diff options
467 files changed, 7830 insertions, 8612 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index ce780ef648f1..ce5d2c038cf5 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -199,7 +199,7 @@ The rationale is: | |||
199 | modifications are prevented | 199 | modifications are prevented |
200 | - saves the compiler work to optimize redundant code away ;) | 200 | - saves the compiler work to optimize redundant code away ;) |
201 | 201 | ||
202 | int fun(int ) | 202 | int fun(int a) |
203 | { | 203 | { |
204 | int result = 0; | 204 | int result = 0; |
205 | char *buffer = kmalloc(SIZE); | 205 | char *buffer = kmalloc(SIZE); |
diff --git a/Documentation/DocBook/.gitignore b/Documentation/DocBook/.gitignore new file mode 100644 index 000000000000..c102c02ecf89 --- /dev/null +++ b/Documentation/DocBook/.gitignore | |||
@@ -0,0 +1,6 @@ | |||
1 | *.xml | ||
2 | *.ps | ||
3 | |||
4 | *.html | ||
5 | *.9.gz | ||
6 | *.9 | ||
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl index 3c47a3f0dc55..8c9c6704e85b 100644 --- a/Documentation/DocBook/kernel-api.tmpl +++ b/Documentation/DocBook/kernel-api.tmpl | |||
@@ -54,6 +54,11 @@ | |||
54 | !Ekernel/sched.c | 54 | !Ekernel/sched.c |
55 | !Ekernel/timer.c | 55 | !Ekernel/timer.c |
56 | </sect1> | 56 | </sect1> |
57 | <sect1><title>High-resolution timers</title> | ||
58 | !Iinclude/linux/ktime.h | ||
59 | !Iinclude/linux/hrtimer.h | ||
60 | !Ekernel/hrtimer.c | ||
61 | </sect1> | ||
57 | <sect1><title>Internal Functions</title> | 62 | <sect1><title>Internal Functions</title> |
58 | !Ikernel/exit.c | 63 | !Ikernel/exit.c |
59 | !Ikernel/signal.c | 64 | !Ikernel/signal.c |
diff --git a/Documentation/applying-patches.txt b/Documentation/applying-patches.txt index 05a08c2c1889..a083ba35d1ad 100644 --- a/Documentation/applying-patches.txt +++ b/Documentation/applying-patches.txt | |||
@@ -3,8 +3,7 @@ | |||
3 | ------------------------------------ | 3 | ------------------------------------ |
4 | 4 | ||
5 | Original by: Jesper Juhl, August 2005 | 5 | Original by: Jesper Juhl, August 2005 |
6 | Last update: 2005-12-02 | 6 | Last update: 2006-01-05 |
7 | |||
8 | 7 | ||
9 | 8 | ||
10 | A frequently asked question on the Linux Kernel Mailing List is how to apply | 9 | A frequently asked question on the Linux Kernel Mailing List is how to apply |
@@ -77,7 +76,7 @@ instead: | |||
77 | 76 | ||
78 | If you wish to uncompress the patch file by hand first before applying it | 77 | If you wish to uncompress the patch file by hand first before applying it |
79 | (what I assume you've done in the examples below), then you simply run | 78 | (what I assume you've done in the examples below), then you simply run |
80 | gunzip or bunzip2 on the file - like this: | 79 | gunzip or bunzip2 on the file -- like this: |
81 | gunzip patch-x.y.z.gz | 80 | gunzip patch-x.y.z.gz |
82 | bunzip2 patch-x.y.z.bz2 | 81 | bunzip2 patch-x.y.z.bz2 |
83 | 82 | ||
@@ -95,7 +94,7 @@ Common errors when patching | |||
95 | --- | 94 | --- |
96 | When patch applies a patch file it attempts to verify the sanity of the | 95 | When patch applies a patch file it attempts to verify the sanity of the |
97 | file in different ways. | 96 | file in different ways. |
98 | Checking that the file looks like a valid patch file, checking the code | 97 | Checking that the file looks like a valid patch file & checking the code |
99 | around the bits being modified matches the context provided in the patch are | 98 | around the bits being modified matches the context provided in the patch are |
100 | just two of the basic sanity checks patch does. | 99 | just two of the basic sanity checks patch does. |
101 | 100 | ||
@@ -122,7 +121,7 @@ outright and leaves a file with a .rej extension (a reject file). You can | |||
122 | read this file to see exactly what change couldn't be applied, so you can | 121 | read this file to see exactly what change couldn't be applied, so you can |
123 | go fix it up by hand if you wish. | 122 | go fix it up by hand if you wish. |
124 | 123 | ||
125 | If you don't have any third party patches applied to your kernel source, but | 124 | If you don't have any third-party patches applied to your kernel source, but |
126 | only patches from kernel.org and you apply the patches in the correct order, | 125 | only patches from kernel.org and you apply the patches in the correct order, |
127 | and have made no modifications yourself to the source files, then you should | 126 | and have made no modifications yourself to the source files, then you should |
128 | never see a fuzz or reject message from patch. If you do see such messages | 127 | never see a fuzz or reject message from patch. If you do see such messages |
@@ -137,7 +136,7 @@ If patch stops and presents a "File to patch:" prompt, then patch could not | |||
137 | find a file to be patched. Most likely you forgot to specify -p1 or you are | 136 | find a file to be patched. Most likely you forgot to specify -p1 or you are |
138 | in the wrong directory. Less often, you'll find patches that need to be | 137 | in the wrong directory. Less often, you'll find patches that need to be |
139 | applied with -p0 instead of -p1 (reading the patch file should reveal if | 138 | applied with -p0 instead of -p1 (reading the patch file should reveal if |
140 | this is the case - if so, then this is an error by the person who created | 139 | this is the case -- if so, then this is an error by the person who created |
141 | the patch but is not fatal). | 140 | the patch but is not fatal). |
142 | 141 | ||
143 | If you get "Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines)." or a | 142 | If you get "Hunk #2 succeeded at 1887 with fuzz 2 (offset 7 lines)." or a |
@@ -168,13 +167,17 @@ the patch will in fact apply it. | |||
168 | 167 | ||
169 | A message similar to "patch: **** unexpected end of file in patch" or "patch | 168 | A message similar to "patch: **** unexpected end of file in patch" or "patch |
170 | unexpectedly ends in middle of line" means that patch could make no sense of | 169 | unexpectedly ends in middle of line" means that patch could make no sense of |
171 | the file you fed to it. Either your download is broken or you tried to feed | 170 | the file you fed to it. Either your download is broken, you tried to feed |
172 | patch a compressed patch file without uncompressing it first. | 171 | patch a compressed patch file without uncompressing it first, or the patch |
172 | file that you are using has been mangled by a mail client or mail transfer | ||
173 | agent along the way somewhere, e.g., by splitting a long line into two lines. | ||
174 | Often these warnings can easily be fixed by joining (concatenating) the | ||
175 | two lines that had been split. | ||
173 | 176 | ||
174 | As I already mentioned above, these errors should never happen if you apply | 177 | As I already mentioned above, these errors should never happen if you apply |
175 | a patch from kernel.org to the correct version of an unmodified source tree. | 178 | a patch from kernel.org to the correct version of an unmodified source tree. |
176 | So if you get these errors with kernel.org patches then you should probably | 179 | So if you get these errors with kernel.org patches then you should probably |
177 | assume that either your patch file or your tree is broken and I'd advice you | 180 | assume that either your patch file or your tree is broken and I'd advise you |
178 | to start over with a fresh download of a full kernel tree and the patch you | 181 | to start over with a fresh download of a full kernel tree and the patch you |
179 | wish to apply. | 182 | wish to apply. |
180 | 183 | ||
@@ -200,10 +203,10 @@ do the additional steps since interdiff can get things wrong in some cases. | |||
200 | Another alternative is `ketchup', which is a python script for automatic | 203 | Another alternative is `ketchup', which is a python script for automatic |
201 | downloading and applying of patches (http://www.selenic.com/ketchup/). | 204 | downloading and applying of patches (http://www.selenic.com/ketchup/). |
202 | 205 | ||
203 | Other nice tools are diffstat which shows a summary of changes made by a | 206 | Other nice tools are diffstat, which shows a summary of changes made by a |
204 | patch, lsdiff which displays a short listing of affected files in a patch | 207 | patch; lsdiff, which displays a short listing of affected files in a patch |
205 | file, along with (optionally) the line numbers of the start of each patch | 208 | file, along with (optionally) the line numbers of the start of each patch; |
206 | and grepdiff which displays a list of the files modified by a patch where | 209 | and grepdiff, which displays a list of the files modified by a patch where |
207 | the patch contains a given regular expression. | 210 | the patch contains a given regular expression. |
208 | 211 | ||
209 | 212 | ||
@@ -228,8 +231,8 @@ The -mm kernels live at | |||
228 | In place of ftp.kernel.org you can use ftp.cc.kernel.org, where cc is a | 231 | In place of ftp.kernel.org you can use ftp.cc.kernel.org, where cc is a |
229 | country code. This way you'll be downloading from a mirror site that's most | 232 | country code. This way you'll be downloading from a mirror site that's most |
230 | likely geographically closer to you, resulting in faster downloads for you, | 233 | likely geographically closer to you, resulting in faster downloads for you, |
231 | less bandwidth used globally and less load on the main kernel.org servers - | 234 | less bandwidth used globally and less load on the main kernel.org servers -- |
232 | these are good things, do use mirrors when possible. | 235 | these are good things, so do use mirrors when possible. |
233 | 236 | ||
234 | 237 | ||
235 | The 2.6.x kernels | 238 | The 2.6.x kernels |
@@ -237,14 +240,14 @@ The 2.6.x kernels | |||
237 | These are the base stable releases released by Linus. The highest numbered | 240 | These are the base stable releases released by Linus. The highest numbered |
238 | release is the most recent. | 241 | release is the most recent. |
239 | 242 | ||
240 | If regressions or other serious flaws are found then a -stable fix patch | 243 | If regressions or other serious flaws are found, then a -stable fix patch |
241 | will be released (see below) on top of this base. Once a new 2.6.x base | 244 | will be released (see below) on top of this base. Once a new 2.6.x base |
242 | kernel is released, a patch is made available that is a delta between the | 245 | kernel is released, a patch is made available that is a delta between the |
243 | previous 2.6.x kernel and the new one. | 246 | previous 2.6.x kernel and the new one. |
244 | 247 | ||
245 | To apply a patch moving from 2.6.11 to 2.6.12 you'd do the following (note | 248 | To apply a patch moving from 2.6.11 to 2.6.12, you'd do the following (note |
246 | that such patches do *NOT* apply on top of 2.6.x.y kernels but on top of the | 249 | that such patches do *NOT* apply on top of 2.6.x.y kernels but on top of the |
247 | base 2.6.x kernel - if you need to move from 2.6.x.y to 2.6.x+1 you need to | 250 | base 2.6.x kernel -- if you need to move from 2.6.x.y to 2.6.x+1 you need to |
248 | first revert the 2.6.x.y patch). | 251 | first revert the 2.6.x.y patch). |
249 | 252 | ||
250 | Here are some examples: | 253 | Here are some examples: |
@@ -266,7 +269,7 @@ $ mv linux-2.6.11.1 linux-2.6.12 # rename source dir | |||
266 | 269 | ||
267 | The 2.6.x.y kernels | 270 | The 2.6.x.y kernels |
268 | --- | 271 | --- |
269 | Kernels with 4 digit versions are -stable kernels. They contain small(ish) | 272 | Kernels with 4-digit versions are -stable kernels. They contain small(ish) |
270 | critical fixes for security problems or significant regressions discovered | 273 | critical fixes for security problems or significant regressions discovered |
271 | in a given 2.6.x kernel. | 274 | in a given 2.6.x kernel. |
272 | 275 | ||
@@ -277,9 +280,14 @@ versions. | |||
277 | If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is | 280 | If no 2.6.x.y kernel is available, then the highest numbered 2.6.x kernel is |
278 | the current stable kernel. | 281 | the current stable kernel. |
279 | 282 | ||
283 | note: the -stable team usually do make incremental patches available as well | ||
284 | as patches against the latest mainline release, but I only cover the | ||
285 | non-incremental ones below. The incremental ones can be found at | ||
286 | ftp://ftp.kernel.org/pub/linux/kernel/v2.6/incr/ | ||
287 | |||
280 | These patches are not incremental, meaning that for example the 2.6.12.3 | 288 | These patches are not incremental, meaning that for example the 2.6.12.3 |
281 | patch does not apply on top of the 2.6.12.2 kernel source, but rather on top | 289 | patch does not apply on top of the 2.6.12.2 kernel source, but rather on top |
282 | of the base 2.6.12 kernel source. | 290 | of the base 2.6.12 kernel source . |
283 | So, in order to apply the 2.6.12.3 patch to your existing 2.6.12.2 kernel | 291 | So, in order to apply the 2.6.12.3 patch to your existing 2.6.12.2 kernel |
284 | source you have to first back out the 2.6.12.2 patch (so you are left with a | 292 | source you have to first back out the 2.6.12.2 patch (so you are left with a |
285 | base 2.6.12 kernel source) and then apply the new 2.6.12.3 patch. | 293 | base 2.6.12 kernel source) and then apply the new 2.6.12.3 patch. |
@@ -345,12 +353,12 @@ The -git kernels | |||
345 | repository, hence the name). | 353 | repository, hence the name). |
346 | 354 | ||
347 | These patches are usually released daily and represent the current state of | 355 | These patches are usually released daily and represent the current state of |
348 | Linus' tree. They are more experimental than -rc kernels since they are | 356 | Linus's tree. They are more experimental than -rc kernels since they are |
349 | generated automatically without even a cursory glance to see if they are | 357 | generated automatically without even a cursory glance to see if they are |
350 | sane. | 358 | sane. |
351 | 359 | ||
352 | -git patches are not incremental and apply either to a base 2.6.x kernel or | 360 | -git patches are not incremental and apply either to a base 2.6.x kernel or |
353 | a base 2.6.x-rc kernel - you can see which from their name. | 361 | a base 2.6.x-rc kernel -- you can see which from their name. |
354 | A patch named 2.6.12-git1 applies to the 2.6.12 kernel source and a patch | 362 | A patch named 2.6.12-git1 applies to the 2.6.12 kernel source and a patch |
355 | named 2.6.13-rc3-git2 applies to the source of the 2.6.13-rc3 kernel. | 363 | named 2.6.13-rc3-git2 applies to the source of the 2.6.13-rc3 kernel. |
356 | 364 | ||
@@ -393,12 +401,12 @@ You should generally strive to get your patches into mainline via -mm to | |||
393 | ensure maximum testing. | 401 | ensure maximum testing. |
394 | 402 | ||
395 | This branch is in constant flux and contains many experimental features, a | 403 | This branch is in constant flux and contains many experimental features, a |
396 | lot of debugging patches not appropriate for mainline etc and is the most | 404 | lot of debugging patches not appropriate for mainline etc., and is the most |
397 | experimental of the branches described in this document. | 405 | experimental of the branches described in this document. |
398 | 406 | ||
399 | These kernels are not appropriate for use on systems that are supposed to be | 407 | These kernels are not appropriate for use on systems that are supposed to be |
400 | stable and they are more risky to run than any of the other branches (make | 408 | stable and they are more risky to run than any of the other branches (make |
401 | sure you have up-to-date backups - that goes for any experimental kernel but | 409 | sure you have up-to-date backups -- that goes for any experimental kernel but |
402 | even more so for -mm kernels). | 410 | even more so for -mm kernels). |
403 | 411 | ||
404 | These kernels in addition to all the other experimental patches they contain | 412 | These kernels in addition to all the other experimental patches they contain |
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt index 22e4040564d5..f4d0de6bac63 100644 --- a/Documentation/filesystems/ext3.txt +++ b/Documentation/filesystems/ext3.txt | |||
@@ -2,11 +2,11 @@ | |||
2 | Ext3 Filesystem | 2 | Ext3 Filesystem |
3 | =============== | 3 | =============== |
4 | 4 | ||
5 | ext3 was originally released in September 1999. Written by Stephen Tweedie | 5 | Ext3 was originally released in September 1999. Written by Stephen Tweedie |
6 | for 2.2 branch, and ported to 2.4 kernels by Peter Braam, Andreas Dilger, | 6 | for the 2.2 branch, and ported to 2.4 kernels by Peter Braam, Andreas Dilger, |
7 | Andrew Morton, Alexander Viro, Ted Ts'o and Stephen Tweedie. | 7 | Andrew Morton, Alexander Viro, Ted Ts'o and Stephen Tweedie. |
8 | 8 | ||
9 | ext3 is ext2 filesystem enhanced with journalling capabilities. | 9 | Ext3 is the ext2 filesystem enhanced with journalling capabilities. |
10 | 10 | ||
11 | Options | 11 | Options |
12 | ======= | 12 | ======= |
@@ -14,69 +14,71 @@ Options | |||
14 | When mounting an ext3 filesystem, the following option are accepted: | 14 | When mounting an ext3 filesystem, the following option are accepted: |
15 | (*) == default | 15 | (*) == default |
16 | 16 | ||
17 | jounal=update Update the ext3 file system's journal to the | 17 | journal=update Update the ext3 file system's journal to the current |
18 | current format. | 18 | format. |
19 | 19 | ||
20 | journal=inum When a journal already exists, this option is | 20 | journal=inum When a journal already exists, this option is ignored. |
21 | ignored. Otherwise, it specifies the number of | 21 | Otherwise, it specifies the number of the inode which |
22 | the inode which will represent the ext3 file | 22 | will represent the ext3 file system's journal file. |
23 | system's journal file. | ||
24 | 23 | ||
25 | journal_dev=devnum When the external journal device's major/minor numbers | 24 | journal_dev=devnum When the external journal device's major/minor numbers |
26 | have changed, this option allows to specify the new | 25 | have changed, this option allows the user to specify |
27 | journal location. The journal device is identified | 26 | the new journal location. The journal device is |
28 | through its new major/minor numbers encoded in devnum. | 27 | identified through its new major/minor numbers encoded |
28 | in devnum. | ||
29 | 29 | ||
30 | noload Don't load the journal on mounting. | 30 | noload Don't load the journal on mounting. |
31 | 31 | ||
32 | data=journal All data are committed into the journal prior | 32 | data=journal All data are committed into the journal prior to being |
33 | to being written into the main file system. | 33 | written into the main file system. |
34 | 34 | ||
35 | data=ordered (*) All data are forced directly out to the main file | 35 | data=ordered (*) All data are forced directly out to the main file |
36 | system prior to its metadata being committed to | 36 | system prior to its metadata being committed to the |
37 | the journal. | 37 | journal. |
38 | 38 | ||
39 | data=writeback Data ordering is not preserved, data may be | 39 | data=writeback Data ordering is not preserved, data may be written |
40 | written into the main file system after its | 40 | into the main file system after its metadata has been |
41 | metadata has been committed to the journal. | 41 | committed to the journal. |
42 | 42 | ||
43 | commit=nrsec (*) Ext3 can be told to sync all its data and metadata | 43 | commit=nrsec (*) Ext3 can be told to sync all its data and metadata |
44 | every 'nrsec' seconds. The default value is 5 seconds. | 44 | every 'nrsec' seconds. The default value is 5 seconds. |
45 | This means that if you lose your power, you will lose, | 45 | This means that if you lose your power, you will lose |
46 | as much, the latest 5 seconds of work (your filesystem | 46 | as much as the latest 5 seconds of work (your |
47 | will not be damaged though, thanks to journaling). This | 47 | filesystem will not be damaged though, thanks to the |
48 | default value (or any low value) will hurt performance, | 48 | journaling). This default value (or any low value) |
49 | but it's good for data-safety. Setting it to 0 will | 49 | will hurt performance, but it's good for data-safety. |
50 | have the same effect than leaving the default 5 sec. | 50 | Setting it to 0 will have the same effect as leaving |
51 | it at the default (5 seconds). | ||
51 | Setting it to very large values will improve | 52 | Setting it to very large values will improve |
52 | performance. | 53 | performance. |
53 | 54 | ||
54 | barrier=1 This enables/disables barriers. barrier=0 disables it, | 55 | barrier=1 This enables/disables barriers. barrier=0 disables |
55 | barrier=1 enables it. | 56 | it, barrier=1 enables it. |
56 | 57 | ||
57 | orlov (*) This enables the new Orlov block allocator. It's enabled | 58 | orlov (*) This enables the new Orlov block allocator. It is |
58 | by default. | 59 | enabled by default. |
59 | 60 | ||
60 | oldalloc This disables the Orlov block allocator and enables the | 61 | oldalloc This disables the Orlov block allocator and enables |
61 | old block allocator. Orlov should have better performance, | 62 | the old block allocator. Orlov should have better |
62 | we'd like to get some feedback if it's the contrary for | 63 | performance - we'd like to get some feedback if it's |
63 | you. | 64 | the contrary for you. |
64 | 65 | ||
65 | user_xattr Enables Extended User Attributes. Additionally, you need | 66 | user_xattr Enables Extended User Attributes. Additionally, you |
66 | to have extended attribute support enabled in the kernel | 67 | need to have extended attribute support enabled in the |
67 | configuration (CONFIG_EXT3_FS_XATTR). See the attr(5) | 68 | kernel configuration (CONFIG_EXT3_FS_XATTR). See the |
68 | manual page and http://acl.bestbits.at to learn more | 69 | attr(5) manual page and http://acl.bestbits.at/ to |
69 | about extended attributes. | 70 | learn more about extended attributes. |
70 | 71 | ||
71 | nouser_xattr Disables Extended User Attributes. | 72 | nouser_xattr Disables Extended User Attributes. |
72 | 73 | ||
73 | acl Enables POSIX Access Control Lists support. Additionally, | 74 | acl Enables POSIX Access Control Lists support. |
74 | you need to have ACL support enabled in the kernel | 75 | Additionally, you need to have ACL support enabled in |
75 | configuration (CONFIG_EXT3_FS_POSIX_ACL). See the acl(5) | 76 | the kernel configuration (CONFIG_EXT3_FS_POSIX_ACL). |
76 | manual page and http://acl.bestbits.at for more | 77 | See the acl(5) manual page and http://acl.bestbits.at/ |
77 | information. | 78 | for more information. |
78 | 79 | ||
79 | noacl This option disables POSIX Access Control List support. | 80 | noacl This option disables POSIX Access Control List |
81 | support. | ||
80 | 82 | ||
81 | reservation | 83 | reservation |
82 | 84 | ||
@@ -88,7 +90,7 @@ bsddf (*) Make 'df' act like BSD. | |||
88 | minixdf Make 'df' act like Minix. | 90 | minixdf Make 'df' act like Minix. |
89 | 91 | ||
90 | check=none Don't do extra checking of bitmaps on mount. | 92 | check=none Don't do extra checking of bitmaps on mount. |
91 | nocheck | 93 | nocheck |
92 | 94 | ||
93 | debug Extra debugging information is sent to syslog. | 95 | debug Extra debugging information is sent to syslog. |
94 | 96 | ||
@@ -97,7 +99,7 @@ errors=continue Keep going on a filesystem error. | |||
97 | errors=panic Panic and halt the machine if an error occurs. | 99 | errors=panic Panic and halt the machine if an error occurs. |
98 | 100 | ||
99 | grpid Give objects the same group ID as their creator. | 101 | grpid Give objects the same group ID as their creator. |
100 | bsdgroups | 102 | bsdgroups |
101 | 103 | ||
102 | nogrpid (*) New objects have the group ID of their creator. | 104 | nogrpid (*) New objects have the group ID of their creator. |
103 | sysvgroups | 105 | sysvgroups |
@@ -108,81 +110,81 @@ resuid=n The user ID which may use the reserved blocks. | |||
108 | 110 | ||
109 | sb=n Use alternate superblock at this location. | 111 | sb=n Use alternate superblock at this location. |
110 | 112 | ||
111 | quota Quota options are currently silently ignored. | 113 | quota |
112 | noquota (see fs/ext3/super.c, line 594) | 114 | noquota |
113 | grpquota | 115 | grpquota |
114 | usrquota | 116 | usrquota |
115 | 117 | ||
116 | 118 | ||
117 | Specification | 119 | Specification |
118 | ============= | 120 | ============= |
119 | ext3 shares all disk implementation with ext2 filesystem, and add | 121 | Ext3 shares all disk implementation with the ext2 filesystem, and adds |
120 | transactions capabilities to ext2. Journaling is done by the | 122 | transactions capabilities to ext2. Journaling is done by the Journaling Block |
121 | Journaling block device layer. | 123 | Device layer. |
122 | 124 | ||
123 | Journaling Block Device layer | 125 | Journaling Block Device layer |
124 | ----------------------------- | 126 | ----------------------------- |
125 | The Journaling Block Device layer (JBD) isn't ext3 specific. It was | 127 | The Journaling Block Device layer (JBD) isn't ext3 specific. It was design to |
126 | design to add journaling capabilities on a block device. The ext3 | 128 | add journaling capabilities on a block device. The ext3 filesystem code will |
127 | filesystem code will inform the JBD of modifications it is performing | 129 | inform the JBD of modifications it is performing (called a transaction). The |
128 | (Call a transaction). the journal support the transactions start and | 130 | journal supports the transactions start and stop, and in case of crash, the |
129 | stop, and in case of crash, the journal can replayed the transactions | 131 | journal can replayed the transactions to put the partition back in a |
130 | to put the partition on a consistent state fastly. | 132 | consistent state fast. |
131 | 133 | ||
132 | handles represent a single atomic update to a filesystem. JBD can | 134 | Handles represent a single atomic update to a filesystem. JBD can handle an |
133 | handle external journal on a block device. | 135 | external journal on a block device. |
134 | 136 | ||
135 | Data Mode | 137 | Data Mode |
136 | --------- | 138 | --------- |
137 | There's 3 different data modes: | 139 | There are 3 different data modes: |
138 | 140 | ||
139 | * writeback mode | 141 | * writeback mode |
140 | In data=writeback mode, ext3 does not journal data at all. This mode | 142 | In data=writeback mode, ext3 does not journal data at all. This mode provides |
141 | provides a similar level of journaling as XFS, JFS, and ReiserFS in its | 143 | a similar level of journaling as that of XFS, JFS, and ReiserFS in its default |
142 | default mode - metadata journaling. A crash+recovery can cause | 144 | mode - metadata journaling. A crash+recovery can cause incorrect data to |
143 | incorrect data to appear in files which were written shortly before the | 145 | appear in files which were written shortly before the crash. This mode will |
144 | crash. This mode will typically provide the best ext3 performance. | 146 | typically provide the best ext3 performance. |
145 | 147 | ||
146 | * ordered mode | 148 | * ordered mode |
147 | In data=ordered mode, ext3 only officially journals metadata, but it | 149 | In data=ordered mode, ext3 only officially journals metadata, but it logically |
148 | logically groups metadata and data blocks into a single unit called a | 150 | groups metadata and data blocks into a single unit called a transaction. When |
149 | transaction. When it's time to write the new metadata out to disk, the | 151 | it's time to write the new metadata out to disk, the associated data blocks |
150 | associated data blocks are written first. In general, this mode | 152 | are written first. In general, this mode performs slightly slower than |
151 | perform slightly slower than writeback but significantly faster than | 153 | writeback but significantly faster than journal mode. |
152 | journal mode. | ||
153 | 154 | ||
154 | * journal mode | 155 | * journal mode |
155 | data=journal mode provides full data and metadata journaling. All new | 156 | data=journal mode provides full data and metadata journaling. All new data is |
156 | data is written to the journal first, and then to its final location. | 157 | written to the journal first, and then to its final location. |
157 | In the event of a crash, the journal can be replayed, bringing both | 158 | In the event of a crash, the journal can be replayed, bringing both data and |
158 | data and metadata into a consistent state. This mode is the slowest | 159 | metadata into a consistent state. This mode is the slowest except when data |
159 | except when data needs to be read from and written to disk at the same | 160 | needs to be read from and written to disk at the same time where it |
160 | time where it outperform all others mode. | 161 | outperforms all others modes. |
161 | 162 | ||
162 | Compatibility | 163 | Compatibility |
163 | ------------- | 164 | ------------- |
164 | 165 | ||
165 | Ext2 partitions can be easily convert to ext3, with `tune2fs -j <dev>`. | 166 | Ext2 partitions can be easily convert to ext3, with `tune2fs -j <dev>`. |
166 | Ext3 is fully compatible with Ext2. Ext3 partitions can easily be | 167 | Ext3 is fully compatible with Ext2. Ext3 partitions can easily be mounted as |
167 | mounted as Ext2. | 168 | Ext2. |
169 | |||
168 | 170 | ||
169 | External Tools | 171 | External Tools |
170 | ============== | 172 | ============== |
171 | see manual pages to know more. | 173 | See manual pages to learn more. |
174 | |||
175 | tune2fs: create a ext3 journal on a ext2 partition with the -j flag. | ||
176 | mke2fs: create a ext3 partition with the -j flag. | ||
177 | debugfs: ext2 and ext3 file system debugger. | ||
172 | 178 | ||
173 | tune2fs: create a ext3 journal on a ext2 partition with the -j flags | ||
174 | mke2fs: create a ext3 partition with the -j flags | ||
175 | debugfs: ext2 and ext3 file system debugger | ||
176 | 179 | ||
177 | References | 180 | References |
178 | ========== | 181 | ========== |
179 | 182 | ||
180 | kernel source: file:/usr/src/linux/fs/ext3 | 183 | kernel source: <file:fs/ext3/> |
181 | file:/usr/src/linux/fs/jbd | 184 | <file:fs/jbd/> |
182 | 185 | ||
183 | programs: http://e2fsprogs.sourceforge.net | 186 | programs: http://e2fsprogs.sourceforge.net/ |
184 | 187 | ||
185 | useful link: | 188 | useful links: http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html |
186 | http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html | ||
187 | http://www-106.ibm.com/developerworks/linux/library/l-fs7/ | 189 | http://www-106.ibm.com/developerworks/linux/library/l-fs7/ |
188 | http://www-106.ibm.com/developerworks/linux/library/l-fs8/ | 190 | http://www-106.ibm.com/developerworks/linux/library/l-fs8/ |
diff --git a/Documentation/hrtimers.txt b/Documentation/hrtimers.txt new file mode 100644 index 000000000000..7620ff735faf --- /dev/null +++ b/Documentation/hrtimers.txt | |||
@@ -0,0 +1,178 @@ | |||
1 | |||
2 | hrtimers - subsystem for high-resolution kernel timers | ||
3 | ---------------------------------------------------- | ||
4 | |||
5 | This patch introduces a new subsystem for high-resolution kernel timers. | ||
6 | |||
7 | One might ask the question: we already have a timer subsystem | ||
8 | (kernel/timers.c), why do we need two timer subsystems? After a lot of | ||
9 | back and forth trying to integrate high-resolution and high-precision | ||
10 | features into the existing timer framework, and after testing various | ||
11 | such high-resolution timer implementations in practice, we came to the | ||
12 | conclusion that the timer wheel code is fundamentally not suitable for | ||
13 | such an approach. We initially didnt believe this ('there must be a way | ||
14 | to solve this'), and spent a considerable effort trying to integrate | ||
15 | things into the timer wheel, but we failed. In hindsight, there are | ||
16 | several reasons why such integration is hard/impossible: | ||
17 | |||
18 | - the forced handling of low-resolution and high-resolution timers in | ||
19 | the same way leads to a lot of compromises, macro magic and #ifdef | ||
20 | mess. The timers.c code is very "tightly coded" around jiffies and | ||
21 | 32-bitness assumptions, and has been honed and micro-optimized for a | ||
22 | relatively narrow use case (jiffies in a relatively narrow HZ range) | ||
23 | for many years - and thus even small extensions to it easily break | ||
24 | the wheel concept, leading to even worse compromises. The timer wheel | ||
25 | code is very good and tight code, there's zero problems with it in its | ||
26 | current usage - but it is simply not suitable to be extended for | ||
27 | high-res timers. | ||
28 | |||
29 | - the unpredictable [O(N)] overhead of cascading leads to delays which | ||
30 | necessiate a more complex handling of high resolution timers, which | ||
31 | in turn decreases robustness. Such a design still led to rather large | ||
32 | timing inaccuracies. Cascading is a fundamental property of the timer | ||
33 | wheel concept, it cannot be 'designed out' without unevitably | ||
34 | degrading other portions of the timers.c code in an unacceptable way. | ||
35 | |||
36 | - the implementation of the current posix-timer subsystem on top of | ||
37 | the timer wheel has already introduced a quite complex handling of | ||
38 | the required readjusting of absolute CLOCK_REALTIME timers at | ||
39 | settimeofday or NTP time - further underlying our experience by | ||
40 | example: that the timer wheel data structure is too rigid for high-res | ||
41 | timers. | ||
42 | |||
43 | - the timer wheel code is most optimal for use cases which can be | ||
44 | identified as "timeouts". Such timeouts are usually set up to cover | ||
45 | error conditions in various I/O paths, such as networking and block | ||
46 | I/O. The vast majority of those timers never expire and are rarely | ||
47 | recascaded because the expected correct event arrives in time so they | ||
48 | can be removed from the timer wheel before any further processing of | ||
49 | them becomes necessary. Thus the users of these timeouts can accept | ||
50 | the granularity and precision tradeoffs of the timer wheel, and | ||
51 | largely expect the timer subsystem to have near-zero overhead. | ||
52 | Accurate timing for them is not a core purpose - in fact most of the | ||
53 | timeout values used are ad-hoc. For them it is at most a necessary | ||
54 | evil to guarantee the processing of actual timeout completions | ||
55 | (because most of the timeouts are deleted before completion), which | ||
56 | should thus be as cheap and unintrusive as possible. | ||
57 | |||
58 | The primary users of precision timers are user-space applications that | ||
59 | utilize nanosleep, posix-timers and itimer interfaces. Also, in-kernel | ||
60 | users like drivers and subsystems which require precise timed events | ||
61 | (e.g. multimedia) can benefit from the availability of a seperate | ||
62 | high-resolution timer subsystem as well. | ||
63 | |||
64 | While this subsystem does not offer high-resolution clock sources just | ||
65 | yet, the hrtimer subsystem can be easily extended with high-resolution | ||
66 | clock capabilities, and patches for that exist and are maturing quickly. | ||
67 | The increasing demand for realtime and multimedia applications along | ||
68 | with other potential users for precise timers gives another reason to | ||
69 | separate the "timeout" and "precise timer" subsystems. | ||
70 | |||
71 | Another potential benefit is that such a seperation allows even more | ||
72 | special-purpose optimization of the existing timer wheel for the low | ||
73 | resolution and low precision use cases - once the precision-sensitive | ||
74 | APIs are separated from the timer wheel and are migrated over to | ||
75 | hrtimers. E.g. we could decrease the frequency of the timeout subsystem | ||
76 | from 250 Hz to 100 HZ (or even smaller). | ||
77 | |||
78 | hrtimer subsystem implementation details | ||
79 | ---------------------------------------- | ||
80 | |||
81 | the basic design considerations were: | ||
82 | |||
83 | - simplicity | ||
84 | |||
85 | - data structure not bound to jiffies or any other granularity. All the | ||
86 | kernel logic works at 64-bit nanoseconds resolution - no compromises. | ||
87 | |||
88 | - simplification of existing, timing related kernel code | ||
89 | |||
90 | another basic requirement was the immediate enqueueing and ordering of | ||
91 | timers at activation time. After looking at several possible solutions | ||
92 | such as radix trees and hashes, we chose the red black tree as the basic | ||
93 | data structure. Rbtrees are available as a library in the kernel and are | ||
94 | used in various performance-critical areas of e.g. memory management and | ||
95 | file systems. The rbtree is solely used for time sorted ordering, while | ||
96 | a separate list is used to give the expiry code fast access to the | ||
97 | queued timers, without having to walk the rbtree. | ||
98 | |||
99 | (This seperate list is also useful for later when we'll introduce | ||
100 | high-resolution clocks, where we need seperate pending and expired | ||
101 | queues while keeping the time-order intact.) | ||
102 | |||
103 | Time-ordered enqueueing is not purely for the purposes of | ||
104 | high-resolution clocks though, it also simplifies the handling of | ||
105 | absolute timers based on a low-resolution CLOCK_REALTIME. The existing | ||
106 | implementation needed to keep an extra list of all armed absolute | ||
107 | CLOCK_REALTIME timers along with complex locking. In case of | ||
108 | settimeofday and NTP, all the timers (!) had to be dequeued, the | ||
109 | time-changing code had to fix them up one by one, and all of them had to | ||
110 | be enqueued again. The time-ordered enqueueing and the storage of the | ||
111 | expiry time in absolute time units removes all this complex and poorly | ||
112 | scaling code from the posix-timer implementation - the clock can simply | ||
113 | be set without having to touch the rbtree. This also makes the handling | ||
114 | of posix-timers simpler in general. | ||
115 | |||
116 | The locking and per-CPU behavior of hrtimers was mostly taken from the | ||
117 | existing timer wheel code, as it is mature and well suited. Sharing code | ||
118 | was not really a win, due to the different data structures. Also, the | ||
119 | hrtimer functions now have clearer behavior and clearer names - such as | ||
120 | hrtimer_try_to_cancel() and hrtimer_cancel() [which are roughly | ||
121 | equivalent to del_timer() and del_timer_sync()] - so there's no direct | ||
122 | 1:1 mapping between them on the algorithmical level, and thus no real | ||
123 | potential for code sharing either. | ||
124 | |||
125 | Basic data types: every time value, absolute or relative, is in a | ||
126 | special nanosecond-resolution type: ktime_t. The kernel-internal | ||
127 | representation of ktime_t values and operations is implemented via | ||
128 | macros and inline functions, and can be switched between a "hybrid | ||
129 | union" type and a plain "scalar" 64bit nanoseconds representation (at | ||
130 | compile time). The hybrid union type optimizes time conversions on 32bit | ||
131 | CPUs. This build-time-selectable ktime_t storage format was implemented | ||
132 | to avoid the performance impact of 64-bit multiplications and divisions | ||
133 | on 32bit CPUs. Such operations are frequently necessary to convert | ||
134 | between the storage formats provided by kernel and userspace interfaces | ||
135 | and the internal time format. (See include/linux/ktime.h for further | ||
136 | details.) | ||
137 | |||
138 | hrtimers - rounding of timer values | ||
139 | ----------------------------------- | ||
140 | |||
141 | the hrtimer code will round timer events to lower-resolution clocks | ||
142 | because it has to. Otherwise it will do no artificial rounding at all. | ||
143 | |||
144 | one question is, what resolution value should be returned to the user by | ||
145 | the clock_getres() interface. This will return whatever real resolution | ||
146 | a given clock has - be it low-res, high-res, or artificially-low-res. | ||
147 | |||
148 | hrtimers - testing and verification | ||
149 | ---------------------------------- | ||
150 | |||
151 | We used the high-resolution clock subsystem ontop of hrtimers to verify | ||
152 | the hrtimer implementation details in praxis, and we also ran the posix | ||
153 | timer tests in order to ensure specification compliance. We also ran | ||
154 | tests on low-resolution clocks. | ||
155 | |||
156 | The hrtimer patch converts the following kernel functionality to use | ||
157 | hrtimers: | ||
158 | |||
159 | - nanosleep | ||
160 | - itimers | ||
161 | - posix-timers | ||
162 | |||
163 | The conversion of nanosleep and posix-timers enabled the unification of | ||
164 | nanosleep and clock_nanosleep. | ||
165 | |||
166 | The code was successfully compiled for the following platforms: | ||
167 | |||
168 | i386, x86_64, ARM, PPC, PPC64, IA64 | ||
169 | |||
170 | The code was run-tested on the following platforms: | ||
171 | |||
172 | i386(UP/SMP), x86_64(UP/SMP), ARM, PPC | ||
173 | |||
174 | hrtimers were also integrated into the -rt tree, along with a | ||
175 | hrtimers-based high-resolution clock implementation, so the hrtimers | ||
176 | code got a healthy amount of testing and use in practice. | ||
177 | |||
178 | Thomas Gleixner, Ingo Molnar | ||
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index d802ce88bedc..443230b43e09 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -1033,9 +1033,9 @@ When kbuild executes the following steps are followed (roughly): | |||
1033 | 1033 | ||
1034 | Example: | 1034 | Example: |
1035 | #arch/i386/Makefile | 1035 | #arch/i386/Makefile |
1036 | GCC_VERSION := $(call cc-version) | ||
1037 | cflags-y += $(shell \ | 1036 | cflags-y += $(shell \ |
1038 | if [ $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;) | 1037 | if [ $(call cc-version) -ge 0300 ] ; then \ |
1038 | echo "-mregparm=3"; fi ;) | ||
1039 | 1039 | ||
1040 | In the above example -mregparm=3 is only used for gcc version greater | 1040 | In the above example -mregparm=3 is only used for gcc version greater |
1041 | than or equal to gcc 3.0. | 1041 | than or equal to gcc 3.0. |
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt index 5f08f9ce6046..212cf3c21abf 100644 --- a/Documentation/kdump/kdump.txt +++ b/Documentation/kdump/kdump.txt | |||
@@ -4,10 +4,10 @@ Documentation for kdump - the kexec-based crash dumping solution | |||
4 | DESIGN | 4 | DESIGN |
5 | ====== | 5 | ====== |
6 | 6 | ||
7 | Kdump uses kexec to reboot to a second kernel whenever a dump needs to be taken. | 7 | Kdump uses kexec to reboot to a second kernel whenever a dump needs to be |
8 | This second kernel is booted with very little memory. The first kernel reserves | 8 | taken. This second kernel is booted with very little memory. The first kernel |
9 | the section of memory that the second kernel uses. This ensures that on-going | 9 | reserves the section of memory that the second kernel uses. This ensures that |
10 | DMA from the first kernel does not corrupt the second kernel. | 10 | on-going DMA from the first kernel does not corrupt the second kernel. |
11 | 11 | ||
12 | All the necessary information about Core image is encoded in ELF format and | 12 | All the necessary information about Core image is encoded in ELF format and |
13 | stored in reserved area of memory before crash. Physical address of start of | 13 | stored in reserved area of memory before crash. Physical address of start of |
@@ -35,77 +35,82 @@ In the second kernel, "old memory" can be accessed in two ways. | |||
35 | SETUP | 35 | SETUP |
36 | ===== | 36 | ===== |
37 | 37 | ||
38 | 1) Download http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-1.101.tar.gz | 38 | 1) Download the upstream kexec-tools userspace package from |
39 | and apply http://lse.sourceforge.net/kdump/patches/kexec-tools-1.101-kdump.patch | 39 | http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-1.101.tar.gz. |
40 | and after that build the source. | ||
41 | 40 | ||
42 | 2) Download and build the appropriate (2.6.13-rc1 onwards) vanilla kernel. | 41 | Apply the latest consolidated kdump patch on top of kexec-tools-1.101 |
42 | from http://lse.sourceforge.net/kdump/. This arrangment has been made | ||
43 | till all the userspace patches supporting kdump are integrated with | ||
44 | upstream kexec-tools userspace. | ||
43 | 45 | ||
46 | 2) Download and build the appropriate (2.6.13-rc1 onwards) vanilla kernels. | ||
44 | Two kernels need to be built in order to get this feature working. | 47 | Two kernels need to be built in order to get this feature working. |
48 | Following are the steps to properly configure the two kernels specific | ||
49 | to kexec and kdump features: | ||
45 | 50 | ||
46 | A) First kernel: | 51 | A) First kernel or regular kernel: |
52 | ---------------------------------- | ||
47 | a) Enable "kexec system call" feature (in Processor type and features). | 53 | a) Enable "kexec system call" feature (in Processor type and features). |
48 | CONFIG_KEXEC=y | 54 | CONFIG_KEXEC=y |
49 | b) This kernel's physical load address should be the default value of | 55 | b) Enable "sysfs file system support" (in Pseudo filesystems). |
50 | 0x100000 (0x100000, 1 MB) (in Processor type and features). | 56 | CONFIG_SYSFS=y |
51 | CONFIG_PHYSICAL_START=0x100000 | 57 | c) make |
52 | c) Enable "sysfs file system support" (in Pseudo filesystems). | ||
53 | CONFIG_SYSFS=y | ||
54 | d) Boot into first kernel with the command line parameter "crashkernel=Y@X". | 58 | d) Boot into first kernel with the command line parameter "crashkernel=Y@X". |
55 | Use appropriate values for X and Y. Y denotes how much memory to reserve | 59 | Use appropriate values for X and Y. Y denotes how much memory to reserve |
56 | for the second kernel, and X denotes at what physical address the reserved | 60 | for the second kernel, and X denotes at what physical address the |
57 | memory section starts. For example: "crashkernel=64M@16M". | 61 | reserved memory section starts. For example: "crashkernel=64M@16M". |
58 | 62 | ||
59 | B) Second kernel: | 63 | |
60 | a) Enable "kernel crash dumps" feature (in Processor type and features). | 64 | B) Second kernel or dump capture kernel: |
61 | CONFIG_CRASH_DUMP=y | 65 | --------------------------------------- |
62 | b) Specify a suitable value for "Physical address where the kernel is | 66 | a) For i386 architecture enable Highmem support |
63 | loaded" (in Processor type and features). Typically this value | 67 | CONFIG_HIGHMEM=y |
64 | should be same as X (See option d) above, e.g., 16 MB or 0x1000000. | 68 | b) Enable "kernel crash dumps" feature (under "Processor type and features") |
65 | CONFIG_PHYSICAL_START=0x1000000 | 69 | CONFIG_CRASH_DUMP=y |
66 | c) Enable "/proc/vmcore support" (Optional, in Pseudo filesystems). | 70 | c) Make sure a suitable value for "Physical address where the kernel is |
67 | CONFIG_PROC_VMCORE=y | 71 | loaded" (under "Processor type and features"). By default this value |
68 | d) Disable SMP support and build a UP kernel (Until it is fixed). | 72 | is 0x1000000 (16MB) and it should be same as X (See option d above), |
69 | CONFIG_SMP=n | 73 | e.g., 16 MB or 0x1000000. |
70 | e) Enable "Local APIC support on uniprocessors". | 74 | CONFIG_PHYSICAL_START=0x1000000 |
71 | CONFIG_X86_UP_APIC=y | 75 | d) Enable "/proc/vmcore support" (Optional, under "Pseudo filesystems"). |
72 | f) Enable "IO-APIC support on uniprocessors" | 76 | CONFIG_PROC_VMCORE=y |
73 | CONFIG_X86_UP_IOAPIC=y | 77 | |
74 | 78 | 3) After booting to regular kernel or first kernel, load the second kernel | |
75 | Note: i) Options a) and b) depend upon "Configure standard kernel features | 79 | using the following command: |
76 | (for small systems)" (under General setup). | ||
77 | ii) Option a) also depends on CONFIG_HIGHMEM (under Processor | ||
78 | type and features). | ||
79 | iii) Both option a) and b) are under "Processor type and features". | ||
80 | |||
81 | 3) Boot into the first kernel. You are now ready to try out kexec-based crash | ||
82 | dumps. | ||
83 | |||
84 | 4) Load the second kernel to be booted using: | ||
85 | 80 | ||
86 | kexec -p <second-kernel> --args-linux --elf32-core-headers | 81 | kexec -p <second-kernel> --args-linux --elf32-core-headers |
87 | --append="root=<root-dev> init 1 irqpoll" | 82 | --append="root=<root-dev> init 1 irqpoll maxcpus=1" |
88 | 83 | ||
89 | Note: i) <second-kernel> has to be a vmlinux image. bzImage will not work, | 84 | Notes: |
90 | as of now. | 85 | ====== |
91 | ii) By default ELF headers are stored in ELF64 format. Option | 86 | i) <second-kernel> has to be a vmlinux image ie uncompressed elf image. |
92 | --elf32-core-headers forces generation of ELF32 headers. gdb can | 87 | bzImage will not work, as of now. |
93 | not open ELF64 headers on 32 bit systems. So creating ELF32 | 88 | ii) --args-linux has to be speicfied as if kexec it loading an elf image, |
94 | headers can come handy for users who have got non-PAE systems and | 89 | it needs to know that the arguments supplied are of linux type. |
95 | hence have memory less than 4GB. | 90 | iii) By default ELF headers are stored in ELF64 format to support systems |
96 | iii) Specify "irqpoll" as command line parameter. This reduces driver | 91 | with more than 4GB memory. Option --elf32-core-headers forces generation |
97 | initialization failures in second kernel due to shared interrupts. | 92 | of ELF32 headers. The reason for this option being, as of now gdb can |
98 | iv) <root-dev> needs to be specified in a format corresponding to | 93 | not open vmcore file with ELF64 headers on a 32 bit systems. So ELF32 |
99 | the root device name in the output of mount command. | 94 | headers can be used if one has non-PAE systems and hence memory less |
100 | v) If you have built the drivers required to mount root file | 95 | than 4GB. |
101 | system as modules in <second-kernel>, then, specify | 96 | iv) Specify "irqpoll" as command line parameter. This reduces driver |
102 | --initrd=<initrd-for-second-kernel>. | 97 | initialization failures in second kernel due to shared interrupts. |
103 | 98 | v) <root-dev> needs to be specified in a format corresponding to the root | |
104 | 5) System reboots into the second kernel when a panic occurs. A module can be | 99 | device name in the output of mount command. |
105 | written to force the panic or "ALT-SysRq-c" can be used initiate a crash | 100 | vi) If you have built the drivers required to mount root file system as |
106 | dump for testing purposes. | 101 | modules in <second-kernel>, then, specify |
107 | 102 | --initrd=<initrd-for-second-kernel>. | |
108 | 6) Write out the dump file using | 103 | vii) Specify maxcpus=1 as, if during first kernel run, if panic happens on |
104 | non-boot cpus, second kernel doesn't seem to be boot up all the cpus. | ||
105 | The other option is to always built the second kernel without SMP | ||
106 | support ie CONFIG_SMP=n | ||
107 | |||
108 | 4) After successfully loading the second kernel as above, if a panic occurs | ||
109 | system reboots into the second kernel. A module can be written to force | ||
110 | the panic or "ALT-SysRq-c" can be used initiate a crash dump for testing | ||
111 | purposes. | ||
112 | |||
113 | 5) Once the second kernel has booted, write out the dump file using | ||
109 | 114 | ||
110 | cp /proc/vmcore <dump-file> | 115 | cp /proc/vmcore <dump-file> |
111 | 116 | ||
@@ -119,9 +124,9 @@ SETUP | |||
119 | 124 | ||
120 | Entire memory: dd if=/dev/oldmem of=oldmem.001 | 125 | Entire memory: dd if=/dev/oldmem of=oldmem.001 |
121 | 126 | ||
127 | |||
122 | ANALYSIS | 128 | ANALYSIS |
123 | ======== | 129 | ======== |
124 | |||
125 | Limited analysis can be done using gdb on the dump file copied out of | 130 | Limited analysis can be done using gdb on the dump file copied out of |
126 | /proc/vmcore. Use vmlinux built with -g and run | 131 | /proc/vmcore. Use vmlinux built with -g and run |
127 | 132 | ||
@@ -132,15 +137,19 @@ work fine. | |||
132 | 137 | ||
133 | Note: gdb cannot analyse core files generated in ELF64 format for i386. | 138 | Note: gdb cannot analyse core files generated in ELF64 format for i386. |
134 | 139 | ||
140 | Latest "crash" (crash-4.0-2.18) as available on Dave Anderson's site | ||
141 | http://people.redhat.com/~anderson/ works well with kdump format. | ||
142 | |||
143 | |||
135 | TODO | 144 | TODO |
136 | ==== | 145 | ==== |
137 | |||
138 | 1) Provide a kernel pages filtering mechanism so that core file size is not | 146 | 1) Provide a kernel pages filtering mechanism so that core file size is not |
139 | insane on systems having huge memory banks. | 147 | insane on systems having huge memory banks. |
140 | 2) Modify "crash" tool to make it recognize this dump. | 148 | 2) Relocatable kernel can help in maintaining multiple kernels for crashdump |
149 | and same kernel as the first kernel can be used to capture the dump. | ||
150 | |||
141 | 151 | ||
142 | CONTACT | 152 | CONTACT |
143 | ======= | 153 | ======= |
144 | |||
145 | Vivek Goyal (vgoyal@in.ibm.com) | 154 | Vivek Goyal (vgoyal@in.ibm.com) |
146 | Maneesh Soni (maneesh@in.ibm.com) | 155 | Maneesh Soni (maneesh@in.ibm.com) |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 0dc848bf0b56..dd0bfc291a68 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -475,10 +475,11 @@ running once the system is up. | |||
475 | See Documentation/block/as-iosched.txt and | 475 | See Documentation/block/as-iosched.txt and |
476 | Documentation/block/deadline-iosched.txt for details. | 476 | Documentation/block/deadline-iosched.txt for details. |
477 | 477 | ||
478 | elfcorehdr= [IA-32] | 478 | elfcorehdr= [IA-32, X86_64] |
479 | Specifies physical address of start of kernel core | 479 | Specifies physical address of start of kernel core |
480 | image elf header. | 480 | image elf header. Generally kexec loader will |
481 | See Documentation/kdump.txt for details. | 481 | pass this option to capture kernel. |
482 | See Documentation/kdump/kdump.txt for details. | ||
482 | 483 | ||
483 | enforcing [SELINUX] Set initial enforcing status. | 484 | enforcing [SELINUX] Set initial enforcing status. |
484 | Format: {"0" | "1"} | 485 | Format: {"0" | "1"} |
@@ -832,7 +833,7 @@ running once the system is up. | |||
832 | mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel | 833 | mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel |
833 | memory. | 834 | memory. |
834 | 835 | ||
835 | memmap=exactmap [KNL,IA-32] Enable setting of an exact | 836 | memmap=exactmap [KNL,IA-32,X86_64] Enable setting of an exact |
836 | E820 memory map, as specified by the user. | 837 | E820 memory map, as specified by the user. |
837 | Such memmap=exactmap lines can be constructed based on | 838 | Such memmap=exactmap lines can be constructed based on |
838 | BIOS output or other requirements. See the memmap=nn@ss | 839 | BIOS output or other requirements. See the memmap=nn@ss |
diff --git a/Documentation/locks.txt b/Documentation/locks.txt index ce1be79edfb8..e3b402ef33bd 100644 --- a/Documentation/locks.txt +++ b/Documentation/locks.txt | |||
@@ -65,20 +65,3 @@ The default is to disallow mandatory locking. The intention is that | |||
65 | mandatory locking only be enabled on a local filesystem as the specific need | 65 | mandatory locking only be enabled on a local filesystem as the specific need |
66 | arises. | 66 | arises. |
67 | 67 | ||
68 | Until an updated version of mount(8) becomes available you may have to apply | ||
69 | this patch to the mount sources (based on the version distributed with Rick | ||
70 | Faith's util-linux-2.5 package): | ||
71 | |||
72 | *** mount.c.orig Sat Jun 8 09:14:31 1996 | ||
73 | --- mount.c Sat Jun 8 09:13:02 1996 | ||
74 | *************** | ||
75 | *** 100,105 **** | ||
76 | --- 100,107 ---- | ||
77 | { "noauto", 0, MS_NOAUTO }, /* Can only be mounted explicitly */ | ||
78 | { "user", 0, MS_USER }, /* Allow ordinary user to mount */ | ||
79 | { "nouser", 1, MS_USER }, /* Forbid ordinary user to mount */ | ||
80 | + { "mand", 0, MS_MANDLOCK }, /* Allow mandatory locks on this FS */ | ||
81 | + { "nomand", 1, MS_MANDLOCK }, /* Forbid mandatory locks on this FS */ | ||
82 | /* add new options here */ | ||
83 | #ifdef MS_NOSUB | ||
84 | { "sub", 1, MS_NOSUB }, /* allow submounts */ | ||
diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt index 2c81305090df..e409e5d07486 100644 --- a/Documentation/stable_kernel_rules.txt +++ b/Documentation/stable_kernel_rules.txt | |||
@@ -1,58 +1,56 @@ | |||
1 | Everything you ever wanted to know about Linux 2.6 -stable releases. | 1 | Everything you ever wanted to know about Linux 2.6 -stable releases. |
2 | 2 | ||
3 | Rules on what kind of patches are accepted, and what ones are not, into | 3 | Rules on what kind of patches are accepted, and which ones are not, into the |
4 | the "-stable" tree: | 4 | "-stable" tree: |
5 | 5 | ||
6 | - It must be obviously correct and tested. | 6 | - It must be obviously correct and tested. |
7 | - It can not bigger than 100 lines, with context. | 7 | - It can not be bigger than 100 lines, with context. |
8 | - It must fix only one thing. | 8 | - It must fix only one thing. |
9 | - It must fix a real bug that bothers people (not a, "This could be a | 9 | - It must fix a real bug that bothers people (not a, "This could be a |
10 | problem..." type thing.) | 10 | problem..." type thing). |
11 | - It must fix a problem that causes a build error (but not for things | 11 | - It must fix a problem that causes a build error (but not for things |
12 | marked CONFIG_BROKEN), an oops, a hang, data corruption, a real | 12 | marked CONFIG_BROKEN), an oops, a hang, data corruption, a real |
13 | security issue, or some "oh, that's not good" issue. In short, | 13 | security issue, or some "oh, that's not good" issue. In short, something |
14 | something critical. | 14 | critical. |
15 | - No "theoretical race condition" issues, unless an explanation of how | 15 | - No "theoretical race condition" issues, unless an explanation of how the |
16 | the race can be exploited. | 16 | race can be exploited is also provided. |
17 | - It can not contain any "trivial" fixes in it (spelling changes, | 17 | - It can not contain any "trivial" fixes in it (spelling changes, |
18 | whitespace cleanups, etc.) | 18 | whitespace cleanups, etc). |
19 | - It must be accepted by the relevant subsystem maintainer. | 19 | - It must be accepted by the relevant subsystem maintainer. |
20 | - It must follow Documentation/SubmittingPatches rules. | 20 | - It must follow the Documentation/SubmittingPatches rules. |
21 | 21 | ||
22 | 22 | ||
23 | Procedure for submitting patches to the -stable tree: | 23 | Procedure for submitting patches to the -stable tree: |
24 | 24 | ||
25 | - Send the patch, after verifying that it follows the above rules, to | 25 | - Send the patch, after verifying that it follows the above rules, to |
26 | stable@kernel.org. | 26 | stable@kernel.org. |
27 | - The sender will receive an ack when the patch has been accepted into | 27 | - The sender will receive an ACK when the patch has been accepted into the |
28 | the queue, or a nak if the patch is rejected. This response might | 28 | queue, or a NAK if the patch is rejected. This response might take a few |
29 | take a few days, according to the developer's schedules. | 29 | days, according to the developer's schedules. |
30 | - If accepted, the patch will be added to the -stable queue, for review | 30 | - If accepted, the patch will be added to the -stable queue, for review by |
31 | by other developers. | 31 | other developers. |
32 | - Security patches should not be sent to this alias, but instead to the | 32 | - Security patches should not be sent to this alias, but instead to the |
33 | documented security@kernel.org. | 33 | documented security@kernel.org address. |
34 | 34 | ||
35 | 35 | ||
36 | Review cycle: | 36 | Review cycle: |
37 | 37 | ||
38 | - When the -stable maintainers decide for a review cycle, the patches | 38 | - When the -stable maintainers decide for a review cycle, the patches will be |
39 | will be sent to the review committee, and the maintainer of the | 39 | sent to the review committee, and the maintainer of the affected area of |
40 | affected area of the patch (unless the submitter is the maintainer of | 40 | the patch (unless the submitter is the maintainer of the area) and CC: to |
41 | the area) and CC: to the linux-kernel mailing list. | 41 | the linux-kernel mailing list. |
42 | - The review committee has 48 hours in which to ack or nak the patch. | 42 | - The review committee has 48 hours in which to ACK or NAK the patch. |
43 | - If the patch is rejected by a member of the committee, or linux-kernel | 43 | - If the patch is rejected by a member of the committee, or linux-kernel |
44 | members object to the patch, bringing up issues that the maintainers | 44 | members object to the patch, bringing up issues that the maintainers and |
45 | and members did not realize, the patch will be dropped from the | 45 | members did not realize, the patch will be dropped from the queue. |
46 | queue. | 46 | - At the end of the review cycle, the ACKed patches will be added to the |
47 | - At the end of the review cycle, the acked patches will be added to | 47 | latest -stable release, and a new -stable release will happen. |
48 | the latest -stable release, and a new -stable release will happen. | 48 | - Security patches will be accepted into the -stable tree directly from the |
49 | - Security patches will be accepted into the -stable tree directly from | 49 | security kernel team, and not go through the normal review cycle. |
50 | the security kernel team, and not go through the normal review cycle. | ||
51 | Contact the kernel security team for more details on this procedure. | 50 | Contact the kernel security team for more details on this procedure. |
52 | 51 | ||
53 | 52 | ||
54 | Review committe: | 53 | Review committe: |
55 | 54 | ||
56 | - This will be made up of a number of kernel developers who have | 55 | - This is made up of a number of kernel developers who have volunteered for |
57 | volunteered for this task, and a few that haven't. | 56 | this task, and a few that haven't. |
58 | |||
@@ -22,8 +22,6 @@ sed-$(CONFIG_MIPS) := "/^@@@/s///p" | |||
22 | 22 | ||
23 | quiet_cmd_offsets = GEN $@ | 23 | quiet_cmd_offsets = GEN $@ |
24 | define cmd_offsets | 24 | define cmd_offsets |
25 | mkdir -p $(dir $@); \ | ||
26 | cat $< | \ | ||
27 | (set -e; \ | 25 | (set -e; \ |
28 | echo "#ifndef __ASM_OFFSETS_H__"; \ | 26 | echo "#ifndef __ASM_OFFSETS_H__"; \ |
29 | echo "#define __ASM_OFFSETS_H__"; \ | 27 | echo "#define __ASM_OFFSETS_H__"; \ |
@@ -34,7 +32,7 @@ define cmd_offsets | |||
34 | echo " *"; \ | 32 | echo " *"; \ |
35 | echo " */"; \ | 33 | echo " */"; \ |
36 | echo ""; \ | 34 | echo ""; \ |
37 | sed -ne $(sed-y); \ | 35 | sed -ne $(sed-y) $<; \ |
38 | echo ""; \ | 36 | echo ""; \ |
39 | echo "#endif" ) > $@ | 37 | echo "#endif" ) > $@ |
40 | endef | 38 | endef |
@@ -45,5 +43,6 @@ arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE | |||
45 | $(call if_changed_dep,cc_s_c) | 43 | $(call if_changed_dep,cc_s_c) |
46 | 44 | ||
47 | $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild | 45 | $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild |
46 | $(Q)mkdir -p $(dir $@) | ||
48 | $(call cmd,offsets) | 47 | $(call cmd,offsets) |
49 | 48 | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 07420161e669..090e10b65b09 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -804,6 +804,7 @@ S: Maintained | |||
804 | DOCBOOK FOR DOCUMENTATION | 804 | DOCBOOK FOR DOCUMENTATION |
805 | P: Martin Waitz | 805 | P: Martin Waitz |
806 | M: tali@admingilde.org | 806 | M: tali@admingilde.org |
807 | T: git http://tali.admingilde.org/git/linux-docbook.git | ||
807 | S: Maintained | 808 | S: Maintained |
808 | 809 | ||
809 | DOUBLETALK DRIVER | 810 | DOUBLETALK DRIVER |
@@ -141,24 +141,6 @@ VPATH := $(srctree) | |||
141 | 141 | ||
142 | export srctree objtree VPATH TOPDIR | 142 | export srctree objtree VPATH TOPDIR |
143 | 143 | ||
144 | nullstring := | ||
145 | space := $(nullstring) # end of line | ||
146 | |||
147 | # Take the contents of any files called localversion* and the config | ||
148 | # variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. Be | ||
149 | # careful not to include files twice if building in the source | ||
150 | # directory. LOCALVERSION from the command line override all of this | ||
151 | |||
152 | localver := $(objtree)/localversion* $(srctree)/localversion* | ||
153 | localver := $(sort $(wildcard $(localver))) | ||
154 | # skip backup files (containing '~') | ||
155 | localver := $(foreach f, $(localver), $(if $(findstring ~, $(f)),,$(f))) | ||
156 | |||
157 | LOCALVERSION = $(subst $(space),, \ | ||
158 | $(shell cat /dev/null $(localver)) \ | ||
159 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) | ||
160 | |||
161 | KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION) | ||
162 | 144 | ||
163 | # SUBARCH tells the usermode build what the underlying arch is. That is set | 145 | # SUBARCH tells the usermode build what the underlying arch is. That is set |
164 | # first, and if a usermode build is happening, the "ARCH=um" on the command | 146 | # first, and if a usermode build is happening, the "ARCH=um" on the command |
@@ -353,7 +335,10 @@ CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | |||
353 | -ffreestanding | 335 | -ffreestanding |
354 | AFLAGS := -D__ASSEMBLY__ | 336 | AFLAGS := -D__ASSEMBLY__ |
355 | 337 | ||
356 | export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION LOCALVERSION KERNELRELEASE \ | 338 | # Read KERNELRELEASE from .kernelrelease (if it exists) |
339 | KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) | ||
340 | |||
341 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE \ | ||
357 | ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ | 342 | ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ |
358 | CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ | 343 | CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ |
359 | HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 344 | HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
@@ -551,26 +536,6 @@ export KBUILD_IMAGE ?= vmlinux | |||
551 | # images. Default is /boot, but you can set it to other values | 536 | # images. Default is /boot, but you can set it to other values |
552 | export INSTALL_PATH ?= /boot | 537 | export INSTALL_PATH ?= /boot |
553 | 538 | ||
554 | # If CONFIG_LOCALVERSION_AUTO is set, we automatically perform some tests | ||
555 | # and try to determine if the current source tree is a release tree, of any sort, | ||
556 | # or if is a pure development tree. | ||
557 | # | ||
558 | # A 'release tree' is any tree with a git TAG associated | ||
559 | # with it. The primary goal of this is to make it safe for a native | ||
560 | # git/CVS/SVN user to build a release tree (i.e, 2.6.9) and also to | ||
561 | # continue developing against the current Linus tree, without having the Linus | ||
562 | # tree overwrite the 2.6.9 tree when installed. | ||
563 | # | ||
564 | # Currently, only git is supported. | ||
565 | # Other SCMs can edit scripts/setlocalversion and add the appropriate | ||
566 | # checks as needed. | ||
567 | |||
568 | |||
569 | ifdef CONFIG_LOCALVERSION_AUTO | ||
570 | localversion-auto := $(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree)) | ||
571 | LOCALVERSION := $(LOCALVERSION)$(localversion-auto) | ||
572 | endif | ||
573 | |||
574 | # | 539 | # |
575 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory | 540 | # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory |
576 | # relocations required by build roots. This is not defined in the | 541 | # relocations required by build roots. This is not defined in the |
@@ -782,6 +747,50 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ; | |||
782 | $(vmlinux-dirs): prepare scripts | 747 | $(vmlinux-dirs): prepare scripts |
783 | $(Q)$(MAKE) $(build)=$@ | 748 | $(Q)$(MAKE) $(build)=$@ |
784 | 749 | ||
750 | # Build the kernel release string | ||
751 | # The KERNELRELEASE is stored in a file named .kernelrelease | ||
752 | # to be used when executing for example make install or make modules_install | ||
753 | # | ||
754 | # Take the contents of any files called localversion* and the config | ||
755 | # variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. | ||
756 | # LOCALVERSION from the command line override all of this | ||
757 | |||
758 | nullstring := | ||
759 | space := $(nullstring) # end of line | ||
760 | |||
761 | ___localver = $(objtree)/localversion* $(srctree)/localversion* | ||
762 | __localver = $(sort $(wildcard $(___localver))) | ||
763 | # skip backup files (containing '~') | ||
764 | _localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) | ||
765 | |||
766 | localver = $(subst $(space),, \ | ||
767 | $(shell cat /dev/null $(_localver)) \ | ||
768 | $(patsubst "%",%,$(CONFIG_LOCALVERSION))) | ||
769 | |||
770 | # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called | ||
771 | # and if the SCM is know a tag from the SCM is appended. | ||
772 | # The appended tag is determinded by the SCM used. | ||
773 | # | ||
774 | # Currently, only git is supported. | ||
775 | # Other SCMs can edit scripts/setlocalversion and add the appropriate | ||
776 | # checks as needed. | ||
777 | ifdef CONFIG_LOCALVERSION_AUTO | ||
778 | _localver-auto = $(shell $(CONFIG_SHELL) \ | ||
779 | $(srctree)/scripts/setlocalversion $(srctree)) | ||
780 | localver-auto = $(LOCALVERSION)$(_localver-auto) | ||
781 | endif | ||
782 | |||
783 | localver-full = $(localver)$(localver-auto) | ||
784 | |||
785 | # Store (new) KERNELRELASE string in .kernelrelease | ||
786 | kernelrelease = \ | ||
787 | $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(localver-full) | ||
788 | .kernelrelease: FORCE | ||
789 | $(Q)rm -f .kernelrelease | ||
790 | $(Q)echo $(kernelrelease) > .kernelrelease | ||
791 | $(Q)echo " Building kernel $(kernelrelease)" | ||
792 | |||
793 | |||
785 | # Things we need to do before we recursively start building the kernel | 794 | # Things we need to do before we recursively start building the kernel |
786 | # or the modules are listed in "prepare". | 795 | # or the modules are listed in "prepare". |
787 | # A multi level approach is used. prepareN is processed before prepareN-1. | 796 | # A multi level approach is used. prepareN is processed before prepareN-1. |
@@ -798,8 +807,7 @@ $(vmlinux-dirs): prepare scripts | |||
798 | # and if so do: | 807 | # and if so do: |
799 | # 1) Check that make has not been executed in the kernel src $(srctree) | 808 | # 1) Check that make has not been executed in the kernel src $(srctree) |
800 | # 2) Create the include2 directory, used for the second asm symlink | 809 | # 2) Create the include2 directory, used for the second asm symlink |
801 | 810 | prepare3: .kernelrelease | |
802 | prepare3: | ||
803 | ifneq ($(KBUILD_SRC),) | 811 | ifneq ($(KBUILD_SRC),) |
804 | @echo ' Using $(srctree) as source for kernel' | 812 | @echo ' Using $(srctree) as source for kernel' |
805 | $(Q)if [ -f $(srctree)/.config ]; then \ | 813 | $(Q)if [ -f $(srctree)/.config ]; then \ |
@@ -984,9 +992,9 @@ CLEAN_FILES += vmlinux System.map \ | |||
984 | 992 | ||
985 | # Directories & files removed with 'make mrproper' | 993 | # Directories & files removed with 'make mrproper' |
986 | MRPROPER_DIRS += include/config include2 | 994 | MRPROPER_DIRS += include/config include2 |
987 | MRPROPER_FILES += .config .config.old include/asm .version \ | 995 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ |
988 | include/linux/autoconf.h include/linux/version.h \ | 996 | include/linux/autoconf.h include/linux/version.h \ |
989 | Module.symvers tags TAGS cscope* | 997 | .kernelrelease Module.symvers tags TAGS cscope* |
990 | 998 | ||
991 | # clean - Delete most, but leave enough to build external modules | 999 | # clean - Delete most, but leave enough to build external modules |
992 | # | 1000 | # |
@@ -1072,6 +1080,7 @@ help: | |||
1072 | @echo ' tags/TAGS - Generate tags file for editors' | 1080 | @echo ' tags/TAGS - Generate tags file for editors' |
1073 | @echo ' cscope - Generate cscope index' | 1081 | @echo ' cscope - Generate cscope index' |
1074 | @echo ' kernelrelease - Output the release version string' | 1082 | @echo ' kernelrelease - Output the release version string' |
1083 | @echo ' kernelversion - Output the version stored in Makefile' | ||
1075 | @echo '' | 1084 | @echo '' |
1076 | @echo 'Static analysers' | 1085 | @echo 'Static analysers' |
1077 | @echo ' buildcheck - List dangling references to vmlinux discarded sections' | 1086 | @echo ' buildcheck - List dangling references to vmlinux discarded sections' |
@@ -1293,6 +1302,8 @@ checkstack: | |||
1293 | 1302 | ||
1294 | kernelrelease: | 1303 | kernelrelease: |
1295 | @echo $(KERNELRELEASE) | 1304 | @echo $(KERNELRELEASE) |
1305 | kernelversion: | ||
1306 | @echo $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | ||
1296 | 1307 | ||
1297 | # FIXME Should go into a make.lib or something | 1308 | # FIXME Should go into a make.lib or something |
1298 | # =========================================================================== | 1309 | # =========================================================================== |
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c index f3e98f837784..1898ea79d0e2 100644 --- a/arch/alpha/kernel/alpha_ksyms.c +++ b/arch/alpha/kernel/alpha_ksyms.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <asm/unistd.h> | 40 | #include <asm/unistd.h> |
41 | 41 | ||
42 | extern struct hwrpb_struct *hwrpb; | 42 | extern struct hwrpb_struct *hwrpb; |
43 | extern void dump_thread(struct pt_regs *, struct user *); | ||
44 | extern spinlock_t rtc_lock; | 43 | extern spinlock_t rtc_lock; |
45 | 44 | ||
46 | /* these are C runtime functions with special calling conventions: */ | 45 | /* these are C runtime functions with special calling conventions: */ |
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c index 90752f6d8867..486d7945583d 100644 --- a/arch/alpha/mm/init.c +++ b/arch/alpha/mm/init.c | |||
@@ -7,6 +7,7 @@ | |||
7 | /* 2.3.x zone allocator, 1999 Andrea Arcangeli <andrea@suse.de> */ | 7 | /* 2.3.x zone allocator, 1999 Andrea Arcangeli <andrea@suse.de> */ |
8 | 8 | ||
9 | #include <linux/config.h> | 9 | #include <linux/config.h> |
10 | #include <linux/pagemap.h> | ||
10 | #include <linux/signal.h> | 11 | #include <linux/signal.h> |
11 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
12 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index f5cc21ad0956..a4e5ac77f6df 100644 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c | |||
@@ -64,7 +64,7 @@ static int dma_chan_count; | |||
64 | static spinlock_t dma_chan_lock; | 64 | static spinlock_t dma_chan_lock; |
65 | static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT]; | 65 | static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT]; |
66 | 66 | ||
67 | const static u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = { | 67 | static const u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = { |
68 | INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3, | 68 | INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3, |
69 | INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7, | 69 | INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7, |
70 | INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10, | 70 | INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10, |
diff --git a/arch/arm26/kernel/armksyms.c b/arch/arm26/kernel/armksyms.c index 35514b398e2e..811a6376c624 100644 --- a/arch/arm26/kernel/armksyms.c +++ b/arch/arm26/kernel/armksyms.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <asm/checksum.h> | 35 | #include <asm/checksum.h> |
36 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
37 | 37 | ||
38 | extern void dump_thread(struct pt_regs *, struct user *); | ||
39 | extern int dump_fpu(struct pt_regs *, struct user_fp_struct *); | 38 | extern int dump_fpu(struct pt_regs *, struct user_fp_struct *); |
40 | extern void inswb(unsigned int port, void *to, int len); | 39 | extern void inswb(unsigned int port, void *to, int len); |
41 | extern void outswb(unsigned int port, const void *to, int len); | 40 | extern void outswb(unsigned int port, const void *to, int len); |
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c index 85833d704ebb..de39725da920 100644 --- a/arch/cris/kernel/crisksyms.c +++ b/arch/cris/kernel/crisksyms.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <asm/pgtable.h> | 21 | #include <asm/pgtable.h> |
22 | #include <asm/fasttimer.h> | 22 | #include <asm/fasttimer.h> |
23 | 23 | ||
24 | extern void dump_thread(struct pt_regs *, struct user *); | ||
25 | extern unsigned long get_cmos_time(void); | 24 | extern unsigned long get_cmos_time(void); |
26 | extern void __Udiv(void); | 25 | extern void __Udiv(void); |
27 | extern void __Umod(void); | 26 | extern void __Umod(void); |
@@ -33,7 +32,6 @@ extern void __lshrdi3(void); | |||
33 | extern void iounmap(volatile void * __iomem); | 32 | extern void iounmap(volatile void * __iomem); |
34 | 33 | ||
35 | /* Platform dependent support */ | 34 | /* Platform dependent support */ |
36 | EXPORT_SYMBOL(dump_thread); | ||
37 | EXPORT_SYMBOL(kernel_thread); | 35 | EXPORT_SYMBOL(kernel_thread); |
38 | EXPORT_SYMBOL(get_cmos_time); | 36 | EXPORT_SYMBOL(get_cmos_time); |
39 | EXPORT_SYMBOL(loops_per_usec); | 37 | EXPORT_SYMBOL(loops_per_usec); |
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c index 7c80afb10460..4ab3e87115b6 100644 --- a/arch/cris/kernel/process.c +++ b/arch/cris/kernel/process.c | |||
@@ -257,34 +257,6 @@ void flush_thread(void) | |||
257 | { | 257 | { |
258 | } | 258 | } |
259 | 259 | ||
260 | /* | ||
261 | * fill in the user structure for a core dump.. | ||
262 | */ | ||
263 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
264 | { | ||
265 | #if 0 | ||
266 | int i; | ||
267 | |||
268 | /* changed the size calculations - should hopefully work better. lbt */ | ||
269 | dump->magic = CMAGIC; | ||
270 | dump->start_code = 0; | ||
271 | dump->start_stack = regs->esp & ~(PAGE_SIZE - 1); | ||
272 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
273 | dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
274 | dump->u_dsize -= dump->u_tsize; | ||
275 | dump->u_ssize = 0; | ||
276 | for (i = 0; i < 8; i++) | ||
277 | dump->u_debugreg[i] = current->debugreg[i]; | ||
278 | |||
279 | if (dump->start_stack < TASK_SIZE) | ||
280 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | ||
281 | |||
282 | dump->regs = *regs; | ||
283 | |||
284 | dump->u_fpvalid = dump_fpu (regs, &dump->i387); | ||
285 | #endif | ||
286 | } | ||
287 | |||
288 | /* Fill in the fpu structure for a core dump. */ | 260 | /* Fill in the fpu structure for a core dump. */ |
289 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) | 261 | int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) |
290 | { | 262 | { |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index 61261b78ced7..60a617aff8ba 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -6,10 +6,6 @@ config FRV | |||
6 | bool | 6 | bool |
7 | default y | 7 | default y |
8 | 8 | ||
9 | config UID16 | ||
10 | bool | ||
11 | default y | ||
12 | |||
13 | config RWSEM_GENERIC_SPINLOCK | 9 | config RWSEM_GENERIC_SPINLOCK |
14 | bool | 10 | bool |
15 | default y | 11 | default y |
diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile index d75e0d771366..5dfc93fd945a 100644 --- a/arch/frv/boot/Makefile +++ b/arch/frv/boot/Makefile | |||
@@ -57,10 +57,10 @@ initrd: | |||
57 | # installation | 57 | # installation |
58 | # | 58 | # |
59 | install: $(CONFIGURE) Image | 59 | install: $(CONFIGURE) Image |
60 | sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) Image $(TOPDIR)/System.map "$(INSTALL_PATH)" | 60 | sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)" |
61 | 61 | ||
62 | zinstall: $(CONFIGURE) zImage | 62 | zinstall: $(CONFIGURE) zImage |
63 | sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" | 63 | sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" |
64 | 64 | ||
65 | # | 65 | # |
66 | # miscellany | 66 | # miscellany |
diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c index 5f118c89d091..0f1c6cbc4f50 100644 --- a/arch/frv/kernel/frv_ksyms.c +++ b/arch/frv/kernel/frv_ksyms.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/hardirq.h> | 18 | #include <asm/hardirq.h> |
19 | #include <asm/cacheflush.h> | 19 | #include <asm/cacheflush.h> |
20 | 20 | ||
21 | extern void dump_thread(struct pt_regs *, struct user *); | ||
22 | extern long __memcpy_user(void *dst, const void *src, size_t count); | 21 | extern long __memcpy_user(void *dst, const void *src, size_t count); |
23 | extern long __memset_user(void *dst, const void *src, size_t count); | 22 | extern long __memset_user(void *dst, const void *src, size_t count); |
24 | 23 | ||
@@ -27,7 +26,6 @@ extern long __memset_user(void *dst, const void *src, size_t count); | |||
27 | EXPORT_SYMBOL(__ioremap); | 26 | EXPORT_SYMBOL(__ioremap); |
28 | EXPORT_SYMBOL(iounmap); | 27 | EXPORT_SYMBOL(iounmap); |
29 | 28 | ||
30 | EXPORT_SYMBOL(dump_thread); | ||
31 | EXPORT_SYMBOL(strnlen); | 29 | EXPORT_SYMBOL(strnlen); |
32 | EXPORT_SYMBOL(strrchr); | 30 | EXPORT_SYMBOL(strrchr); |
33 | EXPORT_SYMBOL(strstr); | 31 | EXPORT_SYMBOL(strstr); |
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 54a452136f00..c4488379ac3b 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c | |||
@@ -244,28 +244,6 @@ int copy_thread(int nr, unsigned long clone_flags, | |||
244 | } /* end copy_thread() */ | 244 | } /* end copy_thread() */ |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * fill in the user structure for a core dump.. | ||
248 | */ | ||
249 | void dump_thread(struct pt_regs *regs, struct user *dump) | ||
250 | { | ||
251 | #if 0 | ||
252 | /* changed the size calculations - should hopefully work better. lbt */ | ||
253 | dump->magic = CMAGIC; | ||
254 | dump->start_code = 0; | ||
255 | dump->start_stack = user_stack(regs) & ~(PAGE_SIZE - 1); | ||
256 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
257 | dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
258 | dump->u_dsize -= dump->u_tsize; | ||
259 | dump->u_ssize = 0; | ||
260 | |||
261 | if (dump->start_stack < TASK_SIZE) | ||
262 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | ||
263 | |||
264 | dump->regs = *(struct user_context *) regs; | ||
265 | #endif | ||
266 | } | ||
267 | |||
268 | /* | ||
269 | * sys_execve() executes a new program. | 247 | * sys_execve() executes a new program. |
270 | */ | 248 | */ |
271 | asmlinkage int sys_execve(char *name, char **argv, char **envp) | 249 | asmlinkage int sys_execve(char *name, char **argv, char **envp) |
diff --git a/arch/h8300/kernel/gpio.c b/arch/h8300/kernel/gpio.c index 795682b873e2..d195568ca8a2 100644 --- a/arch/h8300/kernel/gpio.c +++ b/arch/h8300/kernel/gpio.c | |||
@@ -122,7 +122,7 @@ int h8300_get_gpio_dir(int port_bit) | |||
122 | static char *port_status(int portno) | 122 | static char *port_status(int portno) |
123 | { | 123 | { |
124 | static char result[10]; | 124 | static char result[10]; |
125 | const static char io[2]={'I','O'}; | 125 | static const char io[2]={'I','O'}; |
126 | char *rp; | 126 | char *rp; |
127 | int c; | 127 | int c; |
128 | unsigned char used,ddr; | 128 | unsigned char used,ddr; |
@@ -143,7 +143,7 @@ static int gpio_proc_read(char *buf, char **start, off_t offset, | |||
143 | int len, int *unused_i, void *unused_v) | 143 | int len, int *unused_i, void *unused_v) |
144 | { | 144 | { |
145 | int c,outlen; | 145 | int c,outlen; |
146 | const static char port_name[]="123456789ABCDEFGH"; | 146 | static const char port_name[]="123456789ABCDEFGH"; |
147 | outlen = 0; | 147 | outlen = 0; |
148 | for (c = 0; c < MAX_PORT; c++) { | 148 | for (c = 0; c < MAX_PORT; c++) { |
149 | if (ddrs[c] == NULL) | 149 | if (ddrs[c] == NULL) |
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c index 5a630233112f..3e0d80ea4464 100644 --- a/arch/h8300/kernel/h8300_ksyms.c +++ b/arch/h8300/kernel/h8300_ksyms.c | |||
@@ -22,11 +22,8 @@ | |||
22 | //asmlinkage long long __lshrdi3 (long long, int); | 22 | //asmlinkage long long __lshrdi3 (long long, int); |
23 | extern char h8300_debug_device[]; | 23 | extern char h8300_debug_device[]; |
24 | 24 | ||
25 | extern void dump_thread(struct pt_regs *, struct user *); | ||
26 | |||
27 | /* platform dependent support */ | 25 | /* platform dependent support */ |
28 | 26 | ||
29 | EXPORT_SYMBOL(dump_thread); | ||
30 | EXPORT_SYMBOL(strnlen); | 27 | EXPORT_SYMBOL(strnlen); |
31 | EXPORT_SYMBOL(strrchr); | 28 | EXPORT_SYMBOL(strrchr); |
32 | EXPORT_SYMBOL(strstr); | 29 | EXPORT_SYMBOL(strstr); |
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c index fe21adf3e75e..585ed5efd0f7 100644 --- a/arch/h8300/kernel/process.c +++ b/arch/h8300/kernel/process.c | |||
@@ -208,34 +208,6 @@ int copy_thread(int nr, unsigned long clone_flags, | |||
208 | } | 208 | } |
209 | 209 | ||
210 | /* | 210 | /* |
211 | * fill in the user structure for a core dump.. | ||
212 | */ | ||
213 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
214 | { | ||
215 | /* changed the size calculations - should hopefully work better. lbt */ | ||
216 | dump->magic = CMAGIC; | ||
217 | dump->start_code = 0; | ||
218 | dump->start_stack = rdusp() & ~(PAGE_SIZE - 1); | ||
219 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
220 | dump->u_dsize = ((unsigned long) (current->mm->brk + | ||
221 | (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
222 | dump->u_dsize -= dump->u_tsize; | ||
223 | dump->u_ssize = 0; | ||
224 | |||
225 | dump->u_ar0 = (struct user_regs_struct *)(((int)(&dump->regs)) -((int)(dump))); | ||
226 | dump->regs.er0 = regs->er0; | ||
227 | dump->regs.er1 = regs->er1; | ||
228 | dump->regs.er2 = regs->er2; | ||
229 | dump->regs.er3 = regs->er3; | ||
230 | dump->regs.er4 = regs->er4; | ||
231 | dump->regs.er5 = regs->er5; | ||
232 | dump->regs.er6 = regs->er6; | ||
233 | dump->regs.orig_er0 = regs->orig_er0; | ||
234 | dump->regs.ccr = regs->ccr; | ||
235 | dump->regs.pc = regs->pc; | ||
236 | } | ||
237 | |||
238 | /* | ||
239 | * sys_execve() executes a new program. | 211 | * sys_execve() executes a new program. |
240 | */ | 212 | */ |
241 | asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...) | 213 | asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...) |
diff --git a/arch/h8300/platform/h8300h/ptrace_h8300h.c b/arch/h8300/platform/h8300h/ptrace_h8300h.c index 6ac93c05a1ae..746b1ae672a1 100644 --- a/arch/h8300/platform/h8300h/ptrace_h8300h.c +++ b/arch/h8300/platform/h8300h/ptrace_h8300h.c | |||
@@ -98,7 +98,7 @@ struct optable { | |||
98 | .type = jmp, \ | 98 | .type = jmp, \ |
99 | } | 99 | } |
100 | 100 | ||
101 | const static struct optable optable_0[] = { | 101 | static const struct optable optable_0[] = { |
102 | OPTABLE(0x00,0xff, 1,none), /* 0x00 */ | 102 | OPTABLE(0x00,0xff, 1,none), /* 0x00 */ |
103 | OPTABLE(0x01,0xff,-1,none), /* 0x01 */ | 103 | OPTABLE(0x01,0xff,-1,none), /* 0x01 */ |
104 | OPTABLE(0x02,0xfe, 1,none), /* 0x02-0x03 */ | 104 | OPTABLE(0x02,0xfe, 1,none), /* 0x02-0x03 */ |
@@ -131,31 +131,31 @@ const static struct optable optable_0[] = { | |||
131 | OPTABLE(0x80,0x80, 1,none), /* 0x80-0xff */ | 131 | OPTABLE(0x80,0x80, 1,none), /* 0x80-0xff */ |
132 | }; | 132 | }; |
133 | 133 | ||
134 | const static struct optable optable_1[] = { | 134 | static const struct optable optable_1[] = { |
135 | OPTABLE(0x00,0xff,-3,none), /* 0x0100 */ | 135 | OPTABLE(0x00,0xff,-3,none), /* 0x0100 */ |
136 | OPTABLE(0x40,0xf0,-3,none), /* 0x0140-0x14f */ | 136 | OPTABLE(0x40,0xf0,-3,none), /* 0x0140-0x14f */ |
137 | OPTABLE(0x80,0xf0, 1,none), /* 0x0180-0x018f */ | 137 | OPTABLE(0x80,0xf0, 1,none), /* 0x0180-0x018f */ |
138 | OPTABLE(0xc0,0xc0, 2,none), /* 0x01c0-0x01ff */ | 138 | OPTABLE(0xc0,0xc0, 2,none), /* 0x01c0-0x01ff */ |
139 | }; | 139 | }; |
140 | 140 | ||
141 | const static struct optable optable_2[] = { | 141 | static const struct optable optable_2[] = { |
142 | OPTABLE(0x00,0x20, 2,none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */ | 142 | OPTABLE(0x00,0x20, 2,none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */ |
143 | OPTABLE(0x20,0x20, 3,none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */ | 143 | OPTABLE(0x20,0x20, 3,none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */ |
144 | }; | 144 | }; |
145 | 145 | ||
146 | const static struct optable optable_3[] = { | 146 | static const struct optable optable_3[] = { |
147 | OPTABLE(0x69,0xfb, 2,none), /* 0x010069/0x01006d/014069/0x01406d */ | 147 | OPTABLE(0x69,0xfb, 2,none), /* 0x010069/0x01006d/014069/0x01406d */ |
148 | OPTABLE(0x6b,0xff,-4,none), /* 0x01006b/0x01406b */ | 148 | OPTABLE(0x6b,0xff,-4,none), /* 0x01006b/0x01406b */ |
149 | OPTABLE(0x6f,0xff, 3,none), /* 0x01006f/0x01406f */ | 149 | OPTABLE(0x6f,0xff, 3,none), /* 0x01006f/0x01406f */ |
150 | OPTABLE(0x78,0xff, 5,none), /* 0x010078/0x014078 */ | 150 | OPTABLE(0x78,0xff, 5,none), /* 0x010078/0x014078 */ |
151 | }; | 151 | }; |
152 | 152 | ||
153 | const static struct optable optable_4[] = { | 153 | static const struct optable optable_4[] = { |
154 | OPTABLE(0x00,0x78, 3,none), /* 0x0100690?/0x01006d0?/0140690/0x01406d0?/0x0100698?/0x01006d8?/0140698?/0x01406d8? */ | 154 | OPTABLE(0x00,0x78, 3,none), /* 0x0100690?/0x01006d0?/0140690/0x01406d0?/0x0100698?/0x01006d8?/0140698?/0x01406d8? */ |
155 | OPTABLE(0x20,0x78, 4,none), /* 0x0100692?/0x01006d2?/0140692/0x01406d2?/0x010069a?/0x01006da?/014069a?/0x01406da? */ | 155 | OPTABLE(0x20,0x78, 4,none), /* 0x0100692?/0x01006d2?/0140692/0x01406d2?/0x010069a?/0x01006da?/014069a?/0x01406da? */ |
156 | }; | 156 | }; |
157 | 157 | ||
158 | const static struct optables_list { | 158 | static const struct optables_list { |
159 | const struct optable *ptr; | 159 | const struct optable *ptr; |
160 | int size; | 160 | int size; |
161 | } optables[] = { | 161 | } optables[] = { |
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c index 5441cdd12a39..f6ed663bdde0 100644 --- a/arch/h8300/platform/h8s/ints.c +++ b/arch/h8300/platform/h8s/ints.c | |||
@@ -52,7 +52,7 @@ struct irq_pins { | |||
52 | unsigned char bit_no; | 52 | unsigned char bit_no; |
53 | }; | 53 | }; |
54 | /* ISTR = 0 */ | 54 | /* ISTR = 0 */ |
55 | const static struct irq_pins irq_assign_table0[16]={ | 55 | static const struct irq_pins irq_assign_table0[16]={ |
56 | {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1}, | 56 | {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1}, |
57 | {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3}, | 57 | {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3}, |
58 | {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5}, | 58 | {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5}, |
@@ -63,7 +63,7 @@ const static struct irq_pins irq_assign_table0[16]={ | |||
63 | {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, | 63 | {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, |
64 | }; | 64 | }; |
65 | /* ISTR = 1 */ | 65 | /* ISTR = 1 */ |
66 | const static struct irq_pins irq_assign_table1[16]={ | 66 | static const struct irq_pins irq_assign_table1[16]={ |
67 | {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, | 67 | {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, |
68 | {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3}, | 68 | {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3}, |
69 | {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5}, | 69 | {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5}, |
diff --git a/arch/h8300/platform/h8s/ints_h8s.c b/arch/h8300/platform/h8s/ints_h8s.c index f53de493e3e8..8268dfd12f1f 100644 --- a/arch/h8300/platform/h8s/ints_h8s.c +++ b/arch/h8300/platform/h8s/ints_h8s.c | |||
@@ -42,7 +42,7 @@ struct irq_pins { | |||
42 | unsigned char bit_no; | 42 | unsigned char bit_no; |
43 | } __attribute__((aligned(1),packed)); | 43 | } __attribute__((aligned(1),packed)); |
44 | /* ISTR = 0 */ | 44 | /* ISTR = 0 */ |
45 | const static struct irq_pins irq_assign_table0[16]={ | 45 | static const struct irq_pins irq_assign_table0[16]={ |
46 | {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1}, | 46 | {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1}, |
47 | {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3}, | 47 | {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3}, |
48 | {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5}, | 48 | {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5}, |
@@ -53,7 +53,7 @@ const static struct irq_pins irq_assign_table0[16]={ | |||
53 | {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, | 53 | {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, |
54 | }; | 54 | }; |
55 | /* ISTR = 1 */ | 55 | /* ISTR = 1 */ |
56 | const static struct irq_pins irq_assign_table1[16]={ | 56 | static const struct irq_pins irq_assign_table1[16]={ |
57 | {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, | 57 | {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, |
58 | {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3}, | 58 | {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3}, |
59 | {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5}, | 59 | {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5}, |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index d849c6870e3a..815878ebd30f 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -645,17 +645,6 @@ config SECCOMP | |||
645 | 645 | ||
646 | source kernel/Kconfig.hz | 646 | source kernel/Kconfig.hz |
647 | 647 | ||
648 | config PHYSICAL_START | ||
649 | hex "Physical address where the kernel is loaded" if EMBEDDED | ||
650 | default "0x100000" | ||
651 | help | ||
652 | This gives the physical address where the kernel is loaded. | ||
653 | Primarily used in the case of kexec on panic where the | ||
654 | fail safe kernel needs to run at a different address than | ||
655 | the panic-ed kernel. | ||
656 | |||
657 | Don't change this unless you know what you are doing. | ||
658 | |||
659 | config KEXEC | 648 | config KEXEC |
660 | bool "kexec system call (EXPERIMENTAL)" | 649 | bool "kexec system call (EXPERIMENTAL)" |
661 | depends on EXPERIMENTAL | 650 | depends on EXPERIMENTAL |
@@ -675,11 +664,31 @@ config KEXEC | |||
675 | 664 | ||
676 | config CRASH_DUMP | 665 | config CRASH_DUMP |
677 | bool "kernel crash dumps (EXPERIMENTAL)" | 666 | bool "kernel crash dumps (EXPERIMENTAL)" |
678 | depends on EMBEDDED | ||
679 | depends on EXPERIMENTAL | 667 | depends on EXPERIMENTAL |
680 | depends on HIGHMEM | 668 | depends on HIGHMEM |
681 | help | 669 | help |
682 | Generate crash dump after being started by kexec. | 670 | Generate crash dump after being started by kexec. |
671 | |||
672 | config PHYSICAL_START | ||
673 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) | ||
674 | |||
675 | default "0x1000000" if CRASH_DUMP | ||
676 | default "0x100000" | ||
677 | help | ||
678 | This gives the physical address where the kernel is loaded. Normally | ||
679 | for regular kernels this value is 0x100000 (1MB). But in the case | ||
680 | of kexec on panic the fail safe kernel needs to run at a different | ||
681 | address than the panic-ed kernel. This option is used to set the load | ||
682 | address for kernels used to capture crash dump on being kexec'ed | ||
683 | after panic. The default value for crash dump kernels is | ||
684 | 0x1000000 (16MB). This can also be set based on the "X" value as | ||
685 | specified in the "crashkernel=YM@XM" command line boot parameter | ||
686 | passed to the panic-ed kernel. Typically this parameter is set as | ||
687 | crashkernel=64M@16M. Please take a look at | ||
688 | Documentation/kdump/kdump.txt for more details about crash dumps. | ||
689 | |||
690 | Don't change this unless you know what you are doing. | ||
691 | |||
683 | endmenu | 692 | endmenu |
684 | 693 | ||
685 | 694 | ||
@@ -1051,3 +1060,7 @@ config X86_TRAMPOLINE | |||
1051 | bool | 1060 | bool |
1052 | depends on X86_SMP || (X86_VOYAGER && SMP) | 1061 | depends on X86_SMP || (X86_VOYAGER && SMP) |
1053 | default y | 1062 | default y |
1063 | |||
1064 | config KTIME_SCALAR | ||
1065 | bool | ||
1066 | default y | ||
diff --git a/arch/i386/Makefile b/arch/i386/Makefile index b84119f9cc63..d3c0409d201c 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile | |||
@@ -37,7 +37,10 @@ CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) | |||
37 | # CPU-specific tuning. Anything which can be shared with UML should go here. | 37 | # CPU-specific tuning. Anything which can be shared with UML should go here. |
38 | include $(srctree)/arch/i386/Makefile.cpu | 38 | include $(srctree)/arch/i386/Makefile.cpu |
39 | 39 | ||
40 | cflags-$(CONFIG_REGPARM) += -mregparm=3 | 40 | # -mregparm=3 works ok on gcc-3.0 and later |
41 | # | ||
42 | cflags-$(CONFIG_REGPARM) += $(shell if [ $(call cc-version) -ge 0300 ] ; then \ | ||
43 | echo "-mregparm=3"; fi ;) | ||
41 | 44 | ||
42 | # Disable unit-at-a-time mode, it makes gcc use a lot more stack | 45 | # Disable unit-at-a-time mode, it makes gcc use a lot more stack |
43 | # due to the lack of sharing of stacklots. | 46 | # due to the lack of sharing of stacklots. |
@@ -100,7 +103,7 @@ AFLAGS += $(mflags-y) | |||
100 | boot := arch/i386/boot | 103 | boot := arch/i386/boot |
101 | 104 | ||
102 | .PHONY: zImage bzImage compressed zlilo bzlilo \ | 105 | .PHONY: zImage bzImage compressed zlilo bzlilo \ |
103 | zdisk bzdisk fdimage fdimage144 fdimage288 install kernel_install | 106 | zdisk bzdisk fdimage fdimage144 fdimage288 install |
104 | 107 | ||
105 | all: bzImage | 108 | all: bzImage |
106 | 109 | ||
@@ -122,8 +125,7 @@ zdisk bzdisk: vmlinux | |||
122 | fdimage fdimage144 fdimage288: vmlinux | 125 | fdimage fdimage144 fdimage288: vmlinux |
123 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ | 126 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ |
124 | 127 | ||
125 | install: vmlinux | 128 | install: |
126 | install kernel_install: | ||
127 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install | 129 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install |
128 | 130 | ||
129 | archclean: | 131 | archclean: |
diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile index 1e71382d413a..0fea75dd4e31 100644 --- a/arch/i386/boot/Makefile +++ b/arch/i386/boot/Makefile | |||
@@ -100,5 +100,5 @@ zlilo: $(BOOTIMAGE) | |||
100 | cp System.map $(INSTALL_PATH)/ | 100 | cp System.map $(INSTALL_PATH)/ |
101 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | 101 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi |
102 | 102 | ||
103 | install: $(BOOTIMAGE) | 103 | install: |
104 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" | 104 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" |
diff --git a/arch/i386/boot/install.sh b/arch/i386/boot/install.sh index f17b40dfc0f4..5e44c736eea8 100644 --- a/arch/i386/boot/install.sh +++ b/arch/i386/boot/install.sh | |||
@@ -19,6 +19,20 @@ | |||
19 | # $4 - default install path (blank if root directory) | 19 | # $4 - default install path (blank if root directory) |
20 | # | 20 | # |
21 | 21 | ||
22 | verify () { | ||
23 | if [ ! -f "$1" ]; then | ||
24 | echo "" 1>&2 | ||
25 | echo " *** Missing file: $1" 1>&2 | ||
26 | echo ' *** You need to run "make" before "make install".' 1>&2 | ||
27 | echo "" 1>&2 | ||
28 | exit 1 | ||
29 | fi | ||
30 | } | ||
31 | |||
32 | # Make sure the files actually exist | ||
33 | verify "$2" | ||
34 | verify "$3" | ||
35 | |||
22 | # User may have a custom install script | 36 | # User may have a custom install script |
23 | 37 | ||
24 | if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi | 38 | if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi |
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S index 92f669470142..2ac40c8244c4 100644 --- a/arch/i386/boot/video.S +++ b/arch/i386/boot/video.S | |||
@@ -97,7 +97,6 @@ | |||
97 | #define PARAM_VESAPM_OFF 0x30 | 97 | #define PARAM_VESAPM_OFF 0x30 |
98 | #define PARAM_LFB_PAGES 0x32 | 98 | #define PARAM_LFB_PAGES 0x32 |
99 | #define PARAM_VESA_ATTRIB 0x34 | 99 | #define PARAM_VESA_ATTRIB 0x34 |
100 | #define PARAM_CAPABILITIES 0x36 | ||
101 | 100 | ||
102 | /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ | 101 | /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ |
103 | #ifdef CONFIG_VIDEO_RETAIN | 102 | #ifdef CONFIG_VIDEO_RETAIN |
@@ -234,10 +233,6 @@ mopar_gr: | |||
234 | movw 18(%di), %ax | 233 | movw 18(%di), %ax |
235 | movl %eax, %fs:(PARAM_LFB_SIZE) | 234 | movl %eax, %fs:(PARAM_LFB_SIZE) |
236 | 235 | ||
237 | # store mode capabilities | ||
238 | movl 10(%di), %eax | ||
239 | movl %eax, %fs:(PARAM_CAPABILITIES) | ||
240 | |||
241 | # switching the DAC to 8-bit is for <= 8 bpp only | 236 | # switching the DAC to 8-bit is for <= 8 bpp only |
242 | movw %fs:(PARAM_LFB_DEPTH), %ax | 237 | movw %fs:(PARAM_LFB_DEPTH), %ax |
243 | cmpw $8, %ax | 238 | cmpw $8, %ax |
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index be1880bb75b4..60c3f76dfca4 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile | |||
@@ -25,6 +25,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o | |||
25 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | 25 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o |
26 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o | 26 | obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o |
27 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o | 27 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o |
28 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o | ||
28 | obj-$(CONFIG_X86_NUMAQ) += numaq.o | 29 | obj-$(CONFIG_X86_NUMAQ) += numaq.o |
29 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o | 30 | obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o |
30 | obj-$(CONFIG_KPROBES) += kprobes.o | 31 | obj-$(CONFIG_KPROBES) += kprobes.o |
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c index 0248e084017c..d49dbe8dc96b 100644 --- a/arch/i386/kernel/crash.c +++ b/arch/i386/kernel/crash.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <mach_ipi.h> | 25 | #include <mach_ipi.h> |
26 | 26 | ||
27 | 27 | ||
28 | note_buf_t crash_notes[NR_CPUS]; | ||
29 | /* This keeps a track of which one is crashing cpu. */ | 28 | /* This keeps a track of which one is crashing cpu. */ |
30 | static int crashing_cpu; | 29 | static int crashing_cpu; |
31 | 30 | ||
@@ -72,7 +71,9 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | |||
72 | * squirrelled away. ELF notes happen to provide | 71 | * squirrelled away. ELF notes happen to provide |
73 | * all of that that no need to invent something new. | 72 | * all of that that no need to invent something new. |
74 | */ | 73 | */ |
75 | buf = &crash_notes[cpu][0]; | 74 | buf = (u32*)per_cpu_ptr(crash_notes, cpu); |
75 | if (!buf) | ||
76 | return; | ||
76 | memset(&prstatus, 0, sizeof(prstatus)); | 77 | memset(&prstatus, 0, sizeof(prstatus)); |
77 | prstatus.pr_pid = current->pid; | 78 | prstatus.pr_pid = current->pid; |
78 | elf_core_copy_regs(&prstatus.pr_reg, regs); | 79 | elf_core_copy_regs(&prstatus.pr_reg, regs); |
@@ -81,51 +82,12 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | |||
81 | final_note(buf); | 82 | final_note(buf); |
82 | } | 83 | } |
83 | 84 | ||
84 | static void crash_get_current_regs(struct pt_regs *regs) | 85 | static void crash_save_self(struct pt_regs *regs) |
85 | { | ||
86 | __asm__ __volatile__("movl %%ebx,%0" : "=m"(regs->ebx)); | ||
87 | __asm__ __volatile__("movl %%ecx,%0" : "=m"(regs->ecx)); | ||
88 | __asm__ __volatile__("movl %%edx,%0" : "=m"(regs->edx)); | ||
89 | __asm__ __volatile__("movl %%esi,%0" : "=m"(regs->esi)); | ||
90 | __asm__ __volatile__("movl %%edi,%0" : "=m"(regs->edi)); | ||
91 | __asm__ __volatile__("movl %%ebp,%0" : "=m"(regs->ebp)); | ||
92 | __asm__ __volatile__("movl %%eax,%0" : "=m"(regs->eax)); | ||
93 | __asm__ __volatile__("movl %%esp,%0" : "=m"(regs->esp)); | ||
94 | __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(regs->xss)); | ||
95 | __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(regs->xcs)); | ||
96 | __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(regs->xds)); | ||
97 | __asm__ __volatile__("movw %%es, %%ax;" :"=a"(regs->xes)); | ||
98 | __asm__ __volatile__("pushfl; popl %0" :"=m"(regs->eflags)); | ||
99 | |||
100 | regs->eip = (unsigned long)current_text_addr(); | ||
101 | } | ||
102 | |||
103 | /* CPU does not save ss and esp on stack if execution is already | ||
104 | * running in kernel mode at the time of NMI occurrence. This code | ||
105 | * fixes it. | ||
106 | */ | ||
107 | static void crash_setup_regs(struct pt_regs *newregs, struct pt_regs *oldregs) | ||
108 | { | ||
109 | memcpy(newregs, oldregs, sizeof(*newregs)); | ||
110 | newregs->esp = (unsigned long)&(oldregs->esp); | ||
111 | __asm__ __volatile__("xorl %eax, %eax;"); | ||
112 | __asm__ __volatile__ ("movw %%ss, %%ax;" :"=a"(newregs->xss)); | ||
113 | } | ||
114 | |||
115 | /* We may have saved_regs from where the error came from | ||
116 | * or it is NULL if via a direct panic(). | ||
117 | */ | ||
118 | static void crash_save_self(struct pt_regs *saved_regs) | ||
119 | { | 86 | { |
120 | struct pt_regs regs; | ||
121 | int cpu; | 87 | int cpu; |
122 | 88 | ||
123 | cpu = smp_processor_id(); | 89 | cpu = smp_processor_id(); |
124 | if (saved_regs) | 90 | crash_save_this_cpu(regs, cpu); |
125 | crash_setup_regs(®s, saved_regs); | ||
126 | else | ||
127 | crash_get_current_regs(®s); | ||
128 | crash_save_this_cpu(®s, cpu); | ||
129 | } | 91 | } |
130 | 92 | ||
131 | #ifdef CONFIG_SMP | 93 | #ifdef CONFIG_SMP |
@@ -144,7 +106,7 @@ static int crash_nmi_callback(struct pt_regs *regs, int cpu) | |||
144 | local_irq_disable(); | 106 | local_irq_disable(); |
145 | 107 | ||
146 | if (!user_mode(regs)) { | 108 | if (!user_mode(regs)) { |
147 | crash_setup_regs(&fixed_regs, regs); | 109 | crash_fixup_ss_esp(&fixed_regs, regs); |
148 | regs = &fixed_regs; | 110 | regs = &fixed_regs; |
149 | } | 111 | } |
150 | crash_save_this_cpu(regs, cpu); | 112 | crash_save_this_cpu(regs, cpu); |
diff --git a/arch/i386/kernel/crash_dump.c b/arch/i386/kernel/crash_dump.c new file mode 100644 index 000000000000..3f532df488bc --- /dev/null +++ b/arch/i386/kernel/crash_dump.c | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | * kernel/crash_dump.c - Memory preserving reboot related code. | ||
3 | * | ||
4 | * Created by: Hariprasad Nellitheertha (hari@in.ibm.com) | ||
5 | * Copyright (C) IBM Corporation, 2004. All rights reserved | ||
6 | */ | ||
7 | |||
8 | #include <linux/errno.h> | ||
9 | #include <linux/highmem.h> | ||
10 | #include <linux/crash_dump.h> | ||
11 | |||
12 | #include <asm/uaccess.h> | ||
13 | |||
14 | static void *kdump_buf_page; | ||
15 | |||
16 | /** | ||
17 | * copy_oldmem_page - copy one page from "oldmem" | ||
18 | * @pfn: page frame number to be copied | ||
19 | * @buf: target memory address for the copy; this can be in kernel address | ||
20 | * space or user address space (see @userbuf) | ||
21 | * @csize: number of bytes to copy | ||
22 | * @offset: offset in bytes into the page (based on pfn) to begin the copy | ||
23 | * @userbuf: if set, @buf is in user address space, use copy_to_user(), | ||
24 | * otherwise @buf is in kernel address space, use memcpy(). | ||
25 | * | ||
26 | * Copy a page from "oldmem". For this page, there is no pte mapped | ||
27 | * in the current kernel. We stitch up a pte, similar to kmap_atomic. | ||
28 | * | ||
29 | * Calling copy_to_user() in atomic context is not desirable. Hence first | ||
30 | * copying the data to a pre-allocated kernel page and then copying to user | ||
31 | * space in non-atomic context. | ||
32 | */ | ||
33 | ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | ||
34 | size_t csize, unsigned long offset, int userbuf) | ||
35 | { | ||
36 | void *vaddr; | ||
37 | |||
38 | if (!csize) | ||
39 | return 0; | ||
40 | |||
41 | vaddr = kmap_atomic_pfn(pfn, KM_PTE0); | ||
42 | |||
43 | if (!userbuf) { | ||
44 | memcpy(buf, (vaddr + offset), csize); | ||
45 | kunmap_atomic(vaddr, KM_PTE0); | ||
46 | } else { | ||
47 | if (!kdump_buf_page) { | ||
48 | printk(KERN_WARNING "Kdump: Kdump buffer page not" | ||
49 | " allocated\n"); | ||
50 | return -EFAULT; | ||
51 | } | ||
52 | copy_page(kdump_buf_page, vaddr); | ||
53 | kunmap_atomic(vaddr, KM_PTE0); | ||
54 | if (copy_to_user(buf, (kdump_buf_page + offset), csize)) | ||
55 | return -EFAULT; | ||
56 | } | ||
57 | |||
58 | return csize; | ||
59 | } | ||
60 | |||
61 | static int __init kdump_buf_page_init(void) | ||
62 | { | ||
63 | int ret = 0; | ||
64 | |||
65 | kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
66 | if (!kdump_buf_page) { | ||
67 | printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer" | ||
68 | " page\n"); | ||
69 | ret = -ENOMEM; | ||
70 | } | ||
71 | |||
72 | return ret; | ||
73 | } | ||
74 | arch_initcall(kdump_buf_page_init); | ||
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c index 19edcd526ba4..2f372dbd34fd 100644 --- a/arch/i386/kernel/kprobes.c +++ b/arch/i386/kernel/kprobes.c | |||
@@ -58,13 +58,9 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode) | |||
58 | 58 | ||
59 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 59 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
60 | { | 60 | { |
61 | return 0; | ||
62 | } | ||
63 | |||
64 | void __kprobes arch_copy_kprobe(struct kprobe *p) | ||
65 | { | ||
66 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 61 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
67 | p->opcode = *p->addr; | 62 | p->opcode = *p->addr; |
63 | return 0; | ||
68 | } | 64 | } |
69 | 65 | ||
70 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 66 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
@@ -81,10 +77,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) | |||
81 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); | 77 | (unsigned long) p->addr + sizeof(kprobe_opcode_t)); |
82 | } | 78 | } |
83 | 79 | ||
84 | void __kprobes arch_remove_kprobe(struct kprobe *p) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) | 80 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) |
89 | { | 81 | { |
90 | kcb->prev_kprobe.kp = kprobe_running(); | 82 | kcb->prev_kprobe.kp = kprobe_running(); |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 27c956db0461..f685637a100d 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -898,7 +898,7 @@ static void __init parse_cmdline_early (char ** cmdline_p) | |||
898 | } | 898 | } |
899 | } | 899 | } |
900 | #endif | 900 | #endif |
901 | #ifdef CONFIG_CRASH_DUMP | 901 | #ifdef CONFIG_PROC_VMCORE |
902 | /* elfcorehdr= specifies the location of elf core header | 902 | /* elfcorehdr= specifies the location of elf core header |
903 | * stored by the crashed kernel. | 903 | * stored by the crashed kernel. |
904 | */ | 904 | */ |
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index 53ad954e3ba4..b9f0030a2ebb 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c | |||
@@ -120,7 +120,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo, | |||
120 | #ifdef CONFIG_FRAME_POINTER | 120 | #ifdef CONFIG_FRAME_POINTER |
121 | while (valid_stack_ptr(tinfo, (void *)ebp)) { | 121 | while (valid_stack_ptr(tinfo, (void *)ebp)) { |
122 | addr = *(unsigned long *)(ebp + 4); | 122 | addr = *(unsigned long *)(ebp + 4); |
123 | printk(" [<%08lx>] ", addr); | 123 | printk(KERN_EMERG " [<%08lx>] ", addr); |
124 | print_symbol("%s", addr); | 124 | print_symbol("%s", addr); |
125 | printk("\n"); | 125 | printk("\n"); |
126 | ebp = *(unsigned long *)ebp; | 126 | ebp = *(unsigned long *)ebp; |
@@ -129,7 +129,7 @@ static inline unsigned long print_context_stack(struct thread_info *tinfo, | |||
129 | while (valid_stack_ptr(tinfo, stack)) { | 129 | while (valid_stack_ptr(tinfo, stack)) { |
130 | addr = *stack++; | 130 | addr = *stack++; |
131 | if (__kernel_text_address(addr)) { | 131 | if (__kernel_text_address(addr)) { |
132 | printk(" [<%08lx>]", addr); | 132 | printk(KERN_EMERG " [<%08lx>]", addr); |
133 | print_symbol(" %s", addr); | 133 | print_symbol(" %s", addr); |
134 | printk("\n"); | 134 | printk("\n"); |
135 | } | 135 | } |
@@ -161,7 +161,7 @@ void show_trace(struct task_struct *task, unsigned long * stack) | |||
161 | stack = (unsigned long*)context->previous_esp; | 161 | stack = (unsigned long*)context->previous_esp; |
162 | if (!stack) | 162 | if (!stack) |
163 | break; | 163 | break; |
164 | printk(" =======================\n"); | 164 | printk(KERN_EMERG " =======================\n"); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
@@ -178,14 +178,15 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | stack = esp; | 180 | stack = esp; |
181 | printk(KERN_EMERG); | ||
181 | for(i = 0; i < kstack_depth_to_print; i++) { | 182 | for(i = 0; i < kstack_depth_to_print; i++) { |
182 | if (kstack_end(stack)) | 183 | if (kstack_end(stack)) |
183 | break; | 184 | break; |
184 | if (i && ((i % 8) == 0)) | 185 | if (i && ((i % 8) == 0)) |
185 | printk("\n "); | 186 | printk("\n" KERN_EMERG " "); |
186 | printk("%08lx ", *stack++); | 187 | printk("%08lx ", *stack++); |
187 | } | 188 | } |
188 | printk("\nCall Trace:\n"); | 189 | printk("\n" KERN_EMERG "Call Trace:\n"); |
189 | show_trace(task, esp); | 190 | show_trace(task, esp); |
190 | } | 191 | } |
191 | 192 | ||
@@ -216,18 +217,18 @@ void show_registers(struct pt_regs *regs) | |||
216 | ss = regs->xss & 0xffff; | 217 | ss = regs->xss & 0xffff; |
217 | } | 218 | } |
218 | print_modules(); | 219 | print_modules(); |
219 | printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx" | 220 | printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n" |
220 | " (%s) \n", | 221 | "EFLAGS: %08lx (%s) \n", |
221 | smp_processor_id(), 0xffff & regs->xcs, regs->eip, | 222 | smp_processor_id(), 0xffff & regs->xcs, regs->eip, |
222 | print_tainted(), regs->eflags, system_utsname.release); | 223 | print_tainted(), regs->eflags, system_utsname.release); |
223 | print_symbol("EIP is at %s\n", regs->eip); | 224 | print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip); |
224 | printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", | 225 | printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", |
225 | regs->eax, regs->ebx, regs->ecx, regs->edx); | 226 | regs->eax, regs->ebx, regs->ecx, regs->edx); |
226 | printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", | 227 | printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", |
227 | regs->esi, regs->edi, regs->ebp, esp); | 228 | regs->esi, regs->edi, regs->ebp, esp); |
228 | printk("ds: %04x es: %04x ss: %04x\n", | 229 | printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n", |
229 | regs->xds & 0xffff, regs->xes & 0xffff, ss); | 230 | regs->xds & 0xffff, regs->xes & 0xffff, ss); |
230 | printk("Process %s (pid: %d, threadinfo=%p task=%p)", | 231 | printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)", |
231 | current->comm, current->pid, current_thread_info(), current); | 232 | current->comm, current->pid, current_thread_info(), current); |
232 | /* | 233 | /* |
233 | * When in-kernel, we also print out the stack and code at the | 234 | * When in-kernel, we also print out the stack and code at the |
@@ -236,10 +237,10 @@ void show_registers(struct pt_regs *regs) | |||
236 | if (in_kernel) { | 237 | if (in_kernel) { |
237 | u8 __user *eip; | 238 | u8 __user *eip; |
238 | 239 | ||
239 | printk("\nStack: "); | 240 | printk("\n" KERN_EMERG "Stack: "); |
240 | show_stack(NULL, (unsigned long*)esp); | 241 | show_stack(NULL, (unsigned long*)esp); |
241 | 242 | ||
242 | printk("Code: "); | 243 | printk(KERN_EMERG "Code: "); |
243 | 244 | ||
244 | eip = (u8 __user *)regs->eip - 43; | 245 | eip = (u8 __user *)regs->eip - 43; |
245 | for (i = 0; i < 64; i++, eip++) { | 246 | for (i = 0; i < 64; i++, eip++) { |
@@ -280,15 +281,15 @@ static void handle_BUG(struct pt_regs *regs) | |||
280 | (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) | 281 | (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) |
281 | file = "<bad filename>"; | 282 | file = "<bad filename>"; |
282 | 283 | ||
283 | printk("------------[ cut here ]------------\n"); | 284 | printk(KERN_EMERG "------------[ cut here ]------------\n"); |
284 | printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); | 285 | printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line); |
285 | 286 | ||
286 | no_bug: | 287 | no_bug: |
287 | return; | 288 | return; |
288 | 289 | ||
289 | /* Here we know it was a BUG but file-n-line is unavailable */ | 290 | /* Here we know it was a BUG but file-n-line is unavailable */ |
290 | bug: | 291 | bug: |
291 | printk("Kernel BUG\n"); | 292 | printk(KERN_EMERG "Kernel BUG\n"); |
292 | } | 293 | } |
293 | 294 | ||
294 | /* This is gone through when something in the kernel | 295 | /* This is gone through when something in the kernel |
@@ -321,16 +322,20 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
321 | if (++die.lock_owner_depth < 3) { | 322 | if (++die.lock_owner_depth < 3) { |
322 | int nl = 0; | 323 | int nl = 0; |
323 | handle_BUG(regs); | 324 | handle_BUG(regs); |
324 | printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); | 325 | printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); |
325 | #ifdef CONFIG_PREEMPT | 326 | #ifdef CONFIG_PREEMPT |
326 | printk("PREEMPT "); | 327 | printk(KERN_EMERG "PREEMPT "); |
327 | nl = 1; | 328 | nl = 1; |
328 | #endif | 329 | #endif |
329 | #ifdef CONFIG_SMP | 330 | #ifdef CONFIG_SMP |
331 | if (!nl) | ||
332 | printk(KERN_EMERG); | ||
330 | printk("SMP "); | 333 | printk("SMP "); |
331 | nl = 1; | 334 | nl = 1; |
332 | #endif | 335 | #endif |
333 | #ifdef CONFIG_DEBUG_PAGEALLOC | 336 | #ifdef CONFIG_DEBUG_PAGEALLOC |
337 | if (!nl) | ||
338 | printk(KERN_EMERG); | ||
334 | printk("DEBUG_PAGEALLOC"); | 339 | printk("DEBUG_PAGEALLOC"); |
335 | nl = 1; | 340 | nl = 1; |
336 | #endif | 341 | #endif |
@@ -339,7 +344,7 @@ void die(const char * str, struct pt_regs * regs, long err) | |||
339 | notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); | 344 | notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); |
340 | show_registers(regs); | 345 | show_registers(regs); |
341 | } else | 346 | } else |
342 | printk(KERN_ERR "Recursive die() failure, output suppressed\n"); | 347 | printk(KERN_EMERG "Recursive die() failure, output suppressed\n"); |
343 | 348 | ||
344 | bust_spinlocks(0); | 349 | bust_spinlocks(0); |
345 | die.lock_owner = -1; | 350 | die.lock_owner = -1; |
@@ -527,8 +532,10 @@ gp_in_kernel: | |||
527 | 532 | ||
528 | static void mem_parity_error(unsigned char reason, struct pt_regs * regs) | 533 | static void mem_parity_error(unsigned char reason, struct pt_regs * regs) |
529 | { | 534 | { |
530 | printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n"); | 535 | printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying " |
531 | printk("You probably have a hardware problem with your RAM chips\n"); | 536 | "to continue\n"); |
537 | printk(KERN_EMERG "You probably have a hardware problem with your RAM " | ||
538 | "chips\n"); | ||
532 | 539 | ||
533 | /* Clear and disable the memory parity error line. */ | 540 | /* Clear and disable the memory parity error line. */ |
534 | clear_mem_error(reason); | 541 | clear_mem_error(reason); |
@@ -538,7 +545,7 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs) | |||
538 | { | 545 | { |
539 | unsigned long i; | 546 | unsigned long i; |
540 | 547 | ||
541 | printk("NMI: IOCK error (debug interrupt?)\n"); | 548 | printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n"); |
542 | show_registers(regs); | 549 | show_registers(regs); |
543 | 550 | ||
544 | /* Re-enable the IOCK line, wait for a few seconds */ | 551 | /* Re-enable the IOCK line, wait for a few seconds */ |
@@ -580,11 +587,11 @@ void die_nmi (struct pt_regs *regs, const char *msg) | |||
580 | * to get a message out. | 587 | * to get a message out. |
581 | */ | 588 | */ |
582 | bust_spinlocks(1); | 589 | bust_spinlocks(1); |
583 | printk(msg); | 590 | printk(KERN_EMERG "%s", msg); |
584 | printk(" on CPU%d, eip %08lx, registers:\n", | 591 | printk(" on CPU%d, eip %08lx, registers:\n", |
585 | smp_processor_id(), regs->eip); | 592 | smp_processor_id(), regs->eip); |
586 | show_registers(regs); | 593 | show_registers(regs); |
587 | printk("console shuts up ...\n"); | 594 | printk(KERN_EMERG "console shuts up ...\n"); |
588 | console_silent(); | 595 | console_silent(); |
589 | spin_unlock(&nmi_print_lock); | 596 | spin_unlock(&nmi_print_lock); |
590 | bust_spinlocks(0); | 597 | bust_spinlocks(0); |
@@ -990,8 +997,8 @@ asmlinkage void math_state_restore(struct pt_regs regs) | |||
990 | 997 | ||
991 | asmlinkage void math_emulate(long arg) | 998 | asmlinkage void math_emulate(long arg) |
992 | { | 999 | { |
993 | printk("math-emulation not enabled and no coprocessor found.\n"); | 1000 | printk(KERN_EMERG "math-emulation not enabled and no coprocessor found.\n"); |
994 | printk("killing %s.\n",current->comm); | 1001 | printk(KERN_EMERG "killing %s.\n",current->comm); |
995 | force_sig(SIGFPE,current); | 1002 | force_sig(SIGFPE,current); |
996 | schedule(); | 1003 | schedule(); |
997 | } | 1004 | } |
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 57b047c27e46..f722e1a25948 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile | |||
@@ -25,7 +25,6 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ | |||
25 | -falign-functions=32 -frename-registers -fno-optimize-sibling-calls | 25 | -falign-functions=32 -frename-registers -fno-optimize-sibling-calls |
26 | CFLAGS_KERNEL := -mconstant-gp | 26 | CFLAGS_KERNEL := -mconstant-gp |
27 | 27 | ||
28 | GCC_VERSION := $(call cc-version) | ||
29 | GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") | 28 | GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") |
30 | CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") | 29 | CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") |
31 | 30 | ||
@@ -37,7 +36,7 @@ $(error Sorry, you need a newer version of the assember, one that is built from | |||
37 | ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) | 36 | ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) |
38 | endif | 37 | endif |
39 | 38 | ||
40 | ifeq ($(GCC_VERSION),0304) | 39 | ifeq ($(call cc-version),0304) |
41 | cflags-$(CONFIG_ITANIUM) += -mtune=merced | 40 | cflags-$(CONFIG_ITANIUM) += -mtune=merced |
42 | cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley | 41 | cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley |
43 | endif | 42 | endif |
diff --git a/arch/ia64/ia32/Makefile b/arch/ia64/ia32/Makefile index 2ed90da81166..61cb60affd95 100644 --- a/arch/ia64/ia32/Makefile +++ b/arch/ia64/ia32/Makefile | |||
@@ -2,11 +2,9 @@ | |||
2 | # Makefile for the ia32 kernel emulation subsystem. | 2 | # Makefile for the ia32 kernel emulation subsystem. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := ia32_entry.o sys_ia32.o ia32_ioctl.o ia32_signal.o \ | 5 | obj-y := ia32_entry.o sys_ia32.o ia32_signal.o \ |
6 | ia32_support.o ia32_traps.o binfmt_elf32.o ia32_ldt.o | 6 | ia32_support.o ia32_traps.o binfmt_elf32.o ia32_ldt.o |
7 | 7 | ||
8 | CFLAGS_ia32_ioctl.o += -Ifs/ | ||
9 | |||
10 | # Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and | 8 | # Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and |
11 | # restore_ia32_fpstate_live() can be sure the live register contain user-level state. | 9 | # restore_ia32_fpstate_live() can be sure the live register contain user-level state. |
12 | CFLAGS_ia32_signal.o += -mfixed-range=f16-f31 | 10 | CFLAGS_ia32_signal.o += -mfixed-range=f16-f31 |
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index 494fad6bf376..95fe04400f6b 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S | |||
@@ -469,7 +469,7 @@ ia32_syscall_table: | |||
469 | data8 sys32_epoll_wait | 469 | data8 sys32_epoll_wait |
470 | data8 sys_remap_file_pages | 470 | data8 sys_remap_file_pages |
471 | data8 sys_set_tid_address | 471 | data8 sys_set_tid_address |
472 | data8 sys32_timer_create | 472 | data8 compat_sys_timer_create |
473 | data8 compat_sys_timer_settime /* 260 */ | 473 | data8 compat_sys_timer_settime /* 260 */ |
474 | data8 compat_sys_timer_gettime | 474 | data8 compat_sys_timer_gettime |
475 | data8 sys_timer_getoverrun | 475 | data8 sys_timer_getoverrun |
diff --git a/arch/ia64/ia32/ia32_ioctl.c b/arch/ia64/ia32/ia32_ioctl.c deleted file mode 100644 index 88739394f6df..000000000000 --- a/arch/ia64/ia32/ia32_ioctl.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * IA32 Architecture-specific ioctl shim code | ||
3 | * | ||
4 | * Copyright (C) 2000 VA Linux Co | ||
5 | * Copyright (C) 2000 Don Dugger <n0ano@valinux.com> | ||
6 | * Copyright (C) 2001-2003 Hewlett-Packard Co | ||
7 | * David Mosberger-Tang <davidm@hpl.hp.com> | ||
8 | */ | ||
9 | |||
10 | #include <linux/signal.h> /* argh, msdos_fs.h isn't self-contained... */ | ||
11 | #include <linux/syscalls.h> | ||
12 | #include "ia32priv.h" | ||
13 | |||
14 | #define INCLUDES | ||
15 | #include "compat_ioctl.c" | ||
16 | |||
17 | #define IOCTL_NR(a) ((a) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) | ||
18 | |||
19 | #define DO_IOCTL(fd, cmd, arg) ({ \ | ||
20 | int _ret; \ | ||
21 | mm_segment_t _old_fs = get_fs(); \ | ||
22 | \ | ||
23 | set_fs(KERNEL_DS); \ | ||
24 | _ret = sys_ioctl(fd, cmd, (unsigned long)arg); \ | ||
25 | set_fs(_old_fs); \ | ||
26 | _ret; \ | ||
27 | }) | ||
28 | |||
29 | #define CODE | ||
30 | #include "compat_ioctl.c" | ||
31 | |||
32 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) | ||
33 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, | ||
34 | #define IOCTL_TABLE_START \ | ||
35 | struct ioctl_trans ioctl_start[] = { | ||
36 | #define IOCTL_TABLE_END \ | ||
37 | }; | ||
38 | |||
39 | IOCTL_TABLE_START | ||
40 | #define DECLARES | ||
41 | #include "compat_ioctl.c" | ||
42 | #include <linux/compat_ioctl.h> | ||
43 | IOCTL_TABLE_END | ||
44 | |||
45 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 9f8e8d558873..5ea38286d8d5 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -2553,34 +2553,6 @@ sys32_get_thread_area (struct ia32_user_desc __user *u_info) | |||
2553 | return 0; | 2553 | return 0; |
2554 | } | 2554 | } |
2555 | 2555 | ||
2556 | asmlinkage long | ||
2557 | sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id) | ||
2558 | { | ||
2559 | struct sigevent se; | ||
2560 | mm_segment_t oldfs; | ||
2561 | timer_t t; | ||
2562 | long err; | ||
2563 | |||
2564 | if (se32 == NULL) | ||
2565 | return sys_timer_create(clock, NULL, timer_id); | ||
2566 | |||
2567 | if (get_compat_sigevent(&se, se32)) | ||
2568 | return -EFAULT; | ||
2569 | |||
2570 | if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t))) | ||
2571 | return -EFAULT; | ||
2572 | |||
2573 | oldfs = get_fs(); | ||
2574 | set_fs(KERNEL_DS); | ||
2575 | err = sys_timer_create(clock, (struct sigevent __user *) &se, (timer_t __user *) &t); | ||
2576 | set_fs(oldfs); | ||
2577 | |||
2578 | if (!err) | ||
2579 | err = __put_user (t, timer_id); | ||
2580 | |||
2581 | return err; | ||
2582 | } | ||
2583 | |||
2584 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, | 2556 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, |
2585 | __u32 len_low, __u32 len_high, int advice) | 2557 | __u32 len_low, __u32 len_high, int advice) |
2586 | { | 2558 | { |
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 89a70400c4f6..4de7f6759093 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -467,10 +467,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) | |||
467 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); | 467 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); |
468 | } | 468 | } |
469 | 469 | ||
470 | void __kprobes arch_remove_kprobe(struct kprobe *p) | ||
471 | { | ||
472 | } | ||
473 | |||
474 | /* | 470 | /* |
475 | * We are resuming execution after a single step fault, so the pt_regs | 471 | * We are resuming execution after a single step fault, so the pt_regs |
476 | * structure reflects the register state after we executed the instruction | 472 | * structure reflects the register state after we executed the instruction |
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index fae67bbb52f6..a3dcc3fab4b7 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
@@ -12,10 +12,6 @@ config M32R | |||
12 | config SBUS | 12 | config SBUS |
13 | bool | 13 | bool |
14 | 14 | ||
15 | config UID16 | ||
16 | bool | ||
17 | default n | ||
18 | |||
19 | config GENERIC_ISA_DMA | 15 | config GENERIC_ISA_DMA |
20 | bool | 16 | bool |
21 | default y | 17 | default y |
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c index e5ec134d81d9..dbc8a392105f 100644 --- a/arch/m32r/kernel/m32r_ksyms.c +++ b/arch/m32r/kernel/m32r_ksyms.c | |||
@@ -18,8 +18,6 @@ | |||
18 | #include <asm/irq.h> | 18 | #include <asm/irq.h> |
19 | #include <asm/tlbflush.h> | 19 | #include <asm/tlbflush.h> |
20 | 20 | ||
21 | extern void dump_thread(struct pt_regs *, struct user *); | ||
22 | |||
23 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) | 21 | #if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) |
24 | extern struct drive_info_struct drive_info; | 22 | extern struct drive_info_struct drive_info; |
25 | EXPORT_SYMBOL(drive_info); | 23 | EXPORT_SYMBOL(drive_info); |
@@ -27,7 +25,6 @@ EXPORT_SYMBOL(drive_info); | |||
27 | 25 | ||
28 | /* platform dependent support */ | 26 | /* platform dependent support */ |
29 | EXPORT_SYMBOL(boot_cpu_data); | 27 | EXPORT_SYMBOL(boot_cpu_data); |
30 | EXPORT_SYMBOL(dump_thread); | ||
31 | EXPORT_SYMBOL(dump_fpu); | 28 | EXPORT_SYMBOL(dump_fpu); |
32 | EXPORT_SYMBOL(__ioremap); | 29 | EXPORT_SYMBOL(__ioremap); |
33 | EXPORT_SYMBOL(iounmap); | 30 | EXPORT_SYMBOL(iounmap); |
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index 3bf55d92933f..2a1f250349b7 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c | |||
@@ -261,14 +261,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, | |||
261 | } | 261 | } |
262 | 262 | ||
263 | /* | 263 | /* |
264 | * fill in the user structure for a core dump.. | ||
265 | */ | ||
266 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
267 | { | ||
268 | /* M32R_FIXME */ | ||
269 | } | ||
270 | |||
271 | /* | ||
272 | * Capture the user space registers if the task is not running (in user space) | 264 | * Capture the user space registers if the task is not running (in user space) |
273 | */ | 265 | */ |
274 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) | 266 | int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) |
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c index 73e2f5e168dd..3d7f2000b714 100644 --- a/arch/m68k/kernel/m68k_ksyms.c +++ b/arch/m68k/kernel/m68k_ksyms.c | |||
@@ -23,8 +23,6 @@ asmlinkage long long __lshrdi3 (long long, int); | |||
23 | asmlinkage long long __muldi3 (long long, long long); | 23 | asmlinkage long long __muldi3 (long long, long long); |
24 | extern char m68k_debug_device[]; | 24 | extern char m68k_debug_device[]; |
25 | 25 | ||
26 | extern void dump_thread(struct pt_regs *, struct user *); | ||
27 | |||
28 | /* platform dependent support */ | 26 | /* platform dependent support */ |
29 | 27 | ||
30 | EXPORT_SYMBOL(m68k_machtype); | 28 | EXPORT_SYMBOL(m68k_machtype); |
diff --git a/arch/m68knommu/kernel/m68k_ksyms.c b/arch/m68knommu/kernel/m68k_ksyms.c index b2c62eeb3bab..eddb8d3e130a 100644 --- a/arch/m68knommu/kernel/m68k_ksyms.c +++ b/arch/m68knommu/kernel/m68k_ksyms.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/checksum.h> | 18 | #include <asm/checksum.h> |
19 | #include <asm/current.h> | 19 | #include <asm/current.h> |
20 | 20 | ||
21 | extern void dump_thread(struct pt_regs *, struct user *); | ||
22 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | 21 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); |
23 | 22 | ||
24 | /* platform dependent support */ | 23 | /* platform dependent support */ |
@@ -26,7 +25,6 @@ extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | |||
26 | EXPORT_SYMBOL(__ioremap); | 25 | EXPORT_SYMBOL(__ioremap); |
27 | EXPORT_SYMBOL(iounmap); | 26 | EXPORT_SYMBOL(iounmap); |
28 | EXPORT_SYMBOL(dump_fpu); | 27 | EXPORT_SYMBOL(dump_fpu); |
29 | EXPORT_SYMBOL(dump_thread); | ||
30 | EXPORT_SYMBOL(strnlen); | 28 | EXPORT_SYMBOL(strnlen); |
31 | EXPORT_SYMBOL(strrchr); | 29 | EXPORT_SYMBOL(strrchr); |
32 | EXPORT_SYMBOL(strstr); | 30 | EXPORT_SYMBOL(strstr); |
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c index 82e7ec888806..8b3cf57ba706 100644 --- a/arch/m68knommu/kernel/process.c +++ b/arch/m68knommu/kernel/process.c | |||
@@ -276,52 +276,6 @@ int dump_fpu(struct pt_regs *regs, struct user_m68kfp_struct *fpu) | |||
276 | } | 276 | } |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * fill in the user structure for a core dump.. | ||
280 | */ | ||
281 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
282 | { | ||
283 | struct switch_stack *sw; | ||
284 | |||
285 | /* changed the size calculations - should hopefully work better. lbt */ | ||
286 | dump->magic = CMAGIC; | ||
287 | dump->start_code = 0; | ||
288 | dump->start_stack = rdusp() & ~(PAGE_SIZE - 1); | ||
289 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
290 | dump->u_dsize = ((unsigned long) (current->mm->brk + | ||
291 | (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
292 | dump->u_dsize -= dump->u_tsize; | ||
293 | dump->u_ssize = 0; | ||
294 | |||
295 | if (dump->start_stack < TASK_SIZE) | ||
296 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | ||
297 | |||
298 | dump->u_ar0 = (struct user_regs_struct *)((int)&dump->regs - (int)dump); | ||
299 | sw = ((struct switch_stack *)regs) - 1; | ||
300 | dump->regs.d1 = regs->d1; | ||
301 | dump->regs.d2 = regs->d2; | ||
302 | dump->regs.d3 = regs->d3; | ||
303 | dump->regs.d4 = regs->d4; | ||
304 | dump->regs.d5 = regs->d5; | ||
305 | dump->regs.d6 = sw->d6; | ||
306 | dump->regs.d7 = sw->d7; | ||
307 | dump->regs.a0 = regs->a0; | ||
308 | dump->regs.a1 = regs->a1; | ||
309 | dump->regs.a2 = regs->a2; | ||
310 | dump->regs.a3 = sw->a3; | ||
311 | dump->regs.a4 = sw->a4; | ||
312 | dump->regs.a5 = sw->a5; | ||
313 | dump->regs.a6 = sw->a6; | ||
314 | dump->regs.d0 = regs->d0; | ||
315 | dump->regs.orig_d0 = regs->orig_d0; | ||
316 | dump->regs.stkadj = regs->stkadj; | ||
317 | dump->regs.sr = regs->sr; | ||
318 | dump->regs.pc = regs->pc; | ||
319 | dump->regs.fmtvec = (regs->format << 12) | regs->vector; | ||
320 | /* dump floating point stuff */ | ||
321 | dump->u_fpvalid = dump_fpu (regs, &dump->m68kfp); | ||
322 | } | ||
323 | |||
324 | /* | ||
325 | * Generic dumping code. Used for panic and debug. | 279 | * Generic dumping code. Used for panic and debug. |
326 | */ | 280 | */ |
327 | void dump(struct pt_regs *fp) | 281 | void dump(struct pt_regs *fp) |
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index 72f2126ad19d..f36c4f20ee8a 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -50,7 +50,7 @@ obj-$(CONFIG_MIPS_BOARDS_GEN) += irq-msc01.o | |||
50 | obj-$(CONFIG_32BIT) += scall32-o32.o | 50 | obj-$(CONFIG_32BIT) += scall32-o32.o |
51 | obj-$(CONFIG_64BIT) += scall64-64.o | 51 | obj-$(CONFIG_64BIT) += scall64-64.o |
52 | obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o | 52 | obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o |
53 | obj-$(CONFIG_MIPS32_COMPAT) += ioctl32.o linux32.o signal32.o | 53 | obj-$(CONFIG_MIPS32_COMPAT) += linux32.o signal32.o |
54 | obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o | 54 | obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o |
55 | obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o ptrace32.o | 55 | obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o ptrace32.o |
56 | 56 | ||
@@ -60,6 +60,5 @@ obj-$(CONFIG_PROC_FS) += proc.o | |||
60 | obj-$(CONFIG_64BIT) += cpu-bugs64.o | 60 | obj-$(CONFIG_64BIT) += cpu-bugs64.o |
61 | 61 | ||
62 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | 62 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) |
63 | CFLAGS_ioctl32.o += -Ifs/ | ||
64 | 63 | ||
65 | EXTRA_AFLAGS := $(CFLAGS) | 64 | EXTRA_AFLAGS := $(CFLAGS) |
diff --git a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c deleted file mode 100644 index 9ea1fc748864..000000000000 --- a/arch/mips/kernel/ioctl32.c +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | /* | ||
2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. | ||
3 | * | ||
4 | * Copyright (C) 2000 Silicon Graphics, Inc. | ||
5 | * Written by Ulf Carlsson (ulfc@engr.sgi.com) | ||
6 | * Copyright (C) 2000, 2004 Ralf Baechle | ||
7 | * Copyright (C) 2002, 2003 Maciej W. Rozycki | ||
8 | */ | ||
9 | #define INCLUDES | ||
10 | #include "compat_ioctl.c" | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/compat.h> | ||
15 | #include <linux/ioctl32.h> | ||
16 | #include <linux/syscalls.h> | ||
17 | |||
18 | #ifdef CONFIG_SIBYTE_TBPROF | ||
19 | #include <asm/sibyte/trace_prof.h> | ||
20 | #endif | ||
21 | |||
22 | #define A(__x) ((unsigned long)(__x)) | ||
23 | |||
24 | long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); | ||
25 | |||
26 | #define CODE | ||
27 | #include "compat_ioctl.c" | ||
28 | |||
29 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) | ||
30 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, | ||
31 | #define IOCTL_TABLE_START \ | ||
32 | struct ioctl_trans ioctl_start[] = { | ||
33 | #define IOCTL_TABLE_END \ | ||
34 | }; | ||
35 | |||
36 | IOCTL_TABLE_START | ||
37 | |||
38 | #include <linux/compat_ioctl.h> | ||
39 | #define DECLARES | ||
40 | #include "compat_ioctl.c" | ||
41 | |||
42 | /*HANDLE_IOCTL(RTC_IRQP_READ, w_long) | ||
43 | COMPATIBLE_IOCTL(RTC_IRQP_SET) | ||
44 | HANDLE_IOCTL(RTC_EPOCH_READ, w_long) | ||
45 | COMPATIBLE_IOCTL(RTC_EPOCH_SET) | ||
46 | */ | ||
47 | |||
48 | IOCTL_TABLE_END | ||
49 | |||
50 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile index 171f9c239f60..27827bc3717e 100644 --- a/arch/parisc/kernel/Makefile +++ b/arch/parisc/kernel/Makefile | |||
@@ -6,7 +6,6 @@ extra-y := init_task.o head.o vmlinux.lds | |||
6 | 6 | ||
7 | AFLAGS_entry.o := -traditional | 7 | AFLAGS_entry.o := -traditional |
8 | AFLAGS_pacache.o := -traditional | 8 | AFLAGS_pacache.o := -traditional |
9 | CFLAGS_ioctl32.o := -Ifs/ | ||
10 | 9 | ||
11 | obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ | 10 | obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ |
12 | pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ | 11 | pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ |
@@ -19,6 +18,6 @@ obj-$(CONFIG_SMP) += smp.o | |||
19 | obj-$(CONFIG_PA11) += pci-dma.o | 18 | obj-$(CONFIG_PA11) += pci-dma.o |
20 | obj-$(CONFIG_PCI) += pci.o | 19 | obj-$(CONFIG_PCI) += pci.o |
21 | obj-$(CONFIG_MODULES) += module.o | 20 | obj-$(CONFIG_MODULES) += module.o |
22 | obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o ioctl32.o signal32.o | 21 | obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o |
23 | # only supported for PCX-W/U in 64-bit mode at the moment | 22 | # only supported for PCX-W/U in 64-bit mode at the moment |
24 | obj-$(CONFIG_64BIT) += perf.o perf_asm.o | 23 | obj-$(CONFIG_64BIT) += perf.o perf_asm.o |
diff --git a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c deleted file mode 100644 index 4eada1bb27f0..000000000000 --- a/arch/parisc/kernel/ioctl32.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* $Id: ioctl32.c,v 1.5 2002/10/18 00:21:43 varenet Exp $ | ||
2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. | ||
3 | * | ||
4 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) | ||
5 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) | ||
6 | * | ||
7 | * These routines maintain argument size conversion between 32bit and 64bit | ||
8 | * ioctls. | ||
9 | */ | ||
10 | |||
11 | #include <linux/syscalls.h> | ||
12 | |||
13 | #define INCLUDES | ||
14 | #include "compat_ioctl.c" | ||
15 | |||
16 | #include <asm/perf.h> | ||
17 | #include <asm/ioctls.h> | ||
18 | |||
19 | #define CODE | ||
20 | #include "compat_ioctl.c" | ||
21 | |||
22 | #define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, NULL }, | ||
23 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl) | ||
24 | |||
25 | #define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = { | ||
26 | #define IOCTL_TABLE_END }; | ||
27 | |||
28 | IOCTL_TABLE_START | ||
29 | #include <linux/compat_ioctl.h> | ||
30 | |||
31 | #define DECLARES | ||
32 | #include "compat_ioctl.c" | ||
33 | |||
34 | /* And these ioctls need translation */ | ||
35 | HANDLE_IOCTL(SIOCGPPPSTATS, dev_ifsioc) | ||
36 | HANDLE_IOCTL(SIOCGPPPCSTATS, dev_ifsioc) | ||
37 | HANDLE_IOCTL(SIOCGPPPVER, dev_ifsioc) | ||
38 | |||
39 | #if defined(CONFIG_GEN_RTC) | ||
40 | COMPATIBLE_IOCTL(RTC_AIE_ON) | ||
41 | COMPATIBLE_IOCTL(RTC_AIE_OFF) | ||
42 | COMPATIBLE_IOCTL(RTC_UIE_ON) | ||
43 | COMPATIBLE_IOCTL(RTC_UIE_OFF) | ||
44 | COMPATIBLE_IOCTL(RTC_PIE_ON) | ||
45 | COMPATIBLE_IOCTL(RTC_PIE_OFF) | ||
46 | COMPATIBLE_IOCTL(RTC_WIE_ON) | ||
47 | COMPATIBLE_IOCTL(RTC_WIE_OFF) | ||
48 | COMPATIBLE_IOCTL(RTC_ALM_SET) /* struct rtc_time only has ints */ | ||
49 | COMPATIBLE_IOCTL(RTC_ALM_READ) /* struct rtc_time only has ints */ | ||
50 | COMPATIBLE_IOCTL(RTC_RD_TIME) /* struct rtc_time only has ints */ | ||
51 | COMPATIBLE_IOCTL(RTC_SET_TIME) /* struct rtc_time only has ints */ | ||
52 | HANDLE_IOCTL(RTC_IRQP_READ, w_long) | ||
53 | COMPATIBLE_IOCTL(RTC_IRQP_SET) | ||
54 | HANDLE_IOCTL(RTC_EPOCH_READ, w_long) | ||
55 | COMPATIBLE_IOCTL(RTC_EPOCH_SET) | ||
56 | #endif | ||
57 | |||
58 | IOCTL_TABLE_END | ||
59 | |||
60 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index 5f80e58e5cb3..d3654a264ef7 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile | |||
@@ -76,8 +76,7 @@ LINUXINCLUDE += $(LINUXINCLUDE-y) | |||
76 | CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ | 76 | CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ |
77 | 77 | ||
78 | ifeq ($(CONFIG_PPC64),y) | 78 | ifeq ($(CONFIG_PPC64),y) |
79 | GCC_VERSION := $(call cc-version) | 79 | GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi) |
80 | GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi) | ||
81 | 80 | ||
82 | ifeq ($(CONFIG_POWER4_ONLY),y) | 81 | ifeq ($(CONFIG_POWER4_ONLY),y) |
83 | ifeq ($(CONFIG_ALTIVEC),y) | 82 | ifeq ($(CONFIG_ALTIVEC),y) |
@@ -189,10 +188,9 @@ TOUT := .tmp_gas_check | |||
189 | # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec | 188 | # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec |
190 | # instructions. | 189 | # instructions. |
191 | # gcc-3.4 and binutils-2.14 are a fatal combination. | 190 | # gcc-3.4 and binutils-2.14 are a fatal combination. |
192 | GCC_VERSION := $(call cc-version) | ||
193 | 191 | ||
194 | checkbin: | 192 | checkbin: |
195 | @if test "$(GCC_VERSION)" = "0304" ; then \ | 193 | @if test "$(call cc-version)" = "0304" ; then \ |
196 | if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ | 194 | if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ |
197 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ | 195 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ |
198 | echo 'correctly with gcc-3.4 and your version of binutils.'; \ | 196 | echo 'correctly with gcc-3.4 and your version of binutils.'; \ |
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig index 509399eab6f5..347f4391db8d 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig | |||
@@ -861,7 +861,7 @@ CONFIG_SERIAL_CORE=y | |||
861 | CONFIG_SERIAL_CORE_CONSOLE=y | 861 | CONFIG_SERIAL_CORE_CONSOLE=y |
862 | # CONFIG_SERIAL_PMACZILOG is not set | 862 | # CONFIG_SERIAL_PMACZILOG is not set |
863 | CONFIG_SERIAL_ICOM=m | 863 | CONFIG_SERIAL_ICOM=m |
864 | CONFIG_SERIAL_JSM=m | 864 | # CONFIG_SERIAL_JSM is not set |
865 | CONFIG_UNIX98_PTYS=y | 865 | CONFIG_UNIX98_PTYS=y |
866 | CONFIG_LEGACY_PTYS=y | 866 | CONFIG_LEGACY_PTYS=y |
867 | CONFIG_LEGACY_PTY_COUNT=256 | 867 | CONFIG_LEGACY_PTY_COUNT=256 |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 0faf95c93ef8..144e284d21dd 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | ifeq ($(CONFIG_PPC64),y) | 5 | ifeq ($(CONFIG_PPC64),y) |
6 | EXTRA_CFLAGS += -mno-minimal-toc | 6 | EXTRA_CFLAGS += -mno-minimal-toc |
7 | CFLAGS_ioctl32.o += -Ifs/ | ||
8 | endif | 7 | endif |
9 | ifeq ($(CONFIG_PPC32),y) | 8 | ifeq ($(CONFIG_PPC32),y) |
10 | CFLAGS_prom_init.o += -fPIC | 9 | CFLAGS_prom_init.o += -fPIC |
@@ -16,7 +15,7 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ | |||
16 | obj-y += vdso32/ | 15 | obj-y += vdso32/ |
17 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ | 16 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ |
18 | signal_64.o ptrace32.o systbl.o \ | 17 | signal_64.o ptrace32.o systbl.o \ |
19 | paca.o ioctl32.o cpu_setup_power4.o \ | 18 | paca.o cpu_setup_power4.o \ |
20 | firmware.o sysfs.o idle_64.o | 19 | firmware.o sysfs.o idle_64.o |
21 | obj-$(CONFIG_PPC64) += vdso64/ | 20 | obj-$(CONFIG_PPC64) += vdso64/ |
22 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o | 21 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o |
diff --git a/arch/powerpc/kernel/ioctl32.c b/arch/powerpc/kernel/ioctl32.c deleted file mode 100644 index 0fa3d27fef01..000000000000 --- a/arch/powerpc/kernel/ioctl32.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. | ||
3 | * | ||
4 | * Based on sparc64 ioctl32.c by: | ||
5 | * | ||
6 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) | ||
7 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) | ||
8 | * | ||
9 | * ppc64 changes: | ||
10 | * | ||
11 | * Copyright (C) 2000 Ken Aaker (kdaaker@rchland.vnet.ibm.com) | ||
12 | * Copyright (C) 2001 Anton Blanchard (antonb@au.ibm.com) | ||
13 | * | ||
14 | * These routines maintain argument size conversion between 32bit and 64bit | ||
15 | * ioctls. | ||
16 | * | ||
17 | * This program is free software; you can redistribute it and/or | ||
18 | * modify it under the terms of the GNU General Public License | ||
19 | * as published by the Free Software Foundation; either version | ||
20 | * 2 of the License, or (at your option) any later version. | ||
21 | */ | ||
22 | |||
23 | #define INCLUDES | ||
24 | #include "compat_ioctl.c" | ||
25 | #include <linux/syscalls.h> | ||
26 | |||
27 | #define CODE | ||
28 | #include "compat_ioctl.c" | ||
29 | |||
30 | #define HANDLE_IOCTL(cmd,handler) { cmd, (ioctl_trans_handler_t)handler, NULL }, | ||
31 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl) | ||
32 | |||
33 | #define IOCTL_TABLE_START \ | ||
34 | struct ioctl_trans ioctl_start[] = { | ||
35 | #define IOCTL_TABLE_END \ | ||
36 | }; | ||
37 | |||
38 | IOCTL_TABLE_START | ||
39 | #include <linux/compat_ioctl.h> | ||
40 | #define DECLARES | ||
41 | #include "compat_ioctl.c" | ||
42 | |||
43 | IOCTL_TABLE_END | ||
44 | |||
45 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 5368f9c2e6bf..27b0c40601fb 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <asm/kdebug.h> | 35 | #include <asm/kdebug.h> |
36 | #include <asm/sstep.h> | 36 | #include <asm/sstep.h> |
37 | 37 | ||
38 | static DECLARE_MUTEX(kprobe_mutex); | ||
39 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | 38 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; |
40 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 39 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
41 | 40 | ||
@@ -54,19 +53,17 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
54 | 53 | ||
55 | /* insn must be on a special executable page on ppc64 */ | 54 | /* insn must be on a special executable page on ppc64 */ |
56 | if (!ret) { | 55 | if (!ret) { |
57 | down(&kprobe_mutex); | ||
58 | p->ainsn.insn = get_insn_slot(); | 56 | p->ainsn.insn = get_insn_slot(); |
59 | up(&kprobe_mutex); | ||
60 | if (!p->ainsn.insn) | 57 | if (!p->ainsn.insn) |
61 | ret = -ENOMEM; | 58 | ret = -ENOMEM; |
62 | } | 59 | } |
63 | return ret; | ||
64 | } | ||
65 | 60 | ||
66 | void __kprobes arch_copy_kprobe(struct kprobe *p) | 61 | if (!ret) { |
67 | { | 62 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); |
68 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); | 63 | p->opcode = *p->addr; |
69 | p->opcode = *p->addr; | 64 | } |
65 | |||
66 | return ret; | ||
70 | } | 67 | } |
71 | 68 | ||
72 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 69 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 9b6d965fb13e..475249dc2350 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -932,38 +932,6 @@ long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, | |||
932 | advice); | 932 | advice); |
933 | } | 933 | } |
934 | 934 | ||
935 | long ppc32_timer_create(clockid_t clock, | ||
936 | struct compat_sigevent __user *ev32, | ||
937 | timer_t __user *timer_id) | ||
938 | { | ||
939 | sigevent_t event; | ||
940 | timer_t t; | ||
941 | long err; | ||
942 | mm_segment_t savefs; | ||
943 | |||
944 | if (ev32 == NULL) | ||
945 | return sys_timer_create(clock, NULL, timer_id); | ||
946 | |||
947 | if (get_compat_sigevent(&event, ev32)) | ||
948 | return -EFAULT; | ||
949 | |||
950 | if (!access_ok(VERIFY_WRITE, timer_id, sizeof(timer_t))) | ||
951 | return -EFAULT; | ||
952 | |||
953 | savefs = get_fs(); | ||
954 | set_fs(KERNEL_DS); | ||
955 | /* The __user pointer casts are valid due to the set_fs() */ | ||
956 | err = sys_timer_create(clock, | ||
957 | (sigevent_t __user *) &event, | ||
958 | (timer_t __user *) &t); | ||
959 | set_fs(savefs); | ||
960 | |||
961 | if (err == 0) | ||
962 | err = __put_user(t, timer_id); | ||
963 | |||
964 | return err; | ||
965 | } | ||
966 | |||
967 | asmlinkage long compat_sys_add_key(const char __user *_type, | 935 | asmlinkage long compat_sys_add_key(const char __user *_type, |
968 | const char __user *_description, | 936 | const char __user *_description, |
969 | const void __user *_payload, | 937 | const void __user *_payload, |
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index c3ae74b1bf2d..68013179a503 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S | |||
@@ -281,7 +281,7 @@ SYSCALL(epoll_create) | |||
281 | SYSCALL(epoll_ctl) | 281 | SYSCALL(epoll_ctl) |
282 | SYSCALL(epoll_wait) | 282 | SYSCALL(epoll_wait) |
283 | SYSCALL(remap_file_pages) | 283 | SYSCALL(remap_file_pages) |
284 | SYSX(sys_timer_create,ppc32_timer_create,sys_timer_create) | 284 | SYSX(sys_timer_create,compat_sys_timer_create,sys_timer_create) |
285 | COMPAT_SYS(timer_settime) | 285 | COMPAT_SYS(timer_settime) |
286 | COMPAT_SYS(timer_gettime) | 286 | COMPAT_SYS(timer_gettime) |
287 | SYSCALL(timer_getoverrun) | 287 | SYSCALL(timer_getoverrun) |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index d2ba358c6e38..b3962c3a0348 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -138,7 +138,7 @@ static void spufs_prune_dir(struct dentry *dir) | |||
138 | { | 138 | { |
139 | struct dentry *dentry, *tmp; | 139 | struct dentry *dentry, *tmp; |
140 | mutex_lock(&dir->d_inode->i_mutex); | 140 | mutex_lock(&dir->d_inode->i_mutex); |
141 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { | 141 | list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { |
142 | spin_lock(&dcache_lock); | 142 | spin_lock(&dcache_lock); |
143 | spin_lock(&dentry->d_lock); | 143 | spin_lock(&dentry->d_lock); |
144 | if (!(d_unhashed(dentry)) && dentry->d_inode) { | 144 | if (!(d_unhashed(dentry)) && dentry->d_inode) { |
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index e719a4933af1..98e940beeb3b 100644 --- a/arch/ppc/Makefile +++ b/arch/ppc/Makefile | |||
@@ -128,10 +128,9 @@ TOUT := .tmp_gas_check | |||
128 | # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec | 128 | # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec |
129 | # instructions. | 129 | # instructions. |
130 | # gcc-3.4 and binutils-2.14 are a fatal combination. | 130 | # gcc-3.4 and binutils-2.14 are a fatal combination. |
131 | GCC_VERSION := $(call cc-version) | ||
132 | 131 | ||
133 | checkbin: | 132 | checkbin: |
134 | @if test "$(GCC_VERSION)" = "0304" ; then \ | 133 | @if test "$(call cc-version)" = "0304" ; then \ |
135 | if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ | 134 | if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ |
136 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ | 135 | echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ |
137 | echo 'correctly with gcc-3.4 and your version of binutils.'; \ | 136 | echo 'correctly with gcc-3.4 and your version of binutils.'; \ |
diff --git a/arch/ppc/kernel/machine_kexec.c b/arch/ppc/kernel/machine_kexec.c index a882b0dbe8de..84d65a87191e 100644 --- a/arch/ppc/kernel/machine_kexec.c +++ b/arch/ppc/kernel/machine_kexec.c | |||
@@ -28,12 +28,6 @@ typedef NORET_TYPE void (*relocate_new_kernel_t)( | |||
28 | const extern unsigned char relocate_new_kernel[]; | 28 | const extern unsigned char relocate_new_kernel[]; |
29 | const extern unsigned int relocate_new_kernel_size; | 29 | const extern unsigned int relocate_new_kernel_size; |
30 | 30 | ||
31 | /* | ||
32 | * Provide a dummy crash_notes definition while crash dump arrives to ppc. | ||
33 | * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. | ||
34 | */ | ||
35 | note_buf_t crash_notes[NR_CPUS]; | ||
36 | |||
37 | void machine_shutdown(void) | 31 | void machine_shutdown(void) |
38 | { | 32 | { |
39 | if (ppc_md.machine_shutdown) | 33 | if (ppc_md.machine_shutdown) |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 6fe532d82417..b66602ad7b33 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -27,11 +27,6 @@ config S390 | |||
27 | bool | 27 | bool |
28 | default y | 28 | default y |
29 | 29 | ||
30 | config UID16 | ||
31 | bool | ||
32 | default y | ||
33 | depends on !64BIT | ||
34 | |||
35 | source "init/Kconfig" | 30 | source "init/Kconfig" |
36 | 31 | ||
37 | menu "Base setup" | 32 | menu "Base setup" |
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 4865e4b49464..9269b5788fac 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -17,8 +17,7 @@ obj-$(CONFIG_MODULES) += s390_ksyms.o module.o | |||
17 | obj-$(CONFIG_SMP) += smp.o | 17 | obj-$(CONFIG_SMP) += smp.o |
18 | 18 | ||
19 | obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ | 19 | obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \ |
20 | compat_ioctl.o compat_wrapper.o \ | 20 | compat_wrapper.o compat_exec_domain.o |
21 | compat_exec_domain.o | ||
22 | obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o | 21 | obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o |
23 | 22 | ||
24 | obj-$(CONFIG_VIRT_TIMER) += vtime.o | 23 | obj-$(CONFIG_VIRT_TIMER) += vtime.o |
diff --git a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c deleted file mode 100644 index 6504c4e69986..000000000000 --- a/arch/s390/kernel/compat_ioctl.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. | ||
3 | * | ||
4 | * S390 version | ||
5 | * Copyright (C) 2000-2003 IBM Deutschland Entwicklung GmbH, IBM Corporation | ||
6 | * Author(s): Gerhard Tonn (ton@de.ibm.com) | ||
7 | * Arnd Bergmann (arndb@de.ibm.com) | ||
8 | * | ||
9 | * Original implementation from 32-bit Sparc compat code which is | ||
10 | * Copyright (C) 2000 Silicon Graphics, Inc. | ||
11 | * Written by Ulf Carlsson (ulfc@engr.sgi.com) | ||
12 | */ | ||
13 | |||
14 | #include "compat_linux.h" | ||
15 | #define INCLUDES | ||
16 | #define CODE | ||
17 | #include "../../../fs/compat_ioctl.c" | ||
18 | #include <asm/dasd.h> | ||
19 | #include <asm/cmb.h> | ||
20 | #include <asm/tape390.h> | ||
21 | #include <asm/ccwdev.h> | ||
22 | #include "../../../drivers/s390/char/raw3270.h" | ||
23 | |||
24 | static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, | ||
25 | unsigned long arg, struct file *f) | ||
26 | { | ||
27 | return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg)); | ||
28 | } | ||
29 | |||
30 | static int do_ioctl32_ulong(unsigned int fd, unsigned int cmd, | ||
31 | unsigned long arg, struct file *f) | ||
32 | { | ||
33 | return sys_ioctl(fd, cmd, arg); | ||
34 | } | ||
35 | |||
36 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)do_ioctl32_pointer) | ||
37 | #define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)do_ioctl32_ulong) | ||
38 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, | ||
39 | |||
40 | struct ioctl_trans ioctl_start[] = { | ||
41 | /* architecture independent ioctls */ | ||
42 | #include <linux/compat_ioctl.h> | ||
43 | #define DECLARES | ||
44 | #include "../../../fs/compat_ioctl.c" | ||
45 | |||
46 | /* s390 only ioctls */ | ||
47 | COMPATIBLE_IOCTL(DASDAPIVER) | ||
48 | COMPATIBLE_IOCTL(BIODASDDISABLE) | ||
49 | COMPATIBLE_IOCTL(BIODASDENABLE) | ||
50 | COMPATIBLE_IOCTL(BIODASDRSRV) | ||
51 | COMPATIBLE_IOCTL(BIODASDRLSE) | ||
52 | COMPATIBLE_IOCTL(BIODASDSLCK) | ||
53 | COMPATIBLE_IOCTL(BIODASDINFO) | ||
54 | COMPATIBLE_IOCTL(BIODASDINFO2) | ||
55 | COMPATIBLE_IOCTL(BIODASDFMT) | ||
56 | COMPATIBLE_IOCTL(BIODASDPRRST) | ||
57 | COMPATIBLE_IOCTL(BIODASDQUIESCE) | ||
58 | COMPATIBLE_IOCTL(BIODASDRESUME) | ||
59 | COMPATIBLE_IOCTL(BIODASDPRRD) | ||
60 | COMPATIBLE_IOCTL(BIODASDPSRD) | ||
61 | COMPATIBLE_IOCTL(BIODASDGATTR) | ||
62 | COMPATIBLE_IOCTL(BIODASDSATTR) | ||
63 | COMPATIBLE_IOCTL(BIODASDCMFENABLE) | ||
64 | COMPATIBLE_IOCTL(BIODASDCMFDISABLE) | ||
65 | COMPATIBLE_IOCTL(BIODASDREADALLCMB) | ||
66 | |||
67 | COMPATIBLE_IOCTL(TUBICMD) | ||
68 | COMPATIBLE_IOCTL(TUBOCMD) | ||
69 | COMPATIBLE_IOCTL(TUBGETI) | ||
70 | COMPATIBLE_IOCTL(TUBGETO) | ||
71 | COMPATIBLE_IOCTL(TUBSETMOD) | ||
72 | COMPATIBLE_IOCTL(TUBGETMOD) | ||
73 | |||
74 | COMPATIBLE_IOCTL(TAPE390_DISPLAY) | ||
75 | |||
76 | /* s390 doesn't need handlers here */ | ||
77 | COMPATIBLE_IOCTL(TIOCGSERIAL) | ||
78 | COMPATIBLE_IOCTL(TIOCSSERIAL) | ||
79 | }; | ||
80 | |||
81 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 41b197a3f3a3..cd3b3c3e7a9f 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -1014,38 +1014,6 @@ asmlinkage long sys32_clone(struct pt_regs regs) | |||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /* | 1016 | /* |
1017 | * Wrapper function for sys_timer_create. | ||
1018 | */ | ||
1019 | extern asmlinkage long | ||
1020 | sys_timer_create(clockid_t, struct sigevent *, timer_t *); | ||
1021 | |||
1022 | asmlinkage long | ||
1023 | sys32_timer_create(clockid_t which_clock, struct compat_sigevent *se32, | ||
1024 | timer_t *timer_id) | ||
1025 | { | ||
1026 | struct sigevent se; | ||
1027 | timer_t ktimer_id; | ||
1028 | mm_segment_t old_fs; | ||
1029 | long ret; | ||
1030 | |||
1031 | if (se32 == NULL) | ||
1032 | return sys_timer_create(which_clock, NULL, timer_id); | ||
1033 | |||
1034 | if (get_compat_sigevent(&se, se32)) | ||
1035 | return -EFAULT; | ||
1036 | |||
1037 | old_fs = get_fs(); | ||
1038 | set_fs(KERNEL_DS); | ||
1039 | ret = sys_timer_create(which_clock, &se, &ktimer_id); | ||
1040 | set_fs(old_fs); | ||
1041 | |||
1042 | if (!ret) | ||
1043 | ret = put_user (ktimer_id, timer_id); | ||
1044 | |||
1045 | return ret; | ||
1046 | } | ||
1047 | |||
1048 | /* | ||
1049 | * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. | 1017 | * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. |
1050 | * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} | 1018 | * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} |
1051 | * because the 31 bit values differ from the 64 bit values. | 1019 | * because the 31 bit values differ from the 64 bit values. |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 23fe94e58688..cfde1905d07d 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1289,7 +1289,7 @@ sys32_timer_create_wrapper: | |||
1289 | lgfr %r2,%r2 # timer_t (int) | 1289 | lgfr %r2,%r2 # timer_t (int) |
1290 | llgtr %r3,%r3 # struct compat_sigevent * | 1290 | llgtr %r3,%r3 # struct compat_sigevent * |
1291 | llgtr %r4,%r4 # timer_t * | 1291 | llgtr %r4,%r4 # timer_t * |
1292 | jg sys32_timer_create | 1292 | jg compat_sys_timer_create |
1293 | 1293 | ||
1294 | .globl sys32_timer_settime_wrapper | 1294 | .globl sys32_timer_settime_wrapper |
1295 | sys32_timer_settime_wrapper: | 1295 | sys32_timer_settime_wrapper: |
diff --git a/arch/s390/kernel/crash.c b/arch/s390/kernel/crash.c index 7bd169c58b0c..926cceeae0fa 100644 --- a/arch/s390/kernel/crash.c +++ b/arch/s390/kernel/crash.c | |||
@@ -10,8 +10,6 @@ | |||
10 | #include <linux/threads.h> | 10 | #include <linux/threads.h> |
11 | #include <linux/kexec.h> | 11 | #include <linux/kexec.h> |
12 | 12 | ||
13 | note_buf_t crash_notes[NR_CPUS]; | ||
14 | |||
15 | void machine_crash_shutdown(struct pt_regs *regs) | 13 | void machine_crash_shutdown(struct pt_regs *regs) |
16 | { | 14 | { |
17 | } | 15 | } |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index a942bf2d58e9..7dd58f8ac6b5 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -352,27 +352,6 @@ int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs) | |||
352 | return 1; | 352 | return 1; |
353 | } | 353 | } |
354 | 354 | ||
355 | /* | ||
356 | * fill in the user structure for a core dump.. | ||
357 | */ | ||
358 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
359 | { | ||
360 | |||
361 | /* changed the size calculations - should hopefully work better. lbt */ | ||
362 | dump->magic = CMAGIC; | ||
363 | dump->start_code = 0; | ||
364 | dump->start_stack = regs->gprs[15] & ~(PAGE_SIZE - 1); | ||
365 | dump->u_tsize = current->mm->end_code >> PAGE_SHIFT; | ||
366 | dump->u_dsize = (current->mm->brk + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
367 | dump->u_dsize -= dump->u_tsize; | ||
368 | dump->u_ssize = 0; | ||
369 | if (dump->start_stack < TASK_SIZE) | ||
370 | dump->u_ssize = (TASK_SIZE - dump->start_stack) >> PAGE_SHIFT; | ||
371 | memcpy(&dump->regs, regs, sizeof(s390_regs)); | ||
372 | dump_fpu (regs, &dump->regs.fp_regs); | ||
373 | dump->regs.per_info = current->thread.per_info; | ||
374 | } | ||
375 | |||
376 | unsigned long get_wchan(struct task_struct *p) | 355 | unsigned long get_wchan(struct task_struct *p) |
377 | { | 356 | { |
378 | struct stack_frame *sf, *low, *high; | 357 | struct stack_frame *sf, *low, *high; |
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c index bee654abb6d3..4176c77670c4 100644 --- a/arch/s390/kernel/s390_ksyms.c +++ b/arch/s390/kernel/s390_ksyms.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/smp.h> | 10 | #include <linux/smp.h> |
11 | #include <linux/syscalls.h> | 11 | #include <linux/syscalls.h> |
12 | #include <linux/interrupt.h> | 12 | #include <linux/interrupt.h> |
13 | #include <linux/ioctl32.h> | ||
14 | #include <asm/checksum.h> | 13 | #include <asm/checksum.h> |
15 | #include <asm/cpcmd.h> | 14 | #include <asm/cpcmd.h> |
16 | #include <asm/delay.h> | 15 | #include <asm/delay.h> |
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index fd4f240b833d..8a2bea34ddd2 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -305,26 +305,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
305 | return 0; | 305 | return 0; |
306 | } | 306 | } |
307 | 307 | ||
308 | /* | ||
309 | * fill in the user structure for a core dump.. | ||
310 | */ | ||
311 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
312 | { | ||
313 | dump->magic = CMAGIC; | ||
314 | dump->start_code = current->mm->start_code; | ||
315 | dump->start_data = current->mm->start_data; | ||
316 | dump->start_stack = regs->regs[15] & ~(PAGE_SIZE - 1); | ||
317 | dump->u_tsize = (current->mm->end_code - dump->start_code) >> PAGE_SHIFT; | ||
318 | dump->u_dsize = (current->mm->brk + (PAGE_SIZE-1) - dump->start_data) >> PAGE_SHIFT; | ||
319 | dump->u_ssize = (current->mm->start_stack - dump->start_stack + | ||
320 | PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
321 | /* Debug registers will come here. */ | ||
322 | |||
323 | dump->regs = *regs; | ||
324 | |||
325 | dump->u_fpvalid = dump_fpu(regs, &dump->fpu); | ||
326 | } | ||
327 | |||
328 | /* Tracing by user break controller. */ | 308 | /* Tracing by user break controller. */ |
329 | static void | 309 | static void |
330 | ubc_set_tracing(int asid, unsigned long pc) | 310 | ubc_set_tracing(int asid, unsigned long pc) |
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c index 6954fd62470a..1cf94a618be3 100644 --- a/arch/sh/kernel/sh_ksyms.c +++ b/arch/sh/kernel/sh_ksyms.c | |||
@@ -21,14 +21,12 @@ | |||
21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
22 | #include <asm/checksum.h> | 22 | #include <asm/checksum.h> |
23 | 23 | ||
24 | extern void dump_thread(struct pt_regs *, struct user *); | ||
25 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | 24 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); |
26 | extern struct hw_interrupt_type no_irq_type; | 25 | extern struct hw_interrupt_type no_irq_type; |
27 | 26 | ||
28 | EXPORT_SYMBOL(sh_mv); | 27 | EXPORT_SYMBOL(sh_mv); |
29 | 28 | ||
30 | /* platform dependent support */ | 29 | /* platform dependent support */ |
31 | EXPORT_SYMBOL(dump_thread); | ||
32 | EXPORT_SYMBOL(dump_fpu); | 30 | EXPORT_SYMBOL(dump_fpu); |
33 | EXPORT_SYMBOL(iounmap); | 31 | EXPORT_SYMBOL(iounmap); |
34 | EXPORT_SYMBOL(enable_irq); | 32 | EXPORT_SYMBOL(enable_irq); |
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig index fb35b45dc130..07b172deb872 100644 --- a/arch/sh64/Kconfig +++ b/arch/sh64/Kconfig | |||
@@ -17,10 +17,6 @@ config MMU | |||
17 | bool | 17 | bool |
18 | default y | 18 | default y |
19 | 19 | ||
20 | config UID16 | ||
21 | bool | ||
22 | default y | ||
23 | |||
24 | config RWSEM_GENERIC_SPINLOCK | 20 | config RWSEM_GENERIC_SPINLOCK |
25 | bool | 21 | bool |
26 | default y | 22 | default y |
diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c index b95d04141855..419b5a710441 100644 --- a/arch/sh64/kernel/process.c +++ b/arch/sh64/kernel/process.c | |||
@@ -775,26 +775,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, | |||
775 | return 0; | 775 | return 0; |
776 | } | 776 | } |
777 | 777 | ||
778 | /* | ||
779 | * fill in the user structure for a core dump.. | ||
780 | */ | ||
781 | void dump_thread(struct pt_regs * regs, struct user * dump) | ||
782 | { | ||
783 | dump->magic = CMAGIC; | ||
784 | dump->start_code = current->mm->start_code; | ||
785 | dump->start_data = current->mm->start_data; | ||
786 | dump->start_stack = regs->regs[15] & ~(PAGE_SIZE - 1); | ||
787 | dump->u_tsize = (current->mm->end_code - dump->start_code) >> PAGE_SHIFT; | ||
788 | dump->u_dsize = (current->mm->brk + (PAGE_SIZE-1) - dump->start_data) >> PAGE_SHIFT; | ||
789 | dump->u_ssize = (current->mm->start_stack - dump->start_stack + | ||
790 | PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
791 | /* Debug registers will come here. */ | ||
792 | |||
793 | dump->regs = *regs; | ||
794 | |||
795 | dump->u_fpvalid = dump_fpu(regs, &dump->fpu); | ||
796 | } | ||
797 | |||
798 | asmlinkage int sys_fork(unsigned long r2, unsigned long r3, | 778 | asmlinkage int sys_fork(unsigned long r2, unsigned long r3, |
799 | unsigned long r4, unsigned long r5, | 779 | unsigned long r4, unsigned long r5, |
800 | unsigned long r6, unsigned long r7, | 780 | unsigned long r6, unsigned long r7, |
diff --git a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c index 0b5497d70bd3..472b450e61be 100644 --- a/arch/sh64/kernel/sh_ksyms.c +++ b/arch/sh64/kernel/sh_ksyms.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <asm/delay.h> | 29 | #include <asm/delay.h> |
30 | #include <asm/irq.h> | 30 | #include <asm/irq.h> |
31 | 31 | ||
32 | extern void dump_thread(struct pt_regs *, struct user *); | ||
33 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); | 32 | extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); |
34 | 33 | ||
35 | #if 0 | 34 | #if 0 |
@@ -41,7 +40,6 @@ EXPORT_SYMBOL(drive_info); | |||
41 | #endif | 40 | #endif |
42 | 41 | ||
43 | /* platform dependent support */ | 42 | /* platform dependent support */ |
44 | EXPORT_SYMBOL(dump_thread); | ||
45 | EXPORT_SYMBOL(dump_fpu); | 43 | EXPORT_SYMBOL(dump_fpu); |
46 | EXPORT_SYMBOL(iounmap); | 44 | EXPORT_SYMBOL(iounmap); |
47 | EXPORT_SYMBOL(enable_irq); | 45 | EXPORT_SYMBOL(enable_irq); |
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 1c8fd0fd9305..0b0d492c953b 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c | |||
@@ -82,8 +82,6 @@ extern int __lshrdi3(int, int); | |||
82 | extern int __muldi3(int, int); | 82 | extern int __muldi3(int, int); |
83 | extern int __divdi3(int, int); | 83 | extern int __divdi3(int, int); |
84 | 84 | ||
85 | extern void dump_thread(struct pt_regs *, struct user *); | ||
86 | |||
87 | /* Private functions with odd calling conventions. */ | 85 | /* Private functions with odd calling conventions. */ |
88 | extern void ___atomic24_add(void); | 86 | extern void ___atomic24_add(void); |
89 | extern void ___atomic24_sub(void); | 87 | extern void ___atomic24_sub(void); |
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index 6f00ab8b9d23..83d67eb18895 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile | |||
@@ -16,7 +16,7 @@ obj-y := process.o setup.o cpu.o idprom.o \ | |||
16 | obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ | 16 | obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ |
17 | pci_psycho.o pci_sabre.o pci_schizo.o | 17 | pci_psycho.o pci_sabre.o pci_schizo.o |
18 | obj-$(CONFIG_SMP) += smp.o trampoline.o | 18 | obj-$(CONFIG_SMP) += smp.o trampoline.o |
19 | obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o | 19 | obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o |
20 | obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o | 20 | obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o |
21 | obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o | 21 | obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o |
22 | obj-$(CONFIG_MODULES) += module.o | 22 | obj-$(CONFIG_MODULES) += module.o |
@@ -40,5 +40,3 @@ endif | |||
40 | 40 | ||
41 | head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \ | 41 | head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \ |
42 | etrap.S rtrap.S winfixup.S entry.S | 42 | etrap.S rtrap.S winfixup.S entry.S |
43 | |||
44 | CFLAGS_ioctl32.o += -Ifs/ | ||
diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c index edf52d06b280..202a80c24b6f 100644 --- a/arch/sparc64/kernel/binfmt_aout32.c +++ b/arch/sparc64/kernel/binfmt_aout32.c | |||
@@ -36,8 +36,6 @@ static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs); | |||
36 | static int load_aout32_library(struct file*); | 36 | static int load_aout32_library(struct file*); |
37 | static int aout32_core_dump(long signr, struct pt_regs * regs, struct file *file); | 37 | static int aout32_core_dump(long signr, struct pt_regs * regs, struct file *file); |
38 | 38 | ||
39 | extern void dump_thread(struct pt_regs *, struct user *); | ||
40 | |||
41 | static struct linux_binfmt aout32_format = { | 39 | static struct linux_binfmt aout32_format = { |
42 | NULL, THIS_MODULE, load_aout32_binary, load_aout32_library, aout32_core_dump, | 40 | NULL, THIS_MODULE, load_aout32_binary, load_aout32_library, aout32_core_dump, |
43 | PAGE_SIZE | 41 | PAGE_SIZE |
diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c deleted file mode 100644 index 196b208665a2..000000000000 --- a/arch/sparc64/kernel/ioctl32.c +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* $Id: ioctl32.c,v 1.136 2002/01/14 09:49:52 davem Exp $ | ||
2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. | ||
3 | * | ||
4 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) | ||
5 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) | ||
6 | * Copyright (C) 2003 Pavel Machek (pavel@suse.cz) | ||
7 | * | ||
8 | * These routines maintain argument size conversion between 32bit and 64bit | ||
9 | * ioctls. | ||
10 | */ | ||
11 | |||
12 | #define INCLUDES | ||
13 | #include "compat_ioctl.c" | ||
14 | #include <linux/syscalls.h> | ||
15 | |||
16 | #define CODE | ||
17 | #include "compat_ioctl.c" | ||
18 | |||
19 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl) | ||
20 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL }, | ||
21 | #define IOCTL_TABLE_START \ | ||
22 | struct ioctl_trans ioctl_start[] = { | ||
23 | #define IOCTL_TABLE_END \ | ||
24 | }; | ||
25 | |||
26 | IOCTL_TABLE_START | ||
27 | #include <linux/compat_ioctl.h> | ||
28 | #define DECLARES | ||
29 | #include "compat_ioctl.c" | ||
30 | #if 0 | ||
31 | HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl) | ||
32 | HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl) | ||
33 | HANDLE_IOCTL(RTC32_EPOCH_READ, do_rtc_ioctl) | ||
34 | HANDLE_IOCTL(RTC32_EPOCH_SET, do_rtc_ioctl) | ||
35 | #endif | ||
36 | /* take care of sizeof(sizeof()) breakage */ | ||
37 | IOCTL_TABLE_END | ||
38 | |||
39 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index a97b0f0727ab..ff5e9d5cad50 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -43,14 +43,10 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | |||
43 | 43 | ||
44 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 44 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
45 | { | 45 | { |
46 | return 0; | ||
47 | } | ||
48 | |||
49 | void __kprobes arch_copy_kprobe(struct kprobe *p) | ||
50 | { | ||
51 | p->ainsn.insn[0] = *p->addr; | 46 | p->ainsn.insn[0] = *p->addr; |
52 | p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; | 47 | p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; |
53 | p->opcode = *p->addr; | 48 | p->opcode = *p->addr; |
49 | return 0; | ||
54 | } | 50 | } |
55 | 51 | ||
56 | void __kprobes arch_arm_kprobe(struct kprobe *p) | 52 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
@@ -65,10 +61,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) | |||
65 | flushi(p->addr); | 61 | flushi(p->addr); |
66 | } | 62 | } |
67 | 63 | ||
68 | void __kprobes arch_remove_kprobe(struct kprobe *p) | ||
69 | { | ||
70 | } | ||
71 | |||
72 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) | 64 | static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) |
73 | { | 65 | { |
74 | kcb->prev_kprobe.kp = kprobe_running(); | 66 | kcb->prev_kprobe.kp = kprobe_running(); |
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index fb7a5370dbfc..d177d7e5c9d3 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c | |||
@@ -94,7 +94,6 @@ extern void (*prom_palette)(int); | |||
94 | 94 | ||
95 | extern int __ashrdi3(int, int); | 95 | extern int __ashrdi3(int, int); |
96 | 96 | ||
97 | extern void dump_thread(struct pt_regs *, struct user *); | ||
98 | extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs); | 97 | extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs); |
99 | 98 | ||
100 | extern unsigned long phys_base; | 99 | extern unsigned long phys_base; |
@@ -241,7 +240,6 @@ EXPORT_SYMBOL(io_remap_pfn_range); | |||
241 | EXPORT_SYMBOL(_sigpause_common); | 240 | EXPORT_SYMBOL(_sigpause_common); |
242 | EXPORT_SYMBOL(verify_compat_iovec); | 241 | EXPORT_SYMBOL(verify_compat_iovec); |
243 | 242 | ||
244 | EXPORT_SYMBOL(dump_thread); | ||
245 | EXPORT_SYMBOL(dump_fpu); | 243 | EXPORT_SYMBOL(dump_fpu); |
246 | EXPORT_SYMBOL(pte_alloc_one_kernel); | 244 | EXPORT_SYMBOL(pte_alloc_one_kernel); |
247 | #ifndef CONFIG_SMP | 245 | #ifndef CONFIG_SMP |
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 7f6239ed2521..de342ee3116b 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c | |||
@@ -1120,39 +1120,3 @@ long sys32_lookup_dcookie(unsigned long cookie_high, | |||
1120 | return sys_lookup_dcookie((cookie_high << 32) | cookie_low, | 1120 | return sys_lookup_dcookie((cookie_high << 32) | cookie_low, |
1121 | buf, len); | 1121 | buf, len); |
1122 | } | 1122 | } |
1123 | |||
1124 | extern asmlinkage long | ||
1125 | sys_timer_create(clockid_t which_clock, | ||
1126 | struct sigevent __user *timer_event_spec, | ||
1127 | timer_t __user *created_timer_id); | ||
1128 | |||
1129 | long | ||
1130 | sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, | ||
1131 | timer_t __user *timer_id) | ||
1132 | { | ||
1133 | struct sigevent se; | ||
1134 | mm_segment_t oldfs; | ||
1135 | timer_t t; | ||
1136 | long err; | ||
1137 | |||
1138 | if (se32 == NULL) | ||
1139 | return sys_timer_create(clock, NULL, timer_id); | ||
1140 | |||
1141 | if (get_compat_sigevent(&se, se32)) | ||
1142 | return -EFAULT; | ||
1143 | |||
1144 | if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t))) | ||
1145 | return -EFAULT; | ||
1146 | |||
1147 | oldfs = get_fs(); | ||
1148 | set_fs(KERNEL_DS); | ||
1149 | err = sys_timer_create(clock, | ||
1150 | (struct sigevent __user *) &se, | ||
1151 | (timer_t __user *) &t); | ||
1152 | set_fs(oldfs); | ||
1153 | |||
1154 | if (!err) | ||
1155 | err = __put_user (t, timer_id); | ||
1156 | |||
1157 | return err; | ||
1158 | } | ||
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index 53eaf2345fe9..37e9acc9e587 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S | |||
@@ -73,7 +73,7 @@ sys_call_table32: | |||
73 | /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl | 73 | /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl |
74 | .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep | 74 | .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep |
75 | /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun | 75 | /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun |
76 | .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy | 76 | .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy |
77 | /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink | 77 | /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink |
78 | .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid | 78 | .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid |
79 | /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl | 79 | /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl |
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c index cd13b91b9ff6..ab0d0b170816 100644 --- a/arch/um/drivers/chan_kern.c +++ b/arch/um/drivers/chan_kern.c | |||
@@ -186,9 +186,6 @@ static void tty_receive_char(struct tty_struct *tty, char ch) | |||
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | if((tty->flip.flag_buf_ptr == NULL) || | ||
190 | (tty->flip.char_buf_ptr == NULL)) | ||
191 | return; | ||
192 | tty_insert_flip_char(tty, ch, TTY_NORMAL); | 189 | tty_insert_flip_char(tty, ch, TTY_NORMAL); |
193 | } | 190 | } |
194 | 191 | ||
@@ -653,8 +650,7 @@ void chan_interrupt(struct list_head *chans, struct work_struct *task, | |||
653 | chan = list_entry(ele, struct chan, list); | 650 | chan = list_entry(ele, struct chan, list); |
654 | if(!chan->input || (chan->ops->read == NULL)) continue; | 651 | if(!chan->input || (chan->ops->read == NULL)) continue; |
655 | do { | 652 | do { |
656 | if((tty != NULL) && | 653 | if (tty && !tty_buffer_request_room(tty, 1)) { |
657 | (tty->flip.count >= TTY_FLIPBUF_SIZE)){ | ||
658 | schedule_delayed_work(task, 1); | 654 | schedule_delayed_work(task, 1); |
659 | goto out; | 655 | goto out; |
660 | } | 656 | } |
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c index 11f518a7e156..8fa2ae7f3026 100644 --- a/arch/um/kernel/time.c +++ b/arch/um/kernel/time.c | |||
@@ -99,7 +99,8 @@ void uml_idle_timer(void) | |||
99 | set_interval(ITIMER_REAL); | 99 | set_interval(ITIMER_REAL); |
100 | } | 100 | } |
101 | 101 | ||
102 | extern int do_posix_clock_monotonic_gettime(struct timespec *tp); | 102 | extern void ktime_get_ts(struct timespec *ts); |
103 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) | ||
103 | 104 | ||
104 | void time_init(void) | 105 | void time_init(void) |
105 | { | 106 | { |
@@ -114,8 +115,8 @@ void time_init(void) | |||
114 | wall_to_monotonic.tv_nsec = -now.tv_nsec; | 115 | wall_to_monotonic.tv_nsec = -now.tv_nsec; |
115 | } | 116 | } |
116 | 117 | ||
117 | /* Declared in linux/time.h, which can't be included here */ | 118 | /* Defined in linux/ktimer.h, which can't be included here */ |
118 | extern void clock_was_set(void); | 119 | #define clock_was_set() do { } while (0) |
119 | 120 | ||
120 | void do_gettimeofday(struct timeval *tv) | 121 | void do_gettimeofday(struct timeval *tv) |
121 | { | 122 | { |
diff --git a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c index 39cf247cdae4..062ffa0a9998 100644 --- a/arch/v850/kernel/process.c +++ b/arch/v850/kernel/process.c | |||
@@ -164,30 +164,6 @@ int copy_thread (int nr, unsigned long clone_flags, | |||
164 | } | 164 | } |
165 | 165 | ||
166 | /* | 166 | /* |
167 | * fill in the user structure for a core dump.. | ||
168 | */ | ||
169 | void dump_thread (struct pt_regs *regs, struct user *dump) | ||
170 | { | ||
171 | #if 0 /* Later. XXX */ | ||
172 | dump->magic = CMAGIC; | ||
173 | dump->start_code = 0; | ||
174 | dump->start_stack = regs->gpr[GPR_SP]; | ||
175 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
176 | dump->u_dsize = ((unsigned long) (current->mm->brk + | ||
177 | (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
178 | dump->u_dsize -= dump->u_tsize; | ||
179 | dump->u_ssize = 0; | ||
180 | |||
181 | if (dump->start_stack < TASK_SIZE) | ||
182 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | ||
183 | |||
184 | dump->u_ar0 = (struct user_regs_struct *)((int)&dump->regs - (int)dump); | ||
185 | dump->regs = *regs; | ||
186 | dump->u_fpvalid = 0; | ||
187 | #endif | ||
188 | } | ||
189 | |||
190 | /* | ||
191 | * sys_execve() executes a new program. | 167 | * sys_execve() executes a new program. |
192 | */ | 168 | */ |
193 | int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs) | 169 | int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs) |
diff --git a/arch/v850/kernel/v850_ksyms.c b/arch/v850/kernel/v850_ksyms.c index 0ca64900dd91..8ffc29c1c89d 100644 --- a/arch/v850/kernel/v850_ksyms.c +++ b/arch/v850/kernel/v850_ksyms.c | |||
@@ -21,8 +21,6 @@ extern void *trap_table; | |||
21 | EXPORT_SYMBOL (trap_table); | 21 | EXPORT_SYMBOL (trap_table); |
22 | 22 | ||
23 | /* platform dependent support */ | 23 | /* platform dependent support */ |
24 | extern void dump_thread (struct pt_regs *, struct user *); | ||
25 | EXPORT_SYMBOL (dump_thread); | ||
26 | EXPORT_SYMBOL (kernel_thread); | 24 | EXPORT_SYMBOL (kernel_thread); |
27 | EXPORT_SYMBOL (enable_irq); | 25 | EXPORT_SYMBOL (enable_irq); |
28 | EXPORT_SYMBOL (disable_irq); | 26 | EXPORT_SYMBOL (disable_irq); |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 4f3e925962c3..348b4a0d0d6f 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -399,17 +399,6 @@ config X86_MCE_AMD | |||
399 | Additional support for AMD specific MCE features such as | 399 | Additional support for AMD specific MCE features such as |
400 | the DRAM Error Threshold. | 400 | the DRAM Error Threshold. |
401 | 401 | ||
402 | config PHYSICAL_START | ||
403 | hex "Physical address where the kernel is loaded" if EMBEDDED | ||
404 | default "0x100000" | ||
405 | help | ||
406 | This gives the physical address where the kernel is loaded. | ||
407 | Primarily used in the case of kexec on panic where the | ||
408 | fail safe kernel needs to run at a different address than | ||
409 | the panic-ed kernel. | ||
410 | |||
411 | Don't change this unless you know what you are doing. | ||
412 | |||
413 | config KEXEC | 402 | config KEXEC |
414 | bool "kexec system call (EXPERIMENTAL)" | 403 | bool "kexec system call (EXPERIMENTAL)" |
415 | depends on EXPERIMENTAL | 404 | depends on EXPERIMENTAL |
@@ -427,6 +416,31 @@ config KEXEC | |||
427 | support. As of this writing the exact hardware interface is | 416 | support. As of this writing the exact hardware interface is |
428 | strongly in flux, so no good recommendation can be made. | 417 | strongly in flux, so no good recommendation can be made. |
429 | 418 | ||
419 | config CRASH_DUMP | ||
420 | bool "kernel crash dumps (EXPERIMENTAL)" | ||
421 | depends on EXPERIMENTAL | ||
422 | help | ||
423 | Generate crash dump after being started by kexec. | ||
424 | |||
425 | config PHYSICAL_START | ||
426 | hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) | ||
427 | default "0x1000000" if CRASH_DUMP | ||
428 | default "0x100000" | ||
429 | help | ||
430 | This gives the physical address where the kernel is loaded. Normally | ||
431 | for regular kernels this value is 0x100000 (1MB). But in the case | ||
432 | of kexec on panic the fail safe kernel needs to run at a different | ||
433 | address than the panic-ed kernel. This option is used to set the load | ||
434 | address for kernels used to capture crash dump on being kexec'ed | ||
435 | after panic. The default value for crash dump kernels is | ||
436 | 0x1000000 (16MB). This can also be set based on the "X" value as | ||
437 | specified in the "crashkernel=YM@XM" command line boot parameter | ||
438 | passed to the panic-ed kernel. Typically this parameter is set as | ||
439 | crashkernel=64M@16M. Please take a look at | ||
440 | Documentation/kdump/kdump.txt for more details about crash dumps. | ||
441 | |||
442 | Don't change this unless you know what you are doing. | ||
443 | |||
430 | config SECCOMP | 444 | config SECCOMP |
431 | bool "Enable seccomp to safely compute untrusted bytecode" | 445 | bool "Enable seccomp to safely compute untrusted bytecode" |
432 | depends on PROC_FS | 446 | depends on PROC_FS |
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index a9cd42e61828..51d83288d62b 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile | |||
@@ -80,9 +80,12 @@ bzlilo: vmlinux | |||
80 | bzdisk: vmlinux | 80 | bzdisk: vmlinux |
81 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk | 81 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk |
82 | 82 | ||
83 | install fdimage fdimage144 fdimage288: vmlinux | 83 | fdimage fdimage144 fdimage288: vmlinux |
84 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ | 84 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ |
85 | 85 | ||
86 | install: | ||
87 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ | ||
88 | |||
86 | archclean: | 89 | archclean: |
87 | $(Q)$(MAKE) $(clean)=$(boot) | 90 | $(Q)$(MAKE) $(clean)=$(boot) |
88 | 91 | ||
diff --git a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile index 18c6e915d69b..29f8396ed151 100644 --- a/arch/x86_64/boot/Makefile +++ b/arch/x86_64/boot/Makefile | |||
@@ -98,5 +98,5 @@ zlilo: $(BOOTIMAGE) | |||
98 | cp System.map $(INSTALL_PATH)/ | 98 | cp System.map $(INSTALL_PATH)/ |
99 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | 99 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi |
100 | 100 | ||
101 | install: $(BOOTIMAGE) | 101 | install: |
102 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" | 102 | sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" |
diff --git a/arch/x86_64/boot/install.sh b/arch/x86_64/boot/install.sh index 198af15a7758..baaa2369bdb8 100644 --- a/arch/x86_64/boot/install.sh +++ b/arch/x86_64/boot/install.sh | |||
@@ -1,40 +1,2 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | . $srctree/arch/i386/boot/install.sh |
3 | # arch/x86_64/boot/install.sh | ||
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 | # Copyright (C) 1995 by Linus Torvalds | ||
10 | # | ||
11 | # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin | ||
12 | # | ||
13 | # "make install" script for i386 architecture | ||
14 | # | ||
15 | # Arguments: | ||
16 | # $1 - kernel version | ||
17 | # $2 - kernel image file | ||
18 | # $3 - kernel map file | ||
19 | # $4 - default install path (blank if root directory) | ||
20 | # | ||
21 | |||
22 | # User may have a custom install script | ||
23 | |||
24 | if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi | ||
25 | if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi | ||
26 | |||
27 | # Default install - same as make zlilo | ||
28 | |||
29 | if [ -f $4/vmlinuz ]; then | ||
30 | mv $4/vmlinuz $4/vmlinuz.old | ||
31 | fi | ||
32 | |||
33 | if [ -f $4/System.map ]; then | ||
34 | mv $4/System.map $4/System.old | ||
35 | fi | ||
36 | |||
37 | cat $2 > $4/vmlinuz | ||
38 | cp $3 $4/System.map | ||
39 | |||
40 | if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi | ||
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile index f76217d8f579..051608d55920 100644 --- a/arch/x86_64/ia32/Makefile +++ b/arch/x86_64/ia32/Makefile | |||
@@ -2,8 +2,7 @@ | |||
2 | # Makefile for the ia32 kernel emulation subsystem. | 2 | # Makefile for the ia32 kernel emulation subsystem. |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ | 5 | obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \ |
6 | ia32_signal.o tls32.o \ | ||
7 | ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o | 6 | ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o |
8 | 7 | ||
9 | sysv-$(CONFIG_SYSVIPC) := ipc32.o | 8 | sysv-$(CONFIG_SYSVIPC) := ipc32.o |
@@ -29,4 +28,3 @@ $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE | |||
29 | 28 | ||
30 | AFLAGS_vsyscall-sysenter.o = -m32 | 29 | AFLAGS_vsyscall-sysenter.o = -m32 |
31 | AFLAGS_vsyscall-syscall.o = -m32 | 30 | AFLAGS_vsyscall-syscall.o = -m32 |
32 | CFLAGS_ia32_ioctl.o += -Ifs/ | ||
diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c deleted file mode 100644 index e335bd0b637d..000000000000 --- a/arch/x86_64/ia32/ia32_ioctl.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* $Id: ia32_ioctl.c,v 1.25 2002/10/11 07:17:06 ak Exp $ | ||
2 | * ioctl32.c: Conversion between 32bit and 64bit native ioctls. | ||
3 | * | ||
4 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) | ||
5 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) | ||
6 | * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs | ||
7 | * | ||
8 | * These routines maintain argument size conversion between 32bit and 64bit | ||
9 | * ioctls. | ||
10 | */ | ||
11 | |||
12 | #define INCLUDES | ||
13 | #include <linux/syscalls.h> | ||
14 | #include "compat_ioctl.c" | ||
15 | #include <asm/ia32.h> | ||
16 | |||
17 | #define CODE | ||
18 | #include "compat_ioctl.c" | ||
19 | |||
20 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */ | ||
21 | #define RTC_IRQP_SET32 _IOW('p', 0x0c, unsigned int) /* Set IRQ rate */ | ||
22 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, unsigned) /* Read epoch */ | ||
23 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, unsigned) /* Set epoch */ | ||
24 | |||
25 | static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | ||
26 | { | ||
27 | unsigned long val; | ||
28 | mm_segment_t oldfs = get_fs(); | ||
29 | int ret; | ||
30 | |||
31 | switch (cmd) { | ||
32 | case RTC_IRQP_READ32: | ||
33 | set_fs(KERNEL_DS); | ||
34 | ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val); | ||
35 | set_fs(oldfs); | ||
36 | if (!ret) | ||
37 | ret = put_user(val, (unsigned int __user *) arg); | ||
38 | return ret; | ||
39 | |||
40 | case RTC_IRQP_SET32: | ||
41 | cmd = RTC_IRQP_SET; | ||
42 | break; | ||
43 | |||
44 | case RTC_EPOCH_READ32: | ||
45 | set_fs(KERNEL_DS); | ||
46 | ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val); | ||
47 | set_fs(oldfs); | ||
48 | if (!ret) | ||
49 | ret = put_user(val, (unsigned int __user *) arg); | ||
50 | return ret; | ||
51 | |||
52 | case RTC_EPOCH_SET32: | ||
53 | cmd = RTC_EPOCH_SET; | ||
54 | break; | ||
55 | } | ||
56 | return sys_ioctl(fd,cmd,arg); | ||
57 | } | ||
58 | |||
59 | |||
60 | #define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler) }, | ||
61 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl) | ||
62 | |||
63 | struct ioctl_trans ioctl_start[] = { | ||
64 | #include <linux/compat_ioctl.h> | ||
65 | #define DECLARES | ||
66 | #include "compat_ioctl.c" | ||
67 | |||
68 | /* And these ioctls need translation */ | ||
69 | /* realtime device */ | ||
70 | HANDLE_IOCTL(RTC_IRQP_READ, rtc32_ioctl) | ||
71 | HANDLE_IOCTL(RTC_IRQP_READ32,rtc32_ioctl) | ||
72 | HANDLE_IOCTL(RTC_IRQP_SET32, rtc32_ioctl) | ||
73 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc32_ioctl) | ||
74 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc32_ioctl) | ||
75 | /* take care of sizeof(sizeof()) breakage */ | ||
76 | }; | ||
77 | |||
78 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); | ||
79 | |||
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 1f0ff5adc80e..2ff07b47ea9c 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S | |||
@@ -608,7 +608,7 @@ ia32_sys_call_table: | |||
608 | .quad sys_epoll_wait | 608 | .quad sys_epoll_wait |
609 | .quad sys_remap_file_pages | 609 | .quad sys_remap_file_pages |
610 | .quad sys_set_tid_address | 610 | .quad sys_set_tid_address |
611 | .quad sys32_timer_create | 611 | .quad compat_sys_timer_create |
612 | .quad compat_sys_timer_settime /* 260 */ | 612 | .quad compat_sys_timer_settime /* 260 */ |
613 | .quad compat_sys_timer_gettime | 613 | .quad compat_sys_timer_gettime |
614 | .quad sys_timer_getoverrun | 614 | .quad sys_timer_getoverrun |
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 5389df610e78..54481af5344a 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -969,25 +969,6 @@ long sys32_kill(int pid, int sig) | |||
969 | return sys_kill(pid, sig); | 969 | return sys_kill(pid, sig); |
970 | } | 970 | } |
971 | 971 | ||
972 | extern asmlinkage long | ||
973 | sys_timer_create(clockid_t which_clock, | ||
974 | struct sigevent __user *timer_event_spec, | ||
975 | timer_t __user * created_timer_id); | ||
976 | |||
977 | long | ||
978 | sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id) | ||
979 | { | ||
980 | struct sigevent __user *p = NULL; | ||
981 | if (se32) { | ||
982 | struct sigevent se; | ||
983 | p = compat_alloc_user_space(sizeof(struct sigevent)); | ||
984 | if (get_compat_sigevent(&se, se32) || | ||
985 | copy_to_user(p, &se, sizeof(se))) | ||
986 | return -EFAULT; | ||
987 | } | ||
988 | return sys_timer_create(clock, p, timer_id); | ||
989 | } | ||
990 | |||
991 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, | 972 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, |
992 | __u32 len_low, __u32 len_high, int advice) | 973 | __u32 len_low, __u32 len_high, int advice) |
993 | { | 974 | { |
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile index fe4cbd1c4b2f..12bc54005e2f 100644 --- a/arch/x86_64/kernel/Makefile +++ b/arch/x86_64/kernel/Makefile | |||
@@ -22,6 +22,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o | |||
22 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o \ | 22 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o \ |
23 | genapic.o genapic_cluster.o genapic_flat.o | 23 | genapic.o genapic_cluster.o genapic_flat.o |
24 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o | 24 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o |
25 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o | ||
25 | obj-$(CONFIG_PM) += suspend.o | 26 | obj-$(CONFIG_PM) += suspend.o |
26 | obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o | 27 | obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o |
27 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ | 28 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ |
diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c index 535e04466079..4e6c3b729e39 100644 --- a/arch/x86_64/kernel/crash.c +++ b/arch/x86_64/kernel/crash.c | |||
@@ -11,19 +11,156 @@ | |||
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | #include <linux/irq.h> | ||
14 | #include <linux/reboot.h> | 15 | #include <linux/reboot.h> |
15 | #include <linux/kexec.h> | 16 | #include <linux/kexec.h> |
17 | #include <linux/delay.h> | ||
18 | #include <linux/elf.h> | ||
19 | #include <linux/elfcore.h> | ||
16 | 20 | ||
17 | #include <asm/processor.h> | 21 | #include <asm/processor.h> |
18 | #include <asm/hardirq.h> | 22 | #include <asm/hardirq.h> |
19 | #include <asm/nmi.h> | 23 | #include <asm/nmi.h> |
20 | #include <asm/hw_irq.h> | 24 | #include <asm/hw_irq.h> |
25 | #include <asm/mach_apic.h> | ||
21 | 26 | ||
22 | note_buf_t crash_notes[NR_CPUS]; | 27 | /* This keeps a track of which one is crashing cpu. */ |
28 | static int crashing_cpu; | ||
29 | |||
30 | static u32 *append_elf_note(u32 *buf, char *name, unsigned type, | ||
31 | void *data, size_t data_len) | ||
32 | { | ||
33 | struct elf_note note; | ||
34 | |||
35 | note.n_namesz = strlen(name) + 1; | ||
36 | note.n_descsz = data_len; | ||
37 | note.n_type = type; | ||
38 | memcpy(buf, ¬e, sizeof(note)); | ||
39 | buf += (sizeof(note) +3)/4; | ||
40 | memcpy(buf, name, note.n_namesz); | ||
41 | buf += (note.n_namesz + 3)/4; | ||
42 | memcpy(buf, data, note.n_descsz); | ||
43 | buf += (note.n_descsz + 3)/4; | ||
44 | |||
45 | return buf; | ||
46 | } | ||
47 | |||
48 | static void final_note(u32 *buf) | ||
49 | { | ||
50 | struct elf_note note; | ||
51 | |||
52 | note.n_namesz = 0; | ||
53 | note.n_descsz = 0; | ||
54 | note.n_type = 0; | ||
55 | memcpy(buf, ¬e, sizeof(note)); | ||
56 | } | ||
57 | |||
58 | static void crash_save_this_cpu(struct pt_regs *regs, int cpu) | ||
59 | { | ||
60 | struct elf_prstatus prstatus; | ||
61 | u32 *buf; | ||
62 | |||
63 | if ((cpu < 0) || (cpu >= NR_CPUS)) | ||
64 | return; | ||
65 | |||
66 | /* Using ELF notes here is opportunistic. | ||
67 | * I need a well defined structure format | ||
68 | * for the data I pass, and I need tags | ||
69 | * on the data to indicate what information I have | ||
70 | * squirrelled away. ELF notes happen to provide | ||
71 | * all of that that no need to invent something new. | ||
72 | */ | ||
73 | |||
74 | buf = (u32*)per_cpu_ptr(crash_notes, cpu); | ||
75 | |||
76 | if (!buf) | ||
77 | return; | ||
78 | |||
79 | memset(&prstatus, 0, sizeof(prstatus)); | ||
80 | prstatus.pr_pid = current->pid; | ||
81 | elf_core_copy_regs(&prstatus.pr_reg, regs); | ||
82 | buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus, | ||
83 | sizeof(prstatus)); | ||
84 | final_note(buf); | ||
85 | } | ||
86 | |||
87 | static void crash_save_self(struct pt_regs *regs) | ||
88 | { | ||
89 | int cpu; | ||
90 | |||
91 | cpu = smp_processor_id(); | ||
92 | crash_save_this_cpu(regs, cpu); | ||
93 | } | ||
94 | |||
95 | #ifdef CONFIG_SMP | ||
96 | static atomic_t waiting_for_crash_ipi; | ||
97 | |||
98 | static int crash_nmi_callback(struct pt_regs *regs, int cpu) | ||
99 | { | ||
100 | /* | ||
101 | * Don't do anything if this handler is invoked on crashing cpu. | ||
102 | * Otherwise, system will completely hang. Crashing cpu can get | ||
103 | * an NMI if system was initially booted with nmi_watchdog parameter. | ||
104 | */ | ||
105 | if (cpu == crashing_cpu) | ||
106 | return 1; | ||
107 | local_irq_disable(); | ||
108 | |||
109 | crash_save_this_cpu(regs, cpu); | ||
110 | disable_local_APIC(); | ||
111 | atomic_dec(&waiting_for_crash_ipi); | ||
112 | /* Assume hlt works */ | ||
113 | for(;;) | ||
114 | asm("hlt"); | ||
115 | |||
116 | return 1; | ||
117 | } | ||
118 | |||
119 | static void smp_send_nmi_allbutself(void) | ||
120 | { | ||
121 | send_IPI_allbutself(APIC_DM_NMI); | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * This code is a best effort heuristic to get the | ||
126 | * other cpus to stop executing. So races with | ||
127 | * cpu hotplug shouldn't matter. | ||
128 | */ | ||
129 | |||
130 | static void nmi_shootdown_cpus(void) | ||
131 | { | ||
132 | unsigned long msecs; | ||
133 | |||
134 | atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); | ||
135 | set_nmi_callback(crash_nmi_callback); | ||
136 | |||
137 | /* | ||
138 | * Ensure the new callback function is set before sending | ||
139 | * out the NMI | ||
140 | */ | ||
141 | wmb(); | ||
142 | |||
143 | smp_send_nmi_allbutself(); | ||
144 | |||
145 | msecs = 1000; /* Wait at most a second for the other cpus to stop */ | ||
146 | while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { | ||
147 | mdelay(1); | ||
148 | msecs--; | ||
149 | } | ||
150 | /* Leave the nmi callback set */ | ||
151 | disable_local_APIC(); | ||
152 | } | ||
153 | #else | ||
154 | static void nmi_shootdown_cpus(void) | ||
155 | { | ||
156 | /* There are no cpus to shootdown */ | ||
157 | } | ||
158 | #endif | ||
23 | 159 | ||
24 | void machine_crash_shutdown(struct pt_regs *regs) | 160 | void machine_crash_shutdown(struct pt_regs *regs) |
25 | { | 161 | { |
26 | /* This function is only called after the system | 162 | /* |
163 | * This function is only called after the system | ||
27 | * has paniced or is otherwise in a critical state. | 164 | * has paniced or is otherwise in a critical state. |
28 | * The minimum amount of code to allow a kexec'd kernel | 165 | * The minimum amount of code to allow a kexec'd kernel |
29 | * to run successfully needs to happen here. | 166 | * to run successfully needs to happen here. |
@@ -31,4 +168,19 @@ void machine_crash_shutdown(struct pt_regs *regs) | |||
31 | * In practice this means shooting down the other cpus in | 168 | * In practice this means shooting down the other cpus in |
32 | * an SMP system. | 169 | * an SMP system. |
33 | */ | 170 | */ |
171 | /* The kernel is broken so disable interrupts */ | ||
172 | local_irq_disable(); | ||
173 | |||
174 | /* Make a note of crashing cpu. Will be used in NMI callback.*/ | ||
175 | crashing_cpu = smp_processor_id(); | ||
176 | nmi_shootdown_cpus(); | ||
177 | |||
178 | if(cpu_has_apic) | ||
179 | disable_local_APIC(); | ||
180 | |||
181 | #if defined(CONFIG_X86_IO_APIC) | ||
182 | disable_IO_APIC(); | ||
183 | #endif | ||
184 | |||
185 | crash_save_self(regs); | ||
34 | } | 186 | } |
diff --git a/kernel/crash_dump.c b/arch/x86_64/kernel/crash_dump.c index fccb27dbc623..942deac4d43a 100644 --- a/kernel/crash_dump.c +++ b/arch/x86_64/kernel/crash_dump.c | |||
@@ -5,21 +5,12 @@ | |||
5 | * Copyright (C) IBM Corporation, 2004. All rights reserved | 5 | * Copyright (C) IBM Corporation, 2004. All rights reserved |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/smp_lock.h> | ||
9 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
10 | #include <linux/proc_fs.h> | ||
11 | #include <linux/bootmem.h> | ||
12 | #include <linux/highmem.h> | ||
13 | #include <linux/crash_dump.h> | 9 | #include <linux/crash_dump.h> |
14 | 10 | ||
15 | #include <asm/io.h> | ||
16 | #include <asm/uaccess.h> | 11 | #include <asm/uaccess.h> |
17 | #include <asm/kexec.h> | 12 | #include <asm/io.h> |
18 | |||
19 | /* Stores the physical address of elf header of crash image. */ | ||
20 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
21 | 13 | ||
22 | #ifndef HAVE_ARCH_COPY_OLDMEM_PAGE | ||
23 | /** | 14 | /** |
24 | * copy_oldmem_page - copy one page from "oldmem" | 15 | * copy_oldmem_page - copy one page from "oldmem" |
25 | * @pfn: page frame number to be copied | 16 | * @pfn: page frame number to be copied |
@@ -34,31 +25,23 @@ unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | |||
34 | * in the current kernel. We stitch up a pte, similar to kmap_atomic. | 25 | * in the current kernel. We stitch up a pte, similar to kmap_atomic. |
35 | */ | 26 | */ |
36 | ssize_t copy_oldmem_page(unsigned long pfn, char *buf, | 27 | ssize_t copy_oldmem_page(unsigned long pfn, char *buf, |
37 | size_t csize, unsigned long offset, int userbuf) | 28 | size_t csize, unsigned long offset, int userbuf) |
38 | { | 29 | { |
39 | void *page, *vaddr; | 30 | void *vaddr; |
40 | 31 | ||
41 | if (!csize) | 32 | if (!csize) |
42 | return 0; | 33 | return 0; |
43 | 34 | ||
44 | page = kmalloc(PAGE_SIZE, GFP_KERNEL); | 35 | vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); |
45 | if (!page) | ||
46 | return -ENOMEM; | ||
47 | |||
48 | vaddr = kmap_atomic_pfn(pfn, KM_PTE0); | ||
49 | copy_page(page, vaddr); | ||
50 | kunmap_atomic(vaddr, KM_PTE0); | ||
51 | 36 | ||
52 | if (userbuf) { | 37 | if (userbuf) { |
53 | if (copy_to_user(buf, (page + offset), csize)) { | 38 | if (copy_to_user(buf, (vaddr + offset), csize)) { |
54 | kfree(page); | 39 | iounmap(vaddr); |
55 | return -EFAULT; | 40 | return -EFAULT; |
56 | } | 41 | } |
57 | } else { | 42 | } else |
58 | memcpy(buf, (page + offset), csize); | 43 | memcpy(buf, (vaddr + offset), csize); |
59 | } | ||
60 | 44 | ||
61 | kfree(page); | 45 | iounmap(vaddr); |
62 | return csize; | 46 | return csize; |
63 | } | 47 | } |
64 | #endif | ||
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c index 17579a1a174b..293cd71a266a 100644 --- a/arch/x86_64/kernel/e820.c +++ b/arch/x86_64/kernel/e820.c | |||
@@ -559,6 +559,27 @@ void __init parse_memopt(char *p, char **from) | |||
559 | end_user_pfn >>= PAGE_SHIFT; | 559 | end_user_pfn >>= PAGE_SHIFT; |
560 | } | 560 | } |
561 | 561 | ||
562 | void __init parse_memmapopt(char *p, char **from) | ||
563 | { | ||
564 | unsigned long long start_at, mem_size; | ||
565 | |||
566 | mem_size = memparse(p, from); | ||
567 | p = *from; | ||
568 | if (*p == '@') { | ||
569 | start_at = memparse(p+1, from); | ||
570 | add_memory_region(start_at, mem_size, E820_RAM); | ||
571 | } else if (*p == '#') { | ||
572 | start_at = memparse(p+1, from); | ||
573 | add_memory_region(start_at, mem_size, E820_ACPI); | ||
574 | } else if (*p == '$') { | ||
575 | start_at = memparse(p+1, from); | ||
576 | add_memory_region(start_at, mem_size, E820_RESERVED); | ||
577 | } else { | ||
578 | end_user_pfn = (mem_size >> PAGE_SHIFT); | ||
579 | } | ||
580 | p = *from; | ||
581 | } | ||
582 | |||
562 | unsigned long pci_mem_start = 0xaeedbabe; | 583 | unsigned long pci_mem_start = 0xaeedbabe; |
563 | 584 | ||
564 | /* | 585 | /* |
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c index afe11f4fbd1d..b7dc1f816d13 100644 --- a/arch/x86_64/kernel/kprobes.c +++ b/arch/x86_64/kernel/kprobes.c | |||
@@ -42,8 +42,8 @@ | |||
42 | #include <asm/pgtable.h> | 42 | #include <asm/pgtable.h> |
43 | #include <asm/kdebug.h> | 43 | #include <asm/kdebug.h> |
44 | 44 | ||
45 | static DECLARE_MUTEX(kprobe_mutex); | ||
46 | void jprobe_return_end(void); | 45 | void jprobe_return_end(void); |
46 | static void __kprobes arch_copy_kprobe(struct kprobe *p); | ||
47 | 47 | ||
48 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; | 48 | DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; |
49 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 49 | DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
@@ -69,12 +69,11 @@ static inline int is_IF_modifier(kprobe_opcode_t *insn) | |||
69 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 69 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
70 | { | 70 | { |
71 | /* insn: must be on special executable page on x86_64. */ | 71 | /* insn: must be on special executable page on x86_64. */ |
72 | down(&kprobe_mutex); | ||
73 | p->ainsn.insn = get_insn_slot(); | 72 | p->ainsn.insn = get_insn_slot(); |
74 | up(&kprobe_mutex); | ||
75 | if (!p->ainsn.insn) { | 73 | if (!p->ainsn.insn) { |
76 | return -ENOMEM; | 74 | return -ENOMEM; |
77 | } | 75 | } |
76 | arch_copy_kprobe(p); | ||
78 | return 0; | 77 | return 0; |
79 | } | 78 | } |
80 | 79 | ||
@@ -181,7 +180,7 @@ static inline s32 *is_riprel(u8 *insn) | |||
181 | return NULL; | 180 | return NULL; |
182 | } | 181 | } |
183 | 182 | ||
184 | void __kprobes arch_copy_kprobe(struct kprobe *p) | 183 | static void __kprobes arch_copy_kprobe(struct kprobe *p) |
185 | { | 184 | { |
186 | s32 *ripdisp; | 185 | s32 *ripdisp; |
187 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE); | 186 | memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE); |
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 64c4534b930c..a0e0c9ca8f10 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/processor.h> | 35 | #include <asm/processor.h> |
36 | #include <linux/console.h> | 36 | #include <linux/console.h> |
37 | #include <linux/seq_file.h> | 37 | #include <linux/seq_file.h> |
38 | #include <linux/crash_dump.h> | ||
38 | #include <linux/root_dev.h> | 39 | #include <linux/root_dev.h> |
39 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
40 | #include <linux/acpi.h> | 41 | #include <linux/acpi.h> |
@@ -275,6 +276,7 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
275 | { | 276 | { |
276 | char c = ' ', *to = command_line, *from = COMMAND_LINE; | 277 | char c = ' ', *to = command_line, *from = COMMAND_LINE; |
277 | int len = 0; | 278 | int len = 0; |
279 | int userdef = 0; | ||
278 | 280 | ||
279 | /* Save unparsed command line copy for /proc/cmdline */ | 281 | /* Save unparsed command line copy for /proc/cmdline */ |
280 | memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); | 282 | memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); |
@@ -357,6 +359,28 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
357 | if (!memcmp(from, "mem=", 4)) | 359 | if (!memcmp(from, "mem=", 4)) |
358 | parse_memopt(from+4, &from); | 360 | parse_memopt(from+4, &from); |
359 | 361 | ||
362 | if (!memcmp(from, "memmap=", 7)) { | ||
363 | /* exactmap option is for used defined memory */ | ||
364 | if (!memcmp(from+7, "exactmap", 8)) { | ||
365 | #ifdef CONFIG_CRASH_DUMP | ||
366 | /* If we are doing a crash dump, we | ||
367 | * still need to know the real mem | ||
368 | * size before original memory map is | ||
369 | * reset. | ||
370 | */ | ||
371 | saved_max_pfn = e820_end_of_ram(); | ||
372 | #endif | ||
373 | from += 8+7; | ||
374 | end_pfn_map = 0; | ||
375 | e820.nr_map = 0; | ||
376 | userdef = 1; | ||
377 | } | ||
378 | else { | ||
379 | parse_memmapopt(from+7, &from); | ||
380 | userdef = 1; | ||
381 | } | ||
382 | } | ||
383 | |||
360 | #ifdef CONFIG_NUMA | 384 | #ifdef CONFIG_NUMA |
361 | if (!memcmp(from, "numa=", 5)) | 385 | if (!memcmp(from, "numa=", 5)) |
362 | numa_setup(from+5); | 386 | numa_setup(from+5); |
@@ -395,6 +419,14 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
395 | } | 419 | } |
396 | #endif | 420 | #endif |
397 | 421 | ||
422 | #ifdef CONFIG_PROC_VMCORE | ||
423 | /* elfcorehdr= specifies the location of elf core header | ||
424 | * stored by the crashed kernel. This option will be passed | ||
425 | * by kexec loader to the capture kernel. | ||
426 | */ | ||
427 | else if(!memcmp(from, "elfcorehdr=", 11)) | ||
428 | elfcorehdr_addr = memparse(from+11, &from); | ||
429 | #endif | ||
398 | next_char: | 430 | next_char: |
399 | c = *(from++); | 431 | c = *(from++); |
400 | if (!c) | 432 | if (!c) |
@@ -403,6 +435,10 @@ static __init void parse_cmdline_early (char ** cmdline_p) | |||
403 | break; | 435 | break; |
404 | *(to++) = c; | 436 | *(to++) = c; |
405 | } | 437 | } |
438 | if (userdef) { | ||
439 | printk(KERN_INFO "user-defined physical RAM map:\n"); | ||
440 | e820_print_map("user"); | ||
441 | } | ||
406 | *to = '\0'; | 442 | *to = '\0'; |
407 | *cmdline_p = command_line; | 443 | *cmdline_p = command_line; |
408 | } | 444 | } |
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c index 4a54221e10bc..b7fd6681c629 100644 --- a/arch/x86_64/kernel/x8664_ksyms.c +++ b/arch/x86_64/kernel/x8664_ksyms.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/syscalls.h> | 14 | #include <linux/syscalls.h> |
15 | #include <linux/tty.h> | 15 | #include <linux/tty.h> |
16 | #include <linux/ioctl32.h> | ||
17 | 16 | ||
18 | #include <asm/semaphore.h> | 17 | #include <asm/semaphore.h> |
19 | #include <asm/processor.h> | 18 | #include <asm/processor.h> |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 7e841aa2a4aa..7ee4a14ec3b1 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -18,10 +18,6 @@ config XTENSA | |||
18 | with reasonable minimum requirements. The Xtensa Linux project has | 18 | with reasonable minimum requirements. The Xtensa Linux project has |
19 | a home page at <http://xtensa.sourceforge.net/>. | 19 | a home page at <http://xtensa.sourceforge.net/>. |
20 | 20 | ||
21 | config UID16 | ||
22 | bool | ||
23 | default n | ||
24 | |||
25 | config RWSEM_XCHGADD_ALGORITHM | 21 | config RWSEM_XCHGADD_ALGORITHM |
26 | bool | 22 | bool |
27 | default y | 23 | default y |
diff --git a/drivers/base/core.c b/drivers/base/core.c index fd8059920dbf..6b355bd7816d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -161,8 +161,8 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, | |||
161 | return count; | 161 | return count; |
162 | } | 162 | } |
163 | 163 | ||
164 | /** | 164 | /* |
165 | * device_subsys - structure to be registered with kobject core. | 165 | * devices_subsys - structure to be registered with kobject core. |
166 | */ | 166 | */ |
167 | 167 | ||
168 | decl_subsys(devices, &ktype_device, &device_uevent_ops); | 168 | decl_subsys(devices, &ktype_device, &device_uevent_ops); |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 281d26784d25..07a7f97e1de9 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -83,6 +83,31 @@ static inline void register_cpu_control(struct cpu *cpu) | |||
83 | } | 83 | } |
84 | #endif /* CONFIG_HOTPLUG_CPU */ | 84 | #endif /* CONFIG_HOTPLUG_CPU */ |
85 | 85 | ||
86 | #ifdef CONFIG_KEXEC | ||
87 | #include <linux/kexec.h> | ||
88 | |||
89 | static ssize_t show_crash_notes(struct sys_device *dev, char *buf) | ||
90 | { | ||
91 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | ||
92 | ssize_t rc; | ||
93 | unsigned long long addr; | ||
94 | int cpunum; | ||
95 | |||
96 | cpunum = cpu->sysdev.id; | ||
97 | |||
98 | /* | ||
99 | * Might be reading other cpu's data based on which cpu read thread | ||
100 | * has been scheduled. But cpu data (memory) is allocated once during | ||
101 | * boot up and this data does not change there after. Hence this | ||
102 | * operation should be safe. No locking required. | ||
103 | */ | ||
104 | addr = __pa(per_cpu_ptr(crash_notes, cpunum)); | ||
105 | rc = sprintf(buf, "%Lx\n", addr); | ||
106 | return rc; | ||
107 | } | ||
108 | static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); | ||
109 | #endif | ||
110 | |||
86 | /* | 111 | /* |
87 | * register_cpu - Setup a driverfs device for a CPU. | 112 | * register_cpu - Setup a driverfs device for a CPU. |
88 | * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to | 113 | * @cpu - Callers can set the cpu->no_control field to 1, to indicate not to |
@@ -108,6 +133,11 @@ int __devinit register_cpu(struct cpu *cpu, int num, struct node *root) | |||
108 | register_cpu_control(cpu); | 133 | register_cpu_control(cpu); |
109 | if (!error) | 134 | if (!error) |
110 | cpu_sys_devices[num] = &cpu->sysdev; | 135 | cpu_sys_devices[num] = &cpu->sysdev; |
136 | |||
137 | #ifdef CONFIG_KEXEC | ||
138 | if (!error) | ||
139 | error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes); | ||
140 | #endif | ||
111 | return error; | 141 | return error; |
112 | } | 142 | } |
113 | 143 | ||
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 573ff6c1be5f..613673b12fa6 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -279,6 +279,7 @@ static int hci_uart_tty_open(struct tty_struct *tty) | |||
279 | 279 | ||
280 | tty->disc_data = hu; | 280 | tty->disc_data = hu; |
281 | hu->tty = tty; | 281 | hu->tty = tty; |
282 | tty->receive_room = 65536; | ||
282 | 283 | ||
283 | spin_lock_init(&hu->rx_lock); | 284 | spin_lock_init(&hu->rx_lock); |
284 | 285 | ||
@@ -348,20 +349,6 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty) | |||
348 | hci_uart_tx_wakeup(hu); | 349 | hci_uart_tx_wakeup(hu); |
349 | } | 350 | } |
350 | 351 | ||
351 | /* hci_uart_tty_room() | ||
352 | * | ||
353 | * Callback function from tty driver. Return the amount of | ||
354 | * space left in the receiver's buffer to decide if remote | ||
355 | * transmitter is to be throttled. | ||
356 | * | ||
357 | * Arguments: tty pointer to associated tty instance data | ||
358 | * Return Value: number of bytes left in receive buffer | ||
359 | */ | ||
360 | static int hci_uart_tty_room (struct tty_struct *tty) | ||
361 | { | ||
362 | return 65536; | ||
363 | } | ||
364 | |||
365 | /* hci_uart_tty_receive() | 352 | /* hci_uart_tty_receive() |
366 | * | 353 | * |
367 | * Called by tty low level driver when receive data is | 354 | * Called by tty low level driver when receive data is |
@@ -544,7 +531,6 @@ static int __init hci_uart_init(void) | |||
544 | hci_uart_ldisc.write = hci_uart_tty_write; | 531 | hci_uart_ldisc.write = hci_uart_tty_write; |
545 | hci_uart_ldisc.ioctl = hci_uart_tty_ioctl; | 532 | hci_uart_ldisc.ioctl = hci_uart_tty_ioctl; |
546 | hci_uart_ldisc.poll = hci_uart_tty_poll; | 533 | hci_uart_ldisc.poll = hci_uart_tty_poll; |
547 | hci_uart_ldisc.receive_room = hci_uart_tty_room; | ||
548 | hci_uart_ldisc.receive_buf = hci_uart_tty_receive; | 534 | hci_uart_ldisc.receive_buf = hci_uart_tty_receive; |
549 | hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; | 535 | hci_uart_ldisc.write_wakeup = hci_uart_tty_wakeup; |
550 | hci_uart_ldisc.owner = THIS_MODULE; | 536 | hci_uart_ldisc.owner = THIS_MODULE; |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index dd7e6901c575..d6fcd0a36f9f 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -80,7 +80,7 @@ config SERIAL_NONSTANDARD | |||
80 | 80 | ||
81 | config COMPUTONE | 81 | config COMPUTONE |
82 | tristate "Computone IntelliPort Plus serial support" | 82 | tristate "Computone IntelliPort Plus serial support" |
83 | depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP | 83 | depends on SERIAL_NONSTANDARD |
84 | ---help--- | 84 | ---help--- |
85 | This driver supports the entire family of Intelliport II/Plus | 85 | This driver supports the entire family of Intelliport II/Plus |
86 | controllers with the exception of the MicroChannel controllers and | 86 | controllers with the exception of the MicroChannel controllers and |
@@ -153,7 +153,7 @@ config DIGIEPCA | |||
153 | 153 | ||
154 | config ESPSERIAL | 154 | config ESPSERIAL |
155 | tristate "Hayes ESP serial port support" | 155 | tristate "Hayes ESP serial port support" |
156 | depends on SERIAL_NONSTANDARD && ISA && BROKEN_ON_SMP && ISA_DMA_API | 156 | depends on SERIAL_NONSTANDARD && ISA && ISA_DMA_API |
157 | help | 157 | help |
158 | This is a driver which supports Hayes ESP serial ports. Both single | 158 | This is a driver which supports Hayes ESP serial ports. Both single |
159 | port cards and multiport cards are supported. Make sure to read | 159 | port cards and multiport cards are supported. Make sure to read |
@@ -166,7 +166,7 @@ config ESPSERIAL | |||
166 | 166 | ||
167 | config MOXA_INTELLIO | 167 | config MOXA_INTELLIO |
168 | tristate "Moxa Intellio support" | 168 | tristate "Moxa Intellio support" |
169 | depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP | 169 | depends on SERIAL_NONSTANDARD |
170 | help | 170 | help |
171 | Say Y here if you have a Moxa Intellio multiport serial card. | 171 | Say Y here if you have a Moxa Intellio multiport serial card. |
172 | 172 | ||
@@ -290,7 +290,7 @@ config SX | |||
290 | 290 | ||
291 | config RIO | 291 | config RIO |
292 | tristate "Specialix RIO system support" | 292 | tristate "Specialix RIO system support" |
293 | depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP | 293 | depends on SERIAL_NONSTANDARD && BROKEN_ON_SMP && !64BIT |
294 | help | 294 | help |
295 | This is a driver for the Specialix RIO, a smart serial card which | 295 | This is a driver for the Specialix RIO, a smart serial card which |
296 | drives an outboard box that can support up to 128 ports. Product | 296 | drives an outboard box that can support up to 128 ports. Product |
@@ -936,6 +936,15 @@ config SCx200_GPIO | |||
936 | 936 | ||
937 | If compiled as a module, it will be called scx200_gpio. | 937 | If compiled as a module, it will be called scx200_gpio. |
938 | 938 | ||
939 | config CS5535_GPIO | ||
940 | tristate "AMD CS5535/CS5536 GPIO (Geode Companion Device)" | ||
941 | depends on X86_32 | ||
942 | help | ||
943 | Give userspace access to the GPIO pins on the AMD CS5535 and | ||
944 | CS5536 Geode companion devices. | ||
945 | |||
946 | If compiled as a module, it will be called cs5535_gpio. | ||
947 | |||
939 | config GPIO_VR41XX | 948 | config GPIO_VR41XX |
940 | tristate "NEC VR4100 series General-purpose I/O Unit support" | 949 | tristate "NEC VR4100 series General-purpose I/O Unit support" |
941 | depends on CPU_VR41XX | 950 | depends on CPU_VR41XX |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index d973d14d8f7f..503dd901d406 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -81,6 +81,7 @@ obj-$(CONFIG_PPDEV) += ppdev.o | |||
81 | obj-$(CONFIG_NWBUTTON) += nwbutton.o | 81 | obj-$(CONFIG_NWBUTTON) += nwbutton.o |
82 | obj-$(CONFIG_NWFLASH) += nwflash.o | 82 | obj-$(CONFIG_NWFLASH) += nwflash.o |
83 | obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o | 83 | obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o |
84 | obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o | ||
84 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o | 85 | obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o |
85 | obj-$(CONFIG_TANBAC_TB0219) += tb0219.o | 86 | obj-$(CONFIG_TANBAC_TB0219) += tb0219.o |
86 | obj-$(CONFIG_TELCLOCK) += tlclk.o | 87 | obj-$(CONFIG_TELCLOCK) += tlclk.o |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index a124f8c5d062..869518e4035f 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -116,7 +116,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout); | |||
116 | 116 | ||
117 | static struct serial_state rs_table[1]; | 117 | static struct serial_state rs_table[1]; |
118 | 118 | ||
119 | #define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state)) | 119 | #define NR_PORTS ARRAY_SIZE(rs_table) |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * tmp_buf is used as a temporary buffer by serial_write. We need to | 122 | * tmp_buf is used as a temporary buffer by serial_write. We need to |
@@ -265,8 +265,9 @@ static _INLINE_ void receive_chars(struct async_struct *info) | |||
265 | int status; | 265 | int status; |
266 | int serdatr; | 266 | int serdatr; |
267 | struct tty_struct *tty = info->tty; | 267 | struct tty_struct *tty = info->tty; |
268 | unsigned char ch; | 268 | unsigned char ch, flag; |
269 | struct async_icount *icount; | 269 | struct async_icount *icount; |
270 | int oe = 0; | ||
270 | 271 | ||
271 | icount = &info->state->icount; | 272 | icount = &info->state->icount; |
272 | 273 | ||
@@ -282,15 +283,12 @@ static _INLINE_ void receive_chars(struct async_struct *info) | |||
282 | status |= UART_LSR_OE; | 283 | status |= UART_LSR_OE; |
283 | 284 | ||
284 | ch = serdatr & 0xff; | 285 | ch = serdatr & 0xff; |
285 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
286 | goto ignore_char; | ||
287 | *tty->flip.char_buf_ptr = ch; | ||
288 | icount->rx++; | 286 | icount->rx++; |
289 | 287 | ||
290 | #ifdef SERIAL_DEBUG_INTR | 288 | #ifdef SERIAL_DEBUG_INTR |
291 | printk("DR%02x:%02x...", ch, status); | 289 | printk("DR%02x:%02x...", ch, status); |
292 | #endif | 290 | #endif |
293 | *tty->flip.flag_buf_ptr = 0; | 291 | flag = TTY_NORMAL; |
294 | 292 | ||
295 | /* | 293 | /* |
296 | * We don't handle parity or frame errors - but I have left | 294 | * We don't handle parity or frame errors - but I have left |
@@ -319,7 +317,7 @@ static _INLINE_ void receive_chars(struct async_struct *info) | |||
319 | * should be ignored. | 317 | * should be ignored. |
320 | */ | 318 | */ |
321 | if (status & info->ignore_status_mask) | 319 | if (status & info->ignore_status_mask) |
322 | goto ignore_char; | 320 | goto out; |
323 | 321 | ||
324 | status &= info->read_status_mask; | 322 | status &= info->read_status_mask; |
325 | 323 | ||
@@ -327,33 +325,28 @@ static _INLINE_ void receive_chars(struct async_struct *info) | |||
327 | #ifdef SERIAL_DEBUG_INTR | 325 | #ifdef SERIAL_DEBUG_INTR |
328 | printk("handling break...."); | 326 | printk("handling break...."); |
329 | #endif | 327 | #endif |
330 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 328 | flag = TTY_BREAK; |
331 | if (info->flags & ASYNC_SAK) | 329 | if (info->flags & ASYNC_SAK) |
332 | do_SAK(tty); | 330 | do_SAK(tty); |
333 | } else if (status & UART_LSR_PE) | 331 | } else if (status & UART_LSR_PE) |
334 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 332 | flag = TTY_PARITY; |
335 | else if (status & UART_LSR_FE) | 333 | else if (status & UART_LSR_FE) |
336 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 334 | flag = TTY_FRAME; |
337 | if (status & UART_LSR_OE) { | 335 | if (status & UART_LSR_OE) { |
338 | /* | 336 | /* |
339 | * Overrun is special, since it's | 337 | * Overrun is special, since it's |
340 | * reported immediately, and doesn't | 338 | * reported immediately, and doesn't |
341 | * affect the current character | 339 | * affect the current character |
342 | */ | 340 | */ |
343 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 341 | oe = 1; |
344 | tty->flip.count++; | ||
345 | tty->flip.flag_buf_ptr++; | ||
346 | tty->flip.char_buf_ptr++; | ||
347 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
348 | } | ||
349 | } | 342 | } |
350 | } | 343 | } |
351 | tty->flip.flag_buf_ptr++; | 344 | tty_insert_flip_char(tty, ch, flag); |
352 | tty->flip.char_buf_ptr++; | 345 | if (oe == 1) |
353 | tty->flip.count++; | 346 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
354 | ignore_char: | ||
355 | |||
356 | tty_flip_buffer_push(tty); | 347 | tty_flip_buffer_push(tty); |
348 | out: | ||
349 | return; | ||
357 | } | 350 | } |
358 | 351 | ||
359 | static _INLINE_ void transmit_chars(struct async_struct *info) | 352 | static _INLINE_ void transmit_chars(struct async_struct *info) |
diff --git a/drivers/char/cs5535_gpio.c b/drivers/char/cs5535_gpio.c new file mode 100644 index 000000000000..5d72f50de1ac --- /dev/null +++ b/drivers/char/cs5535_gpio.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | * AMD CS5535/CS5536 GPIO driver. | ||
3 | * Allows a user space process to play with the GPIO pins. | ||
4 | * | ||
5 | * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the smems of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; version 2 of the License. | ||
10 | */ | ||
11 | |||
12 | #include <linux/fs.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/errno.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/cdev.h> | ||
18 | #include <linux/ioport.h> | ||
19 | #include <linux/pci.h> | ||
20 | #include <asm/uaccess.h> | ||
21 | #include <asm/io.h> | ||
22 | |||
23 | |||
24 | #define NAME "cs5535_gpio" | ||
25 | |||
26 | MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>"); | ||
27 | MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO Pin Driver"); | ||
28 | MODULE_LICENSE("GPL"); | ||
29 | |||
30 | static int major; | ||
31 | module_param(major, int, 0); | ||
32 | MODULE_PARM_DESC(major, "Major device number"); | ||
33 | |||
34 | static ulong mask; | ||
35 | module_param(mask, ulong, 0); | ||
36 | MODULE_PARM_DESC(mask, "GPIO channel mask"); | ||
37 | |||
38 | #define MSR_LBAR_GPIO 0x5140000C | ||
39 | |||
40 | static u32 gpio_base; | ||
41 | |||
42 | static struct pci_device_id divil_pci[] = { | ||
43 | { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_ISA) }, | ||
44 | { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA) }, | ||
45 | { } /* NULL entry */ | ||
46 | }; | ||
47 | |||
48 | static struct cdev cs5535_gpio_cdev; | ||
49 | |||
50 | /* reserve 32 entries even though some aren't usable */ | ||
51 | #define CS5535_GPIO_COUNT 32 | ||
52 | |||
53 | /* IO block size */ | ||
54 | #define CS5535_GPIO_SIZE 256 | ||
55 | |||
56 | struct gpio_regmap { | ||
57 | u32 rd_offset; | ||
58 | u32 wr_offset; | ||
59 | char on; | ||
60 | char off; | ||
61 | }; | ||
62 | static struct gpio_regmap rm[] = | ||
63 | { | ||
64 | { 0x30, 0x00, '1', '0' }, /* GPIOx_READ_BACK / GPIOx_OUT_VAL */ | ||
65 | { 0x20, 0x20, 'I', 'i' }, /* GPIOx_IN_EN */ | ||
66 | { 0x04, 0x04, 'O', 'o' }, /* GPIOx_OUT_EN */ | ||
67 | { 0x08, 0x08, 't', 'T' }, /* GPIOx_OUT_OD_EN */ | ||
68 | { 0x18, 0x18, 'P', 'p' }, /* GPIOx_OUT_PU_EN */ | ||
69 | { 0x1c, 0x1c, 'D', 'd' }, /* GPIOx_OUT_PD_EN */ | ||
70 | }; | ||
71 | |||
72 | |||
73 | /** | ||
74 | * Gets the register offset for the GPIO bank. | ||
75 | * Low (0-15) starts at 0x00, high (16-31) starts at 0x80 | ||
76 | */ | ||
77 | static inline u32 cs5535_lowhigh_base(int reg) | ||
78 | { | ||
79 | return (reg & 0x10) << 3; | ||
80 | } | ||
81 | |||
82 | static ssize_t cs5535_gpio_write(struct file *file, const char __user *data, | ||
83 | size_t len, loff_t *ppos) | ||
84 | { | ||
85 | u32 m = iminor(file->f_dentry->d_inode); | ||
86 | int i, j; | ||
87 | u32 base = gpio_base + cs5535_lowhigh_base(m); | ||
88 | u32 m0, m1; | ||
89 | char c; | ||
90 | |||
91 | /** | ||
92 | * Creates the mask for atomic bit programming. | ||
93 | * The high 16 bits and the low 16 bits are used to set the mask. | ||
94 | * For example, GPIO 15 maps to 31,15: 0,1 => On; 1,0=> Off | ||
95 | */ | ||
96 | m1 = 1 << (m & 0x0F); | ||
97 | m0 = m1 << 16; | ||
98 | |||
99 | for (i = 0; i < len; ++i) { | ||
100 | if (get_user(c, data+i)) | ||
101 | return -EFAULT; | ||
102 | |||
103 | for (j = 0; j < ARRAY_SIZE(rm); j++) { | ||
104 | if (c == rm[j].on) { | ||
105 | outl(m1, base + rm[j].wr_offset); | ||
106 | break; | ||
107 | } else if (c == rm[j].off) { | ||
108 | outl(m0, base + rm[j].wr_offset); | ||
109 | break; | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | *ppos = 0; | ||
114 | return len; | ||
115 | } | ||
116 | |||
117 | static ssize_t cs5535_gpio_read(struct file *file, char __user *buf, | ||
118 | size_t len, loff_t *ppos) | ||
119 | { | ||
120 | u32 m = iminor(file->f_dentry->d_inode); | ||
121 | u32 base = gpio_base + cs5535_lowhigh_base(m); | ||
122 | int rd_bit = 1 << (m & 0x0f); | ||
123 | int i; | ||
124 | char ch; | ||
125 | ssize_t count = 0; | ||
126 | |||
127 | if (*ppos >= ARRAY_SIZE(rm)) | ||
128 | return 0; | ||
129 | |||
130 | for (i = *ppos; (i < (*ppos + len)) && (i < ARRAY_SIZE(rm)); i++) { | ||
131 | ch = (inl(base + rm[i].rd_offset) & rd_bit) ? | ||
132 | rm[i].on : rm[i].off; | ||
133 | |||
134 | if (put_user(ch, buf+count)) | ||
135 | return -EFAULT; | ||
136 | |||
137 | count++; | ||
138 | } | ||
139 | |||
140 | /* add a line-feed if there is room */ | ||
141 | if ((i == ARRAY_SIZE(rm)) && (count < len)) { | ||
142 | put_user('\n', buf + count); | ||
143 | count++; | ||
144 | } | ||
145 | |||
146 | *ppos += count; | ||
147 | return count; | ||
148 | } | ||
149 | |||
150 | static int cs5535_gpio_open(struct inode *inode, struct file *file) | ||
151 | { | ||
152 | u32 m = iminor(inode); | ||
153 | |||
154 | /* the mask says which pins are usable by this driver */ | ||
155 | if ((mask & (1 << m)) == 0) | ||
156 | return -EINVAL; | ||
157 | |||
158 | return nonseekable_open(inode, file); | ||
159 | } | ||
160 | |||
161 | static struct file_operations cs5535_gpio_fops = { | ||
162 | .owner = THIS_MODULE, | ||
163 | .write = cs5535_gpio_write, | ||
164 | .read = cs5535_gpio_read, | ||
165 | .open = cs5535_gpio_open | ||
166 | }; | ||
167 | |||
168 | static int __init cs5535_gpio_init(void) | ||
169 | { | ||
170 | dev_t dev_id; | ||
171 | u32 low, hi; | ||
172 | int retval; | ||
173 | |||
174 | if (pci_dev_present(divil_pci) == 0) { | ||
175 | printk(KERN_WARNING NAME ": DIVIL not found\n"); | ||
176 | return -ENODEV; | ||
177 | } | ||
178 | |||
179 | /* Grab the GPIO I/O range */ | ||
180 | rdmsr(MSR_LBAR_GPIO, low, hi); | ||
181 | |||
182 | /* Check the mask and whether GPIO is enabled (sanity check) */ | ||
183 | if (hi != 0x0000f001) { | ||
184 | printk(KERN_WARNING NAME ": GPIO not enabled\n"); | ||
185 | return -ENODEV; | ||
186 | } | ||
187 | |||
188 | /* Mask off the IO base address */ | ||
189 | gpio_base = low & 0x0000ff00; | ||
190 | |||
191 | /** | ||
192 | * Some GPIO pins | ||
193 | * 31-29,23 : reserved (always mask out) | ||
194 | * 28 : Power Button | ||
195 | * 26 : PME# | ||
196 | * 22-16 : LPC | ||
197 | * 14,15 : SMBus | ||
198 | * 9,8 : UART1 | ||
199 | * 7 : PCI INTB | ||
200 | * 3,4 : UART2/DDC | ||
201 | * 2 : IDE_IRQ0 | ||
202 | * 0 : PCI INTA | ||
203 | * | ||
204 | * If a mask was not specified, be conservative and only allow: | ||
205 | * 1,2,5,6,10-13,24,25,27 | ||
206 | */ | ||
207 | if (mask != 0) | ||
208 | mask &= 0x1f7fffff; | ||
209 | else | ||
210 | mask = 0x0b003c66; | ||
211 | |||
212 | if (request_region(gpio_base, CS5535_GPIO_SIZE, NAME) == 0) { | ||
213 | printk(KERN_ERR NAME ": can't allocate I/O for GPIO\n"); | ||
214 | return -ENODEV; | ||
215 | } | ||
216 | |||
217 | if (major) { | ||
218 | dev_id = MKDEV(major, 0); | ||
219 | retval = register_chrdev_region(dev_id, CS5535_GPIO_COUNT, | ||
220 | NAME); | ||
221 | } else { | ||
222 | retval = alloc_chrdev_region(&dev_id, 0, CS5535_GPIO_COUNT, | ||
223 | NAME); | ||
224 | major = MAJOR(dev_id); | ||
225 | } | ||
226 | |||
227 | if (retval) { | ||
228 | release_region(gpio_base, CS5535_GPIO_SIZE); | ||
229 | return -1; | ||
230 | } | ||
231 | |||
232 | printk(KERN_DEBUG NAME ": base=%#x mask=%#lx major=%d\n", | ||
233 | gpio_base, mask, major); | ||
234 | |||
235 | cdev_init(&cs5535_gpio_cdev, &cs5535_gpio_fops); | ||
236 | cdev_add(&cs5535_gpio_cdev, dev_id, CS5535_GPIO_COUNT); | ||
237 | |||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | static void __exit cs5535_gpio_cleanup(void) | ||
242 | { | ||
243 | dev_t dev_id = MKDEV(major, 0); | ||
244 | unregister_chrdev_region(dev_id, CS5535_GPIO_COUNT); | ||
245 | if (gpio_base != 0) | ||
246 | release_region(gpio_base, CS5535_GPIO_SIZE); | ||
247 | } | ||
248 | |||
249 | module_init(cs5535_gpio_init); | ||
250 | module_exit(cs5535_gpio_cleanup); | ||
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index c7f818cd7b02..39c61a71176e 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -641,6 +641,7 @@ static char rcsid[] = | |||
641 | #include <linux/timer.h> | 641 | #include <linux/timer.h> |
642 | #include <linux/interrupt.h> | 642 | #include <linux/interrupt.h> |
643 | #include <linux/tty.h> | 643 | #include <linux/tty.h> |
644 | #include <linux/tty_flip.h> | ||
644 | #include <linux/serial.h> | 645 | #include <linux/serial.h> |
645 | #include <linux/major.h> | 646 | #include <linux/major.h> |
646 | #include <linux/string.h> | 647 | #include <linux/string.h> |
@@ -723,7 +724,7 @@ static unsigned int cy_isa_addresses[] = { | |||
723 | 0xDE000, | 724 | 0xDE000, |
724 | 0,0,0,0,0,0,0,0 | 725 | 0,0,0,0,0,0,0,0 |
725 | }; | 726 | }; |
726 | #define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*)) | 727 | #define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses) |
727 | 728 | ||
728 | #ifdef MODULE | 729 | #ifdef MODULE |
729 | static long maddr[NR_CARDS] = { 0, }; | 730 | static long maddr[NR_CARDS] = { 0, }; |
@@ -1086,7 +1087,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1086 | int had_work; | 1087 | int had_work; |
1087 | int mdm_change; | 1088 | int mdm_change; |
1088 | int mdm_status; | 1089 | int mdm_status; |
1089 | 1090 | int len; | |
1090 | if((cinfo = (struct cyclades_card *)dev_id) == 0){ | 1091 | if((cinfo = (struct cyclades_card *)dev_id) == 0){ |
1091 | #ifdef CY_DEBUG_INTERRUPTS | 1092 | #ifdef CY_DEBUG_INTERRUPTS |
1092 | printk("cyy_interrupt: spurious interrupt %d\n\r", irq); | 1093 | printk("cyy_interrupt: spurious interrupt %d\n\r", irq); |
@@ -1163,63 +1164,43 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1163 | info->icount.rx++; | 1164 | info->icount.rx++; |
1164 | continue; | 1165 | continue; |
1165 | } | 1166 | } |
1166 | if (tty->flip.count < TTY_FLIPBUF_SIZE){ | 1167 | if (tty_buffer_request_room(tty, 1)) { |
1167 | tty->flip.count++; | ||
1168 | if (data & info->read_status_mask){ | 1168 | if (data & info->read_status_mask){ |
1169 | if(data & CyBREAK){ | 1169 | if(data & CyBREAK){ |
1170 | *tty->flip.flag_buf_ptr++ = | 1170 | tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_BREAK); |
1171 | TTY_BREAK; | ||
1172 | *tty->flip.char_buf_ptr++ = | ||
1173 | cy_readb(base_addr+(CyRDSR<<index)); | ||
1174 | info->icount.rx++; | 1171 | info->icount.rx++; |
1175 | if (info->flags & ASYNC_SAK){ | 1172 | if (info->flags & ASYNC_SAK){ |
1176 | do_SAK(tty); | 1173 | do_SAK(tty); |
1177 | } | 1174 | } |
1178 | }else if(data & CyFRAME){ | 1175 | }else if(data & CyFRAME){ |
1179 | *tty->flip.flag_buf_ptr++ = | 1176 | tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_FRAME); |
1180 | TTY_FRAME; | ||
1181 | *tty->flip.char_buf_ptr++ = | ||
1182 | cy_readb(base_addr+(CyRDSR<<index)); | ||
1183 | info->icount.rx++; | 1177 | info->icount.rx++; |
1184 | info->idle_stats.frame_errs++; | 1178 | info->idle_stats.frame_errs++; |
1185 | }else if(data & CyPARITY){ | 1179 | }else if(data & CyPARITY){ |
1186 | *tty->flip.flag_buf_ptr++ = | 1180 | /* Pieces of seven... */ |
1187 | TTY_PARITY; | 1181 | tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_PARITY); |
1188 | *tty->flip.char_buf_ptr++ = | ||
1189 | cy_readb(base_addr+(CyRDSR<<index)); | ||
1190 | info->icount.rx++; | 1182 | info->icount.rx++; |
1191 | info->idle_stats.parity_errs++; | 1183 | info->idle_stats.parity_errs++; |
1192 | }else if(data & CyOVERRUN){ | 1184 | }else if(data & CyOVERRUN){ |
1193 | *tty->flip.flag_buf_ptr++ = | 1185 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
1194 | TTY_OVERRUN; | ||
1195 | *tty->flip.char_buf_ptr++ = 0; | ||
1196 | info->icount.rx++; | 1186 | info->icount.rx++; |
1197 | /* If the flip buffer itself is | 1187 | /* If the flip buffer itself is |
1198 | overflowing, we still lose | 1188 | overflowing, we still lose |
1199 | the next incoming character. | 1189 | the next incoming character. |
1200 | */ | 1190 | */ |
1201 | if(tty->flip.count | 1191 | tty_insert_flip_char(tty, cy_readb(base_addr+(CyRDSR<<index)), TTY_FRAME); |
1202 | < TTY_FLIPBUF_SIZE){ | 1192 | info->icount.rx++; |
1203 | tty->flip.count++; | ||
1204 | *tty->flip.flag_buf_ptr++ = | ||
1205 | TTY_NORMAL; | ||
1206 | *tty->flip.char_buf_ptr++ = | ||
1207 | cy_readb(base_addr+(CyRDSR<<index)); | ||
1208 | info->icount.rx++; | ||
1209 | } | ||
1210 | info->idle_stats.overruns++; | 1193 | info->idle_stats.overruns++; |
1211 | /* These two conditions may imply */ | 1194 | /* These two conditions may imply */ |
1212 | /* a normal read should be done. */ | 1195 | /* a normal read should be done. */ |
1213 | /* }else if(data & CyTIMEOUT){ */ | 1196 | /* }else if(data & CyTIMEOUT){ */ |
1214 | /* }else if(data & CySPECHAR){ */ | 1197 | /* }else if(data & CySPECHAR){ */ |
1215 | }else{ | 1198 | }else { |
1216 | *tty->flip.flag_buf_ptr++ = 0; | 1199 | tty_insert_flip_char(tty, 0, TTY_NORMAL); |
1217 | *tty->flip.char_buf_ptr++ = 0; | 1200 | info->icount.rx++; |
1218 | info->icount.rx++; | ||
1219 | } | 1201 | } |
1220 | }else{ | 1202 | }else{ |
1221 | *tty->flip.flag_buf_ptr++ = 0; | 1203 | tty_insert_flip_char(tty, 0, TTY_NORMAL); |
1222 | *tty->flip.char_buf_ptr++ = 0; | ||
1223 | info->icount.rx++; | 1204 | info->icount.rx++; |
1224 | } | 1205 | } |
1225 | }else{ | 1206 | }else{ |
@@ -1240,14 +1221,10 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1240 | info->mon.char_max = char_count; | 1221 | info->mon.char_max = char_count; |
1241 | info->mon.char_last = char_count; | 1222 | info->mon.char_last = char_count; |
1242 | #endif | 1223 | #endif |
1243 | while(char_count--){ | 1224 | len = tty_buffer_request_room(tty, char_count); |
1244 | if (tty->flip.count >= TTY_FLIPBUF_SIZE){ | 1225 | while(len--){ |
1245 | break; | ||
1246 | } | ||
1247 | tty->flip.count++; | ||
1248 | data = cy_readb(base_addr+(CyRDSR<<index)); | 1226 | data = cy_readb(base_addr+(CyRDSR<<index)); |
1249 | *tty->flip.flag_buf_ptr++ = TTY_NORMAL; | 1227 | tty_insert_flip_char(tty, data, TTY_NORMAL); |
1250 | *tty->flip.char_buf_ptr++ = data; | ||
1251 | info->idle_stats.recv_bytes++; | 1228 | info->idle_stats.recv_bytes++; |
1252 | info->icount.rx++; | 1229 | info->icount.rx++; |
1253 | #ifdef CY_16Y_HACK | 1230 | #ifdef CY_16Y_HACK |
@@ -1256,7 +1233,7 @@ cyy_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
1256 | } | 1233 | } |
1257 | info->idle_stats.recv_idle = jiffies; | 1234 | info->idle_stats.recv_idle = jiffies; |
1258 | } | 1235 | } |
1259 | schedule_delayed_work(&tty->flip.work, 1); | 1236 | schedule_delayed_work(&tty->buf.work, 1); |
1260 | } | 1237 | } |
1261 | /* end of service */ | 1238 | /* end of service */ |
1262 | cy_writeb(base_addr+(CyRIR<<index), (save_xir & 0x3f)); | 1239 | cy_writeb(base_addr+(CyRIR<<index), (save_xir & 0x3f)); |
@@ -1551,6 +1528,7 @@ cyz_handle_rx(struct cyclades_port *info, | |||
1551 | struct cyclades_card *cinfo = &cy_card[info->card]; | 1528 | struct cyclades_card *cinfo = &cy_card[info->card]; |
1552 | struct tty_struct *tty = info->tty; | 1529 | struct tty_struct *tty = info->tty; |
1553 | volatile int char_count; | 1530 | volatile int char_count; |
1531 | int len; | ||
1554 | #ifdef BLOCKMOVE | 1532 | #ifdef BLOCKMOVE |
1555 | int small_count; | 1533 | int small_count; |
1556 | #else | 1534 | #else |
@@ -1606,18 +1584,11 @@ cyz_handle_rx(struct cyclades_port *info, | |||
1606 | tty->flip.count += small_count; | 1584 | tty->flip.count += small_count; |
1607 | } | 1585 | } |
1608 | #else | 1586 | #else |
1609 | while(char_count--){ | 1587 | len = tty_buffer_request_room(tty, char_count); |
1610 | if (tty->flip.count >= N_TTY_BUF_SIZE - tty->read_cnt) | 1588 | while(len--){ |
1611 | break; | ||
1612 | |||
1613 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
1614 | break; | ||
1615 | |||
1616 | data = cy_readb(cinfo->base_addr + rx_bufaddr + new_rx_get); | 1589 | data = cy_readb(cinfo->base_addr + rx_bufaddr + new_rx_get); |
1617 | new_rx_get = (new_rx_get + 1) & (rx_bufsize - 1); | 1590 | new_rx_get = (new_rx_get + 1) & (rx_bufsize - 1); |
1618 | tty->flip.count++; | 1591 | tty_insert_flip_char(tty, data, TTY_NORMAL); |
1619 | *tty->flip.flag_buf_ptr++ = TTY_NORMAL; | ||
1620 | *tty->flip.char_buf_ptr++ = data; | ||
1621 | info->idle_stats.recv_bytes++; | 1592 | info->idle_stats.recv_bytes++; |
1622 | info->icount.rx++; | 1593 | info->icount.rx++; |
1623 | } | 1594 | } |
@@ -1635,7 +1606,7 @@ cyz_handle_rx(struct cyclades_port *info, | |||
1635 | } | 1606 | } |
1636 | #endif | 1607 | #endif |
1637 | info->idle_stats.recv_idle = jiffies; | 1608 | info->idle_stats.recv_idle = jiffies; |
1638 | schedule_delayed_work(&tty->flip.work, 1); | 1609 | schedule_delayed_work(&tty->buf.work, 1); |
1639 | } | 1610 | } |
1640 | /* Update rx_get */ | 1611 | /* Update rx_get */ |
1641 | cy_writel(&buf_ctrl->rx_get, new_rx_get); | 1612 | cy_writel(&buf_ctrl->rx_get, new_rx_get); |
@@ -1763,23 +1734,17 @@ cyz_handle_cmd(struct cyclades_card *cinfo) | |||
1763 | 1734 | ||
1764 | switch(cmd) { | 1735 | switch(cmd) { |
1765 | case C_CM_PR_ERROR: | 1736 | case C_CM_PR_ERROR: |
1766 | tty->flip.count++; | 1737 | tty_insert_flip_char(tty, 0, TTY_PARITY); |
1767 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | ||
1768 | *tty->flip.char_buf_ptr++ = 0; | ||
1769 | info->icount.rx++; | 1738 | info->icount.rx++; |
1770 | special_count++; | 1739 | special_count++; |
1771 | break; | 1740 | break; |
1772 | case C_CM_FR_ERROR: | 1741 | case C_CM_FR_ERROR: |
1773 | tty->flip.count++; | 1742 | tty_insert_flip_char(tty, 0, TTY_FRAME); |
1774 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | ||
1775 | *tty->flip.char_buf_ptr++ = 0; | ||
1776 | info->icount.rx++; | 1743 | info->icount.rx++; |
1777 | special_count++; | 1744 | special_count++; |
1778 | break; | 1745 | break; |
1779 | case C_CM_RXBRK: | 1746 | case C_CM_RXBRK: |
1780 | tty->flip.count++; | 1747 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
1781 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | ||
1782 | *tty->flip.char_buf_ptr++ = 0; | ||
1783 | info->icount.rx++; | 1748 | info->icount.rx++; |
1784 | special_count++; | 1749 | special_count++; |
1785 | break; | 1750 | break; |
@@ -1844,7 +1809,7 @@ cyz_handle_cmd(struct cyclades_card *cinfo) | |||
1844 | if(delta_count) | 1809 | if(delta_count) |
1845 | cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); | 1810 | cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); |
1846 | if(special_count) | 1811 | if(special_count) |
1847 | schedule_delayed_work(&tty->flip.work, 1); | 1812 | schedule_delayed_work(&tty->buf.work, 1); |
1848 | } | 1813 | } |
1849 | } | 1814 | } |
1850 | 1815 | ||
diff --git a/drivers/char/drm/drm_ioc32.c b/drivers/char/drm/drm_ioc32.c index dd91ff6b474c..e9e2db18952d 100644 --- a/drivers/char/drm/drm_ioc32.c +++ b/drivers/char/drm/drm_ioc32.c | |||
@@ -28,7 +28,6 @@ | |||
28 | * IN THE SOFTWARE. | 28 | * IN THE SOFTWARE. |
29 | */ | 29 | */ |
30 | #include <linux/compat.h> | 30 | #include <linux/compat.h> |
31 | #include <linux/ioctl32.h> | ||
32 | 31 | ||
33 | #include "drmP.h" | 32 | #include "drmP.h" |
34 | #include "drm_core.h" | 33 | #include "drm_core.h" |
diff --git a/drivers/char/drm/i915_ioc32.c b/drivers/char/drm/i915_ioc32.c index 2218a946ec87..296248cdc767 100644 --- a/drivers/char/drm/i915_ioc32.c +++ b/drivers/char/drm/i915_ioc32.c | |||
@@ -30,7 +30,6 @@ | |||
30 | * IN THE SOFTWARE. | 30 | * IN THE SOFTWARE. |
31 | */ | 31 | */ |
32 | #include <linux/compat.h> | 32 | #include <linux/compat.h> |
33 | #include <linux/ioctl32.h> | ||
34 | 33 | ||
35 | #include "drmP.h" | 34 | #include "drmP.h" |
36 | #include "drm.h" | 35 | #include "drm.h" |
diff --git a/drivers/char/drm/mga_ioc32.c b/drivers/char/drm/mga_ioc32.c index 24a9d4e86af0..54a18eb2fc04 100644 --- a/drivers/char/drm/mga_ioc32.c +++ b/drivers/char/drm/mga_ioc32.c | |||
@@ -31,7 +31,6 @@ | |||
31 | * IN THE SOFTWARE. | 31 | * IN THE SOFTWARE. |
32 | */ | 32 | */ |
33 | #include <linux/compat.h> | 33 | #include <linux/compat.h> |
34 | #include <linux/ioctl32.h> | ||
35 | 34 | ||
36 | #include "drmP.h" | 35 | #include "drmP.h" |
37 | #include "drm.h" | 36 | #include "drm.h" |
diff --git a/drivers/char/drm/r128_ioc32.c b/drivers/char/drm/r128_ioc32.c index 1e2e367b8b82..9dd6d4116e47 100644 --- a/drivers/char/drm/r128_ioc32.c +++ b/drivers/char/drm/r128_ioc32.c | |||
@@ -30,7 +30,6 @@ | |||
30 | * IN THE SOFTWARE. | 30 | * IN THE SOFTWARE. |
31 | */ | 31 | */ |
32 | #include <linux/compat.h> | 32 | #include <linux/compat.h> |
33 | #include <linux/ioctl32.h> | ||
34 | 33 | ||
35 | #include "drmP.h" | 34 | #include "drmP.h" |
36 | #include "drm.h" | 35 | #include "drm.h" |
diff --git a/drivers/char/drm/radeon_ioc32.c b/drivers/char/drm/radeon_ioc32.c index fef4a2b84c1e..0ccfd3618ff1 100644 --- a/drivers/char/drm/radeon_ioc32.c +++ b/drivers/char/drm/radeon_ioc32.c | |||
@@ -28,7 +28,6 @@ | |||
28 | * IN THE SOFTWARE. | 28 | * IN THE SOFTWARE. |
29 | */ | 29 | */ |
30 | #include <linux/compat.h> | 30 | #include <linux/compat.h> |
31 | #include <linux/ioctl32.h> | ||
32 | 31 | ||
33 | #include "drmP.h" | 32 | #include "drmP.h" |
34 | #include "drm.h" | 33 | #include "drm.h" |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 407708a001e4..765c5c108bf4 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -1786,9 +1786,7 @@ static void doevent(int crd) | |||
1786 | if (tty) { /* Begin if valid tty */ | 1786 | if (tty) { /* Begin if valid tty */ |
1787 | if (event & BREAK_IND) { /* Begin if BREAK_IND */ | 1787 | if (event & BREAK_IND) { /* Begin if BREAK_IND */ |
1788 | /* A break has been indicated */ | 1788 | /* A break has been indicated */ |
1789 | tty->flip.count++; | 1789 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
1790 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | ||
1791 | *tty->flip.char_buf_ptr++ = 0; | ||
1792 | tty_schedule_flip(tty); | 1790 | tty_schedule_flip(tty); |
1793 | } else if (event & LOWTX_IND) { /* Begin LOWTX_IND */ | 1791 | } else if (event & LOWTX_IND) { /* Begin LOWTX_IND */ |
1794 | if (ch->statusflags & LOWWAIT) | 1792 | if (ch->statusflags & LOWWAIT) |
@@ -2124,7 +2122,6 @@ static void receive_data(struct channel *ch) | |||
2124 | int dataToRead, wrapgap, bytesAvailable; | 2122 | int dataToRead, wrapgap, bytesAvailable; |
2125 | unsigned int tail, head; | 2123 | unsigned int tail, head; |
2126 | unsigned int wrapmask; | 2124 | unsigned int wrapmask; |
2127 | int rc; | ||
2128 | 2125 | ||
2129 | /* --------------------------------------------------------------- | 2126 | /* --------------------------------------------------------------- |
2130 | This routine is called by doint when a receive data event | 2127 | This routine is called by doint when a receive data event |
@@ -2162,16 +2159,15 @@ static void receive_data(struct channel *ch) | |||
2162 | return; | 2159 | return; |
2163 | } | 2160 | } |
2164 | 2161 | ||
2165 | if (tty->flip.count == TTY_FLIPBUF_SIZE) | 2162 | if (tty_buffer_request_room(tty, bytesAvailable + 1) == 0) |
2166 | return; | 2163 | return; |
2167 | 2164 | ||
2168 | if (readb(&bc->orun)) { | 2165 | if (readb(&bc->orun)) { |
2169 | writeb(0, &bc->orun); | 2166 | writeb(0, &bc->orun); |
2170 | printk(KERN_WARNING "epca; overrun! DigiBoard device %s\n",tty->name); | 2167 | printk(KERN_WARNING "epca; overrun! DigiBoard device %s\n",tty->name); |
2168 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
2171 | } | 2169 | } |
2172 | rxwinon(ch); | 2170 | rxwinon(ch); |
2173 | rptr = tty->flip.char_buf_ptr; | ||
2174 | rc = tty->flip.count; | ||
2175 | while (bytesAvailable > 0) { /* Begin while there is data on the card */ | 2171 | while (bytesAvailable > 0) { /* Begin while there is data on the card */ |
2176 | wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; | 2172 | wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; |
2177 | /* --------------------------------------------------------------- | 2173 | /* --------------------------------------------------------------- |
@@ -2183,8 +2179,7 @@ static void receive_data(struct channel *ch) | |||
2183 | /* -------------------------------------------------------------- | 2179 | /* -------------------------------------------------------------- |
2184 | Make sure we don't overflow the buffer | 2180 | Make sure we don't overflow the buffer |
2185 | ----------------------------------------------------------------- */ | 2181 | ----------------------------------------------------------------- */ |
2186 | if ((rc + dataToRead) > TTY_FLIPBUF_SIZE) | 2182 | dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead); |
2187 | dataToRead = TTY_FLIPBUF_SIZE - rc; | ||
2188 | if (dataToRead == 0) | 2183 | if (dataToRead == 0) |
2189 | break; | 2184 | break; |
2190 | /* --------------------------------------------------------------- | 2185 | /* --------------------------------------------------------------- |
@@ -2192,13 +2187,9 @@ static void receive_data(struct channel *ch) | |||
2192 | for translation if necessary. | 2187 | for translation if necessary. |
2193 | ------------------------------------------------------------------ */ | 2188 | ------------------------------------------------------------------ */ |
2194 | memcpy_fromio(rptr, ch->rxptr + tail, dataToRead); | 2189 | memcpy_fromio(rptr, ch->rxptr + tail, dataToRead); |
2195 | rc += dataToRead; | ||
2196 | rptr += dataToRead; | ||
2197 | tail = (tail + dataToRead) & wrapmask; | 2190 | tail = (tail + dataToRead) & wrapmask; |
2198 | bytesAvailable -= dataToRead; | 2191 | bytesAvailable -= dataToRead; |
2199 | } /* End while there is data on the card */ | 2192 | } /* End while there is data on the card */ |
2200 | tty->flip.count = rc; | ||
2201 | tty->flip.char_buf_ptr = rptr; | ||
2202 | globalwinon(ch); | 2193 | globalwinon(ch); |
2203 | writew(tail, &bc->rout); | 2194 | writew(tail, &bc->rout); |
2204 | /* Must be called with global data */ | 2195 | /* Must be called with global data */ |
diff --git a/drivers/char/esp.c b/drivers/char/esp.c index 9f53d2fcc360..e469f641c728 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c | |||
@@ -345,26 +345,22 @@ static inline void receive_chars_pio(struct esp_struct *info, int num_bytes) | |||
345 | 345 | ||
346 | for (i = 0; i < num_bytes; i++) { | 346 | for (i = 0; i < num_bytes; i++) { |
347 | if (!(err_buf->data[i] & status_mask)) { | 347 | if (!(err_buf->data[i] & status_mask)) { |
348 | *(tty->flip.char_buf_ptr++) = pio_buf->data[i]; | 348 | int flag = 0; |
349 | 349 | ||
350 | if (err_buf->data[i] & 0x04) { | 350 | if (err_buf->data[i] & 0x04) { |
351 | *(tty->flip.flag_buf_ptr++) = TTY_BREAK; | 351 | flag = TTY_BREAK; |
352 | |||
353 | if (info->flags & ASYNC_SAK) | 352 | if (info->flags & ASYNC_SAK) |
354 | do_SAK(tty); | 353 | do_SAK(tty); |
355 | } | 354 | } |
356 | else if (err_buf->data[i] & 0x02) | 355 | else if (err_buf->data[i] & 0x02) |
357 | *(tty->flip.flag_buf_ptr++) = TTY_FRAME; | 356 | flag = TTY_FRAME; |
358 | else if (err_buf->data[i] & 0x01) | 357 | else if (err_buf->data[i] & 0x01) |
359 | *(tty->flip.flag_buf_ptr++) = TTY_PARITY; | 358 | flag = TTY_PARITY; |
360 | else | 359 | tty_insert_flip_char(tty, pio_buf->data[i], flag); |
361 | *(tty->flip.flag_buf_ptr++) = 0; | ||
362 | |||
363 | tty->flip.count++; | ||
364 | } | 360 | } |
365 | } | 361 | } |
366 | 362 | ||
367 | schedule_delayed_work(&tty->flip.work, 1); | 363 | schedule_delayed_work(&tty->buf.work, 1); |
368 | 364 | ||
369 | info->stat_flags &= ~ESP_STAT_RX_TIMEOUT; | 365 | info->stat_flags &= ~ESP_STAT_RX_TIMEOUT; |
370 | release_pio_buffer(pio_buf); | 366 | release_pio_buffer(pio_buf); |
@@ -397,7 +393,6 @@ static inline void receive_chars_dma_done(struct esp_struct *info, | |||
397 | int num_bytes; | 393 | int num_bytes; |
398 | unsigned long flags; | 394 | unsigned long flags; |
399 | 395 | ||
400 | |||
401 | flags=claim_dma_lock(); | 396 | flags=claim_dma_lock(); |
402 | disable_dma(dma); | 397 | disable_dma(dma); |
403 | clear_dma_ff(dma); | 398 | clear_dma_ff(dma); |
@@ -408,38 +403,31 @@ static inline void receive_chars_dma_done(struct esp_struct *info, | |||
408 | 403 | ||
409 | info->icount.rx += num_bytes; | 404 | info->icount.rx += num_bytes; |
410 | 405 | ||
411 | memcpy(tty->flip.char_buf_ptr, dma_buffer, num_bytes); | ||
412 | tty->flip.char_buf_ptr += num_bytes; | ||
413 | tty->flip.count += num_bytes; | ||
414 | memset(tty->flip.flag_buf_ptr, 0, num_bytes); | ||
415 | tty->flip.flag_buf_ptr += num_bytes; | ||
416 | |||
417 | if (num_bytes > 0) { | 406 | if (num_bytes > 0) { |
418 | tty->flip.flag_buf_ptr--; | 407 | tty_insert_flip_string(tty, dma_buffer, num_bytes - 1); |
419 | 408 | ||
420 | status &= (0x1c & info->read_status_mask); | 409 | status &= (0x1c & info->read_status_mask); |
410 | |||
411 | /* Is the status significant or do we throw the last byte ? */ | ||
412 | if (!(status & info->ignore_status_mask)) { | ||
413 | int statflag = 0; | ||
421 | 414 | ||
422 | if (status & info->ignore_status_mask) { | 415 | if (status & 0x10) { |
423 | tty->flip.count--; | 416 | statflag = TTY_BREAK; |
424 | tty->flip.char_buf_ptr--; | 417 | (info->icount.brk)++; |
425 | tty->flip.flag_buf_ptr--; | 418 | if (info->flags & ASYNC_SAK) |
426 | } else if (status & 0x10) { | 419 | do_SAK(tty); |
427 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 420 | } else if (status & 0x08) { |
428 | (info->icount.brk)++; | 421 | statflag = TTY_FRAME; |
429 | if (info->flags & ASYNC_SAK) | 422 | (info->icount.frame)++; |
430 | do_SAK(tty); | 423 | } |
431 | } else if (status & 0x08) { | 424 | else if (status & 0x04) { |
432 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 425 | statflag = TTY_PARITY; |
433 | (info->icount.frame)++; | 426 | (info->icount.parity)++; |
434 | } | 427 | } |
435 | else if (status & 0x04) { | 428 | tty_insert_flip_char(tty, dma_buffer[num_bytes - 1], statflag); |
436 | *tty->flip.flag_buf_ptr = TTY_PARITY; | ||
437 | (info->icount.parity)++; | ||
438 | } | 429 | } |
439 | 430 | schedule_delayed_work(&tty->buf.work, 1); | |
440 | tty->flip.flag_buf_ptr++; | ||
441 | |||
442 | schedule_delayed_work(&tty->flip.work, 1); | ||
443 | } | 431 | } |
444 | 432 | ||
445 | if (dma_bytes != num_bytes) { | 433 | if (dma_bytes != num_bytes) { |
@@ -693,8 +681,7 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id, | |||
693 | num_bytes = serial_in(info, UART_ESI_STAT1) << 8; | 681 | num_bytes = serial_in(info, UART_ESI_STAT1) << 8; |
694 | num_bytes |= serial_in(info, UART_ESI_STAT2); | 682 | num_bytes |= serial_in(info, UART_ESI_STAT2); |
695 | 683 | ||
696 | if (num_bytes > (TTY_FLIPBUF_SIZE - info->tty->flip.count)) | 684 | num_bytes = tty_buffer_request_room(info->tty, num_bytes); |
697 | num_bytes = TTY_FLIPBUF_SIZE - info->tty->flip.count; | ||
698 | 685 | ||
699 | if (num_bytes) { | 686 | if (num_bytes) { |
700 | if (dma_bytes || | 687 | if (dma_bytes || |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index f92177634677..1994a92d4733 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -597,9 +597,7 @@ static int hvc_poll(struct hvc_struct *hp) | |||
597 | 597 | ||
598 | /* Read data if any */ | 598 | /* Read data if any */ |
599 | for (;;) { | 599 | for (;;) { |
600 | int count = N_INBUF; | 600 | int count = tty_buffer_request_room(tty, N_INBUF); |
601 | if (count > (TTY_FLIPBUF_SIZE - tty->flip.count)) | ||
602 | count = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
603 | 601 | ||
604 | /* If flip is full, just reschedule a later read */ | 602 | /* If flip is full, just reschedule a later read */ |
605 | if (count == 0) { | 603 | if (count == 0) { |
@@ -635,7 +633,7 @@ static int hvc_poll(struct hvc_struct *hp) | |||
635 | tty_insert_flip_char(tty, buf[i], 0); | 633 | tty_insert_flip_char(tty, buf[i], 0); |
636 | } | 634 | } |
637 | 635 | ||
638 | if (tty->flip.count) | 636 | if (count) |
639 | tty_schedule_flip(tty); | 637 | tty_schedule_flip(tty); |
640 | 638 | ||
641 | /* | 639 | /* |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 53dc77c760fc..831eb4e8d9d3 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -456,12 +456,11 @@ static int hvcs_io(struct hvcs_struct *hvcsd) | |||
456 | /* remove the read masks */ | 456 | /* remove the read masks */ |
457 | hvcsd->todo_mask &= ~(HVCS_READ_MASK); | 457 | hvcsd->todo_mask &= ~(HVCS_READ_MASK); |
458 | 458 | ||
459 | if ((tty->flip.count + HVCS_BUFF_LEN) < TTY_FLIPBUF_SIZE) { | 459 | if (tty_buffer_request_room(tty, HVCS_BUFF_LEN) >= HVCS_BUFF_LEN) { |
460 | got = hvc_get_chars(unit_address, | 460 | got = hvc_get_chars(unit_address, |
461 | &buf[0], | 461 | &buf[0], |
462 | HVCS_BUFF_LEN); | 462 | HVCS_BUFF_LEN); |
463 | for (i=0;got && i<got;i++) | 463 | tty_insert_flip_string(tty, buf, got); |
464 | tty_insert_flip_char(tty, buf[i], TTY_NORMAL); | ||
465 | } | 464 | } |
466 | 465 | ||
467 | /* Give the TTY time to process the data we just sent. */ | 466 | /* Give the TTY time to process the data we just sent. */ |
@@ -469,10 +468,9 @@ static int hvcs_io(struct hvcs_struct *hvcsd) | |||
469 | hvcsd->todo_mask |= HVCS_QUICK_READ; | 468 | hvcsd->todo_mask |= HVCS_QUICK_READ; |
470 | 469 | ||
471 | spin_unlock_irqrestore(&hvcsd->lock, flags); | 470 | spin_unlock_irqrestore(&hvcsd->lock, flags); |
472 | if (tty->flip.count) { | 471 | /* This is synch because tty->low_latency == 1 */ |
473 | /* This is synch because tty->low_latency == 1 */ | 472 | if(got) |
474 | tty_flip_buffer_push(tty); | 473 | tty_flip_buffer_push(tty); |
475 | } | ||
476 | 474 | ||
477 | if (!got) { | 475 | if (!got) { |
478 | /* Do this _after_ the flip_buffer_push */ | 476 | /* Do this _after_ the flip_buffer_push */ |
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index a22aa940e01e..a9522189fc9e 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -197,7 +197,7 @@ static inline void print_state(struct hvsi_struct *hp) | |||
197 | }; | 197 | }; |
198 | const char *name = state_names[hp->state]; | 198 | const char *name = state_names[hp->state]; |
199 | 199 | ||
200 | if (hp->state > (sizeof(state_names)/sizeof(char*))) | 200 | if (hp->state > ARRAY_SIZE(state_names)) |
201 | name = "UNKNOWN"; | 201 | name = "UNKNOWN"; |
202 | 202 | ||
203 | pr_debug("hvsi%i: state = %s\n", hp->index, name); | 203 | pr_debug("hvsi%i: state = %s\n", hp->index, name); |
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index ba85eb1b6ec7..fc944d375be7 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c | |||
@@ -854,7 +854,7 @@ i2Input(i2ChanStrPtr pCh) | |||
854 | count += IBUF_SIZE; | 854 | count += IBUF_SIZE; |
855 | } | 855 | } |
856 | // Don't give more than can be taken by the line discipline | 856 | // Don't give more than can be taken by the line discipline |
857 | amountToMove = pCh->pTTY->ldisc.receive_room( pCh->pTTY ); | 857 | amountToMove = pCh->pTTY->receive_room; |
858 | if (count > amountToMove) { | 858 | if (count > amountToMove) { |
859 | count = amountToMove; | 859 | count = amountToMove; |
860 | } | 860 | } |
diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index d815d197dc3e..56e93a5a1e24 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c | |||
@@ -172,7 +172,7 @@ static int Fip_firmware_size; | |||
172 | /* Private (static) functions */ | 172 | /* Private (static) functions */ |
173 | static int ip2_open(PTTY, struct file *); | 173 | static int ip2_open(PTTY, struct file *); |
174 | static void ip2_close(PTTY, struct file *); | 174 | static void ip2_close(PTTY, struct file *); |
175 | static int ip2_write(PTTY, int, const unsigned char *, int); | 175 | static int ip2_write(PTTY, const unsigned char *, int); |
176 | static void ip2_putchar(PTTY, unsigned char); | 176 | static void ip2_putchar(PTTY, unsigned char); |
177 | static void ip2_flush_chars(PTTY); | 177 | static void ip2_flush_chars(PTTY); |
178 | static int ip2_write_room(PTTY); | 178 | static int ip2_write_room(PTTY); |
@@ -1713,7 +1713,7 @@ ip2_hangup ( PTTY tty ) | |||
1713 | /* */ | 1713 | /* */ |
1714 | /******************************************************************************/ | 1714 | /******************************************************************************/ |
1715 | static int | 1715 | static int |
1716 | ip2_write( PTTY tty, int user, const unsigned char *pData, int count) | 1716 | ip2_write( PTTY tty, const unsigned char *pData, int count) |
1717 | { | 1717 | { |
1718 | i2ChanStrPtr pCh = tty->driver_data; | 1718 | i2ChanStrPtr pCh = tty->driver_data; |
1719 | int bytesSent = 0; | 1719 | int bytesSent = 0; |
@@ -1726,7 +1726,7 @@ ip2_write( PTTY tty, int user, const unsigned char *pData, int count) | |||
1726 | 1726 | ||
1727 | /* This is the actual move bit. Make sure it does what we need!!!!! */ | 1727 | /* This is the actual move bit. Make sure it does what we need!!!!! */ |
1728 | WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); | 1728 | WRITE_LOCK_IRQSAVE(&pCh->Pbuf_spinlock,flags); |
1729 | bytesSent = i2Output( pCh, pData, count, user ); | 1729 | bytesSent = i2Output( pCh, pData, count, 0 ); |
1730 | WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); | 1730 | WRITE_UNLOCK_IRQRESTORE(&pCh->Pbuf_spinlock,flags); |
1731 | 1731 | ||
1732 | ip2trace (CHANN, ITRC_WRITE, ITRC_RETURN, 1, bytesSent ); | 1732 | ip2trace (CHANN, ITRC_WRITE, ITRC_RETURN, 1, bytesSent ); |
@@ -2001,7 +2001,9 @@ ip2_stop ( PTTY tty ) | |||
2001 | static int ip2_tiocmget(struct tty_struct *tty, struct file *file) | 2001 | static int ip2_tiocmget(struct tty_struct *tty, struct file *file) |
2002 | { | 2002 | { |
2003 | i2ChanStrPtr pCh = DevTable[tty->index]; | 2003 | i2ChanStrPtr pCh = DevTable[tty->index]; |
2004 | #ifdef ENABLE_DSSNOW | ||
2004 | wait_queue_t wait; | 2005 | wait_queue_t wait; |
2006 | #endif | ||
2005 | 2007 | ||
2006 | if (pCh == NULL) | 2008 | if (pCh == NULL) |
2007 | return -ENODEV; | 2009 | return -ENODEV; |
@@ -2089,15 +2091,17 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2089 | { | 2091 | { |
2090 | wait_queue_t wait; | 2092 | wait_queue_t wait; |
2091 | i2ChanStrPtr pCh = DevTable[tty->index]; | 2093 | i2ChanStrPtr pCh = DevTable[tty->index]; |
2094 | i2eBordStrPtr pB; | ||
2092 | struct async_icount cprev, cnow; /* kernel counter temps */ | 2095 | struct async_icount cprev, cnow; /* kernel counter temps */ |
2093 | struct serial_icounter_struct __user *p_cuser; | 2096 | struct serial_icounter_struct __user *p_cuser; |
2094 | int rc = 0; | 2097 | int rc = 0; |
2095 | unsigned long flags; | 2098 | unsigned long flags; |
2096 | void __user *argp = (void __user *)arg; | 2099 | void __user *argp = (void __user *)arg; |
2097 | 2100 | ||
2098 | if ( pCh == NULL ) { | 2101 | if ( pCh == NULL ) |
2099 | return -ENODEV; | 2102 | return -ENODEV; |
2100 | } | 2103 | |
2104 | pB = pCh->pMyBord; | ||
2101 | 2105 | ||
2102 | ip2trace (CHANN, ITRC_IOCTL, ITRC_ENTER, 2, cmd, arg ); | 2106 | ip2trace (CHANN, ITRC_IOCTL, ITRC_ENTER, 2, cmd, arg ); |
2103 | 2107 | ||
@@ -2206,9 +2210,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2206 | * for masking). Caller should use TIOCGICOUNT to see which one it was | 2210 | * for masking). Caller should use TIOCGICOUNT to see which one it was |
2207 | */ | 2211 | */ |
2208 | case TIOCMIWAIT: | 2212 | case TIOCMIWAIT: |
2209 | save_flags(flags);cli(); | 2213 | WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock, flags); |
2210 | cprev = pCh->icount; /* note the counters on entry */ | 2214 | cprev = pCh->icount; /* note the counters on entry */ |
2211 | restore_flags(flags); | 2215 | WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock, flags); |
2212 | i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4, | 2216 | i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4, |
2213 | CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP); | 2217 | CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP); |
2214 | init_waitqueue_entry(&wait, current); | 2218 | init_waitqueue_entry(&wait, current); |
@@ -2228,9 +2232,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2228 | rc = -ERESTARTSYS; | 2232 | rc = -ERESTARTSYS; |
2229 | break; | 2233 | break; |
2230 | } | 2234 | } |
2231 | save_flags(flags);cli(); | 2235 | WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock, flags); |
2232 | cnow = pCh->icount; /* atomic copy */ | 2236 | cnow = pCh->icount; /* atomic copy */ |
2233 | restore_flags(flags); | 2237 | WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock, flags); |
2234 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 2238 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
2235 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) { | 2239 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) { |
2236 | rc = -EIO; /* no change => rc */ | 2240 | rc = -EIO; /* no change => rc */ |
@@ -2268,9 +2272,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) | |||
2268 | case TIOCGICOUNT: | 2272 | case TIOCGICOUNT: |
2269 | ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc ); | 2273 | ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc ); |
2270 | 2274 | ||
2271 | save_flags(flags);cli(); | 2275 | WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock, flags); |
2272 | cnow = pCh->icount; | 2276 | cnow = pCh->icount; |
2273 | restore_flags(flags); | 2277 | WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock, flags); |
2274 | p_cuser = argp; | 2278 | p_cuser = argp; |
2275 | rc = put_user(cnow.cts, &p_cuser->cts); | 2279 | rc = put_user(cnow.cts, &p_cuser->cts); |
2276 | rc = put_user(cnow.dsr, &p_cuser->dsr); | 2280 | rc = put_user(cnow.dsr, &p_cuser->dsr); |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 561430ed94af..0097f06fa67b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -57,6 +57,7 @@ static int initialized = 0; | |||
57 | 57 | ||
58 | #ifdef CONFIG_PROC_FS | 58 | #ifdef CONFIG_PROC_FS |
59 | struct proc_dir_entry *proc_ipmi_root = NULL; | 59 | struct proc_dir_entry *proc_ipmi_root = NULL; |
60 | EXPORT_SYMBOL(proc_ipmi_root); | ||
60 | #endif /* CONFIG_PROC_FS */ | 61 | #endif /* CONFIG_PROC_FS */ |
61 | 62 | ||
62 | #define MAX_EVENTS_IN_QUEUE 25 | 63 | #define MAX_EVENTS_IN_QUEUE 25 |
@@ -3295,6 +3296,5 @@ EXPORT_SYMBOL(ipmi_get_my_address); | |||
3295 | EXPORT_SYMBOL(ipmi_set_my_LUN); | 3296 | EXPORT_SYMBOL(ipmi_set_my_LUN); |
3296 | EXPORT_SYMBOL(ipmi_get_my_LUN); | 3297 | EXPORT_SYMBOL(ipmi_get_my_LUN); |
3297 | EXPORT_SYMBOL(ipmi_smi_add_proc_entry); | 3298 | EXPORT_SYMBOL(ipmi_smi_add_proc_entry); |
3298 | EXPORT_SYMBOL(proc_ipmi_root); | ||
3299 | EXPORT_SYMBOL(ipmi_user_set_run_to_completion); | 3299 | EXPORT_SYMBOL(ipmi_user_set_run_to_completion); |
3300 | EXPORT_SYMBOL(ipmi_free_recv_msg); | 3300 | EXPORT_SYMBOL(ipmi_free_recv_msg); |
diff --git a/drivers/char/ipmi/ipmi_poweroff.c b/drivers/char/ipmi/ipmi_poweroff.c index e053eade0366..49c09ae004bf 100644 --- a/drivers/char/ipmi/ipmi_poweroff.c +++ b/drivers/char/ipmi/ipmi_poweroff.c | |||
@@ -612,11 +612,14 @@ static int ipmi_poweroff_init (void) | |||
612 | #endif | 612 | #endif |
613 | 613 | ||
614 | rv = ipmi_smi_watcher_register(&smi_watcher); | 614 | rv = ipmi_smi_watcher_register(&smi_watcher); |
615 | |||
616 | #ifdef CONFIG_PROC_FS | ||
615 | if (rv) { | 617 | if (rv) { |
616 | unregister_sysctl_table(ipmi_table_header); | 618 | unregister_sysctl_table(ipmi_table_header); |
617 | printk(KERN_ERR PFX "Unable to register SMI watcher: %d\n", rv); | 619 | printk(KERN_ERR PFX "Unable to register SMI watcher: %d\n", rv); |
618 | goto out_err; | 620 | goto out_err; |
619 | } | 621 | } |
622 | #endif | ||
620 | 623 | ||
621 | out_err: | 624 | out_err: |
622 | return rv; | 625 | return rv; |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 1bbf507adda5..e9ebabaf8cb0 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -20,7 +20,7 @@ | |||
20 | * 3/9/99 sameer Added support for ISI4616 cards. | 20 | * 3/9/99 sameer Added support for ISI4616 cards. |
21 | * | 21 | * |
22 | * 16/9/99 sameer We do not force RTS low anymore. | 22 | * 16/9/99 sameer We do not force RTS low anymore. |
23 | * This is to prevent the firmware | 23 | * This is to prevent the firmware |
24 | * from getting confused. | 24 | * from getting confused. |
25 | * | 25 | * |
26 | * 26/10/99 sameer Cosmetic changes:The driver now | 26 | * 26/10/99 sameer Cosmetic changes:The driver now |
@@ -31,28 +31,28 @@ | |||
31 | * | 31 | * |
32 | * 10/5/00 sameer Fixed isicom_shutdown_board() | 32 | * 10/5/00 sameer Fixed isicom_shutdown_board() |
33 | * to not lower DTR on all the ports | 33 | * to not lower DTR on all the ports |
34 | * when the last port on the card is | 34 | * when the last port on the card is |
35 | * closed. | 35 | * closed. |
36 | * | 36 | * |
37 | * 10/5/00 sameer Signal mask setup command added | 37 | * 10/5/00 sameer Signal mask setup command added |
38 | * to isicom_setup_port and | 38 | * to isicom_setup_port and |
39 | * isicom_shutdown_port. | 39 | * isicom_shutdown_port. |
40 | * | 40 | * |
41 | * 24/5/00 sameer The driver is now SMP aware. | 41 | * 24/5/00 sameer The driver is now SMP aware. |
42 | * | 42 | * |
43 | * | 43 | * |
44 | * 27/11/00 Vinayak P Risbud Fixed the Driver Crash Problem | 44 | * 27/11/00 Vinayak P Risbud Fixed the Driver Crash Problem |
45 | * | 45 | * |
46 | * | 46 | * |
47 | * 03/01/01 anil .s Added support for resetting the | 47 | * 03/01/01 anil .s Added support for resetting the |
48 | * internal modems on ISI cards. | 48 | * internal modems on ISI cards. |
49 | * | 49 | * |
50 | * 08/02/01 anil .s Upgraded the driver for kernel | 50 | * 08/02/01 anil .s Upgraded the driver for kernel |
51 | * 2.4.x | 51 | * 2.4.x |
52 | * | 52 | * |
53 | * 11/04/01 Kevin Fixed firmware load problem with | 53 | * 11/04/01 Kevin Fixed firmware load problem with |
54 | * ISIHP-4X card | 54 | * ISIHP-4X card |
55 | * | 55 | * |
56 | * 30/04/01 anil .s Fixed the remote login through | 56 | * 30/04/01 anil .s Fixed the remote login through |
57 | * ISI port problem. Now the link | 57 | * ISI port problem. Now the link |
58 | * does not go down before password | 58 | * does not go down before password |
@@ -62,9 +62,9 @@ | |||
62 | * among ISI-PCI cards. | 62 | * among ISI-PCI cards. |
63 | * | 63 | * |
64 | * 03/05/01 anil .s Added support to display the version | 64 | * 03/05/01 anil .s Added support to display the version |
65 | * info during insmod as well as module | 65 | * info during insmod as well as module |
66 | * listing by lsmod. | 66 | * listing by lsmod. |
67 | * | 67 | * |
68 | * 10/05/01 anil .s Done the modifications to the source | 68 | * 10/05/01 anil .s Done the modifications to the source |
69 | * file and Install script so that the | 69 | * file and Install script so that the |
70 | * same installation can be used for | 70 | * same installation can be used for |
@@ -73,19 +73,19 @@ | |||
73 | * 06/06/01 anil .s Now we drop both dtr and rts during | 73 | * 06/06/01 anil .s Now we drop both dtr and rts during |
74 | * shutdown_port as well as raise them | 74 | * shutdown_port as well as raise them |
75 | * during isicom_config_port. | 75 | * during isicom_config_port. |
76 | * | 76 | * |
77 | * 09/06/01 acme@conectiva.com.br use capable, not suser, do | 77 | * 09/06/01 acme@conectiva.com.br use capable, not suser, do |
78 | * restore_flags on failure in | 78 | * restore_flags on failure in |
79 | * isicom_send_break, verify put_user | 79 | * isicom_send_break, verify put_user |
80 | * result | 80 | * result |
81 | * | 81 | * |
82 | * 11/02/03 ranjeeth Added support for 230 Kbps and 460 Kbps | 82 | * 11/02/03 ranjeeth Added support for 230 Kbps and 460 Kbps |
83 | * Baud index extended to 21 | 83 | * Baud index extended to 21 |
84 | * | 84 | * |
85 | * 20/03/03 ranjeeth Made to work for Linux Advanced server. | 85 | * 20/03/03 ranjeeth Made to work for Linux Advanced server. |
86 | * Taken care of license warning. | 86 | * Taken care of license warning. |
87 | * | 87 | * |
88 | * 10/12/03 Ravindra Made to work for Fedora Core 1 of | 88 | * 10/12/03 Ravindra Made to work for Fedora Core 1 of |
89 | * Red Hat Distribution | 89 | * Red Hat Distribution |
90 | * | 90 | * |
91 | * 06/01/05 Alan Cox Merged the ISI and base kernel strands | 91 | * 06/01/05 Alan Cox Merged the ISI and base kernel strands |
@@ -93,10 +93,10 @@ | |||
93 | * | 93 | * |
94 | * *********************************************************** | 94 | * *********************************************************** |
95 | * | 95 | * |
96 | * To use this driver you also need the support package. You | 96 | * To use this driver you also need the support package. You |
97 | * can find this in RPM format on | 97 | * can find this in RPM format on |
98 | * ftp://ftp.linux.org.uk/pub/linux/alan | 98 | * ftp://ftp.linux.org.uk/pub/linux/alan |
99 | * | 99 | * |
100 | * You can find the original tools for this direct from Multitech | 100 | * You can find the original tools for this direct from Multitech |
101 | * ftp://ftp.multitech.com/ISI-Cards/ | 101 | * ftp://ftp.multitech.com/ISI-Cards/ |
102 | * | 102 | * |
@@ -107,20 +107,20 @@ | |||
107 | * Omit those entries for boards you don't have installed. | 107 | * Omit those entries for boards you don't have installed. |
108 | * | 108 | * |
109 | * TODO | 109 | * TODO |
110 | * Hotplug | ||
111 | * Merge testing | 110 | * Merge testing |
112 | * 64-bit verification | 111 | * 64-bit verification |
113 | */ | 112 | */ |
114 | 113 | ||
115 | #include <linux/module.h> | 114 | #include <linux/module.h> |
115 | #include <linux/firmware.h> | ||
116 | #include <linux/kernel.h> | 116 | #include <linux/kernel.h> |
117 | #include <linux/tty.h> | 117 | #include <linux/tty.h> |
118 | #include <linux/tty_flip.h> | ||
118 | #include <linux/termios.h> | 119 | #include <linux/termios.h> |
119 | #include <linux/fs.h> | 120 | #include <linux/fs.h> |
120 | #include <linux/sched.h> | 121 | #include <linux/sched.h> |
121 | #include <linux/serial.h> | 122 | #include <linux/serial.h> |
122 | #include <linux/mm.h> | 123 | #include <linux/mm.h> |
123 | #include <linux/miscdevice.h> | ||
124 | #include <linux/interrupt.h> | 124 | #include <linux/interrupt.h> |
125 | #include <linux/timer.h> | 125 | #include <linux/timer.h> |
126 | #include <linux/delay.h> | 126 | #include <linux/delay.h> |
@@ -134,50 +134,62 @@ | |||
134 | 134 | ||
135 | #include <linux/isicom.h> | 135 | #include <linux/isicom.h> |
136 | 136 | ||
137 | #define InterruptTheCard(base) outw(0, (base) + 0xc) | ||
138 | #define ClearInterrupt(base) inw((base) + 0x0a) | ||
139 | |||
140 | #ifdef DEBUG | ||
141 | #define pr_dbg(str...) printk(KERN_DEBUG "ISICOM: " str) | ||
142 | #define isicom_paranoia_check(a, b, c) __isicom_paranoia_check((a), (b), (c)) | ||
143 | #else | ||
144 | #define pr_dbg(str...) do { } while (0) | ||
145 | #define isicom_paranoia_check(a, b, c) 0 | ||
146 | #endif | ||
147 | |||
148 | static int isicom_probe(struct pci_dev *, const struct pci_device_id *); | ||
149 | static void __devexit isicom_remove(struct pci_dev *); | ||
150 | |||
137 | static struct pci_device_id isicom_pci_tbl[] = { | 151 | static struct pci_device_id isicom_pci_tbl[] = { |
138 | { VENDOR_ID, 0x2028, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 152 | { PCI_DEVICE(VENDOR_ID, 0x2028) }, |
139 | { VENDOR_ID, 0x2051, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 153 | { PCI_DEVICE(VENDOR_ID, 0x2051) }, |
140 | { VENDOR_ID, 0x2052, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 154 | { PCI_DEVICE(VENDOR_ID, 0x2052) }, |
141 | { VENDOR_ID, 0x2053, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 155 | { PCI_DEVICE(VENDOR_ID, 0x2053) }, |
142 | { VENDOR_ID, 0x2054, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 156 | { PCI_DEVICE(VENDOR_ID, 0x2054) }, |
143 | { VENDOR_ID, 0x2055, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 157 | { PCI_DEVICE(VENDOR_ID, 0x2055) }, |
144 | { VENDOR_ID, 0x2056, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 158 | { PCI_DEVICE(VENDOR_ID, 0x2056) }, |
145 | { VENDOR_ID, 0x2057, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 159 | { PCI_DEVICE(VENDOR_ID, 0x2057) }, |
146 | { VENDOR_ID, 0x2058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 160 | { PCI_DEVICE(VENDOR_ID, 0x2058) }, |
147 | { 0 } | 161 | { 0 } |
148 | }; | 162 | }; |
149 | MODULE_DEVICE_TABLE(pci, isicom_pci_tbl); | 163 | MODULE_DEVICE_TABLE(pci, isicom_pci_tbl); |
150 | 164 | ||
165 | static struct pci_driver isicom_driver = { | ||
166 | .name = "isicom", | ||
167 | .id_table = isicom_pci_tbl, | ||
168 | .probe = isicom_probe, | ||
169 | .remove = __devexit_p(isicom_remove) | ||
170 | }; | ||
171 | |||
151 | static int prev_card = 3; /* start servicing isi_card[0] */ | 172 | static int prev_card = 3; /* start servicing isi_card[0] */ |
152 | static struct tty_driver *isicom_normal; | 173 | static struct tty_driver *isicom_normal; |
153 | 174 | ||
154 | static struct timer_list tx; | 175 | static struct timer_list tx; |
155 | static char re_schedule = 1; | 176 | static char re_schedule = 1; |
156 | #ifdef ISICOM_DEBUG | ||
157 | static unsigned long tx_count = 0; | ||
158 | #endif | ||
159 | |||
160 | static int ISILoad_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); | ||
161 | 177 | ||
162 | static void isicom_tx(unsigned long _data); | 178 | static void isicom_tx(unsigned long _data); |
163 | static void isicom_start(struct tty_struct * tty); | 179 | static void isicom_start(struct tty_struct *tty); |
164 | |||
165 | static unsigned char * tmp_buf; | ||
166 | static DECLARE_MUTEX(tmp_buf_sem); | ||
167 | 180 | ||
168 | /* baud index mappings from linux defns to isi */ | 181 | /* baud index mappings from linux defns to isi */ |
169 | 182 | ||
170 | static signed char linuxb_to_isib[] = { | 183 | static signed char linuxb_to_isib[] = { |
171 | -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, | 184 | -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 16, 17, 18, 19 |
172 | 18, 19 | ||
173 | }; | 185 | }; |
174 | 186 | ||
175 | struct isi_board { | 187 | struct isi_board { |
176 | unsigned short base; | 188 | unsigned long base; |
177 | unsigned char irq; | 189 | unsigned char irq; |
178 | unsigned char port_count; | 190 | unsigned char port_count; |
179 | unsigned short status; | 191 | unsigned short status; |
180 | unsigned short port_status; /* each bit represents a single port */ | 192 | unsigned short port_status; /* each bit for each port */ |
181 | unsigned short shift_count; | 193 | unsigned short shift_count; |
182 | struct isi_port * ports; | 194 | struct isi_port * ports; |
183 | signed char count; | 195 | signed char count; |
@@ -192,9 +204,9 @@ struct isi_port { | |||
192 | int count; | 204 | int count; |
193 | int blocked_open; | 205 | int blocked_open; |
194 | int close_delay; | 206 | int close_delay; |
195 | unsigned short channel; | 207 | u16 channel; |
196 | unsigned short status; | 208 | u16 status; |
197 | unsigned short closing_wait; | 209 | u16 closing_wait; |
198 | struct isi_board * card; | 210 | struct isi_board * card; |
199 | struct tty_struct * tty; | 211 | struct tty_struct * tty; |
200 | wait_queue_head_t close_wait; | 212 | wait_queue_head_t close_wait; |
@@ -215,35 +227,37 @@ static struct isi_port isi_ports[PORT_COUNT]; | |||
215 | * the kernel lock for the card and have the card in a position that | 227 | * the kernel lock for the card and have the card in a position that |
216 | * it wants to talk. | 228 | * it wants to talk. |
217 | */ | 229 | */ |
218 | 230 | ||
219 | static int lock_card(struct isi_board *card) | 231 | static int lock_card(struct isi_board *card) |
220 | { | 232 | { |
221 | char retries; | 233 | char retries; |
222 | unsigned short base = card->base; | 234 | unsigned long base = card->base; |
223 | 235 | ||
224 | for (retries = 0; retries < 100; retries++) { | 236 | for (retries = 0; retries < 100; retries++) { |
225 | spin_lock_irqsave(&card->card_lock, card->flags); | 237 | spin_lock_irqsave(&card->card_lock, card->flags); |
226 | if (inw(base + 0xe) & 0x1) { | 238 | if (inw(base + 0xe) & 0x1) { |
227 | return 1; | 239 | return 1; |
228 | } else { | 240 | } else { |
229 | spin_unlock_irqrestore(&card->card_lock, card->flags); | 241 | spin_unlock_irqrestore(&card->card_lock, card->flags); |
230 | udelay(1000); /* 1ms */ | 242 | udelay(1000); /* 1ms */ |
231 | } | 243 | } |
232 | } | 244 | } |
233 | printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%x)\n", card->base); | 245 | printk(KERN_WARNING "ISICOM: Failed to lock Card (0x%lx)\n", |
246 | card->base); | ||
247 | |||
234 | return 0; /* Failed to aquire the card! */ | 248 | return 0; /* Failed to aquire the card! */ |
235 | } | 249 | } |
236 | 250 | ||
237 | static int lock_card_at_interrupt(struct isi_board *card) | 251 | static int lock_card_at_interrupt(struct isi_board *card) |
238 | { | 252 | { |
239 | unsigned char retries; | 253 | unsigned char retries; |
240 | unsigned short base = card->base; | 254 | unsigned long base = card->base; |
241 | 255 | ||
242 | for (retries = 0; retries < 200; retries++) { | 256 | for (retries = 0; retries < 200; retries++) { |
243 | spin_lock_irqsave(&card->card_lock, card->flags); | 257 | spin_lock_irqsave(&card->card_lock, card->flags); |
244 | 258 | ||
245 | if (inw(base + 0xe) & 0x1) | 259 | if (inw(base + 0xe) & 0x1) |
246 | return 1; | 260 | return 1; |
247 | else | 261 | else |
248 | spin_unlock_irqrestore(&card->card_lock, card->flags); | 262 | spin_unlock_irqrestore(&card->card_lock, card->flags); |
249 | } | 263 | } |
@@ -259,373 +273,141 @@ static void unlock_card(struct isi_board *card) | |||
259 | /* | 273 | /* |
260 | * ISI Card specific ops ... | 274 | * ISI Card specific ops ... |
261 | */ | 275 | */ |
262 | 276 | ||
263 | static void raise_dtr(struct isi_port * port) | 277 | static void raise_dtr(struct isi_port *port) |
264 | { | 278 | { |
265 | struct isi_board * card = port->card; | 279 | struct isi_board *card = port->card; |
266 | unsigned short base = card->base; | 280 | unsigned long base = card->base; |
267 | unsigned char channel = port->channel; | 281 | u16 channel = port->channel; |
268 | 282 | ||
269 | if (!lock_card(card)) | 283 | if (!lock_card(card)) |
270 | return; | 284 | return; |
271 | 285 | ||
272 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 286 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
273 | outw(0x0504, base); | 287 | outw(0x0504, base); |
274 | InterruptTheCard(base); | 288 | InterruptTheCard(base); |
275 | port->status |= ISI_DTR; | 289 | port->status |= ISI_DTR; |
276 | unlock_card(card); | 290 | unlock_card(card); |
277 | } | 291 | } |
278 | 292 | ||
279 | static inline void drop_dtr(struct isi_port * port) | 293 | static inline void drop_dtr(struct isi_port *port) |
280 | { | 294 | { |
281 | struct isi_board * card = port->card; | 295 | struct isi_board *card = port->card; |
282 | unsigned short base = card->base; | 296 | unsigned long base = card->base; |
283 | unsigned char channel = port->channel; | 297 | u16 channel = port->channel; |
284 | 298 | ||
285 | if (!lock_card(card)) | 299 | if (!lock_card(card)) |
286 | return; | 300 | return; |
287 | 301 | ||
288 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 302 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
289 | outw(0x0404, base); | 303 | outw(0x0404, base); |
290 | InterruptTheCard(base); | 304 | InterruptTheCard(base); |
291 | port->status &= ~ISI_DTR; | 305 | port->status &= ~ISI_DTR; |
292 | unlock_card(card); | 306 | unlock_card(card); |
293 | } | 307 | } |
294 | 308 | ||
295 | static inline void raise_rts(struct isi_port * port) | 309 | static inline void raise_rts(struct isi_port *port) |
296 | { | 310 | { |
297 | struct isi_board * card = port->card; | 311 | struct isi_board *card = port->card; |
298 | unsigned short base = card->base; | 312 | unsigned long base = card->base; |
299 | unsigned char channel = port->channel; | 313 | u16 channel = port->channel; |
300 | 314 | ||
301 | if (!lock_card(card)) | 315 | if (!lock_card(card)) |
302 | return; | 316 | return; |
303 | 317 | ||
304 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 318 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
305 | outw(0x0a04, base); | 319 | outw(0x0a04, base); |
306 | InterruptTheCard(base); | 320 | InterruptTheCard(base); |
307 | port->status |= ISI_RTS; | 321 | port->status |= ISI_RTS; |
308 | unlock_card(card); | 322 | unlock_card(card); |
309 | } | 323 | } |
310 | static inline void drop_rts(struct isi_port * port) | 324 | static inline void drop_rts(struct isi_port *port) |
311 | { | 325 | { |
312 | struct isi_board * card = port->card; | 326 | struct isi_board *card = port->card; |
313 | unsigned short base = card->base; | 327 | unsigned long base = card->base; |
314 | unsigned char channel = port->channel; | 328 | u16 channel = port->channel; |
315 | 329 | ||
316 | if (!lock_card(card)) | 330 | if (!lock_card(card)) |
317 | return; | 331 | return; |
318 | 332 | ||
319 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 333 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
320 | outw(0x0804, base); | 334 | outw(0x0804, base); |
321 | InterruptTheCard(base); | 335 | InterruptTheCard(base); |
322 | port->status &= ~ISI_RTS; | 336 | port->status &= ~ISI_RTS; |
323 | unlock_card(card); | 337 | unlock_card(card); |
324 | } | 338 | } |
325 | 339 | ||
326 | static inline void raise_dtr_rts(struct isi_port * port) | 340 | static inline void raise_dtr_rts(struct isi_port *port) |
327 | { | 341 | { |
328 | struct isi_board * card = port->card; | 342 | struct isi_board *card = port->card; |
329 | unsigned short base = card->base; | 343 | unsigned long base = card->base; |
330 | unsigned char channel = port->channel; | 344 | u16 channel = port->channel; |
331 | 345 | ||
332 | if (!lock_card(card)) | 346 | if (!lock_card(card)) |
333 | return; | 347 | return; |
334 | 348 | ||
335 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 349 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
336 | outw(0x0f04, base); | 350 | outw(0x0f04, base); |
337 | InterruptTheCard(base); | 351 | InterruptTheCard(base); |
338 | port->status |= (ISI_DTR | ISI_RTS); | 352 | port->status |= (ISI_DTR | ISI_RTS); |
339 | unlock_card(card); | 353 | unlock_card(card); |
340 | } | 354 | } |
341 | 355 | ||
342 | static void drop_dtr_rts(struct isi_port * port) | 356 | static void drop_dtr_rts(struct isi_port *port) |
343 | { | 357 | { |
344 | struct isi_board * card = port->card; | 358 | struct isi_board *card = port->card; |
345 | unsigned short base = card->base; | 359 | unsigned long base = card->base; |
346 | unsigned char channel = port->channel; | 360 | u16 channel = port->channel; |
347 | 361 | ||
348 | if (!lock_card(card)) | 362 | if (!lock_card(card)) |
349 | return; | 363 | return; |
350 | 364 | ||
351 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 365 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
352 | outw(0x0c04, base); | 366 | outw(0x0c04, base); |
353 | InterruptTheCard(base); | 367 | InterruptTheCard(base); |
354 | port->status &= ~(ISI_RTS | ISI_DTR); | 368 | port->status &= ~(ISI_RTS | ISI_DTR); |
355 | unlock_card(card); | 369 | unlock_card(card); |
356 | } | 370 | } |
357 | 371 | ||
358 | static inline void kill_queue(struct isi_port * port, short queue) | 372 | static inline void kill_queue(struct isi_port *port, short queue) |
359 | { | 373 | { |
360 | struct isi_board * card = port->card; | 374 | struct isi_board *card = port->card; |
361 | unsigned short base = card->base; | 375 | unsigned long base = card->base; |
362 | unsigned char channel = port->channel; | 376 | u16 channel = port->channel; |
363 | 377 | ||
364 | if (!lock_card(card)) | 378 | if (!lock_card(card)) |
365 | return; | 379 | return; |
366 | 380 | ||
367 | outw(0x8000 | (channel << card->shift_count) | 0x02 , base); | 381 | outw(0x8000 | (channel << card->shift_count) | 0x02, base); |
368 | outw((queue << 8) | 0x06, base); | 382 | outw((queue << 8) | 0x06, base); |
369 | InterruptTheCard(base); | 383 | InterruptTheCard(base); |
370 | unlock_card(card); | 384 | unlock_card(card); |
371 | } | 385 | } |
372 | 386 | ||
373 | |||
374 | /* | ||
375 | * Firmware loader driver specific routines. This needs to mostly die | ||
376 | * and be replaced with request_firmware. | ||
377 | */ | ||
378 | |||
379 | static struct file_operations ISILoad_fops = { | ||
380 | .owner = THIS_MODULE, | ||
381 | .ioctl = ISILoad_ioctl, | ||
382 | }; | ||
383 | |||
384 | static struct miscdevice isiloader_device = { | ||
385 | ISILOAD_MISC_MINOR, "isictl", &ISILoad_fops | ||
386 | }; | ||
387 | |||
388 | |||
389 | static inline int WaitTillCardIsFree(unsigned short base) | ||
390 | { | ||
391 | unsigned long count=0; | ||
392 | while( (!(inw(base+0xe) & 0x1)) && (count++ < 6000000)); | ||
393 | if (inw(base+0xe)&0x1) | ||
394 | return 0; | ||
395 | else | ||
396 | return 1; | ||
397 | } | ||
398 | |||
399 | static int ISILoad_ioctl(struct inode *inode, struct file *filp, | ||
400 | unsigned int cmd, unsigned long arg) | ||
401 | { | ||
402 | unsigned int card, i, j, signature, status, portcount = 0; | ||
403 | unsigned long t; | ||
404 | unsigned short word_count, base; | ||
405 | bin_frame frame; | ||
406 | void __user *argp = (void __user *)arg; | ||
407 | /* exec_record exec_rec; */ | ||
408 | |||
409 | if(get_user(card, (int __user *)argp)) | ||
410 | return -EFAULT; | ||
411 | |||
412 | if(card < 0 || card >= BOARD_COUNT) | ||
413 | return -ENXIO; | ||
414 | |||
415 | base=isi_card[card].base; | ||
416 | |||
417 | if(base==0) | ||
418 | return -ENXIO; /* disabled or not used */ | ||
419 | |||
420 | switch(cmd) { | ||
421 | case MIOCTL_RESET_CARD: | ||
422 | if (!capable(CAP_SYS_ADMIN)) | ||
423 | return -EPERM; | ||
424 | printk(KERN_DEBUG "ISILoad:Resetting Card%d at 0x%x ",card+1,base); | ||
425 | |||
426 | inw(base+0x8); | ||
427 | |||
428 | for(t=jiffies+HZ/100;time_before(jiffies, t);); | ||
429 | |||
430 | outw(0,base+0x8); /* Reset */ | ||
431 | |||
432 | for(j=1;j<=3;j++) { | ||
433 | for(t=jiffies+HZ;time_before(jiffies, t);); | ||
434 | printk("."); | ||
435 | } | ||
436 | signature=(inw(base+0x4)) & 0xff; | ||
437 | if (isi_card[card].isa) { | ||
438 | |||
439 | if (!(inw(base+0xe) & 0x1) || (inw(base+0x2))) { | ||
440 | #ifdef ISICOM_DEBUG | ||
441 | printk("\nbase+0x2=0x%x , base+0xe=0x%x",inw(base+0x2),inw(base+0xe)); | ||
442 | #endif | ||
443 | printk("\nISILoad:ISA Card%d reset failure (Possible bad I/O Port Address 0x%x).\n",card+1,base); | ||
444 | return -EIO; | ||
445 | } | ||
446 | } | ||
447 | else { | ||
448 | portcount = inw(base+0x2); | ||
449 | if (!(inw(base+0xe) & 0x1) || ((portcount!=0) && (portcount!=4) && (portcount!=8))) { | ||
450 | #ifdef ISICOM_DEBUG | ||
451 | printk("\nbase+0x2=0x%x , base+0xe=0x%x",inw(base+0x2),inw(base+0xe)); | ||
452 | #endif | ||
453 | printk("\nISILoad:PCI Card%d reset failure (Possible bad I/O Port Address 0x%x).\n",card+1,base); | ||
454 | return -EIO; | ||
455 | } | ||
456 | } | ||
457 | switch(signature) { | ||
458 | case 0xa5: | ||
459 | case 0xbb: | ||
460 | case 0xdd: | ||
461 | if (isi_card[card].isa) | ||
462 | isi_card[card].port_count = 8; | ||
463 | else { | ||
464 | if (portcount == 4) | ||
465 | isi_card[card].port_count = 4; | ||
466 | else | ||
467 | isi_card[card].port_count = 8; | ||
468 | } | ||
469 | isi_card[card].shift_count = 12; | ||
470 | break; | ||
471 | |||
472 | case 0xcc: isi_card[card].port_count = 16; | ||
473 | isi_card[card].shift_count = 11; | ||
474 | break; | ||
475 | |||
476 | default: printk("ISILoad:Card%d reset failure (Possible bad I/O Port Address 0x%x).\n",card+1,base); | ||
477 | #ifdef ISICOM_DEBUG | ||
478 | printk("Sig=0x%x\n",signature); | ||
479 | #endif | ||
480 | return -EIO; | ||
481 | } | ||
482 | printk("-Done\n"); | ||
483 | return put_user(signature,(unsigned __user *)argp); | ||
484 | |||
485 | case MIOCTL_LOAD_FIRMWARE: | ||
486 | if (!capable(CAP_SYS_ADMIN)) | ||
487 | return -EPERM; | ||
488 | |||
489 | if(copy_from_user(&frame, argp, sizeof(bin_frame))) | ||
490 | return -EFAULT; | ||
491 | |||
492 | if (WaitTillCardIsFree(base)) | ||
493 | return -EIO; | ||
494 | |||
495 | outw(0xf0,base); /* start upload sequence */ | ||
496 | outw(0x00,base); | ||
497 | outw((frame.addr), base);/* lsb of adderess */ | ||
498 | |||
499 | word_count=(frame.count >> 1) + frame.count % 2; | ||
500 | outw(word_count, base); | ||
501 | InterruptTheCard(base); | ||
502 | |||
503 | for(i=0;i<=0x2f;i++); /* a wee bit of delay */ | ||
504 | |||
505 | if (WaitTillCardIsFree(base)) | ||
506 | return -EIO; | ||
507 | |||
508 | if ((status=inw(base+0x4))!=0) { | ||
509 | printk(KERN_WARNING "ISILoad:Card%d rejected load header:\nAddress:0x%x \nCount:0x%x \nStatus:0x%x \n", | ||
510 | card+1, frame.addr, frame.count, status); | ||
511 | return -EIO; | ||
512 | } | ||
513 | outsw(base, (void *) frame.bin_data, word_count); | ||
514 | |||
515 | InterruptTheCard(base); | ||
516 | |||
517 | for(i=0;i<=0x0f;i++); /* another wee bit of delay */ | ||
518 | |||
519 | if (WaitTillCardIsFree(base)) | ||
520 | return -EIO; | ||
521 | |||
522 | if ((status=inw(base+0x4))!=0) { | ||
523 | printk(KERN_ERR "ISILoad:Card%d got out of sync.Card Status:0x%x\n",card+1, status); | ||
524 | return -EIO; | ||
525 | } | ||
526 | return 0; | ||
527 | |||
528 | case MIOCTL_READ_FIRMWARE: | ||
529 | if (!capable(CAP_SYS_ADMIN)) | ||
530 | return -EPERM; | ||
531 | |||
532 | if(copy_from_user(&frame, argp, sizeof(bin_header))) | ||
533 | return -EFAULT; | ||
534 | |||
535 | if (WaitTillCardIsFree(base)) | ||
536 | return -EIO; | ||
537 | |||
538 | outw(0xf1,base); /* start download sequence */ | ||
539 | outw(0x00,base); | ||
540 | outw((frame.addr), base);/* lsb of adderess */ | ||
541 | |||
542 | word_count=(frame.count >> 1) + frame.count % 2; | ||
543 | outw(word_count+1, base); | ||
544 | InterruptTheCard(base); | ||
545 | |||
546 | for(i=0;i<=0xf;i++); /* a wee bit of delay */ | ||
547 | |||
548 | if (WaitTillCardIsFree(base)) | ||
549 | return -EIO; | ||
550 | |||
551 | if ((status=inw(base+0x4))!=0) { | ||
552 | printk(KERN_WARNING "ISILoad:Card%d rejected verify header:\nAddress:0x%x \nCount:0x%x \nStatus:0x%x \n", | ||
553 | card+1, frame.addr, frame.count, status); | ||
554 | return -EIO; | ||
555 | } | ||
556 | |||
557 | inw(base); | ||
558 | insw(base, frame.bin_data, word_count); | ||
559 | InterruptTheCard(base); | ||
560 | |||
561 | for(i=0;i<=0x0f;i++); /* another wee bit of delay */ | ||
562 | |||
563 | if (WaitTillCardIsFree(base)) | ||
564 | return -EIO; | ||
565 | |||
566 | if ((status=inw(base+0x4))!=0) { | ||
567 | printk(KERN_ERR "ISILoad:Card%d verify got out of sync.Card Status:0x%x\n",card+1, status); | ||
568 | return -EIO; | ||
569 | } | ||
570 | |||
571 | if(copy_to_user(argp, &frame, sizeof(bin_frame))) | ||
572 | return -EFAULT; | ||
573 | return 0; | ||
574 | |||
575 | case MIOCTL_XFER_CTRL: | ||
576 | if (!capable(CAP_SYS_ADMIN)) | ||
577 | return -EPERM; | ||
578 | if (WaitTillCardIsFree(base)) | ||
579 | return -EIO; | ||
580 | |||
581 | outw(0xf2, base); | ||
582 | outw(0x800, base); | ||
583 | outw(0x0, base); | ||
584 | outw(0x0, base); | ||
585 | InterruptTheCard(base); | ||
586 | outw(0x0, base+0x4); /* for ISI4608 cards */ | ||
587 | |||
588 | isi_card[card].status |= FIRMWARE_LOADED; | ||
589 | return 0; | ||
590 | |||
591 | default: | ||
592 | #ifdef ISICOM_DEBUG | ||
593 | printk(KERN_DEBUG "ISILoad: Received Ioctl cmd 0x%x.\n", cmd); | ||
594 | #endif | ||
595 | return -ENOIOCTLCMD; | ||
596 | |||
597 | } | ||
598 | |||
599 | } | ||
600 | |||
601 | |||
602 | /* | 387 | /* |
603 | * ISICOM Driver specific routines ... | 388 | * ISICOM Driver specific routines ... |
604 | * | 389 | * |
605 | */ | 390 | */ |
606 | 391 | ||
607 | static inline int isicom_paranoia_check(struct isi_port const * port, char *name, | 392 | static inline int __isicom_paranoia_check(struct isi_port const *port, |
608 | const char * routine) | 393 | char *name, const char *routine) |
609 | { | 394 | { |
610 | #ifdef ISICOM_DEBUG | ||
611 | static const char * badmagic = | ||
612 | KERN_WARNING "ISICOM: Warning: bad isicom magic for dev %s in %s.\n"; | ||
613 | static const char * badport = | ||
614 | KERN_WARNING "ISICOM: Warning: NULL isicom port for dev %s in %s.\n"; | ||
615 | if (!port) { | 395 | if (!port) { |
616 | printk(badport, name, routine); | 396 | printk(KERN_WARNING "ISICOM: Warning: bad isicom magic for " |
397 | "dev %s in %s.\n", name, routine); | ||
617 | return 1; | 398 | return 1; |
618 | } | 399 | } |
619 | if (port->magic != ISICOM_MAGIC) { | 400 | if (port->magic != ISICOM_MAGIC) { |
620 | printk(badmagic, name, routine); | 401 | printk(KERN_WARNING "ISICOM: Warning: NULL isicom port for " |
402 | "dev %s in %s.\n", name, routine); | ||
621 | return 1; | 403 | return 1; |
622 | } | 404 | } |
623 | #endif | 405 | |
624 | return 0; | 406 | return 0; |
625 | } | 407 | } |
626 | 408 | ||
627 | /* | 409 | /* |
628 | * Transmitter. | 410 | * Transmitter. |
629 | * | 411 | * |
630 | * We shovel data into the card buffers on a regular basis. The card | 412 | * We shovel data into the card buffers on a regular basis. The card |
631 | * will do the rest of the work for us. | 413 | * will do the rest of the work for us. |
@@ -635,25 +417,21 @@ static void isicom_tx(unsigned long _data) | |||
635 | { | 417 | { |
636 | short count = (BOARD_COUNT-1), card, base; | 418 | short count = (BOARD_COUNT-1), card, base; |
637 | short txcount, wrd, residue, word_count, cnt; | 419 | short txcount, wrd, residue, word_count, cnt; |
638 | struct isi_port * port; | 420 | struct isi_port *port; |
639 | struct tty_struct * tty; | 421 | struct tty_struct *tty; |
640 | 422 | ||
641 | #ifdef ISICOM_DEBUG | ||
642 | ++tx_count; | ||
643 | #endif | ||
644 | |||
645 | /* find next active board */ | 423 | /* find next active board */ |
646 | card = (prev_card + 1) & 0x0003; | 424 | card = (prev_card + 1) & 0x0003; |
647 | while(count-- > 0) { | 425 | while(count-- > 0) { |
648 | if (isi_card[card].status & BOARD_ACTIVE) | 426 | if (isi_card[card].status & BOARD_ACTIVE) |
649 | break; | 427 | break; |
650 | card = (card + 1) & 0x0003; | 428 | card = (card + 1) & 0x0003; |
651 | } | 429 | } |
652 | if (!(isi_card[card].status & BOARD_ACTIVE)) | 430 | if (!(isi_card[card].status & BOARD_ACTIVE)) |
653 | goto sched_again; | 431 | goto sched_again; |
654 | 432 | ||
655 | prev_card = card; | 433 | prev_card = card; |
656 | 434 | ||
657 | count = isi_card[card].port_count; | 435 | count = isi_card[card].port_count; |
658 | port = isi_card[card].ports; | 436 | port = isi_card[card].ports; |
659 | base = isi_card[card].base; | 437 | base = isi_card[card].base; |
@@ -662,18 +440,18 @@ static void isicom_tx(unsigned long _data) | |||
662 | continue; | 440 | continue; |
663 | /* port not active or tx disabled to force flow control */ | 441 | /* port not active or tx disabled to force flow control */ |
664 | if (!(port->flags & ASYNC_INITIALIZED) || | 442 | if (!(port->flags & ASYNC_INITIALIZED) || |
665 | !(port->status & ISI_TXOK)) | 443 | !(port->status & ISI_TXOK)) |
666 | unlock_card(&isi_card[card]); | 444 | unlock_card(&isi_card[card]); |
667 | continue; | 445 | continue; |
668 | 446 | ||
669 | tty = port->tty; | 447 | tty = port->tty; |
670 | 448 | ||
671 | 449 | ||
672 | if(tty == NULL) { | 450 | if (tty == NULL) { |
673 | unlock_card(&isi_card[card]); | 451 | unlock_card(&isi_card[card]); |
674 | continue; | 452 | continue; |
675 | } | 453 | } |
676 | 454 | ||
677 | txcount = min_t(short, TX_SIZE, port->xmit_cnt); | 455 | txcount = min_t(short, TX_SIZE, port->xmit_cnt); |
678 | if (txcount <= 0 || tty->stopped || tty->hw_stopped) { | 456 | if (txcount <= 0 || tty->stopped || tty->hw_stopped) { |
679 | unlock_card(&isi_card[card]); | 457 | unlock_card(&isi_card[card]); |
@@ -681,44 +459,45 @@ static void isicom_tx(unsigned long _data) | |||
681 | } | 459 | } |
682 | if (!(inw(base + 0x02) & (1 << port->channel))) { | 460 | if (!(inw(base + 0x02) & (1 << port->channel))) { |
683 | unlock_card(&isi_card[card]); | 461 | unlock_card(&isi_card[card]); |
684 | continue; | 462 | continue; |
685 | } | 463 | } |
686 | #ifdef ISICOM_DEBUG | 464 | pr_dbg("txing %d bytes, port%d.\n", txcount, |
687 | printk(KERN_DEBUG "ISICOM: txing %d bytes, port%d.\n", | 465 | port->channel + 1); |
688 | txcount, port->channel+1); | 466 | outw((port->channel << isi_card[card].shift_count) | txcount, |
689 | #endif | 467 | base); |
690 | outw((port->channel << isi_card[card].shift_count) | txcount | ||
691 | , base); | ||
692 | residue = NO; | 468 | residue = NO; |
693 | wrd = 0; | 469 | wrd = 0; |
694 | while (1) { | 470 | while (1) { |
695 | cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE - port->xmit_tail)); | 471 | cnt = min_t(int, txcount, (SERIAL_XMIT_SIZE |
472 | - port->xmit_tail)); | ||
696 | if (residue == YES) { | 473 | if (residue == YES) { |
697 | residue = NO; | 474 | residue = NO; |
698 | if (cnt > 0) { | 475 | if (cnt > 0) { |
699 | wrd |= (port->xmit_buf[port->xmit_tail] << 8); | 476 | wrd |= (port->xmit_buf[port->xmit_tail] |
700 | port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); | 477 | << 8); |
478 | port->xmit_tail = (port->xmit_tail + 1) | ||
479 | & (SERIAL_XMIT_SIZE - 1); | ||
701 | port->xmit_cnt--; | 480 | port->xmit_cnt--; |
702 | txcount--; | 481 | txcount--; |
703 | cnt--; | 482 | cnt--; |
704 | outw(wrd, base); | 483 | outw(wrd, base); |
705 | } | 484 | } else { |
706 | else { | ||
707 | outw(wrd, base); | 485 | outw(wrd, base); |
708 | break; | 486 | break; |
709 | } | 487 | } |
710 | } | 488 | } |
711 | if (cnt <= 0) break; | 489 | if (cnt <= 0) break; |
712 | word_count = cnt >> 1; | 490 | word_count = cnt >> 1; |
713 | outsw(base, port->xmit_buf+port->xmit_tail, word_count); | 491 | outsw(base, port->xmit_buf+port->xmit_tail,word_count); |
714 | port->xmit_tail = (port->xmit_tail + (word_count << 1)) & | 492 | port->xmit_tail = (port->xmit_tail |
715 | (SERIAL_XMIT_SIZE - 1); | 493 | + (word_count << 1)) & (SERIAL_XMIT_SIZE - 1); |
716 | txcount -= (word_count << 1); | 494 | txcount -= (word_count << 1); |
717 | port->xmit_cnt -= (word_count << 1); | 495 | port->xmit_cnt -= (word_count << 1); |
718 | if (cnt & 0x0001) { | 496 | if (cnt & 0x0001) { |
719 | residue = YES; | 497 | residue = YES; |
720 | wrd = port->xmit_buf[port->xmit_tail]; | 498 | wrd = port->xmit_buf[port->xmit_tail]; |
721 | port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); | 499 | port->xmit_tail = (port->xmit_tail + 1) |
500 | & (SERIAL_XMIT_SIZE - 1); | ||
722 | port->xmit_cnt--; | 501 | port->xmit_cnt--; |
723 | txcount--; | 502 | txcount--; |
724 | } | 503 | } |
@@ -730,81 +509,82 @@ static void isicom_tx(unsigned long _data) | |||
730 | if (port->xmit_cnt <= WAKEUP_CHARS) | 509 | if (port->xmit_cnt <= WAKEUP_CHARS) |
731 | schedule_work(&port->bh_tqueue); | 510 | schedule_work(&port->bh_tqueue); |
732 | unlock_card(&isi_card[card]); | 511 | unlock_card(&isi_card[card]); |
733 | } | 512 | } |
513 | |||
514 | /* schedule another tx for hopefully in about 10ms */ | ||
515 | sched_again: | ||
516 | if (!re_schedule) { | ||
517 | re_schedule = 2; | ||
518 | return; | ||
519 | } | ||
734 | 520 | ||
735 | /* schedule another tx for hopefully in about 10ms */ | ||
736 | sched_again: | ||
737 | if (!re_schedule) | ||
738 | return; | ||
739 | init_timer(&tx); | 521 | init_timer(&tx); |
740 | tx.expires = jiffies + HZ/100; | 522 | tx.expires = jiffies + HZ/100; |
741 | tx.data = 0; | 523 | tx.data = 0; |
742 | tx.function = isicom_tx; | 524 | tx.function = isicom_tx; |
743 | add_timer(&tx); | 525 | add_timer(&tx); |
744 | 526 | ||
745 | return; | 527 | return; |
746 | } | 528 | } |
747 | 529 | ||
748 | /* Interrupt handlers */ | 530 | /* Interrupt handlers */ |
749 | 531 | ||
750 | 532 | ||
751 | static void isicom_bottomhalf(void * data) | 533 | static void isicom_bottomhalf(void *data) |
752 | { | 534 | { |
753 | struct isi_port * port = (struct isi_port *) data; | 535 | struct isi_port *port = (struct isi_port *) data; |
754 | struct tty_struct * tty = port->tty; | 536 | struct tty_struct *tty = port->tty; |
755 | 537 | ||
756 | if (!tty) | 538 | if (!tty) |
757 | return; | 539 | return; |
758 | 540 | ||
759 | tty_wakeup(tty); | 541 | tty_wakeup(tty); |
760 | wake_up_interruptible(&tty->write_wait); | 542 | wake_up_interruptible(&tty->write_wait); |
761 | } | 543 | } |
762 | 544 | ||
763 | /* | 545 | /* |
764 | * Main interrupt handler routine | 546 | * Main interrupt handler routine |
765 | */ | 547 | */ |
766 | 548 | ||
767 | static irqreturn_t isicom_interrupt(int irq, void *dev_id, | 549 | static irqreturn_t isicom_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
768 | struct pt_regs *regs) | ||
769 | { | 550 | { |
770 | struct isi_board * card; | 551 | struct isi_board *card = dev_id; |
771 | struct isi_port * port; | 552 | struct isi_port *port; |
772 | struct tty_struct * tty; | 553 | struct tty_struct *tty; |
773 | unsigned short base, header, word_count, count; | 554 | unsigned long base; |
774 | unsigned char channel; | 555 | u16 header, word_count, count, channel; |
775 | short byte_count; | 556 | short byte_count; |
776 | 557 | unsigned char *rp; | |
777 | card = (struct isi_board *) dev_id; | ||
778 | 558 | ||
779 | if (!card || !(card->status & FIRMWARE_LOADED)) | 559 | if (!card || !(card->status & FIRMWARE_LOADED)) |
780 | return IRQ_NONE; | 560 | return IRQ_NONE; |
781 | 561 | ||
782 | base = card->base; | 562 | base = card->base; |
783 | spin_lock(&card->card_lock); | 563 | spin_lock(&card->card_lock); |
784 | 564 | ||
785 | if (card->isa == NO) { | 565 | if (card->isa == NO) { |
786 | /* | 566 | /* |
787 | * disable any interrupts from the PCI card and lower the | 567 | * disable any interrupts from the PCI card and lower the |
788 | * interrupt line | 568 | * interrupt line |
789 | */ | 569 | */ |
790 | outw(0x8000, base+0x04); | 570 | outw(0x8000, base+0x04); |
791 | ClearInterrupt(base); | 571 | ClearInterrupt(base); |
792 | } | 572 | } |
793 | 573 | ||
794 | inw(base); /* get the dummy word out */ | 574 | inw(base); /* get the dummy word out */ |
795 | header = inw(base); | 575 | header = inw(base); |
796 | channel = (header & 0x7800) >> card->shift_count; | 576 | channel = (header & 0x7800) >> card->shift_count; |
797 | byte_count = header & 0xff; | 577 | byte_count = header & 0xff; |
798 | 578 | ||
799 | if (channel + 1 > card->port_count) { | 579 | if (channel + 1 > card->port_count) { |
800 | printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%x): %d(channel) > port_count.\n", | 580 | printk(KERN_WARNING "ISICOM: isicom_interrupt(0x%lx): " |
801 | base, channel+1); | 581 | "%d(channel) > port_count.\n", base, channel+1); |
802 | if (card->isa) | 582 | if (card->isa) |
803 | ClearInterrupt(base); | 583 | ClearInterrupt(base); |
804 | else | 584 | else |
805 | outw(0x0000, base+0x04); /* enable interrupts */ | 585 | outw(0x0000, base+0x04); /* enable interrupts */ |
806 | spin_unlock(&card->card_lock); | 586 | spin_unlock(&card->card_lock); |
807 | return IRQ_HANDLED; | 587 | return IRQ_HANDLED; |
808 | } | 588 | } |
809 | port = card->ports + channel; | 589 | port = card->ports + channel; |
810 | if (!(port->flags & ASYNC_INITIALIZED)) { | 590 | if (!(port->flags & ASYNC_INITIALIZED)) { |
@@ -813,8 +593,8 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, | |||
813 | else | 593 | else |
814 | outw(0x0000, base+0x04); /* enable interrupts */ | 594 | outw(0x0000, base+0x04); /* enable interrupts */ |
815 | return IRQ_HANDLED; | 595 | return IRQ_HANDLED; |
816 | } | 596 | } |
817 | 597 | ||
818 | tty = port->tty; | 598 | tty = port->tty; |
819 | if (tty == NULL) { | 599 | if (tty == NULL) { |
820 | word_count = byte_count >> 1; | 600 | word_count = byte_count >> 1; |
@@ -831,224 +611,204 @@ static irqreturn_t isicom_interrupt(int irq, void *dev_id, | |||
831 | spin_unlock(&card->card_lock); | 611 | spin_unlock(&card->card_lock); |
832 | return IRQ_HANDLED; | 612 | return IRQ_HANDLED; |
833 | } | 613 | } |
834 | 614 | ||
835 | if (header & 0x8000) { /* Status Packet */ | 615 | if (header & 0x8000) { /* Status Packet */ |
836 | header = inw(base); | 616 | header = inw(base); |
837 | switch(header & 0xff) { | 617 | switch(header & 0xff) { |
838 | case 0: /* Change in EIA signals */ | 618 | case 0: /* Change in EIA signals */ |
839 | 619 | if (port->flags & ASYNC_CHECK_CD) { | |
840 | if (port->flags & ASYNC_CHECK_CD) { | 620 | if (port->status & ISI_DCD) { |
841 | if (port->status & ISI_DCD) { | 621 | if (!(header & ISI_DCD)) { |
842 | if (!(header & ISI_DCD)) { | 622 | /* Carrier has been lost */ |
843 | /* Carrier has been lost */ | 623 | pr_dbg("interrupt: DCD->low.\n" |
844 | #ifdef ISICOM_DEBUG | 624 | ); |
845 | printk(KERN_DEBUG "ISICOM: interrupt: DCD->low.\n"); | ||
846 | #endif | ||
847 | port->status &= ~ISI_DCD; | ||
848 | schedule_work(&port->hangup_tq); | ||
849 | } | ||
850 | } | ||
851 | else { | ||
852 | if (header & ISI_DCD) { | ||
853 | /* Carrier has been detected */ | ||
854 | #ifdef ISICOM_DEBUG | ||
855 | printk(KERN_DEBUG "ISICOM: interrupt: DCD->high.\n"); | ||
856 | #endif | ||
857 | port->status |= ISI_DCD; | ||
858 | wake_up_interruptible(&port->open_wait); | ||
859 | } | ||
860 | } | ||
861 | } | ||
862 | else { | ||
863 | if (header & ISI_DCD) | ||
864 | port->status |= ISI_DCD; | ||
865 | else | ||
866 | port->status &= ~ISI_DCD; | 625 | port->status &= ~ISI_DCD; |
867 | } | 626 | schedule_work(&port->hangup_tq); |
868 | |||
869 | if (port->flags & ASYNC_CTS_FLOW) { | ||
870 | if (port->tty->hw_stopped) { | ||
871 | if (header & ISI_CTS) { | ||
872 | port->tty->hw_stopped = 0; | ||
873 | /* start tx ing */ | ||
874 | port->status |= (ISI_TXOK | ISI_CTS); | ||
875 | schedule_work(&port->bh_tqueue); | ||
876 | } | ||
877 | } | ||
878 | else { | ||
879 | if (!(header & ISI_CTS)) { | ||
880 | port->tty->hw_stopped = 1; | ||
881 | /* stop tx ing */ | ||
882 | port->status &= ~(ISI_TXOK | ISI_CTS); | ||
883 | } | ||
884 | } | 627 | } |
628 | } else if (header & ISI_DCD) { | ||
629 | /* Carrier has been detected */ | ||
630 | pr_dbg("interrupt: DCD->high.\n"); | ||
631 | port->status |= ISI_DCD; | ||
632 | wake_up_interruptible(&port->open_wait); | ||
885 | } | 633 | } |
886 | else { | 634 | } else { |
887 | if (header & ISI_CTS) | 635 | if (header & ISI_DCD) |
888 | port->status |= ISI_CTS; | 636 | port->status |= ISI_DCD; |
889 | else | ||
890 | port->status &= ~ISI_CTS; | ||
891 | } | ||
892 | |||
893 | if (header & ISI_DSR) | ||
894 | port->status |= ISI_DSR; | ||
895 | else | 637 | else |
896 | port->status &= ~ISI_DSR; | 638 | port->status &= ~ISI_DCD; |
897 | 639 | } | |
898 | if (header & ISI_RI) | 640 | |
899 | port->status |= ISI_RI; | 641 | if (port->flags & ASYNC_CTS_FLOW) { |
642 | if (port->tty->hw_stopped) { | ||
643 | if (header & ISI_CTS) { | ||
644 | port->tty->hw_stopped = 0; | ||
645 | /* start tx ing */ | ||
646 | port->status |= (ISI_TXOK | ||
647 | | ISI_CTS); | ||
648 | schedule_work(&port->bh_tqueue); | ||
649 | } | ||
650 | } else if (!(header & ISI_CTS)) { | ||
651 | port->tty->hw_stopped = 1; | ||
652 | /* stop tx ing */ | ||
653 | port->status &= ~(ISI_TXOK | ISI_CTS); | ||
654 | } | ||
655 | } else { | ||
656 | if (header & ISI_CTS) | ||
657 | port->status |= ISI_CTS; | ||
900 | else | 658 | else |
901 | port->status &= ~ISI_RI; | 659 | port->status &= ~ISI_CTS; |
902 | 660 | } | |
903 | break; | 661 | |
904 | 662 | if (header & ISI_DSR) | |
905 | case 1: /* Received Break !!! */ | 663 | port->status |= ISI_DSR; |
906 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | 664 | else |
907 | break; | 665 | port->status &= ~ISI_DSR; |
908 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 666 | |
909 | *tty->flip.char_buf_ptr++ = 0; | 667 | if (header & ISI_RI) |
910 | tty->flip.count++; | 668 | port->status |= ISI_RI; |
911 | if (port->flags & ASYNC_SAK) | 669 | else |
912 | do_SAK(tty); | 670 | port->status &= ~ISI_RI; |
913 | schedule_delayed_work(&tty->flip.work, 1); | 671 | |
914 | break; | 672 | break; |
915 | 673 | ||
916 | case 2: /* Statistics */ | 674 | case 1: /* Received Break !!! */ |
917 | printk(KERN_DEBUG "ISICOM: isicom_interrupt: stats!!!.\n"); | 675 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
918 | break; | 676 | if (port->flags & ASYNC_SAK) |
919 | 677 | do_SAK(tty); | |
920 | default: | 678 | tty_flip_buffer_push(tty); |
921 | printk(KERN_WARNING "ISICOM: Intr: Unknown code in status packet.\n"); | 679 | break; |
922 | break; | 680 | |
923 | } | 681 | case 2: /* Statistics */ |
924 | } | 682 | pr_dbg("isicom_interrupt: stats!!!.\n"); |
925 | else { /* Data Packet */ | 683 | break; |
926 | count = min_t(unsigned short, byte_count, (TTY_FLIPBUF_SIZE - tty->flip.count)); | 684 | |
927 | #ifdef ISICOM_DEBUG | 685 | default: |
928 | printk(KERN_DEBUG "ISICOM: Intr: Can rx %d of %d bytes.\n", | 686 | pr_dbg("Intr: Unknown code in status packet.\n"); |
929 | count, byte_count); | 687 | break; |
930 | #endif | 688 | } |
689 | } else { /* Data Packet */ | ||
690 | |||
691 | count = tty_prepare_flip_string(tty, &rp, byte_count & ~1); | ||
692 | pr_dbg("Intr: Can rx %d of %d bytes.\n", count, byte_count); | ||
931 | word_count = count >> 1; | 693 | word_count = count >> 1; |
932 | insw(base, tty->flip.char_buf_ptr, word_count); | 694 | insw(base, rp, word_count); |
933 | tty->flip.char_buf_ptr += (word_count << 1); | ||
934 | byte_count -= (word_count << 1); | 695 | byte_count -= (word_count << 1); |
935 | if (count & 0x0001) { | 696 | if (count & 0x0001) { |
936 | *tty->flip.char_buf_ptr++ = (char)(inw(base) & 0xff); | 697 | tty_insert_flip_char(tty, inw(base) & 0xff, |
698 | TTY_NORMAL); | ||
937 | byte_count -= 2; | 699 | byte_count -= 2; |
938 | } | 700 | } |
939 | memset(tty->flip.flag_buf_ptr, 0, count); | ||
940 | tty->flip.flag_buf_ptr += count; | ||
941 | tty->flip.count += count; | ||
942 | |||
943 | if (byte_count > 0) { | 701 | if (byte_count > 0) { |
944 | printk(KERN_DEBUG "ISICOM: Intr(0x%x:%d): Flip buffer overflow! dropping bytes...\n", | 702 | pr_dbg("Intr(0x%lx:%d): Flip buffer overflow! dropping " |
945 | base, channel+1); | 703 | "bytes...\n", base, channel + 1); |
946 | while(byte_count > 0) { /* drain out unread xtra data */ | 704 | while(byte_count > 0) { /* drain out unread xtra data */ |
947 | inw(base); | 705 | inw(base); |
948 | byte_count -= 2; | 706 | byte_count -= 2; |
949 | } | 707 | } |
950 | } | 708 | } |
951 | schedule_delayed_work(&tty->flip.work, 1); | 709 | tty_flip_buffer_push(tty); |
952 | } | 710 | } |
953 | if (card->isa == YES) | 711 | if (card->isa == YES) |
954 | ClearInterrupt(base); | 712 | ClearInterrupt(base); |
955 | else | 713 | else |
956 | outw(0x0000, base+0x04); /* enable interrupts */ | 714 | outw(0x0000, base+0x04); /* enable interrupts */ |
715 | |||
957 | return IRQ_HANDLED; | 716 | return IRQ_HANDLED; |
958 | } | 717 | } |
959 | 718 | ||
960 | static void isicom_config_port(struct isi_port * port) | 719 | static void isicom_config_port(struct isi_port *port) |
961 | { | 720 | { |
962 | struct isi_board * card = port->card; | 721 | struct isi_board *card = port->card; |
963 | struct tty_struct * tty; | 722 | struct tty_struct *tty; |
964 | unsigned long baud; | 723 | unsigned long baud; |
965 | unsigned short channel_setup, base = card->base; | 724 | unsigned long base = card->base; |
966 | unsigned short channel = port->channel, shift_count = card->shift_count; | 725 | u16 channel_setup, channel = port->channel, |
726 | shift_count = card->shift_count; | ||
967 | unsigned char flow_ctrl; | 727 | unsigned char flow_ctrl; |
968 | 728 | ||
969 | if (!(tty = port->tty) || !tty->termios) | 729 | if (!(tty = port->tty) || !tty->termios) |
970 | return; | 730 | return; |
971 | baud = C_BAUD(tty); | 731 | baud = C_BAUD(tty); |
972 | if (baud & CBAUDEX) { | 732 | if (baud & CBAUDEX) { |
973 | baud &= ~CBAUDEX; | 733 | baud &= ~CBAUDEX; |
974 | 734 | ||
975 | /* if CBAUDEX bit is on and the baud is set to either 50 or 75 | 735 | /* if CBAUDEX bit is on and the baud is set to either 50 or 75 |
976 | * then the card is programmed for 57.6Kbps or 115Kbps | 736 | * then the card is programmed for 57.6Kbps or 115Kbps |
977 | * respectively. | 737 | * respectively. |
978 | */ | 738 | */ |
979 | 739 | ||
980 | if (baud < 1 || baud > 2) | 740 | if (baud < 1 || baud > 2) |
981 | port->tty->termios->c_cflag &= ~CBAUDEX; | 741 | port->tty->termios->c_cflag &= ~CBAUDEX; |
982 | else | 742 | else |
983 | baud += 15; | 743 | baud += 15; |
984 | } | 744 | } |
985 | if (baud == 15) { | 745 | if (baud == 15) { |
986 | 746 | ||
987 | /* the ASYNC_SPD_HI and ASYNC_SPD_VHI options are set | 747 | /* the ASYNC_SPD_HI and ASYNC_SPD_VHI options are set |
988 | * by the set_serial_info ioctl ... this is done by | 748 | * by the set_serial_info ioctl ... this is done by |
989 | * the 'setserial' utility. | 749 | * the 'setserial' utility. |
990 | */ | 750 | */ |
991 | 751 | ||
992 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 752 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
993 | baud++; /* 57.6 Kbps */ | 753 | baud++; /* 57.6 Kbps */ |
994 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) | 754 | if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) |
995 | baud +=2; /* 115 Kbps */ | 755 | baud +=2; /* 115 Kbps */ |
996 | } | 756 | } |
997 | if (linuxb_to_isib[baud] == -1) { | 757 | if (linuxb_to_isib[baud] == -1) { |
998 | /* hang up */ | 758 | /* hang up */ |
999 | drop_dtr(port); | 759 | drop_dtr(port); |
1000 | return; | 760 | return; |
1001 | } | 761 | } |
1002 | else | 762 | else |
1003 | raise_dtr(port); | 763 | raise_dtr(port); |
1004 | 764 | ||
1005 | if (lock_card(card)) { | 765 | if (lock_card(card)) { |
1006 | outw(0x8000 | (channel << shift_count) |0x03, base); | 766 | outw(0x8000 | (channel << shift_count) |0x03, base); |
1007 | outw(linuxb_to_isib[baud] << 8 | 0x03, base); | 767 | outw(linuxb_to_isib[baud] << 8 | 0x03, base); |
1008 | channel_setup = 0; | 768 | channel_setup = 0; |
1009 | switch(C_CSIZE(tty)) { | 769 | switch(C_CSIZE(tty)) { |
1010 | case CS5: | 770 | case CS5: |
1011 | channel_setup |= ISICOM_CS5; | 771 | channel_setup |= ISICOM_CS5; |
1012 | break; | 772 | break; |
1013 | case CS6: | 773 | case CS6: |
1014 | channel_setup |= ISICOM_CS6; | 774 | channel_setup |= ISICOM_CS6; |
1015 | break; | 775 | break; |
1016 | case CS7: | 776 | case CS7: |
1017 | channel_setup |= ISICOM_CS7; | 777 | channel_setup |= ISICOM_CS7; |
1018 | break; | 778 | break; |
1019 | case CS8: | 779 | case CS8: |
1020 | channel_setup |= ISICOM_CS8; | 780 | channel_setup |= ISICOM_CS8; |
1021 | break; | 781 | break; |
1022 | } | 782 | } |
1023 | 783 | ||
1024 | if (C_CSTOPB(tty)) | 784 | if (C_CSTOPB(tty)) |
1025 | channel_setup |= ISICOM_2SB; | 785 | channel_setup |= ISICOM_2SB; |
1026 | if (C_PARENB(tty)) { | 786 | if (C_PARENB(tty)) { |
1027 | channel_setup |= ISICOM_EVPAR; | 787 | channel_setup |= ISICOM_EVPAR; |
1028 | if (C_PARODD(tty)) | 788 | if (C_PARODD(tty)) |
1029 | channel_setup |= ISICOM_ODPAR; | 789 | channel_setup |= ISICOM_ODPAR; |
1030 | } | 790 | } |
1031 | outw(channel_setup, base); | 791 | outw(channel_setup, base); |
1032 | InterruptTheCard(base); | 792 | InterruptTheCard(base); |
1033 | unlock_card(card); | 793 | unlock_card(card); |
1034 | } | 794 | } |
1035 | if (C_CLOCAL(tty)) | 795 | if (C_CLOCAL(tty)) |
1036 | port->flags &= ~ASYNC_CHECK_CD; | 796 | port->flags &= ~ASYNC_CHECK_CD; |
1037 | else | 797 | else |
1038 | port->flags |= ASYNC_CHECK_CD; | 798 | port->flags |= ASYNC_CHECK_CD; |
1039 | 799 | ||
1040 | /* flow control settings ...*/ | 800 | /* flow control settings ...*/ |
1041 | flow_ctrl = 0; | 801 | flow_ctrl = 0; |
1042 | port->flags &= ~ASYNC_CTS_FLOW; | 802 | port->flags &= ~ASYNC_CTS_FLOW; |
1043 | if (C_CRTSCTS(tty)) { | 803 | if (C_CRTSCTS(tty)) { |
1044 | port->flags |= ASYNC_CTS_FLOW; | 804 | port->flags |= ASYNC_CTS_FLOW; |
1045 | flow_ctrl |= ISICOM_CTSRTS; | 805 | flow_ctrl |= ISICOM_CTSRTS; |
1046 | } | 806 | } |
1047 | if (I_IXON(tty)) | 807 | if (I_IXON(tty)) |
1048 | flow_ctrl |= ISICOM_RESPOND_XONXOFF; | 808 | flow_ctrl |= ISICOM_RESPOND_XONXOFF; |
1049 | if (I_IXOFF(tty)) | 809 | if (I_IXOFF(tty)) |
1050 | flow_ctrl |= ISICOM_INITIATE_XONXOFF; | 810 | flow_ctrl |= ISICOM_INITIATE_XONXOFF; |
1051 | 811 | ||
1052 | if (lock_card(card)) { | 812 | if (lock_card(card)) { |
1053 | outw(0x8000 | (channel << shift_count) |0x04, base); | 813 | outw(0x8000 | (channel << shift_count) |0x04, base); |
1054 | outw(flow_ctrl << 8 | 0x05, base); | 814 | outw(flow_ctrl << 8 | 0x05, base); |
@@ -1056,22 +816,22 @@ static void isicom_config_port(struct isi_port * port) | |||
1056 | InterruptTheCard(base); | 816 | InterruptTheCard(base); |
1057 | unlock_card(card); | 817 | unlock_card(card); |
1058 | } | 818 | } |
1059 | 819 | ||
1060 | /* rx enabled -> enable port for rx on the card */ | 820 | /* rx enabled -> enable port for rx on the card */ |
1061 | if (C_CREAD(tty)) { | 821 | if (C_CREAD(tty)) { |
1062 | card->port_status |= (1 << channel); | 822 | card->port_status |= (1 << channel); |
1063 | outw(card->port_status, base + 0x02); | 823 | outw(card->port_status, base + 0x02); |
1064 | } | 824 | } |
1065 | } | 825 | } |
1066 | |||
1067 | /* open et all */ | ||
1068 | 826 | ||
1069 | static inline void isicom_setup_board(struct isi_board * bp) | 827 | /* open et all */ |
828 | |||
829 | static inline void isicom_setup_board(struct isi_board *bp) | ||
1070 | { | 830 | { |
1071 | int channel; | 831 | int channel; |
1072 | struct isi_port * port; | 832 | struct isi_port *port; |
1073 | unsigned long flags; | 833 | unsigned long flags; |
1074 | 834 | ||
1075 | spin_lock_irqsave(&bp->card_lock, flags); | 835 | spin_lock_irqsave(&bp->card_lock, flags); |
1076 | if (bp->status & BOARD_ACTIVE) { | 836 | if (bp->status & BOARD_ACTIVE) { |
1077 | spin_unlock_irqrestore(&bp->card_lock, flags); | 837 | spin_unlock_irqrestore(&bp->card_lock, flags); |
@@ -1080,53 +840,54 @@ static inline void isicom_setup_board(struct isi_board * bp) | |||
1080 | port = bp->ports; | 840 | port = bp->ports; |
1081 | bp->status |= BOARD_ACTIVE; | 841 | bp->status |= BOARD_ACTIVE; |
1082 | spin_unlock_irqrestore(&bp->card_lock, flags); | 842 | spin_unlock_irqrestore(&bp->card_lock, flags); |
1083 | for(channel = 0; channel < bp->port_count; channel++, port++) | 843 | for (channel = 0; channel < bp->port_count; channel++, port++) |
1084 | drop_dtr_rts(port); | 844 | drop_dtr_rts(port); |
1085 | return; | 845 | return; |
1086 | } | 846 | } |
1087 | 847 | ||
1088 | static int isicom_setup_port(struct isi_port * port) | 848 | static int isicom_setup_port(struct isi_port *port) |
1089 | { | 849 | { |
1090 | struct isi_board * card = port->card; | 850 | struct isi_board *card = port->card; |
1091 | unsigned long flags; | 851 | unsigned long flags; |
1092 | 852 | ||
1093 | if (port->flags & ASYNC_INITIALIZED) { | 853 | if (port->flags & ASYNC_INITIALIZED) { |
1094 | return 0; | 854 | return 0; |
1095 | } | 855 | } |
1096 | if (!port->xmit_buf) { | 856 | if (!port->xmit_buf) { |
1097 | unsigned long page; | 857 | unsigned long page; |
1098 | 858 | ||
1099 | if (!(page = get_zeroed_page(GFP_KERNEL))) | 859 | if (!(page = get_zeroed_page(GFP_KERNEL))) |
1100 | return -ENOMEM; | 860 | return -ENOMEM; |
1101 | 861 | ||
1102 | if (port->xmit_buf) { | 862 | if (port->xmit_buf) { |
1103 | free_page(page); | 863 | free_page(page); |
1104 | return -ERESTARTSYS; | 864 | return -ERESTARTSYS; |
1105 | } | 865 | } |
1106 | port->xmit_buf = (unsigned char *) page; | 866 | port->xmit_buf = (unsigned char *) page; |
1107 | } | 867 | } |
1108 | 868 | ||
1109 | spin_lock_irqsave(&card->card_lock, flags); | 869 | spin_lock_irqsave(&card->card_lock, flags); |
1110 | if (port->tty) | 870 | if (port->tty) |
1111 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 871 | clear_bit(TTY_IO_ERROR, &port->tty->flags); |
1112 | if (port->count == 1) | 872 | if (port->count == 1) |
1113 | card->count++; | 873 | card->count++; |
1114 | 874 | ||
1115 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 875 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
1116 | 876 | ||
1117 | /* discard any residual data */ | 877 | /* discard any residual data */ |
1118 | kill_queue(port, ISICOM_KILLTX | ISICOM_KILLRX); | 878 | kill_queue(port, ISICOM_KILLTX | ISICOM_KILLRX); |
1119 | 879 | ||
1120 | isicom_config_port(port); | 880 | isicom_config_port(port); |
1121 | port->flags |= ASYNC_INITIALIZED; | 881 | port->flags |= ASYNC_INITIALIZED; |
1122 | spin_unlock_irqrestore(&card->card_lock, flags); | 882 | spin_unlock_irqrestore(&card->card_lock, flags); |
1123 | 883 | ||
1124 | return 0; | 884 | return 0; |
1125 | } | 885 | } |
1126 | 886 | ||
1127 | static int block_til_ready(struct tty_struct * tty, struct file * filp, struct isi_port * port) | 887 | static int block_til_ready(struct tty_struct *tty, struct file *filp, |
888 | struct isi_port *port) | ||
1128 | { | 889 | { |
1129 | struct isi_board * card = port->card; | 890 | struct isi_board *card = port->card; |
1130 | int do_clocal = 0, retval; | 891 | int do_clocal = 0, retval; |
1131 | unsigned long flags; | 892 | unsigned long flags; |
1132 | DECLARE_WAITQUEUE(wait, current); | 893 | DECLARE_WAITQUEUE(wait, current); |
@@ -1134,30 +895,27 @@ static int block_til_ready(struct tty_struct * tty, struct file * filp, struct i | |||
1134 | /* block if port is in the process of being closed */ | 895 | /* block if port is in the process of being closed */ |
1135 | 896 | ||
1136 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { | 897 | if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) { |
1137 | #ifdef ISICOM_DEBUG | 898 | pr_dbg("block_til_ready: close in progress.\n"); |
1138 | printk(KERN_DEBUG "ISICOM: block_til_ready: close in progress.\n"); | ||
1139 | #endif | ||
1140 | interruptible_sleep_on(&port->close_wait); | 899 | interruptible_sleep_on(&port->close_wait); |
1141 | if (port->flags & ASYNC_HUP_NOTIFY) | 900 | if (port->flags & ASYNC_HUP_NOTIFY) |
1142 | return -EAGAIN; | 901 | return -EAGAIN; |
1143 | else | 902 | else |
1144 | return -ERESTARTSYS; | 903 | return -ERESTARTSYS; |
1145 | } | 904 | } |
1146 | 905 | ||
1147 | /* if non-blocking mode is set ... */ | 906 | /* if non-blocking mode is set ... */ |
1148 | 907 | ||
1149 | if ((filp->f_flags & O_NONBLOCK) || (tty->flags & (1 << TTY_IO_ERROR))) { | 908 | if ((filp->f_flags & O_NONBLOCK) || |
1150 | #ifdef ISICOM_DEBUG | 909 | (tty->flags & (1 << TTY_IO_ERROR))) { |
1151 | printk(KERN_DEBUG "ISICOM: block_til_ready: non-block mode.\n"); | 910 | pr_dbg("block_til_ready: non-block mode.\n"); |
1152 | #endif | ||
1153 | port->flags |= ASYNC_NORMAL_ACTIVE; | 911 | port->flags |= ASYNC_NORMAL_ACTIVE; |
1154 | return 0; | 912 | return 0; |
1155 | } | 913 | } |
1156 | 914 | ||
1157 | if (C_CLOCAL(tty)) | 915 | if (C_CLOCAL(tty)) |
1158 | do_clocal = 1; | 916 | do_clocal = 1; |
1159 | 917 | ||
1160 | /* block waiting for DCD to be asserted, and while | 918 | /* block waiting for DCD to be asserted, and while |
1161 | callout dev is busy */ | 919 | callout dev is busy */ |
1162 | retval = 0; | 920 | retval = 0; |
1163 | add_wait_queue(&port->open_wait, &wait); | 921 | add_wait_queue(&port->open_wait, &wait); |
@@ -1167,27 +925,27 @@ static int block_til_ready(struct tty_struct * tty, struct file * filp, struct i | |||
1167 | port->count--; | 925 | port->count--; |
1168 | port->blocked_open++; | 926 | port->blocked_open++; |
1169 | spin_unlock_irqrestore(&card->card_lock, flags); | 927 | spin_unlock_irqrestore(&card->card_lock, flags); |
1170 | 928 | ||
1171 | while (1) { | 929 | while (1) { |
1172 | raise_dtr_rts(port); | 930 | raise_dtr_rts(port); |
1173 | 931 | ||
1174 | set_current_state(TASK_INTERRUPTIBLE); | 932 | set_current_state(TASK_INTERRUPTIBLE); |
1175 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { | 933 | if (tty_hung_up_p(filp) || !(port->flags & ASYNC_INITIALIZED)) { |
1176 | if (port->flags & ASYNC_HUP_NOTIFY) | 934 | if (port->flags & ASYNC_HUP_NOTIFY) |
1177 | retval = -EAGAIN; | 935 | retval = -EAGAIN; |
1178 | else | 936 | else |
1179 | retval = -ERESTARTSYS; | 937 | retval = -ERESTARTSYS; |
1180 | break; | 938 | break; |
1181 | } | 939 | } |
1182 | if (!(port->flags & ASYNC_CLOSING) && | 940 | if (!(port->flags & ASYNC_CLOSING) && |
1183 | (do_clocal || (port->status & ISI_DCD))) { | 941 | (do_clocal || (port->status & ISI_DCD))) { |
1184 | break; | 942 | break; |
1185 | } | 943 | } |
1186 | if (signal_pending(current)) { | 944 | if (signal_pending(current)) { |
1187 | retval = -ERESTARTSYS; | 945 | retval = -ERESTARTSYS; |
1188 | break; | 946 | break; |
1189 | } | 947 | } |
1190 | schedule(); | 948 | schedule(); |
1191 | } | 949 | } |
1192 | set_current_state(TASK_RUNNING); | 950 | set_current_state(TASK_RUNNING); |
1193 | remove_wait_queue(&port->open_wait, &wait); | 951 | remove_wait_queue(&port->open_wait, &wait); |
@@ -1201,11 +959,11 @@ static int block_til_ready(struct tty_struct * tty, struct file * filp, struct i | |||
1201 | port->flags |= ASYNC_NORMAL_ACTIVE; | 959 | port->flags |= ASYNC_NORMAL_ACTIVE; |
1202 | return 0; | 960 | return 0; |
1203 | } | 961 | } |
1204 | 962 | ||
1205 | static int isicom_open(struct tty_struct * tty, struct file * filp) | 963 | static int isicom_open(struct tty_struct *tty, struct file *filp) |
1206 | { | 964 | { |
1207 | struct isi_port * port; | 965 | struct isi_port *port; |
1208 | struct isi_board * card; | 966 | struct isi_board *card; |
1209 | unsigned int line, board; | 967 | unsigned int line, board; |
1210 | int error; | 968 | int error; |
1211 | 969 | ||
@@ -1214,20 +972,20 @@ static int isicom_open(struct tty_struct * tty, struct file * filp) | |||
1214 | return -ENODEV; | 972 | return -ENODEV; |
1215 | board = BOARD(line); | 973 | board = BOARD(line); |
1216 | card = &isi_card[board]; | 974 | card = &isi_card[board]; |
1217 | 975 | ||
1218 | if (!(card->status & FIRMWARE_LOADED)) | 976 | if (!(card->status & FIRMWARE_LOADED)) |
1219 | return -ENODEV; | 977 | return -ENODEV; |
1220 | 978 | ||
1221 | /* open on a port greater than the port count for the card !!! */ | 979 | /* open on a port greater than the port count for the card !!! */ |
1222 | if (line > ((board * 16) + card->port_count - 1)) | 980 | if (line > ((board * 16) + card->port_count - 1)) |
1223 | return -ENODEV; | 981 | return -ENODEV; |
1224 | 982 | ||
1225 | port = &isi_ports[line]; | 983 | port = &isi_ports[line]; |
1226 | if (isicom_paranoia_check(port, tty->name, "isicom_open")) | 984 | if (isicom_paranoia_check(port, tty->name, "isicom_open")) |
1227 | return -ENODEV; | 985 | return -ENODEV; |
1228 | 986 | ||
1229 | isicom_setup_board(card); | 987 | isicom_setup_board(card); |
1230 | 988 | ||
1231 | port->count++; | 989 | port->count++; |
1232 | tty->driver_data = port; | 990 | tty->driver_data = port; |
1233 | port->tty = tty; | 991 | port->tty = tty; |
@@ -1236,12 +994,12 @@ static int isicom_open(struct tty_struct * tty, struct file * filp) | |||
1236 | if ((error = block_til_ready(tty, filp, port))!=0) | 994 | if ((error = block_til_ready(tty, filp, port))!=0) |
1237 | return error; | 995 | return error; |
1238 | 996 | ||
1239 | return 0; | 997 | return 0; |
1240 | } | 998 | } |
1241 | 999 | ||
1242 | /* close et all */ | 1000 | /* close et all */ |
1243 | 1001 | ||
1244 | static inline void isicom_shutdown_board(struct isi_board * bp) | 1002 | static inline void isicom_shutdown_board(struct isi_board *bp) |
1245 | { | 1003 | { |
1246 | unsigned long flags; | 1004 | unsigned long flags; |
1247 | 1005 | ||
@@ -1252,15 +1010,15 @@ static inline void isicom_shutdown_board(struct isi_board * bp) | |||
1252 | spin_unlock_irqrestore(&bp->card_lock, flags); | 1010 | spin_unlock_irqrestore(&bp->card_lock, flags); |
1253 | } | 1011 | } |
1254 | 1012 | ||
1255 | static void isicom_shutdown_port(struct isi_port * port) | 1013 | static void isicom_shutdown_port(struct isi_port *port) |
1256 | { | 1014 | { |
1257 | struct isi_board * card = port->card; | 1015 | struct isi_board *card = port->card; |
1258 | struct tty_struct * tty; | 1016 | struct tty_struct *tty; |
1259 | unsigned long flags; | 1017 | unsigned long flags; |
1260 | 1018 | ||
1261 | tty = port->tty; | 1019 | tty = port->tty; |
1262 | 1020 | ||
1263 | spin_lock_irqsave(&card->card_lock, flags); | 1021 | spin_lock_irqsave(&card->card_lock, flags); |
1264 | if (!(port->flags & ASYNC_INITIALIZED)) { | 1022 | if (!(port->flags & ASYNC_INITIALIZED)) { |
1265 | spin_unlock_irqrestore(&card->card_lock, flags); | 1023 | spin_unlock_irqrestore(&card->card_lock, flags); |
1266 | return; | 1024 | return; |
@@ -1268,93 +1026,91 @@ static void isicom_shutdown_port(struct isi_port * port) | |||
1268 | if (port->xmit_buf) { | 1026 | if (port->xmit_buf) { |
1269 | free_page((unsigned long) port->xmit_buf); | 1027 | free_page((unsigned long) port->xmit_buf); |
1270 | port->xmit_buf = NULL; | 1028 | port->xmit_buf = NULL; |
1271 | } | 1029 | } |
1272 | port->flags &= ~ASYNC_INITIALIZED; | 1030 | port->flags &= ~ASYNC_INITIALIZED; |
1273 | /* 3rd October 2000 : Vinayak P Risbud */ | 1031 | /* 3rd October 2000 : Vinayak P Risbud */ |
1274 | port->tty = NULL; | 1032 | port->tty = NULL; |
1275 | spin_unlock_irqrestore(&card->card_lock, flags); | 1033 | spin_unlock_irqrestore(&card->card_lock, flags); |
1276 | 1034 | ||
1277 | /*Fix done by Anil .S on 30-04-2001 | 1035 | /*Fix done by Anil .S on 30-04-2001 |
1278 | remote login through isi port has dtr toggle problem | 1036 | remote login through isi port has dtr toggle problem |
1279 | due to which the carrier drops before the password prompt | 1037 | due to which the carrier drops before the password prompt |
1280 | appears on the remote end. Now we drop the dtr only if the | 1038 | appears on the remote end. Now we drop the dtr only if the |
1281 | HUPCL(Hangup on close) flag is set for the tty*/ | 1039 | HUPCL(Hangup on close) flag is set for the tty*/ |
1282 | 1040 | ||
1283 | if (C_HUPCL(tty)) | 1041 | if (C_HUPCL(tty)) |
1284 | /* drop dtr on this port */ | 1042 | /* drop dtr on this port */ |
1285 | drop_dtr(port); | 1043 | drop_dtr(port); |
1286 | 1044 | ||
1287 | /* any other port uninits */ | 1045 | /* any other port uninits */ |
1288 | if (tty) | 1046 | if (tty) |
1289 | set_bit(TTY_IO_ERROR, &tty->flags); | 1047 | set_bit(TTY_IO_ERROR, &tty->flags); |
1290 | 1048 | ||
1291 | if (--card->count < 0) { | 1049 | if (--card->count < 0) { |
1292 | printk(KERN_DEBUG "ISICOM: isicom_shutdown_port: bad board(0x%x) count %d.\n", | 1050 | pr_dbg("isicom_shutdown_port: bad board(0x%lx) count %d.\n", |
1293 | card->base, card->count); | 1051 | card->base, card->count); |
1294 | card->count = 0; | 1052 | card->count = 0; |
1295 | } | 1053 | } |
1296 | 1054 | ||
1297 | /* last port was closed , shutdown that boad too */ | 1055 | /* last port was closed, shutdown that boad too */ |
1298 | if(C_HUPCL(tty)) { | 1056 | if (C_HUPCL(tty)) { |
1299 | if (!card->count) | 1057 | if (!card->count) |
1300 | isicom_shutdown_board(card); | 1058 | isicom_shutdown_board(card); |
1301 | } | 1059 | } |
1302 | } | 1060 | } |
1303 | 1061 | ||
1304 | static void isicom_close(struct tty_struct * tty, struct file * filp) | 1062 | static void isicom_close(struct tty_struct *tty, struct file *filp) |
1305 | { | 1063 | { |
1306 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1064 | struct isi_port *port = tty->driver_data; |
1307 | struct isi_board * card = port->card; | 1065 | struct isi_board *card = port->card; |
1308 | unsigned long flags; | 1066 | unsigned long flags; |
1309 | 1067 | ||
1310 | if (!port) | 1068 | if (!port) |
1311 | return; | 1069 | return; |
1312 | if (isicom_paranoia_check(port, tty->name, "isicom_close")) | 1070 | if (isicom_paranoia_check(port, tty->name, "isicom_close")) |
1313 | return; | 1071 | return; |
1314 | 1072 | ||
1315 | #ifdef ISICOM_DEBUG | 1073 | pr_dbg("Close start!!!.\n"); |
1316 | printk(KERN_DEBUG "ISICOM: Close start!!!.\n"); | 1074 | |
1317 | #endif | ||
1318 | |||
1319 | spin_lock_irqsave(&card->card_lock, flags); | 1075 | spin_lock_irqsave(&card->card_lock, flags); |
1320 | if (tty_hung_up_p(filp)) { | 1076 | if (tty_hung_up_p(filp)) { |
1321 | spin_unlock_irqrestore(&card->card_lock, flags); | 1077 | spin_unlock_irqrestore(&card->card_lock, flags); |
1322 | return; | 1078 | return; |
1323 | } | 1079 | } |
1324 | 1080 | ||
1325 | if (tty->count == 1 && port->count != 1) { | 1081 | if (tty->count == 1 && port->count != 1) { |
1326 | printk(KERN_WARNING "ISICOM:(0x%x) isicom_close: bad port count" | 1082 | printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " |
1327 | "tty->count = 1 port count = %d.\n", | 1083 | "count tty->count = 1 port count = %d.\n", |
1328 | card->base, port->count); | 1084 | card->base, port->count); |
1329 | port->count = 1; | 1085 | port->count = 1; |
1330 | } | 1086 | } |
1331 | if (--port->count < 0) { | 1087 | if (--port->count < 0) { |
1332 | printk(KERN_WARNING "ISICOM:(0x%x) isicom_close: bad port count for" | 1088 | printk(KERN_WARNING "ISICOM:(0x%lx) isicom_close: bad port " |
1333 | "channel%d = %d", card->base, port->channel, | 1089 | "count for channel%d = %d", card->base, port->channel, |
1334 | port->count); | 1090 | port->count); |
1335 | port->count = 0; | 1091 | port->count = 0; |
1336 | } | 1092 | } |
1337 | 1093 | ||
1338 | if (port->count) { | 1094 | if (port->count) { |
1339 | spin_unlock_irqrestore(&card->card_lock, flags); | 1095 | spin_unlock_irqrestore(&card->card_lock, flags); |
1340 | return; | 1096 | return; |
1341 | } | 1097 | } |
1342 | port->flags |= ASYNC_CLOSING; | 1098 | port->flags |= ASYNC_CLOSING; |
1343 | tty->closing = 1; | 1099 | tty->closing = 1; |
1344 | spin_unlock_irqrestore(&card->card_lock, flags); | 1100 | spin_unlock_irqrestore(&card->card_lock, flags); |
1345 | 1101 | ||
1346 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 1102 | if (port->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
1347 | tty_wait_until_sent(tty, port->closing_wait); | 1103 | tty_wait_until_sent(tty, port->closing_wait); |
1348 | /* indicate to the card that no more data can be received | 1104 | /* indicate to the card that no more data can be received |
1349 | on this port */ | 1105 | on this port */ |
1350 | spin_lock_irqsave(&card->card_lock, flags); | 1106 | spin_lock_irqsave(&card->card_lock, flags); |
1351 | if (port->flags & ASYNC_INITIALIZED) { | 1107 | if (port->flags & ASYNC_INITIALIZED) { |
1352 | card->port_status &= ~(1 << port->channel); | 1108 | card->port_status &= ~(1 << port->channel); |
1353 | outw(card->port_status, card->base + 0x02); | 1109 | outw(card->port_status, card->base + 0x02); |
1354 | } | 1110 | } |
1355 | isicom_shutdown_port(port); | 1111 | isicom_shutdown_port(port); |
1356 | spin_unlock_irqrestore(&card->card_lock, flags); | 1112 | spin_unlock_irqrestore(&card->card_lock, flags); |
1357 | 1113 | ||
1358 | if (tty->driver->flush_buffer) | 1114 | if (tty->driver->flush_buffer) |
1359 | tty->driver->flush_buffer(tty); | 1115 | tty->driver->flush_buffer(tty); |
1360 | tty_ldisc_flush(tty); | 1116 | tty_ldisc_flush(tty); |
@@ -1365,65 +1121,65 @@ static void isicom_close(struct tty_struct * tty, struct file * filp) | |||
1365 | if (port->blocked_open) { | 1121 | if (port->blocked_open) { |
1366 | spin_unlock_irqrestore(&card->card_lock, flags); | 1122 | spin_unlock_irqrestore(&card->card_lock, flags); |
1367 | if (port->close_delay) { | 1123 | if (port->close_delay) { |
1368 | #ifdef ISICOM_DEBUG | 1124 | pr_dbg("scheduling until time out.\n"); |
1369 | printk(KERN_DEBUG "ISICOM: scheduling until time out.\n"); | 1125 | msleep_interruptible( |
1370 | #endif | 1126 | jiffies_to_msecs(port->close_delay)); |
1371 | msleep_interruptible(jiffies_to_msecs(port->close_delay)); | ||
1372 | } | 1127 | } |
1373 | spin_lock_irqsave(&card->card_lock, flags); | 1128 | spin_lock_irqsave(&card->card_lock, flags); |
1374 | wake_up_interruptible(&port->open_wait); | 1129 | wake_up_interruptible(&port->open_wait); |
1375 | } | 1130 | } |
1376 | port->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); | 1131 | port->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); |
1377 | wake_up_interruptible(&port->close_wait); | 1132 | wake_up_interruptible(&port->close_wait); |
1378 | spin_unlock_irqrestore(&card->card_lock, flags); | 1133 | spin_unlock_irqrestore(&card->card_lock, flags); |
1379 | } | 1134 | } |
1380 | 1135 | ||
1381 | /* write et all */ | 1136 | /* write et all */ |
1382 | static int isicom_write(struct tty_struct * tty, | 1137 | static int isicom_write(struct tty_struct *tty, const unsigned char *buf, |
1383 | const unsigned char * buf, int count) | 1138 | int count) |
1384 | { | 1139 | { |
1385 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1140 | struct isi_port *port = tty->driver_data; |
1386 | struct isi_board * card = port->card; | 1141 | struct isi_board *card = port->card; |
1387 | unsigned long flags; | 1142 | unsigned long flags; |
1388 | int cnt, total = 0; | 1143 | int cnt, total = 0; |
1389 | 1144 | ||
1390 | if (isicom_paranoia_check(port, tty->name, "isicom_write")) | 1145 | if (isicom_paranoia_check(port, tty->name, "isicom_write")) |
1391 | return 0; | 1146 | return 0; |
1392 | 1147 | ||
1393 | if (!tty || !port->xmit_buf || !tmp_buf) | 1148 | if (!tty || !port->xmit_buf) |
1394 | return 0; | 1149 | return 0; |
1395 | 1150 | ||
1396 | spin_lock_irqsave(&card->card_lock, flags); | 1151 | spin_lock_irqsave(&card->card_lock, flags); |
1397 | 1152 | ||
1398 | while(1) { | 1153 | while(1) { |
1399 | cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt - 1, | 1154 | cnt = min_t(int, count, min(SERIAL_XMIT_SIZE - port->xmit_cnt |
1400 | SERIAL_XMIT_SIZE - port->xmit_head)); | 1155 | - 1, SERIAL_XMIT_SIZE - port->xmit_head)); |
1401 | if (cnt <= 0) | 1156 | if (cnt <= 0) |
1402 | break; | 1157 | break; |
1403 | 1158 | ||
1404 | memcpy(port->xmit_buf + port->xmit_head, buf, cnt); | 1159 | memcpy(port->xmit_buf + port->xmit_head, buf, cnt); |
1405 | port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE - 1); | 1160 | port->xmit_head = (port->xmit_head + cnt) & (SERIAL_XMIT_SIZE |
1161 | - 1); | ||
1406 | port->xmit_cnt += cnt; | 1162 | port->xmit_cnt += cnt; |
1407 | buf += cnt; | 1163 | buf += cnt; |
1408 | count -= cnt; | 1164 | count -= cnt; |
1409 | total += cnt; | 1165 | total += cnt; |
1410 | } | 1166 | } |
1411 | if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped) | 1167 | if (port->xmit_cnt && !tty->stopped && !tty->hw_stopped) |
1412 | port->status |= ISI_TXOK; | 1168 | port->status |= ISI_TXOK; |
1413 | spin_unlock_irqrestore(&card->card_lock, flags); | 1169 | spin_unlock_irqrestore(&card->card_lock, flags); |
1414 | return total; | 1170 | return total; |
1415 | } | 1171 | } |
1416 | 1172 | ||
1417 | /* put_char et all */ | 1173 | /* put_char et all */ |
1418 | static void isicom_put_char(struct tty_struct * tty, unsigned char ch) | 1174 | static void isicom_put_char(struct tty_struct *tty, unsigned char ch) |
1419 | { | 1175 | { |
1420 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1176 | struct isi_port *port = tty->driver_data; |
1421 | struct isi_board * card = port->card; | 1177 | struct isi_board *card = port->card; |
1422 | unsigned long flags; | 1178 | unsigned long flags; |
1423 | 1179 | ||
1424 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) | 1180 | if (isicom_paranoia_check(port, tty->name, "isicom_put_char")) |
1425 | return; | 1181 | return; |
1426 | 1182 | ||
1427 | if (!tty || !port->xmit_buf) | 1183 | if (!tty || !port->xmit_buf) |
1428 | return; | 1184 | return; |
1429 | 1185 | ||
@@ -1432,7 +1188,7 @@ static void isicom_put_char(struct tty_struct * tty, unsigned char ch) | |||
1432 | spin_unlock_irqrestore(&card->card_lock, flags); | 1188 | spin_unlock_irqrestore(&card->card_lock, flags); |
1433 | return; | 1189 | return; |
1434 | } | 1190 | } |
1435 | 1191 | ||
1436 | port->xmit_buf[port->xmit_head++] = ch; | 1192 | port->xmit_buf[port->xmit_head++] = ch; |
1437 | port->xmit_head &= (SERIAL_XMIT_SIZE - 1); | 1193 | port->xmit_head &= (SERIAL_XMIT_SIZE - 1); |
1438 | port->xmit_cnt++; | 1194 | port->xmit_cnt++; |
@@ -1440,30 +1196,31 @@ static void isicom_put_char(struct tty_struct * tty, unsigned char ch) | |||
1440 | } | 1196 | } |
1441 | 1197 | ||
1442 | /* flush_chars et all */ | 1198 | /* flush_chars et all */ |
1443 | static void isicom_flush_chars(struct tty_struct * tty) | 1199 | static void isicom_flush_chars(struct tty_struct *tty) |
1444 | { | 1200 | { |
1445 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1201 | struct isi_port *port = tty->driver_data; |
1446 | 1202 | ||
1447 | if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars")) | 1203 | if (isicom_paranoia_check(port, tty->name, "isicom_flush_chars")) |
1448 | return; | 1204 | return; |
1449 | 1205 | ||
1450 | if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || !port->xmit_buf) | 1206 | if (port->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped || |
1207 | !port->xmit_buf) | ||
1451 | return; | 1208 | return; |
1452 | 1209 | ||
1453 | /* this tells the transmitter to consider this port for | 1210 | /* this tells the transmitter to consider this port for |
1454 | data output to the card ... that's the best we can do. */ | 1211 | data output to the card ... that's the best we can do. */ |
1455 | port->status |= ISI_TXOK; | 1212 | port->status |= ISI_TXOK; |
1456 | } | 1213 | } |
1457 | 1214 | ||
1458 | /* write_room et all */ | 1215 | /* write_room et all */ |
1459 | static int isicom_write_room(struct tty_struct * tty) | 1216 | static int isicom_write_room(struct tty_struct *tty) |
1460 | { | 1217 | { |
1461 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1218 | struct isi_port *port = tty->driver_data; |
1462 | int free; | 1219 | int free; |
1463 | 1220 | ||
1464 | if (isicom_paranoia_check(port, tty->name, "isicom_write_room")) | 1221 | if (isicom_paranoia_check(port, tty->name, "isicom_write_room")) |
1465 | return 0; | 1222 | return 0; |
1466 | 1223 | ||
1467 | free = SERIAL_XMIT_SIZE - port->xmit_cnt - 1; | 1224 | free = SERIAL_XMIT_SIZE - port->xmit_cnt - 1; |
1468 | if (free < 0) | 1225 | if (free < 0) |
1469 | free = 0; | 1226 | free = 0; |
@@ -1471,23 +1228,24 @@ static int isicom_write_room(struct tty_struct * tty) | |||
1471 | } | 1228 | } |
1472 | 1229 | ||
1473 | /* chars_in_buffer et all */ | 1230 | /* chars_in_buffer et all */ |
1474 | static int isicom_chars_in_buffer(struct tty_struct * tty) | 1231 | static int isicom_chars_in_buffer(struct tty_struct *tty) |
1475 | { | 1232 | { |
1476 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1233 | struct isi_port *port = tty->driver_data; |
1477 | if (isicom_paranoia_check(port, tty->name, "isicom_chars_in_buffer")) | 1234 | if (isicom_paranoia_check(port, tty->name, "isicom_chars_in_buffer")) |
1478 | return 0; | 1235 | return 0; |
1479 | return port->xmit_cnt; | 1236 | return port->xmit_cnt; |
1480 | } | 1237 | } |
1481 | 1238 | ||
1482 | /* ioctl et all */ | 1239 | /* ioctl et all */ |
1483 | static inline void isicom_send_break(struct isi_port * port, unsigned long length) | 1240 | static inline void isicom_send_break(struct isi_port *port, |
1241 | unsigned long length) | ||
1484 | { | 1242 | { |
1485 | struct isi_board * card = port->card; | 1243 | struct isi_board *card = port->card; |
1486 | unsigned short base = card->base; | 1244 | unsigned long base = card->base; |
1487 | 1245 | ||
1488 | if(!lock_card(card)) | 1246 | if (!lock_card(card)) |
1489 | return; | 1247 | return; |
1490 | 1248 | ||
1491 | outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base); | 1249 | outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base); |
1492 | outw((length & 0xff) << 8 | 0x00, base); | 1250 | outw((length & 0xff) << 8 | 0x00, base); |
1493 | outw((length & 0xff00), base); | 1251 | outw((length & 0xff00), base); |
@@ -1498,13 +1256,13 @@ static inline void isicom_send_break(struct isi_port * port, unsigned long lengt | |||
1498 | 1256 | ||
1499 | static int isicom_tiocmget(struct tty_struct *tty, struct file *file) | 1257 | static int isicom_tiocmget(struct tty_struct *tty, struct file *file) |
1500 | { | 1258 | { |
1501 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1259 | struct isi_port *port = tty->driver_data; |
1502 | /* just send the port status */ | 1260 | /* just send the port status */ |
1503 | unsigned short status = port->status; | 1261 | u16 status = port->status; |
1504 | 1262 | ||
1505 | if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) | 1263 | if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) |
1506 | return -ENODEV; | 1264 | return -ENODEV; |
1507 | 1265 | ||
1508 | return ((status & ISI_RTS) ? TIOCM_RTS : 0) | | 1266 | return ((status & ISI_RTS) ? TIOCM_RTS : 0) | |
1509 | ((status & ISI_DTR) ? TIOCM_DTR : 0) | | 1267 | ((status & ISI_DTR) ? TIOCM_DTR : 0) | |
1510 | ((status & ISI_DCD) ? TIOCM_CAR : 0) | | 1268 | ((status & ISI_DCD) ? TIOCM_CAR : 0) | |
@@ -1514,13 +1272,13 @@ static int isicom_tiocmget(struct tty_struct *tty, struct file *file) | |||
1514 | } | 1272 | } |
1515 | 1273 | ||
1516 | static int isicom_tiocmset(struct tty_struct *tty, struct file *file, | 1274 | static int isicom_tiocmset(struct tty_struct *tty, struct file *file, |
1517 | unsigned int set, unsigned int clear) | 1275 | unsigned int set, unsigned int clear) |
1518 | { | 1276 | { |
1519 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1277 | struct isi_port *port = tty->driver_data; |
1520 | 1278 | ||
1521 | if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) | 1279 | if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) |
1522 | return -ENODEV; | 1280 | return -ENODEV; |
1523 | 1281 | ||
1524 | if (set & TIOCM_RTS) | 1282 | if (set & TIOCM_RTS) |
1525 | raise_rts(port); | 1283 | raise_rts(port); |
1526 | if (set & TIOCM_DTR) | 1284 | if (set & TIOCM_DTR) |
@@ -1532,46 +1290,46 @@ static int isicom_tiocmset(struct tty_struct *tty, struct file *file, | |||
1532 | drop_dtr(port); | 1290 | drop_dtr(port); |
1533 | 1291 | ||
1534 | return 0; | 1292 | return 0; |
1535 | } | 1293 | } |
1536 | 1294 | ||
1537 | static int isicom_set_serial_info(struct isi_port * port, | 1295 | static int isicom_set_serial_info(struct isi_port *port, |
1538 | struct serial_struct __user *info) | 1296 | struct serial_struct __user *info) |
1539 | { | 1297 | { |
1540 | struct serial_struct newinfo; | 1298 | struct serial_struct newinfo; |
1541 | int reconfig_port; | 1299 | int reconfig_port; |
1542 | 1300 | ||
1543 | if(copy_from_user(&newinfo, info, sizeof(newinfo))) | 1301 | if (copy_from_user(&newinfo, info, sizeof(newinfo))) |
1544 | return -EFAULT; | 1302 | return -EFAULT; |
1545 | 1303 | ||
1546 | reconfig_port = ((port->flags & ASYNC_SPD_MASK) != | 1304 | reconfig_port = ((port->flags & ASYNC_SPD_MASK) != |
1547 | (newinfo.flags & ASYNC_SPD_MASK)); | 1305 | (newinfo.flags & ASYNC_SPD_MASK)); |
1548 | 1306 | ||
1549 | if (!capable(CAP_SYS_ADMIN)) { | 1307 | if (!capable(CAP_SYS_ADMIN)) { |
1550 | if ((newinfo.close_delay != port->close_delay) || | 1308 | if ((newinfo.close_delay != port->close_delay) || |
1551 | (newinfo.closing_wait != port->closing_wait) || | 1309 | (newinfo.closing_wait != port->closing_wait) || |
1552 | ((newinfo.flags & ~ASYNC_USR_MASK) != | 1310 | ((newinfo.flags & ~ASYNC_USR_MASK) != |
1553 | (port->flags & ~ASYNC_USR_MASK))) | 1311 | (port->flags & ~ASYNC_USR_MASK))) |
1554 | return -EPERM; | 1312 | return -EPERM; |
1555 | port->flags = ((port->flags & ~ ASYNC_USR_MASK) | | 1313 | port->flags = ((port->flags & ~ ASYNC_USR_MASK) | |
1556 | (newinfo.flags & ASYNC_USR_MASK)); | 1314 | (newinfo.flags & ASYNC_USR_MASK)); |
1557 | } | 1315 | } |
1558 | else { | 1316 | else { |
1559 | port->close_delay = newinfo.close_delay; | 1317 | port->close_delay = newinfo.close_delay; |
1560 | port->closing_wait = newinfo.closing_wait; | 1318 | port->closing_wait = newinfo.closing_wait; |
1561 | port->flags = ((port->flags & ~ASYNC_FLAGS) | | 1319 | port->flags = ((port->flags & ~ASYNC_FLAGS) | |
1562 | (newinfo.flags & ASYNC_FLAGS)); | 1320 | (newinfo.flags & ASYNC_FLAGS)); |
1563 | } | 1321 | } |
1564 | if (reconfig_port) { | 1322 | if (reconfig_port) { |
1565 | isicom_config_port(port); | 1323 | isicom_config_port(port); |
1566 | } | 1324 | } |
1567 | return 0; | 1325 | return 0; |
1568 | } | 1326 | } |
1569 | 1327 | ||
1570 | static int isicom_get_serial_info(struct isi_port * port, | 1328 | static int isicom_get_serial_info(struct isi_port *port, |
1571 | struct serial_struct __user *info) | 1329 | struct serial_struct __user *info) |
1572 | { | 1330 | { |
1573 | struct serial_struct out_info; | 1331 | struct serial_struct out_info; |
1574 | 1332 | ||
1575 | memset(&out_info, 0, sizeof(out_info)); | 1333 | memset(&out_info, 0, sizeof(out_info)); |
1576 | /* out_info.type = ? */ | 1334 | /* out_info.type = ? */ |
1577 | out_info.line = port - isi_ports; | 1335 | out_info.line = port - isi_ports; |
@@ -1581,15 +1339,15 @@ static int isicom_get_serial_info(struct isi_port * port, | |||
1581 | /* out_info.baud_base = ? */ | 1339 | /* out_info.baud_base = ? */ |
1582 | out_info.close_delay = port->close_delay; | 1340 | out_info.close_delay = port->close_delay; |
1583 | out_info.closing_wait = port->closing_wait; | 1341 | out_info.closing_wait = port->closing_wait; |
1584 | if(copy_to_user(info, &out_info, sizeof(out_info))) | 1342 | if (copy_to_user(info, &out_info, sizeof(out_info))) |
1585 | return -EFAULT; | 1343 | return -EFAULT; |
1586 | return 0; | 1344 | return 0; |
1587 | } | 1345 | } |
1588 | 1346 | ||
1589 | static int isicom_ioctl(struct tty_struct * tty, struct file * filp, | 1347 | static int isicom_ioctl(struct tty_struct *tty, struct file *filp, |
1590 | unsigned int cmd, unsigned long arg) | 1348 | unsigned int cmd, unsigned long arg) |
1591 | { | 1349 | { |
1592 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1350 | struct isi_port *port = tty->driver_data; |
1593 | void __user *argp = (void __user *)arg; | 1351 | void __user *argp = (void __user *)arg; |
1594 | int retval; | 1352 | int retval; |
1595 | 1353 | ||
@@ -1597,139 +1355,141 @@ static int isicom_ioctl(struct tty_struct * tty, struct file * filp, | |||
1597 | return -ENODEV; | 1355 | return -ENODEV; |
1598 | 1356 | ||
1599 | switch(cmd) { | 1357 | switch(cmd) { |
1600 | case TCSBRK: | 1358 | case TCSBRK: |
1601 | retval = tty_check_change(tty); | 1359 | retval = tty_check_change(tty); |
1602 | if (retval) | 1360 | if (retval) |
1603 | return retval; | 1361 | return retval; |
1604 | tty_wait_until_sent(tty, 0); | 1362 | tty_wait_until_sent(tty, 0); |
1605 | if (!arg) | 1363 | if (!arg) |
1606 | isicom_send_break(port, HZ/4); | 1364 | isicom_send_break(port, HZ/4); |
1607 | return 0; | 1365 | return 0; |
1608 | 1366 | ||
1609 | case TCSBRKP: | 1367 | case TCSBRKP: |
1610 | retval = tty_check_change(tty); | 1368 | retval = tty_check_change(tty); |
1611 | if (retval) | 1369 | if (retval) |
1612 | return retval; | 1370 | return retval; |
1613 | tty_wait_until_sent(tty, 0); | 1371 | tty_wait_until_sent(tty, 0); |
1614 | isicom_send_break(port, arg ? arg * (HZ/10) : HZ/4); | 1372 | isicom_send_break(port, arg ? arg * (HZ/10) : HZ/4); |
1615 | return 0; | 1373 | return 0; |
1616 | 1374 | ||
1617 | case TIOCGSOFTCAR: | 1375 | case TIOCGSOFTCAR: |
1618 | return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); | 1376 | return put_user(C_CLOCAL(tty) ? 1 : 0, |
1619 | 1377 | (unsigned long __user *)argp); | |
1620 | case TIOCSSOFTCAR: | 1378 | |
1621 | if(get_user(arg, (unsigned long __user *) argp)) | 1379 | case TIOCSSOFTCAR: |
1622 | return -EFAULT; | 1380 | if (get_user(arg, (unsigned long __user *) argp)) |
1623 | tty->termios->c_cflag = | 1381 | return -EFAULT; |
1624 | ((tty->termios->c_cflag & ~CLOCAL) | | 1382 | tty->termios->c_cflag = |
1625 | (arg ? CLOCAL : 0)); | 1383 | ((tty->termios->c_cflag & ~CLOCAL) | |
1626 | return 0; | 1384 | (arg ? CLOCAL : 0)); |
1627 | 1385 | return 0; | |
1628 | case TIOCGSERIAL: | 1386 | |
1629 | return isicom_get_serial_info(port, argp); | 1387 | case TIOCGSERIAL: |
1630 | 1388 | return isicom_get_serial_info(port, argp); | |
1631 | case TIOCSSERIAL: | 1389 | |
1632 | return isicom_set_serial_info(port, argp); | 1390 | case TIOCSSERIAL: |
1633 | 1391 | return isicom_set_serial_info(port, argp); | |
1634 | default: | 1392 | |
1635 | return -ENOIOCTLCMD; | 1393 | default: |
1394 | return -ENOIOCTLCMD; | ||
1636 | } | 1395 | } |
1637 | return 0; | 1396 | return 0; |
1638 | } | 1397 | } |
1639 | 1398 | ||
1640 | /* set_termios et all */ | 1399 | /* set_termios et all */ |
1641 | static void isicom_set_termios(struct tty_struct * tty, struct termios * old_termios) | 1400 | static void isicom_set_termios(struct tty_struct *tty, |
1401 | struct termios *old_termios) | ||
1642 | { | 1402 | { |
1643 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1403 | struct isi_port *port = tty->driver_data; |
1644 | 1404 | ||
1645 | if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) | 1405 | if (isicom_paranoia_check(port, tty->name, "isicom_set_termios")) |
1646 | return; | 1406 | return; |
1647 | 1407 | ||
1648 | if (tty->termios->c_cflag == old_termios->c_cflag && | 1408 | if (tty->termios->c_cflag == old_termios->c_cflag && |
1649 | tty->termios->c_iflag == old_termios->c_iflag) | 1409 | tty->termios->c_iflag == old_termios->c_iflag) |
1650 | return; | 1410 | return; |
1651 | 1411 | ||
1652 | isicom_config_port(port); | 1412 | isicom_config_port(port); |
1653 | 1413 | ||
1654 | if ((old_termios->c_cflag & CRTSCTS) && | 1414 | if ((old_termios->c_cflag & CRTSCTS) && |
1655 | !(tty->termios->c_cflag & CRTSCTS)) { | 1415 | !(tty->termios->c_cflag & CRTSCTS)) { |
1656 | tty->hw_stopped = 0; | 1416 | tty->hw_stopped = 0; |
1657 | isicom_start(tty); | 1417 | isicom_start(tty); |
1658 | } | 1418 | } |
1659 | } | 1419 | } |
1660 | 1420 | ||
1661 | /* throttle et all */ | 1421 | /* throttle et all */ |
1662 | static void isicom_throttle(struct tty_struct * tty) | 1422 | static void isicom_throttle(struct tty_struct *tty) |
1663 | { | 1423 | { |
1664 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1424 | struct isi_port *port = tty->driver_data; |
1665 | struct isi_board * card = port->card; | 1425 | struct isi_board *card = port->card; |
1666 | 1426 | ||
1667 | if (isicom_paranoia_check(port, tty->name, "isicom_throttle")) | 1427 | if (isicom_paranoia_check(port, tty->name, "isicom_throttle")) |
1668 | return; | 1428 | return; |
1669 | 1429 | ||
1670 | /* tell the card that this port cannot handle any more data for now */ | 1430 | /* tell the card that this port cannot handle any more data for now */ |
1671 | card->port_status &= ~(1 << port->channel); | 1431 | card->port_status &= ~(1 << port->channel); |
1672 | outw(card->port_status, card->base + 0x02); | 1432 | outw(card->port_status, card->base + 0x02); |
1673 | } | 1433 | } |
1674 | 1434 | ||
1675 | /* unthrottle et all */ | 1435 | /* unthrottle et all */ |
1676 | static void isicom_unthrottle(struct tty_struct * tty) | 1436 | static void isicom_unthrottle(struct tty_struct *tty) |
1677 | { | 1437 | { |
1678 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1438 | struct isi_port *port = tty->driver_data; |
1679 | struct isi_board * card = port->card; | 1439 | struct isi_board *card = port->card; |
1680 | 1440 | ||
1681 | if (isicom_paranoia_check(port, tty->name, "isicom_unthrottle")) | 1441 | if (isicom_paranoia_check(port, tty->name, "isicom_unthrottle")) |
1682 | return; | 1442 | return; |
1683 | 1443 | ||
1684 | /* tell the card that this port is ready to accept more data */ | 1444 | /* tell the card that this port is ready to accept more data */ |
1685 | card->port_status |= (1 << port->channel); | 1445 | card->port_status |= (1 << port->channel); |
1686 | outw(card->port_status, card->base + 0x02); | 1446 | outw(card->port_status, card->base + 0x02); |
1687 | } | 1447 | } |
1688 | 1448 | ||
1689 | /* stop et all */ | 1449 | /* stop et all */ |
1690 | static void isicom_stop(struct tty_struct * tty) | 1450 | static void isicom_stop(struct tty_struct *tty) |
1691 | { | 1451 | { |
1692 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1452 | struct isi_port *port = tty->driver_data; |
1693 | 1453 | ||
1694 | if (isicom_paranoia_check(port, tty->name, "isicom_stop")) | 1454 | if (isicom_paranoia_check(port, tty->name, "isicom_stop")) |
1695 | return; | 1455 | return; |
1696 | 1456 | ||
1697 | /* this tells the transmitter not to consider this port for | 1457 | /* this tells the transmitter not to consider this port for |
1698 | data output to the card. */ | 1458 | data output to the card. */ |
1699 | port->status &= ~ISI_TXOK; | 1459 | port->status &= ~ISI_TXOK; |
1700 | } | 1460 | } |
1701 | 1461 | ||
1702 | /* start et all */ | 1462 | /* start et all */ |
1703 | static void isicom_start(struct tty_struct * tty) | 1463 | static void isicom_start(struct tty_struct *tty) |
1704 | { | 1464 | { |
1705 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1465 | struct isi_port *port = tty->driver_data; |
1706 | 1466 | ||
1707 | if (isicom_paranoia_check(port, tty->name, "isicom_start")) | 1467 | if (isicom_paranoia_check(port, tty->name, "isicom_start")) |
1708 | return; | 1468 | return; |
1709 | 1469 | ||
1710 | /* this tells the transmitter to consider this port for | 1470 | /* this tells the transmitter to consider this port for |
1711 | data output to the card. */ | 1471 | data output to the card. */ |
1712 | port->status |= ISI_TXOK; | 1472 | port->status |= ISI_TXOK; |
1713 | } | 1473 | } |
1714 | 1474 | ||
1715 | /* hangup et all */ | 1475 | /* hangup et all */ |
1716 | static void do_isicom_hangup(void * data) | 1476 | static void do_isicom_hangup(void *data) |
1717 | { | 1477 | { |
1718 | struct isi_port * port = (struct isi_port *) data; | 1478 | struct isi_port *port = data; |
1719 | struct tty_struct * tty; | 1479 | struct tty_struct *tty; |
1720 | 1480 | ||
1721 | tty = port->tty; | 1481 | tty = port->tty; |
1722 | if (tty) | 1482 | if (tty) |
1723 | tty_hangup(tty); | 1483 | tty_hangup(tty); |
1724 | } | 1484 | } |
1725 | 1485 | ||
1726 | static void isicom_hangup(struct tty_struct * tty) | 1486 | static void isicom_hangup(struct tty_struct *tty) |
1727 | { | 1487 | { |
1728 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1488 | struct isi_port *port = tty->driver_data; |
1729 | 1489 | ||
1730 | if (isicom_paranoia_check(port, tty->name, "isicom_hangup")) | 1490 | if (isicom_paranoia_check(port, tty->name, "isicom_hangup")) |
1731 | return; | 1491 | return; |
1732 | 1492 | ||
1733 | isicom_shutdown_port(port); | 1493 | isicom_shutdown_port(port); |
1734 | port->count = 0; | 1494 | port->count = 0; |
1735 | port->flags &= ~ASYNC_NORMAL_ACTIVE; | 1495 | port->flags &= ~ASYNC_NORMAL_ACTIVE; |
@@ -1738,342 +1498,540 @@ static void isicom_hangup(struct tty_struct * tty) | |||
1738 | } | 1498 | } |
1739 | 1499 | ||
1740 | /* flush_buffer et all */ | 1500 | /* flush_buffer et all */ |
1741 | static void isicom_flush_buffer(struct tty_struct * tty) | 1501 | static void isicom_flush_buffer(struct tty_struct *tty) |
1742 | { | 1502 | { |
1743 | struct isi_port * port = (struct isi_port *) tty->driver_data; | 1503 | struct isi_port *port = tty->driver_data; |
1744 | struct isi_board * card = port->card; | 1504 | struct isi_board *card = port->card; |
1745 | unsigned long flags; | 1505 | unsigned long flags; |
1746 | 1506 | ||
1747 | if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer")) | 1507 | if (isicom_paranoia_check(port, tty->name, "isicom_flush_buffer")) |
1748 | return; | 1508 | return; |
1749 | 1509 | ||
1750 | spin_lock_irqsave(&card->card_lock, flags); | 1510 | spin_lock_irqsave(&card->card_lock, flags); |
1751 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 1511 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
1752 | spin_unlock_irqrestore(&card->card_lock, flags); | 1512 | spin_unlock_irqrestore(&card->card_lock, flags); |
1753 | 1513 | ||
1754 | wake_up_interruptible(&tty->write_wait); | 1514 | wake_up_interruptible(&tty->write_wait); |
1755 | tty_wakeup(tty); | 1515 | tty_wakeup(tty); |
1756 | } | 1516 | } |
1757 | 1517 | ||
1518 | /* | ||
1519 | * Driver init and deinit functions | ||
1520 | */ | ||
1758 | 1521 | ||
1759 | static int __devinit register_ioregion(void) | 1522 | static int __devinit isicom_register_ioregion(struct pci_dev *pdev, |
1523 | const unsigned int index) | ||
1760 | { | 1524 | { |
1761 | int count, done=0; | 1525 | struct isi_board *board = pci_get_drvdata(pdev); |
1762 | for (count=0; count < BOARD_COUNT; count++ ) { | 1526 | |
1763 | if (isi_card[count].base) | 1527 | if (!board->base) |
1764 | if (!request_region(isi_card[count].base,16,ISICOM_NAME)) { | 1528 | return -EINVAL; |
1765 | printk(KERN_DEBUG "ISICOM: I/O Region 0x%x-0x%x is busy. Card%d will be disabled.\n", | 1529 | |
1766 | isi_card[count].base,isi_card[count].base+15,count+1); | 1530 | if (!request_region(board->base, 16, ISICOM_NAME)) { |
1767 | isi_card[count].base=0; | 1531 | dev_dbg(&pdev->dev, "I/O Region 0x%lx-0x%lx is busy. Card%d " |
1768 | done++; | 1532 | "will be disabled.\n", board->base, board->base + 15, |
1769 | } | 1533 | index + 1); |
1770 | } | 1534 | return -EBUSY; |
1771 | return done; | 1535 | } |
1536 | |||
1537 | return 0; | ||
1772 | } | 1538 | } |
1773 | 1539 | ||
1774 | static void unregister_ioregion(void) | 1540 | static void isicom_unregister_ioregion(struct pci_dev *pdev) |
1775 | { | 1541 | { |
1776 | int count; | 1542 | struct isi_board *board = pci_get_drvdata(pdev); |
1777 | for (count=0; count < BOARD_COUNT; count++ ) | 1543 | |
1778 | if (isi_card[count].base) { | 1544 | if (!board->base) |
1779 | release_region(isi_card[count].base,16); | 1545 | return; |
1780 | #ifdef ISICOM_DEBUG | 1546 | |
1781 | printk(KERN_DEBUG "ISICOM: I/O Region 0x%x-0x%x released for Card%d.\n",isi_card[count].base,isi_card[count].base+15,count+1); | 1547 | release_region(board->base, 16); |
1782 | #endif | 1548 | dev_dbg(&pdev->dev, "I/O Region 0x%lx-0x%lx released.\n", |
1783 | } | 1549 | board->base, board->base + 15); |
1550 | board->base = 0; | ||
1784 | } | 1551 | } |
1785 | 1552 | ||
1786 | static struct tty_operations isicom_ops = { | 1553 | static struct tty_operations isicom_ops = { |
1787 | .open = isicom_open, | 1554 | .open = isicom_open, |
1788 | .close = isicom_close, | 1555 | .close = isicom_close, |
1789 | .write = isicom_write, | 1556 | .write = isicom_write, |
1790 | .put_char = isicom_put_char, | 1557 | .put_char = isicom_put_char, |
1791 | .flush_chars = isicom_flush_chars, | 1558 | .flush_chars = isicom_flush_chars, |
1792 | .write_room = isicom_write_room, | 1559 | .write_room = isicom_write_room, |
1793 | .chars_in_buffer = isicom_chars_in_buffer, | 1560 | .chars_in_buffer = isicom_chars_in_buffer, |
1794 | .ioctl = isicom_ioctl, | 1561 | .ioctl = isicom_ioctl, |
1795 | .set_termios = isicom_set_termios, | 1562 | .set_termios = isicom_set_termios, |
1796 | .throttle = isicom_throttle, | 1563 | .throttle = isicom_throttle, |
1797 | .unthrottle = isicom_unthrottle, | 1564 | .unthrottle = isicom_unthrottle, |
1798 | .stop = isicom_stop, | 1565 | .stop = isicom_stop, |
1799 | .start = isicom_start, | 1566 | .start = isicom_start, |
1800 | .hangup = isicom_hangup, | 1567 | .hangup = isicom_hangup, |
1801 | .flush_buffer = isicom_flush_buffer, | 1568 | .flush_buffer = isicom_flush_buffer, |
1802 | .tiocmget = isicom_tiocmget, | 1569 | .tiocmget = isicom_tiocmget, |
1803 | .tiocmset = isicom_tiocmset, | 1570 | .tiocmset = isicom_tiocmset, |
1804 | }; | 1571 | }; |
1805 | 1572 | ||
1806 | static int __devinit register_drivers(void) | 1573 | static int __devinit isicom_register_tty_driver(void) |
1807 | { | 1574 | { |
1808 | int error; | 1575 | int error = -ENOMEM; |
1809 | 1576 | ||
1810 | /* tty driver structure initialization */ | 1577 | /* tty driver structure initialization */ |
1811 | isicom_normal = alloc_tty_driver(PORT_COUNT); | 1578 | isicom_normal = alloc_tty_driver(PORT_COUNT); |
1812 | if (!isicom_normal) | 1579 | if (!isicom_normal) |
1813 | return -ENOMEM; | 1580 | goto end; |
1814 | 1581 | ||
1815 | isicom_normal->owner = THIS_MODULE; | 1582 | isicom_normal->owner = THIS_MODULE; |
1816 | isicom_normal->name = "ttyM"; | 1583 | isicom_normal->name = "ttyM"; |
1817 | isicom_normal->devfs_name = "isicom/"; | 1584 | isicom_normal->devfs_name = "isicom/"; |
1818 | isicom_normal->major = ISICOM_NMAJOR; | 1585 | isicom_normal->major = ISICOM_NMAJOR; |
1819 | isicom_normal->minor_start = 0; | 1586 | isicom_normal->minor_start = 0; |
1820 | isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; | 1587 | isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; |
1821 | isicom_normal->subtype = SERIAL_TYPE_NORMAL; | 1588 | isicom_normal->subtype = SERIAL_TYPE_NORMAL; |
1822 | isicom_normal->init_termios = tty_std_termios; | 1589 | isicom_normal->init_termios = tty_std_termios; |
1823 | isicom_normal->init_termios.c_cflag = | 1590 | isicom_normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | |
1824 | B9600 | CS8 | CREAD | HUPCL |CLOCAL; | 1591 | CLOCAL; |
1825 | isicom_normal->flags = TTY_DRIVER_REAL_RAW; | 1592 | isicom_normal->flags = TTY_DRIVER_REAL_RAW; |
1826 | tty_set_operations(isicom_normal, &isicom_ops); | 1593 | tty_set_operations(isicom_normal, &isicom_ops); |
1827 | 1594 | ||
1828 | if ((error=tty_register_driver(isicom_normal))!=0) { | 1595 | if ((error = tty_register_driver(isicom_normal))) { |
1829 | printk(KERN_DEBUG "ISICOM: Couldn't register the dialin driver, error=%d\n", | 1596 | pr_dbg("Couldn't register the dialin driver, error=%d\n", |
1830 | error); | 1597 | error); |
1831 | put_tty_driver(isicom_normal); | 1598 | put_tty_driver(isicom_normal); |
1832 | return error; | ||
1833 | } | 1599 | } |
1834 | return 0; | 1600 | end: |
1601 | return error; | ||
1835 | } | 1602 | } |
1836 | 1603 | ||
1837 | static void unregister_drivers(void) | 1604 | static void isicom_unregister_tty_driver(void) |
1838 | { | 1605 | { |
1839 | int error = tty_unregister_driver(isicom_normal); | 1606 | int error; |
1840 | if (error) | 1607 | |
1841 | printk(KERN_DEBUG "ISICOM: couldn't unregister normal driver error=%d.\n",error); | 1608 | if ((error = tty_unregister_driver(isicom_normal))) |
1609 | pr_dbg("couldn't unregister normal driver, error=%d.\n", error); | ||
1610 | |||
1842 | put_tty_driver(isicom_normal); | 1611 | put_tty_driver(isicom_normal); |
1843 | } | 1612 | } |
1844 | 1613 | ||
1845 | static int __devinit register_isr(void) | 1614 | static int __devinit isicom_register_isr(struct pci_dev *pdev, |
1615 | const unsigned int index) | ||
1846 | { | 1616 | { |
1847 | int count, done=0; | 1617 | struct isi_board *board = pci_get_drvdata(pdev); |
1848 | unsigned long irqflags; | 1618 | unsigned long irqflags = SA_INTERRUPT; |
1849 | 1619 | int retval = -EINVAL; | |
1850 | for (count=0; count < BOARD_COUNT; count++ ) { | 1620 | |
1851 | if (isi_card[count].base) { | 1621 | if (!board->base) |
1852 | irqflags = (isi_card[count].isa == YES) ? | 1622 | goto end; |
1853 | SA_INTERRUPT : | 1623 | |
1854 | (SA_INTERRUPT | SA_SHIRQ); | 1624 | if (board->isa == NO) |
1855 | 1625 | irqflags |= SA_SHIRQ; | |
1856 | if (request_irq(isi_card[count].irq, | 1626 | |
1857 | isicom_interrupt, | 1627 | retval = request_irq(board->irq, isicom_interrupt, irqflags, |
1858 | irqflags, | 1628 | ISICOM_NAME, board); |
1859 | ISICOM_NAME, &isi_card[count])) { | 1629 | if (retval < 0) |
1860 | 1630 | dev_warn(&pdev->dev, "Could not install handler at Irq %d. " | |
1861 | printk(KERN_WARNING "ISICOM: Could not" | 1631 | "Card%d will be disabled.\n", board->irq, index + 1); |
1862 | " install handler at Irq %d." | 1632 | else |
1863 | " Card%d will be disabled.\n", | 1633 | retval = 0; |
1864 | isi_card[count].irq, count+1); | 1634 | end: |
1865 | 1635 | return retval; | |
1866 | release_region(isi_card[count].base,16); | ||
1867 | isi_card[count].base=0; | ||
1868 | } | ||
1869 | else | ||
1870 | done++; | ||
1871 | } | ||
1872 | } | ||
1873 | return done; | ||
1874 | } | 1636 | } |
1875 | 1637 | ||
1876 | static void __exit unregister_isr(void) | 1638 | static int __devinit reset_card(struct pci_dev *pdev, |
1639 | const unsigned int card, unsigned int *signature) | ||
1877 | { | 1640 | { |
1878 | int count; | 1641 | struct isi_board *board = pci_get_drvdata(pdev); |
1642 | unsigned long base = board->base; | ||
1643 | unsigned int portcount = 0; | ||
1644 | int retval = 0; | ||
1645 | |||
1646 | dev_dbg(&pdev->dev, "ISILoad:Resetting Card%d at 0x%lx\n", card + 1, | ||
1647 | base); | ||
1879 | 1648 | ||
1880 | for (count=0; count < BOARD_COUNT; count++ ) { | 1649 | inw(base + 0x8); |
1881 | if (isi_card[count].base) | 1650 | |
1882 | free_irq(isi_card[count].irq, &isi_card[count]); | 1651 | mdelay(10); |
1652 | |||
1653 | outw(0, base + 0x8); /* Reset */ | ||
1654 | |||
1655 | msleep(3000); | ||
1656 | |||
1657 | *signature = inw(base + 0x4) & 0xff; | ||
1658 | |||
1659 | if (board->isa == YES) { | ||
1660 | if (!(inw(base + 0xe) & 0x1) || (inw(base + 0x2))) { | ||
1661 | dev_dbg(&pdev->dev, "base+0x2=0x%lx, base+0xe=0x%lx\n", | ||
1662 | inw(base + 0x2), inw(base + 0xe)); | ||
1663 | dev_err(&pdev->dev, "ISILoad:ISA Card%d reset failure " | ||
1664 | "(Possible bad I/O Port Address 0x%lx).\n", | ||
1665 | card + 1, base); | ||
1666 | retval = -EIO; | ||
1667 | goto end; | ||
1668 | } | ||
1669 | } else { | ||
1670 | portcount = inw(base + 0x2); | ||
1671 | if (!(inw(base + 0xe) & 0x1) || ((portcount != 0) && | ||
1672 | (portcount != 4) && (portcount != 8))) { | ||
1673 | dev_dbg(&pdev->dev, "base+0x2=0x%lx, base+0xe=0x%lx\n", | ||
1674 | inw(base + 0x2), inw(base + 0xe)); | ||
1675 | dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure " | ||
1676 | "(Possible bad I/O Port Address 0x%lx).\n", | ||
1677 | card + 1, base); | ||
1678 | retval = -EIO; | ||
1679 | goto end; | ||
1680 | } | ||
1883 | } | 1681 | } |
1682 | |||
1683 | switch (*signature) { | ||
1684 | case 0xa5: | ||
1685 | case 0xbb: | ||
1686 | case 0xdd: | ||
1687 | board->port_count = (board->isa == NO && portcount == 4) ? 4 : | ||
1688 | 8; | ||
1689 | board->shift_count = 12; | ||
1690 | break; | ||
1691 | case 0xcc: | ||
1692 | board->port_count = 16; | ||
1693 | board->shift_count = 11; | ||
1694 | break; | ||
1695 | default: | ||
1696 | dev_warn(&pdev->dev, "ISILoad:Card%d reset failure (Possible " | ||
1697 | "bad I/O Port Address 0x%lx).\n", card + 1, base); | ||
1698 | dev_dbg(&pdev->dev, "Sig=0x%lx\n", signature); | ||
1699 | retval = -EIO; | ||
1700 | } | ||
1701 | dev_info(&pdev->dev, "-Done\n"); | ||
1702 | |||
1703 | end: | ||
1704 | return retval; | ||
1884 | } | 1705 | } |
1885 | 1706 | ||
1886 | static int __devinit isicom_init(void) | 1707 | static inline int WaitTillCardIsFree(u16 base) |
1887 | { | 1708 | { |
1888 | int card, channel, base; | 1709 | unsigned long count = 0; |
1889 | struct isi_port * port; | 1710 | |
1890 | unsigned long page; | 1711 | while (!(inw(base + 0xe) & 0x1) && count++ < 100) |
1891 | 1712 | msleep(5); | |
1892 | if (!tmp_buf) { | 1713 | |
1893 | page = get_zeroed_page(GFP_KERNEL); | 1714 | return !(inw(base + 0xe) & 0x1); |
1894 | if (!page) { | 1715 | } |
1895 | #ifdef ISICOM_DEBUG | 1716 | |
1896 | printk(KERN_DEBUG "ISICOM: Couldn't allocate page for tmp_buf.\n"); | 1717 | static int __devinit load_firmware(struct pci_dev *pdev, |
1897 | #else | 1718 | const unsigned int index, const unsigned int signature) |
1898 | printk(KERN_ERR "ISICOM: Not enough memory...\n"); | 1719 | { |
1899 | #endif | 1720 | struct isi_board *board = pci_get_drvdata(pdev); |
1900 | return 0; | 1721 | const struct firmware *fw; |
1901 | } | 1722 | unsigned long base = board->base; |
1902 | tmp_buf = (unsigned char *) page; | 1723 | unsigned int a; |
1903 | } | 1724 | u16 word_count, status; |
1904 | 1725 | int retval = -EIO; | |
1905 | if (!register_ioregion()) | 1726 | char *name; |
1906 | { | 1727 | u8 *data; |
1907 | printk(KERN_ERR "ISICOM: All required I/O space found busy.\n"); | 1728 | |
1908 | free_page((unsigned long)tmp_buf); | 1729 | struct stframe { |
1909 | return 0; | 1730 | u16 addr; |
1910 | } | 1731 | u16 count; |
1911 | if (register_drivers()) | 1732 | u8 data[0]; |
1912 | { | 1733 | } *frame; |
1913 | unregister_ioregion(); | 1734 | |
1914 | free_page((unsigned long)tmp_buf); | 1735 | switch (signature) { |
1915 | return 0; | 1736 | case 0xa5: |
1916 | } | 1737 | name = "isi608.bin"; |
1917 | if (!register_isr()) | 1738 | break; |
1918 | { | 1739 | case 0xbb: |
1919 | unregister_drivers(); | 1740 | name = "isi608em.bin"; |
1920 | /* ioports already uregistered in register_isr */ | 1741 | break; |
1921 | free_page((unsigned long)tmp_buf); | 1742 | case 0xcc: |
1922 | return 0; | 1743 | name = "isi616em.bin"; |
1744 | break; | ||
1745 | case 0xdd: | ||
1746 | name = "isi4608.bin"; | ||
1747 | break; | ||
1748 | case 0xee: | ||
1749 | name = "isi4616.bin"; | ||
1750 | break; | ||
1751 | default: | ||
1752 | dev_err(&pdev->dev, "Unknown signature.\n"); | ||
1753 | goto end; | ||
1754 | } | ||
1755 | |||
1756 | retval = request_firmware(&fw, name, &pdev->dev); | ||
1757 | if (retval) | ||
1758 | goto end; | ||
1759 | |||
1760 | for (frame = (struct stframe *)fw->data; | ||
1761 | frame < (struct stframe *)(fw->data + fw->size); | ||
1762 | frame++) { | ||
1763 | if (WaitTillCardIsFree(base)) | ||
1764 | goto errrelfw; | ||
1765 | |||
1766 | outw(0xf0, base); /* start upload sequence */ | ||
1767 | outw(0x00, base); | ||
1768 | outw(frame->addr, base); /* lsb of address */ | ||
1769 | |||
1770 | word_count = frame->count / 2 + frame->count % 2; | ||
1771 | outw(word_count, base); | ||
1772 | InterruptTheCard(base); | ||
1773 | |||
1774 | udelay(100); /* 0x2f */ | ||
1775 | |||
1776 | if (WaitTillCardIsFree(base)) | ||
1777 | goto errrelfw; | ||
1778 | |||
1779 | if ((status = inw(base + 0x4)) != 0) { | ||
1780 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" | ||
1781 | "Address:0x%x\nCount:0x%x\nStatus:0x%x\n", | ||
1782 | index + 1, frame->addr, frame->count, status); | ||
1783 | goto errrelfw; | ||
1784 | } | ||
1785 | outsw(base, frame->data, word_count); | ||
1786 | |||
1787 | InterruptTheCard(base); | ||
1788 | |||
1789 | udelay(50); /* 0x0f */ | ||
1790 | |||
1791 | if (WaitTillCardIsFree(base)) | ||
1792 | goto errrelfw; | ||
1793 | |||
1794 | if ((status = inw(base + 0x4)) != 0) { | ||
1795 | dev_err(&pdev->dev, "Card%d got out of sync.Card " | ||
1796 | "Status:0x%x\n", index + 1, status); | ||
1797 | goto errrelfw; | ||
1798 | } | ||
1799 | } | ||
1800 | |||
1801 | retval = -EIO; | ||
1802 | |||
1803 | if (WaitTillCardIsFree(base)) | ||
1804 | goto errrelfw; | ||
1805 | |||
1806 | outw(0xf2, base); | ||
1807 | outw(0x800, base); | ||
1808 | outw(0x0, base); | ||
1809 | outw(0x0, base); | ||
1810 | InterruptTheCard(base); | ||
1811 | outw(0x0, base + 0x4); /* for ISI4608 cards */ | ||
1812 | |||
1813 | /* XXX: should we test it by reading it back and comparing with original like | ||
1814 | * in load firmware package? */ | ||
1815 | for (frame = (struct stframe*)fw->data; | ||
1816 | frame < (struct stframe*)(fw->data + fw->size); | ||
1817 | frame++) { | ||
1818 | if (WaitTillCardIsFree(base)) | ||
1819 | goto errrelfw; | ||
1820 | |||
1821 | outw(0xf1, base); /* start download sequence */ | ||
1822 | outw(0x00, base); | ||
1823 | outw(frame->addr, base); /* lsb of address */ | ||
1824 | |||
1825 | word_count = (frame->count >> 1) + frame->count % 2; | ||
1826 | outw(word_count + 1, base); | ||
1827 | InterruptTheCard(base); | ||
1828 | |||
1829 | udelay(50); /* 0xf */ | ||
1830 | |||
1831 | if (WaitTillCardIsFree(base)) | ||
1832 | goto errrelfw; | ||
1833 | |||
1834 | if ((status = inw(base + 0x4)) != 0) { | ||
1835 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" | ||
1836 | "Address:0x%x\nCount:0x%x\nStatus: 0x%x\n", | ||
1837 | index + 1, frame->addr, frame->count, status); | ||
1838 | goto errrelfw; | ||
1839 | } | ||
1840 | |||
1841 | data = kmalloc(word_count * 2, GFP_KERNEL); | ||
1842 | inw(base); | ||
1843 | insw(base, data, word_count); | ||
1844 | InterruptTheCard(base); | ||
1845 | |||
1846 | for (a = 0; a < frame->count; a++) | ||
1847 | if (data[a] != frame->data[a]) { | ||
1848 | kfree(data); | ||
1849 | dev_err(&pdev->dev, "Card%d, firmware upload " | ||
1850 | "failed\n", index + 1); | ||
1851 | goto errrelfw; | ||
1852 | } | ||
1853 | kfree(data); | ||
1854 | |||
1855 | udelay(50); /* 0xf */ | ||
1856 | |||
1857 | if (WaitTillCardIsFree(base)) | ||
1858 | goto errrelfw; | ||
1859 | |||
1860 | if ((status = inw(base + 0x4)) != 0) { | ||
1861 | dev_err(&pdev->dev, "Card%d verify got out of sync. " | ||
1862 | "Card Status:0x%x\n", index + 1, status); | ||
1863 | goto errrelfw; | ||
1864 | } | ||
1923 | } | 1865 | } |
1924 | 1866 | ||
1925 | memset(isi_ports, 0, sizeof(isi_ports)); | 1867 | board->status |= FIRMWARE_LOADED; |
1926 | for (card = 0; card < BOARD_COUNT; card++) { | 1868 | retval = 0; |
1927 | port = &isi_ports[card * 16]; | 1869 | |
1928 | isi_card[card].ports = port; | 1870 | errrelfw: |
1929 | spin_lock_init(&isi_card[card].card_lock); | 1871 | release_firmware(fw); |
1930 | base = isi_card[card].base; | 1872 | end: |
1931 | for (channel = 0; channel < 16; channel++, port++) { | 1873 | return retval; |
1932 | port->magic = ISICOM_MAGIC; | ||
1933 | port->card = &isi_card[card]; | ||
1934 | port->channel = channel; | ||
1935 | port->close_delay = 50 * HZ/100; | ||
1936 | port->closing_wait = 3000 * HZ/100; | ||
1937 | INIT_WORK(&port->hangup_tq, do_isicom_hangup, port); | ||
1938 | INIT_WORK(&port->bh_tqueue, isicom_bottomhalf, port); | ||
1939 | port->status = 0; | ||
1940 | init_waitqueue_head(&port->open_wait); | ||
1941 | init_waitqueue_head(&port->close_wait); | ||
1942 | /* . . . */ | ||
1943 | } | ||
1944 | } | ||
1945 | |||
1946 | return 1; | ||
1947 | } | 1874 | } |
1948 | 1875 | ||
1949 | /* | 1876 | /* |
1950 | * Insmod can set static symbols so keep these static | 1877 | * Insmod can set static symbols so keep these static |
1951 | */ | 1878 | */ |
1952 | |||
1953 | static int io[4]; | 1879 | static int io[4]; |
1954 | static int irq[4]; | 1880 | static int irq[4]; |
1881 | static int card; | ||
1955 | 1882 | ||
1956 | MODULE_AUTHOR("MultiTech"); | 1883 | static int __devinit isicom_probe(struct pci_dev *pdev, |
1957 | MODULE_DESCRIPTION("Driver for the ISI series of cards by MultiTech"); | 1884 | const struct pci_device_id *ent) |
1958 | MODULE_LICENSE("GPL"); | 1885 | { |
1959 | module_param_array(io, int, NULL, 0); | 1886 | unsigned int ioaddr, signature, index; |
1960 | MODULE_PARM_DESC(io, "I/O ports for the cards"); | 1887 | int retval = -EPERM; |
1961 | module_param_array(irq, int, NULL, 0); | 1888 | u8 pciirq; |
1962 | MODULE_PARM_DESC(irq, "Interrupts for the cards"); | 1889 | struct isi_board *board = NULL; |
1890 | |||
1891 | if (card >= BOARD_COUNT) | ||
1892 | goto err; | ||
1893 | |||
1894 | ioaddr = pci_resource_start(pdev, 3); | ||
1895 | /* i.e at offset 0x1c in the PCI configuration register space. */ | ||
1896 | pciirq = pdev->irq; | ||
1897 | dev_info(&pdev->dev, "ISI PCI Card(Device ID 0x%x)\n", ent->device); | ||
1898 | |||
1899 | /* allot the first empty slot in the array */ | ||
1900 | for (index = 0; index < BOARD_COUNT; index++) | ||
1901 | if (isi_card[index].base == 0) { | ||
1902 | board = &isi_card[index]; | ||
1903 | break; | ||
1904 | } | ||
1905 | |||
1906 | board->base = ioaddr; | ||
1907 | board->irq = pciirq; | ||
1908 | board->isa = NO; | ||
1909 | card++; | ||
1910 | |||
1911 | pci_set_drvdata(pdev, board); | ||
1912 | |||
1913 | retval = isicom_register_ioregion(pdev, index); | ||
1914 | if (retval < 0) | ||
1915 | goto err; | ||
1916 | |||
1917 | retval = isicom_register_isr(pdev, index); | ||
1918 | if (retval < 0) | ||
1919 | goto errunrr; | ||
1920 | |||
1921 | retval = reset_card(pdev, index, &signature); | ||
1922 | if (retval < 0) | ||
1923 | goto errunri; | ||
1924 | |||
1925 | retval = load_firmware(pdev, index, signature); | ||
1926 | if (retval < 0) | ||
1927 | goto errunri; | ||
1928 | |||
1929 | return 0; | ||
1930 | |||
1931 | errunri: | ||
1932 | free_irq(board->irq, board); | ||
1933 | errunrr: | ||
1934 | isicom_unregister_ioregion(pdev); | ||
1935 | err: | ||
1936 | board->base = 0; | ||
1937 | return retval; | ||
1938 | } | ||
1939 | |||
1940 | static void __devexit isicom_remove(struct pci_dev *pdev) | ||
1941 | { | ||
1942 | struct isi_board *board = pci_get_drvdata(pdev); | ||
1943 | |||
1944 | free_irq(board->irq, board); | ||
1945 | isicom_unregister_ioregion(pdev); | ||
1946 | } | ||
1963 | 1947 | ||
1964 | static int __devinit isicom_setup(void) | 1948 | static int __devinit isicom_setup(void) |
1965 | { | 1949 | { |
1966 | struct pci_dev *dev = NULL; | 1950 | int retval, idx, channel; |
1967 | int retval, card, idx, count; | 1951 | struct isi_port *port; |
1968 | unsigned char pciirq; | 1952 | |
1969 | unsigned int ioaddr; | ||
1970 | |||
1971 | card = 0; | 1953 | card = 0; |
1972 | for(idx=0; idx < BOARD_COUNT; idx++) { | 1954 | memset(isi_ports, 0, sizeof(isi_ports)); |
1973 | if (io[idx]) { | ||
1974 | isi_card[idx].base=io[idx]; | ||
1975 | isi_card[idx].irq=irq[idx]; | ||
1976 | isi_card[idx].isa=YES; | ||
1977 | card++; | ||
1978 | } | ||
1979 | else { | ||
1980 | isi_card[idx].base = 0; | ||
1981 | isi_card[idx].irq = 0; | ||
1982 | } | ||
1983 | } | ||
1984 | |||
1985 | for (idx=0 ;idx < card; idx++) { | ||
1986 | if (!((isi_card[idx].irq==2)||(isi_card[idx].irq==3)|| | ||
1987 | (isi_card[idx].irq==4)||(isi_card[idx].irq==5)|| | ||
1988 | (isi_card[idx].irq==7)||(isi_card[idx].irq==10)|| | ||
1989 | (isi_card[idx].irq==11)||(isi_card[idx].irq==12)|| | ||
1990 | (isi_card[idx].irq==15))) { | ||
1991 | |||
1992 | if (isi_card[idx].base) { | ||
1993 | printk(KERN_ERR "ISICOM: Irq %d unsupported. Disabling Card%d...\n", | ||
1994 | isi_card[idx].irq, idx+1); | ||
1995 | isi_card[idx].base=0; | ||
1996 | card--; | ||
1997 | } | ||
1998 | } | ||
1999 | } | ||
2000 | |||
2001 | if (card < BOARD_COUNT) { | ||
2002 | for (idx=0; idx < DEVID_COUNT; idx++) { | ||
2003 | dev = NULL; | ||
2004 | for (;;){ | ||
2005 | if (!(dev = pci_find_device(VENDOR_ID, isicom_pci_tbl[idx].device, dev))) | ||
2006 | break; | ||
2007 | if (card >= BOARD_COUNT) | ||
2008 | break; | ||
2009 | |||
2010 | if (pci_enable_device(dev)) | ||
2011 | break; | ||
2012 | 1955 | ||
2013 | /* found a PCI ISI card! */ | 1956 | for(idx = 0; idx < BOARD_COUNT; idx++) { |
2014 | ioaddr = pci_resource_start (dev, 3); /* i.e at offset 0x1c in the | 1957 | port = &isi_ports[idx * 16]; |
2015 | * PCI configuration register | 1958 | isi_card[idx].ports = port; |
2016 | * space. | 1959 | spin_lock_init(&isi_card[idx].card_lock); |
2017 | */ | 1960 | for (channel = 0; channel < 16; channel++, port++) { |
2018 | pciirq = dev->irq; | 1961 | port->magic = ISICOM_MAGIC; |
2019 | printk(KERN_INFO "ISI PCI Card(Device ID 0x%x)\n", isicom_pci_tbl[idx].device); | 1962 | port->card = &isi_card[idx]; |
2020 | /* | 1963 | port->channel = channel; |
2021 | * allot the first empty slot in the array | 1964 | port->close_delay = 50 * HZ/100; |
2022 | */ | 1965 | port->closing_wait = 3000 * HZ/100; |
2023 | for (count=0; count < BOARD_COUNT; count++) { | 1966 | INIT_WORK(&port->hangup_tq, do_isicom_hangup, port); |
2024 | if (isi_card[count].base == 0) { | 1967 | INIT_WORK(&port->bh_tqueue, isicom_bottomhalf, port); |
2025 | isi_card[count].base = ioaddr; | 1968 | port->status = 0; |
2026 | isi_card[count].irq = pciirq; | 1969 | init_waitqueue_head(&port->open_wait); |
2027 | isi_card[count].isa = NO; | 1970 | init_waitqueue_head(&port->close_wait); |
2028 | card++; | 1971 | /* . . . */ |
2029 | break; | 1972 | } |
2030 | } | 1973 | isi_card[idx].base = 0; |
2031 | } | 1974 | isi_card[idx].irq = 0; |
2032 | } | 1975 | |
2033 | if (card >= BOARD_COUNT) break; | 1976 | if (!io[idx]) |
2034 | } | 1977 | continue; |
1978 | |||
1979 | if (irq[idx] == 2 || irq[idx] == 3 || irq[idx] == 4 || | ||
1980 | irq[idx] == 5 || irq[idx] == 7 || | ||
1981 | irq[idx] == 10 || irq[idx] == 11 || | ||
1982 | irq[idx] == 12 || irq[idx] == 15) { | ||
1983 | printk(KERN_ERR "ISICOM: ISA not supported yet.\n"); | ||
1984 | retval = -EINVAL; | ||
1985 | goto error; | ||
1986 | } else | ||
1987 | printk(KERN_ERR "ISICOM: Irq %d unsupported. " | ||
1988 | "Disabling Card%d...\n", irq[idx], idx + 1); | ||
2035 | } | 1989 | } |
2036 | |||
2037 | if (!(isi_card[0].base || isi_card[1].base || isi_card[2].base || isi_card[3].base)) { | ||
2038 | printk(KERN_ERR "ISICOM: No valid card configuration. Driver cannot be initialized...\n"); | ||
2039 | return -EIO; | ||
2040 | } | ||
2041 | 1990 | ||
2042 | retval = misc_register(&isiloader_device); | 1991 | retval = isicom_register_tty_driver(); |
1992 | if (retval < 0) | ||
1993 | goto error; | ||
1994 | |||
1995 | retval = pci_register_driver(&isicom_driver); | ||
2043 | if (retval < 0) { | 1996 | if (retval < 0) { |
2044 | printk(KERN_ERR "ISICOM: Unable to register firmware loader driver.\n"); | 1997 | printk(KERN_ERR "ISICOM: Unable to register pci driver.\n"); |
2045 | return retval; | 1998 | goto errtty; |
2046 | } | ||
2047 | |||
2048 | if (!isicom_init()) { | ||
2049 | if (misc_deregister(&isiloader_device)) | ||
2050 | printk(KERN_ERR "ISICOM: Unable to unregister Firmware Loader driver\n"); | ||
2051 | return -EIO; | ||
2052 | } | 1999 | } |
2053 | 2000 | ||
2054 | init_timer(&tx); | 2001 | init_timer(&tx); |
2055 | tx.expires = jiffies + 1; | 2002 | tx.expires = jiffies + 1; |
2056 | tx.data = 0; | 2003 | tx.data = 0; |
2057 | tx.function = isicom_tx; | 2004 | tx.function = isicom_tx; |
2058 | re_schedule = 1; | 2005 | re_schedule = 1; |
2059 | add_timer(&tx); | 2006 | add_timer(&tx); |
2060 | 2007 | ||
2061 | return 0; | 2008 | return 0; |
2009 | errtty: | ||
2010 | isicom_unregister_tty_driver(); | ||
2011 | error: | ||
2012 | return retval; | ||
2062 | } | 2013 | } |
2063 | 2014 | ||
2064 | static void __exit isicom_exit(void) | 2015 | static void __exit isicom_exit(void) |
2065 | { | 2016 | { |
2017 | unsigned int index = 0; | ||
2018 | |||
2066 | re_schedule = 0; | 2019 | re_schedule = 0; |
2067 | /* FIXME */ | 2020 | |
2068 | msleep(1000); | 2021 | while (re_schedule != 2 && index++ < 100) |
2069 | unregister_isr(); | 2022 | msleep(10); |
2070 | unregister_drivers(); | 2023 | |
2071 | unregister_ioregion(); | 2024 | pci_unregister_driver(&isicom_driver); |
2072 | if(tmp_buf) | 2025 | isicom_unregister_tty_driver(); |
2073 | free_page((unsigned long)tmp_buf); | ||
2074 | if (misc_deregister(&isiloader_device)) | ||
2075 | printk(KERN_ERR "ISICOM: Unable to unregister Firmware Loader driver\n"); | ||
2076 | } | 2026 | } |
2077 | 2027 | ||
2078 | module_init(isicom_setup); | 2028 | module_init(isicom_setup); |
2079 | module_exit(isicom_exit); | 2029 | module_exit(isicom_exit); |
2030 | |||
2031 | MODULE_AUTHOR("MultiTech"); | ||
2032 | MODULE_DESCRIPTION("Driver for the ISI series of cards by MultiTech"); | ||
2033 | MODULE_LICENSE("GPL"); | ||
2034 | module_param_array(io, int, NULL, 0); | ||
2035 | MODULE_PARM_DESC(io, "I/O ports for the cards"); | ||
2036 | module_param_array(irq, int, NULL, 0); | ||
2037 | MODULE_PARM_DESC(irq, "Interrupts for the cards"); | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ce3bc0d45f1f..28c5a3193b81 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -135,7 +135,7 @@ static stlconf_t stli_brdconf[] = { | |||
135 | /*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/ | 135 | /*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/ |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static int stli_nrbrds = sizeof(stli_brdconf) / sizeof(stlconf_t); | 138 | static int stli_nrbrds = ARRAY_SIZE(stli_brdconf); |
139 | 139 | ||
140 | /* | 140 | /* |
141 | * There is some experimental EISA board detection code in this driver. | 141 | * There is some experimental EISA board detection code in this driver. |
@@ -406,7 +406,7 @@ static unsigned long stli_eisamemprobeaddrs[] = { | |||
406 | 0xff000000, 0xff010000, 0xff020000, 0xff030000, | 406 | 0xff000000, 0xff010000, 0xff020000, 0xff030000, |
407 | }; | 407 | }; |
408 | 408 | ||
409 | static int stli_eisamempsize = sizeof(stli_eisamemprobeaddrs) / sizeof(unsigned long); | 409 | static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs); |
410 | 410 | ||
411 | /* | 411 | /* |
412 | * Define the Stallion PCI vendor and device IDs. | 412 | * Define the Stallion PCI vendor and device IDs. |
@@ -899,15 +899,13 @@ static void stli_argbrds(void) | |||
899 | { | 899 | { |
900 | stlconf_t conf; | 900 | stlconf_t conf; |
901 | stlibrd_t *brdp; | 901 | stlibrd_t *brdp; |
902 | int nrargs, i; | 902 | int i; |
903 | 903 | ||
904 | #ifdef DEBUG | 904 | #ifdef DEBUG |
905 | printk("stli_argbrds()\n"); | 905 | printk("stli_argbrds()\n"); |
906 | #endif | 906 | #endif |
907 | 907 | ||
908 | nrargs = sizeof(stli_brdsp) / sizeof(char **); | 908 | for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) { |
909 | |||
910 | for (i = stli_nrbrds; (i < nrargs); i++) { | ||
911 | memset(&conf, 0, sizeof(conf)); | 909 | memset(&conf, 0, sizeof(conf)); |
912 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) | 910 | if (stli_parsebrd(&conf, stli_brdsp[i]) == 0) |
913 | continue; | 911 | continue; |
@@ -967,7 +965,7 @@ static unsigned long stli_atol(char *str) | |||
967 | static int stli_parsebrd(stlconf_t *confp, char **argp) | 965 | static int stli_parsebrd(stlconf_t *confp, char **argp) |
968 | { | 966 | { |
969 | char *sp; | 967 | char *sp; |
970 | int nrbrdnames, i; | 968 | int i; |
971 | 969 | ||
972 | #ifdef DEBUG | 970 | #ifdef DEBUG |
973 | printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); | 971 | printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); |
@@ -979,14 +977,13 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) | |||
979 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) | 977 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) |
980 | *sp = TOLOWER(*sp); | 978 | *sp = TOLOWER(*sp); |
981 | 979 | ||
982 | nrbrdnames = sizeof(stli_brdstr) / sizeof(stlibrdtype_t); | 980 | for (i = 0; i < ARRAY_SIZE(stli_brdstr); i++) { |
983 | for (i = 0; (i < nrbrdnames); i++) { | ||
984 | if (strcmp(stli_brdstr[i].name, argp[0]) == 0) | 981 | if (strcmp(stli_brdstr[i].name, argp[0]) == 0) |
985 | break; | 982 | break; |
986 | } | 983 | } |
987 | if (i >= nrbrdnames) { | 984 | if (i == ARRAY_SIZE(stli_brdstr)) { |
988 | printk("STALLION: unknown board name, %s?\n", argp[0]); | 985 | printk("STALLION: unknown board name, %s?\n", argp[0]); |
989 | return(0); | 986 | return 0; |
990 | } | 987 | } |
991 | 988 | ||
992 | confp->brdtype = stli_brdstr[i].type; | 989 | confp->brdtype = stli_brdstr[i].type; |
@@ -2714,17 +2711,13 @@ static void stli_read(stlibrd_t *brdp, stliport_t *portp) | |||
2714 | stlen = size - tail; | 2711 | stlen = size - tail; |
2715 | } | 2712 | } |
2716 | 2713 | ||
2717 | len = MIN(len, (TTY_FLIPBUF_SIZE - tty->flip.count)); | 2714 | len = tty_buffer_request_room(tty, len); |
2715 | /* FIXME : iomap ? */ | ||
2718 | shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); | 2716 | shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset); |
2719 | 2717 | ||
2720 | while (len > 0) { | 2718 | while (len > 0) { |
2721 | stlen = MIN(len, stlen); | 2719 | stlen = MIN(len, stlen); |
2722 | memcpy(tty->flip.char_buf_ptr, (char *) (shbuf + tail), stlen); | 2720 | tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen); |
2723 | memset(tty->flip.flag_buf_ptr, 0, stlen); | ||
2724 | tty->flip.char_buf_ptr += stlen; | ||
2725 | tty->flip.flag_buf_ptr += stlen; | ||
2726 | tty->flip.count += stlen; | ||
2727 | |||
2728 | len -= stlen; | 2721 | len -= stlen; |
2729 | tail += stlen; | 2722 | tail += stlen; |
2730 | if (tail >= size) { | 2723 | if (tail >= size) { |
@@ -2909,16 +2902,12 @@ static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) | |||
2909 | 2902 | ||
2910 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { | 2903 | if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) { |
2911 | if (tty != (struct tty_struct *) NULL) { | 2904 | if (tty != (struct tty_struct *) NULL) { |
2912 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 2905 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2913 | tty->flip.count++; | 2906 | if (portp->flags & ASYNC_SAK) { |
2914 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 2907 | do_SAK(tty); |
2915 | *tty->flip.char_buf_ptr++ = 0; | 2908 | EBRDENABLE(brdp); |
2916 | if (portp->flags & ASYNC_SAK) { | ||
2917 | do_SAK(tty); | ||
2918 | EBRDENABLE(brdp); | ||
2919 | } | ||
2920 | tty_schedule_flip(tty); | ||
2921 | } | 2909 | } |
2910 | tty_schedule_flip(tty); | ||
2922 | } | 2911 | } |
2923 | } | 2912 | } |
2924 | 2913 | ||
@@ -4943,7 +4932,7 @@ static int stli_portcmdstats(stliport_t *portp) | |||
4943 | if (portp->tty != (struct tty_struct *) NULL) { | 4932 | if (portp->tty != (struct tty_struct *) NULL) { |
4944 | if (portp->tty->driver_data == portp) { | 4933 | if (portp->tty->driver_data == portp) { |
4945 | stli_comstats.ttystate = portp->tty->flags; | 4934 | stli_comstats.ttystate = portp->tty->flags; |
4946 | stli_comstats.rxbuffered = portp->tty->flip.count; | 4935 | stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/; |
4947 | if (portp->tty->termios != (struct termios *) NULL) { | 4936 | if (portp->tty->termios != (struct termios *) NULL) { |
4948 | stli_comstats.cflags = portp->tty->termios->c_cflag; | 4937 | stli_comstats.cflags = portp->tty->termios->c_cflag; |
4949 | stli_comstats.iflags = portp->tty->termios->c_iflag; | 4938 | stli_comstats.iflags = portp->tty->termios->c_iflag; |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 79e490ef2cf2..5e3ef5522194 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -269,7 +269,7 @@ static int MoxaPortDCDChange(int); | |||
269 | static int MoxaPortDCDON(int); | 269 | static int MoxaPortDCDON(int); |
270 | static void MoxaPortFlushData(int, int); | 270 | static void MoxaPortFlushData(int, int); |
271 | static int MoxaPortWriteData(int, unsigned char *, int); | 271 | static int MoxaPortWriteData(int, unsigned char *, int); |
272 | static int MoxaPortReadData(int, unsigned char *, int); | 272 | static int MoxaPortReadData(int, struct tty_struct *tty); |
273 | static int MoxaPortTxQueue(int); | 273 | static int MoxaPortTxQueue(int); |
274 | static int MoxaPortRxQueue(int); | 274 | static int MoxaPortRxQueue(int); |
275 | static int MoxaPortTxFree(int); | 275 | static int MoxaPortTxFree(int); |
@@ -301,6 +301,8 @@ static struct tty_operations moxa_ops = { | |||
301 | .tiocmset = moxa_tiocmset, | 301 | .tiocmset = moxa_tiocmset, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | static spinlock_t moxa_lock = SPIN_LOCK_UNLOCKED; | ||
305 | |||
304 | #ifdef CONFIG_PCI | 306 | #ifdef CONFIG_PCI |
305 | static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf * board) | 307 | static int moxa_get_PCI_conf(struct pci_dev *p, int board_type, moxa_board_conf * board) |
306 | { | 308 | { |
@@ -448,7 +450,7 @@ static int __init moxa_init(void) | |||
448 | #ifdef CONFIG_PCI | 450 | #ifdef CONFIG_PCI |
449 | { | 451 | { |
450 | struct pci_dev *p = NULL; | 452 | struct pci_dev *p = NULL; |
451 | int n = (sizeof(moxa_pcibrds) / sizeof(moxa_pcibrds[0])) - 1; | 453 | int n = ARRAY_SIZE(moxa_pcibrds) - 1; |
452 | i = 0; | 454 | i = 0; |
453 | while (i < n) { | 455 | while (i < n) { |
454 | while ((p = pci_get_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL) | 456 | while ((p = pci_get_device(moxa_pcibrds[i].vendor, moxa_pcibrds[i].device, p))!=NULL) |
@@ -645,10 +647,10 @@ static int moxa_write(struct tty_struct *tty, | |||
645 | if (ch == NULL) | 647 | if (ch == NULL) |
646 | return (0); | 648 | return (0); |
647 | port = ch->port; | 649 | port = ch->port; |
648 | save_flags(flags); | 650 | |
649 | cli(); | 651 | spin_lock_irqsave(&moxa_lock, flags); |
650 | len = MoxaPortWriteData(port, (unsigned char *) buf, count); | 652 | len = MoxaPortWriteData(port, (unsigned char *) buf, count); |
651 | restore_flags(flags); | 653 | spin_unlock_irqrestore(&moxa_lock, flags); |
652 | 654 | ||
653 | /********************************************* | 655 | /********************************************* |
654 | if ( !(ch->statusflags & LOWWAIT) && | 656 | if ( !(ch->statusflags & LOWWAIT) && |
@@ -723,11 +725,10 @@ static void moxa_put_char(struct tty_struct *tty, unsigned char c) | |||
723 | if (ch == NULL) | 725 | if (ch == NULL) |
724 | return; | 726 | return; |
725 | port = ch->port; | 727 | port = ch->port; |
726 | save_flags(flags); | 728 | spin_lock_irqsave(&moxa_lock, flags); |
727 | cli(); | ||
728 | moxaXmitBuff[0] = c; | 729 | moxaXmitBuff[0] = c; |
729 | MoxaPortWriteData(port, moxaXmitBuff, 1); | 730 | MoxaPortWriteData(port, moxaXmitBuff, 1); |
730 | restore_flags(flags); | 731 | spin_unlock_irqrestore(&moxa_lock, flags); |
731 | /************************************************ | 732 | /************************************************ |
732 | if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) ) | 733 | if ( !(ch->statusflags & LOWWAIT) && (MoxaPortTxFree(port) <= 100) ) |
733 | *************************************************/ | 734 | *************************************************/ |
@@ -1030,12 +1031,12 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp, | |||
1030 | printk("block_til_ready before block: ttys%d, count = %d\n", | 1031 | printk("block_til_ready before block: ttys%d, count = %d\n", |
1031 | ch->line, ch->count); | 1032 | ch->line, ch->count); |
1032 | #endif | 1033 | #endif |
1033 | save_flags(flags); | 1034 | spin_lock_irqsave(&moxa_lock, flags); |
1034 | cli(); | ||
1035 | if (!tty_hung_up_p(filp)) | 1035 | if (!tty_hung_up_p(filp)) |
1036 | ch->count--; | 1036 | ch->count--; |
1037 | restore_flags(flags); | ||
1038 | ch->blocked_open++; | 1037 | ch->blocked_open++; |
1038 | spin_unlock_irqrestore(&moxa_lock, flags); | ||
1039 | |||
1039 | while (1) { | 1040 | while (1) { |
1040 | set_current_state(TASK_INTERRUPTIBLE); | 1041 | set_current_state(TASK_INTERRUPTIBLE); |
1041 | if (tty_hung_up_p(filp) || | 1042 | if (tty_hung_up_p(filp) || |
@@ -1062,17 +1063,21 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp, | |||
1062 | } | 1063 | } |
1063 | set_current_state(TASK_RUNNING); | 1064 | set_current_state(TASK_RUNNING); |
1064 | remove_wait_queue(&ch->open_wait, &wait); | 1065 | remove_wait_queue(&ch->open_wait, &wait); |
1066 | |||
1067 | spin_lock_irqsave(&moxa_lock, flags); | ||
1065 | if (!tty_hung_up_p(filp)) | 1068 | if (!tty_hung_up_p(filp)) |
1066 | ch->count++; | 1069 | ch->count++; |
1067 | ch->blocked_open--; | 1070 | ch->blocked_open--; |
1071 | spin_unlock_irqrestore(&moxa_lock, flags); | ||
1068 | #ifdef SERIAL_DEBUG_OPEN | 1072 | #ifdef SERIAL_DEBUG_OPEN |
1069 | printk("block_til_ready after blocking: ttys%d, count = %d\n", | 1073 | printk("block_til_ready after blocking: ttys%d, count = %d\n", |
1070 | ch->line, ch->count); | 1074 | ch->line, ch->count); |
1071 | #endif | 1075 | #endif |
1072 | if (retval) | 1076 | if (retval) |
1073 | return (retval); | 1077 | return (retval); |
1078 | /* FIXME: review to see if we need to use set_bit on these */ | ||
1074 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; | 1079 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; |
1075 | return (0); | 1080 | return 0; |
1076 | } | 1081 | } |
1077 | 1082 | ||
1078 | static void setup_empty_event(struct tty_struct *tty) | 1083 | static void setup_empty_event(struct tty_struct *tty) |
@@ -1080,15 +1085,14 @@ static void setup_empty_event(struct tty_struct *tty) | |||
1080 | struct moxa_str *ch = tty->driver_data; | 1085 | struct moxa_str *ch = tty->driver_data; |
1081 | unsigned long flags; | 1086 | unsigned long flags; |
1082 | 1087 | ||
1083 | save_flags(flags); | 1088 | spin_lock_irqsave(&moxa_lock, flags); |
1084 | cli(); | ||
1085 | ch->statusflags |= EMPTYWAIT; | 1089 | ch->statusflags |= EMPTYWAIT; |
1086 | moxaEmptyTimer_on[ch->port] = 0; | 1090 | moxaEmptyTimer_on[ch->port] = 0; |
1087 | del_timer(&moxaEmptyTimer[ch->port]); | 1091 | del_timer(&moxaEmptyTimer[ch->port]); |
1088 | moxaEmptyTimer[ch->port].expires = jiffies + HZ; | 1092 | moxaEmptyTimer[ch->port].expires = jiffies + HZ; |
1089 | moxaEmptyTimer_on[ch->port] = 1; | 1093 | moxaEmptyTimer_on[ch->port] = 1; |
1090 | add_timer(&moxaEmptyTimer[ch->port]); | 1094 | add_timer(&moxaEmptyTimer[ch->port]); |
1091 | restore_flags(flags); | 1095 | spin_unlock_irqrestore(&moxa_lock, flags); |
1092 | } | 1096 | } |
1093 | 1097 | ||
1094 | static void check_xmit_empty(unsigned long data) | 1098 | static void check_xmit_empty(unsigned long data) |
@@ -1135,8 +1139,6 @@ static void receive_data(struct moxa_str *ch) | |||
1135 | { | 1139 | { |
1136 | struct tty_struct *tp; | 1140 | struct tty_struct *tp; |
1137 | struct termios *ts; | 1141 | struct termios *ts; |
1138 | int i, count, rc, space; | ||
1139 | unsigned char *charptr, *flagptr; | ||
1140 | unsigned long flags; | 1142 | unsigned long flags; |
1141 | 1143 | ||
1142 | ts = NULL; | 1144 | ts = NULL; |
@@ -1150,24 +1152,10 @@ static void receive_data(struct moxa_str *ch) | |||
1150 | MoxaPortFlushData(ch->port, 0); | 1152 | MoxaPortFlushData(ch->port, 0); |
1151 | return; | 1153 | return; |
1152 | } | 1154 | } |
1153 | space = TTY_FLIPBUF_SIZE - tp->flip.count; | 1155 | spin_lock_irqsave(&moxa_lock, flags); |
1154 | if (space <= 0) | 1156 | MoxaPortReadData(ch->port, tp); |
1155 | return; | 1157 | spin_unlock_irqrestore(&moxa_lock, flags); |
1156 | charptr = tp->flip.char_buf_ptr; | 1158 | tty_schedule_flip(tp); |
1157 | flagptr = tp->flip.flag_buf_ptr; | ||
1158 | rc = tp->flip.count; | ||
1159 | save_flags(flags); | ||
1160 | cli(); | ||
1161 | count = MoxaPortReadData(ch->port, charptr, space); | ||
1162 | restore_flags(flags); | ||
1163 | for (i = 0; i < count; i++) | ||
1164 | *flagptr++ = 0; | ||
1165 | charptr += count; | ||
1166 | rc += count; | ||
1167 | tp->flip.count = rc; | ||
1168 | tp->flip.char_buf_ptr = charptr; | ||
1169 | tp->flip.flag_buf_ptr = flagptr; | ||
1170 | tty_schedule_flip(ch->tty); | ||
1171 | } | 1159 | } |
1172 | 1160 | ||
1173 | #define Magic_code 0x404 | 1161 | #define Magic_code 0x404 |
@@ -1774,7 +1762,7 @@ int MoxaPortsOfCard(int cardno) | |||
1774 | * 14. MoxaPortDCDON(int port); * | 1762 | * 14. MoxaPortDCDON(int port); * |
1775 | * 15. MoxaPortFlushData(int port, int mode); * | 1763 | * 15. MoxaPortFlushData(int port, int mode); * |
1776 | * 16. MoxaPortWriteData(int port, unsigned char * buffer, int length); * | 1764 | * 16. MoxaPortWriteData(int port, unsigned char * buffer, int length); * |
1777 | * 17. MoxaPortReadData(int port, unsigned char * buffer, int length); * | 1765 | * 17. MoxaPortReadData(int port, struct tty_struct *tty); * |
1778 | * 18. MoxaPortTxBufSize(int port); * | 1766 | * 18. MoxaPortTxBufSize(int port); * |
1779 | * 19. MoxaPortRxBufSize(int port); * | 1767 | * 19. MoxaPortRxBufSize(int port); * |
1780 | * 20. MoxaPortTxQueue(int port); * | 1768 | * 20. MoxaPortTxQueue(int port); * |
@@ -2003,10 +1991,9 @@ int MoxaPortsOfCard(int cardno) | |||
2003 | * | 1991 | * |
2004 | * Function 21: Read data. | 1992 | * Function 21: Read data. |
2005 | * Syntax: | 1993 | * Syntax: |
2006 | * int MoxaPortReadData(int port, unsigned char * buffer, int length); | 1994 | * int MoxaPortReadData(int port, struct tty_struct *tty); |
2007 | * int port : port number (0 - 127) | 1995 | * int port : port number (0 - 127) |
2008 | * unsigned char * buffer : pointer to read data buffer. | 1996 | * struct tty_struct *tty : tty for data |
2009 | * int length : read data buffer length | ||
2010 | * | 1997 | * |
2011 | * return: 0 - length : real read data length | 1998 | * return: 0 - length : real read data length |
2012 | * | 1999 | * |
@@ -2504,7 +2491,7 @@ int MoxaPortWriteData(int port, unsigned char * buffer, int len) | |||
2504 | return (total); | 2491 | return (total); |
2505 | } | 2492 | } |
2506 | 2493 | ||
2507 | int MoxaPortReadData(int port, unsigned char * buffer, int space) | 2494 | int MoxaPortReadData(int port, struct tty_struct *tty) |
2508 | { | 2495 | { |
2509 | register ushort head, pageofs; | 2496 | register ushort head, pageofs; |
2510 | int i, count, cnt, len, total, remain; | 2497 | int i, count, cnt, len, total, remain; |
@@ -2522,9 +2509,9 @@ int MoxaPortReadData(int port, unsigned char * buffer, int space) | |||
2522 | count = (tail >= head) ? (tail - head) | 2509 | count = (tail >= head) ? (tail - head) |
2523 | : (tail - head + rx_mask + 1); | 2510 | : (tail - head + rx_mask + 1); |
2524 | if (count == 0) | 2511 | if (count == 0) |
2525 | return (0); | 2512 | return 0; |
2526 | 2513 | ||
2527 | total = (space > count) ? count : space; | 2514 | total = count; |
2528 | remain = count - total; | 2515 | remain = count - total; |
2529 | moxaLog.rxcnt[port] += total; | 2516 | moxaLog.rxcnt[port] += total; |
2530 | count = total; | 2517 | count = total; |
@@ -2539,7 +2526,7 @@ int MoxaPortReadData(int port, unsigned char * buffer, int space) | |||
2539 | len = (count > len) ? len : count; | 2526 | len = (count > len) ? len : count; |
2540 | ofs = baseAddr + DynPage_addr + bufhead + head; | 2527 | ofs = baseAddr + DynPage_addr + bufhead + head; |
2541 | for (i = 0; i < len; i++) | 2528 | for (i = 0; i < len; i++) |
2542 | *buffer++ = readb(ofs + i); | 2529 | tty_insert_flip_char(tty, readb(ofs + i), TTY_NORMAL); |
2543 | head = (head + len) & rx_mask; | 2530 | head = (head + len) & rx_mask; |
2544 | count -= len; | 2531 | count -= len; |
2545 | } | 2532 | } |
@@ -2556,7 +2543,7 @@ int MoxaPortReadData(int port, unsigned char * buffer, int space) | |||
2556 | writew(pageno, baseAddr + Control_reg); | 2543 | writew(pageno, baseAddr + Control_reg); |
2557 | ofs = baseAddr + DynPage_addr + pageofs; | 2544 | ofs = baseAddr + DynPage_addr + pageofs; |
2558 | for (i = 0; i < cnt; i++) | 2545 | for (i = 0; i < cnt; i++) |
2559 | *buffer++ = readb(ofs + i); | 2546 | tty_insert_flip_char(tty, readb(ofs + i), TTY_NORMAL); |
2560 | if (count == 0) { | 2547 | if (count == 0) { |
2561 | writew((head + len) & rx_mask, ofsAddr + RXrptr); | 2548 | writew((head + len) & rx_mask, ofsAddr + RXrptr); |
2562 | break; | 2549 | break; |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 26448f176803..ea725a9964e2 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -813,7 +813,7 @@ static int mxser_init(void) | |||
813 | 813 | ||
814 | /* start finding PCI board here */ | 814 | /* start finding PCI board here */ |
815 | #ifdef CONFIG_PCI | 815 | #ifdef CONFIG_PCI |
816 | n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1; | 816 | n = ARRAY_SIZE(mxser_pcibrds) - 1; |
817 | index = 0; | 817 | index = 0; |
818 | b = 0; | 818 | b = 0; |
819 | while (b < n) { | 819 | while (b < n) { |
@@ -1982,7 +1982,7 @@ static void mxser_receive_chars(struct mxser_struct *info, int *status) | |||
1982 | 1982 | ||
1983 | spin_lock_irqsave(&info->slock, flags); | 1983 | spin_lock_irqsave(&info->slock, flags); |
1984 | 1984 | ||
1985 | recv_room = tty->ldisc.receive_room(tty); | 1985 | recv_room = tty->receive_room; |
1986 | if ((recv_room == 0) && (!info->ldisc_stop_rx)) { | 1986 | if ((recv_room == 0) && (!info->ldisc_stop_rx)) { |
1987 | //mxser_throttle(tty); | 1987 | //mxser_throttle(tty); |
1988 | mxser_stoprx(tty); | 1988 | mxser_stoprx(tty); |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index a133a62f3d55..9f54733f1623 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -191,7 +191,6 @@ static unsigned int n_hdlc_tty_poll(struct tty_struct *tty, struct file *filp, | |||
191 | poll_table *wait); | 191 | poll_table *wait); |
192 | static int n_hdlc_tty_open(struct tty_struct *tty); | 192 | static int n_hdlc_tty_open(struct tty_struct *tty); |
193 | static void n_hdlc_tty_close(struct tty_struct *tty); | 193 | static void n_hdlc_tty_close(struct tty_struct *tty); |
194 | static int n_hdlc_tty_room(struct tty_struct *tty); | ||
195 | static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp, | 194 | static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *cp, |
196 | char *fp, int count); | 195 | char *fp, int count); |
197 | static void n_hdlc_tty_wakeup(struct tty_struct *tty); | 196 | static void n_hdlc_tty_wakeup(struct tty_struct *tty); |
@@ -212,7 +211,6 @@ static struct tty_ldisc n_hdlc_ldisc = { | |||
212 | .ioctl = n_hdlc_tty_ioctl, | 211 | .ioctl = n_hdlc_tty_ioctl, |
213 | .poll = n_hdlc_tty_poll, | 212 | .poll = n_hdlc_tty_poll, |
214 | .receive_buf = n_hdlc_tty_receive, | 213 | .receive_buf = n_hdlc_tty_receive, |
215 | .receive_room = n_hdlc_tty_room, | ||
216 | .write_wakeup = n_hdlc_tty_wakeup, | 214 | .write_wakeup = n_hdlc_tty_wakeup, |
217 | }; | 215 | }; |
218 | 216 | ||
@@ -337,6 +335,7 @@ static int n_hdlc_tty_open (struct tty_struct *tty) | |||
337 | 335 | ||
338 | tty->disc_data = n_hdlc; | 336 | tty->disc_data = n_hdlc; |
339 | n_hdlc->tty = tty; | 337 | n_hdlc->tty = tty; |
338 | tty->receive_room = 65536; | ||
340 | 339 | ||
341 | #if defined(TTY_NO_WRITE_SPLIT) | 340 | #if defined(TTY_NO_WRITE_SPLIT) |
342 | /* change tty_io write() to not split large writes into 8K chunks */ | 341 | /* change tty_io write() to not split large writes into 8K chunks */ |
@@ -478,22 +477,6 @@ static void n_hdlc_tty_wakeup(struct tty_struct *tty) | |||
478 | } /* end of n_hdlc_tty_wakeup() */ | 477 | } /* end of n_hdlc_tty_wakeup() */ |
479 | 478 | ||
480 | /** | 479 | /** |
481 | * n_hdlc_tty_room - Return the amount of space left in the receiver's buffer | ||
482 | * @tty - pointer to associated tty instance data | ||
483 | * | ||
484 | * Callback function from tty driver. Return the amount of space left in the | ||
485 | * receiver's buffer to decide if remote transmitter is to be throttled. | ||
486 | */ | ||
487 | static int n_hdlc_tty_room(struct tty_struct *tty) | ||
488 | { | ||
489 | if (debuglevel >= DEBUG_LEVEL_INFO) | ||
490 | printk("%s(%d)n_hdlc_tty_room() called\n",__FILE__,__LINE__); | ||
491 | /* always return a larger number to prevent */ | ||
492 | /* throttling of remote transmitter. */ | ||
493 | return 65536; | ||
494 | } /* end of n_hdlc_tty_root() */ | ||
495 | |||
496 | /** | ||
497 | * n_hdlc_tty_receive - Called by tty driver when receive data is available | 480 | * n_hdlc_tty_receive - Called by tty driver when receive data is available |
498 | * @tty - pointer to tty instance data | 481 | * @tty - pointer to tty instance data |
499 | * @data - pointer to received data | 482 | * @data - pointer to received data |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 853c98cee64f..c48de09d68f0 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -147,7 +147,6 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file, | |||
147 | struct poll_table_struct *wait); | 147 | struct poll_table_struct *wait); |
148 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, | 148 | static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, |
149 | char *fp, int count); | 149 | char *fp, int count); |
150 | static int r3964_receive_room(struct tty_struct *tty); | ||
151 | 150 | ||
152 | static struct tty_ldisc tty_ldisc_N_R3964 = { | 151 | static struct tty_ldisc tty_ldisc_N_R3964 = { |
153 | .owner = THIS_MODULE, | 152 | .owner = THIS_MODULE, |
@@ -161,7 +160,6 @@ static struct tty_ldisc tty_ldisc_N_R3964 = { | |||
161 | .set_termios = r3964_set_termios, | 160 | .set_termios = r3964_set_termios, |
162 | .poll = r3964_poll, | 161 | .poll = r3964_poll, |
163 | .receive_buf = r3964_receive_buf, | 162 | .receive_buf = r3964_receive_buf, |
164 | .receive_room = r3964_receive_room, | ||
165 | }; | 163 | }; |
166 | 164 | ||
167 | 165 | ||
@@ -1119,6 +1117,7 @@ static int r3964_open(struct tty_struct *tty) | |||
1119 | pInfo->nRetry = 0; | 1117 | pInfo->nRetry = 0; |
1120 | 1118 | ||
1121 | tty->disc_data = pInfo; | 1119 | tty->disc_data = pInfo; |
1120 | tty->receive_room = 65536; | ||
1122 | 1121 | ||
1123 | init_timer(&pInfo->tmr); | 1122 | init_timer(&pInfo->tmr); |
1124 | pInfo->tmr.data = (unsigned long)pInfo; | 1123 | pInfo->tmr.data = (unsigned long)pInfo; |
@@ -1405,12 +1404,5 @@ static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
1405 | } | 1404 | } |
1406 | } | 1405 | } |
1407 | 1406 | ||
1408 | static int r3964_receive_room(struct tty_struct *tty) | ||
1409 | { | ||
1410 | TRACE_L("receive_room"); | ||
1411 | return -1; | ||
1412 | } | ||
1413 | |||
1414 | |||
1415 | MODULE_LICENSE("GPL"); | 1407 | MODULE_LICENSE("GPL"); |
1416 | MODULE_ALIAS_LDISC(N_R3964); | 1408 | MODULE_ALIAS_LDISC(N_R3964); |
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index c556f4d3ccd7..ccad7ae94541 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -78,7 +78,32 @@ static inline void free_buf(unsigned char *buf) | |||
78 | free_page((unsigned long) buf); | 78 | free_page((unsigned long) buf); |
79 | } | 79 | } |
80 | 80 | ||
81 | static inline void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | 81 | /** |
82 | * n_tty_set__room - receive space | ||
83 | * @tty: terminal | ||
84 | * | ||
85 | * Called by the driver to find out how much data it is | ||
86 | * permitted to feed to the line discipline without any being lost | ||
87 | * and thus to manage flow control. Not serialized. Answers for the | ||
88 | * "instant". | ||
89 | */ | ||
90 | |||
91 | static void n_tty_set_room(struct tty_struct *tty) | ||
92 | { | ||
93 | int left = N_TTY_BUF_SIZE - tty->read_cnt - 1; | ||
94 | |||
95 | /* | ||
96 | * If we are doing input canonicalization, and there are no | ||
97 | * pending newlines, let characters through without limit, so | ||
98 | * that erase characters will be handled. Other excess | ||
99 | * characters will be beeped. | ||
100 | */ | ||
101 | if (left <= 0) | ||
102 | left = tty->icanon && !tty->canon_data; | ||
103 | tty->receive_room = left; | ||
104 | } | ||
105 | |||
106 | static void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | ||
82 | { | 107 | { |
83 | if (tty->read_cnt < N_TTY_BUF_SIZE) { | 108 | if (tty->read_cnt < N_TTY_BUF_SIZE) { |
84 | tty->read_buf[tty->read_head] = c; | 109 | tty->read_buf[tty->read_head] = c; |
@@ -87,7 +112,7 @@ static inline void put_tty_queue_nolock(unsigned char c, struct tty_struct *tty) | |||
87 | } | 112 | } |
88 | } | 113 | } |
89 | 114 | ||
90 | static inline void put_tty_queue(unsigned char c, struct tty_struct *tty) | 115 | static void put_tty_queue(unsigned char c, struct tty_struct *tty) |
91 | { | 116 | { |
92 | unsigned long flags; | 117 | unsigned long flags; |
93 | /* | 118 | /* |
@@ -136,6 +161,7 @@ static void reset_buffer_flags(struct tty_struct *tty) | |||
136 | spin_unlock_irqrestore(&tty->read_lock, flags); | 161 | spin_unlock_irqrestore(&tty->read_lock, flags); |
137 | tty->canon_head = tty->canon_data = tty->erasing = 0; | 162 | tty->canon_head = tty->canon_data = tty->erasing = 0; |
138 | memset(&tty->read_flags, 0, sizeof tty->read_flags); | 163 | memset(&tty->read_flags, 0, sizeof tty->read_flags); |
164 | n_tty_set_room(tty); | ||
139 | check_unthrottle(tty); | 165 | check_unthrottle(tty); |
140 | } | 166 | } |
141 | 167 | ||
@@ -838,30 +864,6 @@ send_signal: | |||
838 | put_tty_queue(c, tty); | 864 | put_tty_queue(c, tty); |
839 | } | 865 | } |
840 | 866 | ||
841 | /** | ||
842 | * n_tty_receive_room - receive space | ||
843 | * @tty: terminal | ||
844 | * | ||
845 | * Called by the driver to find out how much data it is | ||
846 | * permitted to feed to the line discipline without any being lost | ||
847 | * and thus to manage flow control. Not serialized. Answers for the | ||
848 | * "instant". | ||
849 | */ | ||
850 | |||
851 | static int n_tty_receive_room(struct tty_struct *tty) | ||
852 | { | ||
853 | int left = N_TTY_BUF_SIZE - tty->read_cnt - 1; | ||
854 | |||
855 | /* | ||
856 | * If we are doing input canonicalization, and there are no | ||
857 | * pending newlines, let characters through without limit, so | ||
858 | * that erase characters will be handled. Other excess | ||
859 | * characters will be beeped. | ||
860 | */ | ||
861 | if (left <= 0) | ||
862 | left = tty->icanon && !tty->canon_data; | ||
863 | return left; | ||
864 | } | ||
865 | 867 | ||
866 | /** | 868 | /** |
867 | * n_tty_write_wakeup - asynchronous I/O notifier | 869 | * n_tty_write_wakeup - asynchronous I/O notifier |
@@ -953,6 +955,8 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
953 | tty->driver->flush_chars(tty); | 955 | tty->driver->flush_chars(tty); |
954 | } | 956 | } |
955 | 957 | ||
958 | n_tty_set_room(tty); | ||
959 | |||
956 | if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) { | 960 | if (!tty->icanon && (tty->read_cnt >= tty->minimum_to_wake)) { |
957 | kill_fasync(&tty->fasync, SIGIO, POLL_IN); | 961 | kill_fasync(&tty->fasync, SIGIO, POLL_IN); |
958 | if (waitqueue_active(&tty->read_wait)) | 962 | if (waitqueue_active(&tty->read_wait)) |
@@ -964,7 +968,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
964 | * mode. We don't want to throttle the driver if we're in | 968 | * mode. We don't want to throttle the driver if we're in |
965 | * canonical mode and don't have a newline yet! | 969 | * canonical mode and don't have a newline yet! |
966 | */ | 970 | */ |
967 | if (n_tty_receive_room(tty) < TTY_THRESHOLD_THROTTLE) { | 971 | if (tty->receive_room < TTY_THRESHOLD_THROTTLE) { |
968 | /* check TTY_THROTTLED first so it indicates our state */ | 972 | /* check TTY_THROTTLED first so it indicates our state */ |
969 | if (!test_and_set_bit(TTY_THROTTLED, &tty->flags) && | 973 | if (!test_and_set_bit(TTY_THROTTLED, &tty->flags) && |
970 | tty->driver->throttle) | 974 | tty->driver->throttle) |
@@ -999,6 +1003,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct termios * old) | |||
999 | if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { | 1003 | if (test_bit(TTY_HW_COOK_IN, &tty->flags)) { |
1000 | tty->raw = 1; | 1004 | tty->raw = 1; |
1001 | tty->real_raw = 1; | 1005 | tty->real_raw = 1; |
1006 | n_tty_set_room(tty); | ||
1002 | return; | 1007 | return; |
1003 | } | 1008 | } |
1004 | if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) || | 1009 | if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) || |
@@ -1051,6 +1056,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct termios * old) | |||
1051 | else | 1056 | else |
1052 | tty->real_raw = 0; | 1057 | tty->real_raw = 0; |
1053 | } | 1058 | } |
1059 | n_tty_set_room(tty); | ||
1054 | } | 1060 | } |
1055 | 1061 | ||
1056 | /** | 1062 | /** |
@@ -1130,7 +1136,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt) | |||
1130 | * | 1136 | * |
1131 | */ | 1137 | */ |
1132 | 1138 | ||
1133 | static inline int copy_from_read_buf(struct tty_struct *tty, | 1139 | static int copy_from_read_buf(struct tty_struct *tty, |
1134 | unsigned char __user **b, | 1140 | unsigned char __user **b, |
1135 | size_t *nr) | 1141 | size_t *nr) |
1136 | 1142 | ||
@@ -1308,6 +1314,7 @@ do_it_again: | |||
1308 | retval = -ERESTARTSYS; | 1314 | retval = -ERESTARTSYS; |
1309 | break; | 1315 | break; |
1310 | } | 1316 | } |
1317 | n_tty_set_room(tty); | ||
1311 | clear_bit(TTY_DONT_FLIP, &tty->flags); | 1318 | clear_bit(TTY_DONT_FLIP, &tty->flags); |
1312 | timeout = schedule_timeout(timeout); | 1319 | timeout = schedule_timeout(timeout); |
1313 | set_bit(TTY_DONT_FLIP, &tty->flags); | 1320 | set_bit(TTY_DONT_FLIP, &tty->flags); |
@@ -1401,6 +1408,8 @@ do_it_again: | |||
1401 | } else if (test_and_clear_bit(TTY_PUSH, &tty->flags)) | 1408 | } else if (test_and_clear_bit(TTY_PUSH, &tty->flags)) |
1402 | goto do_it_again; | 1409 | goto do_it_again; |
1403 | 1410 | ||
1411 | n_tty_set_room(tty); | ||
1412 | |||
1404 | return retval; | 1413 | return retval; |
1405 | } | 1414 | } |
1406 | 1415 | ||
@@ -1553,7 +1562,6 @@ struct tty_ldisc tty_ldisc_N_TTY = { | |||
1553 | normal_poll, /* poll */ | 1562 | normal_poll, /* poll */ |
1554 | NULL, /* hangup */ | 1563 | NULL, /* hangup */ |
1555 | n_tty_receive_buf, /* receive_buf */ | 1564 | n_tty_receive_buf, /* receive_buf */ |
1556 | n_tty_receive_room, /* receive_room */ | ||
1557 | n_tty_write_wakeup /* write_wakeup */ | 1565 | n_tty_write_wakeup /* write_wakeup */ |
1558 | }; | 1566 | }; |
1559 | 1567 | ||
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 1af733d07321..3556ccd77570 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c | |||
@@ -557,13 +557,13 @@ pc_proc_infos(unsigned char *nvram, char *buffer, int *len, | |||
557 | (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0); | 557 | (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0); |
558 | PRINT_PROC("Floppy 0 type : "); | 558 | PRINT_PROC("Floppy 0 type : "); |
559 | type = nvram[2] >> 4; | 559 | type = nvram[2] >> 4; |
560 | if (type < sizeof (floppy_types) / sizeof (*floppy_types)) | 560 | if (type < ARRAY_SIZE(floppy_types)) |
561 | PRINT_PROC("%s\n", floppy_types[type]); | 561 | PRINT_PROC("%s\n", floppy_types[type]); |
562 | else | 562 | else |
563 | PRINT_PROC("%d (unknown)\n", type); | 563 | PRINT_PROC("%d (unknown)\n", type); |
564 | PRINT_PROC("Floppy 1 type : "); | 564 | PRINT_PROC("Floppy 1 type : "); |
565 | type = nvram[2] & 0x0f; | 565 | type = nvram[2] & 0x0f; |
566 | if (type < sizeof (floppy_types) / sizeof (*floppy_types)) | 566 | if (type < ARRAY_SIZE(floppy_types)) |
567 | PRINT_PROC("%s\n", floppy_types[type]); | 567 | PRINT_PROC("%s\n", floppy_types[type]); |
568 | else | 568 | else |
569 | PRINT_PROC("%d (unknown)\n", type); | 569 | PRINT_PROC("%d (unknown)\n", type); |
@@ -843,8 +843,6 @@ static char *colors[] = { | |||
843 | "2", "4", "16", "256", "65536", "??", "??", "??" | 843 | "2", "4", "16", "256", "65536", "??", "??", "??" |
844 | }; | 844 | }; |
845 | 845 | ||
846 | #define fieldsize(a) (sizeof(a)/sizeof(*a)) | ||
847 | |||
848 | static int | 846 | static int |
849 | atari_proc_infos(unsigned char *nvram, char *buffer, int *len, | 847 | atari_proc_infos(unsigned char *nvram, char *buffer, int *len, |
850 | off_t *begin, off_t offset, int size) | 848 | off_t *begin, off_t offset, int size) |
@@ -856,7 +854,7 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len, | |||
856 | PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not "); | 854 | PRINT_PROC("Checksum status : %svalid\n", checksum ? "" : "not "); |
857 | 855 | ||
858 | PRINT_PROC("Boot preference : "); | 856 | PRINT_PROC("Boot preference : "); |
859 | for (i = fieldsize(boot_prefs) - 1; i >= 0; --i) { | 857 | for (i = ARRAY_SIZE(boot_prefs) - 1; i >= 0; --i) { |
860 | if (nvram[1] == boot_prefs[i].val) { | 858 | if (nvram[1] == boot_prefs[i].val) { |
861 | PRINT_PROC("%s\n", boot_prefs[i].name); | 859 | PRINT_PROC("%s\n", boot_prefs[i].name); |
862 | break; | 860 | break; |
@@ -878,12 +876,12 @@ atari_proc_infos(unsigned char *nvram, char *buffer, int *len, | |||
878 | return 1; | 876 | return 1; |
879 | 877 | ||
880 | PRINT_PROC("OS language : "); | 878 | PRINT_PROC("OS language : "); |
881 | if (nvram[6] < fieldsize(languages)) | 879 | if (nvram[6] < ARRAY_SIZE(languages)) |
882 | PRINT_PROC("%s\n", languages[nvram[6]]); | 880 | PRINT_PROC("%s\n", languages[nvram[6]]); |
883 | else | 881 | else |
884 | PRINT_PROC("%u (undefined)\n", nvram[6]); | 882 | PRINT_PROC("%u (undefined)\n", nvram[6]); |
885 | PRINT_PROC("Keyboard language: "); | 883 | PRINT_PROC("Keyboard language: "); |
886 | if (nvram[7] < fieldsize(languages)) | 884 | if (nvram[7] < ARRAY_SIZE(languages)) |
887 | PRINT_PROC("%s\n", languages[nvram[7]]); | 885 | PRINT_PROC("%s\n", languages[nvram[7]]); |
888 | else | 886 | else |
889 | PRINT_PROC("%u (undefined)\n", nvram[7]); | 887 | PRINT_PROC("%u (undefined)\n", nvram[7]); |
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index cf45b100eff1..8a8ca32822ba 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
@@ -1007,8 +1007,9 @@ static void rx_ready_hdlc(MGSLPC_INFO *info, int eom) | |||
1007 | 1007 | ||
1008 | static void rx_ready_async(MGSLPC_INFO *info, int tcd) | 1008 | static void rx_ready_async(MGSLPC_INFO *info, int tcd) |
1009 | { | 1009 | { |
1010 | unsigned char data, status; | 1010 | unsigned char data, status, flag; |
1011 | int fifo_count; | 1011 | int fifo_count; |
1012 | int work = 0; | ||
1012 | struct tty_struct *tty = info->tty; | 1013 | struct tty_struct *tty = info->tty; |
1013 | struct mgsl_icount *icount = &info->icount; | 1014 | struct mgsl_icount *icount = &info->icount; |
1014 | 1015 | ||
@@ -1023,20 +1024,16 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd) | |||
1023 | fifo_count = 32; | 1024 | fifo_count = 32; |
1024 | } else | 1025 | } else |
1025 | fifo_count = 32; | 1026 | fifo_count = 32; |
1026 | 1027 | ||
1028 | tty_buffer_request_room(tty, fifo_count); | ||
1027 | /* Flush received async data to receive data buffer. */ | 1029 | /* Flush received async data to receive data buffer. */ |
1028 | while (fifo_count) { | 1030 | while (fifo_count) { |
1029 | data = read_reg(info, CHA + RXFIFO); | 1031 | data = read_reg(info, CHA + RXFIFO); |
1030 | status = read_reg(info, CHA + RXFIFO); | 1032 | status = read_reg(info, CHA + RXFIFO); |
1031 | fifo_count -= 2; | 1033 | fifo_count -= 2; |
1032 | 1034 | ||
1033 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
1034 | break; | ||
1035 | |||
1036 | *tty->flip.char_buf_ptr = data; | ||
1037 | icount->rx++; | 1035 | icount->rx++; |
1038 | 1036 | flag = TTY_NORMAL; | |
1039 | *tty->flip.flag_buf_ptr = 0; | ||
1040 | 1037 | ||
1041 | // if no frameing/crc error then save data | 1038 | // if no frameing/crc error then save data |
1042 | // BIT7:parity error | 1039 | // BIT7:parity error |
@@ -1055,26 +1052,23 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd) | |||
1055 | status &= info->read_status_mask; | 1052 | status &= info->read_status_mask; |
1056 | 1053 | ||
1057 | if (status & BIT7) | 1054 | if (status & BIT7) |
1058 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 1055 | flag = TTY_PARITY; |
1059 | else if (status & BIT6) | 1056 | else if (status & BIT6) |
1060 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 1057 | flag = TTY_FRAME; |
1061 | } | 1058 | } |
1062 | 1059 | work += tty_insert_flip_char(tty, data, flag); | |
1063 | tty->flip.flag_buf_ptr++; | ||
1064 | tty->flip.char_buf_ptr++; | ||
1065 | tty->flip.count++; | ||
1066 | } | 1060 | } |
1067 | issue_command(info, CHA, CMD_RXFIFO); | 1061 | issue_command(info, CHA, CMD_RXFIFO); |
1068 | 1062 | ||
1069 | if (debug_level >= DEBUG_LEVEL_ISR) { | 1063 | if (debug_level >= DEBUG_LEVEL_ISR) { |
1070 | printk("%s(%d):rx_ready_async count=%d\n", | 1064 | printk("%s(%d):rx_ready_async", |
1071 | __FILE__,__LINE__,tty->flip.count); | 1065 | __FILE__,__LINE__); |
1072 | printk("%s(%d):rx=%d brk=%d parity=%d frame=%d overrun=%d\n", | 1066 | printk("%s(%d):rx=%d brk=%d parity=%d frame=%d overrun=%d\n", |
1073 | __FILE__,__LINE__,icount->rx,icount->brk, | 1067 | __FILE__,__LINE__,icount->rx,icount->brk, |
1074 | icount->parity,icount->frame,icount->overrun); | 1068 | icount->parity,icount->frame,icount->overrun); |
1075 | } | 1069 | } |
1076 | 1070 | ||
1077 | if (tty->flip.count) | 1071 | if (work) |
1078 | tty_flip_buffer_push(tty); | 1072 | tty_flip_buffer_push(tty); |
1079 | } | 1073 | } |
1080 | 1074 | ||
@@ -4005,7 +3999,7 @@ BOOLEAN register_test(MGSLPC_INFO *info) | |||
4005 | { | 3999 | { |
4006 | static unsigned char patterns[] = | 4000 | static unsigned char patterns[] = |
4007 | { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; | 4001 | { 0x00, 0xff, 0xaa, 0x55, 0x69, 0x96, 0x0f }; |
4008 | static unsigned int count = sizeof(patterns) / sizeof(patterns[0]); | 4002 | static unsigned int count = ARRAY_SIZE(patterns); |
4009 | unsigned int i; | 4003 | unsigned int i; |
4010 | BOOLEAN rc = TRUE; | 4004 | BOOLEAN rc = TRUE; |
4011 | unsigned long flags; | 4005 | unsigned long flags; |
@@ -4016,7 +4010,7 @@ BOOLEAN register_test(MGSLPC_INFO *info) | |||
4016 | for (i = 0; i < count; i++) { | 4010 | for (i = 0; i < count; i++) { |
4017 | write_reg(info, XAD1, patterns[i]); | 4011 | write_reg(info, XAD1, patterns[i]); |
4018 | write_reg(info, XAD2, patterns[(i + 1) % count]); | 4012 | write_reg(info, XAD2, patterns[(i + 1) % count]); |
4019 | if ((read_reg(info, XAD1) != patterns[i]) || | 4013 | if ((read_reg(info, XAD1) != patterns[i]) || |
4020 | (read_reg(info, XAD2) != patterns[(i + 1) % count])) { | 4014 | (read_reg(info, XAD2) != patterns[(i + 1) % count])) { |
4021 | rc = FALSE; | 4015 | rc = FALSE; |
4022 | break; | 4016 | break; |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 49f3997fd251..9b5a2c0e7008 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -111,7 +111,7 @@ static int pty_write(struct tty_struct * tty, const unsigned char *buf, int coun | |||
111 | if (!to || tty->stopped) | 111 | if (!to || tty->stopped) |
112 | return 0; | 112 | return 0; |
113 | 113 | ||
114 | c = to->ldisc.receive_room(to); | 114 | c = to->receive_room; |
115 | if (c > count) | 115 | if (c > count) |
116 | c = count; | 116 | c = count; |
117 | to->ldisc.receive_buf(to, buf, NULL, c); | 117 | to->ldisc.receive_buf(to, buf, NULL, c); |
@@ -126,7 +126,7 @@ static int pty_write_room(struct tty_struct *tty) | |||
126 | if (!to || tty->stopped) | 126 | if (!to || tty->stopped) |
127 | return 0; | 127 | return 0; |
128 | 128 | ||
129 | return to->ldisc.receive_room(to); | 129 | return to->receive_room; |
130 | } | 130 | } |
131 | 131 | ||
132 | /* | 132 | /* |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index d7d484024e2b..7085a38532b3 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -56,10 +56,6 @@ | |||
56 | #include <linux/generic_serial.h> | 56 | #include <linux/generic_serial.h> |
57 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
58 | 58 | ||
59 | #if BITS_PER_LONG != 32 | ||
60 | # error FIXME: this driver only works on 32-bit platforms | ||
61 | #endif | ||
62 | |||
63 | #include "linux_compat.h" | 59 | #include "linux_compat.h" |
64 | #include "typdef.h" | 60 | #include "typdef.h" |
65 | #include "pkt.h" | 61 | #include "pkt.h" |
@@ -215,7 +211,7 @@ static int rio_poll = 1; | |||
215 | or less.... */ | 211 | or less.... */ |
216 | static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; | 212 | static int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; |
217 | 213 | ||
218 | #define NR_RIO_ADDRS (sizeof(rio_probe_addrs)/sizeof (int)) | 214 | #define NR_RIO_ADDRS ARRAY_SIZE(rio_probe_addrs) |
219 | 215 | ||
220 | 216 | ||
221 | /* Set the mask to all-ones. This alas, only supports 32 interrupts. | 217 | /* Set the mask to all-ones. This alas, only supports 32 interrupts. |
diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index e42e7b50bf6b..ddda9c14e059 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c | |||
@@ -38,6 +38,7 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
40 | #include <linux/tty.h> | 40 | #include <linux/tty.h> |
41 | #include <linux/tty_flip.h> | ||
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | #include <asm/system.h> | 43 | #include <asm/system.h> |
43 | #include <asm/string.h> | 44 | #include <asm/string.h> |
@@ -560,6 +561,7 @@ struct Port * PortP; | |||
560 | struct PKT *PacketP; | 561 | struct PKT *PacketP; |
561 | register uint DataCnt; | 562 | register uint DataCnt; |
562 | uchar * ptr; | 563 | uchar * ptr; |
564 | unsigned char *buf; | ||
563 | int copied =0; | 565 | int copied =0; |
564 | 566 | ||
565 | static int intCount, RxIntCnt; | 567 | static int intCount, RxIntCnt; |
@@ -657,8 +659,7 @@ struct Port * PortP; | |||
657 | ** and available space. | 659 | ** and available space. |
658 | */ | 660 | */ |
659 | 661 | ||
660 | transCount = min_t(unsigned int, PacketP->len & PKT_LEN_MASK, | 662 | transCount = tty_buffer_request_room(TtyP, PacketP->len & PKT_LEN_MASK); |
661 | TTY_FLIPBUF_SIZE - TtyP->flip.count); | ||
662 | rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", | 663 | rio_dprintk (RIO_DEBUG_REC, "port %d: Copy %d bytes\n", |
663 | PortP->PortNum, transCount); | 664 | PortP->PortNum, transCount); |
664 | /* | 665 | /* |
@@ -678,9 +679,8 @@ struct Port * PortP; | |||
678 | #endif | 679 | #endif |
679 | ptr = (uchar *) PacketP->data + PortP->RxDataStart; | 680 | ptr = (uchar *) PacketP->data + PortP->RxDataStart; |
680 | 681 | ||
681 | rio_memcpy_fromio (TtyP->flip.char_buf_ptr, ptr, transCount); | 682 | tty_prepare_flip_string(TtyP, &buf, transCount); |
682 | memset(TtyP->flip.flag_buf_ptr, TTY_NORMAL, transCount); | 683 | rio_memcpy_fromio (buf, ptr, transCount); |
683 | |||
684 | #ifdef STATS | 684 | #ifdef STATS |
685 | /* | 685 | /* |
686 | ** keep a count for statistical purposes | 686 | ** keep a count for statistical purposes |
@@ -690,9 +690,6 @@ struct Port * PortP; | |||
690 | PortP->RxDataStart += transCount; | 690 | PortP->RxDataStart += transCount; |
691 | PacketP->len -= transCount; | 691 | PacketP->len -= transCount; |
692 | copied += transCount; | 692 | copied += transCount; |
693 | TtyP->flip.count += transCount; | ||
694 | TtyP->flip.char_buf_ptr += transCount; | ||
695 | TtyP->flip.flag_buf_ptr += transCount; | ||
696 | 693 | ||
697 | 694 | ||
698 | #ifdef ___DEBUG_IT___ | 695 | #ifdef ___DEBUG_IT___ |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 55a3a0188eda..050e70ee5920 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/major.h> | 46 | #include <linux/major.h> |
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 | 50 | ||
50 | #include <asm/uaccess.h> | 51 | #include <asm/uaccess.h> |
51 | 52 | ||
@@ -107,15 +108,15 @@ static struct riscom_port rc_port[RC_NBOARD * RC_NPORT]; | |||
107 | 108 | ||
108 | /* RISCom/8 I/O ports addresses (without address translation) */ | 109 | /* RISCom/8 I/O ports addresses (without address translation) */ |
109 | static unsigned short rc_ioport[] = { | 110 | static unsigned short rc_ioport[] = { |
110 | #if 1 | 111 | #if 1 |
111 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, | 112 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, |
112 | #else | 113 | #else |
113 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 0x10, | 114 | 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x09, 0x0a, 0x0b, 0x0c, 0x10, |
114 | 0x11, 0x12, 0x18, 0x28, 0x31, 0x32, 0x39, 0x3a, 0x40, 0x41, 0x61, 0x62, | 115 | 0x11, 0x12, 0x18, 0x28, 0x31, 0x32, 0x39, 0x3a, 0x40, 0x41, 0x61, 0x62, |
115 | 0x63, 0x64, 0x6b, 0x70, 0x71, 0x78, 0x7a, 0x7b, 0x7f, 0x100, 0x101 | 116 | 0x63, 0x64, 0x6b, 0x70, 0x71, 0x78, 0x7a, 0x7b, 0x7f, 0x100, 0x101 |
116 | #endif | 117 | #endif |
117 | }; | 118 | }; |
118 | #define RC_NIOPORT (sizeof(rc_ioport) / sizeof(rc_ioport[0])) | 119 | #define RC_NIOPORT ARRAY_SIZE(rc_ioport) |
119 | 120 | ||
120 | 121 | ||
121 | static inline int rc_paranoia_check(struct riscom_port const * port, | 122 | static inline int rc_paranoia_check(struct riscom_port const * port, |
@@ -354,28 +355,17 @@ static inline void rc_receive_exc(struct riscom_board const * bp) | |||
354 | struct riscom_port *port; | 355 | struct riscom_port *port; |
355 | struct tty_struct *tty; | 356 | struct tty_struct *tty; |
356 | unsigned char status; | 357 | unsigned char status; |
357 | unsigned char ch; | 358 | unsigned char ch, flag; |
358 | 359 | ||
359 | if (!(port = rc_get_port(bp, "Receive"))) | 360 | if (!(port = rc_get_port(bp, "Receive"))) |
360 | return; | 361 | return; |
361 | 362 | ||
362 | tty = port->tty; | 363 | tty = port->tty; |
363 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
364 | printk(KERN_WARNING "rc%d: port %d: Working around flip " | ||
365 | "buffer overflow.\n", | ||
366 | board_No(bp), port_No(port)); | ||
367 | return; | ||
368 | } | ||
369 | 364 | ||
370 | #ifdef RC_REPORT_OVERRUN | 365 | #ifdef RC_REPORT_OVERRUN |
371 | status = rc_in(bp, CD180_RCSR); | 366 | status = rc_in(bp, CD180_RCSR); |
372 | if (status & RCSR_OE) { | 367 | if (status & RCSR_OE) |
373 | port->overrun++; | 368 | port->overrun++; |
374 | #if 0 | ||
375 | printk(KERN_ERR "rc%d: port %d: Overrun. Total %ld overruns\n", | ||
376 | board_No(bp), port_No(port), port->overrun); | ||
377 | #endif | ||
378 | } | ||
379 | status &= port->mark_mask; | 369 | status &= port->mark_mask; |
380 | #else | 370 | #else |
381 | status = rc_in(bp, CD180_RCSR) & port->mark_mask; | 371 | status = rc_in(bp, CD180_RCSR) & port->mark_mask; |
@@ -393,25 +383,24 @@ static inline void rc_receive_exc(struct riscom_board const * bp) | |||
393 | } else if (status & RCSR_BREAK) { | 383 | } else if (status & RCSR_BREAK) { |
394 | printk(KERN_INFO "rc%d: port %d: Handling break...\n", | 384 | printk(KERN_INFO "rc%d: port %d: Handling break...\n", |
395 | board_No(bp), port_No(port)); | 385 | board_No(bp), port_No(port)); |
396 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 386 | flag = TTY_BREAK; |
397 | if (port->flags & ASYNC_SAK) | 387 | if (port->flags & ASYNC_SAK) |
398 | do_SAK(tty); | 388 | do_SAK(tty); |
399 | 389 | ||
400 | } else if (status & RCSR_PE) | 390 | } else if (status & RCSR_PE) |
401 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | 391 | flag = TTY_PARITY; |
402 | 392 | ||
403 | else if (status & RCSR_FE) | 393 | else if (status & RCSR_FE) |
404 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 394 | flag = TTY_FRAME; |
405 | 395 | ||
406 | else if (status & RCSR_OE) | 396 | else if (status & RCSR_OE) |
407 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 397 | flag = TTY_OVERRUN; |
408 | 398 | ||
409 | else | 399 | else |
410 | *tty->flip.flag_buf_ptr++ = 0; | 400 | flag = TTY_NORMAL; |
411 | 401 | ||
412 | *tty->flip.char_buf_ptr++ = ch; | 402 | tty_insert_flip_char(tty, ch, flag); |
413 | tty->flip.count++; | 403 | tty_flip_buffer_push(tty); |
414 | schedule_delayed_work(&tty->flip.work, 1); | ||
415 | } | 404 | } |
416 | 405 | ||
417 | static inline void rc_receive(struct riscom_board const * bp) | 406 | static inline void rc_receive(struct riscom_board const * bp) |
@@ -432,17 +421,15 @@ static inline void rc_receive(struct riscom_board const * bp) | |||
432 | #endif | 421 | #endif |
433 | 422 | ||
434 | while (count--) { | 423 | while (count--) { |
435 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 424 | if (tty_buffer_request_room(tty, 1) == 0) { |
436 | printk(KERN_WARNING "rc%d: port %d: Working around " | 425 | printk(KERN_WARNING "rc%d: port %d: Working around " |
437 | "flip buffer overflow.\n", | 426 | "flip buffer overflow.\n", |
438 | board_No(bp), port_No(port)); | 427 | board_No(bp), port_No(port)); |
439 | break; | 428 | break; |
440 | } | 429 | } |
441 | *tty->flip.char_buf_ptr++ = rc_in(bp, CD180_RDR); | 430 | tty_insert_flip_char(tty, rc_in(bp, CD180_RDR), TTY_NORMAL); |
442 | *tty->flip.flag_buf_ptr++ = 0; | ||
443 | tty->flip.count++; | ||
444 | } | 431 | } |
445 | schedule_delayed_work(&tty->flip.work, 1); | 432 | tty_flip_buffer_push(tty); |
446 | } | 433 | } |
447 | 434 | ||
448 | static inline void rc_transmit(struct riscom_board const * bp) | 435 | static inline void rc_transmit(struct riscom_board const * bp) |
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index d3bc731fbb27..0949dcef0697 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -325,19 +325,16 @@ static void rp_do_receive(struct r_port *info, | |||
325 | { | 325 | { |
326 | unsigned int CharNStat; | 326 | unsigned int CharNStat; |
327 | int ToRecv, wRecv, space = 0, count; | 327 | int ToRecv, wRecv, space = 0, count; |
328 | unsigned char *cbuf; | 328 | unsigned char *cbuf, *chead; |
329 | char *fbuf; | 329 | char *fbuf, *fhead; |
330 | struct tty_ldisc *ld; | 330 | struct tty_ldisc *ld; |
331 | 331 | ||
332 | ld = tty_ldisc_ref(tty); | 332 | ld = tty_ldisc_ref(tty); |
333 | 333 | ||
334 | ToRecv = sGetRxCnt(cp); | 334 | ToRecv = sGetRxCnt(cp); |
335 | if (ld) | 335 | space = tty->receive_room; |
336 | space = ld->receive_room(tty); | ||
337 | if (space > 2 * TTY_FLIPBUF_SIZE) | 336 | if (space > 2 * TTY_FLIPBUF_SIZE) |
338 | space = 2 * TTY_FLIPBUF_SIZE; | 337 | space = 2 * TTY_FLIPBUF_SIZE; |
339 | cbuf = tty->flip.char_buf; | ||
340 | fbuf = tty->flip.flag_buf; | ||
341 | count = 0; | 338 | count = 0; |
342 | #ifdef ROCKET_DEBUG_INTR | 339 | #ifdef ROCKET_DEBUG_INTR |
343 | printk(KERN_INFO "rp_do_receive(%d, %d)...", ToRecv, space); | 340 | printk(KERN_INFO "rp_do_receive(%d, %d)...", ToRecv, space); |
@@ -350,9 +347,13 @@ static void rp_do_receive(struct r_port *info, | |||
350 | if (ToRecv > space) | 347 | if (ToRecv > space) |
351 | ToRecv = space; | 348 | ToRecv = space; |
352 | 349 | ||
350 | ToRecv = tty_prepare_flip_string_flags(tty, &chead, &fhead, ToRecv); | ||
353 | if (ToRecv <= 0) | 351 | if (ToRecv <= 0) |
354 | goto done; | 352 | goto done; |
355 | 353 | ||
354 | cbuf = chead; | ||
355 | fbuf = fhead; | ||
356 | |||
356 | /* | 357 | /* |
357 | * if status indicates there are errored characters in the | 358 | * if status indicates there are errored characters in the |
358 | * FIFO, then enter status mode (a word in FIFO holds | 359 | * FIFO, then enter status mode (a word in FIFO holds |
@@ -399,7 +400,7 @@ static void rp_do_receive(struct r_port *info, | |||
399 | else if (CharNStat & STMRCVROVRH) | 400 | else if (CharNStat & STMRCVROVRH) |
400 | *fbuf++ = TTY_OVERRUN; | 401 | *fbuf++ = TTY_OVERRUN; |
401 | else | 402 | else |
402 | *fbuf++ = 0; | 403 | *fbuf++ = TTY_NORMAL; |
403 | *cbuf++ = CharNStat & 0xff; | 404 | *cbuf++ = CharNStat & 0xff; |
404 | count++; | 405 | count++; |
405 | ToRecv--; | 406 | ToRecv--; |
@@ -426,13 +427,13 @@ static void rp_do_receive(struct r_port *info, | |||
426 | sInStrW(sGetTxRxDataIO(cp), (unsigned short *) cbuf, wRecv); | 427 | sInStrW(sGetTxRxDataIO(cp), (unsigned short *) cbuf, wRecv); |
427 | if (ToRecv & 1) | 428 | if (ToRecv & 1) |
428 | cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); | 429 | cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); |
429 | memset(fbuf, 0, ToRecv); | 430 | memset(fbuf, TTY_NORMAL, ToRecv); |
430 | cbuf += ToRecv; | 431 | cbuf += ToRecv; |
431 | fbuf += ToRecv; | 432 | fbuf += ToRecv; |
432 | count += ToRecv; | 433 | count += ToRecv; |
433 | } | 434 | } |
434 | /* Push the data up to the tty layer */ | 435 | /* Push the data up to the tty layer */ |
435 | ld->receive_buf(tty, tty->flip.char_buf, tty->flip.flag_buf, count); | 436 | ld->receive_buf(tty, cbuf, fbuf, count); |
436 | done: | 437 | done: |
437 | tty_ldisc_deref(ld); | 438 | tty_ldisc_deref(ld); |
438 | } | 439 | } |
diff --git a/drivers/char/selection.c b/drivers/char/selection.c index 5b187c895c18..71093a9fc462 100644 --- a/drivers/char/selection.c +++ b/drivers/char/selection.c | |||
@@ -275,7 +275,8 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t | |||
275 | int paste_selection(struct tty_struct *tty) | 275 | int paste_selection(struct tty_struct *tty) |
276 | { | 276 | { |
277 | struct vc_data *vc = (struct vc_data *)tty->driver_data; | 277 | struct vc_data *vc = (struct vc_data *)tty->driver_data; |
278 | int pasted = 0, count; | 278 | int pasted = 0; |
279 | unsigned int count; | ||
279 | struct tty_ldisc *ld; | 280 | struct tty_ldisc *ld; |
280 | DECLARE_WAITQUEUE(wait, current); | 281 | DECLARE_WAITQUEUE(wait, current); |
281 | 282 | ||
@@ -293,7 +294,7 @@ int paste_selection(struct tty_struct *tty) | |||
293 | continue; | 294 | continue; |
294 | } | 295 | } |
295 | count = sel_buffer_lth - pasted; | 296 | count = sel_buffer_lth - pasted; |
296 | count = min(count, tty->ldisc.receive_room(tty)); | 297 | count = min(count, tty->receive_room); |
297 | tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count); | 298 | tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count); |
298 | pasted += count; | 299 | pasted += count; |
299 | } | 300 | } |
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index dda30e42ec79..80a5b840e22f 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c | |||
@@ -194,11 +194,6 @@ static inline void a2232_receive_char(struct a2232_port *port, int ch, int err) | |||
194 | */ | 194 | */ |
195 | struct tty_struct *tty = port->gs.tty; | 195 | struct tty_struct *tty = port->gs.tty; |
196 | 196 | ||
197 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
198 | return; | ||
199 | |||
200 | tty->flip.count++; | ||
201 | |||
202 | #if 0 | 197 | #if 0 |
203 | switch(err) { | 198 | switch(err) { |
204 | case TTY_BREAK: | 199 | case TTY_BREAK: |
@@ -212,8 +207,7 @@ static inline void a2232_receive_char(struct a2232_port *port, int ch, int err) | |||
212 | } | 207 | } |
213 | #endif | 208 | #endif |
214 | 209 | ||
215 | *tty->flip.flag_buf_ptr++ = err; | 210 | tty_insert_flip_char(tty, ch, err); |
216 | *tty->flip.char_buf_ptr++ = ch; | ||
217 | tty_flip_buffer_push(tty); | 211 | tty_flip_buffer_push(tty); |
218 | } | 212 | } |
219 | 213 | ||
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index c2deac968bdd..f36342ae8e7e 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -117,7 +117,7 @@ struct cyclades_port cy_port[] = { | |||
117 | {-1 }, /* ttyS2 */ | 117 | {-1 }, /* ttyS2 */ |
118 | {-1 }, /* ttyS3 */ | 118 | {-1 }, /* ttyS3 */ |
119 | }; | 119 | }; |
120 | #define NR_PORTS (sizeof(cy_port)/sizeof(struct cyclades_port)) | 120 | #define NR_PORTS ARRAY_SIZE(cy_port) |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * tmp_buf is used as a temporary buffer by serial_write. We need to | 123 | * tmp_buf is used as a temporary buffer by serial_write. We need to |
@@ -422,45 +422,35 @@ cd2401_rxerr_interrupt(int irq, void *dev_id, struct pt_regs *fp) | |||
422 | base_addr[CyREOIR] = rfoc ? 0 : CyNOTRANS; | 422 | base_addr[CyREOIR] = rfoc ? 0 : CyNOTRANS; |
423 | return IRQ_HANDLED; | 423 | return IRQ_HANDLED; |
424 | } | 424 | } |
425 | if (tty->flip.count < TTY_FLIPBUF_SIZE){ | 425 | if (tty_buffer_request_room(tty, 1) != 0){ |
426 | tty->flip.count++; | ||
427 | if (err & info->read_status_mask){ | 426 | if (err & info->read_status_mask){ |
428 | if(err & CyBREAK){ | 427 | if(err & CyBREAK){ |
429 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 428 | tty_insert_flip_char(tty, data, TTY_BREAK); |
430 | *tty->flip.char_buf_ptr++ = data; | ||
431 | if (info->flags & ASYNC_SAK){ | 429 | if (info->flags & ASYNC_SAK){ |
432 | do_SAK(tty); | 430 | do_SAK(tty); |
433 | } | 431 | } |
434 | }else if(err & CyFRAME){ | 432 | }else if(err & CyFRAME){ |
435 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 433 | tty_insert_flip_char(tty, data, TTY_FRAME); |
436 | *tty->flip.char_buf_ptr++ = data; | ||
437 | }else if(err & CyPARITY){ | 434 | }else if(err & CyPARITY){ |
438 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | 435 | tty_insert_flip_char(tty, data, TTY_PARITY); |
439 | *tty->flip.char_buf_ptr++ = data; | ||
440 | }else if(err & CyOVERRUN){ | 436 | }else if(err & CyOVERRUN){ |
441 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 437 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
442 | *tty->flip.char_buf_ptr++ = 0; | ||
443 | /* | 438 | /* |
444 | If the flip buffer itself is | 439 | If the flip buffer itself is |
445 | overflowing, we still loose | 440 | overflowing, we still loose |
446 | the next incoming character. | 441 | the next incoming character. |
447 | */ | 442 | */ |
448 | if(tty->flip.count < TTY_FLIPBUF_SIZE){ | 443 | tty_insert_flip_char(tty, data, TTY_NORMAL); |
449 | tty->flip.count++; | 444 | } |
450 | *tty->flip.flag_buf_ptr++ = TTY_NORMAL; | ||
451 | *tty->flip.char_buf_ptr++ = data; | ||
452 | } | ||
453 | /* These two conditions may imply */ | 445 | /* These two conditions may imply */ |
454 | /* a normal read should be done. */ | 446 | /* a normal read should be done. */ |
455 | /* else if(data & CyTIMEOUT) */ | 447 | /* else if(data & CyTIMEOUT) */ |
456 | /* else if(data & CySPECHAR) */ | 448 | /* else if(data & CySPECHAR) */ |
457 | }else{ | 449 | }else{ |
458 | *tty->flip.flag_buf_ptr++ = 0; | 450 | tty_insert_flip_char(tty, 0, TTY_NORMAL); |
459 | *tty->flip.char_buf_ptr++ = 0; | ||
460 | } | 451 | } |
461 | }else{ | 452 | }else{ |
462 | *tty->flip.flag_buf_ptr++ = 0; | 453 | tty_insert_flip_char(tty, data, TTY_NORMAL); |
463 | *tty->flip.char_buf_ptr++ = 0; | ||
464 | } | 454 | } |
465 | }else{ | 455 | }else{ |
466 | /* there was a software buffer overrun | 456 | /* there was a software buffer overrun |
@@ -692,12 +682,7 @@ cd2401_rx_interrupt(int irq, void *dev_id, struct pt_regs *fp) | |||
692 | #endif | 682 | #endif |
693 | while(char_count--){ | 683 | while(char_count--){ |
694 | data = base_addr[CyRDR]; | 684 | data = base_addr[CyRDR]; |
695 | if (tty->flip.count >= TTY_FLIPBUF_SIZE){ | 685 | tty_insert_flip_char(tty, data, TTY_NORMAL); |
696 | continue; | ||
697 | } | ||
698 | tty->flip.count++; | ||
699 | *tty->flip.flag_buf_ptr++ = TTY_NORMAL; | ||
700 | *tty->flip.char_buf_ptr++ = data; | ||
701 | #ifdef CYCLOM_16Y_HACK | 686 | #ifdef CYCLOM_16Y_HACK |
702 | udelay(10L); | 687 | udelay(10L); |
703 | #endif | 688 | #endif |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 0bbfce43031c..0a574bdbce36 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -85,6 +85,7 @@ | |||
85 | #include <linux/interrupt.h> | 85 | #include <linux/interrupt.h> |
86 | #include <linux/errno.h> | 86 | #include <linux/errno.h> |
87 | #include <linux/tty.h> | 87 | #include <linux/tty.h> |
88 | #include <linux/tty_flip.h> | ||
88 | #include <linux/mm.h> | 89 | #include <linux/mm.h> |
89 | #include <linux/serial.h> | 90 | #include <linux/serial.h> |
90 | #include <linux/fcntl.h> | 91 | #include <linux/fcntl.h> |
@@ -665,7 +666,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
665 | struct specialix_port *port; | 666 | struct specialix_port *port; |
666 | struct tty_struct *tty; | 667 | struct tty_struct *tty; |
667 | unsigned char status; | 668 | unsigned char status; |
668 | unsigned char ch; | 669 | unsigned char ch, flag; |
669 | 670 | ||
670 | func_enter(); | 671 | func_enter(); |
671 | 672 | ||
@@ -676,8 +677,6 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
676 | return; | 677 | return; |
677 | } | 678 | } |
678 | tty = port->tty; | 679 | tty = port->tty; |
679 | dprintk (SX_DEBUG_RX, "port: %p count: %d BUFF_SIZE: %d\n", | ||
680 | port, tty->flip.count, TTY_FLIPBUF_SIZE); | ||
681 | 680 | ||
682 | status = sx_in(bp, CD186x_RCSR); | 681 | status = sx_in(bp, CD186x_RCSR); |
683 | 682 | ||
@@ -691,7 +690,7 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
691 | 690 | ||
692 | /* This flip buffer check needs to be below the reading of the | 691 | /* This flip buffer check needs to be below the reading of the |
693 | status register to reset the chip's IRQ.... */ | 692 | status register to reset the chip's IRQ.... */ |
694 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 693 | if (tty_buffer_request_room(tty, 1) == 0) { |
695 | dprintk(SX_DEBUG_FIFO, "sx%d: port %d: Working around flip buffer overflow.\n", | 694 | dprintk(SX_DEBUG_FIFO, "sx%d: port %d: Working around flip buffer overflow.\n", |
696 | board_No(bp), port_No(port)); | 695 | board_No(bp), port_No(port)); |
697 | func_exit(); | 696 | func_exit(); |
@@ -712,26 +711,24 @@ static inline void sx_receive_exc(struct specialix_board * bp) | |||
712 | } else if (status & RCSR_BREAK) { | 711 | } else if (status & RCSR_BREAK) { |
713 | dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", | 712 | dprintk(SX_DEBUG_RX, "sx%d: port %d: Handling break...\n", |
714 | board_No(bp), port_No(port)); | 713 | board_No(bp), port_No(port)); |
715 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 714 | flag = TTY_BREAK; |
716 | if (port->flags & ASYNC_SAK) | 715 | if (port->flags & ASYNC_SAK) |
717 | do_SAK(tty); | 716 | do_SAK(tty); |
718 | 717 | ||
719 | } else if (status & RCSR_PE) | 718 | } else if (status & RCSR_PE) |
720 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | 719 | flag = TTY_PARITY; |
721 | 720 | ||
722 | else if (status & RCSR_FE) | 721 | else if (status & RCSR_FE) |
723 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 722 | flag = TTY_FRAME; |
724 | 723 | ||
725 | else if (status & RCSR_OE) | 724 | else if (status & RCSR_OE) |
726 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 725 | flag = TTY_OVERRUN; |
727 | 726 | ||
728 | else | 727 | else |
729 | *tty->flip.flag_buf_ptr++ = 0; | 728 | flag = TTY_NORMAL; |
730 | |||
731 | *tty->flip.char_buf_ptr++ = ch; | ||
732 | tty->flip.count++; | ||
733 | schedule_delayed_work(&tty->flip.work, 1); | ||
734 | 729 | ||
730 | if(tty_insert_flip_char(tty, ch, flag)) | ||
731 | tty_flip_buffer_push(tty); | ||
735 | func_exit(); | 732 | func_exit(); |
736 | } | 733 | } |
737 | 734 | ||
@@ -755,18 +752,11 @@ static inline void sx_receive(struct specialix_board * bp) | |||
755 | dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); | 752 | dprintk (SX_DEBUG_RX, "port: %p: count: %d\n", port, count); |
756 | port->hits[count > 8 ? 9 : count]++; | 753 | port->hits[count > 8 ? 9 : count]++; |
757 | 754 | ||
758 | while (count--) { | 755 | tty_buffer_request_room(tty, count); |
759 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
760 | printk(KERN_INFO "sx%d: port %d: Working around flip buffer overflow.\n", | ||
761 | board_No(bp), port_No(port)); | ||
762 | break; | ||
763 | } | ||
764 | *tty->flip.char_buf_ptr++ = sx_in(bp, CD186x_RDR); | ||
765 | *tty->flip.flag_buf_ptr++ = 0; | ||
766 | tty->flip.count++; | ||
767 | } | ||
768 | schedule_delayed_work(&tty->flip.work, 1); | ||
769 | 756 | ||
757 | while (count--) | ||
758 | tty_insert_flip_char(tty, sx_in(bp, CD186x_RDR), TTY_NORMAL); | ||
759 | tty_flip_buffer_push(tty); | ||
770 | func_exit(); | 760 | func_exit(); |
771 | } | 761 | } |
772 | 762 | ||
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 95af2a941595..0e20780d4a29 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -103,7 +103,7 @@ static stlconf_t stl_brdconf[] = { | |||
103 | /*{ BRD_EASYIO, 0x2a0, 0, 0, 10, 0 },*/ | 103 | /*{ BRD_EASYIO, 0x2a0, 0, 0, 10, 0 },*/ |
104 | }; | 104 | }; |
105 | 105 | ||
106 | static int stl_nrbrds = sizeof(stl_brdconf) / sizeof(stlconf_t); | 106 | static int stl_nrbrds = ARRAY_SIZE(stl_brdconf); |
107 | 107 | ||
108 | /*****************************************************************************/ | 108 | /*****************************************************************************/ |
109 | 109 | ||
@@ -424,7 +424,7 @@ static stlpcibrd_t stl_pcibrds[] = { | |||
424 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, BRD_ECHPCI }, | 424 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, BRD_ECHPCI }, |
425 | }; | 425 | }; |
426 | 426 | ||
427 | static int stl_nrpcibrds = sizeof(stl_pcibrds) / sizeof(stlpcibrd_t); | 427 | static int stl_nrpcibrds = ARRAY_SIZE(stl_pcibrds); |
428 | 428 | ||
429 | #endif | 429 | #endif |
430 | 430 | ||
@@ -704,7 +704,7 @@ static unsigned int sc26198_baudtable[] = { | |||
704 | 230400, 460800, 921600 | 704 | 230400, 460800, 921600 |
705 | }; | 705 | }; |
706 | 706 | ||
707 | #define SC26198_NRBAUDS (sizeof(sc26198_baudtable) / sizeof(unsigned int)) | 707 | #define SC26198_NRBAUDS ARRAY_SIZE(sc26198_baudtable) |
708 | 708 | ||
709 | /*****************************************************************************/ | 709 | /*****************************************************************************/ |
710 | 710 | ||
@@ -901,7 +901,7 @@ static unsigned long stl_atol(char *str) | |||
901 | static int stl_parsebrd(stlconf_t *confp, char **argp) | 901 | static int stl_parsebrd(stlconf_t *confp, char **argp) |
902 | { | 902 | { |
903 | char *sp; | 903 | char *sp; |
904 | int nrbrdnames, i; | 904 | int i; |
905 | 905 | ||
906 | #ifdef DEBUG | 906 | #ifdef DEBUG |
907 | printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); | 907 | printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); |
@@ -913,14 +913,13 @@ static int stl_parsebrd(stlconf_t *confp, char **argp) | |||
913 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) | 913 | for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++) |
914 | *sp = TOLOWER(*sp); | 914 | *sp = TOLOWER(*sp); |
915 | 915 | ||
916 | nrbrdnames = sizeof(stl_brdstr) / sizeof(stlbrdtype_t); | 916 | for (i = 0; i < ARRAY_SIZE(stl_brdstr); i++) { |
917 | for (i = 0; (i < nrbrdnames); i++) { | ||
918 | if (strcmp(stl_brdstr[i].name, argp[0]) == 0) | 917 | if (strcmp(stl_brdstr[i].name, argp[0]) == 0) |
919 | break; | 918 | break; |
920 | } | 919 | } |
921 | if (i >= nrbrdnames) { | 920 | if (i == ARRAY_SIZE(stl_brdstr)) { |
922 | printk("STALLION: unknown board name, %s?\n", argp[0]); | 921 | printk("STALLION: unknown board name, %s?\n", argp[0]); |
923 | return(0); | 922 | return 0; |
924 | } | 923 | } |
925 | 924 | ||
926 | confp->brdtype = stl_brdstr[i].type; | 925 | confp->brdtype = stl_brdstr[i].type; |
@@ -2902,7 +2901,8 @@ static int stl_getportstats(stlport_t *portp, comstats_t __user *cp) | |||
2902 | if (portp->tty != (struct tty_struct *) NULL) { | 2901 | if (portp->tty != (struct tty_struct *) NULL) { |
2903 | if (portp->tty->driver_data == portp) { | 2902 | if (portp->tty->driver_data == portp) { |
2904 | portp->stats.ttystate = portp->tty->flags; | 2903 | portp->stats.ttystate = portp->tty->flags; |
2905 | portp->stats.rxbuffered = portp->tty->flip.count; | 2904 | /* No longer available as a statistic */ |
2905 | portp->stats.rxbuffered = 1; /*portp->tty->flip.count; */ | ||
2906 | if (portp->tty->termios != (struct termios *) NULL) { | 2906 | if (portp->tty->termios != (struct termios *) NULL) { |
2907 | portp->stats.cflags = portp->tty->termios->c_cflag; | 2907 | portp->stats.cflags = portp->tty->termios->c_cflag; |
2908 | portp->stats.iflags = portp->tty->termios->c_iflag; | 2908 | portp->stats.iflags = portp->tty->termios->c_iflag; |
@@ -4046,9 +4046,7 @@ static void stl_cd1400rxisr(stlpanel_t *panelp, int ioaddr) | |||
4046 | if ((ioack & ACK_TYPMASK) == ACK_TYPRXGOOD) { | 4046 | if ((ioack & ACK_TYPMASK) == ACK_TYPRXGOOD) { |
4047 | outb((RDCR + portp->uartaddr), ioaddr); | 4047 | outb((RDCR + portp->uartaddr), ioaddr); |
4048 | len = inb(ioaddr + EREG_DATA); | 4048 | len = inb(ioaddr + EREG_DATA); |
4049 | if ((tty == (struct tty_struct *) NULL) || | 4049 | if (tty == NULL || (buflen = tty_buffer_request_room(tty, len)) == 0) { |
4050 | (tty->flip.char_buf_ptr == (char *) NULL) || | ||
4051 | ((buflen = TTY_FLIPBUF_SIZE - tty->flip.count) == 0)) { | ||
4052 | len = MIN(len, sizeof(stl_unwanted)); | 4050 | len = MIN(len, sizeof(stl_unwanted)); |
4053 | outb((RDSR + portp->uartaddr), ioaddr); | 4051 | outb((RDSR + portp->uartaddr), ioaddr); |
4054 | insb((ioaddr + EREG_DATA), &stl_unwanted[0], len); | 4052 | insb((ioaddr + EREG_DATA), &stl_unwanted[0], len); |
@@ -4057,12 +4055,10 @@ static void stl_cd1400rxisr(stlpanel_t *panelp, int ioaddr) | |||
4057 | } else { | 4055 | } else { |
4058 | len = MIN(len, buflen); | 4056 | len = MIN(len, buflen); |
4059 | if (len > 0) { | 4057 | if (len > 0) { |
4058 | unsigned char *ptr; | ||
4060 | outb((RDSR + portp->uartaddr), ioaddr); | 4059 | outb((RDSR + portp->uartaddr), ioaddr); |
4061 | insb((ioaddr + EREG_DATA), tty->flip.char_buf_ptr, len); | 4060 | tty_prepare_flip_string(tty, &ptr, len); |
4062 | memset(tty->flip.flag_buf_ptr, 0, len); | 4061 | insb((ioaddr + EREG_DATA), ptr, len); |
4063 | tty->flip.flag_buf_ptr += len; | ||
4064 | tty->flip.char_buf_ptr += len; | ||
4065 | tty->flip.count += len; | ||
4066 | tty_schedule_flip(tty); | 4062 | tty_schedule_flip(tty); |
4067 | portp->stats.rxtotal += len; | 4063 | portp->stats.rxtotal += len; |
4068 | } | 4064 | } |
@@ -4086,8 +4082,7 @@ static void stl_cd1400rxisr(stlpanel_t *panelp, int ioaddr) | |||
4086 | portp->stats.txxoff++; | 4082 | portp->stats.txxoff++; |
4087 | goto stl_rxalldone; | 4083 | goto stl_rxalldone; |
4088 | } | 4084 | } |
4089 | if ((tty != (struct tty_struct *) NULL) && | 4085 | if (tty != NULL && (portp->rxignoremsk & status) == 0) { |
4090 | ((portp->rxignoremsk & status) == 0)) { | ||
4091 | if (portp->rxmarkmsk & status) { | 4086 | if (portp->rxmarkmsk & status) { |
4092 | if (status & ST_BREAK) { | 4087 | if (status & ST_BREAK) { |
4093 | status = TTY_BREAK; | 4088 | status = TTY_BREAK; |
@@ -4107,14 +4102,8 @@ static void stl_cd1400rxisr(stlpanel_t *panelp, int ioaddr) | |||
4107 | } else { | 4102 | } else { |
4108 | status = 0; | 4103 | status = 0; |
4109 | } | 4104 | } |
4110 | if (tty->flip.char_buf_ptr != (char *) NULL) { | 4105 | tty_insert_flip_char(tty, ch, status); |
4111 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 4106 | tty_schedule_flip(tty); |
4112 | *tty->flip.flag_buf_ptr++ = status; | ||
4113 | *tty->flip.char_buf_ptr++ = ch; | ||
4114 | tty->flip.count++; | ||
4115 | } | ||
4116 | tty_schedule_flip(tty); | ||
4117 | } | ||
4118 | } | 4107 | } |
4119 | } else { | 4108 | } else { |
4120 | printk("STALLION: bad RX interrupt ack value=%x\n", ioack); | 4109 | printk("STALLION: bad RX interrupt ack value=%x\n", ioack); |
@@ -5013,9 +5002,7 @@ static void stl_sc26198rxisr(stlport_t *portp, unsigned int iack) | |||
5013 | len = inb(ioaddr + XP_DATA) + 1; | 5002 | len = inb(ioaddr + XP_DATA) + 1; |
5014 | 5003 | ||
5015 | if ((iack & IVR_TYPEMASK) == IVR_RXDATA) { | 5004 | if ((iack & IVR_TYPEMASK) == IVR_RXDATA) { |
5016 | if ((tty == (struct tty_struct *) NULL) || | 5005 | if (tty == NULL || (buflen = tty_buffer_request_room(tty, len)) == 0) { |
5017 | (tty->flip.char_buf_ptr == (char *) NULL) || | ||
5018 | ((buflen = TTY_FLIPBUF_SIZE - tty->flip.count) == 0)) { | ||
5019 | len = MIN(len, sizeof(stl_unwanted)); | 5006 | len = MIN(len, sizeof(stl_unwanted)); |
5020 | outb(GRXFIFO, (ioaddr + XP_ADDR)); | 5007 | outb(GRXFIFO, (ioaddr + XP_ADDR)); |
5021 | insb((ioaddr + XP_DATA), &stl_unwanted[0], len); | 5008 | insb((ioaddr + XP_DATA), &stl_unwanted[0], len); |
@@ -5024,12 +5011,10 @@ static void stl_sc26198rxisr(stlport_t *portp, unsigned int iack) | |||
5024 | } else { | 5011 | } else { |
5025 | len = MIN(len, buflen); | 5012 | len = MIN(len, buflen); |
5026 | if (len > 0) { | 5013 | if (len > 0) { |
5014 | unsigned char *ptr; | ||
5027 | outb(GRXFIFO, (ioaddr + XP_ADDR)); | 5015 | outb(GRXFIFO, (ioaddr + XP_ADDR)); |
5028 | insb((ioaddr + XP_DATA), tty->flip.char_buf_ptr, len); | 5016 | tty_prepare_flip_string(tty, &ptr, len); |
5029 | memset(tty->flip.flag_buf_ptr, 0, len); | 5017 | insb((ioaddr + XP_DATA), ptr, len); |
5030 | tty->flip.flag_buf_ptr += len; | ||
5031 | tty->flip.char_buf_ptr += len; | ||
5032 | tty->flip.count += len; | ||
5033 | tty_schedule_flip(tty); | 5018 | tty_schedule_flip(tty); |
5034 | portp->stats.rxtotal += len; | 5019 | portp->stats.rxtotal += len; |
5035 | } | 5020 | } |
@@ -5097,14 +5082,8 @@ static inline void stl_sc26198rxbadch(stlport_t *portp, unsigned char status, ch | |||
5097 | status = 0; | 5082 | status = 0; |
5098 | } | 5083 | } |
5099 | 5084 | ||
5100 | if (tty->flip.char_buf_ptr != (char *) NULL) { | 5085 | tty_insert_flip_char(tty, ch, status); |
5101 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 5086 | tty_schedule_flip(tty); |
5102 | *tty->flip.flag_buf_ptr++ = status; | ||
5103 | *tty->flip.char_buf_ptr++ = ch; | ||
5104 | tty->flip.count++; | ||
5105 | } | ||
5106 | tty_schedule_flip(tty); | ||
5107 | } | ||
5108 | 5087 | ||
5109 | if (status == 0) | 5088 | if (status == 0) |
5110 | portp->stats.rxtotal++; | 5089 | portp->stats.rxtotal++; |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 3ad758a9a1dc..64bf89cb574f 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -345,9 +345,9 @@ static int si_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000, | |||
345 | 0xc8000, 0xd8000, 0xe8000, 0xa0000}; | 345 | 0xc8000, 0xd8000, 0xe8000, 0xa0000}; |
346 | static int si1_probe_addrs[]= { 0xd0000}; | 346 | static int si1_probe_addrs[]= { 0xd0000}; |
347 | 347 | ||
348 | #define NR_SX_ADDRS (sizeof(sx_probe_addrs)/sizeof (int)) | 348 | #define NR_SX_ADDRS ARRAY_SIZE(sx_probe_addrs) |
349 | #define NR_SI_ADDRS (sizeof(si_probe_addrs)/sizeof (int)) | 349 | #define NR_SI_ADDRS ARRAY_SIZE(si_probe_addrs) |
350 | #define NR_SI1_ADDRS (sizeof(si1_probe_addrs)/sizeof (int)) | 350 | #define NR_SI1_ADDRS ARRAY_SIZE(si1_probe_addrs) |
351 | 351 | ||
352 | 352 | ||
353 | /* Set the mask to all-ones. This alas, only supports 32 interrupts. | 353 | /* Set the mask to all-ones. This alas, only supports 32 interrupts. |
@@ -1085,6 +1085,7 @@ static inline void sx_receive_chars (struct sx_port *port) | |||
1085 | int rx_op; | 1085 | int rx_op; |
1086 | struct tty_struct *tty; | 1086 | struct tty_struct *tty; |
1087 | int copied=0; | 1087 | int copied=0; |
1088 | unsigned char *rp; | ||
1088 | 1089 | ||
1089 | func_enter2 (); | 1090 | func_enter2 (); |
1090 | tty = port->gs.tty; | 1091 | tty = port->gs.tty; |
@@ -1095,8 +1096,8 @@ static inline void sx_receive_chars (struct sx_port *port) | |||
1095 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); | 1096 | sx_dprintk (SX_DEBUG_RECEIVE, "rxop=%d, c = %d.\n", rx_op, c); |
1096 | 1097 | ||
1097 | /* Don't copy more bytes than there is room for in the buffer */ | 1098 | /* Don't copy more bytes than there is room for in the buffer */ |
1098 | if (tty->flip.count + c > TTY_FLIPBUF_SIZE) | 1099 | |
1099 | c = TTY_FLIPBUF_SIZE - tty->flip.count; | 1100 | c = tty_prepare_flip_string(tty, &rp, c); |
1100 | 1101 | ||
1101 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); | 1102 | sx_dprintk (SX_DEBUG_RECEIVE, "c = %d.\n", c); |
1102 | 1103 | ||
@@ -1111,14 +1112,8 @@ static inline void sx_receive_chars (struct sx_port *port) | |||
1111 | sx_dprintk (SX_DEBUG_RECEIVE , "Copying over %d chars. First is %d at %lx\n", c, | 1112 | sx_dprintk (SX_DEBUG_RECEIVE , "Copying over %d chars. First is %d at %lx\n", c, |
1112 | read_sx_byte (port->board, CHAN_OFFSET(port,hi_rxbuf) + rx_op), | 1113 | read_sx_byte (port->board, CHAN_OFFSET(port,hi_rxbuf) + rx_op), |
1113 | CHAN_OFFSET(port, hi_rxbuf)); | 1114 | CHAN_OFFSET(port, hi_rxbuf)); |
1114 | memcpy_fromio (tty->flip.char_buf_ptr, | 1115 | memcpy_fromio (rp, |
1115 | port->board->base + CHAN_OFFSET(port,hi_rxbuf) + rx_op, c); | 1116 | port->board->base + CHAN_OFFSET(port,hi_rxbuf) + rx_op, c); |
1116 | memset(tty->flip.flag_buf_ptr, TTY_NORMAL, c); | ||
1117 | |||
1118 | /* Update the kernel buffer end */ | ||
1119 | tty->flip.count += c; | ||
1120 | tty->flip.char_buf_ptr += c; | ||
1121 | tty->flip.flag_buf_ptr += c; | ||
1122 | 1117 | ||
1123 | /* This one last. ( Not essential.) | 1118 | /* This one last. ( Not essential.) |
1124 | It allows the card to start putting more data into the buffer! | 1119 | It allows the card to start putting more data into the buffer! |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 62aa0e534a6d..9f1b466c4f84 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -1467,6 +1467,7 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1467 | { | 1467 | { |
1468 | int Fifocount; | 1468 | int Fifocount; |
1469 | u16 status; | 1469 | u16 status; |
1470 | int work = 0; | ||
1470 | unsigned char DataByte; | 1471 | unsigned char DataByte; |
1471 | struct tty_struct *tty = info->tty; | 1472 | struct tty_struct *tty = info->tty; |
1472 | struct mgsl_icount *icount = &info->icount; | 1473 | struct mgsl_icount *icount = &info->icount; |
@@ -1487,6 +1488,8 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1487 | /* flush the receive FIFO */ | 1488 | /* flush the receive FIFO */ |
1488 | 1489 | ||
1489 | while( (Fifocount = (usc_InReg(info,RICR) >> 8)) ) { | 1490 | while( (Fifocount = (usc_InReg(info,RICR) >> 8)) ) { |
1491 | int flag; | ||
1492 | |||
1490 | /* read one byte from RxFIFO */ | 1493 | /* read one byte from RxFIFO */ |
1491 | outw( (inw(info->io_base + CCAR) & 0x0780) | (RDR+LSBONLY), | 1494 | outw( (inw(info->io_base + CCAR) & 0x0780) | (RDR+LSBONLY), |
1492 | info->io_base + CCAR ); | 1495 | info->io_base + CCAR ); |
@@ -1498,13 +1501,9 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1498 | RXSTATUS_OVERRUN + RXSTATUS_BREAK_RECEIVED) ) | 1501 | RXSTATUS_OVERRUN + RXSTATUS_BREAK_RECEIVED) ) |
1499 | usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); | 1502 | usc_UnlatchRxstatusBits(info,RXSTATUS_ALL); |
1500 | 1503 | ||
1501 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
1502 | continue; | ||
1503 | |||
1504 | *tty->flip.char_buf_ptr = DataByte; | ||
1505 | icount->rx++; | 1504 | icount->rx++; |
1506 | 1505 | ||
1507 | *tty->flip.flag_buf_ptr = 0; | 1506 | flag = 0; |
1508 | if ( status & (RXSTATUS_FRAMING_ERROR + RXSTATUS_PARITY_ERROR + | 1507 | if ( status & (RXSTATUS_FRAMING_ERROR + RXSTATUS_PARITY_ERROR + |
1509 | RXSTATUS_OVERRUN + RXSTATUS_BREAK_RECEIVED) ) { | 1508 | RXSTATUS_OVERRUN + RXSTATUS_BREAK_RECEIVED) ) { |
1510 | printk("rxerr=%04X\n",status); | 1509 | printk("rxerr=%04X\n",status); |
@@ -1530,41 +1529,31 @@ static void mgsl_isr_receive_data( struct mgsl_struct *info ) | |||
1530 | status &= info->read_status_mask; | 1529 | status &= info->read_status_mask; |
1531 | 1530 | ||
1532 | if (status & RXSTATUS_BREAK_RECEIVED) { | 1531 | if (status & RXSTATUS_BREAK_RECEIVED) { |
1533 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 1532 | flag = TTY_BREAK; |
1534 | if (info->flags & ASYNC_SAK) | 1533 | if (info->flags & ASYNC_SAK) |
1535 | do_SAK(tty); | 1534 | do_SAK(tty); |
1536 | } else if (status & RXSTATUS_PARITY_ERROR) | 1535 | } else if (status & RXSTATUS_PARITY_ERROR) |
1537 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 1536 | flag = TTY_PARITY; |
1538 | else if (status & RXSTATUS_FRAMING_ERROR) | 1537 | else if (status & RXSTATUS_FRAMING_ERROR) |
1539 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 1538 | flag = TTY_FRAME; |
1540 | if (status & RXSTATUS_OVERRUN) { | ||
1541 | /* Overrun is special, since it's | ||
1542 | * reported immediately, and doesn't | ||
1543 | * affect the current character | ||
1544 | */ | ||
1545 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
1546 | tty->flip.count++; | ||
1547 | tty->flip.flag_buf_ptr++; | ||
1548 | tty->flip.char_buf_ptr++; | ||
1549 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
1550 | } | ||
1551 | } | ||
1552 | } /* end of if (error) */ | 1539 | } /* end of if (error) */ |
1553 | 1540 | tty_insert_flip_char(tty, DataByte, flag); | |
1554 | tty->flip.flag_buf_ptr++; | 1541 | if (status & RXSTATUS_OVERRUN) { |
1555 | tty->flip.char_buf_ptr++; | 1542 | /* Overrun is special, since it's |
1556 | tty->flip.count++; | 1543 | * reported immediately, and doesn't |
1544 | * affect the current character | ||
1545 | */ | ||
1546 | work += tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
1547 | } | ||
1557 | } | 1548 | } |
1558 | 1549 | ||
1559 | if ( debug_level >= DEBUG_LEVEL_ISR ) { | 1550 | if ( debug_level >= DEBUG_LEVEL_ISR ) { |
1560 | printk("%s(%d):mgsl_isr_receive_data flip count=%d\n", | ||
1561 | __FILE__,__LINE__,tty->flip.count); | ||
1562 | printk("%s(%d):rx=%d brk=%d parity=%d frame=%d overrun=%d\n", | 1551 | printk("%s(%d):rx=%d brk=%d parity=%d frame=%d overrun=%d\n", |
1563 | __FILE__,__LINE__,icount->rx,icount->brk, | 1552 | __FILE__,__LINE__,icount->rx,icount->brk, |
1564 | icount->parity,icount->frame,icount->overrun); | 1553 | icount->parity,icount->frame,icount->overrun); |
1565 | } | 1554 | } |
1566 | 1555 | ||
1567 | if ( tty->flip.count ) | 1556 | if(work) |
1568 | tty_flip_buffer_push(tty); | 1557 | tty_flip_buffer_push(tty); |
1569 | } | 1558 | } |
1570 | 1559 | ||
@@ -7058,7 +7047,7 @@ static BOOLEAN mgsl_register_test( struct mgsl_struct *info ) | |||
7058 | { | 7047 | { |
7059 | static unsigned short BitPatterns[] = | 7048 | static unsigned short BitPatterns[] = |
7060 | { 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f }; | 7049 | { 0x0000, 0xffff, 0xaaaa, 0x5555, 0x1234, 0x6969, 0x9696, 0x0f0f }; |
7061 | static unsigned int Patterncount = sizeof(BitPatterns)/sizeof(unsigned short); | 7050 | static unsigned int Patterncount = ARRAY_SIZE(BitPatterns); |
7062 | unsigned int i; | 7051 | unsigned int i; |
7063 | BOOLEAN rc = TRUE; | 7052 | BOOLEAN rc = TRUE; |
7064 | unsigned long flags; | 7053 | unsigned long flags; |
@@ -7501,9 +7490,9 @@ static int mgsl_adapter_test( struct mgsl_struct *info ) | |||
7501 | */ | 7490 | */ |
7502 | static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) | 7491 | static BOOLEAN mgsl_memory_test( struct mgsl_struct *info ) |
7503 | { | 7492 | { |
7504 | static unsigned long BitPatterns[] = { 0x0, 0x55555555, 0xaaaaaaaa, | 7493 | static unsigned long BitPatterns[] = |
7505 | 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; | 7494 | { 0x0, 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; |
7506 | unsigned long Patterncount = sizeof(BitPatterns)/sizeof(unsigned long); | 7495 | unsigned long Patterncount = ARRAY_SIZE(BitPatterns); |
7507 | unsigned long i; | 7496 | unsigned long i; |
7508 | unsigned long TestLimit = SHARED_MEM_ADDRESS_SIZE/sizeof(unsigned long); | 7497 | unsigned long TestLimit = SHARED_MEM_ADDRESS_SIZE/sizeof(unsigned long); |
7509 | unsigned long * TestAddr; | 7498 | unsigned long * TestAddr; |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index 2b9cde94e2f7..79c81def4104 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -75,7 +75,6 @@ | |||
75 | #include <linux/workqueue.h> | 75 | #include <linux/workqueue.h> |
76 | #include <linux/hdlc.h> | 76 | #include <linux/hdlc.h> |
77 | 77 | ||
78 | #include <asm/serial.h> | ||
79 | #include <asm/system.h> | 78 | #include <asm/system.h> |
80 | #include <asm/io.h> | 79 | #include <asm/io.h> |
81 | #include <asm/irq.h> | 80 | #include <asm/irq.h> |
@@ -1750,6 +1749,9 @@ static void rx_async(struct slgt_info *info) | |||
1750 | unsigned char status; | 1749 | unsigned char status; |
1751 | struct slgt_desc *bufs = info->rbufs; | 1750 | struct slgt_desc *bufs = info->rbufs; |
1752 | int i, count; | 1751 | int i, count; |
1752 | int chars = 0; | ||
1753 | int stat; | ||
1754 | unsigned char ch; | ||
1753 | 1755 | ||
1754 | start = end = info->rbuf_current; | 1756 | start = end = info->rbuf_current; |
1755 | 1757 | ||
@@ -1761,16 +1763,15 @@ static void rx_async(struct slgt_info *info) | |||
1761 | DBGDATA(info, p, count, "rx"); | 1763 | DBGDATA(info, p, count, "rx"); |
1762 | 1764 | ||
1763 | for(i=0 ; i < count; i+=2, p+=2) { | 1765 | for(i=0 ; i < count; i+=2, p+=2) { |
1764 | if (tty) { | 1766 | if (tty && chars) { |
1765 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | 1767 | tty_flip_buffer_push(tty); |
1766 | tty_flip_buffer_push(tty); | 1768 | chars = 0; |
1767 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
1768 | break; | ||
1769 | *tty->flip.char_buf_ptr = *p; | ||
1770 | *tty->flip.flag_buf_ptr = 0; | ||
1771 | } | 1769 | } |
1770 | ch = *p; | ||
1772 | icount->rx++; | 1771 | icount->rx++; |
1773 | 1772 | ||
1773 | stat = 0; | ||
1774 | |||
1774 | if ((status = *(p+1) & (BIT9 + BIT8))) { | 1775 | if ((status = *(p+1) & (BIT9 + BIT8))) { |
1775 | if (status & BIT9) | 1776 | if (status & BIT9) |
1776 | icount->parity++; | 1777 | icount->parity++; |
@@ -1779,17 +1780,14 @@ static void rx_async(struct slgt_info *info) | |||
1779 | /* discard char if tty control flags say so */ | 1780 | /* discard char if tty control flags say so */ |
1780 | if (status & info->ignore_status_mask) | 1781 | if (status & info->ignore_status_mask) |
1781 | continue; | 1782 | continue; |
1782 | if (tty) { | 1783 | if (status & BIT9) |
1783 | if (status & BIT9) | 1784 | stat = TTY_PARITY; |
1784 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 1785 | else if (status & BIT8) |
1785 | else if (status & BIT8) | 1786 | stat = TTY_FRAME; |
1786 | *tty->flip.flag_buf_ptr = TTY_FRAME; | ||
1787 | } | ||
1788 | } | 1787 | } |
1789 | if (tty) { | 1788 | if (tty) { |
1790 | tty->flip.flag_buf_ptr++; | 1789 | tty_insert_flip_char(tty, ch, stat); |
1791 | tty->flip.char_buf_ptr++; | 1790 | chars++; |
1792 | tty->flip.count++; | ||
1793 | } | 1791 | } |
1794 | } | 1792 | } |
1795 | 1793 | ||
@@ -1812,7 +1810,7 @@ static void rx_async(struct slgt_info *info) | |||
1812 | break; | 1810 | break; |
1813 | } | 1811 | } |
1814 | 1812 | ||
1815 | if (tty && tty->flip.count) | 1813 | if (tty && chars) |
1816 | tty_flip_buffer_push(tty); | 1814 | tty_flip_buffer_push(tty); |
1817 | } | 1815 | } |
1818 | 1816 | ||
@@ -2030,7 +2028,7 @@ static void isr_serial(struct slgt_info *info) | |||
2030 | if (info->tty) { | 2028 | if (info->tty) { |
2031 | if (!(status & info->ignore_status_mask)) { | 2029 | if (!(status & info->ignore_status_mask)) { |
2032 | if (info->read_status_mask & MASK_BREAK) { | 2030 | if (info->read_status_mask & MASK_BREAK) { |
2033 | *info->tty->flip.flag_buf_ptr = TTY_BREAK; | 2031 | tty_insert_flip_char(info->tty, 0, TTY_BREAK); |
2034 | if (info->flags & ASYNC_SAK) | 2032 | if (info->flags & ASYNC_SAK) |
2035 | do_SAK(info->tty); | 2033 | do_SAK(info->tty); |
2036 | } | 2034 | } |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index ee5a40be9f99..960adb256fbb 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -2196,7 +2196,7 @@ void isr_rxint(SLMP_INFO * info) | |||
2196 | if ( tty ) { | 2196 | if ( tty ) { |
2197 | if (!(status & info->ignore_status_mask1)) { | 2197 | if (!(status & info->ignore_status_mask1)) { |
2198 | if (info->read_status_mask1 & BRKD) { | 2198 | if (info->read_status_mask1 & BRKD) { |
2199 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 2199 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
2200 | if (info->flags & ASYNC_SAK) | 2200 | if (info->flags & ASYNC_SAK) |
2201 | do_SAK(tty); | 2201 | do_SAK(tty); |
2202 | } | 2202 | } |
@@ -2240,16 +2240,10 @@ void isr_rxrdy(SLMP_INFO * info) | |||
2240 | 2240 | ||
2241 | while((status = read_reg(info,CST0)) & BIT0) | 2241 | while((status = read_reg(info,CST0)) & BIT0) |
2242 | { | 2242 | { |
2243 | int flag = 0; | ||
2244 | int over = 0; | ||
2243 | DataByte = read_reg(info,TRB); | 2245 | DataByte = read_reg(info,TRB); |
2244 | 2246 | ||
2245 | if ( tty ) { | ||
2246 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
2247 | continue; | ||
2248 | |||
2249 | *tty->flip.char_buf_ptr = DataByte; | ||
2250 | *tty->flip.flag_buf_ptr = 0; | ||
2251 | } | ||
2252 | |||
2253 | icount->rx++; | 2247 | icount->rx++; |
2254 | 2248 | ||
2255 | if ( status & (PE + FRME + OVRN) ) { | 2249 | if ( status & (PE + FRME + OVRN) ) { |
@@ -2272,42 +2266,34 @@ void isr_rxrdy(SLMP_INFO * info) | |||
2272 | 2266 | ||
2273 | if ( tty ) { | 2267 | if ( tty ) { |
2274 | if (status & PE) | 2268 | if (status & PE) |
2275 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 2269 | flag = TTY_PARITY; |
2276 | else if (status & FRME) | 2270 | else if (status & FRME) |
2277 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 2271 | flag = TTY_FRAME; |
2278 | if (status & OVRN) { | 2272 | if (status & OVRN) { |
2279 | /* Overrun is special, since it's | 2273 | /* Overrun is special, since it's |
2280 | * reported immediately, and doesn't | 2274 | * reported immediately, and doesn't |
2281 | * affect the current character | 2275 | * affect the current character |
2282 | */ | 2276 | */ |
2283 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 2277 | over = 1; |
2284 | tty->flip.count++; | ||
2285 | tty->flip.flag_buf_ptr++; | ||
2286 | tty->flip.char_buf_ptr++; | ||
2287 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
2288 | } | ||
2289 | } | 2278 | } |
2290 | } | 2279 | } |
2291 | } /* end of if (error) */ | 2280 | } /* end of if (error) */ |
2292 | 2281 | ||
2293 | if ( tty ) { | 2282 | if ( tty ) { |
2294 | tty->flip.flag_buf_ptr++; | 2283 | tty_insert_flip_char(tty, DataByte, flag); |
2295 | tty->flip.char_buf_ptr++; | 2284 | if (over) |
2296 | tty->flip.count++; | 2285 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
2297 | } | 2286 | } |
2298 | } | 2287 | } |
2299 | 2288 | ||
2300 | if ( debug_level >= DEBUG_LEVEL_ISR ) { | 2289 | if ( debug_level >= DEBUG_LEVEL_ISR ) { |
2301 | printk("%s(%d):%s isr_rxrdy() flip count=%d\n", | ||
2302 | __FILE__,__LINE__,info->device_name, | ||
2303 | tty ? tty->flip.count : 0); | ||
2304 | printk("%s(%d):%s rx=%d brk=%d parity=%d frame=%d overrun=%d\n", | 2290 | printk("%s(%d):%s rx=%d brk=%d parity=%d frame=%d overrun=%d\n", |
2305 | __FILE__,__LINE__,info->device_name, | 2291 | __FILE__,__LINE__,info->device_name, |
2306 | icount->rx,icount->brk,icount->parity, | 2292 | icount->rx,icount->brk,icount->parity, |
2307 | icount->frame,icount->overrun); | 2293 | icount->frame,icount->overrun); |
2308 | } | 2294 | } |
2309 | 2295 | ||
2310 | if ( tty && tty->flip.count ) | 2296 | if ( tty ) |
2311 | tty_flip_buffer_push(tty); | 2297 | tty_flip_buffer_push(tty); |
2312 | } | 2298 | } |
2313 | 2299 | ||
@@ -5104,7 +5090,7 @@ void tx_load_dma_buffer(SLMP_INFO *info, const char *buf, unsigned int count) | |||
5104 | int register_test(SLMP_INFO *info) | 5090 | int register_test(SLMP_INFO *info) |
5105 | { | 5091 | { |
5106 | static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96}; | 5092 | static unsigned char testval[] = {0x00, 0xff, 0xaa, 0x55, 0x69, 0x96}; |
5107 | static unsigned int count = sizeof(testval)/sizeof(unsigned char); | 5093 | static unsigned int count = ARRAY_SIZE(testval); |
5108 | unsigned int i; | 5094 | unsigned int i; |
5109 | int rc = TRUE; | 5095 | int rc = TRUE; |
5110 | unsigned long flags; | 5096 | unsigned long flags; |
@@ -5422,7 +5408,7 @@ int memory_test(SLMP_INFO *info) | |||
5422 | { | 5408 | { |
5423 | static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa, | 5409 | static unsigned long testval[] = { 0x0, 0x55555555, 0xaaaaaaaa, |
5424 | 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; | 5410 | 0x66666666, 0x99999999, 0xffffffff, 0x12345678 }; |
5425 | unsigned long count = sizeof(testval)/sizeof(unsigned long); | 5411 | unsigned long count = ARRAY_SIZE(testval); |
5426 | unsigned long i; | 5412 | unsigned long i; |
5427 | unsigned long limit = SCA_MEM_SIZE/sizeof(unsigned long); | 5413 | unsigned long limit = SCA_MEM_SIZE/sizeof(unsigned long); |
5428 | unsigned long * addr = (unsigned long *)info->memory_base; | 5414 | unsigned long * addr = (unsigned long *)info->memory_base; |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 4b1eef51ec59..1eda82b31a61 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -166,9 +166,12 @@ static struct tty_struct *alloc_tty_struct(void) | |||
166 | return tty; | 166 | return tty; |
167 | } | 167 | } |
168 | 168 | ||
169 | static void tty_buffer_free_all(struct tty_struct *); | ||
170 | |||
169 | static inline void free_tty_struct(struct tty_struct *tty) | 171 | static inline void free_tty_struct(struct tty_struct *tty) |
170 | { | 172 | { |
171 | kfree(tty->write_buf); | 173 | kfree(tty->write_buf); |
174 | tty_buffer_free_all(tty); | ||
172 | kfree(tty); | 175 | kfree(tty); |
173 | } | 176 | } |
174 | 177 | ||
@@ -231,6 +234,201 @@ static int check_tty_count(struct tty_struct *tty, const char *routine) | |||
231 | } | 234 | } |
232 | 235 | ||
233 | /* | 236 | /* |
237 | * Tty buffer allocation management | ||
238 | */ | ||
239 | |||
240 | static void tty_buffer_free_all(struct tty_struct *tty) | ||
241 | { | ||
242 | struct tty_buffer *thead; | ||
243 | while((thead = tty->buf.head) != NULL) { | ||
244 | tty->buf.head = thead->next; | ||
245 | kfree(thead); | ||
246 | } | ||
247 | while((thead = tty->buf.free) != NULL) { | ||
248 | tty->buf.free = thead->next; | ||
249 | kfree(thead); | ||
250 | } | ||
251 | tty->buf.tail = NULL; | ||
252 | } | ||
253 | |||
254 | static void tty_buffer_init(struct tty_struct *tty) | ||
255 | { | ||
256 | tty->buf.head = NULL; | ||
257 | tty->buf.tail = NULL; | ||
258 | tty->buf.free = NULL; | ||
259 | } | ||
260 | |||
261 | static struct tty_buffer *tty_buffer_alloc(size_t size) | ||
262 | { | ||
263 | struct tty_buffer *p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC); | ||
264 | if(p == NULL) | ||
265 | return NULL; | ||
266 | p->used = 0; | ||
267 | p->size = size; | ||
268 | p->next = NULL; | ||
269 | p->char_buf_ptr = (char *)(p->data); | ||
270 | p->flag_buf_ptr = (unsigned char *)p->char_buf_ptr + size; | ||
271 | /* printk("Flip create %p\n", p); */ | ||
272 | return p; | ||
273 | } | ||
274 | |||
275 | /* Must be called with the tty_read lock held. This needs to acquire strategy | ||
276 | code to decide if we should kfree or relink a given expired buffer */ | ||
277 | |||
278 | static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b) | ||
279 | { | ||
280 | /* Dumb strategy for now - should keep some stats */ | ||
281 | /* printk("Flip dispose %p\n", b); */ | ||
282 | if(b->size >= 512) | ||
283 | kfree(b); | ||
284 | else { | ||
285 | b->next = tty->buf.free; | ||
286 | tty->buf.free = b; | ||
287 | } | ||
288 | } | ||
289 | |||
290 | static struct tty_buffer *tty_buffer_find(struct tty_struct *tty, size_t size) | ||
291 | { | ||
292 | struct tty_buffer **tbh = &tty->buf.free; | ||
293 | while((*tbh) != NULL) { | ||
294 | struct tty_buffer *t = *tbh; | ||
295 | if(t->size >= size) { | ||
296 | *tbh = t->next; | ||
297 | t->next = NULL; | ||
298 | t->used = 0; | ||
299 | /* DEBUG ONLY */ | ||
300 | memset(t->data, '*', size); | ||
301 | /* printk("Flip recycle %p\n", t); */ | ||
302 | return t; | ||
303 | } | ||
304 | tbh = &((*tbh)->next); | ||
305 | } | ||
306 | /* Round the buffer size out */ | ||
307 | size = (size + 0xFF) & ~ 0xFF; | ||
308 | return tty_buffer_alloc(size); | ||
309 | /* Should possibly check if this fails for the largest buffer we | ||
310 | have queued and recycle that ? */ | ||
311 | } | ||
312 | |||
313 | int tty_buffer_request_room(struct tty_struct *tty, size_t size) | ||
314 | { | ||
315 | struct tty_buffer *b = tty->buf.head, *n; | ||
316 | int left = 0; | ||
317 | |||
318 | /* OPTIMISATION: We could keep a per tty "zero" sized buffer to | ||
319 | remove this conditional if its worth it. This would be invisible | ||
320 | to the callers */ | ||
321 | if(b != NULL) | ||
322 | left = b->size - b->used; | ||
323 | if(left >= size) | ||
324 | return size; | ||
325 | /* This is the slow path - looking for new buffers to use */ | ||
326 | n = tty_buffer_find(tty, size); | ||
327 | if(n == NULL) | ||
328 | return left; | ||
329 | n->next = b; | ||
330 | if(b != NULL) | ||
331 | b->next = n; | ||
332 | else | ||
333 | tty->buf.head = n; | ||
334 | tty->buf.tail = n; | ||
335 | return size; | ||
336 | } | ||
337 | |||
338 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); | ||
339 | |||
340 | int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size) | ||
341 | { | ||
342 | int copied = 0; | ||
343 | do { | ||
344 | int space = tty_buffer_request_room(tty, size - copied); | ||
345 | struct tty_buffer *tb = tty->buf.tail; | ||
346 | /* If there is no space then tb may be NULL */ | ||
347 | if(unlikely(space == 0)) | ||
348 | break; | ||
349 | memcpy(tb->char_buf_ptr + tb->used, chars, space); | ||
350 | memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space); | ||
351 | tb->used += space; | ||
352 | copied += space; | ||
353 | chars += space; | ||
354 | /* printk("Flip insert %d.\n", space); */ | ||
355 | } | ||
356 | /* There is a small chance that we need to split the data over | ||
357 | several buffers. If this is the case we must loop */ | ||
358 | while (unlikely(size > copied)); | ||
359 | return copied; | ||
360 | } | ||
361 | |||
362 | EXPORT_SYMBOL_GPL(tty_insert_flip_string); | ||
363 | |||
364 | int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size) | ||
365 | { | ||
366 | int copied = 0; | ||
367 | do { | ||
368 | int space = tty_buffer_request_room(tty, size - copied); | ||
369 | struct tty_buffer *tb = tty->buf.tail; | ||
370 | /* If there is no space then tb may be NULL */ | ||
371 | if(unlikely(space == 0)) | ||
372 | break; | ||
373 | memcpy(tb->char_buf_ptr + tb->used, chars, space); | ||
374 | memcpy(tb->flag_buf_ptr + tb->used, flags, space); | ||
375 | tb->used += space; | ||
376 | copied += space; | ||
377 | chars += space; | ||
378 | flags += space; | ||
379 | } | ||
380 | /* There is a small chance that we need to split the data over | ||
381 | several buffers. If this is the case we must loop */ | ||
382 | while (unlikely(size > copied)); | ||
383 | return copied; | ||
384 | } | ||
385 | |||
386 | EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags); | ||
387 | |||
388 | |||
389 | /* | ||
390 | * Prepare a block of space in the buffer for data. Returns the length | ||
391 | * available and buffer pointer to the space which is now allocated and | ||
392 | * accounted for as ready for normal characters. This is used for drivers | ||
393 | * that need their own block copy routines into the buffer. There is no | ||
394 | * guarantee the buffer is a DMA target! | ||
395 | */ | ||
396 | |||
397 | int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size) | ||
398 | { | ||
399 | int space = tty_buffer_request_room(tty, size); | ||
400 | struct tty_buffer *tb = tty->buf.tail; | ||
401 | *chars = tb->char_buf_ptr + tb->used; | ||
402 | memset(tb->flag_buf_ptr + tb->used, TTY_NORMAL, space); | ||
403 | tb->used += space; | ||
404 | return space; | ||
405 | } | ||
406 | |||
407 | EXPORT_SYMBOL_GPL(tty_prepare_flip_string); | ||
408 | |||
409 | /* | ||
410 | * Prepare a block of space in the buffer for data. Returns the length | ||
411 | * available and buffer pointer to the space which is now allocated and | ||
412 | * accounted for as ready for characters. This is used for drivers | ||
413 | * that need their own block copy routines into the buffer. There is no | ||
414 | * guarantee the buffer is a DMA target! | ||
415 | */ | ||
416 | |||
417 | int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size) | ||
418 | { | ||
419 | int space = tty_buffer_request_room(tty, size); | ||
420 | struct tty_buffer *tb = tty->buf.tail; | ||
421 | *chars = tb->char_buf_ptr + tb->used; | ||
422 | *flags = tb->flag_buf_ptr + tb->used; | ||
423 | tb->used += space; | ||
424 | return space; | ||
425 | } | ||
426 | |||
427 | EXPORT_SYMBOL_GPL(tty_prepare_flip_string_flags); | ||
428 | |||
429 | |||
430 | |||
431 | /* | ||
234 | * This is probably overkill for real world processors but | 432 | * This is probably overkill for real world processors but |
235 | * they are not on hot paths so a little discipline won't do | 433 | * they are not on hot paths so a little discipline won't do |
236 | * any harm. | 434 | * any harm. |
@@ -492,6 +690,17 @@ restart: | |||
492 | if (ld == NULL) | 690 | if (ld == NULL) |
493 | return -EINVAL; | 691 | return -EINVAL; |
494 | 692 | ||
693 | /* | ||
694 | * No more input please, we are switching. The new ldisc | ||
695 | * will update this value in the ldisc open function | ||
696 | */ | ||
697 | |||
698 | tty->receive_room = 0; | ||
699 | |||
700 | /* | ||
701 | * Problem: What do we do if this blocks ? | ||
702 | */ | ||
703 | |||
495 | tty_wait_until_sent(tty, 0); | 704 | tty_wait_until_sent(tty, 0); |
496 | 705 | ||
497 | if (tty->ldisc.num == ldisc) { | 706 | if (tty->ldisc.num == ldisc) { |
@@ -560,9 +769,9 @@ restart: | |||
560 | * we say so later on. | 769 | * we say so later on. |
561 | */ | 770 | */ |
562 | 771 | ||
563 | work = cancel_delayed_work(&tty->flip.work); | 772 | work = cancel_delayed_work(&tty->buf.work); |
564 | /* | 773 | /* |
565 | * Wait for ->hangup_work and ->flip.work handlers to terminate | 774 | * Wait for ->hangup_work and ->buf.work handlers to terminate |
566 | */ | 775 | */ |
567 | 776 | ||
568 | flush_scheduled_work(); | 777 | flush_scheduled_work(); |
@@ -616,7 +825,7 @@ restart: | |||
616 | /* Restart it in case no characters kick it off. Safe if | 825 | /* Restart it in case no characters kick it off. Safe if |
617 | already running */ | 826 | already running */ |
618 | if (work) | 827 | if (work) |
619 | schedule_delayed_work(&tty->flip.work, 1); | 828 | schedule_delayed_work(&tty->buf.work, 1); |
620 | return retval; | 829 | return retval; |
621 | } | 830 | } |
622 | 831 | ||
@@ -1721,10 +1930,10 @@ static void release_dev(struct file * filp) | |||
1721 | */ | 1930 | */ |
1722 | clear_bit(TTY_LDISC, &tty->flags); | 1931 | clear_bit(TTY_LDISC, &tty->flags); |
1723 | clear_bit(TTY_DONT_FLIP, &tty->flags); | 1932 | clear_bit(TTY_DONT_FLIP, &tty->flags); |
1724 | cancel_delayed_work(&tty->flip.work); | 1933 | cancel_delayed_work(&tty->buf.work); |
1725 | 1934 | ||
1726 | /* | 1935 | /* |
1727 | * Wait for ->hangup_work and ->flip.work handlers to terminate | 1936 | * Wait for ->hangup_work and ->buf.work handlers to terminate |
1728 | */ | 1937 | */ |
1729 | 1938 | ||
1730 | flush_scheduled_work(); | 1939 | flush_scheduled_work(); |
@@ -2518,17 +2727,15 @@ EXPORT_SYMBOL(do_SAK); | |||
2518 | 2727 | ||
2519 | /* | 2728 | /* |
2520 | * This routine is called out of the software interrupt to flush data | 2729 | * This routine is called out of the software interrupt to flush data |
2521 | * from the flip buffer to the line discipline. | 2730 | * from the buffer chain to the line discipline. |
2522 | */ | 2731 | */ |
2523 | 2732 | ||
2524 | static void flush_to_ldisc(void *private_) | 2733 | static void flush_to_ldisc(void *private_) |
2525 | { | 2734 | { |
2526 | struct tty_struct *tty = (struct tty_struct *) private_; | 2735 | struct tty_struct *tty = (struct tty_struct *) private_; |
2527 | unsigned char *cp; | ||
2528 | char *fp; | ||
2529 | int count; | ||
2530 | unsigned long flags; | 2736 | unsigned long flags; |
2531 | struct tty_ldisc *disc; | 2737 | struct tty_ldisc *disc; |
2738 | struct tty_buffer *tbuf; | ||
2532 | 2739 | ||
2533 | disc = tty_ldisc_ref(tty); | 2740 | disc = tty_ldisc_ref(tty); |
2534 | if (disc == NULL) /* !TTY_LDISC */ | 2741 | if (disc == NULL) /* !TTY_LDISC */ |
@@ -2538,28 +2745,22 @@ static void flush_to_ldisc(void *private_) | |||
2538 | /* | 2745 | /* |
2539 | * Do it after the next timer tick: | 2746 | * Do it after the next timer tick: |
2540 | */ | 2747 | */ |
2541 | schedule_delayed_work(&tty->flip.work, 1); | 2748 | schedule_delayed_work(&tty->buf.work, 1); |
2542 | goto out; | 2749 | goto out; |
2543 | } | 2750 | } |
2544 | spin_lock_irqsave(&tty->read_lock, flags); | 2751 | spin_lock_irqsave(&tty->read_lock, flags); |
2545 | if (tty->flip.buf_num) { | 2752 | while((tbuf = tty->buf.head) != NULL) { |
2546 | cp = tty->flip.char_buf + TTY_FLIPBUF_SIZE; | 2753 | tty->buf.head = tbuf->next; |
2547 | fp = tty->flip.flag_buf + TTY_FLIPBUF_SIZE; | 2754 | spin_unlock_irqrestore(&tty->read_lock, flags); |
2548 | tty->flip.buf_num = 0; | 2755 | /* printk("Process buffer %p for %d\n", tbuf, tbuf->used); */ |
2549 | tty->flip.char_buf_ptr = tty->flip.char_buf; | 2756 | disc->receive_buf(tty, tbuf->char_buf_ptr, |
2550 | tty->flip.flag_buf_ptr = tty->flip.flag_buf; | 2757 | tbuf->flag_buf_ptr, |
2551 | } else { | 2758 | tbuf->used); |
2552 | cp = tty->flip.char_buf; | 2759 | spin_lock_irqsave(&tty->read_lock, flags); |
2553 | fp = tty->flip.flag_buf; | 2760 | tty_buffer_free(tty, tbuf); |
2554 | tty->flip.buf_num = 1; | 2761 | } |
2555 | tty->flip.char_buf_ptr = tty->flip.char_buf + TTY_FLIPBUF_SIZE; | 2762 | tty->buf.tail = NULL; |
2556 | tty->flip.flag_buf_ptr = tty->flip.flag_buf + TTY_FLIPBUF_SIZE; | ||
2557 | } | ||
2558 | count = tty->flip.count; | ||
2559 | tty->flip.count = 0; | ||
2560 | spin_unlock_irqrestore(&tty->read_lock, flags); | 2763 | spin_unlock_irqrestore(&tty->read_lock, flags); |
2561 | |||
2562 | disc->receive_buf(tty, cp, fp, count); | ||
2563 | out: | 2764 | out: |
2564 | tty_ldisc_deref(disc); | 2765 | tty_ldisc_deref(disc); |
2565 | } | 2766 | } |
@@ -2654,11 +2855,12 @@ void tty_flip_buffer_push(struct tty_struct *tty) | |||
2654 | if (tty->low_latency) | 2855 | if (tty->low_latency) |
2655 | flush_to_ldisc((void *) tty); | 2856 | flush_to_ldisc((void *) tty); |
2656 | else | 2857 | else |
2657 | schedule_delayed_work(&tty->flip.work, 1); | 2858 | schedule_delayed_work(&tty->buf.work, 1); |
2658 | } | 2859 | } |
2659 | 2860 | ||
2660 | EXPORT_SYMBOL(tty_flip_buffer_push); | 2861 | EXPORT_SYMBOL(tty_flip_buffer_push); |
2661 | 2862 | ||
2863 | |||
2662 | /* | 2864 | /* |
2663 | * This subroutine initializes a tty structure. | 2865 | * This subroutine initializes a tty structure. |
2664 | */ | 2866 | */ |
@@ -2669,10 +2871,10 @@ static void initialize_tty_struct(struct tty_struct *tty) | |||
2669 | tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); | 2871 | tty_ldisc_assign(tty, tty_ldisc_get(N_TTY)); |
2670 | tty->pgrp = -1; | 2872 | tty->pgrp = -1; |
2671 | tty->overrun_time = jiffies; | 2873 | tty->overrun_time = jiffies; |
2672 | tty->flip.char_buf_ptr = tty->flip.char_buf; | 2874 | tty->buf.head = tty->buf.tail = NULL; |
2673 | tty->flip.flag_buf_ptr = tty->flip.flag_buf; | 2875 | tty_buffer_init(tty); |
2674 | INIT_WORK(&tty->flip.work, flush_to_ldisc, tty); | 2876 | INIT_WORK(&tty->buf.work, flush_to_ldisc, tty); |
2675 | init_MUTEX(&tty->flip.pty_sem); | 2877 | init_MUTEX(&tty->buf.pty_sem); |
2676 | init_MUTEX(&tty->termios_sem); | 2878 | init_MUTEX(&tty->termios_sem); |
2677 | init_waitqueue_head(&tty->write_wait); | 2879 | init_waitqueue_head(&tty->write_wait); |
2678 | init_waitqueue_head(&tty->read_wait); | 2880 | init_waitqueue_head(&tty->read_wait); |
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 4d75c261f98a..cb82ebf4cb07 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -993,11 +993,10 @@ static void vioHandleData(struct HvLpEvent *event) | |||
993 | * Don't attempt to copy more data into the buffer than we | 993 | * Don't attempt to copy more data into the buffer than we |
994 | * have room for because it would fail without indication. | 994 | * have room for because it would fail without indication. |
995 | */ | 995 | */ |
996 | if ((tty->flip.count + 1) > TTY_FLIPBUF_SIZE) { | 996 | if(tty_insert_flip_char(tty, cevent->data[index], TTY_NORMAL) == 0) { |
997 | printk(VIOCONS_KERN_WARN "input buffer overflow!\n"); | 997 | printk(VIOCONS_KERN_WARN "input buffer overflow!\n"); |
998 | break; | 998 | break; |
999 | } | 999 | } |
1000 | tty_insert_flip_char(tty, cevent->data[index], TTY_NORMAL); | ||
1001 | } | 1000 | } |
1002 | 1001 | ||
1003 | /* if cevent->len == 0 then no data was added to the buffer and flip.count == 0 */ | 1002 | /* if cevent->len == 0 then no data was added to the buffer and flip.count == 0 */ |
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index 19ba83635dd7..d9325281e482 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -434,13 +434,7 @@ static irqreturn_t scc_rx_int(int irq, void *data, struct pt_regs *fp) | |||
434 | SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET); | 434 | SCCwrite_NB(COMMAND_REG, CR_HIGHEST_IUS_RESET); |
435 | return IRQ_HANDLED; | 435 | return IRQ_HANDLED; |
436 | } | 436 | } |
437 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 437 | tty_insert_flip_char(tty, ch, 0); |
438 | *tty->flip.char_buf_ptr = ch; | ||
439 | *tty->flip.flag_buf_ptr = 0; | ||
440 | tty->flip.flag_buf_ptr++; | ||
441 | tty->flip.char_buf_ptr++; | ||
442 | tty->flip.count++; | ||
443 | } | ||
444 | 438 | ||
445 | /* Check if another character is already ready; in that case, the | 439 | /* Check if another character is already ready; in that case, the |
446 | * spcond_int() function must be used, because this character may have an | 440 | * spcond_int() function must be used, because this character may have an |
@@ -487,13 +481,7 @@ static irqreturn_t scc_spcond_int(int irq, void *data, struct pt_regs *fp) | |||
487 | else | 481 | else |
488 | err = 0; | 482 | err = 0; |
489 | 483 | ||
490 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 484 | tty_insert_flip_char(tty, ch, err); |
491 | *tty->flip.char_buf_ptr = ch; | ||
492 | *tty->flip.flag_buf_ptr = err; | ||
493 | tty->flip.flag_buf_ptr++; | ||
494 | tty->flip.char_buf_ptr++; | ||
495 | tty->flip.count++; | ||
496 | } | ||
497 | 485 | ||
498 | /* ++TeSche: *All* errors have to be cleared manually, | 486 | /* ++TeSche: *All* errors have to be cleared manually, |
499 | * else the condition persists for the next chars | 487 | * else the condition persists for the next chars |
@@ -875,13 +863,13 @@ static int scc_open (struct tty_struct * tty, struct file * filp) | |||
875 | local_irq_save(flags); | 863 | local_irq_save(flags); |
876 | #if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) | 864 | #if defined(CONFIG_MVME147_SCC) || defined(CONFIG_MVME162_SCC) |
877 | if (MACH_IS_MVME147 || MACH_IS_MVME16x) { | 865 | if (MACH_IS_MVME147 || MACH_IS_MVME16x) { |
878 | for (i=0; i<sizeof(mvme_init_tab)/sizeof(*mvme_init_tab); ++i) | 866 | for (i = 0; i < ARRAY_SIZE(mvme_init_tab); ++i) |
879 | SCCwrite(mvme_init_tab[i].reg, mvme_init_tab[i].val); | 867 | SCCwrite(mvme_init_tab[i].reg, mvme_init_tab[i].val); |
880 | } | 868 | } |
881 | #endif | 869 | #endif |
882 | #if defined(CONFIG_BVME6000_SCC) | 870 | #if defined(CONFIG_BVME6000_SCC) |
883 | if (MACH_IS_BVME6000) { | 871 | if (MACH_IS_BVME6000) { |
884 | for (i=0; i<sizeof(bvme_init_tab)/sizeof(*bvme_init_tab); ++i) | 872 | for (i = 0; i < ARRAY_SIZE(bvme_init_tab); ++i) |
885 | SCCwrite(bvme_init_tab[i].reg, bvme_init_tab[i].val); | 873 | SCCwrite(bvme_init_tab[i].reg, bvme_init_tab[i].val); |
886 | } | 874 | } |
887 | #endif | 875 | #endif |
diff --git a/drivers/char/vr41xx_rtc.c b/drivers/char/vr41xx_rtc.c index 435b30748e23..159acd8b7788 100644 --- a/drivers/char/vr41xx_rtc.c +++ b/drivers/char/vr41xx_rtc.c | |||
@@ -127,8 +127,6 @@ struct resource rtc_resource[2] = { | |||
127 | .flags = IORESOURCE_MEM, }, | 127 | .flags = IORESOURCE_MEM, }, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | #define RTC_NUM_RESOURCES sizeof(rtc_resource) / sizeof(struct resource) | ||
131 | |||
132 | static inline unsigned long read_elapsed_second(void) | 130 | static inline unsigned long read_elapsed_second(void) |
133 | { | 131 | { |
134 | unsigned long first_low, first_mid, first_high; | 132 | unsigned long first_low, first_mid, first_high; |
@@ -686,7 +684,8 @@ static int __devinit vr41xx_rtc_init(void) | |||
686 | break; | 684 | break; |
687 | } | 685 | } |
688 | 686 | ||
689 | rtc_platform_device = platform_device_register_simple("RTC", -1, rtc_resource, RTC_NUM_RESOURCES); | 687 | rtc_platform_device = platform_device_register_simple("RTC", -1, |
688 | rtc_resource, ARRAY_SIZE(rtc_resource)); | ||
690 | if (IS_ERR(rtc_platform_device)) | 689 | if (IS_ERR(rtc_platform_device)) |
691 | return PTR_ERR(rtc_platform_device); | 690 | return PTR_ERR(rtc_platform_device); |
692 | 691 | ||
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index e91268e86833..f1d9cb7feae6 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2758,29 +2758,6 @@ static void set_vesa_blanking(char __user *p) | |||
2758 | vesa_blank_mode = (mode < 4) ? mode : 0; | 2758 | vesa_blank_mode = (mode < 4) ? mode : 0; |
2759 | } | 2759 | } |
2760 | 2760 | ||
2761 | /* | ||
2762 | * This is called by a timer handler | ||
2763 | */ | ||
2764 | static void vesa_powerdown(void) | ||
2765 | { | ||
2766 | struct vc_data *c = vc_cons[fg_console].d; | ||
2767 | /* | ||
2768 | * Power down if currently suspended (1 or 2), | ||
2769 | * suspend if currently blanked (0), | ||
2770 | * else do nothing (i.e. already powered down (3)). | ||
2771 | * Called only if powerdown features are allowed. | ||
2772 | */ | ||
2773 | switch (vesa_blank_mode) { | ||
2774 | case VESA_NO_BLANKING: | ||
2775 | c->vc_sw->con_blank(c, VESA_VSYNC_SUSPEND+1, 0); | ||
2776 | break; | ||
2777 | case VESA_VSYNC_SUSPEND: | ||
2778 | case VESA_HSYNC_SUSPEND: | ||
2779 | c->vc_sw->con_blank(c, VESA_POWERDOWN+1, 0); | ||
2780 | break; | ||
2781 | } | ||
2782 | } | ||
2783 | |||
2784 | void do_blank_screen(int entering_gfx) | 2761 | void do_blank_screen(int entering_gfx) |
2785 | { | 2762 | { |
2786 | struct vc_data *vc = vc_cons[fg_console].d; | 2763 | struct vc_data *vc = vc_cons[fg_console].d; |
@@ -2791,8 +2768,7 @@ void do_blank_screen(int entering_gfx) | |||
2791 | if (console_blanked) { | 2768 | if (console_blanked) { |
2792 | if (blank_state == blank_vesa_wait) { | 2769 | if (blank_state == blank_vesa_wait) { |
2793 | blank_state = blank_off; | 2770 | blank_state = blank_off; |
2794 | vesa_powerdown(); | 2771 | vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); |
2795 | |||
2796 | } | 2772 | } |
2797 | return; | 2773 | return; |
2798 | } | 2774 | } |
@@ -2822,7 +2798,7 @@ void do_blank_screen(int entering_gfx) | |||
2822 | 2798 | ||
2823 | save_screen(vc); | 2799 | save_screen(vc); |
2824 | /* In case we need to reset origin, blanking hook returns 1 */ | 2800 | /* In case we need to reset origin, blanking hook returns 1 */ |
2825 | i = vc->vc_sw->con_blank(vc, 1, 0); | 2801 | i = vc->vc_sw->con_blank(vc, vesa_off_interval ? 1 : (vesa_blank_mode + 1), 0); |
2826 | console_blanked = fg_console + 1; | 2802 | console_blanked = fg_console + 1; |
2827 | if (i) | 2803 | if (i) |
2828 | set_origin(vc); | 2804 | set_origin(vc); |
@@ -2830,13 +2806,10 @@ void do_blank_screen(int entering_gfx) | |||
2830 | if (console_blank_hook && console_blank_hook(1)) | 2806 | if (console_blank_hook && console_blank_hook(1)) |
2831 | return; | 2807 | return; |
2832 | 2808 | ||
2833 | if (vesa_off_interval) { | 2809 | if (vesa_off_interval && vesa_blank_mode) { |
2834 | blank_state = blank_vesa_wait; | 2810 | blank_state = blank_vesa_wait; |
2835 | mod_timer(&console_timer, jiffies + vesa_off_interval); | 2811 | mod_timer(&console_timer, jiffies + vesa_off_interval); |
2836 | } | 2812 | } |
2837 | |||
2838 | if (vesa_blank_mode) | ||
2839 | vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0); | ||
2840 | } | 2813 | } |
2841 | EXPORT_SYMBOL(do_blank_screen); | 2814 | EXPORT_SYMBOL(do_blank_screen); |
2842 | 2815 | ||
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 385e52930c02..4b4d7db1ff7b 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c | |||
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/ktime.h> | ||
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | #include <asm/atomic.h> | 29 | #include <asm/atomic.h> |
29 | 30 | ||
@@ -56,7 +57,7 @@ void proc_fork_connector(struct task_struct *task) | |||
56 | msg = (struct cn_msg*)buffer; | 57 | msg = (struct cn_msg*)buffer; |
57 | ev = (struct proc_event*)msg->data; | 58 | ev = (struct proc_event*)msg->data; |
58 | get_seq(&msg->seq, &ev->cpu); | 59 | get_seq(&msg->seq, &ev->cpu); |
59 | getnstimestamp(&ev->timestamp); | 60 | ktime_get_ts(&ev->timestamp); /* get high res monotonic timestamp */ |
60 | ev->what = PROC_EVENT_FORK; | 61 | ev->what = PROC_EVENT_FORK; |
61 | ev->event_data.fork.parent_pid = task->real_parent->pid; | 62 | ev->event_data.fork.parent_pid = task->real_parent->pid; |
62 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; | 63 | ev->event_data.fork.parent_tgid = task->real_parent->tgid; |
@@ -82,7 +83,7 @@ void proc_exec_connector(struct task_struct *task) | |||
82 | msg = (struct cn_msg*)buffer; | 83 | msg = (struct cn_msg*)buffer; |
83 | ev = (struct proc_event*)msg->data; | 84 | ev = (struct proc_event*)msg->data; |
84 | get_seq(&msg->seq, &ev->cpu); | 85 | get_seq(&msg->seq, &ev->cpu); |
85 | getnstimestamp(&ev->timestamp); | 86 | ktime_get_ts(&ev->timestamp); |
86 | ev->what = PROC_EVENT_EXEC; | 87 | ev->what = PROC_EVENT_EXEC; |
87 | ev->event_data.exec.process_pid = task->pid; | 88 | ev->event_data.exec.process_pid = task->pid; |
88 | ev->event_data.exec.process_tgid = task->tgid; | 89 | ev->event_data.exec.process_tgid = task->tgid; |
@@ -116,7 +117,7 @@ void proc_id_connector(struct task_struct *task, int which_id) | |||
116 | } else | 117 | } else |
117 | return; | 118 | return; |
118 | get_seq(&msg->seq, &ev->cpu); | 119 | get_seq(&msg->seq, &ev->cpu); |
119 | getnstimestamp(&ev->timestamp); | 120 | ktime_get_ts(&ev->timestamp); |
120 | 121 | ||
121 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); | 122 | memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); |
122 | msg->ack = 0; /* not used */ | 123 | msg->ack = 0; /* not used */ |
@@ -136,7 +137,7 @@ void proc_exit_connector(struct task_struct *task) | |||
136 | msg = (struct cn_msg*)buffer; | 137 | msg = (struct cn_msg*)buffer; |
137 | ev = (struct proc_event*)msg->data; | 138 | ev = (struct proc_event*)msg->data; |
138 | get_seq(&msg->seq, &ev->cpu); | 139 | get_seq(&msg->seq, &ev->cpu); |
139 | getnstimestamp(&ev->timestamp); | 140 | ktime_get_ts(&ev->timestamp); |
140 | ev->what = PROC_EVENT_EXIT; | 141 | ev->what = PROC_EVENT_EXIT; |
141 | ev->event_data.exit.process_pid = task->pid; | 142 | ev->event_data.exit.process_pid = task->pid; |
142 | ev->event_data.exit.process_tgid = task->tgid; | 143 | ev->event_data.exit.process_tgid = task->tgid; |
@@ -169,7 +170,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack) | |||
169 | msg = (struct cn_msg*)buffer; | 170 | msg = (struct cn_msg*)buffer; |
170 | ev = (struct proc_event*)msg->data; | 171 | ev = (struct proc_event*)msg->data; |
171 | msg->seq = rcvd_seq; | 172 | msg->seq = rcvd_seq; |
172 | getnstimestamp(&ev->timestamp); | 173 | ktime_get_ts(&ev->timestamp); |
173 | ev->cpu = -1; | 174 | ev->cpu = -1; |
174 | ev->what = PROC_EVENT_NONE; | 175 | ev->what = PROC_EVENT_NONE; |
175 | ev->event_data.ack.err = err; | 176 | ev->event_data.ack.err = err; |
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 211641a54398..fe06ebb0e5bf 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | #define PDC202_DEBUG_CABLE 0 | 40 | #define PDC202_DEBUG_CABLE 0 |
41 | 41 | ||
42 | const static char *pdc_quirk_drives[] = { | 42 | static const char *pdc_quirk_drives[] = { |
43 | "QUANTUM FIREBALLlct08 08", | 43 | "QUANTUM FIREBALLlct08 08", |
44 | "QUANTUM FIREBALLP KA6.4", | 44 | "QUANTUM FIREBALLP KA6.4", |
45 | "QUANTUM FIREBALLP KA9.1", | 45 | "QUANTUM FIREBALLP KA9.1", |
diff --git a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c index 75897509c401..17390d762cf7 100644 --- a/drivers/ieee1394/amdtp.c +++ b/drivers/ieee1394/amdtp.c | |||
@@ -80,7 +80,6 @@ | |||
80 | #include <linux/pci.h> | 80 | #include <linux/pci.h> |
81 | #include <linux/interrupt.h> | 81 | #include <linux/interrupt.h> |
82 | #include <linux/poll.h> | 82 | #include <linux/poll.h> |
83 | #include <linux/ioctl32.h> | ||
84 | #include <linux/compat.h> | 83 | #include <linux/compat.h> |
85 | #include <linux/cdev.h> | 84 | #include <linux/cdev.h> |
86 | #include <asm/uaccess.h> | 85 | #include <asm/uaccess.h> |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 196db7439272..efeaa944bd0a 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -108,7 +108,6 @@ | |||
108 | #include <linux/types.h> | 108 | #include <linux/types.h> |
109 | #include <linux/vmalloc.h> | 109 | #include <linux/vmalloc.h> |
110 | #include <linux/string.h> | 110 | #include <linux/string.h> |
111 | #include <linux/ioctl32.h> | ||
112 | #include <linux/compat.h> | 111 | #include <linux/compat.h> |
113 | #include <linux/cdev.h> | 112 | #include <linux/cdev.h> |
114 | 113 | ||
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 608479b2df14..39fb88309e8e 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/vmalloc.h> | 48 | #include <linux/vmalloc.h> |
49 | #include <linux/timex.h> | 49 | #include <linux/timex.h> |
50 | #include <linux/mm.h> | 50 | #include <linux/mm.h> |
51 | #include <linux/ioctl32.h> | ||
52 | #include <linux/compat.h> | 51 | #include <linux/compat.h> |
53 | #include <linux/cdev.h> | 52 | #include <linux/cdev.h> |
54 | 53 | ||
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 1bd88fca0542..54a680cc704d 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -96,6 +96,7 @@ static int serport_ldisc_open(struct tty_struct *tty) | |||
96 | init_waitqueue_head(&serport->wait); | 96 | init_waitqueue_head(&serport->wait); |
97 | 97 | ||
98 | tty->disc_data = serport; | 98 | tty->disc_data = serport; |
99 | tty->receive_room = 256; | ||
99 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 100 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
100 | 101 | ||
101 | return 0; | 102 | return 0; |
@@ -140,17 +141,6 @@ out: | |||
140 | } | 141 | } |
141 | 142 | ||
142 | /* | 143 | /* |
143 | * serport_ldisc_room() reports how much room we do have for receiving data. | ||
144 | * Although we in fact have infinite room, we need to specify some value | ||
145 | * here, and 256 seems to be reasonable. | ||
146 | */ | ||
147 | |||
148 | static int serport_ldisc_room(struct tty_struct *tty) | ||
149 | { | ||
150 | return 256; | ||
151 | } | ||
152 | |||
153 | /* | ||
154 | * serport_ldisc_read() just waits indefinitely if everything goes well. | 144 | * serport_ldisc_read() just waits indefinitely if everything goes well. |
155 | * However, when the serio driver closes the serio port, it finishes, | 145 | * However, when the serio driver closes the serio port, it finishes, |
156 | * returning 0 characters. | 146 | * returning 0 characters. |
@@ -237,7 +227,6 @@ static struct tty_ldisc serport_ldisc = { | |||
237 | .read = serport_ldisc_read, | 227 | .read = serport_ldisc_read, |
238 | .ioctl = serport_ldisc_ioctl, | 228 | .ioctl = serport_ldisc_ioctl, |
239 | .receive_buf = serport_ldisc_receive, | 229 | .receive_buf = serport_ldisc_receive, |
240 | .receive_room = serport_ldisc_room, | ||
241 | .write_wakeup = serport_ldisc_write_wakeup | 230 | .write_wakeup = serport_ldisc_write_wakeup |
242 | }; | 231 | }; |
243 | 232 | ||
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 11ae0fddea04..623adbb0d13a 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -463,8 +463,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb) | |||
463 | #endif | 463 | #endif |
464 | goto bad; | 464 | goto bad; |
465 | } | 465 | } |
466 | if (ld->receive_room && | 466 | if (mp->tty->receive_room < datalen) { |
467 | ld->receive_room(mp->tty) < datalen) { | ||
468 | #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) | 467 | #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS) |
469 | printk(KERN_DEBUG "capi: no room in tty\n"); | 468 | printk(KERN_DEBUG "capi: no room in tty\n"); |
470 | #endif | 469 | #endif |
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 4643df097bfe..22759c01746a 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -857,6 +857,118 @@ isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_que | |||
857 | return count; | 857 | return count; |
858 | } | 858 | } |
859 | 859 | ||
860 | /* | ||
861 | * isdn_readbchan_tty() tries to get data from the read-queue. | ||
862 | * It MUST be called with interrupts off. | ||
863 | * | ||
864 | * Be aware that this is not an atomic operation when sleep != 0, even though | ||
865 | * interrupts are turned off! Well, like that we are currently only called | ||
866 | * on behalf of a read system call on raw device files (which are documented | ||
867 | * to be dangerous and for for debugging purpose only). The inode semaphore | ||
868 | * takes care that this is not called for the same minor device number while | ||
869 | * we are sleeping, but access is not serialized against simultaneous read() | ||
870 | * from the corresponding ttyI device. Can other ugly events, like changes | ||
871 | * of the mapping (di,ch)<->minor, happen during the sleep? --he | ||
872 | */ | ||
873 | int | ||
874 | isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack) | ||
875 | { | ||
876 | int count; | ||
877 | int count_pull; | ||
878 | int count_put; | ||
879 | int dflag; | ||
880 | struct sk_buff *skb; | ||
881 | char last = 0; | ||
882 | int len; | ||
883 | |||
884 | if (!dev->drv[di]) | ||
885 | return 0; | ||
886 | if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) | ||
887 | return 0; | ||
888 | |||
889 | len = tty_buffer_request_room(tty, dev->drv[di]->rcvcount[channel]); | ||
890 | if(len == 0) | ||
891 | return len; | ||
892 | |||
893 | count = 0; | ||
894 | while (len) { | ||
895 | if (!(skb = skb_peek(&dev->drv[di]->rpqueue[channel]))) | ||
896 | break; | ||
897 | #ifdef CONFIG_ISDN_AUDIO | ||
898 | if (ISDN_AUDIO_SKB_LOCK(skb)) | ||
899 | break; | ||
900 | ISDN_AUDIO_SKB_LOCK(skb) = 1; | ||
901 | if ((ISDN_AUDIO_SKB_DLECOUNT(skb)) || (dev->drv[di]->DLEflag & (1 << channel))) { | ||
902 | char *p = skb->data; | ||
903 | unsigned long DLEmask = (1 << channel); | ||
904 | |||
905 | dflag = 0; | ||
906 | count_pull = count_put = 0; | ||
907 | while ((count_pull < skb->len) && (len > 0)) { | ||
908 | len--; | ||
909 | if (dev->drv[di]->DLEflag & DLEmask) { | ||
910 | last = DLE; | ||
911 | dev->drv[di]->DLEflag &= ~DLEmask; | ||
912 | } else { | ||
913 | last = *p; | ||
914 | if (last == DLE) { | ||
915 | dev->drv[di]->DLEflag |= DLEmask; | ||
916 | (ISDN_AUDIO_SKB_DLECOUNT(skb))--; | ||
917 | } | ||
918 | p++; | ||
919 | count_pull++; | ||
920 | } | ||
921 | count_put++; | ||
922 | } | ||
923 | if (count_pull >= skb->len) | ||
924 | dflag = 1; | ||
925 | } else { | ||
926 | #endif | ||
927 | /* No DLE's in buff, so simply copy it */ | ||
928 | dflag = 1; | ||
929 | if ((count_pull = skb->len) > len) { | ||
930 | count_pull = len; | ||
931 | dflag = 0; | ||
932 | } | ||
933 | count_put = count_pull; | ||
934 | if(count_put > 1) | ||
935 | tty_insert_flip_string(tty, skb->data, count_put - 1); | ||
936 | last = skb->data[count_put] - 1; | ||
937 | len -= count_put; | ||
938 | #ifdef CONFIG_ISDN_AUDIO | ||
939 | } | ||
940 | #endif | ||
941 | count += count_put; | ||
942 | if (dflag) { | ||
943 | /* We got all the data in this buff. | ||
944 | * Now we can dequeue it. | ||
945 | */ | ||
946 | if(cisco_hack) | ||
947 | tty_insert_flip_char(tty, last, 0xFF); | ||
948 | else | ||
949 | tty_insert_flip_char(tty, last, TTY_NORMAL); | ||
950 | #ifdef CONFIG_ISDN_AUDIO | ||
951 | ISDN_AUDIO_SKB_LOCK(skb) = 0; | ||
952 | #endif | ||
953 | skb = skb_dequeue(&dev->drv[di]->rpqueue[channel]); | ||
954 | dev_kfree_skb(skb); | ||
955 | } else { | ||
956 | tty_insert_flip_char(tty, last, TTY_NORMAL); | ||
957 | /* Not yet emptied this buff, so it | ||
958 | * must stay in the queue, for further calls | ||
959 | * but we pull off the data we got until now. | ||
960 | */ | ||
961 | skb_pull(skb, count_pull); | ||
962 | #ifdef CONFIG_ISDN_AUDIO | ||
963 | ISDN_AUDIO_SKB_LOCK(skb) = 0; | ||
964 | #endif | ||
965 | } | ||
966 | dev->drv[di]->rcvcount[channel] -= count_put; | ||
967 | } | ||
968 | return count; | ||
969 | } | ||
970 | |||
971 | |||
860 | static __inline int | 972 | static __inline int |
861 | isdn_minor2drv(int minor) | 973 | isdn_minor2drv(int minor) |
862 | { | 974 | { |
diff --git a/drivers/isdn/i4l/isdn_common.h b/drivers/isdn/i4l/isdn_common.h index e27e9c3a81ed..082735dbb412 100644 --- a/drivers/isdn/i4l/isdn_common.h +++ b/drivers/isdn/i4l/isdn_common.h | |||
@@ -37,6 +37,7 @@ extern void isdn_timer_ctrl(int tf, int onoff); | |||
37 | extern void isdn_unexclusive_channel(int di, int ch); | 37 | extern void isdn_unexclusive_channel(int di, int ch); |
38 | extern int isdn_getnum(char **); | 38 | extern int isdn_getnum(char **); |
39 | extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *); | 39 | extern int isdn_readbchan(int, int, u_char *, u_char *, int, wait_queue_head_t *); |
40 | extern int isdn_readbchan_tty(int, int, struct tty_struct *, int); | ||
40 | extern int isdn_get_free_channel(int, int, int, int, int, char *); | 41 | extern int isdn_get_free_channel(int, int, int, int, int, char *); |
41 | extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *); | 42 | extern int isdn_writebuf_skb_stub(int, int, int, struct sk_buff *); |
42 | extern int register_isdn(isdn_if * i); | 43 | extern int register_isdn(isdn_if * i); |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index 8c404b4e2482..f190a99604f0 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -64,37 +64,42 @@ isdn_tty_try_read(modem_info * info, struct sk_buff *skb) | |||
64 | int c; | 64 | int c; |
65 | int len; | 65 | int len; |
66 | struct tty_struct *tty; | 66 | struct tty_struct *tty; |
67 | char last; | ||
67 | 68 | ||
68 | if (info->online) { | 69 | if (info->online) { |
69 | if ((tty = info->tty)) { | 70 | if ((tty = info->tty)) { |
70 | if (info->mcr & UART_MCR_RTS) { | 71 | if (info->mcr & UART_MCR_RTS) { |
71 | c = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
72 | len = skb->len | 72 | len = skb->len |
73 | #ifdef CONFIG_ISDN_AUDIO | 73 | #ifdef CONFIG_ISDN_AUDIO |
74 | + ISDN_AUDIO_SKB_DLECOUNT(skb) | 74 | + ISDN_AUDIO_SKB_DLECOUNT(skb) |
75 | #endif | 75 | #endif |
76 | ; | 76 | ; |
77 | |||
78 | c = tty_buffer_request_room(tty, len); | ||
77 | if (c >= len) { | 79 | if (c >= len) { |
78 | #ifdef CONFIG_ISDN_AUDIO | 80 | #ifdef CONFIG_ISDN_AUDIO |
79 | if (ISDN_AUDIO_SKB_DLECOUNT(skb)) | 81 | if (ISDN_AUDIO_SKB_DLECOUNT(skb)) { |
80 | while (skb->len--) { | 82 | int l = skb->len; |
83 | unsigned char *dp = skb->data; | ||
84 | while (--l) { | ||
81 | if (*skb->data == DLE) | 85 | if (*skb->data == DLE) |
82 | tty_insert_flip_char(tty, DLE, 0); | 86 | tty_insert_flip_char(tty, DLE, 0); |
83 | tty_insert_flip_char(tty, *skb->data++, 0); | 87 | tty_insert_flip_char(tty, *dp++, 0); |
88 | } | ||
89 | last = *dp; | ||
84 | } else { | 90 | } else { |
85 | #endif | 91 | #endif |
86 | memcpy(tty->flip.char_buf_ptr, | 92 | if(len > 1) |
87 | skb->data, len); | 93 | tty_insert_flip_string(tty, skb->data, len - 1); |
88 | tty->flip.count += len; | 94 | last = skb->data[len - 1]; |
89 | tty->flip.char_buf_ptr += len; | ||
90 | memset(tty->flip.flag_buf_ptr, 0, len); | ||
91 | tty->flip.flag_buf_ptr += len; | ||
92 | #ifdef CONFIG_ISDN_AUDIO | 95 | #ifdef CONFIG_ISDN_AUDIO |
93 | } | 96 | } |
94 | #endif | 97 | #endif |
95 | if (info->emu.mdmreg[REG_CPPP] & BIT_CPPP) | 98 | if (info->emu.mdmreg[REG_CPPP] & BIT_CPPP) |
96 | tty->flip.flag_buf_ptr[len - 1] = 0xff; | 99 | tty_insert_flip_char(tty, last, 0xFF); |
97 | schedule_delayed_work(&tty->flip.work, 1); | 100 | else |
101 | tty_insert_flip_char(tty, last, TTY_NORMAL); | ||
102 | tty_flip_buffer_push(tty); | ||
98 | kfree_skb(skb); | 103 | kfree_skb(skb); |
99 | return 1; | 104 | return 1; |
100 | } | 105 | } |
@@ -114,7 +119,6 @@ isdn_tty_readmodem(void) | |||
114 | int resched = 0; | 119 | int resched = 0; |
115 | int midx; | 120 | int midx; |
116 | int i; | 121 | int i; |
117 | int c; | ||
118 | int r; | 122 | int r; |
119 | struct tty_struct *tty; | 123 | struct tty_struct *tty; |
120 | modem_info *info; | 124 | modem_info *info; |
@@ -131,20 +135,13 @@ isdn_tty_readmodem(void) | |||
131 | #endif | 135 | #endif |
132 | if ((tty = info->tty)) { | 136 | if ((tty = info->tty)) { |
133 | if (info->mcr & UART_MCR_RTS) { | 137 | if (info->mcr & UART_MCR_RTS) { |
134 | c = TTY_FLIPBUF_SIZE - tty->flip.count; | 138 | /* CISCO AsyncPPP Hack */ |
135 | if (c > 0) { | 139 | if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) |
136 | r = isdn_readbchan(info->isdn_driver, info->isdn_channel, | 140 | r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 0); |
137 | tty->flip.char_buf_ptr, | 141 | else |
138 | tty->flip.flag_buf_ptr, c, NULL); | 142 | r = isdn_readbchan_tty(info->isdn_driver, info->isdn_channel, tty, 1); |
139 | /* CISCO AsyncPPP Hack */ | 143 | if (r) |
140 | if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP)) | 144 | tty_flip_buffer_push(tty); |
141 | memset(tty->flip.flag_buf_ptr, 0, r); | ||
142 | tty->flip.count += r; | ||
143 | tty->flip.flag_buf_ptr += r; | ||
144 | tty->flip.char_buf_ptr += r; | ||
145 | if (r) | ||
146 | schedule_delayed_work(&tty->flip.work, 1); | ||
147 | } | ||
148 | } else | 145 | } else |
149 | r = 1; | 146 | r = 1; |
150 | } else | 147 | } else |
@@ -249,7 +246,7 @@ isdn_tty_rcv_skb(int i, int di, int channel, struct sk_buff *skb) | |||
249 | } | 246 | } |
250 | #endif | 247 | #endif |
251 | #endif | 248 | #endif |
252 | /* Try to deliver directly via tty-flip-buf if queue is empty */ | 249 | /* Try to deliver directly via tty-buf if queue is empty */ |
253 | spin_lock_irqsave(&info->readlock, flags); | 250 | spin_lock_irqsave(&info->readlock, flags); |
254 | if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) | 251 | if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) |
255 | if (isdn_tty_try_read(info, skb)) { | 252 | if (isdn_tty_try_read(info, skb)) { |
@@ -534,7 +531,7 @@ isdn_tty_senddown(modem_info * info) | |||
534 | /* The next routine is called once from within timer-interrupt | 531 | /* The next routine is called once from within timer-interrupt |
535 | * triggered within isdn_tty_modem_ncarrier(). It calls | 532 | * triggered within isdn_tty_modem_ncarrier(). It calls |
536 | * isdn_tty_modem_result() to stuff a "NO CARRIER" Message | 533 | * isdn_tty_modem_result() to stuff a "NO CARRIER" Message |
537 | * into the tty's flip-buffer. | 534 | * into the tty's buffer. |
538 | */ | 535 | */ |
539 | static void | 536 | static void |
540 | isdn_tty_modem_do_ncarrier(unsigned long data) | 537 | isdn_tty_modem_do_ncarrier(unsigned long data) |
@@ -2347,6 +2344,7 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2347 | u_long flags; | 2344 | u_long flags; |
2348 | struct sk_buff *skb = NULL; | 2345 | struct sk_buff *skb = NULL; |
2349 | char *sp = NULL; | 2346 | char *sp = NULL; |
2347 | int l = strlen(msg); | ||
2350 | 2348 | ||
2351 | if (!msg) { | 2349 | if (!msg) { |
2352 | printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); | 2350 | printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); |
@@ -2359,16 +2357,16 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2359 | return; | 2357 | return; |
2360 | } | 2358 | } |
2361 | 2359 | ||
2362 | /* use queue instead of direct flip, if online and */ | 2360 | /* use queue instead of direct, if online and */ |
2363 | /* data is in queue or flip buffer is full */ | 2361 | /* data is in queue or buffer is full */ |
2364 | if ((info->online) && (((tty->flip.count + strlen(msg)) >= TTY_FLIPBUF_SIZE) || | 2362 | if ((info->online && tty_buffer_request_room(tty, l) < l) || |
2365 | (!skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel])))) { | 2363 | (!skb_queue_empty(&dev->drv[info->isdn_driver]->rpqueue[info->isdn_channel]))) { |
2366 | skb = alloc_skb(strlen(msg), GFP_ATOMIC); | 2364 | skb = alloc_skb(l, GFP_ATOMIC); |
2367 | if (!skb) { | 2365 | if (!skb) { |
2368 | spin_unlock_irqrestore(&info->readlock, flags); | 2366 | spin_unlock_irqrestore(&info->readlock, flags); |
2369 | return; | 2367 | return; |
2370 | } | 2368 | } |
2371 | sp = skb_put(skb, strlen(msg)); | 2369 | sp = skb_put(skb, l); |
2372 | #ifdef CONFIG_ISDN_AUDIO | 2370 | #ifdef CONFIG_ISDN_AUDIO |
2373 | ISDN_AUDIO_SKB_DLECOUNT(skb) = 0; | 2371 | ISDN_AUDIO_SKB_DLECOUNT(skb) = 0; |
2374 | ISDN_AUDIO_SKB_LOCK(skb) = 0; | 2372 | ISDN_AUDIO_SKB_LOCK(skb) = 0; |
@@ -2392,9 +2390,8 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2392 | if (skb) { | 2390 | if (skb) { |
2393 | *sp++ = c; | 2391 | *sp++ = c; |
2394 | } else { | 2392 | } else { |
2395 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | 2393 | if(tty_insert_flip_char(tty, c, TTY_NORMAL) == 0) |
2396 | break; | 2394 | break; |
2397 | tty_insert_flip_char(tty, c, 0); | ||
2398 | } | 2395 | } |
2399 | } | 2396 | } |
2400 | if (skb) { | 2397 | if (skb) { |
@@ -2402,12 +2399,12 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2402 | dev->drv[info->isdn_driver]->rcvcount[info->isdn_channel] += skb->len; | 2399 | dev->drv[info->isdn_driver]->rcvcount[info->isdn_channel] += skb->len; |
2403 | spin_unlock_irqrestore(&info->readlock, flags); | 2400 | spin_unlock_irqrestore(&info->readlock, flags); |
2404 | /* Schedule dequeuing */ | 2401 | /* Schedule dequeuing */ |
2405 | if ((dev->modempoll) && (info->rcvsched)) | 2402 | if (dev->modempoll && info->rcvsched) |
2406 | isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1); | 2403 | isdn_timer_ctrl(ISDN_TIMER_MODEMREAD, 1); |
2407 | 2404 | ||
2408 | } else { | 2405 | } else { |
2409 | spin_unlock_irqrestore(&info->readlock, flags); | 2406 | spin_unlock_irqrestore(&info->readlock, flags); |
2410 | schedule_delayed_work(&tty->flip.work, 1); | 2407 | tty_flip_buffer_push(tty); |
2411 | } | 2408 | } |
2412 | } | 2409 | } |
2413 | 2410 | ||
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index e6aa309a66d7..96f7af4ae400 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -303,6 +303,7 @@ static void print_multipath_conf (multipath_conf_t *conf) | |||
303 | static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | 303 | static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) |
304 | { | 304 | { |
305 | multipath_conf_t *conf = mddev->private; | 305 | multipath_conf_t *conf = mddev->private; |
306 | struct request_queue *q; | ||
306 | int found = 0; | 307 | int found = 0; |
307 | int path; | 308 | int path; |
308 | struct multipath_info *p; | 309 | struct multipath_info *p; |
@@ -311,8 +312,8 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
311 | 312 | ||
312 | for (path=0; path<mddev->raid_disks; path++) | 313 | for (path=0; path<mddev->raid_disks; path++) |
313 | if ((p=conf->multipaths+path)->rdev == NULL) { | 314 | if ((p=conf->multipaths+path)->rdev == NULL) { |
314 | blk_queue_stack_limits(mddev->queue, | 315 | q = rdev->bdev->bd_disk->queue; |
315 | rdev->bdev->bd_disk->queue); | 316 | blk_queue_stack_limits(mddev->queue, q); |
316 | 317 | ||
317 | /* as we don't honour merge_bvec_fn, we must never risk | 318 | /* as we don't honour merge_bvec_fn, we must never risk |
318 | * violating it, so limit ->max_sector to one PAGE, as | 319 | * violating it, so limit ->max_sector to one PAGE, as |
@@ -320,7 +321,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
320 | * (Note: it is very unlikely that a device with | 321 | * (Note: it is very unlikely that a device with |
321 | * merge_bvec_fn will be involved in multipath.) | 322 | * merge_bvec_fn will be involved in multipath.) |
322 | */ | 323 | */ |
323 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 324 | if (q->merge_bvec_fn && |
324 | mddev->queue->max_sectors > (PAGE_SIZE>>9)) | 325 | mddev->queue->max_sectors > (PAGE_SIZE>>9)) |
325 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); | 326 | blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); |
326 | 327 | ||
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index c30effdf711f..36c9f5bf8cdd 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -27,34 +27,30 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/videodev.h> | 28 | #include <linux/videodev.h> |
29 | 29 | ||
30 | #define DRIVER_VERSION "0.04" | 30 | #define DRIVER_VERSION "0.05" |
31 | 31 | ||
32 | #define PCI_VENDOR_ESS 0x125D | 32 | #define GPIO_DATA 0x60 /* port offset from ESS_IO_BASE */ |
33 | #define PCI_DEVICE_ID_ESS_ESS1968 0x1968 /* Maestro 2 */ | ||
34 | #define PCI_DEVICE_ID_ESS_ESS1978 0x1978 /* Maestro 2E */ | ||
35 | |||
36 | #define GPIO_DATA 0x60 /* port offset from ESS_IO_BASE */ | ||
37 | 33 | ||
38 | #define IO_MASK 4 /* mask register offset from GPIO_DATA | 34 | #define IO_MASK 4 /* mask register offset from GPIO_DATA |
39 | bits 1=unmask write to given bit */ | 35 | bits 1=unmask write to given bit */ |
40 | #define IO_DIR 8 /* direction register offset from GPIO_DATA | 36 | #define IO_DIR 8 /* direction register offset from GPIO_DATA |
41 | bits 0/1=read/write direction */ | 37 | bits 0/1=read/write direction */ |
42 | 38 | ||
43 | #define GPIO6 0x0040 /* mask bits for GPIO lines */ | 39 | #define GPIO6 0x0040 /* mask bits for GPIO lines */ |
44 | #define GPIO7 0x0080 | 40 | #define GPIO7 0x0080 |
45 | #define GPIO8 0x0100 | 41 | #define GPIO8 0x0100 |
46 | #define GPIO9 0x0200 | 42 | #define GPIO9 0x0200 |
47 | 43 | ||
48 | #define STR_DATA GPIO6 /* radio TEA5757 pins and GPIO bits */ | 44 | #define STR_DATA GPIO6 /* radio TEA5757 pins and GPIO bits */ |
49 | #define STR_CLK GPIO7 | 45 | #define STR_CLK GPIO7 |
50 | #define STR_WREN GPIO8 | 46 | #define STR_WREN GPIO8 |
51 | #define STR_MOST GPIO9 | 47 | #define STR_MOST GPIO9 |
52 | 48 | ||
53 | #define FREQ_LO 50*16000 | 49 | #define FREQ_LO 50*16000 |
54 | #define FREQ_HI 150*16000 | 50 | #define FREQ_HI 150*16000 |
55 | 51 | ||
56 | #define FREQ_IF 171200 /* 10.7*16000 */ | 52 | #define FREQ_IF 171200 /* 10.7*16000 */ |
57 | #define FREQ_STEP 200 /* 12.5*16 */ | 53 | #define FREQ_STEP 200 /* 12.5*16 */ |
58 | 54 | ||
59 | #define FREQ2BITS(x) ((((unsigned int)(x)+FREQ_IF+(FREQ_STEP<<1))\ | 55 | #define FREQ2BITS(x) ((((unsigned int)(x)+FREQ_IF+(FREQ_STEP<<1))\ |
60 | /(FREQ_STEP<<2))<<2) /* (x==fmhz*16*1000) -> bits */ | 56 | /(FREQ_STEP<<2))<<2) /* (x==fmhz*16*1000) -> bits */ |
@@ -65,7 +61,27 @@ static int radio_nr = -1; | |||
65 | module_param(radio_nr, int, 0); | 61 | module_param(radio_nr, int, 0); |
66 | 62 | ||
67 | static int radio_ioctl(struct inode *inode, struct file *file, | 63 | static int radio_ioctl(struct inode *inode, struct file *file, |
68 | unsigned int cmd, unsigned long arg); | 64 | unsigned int cmd, unsigned long arg); |
65 | static int maestro_probe(struct pci_dev *pdev, const struct pci_device_id *ent); | ||
66 | static void maestro_remove(struct pci_dev *pdev); | ||
67 | |||
68 | static struct pci_device_id maestro_r_pci_tbl[] = { | ||
69 | { PCI_DEVICE(PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ESS1968), | ||
70 | .class = PCI_CLASS_MULTIMEDIA_AUDIO << 8, | ||
71 | .class_mask = 0xffff00 }, | ||
72 | { PCI_DEVICE(PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ESS1978), | ||
73 | .class = PCI_CLASS_MULTIMEDIA_AUDIO << 8, | ||
74 | .class_mask = 0xffff00 }, | ||
75 | { 0 } | ||
76 | }; | ||
77 | MODULE_DEVICE_TABLE(pci, maestro_r_pci_tbl); | ||
78 | |||
79 | static struct pci_driver maestro_r_driver = { | ||
80 | .name = "maestro_radio", | ||
81 | .id_table = maestro_r_pci_tbl, | ||
82 | .probe = maestro_probe, | ||
83 | .remove = __devexit_p(maestro_remove), | ||
84 | }; | ||
69 | 85 | ||
70 | static struct file_operations maestro_fops = { | 86 | static struct file_operations maestro_fops = { |
71 | .owner = THIS_MODULE, | 87 | .owner = THIS_MODULE, |
@@ -76,29 +92,27 @@ static struct file_operations maestro_fops = { | |||
76 | .llseek = no_llseek, | 92 | .llseek = no_llseek, |
77 | }; | 93 | }; |
78 | 94 | ||
79 | static struct video_device maestro_radio= | 95 | static struct video_device maestro_radio = { |
80 | { | ||
81 | .owner = THIS_MODULE, | ||
82 | .name = "Maestro radio", | 96 | .name = "Maestro radio", |
83 | .type = VID_TYPE_TUNER, | 97 | .type = VID_TYPE_TUNER, |
84 | .hardware = VID_HARDWARE_SF16MI, | 98 | .hardware = VID_HARDWARE_SF16MI, |
85 | .fops = &maestro_fops, | 99 | .fops = &maestro_fops, |
86 | }; | 100 | }; |
87 | 101 | ||
88 | static struct radio_device | 102 | struct radio_device { |
89 | { | 103 | u16 io, /* base of Maestro card radio io (GPIO_DATA)*/ |
90 | __u16 io, /* base of Maestro card radio io (GPIO_DATA)*/ | ||
91 | muted, /* VIDEO_AUDIO_MUTE */ | 104 | muted, /* VIDEO_AUDIO_MUTE */ |
92 | stereo, /* VIDEO_TUNER_STEREO_ON */ | 105 | stereo, /* VIDEO_TUNER_STEREO_ON */ |
93 | tuned; /* signal strength (0 or 0xffff) */ | 106 | tuned; /* signal strength (0 or 0xffff) */ |
94 | struct semaphore lock; | 107 | struct semaphore lock; |
95 | } radio_unit = {0, 0, 0, 0, }; | 108 | }; |
96 | 109 | ||
97 | static __u32 radio_bits_get(struct radio_device *dev) | 110 | static u32 radio_bits_get(struct radio_device *dev) |
98 | { | 111 | { |
99 | register __u16 io=dev->io, l, rdata; | 112 | register u16 io=dev->io, l, rdata; |
100 | register __u32 data=0; | 113 | register u32 data=0; |
101 | __u16 omask; | 114 | u16 omask; |
115 | |||
102 | omask = inw(io + IO_MASK); | 116 | omask = inw(io + IO_MASK); |
103 | outw(~(STR_CLK | STR_WREN), io + IO_MASK); | 117 | outw(~(STR_CLK | STR_WREN), io + IO_MASK); |
104 | outw(0, io); | 118 | outw(0, io); |
@@ -121,17 +135,21 @@ static __u32 radio_bits_get(struct radio_device *dev) | |||
121 | data++; | 135 | data++; |
122 | udelay(2); | 136 | udelay(2); |
123 | } | 137 | } |
138 | |||
124 | if(dev->muted) | 139 | if(dev->muted) |
125 | outw(STR_WREN, io); | 140 | outw(STR_WREN, io); |
141 | |||
126 | udelay(4); | 142 | udelay(4); |
127 | outw(omask, io + IO_MASK); | 143 | outw(omask, io + IO_MASK); |
144 | |||
128 | return data & 0x3ffe; | 145 | return data & 0x3ffe; |
129 | } | 146 | } |
130 | 147 | ||
131 | static void radio_bits_set(struct radio_device *dev, __u32 data) | 148 | static void radio_bits_set(struct radio_device *dev, u32 data) |
132 | { | 149 | { |
133 | register __u16 io=dev->io, l, bits; | 150 | register u16 io=dev->io, l, bits; |
134 | __u16 omask, odir; | 151 | u16 omask, odir; |
152 | |||
135 | omask = inw(io + IO_MASK); | 153 | omask = inw(io + IO_MASK); |
136 | odir = (inw(io + IO_DIR) & ~STR_DATA) | (STR_CLK | STR_WREN); | 154 | odir = (inw(io + IO_DIR) & ~STR_DATA) | (STR_CLK | STR_WREN); |
137 | outw(odir | STR_DATA, io + IO_DIR); | 155 | outw(odir | STR_DATA, io + IO_DIR); |
@@ -147,8 +165,10 @@ static void radio_bits_set(struct radio_device *dev, __u32 data) | |||
147 | outw(bits, io); /* LO level */ | 165 | outw(bits, io); /* LO level */ |
148 | udelay(4); | 166 | udelay(4); |
149 | } | 167 | } |
168 | |||
150 | if(!dev->muted) | 169 | if(!dev->muted) |
151 | outw(0, io); | 170 | outw(0, io); |
171 | |||
152 | udelay(4); | 172 | udelay(4); |
153 | outw(omask, io + IO_MASK); | 173 | outw(omask, io + IO_MASK); |
154 | outw(odir, io + IO_DIR); | 174 | outw(odir, io + IO_DIR); |
@@ -156,141 +176,103 @@ static void radio_bits_set(struct radio_device *dev, __u32 data) | |||
156 | } | 176 | } |
157 | 177 | ||
158 | static inline int radio_function(struct inode *inode, struct file *file, | 178 | static inline int radio_function(struct inode *inode, struct file *file, |
159 | unsigned int cmd, void *arg) | 179 | unsigned int cmd, void *arg) |
160 | { | 180 | { |
161 | struct video_device *dev = video_devdata(file); | 181 | struct video_device *dev = video_devdata(file); |
162 | struct radio_device *card=dev->priv; | 182 | struct radio_device *card = video_get_drvdata(dev); |
163 | 183 | ||
164 | switch(cmd) { | 184 | switch (cmd) { |
165 | case VIDIOCGCAP: { | 185 | case VIDIOCGCAP: { |
166 | struct video_capability *v = arg; | 186 | struct video_capability *v = arg; |
167 | memset(v,0,sizeof(*v)); | 187 | memset(v, 0, sizeof(*v)); |
168 | strcpy(v->name, "Maestro radio"); | 188 | strcpy(v->name, "Maestro radio"); |
169 | v->type=VID_TYPE_TUNER; | 189 | v->type = VID_TYPE_TUNER; |
170 | v->channels=v->audios=1; | 190 | v->channels = v->audios = 1; |
171 | return 0; | 191 | return 0; |
172 | } | 192 | } case VIDIOCGTUNER: { |
173 | case VIDIOCGTUNER: { | 193 | struct video_tuner *v = arg; |
174 | struct video_tuner *v = arg; | 194 | if (v->tuner) |
175 | if(v->tuner) | 195 | return -EINVAL; |
176 | return -EINVAL; | 196 | (void)radio_bits_get(card); |
177 | (void)radio_bits_get(card); | 197 | v->flags = VIDEO_TUNER_LOW | card->stereo; |
178 | v->flags = VIDEO_TUNER_LOW | card->stereo; | 198 | v->signal = card->tuned; |
179 | v->signal = card->tuned; | 199 | strcpy(v->name, "FM"); |
180 | strcpy(v->name, "FM"); | 200 | v->rangelow = FREQ_LO; |
181 | v->rangelow = FREQ_LO; | 201 | v->rangehigh = FREQ_HI; |
182 | v->rangehigh = FREQ_HI; | 202 | v->mode = VIDEO_MODE_AUTO; |
183 | v->mode = VIDEO_MODE_AUTO; | 203 | return 0; |
184 | return 0; | 204 | } case VIDIOCSTUNER: { |
185 | } | 205 | struct video_tuner *v = arg; |
186 | case VIDIOCSTUNER: { | 206 | if (v->tuner != 0) |
187 | struct video_tuner *v = arg; | 207 | return -EINVAL; |
188 | if(v->tuner!=0) | 208 | return 0; |
189 | return -EINVAL; | 209 | } case VIDIOCGFREQ: { |
190 | return 0; | 210 | unsigned long *freq = arg; |
191 | } | 211 | *freq = BITS2FREQ(radio_bits_get(card)); |
192 | case VIDIOCGFREQ: { | 212 | return 0; |
193 | unsigned long *freq = arg; | 213 | } case VIDIOCSFREQ: { |
194 | *freq = BITS2FREQ(radio_bits_get(card)); | 214 | unsigned long *freq = arg; |
195 | return 0; | 215 | if (*freq < FREQ_LO || *freq > FREQ_HI) |
196 | } | 216 | return -EINVAL; |
197 | case VIDIOCSFREQ: { | 217 | radio_bits_set(card, FREQ2BITS(*freq)); |
198 | unsigned long *freq = arg; | 218 | return 0; |
199 | if (*freq<FREQ_LO || *freq>FREQ_HI ) | 219 | } case VIDIOCGAUDIO: { |
200 | return -EINVAL; | 220 | struct video_audio *v = arg; |
201 | radio_bits_set(card, FREQ2BITS(*freq)); | 221 | memset(v, 0, sizeof(*v)); |
222 | strcpy(v->name, "Radio"); | ||
223 | v->flags = VIDEO_AUDIO_MUTABLE | card->muted; | ||
224 | v->mode = VIDEO_SOUND_STEREO; | ||
225 | return 0; | ||
226 | } case VIDIOCSAUDIO: { | ||
227 | struct video_audio *v = arg; | ||
228 | if (v->audio) | ||
229 | return -EINVAL; | ||
230 | { | ||
231 | register u16 io = card->io; | ||
232 | register u16 omask = inw(io + IO_MASK); | ||
233 | outw(~STR_WREN, io + IO_MASK); | ||
234 | outw((card->muted = v->flags & VIDEO_AUDIO_MUTE) ? | ||
235 | STR_WREN : 0, io); | ||
236 | udelay(4); | ||
237 | outw(omask, io + IO_MASK); | ||
238 | msleep(125); | ||
202 | return 0; | 239 | return 0; |
203 | } | 240 | } |
204 | case VIDIOCGAUDIO: { | 241 | } case VIDIOCGUNIT: { |
205 | struct video_audio *v = arg; | 242 | struct video_unit *v = arg; |
206 | memset(v,0,sizeof(*v)); | 243 | v->video = VIDEO_NO_UNIT; |
207 | strcpy(v->name, "Radio"); | 244 | v->vbi = VIDEO_NO_UNIT; |
208 | v->flags=VIDEO_AUDIO_MUTABLE | card->muted; | 245 | v->radio = dev->minor; |
209 | v->mode=VIDEO_SOUND_STEREO; | 246 | v->audio = 0; |
210 | return 0; | 247 | v->teletext = VIDEO_NO_UNIT; |
211 | } | 248 | return 0; |
212 | case VIDIOCSAUDIO: { | 249 | } default: |
213 | struct video_audio *v = arg; | 250 | return -ENOIOCTLCMD; |
214 | if(v->audio) | ||
215 | return -EINVAL; | ||
216 | { | ||
217 | register __u16 io=card->io; | ||
218 | register __u16 omask = inw(io + IO_MASK); | ||
219 | outw(~STR_WREN, io + IO_MASK); | ||
220 | outw((card->muted = v->flags & VIDEO_AUDIO_MUTE) | ||
221 | ? STR_WREN : 0, io); | ||
222 | udelay(4); | ||
223 | outw(omask, io + IO_MASK); | ||
224 | msleep(125); | ||
225 | return 0; | ||
226 | } | ||
227 | } | ||
228 | case VIDIOCGUNIT: { | ||
229 | struct video_unit *v = arg; | ||
230 | v->video=VIDEO_NO_UNIT; | ||
231 | v->vbi=VIDEO_NO_UNIT; | ||
232 | v->radio=dev->minor; | ||
233 | v->audio=0; | ||
234 | v->teletext=VIDEO_NO_UNIT; | ||
235 | return 0; | ||
236 | } | ||
237 | default: return -ENOIOCTLCMD; | ||
238 | } | 251 | } |
239 | } | 252 | } |
240 | 253 | ||
241 | static int radio_ioctl(struct inode *inode, struct file *file, | 254 | static int radio_ioctl(struct inode *inode, struct file *file, |
242 | unsigned int cmd, unsigned long arg) | 255 | unsigned int cmd, unsigned long arg) |
243 | { | 256 | { |
244 | struct video_device *dev = video_devdata(file); | 257 | struct video_device *dev = video_devdata(file); |
245 | struct radio_device *card=dev->priv; | 258 | struct radio_device *card = video_get_drvdata(dev); |
246 | int ret; | 259 | int ret; |
247 | 260 | ||
248 | down(&card->lock); | 261 | down(&card->lock); |
249 | ret = video_usercopy(inode, file, cmd, arg, radio_function); | 262 | ret = video_usercopy(inode, file, cmd, arg, radio_function); |
250 | up(&card->lock); | 263 | up(&card->lock); |
251 | return ret; | ||
252 | } | ||
253 | 264 | ||
254 | static __u16 radio_install(struct pci_dev *pcidev); | 265 | return ret; |
255 | |||
256 | MODULE_AUTHOR("Adam Tlalka, atlka@pg.gda.pl"); | ||
257 | MODULE_DESCRIPTION("Radio driver for the Maestro PCI sound card radio."); | ||
258 | MODULE_LICENSE("GPL"); | ||
259 | |||
260 | static void __exit maestro_radio_exit(void) | ||
261 | { | ||
262 | video_unregister_device(&maestro_radio); | ||
263 | } | 266 | } |
264 | 267 | ||
265 | static int __init maestro_radio_init(void) | 268 | static u16 __devinit radio_power_on(struct radio_device *dev) |
266 | { | 269 | { |
267 | register __u16 found=0; | 270 | register u16 io = dev->io; |
268 | struct pci_dev *pcidev = NULL; | 271 | register u32 ofreq; |
269 | while(!found && (pcidev = pci_find_device(PCI_VENDOR_ESS, | 272 | u16 omask, odir; |
270 | PCI_DEVICE_ID_ESS_ESS1968, | ||
271 | pcidev))) | ||
272 | found |= radio_install(pcidev); | ||
273 | while(!found && (pcidev = pci_find_device(PCI_VENDOR_ESS, | ||
274 | PCI_DEVICE_ID_ESS_ESS1978, | ||
275 | pcidev))) | ||
276 | found |= radio_install(pcidev); | ||
277 | if(!found) { | ||
278 | printk(KERN_INFO "radio-maestro: no devices found.\n"); | ||
279 | return -ENODEV; | ||
280 | } | ||
281 | return 0; | ||
282 | } | ||
283 | 273 | ||
284 | module_init(maestro_radio_init); | ||
285 | module_exit(maestro_radio_exit); | ||
286 | |||
287 | static inline __u16 radio_power_on(struct radio_device *dev) | ||
288 | { | ||
289 | register __u16 io=dev->io; | ||
290 | register __u32 ofreq; | ||
291 | __u16 omask, odir; | ||
292 | omask = inw(io + IO_MASK); | 274 | omask = inw(io + IO_MASK); |
293 | odir = (inw(io + IO_DIR) & ~STR_DATA) | (STR_CLK | STR_WREN); | 275 | odir = (inw(io + IO_DIR) & ~STR_DATA) | (STR_CLK | STR_WREN); |
294 | outw(odir & ~STR_WREN, io + IO_DIR); | 276 | outw(odir & ~STR_WREN, io + IO_DIR); |
295 | dev->muted = inw(io) & STR_WREN ? 0 : VIDEO_AUDIO_MUTE; | 277 | dev->muted = inw(io) & STR_WREN ? 0 : VIDEO_AUDIO_MUTE; |
296 | outw(odir, io + IO_DIR); | 278 | outw(odir, io + IO_DIR); |
@@ -299,35 +281,101 @@ static inline __u16 radio_power_on(struct radio_device *dev) | |||
299 | udelay(16); | 281 | udelay(16); |
300 | outw(omask, io + IO_MASK); | 282 | outw(omask, io + IO_MASK); |
301 | ofreq = radio_bits_get(dev); | 283 | ofreq = radio_bits_get(dev); |
302 | if((ofreq<FREQ2BITS(FREQ_LO)) || (ofreq>FREQ2BITS(FREQ_HI))) | 284 | |
285 | if ((ofreq < FREQ2BITS(FREQ_LO)) || (ofreq > FREQ2BITS(FREQ_HI))) | ||
303 | ofreq = FREQ2BITS(FREQ_LO); | 286 | ofreq = FREQ2BITS(FREQ_LO); |
304 | radio_bits_set(dev, ofreq); | 287 | radio_bits_set(dev, ofreq); |
288 | |||
305 | return (ofreq == radio_bits_get(dev)); | 289 | return (ofreq == radio_bits_get(dev)); |
306 | } | 290 | } |
307 | 291 | ||
308 | static __u16 radio_install(struct pci_dev *pcidev) | 292 | static int __devinit maestro_probe(struct pci_dev *pdev, |
293 | const struct pci_device_id *ent) | ||
309 | { | 294 | { |
310 | if(((pcidev->class >> 8) & 0xffff) != PCI_CLASS_MULTIMEDIA_AUDIO) | 295 | struct radio_device *radio_unit; |
311 | return 0; | 296 | struct video_device *maestro_radio_inst; |
312 | 297 | int retval; | |
313 | radio_unit.io = pcidev->resource[0].start + GPIO_DATA; | 298 | |
314 | maestro_radio.priv = &radio_unit; | 299 | retval = pci_enable_device(pdev); |
315 | init_MUTEX(&radio_unit.lock); | 300 | if (retval) { |
316 | 301 | dev_err(&pdev->dev, "enabling pci device failed!\n"); | |
317 | if(radio_power_on(&radio_unit)) { | 302 | goto err; |
318 | if(video_register_device(&maestro_radio, VFL_TYPE_RADIO, radio_nr)==-1) { | 303 | } |
319 | printk("radio-maestro: can't register device!"); | 304 | |
320 | return 0; | 305 | retval = -ENOMEM; |
321 | } | 306 | |
322 | printk(KERN_INFO "radio-maestro: version " | 307 | radio_unit = kzalloc(sizeof(*radio_unit), GFP_KERNEL); |
323 | DRIVER_VERSION | 308 | if (radio_unit == NULL) { |
324 | " time " | 309 | dev_err(&pdev->dev, "not enough memory\n"); |
325 | __TIME__ " " | 310 | goto err; |
326 | __DATE__ | 311 | } |
327 | "\n"); | 312 | |
328 | printk(KERN_INFO "radio-maestro: radio chip initialized\n"); | 313 | radio_unit->io = pci_resource_start(pdev, 0) + GPIO_DATA; |
329 | return 1; | 314 | init_MUTEX(&radio_unit->lock); |
330 | } else | 315 | |
331 | return 0; | 316 | maestro_radio_inst = video_device_alloc(); |
317 | if (maestro_radio_inst == NULL) { | ||
318 | dev_err(&pdev->dev, "not enough memory\n"); | ||
319 | goto errfr; | ||
320 | } | ||
321 | |||
322 | memcpy(maestro_radio_inst, &maestro_radio, sizeof(maestro_radio)); | ||
323 | video_set_drvdata(maestro_radio_inst, radio_unit); | ||
324 | pci_set_drvdata(pdev, maestro_radio_inst); | ||
325 | |||
326 | retval = video_register_device(maestro_radio_inst, VFL_TYPE_RADIO, | ||
327 | radio_nr); | ||
328 | if (retval) { | ||
329 | printk(KERN_ERR "can't register video device!\n"); | ||
330 | goto errfr1; | ||
331 | } | ||
332 | |||
333 | if (!radio_power_on(radio_unit)) { | ||
334 | retval = -EIO; | ||
335 | goto errunr; | ||
336 | } | ||
337 | |||
338 | dev_info(&pdev->dev, "version " DRIVER_VERSION " time " __TIME__ " " | ||
339 | __DATE__ "\n"); | ||
340 | dev_info(&pdev->dev, "radio chip initialized\n"); | ||
341 | |||
342 | return 0; | ||
343 | errunr: | ||
344 | video_unregister_device(maestro_radio_inst); | ||
345 | errfr1: | ||
346 | kfree(maestro_radio_inst); | ||
347 | errfr: | ||
348 | kfree(radio_unit); | ||
349 | err: | ||
350 | return retval; | ||
351 | |||
352 | } | ||
353 | |||
354 | static void __devexit maestro_remove(struct pci_dev *pdev) | ||
355 | { | ||
356 | struct video_device *vdev = pci_get_drvdata(pdev); | ||
357 | |||
358 | video_unregister_device(vdev); | ||
332 | } | 359 | } |
333 | 360 | ||
361 | static int __init maestro_radio_init(void) | ||
362 | { | ||
363 | int retval = pci_register_driver(&maestro_r_driver); | ||
364 | |||
365 | if (retval) | ||
366 | printk(KERN_ERR "error during registration pci driver\n"); | ||
367 | |||
368 | return retval; | ||
369 | } | ||
370 | |||
371 | static void __exit maestro_radio_exit(void) | ||
372 | { | ||
373 | pci_unregister_driver(&maestro_r_driver); | ||
374 | } | ||
375 | |||
376 | module_init(maestro_radio_init); | ||
377 | module_exit(maestro_radio_exit); | ||
378 | |||
379 | MODULE_AUTHOR("Adam Tlalka, atlka@pg.gda.pl"); | ||
380 | MODULE_DESCRIPTION("Radio driver for the Maestro PCI sound card radio."); | ||
381 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index 959d2c5951b8..7c340240a50e 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -2585,8 +2585,6 @@ static struct miscdevice mptctl_miscdev = { | |||
2585 | 2585 | ||
2586 | #ifdef CONFIG_COMPAT | 2586 | #ifdef CONFIG_COMPAT |
2587 | 2587 | ||
2588 | #include <linux/ioctl32.h> | ||
2589 | |||
2590 | static int | 2588 | static int |
2591 | compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, | 2589 | compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, |
2592 | unsigned long arg) | 2590 | unsigned long arg) |
diff --git a/drivers/mtd/nand/au1550nd.c b/drivers/mtd/nand/au1550nd.c index 9c5945d6df88..201e1362da14 100644 --- a/drivers/mtd/nand/au1550nd.c +++ b/drivers/mtd/nand/au1550nd.c | |||
@@ -43,7 +43,7 @@ static int nand_width = 1; /* default x8*/ | |||
43 | /* | 43 | /* |
44 | * Define partitions for flash device | 44 | * Define partitions for flash device |
45 | */ | 45 | */ |
46 | const static struct mtd_partition partition_info[] = { | 46 | static const struct mtd_partition partition_info[] = { |
47 | { | 47 | { |
48 | .name = "NAND FS 0", | 48 | .name = "NAND FS 0", |
49 | .offset = 0, | 49 | .offset = 0, |
diff --git a/drivers/mtd/nand/rtc_from4.c b/drivers/mtd/nand/rtc_from4.c index 3a5841c9d950..4129c03dfd90 100644 --- a/drivers/mtd/nand/rtc_from4.c +++ b/drivers/mtd/nand/rtc_from4.c | |||
@@ -96,7 +96,7 @@ static struct mtd_info *rtc_from4_mtd = NULL; | |||
96 | */ | 96 | */ |
97 | static void __iomem *rtc_from4_fio_base = (void *)P2SEGADDR(RTC_FROM4_FIO_BASE); | 97 | static void __iomem *rtc_from4_fio_base = (void *)P2SEGADDR(RTC_FROM4_FIO_BASE); |
98 | 98 | ||
99 | const static struct mtd_partition partition_info[] = { | 99 | static const struct mtd_partition partition_info[] = { |
100 | { | 100 | { |
101 | .name = "Renesas flash partition 1", | 101 | .name = "Renesas flash partition 1", |
102 | .offset = 0, | 102 | .offset = 0, |
diff --git a/drivers/mtd/nand/spia.c b/drivers/mtd/nand/spia.c index 32541cbb0103..9cf1ce718ec1 100644 --- a/drivers/mtd/nand/spia.c +++ b/drivers/mtd/nand/spia.c | |||
@@ -67,7 +67,7 @@ module_param(spia_peddr, int, 0); | |||
67 | /* | 67 | /* |
68 | * Define partitions for flash device | 68 | * Define partitions for flash device |
69 | */ | 69 | */ |
70 | const static struct mtd_partition partition_info[] = { | 70 | static const struct mtd_partition partition_info[] = { |
71 | { | 71 | { |
72 | .name = "SPIA flash partition 1", | 72 | .name = "SPIA flash partition 1", |
73 | .offset = 0, | 73 | .offset = 0, |
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c index d2102a27d307..adfba44dac5a 100644 --- a/drivers/net/8139too.c +++ b/drivers/net/8139too.c | |||
@@ -505,7 +505,7 @@ enum chip_flags { | |||
505 | #define HW_REVID_MASK HW_REVID(1, 1, 1, 1, 1, 1, 1) | 505 | #define HW_REVID_MASK HW_REVID(1, 1, 1, 1, 1, 1, 1) |
506 | 506 | ||
507 | /* directly indexed by chip_t, above */ | 507 | /* directly indexed by chip_t, above */ |
508 | const static struct { | 508 | static const struct { |
509 | const char *name; | 509 | const char *name; |
510 | u32 version; /* from RTL8139C/RTL8139D docs */ | 510 | u32 version; /* from RTL8139C/RTL8139D docs */ |
511 | u32 flags; | 511 | u32 flags; |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 90999867a32c..102c1f0b90da 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -456,11 +456,6 @@ out: | |||
456 | 456 | ||
457 | /* ----------------------------------------------------------------------- */ | 457 | /* ----------------------------------------------------------------------- */ |
458 | 458 | ||
459 | static int sixpack_receive_room(struct tty_struct *tty) | ||
460 | { | ||
461 | return 65536; /* We can handle an infinite amount of data. :-) */ | ||
462 | } | ||
463 | |||
464 | /* | 459 | /* |
465 | * Handle the 'receiver data ready' interrupt. | 460 | * Handle the 'receiver data ready' interrupt. |
466 | * This function is called by the 'tty_io' module in the kernel when | 461 | * This function is called by the 'tty_io' module in the kernel when |
@@ -671,6 +666,7 @@ static int sixpack_open(struct tty_struct *tty) | |||
671 | 666 | ||
672 | /* Done. We have linked the TTY line to a channel. */ | 667 | /* Done. We have linked the TTY line to a channel. */ |
673 | tty->disc_data = sp; | 668 | tty->disc_data = sp; |
669 | tty->receive_room = 65536; | ||
674 | 670 | ||
675 | /* Now we're ready to register. */ | 671 | /* Now we're ready to register. */ |
676 | if (register_netdev(dev)) | 672 | if (register_netdev(dev)) |
@@ -802,7 +798,6 @@ static struct tty_ldisc sp_ldisc = { | |||
802 | .close = sixpack_close, | 798 | .close = sixpack_close, |
803 | .ioctl = sixpack_ioctl, | 799 | .ioctl = sixpack_ioctl, |
804 | .receive_buf = sixpack_receive_buf, | 800 | .receive_buf = sixpack_receive_buf, |
805 | .receive_room = sixpack_receive_room, | ||
806 | .write_wakeup = sixpack_write_wakeup, | 801 | .write_wakeup = sixpack_write_wakeup, |
807 | }; | 802 | }; |
808 | 803 | ||
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index f4424cf886c5..dc5e9d59deed 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -753,6 +753,7 @@ static int mkiss_open(struct tty_struct *tty) | |||
753 | 753 | ||
754 | ax->tty = tty; | 754 | ax->tty = tty; |
755 | tty->disc_data = ax; | 755 | tty->disc_data = ax; |
756 | tty->receive_room = 65535; | ||
756 | 757 | ||
757 | if (tty->driver->flush_buffer) | 758 | if (tty->driver->flush_buffer) |
758 | tty->driver->flush_buffer(tty); | 759 | tty->driver->flush_buffer(tty); |
@@ -940,11 +941,6 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
940 | tty->driver->unthrottle(tty); | 941 | tty->driver->unthrottle(tty); |
941 | } | 942 | } |
942 | 943 | ||
943 | static int mkiss_receive_room(struct tty_struct *tty) | ||
944 | { | ||
945 | return 65536; /* We can handle an infinite amount of data. :-) */ | ||
946 | } | ||
947 | |||
948 | /* | 944 | /* |
949 | * Called by the driver when there's room for more data. If we have | 945 | * Called by the driver when there's room for more data. If we have |
950 | * more packets to send, we send them here. | 946 | * more packets to send, we send them here. |
@@ -983,7 +979,6 @@ static struct tty_ldisc ax_ldisc = { | |||
983 | .close = mkiss_close, | 979 | .close = mkiss_close, |
984 | .ioctl = mkiss_ioctl, | 980 | .ioctl = mkiss_ioctl, |
985 | .receive_buf = mkiss_receive_buf, | 981 | .receive_buf = mkiss_receive_buf, |
986 | .receive_room = mkiss_receive_room, | ||
987 | .write_wakeup = mkiss_write_wakeup | 982 | .write_wakeup = mkiss_write_wakeup |
988 | }; | 983 | }; |
989 | 984 | ||
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c index 3d016a498e1d..6070195b87bd 100644 --- a/drivers/net/irda/irport.c +++ b/drivers/net/irda/irport.c | |||
@@ -285,19 +285,6 @@ static void irport_start(struct irport_cb *self) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | /* | 287 | /* |
288 | * Function irport_probe (void) | ||
289 | * | ||
290 | * Start IO port | ||
291 | * | ||
292 | */ | ||
293 | int irport_probe(int iobase) | ||
294 | { | ||
295 | IRDA_DEBUG(4, "%s(), iobase=%#x\n", __FUNCTION__, iobase); | ||
296 | |||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | /* | ||
301 | * Function irport_get_fcr (speed) | 288 | * Function irport_get_fcr (speed) |
302 | * | 289 | * |
303 | * Compute value of fcr | 290 | * Compute value of fcr |
@@ -382,7 +369,7 @@ static void irport_change_speed(void *priv, __u32 speed) | |||
382 | * we cannot use schedule_timeout() when we are in interrupt context | 369 | * we cannot use schedule_timeout() when we are in interrupt context |
383 | * | 370 | * |
384 | */ | 371 | */ |
385 | int __irport_change_speed(struct irda_task *task) | 372 | static int __irport_change_speed(struct irda_task *task) |
386 | { | 373 | { |
387 | struct irport_cb *self; | 374 | struct irport_cb *self; |
388 | __u32 speed = (__u32) task->param; | 375 | __u32 speed = (__u32) task->param; |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index b8d112348ba4..101750bf210f 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -289,22 +289,6 @@ static void irtty_receive_buf(struct tty_struct *tty, const unsigned char *cp, | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /* | 291 | /* |
292 | * Function irtty_receive_room (tty) | ||
293 | * | ||
294 | * Used by the TTY to find out how much data we can receive at a time | ||
295 | * | ||
296 | */ | ||
297 | static int irtty_receive_room(struct tty_struct *tty) | ||
298 | { | ||
299 | struct sirtty_cb *priv = tty->disc_data; | ||
300 | |||
301 | IRDA_ASSERT(priv != NULL, return 0;); | ||
302 | IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return 0;); | ||
303 | |||
304 | return 65536; /* We can handle an infinite amount of data. :-) */ | ||
305 | } | ||
306 | |||
307 | /* | ||
308 | * Function irtty_write_wakeup (tty) | 292 | * Function irtty_write_wakeup (tty) |
309 | * | 293 | * |
310 | * Called by the driver when there's room for more data. If we have | 294 | * Called by the driver when there's room for more data. If we have |
@@ -534,6 +518,7 @@ static int irtty_open(struct tty_struct *tty) | |||
534 | 518 | ||
535 | dev->priv = priv; | 519 | dev->priv = priv; |
536 | tty->disc_data = priv; | 520 | tty->disc_data = priv; |
521 | tty->receive_room = 65536; | ||
537 | 522 | ||
538 | up(&irtty_sem); | 523 | up(&irtty_sem); |
539 | 524 | ||
@@ -605,7 +590,6 @@ static struct tty_ldisc irda_ldisc = { | |||
605 | .ioctl = irtty_ioctl, | 590 | .ioctl = irtty_ioctl, |
606 | .poll = NULL, | 591 | .poll = NULL, |
607 | .receive_buf = irtty_receive_buf, | 592 | .receive_buf = irtty_receive_buf, |
608 | .receive_room = irtty_receive_room, | ||
609 | .write_wakeup = irtty_write_wakeup, | 593 | .write_wakeup = irtty_write_wakeup, |
610 | .owner = THIS_MODULE, | 594 | .owner = THIS_MODULE, |
611 | }; | 595 | }; |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index a1ac4bd1696e..a7bb54df75a8 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -415,7 +415,7 @@ typedef enum { | |||
415 | 415 | ||
416 | 416 | ||
417 | /* directly indexed by chip_t, above */ | 417 | /* directly indexed by chip_t, above */ |
418 | const static struct { | 418 | static const struct { |
419 | const char *name; | 419 | const char *name; |
420 | u8 version; /* from RTL8139C docs */ | 420 | u8 version; /* from RTL8139C docs */ |
421 | u32 RxConfigMask; /* should clear the bits supported by this chip */ | 421 | u32 RxConfigMask; /* should clear the bits supported by this chip */ |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 400f652282d7..aa6540b39466 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -189,7 +189,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
189 | goto out_free; | 189 | goto out_free; |
190 | 190 | ||
191 | tty->disc_data = ap; | 191 | tty->disc_data = ap; |
192 | 192 | tty->receive_room = 65536; | |
193 | return 0; | 193 | return 0; |
194 | 194 | ||
195 | out_free: | 195 | out_free: |
@@ -343,12 +343,6 @@ ppp_asynctty_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | static int | ||
347 | ppp_asynctty_room(struct tty_struct *tty) | ||
348 | { | ||
349 | return 65535; | ||
350 | } | ||
351 | |||
352 | /* | 346 | /* |
353 | * This can now be called from hard interrupt level as well | 347 | * This can now be called from hard interrupt level as well |
354 | * as soft interrupt level or mainline. | 348 | * as soft interrupt level or mainline. |
@@ -398,7 +392,6 @@ static struct tty_ldisc ppp_ldisc = { | |||
398 | .write = ppp_asynctty_write, | 392 | .write = ppp_asynctty_write, |
399 | .ioctl = ppp_asynctty_ioctl, | 393 | .ioctl = ppp_asynctty_ioctl, |
400 | .poll = ppp_asynctty_poll, | 394 | .poll = ppp_asynctty_poll, |
401 | .receive_room = ppp_asynctty_room, | ||
402 | .receive_buf = ppp_asynctty_receive, | 395 | .receive_buf = ppp_asynctty_receive, |
403 | .write_wakeup = ppp_asynctty_wakeup, | 396 | .write_wakeup = ppp_asynctty_wakeup, |
404 | }; | 397 | }; |
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 4d51c0c8023d..33cb8254e79d 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -237,7 +237,7 @@ ppp_sync_open(struct tty_struct *tty) | |||
237 | goto out_free; | 237 | goto out_free; |
238 | 238 | ||
239 | tty->disc_data = ap; | 239 | tty->disc_data = ap; |
240 | 240 | tty->receive_room = 65536; | |
241 | return 0; | 241 | return 0; |
242 | 242 | ||
243 | out_free: | 243 | out_free: |
@@ -384,12 +384,6 @@ ppp_sync_poll(struct tty_struct *tty, struct file *file, poll_table *wait) | |||
384 | return 0; | 384 | return 0; |
385 | } | 385 | } |
386 | 386 | ||
387 | static int | ||
388 | ppp_sync_room(struct tty_struct *tty) | ||
389 | { | ||
390 | return 65535; | ||
391 | } | ||
392 | |||
393 | /* | 387 | /* |
394 | * This can now be called from hard interrupt level as well | 388 | * This can now be called from hard interrupt level as well |
395 | * as soft interrupt level or mainline. | 389 | * as soft interrupt level or mainline. |
@@ -439,7 +433,6 @@ static struct tty_ldisc ppp_sync_ldisc = { | |||
439 | .write = ppp_sync_write, | 433 | .write = ppp_sync_write, |
440 | .ioctl = ppp_synctty_ioctl, | 434 | .ioctl = ppp_synctty_ioctl, |
441 | .poll = ppp_sync_poll, | 435 | .poll = ppp_sync_poll, |
442 | .receive_room = ppp_sync_room, | ||
443 | .receive_buf = ppp_sync_receive, | 436 | .receive_buf = ppp_sync_receive, |
444 | .write_wakeup = ppp_sync_wakeup, | 437 | .write_wakeup = ppp_sync_wakeup, |
445 | }; | 438 | }; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 14a76f7cf900..2e1bed153c39 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -170,7 +170,7 @@ enum phy_version { | |||
170 | #define _R(NAME,MAC,MASK) \ | 170 | #define _R(NAME,MAC,MASK) \ |
171 | { .name = NAME, .mac_version = MAC, .RxConfigMask = MASK } | 171 | { .name = NAME, .mac_version = MAC, .RxConfigMask = MASK } |
172 | 172 | ||
173 | const static struct { | 173 | static const struct { |
174 | const char *name; | 174 | const char *name; |
175 | u8 mac_version; | 175 | u8 mac_version; |
176 | u32 RxConfigMask; /* Clears the bits supported by this chip */ | 176 | u32 RxConfigMask; /* Clears the bits supported by this chip */ |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 478791e09bf7..b420182eec4b 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
@@ -329,7 +329,7 @@ static struct mii_chip_info { | |||
329 | { NULL, } | 329 | { NULL, } |
330 | }; | 330 | }; |
331 | 331 | ||
332 | const static struct { | 332 | static const struct { |
333 | const char *name; | 333 | const char *name; |
334 | } sis_chip_info[] = { | 334 | } sis_chip_info[] = { |
335 | { "SiS 190 PCI Fast Ethernet adapter" }, | 335 | { "SiS 190 PCI Fast Ethernet adapter" }, |
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 404ea4297e32..b2e18d28850d 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -651,11 +651,6 @@ static void sl_setup(struct net_device *dev) | |||
651 | ******************************************/ | 651 | ******************************************/ |
652 | 652 | ||
653 | 653 | ||
654 | static int slip_receive_room(struct tty_struct *tty) | ||
655 | { | ||
656 | return 65536; /* We can handle an infinite amount of data. :-) */ | ||
657 | } | ||
658 | |||
659 | /* | 654 | /* |
660 | * Handle the 'receiver data ready' interrupt. | 655 | * Handle the 'receiver data ready' interrupt. |
661 | * This function is called by the 'tty_io' module in the kernel when | 656 | * This function is called by the 'tty_io' module in the kernel when |
@@ -869,10 +864,6 @@ static int slip_open(struct tty_struct *tty) | |||
869 | sl->line = tty_devnum(tty); | 864 | sl->line = tty_devnum(tty); |
870 | sl->pid = current->pid; | 865 | sl->pid = current->pid; |
871 | 866 | ||
872 | /* FIXME: already done before we were called - seems this can go */ | ||
873 | if (tty->driver->flush_buffer) | ||
874 | tty->driver->flush_buffer(tty); | ||
875 | |||
876 | if (!test_bit(SLF_INUSE, &sl->flags)) { | 867 | if (!test_bit(SLF_INUSE, &sl->flags)) { |
877 | /* Perform the low-level SLIP initialization. */ | 868 | /* Perform the low-level SLIP initialization. */ |
878 | if ((err = sl_alloc_bufs(sl, SL_MTU)) != 0) | 869 | if ((err = sl_alloc_bufs(sl, SL_MTU)) != 0) |
@@ -897,6 +888,7 @@ static int slip_open(struct tty_struct *tty) | |||
897 | 888 | ||
898 | /* Done. We have linked the TTY line to a channel. */ | 889 | /* Done. We have linked the TTY line to a channel. */ |
899 | rtnl_unlock(); | 890 | rtnl_unlock(); |
891 | tty->receive_room = 65536; /* We don't flow control */ | ||
900 | return sl->dev->base_addr; | 892 | return sl->dev->base_addr; |
901 | 893 | ||
902 | err_free_bufs: | 894 | err_free_bufs: |
@@ -1329,7 +1321,6 @@ static struct tty_ldisc sl_ldisc = { | |||
1329 | .close = slip_close, | 1321 | .close = slip_close, |
1330 | .ioctl = slip_ioctl, | 1322 | .ioctl = slip_ioctl, |
1331 | .receive_buf = slip_receive_buf, | 1323 | .receive_buf = slip_receive_buf, |
1332 | .receive_room = slip_receive_room, | ||
1333 | .write_wakeup = slip_write_wakeup, | 1324 | .write_wakeup = slip_write_wakeup, |
1334 | }; | 1325 | }; |
1335 | 1326 | ||
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index 52f26b9c69d2..931cbdf6d791 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -689,7 +689,7 @@ static void cpc_tty_rx_work(void * data) | |||
689 | } | 689 | } |
690 | } | 690 | } |
691 | cpc_tty->buf_rx.first = cpc_tty->buf_rx.first->next; | 691 | cpc_tty->buf_rx.first = cpc_tty->buf_rx.first->next; |
692 | kfree(buf); | 692 | kfree((void *)buf); |
693 | buf = cpc_tty->buf_rx.first; | 693 | buf = cpc_tty->buf_rx.first; |
694 | flg_rx = 1; | 694 | flg_rx = 1; |
695 | } | 695 | } |
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c index bdf672c48182..9c3ccc669143 100644 --- a/drivers/net/wan/x25_asy.c +++ b/drivers/net/wan/x25_asy.c | |||
@@ -515,11 +515,6 @@ static int x25_asy_close(struct net_device *dev) | |||
515 | return 0; | 515 | return 0; |
516 | } | 516 | } |
517 | 517 | ||
518 | static int x25_asy_receive_room(struct tty_struct *tty) | ||
519 | { | ||
520 | return 65536; /* We can handle an infinite amount of data. :-) */ | ||
521 | } | ||
522 | |||
523 | /* | 518 | /* |
524 | * Handle the 'receiver data ready' interrupt. | 519 | * Handle the 'receiver data ready' interrupt. |
525 | * This function is called by the 'tty_io' module in the kernel when | 520 | * This function is called by the 'tty_io' module in the kernel when |
@@ -573,6 +568,7 @@ static int x25_asy_open_tty(struct tty_struct *tty) | |||
573 | 568 | ||
574 | sl->tty = tty; | 569 | sl->tty = tty; |
575 | tty->disc_data = sl; | 570 | tty->disc_data = sl; |
571 | tty->receive_room = 65536; | ||
576 | if (tty->driver->flush_buffer) { | 572 | if (tty->driver->flush_buffer) { |
577 | tty->driver->flush_buffer(tty); | 573 | tty->driver->flush_buffer(tty); |
578 | } | 574 | } |
@@ -779,7 +775,6 @@ static struct tty_ldisc x25_ldisc = { | |||
779 | .close = x25_asy_close_tty, | 775 | .close = x25_asy_close_tty, |
780 | .ioctl = x25_asy_ioctl, | 776 | .ioctl = x25_asy_ioctl, |
781 | .receive_buf = x25_asy_receive_buf, | 777 | .receive_buf = x25_asy_receive_buf, |
782 | .receive_room = x25_asy_receive_room, | ||
783 | .write_wakeup = x25_asy_write_wakeup, | 778 | .write_wakeup = x25_asy_write_wakeup, |
784 | }; | 779 | }; |
785 | 780 | ||
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c index d25264ba0c0e..18baacfc5a2c 100644 --- a/drivers/net/wireless/strip.c +++ b/drivers/net/wireless/strip.c | |||
@@ -1675,11 +1675,6 @@ static int strip_rebuild_header(struct sk_buff *skb) | |||
1675 | /************************************************************************/ | 1675 | /************************************************************************/ |
1676 | /* Receiving routines */ | 1676 | /* Receiving routines */ |
1677 | 1677 | ||
1678 | static int strip_receive_room(struct tty_struct *tty) | ||
1679 | { | ||
1680 | return 0x10000; /* We can handle an infinite amount of data. :-) */ | ||
1681 | } | ||
1682 | |||
1683 | /* | 1678 | /* |
1684 | * This function parses the response to the ATS300? command, | 1679 | * This function parses the response to the ATS300? command, |
1685 | * extracting the radio version and serial number. | 1680 | * extracting the radio version and serial number. |
@@ -2424,7 +2419,7 @@ static struct net_device_stats *strip_get_stats(struct net_device *dev) | |||
2424 | /* | 2419 | /* |
2425 | * Here's the order things happen: | 2420 | * Here's the order things happen: |
2426 | * When the user runs "slattach -p strip ..." | 2421 | * When the user runs "slattach -p strip ..." |
2427 | * 1. The TTY module calls strip_open | 2422 | * 1. The TTY module calls strip_open;; |
2428 | * 2. strip_open calls strip_alloc | 2423 | * 2. strip_open calls strip_alloc |
2429 | * 3. strip_alloc calls register_netdev | 2424 | * 3. strip_alloc calls register_netdev |
2430 | * 4. register_netdev calls strip_dev_init | 2425 | * 4. register_netdev calls strip_dev_init |
@@ -2652,6 +2647,8 @@ static int strip_open(struct tty_struct *tty) | |||
2652 | 2647 | ||
2653 | strip_info->tty = tty; | 2648 | strip_info->tty = tty; |
2654 | tty->disc_data = strip_info; | 2649 | tty->disc_data = strip_info; |
2650 | tty->receive_room = 65536; | ||
2651 | |||
2655 | if (tty->driver->flush_buffer) | 2652 | if (tty->driver->flush_buffer) |
2656 | tty->driver->flush_buffer(tty); | 2653 | tty->driver->flush_buffer(tty); |
2657 | 2654 | ||
@@ -2762,7 +2759,6 @@ static struct tty_ldisc strip_ldisc = { | |||
2762 | .close = strip_close, | 2759 | .close = strip_close, |
2763 | .ioctl = strip_ioctl, | 2760 | .ioctl = strip_ioctl, |
2764 | .receive_buf = strip_receive_buf, | 2761 | .receive_buf = strip_receive_buf, |
2765 | .receive_room = strip_receive_room, | ||
2766 | .write_wakeup = strip_write_some_more, | 2762 | .write_wakeup = strip_write_some_more, |
2767 | }; | 2763 | }; |
2768 | 2764 | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 2472fa1a1be1..9c25654b1e75 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -1751,6 +1751,7 @@ dasd_device_operations = { | |||
1751 | .open = dasd_open, | 1751 | .open = dasd_open, |
1752 | .release = dasd_release, | 1752 | .release = dasd_release, |
1753 | .ioctl = dasd_ioctl, | 1753 | .ioctl = dasd_ioctl, |
1754 | .compat_ioctl = dasd_compat_ioctl, | ||
1754 | .getgeo = dasd_getgeo, | 1755 | .getgeo = dasd_getgeo, |
1755 | }; | 1756 | }; |
1756 | 1757 | ||
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 2fb05c4a528c..e4b401500b01 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -527,6 +527,7 @@ void dasd_ioctl_exit(void); | |||
527 | int dasd_ioctl_no_register(struct module *, int, dasd_ioctl_fn_t); | 527 | int dasd_ioctl_no_register(struct module *, int, dasd_ioctl_fn_t); |
528 | int dasd_ioctl_no_unregister(struct module *, int, dasd_ioctl_fn_t); | 528 | int dasd_ioctl_no_unregister(struct module *, int, dasd_ioctl_fn_t); |
529 | int dasd_ioctl(struct inode *, struct file *, unsigned int, unsigned long); | 529 | int dasd_ioctl(struct inode *, struct file *, unsigned int, unsigned long); |
530 | long dasd_compat_ioctl(struct file *, unsigned int, unsigned long); | ||
530 | 531 | ||
531 | /* externals in dasd_proc.c */ | 532 | /* externals in dasd_proc.c */ |
532 | int dasd_proc_init(void); | 533 | int dasd_proc_init(void); |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 8e4dcd58599e..9396fcacb8f8 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -118,6 +118,18 @@ dasd_ioctl(struct inode *inp, struct file *filp, | |||
118 | return -EINVAL; | 118 | return -EINVAL; |
119 | } | 119 | } |
120 | 120 | ||
121 | long | ||
122 | dasd_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
123 | { | ||
124 | int rval; | ||
125 | |||
126 | lock_kernel(); | ||
127 | rval = dasd_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); | ||
128 | unlock_kernel(); | ||
129 | |||
130 | return (rval == -EINVAL) ? -ENOIOCTLCMD : rval; | ||
131 | } | ||
132 | |||
121 | static int | 133 | static int |
122 | dasd_ioctl_api_version(struct block_device *bdev, int no, long args) | 134 | dasd_ioctl_api_version(struct block_device *bdev, int no, long args) |
123 | { | 135 | { |
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 75419cf9d353..1f060914cfa4 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/kdev_t.h> | 17 | #include <linux/kdev_t.h> |
18 | #include <linux/tty.h> | 18 | #include <linux/tty.h> |
19 | #include <linux/tty_flip.h> | ||
19 | #include <linux/vt_kern.h> | 20 | #include <linux/vt_kern.h> |
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/console.h> | 22 | #include <linux/console.h> |
@@ -432,8 +433,6 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
432 | if (count > slen) | 433 | if (count > slen) |
433 | count = slen; | 434 | count = slen; |
434 | } else | 435 | } else |
435 | if (count >= TTY_FLIPBUF_SIZE - tty->flip.count) | ||
436 | count = TTY_FLIPBUF_SIZE - tty->flip.count - 1; | ||
437 | EBCASC(raw->inbuf, count); | 436 | EBCASC(raw->inbuf, count); |
438 | cchar = ctrlchar_handle(raw->inbuf, count, tty); | 437 | cchar = ctrlchar_handle(raw->inbuf, count, tty); |
439 | switch (cchar & CTRLCHAR_MASK) { | 438 | switch (cchar & CTRLCHAR_MASK) { |
@@ -441,28 +440,20 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
441 | break; | 440 | break; |
442 | 441 | ||
443 | case CTRLCHAR_CTRL: | 442 | case CTRLCHAR_CTRL: |
444 | tty->flip.count++; | 443 | tty_insert_flip_char(tty, cchar, TTY_NORMAL); |
445 | *tty->flip.flag_buf_ptr++ = TTY_NORMAL; | ||
446 | *tty->flip.char_buf_ptr++ = cchar; | ||
447 | tty_flip_buffer_push(raw->tty); | 444 | tty_flip_buffer_push(raw->tty); |
448 | break; | 445 | break; |
449 | 446 | ||
450 | case CTRLCHAR_NONE: | 447 | case CTRLCHAR_NONE: |
451 | memcpy(tty->flip.char_buf_ptr, | ||
452 | raw->inbuf, count); | ||
453 | if (count < 2 || | 448 | if (count < 2 || |
454 | (strncmp(raw->inbuf+count-2, "^n", 2) && | 449 | (strncmp(raw->inbuf+count-2, "\252n", 2) && |
455 | strncmp(raw->inbuf+count-2, "\252n", 2)) ) { | 450 | strncmp(raw->inbuf+count-2, "^n", 2)) ) { |
456 | /* don't add the auto \n */ | 451 | /* add the auto \n */ |
457 | tty->flip.char_buf_ptr[count] = '\n'; | 452 | raw->inbuf[count] = '\n'; |
458 | memset(tty->flip.flag_buf_ptr, | ||
459 | TTY_NORMAL, count + 1); | ||
460 | count++; | 453 | count++; |
461 | } else | 454 | } else |
462 | count-=2; | 455 | count -= 2; |
463 | tty->flip.char_buf_ptr += count; | 456 | tty_insert_flip_string(tty, raw->inbuf, count); |
464 | tty->flip.flag_buf_ptr += count; | ||
465 | tty->flip.count += count; | ||
466 | tty_flip_buffer_push(raw->tty); | 457 | tty_flip_buffer_push(raw->tty); |
467 | break; | 458 | break; |
468 | } | 459 | } |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 735a7fcdeff5..5f6fa4c67843 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
@@ -319,9 +319,8 @@ fs3270_write(struct file *filp, const char *data, size_t count, loff_t *off) | |||
319 | /* | 319 | /* |
320 | * process ioctl commands for the tube driver | 320 | * process ioctl commands for the tube driver |
321 | */ | 321 | */ |
322 | static int | 322 | static long |
323 | fs3270_ioctl(struct inode *inode, struct file *filp, | 323 | fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
324 | unsigned int cmd, unsigned long arg) | ||
325 | { | 324 | { |
326 | struct fs3270 *fp; | 325 | struct fs3270 *fp; |
327 | struct raw3270_iocb iocb; | 326 | struct raw3270_iocb iocb; |
@@ -331,6 +330,7 @@ fs3270_ioctl(struct inode *inode, struct file *filp, | |||
331 | if (!fp) | 330 | if (!fp) |
332 | return -ENODEV; | 331 | return -ENODEV; |
333 | rc = 0; | 332 | rc = 0; |
333 | lock_kernel(); | ||
334 | switch (cmd) { | 334 | switch (cmd) { |
335 | case TUBICMD: | 335 | case TUBICMD: |
336 | fp->read_command = arg; | 336 | fp->read_command = arg; |
@@ -356,6 +356,7 @@ fs3270_ioctl(struct inode *inode, struct file *filp, | |||
356 | rc = -EFAULT; | 356 | rc = -EFAULT; |
357 | break; | 357 | break; |
358 | } | 358 | } |
359 | unlock_kernel(); | ||
359 | return rc; | 360 | return rc; |
360 | } | 361 | } |
361 | 362 | ||
@@ -491,12 +492,13 @@ fs3270_close(struct inode *inode, struct file *filp) | |||
491 | } | 492 | } |
492 | 493 | ||
493 | static struct file_operations fs3270_fops = { | 494 | static struct file_operations fs3270_fops = { |
494 | .owner = THIS_MODULE, /* owner */ | 495 | .owner = THIS_MODULE, /* owner */ |
495 | .read = fs3270_read, /* read */ | 496 | .read = fs3270_read, /* read */ |
496 | .write = fs3270_write, /* write */ | 497 | .write = fs3270_write, /* write */ |
497 | .ioctl = fs3270_ioctl, /* ioctl */ | 498 | .unlocked_ioctl = fs3270_ioctl, /* ioctl */ |
498 | .open = fs3270_open, /* open */ | 499 | .compat_ioctl = fs3270_ioctl, /* ioctl */ |
499 | .release = fs3270_close, /* release */ | 500 | .open = fs3270_open, /* open */ |
501 | .release = fs3270_close, /* release */ | ||
500 | }; | 502 | }; |
501 | 503 | ||
502 | /* | 504 | /* |
diff --git a/drivers/s390/char/sclp_tty.c b/drivers/s390/char/sclp_tty.c index a20d7c89341d..6cbf067f1a8f 100644 --- a/drivers/s390/char/sclp_tty.c +++ b/drivers/s390/char/sclp_tty.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kmod.h> | 13 | #include <linux/kmod.h> |
14 | #include <linux/tty.h> | 14 | #include <linux/tty.h> |
15 | #include <linux/tty_driver.h> | 15 | #include <linux/tty_driver.h> |
16 | #include <linux/tty_flip.h> | ||
16 | #include <linux/sched.h> | 17 | #include <linux/sched.h> |
17 | #include <linux/wait.h> | 18 | #include <linux/wait.h> |
18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
@@ -496,25 +497,19 @@ sclp_tty_input(unsigned char* buf, unsigned int count) | |||
496 | case CTRLCHAR_SYSRQ: | 497 | case CTRLCHAR_SYSRQ: |
497 | break; | 498 | break; |
498 | case CTRLCHAR_CTRL: | 499 | case CTRLCHAR_CTRL: |
499 | sclp_tty->flip.count++; | 500 | tty_insert_flip_char(sclp_tty, cchar, TTY_NORMAL); |
500 | *sclp_tty->flip.flag_buf_ptr++ = TTY_NORMAL; | ||
501 | *sclp_tty->flip.char_buf_ptr++ = cchar; | ||
502 | tty_flip_buffer_push(sclp_tty); | 501 | tty_flip_buffer_push(sclp_tty); |
503 | break; | 502 | break; |
504 | case CTRLCHAR_NONE: | 503 | case CTRLCHAR_NONE: |
505 | /* send (normal) input to line discipline */ | 504 | /* send (normal) input to line discipline */ |
506 | memcpy(sclp_tty->flip.char_buf_ptr, buf, count); | ||
507 | if (count < 2 || | 505 | if (count < 2 || |
508 | (strncmp ((const char *) buf + count - 2, "^n", 2) && | 506 | (strncmp((const char *) buf + count - 2, "^n", 2) && |
509 | strncmp ((const char *) buf + count - 2, "\0252n", 2))) { | 507 | strncmp((const char *) buf + count - 2, "\252n", 2))) { |
510 | sclp_tty->flip.char_buf_ptr[count] = '\n'; | 508 | /* add the auto \n */ |
511 | count++; | 509 | tty_insert_flip_string(sclp_tty, buf, count); |
510 | tty_insert_flip_char(sclp_tty, '\n', TTY_NORMAL); | ||
512 | } else | 511 | } else |
513 | count -= 2; | 512 | tty_insert_flip_string(sclp_tty, buf, count - 2); |
514 | memset(sclp_tty->flip.flag_buf_ptr, TTY_NORMAL, count); | ||
515 | sclp_tty->flip.char_buf_ptr += count; | ||
516 | sclp_tty->flip.flag_buf_ptr += count; | ||
517 | sclp_tty->flip.count += count; | ||
518 | tty_flip_buffer_push(sclp_tty); | 513 | tty_flip_buffer_push(sclp_tty); |
519 | break; | 514 | break; |
520 | } | 515 | } |
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c index 06bd85824d7b..9e02625c82cf 100644 --- a/drivers/s390/char/sclp_vt220.c +++ b/drivers/s390/char/sclp_vt220.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/tty.h> | 17 | #include <linux/tty.h> |
18 | #include <linux/tty_driver.h> | 18 | #include <linux/tty_driver.h> |
19 | #include <linux/tty_flip.h> | ||
19 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
20 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
21 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
@@ -482,16 +483,7 @@ sclp_vt220_receiver_fn(struct evbuf_header *evbuf) | |||
482 | /* Send input to line discipline */ | 483 | /* Send input to line discipline */ |
483 | buffer++; | 484 | buffer++; |
484 | count--; | 485 | count--; |
485 | /* Prevent buffer overrun by discarding input. Note that | 486 | tty_insert_flip_string(sclp_vt220_tty, buffer, count); |
486 | * because buffer_push works asynchronously, we cannot wait | ||
487 | * for the buffer to be emptied. */ | ||
488 | if (count + sclp_vt220_tty->flip.count > TTY_FLIPBUF_SIZE) | ||
489 | count = TTY_FLIPBUF_SIZE - sclp_vt220_tty->flip.count; | ||
490 | memcpy(sclp_vt220_tty->flip.char_buf_ptr, buffer, count); | ||
491 | memset(sclp_vt220_tty->flip.flag_buf_ptr, TTY_NORMAL, count); | ||
492 | sclp_vt220_tty->flip.char_buf_ptr += count; | ||
493 | sclp_vt220_tty->flip.flag_buf_ptr += count; | ||
494 | sclp_vt220_tty->flip.count += count; | ||
495 | tty_flip_buffer_push(sclp_vt220_tty); | 487 | tty_flip_buffer_push(sclp_vt220_tty); |
496 | break; | 488 | break; |
497 | } | 489 | } |
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 86262a13f7c6..5ce7ca38ace0 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c | |||
@@ -37,6 +37,8 @@ static int tapechar_open(struct inode *,struct file *); | |||
37 | static int tapechar_release(struct inode *,struct file *); | 37 | static int tapechar_release(struct inode *,struct file *); |
38 | static int tapechar_ioctl(struct inode *, struct file *, unsigned int, | 38 | static int tapechar_ioctl(struct inode *, struct file *, unsigned int, |
39 | unsigned long); | 39 | unsigned long); |
40 | static long tapechar_compat_ioctl(struct file *, unsigned int, | ||
41 | unsigned long); | ||
40 | 42 | ||
41 | static struct file_operations tape_fops = | 43 | static struct file_operations tape_fops = |
42 | { | 44 | { |
@@ -44,6 +46,7 @@ static struct file_operations tape_fops = | |||
44 | .read = tapechar_read, | 46 | .read = tapechar_read, |
45 | .write = tapechar_write, | 47 | .write = tapechar_write, |
46 | .ioctl = tapechar_ioctl, | 48 | .ioctl = tapechar_ioctl, |
49 | .compat_ioctl = tapechar_compat_ioctl, | ||
47 | .open = tapechar_open, | 50 | .open = tapechar_open, |
48 | .release = tapechar_release, | 51 | .release = tapechar_release, |
49 | }; | 52 | }; |
@@ -463,6 +466,23 @@ tapechar_ioctl(struct inode *inp, struct file *filp, | |||
463 | return device->discipline->ioctl_fn(device, no, data); | 466 | return device->discipline->ioctl_fn(device, no, data); |
464 | } | 467 | } |
465 | 468 | ||
469 | static long | ||
470 | tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) | ||
471 | { | ||
472 | struct tape_device *device = filp->private_data; | ||
473 | int rval = -ENOIOCTLCMD; | ||
474 | |||
475 | if (device->discipline->ioctl_fn) { | ||
476 | lock_kernel(); | ||
477 | rval = device->discipline->ioctl_fn(device, no, data); | ||
478 | unlock_kernel(); | ||
479 | if (rval == -EINVAL) | ||
480 | rval = -ENOIOCTLCMD; | ||
481 | } | ||
482 | |||
483 | return rval; | ||
484 | } | ||
485 | |||
466 | /* | 486 | /* |
467 | * Initialize character device frontend. | 487 | * Initialize character device frontend. |
468 | */ | 488 | */ |
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c index 135ae04e6e75..2f54d033d7cf 100644 --- a/drivers/s390/crypto/z90main.c +++ b/drivers/s390/crypto/z90main.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/delay.h> // mdelay | 30 | #include <linux/delay.h> // mdelay |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/interrupt.h> // for tasklets | 32 | #include <linux/interrupt.h> // for tasklets |
33 | #include <linux/ioctl32.h> | ||
34 | #include <linux/miscdevice.h> | 33 | #include <linux/miscdevice.h> |
35 | #include <linux/module.h> | 34 | #include <linux/module.h> |
36 | #include <linux/moduleparam.h> | 35 | #include <linux/moduleparam.h> |
diff --git a/drivers/s390/net/ctctty.c b/drivers/s390/net/ctctty.c index 968f2c113efe..93d1725eb79b 100644 --- a/drivers/s390/net/ctctty.c +++ b/drivers/s390/net/ctctty.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/tty.h> | 27 | #include <linux/tty.h> |
28 | #include <linux/tty_flip.h> | ||
28 | #include <linux/serial_reg.h> | 29 | #include <linux/serial_reg.h> |
29 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
@@ -101,25 +102,17 @@ static spinlock_t ctc_tty_lock; | |||
101 | static int | 102 | static int |
102 | ctc_tty_try_read(ctc_tty_info * info, struct sk_buff *skb) | 103 | ctc_tty_try_read(ctc_tty_info * info, struct sk_buff *skb) |
103 | { | 104 | { |
104 | int c; | ||
105 | int len; | 105 | int len; |
106 | struct tty_struct *tty; | 106 | struct tty_struct *tty; |
107 | 107 | ||
108 | DBF_TEXT(trace, 5, __FUNCTION__); | 108 | DBF_TEXT(trace, 5, __FUNCTION__); |
109 | if ((tty = info->tty)) { | 109 | if ((tty = info->tty)) { |
110 | if (info->mcr & UART_MCR_RTS) { | 110 | if (info->mcr & UART_MCR_RTS) { |
111 | c = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
112 | len = skb->len; | 111 | len = skb->len; |
113 | if (c >= len) { | 112 | tty_insert_flip_string(tty, skb->data, len); |
114 | memcpy(tty->flip.char_buf_ptr, skb->data, len); | 113 | tty_flip_buffer_push(tty); |
115 | memset(tty->flip.flag_buf_ptr, 0, len); | 114 | kfree_skb(skb); |
116 | tty->flip.count += len; | 115 | return 1; |
117 | tty->flip.char_buf_ptr += len; | ||
118 | tty->flip.flag_buf_ptr += len; | ||
119 | tty_flip_buffer_push(tty); | ||
120 | kfree_skb(skb); | ||
121 | return 1; | ||
122 | } | ||
123 | } | 116 | } |
124 | } | 117 | } |
125 | return 0; | 118 | return 0; |
@@ -138,19 +131,12 @@ ctc_tty_readmodem(ctc_tty_info *info) | |||
138 | DBF_TEXT(trace, 5, __FUNCTION__); | 131 | DBF_TEXT(trace, 5, __FUNCTION__); |
139 | if ((tty = info->tty)) { | 132 | if ((tty = info->tty)) { |
140 | if (info->mcr & UART_MCR_RTS) { | 133 | if (info->mcr & UART_MCR_RTS) { |
141 | int c = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
142 | struct sk_buff *skb; | 134 | struct sk_buff *skb; |
143 | 135 | ||
144 | if ((c > 0) && (skb = skb_dequeue(&info->rx_queue))) { | 136 | if ((skb = skb_dequeue(&info->rx_queue))) { |
145 | int len = skb->len; | 137 | int len = skb->len; |
146 | if (len > c) | 138 | tty_insert_flip_string(tty, skb->data, len); |
147 | len = c; | ||
148 | memcpy(tty->flip.char_buf_ptr, skb->data, len); | ||
149 | skb_pull(skb, len); | 139 | skb_pull(skb, len); |
150 | memset(tty->flip.flag_buf_ptr, 0, len); | ||
151 | tty->flip.count += len; | ||
152 | tty->flip.char_buf_ptr += len; | ||
153 | tty->flip.flag_buf_ptr += len; | ||
154 | tty_flip_buffer_push(tty); | 140 | tty_flip_buffer_push(tty); |
155 | if (skb->len > 0) | 141 | if (skb->len > 0) |
156 | skb_queue_head(&info->rx_queue, skb); | 142 | skb_queue_head(&info->rx_queue, skb); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 3cb68af90456..9b9062f02462 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <linux/syscalls.h> | 48 | #include <linux/syscalls.h> |
49 | #include <linux/ioctl32.h> | ||
50 | #include <linux/delay.h> | 49 | #include <linux/delay.h> |
51 | #include <linux/smp_lock.h> | 50 | #include <linux/smp_lock.h> |
52 | #include <asm/semaphore.h> | 51 | #include <asm/semaphore.h> |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 0920220f3313..4299fabca554 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/blkdev.h> | 21 | #include <linux/blkdev.h> |
22 | #include <linux/completion.h> | 22 | #include <linux/completion.h> |
23 | #include <linux/ioctl32.h> | ||
24 | #include <linux/compat.h> | 23 | #include <linux/compat.h> |
25 | #include <linux/chio.h> /* here are all the ioctls */ | 24 | #include <linux/chio.h> /* here are all the ioctls */ |
26 | 25 | ||
diff --git a/drivers/scsi/megaraid/megaraid_mm.h b/drivers/scsi/megaraid/megaraid_mm.h index eb8c390a0fa3..3d9e67d6849d 100644 --- a/drivers/scsi/megaraid/megaraid_mm.h +++ b/drivers/scsi/megaraid/megaraid_mm.h | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/ioctl32.h> | ||
26 | 25 | ||
27 | #include "mbox_defs.h" | 26 | #include "mbox_defs.h" |
28 | #include "megaraid_ioctl.h" | 27 | #include "megaraid_ioctl.h" |
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index b5cf39468d18..221999bcf8fe 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c | |||
@@ -94,15 +94,6 @@ static irqreturn_t serial21285_rx_chars(int irq, void *dev_id, struct pt_regs *r | |||
94 | 94 | ||
95 | status = *CSR_UARTFLG; | 95 | status = *CSR_UARTFLG; |
96 | while (!(status & 0x10) && max_count--) { | 96 | while (!(status & 0x10) && max_count--) { |
97 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
98 | if (tty->low_latency) | ||
99 | tty_flip_buffer_push(tty); | ||
100 | /* | ||
101 | * If this failed then we will throw away the | ||
102 | * bytes but must do so to clear interrupts | ||
103 | */ | ||
104 | } | ||
105 | |||
106 | ch = *CSR_UARTDR; | 97 | ch = *CSR_UARTDR; |
107 | flag = TTY_NORMAL; | 98 | flag = TTY_NORMAL; |
108 | port->icount.rx++; | 99 | port->icount.rx++; |
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c index 67e9afa000c1..4dd5c3f98167 100644 --- a/drivers/serial/68328serial.c +++ b/drivers/serial/68328serial.c | |||
@@ -294,7 +294,7 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg | |||
294 | { | 294 | { |
295 | struct tty_struct *tty = info->tty; | 295 | struct tty_struct *tty = info->tty; |
296 | m68328_uart *uart = &uart_addr[info->line]; | 296 | m68328_uart *uart = &uart_addr[info->line]; |
297 | unsigned char ch; | 297 | unsigned char ch, flag; |
298 | 298 | ||
299 | /* | 299 | /* |
300 | * This do { } while() loop will get ALL chars out of Rx FIFO | 300 | * This do { } while() loop will get ALL chars out of Rx FIFO |
@@ -332,26 +332,24 @@ static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *reg | |||
332 | /* | 332 | /* |
333 | * Make sure that we do not overflow the buffer | 333 | * Make sure that we do not overflow the buffer |
334 | */ | 334 | */ |
335 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 335 | if (tty_request_buffer_room(tty, 1) == 0) { |
336 | schedule_work(&tty->flip.work); | 336 | schedule_work(&tty->flip.work); |
337 | return; | 337 | return; |
338 | } | 338 | } |
339 | 339 | ||
340 | flag = TTY_NORMAL; | ||
341 | |||
340 | if(rx & URX_PARITY_ERROR) { | 342 | if(rx & URX_PARITY_ERROR) { |
341 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | 343 | flag = TTY_PARITY; |
342 | status_handle(info, rx); | 344 | status_handle(info, rx); |
343 | } else if(rx & URX_OVRUN) { | 345 | } else if(rx & URX_OVRUN) { |
344 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 346 | flag = TTY_OVERRUN; |
345 | status_handle(info, rx); | 347 | status_handle(info, rx); |
346 | } else if(rx & URX_FRAME_ERROR) { | 348 | } else if(rx & URX_FRAME_ERROR) { |
347 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 349 | flag = TTY_FRAME; |
348 | status_handle(info, rx); | 350 | status_handle(info, rx); |
349 | } else { | ||
350 | *tty->flip.flag_buf_ptr++ = 0; /* XXX */ | ||
351 | } | 351 | } |
352 | *tty->flip.char_buf_ptr++ = ch; | 352 | tty_insert_flip_char(tty, ch, flag); |
353 | tty->flip.count++; | ||
354 | |||
355 | #ifndef CONFIG_XCOPILOT_BUGS | 353 | #ifndef CONFIG_XCOPILOT_BUGS |
356 | } while((rx = uart->urx.w) & URX_DATA_READY); | 354 | } while((rx = uart->urx.w) & URX_DATA_READY); |
357 | #endif | 355 | #endif |
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c index 170c9d2a749c..60f5a5dc17f1 100644 --- a/drivers/serial/68360serial.c +++ b/drivers/serial/68360serial.c | |||
@@ -394,7 +394,7 @@ static void rs_360_start(struct tty_struct *tty) | |||
394 | static _INLINE_ void receive_chars(ser_info_t *info) | 394 | static _INLINE_ void receive_chars(ser_info_t *info) |
395 | { | 395 | { |
396 | struct tty_struct *tty = info->tty; | 396 | struct tty_struct *tty = info->tty; |
397 | unsigned char ch, *cp; | 397 | unsigned char ch, flag, *cp; |
398 | /*int ignored = 0;*/ | 398 | /*int ignored = 0;*/ |
399 | int i; | 399 | int i; |
400 | ushort status; | 400 | ushort status; |
@@ -438,24 +438,15 @@ static _INLINE_ void receive_chars(ser_info_t *info) | |||
438 | cp = (char *)bdp->buf; | 438 | cp = (char *)bdp->buf; |
439 | status = bdp->status; | 439 | status = bdp->status; |
440 | 440 | ||
441 | /* Check to see if there is room in the tty buffer for | ||
442 | * the characters in our BD buffer. If not, we exit | ||
443 | * now, leaving the BD with the characters. We'll pick | ||
444 | * them up again on the next receive interrupt (which could | ||
445 | * be a timeout). | ||
446 | */ | ||
447 | if ((tty->flip.count + i) >= TTY_FLIPBUF_SIZE) | ||
448 | break; | ||
449 | |||
450 | while (i-- > 0) { | 441 | while (i-- > 0) { |
451 | ch = *cp++; | 442 | ch = *cp++; |
452 | *tty->flip.char_buf_ptr = ch; | ||
453 | icount->rx++; | 443 | icount->rx++; |
454 | 444 | ||
455 | #ifdef SERIAL_DEBUG_INTR | 445 | #ifdef SERIAL_DEBUG_INTR |
456 | printk("DR%02x:%02x...", ch, status); | 446 | printk("DR%02x:%02x...", ch, status); |
457 | #endif | 447 | #endif |
458 | *tty->flip.flag_buf_ptr = 0; | 448 | flag = TTY_NORMAL; |
449 | |||
459 | if (status & (BD_SC_BR | BD_SC_FR | | 450 | if (status & (BD_SC_BR | BD_SC_FR | |
460 | BD_SC_PR | BD_SC_OV)) { | 451 | BD_SC_PR | BD_SC_OV)) { |
461 | /* | 452 | /* |
@@ -490,30 +481,18 @@ static _INLINE_ void receive_chars(ser_info_t *info) | |||
490 | if (info->flags & ASYNC_SAK) | 481 | if (info->flags & ASYNC_SAK) |
491 | do_SAK(tty); | 482 | do_SAK(tty); |
492 | } else if (status & BD_SC_PR) | 483 | } else if (status & BD_SC_PR) |
493 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 484 | flag = TTY_PARITY; |
494 | else if (status & BD_SC_FR) | 485 | else if (status & BD_SC_FR) |
495 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 486 | flag = TTY_FRAME; |
496 | if (status & BD_SC_OV) { | ||
497 | /* | ||
498 | * Overrun is special, since it's | ||
499 | * reported immediately, and doesn't | ||
500 | * affect the current character | ||
501 | */ | ||
502 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
503 | tty->flip.count++; | ||
504 | tty->flip.flag_buf_ptr++; | ||
505 | tty->flip.char_buf_ptr++; | ||
506 | *tty->flip.flag_buf_ptr = | ||
507 | TTY_OVERRUN; | ||
508 | } | ||
509 | } | ||
510 | } | 487 | } |
511 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | 488 | tty_insert_flip_char(tty, ch, flag); |
512 | break; | 489 | if (status & BD_SC_OV) |
513 | 490 | /* | |
514 | tty->flip.flag_buf_ptr++; | 491 | * Overrun is special, since it's |
515 | tty->flip.char_buf_ptr++; | 492 | * reported immediately, and doesn't |
516 | tty->flip.count++; | 493 | * affect the current character |
494 | */ | ||
495 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
517 | } | 496 | } |
518 | 497 | ||
519 | /* This BD is ready to be used again. Clear status. | 498 | /* This BD is ready to be used again. Clear status. |
@@ -541,12 +520,7 @@ static _INLINE_ void receive_break(ser_info_t *info) | |||
541 | /* Check to see if there is room in the tty buffer for | 520 | /* Check to see if there is room in the tty buffer for |
542 | * the break. If not, we exit now, losing the break. FIXME | 521 | * the break. If not, we exit now, losing the break. FIXME |
543 | */ | 522 | */ |
544 | if ((tty->flip.count + 1) >= TTY_FLIPBUF_SIZE) | 523 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
545 | return; | ||
546 | *(tty->flip.flag_buf_ptr++) = TTY_BREAK; | ||
547 | *(tty->flip.char_buf_ptr++) = 0; | ||
548 | tty->flip.count++; | ||
549 | |||
550 | schedule_work(&tty->flip.work); | 524 | schedule_work(&tty->flip.work); |
551 | } | 525 | } |
552 | 526 | ||
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index e8454611cb65..54e5cc0dd5f8 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -1142,19 +1142,6 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) | |||
1142 | char flag; | 1142 | char flag; |
1143 | 1143 | ||
1144 | do { | 1144 | do { |
1145 | /* The following is not allowed by the tty layer and | ||
1146 | unsafe. It should be fixed ASAP */ | ||
1147 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
1148 | if (tty->low_latency) { | ||
1149 | spin_unlock(&up->port.lock); | ||
1150 | tty_flip_buffer_push(tty); | ||
1151 | spin_lock(&up->port.lock); | ||
1152 | } | ||
1153 | /* | ||
1154 | * If this failed then we will throw away the | ||
1155 | * bytes but must do so to clear interrupts | ||
1156 | */ | ||
1157 | } | ||
1158 | ch = serial_inp(up, UART_RX); | 1145 | ch = serial_inp(up, UART_RX); |
1159 | flag = TTY_NORMAL; | 1146 | flag = TTY_NORMAL; |
1160 | up->port.icount.rx++; | 1147 | up->port.icount.rx++; |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 1bae26a8a503..698cb76819d9 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -860,7 +860,7 @@ config SERIAL_VR41XX_CONSOLE | |||
860 | 860 | ||
861 | config SERIAL_JSM | 861 | config SERIAL_JSM |
862 | tristate "Digi International NEO PCI Support" | 862 | tristate "Digi International NEO PCI Support" |
863 | depends on PCI | 863 | depends on PCI && BROKEN |
864 | select SERIAL_CORE | 864 | select SERIAL_CORE |
865 | help | 865 | help |
866 | This is a driver for Digi International's Neo series | 866 | This is a driver for Digi International's Neo series |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 48f6e872314b..3490022e9fdc 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -154,15 +154,6 @@ pl010_rx_chars(struct uart_port *port) | |||
154 | 154 | ||
155 | status = UART_GET_FR(port); | 155 | status = UART_GET_FR(port); |
156 | while (UART_RX_DATA(status) && max_count--) { | 156 | while (UART_RX_DATA(status) && max_count--) { |
157 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
158 | if (tty->low_latency) | ||
159 | tty_flip_buffer_push(tty); | ||
160 | /* | ||
161 | * If this failed then we will throw away the | ||
162 | * bytes but must do so to clear interrupts. | ||
163 | */ | ||
164 | } | ||
165 | |||
166 | ch = UART_GET_CHAR(port); | 157 | ch = UART_GET_CHAR(port); |
167 | flag = TTY_NORMAL; | 158 | flag = TTY_NORMAL; |
168 | 159 | ||
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 129670556162..034a029e356e 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -120,15 +120,6 @@ pl011_rx_chars(struct uart_amba_port *uap) | |||
120 | 120 | ||
121 | status = readw(uap->port.membase + UART01x_FR); | 121 | status = readw(uap->port.membase + UART01x_FR); |
122 | while ((status & UART01x_FR_RXFE) == 0 && max_count--) { | 122 | while ((status & UART01x_FR_RXFE) == 0 && max_count--) { |
123 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
124 | if (tty->low_latency) | ||
125 | tty_flip_buffer_push(tty); | ||
126 | /* | ||
127 | * If this failed then we will throw away the | ||
128 | * bytes but must do so to clear interrupts | ||
129 | */ | ||
130 | } | ||
131 | |||
132 | ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX; | 123 | ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX; |
133 | flag = TTY_NORMAL; | 124 | flag = TTY_NORMAL; |
134 | uap->port.icount.rx++; | 125 | uap->port.icount.rx++; |
diff --git a/drivers/serial/au1x00_uart.c b/drivers/serial/au1x00_uart.c index a274ebf256a1..ceb5d7f37bbd 100644 --- a/drivers/serial/au1x00_uart.c +++ b/drivers/serial/au1x00_uart.c | |||
@@ -241,18 +241,12 @@ static _INLINE_ void | |||
241 | receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) | 241 | receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) |
242 | { | 242 | { |
243 | struct tty_struct *tty = up->port.info->tty; | 243 | struct tty_struct *tty = up->port.info->tty; |
244 | unsigned char ch; | 244 | unsigned char ch, flag; |
245 | int max_count = 256; | 245 | int max_count = 256; |
246 | 246 | ||
247 | do { | 247 | do { |
248 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
249 | tty->flip.work.func((void *)tty); | ||
250 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
251 | return; // if TTY_DONT_FLIP is set | ||
252 | } | ||
253 | ch = serial_inp(up, UART_RX); | 248 | ch = serial_inp(up, UART_RX); |
254 | *tty->flip.char_buf_ptr = ch; | 249 | flag = TTY_NORMAL; |
255 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
256 | up->port.icount.rx++; | 250 | up->port.icount.rx++; |
257 | 251 | ||
258 | if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | | 252 | if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | |
@@ -292,30 +286,23 @@ receive_chars(struct uart_8250_port *up, int *status, struct pt_regs *regs) | |||
292 | #endif | 286 | #endif |
293 | if (*status & UART_LSR_BI) { | 287 | if (*status & UART_LSR_BI) { |
294 | DEBUG_INTR("handling break...."); | 288 | DEBUG_INTR("handling break...."); |
295 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 289 | flag = TTY_BREAK; |
296 | } else if (*status & UART_LSR_PE) | 290 | } else if (*status & UART_LSR_PE) |
297 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 291 | flag = TTY_PARITY; |
298 | else if (*status & UART_LSR_FE) | 292 | else if (*status & UART_LSR_FE) |
299 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 293 | flag = TTY_FRAME; |
300 | } | 294 | } |
301 | if (uart_handle_sysrq_char(&up->port, ch, regs)) | 295 | if (uart_handle_sysrq_char(&up->port, ch, regs)) |
302 | goto ignore_char; | 296 | goto ignore_char; |
303 | if ((*status & up->port.ignore_status_mask) == 0) { | 297 | if ((*status & up->port.ignore_status_mask) == 0) |
304 | tty->flip.flag_buf_ptr++; | 298 | tty_insert_flip_char(tty, ch, flag); |
305 | tty->flip.char_buf_ptr++; | 299 | if (*status & UART_LSR_OE) |
306 | tty->flip.count++; | ||
307 | } | ||
308 | if ((*status & UART_LSR_OE) && | ||
309 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
310 | /* | 300 | /* |
311 | * Overrun is special, since it's reported | 301 | * Overrun is special, since it's reported |
312 | * immediately, and doesn't affect the current | 302 | * immediately, and doesn't affect the current |
313 | * character. | 303 | * character. |
314 | */ | 304 | */ |
315 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | 305 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
316 | tty->flip.flag_buf_ptr++; | ||
317 | tty->flip.char_buf_ptr++; | ||
318 | tty->flip.count++; | ||
319 | } | 306 | } |
320 | ignore_char: | 307 | ignore_char: |
321 | *status = serial_inp(up, UART_LSR); | 308 | *status = serial_inp(up, UART_LSR); |
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c index 87ef368384fb..8ef999481f93 100644 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c | |||
@@ -104,8 +104,6 @@ static irqreturn_t clps711xuart_int_rx(int irq, void *dev_id, struct pt_regs *re | |||
104 | while (!(status & SYSFLG_URXFE)) { | 104 | while (!(status & SYSFLG_URXFE)) { |
105 | ch = clps_readl(UARTDR(port)); | 105 | ch = clps_readl(UARTDR(port)); |
106 | 106 | ||
107 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
108 | goto ignore_char; | ||
109 | port->icount.rx++; | 107 | port->icount.rx++; |
110 | 108 | ||
111 | flg = TTY_NORMAL; | 109 | flg = TTY_NORMAL; |
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c index 4d8516d1bb71..a64ba26a94e8 100644 --- a/drivers/serial/dz.c +++ b/drivers/serial/dz.c | |||
@@ -216,8 +216,6 @@ static inline void dz_receive_chars(struct dz_port *dport) | |||
216 | 216 | ||
217 | if (!tty) | 217 | if (!tty) |
218 | break; | 218 | break; |
219 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
220 | break; | ||
221 | 219 | ||
222 | icount->rx++; | 220 | icount->rx++; |
223 | 221 | ||
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c index eb31125c6a30..144a7a352b28 100644 --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c | |||
@@ -729,19 +729,20 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
729 | unsigned short int status; | 729 | unsigned short int status; |
730 | struct uart_icount *icount; | 730 | struct uart_icount *icount; |
731 | unsigned long offset; | 731 | unsigned long offset; |
732 | unsigned char flag; | ||
732 | 733 | ||
733 | trace(icom_port, "RCV_COMPLETE", 0); | 734 | trace(icom_port, "RCV_COMPLETE", 0); |
734 | rcv_buff = icom_port->next_rcv; | 735 | rcv_buff = icom_port->next_rcv; |
735 | 736 | ||
736 | status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags); | 737 | status = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].flags); |
737 | while (status & SA_FL_RCV_DONE) { | 738 | while (status & SA_FL_RCV_DONE) { |
739 | int first = -1; | ||
738 | 740 | ||
739 | trace(icom_port, "FID_STATUS", status); | 741 | trace(icom_port, "FID_STATUS", status); |
740 | count = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].leLength); | 742 | count = cpu_to_le16(icom_port->statStg->rcv[rcv_buff].leLength); |
741 | 743 | ||
744 | count = tty_buffer_request_room(tty, count); | ||
742 | trace(icom_port, "RCV_COUNT", count); | 745 | trace(icom_port, "RCV_COUNT", count); |
743 | if (count > (TTY_FLIPBUF_SIZE - tty->flip.count)) | ||
744 | count = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
745 | 746 | ||
746 | trace(icom_port, "REAL_COUNT", count); | 747 | trace(icom_port, "REAL_COUNT", count); |
747 | 748 | ||
@@ -749,15 +750,10 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
749 | cpu_to_le32(icom_port->statStg->rcv[rcv_buff].leBuffer) - | 750 | cpu_to_le32(icom_port->statStg->rcv[rcv_buff].leBuffer) - |
750 | icom_port->recv_buf_pci; | 751 | icom_port->recv_buf_pci; |
751 | 752 | ||
752 | memcpy(tty->flip.char_buf_ptr,(unsigned char *) | 753 | /* Block copy all but the last byte as this may have status */ |
753 | ((unsigned long)icom_port->recv_buf + offset), count); | ||
754 | |||
755 | if (count > 0) { | 754 | if (count > 0) { |
756 | tty->flip.count += count - 1; | 755 | first = icom_port->recv_buf[offset]; |
757 | tty->flip.char_buf_ptr += count - 1; | 756 | tty_insert_flip_string(tty, icom_port->recv_buf + offset, count - 1); |
758 | |||
759 | memset(tty->flip.flag_buf_ptr, 0, count); | ||
760 | tty->flip.flag_buf_ptr += count - 1; | ||
761 | } | 757 | } |
762 | 758 | ||
763 | icount = &icom_port->uart_port.icount; | 759 | icount = &icom_port->uart_port.icount; |
@@ -765,12 +761,14 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
765 | 761 | ||
766 | /* Break detect logic */ | 762 | /* Break detect logic */ |
767 | if ((status & SA_FLAGS_FRAME_ERROR) | 763 | if ((status & SA_FLAGS_FRAME_ERROR) |
768 | && (tty->flip.char_buf_ptr[0] == 0x00)) { | 764 | && first == 0) { |
769 | status &= ~SA_FLAGS_FRAME_ERROR; | 765 | status &= ~SA_FLAGS_FRAME_ERROR; |
770 | status |= SA_FLAGS_BREAK_DET; | 766 | status |= SA_FLAGS_BREAK_DET; |
771 | trace(icom_port, "BREAK_DET", 0); | 767 | trace(icom_port, "BREAK_DET", 0); |
772 | } | 768 | } |
773 | 769 | ||
770 | flag = TTY_NORMAL; | ||
771 | |||
774 | if (status & | 772 | if (status & |
775 | (SA_FLAGS_BREAK_DET | SA_FLAGS_PARITY_ERROR | | 773 | (SA_FLAGS_BREAK_DET | SA_FLAGS_PARITY_ERROR | |
776 | SA_FLAGS_FRAME_ERROR | SA_FLAGS_OVERRUN)) { | 774 | SA_FLAGS_FRAME_ERROR | SA_FLAGS_OVERRUN)) { |
@@ -797,33 +795,26 @@ static void recv_interrupt(u16 port_int_reg, struct icom_port *icom_port) | |||
797 | status &= icom_port->read_status_mask; | 795 | status &= icom_port->read_status_mask; |
798 | 796 | ||
799 | if (status & SA_FLAGS_BREAK_DET) { | 797 | if (status & SA_FLAGS_BREAK_DET) { |
800 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 798 | flag = TTY_BREAK; |
801 | } else if (status & SA_FLAGS_PARITY_ERROR) { | 799 | } else if (status & SA_FLAGS_PARITY_ERROR) { |
802 | trace(icom_port, "PARITY_ERROR", 0); | 800 | trace(icom_port, "PARITY_ERROR", 0); |
803 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 801 | flag = TTY_PARITY; |
804 | } else if (status & SA_FLAGS_FRAME_ERROR) | 802 | } else if (status & SA_FLAGS_FRAME_ERROR) |
805 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 803 | flag = TTY_FRAME; |
806 | 804 | ||
807 | if (status & SA_FLAGS_OVERRUN) { | ||
808 | /* | ||
809 | * Overrun is special, since it's | ||
810 | * reported immediately, and doesn't | ||
811 | * affect the current character | ||
812 | */ | ||
813 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
814 | tty->flip.count++; | ||
815 | tty->flip.flag_buf_ptr++; | ||
816 | tty->flip.char_buf_ptr++; | ||
817 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
818 | } | ||
819 | } | ||
820 | } | 805 | } |
821 | 806 | ||
822 | tty->flip.flag_buf_ptr++; | 807 | tty_insert_flip_char(tty, *(icom_port->recv_buf + offset + count - 1), flag); |
823 | tty->flip.char_buf_ptr++; | 808 | |
824 | tty->flip.count++; | 809 | if (status & SA_FLAGS_OVERRUN) |
825 | ignore_char: | 810 | /* |
826 | icom_port->statStg->rcv[rcv_buff].flags = 0; | 811 | * Overrun is special, since it's |
812 | * reported immediately, and doesn't | ||
813 | * affect the current character | ||
814 | */ | ||
815 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
816 | ignore_char: | ||
817 | icom_port->statStg->rcv[rcv_buff].flags = 0; | ||
827 | icom_port->statStg->rcv[rcv_buff].leLength = 0; | 818 | icom_port->statStg->rcv[rcv_buff].leLength = 0; |
828 | icom_port->statStg->rcv[rcv_buff].WorkingLength = | 819 | icom_port->statStg->rcv[rcv_buff].WorkingLength = |
829 | (unsigned short int) cpu_to_le16(RCV_BUFF_SZ); | 820 | (unsigned short int) cpu_to_le16(RCV_BUFF_SZ); |
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 83c4c1216587..5c098be9346b 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -256,9 +256,6 @@ static irqreturn_t imx_rxint(int irq, void *dev_id, struct pt_regs *regs) | |||
256 | error_return: | 256 | error_return: |
257 | tty_insert_flip_char(tty, rx, flg); | 257 | tty_insert_flip_char(tty, rx, flg); |
258 | 258 | ||
259 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
260 | goto out; | ||
261 | |||
262 | ignore_char: | 259 | ignore_char: |
263 | rx = URXD0((u32)sport->port.membase); | 260 | rx = URXD0((u32)sport->port.membase); |
264 | } while(rx & URXD_CHARRDY); | 261 | } while(rx & URXD_CHARRDY); |
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index 771676abee60..1d85533d46d2 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c | |||
@@ -2327,19 +2327,13 @@ static void receive_chars(struct uart_port *the_port) | |||
2327 | spin_lock_irqsave(&the_port->lock, pflags); | 2327 | spin_lock_irqsave(&the_port->lock, pflags); |
2328 | tty = info->tty; | 2328 | tty = info->tty; |
2329 | 2329 | ||
2330 | if (request_count > TTY_FLIPBUF_SIZE - tty->flip.count) | 2330 | request_count = tty_buffer_request_room(tty, IOC4_MAX_CHARS - 2); |
2331 | request_count = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
2332 | 2331 | ||
2333 | if (request_count > 0) { | 2332 | if (request_count > 0) { |
2334 | icount = &the_port->icount; | 2333 | icount = &the_port->icount; |
2335 | read_count = do_read(the_port, ch, request_count); | 2334 | read_count = do_read(the_port, ch, request_count); |
2336 | if (read_count > 0) { | 2335 | if (read_count > 0) { |
2337 | flip = 1; | 2336 | tty_insert_flip_string(tty, ch, read_count); |
2338 | memcpy(tty->flip.char_buf_ptr, ch, read_count); | ||
2339 | memset(tty->flip.flag_buf_ptr, TTY_NORMAL, read_count); | ||
2340 | tty->flip.char_buf_ptr += read_count; | ||
2341 | tty->flip.flag_buf_ptr += read_count; | ||
2342 | tty->flip.count += read_count; | ||
2343 | icount->rx += read_count; | 2337 | icount->rx += read_count; |
2344 | } | 2338 | } |
2345 | } | 2339 | } |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index ef132349f310..66f117d15065 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -259,13 +259,7 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
259 | struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */ | 259 | struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */ |
260 | 260 | ||
261 | while (1) { | 261 | while (1) { |
262 | unsigned char ch, r1; | 262 | unsigned char ch, r1, flag; |
263 | |||
264 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
265 | tty->flip.work.func((void *)tty); | ||
266 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
267 | return; /* XXX Ignores SysRq when we need it most. Fix. */ | ||
268 | } | ||
269 | 263 | ||
270 | r1 = read_zsreg(channel, R1); | 264 | r1 = read_zsreg(channel, R1); |
271 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { | 265 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { |
@@ -303,8 +297,7 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
303 | } | 297 | } |
304 | 298 | ||
305 | /* A real serial line, record the character and status. */ | 299 | /* A real serial line, record the character and status. */ |
306 | *tty->flip.char_buf_ptr = ch; | 300 | flag = TTY_NORMAL; |
307 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
308 | up->port.icount.rx++; | 301 | up->port.icount.rx++; |
309 | if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { | 302 | if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { |
310 | if (r1 & BRK_ABRT) { | 303 | if (r1 & BRK_ABRT) { |
@@ -321,28 +314,21 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
321 | up->port.icount.overrun++; | 314 | up->port.icount.overrun++; |
322 | r1 &= up->port.read_status_mask; | 315 | r1 &= up->port.read_status_mask; |
323 | if (r1 & BRK_ABRT) | 316 | if (r1 & BRK_ABRT) |
324 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 317 | flag = TTY_BREAK; |
325 | else if (r1 & PAR_ERR) | 318 | else if (r1 & PAR_ERR) |
326 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 319 | flag = TTY_PARITY; |
327 | else if (r1 & CRC_ERR) | 320 | else if (r1 & CRC_ERR) |
328 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 321 | flag = TTY_FRAME; |
329 | } | 322 | } |
330 | if (uart_handle_sysrq_char(&up->port, ch, regs)) | 323 | if (uart_handle_sysrq_char(&up->port, ch, regs)) |
331 | goto next_char; | 324 | goto next_char; |
332 | 325 | ||
333 | if (up->port.ignore_status_mask == 0xff || | 326 | if (up->port.ignore_status_mask == 0xff || |
334 | (r1 & up->port.ignore_status_mask) == 0) { | 327 | (r1 & up->port.ignore_status_mask) == 0) |
335 | tty->flip.flag_buf_ptr++; | 328 | tty_insert_flip_char(tty, ch, flag); |
336 | tty->flip.char_buf_ptr++; | 329 | |
337 | tty->flip.count++; | 330 | if (r1 & Rx_OVR) |
338 | } | 331 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
339 | if ((r1 & Rx_OVR) && | ||
340 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
341 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
342 | tty->flip.flag_buf_ptr++; | ||
343 | tty->flip.char_buf_ptr++; | ||
344 | tty->flip.count++; | ||
345 | } | ||
346 | next_char: | 332 | next_char: |
347 | ch = readb(&channel->control); | 333 | ch = readb(&channel->control); |
348 | ZSDELAY(); | 334 | ZSDELAY(); |
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c index b0ecc7537ce5..b48066a64a7d 100644 --- a/drivers/serial/m32r_sio.c +++ b/drivers/serial/m32r_sio.c | |||
@@ -331,17 +331,12 @@ static _INLINE_ void receive_chars(struct uart_sio_port *up, int *status, | |||
331 | { | 331 | { |
332 | struct tty_struct *tty = up->port.info->tty; | 332 | struct tty_struct *tty = up->port.info->tty; |
333 | unsigned char ch; | 333 | unsigned char ch; |
334 | unsigned char flag; | ||
334 | int max_count = 256; | 335 | int max_count = 256; |
335 | 336 | ||
336 | do { | 337 | do { |
337 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
338 | tty->flip.work.func((void *)tty); | ||
339 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
340 | return; // if TTY_DONT_FLIP is set | ||
341 | } | ||
342 | ch = sio_in(up, SIORXB); | 338 | ch = sio_in(up, SIORXB); |
343 | *tty->flip.char_buf_ptr = ch; | 339 | flag = TTY_NORMAL; |
344 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
345 | up->port.icount.rx++; | 340 | up->port.icount.rx++; |
346 | 341 | ||
347 | if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | | 342 | if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | |
@@ -380,30 +375,24 @@ static _INLINE_ void receive_chars(struct uart_sio_port *up, int *status, | |||
380 | 375 | ||
381 | if (*status & UART_LSR_BI) { | 376 | if (*status & UART_LSR_BI) { |
382 | DEBUG_INTR("handling break...."); | 377 | DEBUG_INTR("handling break...."); |
383 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 378 | flag = TTY_BREAK; |
384 | } else if (*status & UART_LSR_PE) | 379 | } else if (*status & UART_LSR_PE) |
385 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 380 | flag = TTY_PARITY; |
386 | else if (*status & UART_LSR_FE) | 381 | else if (*status & UART_LSR_FE) |
387 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 382 | flag = TTY_FRAME; |
388 | } | 383 | } |
389 | if (uart_handle_sysrq_char(&up->port, ch, regs)) | 384 | if (uart_handle_sysrq_char(&up->port, ch, regs)) |
390 | goto ignore_char; | 385 | goto ignore_char; |
391 | if ((*status & up->port.ignore_status_mask) == 0) { | 386 | if ((*status & up->port.ignore_status_mask) == 0) |
392 | tty->flip.flag_buf_ptr++; | 387 | tty_insert_flip_char(tty, ch, flag); |
393 | tty->flip.char_buf_ptr++; | 388 | |
394 | tty->flip.count++; | 389 | if (*status & UART_LSR_OE) { |
395 | } | ||
396 | if ((*status & UART_LSR_OE) && | ||
397 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
398 | /* | 390 | /* |
399 | * Overrun is special, since it's reported | 391 | * Overrun is special, since it's reported |
400 | * immediately, and doesn't affect the current | 392 | * immediately, and doesn't affect the current |
401 | * character. | 393 | * character. |
402 | */ | 394 | */ |
403 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | 395 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
404 | tty->flip.flag_buf_ptr++; | ||
405 | tty->flip.char_buf_ptr++; | ||
406 | tty->flip.count++; | ||
407 | } | 396 | } |
408 | ignore_char: | 397 | ignore_char: |
409 | *status = serial_in(up, UART_LSR); | 398 | *status = serial_in(up, UART_LSR); |
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c index 47f7404cb045..f2a51e61eec7 100644 --- a/drivers/serial/mcfserial.c +++ b/drivers/serial/mcfserial.c | |||
@@ -313,7 +313,7 @@ static inline void receive_chars(struct mcf_serial *info) | |||
313 | { | 313 | { |
314 | volatile unsigned char *uartp; | 314 | volatile unsigned char *uartp; |
315 | struct tty_struct *tty = info->tty; | 315 | struct tty_struct *tty = info->tty; |
316 | unsigned char status, ch; | 316 | unsigned char status, ch, flag; |
317 | 317 | ||
318 | if (!tty) | 318 | if (!tty) |
319 | return; | 319 | return; |
@@ -321,10 +321,6 @@ static inline void receive_chars(struct mcf_serial *info) | |||
321 | uartp = info->addr; | 321 | uartp = info->addr; |
322 | 322 | ||
323 | while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) { | 323 | while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) { |
324 | |||
325 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
326 | break; | ||
327 | |||
328 | ch = uartp[MCFUART_URB]; | 324 | ch = uartp[MCFUART_URB]; |
329 | info->stats.rx++; | 325 | info->stats.rx++; |
330 | 326 | ||
@@ -335,29 +331,24 @@ static inline void receive_chars(struct mcf_serial *info) | |||
335 | } | 331 | } |
336 | #endif | 332 | #endif |
337 | 333 | ||
338 | tty->flip.count++; | 334 | flag = TTY_NORMAL; |
339 | if (status & MCFUART_USR_RXERR) { | 335 | if (status & MCFUART_USR_RXERR) { |
340 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR; | 336 | uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR; |
341 | if (status & MCFUART_USR_RXBREAK) { | 337 | if (status & MCFUART_USR_RXBREAK) { |
342 | info->stats.rxbreak++; | 338 | info->stats.rxbreak++; |
343 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 339 | flag = TTY_BREAK; |
344 | } else if (status & MCFUART_USR_RXPARITY) { | 340 | } else if (status & MCFUART_USR_RXPARITY) { |
345 | info->stats.rxparity++; | 341 | info->stats.rxparity++; |
346 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | 342 | flag = TTY_PARITY; |
347 | } else if (status & MCFUART_USR_RXOVERRUN) { | 343 | } else if (status & MCFUART_USR_RXOVERRUN) { |
348 | info->stats.rxoverrun++; | 344 | info->stats.rxoverrun++; |
349 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 345 | flag = TTY_OVERRUN; |
350 | } else if (status & MCFUART_USR_RXFRAMING) { | 346 | } else if (status & MCFUART_USR_RXFRAMING) { |
351 | info->stats.rxframing++; | 347 | info->stats.rxframing++; |
352 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 348 | flag = TTY_FRAME; |
353 | } else { | ||
354 | /* This should never happen... */ | ||
355 | *tty->flip.flag_buf_ptr++ = 0; | ||
356 | } | 349 | } |
357 | } else { | ||
358 | *tty->flip.flag_buf_ptr++ = 0; | ||
359 | } | 350 | } |
360 | *tty->flip.char_buf_ptr++ = ch; | 351 | tty_insert_flip_char(tty, ch, flag); |
361 | } | 352 | } |
362 | 353 | ||
363 | schedule_work(&tty->flip.work); | 354 | schedule_work(&tty->flip.work); |
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 1288d6203e94..61dd17d7bace 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -405,17 +405,13 @@ static inline int | |||
405 | mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs) | 405 | mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs) |
406 | { | 406 | { |
407 | struct tty_struct *tty = port->info->tty; | 407 | struct tty_struct *tty = port->info->tty; |
408 | unsigned char ch; | 408 | unsigned char ch, flag; |
409 | unsigned short status; | 409 | unsigned short status; |
410 | 410 | ||
411 | /* While we can read, do so ! */ | 411 | /* While we can read, do so ! */ |
412 | while ( (status = in_be16(&PSC(port)->mpc52xx_psc_status)) & | 412 | while ( (status = in_be16(&PSC(port)->mpc52xx_psc_status)) & |
413 | MPC52xx_PSC_SR_RXRDY) { | 413 | MPC52xx_PSC_SR_RXRDY) { |
414 | 414 | ||
415 | /* If we are full, just stop reading */ | ||
416 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
417 | break; | ||
418 | |||
419 | /* Get the char */ | 415 | /* Get the char */ |
420 | ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8); | 416 | ch = in_8(&PSC(port)->mpc52xx_psc_buffer_8); |
421 | 417 | ||
@@ -428,45 +424,35 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port, struct pt_regs *regs) | |||
428 | #endif | 424 | #endif |
429 | 425 | ||
430 | /* Store it */ | 426 | /* Store it */ |
431 | *tty->flip.char_buf_ptr = ch; | 427 | |
432 | *tty->flip.flag_buf_ptr = 0; | 428 | flag = TTY_NORMAL; |
433 | port->icount.rx++; | 429 | port->icount.rx++; |
434 | 430 | ||
435 | if ( status & (MPC52xx_PSC_SR_PE | | 431 | if ( status & (MPC52xx_PSC_SR_PE | |
436 | MPC52xx_PSC_SR_FE | | 432 | MPC52xx_PSC_SR_FE | |
437 | MPC52xx_PSC_SR_RB | | 433 | MPC52xx_PSC_SR_RB) ) { |
438 | MPC52xx_PSC_SR_OE) ) { | ||
439 | 434 | ||
440 | if (status & MPC52xx_PSC_SR_RB) { | 435 | if (status & MPC52xx_PSC_SR_RB) { |
441 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 436 | flag = TTY_BREAK; |
442 | uart_handle_break(port); | 437 | uart_handle_break(port); |
443 | } else if (status & MPC52xx_PSC_SR_PE) | 438 | } else if (status & MPC52xx_PSC_SR_PE) |
444 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 439 | flag = TTY_PARITY; |
445 | else if (status & MPC52xx_PSC_SR_FE) | 440 | else if (status & MPC52xx_PSC_SR_FE) |
446 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 441 | flag = TTY_FRAME; |
447 | if (status & MPC52xx_PSC_SR_OE) { | ||
448 | /* | ||
449 | * Overrun is special, since it's | ||
450 | * reported immediately, and doesn't | ||
451 | * affect the current character | ||
452 | */ | ||
453 | if (tty->flip.count < (TTY_FLIPBUF_SIZE-1)) { | ||
454 | tty->flip.flag_buf_ptr++; | ||
455 | tty->flip.char_buf_ptr++; | ||
456 | tty->flip.count++; | ||
457 | } | ||
458 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
459 | } | ||
460 | 442 | ||
461 | /* Clear error condition */ | 443 | /* Clear error condition */ |
462 | out_8(&PSC(port)->command,MPC52xx_PSC_RST_ERR_STAT); | 444 | out_8(&PSC(port)->command,MPC52xx_PSC_RST_ERR_STAT); |
463 | 445 | ||
464 | } | 446 | } |
465 | 447 | tty_insert_flip_char(tty, ch, flag); | |
466 | tty->flip.char_buf_ptr++; | 448 | if (status & MPC52xx_PSC_SR_OE) { |
467 | tty->flip.flag_buf_ptr++; | 449 | /* |
468 | tty->flip.count++; | 450 | * Overrun is special, since it's |
469 | 451 | * reported immediately, and doesn't | |
452 | * affect the current character | ||
453 | */ | ||
454 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
455 | } | ||
470 | } | 456 | } |
471 | 457 | ||
472 | tty_flip_buffer_push(tty); | 458 | tty_flip_buffer_push(tty); |
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 8f83e4007ecd..0ca83ac31d07 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -769,12 +769,12 @@ mpsc_rx_intr(struct mpsc_port_info *pi, struct pt_regs *regs) | |||
769 | bytes_in = be16_to_cpu(rxre->bytecnt); | 769 | bytes_in = be16_to_cpu(rxre->bytecnt); |
770 | 770 | ||
771 | /* Following use of tty struct directly is deprecated */ | 771 | /* Following use of tty struct directly is deprecated */ |
772 | if (unlikely((tty->flip.count + bytes_in) >= TTY_FLIPBUF_SIZE)){ | 772 | if (unlikely(tty_buffer_request_room(tty, bytes_in) < bytes_in)) { |
773 | if (tty->low_latency) | 773 | if (tty->low_latency) |
774 | tty_flip_buffer_push(tty); | 774 | tty_flip_buffer_push(tty); |
775 | /* | 775 | /* |
776 | * If this failed then we will throw awa the bytes | 776 | * If this failed then we will throw away the bytes |
777 | * but mst do so to clear interrupts. | 777 | * but must do so to clear interrupts. |
778 | */ | 778 | */ |
779 | } | 779 | } |
780 | 780 | ||
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 7633132a10aa..4e49168c3176 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c | |||
@@ -223,11 +223,6 @@ static void mux_read(struct uart_port *port) | |||
223 | if (MUX_EOFIFO(data)) | 223 | if (MUX_EOFIFO(data)) |
224 | break; | 224 | break; |
225 | 225 | ||
226 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
227 | continue; | ||
228 | |||
229 | *tty->flip.char_buf_ptr = data & 0xffu; | ||
230 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
231 | port->icount.rx++; | 226 | port->icount.rx++; |
232 | 227 | ||
233 | if (MUX_BREAK(data)) { | 228 | if (MUX_BREAK(data)) { |
@@ -239,9 +234,7 @@ static void mux_read(struct uart_port *port) | |||
239 | if (uart_handle_sysrq_char(port, data & 0xffu, NULL)) | 234 | if (uart_handle_sysrq_char(port, data & 0xffu, NULL)) |
240 | continue; | 235 | continue; |
241 | 236 | ||
242 | tty->flip.flag_buf_ptr++; | 237 | tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL); |
243 | tty->flip.char_buf_ptr++; | ||
244 | tty->flip.count++; | ||
245 | } | 238 | } |
246 | 239 | ||
247 | if (start_count != port->icount.rx) { | 240 | if (start_count != port->icount.rx) { |
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index ea24129eb6b9..f330d6c0e0df 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -210,10 +210,9 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap, | |||
210 | struct pt_regs *regs) | 210 | struct pt_regs *regs) |
211 | { | 211 | { |
212 | struct tty_struct *tty = NULL; | 212 | struct tty_struct *tty = NULL; |
213 | unsigned char ch, r1, drop, error; | 213 | unsigned char ch, r1, drop, error, flag; |
214 | int loops = 0; | 214 | int loops = 0; |
215 | 215 | ||
216 | retry: | ||
217 | /* The interrupt can be enabled when the port isn't open, typically | 216 | /* The interrupt can be enabled when the port isn't open, typically |
218 | * that happens when using one port is open and the other closed (stale | 217 | * that happens when using one port is open and the other closed (stale |
219 | * interrupt) or when one port is used as a console. | 218 | * interrupt) or when one port is used as a console. |
@@ -246,20 +245,6 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap, | |||
246 | error = 0; | 245 | error = 0; |
247 | drop = 0; | 246 | drop = 0; |
248 | 247 | ||
249 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
250 | /* Have to drop the lock here */ | ||
251 | pmz_debug("pmz: flip overflow\n"); | ||
252 | spin_unlock(&uap->port.lock); | ||
253 | tty->flip.work.func((void *)tty); | ||
254 | spin_lock(&uap->port.lock); | ||
255 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
256 | drop = 1; | ||
257 | if (ZS_IS_ASLEEP(uap)) | ||
258 | return NULL; | ||
259 | if (!ZS_IS_OPEN(uap)) | ||
260 | goto retry; | ||
261 | } | ||
262 | |||
263 | r1 = read_zsreg(uap, R1); | 248 | r1 = read_zsreg(uap, R1); |
264 | ch = read_zsdata(uap); | 249 | ch = read_zsdata(uap); |
265 | 250 | ||
@@ -295,8 +280,7 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap, | |||
295 | if (drop) | 280 | if (drop) |
296 | goto next_char; | 281 | goto next_char; |
297 | 282 | ||
298 | *tty->flip.char_buf_ptr = ch; | 283 | flag = TTY_NORMAL; |
299 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
300 | uap->port.icount.rx++; | 284 | uap->port.icount.rx++; |
301 | 285 | ||
302 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | BRK_ABRT)) { | 286 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | BRK_ABRT)) { |
@@ -316,26 +300,19 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap, | |||
316 | uap->port.icount.overrun++; | 300 | uap->port.icount.overrun++; |
317 | r1 &= uap->port.read_status_mask; | 301 | r1 &= uap->port.read_status_mask; |
318 | if (r1 & BRK_ABRT) | 302 | if (r1 & BRK_ABRT) |
319 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 303 | flag = TTY_BREAK; |
320 | else if (r1 & PAR_ERR) | 304 | else if (r1 & PAR_ERR) |
321 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 305 | flag = TTY_PARITY; |
322 | else if (r1 & CRC_ERR) | 306 | else if (r1 & CRC_ERR) |
323 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 307 | flag = TTY_FRAME; |
324 | } | 308 | } |
325 | 309 | ||
326 | if (uap->port.ignore_status_mask == 0xff || | 310 | if (uap->port.ignore_status_mask == 0xff || |
327 | (r1 & uap->port.ignore_status_mask) == 0) { | 311 | (r1 & uap->port.ignore_status_mask) == 0) { |
328 | tty->flip.flag_buf_ptr++; | 312 | tty_insert_flip_char(tty, ch, flag); |
329 | tty->flip.char_buf_ptr++; | ||
330 | tty->flip.count++; | ||
331 | } | ||
332 | if ((r1 & Rx_OVR) && | ||
333 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
334 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
335 | tty->flip.flag_buf_ptr++; | ||
336 | tty->flip.char_buf_ptr++; | ||
337 | tty->flip.count++; | ||
338 | } | 313 | } |
314 | if (r1 & Rx_OVR) | ||
315 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
339 | next_char: | 316 | next_char: |
340 | /* We can get stuck in an infinite loop getting char 0 when the | 317 | /* We can get stuck in an infinite loop getting char 0 when the |
341 | * line is in a wrong HW state, we break that here. | 318 | * line is in a wrong HW state, we break that here. |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index cc998b99a19f..10535f00301f 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -107,14 +107,6 @@ receive_chars(struct uart_pxa_port *up, int *status, struct pt_regs *regs) | |||
107 | int max_count = 256; | 107 | int max_count = 256; |
108 | 108 | ||
109 | do { | 109 | do { |
110 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
111 | if (tty->low_latency) | ||
112 | tty_flip_buffer_push(tty); | ||
113 | /* | ||
114 | * If this failed then we will throw away the | ||
115 | * bytes but must do so to clear interrupts | ||
116 | */ | ||
117 | } | ||
118 | ch = serial_in(up, UART_RX); | 110 | ch = serial_in(up, UART_RX); |
119 | flag = TTY_NORMAL; | 111 | flag = TTY_NORMAL; |
120 | up->port.icount.rx++; | 112 | up->port.icount.rx++; |
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index fe83ce6fef52..eb4883efb7c6 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -323,16 +323,6 @@ s3c24xx_serial_rx_chars(int irq, void *dev_id, struct pt_regs *regs) | |||
323 | if (s3c24xx_serial_rx_fifocnt(ourport, ufstat) == 0) | 323 | if (s3c24xx_serial_rx_fifocnt(ourport, ufstat) == 0) |
324 | break; | 324 | break; |
325 | 325 | ||
326 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
327 | if (tty->low_latency) | ||
328 | tty_flip_buffer_push(tty); | ||
329 | |||
330 | /* | ||
331 | * If this failed then we will throw away the | ||
332 | * bytes but must do so to clear interrupts | ||
333 | */ | ||
334 | } | ||
335 | |||
336 | uerstat = rd_regl(port, S3C2410_UERSTAT); | 326 | uerstat = rd_regl(port, S3C2410_UERSTAT); |
337 | ch = rd_regb(port, S3C2410_URXH); | 327 | ch = rd_regb(port, S3C2410_URXH); |
338 | 328 | ||
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 25a086458ab9..1bd93168f504 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -201,8 +201,6 @@ sa1100_rx_chars(struct sa1100_port *sport, struct pt_regs *regs) | |||
201 | while (status & UTSR1_TO_SM(UTSR1_RNE)) { | 201 | while (status & UTSR1_TO_SM(UTSR1_RNE)) { |
202 | ch = UART_GET_CHAR(sport); | 202 | ch = UART_GET_CHAR(sport); |
203 | 203 | ||
204 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
205 | goto ignore_char; | ||
206 | sport->port.icount.rx++; | 204 | sport->port.icount.rx++; |
207 | 205 | ||
208 | flg = TTY_NORMAL; | 206 | flg = TTY_NORMAL; |
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c index d01dbe5da3b9..d4a1f0e798c1 100644 --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c | |||
@@ -148,15 +148,6 @@ lh7a40xuart_rx_chars (struct uart_port* port) | |||
148 | unsigned int data, flag;/* Received data and status */ | 148 | unsigned int data, flag;/* Received data and status */ |
149 | 149 | ||
150 | while (!(UR (port, UART_R_STATUS) & nRxRdy) && --cbRxMax) { | 150 | while (!(UR (port, UART_R_STATUS) & nRxRdy) && --cbRxMax) { |
151 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
152 | if (tty->low_latency) | ||
153 | tty_flip_buffer_push(tty); | ||
154 | /* | ||
155 | * If this failed then we will throw away the | ||
156 | * bytes but must do so to clear interrupts | ||
157 | */ | ||
158 | } | ||
159 | |||
160 | data = UR (port, UART_R_DATA); | 151 | data = UR (port, UART_R_DATA); |
161 | flag = TTY_NORMAL; | 152 | flag = TTY_NORMAL; |
162 | ++port->icount.rx; | 153 | ++port->icount.rx; |
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c index 995d9dd9ddd5..fdd1f1915a42 100644 --- a/drivers/serial/serial_txx9.c +++ b/drivers/serial/serial_txx9.c | |||
@@ -303,17 +303,6 @@ receive_chars(struct uart_txx9_port *up, unsigned int *status, struct pt_regs *r | |||
303 | char flag; | 303 | char flag; |
304 | 304 | ||
305 | do { | 305 | do { |
306 | /* The following is not allowed by the tty layer and | ||
307 | unsafe. It should be fixed ASAP */ | ||
308 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
309 | if (tty->low_latency) { | ||
310 | spin_unlock(&up->port.lock); | ||
311 | tty_flip_buffer_push(tty); | ||
312 | spin_lock(&up->port.lock); | ||
313 | } | ||
314 | /* If this failed then we will throw away the | ||
315 | bytes but must do so to clear interrupts */ | ||
316 | } | ||
317 | ch = sio_in(up, TXX9_SIRFIFO); | 306 | ch = sio_in(up, TXX9_SIRFIFO); |
318 | flag = TTY_NORMAL; | 307 | flag = TTY_NORMAL; |
319 | up->port.icount.rx++; | 308 | up->port.icount.rx++; |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 430754ebac8a..a9e070759628 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -482,6 +482,7 @@ static inline void sci_receive_chars(struct uart_port *port, | |||
482 | struct tty_struct *tty = port->info->tty; | 482 | struct tty_struct *tty = port->info->tty; |
483 | int i, count, copied = 0; | 483 | int i, count, copied = 0; |
484 | unsigned short status; | 484 | unsigned short status; |
485 | unsigned char flag; | ||
485 | 486 | ||
486 | status = sci_in(port, SCxSR); | 487 | status = sci_in(port, SCxSR); |
487 | if (!(status & SCxSR_RDxF(port))) | 488 | if (!(status & SCxSR_RDxF(port))) |
@@ -499,8 +500,7 @@ static inline void sci_receive_chars(struct uart_port *port, | |||
499 | #endif | 500 | #endif |
500 | 501 | ||
501 | /* Don't copy more bytes than there is room for in the buffer */ | 502 | /* Don't copy more bytes than there is room for in the buffer */ |
502 | if (tty->flip.count + count > TTY_FLIPBUF_SIZE) | 503 | count = tty_buffer_request_room(tty, count); |
503 | count = TTY_FLIPBUF_SIZE - tty->flip.count; | ||
504 | 504 | ||
505 | /* If for any reason we can't copy more data, we're done! */ | 505 | /* If for any reason we can't copy more data, we're done! */ |
506 | if (count == 0) | 506 | if (count == 0) |
@@ -512,8 +512,7 @@ static inline void sci_receive_chars(struct uart_port *port, | |||
512 | || uart_handle_sysrq_char(port, c, regs)) { | 512 | || uart_handle_sysrq_char(port, c, regs)) { |
513 | count = 0; | 513 | count = 0; |
514 | } else { | 514 | } else { |
515 | tty->flip.char_buf_ptr[0] = c; | 515 | tty_insert_flip_char(tty, c, TTY_NORMAL); |
516 | tty->flip.flag_buf_ptr[0] = TTY_NORMAL; | ||
517 | } | 516 | } |
518 | } else { | 517 | } else { |
519 | for (i=0; i<count; i++) { | 518 | for (i=0; i<count; i++) { |
@@ -542,26 +541,21 @@ static inline void sci_receive_chars(struct uart_port *port, | |||
542 | } | 541 | } |
543 | 542 | ||
544 | /* Store data and status */ | 543 | /* Store data and status */ |
545 | tty->flip.char_buf_ptr[i] = c; | ||
546 | if (status&SCxSR_FER(port)) { | 544 | if (status&SCxSR_FER(port)) { |
547 | tty->flip.flag_buf_ptr[i] = TTY_FRAME; | 545 | flag = TTY_FRAME; |
548 | pr_debug("sci: frame error\n"); | 546 | pr_debug("sci: frame error\n"); |
549 | } else if (status&SCxSR_PER(port)) { | 547 | } else if (status&SCxSR_PER(port)) { |
550 | tty->flip.flag_buf_ptr[i] = TTY_PARITY; | 548 | flag = TTY_PARITY; |
551 | pr_debug("sci: parity error\n"); | 549 | pr_debug("sci: parity error\n"); |
552 | } else { | 550 | } else |
553 | tty->flip.flag_buf_ptr[i] = TTY_NORMAL; | 551 | flag = TTY_NORMAL; |
554 | } | 552 | tty_insert_flip_char(tty, c, flag); |
555 | } | 553 | } |
556 | } | 554 | } |
557 | 555 | ||
558 | sci_in(port, SCxSR); /* dummy read */ | 556 | sci_in(port, SCxSR); /* dummy read */ |
559 | sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 557 | sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
560 | 558 | ||
561 | /* Update the kernel buffer end */ | ||
562 | tty->flip.count += count; | ||
563 | tty->flip.char_buf_ptr += count; | ||
564 | tty->flip.flag_buf_ptr += count; | ||
565 | copied += count; | 559 | copied += count; |
566 | port->icount.rx += count; | 560 | port->icount.rx += count; |
567 | } | 561 | } |
@@ -608,48 +602,45 @@ static inline int sci_handle_errors(struct uart_port *port) | |||
608 | unsigned short status = sci_in(port, SCxSR); | 602 | unsigned short status = sci_in(port, SCxSR); |
609 | struct tty_struct *tty = port->info->tty; | 603 | struct tty_struct *tty = port->info->tty; |
610 | 604 | ||
611 | if (status&SCxSR_ORER(port) && tty->flip.count<TTY_FLIPBUF_SIZE) { | 605 | if (status&SCxSR_ORER(port)) { |
612 | /* overrun error */ | 606 | /* overrun error */ |
613 | copied++; | 607 | if(tty_insert_flip_char(tty, 0, TTY_OVERRUN)) |
614 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 608 | copied++; |
615 | pr_debug("sci: overrun error\n"); | 609 | pr_debug("sci: overrun error\n"); |
616 | } | 610 | } |
617 | 611 | ||
618 | if (status&SCxSR_FER(port) && tty->flip.count<TTY_FLIPBUF_SIZE) { | 612 | if (status&SCxSR_FER(port)) { |
619 | if (sci_rxd_in(port) == 0) { | 613 | if (sci_rxd_in(port) == 0) { |
620 | /* Notify of BREAK */ | 614 | /* Notify of BREAK */ |
621 | struct sci_port * sci_port = (struct sci_port *)port; | 615 | struct sci_port * sci_port = (struct sci_port *)port; |
622 | if(!sci_port->break_flag) { | 616 | if(!sci_port->break_flag) { |
623 | sci_port->break_flag = 1; | 617 | sci_port->break_flag = 1; |
624 | sci_schedule_break_timer((struct sci_port *)port); | 618 | sci_schedule_break_timer((struct sci_port *)port); |
625 | /* Do sysrq handling. */ | 619 | /* Do sysrq handling. */ |
626 | if(uart_handle_break(port)) { | 620 | if(uart_handle_break(port)) |
627 | return 0; | 621 | return 0; |
628 | } | ||
629 | pr_debug("sci: BREAK detected\n"); | 622 | pr_debug("sci: BREAK detected\n"); |
630 | copied++; | 623 | if(tty_insert_flip_char(tty, 0, TTY_BREAK)) |
631 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 624 | copied++; |
632 | } | 625 | } |
633 | } | 626 | } |
634 | else { | 627 | else { |
635 | /* frame error */ | 628 | /* frame error */ |
636 | copied++; | 629 | if(tty_insert_flip_char(tty, 0, TTY_FRAME)) |
637 | *tty->flip.flag_buf_ptr++ = TTY_FRAME; | 630 | copied++; |
638 | pr_debug("sci: frame error\n"); | 631 | pr_debug("sci: frame error\n"); |
639 | } | 632 | } |
640 | } | 633 | } |
641 | 634 | ||
642 | if (status&SCxSR_PER(port) && tty->flip.count<TTY_FLIPBUF_SIZE) { | 635 | if (status&SCxSR_PER(port)) { |
636 | if(tty_insert_flip_char(tty, 0, TTY_PARITY)) | ||
637 | copied++; | ||
643 | /* parity error */ | 638 | /* parity error */ |
644 | copied++; | ||
645 | *tty->flip.flag_buf_ptr++ = TTY_PARITY; | ||
646 | pr_debug("sci: parity error\n"); | 639 | pr_debug("sci: parity error\n"); |
647 | } | 640 | } |
648 | 641 | ||
649 | if (copied) { | 642 | if (copied) |
650 | tty->flip.count += copied; | ||
651 | tty_flip_buffer_push(tty); | 643 | tty_flip_buffer_push(tty); |
652 | } | ||
653 | 644 | ||
654 | return copied; | 645 | return copied; |
655 | } | 646 | } |
@@ -661,15 +652,14 @@ static inline int sci_handle_breaks(struct uart_port *port) | |||
661 | struct tty_struct *tty = port->info->tty; | 652 | struct tty_struct *tty = port->info->tty; |
662 | struct sci_port *s = &sci_ports[port->line]; | 653 | struct sci_port *s = &sci_ports[port->line]; |
663 | 654 | ||
664 | if (!s->break_flag && status & SCxSR_BRK(port) && | 655 | if (!s->break_flag && status & SCxSR_BRK(port)) |
665 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
666 | #if defined(CONFIG_CPU_SH3) | 656 | #if defined(CONFIG_CPU_SH3) |
667 | /* Debounce break */ | 657 | /* Debounce break */ |
668 | s->break_flag = 1; | 658 | s->break_flag = 1; |
669 | #endif | 659 | #endif |
670 | /* Notify of BREAK */ | 660 | /* Notify of BREAK */ |
671 | copied++; | 661 | if(tty_insert_flip_char(tty, 0, TTY_BREAK)) |
672 | *tty->flip.flag_buf_ptr++ = TTY_BREAK; | 662 | copied++; |
673 | pr_debug("sci: BREAK detected\n"); | 663 | pr_debug("sci: BREAK detected\n"); |
674 | } | 664 | } |
675 | 665 | ||
@@ -677,19 +667,15 @@ static inline int sci_handle_breaks(struct uart_port *port) | |||
677 | /* XXX: Handle SCIF overrun error */ | 667 | /* XXX: Handle SCIF overrun error */ |
678 | if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { | 668 | if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { |
679 | sci_out(port, SCLSR, 0); | 669 | sci_out(port, SCLSR, 0); |
680 | if(tty->flip.count<TTY_FLIPBUF_SIZE) { | 670 | if(tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { |
681 | copied++; | 671 | copied++; |
682 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | ||
683 | pr_debug("sci: overrun error\n"); | 672 | pr_debug("sci: overrun error\n"); |
684 | } | 673 | } |
685 | } | 674 | } |
686 | #endif | 675 | #endif |
687 | 676 | ||
688 | if (copied) { | 677 | if (copied) |
689 | tty->flip.count += copied; | ||
690 | tty_flip_buffer_push(tty); | 678 | tty_flip_buffer_push(tty); |
691 | } | ||
692 | |||
693 | return copied; | 679 | return copied; |
694 | } | 680 | } |
695 | 681 | ||
@@ -732,12 +718,9 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr, struct pt_regs *regs) | |||
732 | struct tty_struct *tty = port->info->tty; | 718 | struct tty_struct *tty = port->info->tty; |
733 | 719 | ||
734 | sci_out(port, SCLSR, 0); | 720 | sci_out(port, SCLSR, 0); |
735 | if(tty->flip.count<TTY_FLIPBUF_SIZE) { | 721 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
736 | *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; | 722 | tty_flip_buffer_push(tty); |
737 | tty->flip.count++; | 723 | pr_debug("scif: overrun error\n"); |
738 | tty_flip_buffer_push(tty); | ||
739 | pr_debug("scif: overrun error\n"); | ||
740 | } | ||
741 | } | 724 | } |
742 | #endif | 725 | #endif |
743 | sci_rx_interrupt(irq, ptr, regs); | 726 | sci_rx_interrupt(irq, ptr, regs); |
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c index 313f9df24a2d..5468e5a767e2 100644 --- a/drivers/serial/sn_console.c +++ b/drivers/serial/sn_console.c | |||
@@ -519,11 +519,7 @@ sn_receive_chars(struct sn_cons_port *port, struct pt_regs *regs, | |||
519 | 519 | ||
520 | /* record the character to pass up to the tty layer */ | 520 | /* record the character to pass up to the tty layer */ |
521 | if (tty) { | 521 | if (tty) { |
522 | *tty->flip.char_buf_ptr = ch; | 522 | if(tty_insert_flip_char(tty, ch, TTY_NORMAL) == 0) |
523 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
524 | tty->flip.char_buf_ptr++; | ||
525 | tty->flip.count++; | ||
526 | if (tty->flip.count == TTY_FLIPBUF_SIZE) | ||
527 | break; | 523 | break; |
528 | } | 524 | } |
529 | port->sc_port.icount.rx++; | 525 | port->sc_port.icount.rx++; |
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index ba9381fd3f2d..7e773ff76c61 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c | |||
@@ -159,21 +159,14 @@ receive_chars(struct uart_sunsab_port *up, | |||
159 | saw_console_brk = 1; | 159 | saw_console_brk = 1; |
160 | 160 | ||
161 | for (i = 0; i < count; i++) { | 161 | for (i = 0; i < count; i++) { |
162 | unsigned char ch = buf[i]; | 162 | unsigned char ch = buf[i], flag; |
163 | 163 | ||
164 | if (tty == NULL) { | 164 | if (tty == NULL) { |
165 | uart_handle_sysrq_char(&up->port, ch, regs); | 165 | uart_handle_sysrq_char(&up->port, ch, regs); |
166 | continue; | 166 | continue; |
167 | } | 167 | } |
168 | 168 | ||
169 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | 169 | flag = TTY_NORMAL; |
170 | tty->flip.work.func((void *)tty); | ||
171 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
172 | return tty; // if TTY_DONT_FLIP is set | ||
173 | } | ||
174 | |||
175 | *tty->flip.char_buf_ptr = ch; | ||
176 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
177 | up->port.icount.rx++; | 170 | up->port.icount.rx++; |
178 | 171 | ||
179 | if (unlikely(stat->sreg.isr0 & (SAB82532_ISR0_PERR | | 172 | if (unlikely(stat->sreg.isr0 & (SAB82532_ISR0_PERR | |
@@ -209,34 +202,21 @@ receive_chars(struct uart_sunsab_port *up, | |||
209 | stat->sreg.isr1 &= ((up->port.read_status_mask >> 8) & 0xff); | 202 | stat->sreg.isr1 &= ((up->port.read_status_mask >> 8) & 0xff); |
210 | 203 | ||
211 | if (stat->sreg.isr1 & SAB82532_ISR1_BRK) { | 204 | if (stat->sreg.isr1 & SAB82532_ISR1_BRK) { |
212 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 205 | flag = TTY_BREAK; |
213 | } else if (stat->sreg.isr0 & SAB82532_ISR0_PERR) | 206 | } else if (stat->sreg.isr0 & SAB82532_ISR0_PERR) |
214 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 207 | flag = TTY_PARITY; |
215 | else if (stat->sreg.isr0 & SAB82532_ISR0_FERR) | 208 | else if (stat->sreg.isr0 & SAB82532_ISR0_FERR) |
216 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 209 | flag = TTY_FRAME; |
217 | } | 210 | } |
218 | 211 | ||
219 | if (uart_handle_sysrq_char(&up->port, ch, regs)) | 212 | if (uart_handle_sysrq_char(&up->port, ch, regs)) |
220 | continue; | 213 | continue; |
221 | 214 | ||
222 | if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 && | 215 | if ((stat->sreg.isr0 & (up->port.ignore_status_mask & 0xff)) == 0 && |
223 | (stat->sreg.isr1 & ((up->port.ignore_status_mask >> 8) & 0xff)) == 0){ | 216 | (stat->sreg.isr1 & ((up->port.ignore_status_mask >> 8) & 0xff)) == 0) |
224 | tty->flip.flag_buf_ptr++; | 217 | tty_insert_flip_char(tty, ch, flag); |
225 | tty->flip.char_buf_ptr++; | 218 | if (stat->sreg.isr0 & SAB82532_ISR0_RFO) |
226 | tty->flip.count++; | 219 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
227 | } | ||
228 | if ((stat->sreg.isr0 & SAB82532_ISR0_RFO) && | ||
229 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
230 | /* | ||
231 | * Overrun is special, since it's reported | ||
232 | * immediately, and doesn't affect the current | ||
233 | * character. | ||
234 | */ | ||
235 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
236 | tty->flip.flag_buf_ptr++; | ||
237 | tty->flip.char_buf_ptr++; | ||
238 | tty->flip.count++; | ||
239 | } | ||
240 | } | 220 | } |
241 | 221 | ||
242 | if (saw_console_brk) | 222 | if (saw_console_brk) |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index f0738533f39a..9a3665b34d97 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -323,19 +323,13 @@ static _INLINE_ struct tty_struct * | |||
323 | receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs) | 323 | receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs *regs) |
324 | { | 324 | { |
325 | struct tty_struct *tty = up->port.info->tty; | 325 | struct tty_struct *tty = up->port.info->tty; |
326 | unsigned char ch; | 326 | unsigned char ch, flag; |
327 | int max_count = 256; | 327 | int max_count = 256; |
328 | int saw_console_brk = 0; | 328 | int saw_console_brk = 0; |
329 | 329 | ||
330 | do { | 330 | do { |
331 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
332 | tty->flip.work.func((void *)tty); | ||
333 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
334 | return tty; // if TTY_DONT_FLIP is set | ||
335 | } | ||
336 | ch = serial_inp(up, UART_RX); | 331 | ch = serial_inp(up, UART_RX); |
337 | *tty->flip.char_buf_ptr = ch; | 332 | flag = TTY_NORMAL; |
338 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
339 | up->port.icount.rx++; | 333 | up->port.icount.rx++; |
340 | 334 | ||
341 | if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | | 335 | if (unlikely(*status & (UART_LSR_BI | UART_LSR_PE | |
@@ -377,31 +371,23 @@ receive_chars(struct uart_sunsu_port *up, unsigned char *status, struct pt_regs | |||
377 | } | 371 | } |
378 | 372 | ||
379 | if (*status & UART_LSR_BI) { | 373 | if (*status & UART_LSR_BI) { |
380 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 374 | flag = TTY_BREAK; |
381 | } else if (*status & UART_LSR_PE) | 375 | } else if (*status & UART_LSR_PE) |
382 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 376 | flag = TTY_PARITY; |
383 | else if (*status & UART_LSR_FE) | 377 | else if (*status & UART_LSR_FE) |
384 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 378 | flag = TTY_FRAME; |
385 | } | 379 | } |
386 | if (uart_handle_sysrq_char(&up->port, ch, regs)) | 380 | if (uart_handle_sysrq_char(&up->port, ch, regs)) |
387 | goto ignore_char; | 381 | goto ignore_char; |
388 | if ((*status & up->port.ignore_status_mask) == 0) { | 382 | if ((*status & up->port.ignore_status_mask) == 0) |
389 | tty->flip.flag_buf_ptr++; | 383 | tty_insert_flip_char(tty, ch, flag); |
390 | tty->flip.char_buf_ptr++; | 384 | if (*status & UART_LSR_OE) |
391 | tty->flip.count++; | ||
392 | } | ||
393 | if ((*status & UART_LSR_OE) && | ||
394 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
395 | /* | 385 | /* |
396 | * Overrun is special, since it's reported | 386 | * Overrun is special, since it's reported |
397 | * immediately, and doesn't affect the current | 387 | * immediately, and doesn't affect the current |
398 | * character. | 388 | * character. |
399 | */ | 389 | */ |
400 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | 390 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
401 | tty->flip.flag_buf_ptr++; | ||
402 | tty->flip.char_buf_ptr++; | ||
403 | tty->flip.count++; | ||
404 | } | ||
405 | ignore_char: | 391 | ignore_char: |
406 | *status = serial_inp(up, UART_LSR); | 392 | *status = serial_inp(up, UART_LSR); |
407 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); | 393 | } while ((*status & UART_LSR_DR) && (max_count-- > 0)); |
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 7653d6cf05af..3c72484adea7 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c | |||
@@ -319,7 +319,7 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
319 | struct pt_regs *regs) | 319 | struct pt_regs *regs) |
320 | { | 320 | { |
321 | struct tty_struct *tty; | 321 | struct tty_struct *tty; |
322 | unsigned char ch, r1; | 322 | unsigned char ch, r1, flag; |
323 | 323 | ||
324 | tty = NULL; | 324 | tty = NULL; |
325 | if (up->port.info != NULL && /* Unopened serial console */ | 325 | if (up->port.info != NULL && /* Unopened serial console */ |
@@ -362,19 +362,8 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
362 | continue; | 362 | continue; |
363 | } | 363 | } |
364 | 364 | ||
365 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
366 | tty->flip.work.func((void *)tty); | ||
367 | /* | ||
368 | * The 8250 bails out of the loop here, | ||
369 | * but we need to read everything, or die. | ||
370 | */ | ||
371 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
372 | continue; | ||
373 | } | ||
374 | |||
375 | /* A real serial line, record the character and status. */ | 365 | /* A real serial line, record the character and status. */ |
376 | *tty->flip.char_buf_ptr = ch; | 366 | flag = TTY_NORMAL; |
377 | *tty->flip.flag_buf_ptr = TTY_NORMAL; | ||
378 | up->port.icount.rx++; | 367 | up->port.icount.rx++; |
379 | if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { | 368 | if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { |
380 | if (r1 & BRK_ABRT) { | 369 | if (r1 & BRK_ABRT) { |
@@ -391,28 +380,21 @@ sunzilog_receive_chars(struct uart_sunzilog_port *up, | |||
391 | up->port.icount.overrun++; | 380 | up->port.icount.overrun++; |
392 | r1 &= up->port.read_status_mask; | 381 | r1 &= up->port.read_status_mask; |
393 | if (r1 & BRK_ABRT) | 382 | if (r1 & BRK_ABRT) |
394 | *tty->flip.flag_buf_ptr = TTY_BREAK; | 383 | flag = TTY_BREAK; |
395 | else if (r1 & PAR_ERR) | 384 | else if (r1 & PAR_ERR) |
396 | *tty->flip.flag_buf_ptr = TTY_PARITY; | 385 | flag = TTY_PARITY; |
397 | else if (r1 & CRC_ERR) | 386 | else if (r1 & CRC_ERR) |
398 | *tty->flip.flag_buf_ptr = TTY_FRAME; | 387 | flag = TTY_FRAME; |
399 | } | 388 | } |
400 | if (uart_handle_sysrq_char(&up->port, ch, regs)) | 389 | if (uart_handle_sysrq_char(&up->port, ch, regs)) |
401 | continue; | 390 | continue; |
402 | 391 | ||
403 | if (up->port.ignore_status_mask == 0xff || | 392 | if (up->port.ignore_status_mask == 0xff || |
404 | (r1 & up->port.ignore_status_mask) == 0) { | 393 | (r1 & up->port.ignore_status_mask) == 0) { |
405 | tty->flip.flag_buf_ptr++; | 394 | tty_insert_flip_char(tty, ch, flag); |
406 | tty->flip.char_buf_ptr++; | ||
407 | tty->flip.count++; | ||
408 | } | ||
409 | if ((r1 & Rx_OVR) && | ||
410 | tty->flip.count < TTY_FLIPBUF_SIZE) { | ||
411 | *tty->flip.flag_buf_ptr = TTY_OVERRUN; | ||
412 | tty->flip.flag_buf_ptr++; | ||
413 | tty->flip.char_buf_ptr++; | ||
414 | tty->flip.count++; | ||
415 | } | 395 | } |
396 | if (r1 & Rx_OVR) | ||
397 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
416 | } | 398 | } |
417 | 399 | ||
418 | return tty; | 400 | return tty; |
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index 865d4dea65df..0a28deeb098d 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -371,11 +371,6 @@ static inline void receive_chars(struct uart_port *port, uint8_t *status, | |||
371 | lsr = *status; | 371 | lsr = *status; |
372 | 372 | ||
373 | do { | 373 | do { |
374 | if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE)) { | ||
375 | if (tty->low_latency) | ||
376 | tty_flip_buffer_push(tty); | ||
377 | } | ||
378 | |||
379 | ch = siu_read(port, UART_RX); | 374 | ch = siu_read(port, UART_RX); |
380 | port->icount.rx++; | 375 | port->icount.rx++; |
381 | flag = TTY_NORMAL; | 376 | flag = TTY_NORMAL; |
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index b28336148658..c1b47d74e206 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -532,9 +532,9 @@ static void speedtch_handle_int(struct urb *int_urb, struct pt_regs *regs) | |||
532 | int ret = int_urb->status; | 532 | int ret = int_urb->status; |
533 | 533 | ||
534 | /* The magic interrupt for "up state" */ | 534 | /* The magic interrupt for "up state" */ |
535 | const static unsigned char up_int[6] = { 0xa1, 0x00, 0x01, 0x00, 0x00, 0x00 }; | 535 | static const unsigned char up_int[6] = { 0xa1, 0x00, 0x01, 0x00, 0x00, 0x00 }; |
536 | /* The magic interrupt for "down state" */ | 536 | /* The magic interrupt for "down state" */ |
537 | const static unsigned char down_int[6] = { 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00 }; | 537 | static const unsigned char down_int[6] = { 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
538 | 538 | ||
539 | atm_dbg(usbatm, "%s entered\n", __func__); | 539 | atm_dbg(usbatm, "%s entered\n", __func__); |
540 | 540 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 248279e44c99..b9fd39fd1b5b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -335,14 +335,9 @@ next_buffer: | |||
335 | 335 | ||
336 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d\n", buf, buf->size); | 336 | dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d\n", buf, buf->size); |
337 | 337 | ||
338 | for (i = 0; i < buf->size && !acm->throttle; i++) { | 338 | tty_buffer_request_room(tty, buf->size); |
339 | /* if we insert more than TTY_FLIPBUF_SIZE characters, | 339 | if (!acm->throttle) |
340 | we drop them. */ | 340 | tty_insert_flip_string(tty, buf->base, buf->size); |
341 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
342 | tty_flip_buffer_push(tty); | ||
343 | } | ||
344 | tty_insert_flip_char(tty, buf->base[i], 0); | ||
345 | } | ||
346 | tty_flip_buffer_push(tty); | 341 | tty_flip_buffer_push(tty); |
347 | 342 | ||
348 | spin_lock(&acm->throttle_lock); | 343 | spin_lock(&acm->throttle_lock); |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 65e084a2c87e..2e6926b33455 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -1271,6 +1271,7 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size) | |||
1271 | unsigned int len; | 1271 | unsigned int len; |
1272 | struct gs_port *port; | 1272 | struct gs_port *port; |
1273 | int ret; | 1273 | int ret; |
1274 | struct tty_struct *tty; | ||
1274 | 1275 | ||
1275 | /* TEMPORARY -- only port 0 is supported right now */ | 1276 | /* TEMPORARY -- only port 0 is supported right now */ |
1276 | port = dev->dev_port[0]; | 1277 | port = dev->dev_port[0]; |
@@ -1290,7 +1291,10 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size) | |||
1290 | goto exit; | 1291 | goto exit; |
1291 | } | 1292 | } |
1292 | 1293 | ||
1293 | if (port->port_tty == NULL) { | 1294 | |
1295 | tty = port->port_tty; | ||
1296 | |||
1297 | if (tty == NULL) { | ||
1294 | printk(KERN_ERR "gs_recv_packet: port=%d, NULL tty pointer\n", | 1298 | printk(KERN_ERR "gs_recv_packet: port=%d, NULL tty pointer\n", |
1295 | port->port_num); | 1299 | port->port_num); |
1296 | ret = -EIO; | 1300 | ret = -EIO; |
@@ -1304,20 +1308,13 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size) | |||
1304 | goto exit; | 1308 | goto exit; |
1305 | } | 1309 | } |
1306 | 1310 | ||
1307 | len = (unsigned int)(TTY_FLIPBUF_SIZE - port->port_tty->flip.count); | 1311 | len = tty_buffer_request_room(tty, size); |
1308 | if (len < size) | 1312 | if (len > 0) { |
1309 | size = len; | 1313 | tty_insert_flip_string(tty, packet, len); |
1310 | |||
1311 | if (size > 0) { | ||
1312 | memcpy(port->port_tty->flip.char_buf_ptr, packet, size); | ||
1313 | port->port_tty->flip.char_buf_ptr += size; | ||
1314 | port->port_tty->flip.count += size; | ||
1315 | tty_flip_buffer_push(port->port_tty); | 1314 | tty_flip_buffer_push(port->port_tty); |
1316 | wake_up_interruptible(&port->port_tty->read_wait); | 1315 | wake_up_interruptible(&port->port_tty->read_wait); |
1317 | } | 1316 | } |
1318 | |||
1319 | ret = 0; | 1317 | ret = 0; |
1320 | |||
1321 | exit: | 1318 | exit: |
1322 | spin_unlock(&port->port_lock); | 1319 | spin_unlock(&port->port_lock); |
1323 | return ret; | 1320 | return ret; |
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 458f2acdeb0a..28538db9eaf3 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -674,7 +674,7 @@ struct vendor_product | |||
674 | 674 | ||
675 | 675 | ||
676 | /* These are taken from the msmUSB.inf file on the Windows driver CD */ | 676 | /* These are taken from the msmUSB.inf file on the Windows driver CD */ |
677 | const static struct vendor_product mts_supported_products[] = | 677 | static const struct vendor_product mts_supported_products[] = |
678 | { | 678 | { |
679 | { "Phantom 336CX", mts_sup_unknown}, | 679 | { "Phantom 336CX", mts_sup_unknown}, |
680 | { "Phantom 336CX", mts_sup_unknown}, | 680 | { "Phantom 336CX", mts_sup_unknown}, |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 14f55fd26a64..be5dc80836c3 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -84,7 +84,7 @@ config USB_SERIAL_BELKIN | |||
84 | 84 | ||
85 | config USB_SERIAL_WHITEHEAT | 85 | config USB_SERIAL_WHITEHEAT |
86 | tristate "USB ConnectTech WhiteHEAT Serial Driver" | 86 | tristate "USB ConnectTech WhiteHEAT Serial Driver" |
87 | depends on USB_SERIAL && BROKEN_ON_SMP | 87 | depends on USB_SERIAL |
88 | help | 88 | help |
89 | Say Y here if you want to use a ConnectTech WhiteHEAT 4 port | 89 | Say Y here if you want to use a ConnectTech WhiteHEAT 4 port |
90 | USB to serial converter device. | 90 | USB to serial converter device. |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 6d18d4eaba35..2357b1d102d7 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -364,7 +364,6 @@ static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
364 | struct tty_struct *tty; | 364 | struct tty_struct *tty; |
365 | unsigned char *data = urb->transfer_buffer; | 365 | unsigned char *data = urb->transfer_buffer; |
366 | short todo; | 366 | short todo; |
367 | int i; | ||
368 | int result; | 367 | int result; |
369 | 368 | ||
370 | dbg("%s - port %d", __FUNCTION__, port->number); | 369 | dbg("%s - port %d", __FUNCTION__, port->number); |
@@ -381,14 +380,8 @@ static void cyberjack_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
381 | return; | 380 | return; |
382 | } | 381 | } |
383 | if (urb->actual_length) { | 382 | if (urb->actual_length) { |
384 | for (i = 0; i < urb->actual_length ; ++i) { | 383 | tty_buffer_request_room(tty, urb->actual_length); |
385 | /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ | 384 | tty_insert_flip_string(tty, data, urb->actual_length); |
386 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
387 | tty_flip_buffer_push(tty); | ||
388 | } | ||
389 | /* this doesn't actually push the data through unless tty->low_latency is set */ | ||
390 | tty_insert_flip_char(tty, data[i], 0); | ||
391 | } | ||
392 | tty_flip_buffer_push(tty); | 385 | tty_flip_buffer_push(tty); |
393 | } | 386 | } |
394 | 387 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 4e9637eb6137..68067fe117a4 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -1263,12 +1263,10 @@ static void cypress_read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
1263 | 1263 | ||
1264 | /* process read if there is data other than line status */ | 1264 | /* process read if there is data other than line status */ |
1265 | if (tty && (bytes > i)) { | 1265 | if (tty && (bytes > i)) { |
1266 | bytes = tty_buffer_request_room(tty, bytes); | ||
1266 | for (; i < bytes ; ++i) { | 1267 | for (; i < bytes ; ++i) { |
1267 | dbg("pushing byte number %d - %d - %c", i, data[i], | 1268 | dbg("pushing byte number %d - %d - %c", i, data[i], |
1268 | data[i]); | 1269 | data[i]); |
1269 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
1270 | tty_flip_buffer_push(tty); | ||
1271 | } | ||
1272 | tty_insert_flip_char(tty, data[i], tty_flag); | 1270 | tty_insert_flip_char(tty, data[i], tty_flag); |
1273 | } | 1271 | } |
1274 | tty_flip_buffer_push(port->tty); | 1272 | tty_flip_buffer_push(port->tty); |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index 8fc414bd5b24..b3f776a90c93 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -946,13 +946,10 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); | |||
946 | spin_lock_irqsave( &priv->dp_port_lock, flags ); | 946 | spin_lock_irqsave( &priv->dp_port_lock, flags ); |
947 | 947 | ||
948 | /* send any buffered chars from throttle time on to tty subsystem */ | 948 | /* send any buffered chars from throttle time on to tty subsystem */ |
949 | len = min(priv->dp_in_buf_len, TTY_FLIPBUF_SIZE - tty->flip.count ); | 949 | |
950 | len = tty_buffer_request_room(tty, priv->dp_in_buf_len); | ||
950 | if( len > 0 ) { | 951 | if( len > 0 ) { |
951 | memcpy( tty->flip.char_buf_ptr, priv->dp_in_buf, len ); | 952 | tty_insert_flip_string_flags(tty, priv->dp_in_buf, priv->dp_in_flag_buf, len); |
952 | memcpy( tty->flip.flag_buf_ptr, priv->dp_in_flag_buf, len ); | ||
953 | tty->flip.char_buf_ptr += len; | ||
954 | tty->flip.flag_buf_ptr += len; | ||
955 | tty->flip.count += len; | ||
956 | tty_flip_buffer_push( tty ); | 953 | tty_flip_buffer_push( tty ); |
957 | } | 954 | } |
958 | 955 | ||
@@ -1827,6 +1824,7 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
1827 | int status = ((unsigned char *)urb->transfer_buffer)[2]; | 1824 | int status = ((unsigned char *)urb->transfer_buffer)[2]; |
1828 | unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3; | 1825 | unsigned char *data = ((unsigned char *)urb->transfer_buffer)+3; |
1829 | int flag,throttled; | 1826 | int flag,throttled; |
1827 | int i; | ||
1830 | 1828 | ||
1831 | /* do not process callbacks on closed ports */ | 1829 | /* do not process callbacks on closed ports */ |
1832 | /* but do continue the read chain */ | 1830 | /* but do continue the read chain */ |
@@ -1885,20 +1883,18 @@ static int digi_read_inb_callback( struct urb *urb ) | |||
1885 | } | 1883 | } |
1886 | 1884 | ||
1887 | } else { | 1885 | } else { |
1888 | 1886 | len = tty_buffer_request_room(tty, len); | |
1889 | len = min( len, TTY_FLIPBUF_SIZE - tty->flip.count ); | ||
1890 | |||
1891 | if( len > 0 ) { | 1887 | if( len > 0 ) { |
1892 | memcpy( tty->flip.char_buf_ptr, data, len ); | 1888 | /* Hot path */ |
1893 | memset( tty->flip.flag_buf_ptr, flag, len ); | 1889 | if(flag == TTY_NORMAL) |
1894 | tty->flip.char_buf_ptr += len; | 1890 | tty_insert_flip_string(tty, data, len); |
1895 | tty->flip.flag_buf_ptr += len; | 1891 | else { |
1896 | tty->flip.count += len; | 1892 | for(i = 0; i < len; i++) |
1893 | tty_insert_flip_char(tty, data[i], flag); | ||
1894 | } | ||
1897 | tty_flip_buffer_push( tty ); | 1895 | tty_flip_buffer_push( tty ); |
1898 | } | 1896 | } |
1899 | |||
1900 | } | 1897 | } |
1901 | |||
1902 | } | 1898 | } |
1903 | 1899 | ||
1904 | spin_unlock( &priv->dp_port_lock ); | 1900 | spin_unlock( &priv->dp_port_lock ); |
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 79a766e9ca23..63f7c78a1152 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -344,7 +344,6 @@ static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
344 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 344 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
345 | struct tty_struct *tty; | 345 | struct tty_struct *tty; |
346 | unsigned char *data = urb->transfer_buffer; | 346 | unsigned char *data = urb->transfer_buffer; |
347 | int i; | ||
348 | int result; | 347 | int result; |
349 | 348 | ||
350 | dbg("%s - port %d", __FUNCTION__, port->number); | 349 | dbg("%s - port %d", __FUNCTION__, port->number); |
@@ -359,19 +358,8 @@ static void empeg_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
359 | tty = port->tty; | 358 | tty = port->tty; |
360 | 359 | ||
361 | if (urb->actual_length) { | 360 | if (urb->actual_length) { |
362 | for (i = 0; i < urb->actual_length ; ++i) { | 361 | tty_buffer_request_room(tty, urb->actual_length); |
363 | /* gb - 2000/11/13 | 362 | tty_insert_flip_string(tty, data, urb->actual_length); |
364 | * If we insert too many characters we'll overflow the buffer. | ||
365 | * This means we'll lose bytes - Decidedly bad. | ||
366 | */ | ||
367 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
368 | tty_flip_buffer_push(tty); | ||
369 | } | ||
370 | tty_insert_flip_char(tty, data[i], 0); | ||
371 | } | ||
372 | /* gb - 2000/11/13 | ||
373 | * Goes straight through instead of scheduling - if tty->low_latency is set. | ||
374 | */ | ||
375 | tty_flip_buffer_push(tty); | 363 | tty_flip_buffer_push(tty); |
376 | bytes_in += urb->actual_length; | 364 | bytes_in += urb->actual_length; |
377 | } | 365 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index eb863b3f2d79..10bc1bf23b35 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1610,24 +1610,11 @@ static void ftdi_process_read (void *param) | |||
1610 | length = 0; | 1610 | length = 0; |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | /* have to make sure we don't overflow the buffer | ||
1614 | with tty_insert_flip_char's */ | ||
1615 | if (tty->flip.count+length > TTY_FLIPBUF_SIZE) { | ||
1616 | tty_flip_buffer_push(tty); | ||
1617 | need_flip = 0; | ||
1618 | |||
1619 | if (tty->flip.count != 0) { | ||
1620 | /* flip didn't work, this happens when ftdi_process_read() is | ||
1621 | * called from ftdi_unthrottle, because TTY_DONT_FLIP is set */ | ||
1622 | dbg("%s - flip buffer push failed", __FUNCTION__); | ||
1623 | break; | ||
1624 | } | ||
1625 | } | ||
1626 | if (priv->rx_flags & THROTTLED) { | 1613 | if (priv->rx_flags & THROTTLED) { |
1627 | dbg("%s - throttled", __FUNCTION__); | 1614 | dbg("%s - throttled", __FUNCTION__); |
1628 | break; | 1615 | break; |
1629 | } | 1616 | } |
1630 | if (tty->ldisc.receive_room(tty)-tty->flip.count < length) { | 1617 | if (tty_buffer_request_room(tty, length) < length) { |
1631 | /* break out & wait for throttling/unthrottling to happen */ | 1618 | /* break out & wait for throttling/unthrottling to happen */ |
1632 | dbg("%s - receive room low", __FUNCTION__); | 1619 | dbg("%s - receive room low", __FUNCTION__); |
1633 | break; | 1620 | break; |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 452efce72714..d6f55e9dccae 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -275,23 +275,14 @@ static void send_to_tty(struct usb_serial_port *port, | |||
275 | char *data, unsigned int actual_length) | 275 | char *data, unsigned int actual_length) |
276 | { | 276 | { |
277 | struct tty_struct *tty = port->tty; | 277 | struct tty_struct *tty = port->tty; |
278 | int i; | ||
279 | 278 | ||
280 | if (tty && actual_length) { | 279 | if (tty && actual_length) { |
281 | 280 | ||
282 | usb_serial_debug_data(debug, &port->dev, | 281 | usb_serial_debug_data(debug, &port->dev, |
283 | __FUNCTION__, actual_length, data); | 282 | __FUNCTION__, actual_length, data); |
284 | 283 | ||
285 | for (i = 0; i < actual_length ; ++i) { | 284 | tty_buffer_request_room(tty, actual_length); |
286 | /* if we insert more than TTY_FLIPBUF_SIZE characters, | 285 | tty_insert_flip_string(tty, data, actual_length); |
287 | we drop them. */ | ||
288 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
289 | tty_flip_buffer_push(tty); | ||
290 | } | ||
291 | /* this doesn't actually push the data through unless | ||
292 | tty->low_latency is set */ | ||
293 | tty_insert_flip_char(tty, data[i], 0); | ||
294 | } | ||
295 | tty_flip_buffer_push(tty); | 286 | tty_flip_buffer_push(tty); |
296 | } | 287 | } |
297 | } | 288 | } |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 4ddac620fc0c..476cda107f4f 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -254,7 +254,6 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg | |||
254 | struct usb_serial *serial = port->serial; | 254 | struct usb_serial *serial = port->serial; |
255 | struct tty_struct *tty; | 255 | struct tty_struct *tty; |
256 | unsigned char *data = urb->transfer_buffer; | 256 | unsigned char *data = urb->transfer_buffer; |
257 | int i; | ||
258 | int result; | 257 | int result; |
259 | 258 | ||
260 | dbg("%s - port %d", __FUNCTION__, port->number); | 259 | dbg("%s - port %d", __FUNCTION__, port->number); |
@@ -268,14 +267,8 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb, struct pt_regs *reg | |||
268 | 267 | ||
269 | tty = port->tty; | 268 | tty = port->tty; |
270 | if (tty && urb->actual_length) { | 269 | if (tty && urb->actual_length) { |
271 | for (i = 0; i < urb->actual_length ; ++i) { | 270 | tty_buffer_request_room(tty, urb->actual_length); |
272 | /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ | 271 | tty_insert_flip_string(tty, data, urb->actual_length); |
273 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
274 | tty_flip_buffer_push(tty); | ||
275 | } | ||
276 | /* this doesn't actually push the data through unless tty->low_latency is set */ | ||
277 | tty_insert_flip_char(tty, data[i], 0); | ||
278 | } | ||
279 | tty_flip_buffer_push(tty); | 272 | tty_flip_buffer_push(tty); |
280 | } | 273 | } |
281 | 274 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index faedbeb6ba49..3f29e6b0fd19 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -1965,20 +1965,14 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c | |||
1965 | int cnt; | 1965 | int cnt; |
1966 | 1966 | ||
1967 | do { | 1967 | do { |
1968 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1968 | cnt = tty_buffer_request_room(tty, length); |
1969 | tty_flip_buffer_push(tty); | 1969 | if (cnt < length) { |
1970 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1970 | dev_err(dev, "%s - dropping data, %d bytes lost\n", |
1971 | dev_err(dev, "%s - dropping data, %d bytes lost\n", | 1971 | __FUNCTION__, length - cnt); |
1972 | __FUNCTION__, length); | 1972 | if(cnt == 0) |
1973 | return; | 1973 | break; |
1974 | } | ||
1975 | } | 1974 | } |
1976 | cnt = min(length, TTY_FLIPBUF_SIZE - tty->flip.count); | 1975 | tty_insert_flip_string(tty, data, cnt); |
1977 | memcpy(tty->flip.char_buf_ptr, data, cnt); | ||
1978 | memset(tty->flip.flag_buf_ptr, 0, cnt); | ||
1979 | tty->flip.char_buf_ptr += cnt; | ||
1980 | tty->flip.flag_buf_ptr += cnt; | ||
1981 | tty->flip.count += cnt; | ||
1982 | data += cnt; | 1976 | data += cnt; |
1983 | length -= cnt; | 1977 | length -= cnt; |
1984 | } while (length > 0); | 1978 | } while (length > 0); |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 2edf9cabad20..afc0f34b3a46 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -1865,20 +1865,14 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, unsigned c | |||
1865 | int cnt; | 1865 | int cnt; |
1866 | 1866 | ||
1867 | do { | 1867 | do { |
1868 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1868 | cnt = tty_buffer_request_room(tty, length); |
1869 | tty_flip_buffer_push(tty); | 1869 | if (cnt < length) { |
1870 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1870 | dev_err(dev, "%s - dropping data, %d bytes lost\n", |
1871 | dev_err(dev, "%s - dropping data, %d bytes lost\n", | 1871 | __FUNCTION__, length - cnt); |
1872 | __FUNCTION__, length); | 1872 | if(cnt == 0) |
1873 | return; | 1873 | break; |
1874 | } | ||
1875 | } | 1874 | } |
1876 | cnt = min(length, TTY_FLIPBUF_SIZE - tty->flip.count); | 1875 | tty_insert_flip_string(tty, data, cnt); |
1877 | memcpy(tty->flip.char_buf_ptr, data, cnt); | ||
1878 | memset(tty->flip.flag_buf_ptr, 0, cnt); | ||
1879 | tty->flip.char_buf_ptr += cnt; | ||
1880 | tty->flip.flag_buf_ptr += cnt; | ||
1881 | tty->flip.count += cnt; | ||
1882 | data += cnt; | 1876 | data += cnt; |
1883 | length -= cnt; | 1877 | length -= cnt; |
1884 | } while (length > 0); | 1878 | } while (length > 0); |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 06d07cea0b70..9a5c97989562 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -711,7 +711,7 @@ static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
711 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 711 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
712 | struct tty_struct *tty; | 712 | struct tty_struct *tty; |
713 | unsigned char *data = urb->transfer_buffer; | 713 | unsigned char *data = urb->transfer_buffer; |
714 | int i, result; | 714 | int result; |
715 | 715 | ||
716 | dbg("%s - port %d", __FUNCTION__, port->number); | 716 | dbg("%s - port %d", __FUNCTION__, port->number); |
717 | 717 | ||
@@ -724,14 +724,8 @@ static void ipaq_read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
724 | 724 | ||
725 | tty = port->tty; | 725 | tty = port->tty; |
726 | if (tty && urb->actual_length) { | 726 | if (tty && urb->actual_length) { |
727 | for (i = 0; i < urb->actual_length ; ++i) { | 727 | tty_buffer_request_room(tty, urb->actual_length); |
728 | /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ | 728 | tty_insert_flip_string(tty, data, urb->actual_length); |
729 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
730 | tty_flip_buffer_push(tty); | ||
731 | } | ||
732 | /* this doesn't actually push the data through unless tty->low_latency is set */ | ||
733 | tty_insert_flip_char(tty, data[i], 0); | ||
734 | } | ||
735 | tty_flip_buffer_push(tty); | 729 | tty_flip_buffer_push(tty); |
736 | bytes_in += urb->actual_length; | 730 | bytes_in += urb->actual_length; |
737 | } | 731 | } |
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 2dd191f5fe76..e760a70242c1 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -166,7 +166,6 @@ static void ipw_read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
166 | struct usb_serial_port *port = urb->context; | 166 | struct usb_serial_port *port = urb->context; |
167 | unsigned char *data = urb->transfer_buffer; | 167 | unsigned char *data = urb->transfer_buffer; |
168 | struct tty_struct *tty; | 168 | struct tty_struct *tty; |
169 | int i; | ||
170 | int result; | 169 | int result; |
171 | 170 | ||
172 | dbg("%s - port %d", __FUNCTION__, port->number); | 171 | dbg("%s - port %d", __FUNCTION__, port->number); |
@@ -180,14 +179,8 @@ static void ipw_read_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
180 | 179 | ||
181 | tty = port->tty; | 180 | tty = port->tty; |
182 | if (tty && urb->actual_length) { | 181 | if (tty && urb->actual_length) { |
183 | for (i = 0; i < urb->actual_length ; ++i) { | 182 | tty_buffer_request_room(tty, urb->actual_length); |
184 | /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ | 183 | tty_insert_flip_string(tty, data, urb->actual_length); |
185 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
186 | tty_flip_buffer_push(tty); | ||
187 | } | ||
188 | /* this doesn't actually push the data through unless tty->low_latency is set */ | ||
189 | tty_insert_flip_char(tty, data[i], 0); | ||
190 | } | ||
191 | tty_flip_buffer_push(tty); | 184 | tty_flip_buffer_push(tty); |
192 | } | 185 | } |
193 | 186 | ||
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index 4e2f7dfb58b2..78335a5f7743 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -648,7 +648,6 @@ static void klsi_105_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
648 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, | 648 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, |
649 | urb->actual_length, data); | 649 | urb->actual_length, data); |
650 | } else { | 650 | } else { |
651 | int i; | ||
652 | int bytes_sent = ((__u8 *) data)[0] + | 651 | int bytes_sent = ((__u8 *) data)[0] + |
653 | ((unsigned int) ((__u8 *) data)[1] << 8); | 652 | ((unsigned int) ((__u8 *) data)[1] << 8); |
654 | tty = port->tty; | 653 | tty = port->tty; |
@@ -669,16 +668,8 @@ static void klsi_105_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
669 | bytes_sent = urb->actual_length - 2; | 668 | bytes_sent = urb->actual_length - 2; |
670 | } | 669 | } |
671 | 670 | ||
672 | for (i = 2; i < 2+bytes_sent; i++) { | 671 | tty_buffer_request_room(tty, bytes_sent); |
673 | /* if we insert more than TTY_FLIPBUF_SIZE characters, | 672 | tty_insert_flip_string(tty, data + 2, bytes_sent); |
674 | * we drop them. */ | ||
675 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
676 | tty_flip_buffer_push(tty); | ||
677 | } | ||
678 | /* this doesn't actually push the data through unless | ||
679 | * tty->low_latency is set */ | ||
680 | tty_insert_flip_char(tty, ((__u8*) data)[i], 0); | ||
681 | } | ||
682 | tty_flip_buffer_push(tty); | 673 | tty_flip_buffer_push(tty); |
683 | 674 | ||
684 | /* again lockless, but debug info only */ | 675 | /* again lockless, but debug info only */ |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index d9c21e275130..b8b213185d0f 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -365,7 +365,6 @@ static void kobil_close (struct usb_serial_port *port, struct file *filp) | |||
365 | 365 | ||
366 | static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs) | 366 | static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs) |
367 | { | 367 | { |
368 | int i; | ||
369 | int result; | 368 | int result; |
370 | struct usb_serial_port *port = (struct usb_serial_port *) purb->context; | 369 | struct usb_serial_port *port = (struct usb_serial_port *) purb->context; |
371 | struct tty_struct *tty; | 370 | struct tty_struct *tty; |
@@ -397,14 +396,8 @@ static void kobil_read_int_callback( struct urb *purb, struct pt_regs *regs) | |||
397 | */ | 396 | */ |
398 | // END DEBUG | 397 | // END DEBUG |
399 | 398 | ||
400 | for (i = 0; i < purb->actual_length; ++i) { | 399 | tty_buffer_request_room(tty, purb->actual_length); |
401 | // if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. | 400 | tty_insert_flip_string(tty, data, purb->actual_length); |
402 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
403 | tty_flip_buffer_push(tty); | ||
404 | } | ||
405 | // this doesn't actually push the data through unless tty->low_latency is set | ||
406 | tty_insert_flip_char(tty, data[i], 0); | ||
407 | } | ||
408 | tty_flip_buffer_push(tty); | 401 | tty_flip_buffer_push(tty); |
409 | } | 402 | } |
410 | 403 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 3fd2405304fd..52bdf6fe46f2 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -321,7 +321,7 @@ static int option_write(struct usb_serial_port *port, | |||
321 | 321 | ||
322 | static void option_indat_callback(struct urb *urb, struct pt_regs *regs) | 322 | static void option_indat_callback(struct urb *urb, struct pt_regs *regs) |
323 | { | 323 | { |
324 | int i, err; | 324 | int err; |
325 | int endpoint; | 325 | int endpoint; |
326 | struct usb_serial_port *port; | 326 | struct usb_serial_port *port; |
327 | struct tty_struct *tty; | 327 | struct tty_struct *tty; |
@@ -338,11 +338,8 @@ static void option_indat_callback(struct urb *urb, struct pt_regs *regs) | |||
338 | } else { | 338 | } else { |
339 | tty = port->tty; | 339 | tty = port->tty; |
340 | if (urb->actual_length) { | 340 | if (urb->actual_length) { |
341 | for (i = 0; i < urb->actual_length ; ++i) { | 341 | tty_buffer_request_room(tty, urb->actual_length); |
342 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | 342 | tty_insert_flip_string(tty, data, urb->actual_length); |
343 | tty_flip_buffer_push(tty); | ||
344 | tty_insert_flip_char(tty, data[i], 0); | ||
345 | } | ||
346 | tty_flip_buffer_push(tty); | 343 | tty_flip_buffer_push(tty); |
347 | } else { | 344 | } else { |
348 | dbg("%s: empty read urb received", __FUNCTION__); | 345 | dbg("%s: empty read urb received", __FUNCTION__); |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index f03721056190..9ffff1938239 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -924,16 +924,12 @@ static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
924 | 924 | ||
925 | tty = port->tty; | 925 | tty = port->tty; |
926 | if (tty && urb->actual_length) { | 926 | if (tty && urb->actual_length) { |
927 | tty_buffer_request_room(tty, urb->actual_length + 1); | ||
927 | /* overrun is special, not associated with a char */ | 928 | /* overrun is special, not associated with a char */ |
928 | if (status & UART_OVERRUN_ERROR) | 929 | if (status & UART_OVERRUN_ERROR) |
929 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 930 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); |
930 | 931 | for (i = 0; i < urb->actual_length; ++i) | |
931 | for (i = 0; i < urb->actual_length; ++i) { | ||
932 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
933 | tty_flip_buffer_push(tty); | ||
934 | } | ||
935 | tty_insert_flip_char (tty, data[i], tty_flag); | 932 | tty_insert_flip_char (tty, data[i], tty_flag); |
936 | } | ||
937 | tty_flip_buffer_push (tty); | 933 | tty_flip_buffer_push (tty); |
938 | } | 934 | } |
939 | 935 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index abb830cb77bd..c18db3257073 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -1280,24 +1280,18 @@ static void ti_recv(struct device *dev, struct tty_struct *tty, | |||
1280 | int cnt; | 1280 | int cnt; |
1281 | 1281 | ||
1282 | do { | 1282 | do { |
1283 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1283 | cnt = tty_buffer_request_room(tty, length); |
1284 | tty_flip_buffer_push(tty); | 1284 | if (cnt < length) { |
1285 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) { | 1285 | dev_err(dev, "%s - dropping data, %d bytes lost\n", __FUNCTION__, length - cnt); |
1286 | dev_err(dev, "%s - dropping data, %d bytes lost\n", __FUNCTION__, length); | 1286 | if(cnt == 0) |
1287 | return; | 1287 | break; |
1288 | } | ||
1289 | } | 1288 | } |
1290 | cnt = min(length, TTY_FLIPBUF_SIZE - tty->flip.count); | 1289 | tty_insert_flip_string(tty, data, cnt); |
1291 | memcpy(tty->flip.char_buf_ptr, data, cnt); | 1290 | tty_flip_buffer_push(tty); |
1292 | memset(tty->flip.flag_buf_ptr, 0, cnt); | ||
1293 | tty->flip.char_buf_ptr += cnt; | ||
1294 | tty->flip.flag_buf_ptr += cnt; | ||
1295 | tty->flip.count += cnt; | ||
1296 | data += cnt; | 1291 | data += cnt; |
1297 | length -= cnt; | 1292 | length -= cnt; |
1298 | } while (length > 0); | 1293 | } while (length > 0); |
1299 | 1294 | ||
1300 | tty_flip_buffer_push(tty); | ||
1301 | } | 1295 | } |
1302 | 1296 | ||
1303 | 1297 | ||
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 49b1fbe61f25..bce3d55affd8 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -488,7 +488,6 @@ static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
488 | unsigned char *data = urb->transfer_buffer; | 488 | unsigned char *data = urb->transfer_buffer; |
489 | struct tty_struct *tty; | 489 | struct tty_struct *tty; |
490 | unsigned long flags; | 490 | unsigned long flags; |
491 | int i; | ||
492 | int throttled; | 491 | int throttled; |
493 | int result; | 492 | int result; |
494 | 493 | ||
@@ -503,14 +502,8 @@ static void visor_read_bulk_callback (struct urb *urb, struct pt_regs *regs) | |||
503 | 502 | ||
504 | tty = port->tty; | 503 | tty = port->tty; |
505 | if (tty && urb->actual_length) { | 504 | if (tty && urb->actual_length) { |
506 | for (i = 0; i < urb->actual_length ; ++i) { | 505 | tty_buffer_request_room(tty, urb->actual_length); |
507 | /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ | 506 | tty_insert_flip_string(tty, data, urb->actual_length); |
508 | if(tty->flip.count >= TTY_FLIPBUF_SIZE) { | ||
509 | tty_flip_buffer_push(tty); | ||
510 | } | ||
511 | /* this doesn't actually push the data through unless tty->low_latency is set */ | ||
512 | tty_insert_flip_char(tty, data[i], 0); | ||
513 | } | ||
514 | tty_flip_buffer_push(tty); | 507 | tty_flip_buffer_push(tty); |
515 | } | 508 | } |
516 | spin_lock_irqsave(&priv->lock, flags); | 509 | spin_lock_irqsave(&priv->lock, flags); |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index a7c3c4734d83..557411c6e7c7 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -1434,7 +1434,9 @@ static void rx_data_softint(void *private) | |||
1434 | urb = wrap->urb; | 1434 | urb = wrap->urb; |
1435 | 1435 | ||
1436 | if (tty && urb->actual_length) { | 1436 | if (tty && urb->actual_length) { |
1437 | if (urb->actual_length > TTY_FLIPBUF_SIZE - tty->flip.count) { | 1437 | int len = tty_buffer_request_room(tty, urb->actual_length); |
1438 | /* This stuff can go away now I suspect */ | ||
1439 | if (unlikely(len < urb->actual_length)) { | ||
1438 | spin_lock_irqsave(&info->lock, flags); | 1440 | spin_lock_irqsave(&info->lock, flags); |
1439 | list_add(tmp, &info->rx_urb_q); | 1441 | list_add(tmp, &info->rx_urb_q); |
1440 | spin_unlock_irqrestore(&info->lock, flags); | 1442 | spin_unlock_irqrestore(&info->lock, flags); |
@@ -1442,11 +1444,8 @@ static void rx_data_softint(void *private) | |||
1442 | schedule_work(&info->rx_work); | 1444 | schedule_work(&info->rx_work); |
1443 | return; | 1445 | return; |
1444 | } | 1446 | } |
1445 | 1447 | tty_insert_flip_string(tty, urb->transfer_buffer, len); | |
1446 | memcpy(tty->flip.char_buf_ptr, urb->transfer_buffer, urb->actual_length); | 1448 | sent += len; |
1447 | tty->flip.char_buf_ptr += urb->actual_length; | ||
1448 | tty->flip.count += urb->actual_length; | ||
1449 | sent += urb->actual_length; | ||
1450 | } | 1449 | } |
1451 | 1450 | ||
1452 | urb->dev = port->serial->dev; | 1451 | urb->dev = port->serial->dev; |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 3f04427c9026..3e153d313bb0 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -993,12 +993,6 @@ config FB_ATY_GENERIC_LCD | |||
993 | Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility, | 993 | Say Y if you have a laptop with an ATI Rage LT PRO, Rage Mobility, |
994 | Rage XC, or Rage XL chipset. | 994 | Rage XC, or Rage XL chipset. |
995 | 995 | ||
996 | config FB_ATY_XL_INIT | ||
997 | bool "Rage XL No-BIOS Init support" | ||
998 | depends on FB_ATY_CT | ||
999 | help | ||
1000 | Say Y here to support booting a Rage XL without BIOS support. | ||
1001 | |||
1002 | config FB_ATY_GX | 996 | config FB_ATY_GX |
1003 | bool "Mach64 GX support" if PCI | 997 | bool "Mach64 GX support" if PCI |
1004 | depends on FB_ATY | 998 | depends on FB_ATY |
@@ -1376,7 +1370,7 @@ config FB_PXA | |||
1376 | 1370 | ||
1377 | This driver is also available as a module ( = code which can be | 1371 | This driver is also available as a module ( = code which can be |
1378 | inserted and removed from the running kernel whenever you want). The | 1372 | inserted and removed from the running kernel whenever you want). The |
1379 | module will be called vfb. If you want to compile it as a module, | 1373 | module will be called pxafb. If you want to compile it as a module, |
1380 | say M here and read <file:Documentation/modules.txt>. | 1374 | say M here and read <file:Documentation/modules.txt>. |
1381 | 1375 | ||
1382 | If unsure, say N. | 1376 | If unsure, say N. |
@@ -1409,7 +1403,7 @@ config FB_W100 | |||
1409 | 1403 | ||
1410 | This driver is also available as a module ( = code which can be | 1404 | This driver is also available as a module ( = code which can be |
1411 | inserted and removed from the running kernel whenever you want). The | 1405 | inserted and removed from the running kernel whenever you want). The |
1412 | module will be called vfb. If you want to compile it as a module, | 1406 | module will be called w100fb. If you want to compile it as a module, |
1413 | say M here and read <file:Documentation/modules.txt>. | 1407 | say M here and read <file:Documentation/modules.txt>. |
1414 | 1408 | ||
1415 | If unsure, say N. | 1409 | If unsure, say N. |
diff --git a/drivers/video/arcfb.c b/drivers/video/arcfb.c index 2784f0a9d693..89060b2db8e5 100644 --- a/drivers/video/arcfb.c +++ b/drivers/video/arcfb.c | |||
@@ -366,7 +366,8 @@ static void arcfb_lcd_update(struct arcfb_par *par, unsigned int dx, | |||
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | void arcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 369 | static void arcfb_fillrect(struct fb_info *info, |
370 | const struct fb_fillrect *rect) | ||
370 | { | 371 | { |
371 | struct arcfb_par *par = info->par; | 372 | struct arcfb_par *par = info->par; |
372 | 373 | ||
@@ -376,7 +377,8 @@ void arcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
376 | arcfb_lcd_update(par, rect->dx, rect->dy, rect->width, rect->height); | 377 | arcfb_lcd_update(par, rect->dx, rect->dy, rect->width, rect->height); |
377 | } | 378 | } |
378 | 379 | ||
379 | void arcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 380 | static void arcfb_copyarea(struct fb_info *info, |
381 | const struct fb_copyarea *area) | ||
380 | { | 382 | { |
381 | struct arcfb_par *par = info->par; | 383 | struct arcfb_par *par = info->par; |
382 | 384 | ||
@@ -386,7 +388,7 @@ void arcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
386 | arcfb_lcd_update(par, area->dx, area->dy, area->width, area->height); | 388 | arcfb_lcd_update(par, area->dx, area->dy, area->width, area->height); |
387 | } | 389 | } |
388 | 390 | ||
389 | void arcfb_imageblit(struct fb_info *info, const struct fb_image *image) | 391 | static void arcfb_imageblit(struct fb_info *info, const struct fb_image *image) |
390 | { | 392 | { |
391 | struct arcfb_par *par = info->par; | 393 | struct arcfb_par *par = info->par; |
392 | 394 | ||
diff --git a/drivers/video/asiliantfb.c b/drivers/video/asiliantfb.c index c64de59398f4..69f75547865d 100644 --- a/drivers/video/asiliantfb.c +++ b/drivers/video/asiliantfb.c | |||
@@ -549,7 +549,7 @@ asiliantfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) | |||
549 | if (!request_mem_region(addr, size, "asiliantfb")) | 549 | if (!request_mem_region(addr, size, "asiliantfb")) |
550 | return -EBUSY; | 550 | return -EBUSY; |
551 | 551 | ||
552 | p = framebuffer_alloc(sizeof(u32) * 256, &dp->dev); | 552 | p = framebuffer_alloc(sizeof(u32) * 16, &dp->dev); |
553 | if (!p) { | 553 | if (!p) { |
554 | release_mem_region(addr, size); | 554 | release_mem_region(addr, size); |
555 | return -ENOMEM; | 555 | return -ENOMEM; |
diff --git a/drivers/video/aty/Makefile b/drivers/video/aty/Makefile index 9dec96249ffb..18521397a6e3 100644 --- a/drivers/video/aty/Makefile +++ b/drivers/video/aty/Makefile | |||
@@ -5,7 +5,6 @@ obj-$(CONFIG_FB_RADEON) += radeonfb.o | |||
5 | atyfb-y := atyfb_base.o mach64_accel.o mach64_cursor.o | 5 | atyfb-y := atyfb_base.o mach64_accel.o mach64_cursor.o |
6 | atyfb-$(CONFIG_FB_ATY_GX) += mach64_gx.o | 6 | atyfb-$(CONFIG_FB_ATY_GX) += mach64_gx.o |
7 | atyfb-$(CONFIG_FB_ATY_CT) += mach64_ct.o | 7 | atyfb-$(CONFIG_FB_ATY_CT) += mach64_ct.o |
8 | atyfb-$(CONFIG_FB_ATY_XL_INIT) += xlinit.o | ||
9 | 8 | ||
10 | atyfb-objs := $(atyfb-y) | 9 | atyfb-objs := $(atyfb-y) |
11 | 10 | ||
diff --git a/drivers/video/aty/atyfb.h b/drivers/video/aty/atyfb.h index 09de173c1164..e9b7a64c1ac4 100644 --- a/drivers/video/aty/atyfb.h +++ b/drivers/video/aty/atyfb.h | |||
@@ -50,6 +50,7 @@ struct pll_info { | |||
50 | int sclk, mclk, mclk_pm, xclk; | 50 | int sclk, mclk, mclk_pm, xclk; |
51 | int ref_div; | 51 | int ref_div; |
52 | int ref_clk; | 52 | int ref_clk; |
53 | int ecp_max; | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | typedef struct { | 56 | typedef struct { |
@@ -354,6 +355,5 @@ static inline void wait_for_idle(struct atyfb_par *par) | |||
354 | 355 | ||
355 | extern void aty_reset_engine(const struct atyfb_par *par); | 356 | extern void aty_reset_engine(const struct atyfb_par *par); |
356 | extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); | 357 | extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); |
357 | extern int atyfb_xl_init(struct fb_info *info); | ||
358 | extern void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par); | 358 | extern void aty_st_pll_ct(int offset, u8 val, const struct atyfb_par *par); |
359 | extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); | 359 | extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index 3fefdb0cbf07..e370125e4fbc 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -109,9 +109,18 @@ | |||
109 | #define GUI_RESERVE (1 * PAGE_SIZE) | 109 | #define GUI_RESERVE (1 * PAGE_SIZE) |
110 | 110 | ||
111 | /* FIXME: remove the FAIL definition */ | 111 | /* FIXME: remove the FAIL definition */ |
112 | #define FAIL(msg) do { printk(KERN_CRIT "atyfb: " msg "\n"); return -EINVAL; } while (0) | 112 | #define FAIL(msg) do { \ |
113 | #define FAIL_MAX(msg, x, _max_) do { if(x > _max_) { printk(KERN_CRIT "atyfb: " msg " %x(%x)\n", x, _max_); return -EINVAL; } } while (0) | 113 | if (!(var->activate & FB_ACTIVATE_TEST)) \ |
114 | 114 | printk(KERN_CRIT "atyfb: " msg "\n"); \ | |
115 | return -EINVAL; \ | ||
116 | } while (0) | ||
117 | #define FAIL_MAX(msg, x, _max_) do { \ | ||
118 | if (x > _max_) { \ | ||
119 | if (!(var->activate & FB_ACTIVATE_TEST)) \ | ||
120 | printk(KERN_CRIT "atyfb: " msg " %x(%x)\n", x, _max_); \ | ||
121 | return -EINVAL; \ | ||
122 | } \ | ||
123 | } while (0) | ||
115 | #ifdef DEBUG | 124 | #ifdef DEBUG |
116 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "atyfb: " fmt, ## args) | 125 | #define DPRINTK(fmt, args...) printk(KERN_DEBUG "atyfb: " fmt, ## args) |
117 | #else | 126 | #else |
@@ -340,6 +349,7 @@ static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, }; | |||
340 | #define ATI_CHIP_264VT3 (M64F_VT | M64F_INTEGRATED | M64F_VT_BUS | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL) | 349 | #define ATI_CHIP_264VT3 (M64F_VT | M64F_INTEGRATED | M64F_VT_BUS | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL) |
341 | #define ATI_CHIP_264VT4 (M64F_VT | M64F_INTEGRATED | M64F_GTB_DSP) | 350 | #define ATI_CHIP_264VT4 (M64F_VT | M64F_INTEGRATED | M64F_GTB_DSP) |
342 | 351 | ||
352 | /* FIXME what is this chip? */ | ||
343 | #define ATI_CHIP_264LT (M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP) | 353 | #define ATI_CHIP_264LT (M64F_GT | M64F_INTEGRATED | M64F_GTB_DSP) |
344 | 354 | ||
345 | /* make sets shorter */ | 355 | /* make sets shorter */ |
@@ -359,58 +369,60 @@ static unsigned long phys_guiregbase[FB_MAX] __initdata = { 0, }; | |||
359 | static struct { | 369 | static struct { |
360 | u16 pci_id; | 370 | u16 pci_id; |
361 | const char *name; | 371 | const char *name; |
362 | int pll, mclk, xclk; | 372 | int pll, mclk, xclk, ecp_max; |
363 | u32 features; | 373 | u32 features; |
364 | } aty_chips[] __devinitdata = { | 374 | } aty_chips[] __devinitdata = { |
365 | #ifdef CONFIG_FB_ATY_GX | 375 | #ifdef CONFIG_FB_ATY_GX |
366 | /* Mach64 GX */ | 376 | /* Mach64 GX */ |
367 | { PCI_CHIP_MACH64GX, "ATI888GX00 (Mach64 GX)", 135, 50, 50, ATI_CHIP_88800GX }, | 377 | { PCI_CHIP_MACH64GX, "ATI888GX00 (Mach64 GX)", 135, 50, 50, 0, ATI_CHIP_88800GX }, |
368 | { PCI_CHIP_MACH64CX, "ATI888CX00 (Mach64 CX)", 135, 50, 50, ATI_CHIP_88800CX }, | 378 | { PCI_CHIP_MACH64CX, "ATI888CX00 (Mach64 CX)", 135, 50, 50, 0, ATI_CHIP_88800CX }, |
369 | #endif /* CONFIG_FB_ATY_GX */ | 379 | #endif /* CONFIG_FB_ATY_GX */ |
370 | 380 | ||
371 | #ifdef CONFIG_FB_ATY_CT | 381 | #ifdef CONFIG_FB_ATY_CT |
372 | { PCI_CHIP_MACH64CT, "ATI264CT (Mach64 CT)", 135, 60, 60, ATI_CHIP_264CT }, | 382 | { PCI_CHIP_MACH64CT, "ATI264CT (Mach64 CT)", 135, 60, 60, 0, ATI_CHIP_264CT }, |
373 | { PCI_CHIP_MACH64ET, "ATI264ET (Mach64 ET)", 135, 60, 60, ATI_CHIP_264ET }, | 383 | { PCI_CHIP_MACH64ET, "ATI264ET (Mach64 ET)", 135, 60, 60, 0, ATI_CHIP_264ET }, |
374 | { PCI_CHIP_MACH64VT, "ATI264VT? (Mach64 VT)", 170, 67, 67, ATI_CHIP_264VT }, | 384 | |
375 | { PCI_CHIP_MACH64GT, "3D RAGE (Mach64 GT)", 135, 63, 63, ATI_CHIP_264GT }, | 385 | /* FIXME what is this chip? */ |
376 | /* FIXME { ...ATI_264GU, maybe ATI_CHIP_264GTDVD }, */ | 386 | { PCI_CHIP_MACH64LT, "ATI264LT (Mach64 LT)", 135, 63, 63, 0, ATI_CHIP_264LT }, |
377 | { PCI_CHIP_MACH64GU, "3D RAGE II+ (Mach64 GTB)", 200, 67, 67, ATI_CHIP_264GTB }, | 387 | |
378 | { PCI_CHIP_MACH64VU, "ATI264VTB (Mach64 VU)", 200, 67, 67, ATI_CHIP_264VT3 }, | 388 | { PCI_CHIP_MACH64VT, "ATI264VT (Mach64 VT)", 170, 67, 67, 80, ATI_CHIP_264VT }, |
379 | 389 | { PCI_CHIP_MACH64GT, "3D RAGE (Mach64 GT)", 135, 63, 63, 80, ATI_CHIP_264GT }, | |
380 | { PCI_CHIP_MACH64LT, "3D RAGE LT (Mach64 LT)", 135, 63, 63, ATI_CHIP_264LT }, | 390 | |
381 | /* FIXME chipset maybe ATI_CHIP_264LTPRO ? */ | 391 | { PCI_CHIP_MACH64VU, "ATI264VT3 (Mach64 VU)", 200, 67, 67, 80, ATI_CHIP_264VT3 }, |
382 | { PCI_CHIP_MACH64LG, "3D RAGE LT-G (Mach64 LG)", 230, 63, 63, ATI_CHIP_264LTG | M64F_LT_LCD_REGS | M64F_G3_PB_1024x768 }, | 392 | { PCI_CHIP_MACH64GU, "3D RAGE II+ (Mach64 GU)", 200, 67, 67, 100, ATI_CHIP_264GTB }, |
383 | 393 | ||
384 | { PCI_CHIP_MACH64VV, "ATI264VT4 (Mach64 VV)", 230, 83, 83, ATI_CHIP_264VT4 }, | 394 | { PCI_CHIP_MACH64LG, "3D RAGE LT (Mach64 LG)", 230, 63, 63, 100, ATI_CHIP_264LTG | M64F_LT_LCD_REGS | M64F_G3_PB_1024x768 }, |
385 | 395 | ||
386 | { PCI_CHIP_MACH64GV, "3D RAGE IIC (Mach64 GV, PCI)", 230, 83, 83, ATI_CHIP_264GT2C }, | 396 | { PCI_CHIP_MACH64VV, "ATI264VT4 (Mach64 VV)", 230, 83, 83, 100, ATI_CHIP_264VT4 }, |
387 | { PCI_CHIP_MACH64GW, "3D RAGE IIC (Mach64 GW, AGP)", 230, 83, 83, ATI_CHIP_264GT2C }, | 397 | |
388 | { PCI_CHIP_MACH64GY, "3D RAGE IIC (Mach64 GY, PCI)", 230, 83, 83, ATI_CHIP_264GT2C }, | 398 | { PCI_CHIP_MACH64GV, "3D RAGE IIC (Mach64 GV, PCI)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, |
389 | { PCI_CHIP_MACH64GZ, "3D RAGE IIC (Mach64 GZ, AGP)", 230, 83, 83, ATI_CHIP_264GT2C }, | 399 | { PCI_CHIP_MACH64GW, "3D RAGE IIC (Mach64 GW, AGP)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, |
390 | 400 | { PCI_CHIP_MACH64GY, "3D RAGE IIC (Mach64 GY, PCI)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, | |
391 | { PCI_CHIP_MACH64GB, "3D RAGE PRO (Mach64 GB, BGA, AGP)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 401 | { PCI_CHIP_MACH64GZ, "3D RAGE IIC (Mach64 GZ, AGP)", 230, 83, 83, 100, ATI_CHIP_264GT2C }, |
392 | { PCI_CHIP_MACH64GD, "3D RAGE PRO (Mach64 GD, BGA, AGP 1x)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 402 | |
393 | { PCI_CHIP_MACH64GI, "3D RAGE PRO (Mach64 GI, BGA, PCI)", 230, 100, 100, ATI_CHIP_264GTPRO | M64F_MAGIC_VRAM_SIZE }, | 403 | { PCI_CHIP_MACH64GB, "3D RAGE PRO (Mach64 GB, BGA, AGP)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, |
394 | { PCI_CHIP_MACH64GP, "3D RAGE PRO (Mach64 GP, PQFP, PCI)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 404 | { PCI_CHIP_MACH64GD, "3D RAGE PRO (Mach64 GD, BGA, AGP 1x)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, |
395 | { PCI_CHIP_MACH64GQ, "3D RAGE PRO (Mach64 GQ, PQFP, PCI, limited 3D)", 230, 100, 100, ATI_CHIP_264GTPRO }, | 405 | { PCI_CHIP_MACH64GI, "3D RAGE PRO (Mach64 GI, BGA, PCI)", 230, 100, 100, 125, ATI_CHIP_264GTPRO | M64F_MAGIC_VRAM_SIZE }, |
396 | 406 | { PCI_CHIP_MACH64GP, "3D RAGE PRO (Mach64 GP, PQFP, PCI)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, | |
397 | { PCI_CHIP_MACH64LB, "3D RAGE LT PRO (Mach64 LB, AGP)", 236, 75, 100, ATI_CHIP_264LTPRO }, | 407 | { PCI_CHIP_MACH64GQ, "3D RAGE PRO (Mach64 GQ, PQFP, PCI, limited 3D)", 230, 100, 100, 125, ATI_CHIP_264GTPRO }, |
398 | { PCI_CHIP_MACH64LD, "3D RAGE LT PRO (Mach64 LD, AGP)", 230, 100, 100, ATI_CHIP_264LTPRO }, | 408 | |
399 | { PCI_CHIP_MACH64LI, "3D RAGE LT PRO (Mach64 LI, PCI)", 230, 100, 100, ATI_CHIP_264LTPRO | M64F_G3_PB_1_1 | M64F_G3_PB_1024x768 }, | 409 | { PCI_CHIP_MACH64LB, "3D RAGE LT PRO (Mach64 LB, AGP)", 236, 75, 100, 135, ATI_CHIP_264LTPRO }, |
400 | { PCI_CHIP_MACH64LP, "3D RAGE LT PRO (Mach64 LP, PCI)", 230, 100, 100, ATI_CHIP_264LTPRO }, | 410 | { PCI_CHIP_MACH64LD, "3D RAGE LT PRO (Mach64 LD, AGP)", 230, 100, 100, 135, ATI_CHIP_264LTPRO }, |
401 | { PCI_CHIP_MACH64LQ, "3D RAGE LT PRO (Mach64 LQ, PCI)", 230, 100, 100, ATI_CHIP_264LTPRO }, | 411 | { PCI_CHIP_MACH64LI, "3D RAGE LT PRO (Mach64 LI, PCI)", 230, 100, 100, 135, ATI_CHIP_264LTPRO | M64F_G3_PB_1_1 | M64F_G3_PB_1024x768 }, |
402 | 412 | { PCI_CHIP_MACH64LP, "3D RAGE LT PRO (Mach64 LP, PCI)", 230, 100, 100, 135, ATI_CHIP_264LTPRO }, | |
403 | { PCI_CHIP_MACH64GM, "3D RAGE XL (Mach64 GM, AGP)", 230, 83, 63, ATI_CHIP_264XL }, | 413 | { PCI_CHIP_MACH64LQ, "3D RAGE LT PRO (Mach64 LQ, PCI)", 230, 100, 100, 135, ATI_CHIP_264LTPRO }, |
404 | { PCI_CHIP_MACH64GN, "3D RAGE XL (Mach64 GN, AGP)", 230, 83, 63, ATI_CHIP_264XL }, | 414 | |
405 | { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66/BGA)", 230, 83, 63, ATI_CHIP_264XL }, | 415 | { PCI_CHIP_MACH64GM, "3D RAGE XL (Mach64 GM, AGP 2x)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
406 | { PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33MHz)", 235, 83, 63, ATI_CHIP_264XL | M64F_SDRAM_MAGIC_PLL }, | 416 | { PCI_CHIP_MACH64GN, "3D RAGE XC (Mach64 GN, AGP 2x)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
407 | { PCI_CHIP_MACH64GL, "3D RAGE XL (Mach64 GL, PCI)", 230, 83, 63, ATI_CHIP_264XL }, | 417 | { PCI_CHIP_MACH64GO, "3D RAGE XL (Mach64 GO, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
408 | { PCI_CHIP_MACH64GS, "3D RAGE XL (Mach64 GS, PCI)", 230, 83, 63, ATI_CHIP_264XL }, | 418 | { PCI_CHIP_MACH64GL, "3D RAGE XC (Mach64 GL, PCI-66)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
409 | 419 | { PCI_CHIP_MACH64GR, "3D RAGE XL (Mach64 GR, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL | M64F_SDRAM_MAGIC_PLL }, | |
410 | { PCI_CHIP_MACH64LM, "3D RAGE Mobility P/M (Mach64 LM, AGP 2x)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 420 | { PCI_CHIP_MACH64GS, "3D RAGE XC (Mach64 GS, PCI-33)", 230, 83, 63, 135, ATI_CHIP_264XL }, |
411 | { PCI_CHIP_MACH64LN, "3D RAGE Mobility L (Mach64 LN, AGP 2x)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 421 | |
412 | { PCI_CHIP_MACH64LR, "3D RAGE Mobility P/M (Mach64 LR, PCI)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 422 | { PCI_CHIP_MACH64LM, "3D RAGE Mobility P/M (Mach64 LM, AGP 2x)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, |
413 | { PCI_CHIP_MACH64LS, "3D RAGE Mobility L (Mach64 LS, PCI)", 230, 83, 125, ATI_CHIP_MOBILITY }, | 423 | { PCI_CHIP_MACH64LN, "3D RAGE Mobility L (Mach64 LN, AGP 2x)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, |
424 | { PCI_CHIP_MACH64LR, "3D RAGE Mobility P/M (Mach64 LR, PCI)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, | ||
425 | { PCI_CHIP_MACH64LS, "3D RAGE Mobility L (Mach64 LS, PCI)", 230, 83, 125, 135, ATI_CHIP_MOBILITY }, | ||
414 | #endif /* CONFIG_FB_ATY_CT */ | 426 | #endif /* CONFIG_FB_ATY_CT */ |
415 | }; | 427 | }; |
416 | 428 | ||
@@ -431,6 +443,7 @@ static int __devinit correct_chipset(struct atyfb_par *par) | |||
431 | par->pll_limits.pll_max = aty_chips[i].pll; | 443 | par->pll_limits.pll_max = aty_chips[i].pll; |
432 | par->pll_limits.mclk = aty_chips[i].mclk; | 444 | par->pll_limits.mclk = aty_chips[i].mclk; |
433 | par->pll_limits.xclk = aty_chips[i].xclk; | 445 | par->pll_limits.xclk = aty_chips[i].xclk; |
446 | par->pll_limits.ecp_max = aty_chips[i].ecp_max; | ||
434 | par->features = aty_chips[i].features; | 447 | par->features = aty_chips[i].features; |
435 | 448 | ||
436 | chip_id = aty_ld_le32(CONFIG_CHIP_ID, par); | 449 | chip_id = aty_ld_le32(CONFIG_CHIP_ID, par); |
@@ -450,39 +463,63 @@ static int __devinit correct_chipset(struct atyfb_par *par) | |||
450 | #endif | 463 | #endif |
451 | #ifdef CONFIG_FB_ATY_CT | 464 | #ifdef CONFIG_FB_ATY_CT |
452 | case PCI_CHIP_MACH64VT: | 465 | case PCI_CHIP_MACH64VT: |
453 | rev &= 0xc7; | 466 | switch (rev & 0x07) { |
454 | if(rev == 0x00) { | 467 | case 0x00: |
455 | name = "ATI264VTA3 (Mach64 VT)"; | 468 | switch (rev & 0xc0) { |
456 | par->pll_limits.pll_max = 170; | 469 | case 0x00: |
457 | par->pll_limits.mclk = 67; | 470 | name = "ATI264VT (A3) (Mach64 VT)"; |
458 | par->pll_limits.xclk = 67; | 471 | par->pll_limits.pll_max = 170; |
459 | par->features = ATI_CHIP_264VT; | 472 | par->pll_limits.mclk = 67; |
460 | } else if(rev == 0x40) { | 473 | par->pll_limits.xclk = 67; |
461 | name = "ATI264VTA4 (Mach64 VT)"; | 474 | par->pll_limits.ecp_max = 80; |
475 | par->features = ATI_CHIP_264VT; | ||
476 | break; | ||
477 | case 0x40: | ||
478 | name = "ATI264VT2 (A4) (Mach64 VT)"; | ||
479 | par->pll_limits.pll_max = 200; | ||
480 | par->pll_limits.mclk = 67; | ||
481 | par->pll_limits.xclk = 67; | ||
482 | par->pll_limits.ecp_max = 80; | ||
483 | par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; | ||
484 | break; | ||
485 | } | ||
486 | break; | ||
487 | case 0x01: | ||
488 | name = "ATI264VT3 (B1) (Mach64 VT)"; | ||
462 | par->pll_limits.pll_max = 200; | 489 | par->pll_limits.pll_max = 200; |
463 | par->pll_limits.mclk = 67; | 490 | par->pll_limits.mclk = 67; |
464 | par->pll_limits.xclk = 67; | 491 | par->pll_limits.xclk = 67; |
465 | par->features = ATI_CHIP_264VT | M64F_MAGIC_POSTDIV; | 492 | par->pll_limits.ecp_max = 80; |
466 | } else { | 493 | par->features = ATI_CHIP_264VTB; |
467 | name = "ATI264VTB (Mach64 VT)"; | 494 | break; |
495 | case 0x02: | ||
496 | name = "ATI264VT3 (B2) (Mach64 VT)"; | ||
468 | par->pll_limits.pll_max = 200; | 497 | par->pll_limits.pll_max = 200; |
469 | par->pll_limits.mclk = 67; | 498 | par->pll_limits.mclk = 67; |
470 | par->pll_limits.xclk = 67; | 499 | par->pll_limits.xclk = 67; |
471 | par->features = ATI_CHIP_264VTB; | 500 | par->pll_limits.ecp_max = 80; |
501 | par->features = ATI_CHIP_264VT3; | ||
502 | break; | ||
472 | } | 503 | } |
473 | break; | 504 | break; |
474 | case PCI_CHIP_MACH64GT: | 505 | case PCI_CHIP_MACH64GT: |
475 | rev &= 0x07; | 506 | switch (rev & 0x07) { |
476 | if(rev == 0x01) { | 507 | case 0x01: |
508 | name = "3D RAGE II (Mach64 GT)"; | ||
477 | par->pll_limits.pll_max = 170; | 509 | par->pll_limits.pll_max = 170; |
478 | par->pll_limits.mclk = 67; | 510 | par->pll_limits.mclk = 67; |
479 | par->pll_limits.xclk = 67; | 511 | par->pll_limits.xclk = 67; |
512 | par->pll_limits.ecp_max = 80; | ||
480 | par->features = ATI_CHIP_264GTB; | 513 | par->features = ATI_CHIP_264GTB; |
481 | } else if(rev == 0x02) { | 514 | break; |
515 | case 0x02: | ||
516 | name = "3D RAGE II+ (Mach64 GT)"; | ||
482 | par->pll_limits.pll_max = 200; | 517 | par->pll_limits.pll_max = 200; |
483 | par->pll_limits.mclk = 67; | 518 | par->pll_limits.mclk = 67; |
484 | par->pll_limits.xclk = 67; | 519 | par->pll_limits.xclk = 67; |
520 | par->pll_limits.ecp_max = 100; | ||
485 | par->features = ATI_CHIP_264GTB; | 521 | par->features = ATI_CHIP_264GTB; |
522 | break; | ||
486 | } | 523 | } |
487 | break; | 524 | break; |
488 | #endif | 525 | #endif |
@@ -692,7 +729,7 @@ static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc) | |||
692 | aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | | 729 | aty_st_lcd(LCD_GEN_CNTL, (crtc->lcd_gen_cntl & ~CRTC_RW_SELECT) | |
693 | (SHADOW_EN | SHADOW_RW_EN), par); | 730 | (SHADOW_EN | SHADOW_RW_EN), par); |
694 | 731 | ||
695 | DPRINTK("set secondary CRT to %ix%i %c%c\n", | 732 | DPRINTK("set shadow CRT to %ix%i %c%c\n", |
696 | ((((crtc->shadow_h_tot_disp>>16) & 0xff) + 1)<<3), (((crtc->shadow_v_tot_disp>>16) & 0x7ff) + 1), | 733 | ((((crtc->shadow_h_tot_disp>>16) & 0xff) + 1)<<3), (((crtc->shadow_v_tot_disp>>16) & 0x7ff) + 1), |
697 | (crtc->shadow_h_sync_strt_wid & 0x200000)?'N':'P', (crtc->shadow_v_sync_strt_wid & 0x200000)?'N':'P'); | 734 | (crtc->shadow_h_sync_strt_wid & 0x200000)?'N':'P', (crtc->shadow_v_sync_strt_wid & 0x200000)?'N':'P'); |
698 | 735 | ||
@@ -840,11 +877,14 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
840 | know if one is connected. So it's better to fail then. | 877 | know if one is connected. So it's better to fail then. |
841 | */ | 878 | */ |
842 | if (crtc->lcd_gen_cntl & CRT_ON) { | 879 | if (crtc->lcd_gen_cntl & CRT_ON) { |
843 | PRINTKI("Disable lcd panel, because video mode does not fit.\n"); | 880 | if (!(var->activate & FB_ACTIVATE_TEST)) |
881 | PRINTKI("Disable LCD panel, because video mode does not fit.\n"); | ||
844 | crtc->lcd_gen_cntl &= ~LCD_ON; | 882 | crtc->lcd_gen_cntl &= ~LCD_ON; |
845 | /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ | 883 | /*aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl, par);*/ |
846 | } else { | 884 | } else { |
847 | FAIL("Video mode exceeds size of lcd panel.\nConnect this computer to a conventional monitor if you really need this mode."); | 885 | if (!(var->activate & FB_ACTIVATE_TEST)) |
886 | PRINTKE("Video mode exceeds size of LCD panel.\nConnect this computer to a conventional monitor if you really need this mode.\n"); | ||
887 | return -EINVAL; | ||
848 | } | 888 | } |
849 | } | 889 | } |
850 | } | 890 | } |
@@ -858,9 +898,9 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
858 | vmode &= ~(FB_VMODE_DOUBLE | FB_VMODE_INTERLACED); | 898 | vmode &= ~(FB_VMODE_DOUBLE | FB_VMODE_INTERLACED); |
859 | 899 | ||
860 | /* This is horror! When we simulate, say 640x480 on an 800x600 | 900 | /* This is horror! When we simulate, say 640x480 on an 800x600 |
861 | lcd monitor, the CRTC should be programmed 800x600 values for | 901 | LCD monitor, the CRTC should be programmed 800x600 values for |
862 | the non visible part, but 640x480 for the visible part. | 902 | the non visible part, but 640x480 for the visible part. |
863 | This code has been tested on a laptop with it's 1400x1050 lcd | 903 | This code has been tested on a laptop with it's 1400x1050 LCD |
864 | monitor and a conventional monitor both switched on. | 904 | monitor and a conventional monitor both switched on. |
865 | Tested modes: 1280x1024, 1152x864, 1024x768, 800x600, | 905 | Tested modes: 1280x1024, 1152x864, 1024x768, 800x600, |
866 | works with little glitches also with DOUBLESCAN modes | 906 | works with little glitches also with DOUBLESCAN modes |
@@ -955,16 +995,6 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
955 | vdisplay = yres; | 995 | vdisplay = yres; |
956 | if(vmode & FB_VMODE_DOUBLE) | 996 | if(vmode & FB_VMODE_DOUBLE) |
957 | vdisplay <<= 1; | 997 | vdisplay <<= 1; |
958 | if(vmode & FB_VMODE_INTERLACED) { | ||
959 | vdisplay >>= 1; | ||
960 | |||
961 | /* The prefered mode for the lcd is not interlaced, so disable it if | ||
962 | it was enabled. For doublescan there is no problem, because we can | ||
963 | compensate for it in the hardware stretching (we stretch half as much) | ||
964 | */ | ||
965 | vmode &= ~FB_VMODE_INTERLACED; | ||
966 | /*crtc->gen_cntl &= ~CRTC_INTERLACE_EN;*/ | ||
967 | } | ||
968 | crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); | 998 | crtc->gen_cntl &= ~(CRTC2_EN | CRTC2_PIX_WIDTH); |
969 | crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | | 999 | crtc->lcd_gen_cntl &= ~(HORZ_DIVBY2_EN | DIS_HOR_CRT_DIVBY2 | |
970 | /*TVCLK_PM_EN | VCLK_DAC_PM_EN |*/ | 1000 | /*TVCLK_PM_EN | VCLK_DAC_PM_EN |*/ |
@@ -980,7 +1010,7 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
980 | crtc->horz_stretching &= | 1010 | crtc->horz_stretching &= |
981 | ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | AUTO_HORZ_RATIO | | 1011 | ~(HORZ_STRETCH_RATIO | HORZ_STRETCH_LOOP | AUTO_HORZ_RATIO | |
982 | HORZ_STRETCH_MODE | HORZ_STRETCH_EN); | 1012 | HORZ_STRETCH_MODE | HORZ_STRETCH_EN); |
983 | if (xres < par->lcd_width) { | 1013 | if (xres < par->lcd_width && crtc->lcd_gen_cntl & LCD_ON) { |
984 | do { | 1014 | do { |
985 | /* | 1015 | /* |
986 | * The horizontal blender misbehaves when HDisplay is less than a | 1016 | * The horizontal blender misbehaves when HDisplay is less than a |
@@ -1042,7 +1072,7 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
1042 | } while (0); | 1072 | } while (0); |
1043 | } | 1073 | } |
1044 | 1074 | ||
1045 | if (vdisplay < par->lcd_height) { | 1075 | if (vdisplay < par->lcd_height && crtc->lcd_gen_cntl & LCD_ON) { |
1046 | crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | | 1076 | crtc->vert_stretching = (VERT_STRETCH_USE0 | VERT_STRETCH_EN | |
1047 | (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); | 1077 | (((vdisplay * (VERT_STRETCH_RATIO0 + 1)) / par->lcd_height) & VERT_STRETCH_RATIO0)); |
1048 | 1078 | ||
@@ -1065,9 +1095,8 @@ static int aty_var_to_crtc(const struct fb_info *info, | |||
1065 | #endif /* CONFIG_FB_ATY_GENERIC_LCD */ | 1095 | #endif /* CONFIG_FB_ATY_GENERIC_LCD */ |
1066 | 1096 | ||
1067 | if (M64_HAS(MAGIC_FIFO)) { | 1097 | if (M64_HAS(MAGIC_FIFO)) { |
1068 | /* Not VTB/GTB */ | 1098 | /* FIXME: display FIFO low watermark values */ |
1069 | /* FIXME: magic FIFO values */ | 1099 | crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_FIFO_LWM); |
1070 | crtc->gen_cntl |= (aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC2_PIX_WIDTH); | ||
1071 | } | 1100 | } |
1072 | crtc->dp_pix_width = dp_pix_width; | 1101 | crtc->dp_pix_width = dp_pix_width; |
1073 | crtc->dp_chain_mask = dp_chain_mask; | 1102 | crtc->dp_chain_mask = dp_chain_mask; |
@@ -1184,7 +1213,8 @@ static int aty_crtc_to_var(const struct crtc *crtc, struct fb_var_screeninfo *va | |||
1184 | var->transp.length = 8; | 1213 | var->transp.length = 8; |
1185 | break; | 1214 | break; |
1186 | default: | 1215 | default: |
1187 | FAIL("Invalid pixel width"); | 1216 | PRINTKE("Invalid pixel width\n"); |
1217 | return -EINVAL; | ||
1188 | } | 1218 | } |
1189 | 1219 | ||
1190 | /* output */ | 1220 | /* output */ |
@@ -1241,7 +1271,8 @@ static int atyfb_set_par(struct fb_info *info) | |||
1241 | pixclock = atyfb_get_pixclock(var, par); | 1271 | pixclock = atyfb_get_pixclock(var, par); |
1242 | 1272 | ||
1243 | if (pixclock == 0) { | 1273 | if (pixclock == 0) { |
1244 | FAIL("Invalid pixclock"); | 1274 | PRINTKE("Invalid pixclock\n"); |
1275 | return -EINVAL; | ||
1245 | } else { | 1276 | } else { |
1246 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &par->pll))) | 1277 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &par->pll))) |
1247 | return err; | 1278 | return err; |
@@ -1446,7 +1477,9 @@ static int atyfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1446 | pixclock = atyfb_get_pixclock(var, par); | 1477 | pixclock = atyfb_get_pixclock(var, par); |
1447 | 1478 | ||
1448 | if (pixclock == 0) { | 1479 | if (pixclock == 0) { |
1449 | FAIL("Invalid pixclock"); | 1480 | if (!(var->activate & FB_ACTIVATE_TEST)) |
1481 | PRINTKE("Invalid pixclock\n"); | ||
1482 | return -EINVAL; | ||
1450 | } else { | 1483 | } else { |
1451 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &pll))) | 1484 | if((err = par->pll_ops->var_to_pll(info, pixclock, var->bits_per_pixel, &pll))) |
1452 | return err; | 1485 | return err; |
@@ -2291,10 +2324,6 @@ static int __init aty_init(struct fb_info *info, const char *name) | |||
2291 | par->dac_ops = &aty_dac_ct; | 2324 | par->dac_ops = &aty_dac_ct; |
2292 | par->pll_ops = &aty_pll_ct; | 2325 | par->pll_ops = &aty_pll_ct; |
2293 | par->bus_type = PCI; | 2326 | par->bus_type = PCI; |
2294 | #ifdef CONFIG_FB_ATY_XL_INIT | ||
2295 | if (IS_XL(par->pci_id)) | ||
2296 | atyfb_xl_init(info); | ||
2297 | #endif | ||
2298 | par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07); | 2327 | par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07); |
2299 | ramname = aty_ct_ram[par->ram_type]; | 2328 | ramname = aty_ct_ram[par->ram_type]; |
2300 | /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */ | 2329 | /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */ |
@@ -2638,16 +2667,16 @@ static int __init store_video_par(char *video_str, unsigned char m64_num) | |||
2638 | static int atyfb_blank(int blank, struct fb_info *info) | 2667 | static int atyfb_blank(int blank, struct fb_info *info) |
2639 | { | 2668 | { |
2640 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 2669 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
2641 | u8 gen_cntl; | 2670 | u32 gen_cntl; |
2642 | 2671 | ||
2643 | if (par->lock_blank || par->asleep) | 2672 | if (par->lock_blank || par->asleep) |
2644 | return 0; | 2673 | return 0; |
2645 | 2674 | ||
2646 | #ifdef CONFIG_PMAC_BACKLIGHT | 2675 | #ifdef CONFIG_PMAC_BACKLIGHT |
2647 | if ((_machine == _MACH_Pmac) && blank) | 2676 | if ((_machine == _MACH_Pmac) && blank > FB_BLANK_NORMAL) |
2648 | set_backlight_enable(0); | 2677 | set_backlight_enable(0); |
2649 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2678 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
2650 | if (par->lcd_table && blank && | 2679 | if (par->lcd_table && blank > FB_BLANK_NORMAL && |
2651 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | 2680 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { |
2652 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); | 2681 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); |
2653 | pm &= ~PWR_BLON; | 2682 | pm &= ~PWR_BLON; |
@@ -2655,31 +2684,31 @@ static int atyfb_blank(int blank, struct fb_info *info) | |||
2655 | } | 2684 | } |
2656 | #endif | 2685 | #endif |
2657 | 2686 | ||
2658 | gen_cntl = aty_ld_8(CRTC_GEN_CNTL, par); | 2687 | gen_cntl = aty_ld_le32(CRTC_GEN_CNTL, par); |
2659 | switch (blank) { | 2688 | switch (blank) { |
2660 | case FB_BLANK_UNBLANK: | 2689 | case FB_BLANK_UNBLANK: |
2661 | gen_cntl &= ~(0x4c); | 2690 | gen_cntl &= ~0x400004c; |
2662 | break; | 2691 | break; |
2663 | case FB_BLANK_NORMAL: | 2692 | case FB_BLANK_NORMAL: |
2664 | gen_cntl |= 0x40; | 2693 | gen_cntl |= 0x4000040; |
2665 | break; | 2694 | break; |
2666 | case FB_BLANK_VSYNC_SUSPEND: | 2695 | case FB_BLANK_VSYNC_SUSPEND: |
2667 | gen_cntl |= 0x8; | 2696 | gen_cntl |= 0x4000048; |
2668 | break; | 2697 | break; |
2669 | case FB_BLANK_HSYNC_SUSPEND: | 2698 | case FB_BLANK_HSYNC_SUSPEND: |
2670 | gen_cntl |= 0x4; | 2699 | gen_cntl |= 0x4000044; |
2671 | break; | 2700 | break; |
2672 | case FB_BLANK_POWERDOWN: | 2701 | case FB_BLANK_POWERDOWN: |
2673 | gen_cntl |= 0x4c; | 2702 | gen_cntl |= 0x400004c; |
2674 | break; | 2703 | break; |
2675 | } | 2704 | } |
2676 | aty_st_8(CRTC_GEN_CNTL, gen_cntl, par); | 2705 | aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); |
2677 | 2706 | ||
2678 | #ifdef CONFIG_PMAC_BACKLIGHT | 2707 | #ifdef CONFIG_PMAC_BACKLIGHT |
2679 | if ((_machine == _MACH_Pmac) && !blank) | 2708 | if ((_machine == _MACH_Pmac) && blank <= FB_BLANK_NORMAL) |
2680 | set_backlight_enable(1); | 2709 | set_backlight_enable(1); |
2681 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) | 2710 | #elif defined(CONFIG_FB_ATY_GENERIC_LCD) |
2682 | if (par->lcd_table && !blank && | 2711 | if (par->lcd_table && blank <= FB_BLANK_NORMAL && |
2683 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { | 2712 | (aty_ld_lcd(LCD_GEN_CNTL, par) & LCD_ON)) { |
2684 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); | 2713 | u32 pm = aty_ld_lcd(POWER_MANAGEMENT, par); |
2685 | pm |= PWR_BLON; | 2714 | pm |= PWR_BLON; |
@@ -3157,15 +3186,15 @@ static void aty_init_lcd(struct atyfb_par *par, u32 bios_base) | |||
3157 | refresh_rates_buf, lcd_refresh_rates[default_refresh_rate]); | 3186 | refresh_rates_buf, lcd_refresh_rates[default_refresh_rate]); |
3158 | par->lcd_refreshrate = lcd_refresh_rates[default_refresh_rate]; | 3187 | par->lcd_refreshrate = lcd_refresh_rates[default_refresh_rate]; |
3159 | /* We now need to determine the crtc parameters for the | 3188 | /* We now need to determine the crtc parameters for the |
3160 | * lcd monitor. This is tricky, because they are not stored | 3189 | * LCD monitor. This is tricky, because they are not stored |
3161 | * individually in the BIOS. Instead, the BIOS contains a | 3190 | * individually in the BIOS. Instead, the BIOS contains a |
3162 | * table of display modes that work for this monitor. | 3191 | * table of display modes that work for this monitor. |
3163 | * | 3192 | * |
3164 | * The idea is that we search for a mode of the same dimensions | 3193 | * The idea is that we search for a mode of the same dimensions |
3165 | * as the dimensions of the lcd monitor. Say our lcd monitor | 3194 | * as the dimensions of the LCD monitor. Say our LCD monitor |
3166 | * is 800x600 pixels, we search for a 800x600 monitor. | 3195 | * is 800x600 pixels, we search for a 800x600 monitor. |
3167 | * The CRTC parameters we find here are the ones that we need | 3196 | * The CRTC parameters we find here are the ones that we need |
3168 | * to use to simulate other resolutions on the lcd screen. | 3197 | * to use to simulate other resolutions on the LCD screen. |
3169 | */ | 3198 | */ |
3170 | lcdmodeptr = (u16 *)(par->lcd_table + 64); | 3199 | lcdmodeptr = (u16 *)(par->lcd_table + 64); |
3171 | while (*lcdmodeptr != 0) { | 3200 | while (*lcdmodeptr != 0) { |
@@ -3692,9 +3721,7 @@ static int __init atyfb_init(void) | |||
3692 | atyfb_setup(option); | 3721 | atyfb_setup(option); |
3693 | #endif | 3722 | #endif |
3694 | 3723 | ||
3695 | #ifdef CONFIG_PCI | ||
3696 | pci_register_driver(&atyfb_driver); | 3724 | pci_register_driver(&atyfb_driver); |
3697 | #endif | ||
3698 | #ifdef CONFIG_ATARI | 3725 | #ifdef CONFIG_ATARI |
3699 | atyfb_atari_probe(); | 3726 | atyfb_atari_probe(); |
3700 | #endif | 3727 | #endif |
@@ -3703,9 +3730,7 @@ static int __init atyfb_init(void) | |||
3703 | 3730 | ||
3704 | static void __exit atyfb_exit(void) | 3731 | static void __exit atyfb_exit(void) |
3705 | { | 3732 | { |
3706 | #ifdef CONFIG_PCI | ||
3707 | pci_unregister_driver(&atyfb_driver); | 3733 | pci_unregister_driver(&atyfb_driver); |
3708 | #endif | ||
3709 | } | 3734 | } |
3710 | 3735 | ||
3711 | module_init(atyfb_init); | 3736 | module_init(atyfb_init); |
diff --git a/drivers/video/aty/mach64_ct.c b/drivers/video/aty/mach64_ct.c index 9bdb2aab01aa..e7056934c6a8 100644 --- a/drivers/video/aty/mach64_ct.c +++ b/drivers/video/aty/mach64_ct.c | |||
@@ -206,9 +206,7 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll | |||
206 | { | 206 | { |
207 | u32 q; | 207 | u32 q; |
208 | struct atyfb_par *par = (struct atyfb_par *) info->par; | 208 | struct atyfb_par *par = (struct atyfb_par *) info->par; |
209 | #ifdef DEBUG | ||
210 | int pllvclk; | 209 | int pllvclk; |
211 | #endif | ||
212 | 210 | ||
213 | /* FIXME: use the VTB/GTB /{3,6,12} post dividers if they're better suited */ | 211 | /* FIXME: use the VTB/GTB /{3,6,12} post dividers if they're better suited */ |
214 | q = par->ref_clk_per * pll->pll_ref_div * 4 / vclk_per; | 212 | q = par->ref_clk_per * pll->pll_ref_div * 4 / vclk_per; |
@@ -223,13 +221,26 @@ static int aty_valid_pll_ct(const struct fb_info *info, u32 vclk_per, struct pll | |||
223 | pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; | 221 | pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; |
224 | // pll->vclk_post_div <<= 6; | 222 | // pll->vclk_post_div <<= 6; |
225 | pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; | 223 | pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; |
226 | #ifdef DEBUG | ||
227 | pllvclk = (1000000 * 2 * pll->vclk_fb_div) / | 224 | pllvclk = (1000000 * 2 * pll->vclk_fb_div) / |
228 | (par->ref_clk_per * pll->pll_ref_div); | 225 | (par->ref_clk_per * pll->pll_ref_div); |
226 | #ifdef DEBUG | ||
229 | printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", | 227 | printk("atyfb(%s): pllvclk=%d MHz, vclk=%d MHz\n", |
230 | __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real); | 228 | __FUNCTION__, pllvclk, pllvclk / pll->vclk_post_div_real); |
231 | #endif | 229 | #endif |
232 | pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ | 230 | pll->pll_vclk_cntl = 0x03; /* VCLK = PLL_VCLK/VCLKx_POST */ |
231 | |||
232 | /* Set ECP (scaler/overlay clock) divider */ | ||
233 | if (par->pll_limits.ecp_max) { | ||
234 | int ecp = pllvclk / pll->vclk_post_div_real; | ||
235 | int ecp_div = 0; | ||
236 | |||
237 | while (ecp > par->pll_limits.ecp_max && ecp_div < 2) { | ||
238 | ecp >>= 1; | ||
239 | ecp_div++; | ||
240 | } | ||
241 | pll->pll_vclk_cntl |= ecp_div << 4; | ||
242 | } | ||
243 | |||
233 | return 0; | 244 | return 0; |
234 | } | 245 | } |
235 | 246 | ||
diff --git a/drivers/video/aty/xlinit.c b/drivers/video/aty/xlinit.c deleted file mode 100644 index a085cbf74ecb..000000000000 --- a/drivers/video/aty/xlinit.c +++ /dev/null | |||
@@ -1,359 +0,0 @@ | |||
1 | /* | ||
2 | * ATI Rage XL Initialization. Support for Xpert98 and Victoria | ||
3 | * PCI cards. | ||
4 | * | ||
5 | * Copyright (C) 2002 MontaVista Software Inc. | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * stevel@mvista.com or source@mvista.com | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms of the GNU General Public License as published by the | ||
11 | * Free Software Foundation; either version 2 of the License, or (at your | ||
12 | * option) any later version. | ||
13 | * | ||
14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | ||
17 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
19 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
20 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
21 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
23 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License along | ||
26 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
27 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | */ | ||
29 | #include <linux/config.h> | ||
30 | #include <linux/module.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/errno.h> | ||
33 | #include <linux/string.h> | ||
34 | #include <linux/mm.h> | ||
35 | #include <linux/slab.h> | ||
36 | #include <linux/vmalloc.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include <linux/fb.h> | ||
39 | #include <linux/init.h> | ||
40 | #include <linux/pci.h> | ||
41 | #include <asm/io.h> | ||
42 | #include <video/mach64.h> | ||
43 | #include "atyfb.h" | ||
44 | |||
45 | #define MPLL_GAIN 0xad | ||
46 | #define VPLL_GAIN 0xd5 | ||
47 | |||
48 | enum { | ||
49 | VICTORIA = 0, | ||
50 | XPERT98, | ||
51 | NUM_XL_CARDS | ||
52 | }; | ||
53 | |||
54 | extern const struct aty_pll_ops aty_pll_ct; | ||
55 | |||
56 | #define DEFAULT_CARD XPERT98 | ||
57 | static int xl_card = DEFAULT_CARD; | ||
58 | |||
59 | static const struct xl_card_cfg_t { | ||
60 | int ref_crystal; // 10^4 Hz | ||
61 | int mem_type; | ||
62 | int mem_size; | ||
63 | u32 mem_cntl; | ||
64 | u32 ext_mem_cntl; | ||
65 | u32 mem_addr_config; | ||
66 | u32 bus_cntl; | ||
67 | u32 dac_cntl; | ||
68 | u32 hw_debug; | ||
69 | u32 custom_macro_cntl; | ||
70 | u8 dll2_cntl; | ||
71 | u8 pll_yclk_cntl; | ||
72 | } card_cfg[NUM_XL_CARDS] = { | ||
73 | // VICTORIA | ||
74 | { 2700, SDRAM, 0x800000, | ||
75 | 0x10757A3B, 0x64000C81, 0x00110202, 0x7b33A040, | ||
76 | 0x82010102, 0x48803800, 0x005E0179, | ||
77 | 0x50, 0x25 | ||
78 | }, | ||
79 | // XPERT98 | ||
80 | { 1432, WRAM, 0x800000, | ||
81 | 0x00165A2B, 0xE0000CF1, 0x00200213, 0x7333A001, | ||
82 | 0x8000000A, 0x48833800, 0x007F0779, | ||
83 | 0x10, 0x19 | ||
84 | } | ||
85 | }; | ||
86 | |||
87 | typedef struct { | ||
88 | u8 lcd_reg; | ||
89 | u32 val; | ||
90 | } lcd_tbl_t; | ||
91 | |||
92 | static const lcd_tbl_t lcd_tbl[] = { | ||
93 | { 0x01, 0x000520C0 }, | ||
94 | { 0x08, 0x02000408 }, | ||
95 | { 0x03, 0x00000F00 }, | ||
96 | { 0x00, 0x00000000 }, | ||
97 | { 0x02, 0x00000000 }, | ||
98 | { 0x04, 0x00000000 }, | ||
99 | { 0x05, 0x00000000 }, | ||
100 | { 0x06, 0x00000000 }, | ||
101 | { 0x33, 0x00000000 }, | ||
102 | { 0x34, 0x00000000 }, | ||
103 | { 0x35, 0x00000000 }, | ||
104 | { 0x36, 0x00000000 }, | ||
105 | { 0x37, 0x00000000 } | ||
106 | }; | ||
107 | |||
108 | static void reset_gui(struct atyfb_par *par) | ||
109 | { | ||
110 | aty_st_8(GEN_TEST_CNTL+1, 0x01, par); | ||
111 | aty_st_8(GEN_TEST_CNTL+1, 0x00, par); | ||
112 | aty_st_8(GEN_TEST_CNTL+1, 0x02, par); | ||
113 | mdelay(5); | ||
114 | } | ||
115 | |||
116 | static void reset_sdram(struct atyfb_par *par) | ||
117 | { | ||
118 | u8 temp; | ||
119 | |||
120 | temp = aty_ld_8(EXT_MEM_CNTL, par); | ||
121 | temp |= 0x02; | ||
122 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_SDRAM_RESET = 1b | ||
123 | temp |= 0x08; | ||
124 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_CYC_TEST = 10b | ||
125 | temp |= 0x0c; | ||
126 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_CYC_TEST = 11b | ||
127 | mdelay(5); | ||
128 | temp &= 0xf3; | ||
129 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_CYC_TEST = 00b | ||
130 | temp &= 0xfd; | ||
131 | aty_st_8(EXT_MEM_CNTL, temp, par); // MEM_SDRAM_REST = 0b | ||
132 | mdelay(5); | ||
133 | } | ||
134 | |||
135 | static void init_dll(struct atyfb_par *par) | ||
136 | { | ||
137 | // enable DLL | ||
138 | aty_st_pll_ct(PLL_GEN_CNTL, | ||
139 | aty_ld_pll_ct(PLL_GEN_CNTL, par) & 0x7f, | ||
140 | par); | ||
141 | |||
142 | // reset DLL | ||
143 | aty_st_pll_ct(DLL_CNTL, 0x82, par); | ||
144 | aty_st_pll_ct(DLL_CNTL, 0xE2, par); | ||
145 | mdelay(5); | ||
146 | aty_st_pll_ct(DLL_CNTL, 0x82, par); | ||
147 | mdelay(6); | ||
148 | } | ||
149 | |||
150 | static void reset_clocks(struct atyfb_par *par, struct pll_ct *pll, | ||
151 | int hsync_enb) | ||
152 | { | ||
153 | reset_gui(par); | ||
154 | aty_st_pll_ct(MCLK_FB_DIV, pll->mclk_fb_div, par); | ||
155 | aty_st_pll_ct(SCLK_FB_DIV, pll->sclk_fb_div, par); | ||
156 | |||
157 | mdelay(15); | ||
158 | init_dll(par); | ||
159 | aty_st_8(GEN_TEST_CNTL+1, 0x00, par); | ||
160 | mdelay(5); | ||
161 | aty_st_8(CRTC_GEN_CNTL+3, 0x04, par); | ||
162 | mdelay(6); | ||
163 | reset_sdram(par); | ||
164 | aty_st_8(CRTC_GEN_CNTL+3, | ||
165 | hsync_enb ? 0x00 : 0x04, par); | ||
166 | |||
167 | aty_st_pll_ct(SPLL_CNTL2, pll->spll_cntl2, par); | ||
168 | aty_st_pll_ct(PLL_GEN_CNTL, pll->pll_gen_cntl, par); | ||
169 | aty_st_pll_ct(PLL_VCLK_CNTL, pll->pll_vclk_cntl, par); | ||
170 | } | ||
171 | |||
172 | int atyfb_xl_init(struct fb_info *info) | ||
173 | { | ||
174 | const struct xl_card_cfg_t * card = &card_cfg[xl_card]; | ||
175 | struct atyfb_par *par = (struct atyfb_par *) info->par; | ||
176 | union aty_pll pll; | ||
177 | int err; | ||
178 | u32 temp; | ||
179 | |||
180 | aty_st_8(CONFIG_STAT0, 0x85, par); | ||
181 | mdelay(10); | ||
182 | |||
183 | /* | ||
184 | * The following needs to be set before the call | ||
185 | * to var_to_pll() below. They'll be re-set again | ||
186 | * to the same values in aty_init(). | ||
187 | */ | ||
188 | par->ref_clk_per = 100000000UL/card->ref_crystal; | ||
189 | par->ram_type = card->mem_type; | ||
190 | info->fix.smem_len = card->mem_size; | ||
191 | if (xl_card == VICTORIA) { | ||
192 | // the MCLK, XCLK are 120MHz on victoria card | ||
193 | par->mclk_per = 1000000/120; | ||
194 | par->xclk_per = 1000000/120; | ||
195 | par->features &= ~M64F_MFB_FORCE_4; | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * Calculate mclk and xclk dividers, etc. The passed | ||
200 | * pixclock and bpp values don't matter yet, the vclk | ||
201 | * isn't programmed until later. | ||
202 | */ | ||
203 | if ((err = aty_pll_ct.var_to_pll(info, 39726, 8, &pll))) | ||
204 | return err; | ||
205 | |||
206 | aty_st_pll_ct(LVDS_CNTL0, 0x00, par); | ||
207 | aty_st_pll_ct(DLL2_CNTL, card->dll2_cntl, par); | ||
208 | aty_st_pll_ct(V2PLL_CNTL, 0x10, par); | ||
209 | aty_st_pll_ct(MPLL_CNTL, MPLL_GAIN, par); | ||
210 | aty_st_pll_ct(VPLL_CNTL, VPLL_GAIN, par); | ||
211 | aty_st_pll_ct(PLL_VCLK_CNTL, 0x00, par); | ||
212 | aty_st_pll_ct(VFC_CNTL, 0x1B, par); | ||
213 | aty_st_pll_ct(PLL_REF_DIV, pll.ct.pll_ref_div, par); | ||
214 | aty_st_pll_ct(PLL_EXT_CNTL, pll.ct.pll_ext_cntl, par); | ||
215 | aty_st_pll_ct(SPLL_CNTL2, 0x03, par); | ||
216 | aty_st_pll_ct(PLL_GEN_CNTL, 0x44, par); | ||
217 | |||
218 | reset_clocks(par, &pll.ct, 0); | ||
219 | mdelay(10); | ||
220 | |||
221 | aty_st_pll_ct(VCLK_POST_DIV, 0x03, par); | ||
222 | aty_st_pll_ct(VCLK0_FB_DIV, 0xDA, par); | ||
223 | aty_st_pll_ct(VCLK_POST_DIV, 0x0F, par); | ||
224 | aty_st_pll_ct(VCLK1_FB_DIV, 0xF5, par); | ||
225 | aty_st_pll_ct(VCLK_POST_DIV, 0x3F, par); | ||
226 | aty_st_pll_ct(PLL_EXT_CNTL, 0x40 | pll.ct.pll_ext_cntl, par); | ||
227 | aty_st_pll_ct(VCLK2_FB_DIV, 0x00, par); | ||
228 | aty_st_pll_ct(VCLK_POST_DIV, 0xFF, par); | ||
229 | aty_st_pll_ct(PLL_EXT_CNTL, 0xC0 | pll.ct.pll_ext_cntl, par); | ||
230 | aty_st_pll_ct(VCLK3_FB_DIV, 0x00, par); | ||
231 | |||
232 | aty_st_8(BUS_CNTL, 0x01, par); | ||
233 | aty_st_le32(BUS_CNTL, card->bus_cntl | 0x08000000, par); | ||
234 | |||
235 | aty_st_le32(CRTC_GEN_CNTL, 0x04000200, par); | ||
236 | aty_st_le16(CONFIG_STAT0, 0x0020, par); | ||
237 | aty_st_le32(MEM_CNTL, 0x10151A33, par); | ||
238 | aty_st_le32(EXT_MEM_CNTL, 0xE0000C01, par); | ||
239 | aty_st_le16(CRTC_GEN_CNTL+2, 0x0000, par); | ||
240 | aty_st_le32(DAC_CNTL, card->dac_cntl, par); | ||
241 | aty_st_le16(GEN_TEST_CNTL, 0x0100, par); | ||
242 | aty_st_le32(CUSTOM_MACRO_CNTL, 0x003C0171, par); | ||
243 | aty_st_le32(MEM_BUF_CNTL, 0x00382848, par); | ||
244 | |||
245 | aty_st_le32(HW_DEBUG, card->hw_debug, par); | ||
246 | aty_st_le16(MEM_ADDR_CONFIG, 0x0000, par); | ||
247 | aty_st_le16(GP_IO+2, 0x0000, par); | ||
248 | aty_st_le16(GEN_TEST_CNTL, 0x0000, par); | ||
249 | aty_st_le16(EXT_DAC_REGS+2, 0x0000, par); | ||
250 | aty_st_le32(CRTC_INT_CNTL, 0x00000000, par); | ||
251 | aty_st_le32(TIMER_CONFIG, 0x00000000, par); | ||
252 | aty_st_le32(0xEC, 0x00000000, par); | ||
253 | aty_st_le32(0xFC, 0x00000000, par); | ||
254 | |||
255 | #if defined (CONFIG_FB_ATY_GENERIC_LCD) | ||
256 | { | ||
257 | int i; | ||
258 | |||
259 | for (i = 0; i < ARRAY_SIZE(lcd_tbl); i++) | ||
260 | aty_st_lcd(lcd_tbl[i].lcd_reg, lcd_tbl[i].val, par); | ||
261 | } | ||
262 | #endif | ||
263 | |||
264 | aty_st_le16(CONFIG_STAT0, 0x00A4, par); | ||
265 | mdelay(10); | ||
266 | |||
267 | aty_st_8(BUS_CNTL+1, 0xA0, par); | ||
268 | mdelay(10); | ||
269 | |||
270 | reset_clocks(par, &pll.ct, 1); | ||
271 | mdelay(10); | ||
272 | |||
273 | // something about power management | ||
274 | aty_st_8(LCD_INDEX, 0x08, par); | ||
275 | aty_st_8(LCD_DATA, 0x0A, par); | ||
276 | aty_st_8(LCD_INDEX, 0x08, par); | ||
277 | aty_st_8(LCD_DATA+3, 0x02, par); | ||
278 | aty_st_8(LCD_INDEX, 0x08, par); | ||
279 | aty_st_8(LCD_DATA, 0x0B, par); | ||
280 | mdelay(2); | ||
281 | |||
282 | // enable display requests, enable CRTC | ||
283 | aty_st_8(CRTC_GEN_CNTL+3, 0x02, par); | ||
284 | // disable display | ||
285 | aty_st_8(CRTC_GEN_CNTL, 0x40, par); | ||
286 | // disable display requests, disable CRTC | ||
287 | aty_st_8(CRTC_GEN_CNTL+3, 0x04, par); | ||
288 | mdelay(10); | ||
289 | |||
290 | aty_st_pll_ct(PLL_YCLK_CNTL, 0x25, par); | ||
291 | |||
292 | aty_st_le16(CUSTOM_MACRO_CNTL, 0x0179, par); | ||
293 | aty_st_le16(CUSTOM_MACRO_CNTL+2, 0x005E, par); | ||
294 | aty_st_le16(CUSTOM_MACRO_CNTL+2, card->custom_macro_cntl>>16, par); | ||
295 | aty_st_8(CUSTOM_MACRO_CNTL+1, | ||
296 | (card->custom_macro_cntl>>8) & 0xff, par); | ||
297 | |||
298 | aty_st_le32(MEM_ADDR_CONFIG, card->mem_addr_config, par); | ||
299 | aty_st_le32(MEM_CNTL, card->mem_cntl, par); | ||
300 | aty_st_le32(EXT_MEM_CNTL, card->ext_mem_cntl, par); | ||
301 | |||
302 | aty_st_8(CONFIG_STAT0, 0xA0 | card->mem_type, par); | ||
303 | |||
304 | aty_st_pll_ct(PLL_YCLK_CNTL, 0x01, par); | ||
305 | mdelay(15); | ||
306 | aty_st_pll_ct(PLL_YCLK_CNTL, card->pll_yclk_cntl, par); | ||
307 | mdelay(1); | ||
308 | |||
309 | reset_clocks(par, &pll.ct, 0); | ||
310 | mdelay(50); | ||
311 | reset_clocks(par, &pll.ct, 0); | ||
312 | mdelay(50); | ||
313 | |||
314 | // enable extended register block | ||
315 | aty_st_8(BUS_CNTL+3, 0x7B, par); | ||
316 | mdelay(1); | ||
317 | // disable extended register block | ||
318 | aty_st_8(BUS_CNTL+3, 0x73, par); | ||
319 | |||
320 | aty_st_8(CONFIG_STAT0, 0x80 | card->mem_type, par); | ||
321 | |||
322 | // disable display requests, disable CRTC | ||
323 | aty_st_8(CRTC_GEN_CNTL+3, 0x04, par); | ||
324 | // disable mapping registers in VGA aperture | ||
325 | aty_st_8(CONFIG_CNTL, aty_ld_8(CONFIG_CNTL, par) & ~0x04, par); | ||
326 | mdelay(50); | ||
327 | // enable display requests, enable CRTC | ||
328 | aty_st_8(CRTC_GEN_CNTL+3, 0x02, par); | ||
329 | |||
330 | // make GPIO's 14,15,16 all inputs | ||
331 | aty_st_8(LCD_INDEX, 0x07, par); | ||
332 | aty_st_8(LCD_DATA+3, 0x00, par); | ||
333 | |||
334 | // enable the display | ||
335 | aty_st_8(CRTC_GEN_CNTL, 0x00, par); | ||
336 | mdelay(17); | ||
337 | // reset the memory controller | ||
338 | aty_st_8(GEN_TEST_CNTL+1, 0x02, par); | ||
339 | mdelay(15); | ||
340 | aty_st_8(GEN_TEST_CNTL+1, 0x00, par); | ||
341 | mdelay(30); | ||
342 | |||
343 | // enable extended register block | ||
344 | aty_st_8(BUS_CNTL+3, | ||
345 | (u8)(aty_ld_8(BUS_CNTL+3, par) | 0x08), | ||
346 | par); | ||
347 | // set FIFO size to 512 (PIO) | ||
348 | aty_st_le32(GUI_CNTL, | ||
349 | aty_ld_le32(GUI_CNTL, par) & ~0x3, | ||
350 | par); | ||
351 | |||
352 | // enable CRT and disable lcd | ||
353 | aty_st_8(LCD_INDEX, 0x01, par); | ||
354 | temp = aty_ld_le32(LCD_DATA, par); | ||
355 | temp = (temp | 0x01) & ~0x02; | ||
356 | aty_st_le32(LCD_DATA, temp, par); | ||
357 | return 0; | ||
358 | } | ||
359 | |||
diff --git a/drivers/video/console/bitblit.c b/drivers/video/console/bitblit.c index e65fc3ef7630..eea422eb1ab5 100644 --- a/drivers/video/console/bitblit.c +++ b/drivers/video/console/bitblit.c | |||
@@ -234,14 +234,14 @@ static void bit_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | static void bit_cursor(struct vc_data *vc, struct fb_info *info, | 237 | static void bit_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
238 | struct display *p, int mode, int softback_lines, int fg, int bg) | 238 | int softback_lines, int fg, int bg) |
239 | { | 239 | { |
240 | struct fb_cursor cursor; | 240 | struct fb_cursor cursor; |
241 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 241 | struct fbcon_ops *ops = info->fbcon_par; |
242 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 242 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
243 | int w = (vc->vc_font.width + 7) >> 3, c; | 243 | int w = (vc->vc_font.width + 7) >> 3, c; |
244 | int y = real_y(p, vc->vc_y); | 244 | int y = real_y(ops->p, vc->vc_y); |
245 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 245 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
246 | int err = 1; | 246 | int err = 1; |
247 | char *src; | 247 | char *src; |
@@ -310,7 +310,7 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, | |||
310 | } | 310 | } |
311 | 311 | ||
312 | if (cursor.set & FB_CUR_SETSIZE || | 312 | if (cursor.set & FB_CUR_SETSIZE || |
313 | vc->vc_cursor_type != p->cursor_shape || | 313 | vc->vc_cursor_type != ops->p->cursor_shape || |
314 | ops->cursor_state.mask == NULL || | 314 | ops->cursor_state.mask == NULL || |
315 | ops->cursor_reset) { | 315 | ops->cursor_reset) { |
316 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); | 316 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); |
@@ -323,10 +323,10 @@ static void bit_cursor(struct vc_data *vc, struct fb_info *info, | |||
323 | kfree(ops->cursor_state.mask); | 323 | kfree(ops->cursor_state.mask); |
324 | ops->cursor_state.mask = mask; | 324 | ops->cursor_state.mask = mask; |
325 | 325 | ||
326 | p->cursor_shape = vc->vc_cursor_type; | 326 | ops->p->cursor_shape = vc->vc_cursor_type; |
327 | cursor.set |= FB_CUR_SETSHAPE; | 327 | cursor.set |= FB_CUR_SETSHAPE; |
328 | 328 | ||
329 | switch (p->cursor_shape & CUR_HWMASK) { | 329 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
330 | case CUR_NONE: | 330 | case CUR_NONE: |
331 | cur_height = 0; | 331 | cur_height = 0; |
332 | break; | 332 | break; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 50e4c4eb491f..041d06987861 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -209,13 +209,13 @@ static irqreturn_t fb_vbl_detect(int irq, void *dummy, struct pt_regs *fp) | |||
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION | 211 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION |
212 | static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) | 212 | static inline void fbcon_set_rotation(struct fb_info *info) |
213 | { | 213 | { |
214 | struct fbcon_ops *ops = info->fbcon_par; | 214 | struct fbcon_ops *ops = info->fbcon_par; |
215 | 215 | ||
216 | if (!(info->flags & FBINFO_MISC_TILEBLITTING) && | 216 | if (!(info->flags & FBINFO_MISC_TILEBLITTING) && |
217 | p->con_rotate < 4) | 217 | ops->p->con_rotate < 4) |
218 | ops->rotate = p->con_rotate; | 218 | ops->rotate = ops->p->con_rotate; |
219 | else | 219 | else |
220 | ops->rotate = 0; | 220 | ops->rotate = 0; |
221 | } | 221 | } |
@@ -265,7 +265,7 @@ static void fbcon_rotate_all(struct fb_info *info, u32 rotate) | |||
265 | fbcon_set_all_vcs(info); | 265 | fbcon_set_all_vcs(info); |
266 | } | 266 | } |
267 | #else | 267 | #else |
268 | static inline void fbcon_set_rotation(struct fb_info *info, struct display *p) | 268 | static inline void fbcon_set_rotation(struct fb_info *info) |
269 | { | 269 | { |
270 | struct fbcon_ops *ops = info->fbcon_par; | 270 | struct fbcon_ops *ops = info->fbcon_par; |
271 | 271 | ||
@@ -402,7 +402,7 @@ static void fb_flashcursor(void *private) | |||
402 | c = scr_readw((u16 *) vc->vc_pos); | 402 | c = scr_readw((u16 *) vc->vc_pos); |
403 | mode = (!ops->cursor_flash || ops->cursor_state.enable) ? | 403 | mode = (!ops->cursor_flash || ops->cursor_state.enable) ? |
404 | CM_ERASE : CM_DRAW; | 404 | CM_ERASE : CM_DRAW; |
405 | ops->cursor(vc, info, p, mode, softback_lines, get_color(vc, info, c, 1), | 405 | ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), |
406 | get_color(vc, info, c, 0)); | 406 | get_color(vc, info, c, 0)); |
407 | release_console_sem(); | 407 | release_console_sem(); |
408 | } | 408 | } |
@@ -647,29 +647,27 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info, | |||
647 | } | 647 | } |
648 | 648 | ||
649 | #ifdef CONFIG_FB_TILEBLITTING | 649 | #ifdef CONFIG_FB_TILEBLITTING |
650 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info, | 650 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info) |
651 | struct display *p) | ||
652 | { | 651 | { |
653 | struct fbcon_ops *ops = info->fbcon_par; | 652 | struct fbcon_ops *ops = info->fbcon_par; |
654 | 653 | ||
655 | ops->p = (p) ? p : &fb_display[vc->vc_num]; | 654 | ops->p = &fb_display[vc->vc_num]; |
656 | 655 | ||
657 | if ((info->flags & FBINFO_MISC_TILEBLITTING)) | 656 | if ((info->flags & FBINFO_MISC_TILEBLITTING)) |
658 | fbcon_set_tileops(vc, info, p, ops); | 657 | fbcon_set_tileops(vc, info); |
659 | else { | 658 | else { |
660 | fbcon_set_rotation(info, ops->p); | 659 | fbcon_set_rotation(info); |
661 | fbcon_set_bitops(ops); | 660 | fbcon_set_bitops(ops); |
662 | } | 661 | } |
663 | } | 662 | } |
664 | #else | 663 | #else |
665 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info, | 664 | static void set_blitting_type(struct vc_data *vc, struct fb_info *info) |
666 | struct display *p) | ||
667 | { | 665 | { |
668 | struct fbcon_ops *ops = info->fbcon_par; | 666 | struct fbcon_ops *ops = info->fbcon_par; |
669 | 667 | ||
670 | info->flags &= ~FBINFO_MISC_TILEBLITTING; | 668 | info->flags &= ~FBINFO_MISC_TILEBLITTING; |
671 | ops->p = (p) ? p : &fb_display[vc->vc_num]; | 669 | ops->p = &fb_display[vc->vc_num]; |
672 | fbcon_set_rotation(info, ops->p); | 670 | fbcon_set_rotation(info); |
673 | fbcon_set_bitops(ops); | 671 | fbcon_set_bitops(ops); |
674 | } | 672 | } |
675 | #endif /* CONFIG_MISC_TILEBLITTING */ | 673 | #endif /* CONFIG_MISC_TILEBLITTING */ |
@@ -689,15 +687,14 @@ static int con2fb_acquire_newinfo(struct vc_data *vc, struct fb_info *info, | |||
689 | err = -ENODEV; | 687 | err = -ENODEV; |
690 | 688 | ||
691 | if (!err) { | 689 | if (!err) { |
692 | ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL); | 690 | ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); |
693 | if (!ops) | 691 | if (!ops) |
694 | err = -ENOMEM; | 692 | err = -ENOMEM; |
695 | } | 693 | } |
696 | 694 | ||
697 | if (!err) { | 695 | if (!err) { |
698 | memset(ops, 0, sizeof(struct fbcon_ops)); | ||
699 | info->fbcon_par = ops; | 696 | info->fbcon_par = ops; |
700 | set_blitting_type(vc, info, NULL); | 697 | set_blitting_type(vc, info); |
701 | } | 698 | } |
702 | 699 | ||
703 | if (err) { | 700 | if (err) { |
@@ -921,19 +918,18 @@ static const char *fbcon_startup(void) | |||
921 | return NULL; | 918 | return NULL; |
922 | } | 919 | } |
923 | 920 | ||
924 | ops = kmalloc(sizeof(struct fbcon_ops), GFP_KERNEL); | 921 | ops = kzalloc(sizeof(struct fbcon_ops), GFP_KERNEL); |
925 | if (!ops) { | 922 | if (!ops) { |
926 | module_put(owner); | 923 | module_put(owner); |
927 | return NULL; | 924 | return NULL; |
928 | } | 925 | } |
929 | 926 | ||
930 | memset(ops, 0, sizeof(struct fbcon_ops)); | ||
931 | ops->currcon = -1; | 927 | ops->currcon = -1; |
932 | ops->graphics = 1; | 928 | ops->graphics = 1; |
933 | ops->cur_rotate = -1; | 929 | ops->cur_rotate = -1; |
934 | info->fbcon_par = ops; | 930 | info->fbcon_par = ops; |
935 | p->con_rotate = rotate; | 931 | p->con_rotate = rotate; |
936 | set_blitting_type(vc, info, NULL); | 932 | set_blitting_type(vc, info); |
937 | 933 | ||
938 | if (info->fix.type != FB_TYPE_TEXT) { | 934 | if (info->fix.type != FB_TYPE_TEXT) { |
939 | if (fbcon_softback_size) { | 935 | if (fbcon_softback_size) { |
@@ -1093,7 +1089,7 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1093 | 1089 | ||
1094 | ops = info->fbcon_par; | 1090 | ops = info->fbcon_par; |
1095 | p->con_rotate = rotate; | 1091 | p->con_rotate = rotate; |
1096 | set_blitting_type(vc, info, NULL); | 1092 | set_blitting_type(vc, info); |
1097 | 1093 | ||
1098 | cols = vc->vc_cols; | 1094 | cols = vc->vc_cols; |
1099 | rows = vc->vc_rows; | 1095 | rows = vc->vc_rows; |
@@ -1141,9 +1137,9 @@ static void fbcon_init(struct vc_data *vc, int init) | |||
1141 | if (vc == svc && softback_buf) | 1137 | if (vc == svc && softback_buf) |
1142 | fbcon_update_softback(vc); | 1138 | fbcon_update_softback(vc); |
1143 | 1139 | ||
1144 | if (ops->rotate_font && ops->rotate_font(info, vc, p)) { | 1140 | if (ops->rotate_font && ops->rotate_font(info, vc)) { |
1145 | ops->rotate = FB_ROTATE_UR; | 1141 | ops->rotate = FB_ROTATE_UR; |
1146 | set_blitting_type(vc, info, p); | 1142 | set_blitting_type(vc, info); |
1147 | } | 1143 | } |
1148 | 1144 | ||
1149 | } | 1145 | } |
@@ -1243,7 +1239,6 @@ static void fbcon_cursor(struct vc_data *vc, int mode) | |||
1243 | { | 1239 | { |
1244 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | 1240 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1245 | struct fbcon_ops *ops = info->fbcon_par; | 1241 | struct fbcon_ops *ops = info->fbcon_par; |
1246 | struct display *p = &fb_display[vc->vc_num]; | ||
1247 | int y; | 1242 | int y; |
1248 | int c = scr_readw((u16 *) vc->vc_pos); | 1243 | int c = scr_readw((u16 *) vc->vc_pos); |
1249 | 1244 | ||
@@ -1260,7 +1255,7 @@ static void fbcon_cursor(struct vc_data *vc, int mode) | |||
1260 | y = 0; | 1255 | y = 0; |
1261 | } | 1256 | } |
1262 | 1257 | ||
1263 | ops->cursor(vc, info, p, mode, y, get_color(vc, info, c, 1), | 1258 | ops->cursor(vc, info, mode, y, get_color(vc, info, c, 1), |
1264 | get_color(vc, info, c, 0)); | 1259 | get_color(vc, info, c, 0)); |
1265 | vbl_cursor_cnt = CURSOR_DRAW_DELAY; | 1260 | vbl_cursor_cnt = CURSOR_DRAW_DELAY; |
1266 | } | 1261 | } |
@@ -1411,16 +1406,13 @@ static __inline__ void ypan_up_redraw(struct vc_data *vc, int t, int count) | |||
1411 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | 1406 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1412 | struct fbcon_ops *ops = info->fbcon_par; | 1407 | struct fbcon_ops *ops = info->fbcon_par; |
1413 | struct display *p = &fb_display[vc->vc_num]; | 1408 | struct display *p = &fb_display[vc->vc_num]; |
1414 | int redraw = 0; | ||
1415 | 1409 | ||
1416 | p->yscroll += count; | 1410 | p->yscroll += count; |
1411 | |||
1417 | if (p->yscroll > p->vrows - vc->vc_rows) { | 1412 | if (p->yscroll > p->vrows - vc->vc_rows) { |
1418 | p->yscroll -= p->vrows - vc->vc_rows; | 1413 | p->yscroll -= p->vrows - vc->vc_rows; |
1419 | redraw = 1; | ||
1420 | } | ||
1421 | |||
1422 | if (redraw) | ||
1423 | fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); | 1414 | fbcon_redraw_move(vc, p, t + count, vc->vc_rows - count, t); |
1415 | } | ||
1424 | 1416 | ||
1425 | ops->var.xoffset = 0; | 1417 | ops->var.xoffset = 0; |
1426 | ops->var.yoffset = p->yscroll * vc->vc_font.height; | 1418 | ops->var.yoffset = p->yscroll * vc->vc_font.height; |
@@ -1462,16 +1454,13 @@ static __inline__ void ypan_down_redraw(struct vc_data *vc, int t, int count) | |||
1462 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | 1454 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; |
1463 | struct fbcon_ops *ops = info->fbcon_par; | 1455 | struct fbcon_ops *ops = info->fbcon_par; |
1464 | struct display *p = &fb_display[vc->vc_num]; | 1456 | struct display *p = &fb_display[vc->vc_num]; |
1465 | int redraw = 0; | ||
1466 | 1457 | ||
1467 | p->yscroll -= count; | 1458 | p->yscroll -= count; |
1459 | |||
1468 | if (p->yscroll < 0) { | 1460 | if (p->yscroll < 0) { |
1469 | p->yscroll += p->vrows - vc->vc_rows; | 1461 | p->yscroll += p->vrows - vc->vc_rows; |
1470 | redraw = 1; | ||
1471 | } | ||
1472 | |||
1473 | if (redraw) | ||
1474 | fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); | 1462 | fbcon_redraw_move(vc, p, t, vc->vc_rows - count, t + count); |
1463 | } | ||
1475 | 1464 | ||
1476 | ops->var.xoffset = 0; | 1465 | ops->var.xoffset = 0; |
1477 | ops->var.yoffset = p->yscroll * vc->vc_font.height; | 1466 | ops->var.yoffset = p->yscroll * vc->vc_font.height; |
@@ -1968,7 +1957,8 @@ static __inline__ void updatescrollmode(struct display *p, | |||
1968 | divides(ypan, vc->vc_font.height) && vyres > yres; | 1957 | divides(ypan, vc->vc_font.height) && vyres > yres; |
1969 | int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && | 1958 | int good_wrap = (cap & FBINFO_HWACCEL_YWRAP) && |
1970 | divides(ywrap, vc->vc_font.height) && | 1959 | divides(ywrap, vc->vc_font.height) && |
1971 | divides(vc->vc_font.height, vyres); | 1960 | divides(vc->vc_font.height, vyres) && |
1961 | divides(vc->vc_font.height, yres); | ||
1972 | int reading_fast = cap & FBINFO_READS_FAST; | 1962 | int reading_fast = cap & FBINFO_READS_FAST; |
1973 | int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && | 1963 | int fast_copyarea = (cap & FBINFO_HWACCEL_COPYAREA) && |
1974 | !(cap & FBINFO_HWACCEL_DISABLED); | 1964 | !(cap & FBINFO_HWACCEL_DISABLED); |
@@ -2107,16 +2097,19 @@ static int fbcon_switch(struct vc_data *vc) | |||
2107 | info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { | 2097 | info->flags & FBINFO_MISC_ALWAYS_SETPAR)) { |
2108 | if (info->fbops->fb_set_par) | 2098 | if (info->fbops->fb_set_par) |
2109 | info->fbops->fb_set_par(info); | 2099 | info->fbops->fb_set_par(info); |
2110 | fbcon_del_cursor_timer(old_info); | 2100 | |
2111 | fbcon_add_cursor_timer(info); | 2101 | if (old_info != info) { |
2102 | fbcon_del_cursor_timer(old_info); | ||
2103 | fbcon_add_cursor_timer(info); | ||
2104 | } | ||
2112 | } | 2105 | } |
2113 | 2106 | ||
2114 | set_blitting_type(vc, info, p); | 2107 | set_blitting_type(vc, info); |
2115 | ops->cursor_reset = 1; | 2108 | ops->cursor_reset = 1; |
2116 | 2109 | ||
2117 | if (ops->rotate_font && ops->rotate_font(info, vc, p)) { | 2110 | if (ops->rotate_font && ops->rotate_font(info, vc)) { |
2118 | ops->rotate = FB_ROTATE_UR; | 2111 | ops->rotate = FB_ROTATE_UR; |
2119 | set_blitting_type(vc, info, p); | 2112 | set_blitting_type(vc, info); |
2120 | } | 2113 | } |
2121 | 2114 | ||
2122 | vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); | 2115 | vc->vc_can_do_color = (fb_get_color_depth(&info->var, &info->fix)!=1); |
@@ -2739,7 +2732,7 @@ static void fbcon_modechanged(struct fb_info *info) | |||
2739 | return; | 2732 | return; |
2740 | 2733 | ||
2741 | p = &fb_display[vc->vc_num]; | 2734 | p = &fb_display[vc->vc_num]; |
2742 | set_blitting_type(vc, info, p); | 2735 | set_blitting_type(vc, info); |
2743 | 2736 | ||
2744 | if (CON_IS_VISIBLE(vc)) { | 2737 | if (CON_IS_VISIBLE(vc)) { |
2745 | var_to_display(p, &info->var, info); | 2738 | var_to_display(p, &info->var, info); |
@@ -2781,7 +2774,7 @@ static void fbcon_set_all_vcs(struct fb_info *info) | |||
2781 | continue; | 2774 | continue; |
2782 | 2775 | ||
2783 | p = &fb_display[vc->vc_num]; | 2776 | p = &fb_display[vc->vc_num]; |
2784 | set_blitting_type(vc, info, p); | 2777 | set_blitting_type(vc, info); |
2785 | var_to_display(p, &info->var, info); | 2778 | var_to_display(p, &info->var, info); |
2786 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); | 2779 | cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres); |
2787 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); | 2780 | rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres); |
@@ -2806,6 +2799,8 @@ static void fbcon_set_all_vcs(struct fb_info *info) | |||
2806 | fbcon_update_softback(vc); | 2799 | fbcon_update_softback(vc); |
2807 | } | 2800 | } |
2808 | } | 2801 | } |
2802 | |||
2803 | ops->p = &fb_display[ops->currcon]; | ||
2809 | } | 2804 | } |
2810 | 2805 | ||
2811 | static int fbcon_mode_deleted(struct fb_info *info, | 2806 | static int fbcon_mode_deleted(struct fb_info *info, |
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 6892e7ff34de..c38c3d8e7a74 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h | |||
@@ -62,12 +62,10 @@ struct fbcon_ops { | |||
62 | int fg, int bg); | 62 | int fg, int bg); |
63 | void (*clear_margins)(struct vc_data *vc, struct fb_info *info, | 63 | void (*clear_margins)(struct vc_data *vc, struct fb_info *info, |
64 | int bottom_only); | 64 | int bottom_only); |
65 | void (*cursor)(struct vc_data *vc, struct fb_info *info, | 65 | void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode, |
66 | struct display *p, int mode, int softback_lines, | 66 | int softback_lines, int fg, int bg); |
67 | int fg, int bg); | ||
68 | int (*update_start)(struct fb_info *info); | 67 | int (*update_start)(struct fb_info *info); |
69 | int (*rotate_font)(struct fb_info *info, struct vc_data *vc, | 68 | int (*rotate_font)(struct fb_info *info, struct vc_data *vc); |
70 | struct display *p); | ||
71 | struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ | 69 | struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */ |
72 | struct timer_list cursor_timer; /* Cursor timer */ | 70 | struct timer_list cursor_timer; /* Cursor timer */ |
73 | struct fb_cursor cursor_state; | 71 | struct fb_cursor cursor_state; |
@@ -173,8 +171,7 @@ struct fbcon_ops { | |||
173 | #define SCROLL_PAN_REDRAW 0x005 | 171 | #define SCROLL_PAN_REDRAW 0x005 |
174 | 172 | ||
175 | #ifdef CONFIG_FB_TILEBLITTING | 173 | #ifdef CONFIG_FB_TILEBLITTING |
176 | extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | 174 | extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info); |
177 | struct display *p, struct fbcon_ops *ops); | ||
178 | #endif | 175 | #endif |
179 | extern void fbcon_set_bitops(struct fbcon_ops *ops); | 176 | extern void fbcon_set_bitops(struct fbcon_ops *ops); |
180 | extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); | 177 | extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); |
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/console/fbcon_ccw.c index 4952b66ae206..990289a69b78 100644 --- a/drivers/video/console/fbcon_ccw.c +++ b/drivers/video/console/fbcon_ccw.c | |||
@@ -219,19 +219,18 @@ static void ccw_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | static void ccw_cursor(struct vc_data *vc, struct fb_info *info, | 222 | static void ccw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
223 | struct display *p, int mode, int softback_lines, | 223 | int softback_lines, int fg, int bg) |
224 | int fg, int bg) | ||
225 | { | 224 | { |
226 | struct fb_cursor cursor; | 225 | struct fb_cursor cursor; |
227 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 226 | struct fbcon_ops *ops = info->fbcon_par; |
228 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 227 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
229 | int w = (vc->vc_font.height + 7) >> 3, c; | 228 | int w = (vc->vc_font.height + 7) >> 3, c; |
230 | int y = real_y(p, vc->vc_y); | 229 | int y = real_y(ops->p, vc->vc_y); |
231 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 230 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
232 | int err = 1, dx, dy; | 231 | int err = 1, dx, dy; |
233 | char *src; | 232 | char *src; |
234 | u32 vyres = GETVYRES(p->scrollmode, info); | 233 | u32 vyres = GETVYRES(ops->p->scrollmode, info); |
235 | 234 | ||
236 | if (!ops->fontbuffer) | 235 | if (!ops->fontbuffer) |
237 | return; | 236 | return; |
@@ -303,7 +302,7 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, | |||
303 | } | 302 | } |
304 | 303 | ||
305 | if (cursor.set & FB_CUR_SETSIZE || | 304 | if (cursor.set & FB_CUR_SETSIZE || |
306 | vc->vc_cursor_type != p->cursor_shape || | 305 | vc->vc_cursor_type != ops->p->cursor_shape || |
307 | ops->cursor_state.mask == NULL || | 306 | ops->cursor_state.mask == NULL || |
308 | ops->cursor_reset) { | 307 | ops->cursor_reset) { |
309 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); | 308 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); |
@@ -323,10 +322,10 @@ static void ccw_cursor(struct vc_data *vc, struct fb_info *info, | |||
323 | kfree(ops->cursor_state.mask); | 322 | kfree(ops->cursor_state.mask); |
324 | ops->cursor_state.mask = mask; | 323 | ops->cursor_state.mask = mask; |
325 | 324 | ||
326 | p->cursor_shape = vc->vc_cursor_type; | 325 | ops->p->cursor_shape = vc->vc_cursor_type; |
327 | cursor.set |= FB_CUR_SETSHAPE; | 326 | cursor.set |= FB_CUR_SETSHAPE; |
328 | 327 | ||
329 | switch (p->cursor_shape & CUR_HWMASK) { | 328 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
330 | case CUR_NONE: | 329 | case CUR_NONE: |
331 | cur_height = 0; | 330 | cur_height = 0; |
332 | break; | 331 | break; |
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/console/fbcon_cw.c index 6d92b8456206..d44c5fa515fb 100644 --- a/drivers/video/console/fbcon_cw.c +++ b/drivers/video/console/fbcon_cw.c | |||
@@ -203,19 +203,18 @@ static void cw_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | static void cw_cursor(struct vc_data *vc, struct fb_info *info, | 206 | static void cw_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
207 | struct display *p, int mode, int softback_lines, | 207 | int softback_lines, int fg, int bg) |
208 | int fg, int bg) | ||
209 | { | 208 | { |
210 | struct fb_cursor cursor; | 209 | struct fb_cursor cursor; |
211 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 210 | struct fbcon_ops *ops = info->fbcon_par; |
212 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 211 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
213 | int w = (vc->vc_font.height + 7) >> 3, c; | 212 | int w = (vc->vc_font.height + 7) >> 3, c; |
214 | int y = real_y(p, vc->vc_y); | 213 | int y = real_y(ops->p, vc->vc_y); |
215 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 214 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
216 | int err = 1, dx, dy; | 215 | int err = 1, dx, dy; |
217 | char *src; | 216 | char *src; |
218 | u32 vxres = GETVXRES(p->scrollmode, info); | 217 | u32 vxres = GETVXRES(ops->p->scrollmode, info); |
219 | 218 | ||
220 | if (!ops->fontbuffer) | 219 | if (!ops->fontbuffer) |
221 | return; | 220 | return; |
@@ -287,7 +286,7 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, | |||
287 | } | 286 | } |
288 | 287 | ||
289 | if (cursor.set & FB_CUR_SETSIZE || | 288 | if (cursor.set & FB_CUR_SETSIZE || |
290 | vc->vc_cursor_type != p->cursor_shape || | 289 | vc->vc_cursor_type != ops->p->cursor_shape || |
291 | ops->cursor_state.mask == NULL || | 290 | ops->cursor_state.mask == NULL || |
292 | ops->cursor_reset) { | 291 | ops->cursor_reset) { |
293 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); | 292 | char *tmp, *mask = kmalloc(w*vc->vc_font.width, GFP_ATOMIC); |
@@ -307,10 +306,10 @@ static void cw_cursor(struct vc_data *vc, struct fb_info *info, | |||
307 | kfree(ops->cursor_state.mask); | 306 | kfree(ops->cursor_state.mask); |
308 | ops->cursor_state.mask = mask; | 307 | ops->cursor_state.mask = mask; |
309 | 308 | ||
310 | p->cursor_shape = vc->vc_cursor_type; | 309 | ops->p->cursor_shape = vc->vc_cursor_type; |
311 | cursor.set |= FB_CUR_SETSHAPE; | 310 | cursor.set |= FB_CUR_SETSHAPE; |
312 | 311 | ||
313 | switch (p->cursor_shape & CUR_HWMASK) { | 312 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
314 | case CUR_NONE: | 313 | case CUR_NONE: |
315 | cur_height = 0; | 314 | cur_height = 0; |
316 | break; | 315 | break; |
diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/console/fbcon_rotate.c index ec0dd8fe241c..2dc091fbd5c9 100644 --- a/drivers/video/console/fbcon_rotate.c +++ b/drivers/video/console/fbcon_rotate.c | |||
@@ -18,8 +18,7 @@ | |||
18 | #include "fbcon.h" | 18 | #include "fbcon.h" |
19 | #include "fbcon_rotate.h" | 19 | #include "fbcon_rotate.h" |
20 | 20 | ||
21 | static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc, | 21 | static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc) |
22 | struct display *p) | ||
23 | { | 22 | { |
24 | struct fbcon_ops *ops = info->fbcon_par; | 23 | struct fbcon_ops *ops = info->fbcon_par; |
25 | int len, err = 0; | 24 | int len, err = 0; |
@@ -28,12 +27,12 @@ static int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc, | |||
28 | u8 *dst; | 27 | u8 *dst; |
29 | 28 | ||
30 | if (vc->vc_font.data == ops->fontdata && | 29 | if (vc->vc_font.data == ops->fontdata && |
31 | p->con_rotate == ops->cur_rotate) | 30 | ops->p->con_rotate == ops->cur_rotate) |
32 | goto finished; | 31 | goto finished; |
33 | 32 | ||
34 | src = ops->fontdata = vc->vc_font.data; | 33 | src = ops->fontdata = vc->vc_font.data; |
35 | ops->cur_rotate = p->con_rotate; | 34 | ops->cur_rotate = ops->p->con_rotate; |
36 | len = (!p->userfont) ? 256 : FNTCHARCNT(src); | 35 | len = (!ops->p->userfont) ? 256 : FNTCHARCNT(src); |
37 | s_cellsize = ((vc->vc_font.width + 7)/8) * | 36 | s_cellsize = ((vc->vc_font.width + 7)/8) * |
38 | vc->vc_font.height; | 37 | vc->vc_font.height; |
39 | d_cellsize = s_cellsize; | 38 | d_cellsize = s_cellsize; |
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/console/fbcon_rotate.h index 1b8f92fdc6a8..75be5ce53dc5 100644 --- a/drivers/video/console/fbcon_rotate.h +++ b/drivers/video/console/fbcon_rotate.h | |||
@@ -11,8 +11,6 @@ | |||
11 | #ifndef _FBCON_ROTATE_H | 11 | #ifndef _FBCON_ROTATE_H |
12 | #define _FBCON_ROTATE_H | 12 | #define _FBCON_ROTATE_H |
13 | 13 | ||
14 | #define FNTCHARCNT(fd) (((int *)(fd))[-3]) | ||
15 | |||
16 | #define GETVYRES(s,i) ({ \ | 14 | #define GETVYRES(s,i) ({ \ |
17 | (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ | 15 | (s == SCROLL_REDRAW || s == SCROLL_MOVE) ? \ |
18 | (i)->var.yres : (i)->var.yres_virtual; }) | 16 | (i)->var.yres : (i)->var.yres_virtual; }) |
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/console/fbcon_ud.c index 9dd059e8b645..f56ed068a5bc 100644 --- a/drivers/video/console/fbcon_ud.c +++ b/drivers/video/console/fbcon_ud.c | |||
@@ -249,20 +249,19 @@ static void ud_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | static void ud_cursor(struct vc_data *vc, struct fb_info *info, | 252 | static void ud_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
253 | struct display *p, int mode, int softback_lines, | 253 | int softback_lines, int fg, int bg) |
254 | int fg, int bg) | ||
255 | { | 254 | { |
256 | struct fb_cursor cursor; | 255 | struct fb_cursor cursor; |
257 | struct fbcon_ops *ops = (struct fbcon_ops *) info->fbcon_par; | 256 | struct fbcon_ops *ops = info->fbcon_par; |
258 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; | 257 | unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff; |
259 | int w = (vc->vc_font.width + 7) >> 3, c; | 258 | int w = (vc->vc_font.width + 7) >> 3, c; |
260 | int y = real_y(p, vc->vc_y); | 259 | int y = real_y(ops->p, vc->vc_y); |
261 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); | 260 | int attribute, use_sw = (vc->vc_cursor_type & 0x10); |
262 | int err = 1, dx, dy; | 261 | int err = 1, dx, dy; |
263 | char *src; | 262 | char *src; |
264 | u32 vyres = GETVYRES(p->scrollmode, info); | 263 | u32 vyres = GETVYRES(ops->p->scrollmode, info); |
265 | u32 vxres = GETVXRES(p->scrollmode, info); | 264 | u32 vxres = GETVXRES(ops->p->scrollmode, info); |
266 | 265 | ||
267 | if (!ops->fontbuffer) | 266 | if (!ops->fontbuffer) |
268 | return; | 267 | return; |
@@ -334,7 +333,7 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, | |||
334 | } | 333 | } |
335 | 334 | ||
336 | if (cursor.set & FB_CUR_SETSIZE || | 335 | if (cursor.set & FB_CUR_SETSIZE || |
337 | vc->vc_cursor_type != p->cursor_shape || | 336 | vc->vc_cursor_type != ops->p->cursor_shape || |
338 | ops->cursor_state.mask == NULL || | 337 | ops->cursor_state.mask == NULL || |
339 | ops->cursor_reset) { | 338 | ops->cursor_reset) { |
340 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); | 339 | char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC); |
@@ -347,10 +346,10 @@ static void ud_cursor(struct vc_data *vc, struct fb_info *info, | |||
347 | kfree(ops->cursor_state.mask); | 346 | kfree(ops->cursor_state.mask); |
348 | ops->cursor_state.mask = mask; | 347 | ops->cursor_state.mask = mask; |
349 | 348 | ||
350 | p->cursor_shape = vc->vc_cursor_type; | 349 | ops->p->cursor_shape = vc->vc_cursor_type; |
351 | cursor.set |= FB_CUR_SETSHAPE; | 350 | cursor.set |= FB_CUR_SETSHAPE; |
352 | 351 | ||
353 | switch (p->cursor_shape & CUR_HWMASK) { | 352 | switch (ops->p->cursor_shape & CUR_HWMASK) { |
354 | case CUR_NONE: | 353 | case CUR_NONE: |
355 | cur_height = 0; | 354 | cur_height = 0; |
356 | break; | 355 | break; |
diff --git a/drivers/video/console/softcursor.c b/drivers/video/console/softcursor.c index 8529bf08db28..3957fc7523e2 100644 --- a/drivers/video/console/softcursor.c +++ b/drivers/video/console/softcursor.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
19 | 19 | ||
20 | #include "fbcon.h" | ||
21 | |||
20 | int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) | 22 | int soft_cursor(struct fb_info *info, struct fb_cursor *cursor) |
21 | { | 23 | { |
22 | unsigned int scan_align = info->pixmap.scan_align - 1; | 24 | unsigned int scan_align = info->pixmap.scan_align - 1; |
diff --git a/drivers/video/console/tileblit.c b/drivers/video/console/tileblit.c index cb25324a5635..153352ca9461 100644 --- a/drivers/video/console/tileblit.c +++ b/drivers/video/console/tileblit.c | |||
@@ -80,9 +80,8 @@ static void tile_clear_margins(struct vc_data *vc, struct fb_info *info, | |||
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | static void tile_cursor(struct vc_data *vc, struct fb_info *info, | 83 | static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode, |
84 | struct display *p, int mode, int softback_lines, | 84 | int softback_lines, int fg, int bg) |
85 | int fg, int bg) | ||
86 | { | 85 | { |
87 | struct fb_tilecursor cursor; | 86 | struct fb_tilecursor cursor; |
88 | int use_sw = (vc->vc_cursor_type & 0x01); | 87 | int use_sw = (vc->vc_cursor_type & 0x01); |
@@ -130,10 +129,10 @@ static int tile_update_start(struct fb_info *info) | |||
130 | return err; | 129 | return err; |
131 | } | 130 | } |
132 | 131 | ||
133 | void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | 132 | void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info) |
134 | struct display *p, struct fbcon_ops *ops) | ||
135 | { | 133 | { |
136 | struct fb_tilemap map; | 134 | struct fb_tilemap map; |
135 | struct fbcon_ops *ops = info->fbcon_par; | ||
137 | 136 | ||
138 | ops->bmove = tile_bmove; | 137 | ops->bmove = tile_bmove; |
139 | ops->clear = tile_clear; | 138 | ops->clear = tile_clear; |
@@ -142,13 +141,13 @@ void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info, | |||
142 | ops->cursor = tile_cursor; | 141 | ops->cursor = tile_cursor; |
143 | ops->update_start = tile_update_start; | 142 | ops->update_start = tile_update_start; |
144 | 143 | ||
145 | if (p) { | 144 | if (ops->p) { |
146 | map.width = vc->vc_font.width; | 145 | map.width = vc->vc_font.width; |
147 | map.height = vc->vc_font.height; | 146 | map.height = vc->vc_font.height; |
148 | map.depth = 1; | 147 | map.depth = 1; |
149 | map.length = (p->userfont) ? | 148 | map.length = (ops->p->userfont) ? |
150 | FNTCHARCNT(p->fontdata) : 256; | 149 | FNTCHARCNT(ops->p->fontdata) : 256; |
151 | map.data = p->fontdata; | 150 | map.data = ops->p->fontdata; |
152 | info->tileops->fb_settile(info, &map); | 151 | info->tileops->fb_settile(info, &map); |
153 | } | 152 | } |
154 | } | 153 | } |
diff --git a/drivers/video/fbcvt.c b/drivers/video/fbcvt.c index 0b6af00d197e..ac90883dc3aa 100644 --- a/drivers/video/fbcvt.c +++ b/drivers/video/fbcvt.c | |||
@@ -214,12 +214,11 @@ static void fb_cvt_print_name(struct fb_cvt_data *cvt) | |||
214 | { | 214 | { |
215 | u32 pixcount, pixcount_mod; | 215 | u32 pixcount, pixcount_mod; |
216 | int cnt = 255, offset = 0, read = 0; | 216 | int cnt = 255, offset = 0, read = 0; |
217 | u8 *buf = kmalloc(256, GFP_KERNEL); | 217 | u8 *buf = kzalloc(256, GFP_KERNEL); |
218 | 218 | ||
219 | if (!buf) | 219 | if (!buf) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | memset(buf, 0, 256); | ||
223 | pixcount = (cvt->xres * (cvt->yres/cvt->interlace))/1000000; | 222 | pixcount = (cvt->xres * (cvt->yres/cvt->interlace))/1000000; |
224 | pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; | 223 | pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; |
225 | pixcount_mod /= 1000; | 224 | pixcount_mod /= 1000; |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 10dfdf035264..32a9b69becc5 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -589,17 +589,19 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
589 | return info->fbops->fb_read(file, buf, count, ppos); | 589 | return info->fbops->fb_read(file, buf, count, ppos); |
590 | 590 | ||
591 | total_size = info->screen_size; | 591 | total_size = info->screen_size; |
592 | |||
592 | if (total_size == 0) | 593 | if (total_size == 0) |
593 | total_size = info->fix.smem_len; | 594 | total_size = info->fix.smem_len; |
594 | 595 | ||
595 | if (p >= total_size) | 596 | if (p >= total_size) |
596 | return 0; | 597 | return 0; |
598 | |||
597 | if (count >= total_size) | 599 | if (count >= total_size) |
598 | count = total_size; | 600 | count = total_size; |
601 | |||
599 | if (count + p > total_size) | 602 | if (count + p > total_size) |
600 | count = total_size - p; | 603 | count = total_size - p; |
601 | 604 | ||
602 | cnt = 0; | ||
603 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, | 605 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, |
604 | GFP_KERNEL); | 606 | GFP_KERNEL); |
605 | if (!buffer) | 607 | if (!buffer) |
@@ -636,6 +638,7 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
636 | } | 638 | } |
637 | 639 | ||
638 | kfree(buffer); | 640 | kfree(buffer); |
641 | |||
639 | return (err) ? err : cnt; | 642 | return (err) ? err : cnt; |
640 | } | 643 | } |
641 | 644 | ||
@@ -648,7 +651,7 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
648 | struct fb_info *info = registered_fb[fbidx]; | 651 | struct fb_info *info = registered_fb[fbidx]; |
649 | u32 *buffer, *src; | 652 | u32 *buffer, *src; |
650 | u32 __iomem *dst; | 653 | u32 __iomem *dst; |
651 | int c, i, cnt = 0, err; | 654 | int c, i, cnt = 0, err = 0; |
652 | unsigned long total_size; | 655 | unsigned long total_size; |
653 | 656 | ||
654 | if (!info || !info->screen_base) | 657 | if (!info || !info->screen_base) |
@@ -661,19 +664,19 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
661 | return info->fbops->fb_write(file, buf, count, ppos); | 664 | return info->fbops->fb_write(file, buf, count, ppos); |
662 | 665 | ||
663 | total_size = info->screen_size; | 666 | total_size = info->screen_size; |
667 | |||
664 | if (total_size == 0) | 668 | if (total_size == 0) |
665 | total_size = info->fix.smem_len; | 669 | total_size = info->fix.smem_len; |
666 | 670 | ||
667 | if (p > total_size) | 671 | if (p > total_size) |
668 | return -ENOSPC; | 672 | return 0; |
673 | |||
669 | if (count >= total_size) | 674 | if (count >= total_size) |
670 | count = total_size; | 675 | count = total_size; |
671 | err = 0; | 676 | |
672 | if (count + p > total_size) { | 677 | if (count + p > total_size) |
673 | count = total_size - p; | 678 | count = total_size - p; |
674 | err = -ENOSPC; | 679 | |
675 | } | ||
676 | cnt = 0; | ||
677 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, | 680 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, |
678 | GFP_KERNEL); | 681 | GFP_KERNEL); |
679 | if (!buffer) | 682 | if (!buffer) |
@@ -687,12 +690,15 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
687 | while (count) { | 690 | while (count) { |
688 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; | 691 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; |
689 | src = buffer; | 692 | src = buffer; |
693 | |||
690 | if (copy_from_user(src, buf, c)) { | 694 | if (copy_from_user(src, buf, c)) { |
691 | err = -EFAULT; | 695 | err = -EFAULT; |
692 | break; | 696 | break; |
693 | } | 697 | } |
698 | |||
694 | for (i = c >> 2; i--; ) | 699 | for (i = c >> 2; i--; ) |
695 | fb_writel(*src++, dst++); | 700 | fb_writel(*src++, dst++); |
701 | |||
696 | if (c & 3) { | 702 | if (c & 3) { |
697 | u8 *src8 = (u8 *) src; | 703 | u8 *src8 = (u8 *) src; |
698 | u8 __iomem *dst8 = (u8 __iomem *) dst; | 704 | u8 __iomem *dst8 = (u8 __iomem *) dst; |
@@ -702,11 +708,13 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
702 | 708 | ||
703 | dst = (u32 __iomem *) dst8; | 709 | dst = (u32 __iomem *) dst8; |
704 | } | 710 | } |
711 | |||
705 | *ppos += c; | 712 | *ppos += c; |
706 | buf += c; | 713 | buf += c; |
707 | cnt += c; | 714 | cnt += c; |
708 | count -= c; | 715 | count -= c; |
709 | } | 716 | } |
717 | |||
710 | kfree(buffer); | 718 | kfree(buffer); |
711 | 719 | ||
712 | return (err) ? err : cnt; | 720 | return (err) ? err : cnt; |
@@ -1226,6 +1234,7 @@ fb_open(struct inode *inode, struct file *file) | |||
1226 | return -ENODEV; | 1234 | return -ENODEV; |
1227 | if (!try_module_get(info->fbops->owner)) | 1235 | if (!try_module_get(info->fbops->owner)) |
1228 | return -ENODEV; | 1236 | return -ENODEV; |
1237 | file->private_data = info; | ||
1229 | if (info->fbops->fb_open) { | 1238 | if (info->fbops->fb_open) { |
1230 | res = info->fbops->fb_open(info,1); | 1239 | res = info->fbops->fb_open(info,1); |
1231 | if (res) | 1240 | if (res) |
@@ -1237,11 +1246,9 @@ fb_open(struct inode *inode, struct file *file) | |||
1237 | static int | 1246 | static int |
1238 | fb_release(struct inode *inode, struct file *file) | 1247 | fb_release(struct inode *inode, struct file *file) |
1239 | { | 1248 | { |
1240 | int fbidx = iminor(inode); | 1249 | struct fb_info * const info = file->private_data; |
1241 | struct fb_info *info; | ||
1242 | 1250 | ||
1243 | lock_kernel(); | 1251 | lock_kernel(); |
1244 | info = registered_fb[fbidx]; | ||
1245 | if (info->fbops->fb_release) | 1252 | if (info->fbops->fb_release) |
1246 | info->fbops->fb_release(info,1); | 1253 | info->fbops->fb_release(info,1); |
1247 | module_put(info->fbops->owner); | 1254 | module_put(info->fbops->owner); |
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index fc7965b66775..7c74e7325d95 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c | |||
@@ -317,26 +317,29 @@ static int edid_is_monitor_block(unsigned char *block) | |||
317 | static void calc_mode_timings(int xres, int yres, int refresh, | 317 | static void calc_mode_timings(int xres, int yres, int refresh, |
318 | struct fb_videomode *mode) | 318 | struct fb_videomode *mode) |
319 | { | 319 | { |
320 | struct fb_var_screeninfo var; | 320 | struct fb_var_screeninfo *var; |
321 | struct fb_info info; | ||
322 | 321 | ||
323 | memset(&var, 0, sizeof(struct fb_var_screeninfo)); | 322 | var = kzalloc(sizeof(struct fb_var_screeninfo), GFP_KERNEL); |
324 | var.xres = xres; | 323 | |
325 | var.yres = yres; | 324 | if (var) { |
326 | fb_get_mode(FB_VSYNCTIMINGS | FB_IGNOREMON, | 325 | var->xres = xres; |
327 | refresh, &var, &info); | 326 | var->yres = yres; |
328 | mode->xres = xres; | 327 | fb_get_mode(FB_VSYNCTIMINGS | FB_IGNOREMON, |
329 | mode->yres = yres; | 328 | refresh, var, NULL); |
330 | mode->pixclock = var.pixclock; | 329 | mode->xres = xres; |
331 | mode->refresh = refresh; | 330 | mode->yres = yres; |
332 | mode->left_margin = var.left_margin; | 331 | mode->pixclock = var->pixclock; |
333 | mode->right_margin = var.right_margin; | 332 | mode->refresh = refresh; |
334 | mode->upper_margin = var.upper_margin; | 333 | mode->left_margin = var->left_margin; |
335 | mode->lower_margin = var.lower_margin; | 334 | mode->right_margin = var->right_margin; |
336 | mode->hsync_len = var.hsync_len; | 335 | mode->upper_margin = var->upper_margin; |
337 | mode->vsync_len = var.vsync_len; | 336 | mode->lower_margin = var->lower_margin; |
338 | mode->vmode = 0; | 337 | mode->hsync_len = var->hsync_len; |
339 | mode->sync = 0; | 338 | mode->vsync_len = var->vsync_len; |
339 | mode->vmode = 0; | ||
340 | mode->sync = 0; | ||
341 | kfree(var); | ||
342 | } | ||
340 | } | 343 | } |
341 | 344 | ||
342 | static int get_est_timing(unsigned char *block, struct fb_videomode *mode) | 345 | static int get_est_timing(unsigned char *block, struct fb_videomode *mode) |
@@ -525,10 +528,9 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize) | |||
525 | unsigned char *block; | 528 | unsigned char *block; |
526 | int num = 0, i; | 529 | int num = 0, i; |
527 | 530 | ||
528 | mode = kmalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); | 531 | mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); |
529 | if (mode == NULL) | 532 | if (mode == NULL) |
530 | return NULL; | 533 | return NULL; |
531 | memset(mode, 0, 50 * sizeof(struct fb_videomode)); | ||
532 | 534 | ||
533 | if (edid == NULL || !edid_checksum(edid) || | 535 | if (edid == NULL || !edid_checksum(edid) || |
534 | !edid_check_header(edid)) { | 536 | !edid_check_header(edid)) { |
@@ -1105,15 +1107,21 @@ static void fb_timings_dclk(struct __fb_timings *timings) | |||
1105 | */ | 1107 | */ |
1106 | int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_info *info) | 1108 | int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_info *info) |
1107 | { | 1109 | { |
1108 | struct __fb_timings timings; | 1110 | struct __fb_timings *timings; |
1109 | u32 interlace = 1, dscan = 1; | 1111 | u32 interlace = 1, dscan = 1; |
1110 | u32 hfmin, hfmax, vfmin, vfmax, dclkmin, dclkmax; | 1112 | u32 hfmin, hfmax, vfmin, vfmax, dclkmin, dclkmax, err = 0; |
1113 | |||
1114 | |||
1115 | timings = kzalloc(sizeof(struct __fb_timings), GFP_KERNEL); | ||
1116 | |||
1117 | if (!timings) | ||
1118 | return -ENOMEM; | ||
1111 | 1119 | ||
1112 | /* | 1120 | /* |
1113 | * If monspecs are invalid, use values that are enough | 1121 | * If monspecs are invalid, use values that are enough |
1114 | * for 640x480@60 | 1122 | * for 640x480@60 |
1115 | */ | 1123 | */ |
1116 | if (!info->monspecs.hfmax || !info->monspecs.vfmax || | 1124 | if (!info || !info->monspecs.hfmax || !info->monspecs.vfmax || |
1117 | !info->monspecs.dclkmax || | 1125 | !info->monspecs.dclkmax || |
1118 | info->monspecs.hfmax < info->monspecs.hfmin || | 1126 | info->monspecs.hfmax < info->monspecs.hfmin || |
1119 | info->monspecs.vfmax < info->monspecs.vfmin || | 1127 | info->monspecs.vfmax < info->monspecs.vfmin || |
@@ -1130,65 +1138,66 @@ int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var, struct fb_inf | |||
1130 | dclkmax = info->monspecs.dclkmax; | 1138 | dclkmax = info->monspecs.dclkmax; |
1131 | } | 1139 | } |
1132 | 1140 | ||
1133 | memset(&timings, 0, sizeof(struct __fb_timings)); | 1141 | timings->hactive = var->xres; |
1134 | timings.hactive = var->xres; | 1142 | timings->vactive = var->yres; |
1135 | timings.vactive = var->yres; | ||
1136 | if (var->vmode & FB_VMODE_INTERLACED) { | 1143 | if (var->vmode & FB_VMODE_INTERLACED) { |
1137 | timings.vactive /= 2; | 1144 | timings->vactive /= 2; |
1138 | interlace = 2; | 1145 | interlace = 2; |
1139 | } | 1146 | } |
1140 | if (var->vmode & FB_VMODE_DOUBLE) { | 1147 | if (var->vmode & FB_VMODE_DOUBLE) { |
1141 | timings.vactive *= 2; | 1148 | timings->vactive *= 2; |
1142 | dscan = 2; | 1149 | dscan = 2; |
1143 | } | 1150 | } |
1144 | 1151 | ||
1145 | switch (flags & ~FB_IGNOREMON) { | 1152 | switch (flags & ~FB_IGNOREMON) { |
1146 | case FB_MAXTIMINGS: /* maximize refresh rate */ | 1153 | case FB_MAXTIMINGS: /* maximize refresh rate */ |
1147 | timings.hfreq = hfmax; | 1154 | timings->hfreq = hfmax; |
1148 | fb_timings_hfreq(&timings); | 1155 | fb_timings_hfreq(timings); |
1149 | if (timings.vfreq > vfmax) { | 1156 | if (timings->vfreq > vfmax) { |
1150 | timings.vfreq = vfmax; | 1157 | timings->vfreq = vfmax; |
1151 | fb_timings_vfreq(&timings); | 1158 | fb_timings_vfreq(timings); |
1152 | } | 1159 | } |
1153 | if (timings.dclk > dclkmax) { | 1160 | if (timings->dclk > dclkmax) { |
1154 | timings.dclk = dclkmax; | 1161 | timings->dclk = dclkmax; |
1155 | fb_timings_dclk(&timings); | 1162 | fb_timings_dclk(timings); |
1156 | } | 1163 | } |
1157 | break; | 1164 | break; |
1158 | case FB_VSYNCTIMINGS: /* vrefresh driven */ | 1165 | case FB_VSYNCTIMINGS: /* vrefresh driven */ |
1159 | timings.vfreq = val; | 1166 | timings->vfreq = val; |
1160 | fb_timings_vfreq(&timings); | 1167 | fb_timings_vfreq(timings); |
1161 | break; | 1168 | break; |
1162 | case FB_HSYNCTIMINGS: /* hsync driven */ | 1169 | case FB_HSYNCTIMINGS: /* hsync driven */ |
1163 | timings.hfreq = val; | 1170 | timings->hfreq = val; |
1164 | fb_timings_hfreq(&timings); | 1171 | fb_timings_hfreq(timings); |
1165 | break; | 1172 | break; |
1166 | case FB_DCLKTIMINGS: /* pixelclock driven */ | 1173 | case FB_DCLKTIMINGS: /* pixelclock driven */ |
1167 | timings.dclk = PICOS2KHZ(val) * 1000; | 1174 | timings->dclk = PICOS2KHZ(val) * 1000; |
1168 | fb_timings_dclk(&timings); | 1175 | fb_timings_dclk(timings); |
1169 | break; | 1176 | break; |
1170 | default: | 1177 | default: |
1171 | return -EINVAL; | 1178 | err = -EINVAL; |
1172 | 1179 | ||
1173 | } | 1180 | } |
1174 | 1181 | ||
1175 | if (!(flags & FB_IGNOREMON) && | 1182 | if (err || (!(flags & FB_IGNOREMON) && |
1176 | (timings.vfreq < vfmin || timings.vfreq > vfmax || | 1183 | (timings->vfreq < vfmin || timings->vfreq > vfmax || |
1177 | timings.hfreq < hfmin || timings.hfreq > hfmax || | 1184 | timings->hfreq < hfmin || timings->hfreq > hfmax || |
1178 | timings.dclk < dclkmin || timings.dclk > dclkmax)) | 1185 | timings->dclk < dclkmin || timings->dclk > dclkmax))) { |
1179 | return -EINVAL; | 1186 | err = -EINVAL; |
1180 | 1187 | } else { | |
1181 | var->pixclock = KHZ2PICOS(timings.dclk/1000); | 1188 | var->pixclock = KHZ2PICOS(timings->dclk/1000); |
1182 | var->hsync_len = (timings.htotal * 8)/100; | 1189 | var->hsync_len = (timings->htotal * 8)/100; |
1183 | var->right_margin = (timings.hblank/2) - var->hsync_len; | 1190 | var->right_margin = (timings->hblank/2) - var->hsync_len; |
1184 | var->left_margin = timings.hblank - var->right_margin - var->hsync_len; | 1191 | var->left_margin = timings->hblank - var->right_margin - |
1185 | 1192 | var->hsync_len; | |
1186 | var->vsync_len = (3 * interlace)/dscan; | 1193 | var->vsync_len = (3 * interlace)/dscan; |
1187 | var->lower_margin = (1 * interlace)/dscan; | 1194 | var->lower_margin = (1 * interlace)/dscan; |
1188 | var->upper_margin = (timings.vblank * interlace)/dscan - | 1195 | var->upper_margin = (timings->vblank * interlace)/dscan - |
1189 | (var->vsync_len + var->lower_margin); | 1196 | (var->vsync_len + var->lower_margin); |
1197 | } | ||
1190 | 1198 | ||
1191 | return 0; | 1199 | kfree(timings); |
1200 | return err; | ||
1192 | } | 1201 | } |
1193 | #else | 1202 | #else |
1194 | int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) | 1203 | int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var) |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 08dac9580d15..6d26057337e2 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -43,10 +43,11 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) | |||
43 | if (size) | 43 | if (size) |
44 | fb_info_size += PADDING; | 44 | fb_info_size += PADDING; |
45 | 45 | ||
46 | p = kmalloc(fb_info_size + size, GFP_KERNEL); | 46 | p = kzalloc(fb_info_size + size, GFP_KERNEL); |
47 | |||
47 | if (!p) | 48 | if (!p) |
48 | return NULL; | 49 | return NULL; |
49 | memset(p, 0, fb_info_size + size); | 50 | |
50 | info = (struct fb_info *) p; | 51 | info = (struct fb_info *) p; |
51 | 52 | ||
52 | if (size) | 53 | if (size) |
@@ -106,8 +107,7 @@ static int mode_string(char *buf, unsigned int offset, | |||
106 | static ssize_t store_mode(struct class_device *class_device, const char * buf, | 107 | static ssize_t store_mode(struct class_device *class_device, const char * buf, |
107 | size_t count) | 108 | size_t count) |
108 | { | 109 | { |
109 | struct fb_info *fb_info = | 110 | struct fb_info *fb_info = class_get_devdata(class_device); |
110 | (struct fb_info *)class_get_devdata(class_device); | ||
111 | char mstr[100]; | 111 | char mstr[100]; |
112 | struct fb_var_screeninfo var; | 112 | struct fb_var_screeninfo var; |
113 | struct fb_modelist *modelist; | 113 | struct fb_modelist *modelist; |
@@ -137,8 +137,7 @@ static ssize_t store_mode(struct class_device *class_device, const char * buf, | |||
137 | 137 | ||
138 | static ssize_t show_mode(struct class_device *class_device, char *buf) | 138 | static ssize_t show_mode(struct class_device *class_device, char *buf) |
139 | { | 139 | { |
140 | struct fb_info *fb_info = | 140 | struct fb_info *fb_info = class_get_devdata(class_device); |
141 | (struct fb_info *)class_get_devdata(class_device); | ||
142 | 141 | ||
143 | if (!fb_info->mode) | 142 | if (!fb_info->mode) |
144 | return 0; | 143 | return 0; |
@@ -149,8 +148,7 @@ static ssize_t show_mode(struct class_device *class_device, char *buf) | |||
149 | static ssize_t store_modes(struct class_device *class_device, const char * buf, | 148 | static ssize_t store_modes(struct class_device *class_device, const char * buf, |
150 | size_t count) | 149 | size_t count) |
151 | { | 150 | { |
152 | struct fb_info *fb_info = | 151 | struct fb_info *fb_info = class_get_devdata(class_device); |
153 | (struct fb_info *)class_get_devdata(class_device); | ||
154 | LIST_HEAD(old_list); | 152 | LIST_HEAD(old_list); |
155 | int i = count / sizeof(struct fb_videomode); | 153 | int i = count / sizeof(struct fb_videomode); |
156 | 154 | ||
@@ -174,8 +172,7 @@ static ssize_t store_modes(struct class_device *class_device, const char * buf, | |||
174 | 172 | ||
175 | static ssize_t show_modes(struct class_device *class_device, char *buf) | 173 | static ssize_t show_modes(struct class_device *class_device, char *buf) |
176 | { | 174 | { |
177 | struct fb_info *fb_info = | 175 | struct fb_info *fb_info = class_get_devdata(class_device); |
178 | (struct fb_info *)class_get_devdata(class_device); | ||
179 | unsigned int i; | 176 | unsigned int i; |
180 | struct list_head *pos; | 177 | struct list_head *pos; |
181 | struct fb_modelist *modelist; | 178 | struct fb_modelist *modelist; |
@@ -193,8 +190,7 @@ static ssize_t show_modes(struct class_device *class_device, char *buf) | |||
193 | static ssize_t store_bpp(struct class_device *class_device, const char * buf, | 190 | static ssize_t store_bpp(struct class_device *class_device, const char * buf, |
194 | size_t count) | 191 | size_t count) |
195 | { | 192 | { |
196 | struct fb_info *fb_info = | 193 | struct fb_info *fb_info = class_get_devdata(class_device); |
197 | (struct fb_info *)class_get_devdata(class_device); | ||
198 | struct fb_var_screeninfo var; | 194 | struct fb_var_screeninfo var; |
199 | char ** last = NULL; | 195 | char ** last = NULL; |
200 | int err; | 196 | int err; |
@@ -208,8 +204,7 @@ static ssize_t store_bpp(struct class_device *class_device, const char * buf, | |||
208 | 204 | ||
209 | static ssize_t show_bpp(struct class_device *class_device, char *buf) | 205 | static ssize_t show_bpp(struct class_device *class_device, char *buf) |
210 | { | 206 | { |
211 | struct fb_info *fb_info = | 207 | struct fb_info *fb_info = class_get_devdata(class_device); |
212 | (struct fb_info *)class_get_devdata(class_device); | ||
213 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.bits_per_pixel); | 208 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->var.bits_per_pixel); |
214 | } | 209 | } |
215 | 210 | ||
@@ -280,8 +275,7 @@ static ssize_t show_con_rotate(struct class_device *class_device, char *buf) | |||
280 | static ssize_t store_virtual(struct class_device *class_device, | 275 | static ssize_t store_virtual(struct class_device *class_device, |
281 | const char * buf, size_t count) | 276 | const char * buf, size_t count) |
282 | { | 277 | { |
283 | struct fb_info *fb_info = | 278 | struct fb_info *fb_info = class_get_devdata(class_device); |
284 | (struct fb_info *)class_get_devdata(class_device); | ||
285 | struct fb_var_screeninfo var; | 279 | struct fb_var_screeninfo var; |
286 | char *last = NULL; | 280 | char *last = NULL; |
287 | int err; | 281 | int err; |
@@ -300,16 +294,14 @@ static ssize_t store_virtual(struct class_device *class_device, | |||
300 | 294 | ||
301 | static ssize_t show_virtual(struct class_device *class_device, char *buf) | 295 | static ssize_t show_virtual(struct class_device *class_device, char *buf) |
302 | { | 296 | { |
303 | struct fb_info *fb_info = | 297 | struct fb_info *fb_info = class_get_devdata(class_device); |
304 | (struct fb_info *)class_get_devdata(class_device); | ||
305 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xres_virtual, | 298 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xres_virtual, |
306 | fb_info->var.yres_virtual); | 299 | fb_info->var.yres_virtual); |
307 | } | 300 | } |
308 | 301 | ||
309 | static ssize_t show_stride(struct class_device *class_device, char *buf) | 302 | static ssize_t show_stride(struct class_device *class_device, char *buf) |
310 | { | 303 | { |
311 | struct fb_info *fb_info = | 304 | struct fb_info *fb_info = class_get_devdata(class_device); |
312 | (struct fb_info *)class_get_devdata(class_device); | ||
313 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); | 305 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->fix.line_length); |
314 | } | 306 | } |
315 | 307 | ||
@@ -320,7 +312,7 @@ static ssize_t show_stride(struct class_device *class_device, char *buf) | |||
320 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, | 312 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, |
321 | size_t count) | 313 | size_t count) |
322 | { | 314 | { |
323 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 315 | struct fb_info *fb_info = class_get_devdata(class_device); |
324 | int rc, i, start, length, transp = 0; | 316 | int rc, i, start, length, transp = 0; |
325 | 317 | ||
326 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) | 318 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) |
@@ -380,8 +372,7 @@ static ssize_t store_cmap(struct class_device *class_device, const char *buf, | |||
380 | 372 | ||
381 | static ssize_t show_cmap(struct class_device *class_device, char *buf) | 373 | static ssize_t show_cmap(struct class_device *class_device, char *buf) |
382 | { | 374 | { |
383 | struct fb_info *fb_info = | 375 | struct fb_info *fb_info = class_get_devdata(class_device); |
384 | (struct fb_info *)class_get_devdata(class_device); | ||
385 | unsigned int i; | 376 | unsigned int i; |
386 | 377 | ||
387 | if (!fb_info->cmap.red || !fb_info->cmap.blue || | 378 | if (!fb_info->cmap.red || !fb_info->cmap.blue || |
@@ -405,8 +396,7 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf) | |||
405 | static ssize_t store_blank(struct class_device *class_device, const char * buf, | 396 | static ssize_t store_blank(struct class_device *class_device, const char * buf, |
406 | size_t count) | 397 | size_t count) |
407 | { | 398 | { |
408 | struct fb_info *fb_info = | 399 | struct fb_info *fb_info = class_get_devdata(class_device); |
409 | (struct fb_info *)class_get_devdata(class_device); | ||
410 | char *last = NULL; | 400 | char *last = NULL; |
411 | int err; | 401 | int err; |
412 | 402 | ||
@@ -422,41 +412,40 @@ static ssize_t store_blank(struct class_device *class_device, const char * buf, | |||
422 | 412 | ||
423 | static ssize_t show_blank(struct class_device *class_device, char *buf) | 413 | static ssize_t show_blank(struct class_device *class_device, char *buf) |
424 | { | 414 | { |
425 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 415 | // struct fb_info *fb_info = class_get_devdata(class_device); |
426 | return 0; | 416 | return 0; |
427 | } | 417 | } |
428 | 418 | ||
429 | static ssize_t store_console(struct class_device *class_device, | 419 | static ssize_t store_console(struct class_device *class_device, |
430 | const char * buf, size_t count) | 420 | const char * buf, size_t count) |
431 | { | 421 | { |
432 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 422 | // struct fb_info *fb_info = class_get_devdata(class_device); |
433 | return 0; | 423 | return 0; |
434 | } | 424 | } |
435 | 425 | ||
436 | static ssize_t show_console(struct class_device *class_device, char *buf) | 426 | static ssize_t show_console(struct class_device *class_device, char *buf) |
437 | { | 427 | { |
438 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 428 | // struct fb_info *fb_info = class_get_devdata(class_device); |
439 | return 0; | 429 | return 0; |
440 | } | 430 | } |
441 | 431 | ||
442 | static ssize_t store_cursor(struct class_device *class_device, | 432 | static ssize_t store_cursor(struct class_device *class_device, |
443 | const char * buf, size_t count) | 433 | const char * buf, size_t count) |
444 | { | 434 | { |
445 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 435 | // struct fb_info *fb_info = class_get_devdata(class_device); |
446 | return 0; | 436 | return 0; |
447 | } | 437 | } |
448 | 438 | ||
449 | static ssize_t show_cursor(struct class_device *class_device, char *buf) | 439 | static ssize_t show_cursor(struct class_device *class_device, char *buf) |
450 | { | 440 | { |
451 | // struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 441 | // struct fb_info *fb_info = class_get_devdata(class_device); |
452 | return 0; | 442 | return 0; |
453 | } | 443 | } |
454 | 444 | ||
455 | static ssize_t store_pan(struct class_device *class_device, const char * buf, | 445 | static ssize_t store_pan(struct class_device *class_device, const char * buf, |
456 | size_t count) | 446 | size_t count) |
457 | { | 447 | { |
458 | struct fb_info *fb_info = | 448 | struct fb_info *fb_info = class_get_devdata(class_device); |
459 | (struct fb_info *)class_get_devdata(class_device); | ||
460 | struct fb_var_screeninfo var; | 449 | struct fb_var_screeninfo var; |
461 | char *last = NULL; | 450 | char *last = NULL; |
462 | int err; | 451 | int err; |
@@ -479,19 +468,40 @@ static ssize_t store_pan(struct class_device *class_device, const char * buf, | |||
479 | 468 | ||
480 | static ssize_t show_pan(struct class_device *class_device, char *buf) | 469 | static ssize_t show_pan(struct class_device *class_device, char *buf) |
481 | { | 470 | { |
482 | struct fb_info *fb_info = | 471 | struct fb_info *fb_info = class_get_devdata(class_device); |
483 | (struct fb_info *)class_get_devdata(class_device); | ||
484 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xoffset, | 472 | return snprintf(buf, PAGE_SIZE, "%d,%d\n", fb_info->var.xoffset, |
485 | fb_info->var.xoffset); | 473 | fb_info->var.xoffset); |
486 | } | 474 | } |
487 | 475 | ||
488 | static ssize_t show_name(struct class_device *class_device, char *buf) | 476 | static ssize_t show_name(struct class_device *class_device, char *buf) |
489 | { | 477 | { |
490 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 478 | struct fb_info *fb_info = class_get_devdata(class_device); |
491 | 479 | ||
492 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); | 480 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); |
493 | } | 481 | } |
494 | 482 | ||
483 | static ssize_t store_fbstate(struct class_device *class_device, | ||
484 | const char *buf, size_t count) | ||
485 | { | ||
486 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
487 | u32 state; | ||
488 | char *last = NULL; | ||
489 | |||
490 | state = simple_strtoul(buf, &last, 0); | ||
491 | |||
492 | acquire_console_sem(); | ||
493 | fb_set_suspend(fb_info, (int)state); | ||
494 | release_console_sem(); | ||
495 | |||
496 | return count; | ||
497 | } | ||
498 | |||
499 | static ssize_t show_fbstate(struct class_device *class_device, char *buf) | ||
500 | { | ||
501 | struct fb_info *fb_info = class_get_devdata(class_device); | ||
502 | return snprintf(buf, PAGE_SIZE, "%d\n", fb_info->state); | ||
503 | } | ||
504 | |||
495 | static struct class_device_attribute class_device_attrs[] = { | 505 | static struct class_device_attribute class_device_attrs[] = { |
496 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), | 506 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), |
497 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), | 507 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), |
@@ -507,6 +517,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
507 | __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), | 517 | __ATTR(rotate, S_IRUGO|S_IWUSR, show_rotate, store_rotate), |
508 | __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), | 518 | __ATTR(con_rotate, S_IRUGO|S_IWUSR, show_con_rotate, store_con_rotate), |
509 | __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), | 519 | __ATTR(con_rotate_all, S_IWUSR, NULL, store_con_rotate_all), |
520 | __ATTR(state, S_IRUGO|S_IWUSR, show_fbstate, store_fbstate), | ||
510 | }; | 521 | }; |
511 | 522 | ||
512 | int fb_init_class_device(struct fb_info *fb_info) | 523 | int fb_init_class_device(struct fb_info *fb_info) |
diff --git a/drivers/video/hgafb.c b/drivers/video/hgafb.c index b37cea7d1094..4e39035cf335 100644 --- a/drivers/video/hgafb.c +++ b/drivers/video/hgafb.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/fb.h> | 42 | #include <linux/fb.h> |
43 | #include <linux/init.h> | 43 | #include <linux/init.h> |
44 | #include <linux/ioport.h> | 44 | #include <linux/ioport.h> |
45 | #include <linux/platform_device.h> | ||
45 | #include <asm/io.h> | 46 | #include <asm/io.h> |
46 | #include <asm/vga.h> | 47 | #include <asm/vga.h> |
47 | 48 | ||
@@ -107,7 +108,7 @@ static DEFINE_SPINLOCK(hga_reg_lock); | |||
107 | 108 | ||
108 | /* Framebuffer driver structures */ | 109 | /* Framebuffer driver structures */ |
109 | 110 | ||
110 | static struct fb_var_screeninfo hga_default_var = { | 111 | static struct fb_var_screeninfo __initdata hga_default_var = { |
111 | .xres = 720, | 112 | .xres = 720, |
112 | .yres = 348, | 113 | .yres = 348, |
113 | .xres_virtual = 720, | 114 | .xres_virtual = 720, |
@@ -121,7 +122,7 @@ static struct fb_var_screeninfo hga_default_var = { | |||
121 | .width = -1, | 122 | .width = -1, |
122 | }; | 123 | }; |
123 | 124 | ||
124 | static struct fb_fix_screeninfo hga_fix = { | 125 | static struct fb_fix_screeninfo __initdata hga_fix = { |
125 | .id = "HGA", | 126 | .id = "HGA", |
126 | .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ | 127 | .type = FB_TYPE_PACKED_PIXELS, /* (not sure) */ |
127 | .visual = FB_VISUAL_MONO10, | 128 | .visual = FB_VISUAL_MONO10, |
@@ -131,8 +132,6 @@ static struct fb_fix_screeninfo hga_fix = { | |||
131 | .accel = FB_ACCEL_NONE | 132 | .accel = FB_ACCEL_NONE |
132 | }; | 133 | }; |
133 | 134 | ||
134 | static struct fb_info fb_info; | ||
135 | |||
136 | /* Don't assume that tty1 will be the initial current console. */ | 135 | /* Don't assume that tty1 will be the initial current console. */ |
137 | static int release_io_port = 0; | 136 | static int release_io_port = 0; |
138 | static int release_io_ports = 0; | 137 | static int release_io_ports = 0; |
@@ -549,10 +548,9 @@ static struct fb_ops hgafb_ops = { | |||
549 | * Initialization | 548 | * Initialization |
550 | */ | 549 | */ |
551 | 550 | ||
552 | static int __init hgafb_init(void) | 551 | static int __init hgafb_probe(struct device *device) |
553 | { | 552 | { |
554 | if (fb_get_options("hgafb", NULL)) | 553 | struct fb_info *info; |
555 | return -ENODEV; | ||
556 | 554 | ||
557 | if (! hga_card_detect()) { | 555 | if (! hga_card_detect()) { |
558 | printk(KERN_INFO "hgafb: HGA card not detected.\n"); | 556 | printk(KERN_INFO "hgafb: HGA card not detected.\n"); |
@@ -564,41 +562,95 @@ static int __init hgafb_init(void) | |||
564 | printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", | 562 | printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", |
565 | hga_type_name, hga_vram_len/1024); | 563 | hga_type_name, hga_vram_len/1024); |
566 | 564 | ||
565 | info = framebuffer_alloc(0, NULL); | ||
566 | if (!info) { | ||
567 | iounmap(hga_vram); | ||
568 | return -ENOMEM; | ||
569 | } | ||
570 | |||
567 | hga_fix.smem_start = (unsigned long)hga_vram; | 571 | hga_fix.smem_start = (unsigned long)hga_vram; |
568 | hga_fix.smem_len = hga_vram_len; | 572 | hga_fix.smem_len = hga_vram_len; |
569 | 573 | ||
570 | fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 574 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
571 | fb_info.var = hga_default_var; | 575 | info->var = hga_default_var; |
572 | fb_info.fix = hga_fix; | 576 | info->fix = hga_fix; |
573 | fb_info.monspecs.hfmin = 0; | 577 | info->monspecs.hfmin = 0; |
574 | fb_info.monspecs.hfmax = 0; | 578 | info->monspecs.hfmax = 0; |
575 | fb_info.monspecs.vfmin = 10000; | 579 | info->monspecs.vfmin = 10000; |
576 | fb_info.monspecs.vfmax = 10000; | 580 | info->monspecs.vfmax = 10000; |
577 | fb_info.monspecs.dpms = 0; | 581 | info->monspecs.dpms = 0; |
578 | fb_info.fbops = &hgafb_ops; | 582 | info->fbops = &hgafb_ops; |
579 | fb_info.screen_base = hga_vram; | 583 | info->screen_base = hga_vram; |
580 | 584 | ||
581 | if (register_framebuffer(&fb_info) < 0) { | 585 | if (register_framebuffer(info) < 0) { |
586 | framebuffer_release(info); | ||
582 | iounmap(hga_vram); | 587 | iounmap(hga_vram); |
583 | return -EINVAL; | 588 | return -EINVAL; |
584 | } | 589 | } |
585 | 590 | ||
586 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 591 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
587 | fb_info.node, fb_info.fix.id); | 592 | info->node, info->fix.id); |
593 | dev_set_drvdata(device, info); | ||
588 | return 0; | 594 | return 0; |
589 | } | 595 | } |
590 | 596 | ||
591 | #ifdef MODULE | 597 | static int hgafb_remove(struct device *device) |
592 | static void __exit hgafb_exit(void) | ||
593 | { | 598 | { |
599 | struct fb_info *info = dev_get_drvdata(device); | ||
600 | |||
594 | hga_txt_mode(); | 601 | hga_txt_mode(); |
595 | hga_clear_screen(); | 602 | hga_clear_screen(); |
596 | unregister_framebuffer(&fb_info); | 603 | |
604 | if (info) { | ||
605 | unregister_framebuffer(info); | ||
606 | framebuffer_release(info); | ||
607 | } | ||
608 | |||
597 | iounmap(hga_vram); | 609 | iounmap(hga_vram); |
598 | if (release_io_ports) release_region(0x3b0, 12); | 610 | |
599 | if (release_io_port) release_region(0x3bf, 1); | 611 | if (release_io_ports) |
612 | release_region(0x3b0, 12); | ||
613 | |||
614 | if (release_io_port) | ||
615 | release_region(0x3bf, 1); | ||
616 | |||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static struct device_driver hgafb_driver = { | ||
621 | .name = "hgafb", | ||
622 | .bus = &platform_bus_type, | ||
623 | .probe = hgafb_probe, | ||
624 | .remove = hgafb_remove, | ||
625 | }; | ||
626 | |||
627 | static struct platform_device hgafb_device = { | ||
628 | .name = "hgafb", | ||
629 | }; | ||
630 | |||
631 | static int __init hgafb_init(void) | ||
632 | { | ||
633 | int ret; | ||
634 | |||
635 | if (fb_get_options("hgafb", NULL)) | ||
636 | return -ENODEV; | ||
637 | |||
638 | ret = driver_register(&hgafb_driver); | ||
639 | |||
640 | if (!ret) { | ||
641 | ret = platform_device_register(&hgafb_device); | ||
642 | if (ret) | ||
643 | driver_unregister(&hgafb_driver); | ||
644 | } | ||
645 | |||
646 | return ret; | ||
647 | } | ||
648 | |||
649 | static void __exit hgafb_exit(void) | ||
650 | { | ||
651 | platform_device_unregister(&hgafb_device); | ||
652 | driver_unregister(&hgafb_driver); | ||
600 | } | 653 | } |
601 | #endif | ||
602 | 654 | ||
603 | /* ------------------------------------------------------------------------- | 655 | /* ------------------------------------------------------------------------- |
604 | * | 656 | * |
@@ -613,7 +665,4 @@ MODULE_LICENSE("GPL"); | |||
613 | module_param(nologo, bool, 0); | 665 | module_param(nologo, bool, 0); |
614 | MODULE_PARM_DESC(nologo, "Disables startup logo if != 0 (default=0)"); | 666 | MODULE_PARM_DESC(nologo, "Disables startup logo if != 0 (default=0)"); |
615 | module_init(hgafb_init); | 667 | module_init(hgafb_init); |
616 | |||
617 | #ifdef MODULE | ||
618 | module_exit(hgafb_exit); | 668 | module_exit(hgafb_exit); |
619 | #endif | ||
diff --git a/drivers/video/i810/i810-i2c.c b/drivers/video/i810/i810-i2c.c index c61bad0da20f..bd410e06db73 100644 --- a/drivers/video/i810/i810-i2c.c +++ b/drivers/video/i810/i810-i2c.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/fb.h> | 17 | #include <linux/fb.h> |
18 | #include "i810.h" | 18 | #include "i810.h" |
19 | #include "i810_regs.h" | 19 | #include "i810_regs.h" |
20 | #include "i810_main.h" | ||
20 | #include "../edid.h" | 21 | #include "../edid.h" |
21 | 22 | ||
22 | #define I810_DDC 0x50 | 23 | #define I810_DDC 0x50 |
@@ -42,7 +43,7 @@ | |||
42 | 43 | ||
43 | static void i810i2c_setscl(void *data, int state) | 44 | static void i810i2c_setscl(void *data, int state) |
44 | { | 45 | { |
45 | struct i810fb_i2c_chan *chan = (struct i810fb_i2c_chan *)data; | 46 | struct i810fb_i2c_chan *chan = data; |
46 | struct i810fb_par *par = chan->par; | 47 | struct i810fb_par *par = chan->par; |
47 | u8 __iomem *mmio = par->mmio_start_virtual; | 48 | u8 __iomem *mmio = par->mmio_start_virtual; |
48 | 49 | ||
diff --git a/drivers/video/i810/i810_accel.c b/drivers/video/i810/i810_accel.c index 64cd1c827cf0..76764ea3486a 100644 --- a/drivers/video/i810/i810_accel.c +++ b/drivers/video/i810/i810_accel.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include "i810_regs.h" | 15 | #include "i810_regs.h" |
16 | #include "i810.h" | 16 | #include "i810.h" |
17 | #include "i810_main.h" | ||
17 | 18 | ||
18 | static u32 i810fb_rop[] = { | 19 | static u32 i810fb_rop[] = { |
19 | COLOR_COPY_ROP, /* ROP_COPY */ | 20 | COLOR_COPY_ROP, /* ROP_COPY */ |
@@ -57,7 +58,7 @@ static inline void i810_report_error(u8 __iomem *mmio) | |||
57 | */ | 58 | */ |
58 | static inline int wait_for_space(struct fb_info *info, u32 space) | 59 | static inline int wait_for_space(struct fb_info *info, u32 space) |
59 | { | 60 | { |
60 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 61 | struct i810fb_par *par = info->par; |
61 | u32 head, count = WAIT_COUNT, tail; | 62 | u32 head, count = WAIT_COUNT, tail; |
62 | u8 __iomem *mmio = par->mmio_start_virtual; | 63 | u8 __iomem *mmio = par->mmio_start_virtual; |
63 | 64 | ||
@@ -88,7 +89,7 @@ static inline int wait_for_space(struct fb_info *info, u32 space) | |||
88 | */ | 89 | */ |
89 | static inline int wait_for_engine_idle(struct fb_info *info) | 90 | static inline int wait_for_engine_idle(struct fb_info *info) |
90 | { | 91 | { |
91 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 92 | struct i810fb_par *par = info->par; |
92 | u8 __iomem *mmio = par->mmio_start_virtual; | 93 | u8 __iomem *mmio = par->mmio_start_virtual; |
93 | int count = WAIT_COUNT; | 94 | int count = WAIT_COUNT; |
94 | 95 | ||
@@ -116,7 +117,7 @@ static inline int wait_for_engine_idle(struct fb_info *info) | |||
116 | */ | 117 | */ |
117 | static inline u32 begin_iring(struct fb_info *info, u32 space) | 118 | static inline u32 begin_iring(struct fb_info *info, u32 space) |
118 | { | 119 | { |
119 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 120 | struct i810fb_par *par = info->par; |
120 | 121 | ||
121 | if (par->dev_flags & ALWAYS_SYNC) | 122 | if (par->dev_flags & ALWAYS_SYNC) |
122 | wait_for_engine_idle(info); | 123 | wait_for_engine_idle(info); |
@@ -161,7 +162,7 @@ static inline void source_copy_blit(int dwidth, int dheight, int dpitch, | |||
161 | int xdir, int src, int dest, int rop, | 162 | int xdir, int src, int dest, int rop, |
162 | int blit_bpp, struct fb_info *info) | 163 | int blit_bpp, struct fb_info *info) |
163 | { | 164 | { |
164 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 165 | struct i810fb_par *par = info->par; |
165 | 166 | ||
166 | if (begin_iring(info, 24 + IRING_PAD)) return; | 167 | if (begin_iring(info, 24 + IRING_PAD)) return; |
167 | 168 | ||
@@ -195,7 +196,7 @@ static inline void color_blit(int width, int height, int pitch, int dest, | |||
195 | int rop, int what, int blit_bpp, | 196 | int rop, int what, int blit_bpp, |
196 | struct fb_info *info) | 197 | struct fb_info *info) |
197 | { | 198 | { |
198 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 199 | struct i810fb_par *par = info->par; |
199 | 200 | ||
200 | if (begin_iring(info, 24 + IRING_PAD)) return; | 201 | if (begin_iring(info, 24 + IRING_PAD)) return; |
201 | 202 | ||
@@ -236,7 +237,7 @@ static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch, | |||
236 | int dest, const u32 *src, int bg, | 237 | int dest, const u32 *src, int bg, |
237 | int fg, struct fb_info *info) | 238 | int fg, struct fb_info *info) |
238 | { | 239 | { |
239 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 240 | struct i810fb_par *par = info->par; |
240 | 241 | ||
241 | if (begin_iring(info, 24 + (dsize << 2) + IRING_PAD)) return; | 242 | if (begin_iring(info, 24 + (dsize << 2) + IRING_PAD)) return; |
242 | 243 | ||
@@ -254,7 +255,7 @@ static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch, | |||
254 | 255 | ||
255 | static inline void load_front(int offset, struct fb_info *info) | 256 | static inline void load_front(int offset, struct fb_info *info) |
256 | { | 257 | { |
257 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 258 | struct i810fb_par *par = info->par; |
258 | 259 | ||
259 | if (begin_iring(info, 8 + IRING_PAD)) return; | 260 | if (begin_iring(info, 8 + IRING_PAD)) return; |
260 | 261 | ||
@@ -296,7 +297,7 @@ static inline void i810fb_iring_enable(struct i810fb_par *par, u32 mode) | |||
296 | 297 | ||
297 | void i810fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 298 | void i810fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
298 | { | 299 | { |
299 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 300 | struct i810fb_par *par = info->par; |
300 | u32 dx, dy, width, height, dest, rop = 0, color = 0; | 301 | u32 dx, dy, width, height, dest, rop = 0, color = 0; |
301 | 302 | ||
302 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || | 303 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || |
@@ -322,7 +323,7 @@ void i810fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
322 | 323 | ||
323 | void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 324 | void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
324 | { | 325 | { |
325 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 326 | struct i810fb_par *par = info->par; |
326 | u32 sx, sy, dx, dy, pitch, width, height, src, dest, xdir; | 327 | u32 sx, sy, dx, dy, pitch, width, height, src, dest, xdir; |
327 | 328 | ||
328 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || | 329 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || |
@@ -361,7 +362,7 @@ void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
361 | 362 | ||
362 | void i810fb_imageblit(struct fb_info *info, const struct fb_image *image) | 363 | void i810fb_imageblit(struct fb_info *info, const struct fb_image *image) |
363 | { | 364 | { |
364 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 365 | struct i810fb_par *par = info->par; |
365 | u32 fg = 0, bg = 0, size, dst; | 366 | u32 fg = 0, bg = 0, size, dst; |
366 | 367 | ||
367 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || | 368 | if (!info->var.accel_flags || par->dev_flags & LOCKUP || |
@@ -397,7 +398,7 @@ void i810fb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
397 | 398 | ||
398 | int i810fb_sync(struct fb_info *info) | 399 | int i810fb_sync(struct fb_info *info) |
399 | { | 400 | { |
400 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 401 | struct i810fb_par *par = info->par; |
401 | 402 | ||
402 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) | 403 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) |
403 | return 0; | 404 | return 0; |
@@ -407,7 +408,7 @@ int i810fb_sync(struct fb_info *info) | |||
407 | 408 | ||
408 | void i810fb_load_front(u32 offset, struct fb_info *info) | 409 | void i810fb_load_front(u32 offset, struct fb_info *info) |
409 | { | 410 | { |
410 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 411 | struct i810fb_par *par = info->par; |
411 | u8 __iomem *mmio = par->mmio_start_virtual; | 412 | u8 __iomem *mmio = par->mmio_start_virtual; |
412 | 413 | ||
413 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) | 414 | if (!info->var.accel_flags || par->dev_flags & LOCKUP) |
@@ -427,7 +428,7 @@ void i810fb_load_front(u32 offset, struct fb_info *info) | |||
427 | */ | 428 | */ |
428 | void i810fb_init_ringbuffer(struct fb_info *info) | 429 | void i810fb_init_ringbuffer(struct fb_info *info) |
429 | { | 430 | { |
430 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 431 | struct i810fb_par *par = info->par; |
431 | u32 tmp1, tmp2; | 432 | u32 tmp1, tmp2; |
432 | u8 __iomem *mmio = par->mmio_start_virtual; | 433 | u8 __iomem *mmio = par->mmio_start_virtual; |
433 | 434 | ||
diff --git a/drivers/video/i810/i810_gtf.c b/drivers/video/i810/i810_gtf.c index 64f087a4466b..9743d51e7f8c 100644 --- a/drivers/video/i810/i810_gtf.c +++ b/drivers/video/i810/i810_gtf.c | |||
@@ -14,6 +14,7 @@ | |||
14 | 14 | ||
15 | #include "i810_regs.h" | 15 | #include "i810_regs.h" |
16 | #include "i810.h" | 16 | #include "i810.h" |
17 | #include "i810_main.h" | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * FIFO and Watermark tables - based almost wholly on i810_wmark.c in | 20 | * FIFO and Watermark tables - based almost wholly on i810_wmark.c in |
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index c0c974b1afaa..266d0ab92663 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -42,20 +42,62 @@ | |||
42 | #include <linux/pci_ids.h> | 42 | #include <linux/pci_ids.h> |
43 | #include <linux/resource.h> | 43 | #include <linux/resource.h> |
44 | #include <linux/unistd.h> | 44 | #include <linux/unistd.h> |
45 | #include <linux/console.h> | ||
45 | 46 | ||
46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
47 | #include <asm/div64.h> | 48 | #include <asm/div64.h> |
48 | |||
49 | #ifdef CONFIG_MTRR | ||
50 | #include <asm/mtrr.h> | ||
51 | #endif | ||
52 | |||
53 | #include <asm/page.h> | 49 | #include <asm/page.h> |
54 | 50 | ||
55 | #include "i810_regs.h" | 51 | #include "i810_regs.h" |
56 | #include "i810.h" | 52 | #include "i810.h" |
57 | #include "i810_main.h" | 53 | #include "i810_main.h" |
58 | 54 | ||
55 | /* | ||
56 | * voffset - framebuffer offset in MiB from aperture start address. In order for | ||
57 | * the driver to work with X, we must try to use memory holes left untouched by X. The | ||
58 | * following table lists where X's different surfaces start at. | ||
59 | * | ||
60 | * --------------------------------------------- | ||
61 | * : : 64 MiB : 32 MiB : | ||
62 | * ---------------------------------------------- | ||
63 | * : FrontBuffer : 0 : 0 : | ||
64 | * : DepthBuffer : 48 : 16 : | ||
65 | * : BackBuffer : 56 : 24 : | ||
66 | * ---------------------------------------------- | ||
67 | * | ||
68 | * So for chipsets with 64 MiB Aperture sizes, 32 MiB for v_offset is okay, allowing up to | ||
69 | * 15 + 1 MiB of Framebuffer memory. For 32 MiB Aperture sizes, a v_offset of 8 MiB should | ||
70 | * work, allowing 7 + 1 MiB of Framebuffer memory. | ||
71 | * Note, the size of the hole may change depending on how much memory you allocate to X, | ||
72 | * and how the memory is split up between these surfaces. | ||
73 | * | ||
74 | * Note: Anytime the DepthBuffer or FrontBuffer is overlapped, X would still run but with | ||
75 | * DRI disabled. But if the Frontbuffer is overlapped, X will fail to load. | ||
76 | * | ||
77 | * Experiment with v_offset to find out which works best for you. | ||
78 | */ | ||
79 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ | ||
80 | static u32 voffset __initdata = 0; | ||
81 | |||
82 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); | ||
83 | static int __devinit i810fb_init_pci (struct pci_dev *dev, | ||
84 | const struct pci_device_id *entry); | ||
85 | static void __exit i810fb_remove_pci(struct pci_dev *dev); | ||
86 | static int i810fb_resume(struct pci_dev *dev); | ||
87 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state); | ||
88 | |||
89 | /* Chipset Specific Functions */ | ||
90 | static int i810fb_set_par (struct fb_info *info); | ||
91 | static int i810fb_getcolreg (u8 regno, u8 *red, u8 *green, u8 *blue, | ||
92 | u8 *transp, struct fb_info *info); | ||
93 | static int i810fb_setcolreg (unsigned regno, unsigned red, unsigned green, unsigned blue, | ||
94 | unsigned transp, struct fb_info *info); | ||
95 | static int i810fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); | ||
96 | static int i810fb_blank (int blank_mode, struct fb_info *info); | ||
97 | |||
98 | /* Initialization */ | ||
99 | static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par); | ||
100 | |||
59 | /* PCI */ | 101 | /* PCI */ |
60 | static const char *i810_pci_list[] __devinitdata = { | 102 | static const char *i810_pci_list[] __devinitdata = { |
61 | "Intel(R) 810 Framebuffer Device" , | 103 | "Intel(R) 810 Framebuffer Device" , |
@@ -776,7 +818,7 @@ static void i810_load_cursor_image(int width, int height, u8 *data, | |||
776 | 818 | ||
777 | static void i810_load_cursor_colors(int fg, int bg, struct fb_info *info) | 819 | static void i810_load_cursor_colors(int fg, int bg, struct fb_info *info) |
778 | { | 820 | { |
779 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 821 | struct i810fb_par *par = info->par; |
780 | u8 __iomem *mmio = par->mmio_start_virtual; | 822 | u8 __iomem *mmio = par->mmio_start_virtual; |
781 | u8 red, green, blue, trans, temp; | 823 | u8 red, green, blue, trans, temp; |
782 | 824 | ||
@@ -949,7 +991,7 @@ static void set_color_bitfields(struct fb_var_screeninfo *var) | |||
949 | static int i810_check_params(struct fb_var_screeninfo *var, | 991 | static int i810_check_params(struct fb_var_screeninfo *var, |
950 | struct fb_info *info) | 992 | struct fb_info *info) |
951 | { | 993 | { |
952 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 994 | struct i810fb_par *par = info->par; |
953 | int line_length, vidmem, mode_valid = 0, retval = 0; | 995 | int line_length, vidmem, mode_valid = 0, retval = 0; |
954 | u32 vyres = var->yres_virtual, vxres = var->xres_virtual; | 996 | u32 vyres = var->yres_virtual, vxres = var->xres_virtual; |
955 | /* | 997 | /* |
@@ -1043,7 +1085,7 @@ static int i810_check_params(struct fb_var_screeninfo *var, | |||
1043 | */ | 1085 | */ |
1044 | static int encode_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | 1086 | static int encode_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) |
1045 | { | 1087 | { |
1046 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1088 | struct i810fb_par *par = info->par; |
1047 | 1089 | ||
1048 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); | 1090 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); |
1049 | 1091 | ||
@@ -1154,7 +1196,7 @@ static void decode_var(const struct fb_var_screeninfo *var, | |||
1154 | static int i810fb_getcolreg(u8 regno, u8 *red, u8 *green, u8 *blue, | 1196 | static int i810fb_getcolreg(u8 regno, u8 *red, u8 *green, u8 *blue, |
1155 | u8 *transp, struct fb_info *info) | 1197 | u8 *transp, struct fb_info *info) |
1156 | { | 1198 | { |
1157 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1199 | struct i810fb_par *par = info->par; |
1158 | u8 __iomem *mmio = par->mmio_start_virtual; | 1200 | u8 __iomem *mmio = par->mmio_start_virtual; |
1159 | u8 temp; | 1201 | u8 temp; |
1160 | 1202 | ||
@@ -1193,7 +1235,7 @@ static int i810fb_getcolreg(u8 regno, u8 *red, u8 *green, u8 *blue, | |||
1193 | 1235 | ||
1194 | static int i810fb_open(struct fb_info *info, int user) | 1236 | static int i810fb_open(struct fb_info *info, int user) |
1195 | { | 1237 | { |
1196 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1238 | struct i810fb_par *par = info->par; |
1197 | u32 count = atomic_read(&par->use_count); | 1239 | u32 count = atomic_read(&par->use_count); |
1198 | 1240 | ||
1199 | if (count == 0) { | 1241 | if (count == 0) { |
@@ -1212,7 +1254,7 @@ static int i810fb_open(struct fb_info *info, int user) | |||
1212 | 1254 | ||
1213 | static int i810fb_release(struct fb_info *info, int user) | 1255 | static int i810fb_release(struct fb_info *info, int user) |
1214 | { | 1256 | { |
1215 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1257 | struct i810fb_par *par = info->par; |
1216 | u32 count; | 1258 | u32 count; |
1217 | 1259 | ||
1218 | count = atomic_read(&par->use_count); | 1260 | count = atomic_read(&par->use_count); |
@@ -1234,7 +1276,7 @@ static int i810fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1234 | unsigned blue, unsigned transp, | 1276 | unsigned blue, unsigned transp, |
1235 | struct fb_info *info) | 1277 | struct fb_info *info) |
1236 | { | 1278 | { |
1237 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1279 | struct i810fb_par *par = info->par; |
1238 | u8 __iomem *mmio = par->mmio_start_virtual; | 1280 | u8 __iomem *mmio = par->mmio_start_virtual; |
1239 | u8 temp; | 1281 | u8 temp; |
1240 | int i; | 1282 | int i; |
@@ -1328,7 +1370,7 @@ static int i810fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1328 | static int i810fb_pan_display(struct fb_var_screeninfo *var, | 1370 | static int i810fb_pan_display(struct fb_var_screeninfo *var, |
1329 | struct fb_info *info) | 1371 | struct fb_info *info) |
1330 | { | 1372 | { |
1331 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1373 | struct i810fb_par *par = info->par; |
1332 | u32 total; | 1374 | u32 total; |
1333 | 1375 | ||
1334 | total = var->xoffset * par->depth + | 1376 | total = var->xoffset * par->depth + |
@@ -1340,7 +1382,7 @@ static int i810fb_pan_display(struct fb_var_screeninfo *var, | |||
1340 | 1382 | ||
1341 | static int i810fb_blank (int blank_mode, struct fb_info *info) | 1383 | static int i810fb_blank (int blank_mode, struct fb_info *info) |
1342 | { | 1384 | { |
1343 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1385 | struct i810fb_par *par = info->par; |
1344 | u8 __iomem *mmio = par->mmio_start_virtual; | 1386 | u8 __iomem *mmio = par->mmio_start_virtual; |
1345 | int mode = 0, pwr, scr_off = 0; | 1387 | int mode = 0, pwr, scr_off = 0; |
1346 | 1388 | ||
@@ -1385,7 +1427,7 @@ static int i810fb_blank (int blank_mode, struct fb_info *info) | |||
1385 | 1427 | ||
1386 | static int i810fb_set_par(struct fb_info *info) | 1428 | static int i810fb_set_par(struct fb_info *info) |
1387 | { | 1429 | { |
1388 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1430 | struct i810fb_par *par = info->par; |
1389 | 1431 | ||
1390 | decode_var(&info->var, par); | 1432 | decode_var(&info->var, par); |
1391 | i810_load_regs(par); | 1433 | i810_load_regs(par); |
@@ -1429,7 +1471,7 @@ static int i810fb_check_var(struct fb_var_screeninfo *var, | |||
1429 | 1471 | ||
1430 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1472 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1431 | { | 1473 | { |
1432 | struct i810fb_par *par = (struct i810fb_par *)info->par; | 1474 | struct i810fb_par *par = info->par; |
1433 | u8 __iomem *mmio = par->mmio_start_virtual; | 1475 | u8 __iomem *mmio = par->mmio_start_virtual; |
1434 | 1476 | ||
1435 | if (!par->dev_flags & LOCKUP) | 1477 | if (!par->dev_flags & LOCKUP) |
@@ -1516,36 +1558,29 @@ static struct fb_ops i810fb_ops __devinitdata = { | |||
1516 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) | 1558 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) |
1517 | { | 1559 | { |
1518 | struct fb_info *info = pci_get_drvdata(dev); | 1560 | struct fb_info *info = pci_get_drvdata(dev); |
1519 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1561 | struct i810fb_par *par = info->par; |
1520 | int blank = 0, prev_state = par->cur_state; | ||
1521 | |||
1522 | if (state.event == prev_state) | ||
1523 | return 0; | ||
1524 | 1562 | ||
1525 | par->cur_state = state.event; | 1563 | par->cur_state = state.event; |
1526 | 1564 | ||
1527 | switch (state.event) { | 1565 | if (state.event == PM_EVENT_FREEZE) { |
1528 | case 1: | 1566 | dev->dev.power.power_state = state; |
1529 | blank = VESA_VSYNC_SUSPEND; | 1567 | return 0; |
1530 | break; | ||
1531 | case 2: | ||
1532 | blank = VESA_HSYNC_SUSPEND; | ||
1533 | break; | ||
1534 | case 3: | ||
1535 | blank = VESA_POWERDOWN; | ||
1536 | break; | ||
1537 | default: | ||
1538 | return -EINVAL; | ||
1539 | } | 1568 | } |
1540 | info->fbops->fb_blank(blank, info); | ||
1541 | 1569 | ||
1542 | if (!prev_state) { | 1570 | acquire_console_sem(); |
1543 | agp_unbind_memory(par->i810_gtt.i810_fb_memory); | 1571 | fb_set_suspend(info, 1); |
1544 | agp_unbind_memory(par->i810_gtt.i810_cursor_memory); | 1572 | |
1545 | pci_disable_device(dev); | 1573 | if (info->fbops->fb_sync) |
1546 | } | 1574 | info->fbops->fb_sync(info); |
1575 | |||
1576 | i810fb_blank(FB_BLANK_POWERDOWN, info); | ||
1577 | agp_unbind_memory(par->i810_gtt.i810_fb_memory); | ||
1578 | agp_unbind_memory(par->i810_gtt.i810_cursor_memory); | ||
1579 | |||
1547 | pci_save_state(dev); | 1580 | pci_save_state(dev); |
1581 | pci_disable_device(dev); | ||
1548 | pci_set_power_state(dev, pci_choose_state(dev, state)); | 1582 | pci_set_power_state(dev, pci_choose_state(dev, state)); |
1583 | release_console_sem(); | ||
1549 | 1584 | ||
1550 | return 0; | 1585 | return 0; |
1551 | } | 1586 | } |
@@ -1553,23 +1588,29 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t state) | |||
1553 | static int i810fb_resume(struct pci_dev *dev) | 1588 | static int i810fb_resume(struct pci_dev *dev) |
1554 | { | 1589 | { |
1555 | struct fb_info *info = pci_get_drvdata(dev); | 1590 | struct fb_info *info = pci_get_drvdata(dev); |
1556 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1591 | struct i810fb_par *par = info->par; |
1592 | int cur_state = par->cur_state; | ||
1593 | |||
1594 | par->cur_state = PM_EVENT_ON; | ||
1557 | 1595 | ||
1558 | if (par->cur_state == 0) | 1596 | if (cur_state == PM_EVENT_FREEZE) { |
1597 | pci_set_power_state(dev, PCI_D0); | ||
1559 | return 0; | 1598 | return 0; |
1599 | } | ||
1560 | 1600 | ||
1561 | pci_restore_state(dev); | 1601 | acquire_console_sem(); |
1562 | pci_set_power_state(dev, PCI_D0); | 1602 | pci_set_power_state(dev, PCI_D0); |
1603 | pci_restore_state(dev); | ||
1563 | pci_enable_device(dev); | 1604 | pci_enable_device(dev); |
1605 | pci_set_master(dev); | ||
1564 | agp_bind_memory(par->i810_gtt.i810_fb_memory, | 1606 | agp_bind_memory(par->i810_gtt.i810_fb_memory, |
1565 | par->fb.offset); | 1607 | par->fb.offset); |
1566 | agp_bind_memory(par->i810_gtt.i810_cursor_memory, | 1608 | agp_bind_memory(par->i810_gtt.i810_cursor_memory, |
1567 | par->cursor_heap.offset); | 1609 | par->cursor_heap.offset); |
1568 | 1610 | i810fb_set_par(info); | |
1611 | fb_set_suspend (info, 0); | ||
1569 | info->fbops->fb_blank(VESA_NO_BLANKING, info); | 1612 | info->fbops->fb_blank(VESA_NO_BLANKING, info); |
1570 | 1613 | release_console_sem(); | |
1571 | par->cur_state = 0; | ||
1572 | |||
1573 | return 0; | 1614 | return 0; |
1574 | } | 1615 | } |
1575 | /*********************************************************************** | 1616 | /*********************************************************************** |
@@ -1610,7 +1651,7 @@ static void __devinit i810_fix_offsets(struct i810fb_par *par) | |||
1610 | 1651 | ||
1611 | static int __devinit i810_alloc_agp_mem(struct fb_info *info) | 1652 | static int __devinit i810_alloc_agp_mem(struct fb_info *info) |
1612 | { | 1653 | { |
1613 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 1654 | struct i810fb_par *par = info->par; |
1614 | int size; | 1655 | int size; |
1615 | struct agp_bridge_data *bridge; | 1656 | struct agp_bridge_data *bridge; |
1616 | 1657 | ||
@@ -2074,7 +2115,7 @@ static void i810fb_release_resource(struct fb_info *info, | |||
2074 | static void __exit i810fb_remove_pci(struct pci_dev *dev) | 2115 | static void __exit i810fb_remove_pci(struct pci_dev *dev) |
2075 | { | 2116 | { |
2076 | struct fb_info *info = pci_get_drvdata(dev); | 2117 | struct fb_info *info = pci_get_drvdata(dev); |
2077 | struct i810fb_par *par = (struct i810fb_par *) info->par; | 2118 | struct i810fb_par *par = info->par; |
2078 | 2119 | ||
2079 | unregister_framebuffer(info); | 2120 | unregister_framebuffer(info); |
2080 | i810fb_release_resource(info, par); | 2121 | i810fb_release_resource(info, par); |
diff --git a/drivers/video/i810/i810_main.h b/drivers/video/i810/i810_main.h index 06072a6466f2..51d4f3d4116d 100644 --- a/drivers/video/i810/i810_main.h +++ b/drivers/video/i810/i810_main.h | |||
@@ -14,55 +14,6 @@ | |||
14 | #ifndef __I810_MAIN_H__ | 14 | #ifndef __I810_MAIN_H__ |
15 | #define __I810_MAIN_H__ | 15 | #define __I810_MAIN_H__ |
16 | 16 | ||
17 | static int __devinit i810fb_init_pci (struct pci_dev *dev, | ||
18 | const struct pci_device_id *entry); | ||
19 | static void __exit i810fb_remove_pci(struct pci_dev *dev); | ||
20 | static int i810fb_resume(struct pci_dev *dev); | ||
21 | static int i810fb_suspend(struct pci_dev *dev, pm_message_t state); | ||
22 | |||
23 | /* | ||
24 | * voffset - framebuffer offset in MiB from aperture start address. In order for | ||
25 | * the driver to work with X, we must try to use memory holes left untouched by X. The | ||
26 | * following table lists where X's different surfaces start at. | ||
27 | * | ||
28 | * --------------------------------------------- | ||
29 | * : : 64 MiB : 32 MiB : | ||
30 | * ---------------------------------------------- | ||
31 | * : FrontBuffer : 0 : 0 : | ||
32 | * : DepthBuffer : 48 : 16 : | ||
33 | * : BackBuffer : 56 : 24 : | ||
34 | * ---------------------------------------------- | ||
35 | * | ||
36 | * So for chipsets with 64 MiB Aperture sizes, 32 MiB for v_offset is okay, allowing up to | ||
37 | * 15 + 1 MiB of Framebuffer memory. For 32 MiB Aperture sizes, a v_offset of 8 MiB should | ||
38 | * work, allowing 7 + 1 MiB of Framebuffer memory. | ||
39 | * Note, the size of the hole may change depending on how much memory you allocate to X, | ||
40 | * and how the memory is split up between these surfaces. | ||
41 | * | ||
42 | * Note: Anytime the DepthBuffer or FrontBuffer is overlapped, X would still run but with | ||
43 | * DRI disabled. But if the Frontbuffer is overlapped, X will fail to load. | ||
44 | * | ||
45 | * Experiment with v_offset to find out which works best for you. | ||
46 | */ | ||
47 | static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */ | ||
48 | static u32 voffset __initdata = 0; | ||
49 | |||
50 | static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor); | ||
51 | |||
52 | /* Chipset Specific Functions */ | ||
53 | static int i810fb_set_par (struct fb_info *info); | ||
54 | static int i810fb_getcolreg (u8 regno, u8 *red, u8 *green, u8 *blue, | ||
55 | u8 *transp, struct fb_info *info); | ||
56 | static int i810fb_setcolreg (unsigned regno, unsigned red, unsigned green, unsigned blue, | ||
57 | unsigned transp, struct fb_info *info); | ||
58 | static int i810fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); | ||
59 | static int i810fb_blank (int blank_mode, struct fb_info *info); | ||
60 | |||
61 | /* Initialization */ | ||
62 | static void i810fb_release_resource (struct fb_info *info, struct i810fb_par *par); | ||
63 | extern int __init agp_intel_init(void); | ||
64 | |||
65 | |||
66 | /* Video Timings */ | 17 | /* Video Timings */ |
67 | extern void round_off_xres (u32 *xres); | 18 | extern void round_off_xres (u32 *xres); |
68 | extern void round_off_yres (u32 *xres, u32 *yres); | 19 | extern void round_off_yres (u32 *xres, u32 *yres); |
@@ -101,7 +52,7 @@ static inline void i810_delete_i2c_busses(struct i810fb_par *par) { } | |||
101 | 52 | ||
102 | /* Conditionals */ | 53 | /* Conditionals */ |
103 | #ifdef CONFIG_X86 | 54 | #ifdef CONFIG_X86 |
104 | inline void flush_cache(void) | 55 | static inline void flush_cache(void) |
105 | { | 56 | { |
106 | asm volatile ("wbinvd":::"memory"); | 57 | asm volatile ("wbinvd":::"memory"); |
107 | } | 58 | } |
@@ -110,7 +61,9 @@ inline void flush_cache(void) | |||
110 | #endif | 61 | #endif |
111 | 62 | ||
112 | #ifdef CONFIG_MTRR | 63 | #ifdef CONFIG_MTRR |
113 | #define KERNEL_HAS_MTRR 1 | 64 | |
65 | #include <asm/mtrr.h> | ||
66 | |||
114 | static inline void __devinit set_mtrr(struct i810fb_par *par) | 67 | static inline void __devinit set_mtrr(struct i810fb_par *par) |
115 | { | 68 | { |
116 | par->mtrr_reg = mtrr_add((u32) par->aperture.physical, | 69 | par->mtrr_reg = mtrr_add((u32) par->aperture.physical, |
@@ -128,7 +81,6 @@ static inline void unset_mtrr(struct i810fb_par *par) | |||
128 | par->aperture.size); | 81 | par->aperture.size); |
129 | } | 82 | } |
130 | #else | 83 | #else |
131 | #define KERNEL_HAS_MTRR 0 | ||
132 | #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n") | 84 | #define set_mtrr(x) printk("set_mtrr: MTRR is disabled in the kernel\n") |
133 | 85 | ||
134 | #define unset_mtrr(x) do { } while (0) | 86 | #define unset_mtrr(x) do { } while (0) |
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c index 7fbe24206b19..a5d813050db5 100644 --- a/drivers/video/imsttfb.c +++ b/drivers/video/imsttfb.c | |||
@@ -323,6 +323,7 @@ struct imstt_par { | |||
323 | unsigned long cmap_regs_phys; | 323 | unsigned long cmap_regs_phys; |
324 | __u8 *cmap_regs; | 324 | __u8 *cmap_regs; |
325 | __u32 ramdac; | 325 | __u32 ramdac; |
326 | __u32 palette[16]; | ||
326 | }; | 327 | }; |
327 | 328 | ||
328 | enum { | 329 | enum { |
@@ -657,7 +658,7 @@ set_imstt_regvals_tvp (struct imstt_par *par, u_int bpp) | |||
657 | static void | 658 | static void |
658 | set_imstt_regvals (struct fb_info *info, u_int bpp) | 659 | set_imstt_regvals (struct fb_info *info, u_int bpp) |
659 | { | 660 | { |
660 | struct imstt_par *par = (struct imstt_par *) info->par; | 661 | struct imstt_par *par = info->par; |
661 | struct imstt_regvals *init = &par->init; | 662 | struct imstt_regvals *init = &par->init; |
662 | __u32 ctl, pitch, byteswap, scr; | 663 | __u32 ctl, pitch, byteswap, scr; |
663 | 664 | ||
@@ -749,7 +750,7 @@ set_imstt_regvals (struct fb_info *info, u_int bpp) | |||
749 | static inline void | 750 | static inline void |
750 | set_offset (struct fb_var_screeninfo *var, struct fb_info *info) | 751 | set_offset (struct fb_var_screeninfo *var, struct fb_info *info) |
751 | { | 752 | { |
752 | struct imstt_par *par = (struct imstt_par *) info->par; | 753 | struct imstt_par *par = info->par; |
753 | __u32 off = var->yoffset * (info->fix.line_length >> 3) | 754 | __u32 off = var->yoffset * (info->fix.line_length >> 3) |
754 | + ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3); | 755 | + ((var->xoffset * (var->bits_per_pixel >> 3)) >> 3); |
755 | write_reg_le32(par->dc_regs, SSR, off); | 756 | write_reg_le32(par->dc_regs, SSR, off); |
@@ -863,7 +864,7 @@ imsttfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
863 | static int | 864 | static int |
864 | imsttfb_set_par(struct fb_info *info) | 865 | imsttfb_set_par(struct fb_info *info) |
865 | { | 866 | { |
866 | struct imstt_par *par = (struct imstt_par *) info->par; | 867 | struct imstt_par *par = info->par; |
867 | 868 | ||
868 | if (!compute_imstt_regvals(par, info->var.xres, info->var.yres)) | 869 | if (!compute_imstt_regvals(par, info->var.xres, info->var.yres)) |
869 | return -EINVAL; | 870 | return -EINVAL; |
@@ -881,7 +882,7 @@ static int | |||
881 | imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue, | 882 | imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue, |
882 | u_int transp, struct fb_info *info) | 883 | u_int transp, struct fb_info *info) |
883 | { | 884 | { |
884 | struct imstt_par *par = (struct imstt_par *) info->par; | 885 | struct imstt_par *par = info->par; |
885 | u_int bpp = info->var.bits_per_pixel; | 886 | u_int bpp = info->var.bits_per_pixel; |
886 | 887 | ||
887 | if (regno > 255) | 888 | if (regno > 255) |
@@ -905,14 +906,17 @@ imsttfb_setcolreg (u_int regno, u_int red, u_int green, u_int blue, | |||
905 | if (regno < 16) | 906 | if (regno < 16) |
906 | switch (bpp) { | 907 | switch (bpp) { |
907 | case 16: | 908 | case 16: |
908 | ((u16 *)info->pseudo_palette)[regno] = (regno << (info->var.green.length == 5 ? 10 : 11)) | (regno << 5) | regno; | 909 | par->palette[regno] = |
910 | (regno << (info->var.green.length == | ||
911 | 5 ? 10 : 11)) | (regno << 5) | regno; | ||
909 | break; | 912 | break; |
910 | case 24: | 913 | case 24: |
911 | ((u32 *)info->pseudo_palette)[regno] = (regno << 16) | (regno << 8) | regno; | 914 | par->palette[regno] = |
915 | (regno << 16) | (regno << 8) | regno; | ||
912 | break; | 916 | break; |
913 | case 32: { | 917 | case 32: { |
914 | int i = (regno << 8) | regno; | 918 | int i = (regno << 8) | regno; |
915 | ((u32 *)info->pseudo_palette)[regno] = (i << 16) | i; | 919 | par->palette[regno] = (i << 16) |i; |
916 | break; | 920 | break; |
917 | } | 921 | } |
918 | } | 922 | } |
@@ -935,7 +939,7 @@ imsttfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) | |||
935 | static int | 939 | static int |
936 | imsttfb_blank(int blank, struct fb_info *info) | 940 | imsttfb_blank(int blank, struct fb_info *info) |
937 | { | 941 | { |
938 | struct imstt_par *par = (struct imstt_par *) info->par; | 942 | struct imstt_par *par = info->par; |
939 | __u32 ctrl; | 943 | __u32 ctrl; |
940 | 944 | ||
941 | ctrl = read_reg_le32(par->dc_regs, STGCTL); | 945 | ctrl = read_reg_le32(par->dc_regs, STGCTL); |
@@ -989,7 +993,7 @@ imsttfb_blank(int blank, struct fb_info *info) | |||
989 | static void | 993 | static void |
990 | imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 994 | imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
991 | { | 995 | { |
992 | struct imstt_par *par = (struct imstt_par *) info->par; | 996 | struct imstt_par *par = info->par; |
993 | __u32 Bpp, line_pitch, bgc, dx, dy, width, height; | 997 | __u32 Bpp, line_pitch, bgc, dx, dy, width, height; |
994 | 998 | ||
995 | bgc = rect->color; | 999 | bgc = rect->color; |
@@ -1033,7 +1037,7 @@ imsttfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
1033 | static void | 1037 | static void |
1034 | imsttfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 1038 | imsttfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
1035 | { | 1039 | { |
1036 | struct imstt_par *par = (struct imstt_par *) info->par; | 1040 | struct imstt_par *par = info->par; |
1037 | __u32 Bpp, line_pitch, fb_offset_old, fb_offset_new, sp, dp_octl; | 1041 | __u32 Bpp, line_pitch, fb_offset_old, fb_offset_new, sp, dp_octl; |
1038 | __u32 cnt, bltctl, sx, sy, dx, dy, height, width; | 1042 | __u32 cnt, bltctl, sx, sy, dx, dy, height, width; |
1039 | 1043 | ||
@@ -1195,7 +1199,7 @@ imstt_set_cursor(struct imstt_par *par, struct fb_image *d, int on) | |||
1195 | static int | 1199 | static int |
1196 | imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1200 | imsttfb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1197 | { | 1201 | { |
1198 | struct imstt_par *par = (struct imstt_par *) info->par; | 1202 | struct imstt_par *par = info->par; |
1199 | u32 flags = cursor->set, fg, bg, xx, yy; | 1203 | u32 flags = cursor->set, fg, bg, xx, yy; |
1200 | 1204 | ||
1201 | if (cursor->dest == NULL && cursor->rop == ROP_XOR) | 1205 | if (cursor->dest == NULL && cursor->rop == ROP_XOR) |
@@ -1266,7 +1270,7 @@ static int | |||
1266 | imsttfb_ioctl(struct inode *inode, struct file *file, u_int cmd, | 1270 | imsttfb_ioctl(struct inode *inode, struct file *file, u_int cmd, |
1267 | u_long arg, struct fb_info *info) | 1271 | u_long arg, struct fb_info *info) |
1268 | { | 1272 | { |
1269 | struct imstt_par *par = (struct imstt_par *) info->par; | 1273 | struct imstt_par *par = info->par; |
1270 | void __user *argp = (void __user *)arg; | 1274 | void __user *argp = (void __user *)arg; |
1271 | __u32 reg[2]; | 1275 | __u32 reg[2]; |
1272 | __u8 idx[2]; | 1276 | __u8 idx[2]; |
@@ -1350,7 +1354,7 @@ static struct fb_ops imsttfb_ops = { | |||
1350 | static void __devinit | 1354 | static void __devinit |
1351 | init_imstt(struct fb_info *info) | 1355 | init_imstt(struct fb_info *info) |
1352 | { | 1356 | { |
1353 | struct imstt_par *par = (struct imstt_par *) info->par; | 1357 | struct imstt_par *par = info->par; |
1354 | __u32 i, tmp, *ip, *end; | 1358 | __u32 i, tmp, *ip, *end; |
1355 | 1359 | ||
1356 | tmp = read_reg_le32(par->dc_regs, PRC); | 1360 | tmp = read_reg_le32(par->dc_regs, PRC); |
@@ -1413,7 +1417,7 @@ init_imstt(struct fb_info *info) | |||
1413 | if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len | 1417 | if ((info->var.xres * info->var.yres) * (info->var.bits_per_pixel >> 3) > info->fix.smem_len |
1414 | || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { | 1418 | || !(compute_imstt_regvals(par, info->var.xres, info->var.yres))) { |
1415 | printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); | 1419 | printk("imsttfb: %ux%ux%u not supported\n", info->var.xres, info->var.yres, info->var.bits_per_pixel); |
1416 | kfree(info); | 1420 | framebuffer_release(info); |
1417 | return; | 1421 | return; |
1418 | } | 1422 | } |
1419 | 1423 | ||
@@ -1449,7 +1453,7 @@ init_imstt(struct fb_info *info) | |||
1449 | fb_alloc_cmap(&info->cmap, 0, 0); | 1453 | fb_alloc_cmap(&info->cmap, 0, 0); |
1450 | 1454 | ||
1451 | if (register_framebuffer(info) < 0) { | 1455 | if (register_framebuffer(info) < 0) { |
1452 | kfree(info); | 1456 | framebuffer_release(info); |
1453 | return; | 1457 | return; |
1454 | } | 1458 | } |
1455 | 1459 | ||
@@ -1474,26 +1478,21 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1474 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); | 1478 | printk(KERN_ERR "imsttfb: no OF node for pci device\n"); |
1475 | #endif /* CONFIG_PPC_OF */ | 1479 | #endif /* CONFIG_PPC_OF */ |
1476 | 1480 | ||
1477 | size = sizeof(struct fb_info) + sizeof(struct imstt_par) + | 1481 | info = framebuffer_alloc(sizeof(struct imstt_par), &pdev->dev); |
1478 | sizeof(u32) * 16; | ||
1479 | |||
1480 | info = kmalloc(size, GFP_KERNEL); | ||
1481 | 1482 | ||
1482 | if (!info) { | 1483 | if (!info) { |
1483 | printk(KERN_ERR "imsttfb: Can't allocate memory\n"); | 1484 | printk(KERN_ERR "imsttfb: Can't allocate memory\n"); |
1484 | return -ENOMEM; | 1485 | return -ENOMEM; |
1485 | } | 1486 | } |
1486 | 1487 | ||
1487 | memset(info, 0, size); | 1488 | par = info->par; |
1488 | |||
1489 | par = (struct imstt_par *) (info + 1); | ||
1490 | 1489 | ||
1491 | addr = pci_resource_start (pdev, 0); | 1490 | addr = pci_resource_start (pdev, 0); |
1492 | size = pci_resource_len (pdev, 0); | 1491 | size = pci_resource_len (pdev, 0); |
1493 | 1492 | ||
1494 | if (!request_mem_region(addr, size, "imsttfb")) { | 1493 | if (!request_mem_region(addr, size, "imsttfb")) { |
1495 | printk(KERN_ERR "imsttfb: Can't reserve memory region\n"); | 1494 | printk(KERN_ERR "imsttfb: Can't reserve memory region\n"); |
1496 | kfree(info); | 1495 | framebuffer_release(info); |
1497 | return -ENODEV; | 1496 | return -ENODEV; |
1498 | } | 1497 | } |
1499 | 1498 | ||
@@ -1516,14 +1515,13 @@ imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1516 | } | 1515 | } |
1517 | 1516 | ||
1518 | info->fix.smem_start = addr; | 1517 | info->fix.smem_start = addr; |
1519 | info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? 0x400000 : 0x800000); | 1518 | info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? |
1519 | 0x400000 : 0x800000); | ||
1520 | info->fix.mmio_start = addr + 0x800000; | 1520 | info->fix.mmio_start = addr + 0x800000; |
1521 | par->dc_regs = ioremap(addr + 0x800000, 0x1000); | 1521 | par->dc_regs = ioremap(addr + 0x800000, 0x1000); |
1522 | par->cmap_regs_phys = addr + 0x840000; | 1522 | par->cmap_regs_phys = addr + 0x840000; |
1523 | par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); | 1523 | par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); |
1524 | info->par = par; | 1524 | info->pseudo_palette = par->palette; |
1525 | info->pseudo_palette = (void *) (par + 1); | ||
1526 | info->device = &pdev->dev; | ||
1527 | init_imstt(info); | 1525 | init_imstt(info); |
1528 | 1526 | ||
1529 | pci_set_drvdata(pdev, info); | 1527 | pci_set_drvdata(pdev, info); |
@@ -1534,7 +1532,7 @@ static void __devexit | |||
1534 | imsttfb_remove(struct pci_dev *pdev) | 1532 | imsttfb_remove(struct pci_dev *pdev) |
1535 | { | 1533 | { |
1536 | struct fb_info *info = pci_get_drvdata(pdev); | 1534 | struct fb_info *info = pci_get_drvdata(pdev); |
1537 | struct imstt_par *par = (struct imstt_par *) info->par; | 1535 | struct imstt_par *par = info->par; |
1538 | int size = pci_resource_len(pdev, 0); | 1536 | int size = pci_resource_len(pdev, 0); |
1539 | 1537 | ||
1540 | unregister_framebuffer(info); | 1538 | unregister_framebuffer(info); |
@@ -1542,7 +1540,7 @@ imsttfb_remove(struct pci_dev *pdev) | |||
1542 | iounmap(par->dc_regs); | 1540 | iounmap(par->dc_regs); |
1543 | iounmap(info->screen_base); | 1541 | iounmap(info->screen_base); |
1544 | release_mem_region(info->fix.smem_start, size); | 1542 | release_mem_region(info->fix.smem_start, size); |
1545 | kfree(info); | 1543 | framebuffer_release(info); |
1546 | } | 1544 | } |
1547 | 1545 | ||
1548 | #ifndef MODULE | 1546 | #ifndef MODULE |
diff --git a/drivers/video/kyro/STG4000InitDevice.c b/drivers/video/kyro/STG4000InitDevice.c index 7e33cd307d47..ab5285a7f1d6 100644 --- a/drivers/video/kyro/STG4000InitDevice.c +++ b/drivers/video/kyro/STG4000InitDevice.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
16 | 16 | ||
17 | #include "STG4000Reg.h" | 17 | #include "STG4000Reg.h" |
18 | #include "STG4000Interface.h" | ||
18 | 19 | ||
19 | /* SDRAM fixed settings */ | 20 | /* SDRAM fixed settings */ |
20 | #define SDRAM_CFG_0 0x49A1 | 21 | #define SDRAM_CFG_0 0x49A1 |
diff --git a/drivers/video/kyro/STG4000Interface.h b/drivers/video/kyro/STG4000Interface.h index e75b3b4a4aa1..b7c83d5dfb13 100644 --- a/drivers/video/kyro/STG4000Interface.h +++ b/drivers/video/kyro/STG4000Interface.h | |||
@@ -11,7 +11,8 @@ | |||
11 | #ifndef _STG4000INTERFACE_H | 11 | #ifndef _STG4000INTERFACE_H |
12 | #define _STG4000INTERFACE_H | 12 | #define _STG4000INTERFACE_H |
13 | 13 | ||
14 | struct pci_dev; | 14 | #include <linux/pci.h> |
15 | #include <video/kyro.h> | ||
15 | 16 | ||
16 | /* | 17 | /* |
17 | * Ramdac Setup | 18 | * Ramdac Setup |
diff --git a/drivers/video/kyro/STG4000OverlayDevice.c b/drivers/video/kyro/STG4000OverlayDevice.c index 2ae9bafacdd0..a8c9713413e6 100644 --- a/drivers/video/kyro/STG4000OverlayDevice.c +++ b/drivers/video/kyro/STG4000OverlayDevice.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | 15 | ||
16 | #include "STG4000Reg.h" | 16 | #include "STG4000Reg.h" |
17 | #include "STG4000Interface.h" | ||
17 | 18 | ||
18 | /* HW Defines */ | 19 | /* HW Defines */ |
19 | 20 | ||
diff --git a/drivers/video/kyro/fbdev.c b/drivers/video/kyro/fbdev.c index 5eb4d5c177bd..bcd359b6d4ff 100644 --- a/drivers/video/kyro/fbdev.c +++ b/drivers/video/kyro/fbdev.c | |||
@@ -73,8 +73,6 @@ static struct fb_var_screeninfo kyro_var __devinitdata = { | |||
73 | .vmode = FB_VMODE_NONINTERLACED, | 73 | .vmode = FB_VMODE_NONINTERLACED, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static struct kyrofb_info *currentpar; | ||
77 | |||
78 | typedef struct { | 76 | typedef struct { |
79 | STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */ | 77 | STG4000REG __iomem *pSTGReg; /* Virtual address of PCI register region */ |
80 | u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */ | 78 | u32 ulNextFreeVidMem; /* Offset from start of vid mem to next free region */ |
@@ -309,7 +307,7 @@ enum { | |||
309 | /* Accessors */ | 307 | /* Accessors */ |
310 | static int kyro_dev_video_mode_set(struct fb_info *info) | 308 | static int kyro_dev_video_mode_set(struct fb_info *info) |
311 | { | 309 | { |
312 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 310 | struct kyrofb_info *par = info->par; |
313 | 311 | ||
314 | /* Turn off display */ | 312 | /* Turn off display */ |
315 | StopVTG(deviceInfo.pSTGReg); | 313 | StopVTG(deviceInfo.pSTGReg); |
@@ -402,7 +400,7 @@ static inline unsigned long get_line_length(int x, int bpp) | |||
402 | 400 | ||
403 | static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 401 | static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
404 | { | 402 | { |
405 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 403 | struct kyrofb_info *par = info->par; |
406 | 404 | ||
407 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { | 405 | if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { |
408 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); | 406 | printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); |
@@ -478,7 +476,7 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
478 | 476 | ||
479 | static int kyrofb_set_par(struct fb_info *info) | 477 | static int kyrofb_set_par(struct fb_info *info) |
480 | { | 478 | { |
481 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 479 | struct kyrofb_info *par = info->par; |
482 | unsigned long lineclock; | 480 | unsigned long lineclock; |
483 | unsigned long frameclock; | 481 | unsigned long frameclock; |
484 | 482 | ||
@@ -536,20 +534,22 @@ static int kyrofb_set_par(struct fb_info *info) | |||
536 | static int kyrofb_setcolreg(u_int regno, u_int red, u_int green, | 534 | static int kyrofb_setcolreg(u_int regno, u_int red, u_int green, |
537 | u_int blue, u_int transp, struct fb_info *info) | 535 | u_int blue, u_int transp, struct fb_info *info) |
538 | { | 536 | { |
537 | struct kyrofb_info *par = info->par; | ||
538 | |||
539 | if (regno > 255) | 539 | if (regno > 255) |
540 | return 1; /* Invalid register */ | 540 | return 1; /* Invalid register */ |
541 | 541 | ||
542 | if (regno < 16) { | 542 | if (regno < 16) { |
543 | switch (info->var.bits_per_pixel) { | 543 | switch (info->var.bits_per_pixel) { |
544 | case 16: | 544 | case 16: |
545 | ((u16*)(info->pseudo_palette))[regno] = | 545 | par->palette[regno] = |
546 | (red & 0xf800) | | 546 | (red & 0xf800) | |
547 | ((green & 0xfc00) >> 5) | | 547 | ((green & 0xfc00) >> 5) | |
548 | ((blue & 0xf800) >> 11); | 548 | ((blue & 0xf800) >> 11); |
549 | break; | 549 | break; |
550 | case 32: | 550 | case 32: |
551 | red >>= 8; green >>= 8; blue >>= 8; transp >>= 8; | 551 | red >>= 8; green >>= 8; blue >>= 8; transp >>= 8; |
552 | ((u32*)(info->pseudo_palette))[regno] = | 552 | par->palette[regno] = |
553 | (transp << 24) | (red << 16) | (green << 8) | blue; | 553 | (transp << 24) | (red << 16) | (green << 8) | blue; |
554 | break; | 554 | break; |
555 | } | 555 | } |
@@ -675,6 +675,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
675 | const struct pci_device_id *ent) | 675 | const struct pci_device_id *ent) |
676 | { | 676 | { |
677 | struct fb_info *info; | 677 | struct fb_info *info; |
678 | struct kyrofb_info *currentpar; | ||
678 | unsigned long size; | 679 | unsigned long size; |
679 | int err; | 680 | int err; |
680 | 681 | ||
@@ -683,14 +684,11 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
683 | return err; | 684 | return err; |
684 | } | 685 | } |
685 | 686 | ||
686 | size = sizeof(struct fb_info) + sizeof(struct kyrofb_info) + 16 * sizeof(u32); | 687 | info = framebuffer_alloc(sizeof(struct kyrofb_info), &pdev->dev); |
687 | info = kmalloc(size, GFP_KERNEL); | ||
688 | if (!info) | 688 | if (!info) |
689 | return -ENOMEM; | 689 | return -ENOMEM; |
690 | 690 | ||
691 | memset(info, 0, size); | 691 | currentpar = info->par; |
692 | |||
693 | currentpar = (struct kyrofb_info *)(info + 1); | ||
694 | 692 | ||
695 | kyro_fix.smem_start = pci_resource_start(pdev, 0); | 693 | kyro_fix.smem_start = pci_resource_start(pdev, 0); |
696 | kyro_fix.smem_len = pci_resource_len(pdev, 0); | 694 | kyro_fix.smem_len = pci_resource_len(pdev, 0); |
@@ -716,8 +714,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
716 | 714 | ||
717 | info->fbops = &kyrofb_ops; | 715 | info->fbops = &kyrofb_ops; |
718 | info->fix = kyro_fix; | 716 | info->fix = kyro_fix; |
719 | info->par = currentpar; | 717 | info->pseudo_palette = currentpar->palette; |
720 | info->pseudo_palette = (void *)(currentpar + 1); | ||
721 | info->flags = FBINFO_DEFAULT; | 718 | info->flags = FBINFO_DEFAULT; |
722 | 719 | ||
723 | SetCoreClockPLL(deviceInfo.pSTGReg, pdev); | 720 | SetCoreClockPLL(deviceInfo.pSTGReg, pdev); |
@@ -741,7 +738,6 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
741 | 738 | ||
742 | fb_memset(info->screen_base, 0, size); | 739 | fb_memset(info->screen_base, 0, size); |
743 | 740 | ||
744 | info->device = &pdev->dev; | ||
745 | if (register_framebuffer(info) < 0) | 741 | if (register_framebuffer(info) < 0) |
746 | goto out_unmap; | 742 | goto out_unmap; |
747 | 743 | ||
@@ -757,7 +753,7 @@ static int __devinit kyrofb_probe(struct pci_dev *pdev, | |||
757 | out_unmap: | 753 | out_unmap: |
758 | iounmap(currentpar->regbase); | 754 | iounmap(currentpar->regbase); |
759 | iounmap(info->screen_base); | 755 | iounmap(info->screen_base); |
760 | kfree(info); | 756 | framebuffer_release(info); |
761 | 757 | ||
762 | return -EINVAL; | 758 | return -EINVAL; |
763 | } | 759 | } |
@@ -765,7 +761,7 @@ out_unmap: | |||
765 | static void __devexit kyrofb_remove(struct pci_dev *pdev) | 761 | static void __devexit kyrofb_remove(struct pci_dev *pdev) |
766 | { | 762 | { |
767 | struct fb_info *info = pci_get_drvdata(pdev); | 763 | struct fb_info *info = pci_get_drvdata(pdev); |
768 | struct kyrofb_info *par = (struct kyrofb_info *)info->par; | 764 | struct kyrofb_info *par = info->par; |
769 | 765 | ||
770 | /* Reset the board */ | 766 | /* Reset the board */ |
771 | StopVTG(deviceInfo.pSTGReg); | 767 | StopVTG(deviceInfo.pSTGReg); |
@@ -789,7 +785,7 @@ static void __devexit kyrofb_remove(struct pci_dev *pdev) | |||
789 | 785 | ||
790 | unregister_framebuffer(info); | 786 | unregister_framebuffer(info); |
791 | pci_set_drvdata(pdev, NULL); | 787 | pci_set_drvdata(pdev, NULL); |
792 | kfree(info); | 788 | framebuffer_release(info); |
793 | } | 789 | } |
794 | 790 | ||
795 | static int __init kyrofb_init(void) | 791 | static int __init kyrofb_init(void) |
diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index a8c47ad2cdb6..3a3e1804c56a 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h | |||
@@ -50,8 +50,6 @@ | |||
50 | #include <asm/mtrr.h> | 50 | #include <asm/mtrr.h> |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #include "../console/fbcon.h" | ||
54 | |||
55 | #if defined(CONFIG_PPC_PMAC) | 53 | #if defined(CONFIG_PPC_PMAC) |
56 | #include <asm/prom.h> | 54 | #include <asm/prom.h> |
57 | #include <asm/pci-bridge.h> | 55 | #include <asm/pci-bridge.h> |
@@ -351,8 +349,6 @@ struct matrox_bios { | |||
351 | } output; | 349 | } output; |
352 | }; | 350 | }; |
353 | 351 | ||
354 | extern struct display fb_display[]; | ||
355 | |||
356 | struct matrox_switch; | 352 | struct matrox_switch; |
357 | struct matroxfb_driver; | 353 | struct matroxfb_driver; |
358 | struct matroxfb_dh_fb_info; | 354 | struct matroxfb_dh_fb_info; |
diff --git a/drivers/video/matrox/matroxfb_g450.c b/drivers/video/matrox/matroxfb_g450.c index 35008af7db75..c122d8743dd2 100644 --- a/drivers/video/matrox/matroxfb_g450.c +++ b/drivers/video/matrox/matroxfb_g450.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | #include <asm/div64.h> | 21 | #include <asm/div64.h> |
22 | 22 | ||
23 | #include "matroxfb_g450.h" | ||
24 | |||
23 | /* Definition of the various controls */ | 25 | /* Definition of the various controls */ |
24 | struct mctl { | 26 | struct mctl { |
25 | struct v4l2_queryctrl desc; | 27 | struct v4l2_queryctrl desc; |
diff --git a/drivers/video/matrox/matroxfb_misc.c b/drivers/video/matrox/matroxfb_misc.c index d9d3e9f6c08e..455a46ce840c 100644 --- a/drivers/video/matrox/matroxfb_misc.c +++ b/drivers/video/matrox/matroxfb_misc.c | |||
@@ -192,11 +192,8 @@ int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) { | |||
192 | unsigned int wd; | 192 | unsigned int wd; |
193 | unsigned int divider; | 193 | unsigned int divider; |
194 | int i; | 194 | int i; |
195 | int fwidth; | ||
196 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); | 195 | struct matrox_hw_state * const hw = &ACCESS_FBINFO(hw); |
197 | 196 | ||
198 | fwidth = 8; | ||
199 | |||
200 | DBG(__FUNCTION__) | 197 | DBG(__FUNCTION__) |
201 | 198 | ||
202 | hw->SEQ[0] = 0x00; | 199 | hw->SEQ[0] = 0x00; |
@@ -235,10 +232,7 @@ int matroxfb_vgaHWinit(WPMINFO struct my_timming* m) { | |||
235 | hw->ATTR[16] = 0x41; | 232 | hw->ATTR[16] = 0x41; |
236 | hw->ATTR[17] = 0xFF; | 233 | hw->ATTR[17] = 0xFF; |
237 | hw->ATTR[18] = 0x0F; | 234 | hw->ATTR[18] = 0x0F; |
238 | if (fwidth == 9) | 235 | hw->ATTR[19] = 0x00; |
239 | hw->ATTR[19] = 0x08; | ||
240 | else | ||
241 | hw->ATTR[19] = 0x00; | ||
242 | hw->ATTR[20] = 0x00; | 236 | hw->ATTR[20] = 0x00; |
243 | 237 | ||
244 | hd = m->HDisplay >> 3; | 238 | hd = m->HDisplay >> 3; |
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c index 8486e77872dc..e18c9f98a401 100644 --- a/drivers/video/neofb.c +++ b/drivers/video/neofb.c | |||
@@ -485,7 +485,7 @@ static void vgaHWRestore(const struct fb_info *info, | |||
485 | */ | 485 | */ |
486 | static inline int neo2200_sync(struct fb_info *info) | 486 | static inline int neo2200_sync(struct fb_info *info) |
487 | { | 487 | { |
488 | struct neofb_par *par = (struct neofb_par *) info->par; | 488 | struct neofb_par *par = info->par; |
489 | int waitcycles; | 489 | int waitcycles; |
490 | 490 | ||
491 | while (readl(&par->neo2200->bltStat) & 1) | 491 | while (readl(&par->neo2200->bltStat) & 1) |
@@ -525,7 +525,7 @@ static inline void neo2200_wait_fifo(struct fb_info *info, | |||
525 | static inline void neo2200_accel_init(struct fb_info *info, | 525 | static inline void neo2200_accel_init(struct fb_info *info, |
526 | struct fb_var_screeninfo *var) | 526 | struct fb_var_screeninfo *var) |
527 | { | 527 | { |
528 | struct neofb_par *par = (struct neofb_par *) info->par; | 528 | struct neofb_par *par = info->par; |
529 | Neo2200 __iomem *neo2200 = par->neo2200; | 529 | Neo2200 __iomem *neo2200 = par->neo2200; |
530 | u32 bltMod, pitch; | 530 | u32 bltMod, pitch; |
531 | 531 | ||
@@ -560,7 +560,7 @@ static inline void neo2200_accel_init(struct fb_info *info, | |||
560 | static int | 560 | static int |
561 | neofb_open(struct fb_info *info, int user) | 561 | neofb_open(struct fb_info *info, int user) |
562 | { | 562 | { |
563 | struct neofb_par *par = (struct neofb_par *) info->par; | 563 | struct neofb_par *par = info->par; |
564 | int cnt = atomic_read(&par->ref_count); | 564 | int cnt = atomic_read(&par->ref_count); |
565 | 565 | ||
566 | if (!cnt) { | 566 | if (!cnt) { |
@@ -575,7 +575,7 @@ neofb_open(struct fb_info *info, int user) | |||
575 | static int | 575 | static int |
576 | neofb_release(struct fb_info *info, int user) | 576 | neofb_release(struct fb_info *info, int user) |
577 | { | 577 | { |
578 | struct neofb_par *par = (struct neofb_par *) info->par; | 578 | struct neofb_par *par = info->par; |
579 | int cnt = atomic_read(&par->ref_count); | 579 | int cnt = atomic_read(&par->ref_count); |
580 | 580 | ||
581 | if (!cnt) | 581 | if (!cnt) |
@@ -590,7 +590,7 @@ neofb_release(struct fb_info *info, int user) | |||
590 | static int | 590 | static int |
591 | neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 591 | neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
592 | { | 592 | { |
593 | struct neofb_par *par = (struct neofb_par *) info->par; | 593 | struct neofb_par *par = info->par; |
594 | unsigned int pixclock = var->pixclock; | 594 | unsigned int pixclock = var->pixclock; |
595 | struct xtimings timings; | 595 | struct xtimings timings; |
596 | int memlen, vramlen; | 596 | int memlen, vramlen; |
@@ -757,7 +757,7 @@ neofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
757 | 757 | ||
758 | static int neofb_set_par(struct fb_info *info) | 758 | static int neofb_set_par(struct fb_info *info) |
759 | { | 759 | { |
760 | struct neofb_par *par = (struct neofb_par *) info->par; | 760 | struct neofb_par *par = info->par; |
761 | struct xtimings timings; | 761 | struct xtimings timings; |
762 | unsigned char temp; | 762 | unsigned char temp; |
763 | int i, clock_hi = 0; | 763 | int i, clock_hi = 0; |
@@ -1216,7 +1216,7 @@ static int neofb_set_par(struct fb_info *info) | |||
1216 | static void neofb_update_start(struct fb_info *info, | 1216 | static void neofb_update_start(struct fb_info *info, |
1217 | struct fb_var_screeninfo *var) | 1217 | struct fb_var_screeninfo *var) |
1218 | { | 1218 | { |
1219 | struct neofb_par *par = (struct neofb_par *) info->par; | 1219 | struct neofb_par *par = info->par; |
1220 | struct vgastate *state = &par->state; | 1220 | struct vgastate *state = &par->state; |
1221 | int oldExtCRTDispAddr; | 1221 | int oldExtCRTDispAddr; |
1222 | int Base; | 1222 | int Base; |
@@ -1331,7 +1331,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info) | |||
1331 | * wms...Enable VESA DPMS compatible powerdown mode | 1331 | * wms...Enable VESA DPMS compatible powerdown mode |
1332 | * run "setterm -powersave powerdown" to take advantage | 1332 | * run "setterm -powersave powerdown" to take advantage |
1333 | */ | 1333 | */ |
1334 | struct neofb_par *par = (struct neofb_par *)info->par; | 1334 | struct neofb_par *par = info->par; |
1335 | int seqflags, lcdflags, dpmsflags, reg; | 1335 | int seqflags, lcdflags, dpmsflags, reg; |
1336 | 1336 | ||
1337 | switch (blank_mode) { | 1337 | switch (blank_mode) { |
@@ -1404,7 +1404,7 @@ static int neofb_blank(int blank_mode, struct fb_info *info) | |||
1404 | static void | 1404 | static void |
1405 | neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 1405 | neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
1406 | { | 1406 | { |
1407 | struct neofb_par *par = (struct neofb_par *) info->par; | 1407 | struct neofb_par *par = info->par; |
1408 | u_long dst, rop; | 1408 | u_long dst, rop; |
1409 | 1409 | ||
1410 | dst = rect->dx + rect->dy * info->var.xres_virtual; | 1410 | dst = rect->dx + rect->dy * info->var.xres_virtual; |
@@ -1440,7 +1440,7 @@ static void | |||
1440 | neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 1440 | neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
1441 | { | 1441 | { |
1442 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; | 1442 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; |
1443 | struct neofb_par *par = (struct neofb_par *) info->par; | 1443 | struct neofb_par *par = info->par; |
1444 | u_long src, dst, bltCntl; | 1444 | u_long src, dst, bltCntl; |
1445 | 1445 | ||
1446 | bltCntl = NEO_BC3_FIFO_EN | NEO_BC3_SKIP_MAPPING | 0x0C0000; | 1446 | bltCntl = NEO_BC3_FIFO_EN | NEO_BC3_SKIP_MAPPING | 0x0C0000; |
@@ -1472,7 +1472,7 @@ neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
1472 | static void | 1472 | static void |
1473 | neo2200_imageblit(struct fb_info *info, const struct fb_image *image) | 1473 | neo2200_imageblit(struct fb_info *info, const struct fb_image *image) |
1474 | { | 1474 | { |
1475 | struct neofb_par *par = (struct neofb_par *) info->par; | 1475 | struct neofb_par *par = info->par; |
1476 | int s_pitch = (image->width * image->depth + 7) >> 3; | 1476 | int s_pitch = (image->width * image->depth + 7) >> 3; |
1477 | int scan_align = info->pixmap.scan_align - 1; | 1477 | int scan_align = info->pixmap.scan_align - 1; |
1478 | int buf_align = info->pixmap.buf_align - 1; | 1478 | int buf_align = info->pixmap.buf_align - 1; |
@@ -1686,7 +1686,7 @@ static struct fb_videomode __devinitdata mode800x480 = { | |||
1686 | static int __devinit neo_map_mmio(struct fb_info *info, | 1686 | static int __devinit neo_map_mmio(struct fb_info *info, |
1687 | struct pci_dev *dev) | 1687 | struct pci_dev *dev) |
1688 | { | 1688 | { |
1689 | struct neofb_par *par = (struct neofb_par *) info->par; | 1689 | struct neofb_par *par = info->par; |
1690 | 1690 | ||
1691 | DBG("neo_map_mmio"); | 1691 | DBG("neo_map_mmio"); |
1692 | 1692 | ||
@@ -1733,7 +1733,7 @@ static int __devinit neo_map_mmio(struct fb_info *info, | |||
1733 | 1733 | ||
1734 | static void neo_unmap_mmio(struct fb_info *info) | 1734 | static void neo_unmap_mmio(struct fb_info *info) |
1735 | { | 1735 | { |
1736 | struct neofb_par *par = (struct neofb_par *) info->par; | 1736 | struct neofb_par *par = info->par; |
1737 | 1737 | ||
1738 | DBG("neo_unmap_mmio"); | 1738 | DBG("neo_unmap_mmio"); |
1739 | 1739 | ||
@@ -1796,7 +1796,7 @@ static void neo_unmap_video(struct fb_info *info) | |||
1796 | 1796 | ||
1797 | #ifdef CONFIG_MTRR | 1797 | #ifdef CONFIG_MTRR |
1798 | { | 1798 | { |
1799 | struct neofb_par *par = (struct neofb_par *) info->par; | 1799 | struct neofb_par *par = info->par; |
1800 | 1800 | ||
1801 | mtrr_del(par->mtrr, info->fix.smem_start, | 1801 | mtrr_del(par->mtrr, info->fix.smem_start, |
1802 | info->fix.smem_len); | 1802 | info->fix.smem_len); |
@@ -1811,7 +1811,7 @@ static void neo_unmap_video(struct fb_info *info) | |||
1811 | 1811 | ||
1812 | static int __devinit neo_scan_monitor(struct fb_info *info) | 1812 | static int __devinit neo_scan_monitor(struct fb_info *info) |
1813 | { | 1813 | { |
1814 | struct neofb_par *par = (struct neofb_par *) info->par; | 1814 | struct neofb_par *par = info->par; |
1815 | unsigned char type, display; | 1815 | unsigned char type, display; |
1816 | int w; | 1816 | int w; |
1817 | 1817 | ||
@@ -1890,7 +1890,7 @@ static int __devinit neo_scan_monitor(struct fb_info *info) | |||
1890 | 1890 | ||
1891 | static int __devinit neo_init_hw(struct fb_info *info) | 1891 | static int __devinit neo_init_hw(struct fb_info *info) |
1892 | { | 1892 | { |
1893 | struct neofb_par *par = (struct neofb_par *) info->par; | 1893 | struct neofb_par *par = info->par; |
1894 | int videoRam = 896; | 1894 | int videoRam = 896; |
1895 | int maxClock = 65000; | 1895 | int maxClock = 65000; |
1896 | int CursorMem = 1024; | 1896 | int CursorMem = 1024; |
@@ -2014,7 +2014,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st | |||
2014 | struct fb_info *info; | 2014 | struct fb_info *info; |
2015 | struct neofb_par *par; | 2015 | struct neofb_par *par; |
2016 | 2016 | ||
2017 | info = framebuffer_alloc(sizeof(struct neofb_par) + sizeof(u32) * 256, &dev->dev); | 2017 | info = framebuffer_alloc(sizeof(struct neofb_par), &dev->dev); |
2018 | 2018 | ||
2019 | if (!info) | 2019 | if (!info) |
2020 | return NULL; | 2020 | return NULL; |
@@ -2081,7 +2081,7 @@ static struct fb_info *__devinit neo_alloc_fb_info(struct pci_dev *dev, const st | |||
2081 | info->fix.accel = id->driver_data; | 2081 | info->fix.accel = id->driver_data; |
2082 | 2082 | ||
2083 | info->fbops = &neofb_ops; | 2083 | info->fbops = &neofb_ops; |
2084 | info->pseudo_palette = (void *) (par + 1); | 2084 | info->pseudo_palette = par->palette; |
2085 | return info; | 2085 | return info; |
2086 | } | 2086 | } |
2087 | 2087 | ||
diff --git a/drivers/video/nvidia/nv_hw.c b/drivers/video/nvidia/nv_hw.c index b989358437b3..99c3a8e6a237 100644 --- a/drivers/video/nvidia/nv_hw.c +++ b/drivers/video/nvidia/nv_hw.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
53 | #include "nv_type.h" | 53 | #include "nv_type.h" |
54 | #include "nv_local.h" | 54 | #include "nv_local.h" |
55 | #include "nv_proto.h" | ||
55 | 56 | ||
56 | void NVLockUnlock(struct nvidia_par *par, int Lock) | 57 | void NVLockUnlock(struct nvidia_par *par, int Lock) |
57 | { | 58 | { |
@@ -848,7 +849,7 @@ void NVCalcStateExt(struct nvidia_par *par, | |||
848 | int width, | 849 | int width, |
849 | int hDisplaySize, int height, int dotClock, int flags) | 850 | int hDisplaySize, int height, int dotClock, int flags) |
850 | { | 851 | { |
851 | int pixelDepth, VClk; | 852 | int pixelDepth, VClk = 0; |
852 | /* | 853 | /* |
853 | * Save mode parameters. | 854 | * Save mode parameters. |
854 | */ | 855 | */ |
@@ -938,15 +939,24 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
938 | 939 | ||
939 | if (par->Architecture == NV_ARCH_04) { | 940 | if (par->Architecture == NV_ARCH_04) { |
940 | NV_WR32(par->PFB, 0x0200, state->config); | 941 | NV_WR32(par->PFB, 0x0200, state->config); |
941 | } else if ((par->Chipset & 0xfff0) == 0x0090) { | 942 | } else if ((par->Architecture < NV_ARCH_40) || |
942 | for (i = 0; i < 15; i++) { | 943 | (par->Chipset & 0xfff0) == 0x0040) { |
943 | NV_WR32(par->PFB, 0x0600 + (i * 0x10), 0); | ||
944 | NV_WR32(par->PFB, 0x0604 + (i * 0x10), par->FbMapSize - 1); | ||
945 | } | ||
946 | } else { | ||
947 | for (i = 0; i < 8; i++) { | 944 | for (i = 0; i < 8; i++) { |
948 | NV_WR32(par->PFB, 0x0240 + (i * 0x10), 0); | 945 | NV_WR32(par->PFB, 0x0240 + (i * 0x10), 0); |
949 | NV_WR32(par->PFB, 0x0244 + (i * 0x10), par->FbMapSize - 1); | 946 | NV_WR32(par->PFB, 0x0244 + (i * 0x10), |
947 | par->FbMapSize - 1); | ||
948 | } | ||
949 | } else { | ||
950 | int regions = 12; | ||
951 | |||
952 | if (((par->Chipset & 0xfff0) == 0x0090) || | ||
953 | ((par->Chipset & 0xfff0) == 0x01D0) || | ||
954 | ((par->Chipset & 0xfff0) == 0x0290)) | ||
955 | regions = 15; | ||
956 | for(i = 0; i < regions; i++) { | ||
957 | NV_WR32(par->PFB, 0x0600 + (i * 0x10), 0); | ||
958 | NV_WR32(par->PFB, 0x0604 + (i * 0x10), | ||
959 | par->FbMapSize - 1); | ||
950 | } | 960 | } |
951 | } | 961 | } |
952 | 962 | ||
@@ -1182,11 +1192,17 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1182 | NV_WR32(par->PGRAPH, 0x0608, 0xFFFFFFFF); | 1192 | NV_WR32(par->PGRAPH, 0x0608, 0xFFFFFFFF); |
1183 | } else { | 1193 | } else { |
1184 | if (par->Architecture >= NV_ARCH_40) { | 1194 | if (par->Architecture >= NV_ARCH_40) { |
1195 | u32 tmp; | ||
1196 | |||
1185 | NV_WR32(par->PGRAPH, 0x0084, 0x401287c0); | 1197 | NV_WR32(par->PGRAPH, 0x0084, 0x401287c0); |
1186 | NV_WR32(par->PGRAPH, 0x008C, 0x60de8051); | 1198 | NV_WR32(par->PGRAPH, 0x008C, 0x60de8051); |
1187 | NV_WR32(par->PGRAPH, 0x0090, 0x00008000); | 1199 | NV_WR32(par->PGRAPH, 0x0090, 0x00008000); |
1188 | NV_WR32(par->PGRAPH, 0x0610, 0x00be3c5f); | 1200 | NV_WR32(par->PGRAPH, 0x0610, 0x00be3c5f); |
1189 | 1201 | ||
1202 | tmp = NV_RD32(par->REGS, 0x1540) & 0xff; | ||
1203 | for(i = 0; tmp && !(tmp & 1); tmp >>= 1, i++); | ||
1204 | NV_WR32(par->PGRAPH, 0x5000, i); | ||
1205 | |||
1190 | if ((par->Chipset & 0xfff0) == 0x0040) { | 1206 | if ((par->Chipset & 0xfff0) == 0x0040) { |
1191 | NV_WR32(par->PGRAPH, 0x09b0, | 1207 | NV_WR32(par->PGRAPH, 0x09b0, |
1192 | 0x83280fff); | 1208 | 0x83280fff); |
@@ -1211,6 +1227,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1211 | 0xffff7fff); | 1227 | 0xffff7fff); |
1212 | break; | 1228 | break; |
1213 | case 0x00C0: | 1229 | case 0x00C0: |
1230 | case 0x0120: | ||
1214 | NV_WR32(par->PGRAPH, 0x0828, | 1231 | NV_WR32(par->PGRAPH, 0x0828, |
1215 | 0x007596ff); | 1232 | 0x007596ff); |
1216 | NV_WR32(par->PGRAPH, 0x082C, | 1233 | NV_WR32(par->PGRAPH, 0x082C, |
@@ -1245,6 +1262,7 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1245 | 0x00100000); | 1262 | 0x00100000); |
1246 | break; | 1263 | break; |
1247 | case 0x0090: | 1264 | case 0x0090: |
1265 | case 0x0290: | ||
1248 | NV_WR32(par->PRAMDAC, 0x0608, | 1266 | NV_WR32(par->PRAMDAC, 0x0608, |
1249 | NV_RD32(par->PRAMDAC, 0x0608) | | 1267 | NV_RD32(par->PRAMDAC, 0x0608) | |
1250 | 0x00100000); | 1268 | 0x00100000); |
@@ -1310,14 +1328,44 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1310 | } | 1328 | } |
1311 | } | 1329 | } |
1312 | 1330 | ||
1313 | if ((par->Chipset & 0xfff0) == 0x0090) { | 1331 | if ((par->Architecture < NV_ARCH_40) || |
1314 | for (i = 0; i < 60; i++) | 1332 | ((par->Chipset & 0xfff0) == 0x0040)) { |
1315 | NV_WR32(par->PGRAPH, 0x0D00 + i, | 1333 | for (i = 0; i < 32; i++) { |
1316 | NV_RD32(par->PFB, 0x0600 + i)); | 1334 | NV_WR32(par->PGRAPH, 0x0900 + i*4, |
1335 | NV_RD32(par->PFB, 0x0240 +i*4)); | ||
1336 | NV_WR32(par->PGRAPH, 0x6900 + i*4, | ||
1337 | NV_RD32(par->PFB, 0x0240 +i*4)); | ||
1338 | } | ||
1317 | } else { | 1339 | } else { |
1318 | for (i = 0; i < 32; i++) | 1340 | if (((par->Chipset & 0xfff0) == 0x0090) || |
1319 | NV_WR32(par->PGRAPH, 0x0900 + i, | 1341 | ((par->Chipset & 0xfff0) == 0x01D0) || |
1320 | NV_RD32(par->PFB, 0x0240 + i)); | 1342 | ((par->Chipset & 0xfff0) == 0x0290)) { |
1343 | for (i = 0; i < 60; i++) { | ||
1344 | NV_WR32(par->PGRAPH, | ||
1345 | 0x0D00 + i*4, | ||
1346 | NV_RD32(par->PFB, | ||
1347 | 0x0600 + i*4)); | ||
1348 | NV_WR32(par->PGRAPH, | ||
1349 | 0x6900 + i*4, | ||
1350 | NV_RD32(par->PFB, | ||
1351 | 0x0600 + i*4)); | ||
1352 | } | ||
1353 | } else { | ||
1354 | for (i = 0; i < 48; i++) { | ||
1355 | NV_WR32(par->PGRAPH, | ||
1356 | 0x0900 + i*4, | ||
1357 | NV_RD32(par->PFB, | ||
1358 | 0x0600 + i*4)); | ||
1359 | if(((par->Chipset & 0xfff0) | ||
1360 | != 0x0160) && | ||
1361 | ((par->Chipset & 0xfff0) | ||
1362 | != 0x0220)) | ||
1363 | NV_WR32(par->PGRAPH, | ||
1364 | 0x6900 + i*4, | ||
1365 | NV_RD32(par->PFB, | ||
1366 | 0x0600 + i*4)); | ||
1367 | } | ||
1368 | } | ||
1321 | } | 1369 | } |
1322 | 1370 | ||
1323 | if (par->Architecture >= NV_ARCH_40) { | 1371 | if (par->Architecture >= NV_ARCH_40) { |
@@ -1338,7 +1386,9 @@ void NVLoadStateExt(struct nvidia_par *par, RIVA_HW_STATE * state) | |||
1338 | NV_WR32(par->PGRAPH, 0x0868, | 1386 | NV_WR32(par->PGRAPH, 0x0868, |
1339 | par->FbMapSize - 1); | 1387 | par->FbMapSize - 1); |
1340 | } else { | 1388 | } else { |
1341 | if((par->Chipset & 0xfff0) == 0x0090) { | 1389 | if ((par->Chipset & 0xfff0) == 0x0090 || |
1390 | (par->Chipset & 0xfff0) == 0x01D0 || | ||
1391 | (par->Chipset & 0xfff0) == 0x0290) { | ||
1342 | NV_WR32(par->PGRAPH, 0x0DF0, | 1392 | NV_WR32(par->PGRAPH, 0x0DF0, |
1343 | NV_RD32(par->PFB, 0x0200)); | 1393 | NV_RD32(par->PFB, 0x0200)); |
1344 | NV_WR32(par->PGRAPH, 0x0DF4, | 1394 | NV_WR32(par->PGRAPH, 0x0DF4, |
diff --git a/drivers/video/nvidia/nv_i2c.c b/drivers/video/nvidia/nv_i2c.c index 12f2884d3f0b..bd9eca05e146 100644 --- a/drivers/video/nvidia/nv_i2c.c +++ b/drivers/video/nvidia/nv_i2c.c | |||
@@ -46,7 +46,7 @@ static void nvidia_gpio_setscl(void *data, int state) | |||
46 | 46 | ||
47 | static void nvidia_gpio_setsda(void *data, int state) | 47 | static void nvidia_gpio_setsda(void *data, int state) |
48 | { | 48 | { |
49 | struct nvidia_i2c_chan *chan = (struct nvidia_i2c_chan *)data; | 49 | struct nvidia_i2c_chan *chan = data; |
50 | struct nvidia_par *par = chan->par; | 50 | struct nvidia_par *par = chan->par; |
51 | u32 val; | 51 | u32 val; |
52 | 52 | ||
@@ -64,7 +64,7 @@ static void nvidia_gpio_setsda(void *data, int state) | |||
64 | 64 | ||
65 | static int nvidia_gpio_getscl(void *data) | 65 | static int nvidia_gpio_getscl(void *data) |
66 | { | 66 | { |
67 | struct nvidia_i2c_chan *chan = (struct nvidia_i2c_chan *)data; | 67 | struct nvidia_i2c_chan *chan = data; |
68 | struct nvidia_par *par = chan->par; | 68 | struct nvidia_par *par = chan->par; |
69 | u32 val = 0; | 69 | u32 val = 0; |
70 | 70 | ||
@@ -79,7 +79,7 @@ static int nvidia_gpio_getscl(void *data) | |||
79 | 79 | ||
80 | static int nvidia_gpio_getsda(void *data) | 80 | static int nvidia_gpio_getsda(void *data) |
81 | { | 81 | { |
82 | struct nvidia_i2c_chan *chan = (struct nvidia_i2c_chan *)data; | 82 | struct nvidia_i2c_chan *chan = data; |
83 | struct nvidia_par *par = chan->par; | 83 | struct nvidia_par *par = chan->par; |
84 | u32 val = 0; | 84 | u32 val = 0; |
85 | 85 | ||
@@ -136,13 +136,13 @@ void nvidia_create_i2c_busses(struct nvidia_par *par) | |||
136 | par->chan[2].par = par; | 136 | par->chan[2].par = par; |
137 | 137 | ||
138 | par->chan[0].ddc_base = 0x3e; | 138 | par->chan[0].ddc_base = 0x3e; |
139 | nvidia_setup_i2c_bus(&par->chan[0], "BUS1"); | 139 | nvidia_setup_i2c_bus(&par->chan[0], "nvidia #0"); |
140 | 140 | ||
141 | par->chan[1].ddc_base = 0x36; | 141 | par->chan[1].ddc_base = 0x36; |
142 | nvidia_setup_i2c_bus(&par->chan[1], "BUS2"); | 142 | nvidia_setup_i2c_bus(&par->chan[1], "nvidia #1"); |
143 | 143 | ||
144 | par->chan[2].ddc_base = 0x50; | 144 | par->chan[2].ddc_base = 0x50; |
145 | nvidia_setup_i2c_bus(&par->chan[2], "BUS3"); | 145 | nvidia_setup_i2c_bus(&par->chan[2], "nvidia #2"); |
146 | } | 146 | } |
147 | 147 | ||
148 | void nvidia_delete_i2c_busses(struct nvidia_par *par) | 148 | void nvidia_delete_i2c_busses(struct nvidia_par *par) |
diff --git a/drivers/video/nvidia/nv_proto.h b/drivers/video/nvidia/nv_proto.h index 3353103e8b0b..b149a690ee0f 100644 --- a/drivers/video/nvidia/nv_proto.h +++ b/drivers/video/nvidia/nv_proto.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #define __NV_PROTO_H__ | 4 | #define __NV_PROTO_H__ |
5 | 5 | ||
6 | /* in nv_setup.c */ | 6 | /* in nv_setup.c */ |
7 | void NVCommonSetup(struct fb_info *info); | 7 | int NVCommonSetup(struct fb_info *info); |
8 | void NVWriteCrtc(struct nvidia_par *par, u8 index, u8 value); | 8 | void NVWriteCrtc(struct nvidia_par *par, u8 index, u8 value); |
9 | u8 NVReadCrtc(struct nvidia_par *par, u8 index); | 9 | u8 NVReadCrtc(struct nvidia_par *par, u8 index); |
10 | void NVWriteGr(struct nvidia_par *par, u8 index, u8 value); | 10 | void NVWriteGr(struct nvidia_par *par, u8 index, u8 value); |
diff --git a/drivers/video/nvidia/nv_setup.c b/drivers/video/nvidia/nv_setup.c index 1f06a9f1bd0f..a18a9aebf05f 100644 --- a/drivers/video/nvidia/nv_setup.c +++ b/drivers/video/nvidia/nv_setup.c | |||
@@ -285,28 +285,34 @@ static void nv10GetConfig(struct nvidia_par *par) | |||
285 | par->CrystalFreqKHz = 27000; | 285 | par->CrystalFreqKHz = 27000; |
286 | } | 286 | } |
287 | 287 | ||
288 | par->CursorStart = (par->RamAmountKBytes - 96) * 1024; | ||
289 | par->CURSOR = NULL; /* can't set this here */ | 288 | par->CURSOR = NULL; /* can't set this here */ |
290 | par->MinVClockFreqKHz = 12000; | 289 | par->MinVClockFreqKHz = 12000; |
291 | par->MaxVClockFreqKHz = par->twoStagePLL ? 400000 : 350000; | 290 | par->MaxVClockFreqKHz = par->twoStagePLL ? 400000 : 350000; |
292 | } | 291 | } |
293 | 292 | ||
294 | void NVCommonSetup(struct fb_info *info) | 293 | int NVCommonSetup(struct fb_info *info) |
295 | { | 294 | { |
296 | struct nvidia_par *par = info->par; | 295 | struct nvidia_par *par = info->par; |
297 | struct fb_var_screeninfo var; | 296 | struct fb_var_screeninfo *var; |
298 | u16 implementation = par->Chipset & 0x0ff0; | 297 | u16 implementation = par->Chipset & 0x0ff0; |
299 | u8 *edidA = NULL, *edidB = NULL; | 298 | u8 *edidA = NULL, *edidB = NULL; |
300 | struct fb_monspecs monitorA, monitorB; | 299 | struct fb_monspecs *monitorA, *monitorB; |
301 | struct fb_monspecs *monA = NULL, *monB = NULL; | 300 | struct fb_monspecs *monA = NULL, *monB = NULL; |
302 | int mobile = 0; | 301 | int mobile = 0; |
303 | int tvA = 0; | 302 | int tvA = 0; |
304 | int tvB = 0; | 303 | int tvB = 0; |
305 | int FlatPanel = -1; /* really means the CRTC is slaved */ | 304 | int FlatPanel = -1; /* really means the CRTC is slaved */ |
306 | int Television = 0; | 305 | int Television = 0; |
306 | int err = 0; | ||
307 | 307 | ||
308 | memset(&monitorA, 0, sizeof(struct fb_monspecs)); | 308 | var = kzalloc(sizeof(struct fb_var_screeninfo), GFP_KERNEL); |
309 | memset(&monitorB, 0, sizeof(struct fb_monspecs)); | 309 | monitorA = kzalloc(sizeof(struct fb_monspecs), GFP_KERNEL); |
310 | monitorB = kzalloc(sizeof(struct fb_monspecs), GFP_KERNEL); | ||
311 | |||
312 | if (!var || !monitorA || !monitorB) { | ||
313 | err = -ENOMEM; | ||
314 | goto done; | ||
315 | } | ||
310 | 316 | ||
311 | par->PRAMIN = par->REGS + (0x00710000 / 4); | 317 | par->PRAMIN = par->REGS + (0x00710000 / 4); |
312 | par->PCRTC0 = par->REGS + (0x00600000 / 4); | 318 | par->PCRTC0 = par->REGS + (0x00600000 / 4); |
@@ -382,6 +388,8 @@ void NVCommonSetup(struct fb_info *info) | |||
382 | case 0x0146: | 388 | case 0x0146: |
383 | case 0x0147: | 389 | case 0x0147: |
384 | case 0x0148: | 390 | case 0x0148: |
391 | case 0x0098: | ||
392 | case 0x0099: | ||
385 | mobile = 1; | 393 | mobile = 1; |
386 | break; | 394 | break; |
387 | default: | 395 | default: |
@@ -406,9 +414,9 @@ void NVCommonSetup(struct fb_info *info) | |||
406 | par->CRTCnumber = 0; | 414 | par->CRTCnumber = 0; |
407 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) | 415 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) |
408 | nvidia_probe_of_connector(info, 1, &edidA); | 416 | nvidia_probe_of_connector(info, 1, &edidA); |
409 | if (edidA && !fb_parse_edid(edidA, &var)) { | 417 | if (edidA && !fb_parse_edid(edidA, var)) { |
410 | printk("nvidiafb: EDID found from BUS1\n"); | 418 | printk("nvidiafb: EDID found from BUS1\n"); |
411 | monA = &monitorA; | 419 | monA = monitorA; |
412 | fb_edid_to_monspecs(edidA, monA); | 420 | fb_edid_to_monspecs(edidA, monA); |
413 | FlatPanel = (monA->input & FB_DISP_DDI) ? 1 : 0; | 421 | FlatPanel = (monA->input & FB_DISP_DDI) ? 1 : 0; |
414 | 422 | ||
@@ -494,17 +502,17 @@ void NVCommonSetup(struct fb_info *info) | |||
494 | 502 | ||
495 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) | 503 | if (nvidia_probe_i2c_connector(info, 1, &edidA)) |
496 | nvidia_probe_of_connector(info, 1, &edidA); | 504 | nvidia_probe_of_connector(info, 1, &edidA); |
497 | if (edidA && !fb_parse_edid(edidA, &var)) { | 505 | if (edidA && !fb_parse_edid(edidA, var)) { |
498 | printk("nvidiafb: EDID found from BUS1\n"); | 506 | printk("nvidiafb: EDID found from BUS1\n"); |
499 | monA = &monitorA; | 507 | monA = monitorA; |
500 | fb_edid_to_monspecs(edidA, monA); | 508 | fb_edid_to_monspecs(edidA, monA); |
501 | } | 509 | } |
502 | 510 | ||
503 | if (nvidia_probe_i2c_connector(info, 2, &edidB)) | 511 | if (nvidia_probe_i2c_connector(info, 2, &edidB)) |
504 | nvidia_probe_of_connector(info, 2, &edidB); | 512 | nvidia_probe_of_connector(info, 2, &edidB); |
505 | if (edidB && !fb_parse_edid(edidB, &var)) { | 513 | if (edidB && !fb_parse_edid(edidB, var)) { |
506 | printk("nvidiafb: EDID found from BUS2\n"); | 514 | printk("nvidiafb: EDID found from BUS2\n"); |
507 | monB = &monitorB; | 515 | monB = monitorB; |
508 | fb_edid_to_monspecs(edidB, monB); | 516 | fb_edid_to_monspecs(edidB, monB); |
509 | } | 517 | } |
510 | 518 | ||
@@ -639,4 +647,9 @@ void NVCommonSetup(struct fb_info *info) | |||
639 | 647 | ||
640 | kfree(edidA); | 648 | kfree(edidA); |
641 | kfree(edidB); | 649 | kfree(edidB); |
650 | done: | ||
651 | kfree(var); | ||
652 | kfree(monitorA); | ||
653 | kfree(monitorB); | ||
654 | return err; | ||
642 | } | 655 | } |
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c index bee09c6e48f6..dbcb8962e57d 100644 --- a/drivers/video/nvidia/nvidia.c +++ b/drivers/video/nvidia/nvidia.c | |||
@@ -284,6 +284,16 @@ static struct pci_device_id nvidiafb_pci_tbl[] = { | |||
284 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 284 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
285 | {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200, | 285 | {PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_6200, |
286 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 286 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
287 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1, | ||
288 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
289 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1, | ||
290 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
291 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2, | ||
292 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
293 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1, | ||
294 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
295 | {PCI_VENDOR_ID_NVIDIA, PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT, | ||
296 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
287 | {PCI_VENDOR_ID_NVIDIA, 0x0252, | 297 | {PCI_VENDOR_ID_NVIDIA, 0x0252, |
288 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 298 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
289 | {PCI_VENDOR_ID_NVIDIA, 0x0313, | 299 | {PCI_VENDOR_ID_NVIDIA, 0x0313, |
@@ -418,6 +428,7 @@ static int noaccel __devinitdata = 0; | |||
418 | static int noscale __devinitdata = 0; | 428 | static int noscale __devinitdata = 0; |
419 | static int paneltweak __devinitdata = 0; | 429 | static int paneltweak __devinitdata = 0; |
420 | static int vram __devinitdata = 0; | 430 | static int vram __devinitdata = 0; |
431 | static int bpp __devinitdata = 8; | ||
421 | #ifdef CONFIG_MTRR | 432 | #ifdef CONFIG_MTRR |
422 | static int nomtrr __devinitdata = 0; | 433 | static int nomtrr __devinitdata = 0; |
423 | #endif | 434 | #endif |
@@ -485,7 +496,7 @@ static int nvidia_backlight_levels[] = { | |||
485 | 496 | ||
486 | static int nvidia_set_backlight_enable(int on, int level, void *data) | 497 | static int nvidia_set_backlight_enable(int on, int level, void *data) |
487 | { | 498 | { |
488 | struct nvidia_par *par = (struct nvidia_par *)data; | 499 | struct nvidia_par *par = data; |
489 | u32 tmp_pcrt, tmp_pmc, fpcontrol; | 500 | u32 tmp_pcrt, tmp_pmc, fpcontrol; |
490 | 501 | ||
491 | tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; | 502 | tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; |
@@ -1382,24 +1393,36 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info) | |||
1382 | info->monspecs.modedb_len, &info->modelist); | 1393 | info->monspecs.modedb_len, &info->modelist); |
1383 | fb_var_to_videomode(&modedb, &nvidiafb_default_var); | 1394 | fb_var_to_videomode(&modedb, &nvidiafb_default_var); |
1384 | 1395 | ||
1396 | switch (bpp) { | ||
1397 | case 0 ... 8: | ||
1398 | bpp = 8; | ||
1399 | break; | ||
1400 | case 9 ... 16: | ||
1401 | bpp = 16; | ||
1402 | break; | ||
1403 | default: | ||
1404 | bpp = 32; | ||
1405 | break; | ||
1406 | } | ||
1407 | |||
1385 | if (specs->modedb != NULL) { | 1408 | if (specs->modedb != NULL) { |
1386 | struct fb_videomode *modedb; | 1409 | struct fb_videomode *modedb; |
1387 | 1410 | ||
1388 | modedb = fb_find_best_display(specs, &info->modelist); | 1411 | modedb = fb_find_best_display(specs, &info->modelist); |
1389 | fb_videomode_to_var(&nvidiafb_default_var, modedb); | 1412 | fb_videomode_to_var(&nvidiafb_default_var, modedb); |
1390 | nvidiafb_default_var.bits_per_pixel = 8; | 1413 | nvidiafb_default_var.bits_per_pixel = bpp; |
1391 | } else if (par->fpWidth && par->fpHeight) { | 1414 | } else if (par->fpWidth && par->fpHeight) { |
1392 | char buf[16]; | 1415 | char buf[16]; |
1393 | 1416 | ||
1394 | memset(buf, 0, 16); | 1417 | memset(buf, 0, 16); |
1395 | snprintf(buf, 15, "%dx%dMR", par->fpWidth, par->fpHeight); | 1418 | snprintf(buf, 15, "%dx%dMR", par->fpWidth, par->fpHeight); |
1396 | fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb, | 1419 | fb_find_mode(&nvidiafb_default_var, info, buf, specs->modedb, |
1397 | specs->modedb_len, &modedb, 8); | 1420 | specs->modedb_len, &modedb, bpp); |
1398 | } | 1421 | } |
1399 | 1422 | ||
1400 | if (mode_option) | 1423 | if (mode_option) |
1401 | fb_find_mode(&nvidiafb_default_var, info, mode_option, | 1424 | fb_find_mode(&nvidiafb_default_var, info, mode_option, |
1402 | specs->modedb, specs->modedb_len, &modedb, 8); | 1425 | specs->modedb, specs->modedb_len, &modedb, bpp); |
1403 | 1426 | ||
1404 | info->var = nvidiafb_default_var; | 1427 | info->var = nvidiafb_default_var; |
1405 | info->fix.visual = (info->var.bits_per_pixel == 8) ? | 1428 | info->fix.visual = (info->var.bits_per_pixel == 8) ? |
@@ -1448,11 +1471,34 @@ static int __devinit nvidia_set_fbinfo(struct fb_info *info) | |||
1448 | return nvidiafb_check_var(&info->var, info); | 1471 | return nvidiafb_check_var(&info->var, info); |
1449 | } | 1472 | } |
1450 | 1473 | ||
1451 | static u32 __devinit nvidia_get_arch(struct pci_dev *pd) | 1474 | static u32 __devinit nvidia_get_chipset(struct fb_info *info) |
1452 | { | 1475 | { |
1476 | struct nvidia_par *par = info->par; | ||
1477 | u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device; | ||
1478 | |||
1479 | printk("nvidiafb: PCI id - %x\n", id); | ||
1480 | if ((id & 0xfff0) == 0x00f0) { | ||
1481 | /* pci-e */ | ||
1482 | printk("nvidiafb: PCI-E card\n"); | ||
1483 | id = NV_RD32(par->REGS, 0x1800); | ||
1484 | |||
1485 | if ((id & 0x0000ffff) == 0x000010DE) | ||
1486 | id = 0x10DE0000 | (id >> 16); | ||
1487 | else if ((id & 0xffff0000) == 0xDE100000) /* wrong endian */ | ||
1488 | id = 0x10DE0000 | ((id << 8) & 0x0000ff00) | | ||
1489 | ((id >> 8) & 0x000000ff); | ||
1490 | } | ||
1491 | |||
1492 | printk("nvidiafb: Actual id - %x\n", id); | ||
1493 | return id; | ||
1494 | } | ||
1495 | |||
1496 | static u32 __devinit nvidia_get_arch(struct fb_info *info) | ||
1497 | { | ||
1498 | struct nvidia_par *par = info->par; | ||
1453 | u32 arch = 0; | 1499 | u32 arch = 0; |
1454 | 1500 | ||
1455 | switch (pd->device & 0x0ff0) { | 1501 | switch (par->Chipset & 0x0ff0) { |
1456 | case 0x0100: /* GeForce 256 */ | 1502 | case 0x0100: /* GeForce 256 */ |
1457 | case 0x0110: /* GeForce2 MX */ | 1503 | case 0x0110: /* GeForce2 MX */ |
1458 | case 0x0150: /* GeForce2 */ | 1504 | case 0x0150: /* GeForce2 */ |
@@ -1485,6 +1531,8 @@ static u32 __devinit nvidia_get_arch(struct pci_dev *pd) | |||
1485 | case 0x0210: | 1531 | case 0x0210: |
1486 | case 0x0220: | 1532 | case 0x0220: |
1487 | case 0x0230: | 1533 | case 0x0230: |
1534 | case 0x0290: | ||
1535 | case 0x0390: | ||
1488 | arch = NV_ARCH_40; | 1536 | arch = NV_ARCH_40; |
1489 | break; | 1537 | break; |
1490 | case 0x0020: /* TNT, TNT2 */ | 1538 | case 0x0020: /* TNT, TNT2 */ |
@@ -1513,7 +1561,7 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1513 | if (!info) | 1561 | if (!info) |
1514 | goto err_out; | 1562 | goto err_out; |
1515 | 1563 | ||
1516 | par = (struct nvidia_par *)info->par; | 1564 | par = info->par; |
1517 | par->pci_dev = pd; | 1565 | par->pci_dev = pd; |
1518 | 1566 | ||
1519 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); | 1567 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); |
@@ -1533,18 +1581,6 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1533 | goto err_out_request; | 1581 | goto err_out_request; |
1534 | } | 1582 | } |
1535 | 1583 | ||
1536 | par->Architecture = nvidia_get_arch(pd); | ||
1537 | |||
1538 | par->Chipset = (pd->vendor << 16) | pd->device; | ||
1539 | printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset); | ||
1540 | |||
1541 | if (par->Architecture == 0) { | ||
1542 | printk(KERN_ERR PFX "unknown NV_ARCH\n"); | ||
1543 | goto err_out_free_base0; | ||
1544 | } | ||
1545 | |||
1546 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); | ||
1547 | |||
1548 | par->FlatPanel = flatpanel; | 1584 | par->FlatPanel = flatpanel; |
1549 | if (flatpanel == 1) | 1585 | if (flatpanel == 1) |
1550 | printk(KERN_INFO PFX "flatpanel support enabled\n"); | 1586 | printk(KERN_INFO PFX "flatpanel support enabled\n"); |
@@ -1570,7 +1606,19 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1570 | goto err_out_free_base0; | 1606 | goto err_out_free_base0; |
1571 | } | 1607 | } |
1572 | 1608 | ||
1573 | NVCommonSetup(info); | 1609 | par->Chipset = nvidia_get_chipset(info); |
1610 | printk(KERN_INFO PFX "nVidia device/chipset %X\n", par->Chipset); | ||
1611 | par->Architecture = nvidia_get_arch(info); | ||
1612 | |||
1613 | if (par->Architecture == 0) { | ||
1614 | printk(KERN_ERR PFX "unknown NV_ARCH\n"); | ||
1615 | goto err_out_arch; | ||
1616 | } | ||
1617 | |||
1618 | sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4); | ||
1619 | |||
1620 | if (NVCommonSetup(info)) | ||
1621 | goto err_out_arch; | ||
1574 | 1622 | ||
1575 | par->FbAddress = nvidiafb_fix.smem_start; | 1623 | par->FbAddress = nvidiafb_fix.smem_start; |
1576 | par->FbMapSize = par->RamAmountKBytes * 1024; | 1624 | par->FbMapSize = par->RamAmountKBytes * 1024; |
@@ -1581,10 +1629,15 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1581 | if (par->FbMapSize > 64 * 1024 * 1024) | 1629 | if (par->FbMapSize > 64 * 1024 * 1024) |
1582 | par->FbMapSize = 64 * 1024 * 1024; | 1630 | par->FbMapSize = 64 * 1024 * 1024; |
1583 | 1631 | ||
1584 | par->FbUsableSize = par->FbMapSize - (128 * 1024); | 1632 | if(par->Architecture >= NV_ARCH_40) |
1633 | par->FbUsableSize = par->FbMapSize - (560 * 1024); | ||
1634 | else | ||
1635 | par->FbUsableSize = par->FbMapSize - (128 * 1024); | ||
1585 | par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 : | 1636 | par->ScratchBufferSize = (par->Architecture < NV_ARCH_10) ? 8 * 1024 : |
1586 | 16 * 1024; | 1637 | 16 * 1024; |
1587 | par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize; | 1638 | par->ScratchBufferStart = par->FbUsableSize - par->ScratchBufferSize; |
1639 | par->CursorStart = par->FbUsableSize + (32 * 1024); | ||
1640 | |||
1588 | info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize); | 1641 | info->screen_base = ioremap(nvidiafb_fix.smem_start, par->FbMapSize); |
1589 | info->screen_size = par->FbUsableSize; | 1642 | info->screen_size = par->FbUsableSize; |
1590 | nvidiafb_fix.smem_len = par->RamAmountKBytes * 1024; | 1643 | nvidiafb_fix.smem_len = par->RamAmountKBytes * 1024; |
@@ -1640,21 +1693,22 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd, | |||
1640 | NVTRACE_LEAVE(); | 1693 | NVTRACE_LEAVE(); |
1641 | return 0; | 1694 | return 0; |
1642 | 1695 | ||
1643 | err_out_iounmap_fb: | 1696 | err_out_iounmap_fb: |
1644 | iounmap(info->screen_base); | 1697 | iounmap(info->screen_base); |
1645 | err_out_free_base1: | 1698 | err_out_free_base1: |
1646 | fb_destroy_modedb(info->monspecs.modedb); | 1699 | fb_destroy_modedb(info->monspecs.modedb); |
1647 | nvidia_delete_i2c_busses(par); | 1700 | nvidia_delete_i2c_busses(par); |
1701 | err_out_arch: | ||
1648 | iounmap(par->REGS); | 1702 | iounmap(par->REGS); |
1649 | err_out_free_base0: | 1703 | err_out_free_base0: |
1650 | pci_release_regions(pd); | 1704 | pci_release_regions(pd); |
1651 | err_out_request: | 1705 | err_out_request: |
1652 | pci_disable_device(pd); | 1706 | pci_disable_device(pd); |
1653 | err_out_enable: | 1707 | err_out_enable: |
1654 | kfree(info->pixmap.addr); | 1708 | kfree(info->pixmap.addr); |
1655 | err_out_kfree: | 1709 | err_out_kfree: |
1656 | framebuffer_release(info); | 1710 | framebuffer_release(info); |
1657 | err_out: | 1711 | err_out: |
1658 | return -ENODEV; | 1712 | return -ENODEV; |
1659 | } | 1713 | } |
1660 | 1714 | ||
@@ -1729,6 +1783,8 @@ static int __devinit nvidiafb_setup(char *options) | |||
1729 | #endif | 1783 | #endif |
1730 | } else if (!strncmp(this_opt, "fpdither:", 9)) { | 1784 | } else if (!strncmp(this_opt, "fpdither:", 9)) { |
1731 | fpdither = simple_strtol(this_opt+9, NULL, 0); | 1785 | fpdither = simple_strtol(this_opt+9, NULL, 0); |
1786 | } else if (!strncmp(this_opt, "bpp:", 4)) { | ||
1787 | bpp = simple_strtoul(this_opt+4, NULL, 0); | ||
1732 | } else | 1788 | } else |
1733 | mode_option = this_opt; | 1789 | mode_option = this_opt; |
1734 | } | 1790 | } |
@@ -1804,6 +1860,11 @@ module_param(vram, int, 0); | |||
1804 | MODULE_PARM_DESC(vram, | 1860 | MODULE_PARM_DESC(vram, |
1805 | "amount of framebuffer memory to remap in MiB" | 1861 | "amount of framebuffer memory to remap in MiB" |
1806 | "(default=0 - remap entire memory)"); | 1862 | "(default=0 - remap entire memory)"); |
1863 | module_param(mode_option, charp, 0); | ||
1864 | MODULE_PARM_DESC(mode_option, "Specify initial video mode"); | ||
1865 | module_param(bpp, int, 0); | ||
1866 | MODULE_PARM_DESC(bpp, "pixel width in bits" | ||
1867 | "(default=8)"); | ||
1807 | #ifdef CONFIG_MTRR | 1868 | #ifdef CONFIG_MTRR |
1808 | module_param(nomtrr, bool, 0); | 1869 | module_param(nomtrr, bool, 0); |
1809 | MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " | 1870 | MODULE_PARM_DESC(nomtrr, "Disables MTRR support (0 or 1=disabled) " |
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 0277ce031e5e..5fe197943deb 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
@@ -91,6 +91,7 @@ struct pm2fb_par | |||
91 | u32 mem_config; /* MemConfig reg at probe */ | 91 | u32 mem_config; /* MemConfig reg at probe */ |
92 | u32 mem_control; /* MemControl reg at probe */ | 92 | u32 mem_control; /* MemControl reg at probe */ |
93 | u32 boot_address; /* BootAddress reg at probe */ | 93 | u32 boot_address; /* BootAddress reg at probe */ |
94 | u32 palette[16]; | ||
94 | }; | 95 | }; |
95 | 96 | ||
96 | /* | 97 | /* |
@@ -674,7 +675,7 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
674 | */ | 675 | */ |
675 | static int pm2fb_set_par(struct fb_info *info) | 676 | static int pm2fb_set_par(struct fb_info *info) |
676 | { | 677 | { |
677 | struct pm2fb_par *par = (struct pm2fb_par *) info->par; | 678 | struct pm2fb_par *par = info->par; |
678 | u32 pixclock; | 679 | u32 pixclock; |
679 | u32 width, height, depth; | 680 | u32 width, height, depth; |
680 | u32 hsstart, hsend, hbend, htotal; | 681 | u32 hsstart, hsend, hbend, htotal; |
@@ -854,7 +855,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
854 | unsigned blue, unsigned transp, | 855 | unsigned blue, unsigned transp, |
855 | struct fb_info *info) | 856 | struct fb_info *info) |
856 | { | 857 | { |
857 | struct pm2fb_par *par = (struct pm2fb_par *) info->par; | 858 | struct pm2fb_par *par = info->par; |
858 | 859 | ||
859 | if (regno >= info->cmap.len) /* no. of hw registers */ | 860 | if (regno >= info->cmap.len) /* no. of hw registers */ |
860 | return 1; | 861 | return 1; |
@@ -929,7 +930,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
929 | case 16: | 930 | case 16: |
930 | case 24: | 931 | case 24: |
931 | case 32: | 932 | case 32: |
932 | ((u32*)(info->pseudo_palette))[regno] = v; | 933 | par->palette[regno] = v; |
933 | break; | 934 | break; |
934 | } | 935 | } |
935 | return 0; | 936 | return 0; |
@@ -955,7 +956,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
955 | static int pm2fb_pan_display(struct fb_var_screeninfo *var, | 956 | static int pm2fb_pan_display(struct fb_var_screeninfo *var, |
956 | struct fb_info *info) | 957 | struct fb_info *info) |
957 | { | 958 | { |
958 | struct pm2fb_par *p = (struct pm2fb_par *) info->par; | 959 | struct pm2fb_par *p = info->par; |
959 | u32 base; | 960 | u32 base; |
960 | u32 depth; | 961 | u32 depth; |
961 | u32 xres; | 962 | u32 xres; |
@@ -987,7 +988,7 @@ static int pm2fb_pan_display(struct fb_var_screeninfo *var, | |||
987 | */ | 988 | */ |
988 | static int pm2fb_blank(int blank_mode, struct fb_info *info) | 989 | static int pm2fb_blank(int blank_mode, struct fb_info *info) |
989 | { | 990 | { |
990 | struct pm2fb_par *par = (struct pm2fb_par *) info->par; | 991 | struct pm2fb_par *par = info->par; |
991 | u32 video = par->video; | 992 | u32 video = par->video; |
992 | 993 | ||
993 | DPRINTK("blank_mode %d\n", blank_mode); | 994 | DPRINTK("blank_mode %d\n", blank_mode); |
@@ -1054,8 +1055,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1054 | { | 1055 | { |
1055 | struct pm2fb_par *default_par; | 1056 | struct pm2fb_par *default_par; |
1056 | struct fb_info *info; | 1057 | struct fb_info *info; |
1057 | int size, err; | 1058 | int err, err_retval = -ENXIO; |
1058 | int err_retval = -ENXIO; | ||
1059 | 1059 | ||
1060 | err = pci_enable_device(pdev); | 1060 | err = pci_enable_device(pdev); |
1061 | if ( err ) { | 1061 | if ( err ) { |
@@ -1063,11 +1063,10 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1063 | return err; | 1063 | return err; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | size = sizeof(struct pm2fb_par) + 256 * sizeof(u32); | 1066 | info = framebuffer_alloc(sizeof(struct pm2fb_par), &pdev->dev); |
1067 | info = framebuffer_alloc(size, &pdev->dev); | ||
1068 | if ( !info ) | 1067 | if ( !info ) |
1069 | return -ENOMEM; | 1068 | return -ENOMEM; |
1070 | default_par = (struct pm2fb_par *) info->par; | 1069 | default_par = info->par; |
1071 | 1070 | ||
1072 | switch (pdev->device) { | 1071 | switch (pdev->device) { |
1073 | case PCI_DEVICE_ID_TI_TVP4020: | 1072 | case PCI_DEVICE_ID_TI_TVP4020: |
@@ -1171,7 +1170,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev, | |||
1171 | 1170 | ||
1172 | info->fbops = &pm2fb_ops; | 1171 | info->fbops = &pm2fb_ops; |
1173 | info->fix = pm2fb_fix; | 1172 | info->fix = pm2fb_fix; |
1174 | info->pseudo_palette = (void *)(default_par + 1); | 1173 | info->pseudo_palette = default_par->palette; |
1175 | info->flags = FBINFO_DEFAULT | | 1174 | info->flags = FBINFO_DEFAULT | |
1176 | FBINFO_HWACCEL_YPAN; | 1175 | FBINFO_HWACCEL_YPAN; |
1177 | 1176 | ||
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 3e9f96e9237d..6c19ab6afb01 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -630,7 +630,7 @@ static void riva_load_video_mode(struct fb_info *info) | |||
630 | int bpp, width, hDisplaySize, hDisplay, hStart, | 630 | int bpp, width, hDisplaySize, hDisplay, hStart, |
631 | hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock; | 631 | hEnd, hTotal, height, vDisplay, vStart, vEnd, vTotal, dotClock; |
632 | int hBlankStart, hBlankEnd, vBlankStart, vBlankEnd; | 632 | int hBlankStart, hBlankEnd, vBlankStart, vBlankEnd; |
633 | struct riva_par *par = (struct riva_par *) info->par; | 633 | struct riva_par *par = info->par; |
634 | struct riva_regs newmode; | 634 | struct riva_regs newmode; |
635 | 635 | ||
636 | NVTRACE_ENTER(); | 636 | NVTRACE_ENTER(); |
@@ -925,7 +925,7 @@ riva_set_rop_solid(struct riva_par *par, int rop) | |||
925 | 925 | ||
926 | static void riva_setup_accel(struct fb_info *info) | 926 | static void riva_setup_accel(struct fb_info *info) |
927 | { | 927 | { |
928 | struct riva_par *par = (struct riva_par *) info->par; | 928 | struct riva_par *par = info->par; |
929 | 929 | ||
930 | RIVA_FIFO_FREE(par->riva, Clip, 2); | 930 | RIVA_FIFO_FREE(par->riva, Clip, 2); |
931 | NV_WR32(&par->riva.Clip->TopLeft, 0, 0x0); | 931 | NV_WR32(&par->riva.Clip->TopLeft, 0, 0x0); |
@@ -979,7 +979,7 @@ static int riva_get_cmap_len(const struct fb_var_screeninfo *var) | |||
979 | #ifdef CONFIG_PMAC_BACKLIGHT | 979 | #ifdef CONFIG_PMAC_BACKLIGHT |
980 | static int riva_set_backlight_enable(int on, int level, void *data) | 980 | static int riva_set_backlight_enable(int on, int level, void *data) |
981 | { | 981 | { |
982 | struct riva_par *par = (struct riva_par *)data; | 982 | struct riva_par *par = data; |
983 | U032 tmp_pcrt, tmp_pmc; | 983 | U032 tmp_pcrt, tmp_pmc; |
984 | 984 | ||
985 | tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; | 985 | tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF; |
@@ -1008,7 +1008,7 @@ static int riva_set_backlight_level(int level, void *data) | |||
1008 | 1008 | ||
1009 | static int rivafb_open(struct fb_info *info, int user) | 1009 | static int rivafb_open(struct fb_info *info, int user) |
1010 | { | 1010 | { |
1011 | struct riva_par *par = (struct riva_par *) info->par; | 1011 | struct riva_par *par = info->par; |
1012 | int cnt = atomic_read(&par->ref_count); | 1012 | int cnt = atomic_read(&par->ref_count); |
1013 | 1013 | ||
1014 | NVTRACE_ENTER(); | 1014 | NVTRACE_ENTER(); |
@@ -1034,7 +1034,7 @@ static int rivafb_open(struct fb_info *info, int user) | |||
1034 | 1034 | ||
1035 | static int rivafb_release(struct fb_info *info, int user) | 1035 | static int rivafb_release(struct fb_info *info, int user) |
1036 | { | 1036 | { |
1037 | struct riva_par *par = (struct riva_par *) info->par; | 1037 | struct riva_par *par = info->par; |
1038 | int cnt = atomic_read(&par->ref_count); | 1038 | int cnt = atomic_read(&par->ref_count); |
1039 | 1039 | ||
1040 | NVTRACE_ENTER(); | 1040 | NVTRACE_ENTER(); |
@@ -1057,7 +1057,7 @@ static int rivafb_release(struct fb_info *info, int user) | |||
1057 | static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 1057 | static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
1058 | { | 1058 | { |
1059 | struct fb_videomode *mode; | 1059 | struct fb_videomode *mode; |
1060 | struct riva_par *par = (struct riva_par *) info->par; | 1060 | struct riva_par *par = info->par; |
1061 | int nom, den; /* translating from pixels->bytes */ | 1061 | int nom, den; /* translating from pixels->bytes */ |
1062 | int mode_valid = 0; | 1062 | int mode_valid = 0; |
1063 | 1063 | ||
@@ -1166,7 +1166,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
1166 | 1166 | ||
1167 | static int rivafb_set_par(struct fb_info *info) | 1167 | static int rivafb_set_par(struct fb_info *info) |
1168 | { | 1168 | { |
1169 | struct riva_par *par = (struct riva_par *) info->par; | 1169 | struct riva_par *par = info->par; |
1170 | 1170 | ||
1171 | NVTRACE_ENTER(); | 1171 | NVTRACE_ENTER(); |
1172 | /* vgaHWunlock() + riva unlock (0x7F) */ | 1172 | /* vgaHWunlock() + riva unlock (0x7F) */ |
@@ -1205,43 +1205,19 @@ static int rivafb_set_par(struct fb_info *info) | |||
1205 | static int rivafb_pan_display(struct fb_var_screeninfo *var, | 1205 | static int rivafb_pan_display(struct fb_var_screeninfo *var, |
1206 | struct fb_info *info) | 1206 | struct fb_info *info) |
1207 | { | 1207 | { |
1208 | struct riva_par *par = (struct riva_par *)info->par; | 1208 | struct riva_par *par = info->par; |
1209 | unsigned int base; | 1209 | unsigned int base; |
1210 | 1210 | ||
1211 | NVTRACE_ENTER(); | 1211 | NVTRACE_ENTER(); |
1212 | if (var->xoffset > (var->xres_virtual - var->xres)) | ||
1213 | return -EINVAL; | ||
1214 | if (var->yoffset > (var->yres_virtual - var->yres)) | ||
1215 | return -EINVAL; | ||
1216 | |||
1217 | if (var->vmode & FB_VMODE_YWRAP) { | ||
1218 | if (var->yoffset < 0 | ||
1219 | || var->yoffset >= info->var.yres_virtual | ||
1220 | || var->xoffset) return -EINVAL; | ||
1221 | } else { | ||
1222 | if (var->xoffset + info->var.xres > info->var.xres_virtual || | ||
1223 | var->yoffset + info->var.yres > info->var.yres_virtual) | ||
1224 | return -EINVAL; | ||
1225 | } | ||
1226 | |||
1227 | base = var->yoffset * info->fix.line_length + var->xoffset; | 1212 | base = var->yoffset * info->fix.line_length + var->xoffset; |
1228 | |||
1229 | par->riva.SetStartAddress(&par->riva, base); | 1213 | par->riva.SetStartAddress(&par->riva, base); |
1230 | |||
1231 | info->var.xoffset = var->xoffset; | ||
1232 | info->var.yoffset = var->yoffset; | ||
1233 | |||
1234 | if (var->vmode & FB_VMODE_YWRAP) | ||
1235 | info->var.vmode |= FB_VMODE_YWRAP; | ||
1236 | else | ||
1237 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
1238 | NVTRACE_LEAVE(); | 1214 | NVTRACE_LEAVE(); |
1239 | return 0; | 1215 | return 0; |
1240 | } | 1216 | } |
1241 | 1217 | ||
1242 | static int rivafb_blank(int blank, struct fb_info *info) | 1218 | static int rivafb_blank(int blank, struct fb_info *info) |
1243 | { | 1219 | { |
1244 | struct riva_par *par= (struct riva_par *)info->par; | 1220 | struct riva_par *par= info->par; |
1245 | unsigned char tmp, vesa; | 1221 | unsigned char tmp, vesa; |
1246 | 1222 | ||
1247 | tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */ | 1223 | tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */ |
@@ -1304,7 +1280,7 @@ static int rivafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1304 | unsigned blue, unsigned transp, | 1280 | unsigned blue, unsigned transp, |
1305 | struct fb_info *info) | 1281 | struct fb_info *info) |
1306 | { | 1282 | { |
1307 | struct riva_par *par = (struct riva_par *)info->par; | 1283 | struct riva_par *par = info->par; |
1308 | RIVA_HW_INST *chip = &par->riva; | 1284 | RIVA_HW_INST *chip = &par->riva; |
1309 | int i; | 1285 | int i; |
1310 | 1286 | ||
@@ -1393,7 +1369,7 @@ static int rivafb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
1393 | */ | 1369 | */ |
1394 | static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 1370 | static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
1395 | { | 1371 | { |
1396 | struct riva_par *par = (struct riva_par *) info->par; | 1372 | struct riva_par *par = info->par; |
1397 | u_int color, rop = 0; | 1373 | u_int color, rop = 0; |
1398 | 1374 | ||
1399 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { | 1375 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { |
@@ -1449,7 +1425,7 @@ static void rivafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect | |||
1449 | */ | 1425 | */ |
1450 | static void rivafb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 1426 | static void rivafb_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
1451 | { | 1427 | { |
1452 | struct riva_par *par = (struct riva_par *) info->par; | 1428 | struct riva_par *par = info->par; |
1453 | 1429 | ||
1454 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { | 1430 | if ((info->flags & FBINFO_HWACCEL_DISABLED)) { |
1455 | cfb_copyarea(info, region); | 1431 | cfb_copyarea(info, region); |
@@ -1495,7 +1471,7 @@ static inline void convert_bgcolor_16(u32 *col) | |||
1495 | static void rivafb_imageblit(struct fb_info *info, | 1471 | static void rivafb_imageblit(struct fb_info *info, |
1496 | const struct fb_image *image) | 1472 | const struct fb_image *image) |
1497 | { | 1473 | { |
1498 | struct riva_par *par = (struct riva_par *) info->par; | 1474 | struct riva_par *par = info->par; |
1499 | u32 fgx = 0, bgx = 0, width, tmp; | 1475 | u32 fgx = 0, bgx = 0, width, tmp; |
1500 | u8 *cdat = (u8 *) image->data; | 1476 | u8 *cdat = (u8 *) image->data; |
1501 | volatile u32 __iomem *d; | 1477 | volatile u32 __iomem *d; |
@@ -1580,7 +1556,7 @@ static void rivafb_imageblit(struct fb_info *info, | |||
1580 | */ | 1556 | */ |
1581 | static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1557 | static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1582 | { | 1558 | { |
1583 | struct riva_par *par = (struct riva_par *) info->par; | 1559 | struct riva_par *par = info->par; |
1584 | u8 data[MAX_CURS * MAX_CURS/8]; | 1560 | u8 data[MAX_CURS * MAX_CURS/8]; |
1585 | int i, set = cursor->set; | 1561 | int i, set = cursor->set; |
1586 | u16 fg, bg; | 1562 | u16 fg, bg; |
@@ -1664,7 +1640,7 @@ static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
1664 | 1640 | ||
1665 | static int rivafb_sync(struct fb_info *info) | 1641 | static int rivafb_sync(struct fb_info *info) |
1666 | { | 1642 | { |
1667 | struct riva_par *par = (struct riva_par *)info->par; | 1643 | struct riva_par *par = info->par; |
1668 | 1644 | ||
1669 | wait_for_idle(par); | 1645 | wait_for_idle(par); |
1670 | return 0; | 1646 | return 0; |
@@ -1696,7 +1672,7 @@ static struct fb_ops riva_fb_ops = { | |||
1696 | static int __devinit riva_set_fbinfo(struct fb_info *info) | 1672 | static int __devinit riva_set_fbinfo(struct fb_info *info) |
1697 | { | 1673 | { |
1698 | unsigned int cmap_len; | 1674 | unsigned int cmap_len; |
1699 | struct riva_par *par = (struct riva_par *) info->par; | 1675 | struct riva_par *par = info->par; |
1700 | 1676 | ||
1701 | NVTRACE_ENTER(); | 1677 | NVTRACE_ENTER(); |
1702 | info->flags = FBINFO_DEFAULT | 1678 | info->flags = FBINFO_DEFAULT |
@@ -1733,7 +1709,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info) | |||
1733 | #ifdef CONFIG_PPC_OF | 1709 | #ifdef CONFIG_PPC_OF |
1734 | static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) | 1710 | static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) |
1735 | { | 1711 | { |
1736 | struct riva_par *par = (struct riva_par *) info->par; | 1712 | struct riva_par *par = info->par; |
1737 | struct device_node *dp; | 1713 | struct device_node *dp; |
1738 | unsigned char *pedid = NULL; | 1714 | unsigned char *pedid = NULL; |
1739 | unsigned char *disptype = NULL; | 1715 | unsigned char *disptype = NULL; |
@@ -1767,7 +1743,7 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) | |||
1767 | #if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF) | 1743 | #if defined(CONFIG_FB_RIVA_I2C) && !defined(CONFIG_PPC_OF) |
1768 | static int __devinit riva_get_EDID_i2c(struct fb_info *info) | 1744 | static int __devinit riva_get_EDID_i2c(struct fb_info *info) |
1769 | { | 1745 | { |
1770 | struct riva_par *par = (struct riva_par *) info->par; | 1746 | struct riva_par *par = info->par; |
1771 | struct fb_var_screeninfo var; | 1747 | struct fb_var_screeninfo var; |
1772 | int i; | 1748 | int i; |
1773 | 1749 | ||
@@ -1837,7 +1813,7 @@ static void __devinit riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) | |||
1837 | static void __devinit riva_get_edidinfo(struct fb_info *info) | 1813 | static void __devinit riva_get_edidinfo(struct fb_info *info) |
1838 | { | 1814 | { |
1839 | struct fb_var_screeninfo *var = &rivafb_default_var; | 1815 | struct fb_var_screeninfo *var = &rivafb_default_var; |
1840 | struct riva_par *par = (struct riva_par *) info->par; | 1816 | struct riva_par *par = info->par; |
1841 | 1817 | ||
1842 | fb_edid_to_monspecs(par->EDID, &info->monspecs); | 1818 | fb_edid_to_monspecs(par->EDID, &info->monspecs); |
1843 | fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len, | 1819 | fb_videomode_to_modelist(info->monspecs.modedb, info->monspecs.modedb_len, |
@@ -1909,7 +1885,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
1909 | ret = -ENOMEM; | 1885 | ret = -ENOMEM; |
1910 | goto err_ret; | 1886 | goto err_ret; |
1911 | } | 1887 | } |
1912 | default_par = (struct riva_par *) info->par; | 1888 | default_par = info->par; |
1913 | default_par->pdev = pd; | 1889 | default_par->pdev = pd; |
1914 | 1890 | ||
1915 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); | 1891 | info->pixmap.addr = kmalloc(8 * 1024, GFP_KERNEL); |
@@ -2070,7 +2046,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd, | |||
2070 | 2046 | ||
2071 | err_iounmap_screen_base: | 2047 | err_iounmap_screen_base: |
2072 | #ifdef CONFIG_FB_RIVA_I2C | 2048 | #ifdef CONFIG_FB_RIVA_I2C |
2073 | riva_delete_i2c_busses((struct riva_par *) info->par); | 2049 | riva_delete_i2c_busses(info->par); |
2074 | #endif | 2050 | #endif |
2075 | iounmap(info->screen_base); | 2051 | iounmap(info->screen_base); |
2076 | err_iounmap_pramin: | 2052 | err_iounmap_pramin: |
@@ -2093,7 +2069,7 @@ err_ret: | |||
2093 | static void __exit rivafb_remove(struct pci_dev *pd) | 2069 | static void __exit rivafb_remove(struct pci_dev *pd) |
2094 | { | 2070 | { |
2095 | struct fb_info *info = pci_get_drvdata(pd); | 2071 | struct fb_info *info = pci_get_drvdata(pd); |
2096 | struct riva_par *par = (struct riva_par *) info->par; | 2072 | struct riva_par *par = info->par; |
2097 | 2073 | ||
2098 | NVTRACE_ENTER(); | 2074 | NVTRACE_ENTER(); |
2099 | if (!info) | 2075 | if (!info) |
diff --git a/drivers/video/riva/rivafb-i2c.c b/drivers/video/riva/rivafb-i2c.c index 77151d8e0766..8b1967fc116a 100644 --- a/drivers/video/riva/rivafb-i2c.c +++ b/drivers/video/riva/rivafb-i2c.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | static void riva_gpio_setscl(void* data, int state) | 31 | static void riva_gpio_setscl(void* data, int state) |
32 | { | 32 | { |
33 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 33 | struct riva_i2c_chan *chan = data; |
34 | struct riva_par *par = chan->par; | 34 | struct riva_par *par = chan->par; |
35 | u32 val; | 35 | u32 val; |
36 | 36 | ||
@@ -48,7 +48,7 @@ static void riva_gpio_setscl(void* data, int state) | |||
48 | 48 | ||
49 | static void riva_gpio_setsda(void* data, int state) | 49 | static void riva_gpio_setsda(void* data, int state) |
50 | { | 50 | { |
51 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 51 | struct riva_i2c_chan *chan = data; |
52 | struct riva_par *par = chan->par; | 52 | struct riva_par *par = chan->par; |
53 | u32 val; | 53 | u32 val; |
54 | 54 | ||
@@ -66,7 +66,7 @@ static void riva_gpio_setsda(void* data, int state) | |||
66 | 66 | ||
67 | static int riva_gpio_getscl(void* data) | 67 | static int riva_gpio_getscl(void* data) |
68 | { | 68 | { |
69 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 69 | struct riva_i2c_chan *chan = data; |
70 | struct riva_par *par = chan->par; | 70 | struct riva_par *par = chan->par; |
71 | u32 val = 0; | 71 | u32 val = 0; |
72 | 72 | ||
@@ -81,7 +81,7 @@ static int riva_gpio_getscl(void* data) | |||
81 | 81 | ||
82 | static int riva_gpio_getsda(void* data) | 82 | static int riva_gpio_getsda(void* data) |
83 | { | 83 | { |
84 | struct riva_i2c_chan *chan = (struct riva_i2c_chan *)data; | 84 | struct riva_i2c_chan *chan = data; |
85 | struct riva_par *par = chan->par; | 85 | struct riva_par *par = chan->par; |
86 | u32 val = 0; | 86 | u32 val = 0; |
87 | 87 | ||
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c index fe99d17a21d7..d574dd3c9c8a 100644 --- a/drivers/video/s3c2410fb.c +++ b/drivers/video/s3c2410fb.c | |||
@@ -552,7 +552,7 @@ static inline void modify_gpio(void __iomem *reg, | |||
552 | * s3c2410fb_init_registers - Initialise all LCD-related registers | 552 | * s3c2410fb_init_registers - Initialise all LCD-related registers |
553 | */ | 553 | */ |
554 | 554 | ||
555 | int s3c2410fb_init_registers(struct s3c2410fb_info *fbi) | 555 | static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi) |
556 | { | 556 | { |
557 | unsigned long flags; | 557 | unsigned long flags; |
558 | 558 | ||
@@ -634,7 +634,7 @@ static irqreturn_t s3c2410fb_irq(int irq, void *dev_id, struct pt_regs *r) | |||
634 | 634 | ||
635 | static char driver_name[]="s3c2410fb"; | 635 | static char driver_name[]="s3c2410fb"; |
636 | 636 | ||
637 | int __init s3c2410fb_probe(struct platform_device *pdev) | 637 | static int __init s3c2410fb_probe(struct platform_device *pdev) |
638 | { | 638 | { |
639 | struct s3c2410fb_info *info; | 639 | struct s3c2410fb_info *info; |
640 | struct fb_info *fbinfo; | 640 | struct fb_info *fbinfo; |
@@ -667,8 +667,6 @@ int __init s3c2410fb_probe(struct platform_device *pdev) | |||
667 | info->fb = fbinfo; | 667 | info->fb = fbinfo; |
668 | platform_set_drvdata(pdev, fbinfo); | 668 | platform_set_drvdata(pdev, fbinfo); |
669 | 669 | ||
670 | s3c2410fb_init_registers(info); | ||
671 | |||
672 | dprintk("devinit\n"); | 670 | dprintk("devinit\n"); |
673 | 671 | ||
674 | strcpy(fbinfo->fix.id, driver_name); | 672 | strcpy(fbinfo->fix.id, driver_name); |
@@ -701,8 +699,8 @@ int __init s3c2410fb_probe(struct platform_device *pdev) | |||
701 | fbinfo->var.yres_virtual = mach_info->yres.defval; | 699 | fbinfo->var.yres_virtual = mach_info->yres.defval; |
702 | fbinfo->var.bits_per_pixel = mach_info->bpp.defval; | 700 | fbinfo->var.bits_per_pixel = mach_info->bpp.defval; |
703 | 701 | ||
704 | fbinfo->var.upper_margin = S3C2410_LCDCON2_GET_VBPD(mregs->lcdcon2) +1; | 702 | fbinfo->var.upper_margin = S3C2410_LCDCON2_GET_VBPD(mregs->lcdcon2) + 1; |
705 | fbinfo->var.lower_margin = S3C2410_LCDCON2_GET_VFPD(mregs->lcdcon2) +1; | 703 | fbinfo->var.lower_margin = S3C2410_LCDCON2_GET_VFPD(mregs->lcdcon2) + 1; |
706 | fbinfo->var.vsync_len = S3C2410_LCDCON2_GET_VSPW(mregs->lcdcon2) + 1; | 704 | fbinfo->var.vsync_len = S3C2410_LCDCON2_GET_VSPW(mregs->lcdcon2) + 1; |
707 | 705 | ||
708 | fbinfo->var.left_margin = S3C2410_LCDCON3_GET_HFPD(mregs->lcdcon3) + 1; | 706 | fbinfo->var.left_margin = S3C2410_LCDCON3_GET_HFPD(mregs->lcdcon3) + 1; |
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c index 3c98457783c4..00719a91479f 100644 --- a/drivers/video/savage/savagefb-i2c.c +++ b/drivers/video/savage/savagefb-i2c.c | |||
@@ -49,7 +49,7 @@ | |||
49 | 49 | ||
50 | static void savage4_gpio_setscl(void *data, int val) | 50 | static void savage4_gpio_setscl(void *data, int val) |
51 | { | 51 | { |
52 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 52 | struct savagefb_i2c_chan *chan = data; |
53 | unsigned int r; | 53 | unsigned int r; |
54 | 54 | ||
55 | r = readl(chan->ioaddr + chan->reg); | 55 | r = readl(chan->ioaddr + chan->reg); |
@@ -63,7 +63,7 @@ static void savage4_gpio_setscl(void *data, int val) | |||
63 | 63 | ||
64 | static void savage4_gpio_setsda(void *data, int val) | 64 | static void savage4_gpio_setsda(void *data, int val) |
65 | { | 65 | { |
66 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 66 | struct savagefb_i2c_chan *chan = data; |
67 | 67 | ||
68 | unsigned int r; | 68 | unsigned int r; |
69 | r = readl(chan->ioaddr + chan->reg); | 69 | r = readl(chan->ioaddr + chan->reg); |
@@ -77,21 +77,21 @@ static void savage4_gpio_setsda(void *data, int val) | |||
77 | 77 | ||
78 | static int savage4_gpio_getscl(void *data) | 78 | static int savage4_gpio_getscl(void *data) |
79 | { | 79 | { |
80 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 80 | struct savagefb_i2c_chan *chan = data; |
81 | 81 | ||
82 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN)); | 82 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SCL_IN)); |
83 | } | 83 | } |
84 | 84 | ||
85 | static int savage4_gpio_getsda(void *data) | 85 | static int savage4_gpio_getsda(void *data) |
86 | { | 86 | { |
87 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 87 | struct savagefb_i2c_chan *chan = data; |
88 | 88 | ||
89 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN)); | 89 | return (0 != (readl(chan->ioaddr + chan->reg) & SAVAGE4_I2C_SDA_IN)); |
90 | } | 90 | } |
91 | 91 | ||
92 | static void prosavage_gpio_setscl(void* data, int val) | 92 | static void prosavage_gpio_setscl(void* data, int val) |
93 | { | 93 | { |
94 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 94 | struct savagefb_i2c_chan *chan = data; |
95 | u32 r; | 95 | u32 r; |
96 | 96 | ||
97 | SET_CR_IX(chan->ioaddr, chan->reg); | 97 | SET_CR_IX(chan->ioaddr, chan->reg); |
@@ -107,7 +107,7 @@ static void prosavage_gpio_setscl(void* data, int val) | |||
107 | 107 | ||
108 | static void prosavage_gpio_setsda(void* data, int val) | 108 | static void prosavage_gpio_setsda(void* data, int val) |
109 | { | 109 | { |
110 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 110 | struct savagefb_i2c_chan *chan = data; |
111 | unsigned int r; | 111 | unsigned int r; |
112 | 112 | ||
113 | SET_CR_IX(chan->ioaddr, chan->reg); | 113 | SET_CR_IX(chan->ioaddr, chan->reg); |
@@ -123,7 +123,7 @@ static void prosavage_gpio_setsda(void* data, int val) | |||
123 | 123 | ||
124 | static int prosavage_gpio_getscl(void* data) | 124 | static int prosavage_gpio_getscl(void* data) |
125 | { | 125 | { |
126 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 126 | struct savagefb_i2c_chan *chan = data; |
127 | 127 | ||
128 | SET_CR_IX(chan->ioaddr, chan->reg); | 128 | SET_CR_IX(chan->ioaddr, chan->reg); |
129 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN)); | 129 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN)); |
@@ -131,7 +131,7 @@ static int prosavage_gpio_getscl(void* data) | |||
131 | 131 | ||
132 | static int prosavage_gpio_getsda(void* data) | 132 | static int prosavage_gpio_getsda(void* data) |
133 | { | 133 | { |
134 | struct savagefb_i2c_chan *chan = (struct savagefb_i2c_chan *)data; | 134 | struct savagefb_i2c_chan *chan = data; |
135 | 135 | ||
136 | SET_CR_IX(chan->ioaddr, chan->reg); | 136 | SET_CR_IX(chan->ioaddr, chan->reg); |
137 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN)); | 137 | return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN)); |
@@ -140,10 +140,9 @@ static int prosavage_gpio_getsda(void* data) | |||
140 | static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | 140 | static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, |
141 | const char *name) | 141 | const char *name) |
142 | { | 142 | { |
143 | int (*add_bus)(struct i2c_adapter *) = symbol_get(i2c_bit_add_bus); | ||
144 | int rc = 0; | 143 | int rc = 0; |
145 | 144 | ||
146 | if (add_bus && chan->par) { | 145 | if (chan->par) { |
147 | strcpy(chan->adapter.name, name); | 146 | strcpy(chan->adapter.name, name); |
148 | chan->adapter.owner = THIS_MODULE; | 147 | chan->adapter.owner = THIS_MODULE; |
149 | chan->adapter.id = I2C_HW_B_SAVAGE; | 148 | chan->adapter.id = I2C_HW_B_SAVAGE; |
@@ -161,7 +160,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
161 | chan->algo.setscl(chan, 1); | 160 | chan->algo.setscl(chan, 1); |
162 | udelay(20); | 161 | udelay(20); |
163 | 162 | ||
164 | rc = add_bus(&chan->adapter); | 163 | rc = i2c_bit_add_bus(&chan->adapter); |
165 | 164 | ||
166 | if (rc == 0) | 165 | if (rc == 0) |
167 | dev_dbg(&chan->par->pcidev->dev, | 166 | dev_dbg(&chan->par->pcidev->dev, |
@@ -169,8 +168,6 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
169 | else | 168 | else |
170 | dev_warn(&chan->par->pcidev->dev, | 169 | dev_warn(&chan->par->pcidev->dev, |
171 | "Failed to register I2C bus %s.\n", name); | 170 | "Failed to register I2C bus %s.\n", name); |
172 | |||
173 | symbol_put(i2c_bit_add_bus); | ||
174 | } else | 171 | } else |
175 | chan->par = NULL; | 172 | chan->par = NULL; |
176 | 173 | ||
@@ -179,7 +176,7 @@ static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, | |||
179 | 176 | ||
180 | void savagefb_create_i2c_busses(struct fb_info *info) | 177 | void savagefb_create_i2c_busses(struct fb_info *info) |
181 | { | 178 | { |
182 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 179 | struct savagefb_par *par = info->par; |
183 | par->chan.par = par; | 180 | par->chan.par = par; |
184 | 181 | ||
185 | switch(info->fix.accel) { | 182 | switch(info->fix.accel) { |
@@ -193,6 +190,7 @@ void savagefb_create_i2c_busses(struct fb_info *info) | |||
193 | par->chan.algo.getscl = prosavage_gpio_getscl; | 190 | par->chan.algo.getscl = prosavage_gpio_getscl; |
194 | break; | 191 | break; |
195 | case FB_ACCEL_SAVAGE4: | 192 | case FB_ACCEL_SAVAGE4: |
193 | case FB_ACCEL_SAVAGE2000: | ||
196 | par->chan.reg = 0xff20; | 194 | par->chan.reg = 0xff20; |
197 | par->chan.ioaddr = par->mmio.vbase; | 195 | par->chan.ioaddr = par->mmio.vbase; |
198 | par->chan.algo.setsda = savage4_gpio_setsda; | 196 | par->chan.algo.setsda = savage4_gpio_setsda; |
@@ -209,14 +207,10 @@ void savagefb_create_i2c_busses(struct fb_info *info) | |||
209 | 207 | ||
210 | void savagefb_delete_i2c_busses(struct fb_info *info) | 208 | void savagefb_delete_i2c_busses(struct fb_info *info) |
211 | { | 209 | { |
212 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 210 | struct savagefb_par *par = info->par; |
213 | int (*del_bus)(struct i2c_adapter *) = | ||
214 | symbol_get(i2c_bit_del_bus); | ||
215 | 211 | ||
216 | if (del_bus && par->chan.par) { | 212 | if (par->chan.par) |
217 | del_bus(&par->chan.adapter); | 213 | i2c_bit_del_bus(&par->chan.adapter); |
218 | symbol_put(i2c_bit_del_bus); | ||
219 | } | ||
220 | 214 | ||
221 | par->chan.par = NULL; | 215 | par->chan.par = NULL; |
222 | } | 216 | } |
@@ -224,8 +218,6 @@ void savagefb_delete_i2c_busses(struct fb_info *info) | |||
224 | static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) | 218 | static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) |
225 | { | 219 | { |
226 | u8 start = 0x0; | 220 | u8 start = 0x0; |
227 | int (*transfer)(struct i2c_adapter *, struct i2c_msg *, int) = | ||
228 | symbol_get(i2c_transfer); | ||
229 | struct i2c_msg msgs[] = { | 221 | struct i2c_msg msgs[] = { |
230 | { | 222 | { |
231 | .addr = SAVAGE_DDC, | 223 | .addr = SAVAGE_DDC, |
@@ -239,21 +231,19 @@ static u8 *savage_do_probe_i2c_edid(struct savagefb_i2c_chan *chan) | |||
239 | }; | 231 | }; |
240 | u8 *buf = NULL; | 232 | u8 *buf = NULL; |
241 | 233 | ||
242 | if (transfer && chan->par) { | 234 | if (chan->par) { |
243 | buf = kmalloc(EDID_LENGTH, GFP_KERNEL); | 235 | buf = kmalloc(EDID_LENGTH, GFP_KERNEL); |
244 | 236 | ||
245 | if (buf) { | 237 | if (buf) { |
246 | msgs[1].buf = buf; | 238 | msgs[1].buf = buf; |
247 | 239 | ||
248 | if (transfer(&chan->adapter, msgs, 2) != 2) { | 240 | if (i2c_transfer(&chan->adapter, msgs, 2) != 2) { |
249 | dev_dbg(&chan->par->pcidev->dev, | 241 | dev_dbg(&chan->par->pcidev->dev, |
250 | "Unable to read EDID block.\n"); | 242 | "Unable to read EDID block.\n"); |
251 | kfree(buf); | 243 | kfree(buf); |
252 | buf = NULL; | 244 | buf = NULL; |
253 | } | 245 | } |
254 | } | 246 | } |
255 | |||
256 | symbol_put(i2c_transfer); | ||
257 | } | 247 | } |
258 | 248 | ||
259 | return buf; | 249 | return buf; |
diff --git a/drivers/video/savage/savagefb_accel.c b/drivers/video/savage/savagefb_accel.c index bac8ea3a0108..bbcc055d3bb7 100644 --- a/drivers/video/savage/savagefb_accel.c +++ b/drivers/video/savage/savagefb_accel.c | |||
@@ -21,7 +21,7 @@ static u32 savagefb_rop[] = { | |||
21 | 21 | ||
22 | int savagefb_sync(struct fb_info *info) | 22 | int savagefb_sync(struct fb_info *info) |
23 | { | 23 | { |
24 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 24 | struct savagefb_par *par = info->par; |
25 | 25 | ||
26 | par->SavageWaitIdle(par); | 26 | par->SavageWaitIdle(par); |
27 | return 0; | 27 | return 0; |
@@ -29,7 +29,7 @@ int savagefb_sync(struct fb_info *info) | |||
29 | 29 | ||
30 | void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | 30 | void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) |
31 | { | 31 | { |
32 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 32 | struct savagefb_par *par = info->par; |
33 | int sx = region->sx, dx = region->dx; | 33 | int sx = region->sx, dx = region->dx; |
34 | int sy = region->sy, dy = region->dy; | 34 | int sy = region->sy, dy = region->dy; |
35 | int cmd; | 35 | int cmd; |
@@ -63,7 +63,7 @@ void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
63 | 63 | ||
64 | void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 64 | void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
65 | { | 65 | { |
66 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 66 | struct savagefb_par *par = info->par; |
67 | int cmd, color; | 67 | int cmd, color; |
68 | 68 | ||
69 | if (!rect->width || !rect->height) | 69 | if (!rect->width || !rect->height) |
@@ -90,7 +90,7 @@ void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
90 | 90 | ||
91 | void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) | 91 | void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) |
92 | { | 92 | { |
93 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 93 | struct savagefb_par *par = info->par; |
94 | int fg, bg, size, i, width; | 94 | int fg, bg, size, i, width; |
95 | int cmd; | 95 | int cmd; |
96 | u32 *src = (u32 *) image->data; | 96 | u32 *src = (u32 *) image->data; |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 09e2f2841901..ab727eaa7f43 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
@@ -686,7 +686,7 @@ static void savage_update_var(struct fb_var_screeninfo *var, struct fb_videomode | |||
686 | static int savagefb_check_var (struct fb_var_screeninfo *var, | 686 | static int savagefb_check_var (struct fb_var_screeninfo *var, |
687 | struct fb_info *info) | 687 | struct fb_info *info) |
688 | { | 688 | { |
689 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 689 | struct savagefb_par *par = info->par; |
690 | int memlen, vramlen, mode_valid = 0; | 690 | int memlen, vramlen, mode_valid = 0; |
691 | 691 | ||
692 | DBG("savagefb_check_var"); | 692 | DBG("savagefb_check_var"); |
@@ -1025,7 +1025,7 @@ static int savagefb_setcolreg(unsigned regno, | |||
1025 | unsigned transp, | 1025 | unsigned transp, |
1026 | struct fb_info *info) | 1026 | struct fb_info *info) |
1027 | { | 1027 | { |
1028 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1028 | struct savagefb_par *par = info->par; |
1029 | 1029 | ||
1030 | if (regno >= NR_PALETTE) | 1030 | if (regno >= NR_PALETTE) |
1031 | return -EINVAL; | 1031 | return -EINVAL; |
@@ -1328,7 +1328,7 @@ static void savagefb_set_fix(struct fb_info *info) | |||
1328 | #if defined(CONFIG_FB_SAVAGE_ACCEL) | 1328 | #if defined(CONFIG_FB_SAVAGE_ACCEL) |
1329 | static void savagefb_set_clip(struct fb_info *info) | 1329 | static void savagefb_set_clip(struct fb_info *info) |
1330 | { | 1330 | { |
1331 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1331 | struct savagefb_par *par = info->par; |
1332 | int cmd; | 1332 | int cmd; |
1333 | 1333 | ||
1334 | cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; | 1334 | cmd = BCI_CMD_NOP | BCI_CMD_CLIP_NEW; |
@@ -1342,7 +1342,7 @@ static void savagefb_set_clip(struct fb_info *info) | |||
1342 | 1342 | ||
1343 | static int savagefb_set_par (struct fb_info *info) | 1343 | static int savagefb_set_par (struct fb_info *info) |
1344 | { | 1344 | { |
1345 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1345 | struct savagefb_par *par = info->par; |
1346 | struct fb_var_screeninfo *var = &info->var; | 1346 | struct fb_var_screeninfo *var = &info->var; |
1347 | int err; | 1347 | int err; |
1348 | 1348 | ||
@@ -1381,29 +1381,9 @@ static int savagefb_set_par (struct fb_info *info) | |||
1381 | static int savagefb_pan_display (struct fb_var_screeninfo *var, | 1381 | static int savagefb_pan_display (struct fb_var_screeninfo *var, |
1382 | struct fb_info *info) | 1382 | struct fb_info *info) |
1383 | { | 1383 | { |
1384 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1384 | struct savagefb_par *par = info->par; |
1385 | u_int y_bottom; | ||
1386 | |||
1387 | y_bottom = var->yoffset; | ||
1388 | |||
1389 | if (!(var->vmode & FB_VMODE_YWRAP)) | ||
1390 | y_bottom += var->yres; | ||
1391 | |||
1392 | if (var->xoffset > (var->xres_virtual - var->xres)) | ||
1393 | return -EINVAL; | ||
1394 | if (y_bottom > info->var.yres_virtual) | ||
1395 | return -EINVAL; | ||
1396 | 1385 | ||
1397 | savagefb_update_start (par, var); | 1386 | savagefb_update_start (par, var); |
1398 | |||
1399 | info->var.xoffset = var->xoffset; | ||
1400 | info->var.yoffset = var->yoffset; | ||
1401 | |||
1402 | if (var->vmode & FB_VMODE_YWRAP) | ||
1403 | info->var.vmode |= FB_VMODE_YWRAP; | ||
1404 | else | ||
1405 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
1406 | |||
1407 | return 0; | 1387 | return 0; |
1408 | } | 1388 | } |
1409 | 1389 | ||
@@ -1534,7 +1514,7 @@ static void savage_disable_mmio (struct savagefb_par *par) | |||
1534 | 1514 | ||
1535 | static int __devinit savage_map_mmio (struct fb_info *info) | 1515 | static int __devinit savage_map_mmio (struct fb_info *info) |
1536 | { | 1516 | { |
1537 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1517 | struct savagefb_par *par = info->par; |
1538 | DBG ("savage_map_mmio"); | 1518 | DBG ("savage_map_mmio"); |
1539 | 1519 | ||
1540 | if (S3_SAVAGE3D_SERIES (par->chip)) | 1520 | if (S3_SAVAGE3D_SERIES (par->chip)) |
@@ -1567,7 +1547,7 @@ static int __devinit savage_map_mmio (struct fb_info *info) | |||
1567 | 1547 | ||
1568 | static void __devinit savage_unmap_mmio (struct fb_info *info) | 1548 | static void __devinit savage_unmap_mmio (struct fb_info *info) |
1569 | { | 1549 | { |
1570 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1550 | struct savagefb_par *par = info->par; |
1571 | DBG ("savage_unmap_mmio"); | 1551 | DBG ("savage_unmap_mmio"); |
1572 | 1552 | ||
1573 | savage_disable_mmio(par); | 1553 | savage_disable_mmio(par); |
@@ -1581,7 +1561,7 @@ static void __devinit savage_unmap_mmio (struct fb_info *info) | |||
1581 | static int __devinit savage_map_video (struct fb_info *info, | 1561 | static int __devinit savage_map_video (struct fb_info *info, |
1582 | int video_len) | 1562 | int video_len) |
1583 | { | 1563 | { |
1584 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1564 | struct savagefb_par *par = info->par; |
1585 | int resource; | 1565 | int resource; |
1586 | 1566 | ||
1587 | DBG("savage_map_video"); | 1567 | DBG("savage_map_video"); |
@@ -1619,7 +1599,7 @@ static int __devinit savage_map_video (struct fb_info *info, | |||
1619 | 1599 | ||
1620 | static void __devinit savage_unmap_video (struct fb_info *info) | 1600 | static void __devinit savage_unmap_video (struct fb_info *info) |
1621 | { | 1601 | { |
1622 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1602 | struct savagefb_par *par = info->par; |
1623 | 1603 | ||
1624 | DBG("savage_unmap_video"); | 1604 | DBG("savage_unmap_video"); |
1625 | 1605 | ||
@@ -1869,7 +1849,7 @@ static int __devinit savage_init_fb_info (struct fb_info *info, | |||
1869 | struct pci_dev *dev, | 1849 | struct pci_dev *dev, |
1870 | const struct pci_device_id *id) | 1850 | const struct pci_device_id *id) |
1871 | { | 1851 | { |
1872 | struct savagefb_par *par = (struct savagefb_par *)info->par; | 1852 | struct savagefb_par *par = info->par; |
1873 | int err = 0; | 1853 | int err = 0; |
1874 | 1854 | ||
1875 | par->pcidev = dev; | 1855 | par->pcidev = dev; |
@@ -2139,8 +2119,7 @@ static int __devinit savagefb_probe (struct pci_dev* dev, | |||
2139 | 2119 | ||
2140 | static void __devexit savagefb_remove (struct pci_dev *dev) | 2120 | static void __devexit savagefb_remove (struct pci_dev *dev) |
2141 | { | 2121 | { |
2142 | struct fb_info *info = | 2122 | struct fb_info *info = pci_get_drvdata(dev); |
2143 | (struct fb_info *)pci_get_drvdata(dev); | ||
2144 | 2123 | ||
2145 | DBG("savagefb_remove"); | 2124 | DBG("savagefb_remove"); |
2146 | 2125 | ||
@@ -2174,9 +2153,8 @@ static void __devexit savagefb_remove (struct pci_dev *dev) | |||
2174 | 2153 | ||
2175 | static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) | 2154 | static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) |
2176 | { | 2155 | { |
2177 | struct fb_info *info = | 2156 | struct fb_info *info = pci_get_drvdata(dev); |
2178 | (struct fb_info *)pci_get_drvdata(dev); | 2157 | struct savagefb_par *par = info->par; |
2179 | struct savagefb_par *par = (struct savagefb_par *)info->par; | ||
2180 | 2158 | ||
2181 | DBG("savagefb_suspend"); | 2159 | DBG("savagefb_suspend"); |
2182 | 2160 | ||
@@ -2210,9 +2188,8 @@ static int savagefb_suspend (struct pci_dev* dev, pm_message_t state) | |||
2210 | 2188 | ||
2211 | static int savagefb_resume (struct pci_dev* dev) | 2189 | static int savagefb_resume (struct pci_dev* dev) |
2212 | { | 2190 | { |
2213 | struct fb_info *info = | 2191 | struct fb_info *info = pci_get_drvdata(dev); |
2214 | (struct fb_info *)pci_get_drvdata(dev); | 2192 | struct savagefb_par *par = info->par; |
2215 | struct savagefb_par *par = (struct savagefb_par *)info->par; | ||
2216 | int cur_state = par->pm_state; | 2193 | int cur_state = par->pm_state; |
2217 | 2194 | ||
2218 | DBG("savage_resume"); | 2195 | DBG("savage_resume"); |
diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c index a01e7ecc15ed..9b707771d757 100644 --- a/drivers/video/skeletonfb.c +++ b/drivers/video/skeletonfb.c | |||
@@ -115,7 +115,8 @@ static struct fb_fix_screeninfo xxxfb_fix __initdata = { | |||
115 | /* | 115 | /* |
116 | * If your driver supports multiple boards or it supports multiple | 116 | * If your driver supports multiple boards or it supports multiple |
117 | * framebuffers, you should make these arrays, or allocate them | 117 | * framebuffers, you should make these arrays, or allocate them |
118 | * dynamically (using kmalloc()). | 118 | * dynamically using framebuffer_alloc() and free them with |
119 | * framebuffer_release(). | ||
119 | */ | 120 | */ |
120 | static struct fb_info info; | 121 | static struct fb_info info; |
121 | 122 | ||
@@ -179,18 +180,31 @@ static int xxxfb_release(const struct fb_info *info, int user) | |||
179 | * intent to only test a mode and not actually set it. The stuff in | 180 | * intent to only test a mode and not actually set it. The stuff in |
180 | * modedb.c is a example of this. If the var passed in is slightly | 181 | * modedb.c is a example of this. If the var passed in is slightly |
181 | * off by what the hardware can support then we alter the var PASSED in | 182 | * off by what the hardware can support then we alter the var PASSED in |
182 | * to what we can do. If the hardware doesn't support mode change | 183 | * to what we can do. |
183 | * a -EINVAL will be returned by the upper layers. You don't need to | 184 | * |
184 | * implement this function then. If you hardware doesn't support | 185 | * For values that are off, this function must round them _up_ to the |
185 | * changing the resolution then this function is not needed. In this | 186 | * next value that is supported by the hardware. If the value is |
186 | * case the driver woudl just provide a var that represents the static | 187 | * greater than the highest value supported by the hardware, then this |
187 | * state the screen is in. | 188 | * function must return -EINVAL. |
189 | * | ||
190 | * Exception to the above rule: Some drivers have a fixed mode, ie, | ||
191 | * the hardware is already set at boot up, and cannot be changed. In | ||
192 | * this case, it is more acceptable that this function just return | ||
193 | * a copy of the currently working var (info->var). Better is to not | ||
194 | * implement this function, as the upper layer will do the copying | ||
195 | * of the current var for you. | ||
196 | * | ||
197 | * Note: This is the only function where the contents of var can be | ||
198 | * freely adjusted after the driver has been registered. If you find | ||
199 | * that you have code outside of this function that alters the content | ||
200 | * of var, then you are doing something wrong. Note also that the | ||
201 | * contents of info->var must be left untouched at all times after | ||
202 | * driver registration. | ||
188 | * | 203 | * |
189 | * Returns negative errno on error, or zero on success. | 204 | * Returns negative errno on error, or zero on success. |
190 | */ | 205 | */ |
191 | static int xxxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 206 | static int xxxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
192 | { | 207 | { |
193 | const struct xxx_par *par = (const struct xxx_par *) info->par; | ||
194 | /* ... */ | 208 | /* ... */ |
195 | return 0; | 209 | return 0; |
196 | } | 210 | } |
@@ -204,14 +218,39 @@ static int xxxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
204 | * fb_fix_screeninfo stored in fb_info. It doesn't not alter var in | 218 | * fb_fix_screeninfo stored in fb_info. It doesn't not alter var in |
205 | * fb_info since we are using that data. This means we depend on the | 219 | * fb_info since we are using that data. This means we depend on the |
206 | * data in var inside fb_info to be supported by the hardware. | 220 | * data in var inside fb_info to be supported by the hardware. |
207 | * xxxfb_check_var is always called before xxxfb_set_par to ensure this. | 221 | * |
222 | * This function is also used to recover/restore the hardware to a | ||
223 | * known working state. | ||
224 | * | ||
225 | * xxxfb_check_var is always called before xxxfb_set_par to ensure that | ||
226 | * the contents of var is always valid. | ||
227 | * | ||
208 | * Again if you can't change the resolution you don't need this function. | 228 | * Again if you can't change the resolution you don't need this function. |
209 | * | 229 | * |
230 | * However, even if your hardware does not support mode changing, | ||
231 | * a set_par might be needed to at least initialize the hardware to | ||
232 | * a known working state, especially if it came back from another | ||
233 | * process that also modifies the same hardware, such as X. | ||
234 | * | ||
235 | * If this is the case, a combination such as the following should work: | ||
236 | * | ||
237 | * static int xxxfb_check_var(struct fb_var_screeninfo *var, | ||
238 | * struct fb_info *info) | ||
239 | * { | ||
240 | * *var = info->var; | ||
241 | * return 0; | ||
242 | * } | ||
243 | * | ||
244 | * static int xxxfb_set_par(struct fb_info *info) | ||
245 | * { | ||
246 | * init your hardware here | ||
247 | * } | ||
248 | * | ||
210 | * Returns negative errno on error, or zero on success. | 249 | * Returns negative errno on error, or zero on success. |
211 | */ | 250 | */ |
212 | static int xxxfb_set_par(struct fb_info *info) | 251 | static int xxxfb_set_par(struct fb_info *info) |
213 | { | 252 | { |
214 | struct xxx_par *par = (struct xxx_par *) info->par; | 253 | struct xxx_par *par = info->par; |
215 | /* ... */ | 254 | /* ... */ |
216 | return 0; | 255 | return 0; |
217 | } | 256 | } |
@@ -258,70 +297,110 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
258 | * var->{color}.offset contains start of bitfield | 297 | * var->{color}.offset contains start of bitfield |
259 | * var->{color}.length contains length of bitfield | 298 | * var->{color}.length contains length of bitfield |
260 | * {hardwarespecific} contains width of DAC | 299 | * {hardwarespecific} contains width of DAC |
261 | * cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset) | 300 | * pseudo_palette[X] is programmed to (X << red.offset) | |
301 | * (X << green.offset) | | ||
302 | * (X << blue.offset) | ||
262 | * RAMDAC[X] is programmed to (red, green, blue) | 303 | * RAMDAC[X] is programmed to (red, green, blue) |
304 | * color depth = SUM(var->{color}.length) | ||
263 | * | 305 | * |
264 | * Pseudocolor: | 306 | * Pseudocolor: |
265 | * uses offset = 0 && length = DAC register width. | ||
266 | * var->{color}.offset is 0 | 307 | * var->{color}.offset is 0 |
267 | * var->{color}.length contains widht of DAC | 308 | * var->{color}.length contains width of DAC or the number of unique |
268 | * cmap is not used | 309 | * colors available (color depth) |
269 | * DAC[X] is programmed to (red, green, blue) | 310 | * pseudo_palette is not used |
311 | * RAMDAC[X] is programmed to (red, green, blue) | ||
312 | * color depth = var->{color}.length | ||
313 | * | ||
314 | * Static pseudocolor: | ||
315 | * same as Pseudocolor, but the RAMDAC is not programmed (read-only) | ||
316 | * | ||
317 | * Mono01/Mono10: | ||
318 | * Has only 2 values, black on white or white on black (fg on bg), | ||
319 | * var->{color}.offset is 0 | ||
320 | * white = (1 << var->{color}.length) - 1, black = 0 | ||
321 | * pseudo_palette is not used | ||
322 | * RAMDAC does not exist | ||
323 | * color depth is always 2 | ||
324 | * | ||
270 | * Truecolor: | 325 | * Truecolor: |
271 | * does not use RAMDAC (usually has 3 of them). | 326 | * does not use RAMDAC (usually has 3 of them). |
272 | * var->{color}.offset contains start of bitfield | 327 | * var->{color}.offset contains start of bitfield |
273 | * var->{color}.length contains length of bitfield | 328 | * var->{color}.length contains length of bitfield |
274 | * cmap is programmed to (red << red.offset) | (green << green.offset) | | 329 | * pseudo_palette is programmed to (red << red.offset) | |
275 | * (blue << blue.offset) | (transp << transp.offset) | 330 | * (green << green.offset) | |
331 | * (blue << blue.offset) | | ||
332 | * (transp << transp.offset) | ||
276 | * RAMDAC does not exist | 333 | * RAMDAC does not exist |
334 | * color depth = SUM(var->{color}.length}) | ||
335 | * | ||
336 | * The color depth is used by fbcon for choosing the logo and also | ||
337 | * for color palette transformation if color depth < 4 | ||
338 | * | ||
339 | * As can be seen from the above, the field bits_per_pixel is _NOT_ | ||
340 | * a criteria for describing the color visual. | ||
341 | * | ||
342 | * A common mistake is assuming that bits_per_pixel <= 8 is pseudocolor, | ||
343 | * and higher than that, true/directcolor. This is incorrect, one needs | ||
344 | * to look at the fix->visual. | ||
345 | * | ||
346 | * Another common mistake is using bits_per_pixel to calculate the color | ||
347 | * depth. The bits_per_pixel field does not directly translate to color | ||
348 | * depth. You have to compute for the color depth (using the color | ||
349 | * bitfields) and fix->visual as seen above. | ||
350 | */ | ||
351 | |||
352 | /* | ||
353 | * This is the point where the color is converted to something that | ||
354 | * is acceptable by the hardware. | ||
277 | */ | 355 | */ |
278 | #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16) | 356 | #define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16) |
279 | switch (info->fix.visual) { | 357 | red = CNVT_TOHW(red, info->var.red.length); |
280 | case FB_VISUAL_TRUECOLOR: | 358 | green = CNVT_TOHW(green, info->var.green.length); |
281 | case FB_VISUAL_PSEUDOCOLOR: | 359 | blue = CNVT_TOHW(blue, info->var.blue.length); |
282 | red = CNVT_TOHW(red, info->var.red.length); | 360 | transp = CNVT_TOHW(transp, info->var.transp.length); |
283 | green = CNVT_TOHW(green, info->var.green.length); | ||
284 | blue = CNVT_TOHW(blue, info->var.blue.length); | ||
285 | transp = CNVT_TOHW(transp, info->var.transp.length); | ||
286 | break; | ||
287 | case FB_VISUAL_DIRECTCOLOR: | ||
288 | /* example here assumes 8 bit DAC. Might be different | ||
289 | * for your hardware */ | ||
290 | red = CNVT_TOHW(red, 8); | ||
291 | green = CNVT_TOHW(green, 8); | ||
292 | blue = CNVT_TOHW(blue, 8); | ||
293 | /* hey, there is bug in transp handling... */ | ||
294 | transp = CNVT_TOHW(transp, 8); | ||
295 | break; | ||
296 | } | ||
297 | #undef CNVT_TOHW | 361 | #undef CNVT_TOHW |
298 | /* Truecolor has hardware independent palette */ | 362 | /* |
299 | if (info->fix.visual == FB_VISUAL_TRUECOLOR) { | 363 | * This is the point where the function feeds the color to the hardware |
300 | u32 v; | 364 | * palette after converting the colors to something acceptable by |
301 | 365 | * the hardware. Note, only FB_VISUAL_DIRECTCOLOR and | |
302 | if (regno >= 16) | 366 | * FB_VISUAL_PSEUDOCOLOR visuals need to write to the hardware palette. |
303 | return -EINVAL; | 367 | * If you have code that writes to the hardware CLUT, and it's not |
304 | 368 | * any of the above visuals, then you are doing something wrong. | |
305 | v = (red << info->var.red.offset) | | 369 | */ |
306 | (green << info->var.green.offset) | | 370 | if (info->fix.visual == FB_VISUAL_DIRECTCOLOR || |
307 | (blue << info->var.blue.offset) | | 371 | info->fix.visual == FB_VISUAL_TRUECOLOR) |
308 | (transp << info->var.transp.offset); | 372 | write_{red|green|blue|transp}_to_clut(); |
309 | 373 | ||
310 | switch (info->var.bits_per_pixel) { | 374 | /* This is the point were you need to fill up the contents of |
311 | case 8: | 375 | * info->pseudo_palette. This structure is used _only_ by fbcon, thus |
312 | /* Yes some hand held devices have this. */ | 376 | * it only contains 16 entries to match the number of colors supported |
313 | ((u8*)(info->pseudo_palette))[regno] = v; | 377 | * by the console. The pseudo_palette is used only if the visual is |
314 | break; | 378 | * in directcolor or truecolor mode. With other visuals, the |
315 | case 16: | 379 | * pseudo_palette is not used. (This might change in the future.) |
316 | ((u16*)(info->pseudo_palette))[regno] = v; | 380 | * |
317 | break; | 381 | * The contents of the pseudo_palette is in raw pixel format. Ie, each |
318 | case 24: | 382 | * entry can be written directly to the framebuffer without any conversion. |
319 | case 32: | 383 | * The pseudo_palette is (void *). However, if using the generic |
320 | ((u32*)(info->pseudo_palette))[regno] = v; | 384 | * drawing functions (cfb_imageblit, cfb_fillrect), the pseudo_palette |
321 | break; | 385 | * must be casted to (u32 *) _regardless_ of the bits per pixel. If the |
322 | } | 386 | * driver is using its own drawing functions, then it can use whatever |
323 | return 0; | 387 | * size it wants. |
388 | */ | ||
389 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || | ||
390 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) { | ||
391 | u32 v; | ||
392 | |||
393 | if (regno >= 16) | ||
394 | return -EINVAL; | ||
395 | |||
396 | v = (red << info->var.red.offset) | | ||
397 | (green << info->var.green.offset) | | ||
398 | (blue << info->var.blue.offset) | | ||
399 | (transp << info->var.transp.offset); | ||
400 | |||
401 | ((u32*)(info->pseudo_palette))[regno] = v; | ||
324 | } | 402 | } |
403 | |||
325 | /* ... */ | 404 | /* ... */ |
326 | return 0; | 405 | return 0; |
327 | } | 406 | } |
@@ -340,6 +419,17 @@ static int xxxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
340 | static int xxxfb_pan_display(struct fb_var_screeninfo *var, | 419 | static int xxxfb_pan_display(struct fb_var_screeninfo *var, |
341 | const struct fb_info *info) | 420 | const struct fb_info *info) |
342 | { | 421 | { |
422 | /* | ||
423 | * If your hardware does not support panning, _do_ _not_ implement this | ||
424 | * function. Creating a dummy function will just confuse user apps. | ||
425 | */ | ||
426 | |||
427 | /* | ||
428 | * Note that even if this function is fully functional, a setting of | ||
429 | * 0 in both xpanstep and ypanstep means that this function will never | ||
430 | * get called. | ||
431 | */ | ||
432 | |||
343 | /* ... */ | 433 | /* ... */ |
344 | return 0; | 434 | return 0; |
345 | } | 435 | } |
@@ -349,15 +439,20 @@ static int xxxfb_pan_display(struct fb_var_screeninfo *var, | |||
349 | * @blank_mode: the blank mode we want. | 439 | * @blank_mode: the blank mode we want. |
350 | * @info: frame buffer structure that represents a single frame buffer | 440 | * @info: frame buffer structure that represents a single frame buffer |
351 | * | 441 | * |
352 | * Blank the screen if blank_mode != 0, else unblank. Return 0 if | 442 | * Blank the screen if blank_mode != FB_BLANK_UNBLANK, else unblank. |
353 | * blanking succeeded, != 0 if un-/blanking failed due to e.g. a | 443 | * Return 0 if blanking succeeded, != 0 if un-/blanking failed due to |
354 | * video mode which doesn't support it. Implements VESA suspend | 444 | * e.g. a video mode which doesn't support it. |
355 | * and powerdown modes on hardware that supports disabling hsync/vsync: | ||
356 | * blank_mode == 2: suspend vsync | ||
357 | * blank_mode == 3: suspend hsync | ||
358 | * blank_mode == 4: powerdown | ||
359 | * | 445 | * |
360 | * Returns negative errno on error, or zero on success. | 446 | * Implements VESA suspend and powerdown modes on hardware that supports |
447 | * disabling hsync/vsync: | ||
448 | * | ||
449 | * FB_BLANK_NORMAL = display is blanked, syncs are on. | ||
450 | * FB_BLANK_HSYNC_SUSPEND = hsync off | ||
451 | * FB_BLANK_VSYNC_SUSPEND = vsync off | ||
452 | * FB_BLANK_POWERDOWN = hsync and vsync off | ||
453 | * | ||
454 | * If implementing this function, at least support FB_BLANK_UNBLANK. | ||
455 | * Return !0 for any modes that are unimplemented. | ||
361 | * | 456 | * |
362 | */ | 457 | */ |
363 | static int xxxfb_blank(int blank_mode, const struct fb_info *info) | 458 | static int xxxfb_blank(int blank_mode, const struct fb_info *info) |
@@ -454,6 +549,14 @@ void xxxfb_imageblit(struct fb_info *p, const struct fb_image *image) | |||
454 | * @data: The actual data used to construct the image on the display. | 549 | * @data: The actual data used to construct the image on the display. |
455 | * @cmap: The colormap used for color images. | 550 | * @cmap: The colormap used for color images. |
456 | */ | 551 | */ |
552 | |||
553 | /* | ||
554 | * The generic function, cfb_imageblit, expects that the bitmap scanlines are | ||
555 | * padded to the next byte. Most hardware accelerators may require padding to | ||
556 | * the next u16 or the next u32. If that is the case, the driver can specify | ||
557 | * this by setting info->pixmap.scan_align = 2 or 4. See a more | ||
558 | * comprehensive description of the pixmap below. | ||
559 | */ | ||
457 | } | 560 | } |
458 | 561 | ||
459 | /** | 562 | /** |
@@ -517,6 +620,7 @@ int xxxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | |||
517 | */ | 620 | */ |
518 | void xxxfb_rotate(struct fb_info *info, int angle) | 621 | void xxxfb_rotate(struct fb_info *info, int angle) |
519 | { | 622 | { |
623 | /* Will be deprecated */ | ||
520 | } | 624 | } |
521 | 625 | ||
522 | /** | 626 | /** |
@@ -540,6 +644,9 @@ void xxxfb_poll(struct fb_info *info, poll_table *wait) | |||
540 | * so we can have consistent display output. | 644 | * so we can have consistent display output. |
541 | * | 645 | * |
542 | * @info: frame buffer structure that represents a single frame buffer | 646 | * @info: frame buffer structure that represents a single frame buffer |
647 | * | ||
648 | * If the driver has implemented its own hardware-based drawing function, | ||
649 | * implementing this function is highly recommended. | ||
543 | */ | 650 | */ |
544 | void xxxfb_sync(struct fb_info *info) | 651 | void xxxfb_sync(struct fb_info *info) |
545 | { | 652 | { |
@@ -549,20 +656,25 @@ void xxxfb_sync(struct fb_info *info) | |||
549 | * Initialization | 656 | * Initialization |
550 | */ | 657 | */ |
551 | 658 | ||
552 | int __init xxxfb_init(void) | 659 | /* static int __init xxfb_probe (struct device *device) -- for platform devs */ |
660 | static int __init xxxfb_probe(struct pci_dev *dev, | ||
661 | const_struct pci_device_id *ent) | ||
553 | { | 662 | { |
663 | struct fb_info *info; | ||
664 | struct xxx_par *par; | ||
665 | struct device = &dev->dev; /* for pci drivers */ | ||
554 | int cmap_len, retval; | 666 | int cmap_len, retval; |
555 | 667 | ||
556 | /* | 668 | /* |
557 | * For kernel boot options (in 'video=xxxfb:<options>' format) | 669 | * Dynamically allocate info and par |
558 | */ | 670 | */ |
559 | #ifndef MODULE | 671 | info = framebuffer_alloc(sizeof(struct xxx_par), device); |
560 | char *option = NULL; | ||
561 | 672 | ||
562 | if (fb_get_options("xxxfb", &option)) | 673 | if (!info) { |
563 | return -ENODEV; | 674 | /* goto error path */ |
564 | xxxfb_setup(option); | 675 | } |
565 | #endif | 676 | |
677 | par = info->par; | ||
566 | 678 | ||
567 | /* | 679 | /* |
568 | * Here we set the screen_base to the virtual memory address | 680 | * Here we set the screen_base to the virtual memory address |
@@ -570,18 +682,87 @@ int __init xxxfb_init(void) | |||
570 | * from the bus layer and then translate it to virtual memory | 682 | * from the bus layer and then translate it to virtual memory |
571 | * space via ioremap. Consult ioport.h. | 683 | * space via ioremap. Consult ioport.h. |
572 | */ | 684 | */ |
573 | info.screen_base = framebuffer_virtual_memory; | 685 | info->screen_base = framebuffer_virtual_memory; |
574 | info.fbops = &xxxfb_ops; | 686 | info->fbops = &xxxfb_ops; |
575 | info.fix = xxxfb_fix; | 687 | info->fix = xxxfb_fix; /* this will be the only time xxxfb_fix will be |
576 | info.pseudo_palette = pseudo_palette; | 688 | * used, so mark it as __initdata |
577 | 689 | */ | |
690 | info->pseudo_palette = pseudo_palette; /* The pseudopalette is an | ||
691 | * 16-member array | ||
692 | */ | ||
578 | /* | 693 | /* |
579 | * Set up flags to indicate what sort of acceleration your | 694 | * Set up flags to indicate what sort of acceleration your |
580 | * driver can provide (pan/wrap/copyarea/etc.) and whether it | 695 | * driver can provide (pan/wrap/copyarea/etc.) and whether it |
581 | * is a module -- see FBINFO_* in include/linux/fb.h | 696 | * is a module -- see FBINFO_* in include/linux/fb.h |
697 | * | ||
698 | * If your hardware can support any of the hardware accelerated functions | ||
699 | * fbcon performance will improve if info->flags is set properly. | ||
700 | * | ||
701 | * FBINFO_HWACCEL_COPYAREA - hardware moves | ||
702 | * FBINFO_HWACCEL_FILLRECT - hardware fills | ||
703 | * FBINFO_HWACCEL_IMAGEBLIT - hardware mono->color expansion | ||
704 | * FBINFO_HWACCEL_YPAN - hardware can pan display in y-axis | ||
705 | * FBINFO_HWACCEL_YWRAP - hardware can wrap display in y-axis | ||
706 | * FBINFO_HWACCEL_DISABLED - supports hardware accels, but disabled | ||
707 | * FBINFO_READS_FAST - if set, prefer moves over mono->color expansion | ||
708 | * FBINFO_MISC_TILEBLITTING - hardware can do tile blits | ||
709 | * | ||
710 | * NOTE: These are for fbcon use only. | ||
711 | */ | ||
712 | info->flags = FBINFO_DEFAULT; | ||
713 | |||
714 | /********************* This stage is optional ******************************/ | ||
715 | /* | ||
716 | * The struct pixmap is a scratch pad for the drawing functions. This | ||
717 | * is where the monochrome bitmap is constructed by the higher layers | ||
718 | * and then passed to the accelerator. For drivers that uses | ||
719 | * cfb_imageblit, you can skip this part. For those that have a more | ||
720 | * rigorous requirement, this stage is needed | ||
721 | */ | ||
722 | |||
723 | /* PIXMAP_SIZE should be small enough to optimize drawing, but not | ||
724 | * large enough that memory is wasted. A safe size is | ||
725 | * (max_xres * max_font_height/8). max_xres is driver dependent, | ||
726 | * max_font_height is 32. | ||
727 | */ | ||
728 | info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL); | ||
729 | if (!info->pixmap.addr) { | ||
730 | /* goto error */ | ||
731 | } | ||
732 | |||
733 | info->pixmap.size = PIXMAP_SIZE; | ||
734 | |||
735 | /* | ||
736 | * FB_PIXMAP_SYSTEM - memory is in system ram | ||
737 | * FB_PIXMAP_IO - memory is iomapped | ||
738 | * FB_PIXMAP_SYNC - if set, will call fb_sync() per access to pixmap, | ||
739 | * usually if FB_PIXMAP_IO is set. | ||
740 | * | ||
741 | * Currently, FB_PIXMAP_IO is unimplemented. | ||
742 | */ | ||
743 | info->pixmap.flags = FB_PIXMAP_SYSTEM; | ||
744 | |||
745 | /* | ||
746 | * scan_align is the number of padding for each scanline. It is in bytes. | ||
747 | * Thus for accelerators that need padding to the next u32, put 4 here. | ||
748 | */ | ||
749 | info->pixmap.scan_align = 4; | ||
750 | |||
751 | /* | ||
752 | * buf_align is the amount to be padded for the buffer. For example, | ||
753 | * the i810fb needs a scan_align of 2 but expects it to be fed with | ||
754 | * dwords, so a buf_align = 4 is required. | ||
582 | */ | 755 | */ |
583 | info.flags = FBINFO_DEFAULT; | 756 | info->pixmap.buf_align = 4; |
584 | info.par = current_par; | 757 | |
758 | /* access_align is how many bits can be accessed from the framebuffer | ||
759 | * ie. some epson cards allow 16-bit access only. Most drivers will | ||
760 | * be safe with u32 here. | ||
761 | * | ||
762 | * NOTE: This field is currently unused. | ||
763 | */ | ||
764 | info->pixmap.scan_align = 32 | ||
765 | /***************************** End optional stage ***************************/ | ||
585 | 766 | ||
586 | /* | 767 | /* |
587 | * This should give a reasonable default video mode. The following is | 768 | * This should give a reasonable default video mode. The following is |
@@ -590,42 +771,145 @@ int __init xxxfb_init(void) | |||
590 | if (!mode_option) | 771 | if (!mode_option) |
591 | mode_option = "640x480@60"; | 772 | mode_option = "640x480@60"; |
592 | 773 | ||
593 | retval = fb_find_mode(&info.var, &info, mode_option, NULL, 0, NULL, 8); | 774 | retval = fb_find_mode(info->var, info, mode_option, NULL, 0, NULL, 8); |
594 | 775 | ||
595 | if (!retval || retval == 4) | 776 | if (!retval || retval == 4) |
596 | return -EINVAL; | 777 | return -EINVAL; |
597 | 778 | ||
598 | /* This has to been done !!! */ | 779 | /* This has to been done !!! */ |
599 | fb_alloc_cmap(&info.cmap, cmap_len, 0); | 780 | fb_alloc_cmap(info->cmap, cmap_len, 0); |
600 | 781 | ||
601 | /* | 782 | /* |
602 | * The following is done in the case of having hardware with a static | 783 | * The following is done in the case of having hardware with a static |
603 | * mode. If we are setting the mode ourselves we don't call this. | 784 | * mode. If we are setting the mode ourselves we don't call this. |
604 | */ | 785 | */ |
605 | info.var = xxxfb_var; | 786 | info->var = xxxfb_var; |
606 | 787 | ||
607 | if (register_framebuffer(&info) < 0) | 788 | /* |
789 | * For drivers that can... | ||
790 | */ | ||
791 | xxxfb_check_var(&info->var, info); | ||
792 | |||
793 | /* | ||
794 | * Does a call to fb_set_par() before register_framebuffer needed? This | ||
795 | * will depend on you and the hardware. If you are sure that your driver | ||
796 | * is the only device in the system, a call to fb_set_par() is safe. | ||
797 | * | ||
798 | * Hardware in x86 systems has a VGA core. Calling set_par() at this | ||
799 | * point will corrupt the VGA console, so it might be safer to skip a | ||
800 | * call to set_par here and just allow fbcon to do it for you. | ||
801 | */ | ||
802 | /* xxxfb_set_par(info); */ | ||
803 | |||
804 | if (register_framebuffer(info) < 0) | ||
608 | return -EINVAL; | 805 | return -EINVAL; |
609 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info.node, | 806 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, |
610 | info.fix.id); | 807 | info->fix.id); |
808 | pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ | ||
611 | return 0; | 809 | return 0; |
612 | } | 810 | } |
613 | 811 | ||
614 | /* | 812 | /* |
615 | * Cleanup | 813 | * Cleanup |
616 | */ | 814 | */ |
815 | /* static void __exit xxxfb_remove(struct device *device) */ | ||
816 | static void __exit xxxfb_remove(struct pci_dev *dev) | ||
817 | { | ||
818 | struct fb_info *info = pci_get_drv_data(dev); | ||
819 | /* or dev_get_drv_data(device); */ | ||
820 | |||
821 | if (info) { | ||
822 | unregister_framebuffer(info); | ||
823 | fb_dealloc_cmap(&info.cmap); | ||
824 | /* ... */ | ||
825 | framebuffer_release(info); | ||
826 | } | ||
827 | |||
828 | return 0; | ||
829 | } | ||
617 | 830 | ||
618 | static void __exit xxxfb_cleanup(void) | 831 | #if CONFIG_PCI |
832 | /* For PCI drivers */ | ||
833 | static struct pci_driver xxxfb_driver = { | ||
834 | .name = "xxxfb", | ||
835 | .id_table = xxxfb_devices, | ||
836 | .probe = xxxfb_probe, | ||
837 | .remove = __devexit_p(xxxfb_remove), | ||
838 | .suspend = xxxfb_suspend, /* optional */ | ||
839 | .resume = xxxfb_resume, /* optional */ | ||
840 | }; | ||
841 | |||
842 | static int __init xxxfb_init(void) | ||
619 | { | 843 | { |
620 | /* | 844 | /* |
621 | * If your driver supports multiple boards, you should unregister and | 845 | * For kernel boot options (in 'video=xxxfb:<options>' format) |
622 | * clean up all instances. | 846 | */ |
623 | */ | 847 | #ifndef MODULE |
848 | char *option = NULL; | ||
624 | 849 | ||
625 | unregister_framebuffer(info); | 850 | if (fb_get_options("xxxfb", &option)) |
626 | fb_dealloc_cmap(&info.cmap); | 851 | return -ENODEV; |
627 | /* ... */ | 852 | xxxfb_setup(option); |
853 | #endif | ||
854 | |||
855 | return pci_register_driver(&xxxfb_driver); | ||
856 | } | ||
857 | |||
858 | static void __exit xxxfb_exit(void) | ||
859 | { | ||
860 | pci_unregister_driver(&xxxfb_driver); | ||
628 | } | 861 | } |
862 | #else | ||
863 | #include <linux/platform_device.h> | ||
864 | /* for platform devices */ | ||
865 | static struct device_driver xxxfb_driver = { | ||
866 | .name = "xxxfb", | ||
867 | .bus = &platform_bus_type, | ||
868 | .probe = xxxfb_probe, | ||
869 | .remove = xxxfb_remove, | ||
870 | .suspend = xxxfb_suspend, /* optional */ | ||
871 | .resume = xxxfb_resume, /* optional */ | ||
872 | }; | ||
873 | |||
874 | static struct platform_device xxxfb_device = { | ||
875 | .name = "xxxfb", | ||
876 | }; | ||
877 | |||
878 | static int __init xxxfb_init(void) | ||
879 | { | ||
880 | int ret; | ||
881 | /* | ||
882 | * For kernel boot options (in 'video=xxxfb:<options>' format) | ||
883 | */ | ||
884 | #ifndef MODULE | ||
885 | char *option = NULL; | ||
886 | |||
887 | if (fb_get_options("xxxfb", &option)) | ||
888 | return -ENODEV; | ||
889 | xxxfb_setup(option); | ||
890 | #endif | ||
891 | ret = driver_register(&xxxfb_driver); | ||
892 | |||
893 | if (!ret) { | ||
894 | ret = platform_device_register(&xxxfb_device); | ||
895 | if (ret) | ||
896 | driver_unregister(&xxxfb_driver); | ||
897 | } | ||
898 | |||
899 | return ret; | ||
900 | } | ||
901 | |||
902 | static void __exit xxxfb_exit(void) | ||
903 | { | ||
904 | platform_device_unregister(&xxxfb_device); | ||
905 | driver_unregister(&xxxfb_driver); | ||
906 | } | ||
907 | #endif | ||
908 | |||
909 | MODULE_LICENSE("GPL"); | ||
910 | module_init(xxxfb_init); | ||
911 | module_exit(xxxfb_exit); | ||
912 | |||
629 | 913 | ||
630 | /* | 914 | /* |
631 | * Setup | 915 | * Setup |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index e0f14df840d9..8a5ce210bb27 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
@@ -382,7 +382,7 @@ static void sstfb_clear_screen(struct fb_info *info) | |||
382 | static int sstfb_check_var(struct fb_var_screeninfo *var, | 382 | static int sstfb_check_var(struct fb_var_screeninfo *var, |
383 | struct fb_info *info) | 383 | struct fb_info *info) |
384 | { | 384 | { |
385 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 385 | struct sstfb_par *par = info->par; |
386 | int hSyncOff = var->xres + var->right_margin + var->left_margin; | 386 | int hSyncOff = var->xres + var->right_margin + var->left_margin; |
387 | int vSyncOff = var->yres + var->lower_margin + var->upper_margin; | 387 | int vSyncOff = var->yres + var->lower_margin + var->upper_margin; |
388 | int vBackPorch = var->left_margin, yDim = var->yres; | 388 | int vBackPorch = var->left_margin, yDim = var->yres; |
@@ -542,7 +542,7 @@ static int sstfb_check_var(struct fb_var_screeninfo *var, | |||
542 | */ | 542 | */ |
543 | static int sstfb_set_par(struct fb_info *info) | 543 | static int sstfb_set_par(struct fb_info *info) |
544 | { | 544 | { |
545 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 545 | struct sstfb_par *par = info->par; |
546 | u32 lfbmode, fbiinit1, fbiinit2, fbiinit3, fbiinit5, fbiinit6=0; | 546 | u32 lfbmode, fbiinit1, fbiinit2, fbiinit3, fbiinit5, fbiinit6=0; |
547 | struct pci_dev *sst_dev = par->dev; | 547 | struct pci_dev *sst_dev = par->dev; |
548 | unsigned int freq; | 548 | unsigned int freq; |
@@ -748,13 +748,14 @@ static int sstfb_set_par(struct fb_info *info) | |||
748 | static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | 748 | static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, |
749 | u_int transp, struct fb_info *info) | 749 | u_int transp, struct fb_info *info) |
750 | { | 750 | { |
751 | struct sstfb_par *par = info->par; | ||
751 | u32 col; | 752 | u32 col; |
752 | 753 | ||
753 | f_dddprintk("sstfb_setcolreg\n"); | 754 | f_dddprintk("sstfb_setcolreg\n"); |
754 | f_dddprintk("%-2d rgbt: %#x, %#x, %#x, %#x\n", | 755 | f_dddprintk("%-2d rgbt: %#x, %#x, %#x, %#x\n", |
755 | regno, red, green, blue, transp); | 756 | regno, red, green, blue, transp); |
756 | if (regno >= 16) | 757 | if (regno > 15) |
757 | return -EINVAL; | 758 | return 0; |
758 | 759 | ||
759 | red >>= (16 - info->var.red.length); | 760 | red >>= (16 - info->var.red.length); |
760 | green >>= (16 - info->var.green.length); | 761 | green >>= (16 - info->var.green.length); |
@@ -765,7 +766,7 @@ static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
765 | | (blue << info->var.blue.offset) | 766 | | (blue << info->var.blue.offset) |
766 | | (transp << info->var.transp.offset); | 767 | | (transp << info->var.transp.offset); |
767 | 768 | ||
768 | ((u32 *)info->pseudo_palette)[regno] = col; | 769 | par->palette[regno] = col; |
769 | 770 | ||
770 | return 0; | 771 | return 0; |
771 | } | 772 | } |
@@ -773,7 +774,7 @@ static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, | |||
773 | static int sstfb_ioctl(struct inode *inode, struct file *file, | 774 | static int sstfb_ioctl(struct inode *inode, struct file *file, |
774 | u_int cmd, u_long arg, struct fb_info *info ) | 775 | u_int cmd, u_long arg, struct fb_info *info ) |
775 | { | 776 | { |
776 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 777 | struct sstfb_par *par = info->par; |
777 | struct pci_dev *sst_dev = par->dev; | 778 | struct pci_dev *sst_dev = par->dev; |
778 | u32 fbiinit0, tmp, val; | 779 | u32 fbiinit0, tmp, val; |
779 | u_long p; | 780 | u_long p; |
@@ -830,7 +831,7 @@ static int sstfb_ioctl(struct inode *inode, struct file *file, | |||
830 | #if 0 | 831 | #if 0 |
831 | static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 832 | static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
832 | { | 833 | { |
833 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 834 | struct sstfb_par *par = info->par; |
834 | u32 stride = info->fix.line_length; | 835 | u32 stride = info->fix.line_length; |
835 | 836 | ||
836 | if (!IS_VOODOO2(par)) | 837 | if (!IS_VOODOO2(par)) |
@@ -855,7 +856,7 @@ static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
855 | */ | 856 | */ |
856 | static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 857 | static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
857 | { | 858 | { |
858 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 859 | struct sstfb_par *par = info->par; |
859 | u32 stride = info->fix.line_length; | 860 | u32 stride = info->fix.line_length; |
860 | 861 | ||
861 | if (!IS_VOODOO2(par)) | 862 | if (!IS_VOODOO2(par)) |
@@ -925,7 +926,7 @@ static int __devinit sst_get_memsize(struct fb_info *info, __u32 *memsize) | |||
925 | 926 | ||
926 | static int __devinit sst_detect_att(struct fb_info *info) | 927 | static int __devinit sst_detect_att(struct fb_info *info) |
927 | { | 928 | { |
928 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 929 | struct sstfb_par *par = info->par; |
929 | int i, mir, dir; | 930 | int i, mir, dir; |
930 | 931 | ||
931 | for (i=0; i<3; i++) { | 932 | for (i=0; i<3; i++) { |
@@ -950,7 +951,7 @@ static int __devinit sst_detect_att(struct fb_info *info) | |||
950 | 951 | ||
951 | static int __devinit sst_detect_ti(struct fb_info *info) | 952 | static int __devinit sst_detect_ti(struct fb_info *info) |
952 | { | 953 | { |
953 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 954 | struct sstfb_par *par = info->par; |
954 | int i, mir, dir; | 955 | int i, mir, dir; |
955 | 956 | ||
956 | for (i = 0; i<3; i++) { | 957 | for (i = 0; i<3; i++) { |
@@ -986,7 +987,7 @@ static int __devinit sst_detect_ti(struct fb_info *info) | |||
986 | */ | 987 | */ |
987 | static int __devinit sst_detect_ics(struct fb_info *info) | 988 | static int __devinit sst_detect_ics(struct fb_info *info) |
988 | { | 989 | { |
989 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 990 | struct sstfb_par *par = info->par; |
990 | int m_clk0_1, m_clk0_7, m_clk1_b; | 991 | int m_clk0_1, m_clk0_7, m_clk1_b; |
991 | int n_clk0_1, n_clk0_7, n_clk1_b; | 992 | int n_clk0_1, n_clk0_7, n_clk1_b; |
992 | int i; | 993 | int i; |
@@ -1023,7 +1024,7 @@ static int __devinit sst_detect_ics(struct fb_info *info) | |||
1023 | static int sst_set_pll_att_ti(struct fb_info *info, | 1024 | static int sst_set_pll_att_ti(struct fb_info *info, |
1024 | const struct pll_timing *t, const int clock) | 1025 | const struct pll_timing *t, const int clock) |
1025 | { | 1026 | { |
1026 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1027 | struct sstfb_par *par = info->par; |
1027 | u8 cr0, cc; | 1028 | u8 cr0, cc; |
1028 | 1029 | ||
1029 | /* enable indexed mode */ | 1030 | /* enable indexed mode */ |
@@ -1077,7 +1078,7 @@ static int sst_set_pll_att_ti(struct fb_info *info, | |||
1077 | static int sst_set_pll_ics(struct fb_info *info, | 1078 | static int sst_set_pll_ics(struct fb_info *info, |
1078 | const struct pll_timing *t, const int clock) | 1079 | const struct pll_timing *t, const int clock) |
1079 | { | 1080 | { |
1080 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1081 | struct sstfb_par *par = info->par; |
1081 | u8 pll_ctrl; | 1082 | u8 pll_ctrl; |
1082 | 1083 | ||
1083 | sst_dac_write(DACREG_ICS_PLLRMA, DACREG_ICS_PLL_CTRL); | 1084 | sst_dac_write(DACREG_ICS_PLLRMA, DACREG_ICS_PLL_CTRL); |
@@ -1114,7 +1115,7 @@ static int sst_set_pll_ics(struct fb_info *info, | |||
1114 | 1115 | ||
1115 | static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) | 1116 | static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) |
1116 | { | 1117 | { |
1117 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1118 | struct sstfb_par *par = info->par; |
1118 | u8 cr0; | 1119 | u8 cr0; |
1119 | 1120 | ||
1120 | sst_dac_write(DACREG_WMA, 0); /* backdoor */ | 1121 | sst_dac_write(DACREG_WMA, 0); /* backdoor */ |
@@ -1149,7 +1150,7 @@ static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp) | |||
1149 | 1150 | ||
1150 | static void sst_set_vidmod_ics(struct fb_info *info, const int bpp) | 1151 | static void sst_set_vidmod_ics(struct fb_info *info, const int bpp) |
1151 | { | 1152 | { |
1152 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1153 | struct sstfb_par *par = info->par; |
1153 | 1154 | ||
1154 | switch(bpp) { | 1155 | switch(bpp) { |
1155 | case 16: | 1156 | case 16: |
@@ -1308,7 +1309,7 @@ static int __devinit sst_init(struct fb_info *info, struct sstfb_par *par) | |||
1308 | 1309 | ||
1309 | static void __devexit sst_shutdown(struct fb_info *info) | 1310 | static void __devexit sst_shutdown(struct fb_info *info) |
1310 | { | 1311 | { |
1311 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1312 | struct sstfb_par *par = info->par; |
1312 | struct pci_dev *dev = par->dev; | 1313 | struct pci_dev *dev = par->dev; |
1313 | struct pll_timing gfx_timings; | 1314 | struct pll_timing gfx_timings; |
1314 | int Fout; | 1315 | int Fout; |
@@ -1394,12 +1395,6 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, | |||
1394 | struct sst_spec *spec; | 1395 | struct sst_spec *spec; |
1395 | int err; | 1396 | int err; |
1396 | 1397 | ||
1397 | struct all_info { | ||
1398 | struct fb_info info; | ||
1399 | struct sstfb_par par; | ||
1400 | u32 pseudo_palette[16]; | ||
1401 | } *all; | ||
1402 | |||
1403 | /* Enable device in PCI config. */ | 1398 | /* Enable device in PCI config. */ |
1404 | if ((err=pci_enable_device(pdev))) { | 1399 | if ((err=pci_enable_device(pdev))) { |
1405 | eprintk("cannot enable device\n"); | 1400 | eprintk("cannot enable device\n"); |
@@ -1407,14 +1402,13 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, | |||
1407 | } | 1402 | } |
1408 | 1403 | ||
1409 | /* Allocate the fb and par structures. */ | 1404 | /* Allocate the fb and par structures. */ |
1410 | all = kmalloc(sizeof(*all), GFP_KERNEL); | 1405 | info = framebuffer_alloc(sizeof(struct sstfb_par), &pdev->dev); |
1411 | if (!all) | 1406 | if (!info) |
1412 | return -ENOMEM; | 1407 | return -ENOMEM; |
1413 | memset(all, 0, sizeof(*all)); | 1408 | |
1414 | pci_set_drvdata(pdev, all); | 1409 | pci_set_drvdata(pdev, info); |
1415 | 1410 | ||
1416 | info = &all->info; | 1411 | par = info->par; |
1417 | par = info->par = &all->par; | ||
1418 | fix = &info->fix; | 1412 | fix = &info->fix; |
1419 | 1413 | ||
1420 | par->type = id->driver_data; | 1414 | par->type = id->driver_data; |
@@ -1471,7 +1465,7 @@ static int __devinit sstfb_probe(struct pci_dev *pdev, | |||
1471 | 1465 | ||
1472 | info->flags = FBINFO_DEFAULT; | 1466 | info->flags = FBINFO_DEFAULT; |
1473 | info->fbops = &sstfb_ops; | 1467 | info->fbops = &sstfb_ops; |
1474 | info->pseudo_palette = &all->pseudo_palette; | 1468 | info->pseudo_palette = par->palette; |
1475 | 1469 | ||
1476 | fix->type = FB_TYPE_PACKED_PIXELS; | 1470 | fix->type = FB_TYPE_PACKED_PIXELS; |
1477 | fix->visual = FB_VISUAL_TRUECOLOR; | 1471 | fix->visual = FB_VISUAL_TRUECOLOR; |
@@ -1527,7 +1521,7 @@ fail_mmio_remap: | |||
1527 | fail_fb_mem: | 1521 | fail_fb_mem: |
1528 | release_mem_region(fix->mmio_start, info->fix.mmio_len); | 1522 | release_mem_region(fix->mmio_start, info->fix.mmio_len); |
1529 | fail_mmio_mem: | 1523 | fail_mmio_mem: |
1530 | kfree(info); | 1524 | framebuffer_release(info); |
1531 | return -ENXIO; /* no voodoo detected */ | 1525 | return -ENXIO; /* no voodoo detected */ |
1532 | } | 1526 | } |
1533 | 1527 | ||
@@ -1537,7 +1531,7 @@ static void __devexit sstfb_remove(struct pci_dev *pdev) | |||
1537 | struct fb_info *info; | 1531 | struct fb_info *info; |
1538 | 1532 | ||
1539 | info = pci_get_drvdata(pdev); | 1533 | info = pci_get_drvdata(pdev); |
1540 | par = (struct sstfb_par *) info->par; | 1534 | par = info->par; |
1541 | 1535 | ||
1542 | sst_shutdown(info); | 1536 | sst_shutdown(info); |
1543 | unregister_framebuffer(info); | 1537 | unregister_framebuffer(info); |
@@ -1545,7 +1539,7 @@ static void __devexit sstfb_remove(struct pci_dev *pdev) | |||
1545 | iounmap(par->mmio_vbase); | 1539 | iounmap(par->mmio_vbase); |
1546 | release_mem_region(info->fix.smem_start, 0x400000); | 1540 | release_mem_region(info->fix.smem_start, 0x400000); |
1547 | release_mem_region(info->fix.mmio_start, info->fix.mmio_len); | 1541 | release_mem_region(info->fix.mmio_start, info->fix.mmio_len); |
1548 | kfree(info); | 1542 | framebuffer_release(info); |
1549 | } | 1543 | } |
1550 | 1544 | ||
1551 | 1545 | ||
@@ -1613,7 +1607,7 @@ static int sstfb_dump_regs(struct fb_info *info) | |||
1613 | 1607 | ||
1614 | const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]); | 1608 | const int pci_s = sizeof(pci_regs)/sizeof(pci_regs[0]); |
1615 | const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]); | 1609 | const int sst_s = sizeof(sst_regs)/sizeof(sst_regs[0]); |
1616 | struct sstfb_par *par = (struct sstfb_par *) info->par; | 1610 | struct sstfb_par *par = info->par; |
1617 | struct pci_dev *dev = par->dev; | 1611 | struct pci_dev *dev = par->dev; |
1618 | u32 pci_res[pci_s]; | 1612 | u32 pci_res[pci_s]; |
1619 | u32 sst_res[sst_s]; | 1613 | u32 sst_res[sst_s]; |
diff --git a/drivers/video/tdfxfb.c b/drivers/video/tdfxfb.c index 9d53387e6a66..3e7baf4c9fa8 100644 --- a/drivers/video/tdfxfb.c +++ b/drivers/video/tdfxfb.c | |||
@@ -291,7 +291,7 @@ static inline void banshee_make_room(struct tdfx_par *par, int size) | |||
291 | 291 | ||
292 | static int banshee_wait_idle(struct fb_info *info) | 292 | static int banshee_wait_idle(struct fb_info *info) |
293 | { | 293 | { |
294 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 294 | struct tdfx_par *par = info->par; |
295 | int i = 0; | 295 | int i = 0; |
296 | 296 | ||
297 | banshee_make_room(par, 1); | 297 | banshee_make_room(par, 1); |
@@ -364,7 +364,7 @@ static u32 do_calc_pll(int freq, int* freq_out) | |||
364 | 364 | ||
365 | static void do_write_regs(struct fb_info *info, struct banshee_reg* reg) | 365 | static void do_write_regs(struct fb_info *info, struct banshee_reg* reg) |
366 | { | 366 | { |
367 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 367 | struct tdfx_par *par = info->par; |
368 | int i; | 368 | int i; |
369 | 369 | ||
370 | banshee_wait_idle(info); | 370 | banshee_wait_idle(info); |
@@ -469,7 +469,7 @@ static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id) | |||
469 | 469 | ||
470 | static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info) | 470 | static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info) |
471 | { | 471 | { |
472 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 472 | struct tdfx_par *par = info->par; |
473 | u32 lpitch; | 473 | u32 lpitch; |
474 | 474 | ||
475 | if (var->bits_per_pixel != 8 && var->bits_per_pixel != 16 && | 475 | if (var->bits_per_pixel != 8 && var->bits_per_pixel != 16 && |
@@ -558,7 +558,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info) | |||
558 | 558 | ||
559 | static int tdfxfb_set_par(struct fb_info *info) | 559 | static int tdfxfb_set_par(struct fb_info *info) |
560 | { | 560 | { |
561 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 561 | struct tdfx_par *par = info->par; |
562 | u32 hdispend, hsyncsta, hsyncend, htotal; | 562 | u32 hdispend, hsyncsta, hsyncend, htotal; |
563 | u32 hd, hs, he, ht, hbs, hbe; | 563 | u32 hd, hs, he, ht, hbs, hbe; |
564 | u32 vd, vs, ve, vt, vbs, vbe; | 564 | u32 vd, vs, ve, vt, vbs, vbe; |
@@ -780,7 +780,7 @@ static int tdfxfb_set_par(struct fb_info *info) | |||
780 | static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | 780 | static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, |
781 | unsigned blue,unsigned transp,struct fb_info *info) | 781 | unsigned blue,unsigned transp,struct fb_info *info) |
782 | { | 782 | { |
783 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 783 | struct tdfx_par *par = info->par; |
784 | u32 rgbcol; | 784 | u32 rgbcol; |
785 | 785 | ||
786 | if (regno >= info->cmap.len || regno > 255) return 1; | 786 | if (regno >= info->cmap.len || regno > 255) return 1; |
@@ -794,11 +794,15 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
794 | break; | 794 | break; |
795 | /* Truecolor has no hardware color palettes. */ | 795 | /* Truecolor has no hardware color palettes. */ |
796 | case FB_VISUAL_TRUECOLOR: | 796 | case FB_VISUAL_TRUECOLOR: |
797 | rgbcol = (CNVT_TOHW( red, info->var.red.length) << info->var.red.offset) | | 797 | rgbcol = (CNVT_TOHW( red, info->var.red.length) << |
798 | (CNVT_TOHW( green, info->var.green.length) << info->var.green.offset) | | 798 | info->var.red.offset) | |
799 | (CNVT_TOHW( blue, info->var.blue.length) << info->var.blue.offset) | | 799 | (CNVT_TOHW( green, info->var.green.length) << |
800 | (CNVT_TOHW( transp, info->var.transp.length) << info->var.transp.offset); | 800 | info->var.green.offset) | |
801 | ((u32*)(info->pseudo_palette))[regno] = rgbcol; | 801 | (CNVT_TOHW( blue, info->var.blue.length) << |
802 | info->var.blue.offset) | | ||
803 | (CNVT_TOHW( transp, info->var.transp.length) << | ||
804 | info->var.transp.offset); | ||
805 | par->palette[regno] = rgbcol; | ||
802 | break; | 806 | break; |
803 | default: | 807 | default: |
804 | DPRINTK("bad depth %u\n", info->var.bits_per_pixel); | 808 | DPRINTK("bad depth %u\n", info->var.bits_per_pixel); |
@@ -810,7 +814,7 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
810 | /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ | 814 | /* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ |
811 | static int tdfxfb_blank(int blank, struct fb_info *info) | 815 | static int tdfxfb_blank(int blank, struct fb_info *info) |
812 | { | 816 | { |
813 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 817 | struct tdfx_par *par = info->par; |
814 | u32 dacmode, state = 0, vgablank = 0; | 818 | u32 dacmode, state = 0, vgablank = 0; |
815 | 819 | ||
816 | dacmode = tdfx_inl(par, DACMODE); | 820 | dacmode = tdfx_inl(par, DACMODE); |
@@ -855,7 +859,7 @@ static int tdfxfb_blank(int blank, struct fb_info *info) | |||
855 | static int tdfxfb_pan_display(struct fb_var_screeninfo *var, | 859 | static int tdfxfb_pan_display(struct fb_var_screeninfo *var, |
856 | struct fb_info *info) | 860 | struct fb_info *info) |
857 | { | 861 | { |
858 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 862 | struct tdfx_par *par = info->par; |
859 | u32 addr; | 863 | u32 addr; |
860 | 864 | ||
861 | if (nopan || var->xoffset || (var->yoffset > var->yres_virtual)) | 865 | if (nopan || var->xoffset || (var->yoffset > var->yres_virtual)) |
@@ -878,7 +882,7 @@ static int tdfxfb_pan_display(struct fb_var_screeninfo *var, | |||
878 | */ | 882 | */ |
879 | static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 883 | static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
880 | { | 884 | { |
881 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 885 | struct tdfx_par *par = info->par; |
882 | u32 bpp = info->var.bits_per_pixel; | 886 | u32 bpp = info->var.bits_per_pixel; |
883 | u32 stride = info->fix.line_length; | 887 | u32 stride = info->fix.line_length; |
884 | u32 fmt= stride | ((bpp+((bpp==8) ? 0 : 8)) << 13); | 888 | u32 fmt= stride | ((bpp+((bpp==8) ? 0 : 8)) << 13); |
@@ -894,7 +898,7 @@ static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect | |||
894 | if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { | 898 | if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { |
895 | tdfx_outl(par, COLORFORE, rect->color); | 899 | tdfx_outl(par, COLORFORE, rect->color); |
896 | } else { /* FB_VISUAL_TRUECOLOR */ | 900 | } else { /* FB_VISUAL_TRUECOLOR */ |
897 | tdfx_outl(par, COLORFORE, ((u32*)(info->pseudo_palette))[rect->color]); | 901 | tdfx_outl(par, COLORFORE, par->palette[rect->color]); |
898 | } | 902 | } |
899 | tdfx_outl(par, COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); | 903 | tdfx_outl(par, COMMAND_2D, COMMAND_2D_FILLRECT | (tdfx_rop << 24)); |
900 | tdfx_outl(par, DSTSIZE, rect->width | (rect->height << 16)); | 904 | tdfx_outl(par, DSTSIZE, rect->width | (rect->height << 16)); |
@@ -906,7 +910,7 @@ static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect | |||
906 | */ | 910 | */ |
907 | static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 911 | static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
908 | { | 912 | { |
909 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 913 | struct tdfx_par *par = info->par; |
910 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; | 914 | u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy; |
911 | u32 bpp = info->var.bits_per_pixel; | 915 | u32 bpp = info->var.bits_per_pixel; |
912 | u32 stride = info->fix.line_length; | 916 | u32 stride = info->fix.line_length; |
@@ -938,7 +942,7 @@ static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area | |||
938 | 942 | ||
939 | static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) | 943 | static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) |
940 | { | 944 | { |
941 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 945 | struct tdfx_par *par = info->par; |
942 | int size = image->height * ((image->width * image->depth + 7)>>3); | 946 | int size = image->height * ((image->width * image->depth + 7)>>3); |
943 | int fifo_free; | 947 | int fifo_free; |
944 | int i, stride = info->fix.line_length; | 948 | int i, stride = info->fix.line_length; |
@@ -961,8 +965,10 @@ static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
961 | break; | 965 | break; |
962 | case FB_VISUAL_TRUECOLOR: | 966 | case FB_VISUAL_TRUECOLOR: |
963 | default: | 967 | default: |
964 | tdfx_outl(par, COLORFORE, ((u32*)(info->pseudo_palette))[image->fg_color]); | 968 | tdfx_outl(par, COLORFORE, |
965 | tdfx_outl(par, COLORBACK, ((u32*)(info->pseudo_palette))[image->bg_color]); | 969 | par->palette[image->fg_color]); |
970 | tdfx_outl(par, COLORBACK, | ||
971 | par->palette[image->bg_color]); | ||
966 | } | 972 | } |
967 | #ifdef __BIG_ENDIAN | 973 | #ifdef __BIG_ENDIAN |
968 | srcfmt = 0x400000 | BIT(20); | 974 | srcfmt = 0x400000 | BIT(20); |
@@ -1007,7 +1013,7 @@ static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
1007 | #ifdef TDFX_HARDWARE_CURSOR | 1013 | #ifdef TDFX_HARDWARE_CURSOR |
1008 | static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) | 1014 | static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor) |
1009 | { | 1015 | { |
1010 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 1016 | struct tdfx_par *par = info->par; |
1011 | unsigned long flags; | 1017 | unsigned long flags; |
1012 | 1018 | ||
1013 | /* | 1019 | /* |
@@ -1157,18 +1163,17 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, | |||
1157 | { | 1163 | { |
1158 | struct tdfx_par *default_par; | 1164 | struct tdfx_par *default_par; |
1159 | struct fb_info *info; | 1165 | struct fb_info *info; |
1160 | int size, err, lpitch; | 1166 | int err, lpitch; |
1161 | 1167 | ||
1162 | if ((err = pci_enable_device(pdev))) { | 1168 | if ((err = pci_enable_device(pdev))) { |
1163 | printk(KERN_WARNING "tdfxfb: Can't enable pdev: %d\n", err); | 1169 | printk(KERN_WARNING "tdfxfb: Can't enable pdev: %d\n", err); |
1164 | return err; | 1170 | return err; |
1165 | } | 1171 | } |
1166 | 1172 | ||
1167 | size = sizeof(struct tdfx_par)+256*sizeof(u32); | 1173 | info = framebuffer_alloc(sizeof(struct tdfx_par), &pdev->dev); |
1168 | 1174 | ||
1169 | info = framebuffer_alloc(size, &pdev->dev); | 1175 | if (!info) |
1170 | 1176 | return -ENOMEM; | |
1171 | if (!info) return -ENOMEM; | ||
1172 | 1177 | ||
1173 | default_par = info->par; | 1178 | default_par = info->par; |
1174 | 1179 | ||
@@ -1248,7 +1253,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev, | |||
1248 | 1253 | ||
1249 | info->fbops = &tdfxfb_ops; | 1254 | info->fbops = &tdfxfb_ops; |
1250 | info->fix = tdfx_fix; | 1255 | info->fix = tdfx_fix; |
1251 | info->pseudo_palette = (void *)(default_par + 1); | 1256 | info->pseudo_palette = default_par->palette; |
1252 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; | 1257 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; |
1253 | #ifdef CONFIG_FB_3DFX_ACCEL | 1258 | #ifdef CONFIG_FB_3DFX_ACCEL |
1254 | info->flags |= FBINFO_HWACCEL_FILLRECT | | 1259 | info->flags |= FBINFO_HWACCEL_FILLRECT | |
@@ -1307,7 +1312,7 @@ out_err: | |||
1307 | } | 1312 | } |
1308 | 1313 | ||
1309 | #ifndef MODULE | 1314 | #ifndef MODULE |
1310 | void tdfxfb_setup(char *options) | 1315 | static void tdfxfb_setup(char *options) |
1311 | { | 1316 | { |
1312 | char* this_opt; | 1317 | char* this_opt; |
1313 | 1318 | ||
@@ -1340,7 +1345,7 @@ void tdfxfb_setup(char *options) | |||
1340 | static void __devexit tdfxfb_remove(struct pci_dev *pdev) | 1345 | static void __devexit tdfxfb_remove(struct pci_dev *pdev) |
1341 | { | 1346 | { |
1342 | struct fb_info *info = pci_get_drvdata(pdev); | 1347 | struct fb_info *info = pci_get_drvdata(pdev); |
1343 | struct tdfx_par *par = (struct tdfx_par *) info->par; | 1348 | struct tdfx_par *par = info->par; |
1344 | 1349 | ||
1345 | unregister_framebuffer(info); | 1350 | unregister_framebuffer(info); |
1346 | iounmap(par->regbase_virt); | 1351 | iounmap(par->regbase_virt); |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 3e58ddc2bc38..8982e540214c 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -57,7 +57,6 @@ static unsigned short *pmi_base = NULL; | |||
57 | static void (*pmi_start)(void); | 57 | static void (*pmi_start)(void); |
58 | static void (*pmi_pal)(void); | 58 | static void (*pmi_pal)(void); |
59 | static int depth; | 59 | static int depth; |
60 | static int vga_compat; | ||
61 | 60 | ||
62 | /* --------------------------------------------------------------------- */ | 61 | /* --------------------------------------------------------------------- */ |
63 | 62 | ||
@@ -67,15 +66,6 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var, | |||
67 | #ifdef __i386__ | 66 | #ifdef __i386__ |
68 | int offset; | 67 | int offset; |
69 | 68 | ||
70 | if (!ypan) | ||
71 | return -EINVAL; | ||
72 | if (var->xoffset) | ||
73 | return -EINVAL; | ||
74 | if (var->yoffset > var->yres_virtual) | ||
75 | return -EINVAL; | ||
76 | if ((ypan==1) && var->yoffset+var->yres > var->yres_virtual) | ||
77 | return -EINVAL; | ||
78 | |||
79 | offset = (var->yoffset * info->fix.line_length + var->xoffset) / 4; | 69 | offset = (var->yoffset * info->fix.line_length + var->xoffset) / 4; |
80 | 70 | ||
81 | __asm__ __volatile__( | 71 | __asm__ __volatile__( |
@@ -90,37 +80,6 @@ static int vesafb_pan_display(struct fb_var_screeninfo *var, | |||
90 | return 0; | 80 | return 0; |
91 | } | 81 | } |
92 | 82 | ||
93 | static int vesafb_blank(int blank, struct fb_info *info) | ||
94 | { | ||
95 | int err = 1; | ||
96 | |||
97 | if (vga_compat) { | ||
98 | int loop = 10000; | ||
99 | u8 seq = 0, crtc17 = 0; | ||
100 | |||
101 | if (blank == FB_BLANK_POWERDOWN) { | ||
102 | seq = 0x20; | ||
103 | crtc17 = 0x00; | ||
104 | err = 0; | ||
105 | } else { | ||
106 | seq = 0x00; | ||
107 | crtc17 = 0x80; | ||
108 | err = (blank == FB_BLANK_UNBLANK) ? 0 : -EINVAL; | ||
109 | } | ||
110 | |||
111 | vga_wseq(NULL, 0x00, 0x01); | ||
112 | seq |= vga_rseq(NULL, 0x01) & ~0x20; | ||
113 | vga_wseq(NULL, 0x00, seq); | ||
114 | |||
115 | crtc17 |= vga_rcrt(NULL, 0x17) & ~0x80; | ||
116 | while (loop--); | ||
117 | vga_wcrt(NULL, 0x17, crtc17); | ||
118 | vga_wseq(NULL, 0x00, 0x03); | ||
119 | } | ||
120 | |||
121 | return err; | ||
122 | } | ||
123 | |||
124 | static void vesa_setpalette(int regno, unsigned red, unsigned green, | 83 | static void vesa_setpalette(int regno, unsigned red, unsigned green, |
125 | unsigned blue) | 84 | unsigned blue) |
126 | { | 85 | { |
@@ -205,7 +164,6 @@ static struct fb_ops vesafb_ops = { | |||
205 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
206 | .fb_setcolreg = vesafb_setcolreg, | 165 | .fb_setcolreg = vesafb_setcolreg, |
207 | .fb_pan_display = vesafb_pan_display, | 166 | .fb_pan_display = vesafb_pan_display, |
208 | .fb_blank = vesafb_blank, | ||
209 | .fb_fillrect = cfb_fillrect, | 167 | .fb_fillrect = cfb_fillrect, |
210 | .fb_copyarea = cfb_copyarea, | 168 | .fb_copyarea = cfb_copyarea, |
211 | .fb_imageblit = cfb_imageblit, | 169 | .fb_imageblit = cfb_imageblit, |
@@ -459,9 +417,8 @@ static int __init vesafb_probe(struct platform_device *dev) | |||
459 | info->flags = FBINFO_FLAG_DEFAULT | | 417 | info->flags = FBINFO_FLAG_DEFAULT | |
460 | (ypan) ? FBINFO_HWACCEL_YPAN : 0; | 418 | (ypan) ? FBINFO_HWACCEL_YPAN : 0; |
461 | 419 | ||
462 | vga_compat = (screen_info.capabilities & 2) ? 0 : 1; | 420 | if (!ypan) |
463 | printk("vesafb: Mode is %sVGA compatible\n", | 421 | info->fbops->fb_pan_display = NULL; |
464 | (vga_compat) ? "" : "not "); | ||
465 | 422 | ||
466 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 423 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
467 | err = -ENOMEM; | 424 | err = -ENOMEM; |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 226ae8a88482..f3f16fd9f231 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -705,15 +705,7 @@ static int vga16fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
705 | static int vga16fb_pan_display(struct fb_var_screeninfo *var, | 705 | static int vga16fb_pan_display(struct fb_var_screeninfo *var, |
706 | struct fb_info *info) | 706 | struct fb_info *info) |
707 | { | 707 | { |
708 | if (var->xoffset + info->var.xres > info->var.xres_virtual || | ||
709 | var->yoffset + info->var.yres > info->var.yres_virtual) | ||
710 | return -EINVAL; | ||
711 | |||
712 | vga16fb_pan_var(info, var); | 708 | vga16fb_pan_var(info, var); |
713 | |||
714 | info->var.xoffset = var->xoffset; | ||
715 | info->var.yoffset = var->yoffset; | ||
716 | info->var.vmode &= ~FB_VMODE_YWRAP; | ||
717 | return 0; | 709 | return 0; |
718 | } | 710 | } |
719 | 711 | ||
diff --git a/drivers/video/vgastate.c b/drivers/video/vgastate.c index d9e01daee630..15179ec62339 100644 --- a/drivers/video/vgastate.c +++ b/drivers/video/vgastate.c | |||
@@ -356,10 +356,11 @@ int save_vga(struct vgastate *state) | |||
356 | { | 356 | { |
357 | struct regstate *saved; | 357 | struct regstate *saved; |
358 | 358 | ||
359 | saved = kmalloc(sizeof(struct regstate), GFP_KERNEL); | 359 | saved = kzalloc(sizeof(struct regstate), GFP_KERNEL); |
360 | |||
360 | if (saved == NULL) | 361 | if (saved == NULL) |
361 | return 1; | 362 | return 1; |
362 | memset (saved, 0, sizeof(struct regstate)); | 363 | |
363 | state->vidstate = (void *)saved; | 364 | state->vidstate = (void *)saved; |
364 | 365 | ||
365 | if (state->flags & VGA_SAVE_CMAP) { | 366 | if (state->flags & VGA_SAVE_CMAP) { |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index ae0f06b3c11a..2c4fa75be025 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -91,7 +91,7 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses, | |||
91 | sb->s_op = &v9fs_super_ops; | 91 | sb->s_op = &v9fs_super_ops; |
92 | 92 | ||
93 | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | | 93 | sb->s_flags = flags | MS_ACTIVE | MS_SYNCHRONOUS | MS_DIRSYNC | |
94 | MS_NODIRATIME | MS_NOATIME; | 94 | MS_NOATIME; |
95 | } | 95 | } |
96 | 96 | ||
97 | /** | 97 | /** |
diff --git a/fs/Kconfig b/fs/Kconfig index 382e3b2883d5..ef78e3a42d32 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -798,7 +798,7 @@ config PROC_KCORE | |||
798 | 798 | ||
799 | config PROC_VMCORE | 799 | config PROC_VMCORE |
800 | bool "/proc/vmcore support (EXPERIMENTAL)" | 800 | bool "/proc/vmcore support (EXPERIMENTAL)" |
801 | depends on PROC_FS && EMBEDDED && EXPERIMENTAL && CRASH_DUMP | 801 | depends on PROC_FS && EXPERIMENTAL && CRASH_DUMP |
802 | help | 802 | help |
803 | Exports the dump image of crashed kernel in ELF format. | 803 | Exports the dump image of crashed kernel in ELF format. |
804 | 804 | ||
diff --git a/fs/Makefile b/fs/Makefile index 35e9aec608e4..1db711319c80 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -14,7 +14,7 @@ obj-y := open.o read_write.o file_table.o buffer.o bio.o super.o \ | |||
14 | 14 | ||
15 | obj-$(CONFIG_INOTIFY) += inotify.o | 15 | obj-$(CONFIG_INOTIFY) += inotify.o |
16 | obj-$(CONFIG_EPOLL) += eventpoll.o | 16 | obj-$(CONFIG_EPOLL) += eventpoll.o |
17 | obj-$(CONFIG_COMPAT) += compat.o | 17 | obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o |
18 | 18 | ||
19 | nfsd-$(CONFIG_NFSD) := nfsctl.o | 19 | nfsd-$(CONFIG_NFSD) := nfsctl.o |
20 | obj-y += $(nfsd-y) $(nfsd-m) | 20 | obj-y += $(nfsd-y) $(nfsd-m) |
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index 541b19e6fec9..14aa70282e8c 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -86,7 +86,7 @@ static int autofs4_root_readdir(struct file *file, void *dirent, | |||
86 | 86 | ||
87 | /* Update usage from here to top of tree, so that scan of | 87 | /* Update usage from here to top of tree, so that scan of |
88 | top-level directories will give a useful result */ | 88 | top-level directories will give a useful result */ |
89 | static void autofs4_update_usage(struct dentry *dentry) | 89 | static void autofs4_update_usage(struct vfsmount *mnt, struct dentry *dentry) |
90 | { | 90 | { |
91 | struct dentry *top = dentry->d_sb->s_root; | 91 | struct dentry *top = dentry->d_sb->s_root; |
92 | 92 | ||
@@ -95,7 +95,7 @@ static void autofs4_update_usage(struct dentry *dentry) | |||
95 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 95 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
96 | 96 | ||
97 | if (ino) { | 97 | if (ino) { |
98 | update_atime(dentry->d_inode); | 98 | touch_atime(mnt, dentry); |
99 | ino->last_used = jiffies; | 99 | ino->last_used = jiffies; |
100 | } | 100 | } |
101 | } | 101 | } |
@@ -289,10 +289,10 @@ out: | |||
289 | return autofs4_dcache_readdir(file, dirent, filldir); | 289 | return autofs4_dcache_readdir(file, dirent, filldir); |
290 | } | 290 | } |
291 | 291 | ||
292 | static int try_to_fill_dentry(struct dentry *dentry, | 292 | static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int flags) |
293 | struct super_block *sb, | ||
294 | struct autofs_sb_info *sbi, int flags) | ||
295 | { | 293 | { |
294 | struct super_block *sb = mnt->mnt_sb; | ||
295 | struct autofs_sb_info *sbi = autofs4_sbi(sb); | ||
296 | struct autofs_info *de_info = autofs4_dentry_ino(dentry); | 296 | struct autofs_info *de_info = autofs4_dentry_ino(dentry); |
297 | int status = 0; | 297 | int status = 0; |
298 | 298 | ||
@@ -367,7 +367,7 @@ static int try_to_fill_dentry(struct dentry *dentry, | |||
367 | /* We don't update the usages for the autofs daemon itself, this | 367 | /* We don't update the usages for the autofs daemon itself, this |
368 | is necessary for recursive autofs mounts */ | 368 | is necessary for recursive autofs mounts */ |
369 | if (!autofs4_oz_mode(sbi)) | 369 | if (!autofs4_oz_mode(sbi)) |
370 | autofs4_update_usage(dentry); | 370 | autofs4_update_usage(mnt, dentry); |
371 | 371 | ||
372 | spin_lock(&dentry->d_lock); | 372 | spin_lock(&dentry->d_lock); |
373 | dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; | 373 | dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; |
@@ -392,7 +392,7 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
392 | /* Pending dentry */ | 392 | /* Pending dentry */ |
393 | if (autofs4_ispending(dentry)) { | 393 | if (autofs4_ispending(dentry)) { |
394 | if (!oz_mode) | 394 | if (!oz_mode) |
395 | status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); | 395 | status = try_to_fill_dentry(nd->mnt, dentry, flags); |
396 | return status; | 396 | return status; |
397 | } | 397 | } |
398 | 398 | ||
@@ -409,14 +409,14 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd) | |||
409 | dentry, dentry->d_name.len, dentry->d_name.name); | 409 | dentry, dentry->d_name.len, dentry->d_name.name); |
410 | spin_unlock(&dcache_lock); | 410 | spin_unlock(&dcache_lock); |
411 | if (!oz_mode) | 411 | if (!oz_mode) |
412 | status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); | 412 | status = try_to_fill_dentry(nd->mnt, dentry, flags); |
413 | return status; | 413 | return status; |
414 | } | 414 | } |
415 | spin_unlock(&dcache_lock); | 415 | spin_unlock(&dcache_lock); |
416 | 416 | ||
417 | /* Update the usage list */ | 417 | /* Update the usage list */ |
418 | if (!oz_mode) | 418 | if (!oz_mode) |
419 | autofs4_update_usage(dentry); | 419 | autofs4_update_usage(nd->mnt, dentry); |
420 | 420 | ||
421 | return 1; | 421 | return 1; |
422 | } | 422 | } |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 72011826f0cb..f312103434d4 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -33,8 +33,6 @@ static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); | |||
33 | static int load_aout_library(struct file*); | 33 | static int load_aout_library(struct file*); |
34 | static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); | 34 | static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); |
35 | 35 | ||
36 | extern void dump_thread(struct pt_regs *, struct user *); | ||
37 | |||
38 | static struct linux_binfmt aout_format = { | 36 | static struct linux_binfmt aout_format = { |
39 | .module = THIS_MODULE, | 37 | .module = THIS_MODULE, |
40 | .load_binary = load_aout_binary, | 38 | .load_binary = load_aout_binary, |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 80ca932ba0bd..a4f6f57d91aa 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -622,7 +622,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
622 | goto out_free_file; | 622 | goto out_free_file; |
623 | 623 | ||
624 | retval = -ENOMEM; | 624 | retval = -ENOMEM; |
625 | elf_interpreter = (char *) kmalloc(elf_ppnt->p_filesz, | 625 | elf_interpreter = kmalloc(elf_ppnt->p_filesz, |
626 | GFP_KERNEL); | 626 | GFP_KERNEL); |
627 | if (!elf_interpreter) | 627 | if (!elf_interpreter) |
628 | goto out_free_file; | 628 | goto out_free_file; |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index e0344f69c79d..5b3076e8ee90 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -187,7 +187,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, struct pt_regs *regs | |||
187 | goto error; | 187 | goto error; |
188 | 188 | ||
189 | /* read the name of the interpreter into memory */ | 189 | /* read the name of the interpreter into memory */ |
190 | interpreter_name = (char *) kmalloc(phdr->p_filesz, GFP_KERNEL); | 190 | interpreter_name = kmalloc(phdr->p_filesz, GFP_KERNEL); |
191 | if (!interpreter_name) | 191 | if (!interpreter_name) |
192 | goto error; | 192 | goto error; |
193 | 193 | ||
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 9d6625829b99..b72dc31a0970 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -77,8 +77,6 @@ static int load_flat_shared_library(int id, struct lib_info *p); | |||
77 | static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs); | 77 | static int load_flat_binary(struct linux_binprm *, struct pt_regs * regs); |
78 | static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file); | 78 | static int flat_core_dump(long signr, struct pt_regs * regs, struct file *file); |
79 | 79 | ||
80 | extern void dump_thread(struct pt_regs *, struct user *); | ||
81 | |||
82 | static struct linux_binfmt flat_format = { | 80 | static struct linux_binfmt flat_format = { |
83 | .module = THIS_MODULE, | 81 | .module = THIS_MODULE, |
84 | .load_binary = load_flat_binary, | 82 | .load_binary = load_flat_binary, |
diff --git a/fs/cifs/cifs_uniupr.h b/fs/cifs/cifs_uniupr.h index decd138f14d4..da2ad5b451ac 100644 --- a/fs/cifs/cifs_uniupr.h +++ b/fs/cifs/cifs_uniupr.h | |||
@@ -242,7 +242,7 @@ static signed char UniCaseRangeLff20[27] = { | |||
242 | /* | 242 | /* |
243 | * Lower Case Range | 243 | * Lower Case Range |
244 | */ | 244 | */ |
245 | const static struct UniCaseRange CifsUniLowerRange[] = { | 245 | static const struct UniCaseRange CifsUniLowerRange[] = { |
246 | 0x0380, 0x03ab, UniCaseRangeL0380, | 246 | 0x0380, 0x03ab, UniCaseRangeL0380, |
247 | 0x0400, 0x042f, UniCaseRangeL0400, | 247 | 0x0400, 0x042f, UniCaseRangeL0400, |
248 | 0x0490, 0x04cb, UniCaseRangeL0490, | 248 | 0x0490, 0x04cb, UniCaseRangeL0490, |
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 55d9a3a954cf..890bc30fbe20 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -10,7 +10,6 @@ | |||
10 | * ioctls. | 10 | * ioctls. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifdef INCLUDES | ||
14 | #include <linux/config.h> | 13 | #include <linux/config.h> |
15 | #include <linux/types.h> | 14 | #include <linux/types.h> |
16 | #include <linux/compat.h> | 15 | #include <linux/compat.h> |
@@ -81,13 +80,9 @@ | |||
81 | #include <linux/capi.h> | 80 | #include <linux/capi.h> |
82 | 81 | ||
83 | #include <scsi/scsi.h> | 82 | #include <scsi/scsi.h> |
84 | /* Ugly hack. */ | ||
85 | #undef __KERNEL__ | ||
86 | #include <scsi/scsi_ioctl.h> | 83 | #include <scsi/scsi_ioctl.h> |
87 | #define __KERNEL__ | ||
88 | #include <scsi/sg.h> | 84 | #include <scsi/sg.h> |
89 | 85 | ||
90 | #include <asm/types.h> | ||
91 | #include <asm/uaccess.h> | 86 | #include <asm/uaccess.h> |
92 | #include <linux/ethtool.h> | 87 | #include <linux/ethtool.h> |
93 | #include <linux/mii.h> | 88 | #include <linux/mii.h> |
@@ -95,7 +90,6 @@ | |||
95 | #include <linux/watchdog.h> | 90 | #include <linux/watchdog.h> |
96 | #include <linux/dm-ioctl.h> | 91 | #include <linux/dm-ioctl.h> |
97 | 92 | ||
98 | #include <asm/module.h> | ||
99 | #include <linux/soundcard.h> | 93 | #include <linux/soundcard.h> |
100 | #include <linux/lp.h> | 94 | #include <linux/lp.h> |
101 | #include <linux/ppdev.h> | 95 | #include <linux/ppdev.h> |
@@ -128,11 +122,6 @@ | |||
128 | #include <linux/dvb/frontend.h> | 122 | #include <linux/dvb/frontend.h> |
129 | #include <linux/dvb/video.h> | 123 | #include <linux/dvb/video.h> |
130 | 124 | ||
131 | #undef INCLUDES | ||
132 | #endif | ||
133 | |||
134 | #ifdef CODE | ||
135 | |||
136 | /* Aiee. Someone does not find a difference between int and long */ | 125 | /* Aiee. Someone does not find a difference between int and long */ |
137 | #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) | 126 | #define EXT2_IOC32_GETFLAGS _IOR('f', 1, int) |
138 | #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int) | 127 | #define EXT2_IOC32_SETFLAGS _IOW('f', 2, int) |
@@ -148,6 +137,12 @@ | |||
148 | #define EXT2_IOC32_GETVERSION _IOR('v', 1, int) | 137 | #define EXT2_IOC32_GETVERSION _IOR('v', 1, int) |
149 | #define EXT2_IOC32_SETVERSION _IOW('v', 2, int) | 138 | #define EXT2_IOC32_SETVERSION _IOW('v', 2, int) |
150 | 139 | ||
140 | static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, | ||
141 | unsigned long arg, struct file *f) | ||
142 | { | ||
143 | return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg)); | ||
144 | } | ||
145 | |||
151 | static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg) | 146 | static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg) |
152 | { | 147 | { |
153 | mm_segment_t old_fs = get_fs(); | 148 | mm_segment_t old_fs = get_fs(); |
@@ -2475,6 +2470,49 @@ static int old_bridge_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg | |||
2475 | return -EINVAL; | 2470 | return -EINVAL; |
2476 | } | 2471 | } |
2477 | 2472 | ||
2473 | #define RTC_IRQP_READ32 _IOR('p', 0x0b, compat_ulong_t) | ||
2474 | #define RTC_IRQP_SET32 _IOW('p', 0x0c, compat_ulong_t) | ||
2475 | #define RTC_EPOCH_READ32 _IOR('p', 0x0d, compat_ulong_t) | ||
2476 | #define RTC_EPOCH_SET32 _IOW('p', 0x0e, compat_ulong_t) | ||
2477 | |||
2478 | static int rtc_ioctl(unsigned fd, unsigned cmd, unsigned long arg) | ||
2479 | { | ||
2480 | mm_segment_t oldfs = get_fs(); | ||
2481 | compat_ulong_t val32; | ||
2482 | unsigned long kval; | ||
2483 | int ret; | ||
2484 | |||
2485 | switch (cmd) { | ||
2486 | case RTC_IRQP_READ32: | ||
2487 | case RTC_EPOCH_READ32: | ||
2488 | set_fs(KERNEL_DS); | ||
2489 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_READ32) ? | ||
2490 | RTC_IRQP_READ : RTC_EPOCH_READ, | ||
2491 | (unsigned long)&kval); | ||
2492 | set_fs(oldfs); | ||
2493 | if (ret) | ||
2494 | return ret; | ||
2495 | val32 = kval; | ||
2496 | return put_user(val32, (unsigned int __user *)arg); | ||
2497 | case RTC_IRQP_SET32: | ||
2498 | case RTC_EPOCH_SET32: | ||
2499 | ret = get_user(val32, (unsigned int __user *)arg); | ||
2500 | if (ret) | ||
2501 | return ret; | ||
2502 | kval = val32; | ||
2503 | |||
2504 | set_fs(KERNEL_DS); | ||
2505 | ret = sys_ioctl(fd, (cmd == RTC_IRQP_SET32) ? | ||
2506 | RTC_IRQP_SET : RTC_EPOCH_SET, | ||
2507 | (unsigned long)&kval); | ||
2508 | set_fs(oldfs); | ||
2509 | return ret; | ||
2510 | default: | ||
2511 | /* unreached */ | ||
2512 | return -ENOIOCTLCMD; | ||
2513 | } | ||
2514 | } | ||
2515 | |||
2478 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) | 2516 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) |
2479 | struct ncp_ioctl_request_32 { | 2517 | struct ncp_ioctl_request_32 { |
2480 | u32 function; | 2518 | u32 function; |
@@ -2662,10 +2700,20 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon | |||
2662 | } | 2700 | } |
2663 | #endif | 2701 | #endif |
2664 | 2702 | ||
2665 | #undef CODE | 2703 | #define HANDLE_IOCTL(cmd,handler) \ |
2666 | #endif | 2704 | { (cmd), (ioctl_trans_handler_t)(handler) }, |
2705 | |||
2706 | /* pointer to compatible structure or no argument */ | ||
2707 | #define COMPATIBLE_IOCTL(cmd) \ | ||
2708 | { (cmd), do_ioctl32_pointer }, | ||
2709 | |||
2710 | /* argument is an unsigned long integer, not a pointer */ | ||
2711 | #define ULONG_IOCTL(cmd) \ | ||
2712 | { (cmd), (ioctl_trans_handler_t)sys_ioctl }, | ||
2667 | 2713 | ||
2668 | #ifdef DECLARES | 2714 | |
2715 | struct ioctl_trans ioctl_start[] = { | ||
2716 | #include <linux/compat_ioctl.h> | ||
2669 | HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob) | 2717 | HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob) |
2670 | HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob) | 2718 | HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob) |
2671 | #ifdef CONFIG_NET | 2719 | #ifdef CONFIG_NET |
@@ -2858,6 +2906,10 @@ HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl) | |||
2858 | HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) | 2906 | HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl) |
2859 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) | 2907 | HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) |
2860 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) | 2908 | HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) |
2909 | HANDLE_IOCTL(RTC_IRQP_READ32, rtc_ioctl) | ||
2910 | HANDLE_IOCTL(RTC_IRQP_SET32, rtc_ioctl) | ||
2911 | HANDLE_IOCTL(RTC_EPOCH_READ32, rtc_ioctl) | ||
2912 | HANDLE_IOCTL(RTC_EPOCH_SET32, rtc_ioctl) | ||
2861 | 2913 | ||
2862 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) | 2914 | #if defined(CONFIG_NCP_FS) || defined(CONFIG_NCP_FS_MODULE) |
2863 | HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest) | 2915 | HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest) |
@@ -2874,6 +2926,6 @@ HANDLE_IOCTL(DMX_GET_EVENT, do_dmx_get_event) | |||
2874 | HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) | 2926 | HANDLE_IOCTL(VIDEO_GET_EVENT, do_video_get_event) |
2875 | HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) | 2927 | HANDLE_IOCTL(VIDEO_STILLPICTURE, do_video_stillpicture) |
2876 | HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette) | 2928 | HANDLE_IOCTL(VIDEO_SET_SPU_PALETTE, do_video_set_spu_palette) |
2929 | }; | ||
2877 | 2930 | ||
2878 | #undef DECLARES | 2931 | int ioctl_table_size = ARRAY_SIZE(ioctl_start); |
2879 | #endif | ||
diff --git a/fs/dcache.c b/fs/dcache.c index 1536f15c4d4c..134d6775183f 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -808,10 +808,14 @@ void d_instantiate(struct dentry *entry, struct inode * inode) | |||
808 | * | 808 | * |
809 | * Fill in inode information in the entry. On success, it returns NULL. | 809 | * Fill in inode information in the entry. On success, it returns NULL. |
810 | * If an unhashed alias of "entry" already exists, then we return the | 810 | * If an unhashed alias of "entry" already exists, then we return the |
811 | * aliased dentry instead. | 811 | * aliased dentry instead and drop one reference to inode. |
812 | * | 812 | * |
813 | * Note that in order to avoid conflicts with rename() etc, the caller | 813 | * Note that in order to avoid conflicts with rename() etc, the caller |
814 | * had better be holding the parent directory semaphore. | 814 | * had better be holding the parent directory semaphore. |
815 | * | ||
816 | * This also assumes that the inode count has been incremented | ||
817 | * (or otherwise set) by the caller to indicate that it is now | ||
818 | * in use by the dcache. | ||
815 | */ | 819 | */ |
816 | struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) | 820 | struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) |
817 | { | 821 | { |
@@ -838,6 +842,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) | |||
838 | dget_locked(alias); | 842 | dget_locked(alias); |
839 | spin_unlock(&dcache_lock); | 843 | spin_unlock(&dcache_lock); |
840 | BUG_ON(!d_unhashed(alias)); | 844 | BUG_ON(!d_unhashed(alias)); |
845 | iput(inode); | ||
841 | return alias; | 846 | return alias; |
842 | } | 847 | } |
843 | list_add(&entry->d_alias, &inode->i_dentry); | 848 | list_add(&entry->d_alias, &inode->i_dentry); |
@@ -632,10 +632,10 @@ static inline int de_thread(struct task_struct *tsk) | |||
632 | * synchronize with any firing (by calling del_timer_sync) | 632 | * synchronize with any firing (by calling del_timer_sync) |
633 | * before we can safely let the old group leader die. | 633 | * before we can safely let the old group leader die. |
634 | */ | 634 | */ |
635 | sig->real_timer.data = (unsigned long)current; | 635 | sig->real_timer.data = current; |
636 | spin_unlock_irq(lock); | 636 | spin_unlock_irq(lock); |
637 | if (del_timer_sync(&sig->real_timer)) | 637 | if (hrtimer_cancel(&sig->real_timer)) |
638 | add_timer(&sig->real_timer); | 638 | hrtimer_restart(&sig->real_timer); |
639 | spin_lock_irq(lock); | 639 | spin_lock_irq(lock); |
640 | } | 640 | } |
641 | while (atomic_read(&sig->count) > count) { | 641 | while (atomic_read(&sig->count) > count) { |
diff --git a/fs/ext2/bitmap.c b/fs/ext2/bitmap.c index 20145b74623f..e9983a0dd396 100644 --- a/fs/ext2/bitmap.c +++ b/fs/ext2/bitmap.c | |||
@@ -7,8 +7,12 @@ | |||
7 | * Universite Pierre et Marie Curie (Paris VI) | 7 | * Universite Pierre et Marie Curie (Paris VI) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifdef EXT2FS_DEBUG | ||
11 | |||
10 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
11 | 13 | ||
14 | #include "ext2.h" | ||
15 | |||
12 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; | 16 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; |
13 | 17 | ||
14 | unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars) | 18 | unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars) |
@@ -23,3 +27,6 @@ unsigned long ext2_count_free (struct buffer_head * map, unsigned int numchars) | |||
23 | nibblemap[(map->b_data[i] >> 4) & 0xf]; | 27 | nibblemap[(map->b_data[i] >> 4) & 0xf]; |
24 | return (sum); | 28 | return (sum); |
25 | } | 29 | } |
30 | |||
31 | #endif /* EXT2FS_DEBUG */ | ||
32 | |||
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index f7a3b5fee274..a2ca3107d475 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
@@ -389,10 +389,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name, | |||
389 | ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld", | 389 | ea_idebug(inode, "name=%d.%s, value=%p, value_len=%ld", |
390 | name_index, name, value, (long)value_len); | 390 | name_index, name, value, (long)value_len); |
391 | 391 | ||
392 | if (IS_RDONLY(inode)) | ||
393 | return -EROFS; | ||
394 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | ||
395 | return -EPERM; | ||
396 | if (value == NULL) | 392 | if (value == NULL) |
397 | value_len = 0; | 393 | value_len = 0; |
398 | if (name == NULL) | 394 | if (name == NULL) |
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c index 52b30ee6a25f..2c072bfea23b 100644 --- a/fs/ext2/xattr_trusted.c +++ b/fs/ext2/xattr_trusted.c | |||
@@ -38,8 +38,6 @@ ext2_xattr_trusted_get(struct inode *inode, const char *name, | |||
38 | { | 38 | { |
39 | if (strcmp(name, "") == 0) | 39 | if (strcmp(name, "") == 0) |
40 | return -EINVAL; | 40 | return -EINVAL; |
41 | if (!capable(CAP_SYS_ADMIN)) | ||
42 | return -EPERM; | ||
43 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, | 41 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, |
44 | buffer, size); | 42 | buffer, size); |
45 | } | 43 | } |
@@ -50,8 +48,6 @@ ext2_xattr_trusted_set(struct inode *inode, const char *name, | |||
50 | { | 48 | { |
51 | if (strcmp(name, "") == 0) | 49 | if (strcmp(name, "") == 0) |
52 | return -EINVAL; | 50 | return -EINVAL; |
53 | if (!capable(CAP_SYS_ADMIN)) | ||
54 | return -EPERM; | ||
55 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, | 51 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, |
56 | value, size, flags); | 52 | value, size, flags); |
57 | } | 53 | } |
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c index 0c03ea131a94..f383e7c3a7b5 100644 --- a/fs/ext2/xattr_user.c +++ b/fs/ext2/xattr_user.c | |||
@@ -35,16 +35,10 @@ static int | |||
35 | ext2_xattr_user_get(struct inode *inode, const char *name, | 35 | ext2_xattr_user_get(struct inode *inode, const char *name, |
36 | void *buffer, size_t size) | 36 | void *buffer, size_t size) |
37 | { | 37 | { |
38 | int error; | ||
39 | |||
40 | if (strcmp(name, "") == 0) | 38 | if (strcmp(name, "") == 0) |
41 | return -EINVAL; | 39 | return -EINVAL; |
42 | if (!test_opt(inode->i_sb, XATTR_USER)) | 40 | if (!test_opt(inode->i_sb, XATTR_USER)) |
43 | return -EOPNOTSUPP; | 41 | return -EOPNOTSUPP; |
44 | error = permission(inode, MAY_READ, NULL); | ||
45 | if (error) | ||
46 | return error; | ||
47 | |||
48 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size); | 42 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_USER, name, buffer, size); |
49 | } | 43 | } |
50 | 44 | ||
@@ -52,18 +46,10 @@ static int | |||
52 | ext2_xattr_user_set(struct inode *inode, const char *name, | 46 | ext2_xattr_user_set(struct inode *inode, const char *name, |
53 | const void *value, size_t size, int flags) | 47 | const void *value, size_t size, int flags) |
54 | { | 48 | { |
55 | int error; | ||
56 | |||
57 | if (strcmp(name, "") == 0) | 49 | if (strcmp(name, "") == 0) |
58 | return -EINVAL; | 50 | return -EINVAL; |
59 | if (!test_opt(inode->i_sb, XATTR_USER)) | 51 | if (!test_opt(inode->i_sb, XATTR_USER)) |
60 | return -EOPNOTSUPP; | 52 | return -EOPNOTSUPP; |
61 | if ( !S_ISREG(inode->i_mode) && | ||
62 | (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) | ||
63 | return -EPERM; | ||
64 | error = permission(inode, MAY_WRITE, NULL); | ||
65 | if (error) | ||
66 | return error; | ||
67 | 53 | ||
68 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name, | 54 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_USER, name, |
69 | value, size, flags); | 55 | value, size, flags); |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index ae1148c24c53..c6393fb4c35a 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -20,8 +20,6 @@ | |||
20 | #include <linux/quotaops.h> | 20 | #include <linux/quotaops.h> |
21 | #include <linux/buffer_head.h> | 21 | #include <linux/buffer_head.h> |
22 | 22 | ||
23 | #include "bitmap.h" | ||
24 | |||
25 | /* | 23 | /* |
26 | * balloc.c contains the blocks allocation and deallocation routines | 24 | * balloc.c contains the blocks allocation and deallocation routines |
27 | */ | 25 | */ |
diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c index 5b4ba3e246e6..cb16b4c5d5df 100644 --- a/fs/ext3/bitmap.c +++ b/fs/ext3/bitmap.c | |||
@@ -7,8 +7,11 @@ | |||
7 | * Universite Pierre et Marie Curie (Paris VI) | 7 | * Universite Pierre et Marie Curie (Paris VI) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifdef EXT3FS_DEBUG | ||
11 | |||
10 | #include <linux/buffer_head.h> | 12 | #include <linux/buffer_head.h> |
11 | #include "bitmap.h" | 13 | |
14 | #include "ext3_fs.h" | ||
12 | 15 | ||
13 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; | 16 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; |
14 | 17 | ||
@@ -24,3 +27,6 @@ unsigned long ext3_count_free (struct buffer_head * map, unsigned int numchars) | |||
24 | nibblemap[(map->b_data[i] >> 4) & 0xf]; | 27 | nibblemap[(map->b_data[i] >> 4) & 0xf]; |
25 | return (sum); | 28 | return (sum); |
26 | } | 29 | } |
30 | |||
31 | #endif /* EXT3FS_DEBUG */ | ||
32 | |||
diff --git a/fs/ext3/bitmap.h b/fs/ext3/bitmap.h deleted file mode 100644 index 6ee503a6bb4e..000000000000 --- a/fs/ext3/bitmap.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | /* linux/fs/ext3/bitmap.c | ||
2 | * | ||
3 | * Copyright (C) 2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | extern unsigned long ext3_count_free (struct buffer_head *, unsigned int ); | ||
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 69078079b19c..dc826464f313 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -26,7 +26,6 @@ | |||
26 | 26 | ||
27 | #include <asm/byteorder.h> | 27 | #include <asm/byteorder.h> |
28 | 28 | ||
29 | #include "bitmap.h" | ||
30 | #include "xattr.h" | 29 | #include "xattr.h" |
31 | #include "acl.h" | 30 | #include "acl.h" |
32 | 31 | ||
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c index 238199d82ce5..e8d60bf6b7df 100644 --- a/fs/ext3/xattr.c +++ b/fs/ext3/xattr.c | |||
@@ -946,10 +946,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
946 | }; | 946 | }; |
947 | int error; | 947 | int error; |
948 | 948 | ||
949 | if (IS_RDONLY(inode)) | ||
950 | return -EROFS; | ||
951 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | ||
952 | return -EPERM; | ||
953 | if (!name) | 949 | if (!name) |
954 | return -EINVAL; | 950 | return -EINVAL; |
955 | if (strlen(name) > 255) | 951 | if (strlen(name) > 255) |
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index f68bfd1cf519..7c693c94f14d 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c | |||
@@ -39,8 +39,6 @@ ext3_xattr_trusted_get(struct inode *inode, const char *name, | |||
39 | { | 39 | { |
40 | if (strcmp(name, "") == 0) | 40 | if (strcmp(name, "") == 0) |
41 | return -EINVAL; | 41 | return -EINVAL; |
42 | if (!capable(CAP_SYS_ADMIN)) | ||
43 | return -EPERM; | ||
44 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, | 42 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_TRUSTED, name, |
45 | buffer, size); | 43 | buffer, size); |
46 | } | 44 | } |
@@ -51,8 +49,6 @@ ext3_xattr_trusted_set(struct inode *inode, const char *name, | |||
51 | { | 49 | { |
52 | if (strcmp(name, "") == 0) | 50 | if (strcmp(name, "") == 0) |
53 | return -EINVAL; | 51 | return -EINVAL; |
54 | if (!capable(CAP_SYS_ADMIN)) | ||
55 | return -EPERM; | ||
56 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, | 52 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_TRUSTED, name, |
57 | value, size, flags); | 53 | value, size, flags); |
58 | } | 54 | } |
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index e907cae7a07c..a85a0a17c4fd 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c | |||
@@ -37,16 +37,10 @@ static int | |||
37 | ext3_xattr_user_get(struct inode *inode, const char *name, | 37 | ext3_xattr_user_get(struct inode *inode, const char *name, |
38 | void *buffer, size_t size) | 38 | void *buffer, size_t size) |
39 | { | 39 | { |
40 | int error; | ||
41 | |||
42 | if (strcmp(name, "") == 0) | 40 | if (strcmp(name, "") == 0) |
43 | return -EINVAL; | 41 | return -EINVAL; |
44 | if (!test_opt(inode->i_sb, XATTR_USER)) | 42 | if (!test_opt(inode->i_sb, XATTR_USER)) |
45 | return -EOPNOTSUPP; | 43 | return -EOPNOTSUPP; |
46 | error = permission(inode, MAY_READ, NULL); | ||
47 | if (error) | ||
48 | return error; | ||
49 | |||
50 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size); | 44 | return ext3_xattr_get(inode, EXT3_XATTR_INDEX_USER, name, buffer, size); |
51 | } | 45 | } |
52 | 46 | ||
@@ -54,19 +48,10 @@ static int | |||
54 | ext3_xattr_user_set(struct inode *inode, const char *name, | 48 | ext3_xattr_user_set(struct inode *inode, const char *name, |
55 | const void *value, size_t size, int flags) | 49 | const void *value, size_t size, int flags) |
56 | { | 50 | { |
57 | int error; | ||
58 | |||
59 | if (strcmp(name, "") == 0) | 51 | if (strcmp(name, "") == 0) |
60 | return -EINVAL; | 52 | return -EINVAL; |
61 | if (!test_opt(inode->i_sb, XATTR_USER)) | 53 | if (!test_opt(inode->i_sb, XATTR_USER)) |
62 | return -EOPNOTSUPP; | 54 | return -EOPNOTSUPP; |
63 | if ( !S_ISREG(inode->i_mode) && | ||
64 | (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) | ||
65 | return -EPERM; | ||
66 | error = permission(inode, MAY_WRITE, NULL); | ||
67 | if (error) | ||
68 | return error; | ||
69 | |||
70 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, | 55 | return ext3_xattr_set(inode, EXT3_XATTR_INDEX_USER, name, |
71 | value, size, flags); | 56 | value, size, flags); |
72 | } | 57 | } |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index df16fcbff3fb..0fa1ab6250bf 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -143,9 +143,6 @@ struct hfsplus_sb_info { | |||
143 | 143 | ||
144 | unsigned long flags; | 144 | unsigned long flags; |
145 | 145 | ||
146 | atomic_t inode_cnt; | ||
147 | u32 last_inode_cnt; | ||
148 | |||
149 | struct hlist_head rsrc_inodes; | 146 | struct hlist_head rsrc_inodes; |
150 | }; | 147 | }; |
151 | 148 | ||
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 983bcd02ac1c..7acff6c5464f 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -182,11 +182,6 @@ static struct dentry *hfsplus_file_lookup(struct inode *dir, struct dentry *dent | |||
182 | igrab(dir); | 182 | igrab(dir); |
183 | hlist_add_head(&inode->i_hash, &HFSPLUS_SB(sb).rsrc_inodes); | 183 | hlist_add_head(&inode->i_hash, &HFSPLUS_SB(sb).rsrc_inodes); |
184 | mark_inode_dirty(inode); | 184 | mark_inode_dirty(inode); |
185 | { | ||
186 | void hfsplus_inode_check(struct super_block *sb); | ||
187 | atomic_inc(&HFSPLUS_SB(sb).inode_cnt); | ||
188 | hfsplus_inode_check(sb); | ||
189 | } | ||
190 | out: | 185 | out: |
191 | d_add(dentry, inode); | 186 | d_add(dentry, inode); |
192 | return NULL; | 187 | return NULL; |
@@ -317,11 +312,6 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode) | |||
317 | if (!inode) | 312 | if (!inode) |
318 | return NULL; | 313 | return NULL; |
319 | 314 | ||
320 | { | ||
321 | void hfsplus_inode_check(struct super_block *sb); | ||
322 | atomic_inc(&HFSPLUS_SB(sb).inode_cnt); | ||
323 | hfsplus_inode_check(sb); | ||
324 | } | ||
325 | inode->i_ino = HFSPLUS_SB(sb).next_cnid++; | 315 | inode->i_ino = HFSPLUS_SB(sb).next_cnid++; |
326 | inode->i_mode = mode; | 316 | inode->i_mode = mode; |
327 | inode->i_uid = current->fsuid; | 317 | inode->i_uid = current->fsuid; |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 6daaf7c755a6..d791780def50 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -22,29 +22,12 @@ static void hfsplus_destroy_inode(struct inode *inode); | |||
22 | 22 | ||
23 | #include "hfsplus_fs.h" | 23 | #include "hfsplus_fs.h" |
24 | 24 | ||
25 | void hfsplus_inode_check(struct super_block *sb) | ||
26 | { | ||
27 | #if 0 | ||
28 | u32 cnt = atomic_read(&HFSPLUS_SB(sb).inode_cnt); | ||
29 | u32 last_cnt = HFSPLUS_SB(sb).last_inode_cnt; | ||
30 | |||
31 | if (cnt <= (last_cnt / 2) || | ||
32 | cnt >= (last_cnt * 2)) { | ||
33 | HFSPLUS_SB(sb).last_inode_cnt = cnt; | ||
34 | printk("inode_check: %u,%u,%u\n", cnt, last_cnt, | ||
35 | HFSPLUS_SB(sb).cat_tree ? HFSPLUS_SB(sb).cat_tree->node_hash_cnt : 0); | ||
36 | } | ||
37 | #endif | ||
38 | } | ||
39 | |||
40 | static void hfsplus_read_inode(struct inode *inode) | 25 | static void hfsplus_read_inode(struct inode *inode) |
41 | { | 26 | { |
42 | struct hfs_find_data fd; | 27 | struct hfs_find_data fd; |
43 | struct hfsplus_vh *vhdr; | 28 | struct hfsplus_vh *vhdr; |
44 | int err; | 29 | int err; |
45 | 30 | ||
46 | atomic_inc(&HFSPLUS_SB(inode->i_sb).inode_cnt); | ||
47 | hfsplus_inode_check(inode->i_sb); | ||
48 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); | 31 | INIT_LIST_HEAD(&HFSPLUS_I(inode).open_dir_list); |
49 | init_MUTEX(&HFSPLUS_I(inode).extents_lock); | 32 | init_MUTEX(&HFSPLUS_I(inode).extents_lock); |
50 | HFSPLUS_I(inode).flags = 0; | 33 | HFSPLUS_I(inode).flags = 0; |
@@ -155,12 +138,10 @@ static int hfsplus_write_inode(struct inode *inode, int unused) | |||
155 | static void hfsplus_clear_inode(struct inode *inode) | 138 | static void hfsplus_clear_inode(struct inode *inode) |
156 | { | 139 | { |
157 | dprint(DBG_INODE, "hfsplus_clear_inode: %lu\n", inode->i_ino); | 140 | dprint(DBG_INODE, "hfsplus_clear_inode: %lu\n", inode->i_ino); |
158 | atomic_dec(&HFSPLUS_SB(inode->i_sb).inode_cnt); | ||
159 | if (HFSPLUS_IS_RSRC(inode)) { | 141 | if (HFSPLUS_IS_RSRC(inode)) { |
160 | HFSPLUS_I(HFSPLUS_I(inode).rsrc_inode).rsrc_inode = NULL; | 142 | HFSPLUS_I(HFSPLUS_I(inode).rsrc_inode).rsrc_inode = NULL; |
161 | iput(HFSPLUS_I(inode).rsrc_inode); | 143 | iput(HFSPLUS_I(inode).rsrc_inode); |
162 | } | 144 | } |
163 | hfsplus_inode_check(inode->i_sb); | ||
164 | } | 145 | } |
165 | 146 | ||
166 | static void hfsplus_write_super(struct super_block *sb) | 147 | static void hfsplus_write_super(struct super_block *sb) |
diff --git a/fs/inode.c b/fs/inode.c index e08767fd57b0..108138d4e909 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/cdev.h> | 22 | #include <linux/cdev.h> |
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/inotify.h> | 24 | #include <linux/inotify.h> |
25 | #include <linux/mount.h> | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * This is needed for the following functions: | 28 | * This is needed for the following functions: |
@@ -1176,22 +1177,33 @@ sector_t bmap(struct inode * inode, sector_t block) | |||
1176 | EXPORT_SYMBOL(bmap); | 1177 | EXPORT_SYMBOL(bmap); |
1177 | 1178 | ||
1178 | /** | 1179 | /** |
1179 | * update_atime - update the access time | 1180 | * touch_atime - update the access time |
1181 | * @mnt: mount the inode is accessed on | ||
1180 | * @inode: inode accessed | 1182 | * @inode: inode accessed |
1181 | * | 1183 | * |
1182 | * Update the accessed time on an inode and mark it for writeback. | 1184 | * Update the accessed time on an inode and mark it for writeback. |
1183 | * This function automatically handles read only file systems and media, | 1185 | * This function automatically handles read only file systems and media, |
1184 | * as well as the "noatime" flag and inode specific "noatime" markers. | 1186 | * as well as the "noatime" flag and inode specific "noatime" markers. |
1185 | */ | 1187 | */ |
1186 | void update_atime(struct inode *inode) | 1188 | void touch_atime(struct vfsmount *mnt, struct dentry *dentry) |
1187 | { | 1189 | { |
1190 | struct inode *inode = dentry->d_inode; | ||
1188 | struct timespec now; | 1191 | struct timespec now; |
1189 | 1192 | ||
1190 | if (IS_NOATIME(inode)) | 1193 | if (IS_RDONLY(inode)) |
1191 | return; | 1194 | return; |
1192 | if (IS_NODIRATIME(inode) && S_ISDIR(inode->i_mode)) | 1195 | |
1196 | if ((inode->i_flags & S_NOATIME) || | ||
1197 | (inode->i_sb->s_flags & MS_NOATIME) || | ||
1198 | ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))) | ||
1193 | return; | 1199 | return; |
1194 | if (IS_RDONLY(inode)) | 1200 | |
1201 | /* | ||
1202 | * We may have a NULL vfsmount when coming from NFSD | ||
1203 | */ | ||
1204 | if (mnt && | ||
1205 | ((mnt->mnt_flags & MNT_NOATIME) || | ||
1206 | ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)))) | ||
1195 | return; | 1207 | return; |
1196 | 1208 | ||
1197 | now = current_fs_time(inode->i_sb); | 1209 | now = current_fs_time(inode->i_sb); |
@@ -1201,19 +1213,23 @@ void update_atime(struct inode *inode) | |||
1201 | } | 1213 | } |
1202 | } | 1214 | } |
1203 | 1215 | ||
1204 | EXPORT_SYMBOL(update_atime); | 1216 | EXPORT_SYMBOL(touch_atime); |
1205 | 1217 | ||
1206 | /** | 1218 | /** |
1207 | * inode_update_time - update mtime and ctime time | 1219 | * file_update_time - update mtime and ctime time |
1208 | * @inode: inode accessed | 1220 | * @file: file accessed |
1209 | * @ctime_too: update ctime too | ||
1210 | * | 1221 | * |
1211 | * Update the mtime time on an inode and mark it for writeback. | 1222 | * Update the mtime and ctime members of an inode and mark the inode |
1212 | * When ctime_too is specified update the ctime too. | 1223 | * for writeback. Note that this function is meant exclusively for |
1224 | * usage in the file write path of filesystems, and filesystems may | ||
1225 | * choose to explicitly ignore update via this function with the | ||
1226 | * S_NOCTIME inode flag, e.g. for network filesystem where these | ||
1227 | * timestamps are handled by the server. | ||
1213 | */ | 1228 | */ |
1214 | 1229 | ||
1215 | void inode_update_time(struct inode *inode, int ctime_too) | 1230 | void file_update_time(struct file *file) |
1216 | { | 1231 | { |
1232 | struct inode *inode = file->f_dentry->d_inode; | ||
1217 | struct timespec now; | 1233 | struct timespec now; |
1218 | int sync_it = 0; | 1234 | int sync_it = 0; |
1219 | 1235 | ||
@@ -1227,16 +1243,15 @@ void inode_update_time(struct inode *inode, int ctime_too) | |||
1227 | sync_it = 1; | 1243 | sync_it = 1; |
1228 | inode->i_mtime = now; | 1244 | inode->i_mtime = now; |
1229 | 1245 | ||
1230 | if (ctime_too) { | 1246 | if (!timespec_equal(&inode->i_ctime, &now)) |
1231 | if (!timespec_equal(&inode->i_ctime, &now)) | 1247 | sync_it = 1; |
1232 | sync_it = 1; | 1248 | inode->i_ctime = now; |
1233 | inode->i_ctime = now; | 1249 | |
1234 | } | ||
1235 | if (sync_it) | 1250 | if (sync_it) |
1236 | mark_inode_dirty_sync(inode); | 1251 | mark_inode_dirty_sync(inode); |
1237 | } | 1252 | } |
1238 | 1253 | ||
1239 | EXPORT_SYMBOL(inode_update_time); | 1254 | EXPORT_SYMBOL(file_update_time); |
1240 | 1255 | ||
1241 | int inode_needs_sync(struct inode *inode) | 1256 | int inode_needs_sync(struct inode *inode) |
1242 | { | 1257 | { |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 23aa5066b5a4..952da5f917cd 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -83,21 +83,6 @@ struct ea_buffer { | |||
83 | #define EA_NEW 0x0004 | 83 | #define EA_NEW 0x0004 |
84 | #define EA_MALLOC 0x0008 | 84 | #define EA_MALLOC 0x0008 |
85 | 85 | ||
86 | /* Namespaces */ | ||
87 | #define XATTR_SYSTEM_PREFIX "system." | ||
88 | #define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1) | ||
89 | |||
90 | #define XATTR_USER_PREFIX "user." | ||
91 | #define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) | ||
92 | |||
93 | #define XATTR_OS2_PREFIX "os2." | ||
94 | #define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1) | ||
95 | |||
96 | /* XATTR_SECURITY_PREFIX is defined in include/linux/xattr.h */ | ||
97 | #define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1) | ||
98 | |||
99 | #define XATTR_TRUSTED_PREFIX "trusted." | ||
100 | #define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1) | ||
101 | 86 | ||
102 | /* | 87 | /* |
103 | * These three routines are used to recognize on-disk extended attributes | 88 | * These three routines are used to recognize on-disk extended attributes |
@@ -773,36 +758,23 @@ static int can_set_system_xattr(struct inode *inode, const char *name, | |||
773 | static int can_set_xattr(struct inode *inode, const char *name, | 758 | static int can_set_xattr(struct inode *inode, const char *name, |
774 | const void *value, size_t value_len) | 759 | const void *value, size_t value_len) |
775 | { | 760 | { |
776 | if (IS_RDONLY(inode)) | 761 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) |
777 | return -EROFS; | ||
778 | |||
779 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | ||
780 | return -EPERM; | ||
781 | |||
782 | if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0) | ||
783 | /* | ||
784 | * "system.*" | ||
785 | */ | ||
786 | return can_set_system_xattr(inode, name, value, value_len); | 762 | return can_set_system_xattr(inode, name, value, value_len); |
787 | 763 | ||
788 | if(strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) | 764 | /* |
789 | return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM); | 765 | * Don't allow setting an attribute in an unknown namespace. |
790 | 766 | */ | |
791 | #ifdef CONFIG_JFS_SECURITY | 767 | if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) && |
792 | if (strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) | 768 | strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) && |
793 | == 0) | 769 | strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && |
794 | return 0; /* Leave it to the security module */ | 770 | strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)) |
795 | #endif | ||
796 | |||
797 | if((strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) != 0) && | ||
798 | (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) != 0)) | ||
799 | return -EOPNOTSUPP; | 771 | return -EOPNOTSUPP; |
800 | 772 | ||
801 | if (!S_ISREG(inode->i_mode) && | 773 | if (!S_ISREG(inode->i_mode) && |
802 | (!S_ISDIR(inode->i_mode) || inode->i_mode &S_ISVTX)) | 774 | (!S_ISDIR(inode->i_mode) || inode->i_mode &S_ISVTX)) |
803 | return -EPERM; | 775 | return -EPERM; |
804 | 776 | ||
805 | return permission(inode, MAY_WRITE, NULL); | 777 | return 0; |
806 | } | 778 | } |
807 | 779 | ||
808 | int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name, | 780 | int __jfs_setxattr(tid_t tid, struct inode *inode, const char *name, |
@@ -972,22 +944,6 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
972 | return rc; | 944 | return rc; |
973 | } | 945 | } |
974 | 946 | ||
975 | static int can_get_xattr(struct inode *inode, const char *name) | ||
976 | { | ||
977 | #ifdef CONFIG_JFS_SECURITY | ||
978 | if(strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) | ||
979 | return 0; | ||
980 | #endif | ||
981 | |||
982 | if(strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) == 0) | ||
983 | return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM); | ||
984 | |||
985 | if(strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) == 0) | ||
986 | return 0; | ||
987 | |||
988 | return permission(inode, MAY_READ, NULL); | ||
989 | } | ||
990 | |||
991 | ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, | 947 | ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, |
992 | size_t buf_size) | 948 | size_t buf_size) |
993 | { | 949 | { |
@@ -998,12 +954,8 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data, | |||
998 | ssize_t size; | 954 | ssize_t size; |
999 | int namelen = strlen(name); | 955 | int namelen = strlen(name); |
1000 | char *os2name = NULL; | 956 | char *os2name = NULL; |
1001 | int rc; | ||
1002 | char *value; | 957 | char *value; |
1003 | 958 | ||
1004 | if ((rc = can_get_xattr(inode, name))) | ||
1005 | return rc; | ||
1006 | |||
1007 | if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { | 959 | if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { |
1008 | os2name = kmalloc(namelen - XATTR_OS2_PREFIX_LEN + 1, | 960 | os2name = kmalloc(namelen - XATTR_OS2_PREFIX_LEN + 1, |
1009 | GFP_KERNEL); | 961 | GFP_KERNEL); |
diff --git a/fs/namespace.c b/fs/namespace.c index f0e353f5bc30..2ca6145f43d6 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -355,14 +355,14 @@ static int show_vfsmnt(struct seq_file *m, void *v) | |||
355 | { MS_SYNCHRONOUS, ",sync" }, | 355 | { MS_SYNCHRONOUS, ",sync" }, |
356 | { MS_DIRSYNC, ",dirsync" }, | 356 | { MS_DIRSYNC, ",dirsync" }, |
357 | { MS_MANDLOCK, ",mand" }, | 357 | { MS_MANDLOCK, ",mand" }, |
358 | { MS_NOATIME, ",noatime" }, | ||
359 | { MS_NODIRATIME, ",nodiratime" }, | ||
360 | { 0, NULL } | 358 | { 0, NULL } |
361 | }; | 359 | }; |
362 | static struct proc_fs_info mnt_info[] = { | 360 | static struct proc_fs_info mnt_info[] = { |
363 | { MNT_NOSUID, ",nosuid" }, | 361 | { MNT_NOSUID, ",nosuid" }, |
364 | { MNT_NODEV, ",nodev" }, | 362 | { MNT_NODEV, ",nodev" }, |
365 | { MNT_NOEXEC, ",noexec" }, | 363 | { MNT_NOEXEC, ",noexec" }, |
364 | { MNT_NOATIME, ",noatime" }, | ||
365 | { MNT_NODIRATIME, ",nodiratime" }, | ||
366 | { 0, NULL } | 366 | { 0, NULL } |
367 | }; | 367 | }; |
368 | struct proc_fs_info *fs_infop; | 368 | struct proc_fs_info *fs_infop; |
@@ -1286,7 +1286,13 @@ long do_mount(char *dev_name, char *dir_name, char *type_page, | |||
1286 | mnt_flags |= MNT_NODEV; | 1286 | mnt_flags |= MNT_NODEV; |
1287 | if (flags & MS_NOEXEC) | 1287 | if (flags & MS_NOEXEC) |
1288 | mnt_flags |= MNT_NOEXEC; | 1288 | mnt_flags |= MNT_NOEXEC; |
1289 | flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE); | 1289 | if (flags & MS_NOATIME) |
1290 | mnt_flags |= MNT_NOATIME; | ||
1291 | if (flags & MS_NODIRATIME) | ||
1292 | mnt_flags |= MNT_NODIRATIME; | ||
1293 | |||
1294 | flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | | ||
1295 | MS_NOATIME | MS_NODIRATIME); | ||
1290 | 1296 | ||
1291 | /* ... and get the mountpoint */ | 1297 | /* ... and get the mountpoint */ |
1292 | retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); | 1298 | retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 4947d9b11fc1..973b444d6914 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -262,7 +262,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * | |||
262 | } | 262 | } |
263 | vfree(bouncebuffer); | 263 | vfree(bouncebuffer); |
264 | 264 | ||
265 | inode_update_time(inode, 1); | 265 | file_update_time(file); |
266 | 266 | ||
267 | *ppos = pos; | 267 | *ppos = pos; |
268 | 268 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 3e4ba9cb7f80..a77ee95b7efb 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -950,11 +950,20 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
950 | 950 | ||
951 | /* Flush out writes to the server in order to update c/mtime */ | 951 | /* Flush out writes to the server in order to update c/mtime */ |
952 | nfs_sync_inode(inode, 0, 0, FLUSH_WAIT|FLUSH_NOCOMMIT); | 952 | nfs_sync_inode(inode, 0, 0, FLUSH_WAIT|FLUSH_NOCOMMIT); |
953 | if (__IS_FLG(inode, MS_NOATIME)) | 953 | |
954 | need_atime = 0; | 954 | /* |
955 | else if (__IS_FLG(inode, MS_NODIRATIME) && S_ISDIR(inode->i_mode)) | 955 | * We may force a getattr if the user cares about atime. |
956 | * | ||
957 | * Note that we only have to check the vfsmount flags here: | ||
958 | * - NFS always sets S_NOATIME by so checking it would give a | ||
959 | * bogus result | ||
960 | * - NFS never sets MS_NOATIME or MS_NODIRATIME so there is | ||
961 | * no point in checking those. | ||
962 | */ | ||
963 | if ((mnt->mnt_flags & MNT_NOATIME) || | ||
964 | ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))) | ||
956 | need_atime = 0; | 965 | need_atime = 0; |
957 | /* We may force a getattr if the user cares about atime */ | 966 | |
958 | if (need_atime) | 967 | if (need_atime) |
959 | err = __nfs_revalidate_inode(NFS_SERVER(inode), inode); | 968 | err = __nfs_revalidate_inode(NFS_SERVER(inode), inode); |
960 | else | 969 | else |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index bb36b4304491..eef0576a7785 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -48,8 +48,8 @@ | |||
48 | #include <linux/fsnotify.h> | 48 | #include <linux/fsnotify.h> |
49 | #include <linux/posix_acl.h> | 49 | #include <linux/posix_acl.h> |
50 | #include <linux/posix_acl_xattr.h> | 50 | #include <linux/posix_acl_xattr.h> |
51 | #ifdef CONFIG_NFSD_V4 | ||
52 | #include <linux/xattr.h> | 51 | #include <linux/xattr.h> |
52 | #ifdef CONFIG_NFSD_V4 | ||
53 | #include <linux/nfs4.h> | 53 | #include <linux/nfs4.h> |
54 | #include <linux/nfs4_acl.h> | 54 | #include <linux/nfs4_acl.h> |
55 | #include <linux/nfsd_idmap.h> | 55 | #include <linux/nfsd_idmap.h> |
@@ -365,8 +365,30 @@ out_nfserr: | |||
365 | goto out; | 365 | goto out; |
366 | } | 366 | } |
367 | 367 | ||
368 | #if defined(CONFIG_NFSD_V4) | 368 | #if defined(CONFIG_NFSD_V2_ACL) || \ |
369 | defined(CONFIG_NFSD_V3_ACL) || \ | ||
370 | defined(CONFIG_NFSD_V4) | ||
371 | static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) | ||
372 | { | ||
373 | ssize_t buflen; | ||
374 | int error; | ||
375 | |||
376 | buflen = vfs_getxattr(dentry, key, NULL, 0); | ||
377 | if (buflen <= 0) | ||
378 | return buflen; | ||
369 | 379 | ||
380 | *buf = kmalloc(buflen, GFP_KERNEL); | ||
381 | if (!*buf) | ||
382 | return -ENOMEM; | ||
383 | |||
384 | error = vfs_getxattr(dentry, key, *buf, buflen); | ||
385 | if (error < 0) | ||
386 | return error; | ||
387 | return buflen; | ||
388 | } | ||
389 | #endif | ||
390 | |||
391 | #if defined(CONFIG_NFSD_V4) | ||
370 | static int | 392 | static int |
371 | set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key) | 393 | set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key) |
372 | { | 394 | { |
@@ -374,7 +396,6 @@ set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key) | |||
374 | size_t buflen; | 396 | size_t buflen; |
375 | char *buf = NULL; | 397 | char *buf = NULL; |
376 | int error = 0; | 398 | int error = 0; |
377 | struct inode *inode = dentry->d_inode; | ||
378 | 399 | ||
379 | buflen = posix_acl_xattr_size(pacl->a_count); | 400 | buflen = posix_acl_xattr_size(pacl->a_count); |
380 | buf = kmalloc(buflen, GFP_KERNEL); | 401 | buf = kmalloc(buflen, GFP_KERNEL); |
@@ -388,15 +409,7 @@ set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key) | |||
388 | goto out; | 409 | goto out; |
389 | } | 410 | } |
390 | 411 | ||
391 | error = -EOPNOTSUPP; | 412 | error = vfs_setxattr(dentry, key, buf, len, 0); |
392 | if (inode->i_op && inode->i_op->setxattr) { | ||
393 | mutex_lock(&inode->i_mutex); | ||
394 | security_inode_setxattr(dentry, key, buf, len, 0); | ||
395 | error = inode->i_op->setxattr(dentry, key, buf, len, 0); | ||
396 | if (!error) | ||
397 | security_inode_post_setxattr(dentry, key, buf, len, 0); | ||
398 | mutex_unlock(&inode->i_mutex); | ||
399 | } | ||
400 | out: | 413 | out: |
401 | kfree(buf); | 414 | kfree(buf); |
402 | return error; | 415 | return error; |
@@ -455,44 +468,19 @@ out_nfserr: | |||
455 | static struct posix_acl * | 468 | static struct posix_acl * |
456 | _get_posix_acl(struct dentry *dentry, char *key) | 469 | _get_posix_acl(struct dentry *dentry, char *key) |
457 | { | 470 | { |
458 | struct inode *inode = dentry->d_inode; | 471 | void *buf = NULL; |
459 | char *buf = NULL; | ||
460 | int buflen, error = 0; | ||
461 | struct posix_acl *pacl = NULL; | 472 | struct posix_acl *pacl = NULL; |
473 | int buflen; | ||
462 | 474 | ||
463 | error = -EOPNOTSUPP; | 475 | buflen = nfsd_getxattr(dentry, key, &buf); |
464 | if (inode->i_op == NULL) | 476 | if (!buflen) |
465 | goto out_err; | 477 | buflen = -ENODATA; |
466 | if (inode->i_op->getxattr == NULL) | 478 | if (buflen <= 0) |
467 | goto out_err; | 479 | return ERR_PTR(buflen); |
468 | |||
469 | error = security_inode_getxattr(dentry, key); | ||
470 | if (error) | ||
471 | goto out_err; | ||
472 | |||
473 | buflen = inode->i_op->getxattr(dentry, key, NULL, 0); | ||
474 | if (buflen <= 0) { | ||
475 | error = buflen < 0 ? buflen : -ENODATA; | ||
476 | goto out_err; | ||
477 | } | ||
478 | |||
479 | buf = kmalloc(buflen, GFP_KERNEL); | ||
480 | if (buf == NULL) { | ||
481 | error = -ENOMEM; | ||
482 | goto out_err; | ||
483 | } | ||
484 | |||
485 | error = inode->i_op->getxattr(dentry, key, buf, buflen); | ||
486 | if (error < 0) | ||
487 | goto out_err; | ||
488 | 480 | ||
489 | pacl = posix_acl_from_xattr(buf, buflen); | 481 | pacl = posix_acl_from_xattr(buf, buflen); |
490 | out: | ||
491 | kfree(buf); | 482 | kfree(buf); |
492 | return pacl; | 483 | return pacl; |
493 | out_err: | ||
494 | pacl = ERR_PTR(error); | ||
495 | goto out; | ||
496 | } | 484 | } |
497 | 485 | ||
498 | int | 486 | int |
@@ -1884,39 +1872,25 @@ nfsd_get_posix_acl(struct svc_fh *fhp, int type) | |||
1884 | ssize_t size; | 1872 | ssize_t size; |
1885 | struct posix_acl *acl; | 1873 | struct posix_acl *acl; |
1886 | 1874 | ||
1887 | if (!IS_POSIXACL(inode) || !inode->i_op || !inode->i_op->getxattr) | 1875 | if (!IS_POSIXACL(inode)) |
1876 | return ERR_PTR(-EOPNOTSUPP); | ||
1877 | |||
1878 | switch (type) { | ||
1879 | case ACL_TYPE_ACCESS: | ||
1880 | name = POSIX_ACL_XATTR_ACCESS; | ||
1881 | break; | ||
1882 | case ACL_TYPE_DEFAULT: | ||
1883 | name = POSIX_ACL_XATTR_DEFAULT; | ||
1884 | break; | ||
1885 | default: | ||
1888 | return ERR_PTR(-EOPNOTSUPP); | 1886 | return ERR_PTR(-EOPNOTSUPP); |
1889 | switch(type) { | ||
1890 | case ACL_TYPE_ACCESS: | ||
1891 | name = POSIX_ACL_XATTR_ACCESS; | ||
1892 | break; | ||
1893 | case ACL_TYPE_DEFAULT: | ||
1894 | name = POSIX_ACL_XATTR_DEFAULT; | ||
1895 | break; | ||
1896 | default: | ||
1897 | return ERR_PTR(-EOPNOTSUPP); | ||
1898 | } | 1887 | } |
1899 | 1888 | ||
1900 | size = inode->i_op->getxattr(fhp->fh_dentry, name, NULL, 0); | 1889 | size = nfsd_getxattr(fhp->fh_dentry, name, &value); |
1890 | if (size < 0) | ||
1891 | return ERR_PTR(size); | ||
1901 | 1892 | ||
1902 | if (size < 0) { | ||
1903 | acl = ERR_PTR(size); | ||
1904 | goto getout; | ||
1905 | } else if (size > 0) { | ||
1906 | value = kmalloc(size, GFP_KERNEL); | ||
1907 | if (!value) { | ||
1908 | acl = ERR_PTR(-ENOMEM); | ||
1909 | goto getout; | ||
1910 | } | ||
1911 | size = inode->i_op->getxattr(fhp->fh_dentry, name, value, size); | ||
1912 | if (size < 0) { | ||
1913 | acl = ERR_PTR(size); | ||
1914 | goto getout; | ||
1915 | } | ||
1916 | } | ||
1917 | acl = posix_acl_from_xattr(value, size); | 1893 | acl = posix_acl_from_xattr(value, size); |
1918 | |||
1919 | getout: | ||
1920 | kfree(value); | 1894 | kfree(value); |
1921 | return acl; | 1895 | return acl; |
1922 | } | 1896 | } |
@@ -1957,16 +1931,13 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
1957 | } else | 1931 | } else |
1958 | size = 0; | 1932 | size = 0; |
1959 | 1933 | ||
1960 | if (!fhp->fh_locked) | ||
1961 | fh_lock(fhp); /* unlocking is done automatically */ | ||
1962 | if (size) | 1934 | if (size) |
1963 | error = inode->i_op->setxattr(fhp->fh_dentry, name, | 1935 | error = vfs_setxattr(fhp->fh_dentry, name, value, size, 0); |
1964 | value, size, 0); | ||
1965 | else { | 1936 | else { |
1966 | if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT) | 1937 | if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT) |
1967 | error = 0; | 1938 | error = 0; |
1968 | else { | 1939 | else { |
1969 | error = inode->i_op->removexattr(fhp->fh_dentry, name); | 1940 | error = vfs_removexattr(fhp->fh_dentry, name); |
1970 | if (error == -ENODATA) | 1941 | if (error == -ENODATA) |
1971 | error = 0; | 1942 | error = 0; |
1972 | } | 1943 | } |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 30f71acdc1cb..fb413d3d8618 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2173,7 +2173,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb, | |||
2173 | err = remove_suid(file->f_dentry); | 2173 | err = remove_suid(file->f_dentry); |
2174 | if (err) | 2174 | if (err) |
2175 | goto out; | 2175 | goto out; |
2176 | inode_update_time(inode, 1); | 2176 | file_update_time(file); |
2177 | written = ntfs_file_buffered_write(iocb, iov, nr_segs, pos, ppos, | 2177 | written = ntfs_file_buffered_write(iocb, iov, nr_segs, pos, ppos, |
2178 | count); | 2178 | count); |
2179 | out: | 2179 | out: |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index bda7a08911a5..ea1bd3feea1b 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -2767,7 +2767,25 @@ unm_done: | |||
2767 | up_write(&ni->runlist.lock); | 2767 | up_write(&ni->runlist.lock); |
2768 | done: | 2768 | done: |
2769 | /* Update the mtime and ctime on the base inode. */ | 2769 | /* Update the mtime and ctime on the base inode. */ |
2770 | inode_update_time(VFS_I(base_ni), 1); | 2770 | /* normally ->truncate shouldn't update ctime or mtime, |
2771 | * but ntfs did before so it got a copy & paste version | ||
2772 | * of file_update_time. one day someone should fix this | ||
2773 | * for real. | ||
2774 | */ | ||
2775 | if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { | ||
2776 | struct timespec now = current_fs_time(VFS_I(base_ni)->i_sb); | ||
2777 | int sync_it = 0; | ||
2778 | |||
2779 | if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) || | ||
2780 | !timespec_equal(&VFS_I(base_ni)->i_ctime, &now)) | ||
2781 | sync_it = 1; | ||
2782 | VFS_I(base_ni)->i_mtime = now; | ||
2783 | VFS_I(base_ni)->i_ctime = now; | ||
2784 | |||
2785 | if (sync_it) | ||
2786 | mark_inode_dirty_sync(VFS_I(base_ni)); | ||
2787 | } | ||
2788 | |||
2771 | if (likely(!err)) { | 2789 | if (likely(!err)) { |
2772 | NInoClearTruncateFailed(ni); | 2790 | NInoClearTruncateFailed(ni); |
2773 | ntfs_debug("Done."); | 2791 | ntfs_debug("Done."); |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 280e383fc84e..c3a3f1a8310b 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -443,8 +443,8 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
443 | 443 | ||
444 | ntfs_debug("Entering with remount options string: %s", opt); | 444 | ntfs_debug("Entering with remount options string: %s", opt); |
445 | #ifndef NTFS_RW | 445 | #ifndef NTFS_RW |
446 | /* For read-only compiled driver, enforce all read-only flags. */ | 446 | /* For read-only compiled driver, enforce read-only flag. */ |
447 | *flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 447 | *flags |= MS_RDONLY; |
448 | #else /* NTFS_RW */ | 448 | #else /* NTFS_RW */ |
449 | /* | 449 | /* |
450 | * For the read-write compiled driver, if we are remounting read-write, | 450 | * For the read-write compiled driver, if we are remounting read-write, |
@@ -1721,7 +1721,7 @@ static BOOL load_system_files(ntfs_volume *vol) | |||
1721 | es3); | 1721 | es3); |
1722 | goto iput_mirr_err_out; | 1722 | goto iput_mirr_err_out; |
1723 | } | 1723 | } |
1724 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1724 | sb->s_flags |= MS_RDONLY; |
1725 | ntfs_error(sb, "%s. Mounting read-only%s", | 1725 | ntfs_error(sb, "%s. Mounting read-only%s", |
1726 | !vol->mftmirr_ino ? es1 : es2, es3); | 1726 | !vol->mftmirr_ino ? es1 : es2, es3); |
1727 | } else | 1727 | } else |
@@ -1837,7 +1837,7 @@ get_ctx_vol_failed: | |||
1837 | es1, es2); | 1837 | es1, es2); |
1838 | goto iput_vol_err_out; | 1838 | goto iput_vol_err_out; |
1839 | } | 1839 | } |
1840 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1840 | sb->s_flags |= MS_RDONLY; |
1841 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 1841 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
1842 | } else | 1842 | } else |
1843 | ntfs_warning(sb, "%s. Will not be able to remount " | 1843 | ntfs_warning(sb, "%s. Will not be able to remount " |
@@ -1874,7 +1874,7 @@ get_ctx_vol_failed: | |||
1874 | } | 1874 | } |
1875 | goto iput_logfile_err_out; | 1875 | goto iput_logfile_err_out; |
1876 | } | 1876 | } |
1877 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1877 | sb->s_flags |= MS_RDONLY; |
1878 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 1878 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
1879 | } else | 1879 | } else |
1880 | ntfs_warning(sb, "%s. Will not be able to remount " | 1880 | ntfs_warning(sb, "%s. Will not be able to remount " |
@@ -1919,7 +1919,7 @@ get_ctx_vol_failed: | |||
1919 | es1, es2); | 1919 | es1, es2); |
1920 | goto iput_root_err_out; | 1920 | goto iput_root_err_out; |
1921 | } | 1921 | } |
1922 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1922 | sb->s_flags |= MS_RDONLY; |
1923 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 1923 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
1924 | } else | 1924 | } else |
1925 | ntfs_warning(sb, "%s. Will not be able to remount " | 1925 | ntfs_warning(sb, "%s. Will not be able to remount " |
@@ -1943,7 +1943,7 @@ get_ctx_vol_failed: | |||
1943 | goto iput_root_err_out; | 1943 | goto iput_root_err_out; |
1944 | } | 1944 | } |
1945 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 1945 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
1946 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1946 | sb->s_flags |= MS_RDONLY; |
1947 | /* | 1947 | /* |
1948 | * Do not set NVolErrors() because ntfs_remount() might manage | 1948 | * Do not set NVolErrors() because ntfs_remount() might manage |
1949 | * to set the dirty flag in which case all would be well. | 1949 | * to set the dirty flag in which case all would be well. |
@@ -1970,7 +1970,7 @@ get_ctx_vol_failed: | |||
1970 | goto iput_root_err_out; | 1970 | goto iput_root_err_out; |
1971 | } | 1971 | } |
1972 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 1972 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
1973 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1973 | sb->s_flags |= MS_RDONLY; |
1974 | NVolSetErrors(vol); | 1974 | NVolSetErrors(vol); |
1975 | } | 1975 | } |
1976 | #endif | 1976 | #endif |
@@ -1989,7 +1989,7 @@ get_ctx_vol_failed: | |||
1989 | goto iput_root_err_out; | 1989 | goto iput_root_err_out; |
1990 | } | 1990 | } |
1991 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 1991 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
1992 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 1992 | sb->s_flags |= MS_RDONLY; |
1993 | NVolSetErrors(vol); | 1993 | NVolSetErrors(vol); |
1994 | } | 1994 | } |
1995 | #endif /* NTFS_RW */ | 1995 | #endif /* NTFS_RW */ |
@@ -2030,7 +2030,7 @@ get_ctx_vol_failed: | |||
2030 | es1, es2); | 2030 | es1, es2); |
2031 | goto iput_quota_err_out; | 2031 | goto iput_quota_err_out; |
2032 | } | 2032 | } |
2033 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 2033 | sb->s_flags |= MS_RDONLY; |
2034 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 2034 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
2035 | } else | 2035 | } else |
2036 | ntfs_warning(sb, "%s. Will not be able to remount " | 2036 | ntfs_warning(sb, "%s. Will not be able to remount " |
@@ -2053,7 +2053,7 @@ get_ctx_vol_failed: | |||
2053 | goto iput_quota_err_out; | 2053 | goto iput_quota_err_out; |
2054 | } | 2054 | } |
2055 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 2055 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
2056 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 2056 | sb->s_flags |= MS_RDONLY; |
2057 | NVolSetErrors(vol); | 2057 | NVolSetErrors(vol); |
2058 | } | 2058 | } |
2059 | /* | 2059 | /* |
@@ -2074,7 +2074,7 @@ get_ctx_vol_failed: | |||
2074 | es1, es2); | 2074 | es1, es2); |
2075 | goto iput_usnjrnl_err_out; | 2075 | goto iput_usnjrnl_err_out; |
2076 | } | 2076 | } |
2077 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 2077 | sb->s_flags |= MS_RDONLY; |
2078 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 2078 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
2079 | } else | 2079 | } else |
2080 | ntfs_warning(sb, "%s. Will not be able to remount " | 2080 | ntfs_warning(sb, "%s. Will not be able to remount " |
@@ -2097,7 +2097,7 @@ get_ctx_vol_failed: | |||
2097 | goto iput_usnjrnl_err_out; | 2097 | goto iput_usnjrnl_err_out; |
2098 | } | 2098 | } |
2099 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); | 2099 | ntfs_error(sb, "%s. Mounting read-only%s", es1, es2); |
2100 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 2100 | sb->s_flags |= MS_RDONLY; |
2101 | NVolSetErrors(vol); | 2101 | NVolSetErrors(vol); |
2102 | } | 2102 | } |
2103 | #endif /* NTFS_RW */ | 2103 | #endif /* NTFS_RW */ |
@@ -2689,7 +2689,7 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2689 | 2689 | ||
2690 | ntfs_debug("Entering."); | 2690 | ntfs_debug("Entering."); |
2691 | #ifndef NTFS_RW | 2691 | #ifndef NTFS_RW |
2692 | sb->s_flags |= MS_RDONLY | MS_NOATIME | MS_NODIRATIME; | 2692 | sb->s_flags |= MS_RDONLY; |
2693 | #endif /* ! NTFS_RW */ | 2693 | #endif /* ! NTFS_RW */ |
2694 | /* Allocate a new ntfs_volume and place it in sb->s_fs_info. */ | 2694 | /* Allocate a new ntfs_volume and place it in sb->s_fs_info. */ |
2695 | sb->s_fs_info = kmalloc(sizeof(ntfs_volume), GFP_NOFS); | 2695 | sb->s_fs_info = kmalloc(sizeof(ntfs_volume), GFP_NOFS); |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index afdeec4b0eef..843cf9ddefe8 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -80,12 +80,8 @@ static struct vm_operations_struct ocfs2_file_vm_ops = { | |||
80 | .nopage = ocfs2_nopage, | 80 | .nopage = ocfs2_nopage, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | int ocfs2_mmap(struct file *file, | 83 | int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) |
84 | struct vm_area_struct *vma) | ||
85 | { | 84 | { |
86 | struct address_space *mapping = file->f_dentry->d_inode->i_mapping; | ||
87 | struct inode *inode = mapping->host; | ||
88 | |||
89 | /* We don't want to support shared writable mappings yet. */ | 85 | /* We don't want to support shared writable mappings yet. */ |
90 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) | 86 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) |
91 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { | 87 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { |
@@ -95,7 +91,7 @@ int ocfs2_mmap(struct file *file, | |||
95 | return -EINVAL; | 91 | return -EINVAL; |
96 | } | 92 | } |
97 | 93 | ||
98 | update_atime(inode); | 94 | file_accessed(file); |
99 | vma->vm_ops = &ocfs2_file_vm_ops; | 95 | vma->vm_ops = &ocfs2_file_vm_ops; |
100 | return 0; | 96 | return 0; |
101 | } | 97 | } |
@@ -347,7 +347,7 @@ out: | |||
347 | kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); | 347 | kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); |
348 | } | 348 | } |
349 | if (ret > 0) | 349 | if (ret > 0) |
350 | inode_update_time(inode, 1); /* mtime and ctime */ | 350 | file_update_time(filp); |
351 | return ret; | 351 | return ret; |
352 | } | 352 | } |
353 | 353 | ||
diff --git a/fs/proc/array.c b/fs/proc/array.c index 5e9251f65317..7eb1bd7f800c 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -330,7 +330,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
330 | unsigned long min_flt = 0, maj_flt = 0; | 330 | unsigned long min_flt = 0, maj_flt = 0; |
331 | cputime_t cutime, cstime, utime, stime; | 331 | cputime_t cutime, cstime, utime, stime; |
332 | unsigned long rsslim = 0; | 332 | unsigned long rsslim = 0; |
333 | unsigned long it_real_value = 0; | 333 | DEFINE_KTIME(it_real_value); |
334 | struct task_struct *t; | 334 | struct task_struct *t; |
335 | char tcomm[sizeof(task->comm)]; | 335 | char tcomm[sizeof(task->comm)]; |
336 | 336 | ||
@@ -386,7 +386,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
386 | utime = cputime_add(utime, task->signal->utime); | 386 | utime = cputime_add(utime, task->signal->utime); |
387 | stime = cputime_add(stime, task->signal->stime); | 387 | stime = cputime_add(stime, task->signal->stime); |
388 | } | 388 | } |
389 | it_real_value = task->signal->it_real_value; | 389 | it_real_value = task->signal->real_timer.expires; |
390 | } | 390 | } |
391 | ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0; | 391 | ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0; |
392 | read_unlock(&tasklist_lock); | 392 | read_unlock(&tasklist_lock); |
@@ -435,7 +435,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
435 | priority, | 435 | priority, |
436 | nice, | 436 | nice, |
437 | num_threads, | 437 | num_threads, |
438 | jiffies_to_clock_t(it_real_value), | 438 | (long) ktime_to_clock_t(it_real_value), |
439 | start_time, | 439 | start_time, |
440 | vsize, | 440 | vsize, |
441 | mm ? get_mm_rss(mm) : 0, | 441 | mm ? get_mm_rss(mm) : 0, |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 3b2e7b69e63a..5378d7c78419 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -35,6 +35,9 @@ static size_t elfcorebuf_sz; | |||
35 | /* Total size of vmcore file. */ | 35 | /* Total size of vmcore file. */ |
36 | static u64 vmcore_size; | 36 | static u64 vmcore_size; |
37 | 37 | ||
38 | /* Stores the physical address of elf header of crash image. */ | ||
39 | unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX; | ||
40 | |||
38 | struct proc_dir_entry *proc_vmcore = NULL; | 41 | struct proc_dir_entry *proc_vmcore = NULL; |
39 | 42 | ||
40 | /* Reads a page from the oldmem device from given offset. */ | 43 | /* Reads a page from the oldmem device from given offset. */ |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 127e7d2cabdd..ad6fa964b0e7 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -1360,7 +1360,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1360 | if (res) | 1360 | if (res) |
1361 | goto out; | 1361 | goto out; |
1362 | 1362 | ||
1363 | inode_update_time(inode, 1); /* Both mtime and ctime */ | 1363 | file_update_time(file); |
1364 | 1364 | ||
1365 | // Ok, we are done with all the checks. | 1365 | // Ok, we are done with all the checks. |
1366 | 1366 | ||
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index f1895f0a278e..6f99e01f94ab 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -497,12 +497,6 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer, | |||
497 | struct iattr newattrs; | 497 | struct iattr newattrs; |
498 | __u32 xahash = 0; | 498 | __u32 xahash = 0; |
499 | 499 | ||
500 | if (IS_RDONLY(inode)) | ||
501 | return -EROFS; | ||
502 | |||
503 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | ||
504 | return -EPERM; | ||
505 | |||
506 | if (get_inode_sd_version(inode) == STAT_DATA_V1) | 500 | if (get_inode_sd_version(inode) == STAT_DATA_V1) |
507 | return -EOPNOTSUPP; | 501 | return -EOPNOTSUPP; |
508 | 502 | ||
@@ -758,9 +752,6 @@ int reiserfs_xattr_del(struct inode *inode, const char *name) | |||
758 | struct dentry *dir; | 752 | struct dentry *dir; |
759 | int err; | 753 | int err; |
760 | 754 | ||
761 | if (IS_RDONLY(inode)) | ||
762 | return -EROFS; | ||
763 | |||
764 | dir = open_xa_dir(inode, FL_READONLY); | 755 | dir = open_xa_dir(inode, FL_READONLY); |
765 | if (IS_ERR(dir)) { | 756 | if (IS_ERR(dir)) { |
766 | err = PTR_ERR(dir); | 757 | err = PTR_ERR(dir); |
@@ -984,12 +975,6 @@ reiserfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
984 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 975 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) |
985 | return -EOPNOTSUPP; | 976 | return -EOPNOTSUPP; |
986 | 977 | ||
987 | if (IS_RDONLY(dentry->d_inode)) | ||
988 | return -EROFS; | ||
989 | |||
990 | if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) | ||
991 | return -EROFS; | ||
992 | |||
993 | reiserfs_write_lock_xattr_i(dentry->d_inode); | 978 | reiserfs_write_lock_xattr_i(dentry->d_inode); |
994 | lock = !has_xattr_dir(dentry->d_inode); | 979 | lock = !has_xattr_dir(dentry->d_inode); |
995 | if (lock) | 980 | if (lock) |
@@ -1019,12 +1004,6 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name) | |||
1019 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) | 1004 | get_inode_sd_version(dentry->d_inode) == STAT_DATA_V1) |
1020 | return -EOPNOTSUPP; | 1005 | return -EOPNOTSUPP; |
1021 | 1006 | ||
1022 | if (IS_RDONLY(dentry->d_inode)) | ||
1023 | return -EROFS; | ||
1024 | |||
1025 | if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) | ||
1026 | return -EPERM; | ||
1027 | |||
1028 | reiserfs_write_lock_xattr_i(dentry->d_inode); | 1007 | reiserfs_write_lock_xattr_i(dentry->d_inode); |
1029 | reiserfs_read_lock_xattrs(dentry->d_sb); | 1008 | reiserfs_read_lock_xattrs(dentry->d_sb); |
1030 | 1009 | ||
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index 51458048ca66..073f39364b11 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c | |||
@@ -16,18 +16,10 @@ static int | |||
16 | user_get(struct inode *inode, const char *name, void *buffer, size_t size) | 16 | user_get(struct inode *inode, const char *name, void *buffer, size_t size) |
17 | { | 17 | { |
18 | 18 | ||
19 | int error; | ||
20 | |||
21 | if (strlen(name) < sizeof(XATTR_USER_PREFIX)) | 19 | if (strlen(name) < sizeof(XATTR_USER_PREFIX)) |
22 | return -EINVAL; | 20 | return -EINVAL; |
23 | |||
24 | if (!reiserfs_xattrs_user(inode->i_sb)) | 21 | if (!reiserfs_xattrs_user(inode->i_sb)) |
25 | return -EOPNOTSUPP; | 22 | return -EOPNOTSUPP; |
26 | |||
27 | error = reiserfs_permission_locked(inode, MAY_READ, NULL); | ||
28 | if (error) | ||
29 | return error; | ||
30 | |||
31 | return reiserfs_xattr_get(inode, name, buffer, size); | 23 | return reiserfs_xattr_get(inode, name, buffer, size); |
32 | } | 24 | } |
33 | 25 | ||
@@ -36,43 +28,21 @@ user_set(struct inode *inode, const char *name, const void *buffer, | |||
36 | size_t size, int flags) | 28 | size_t size, int flags) |
37 | { | 29 | { |
38 | 30 | ||
39 | int error; | ||
40 | |||
41 | if (strlen(name) < sizeof(XATTR_USER_PREFIX)) | 31 | if (strlen(name) < sizeof(XATTR_USER_PREFIX)) |
42 | return -EINVAL; | 32 | return -EINVAL; |
43 | 33 | ||
44 | if (!reiserfs_xattrs_user(inode->i_sb)) | 34 | if (!reiserfs_xattrs_user(inode->i_sb)) |
45 | return -EOPNOTSUPP; | 35 | return -EOPNOTSUPP; |
46 | |||
47 | if (!S_ISREG(inode->i_mode) && | ||
48 | (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) | ||
49 | return -EPERM; | ||
50 | |||
51 | error = reiserfs_permission_locked(inode, MAY_WRITE, NULL); | ||
52 | if (error) | ||
53 | return error; | ||
54 | |||
55 | return reiserfs_xattr_set(inode, name, buffer, size, flags); | 36 | return reiserfs_xattr_set(inode, name, buffer, size, flags); |
56 | } | 37 | } |
57 | 38 | ||
58 | static int user_del(struct inode *inode, const char *name) | 39 | static int user_del(struct inode *inode, const char *name) |
59 | { | 40 | { |
60 | int error; | ||
61 | |||
62 | if (strlen(name) < sizeof(XATTR_USER_PREFIX)) | 41 | if (strlen(name) < sizeof(XATTR_USER_PREFIX)) |
63 | return -EINVAL; | 42 | return -EINVAL; |
64 | 43 | ||
65 | if (!reiserfs_xattrs_user(inode->i_sb)) | 44 | if (!reiserfs_xattrs_user(inode->i_sb)) |
66 | return -EOPNOTSUPP; | 45 | return -EOPNOTSUPP; |
67 | |||
68 | if (!S_ISREG(inode->i_mode) && | ||
69 | (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) | ||
70 | return -EPERM; | ||
71 | |||
72 | error = reiserfs_permission_locked(inode, MAY_WRITE, NULL); | ||
73 | if (error) | ||
74 | return error; | ||
75 | |||
76 | return 0; | 46 | return 0; |
77 | } | 47 | } |
78 | 48 | ||
diff --git a/fs/xattr.c b/fs/xattr.c index 386a532ee5a9..80eca7d3d69f 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -19,6 +19,149 @@ | |||
19 | #include <linux/fsnotify.h> | 19 | #include <linux/fsnotify.h> |
20 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
21 | 21 | ||
22 | |||
23 | /* | ||
24 | * Check permissions for extended attribute access. This is a bit complicated | ||
25 | * because different namespaces have very different rules. | ||
26 | */ | ||
27 | static int | ||
28 | xattr_permission(struct inode *inode, const char *name, int mask) | ||
29 | { | ||
30 | /* | ||
31 | * We can never set or remove an extended attribute on a read-only | ||
32 | * filesystem or on an immutable / append-only inode. | ||
33 | */ | ||
34 | if (mask & MAY_WRITE) { | ||
35 | if (IS_RDONLY(inode)) | ||
36 | return -EROFS; | ||
37 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | ||
38 | return -EPERM; | ||
39 | } | ||
40 | |||
41 | /* | ||
42 | * No restriction for security.* and system.* from the VFS. Decision | ||
43 | * on these is left to the underlying filesystem / security module. | ||
44 | */ | ||
45 | if (!strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) || | ||
46 | !strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | ||
47 | return 0; | ||
48 | |||
49 | /* | ||
50 | * The trusted.* namespace can only accessed by a privilegued user. | ||
51 | */ | ||
52 | if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN)) | ||
53 | return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM); | ||
54 | |||
55 | if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) { | ||
56 | if (!S_ISREG(inode->i_mode) && | ||
57 | (!S_ISDIR(inode->i_mode) || inode->i_mode & S_ISVTX)) | ||
58 | return -EPERM; | ||
59 | } | ||
60 | |||
61 | return permission(inode, mask, NULL); | ||
62 | } | ||
63 | |||
64 | int | ||
65 | vfs_setxattr(struct dentry *dentry, char *name, void *value, | ||
66 | size_t size, int flags) | ||
67 | { | ||
68 | struct inode *inode = dentry->d_inode; | ||
69 | int error; | ||
70 | |||
71 | error = xattr_permission(inode, name, MAY_WRITE); | ||
72 | if (error) | ||
73 | return error; | ||
74 | |||
75 | mutex_lock(&inode->i_mutex); | ||
76 | error = security_inode_setxattr(dentry, name, value, size, flags); | ||
77 | if (error) | ||
78 | goto out; | ||
79 | error = -EOPNOTSUPP; | ||
80 | if (inode->i_op->setxattr) { | ||
81 | error = inode->i_op->setxattr(dentry, name, value, size, flags); | ||
82 | if (!error) { | ||
83 | fsnotify_xattr(dentry); | ||
84 | security_inode_post_setxattr(dentry, name, value, | ||
85 | size, flags); | ||
86 | } | ||
87 | } else if (!strncmp(name, XATTR_SECURITY_PREFIX, | ||
88 | XATTR_SECURITY_PREFIX_LEN)) { | ||
89 | const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; | ||
90 | error = security_inode_setsecurity(inode, suffix, value, | ||
91 | size, flags); | ||
92 | if (!error) | ||
93 | fsnotify_xattr(dentry); | ||
94 | } | ||
95 | out: | ||
96 | mutex_unlock(&inode->i_mutex); | ||
97 | return error; | ||
98 | } | ||
99 | EXPORT_SYMBOL_GPL(vfs_setxattr); | ||
100 | |||
101 | ssize_t | ||
102 | vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size) | ||
103 | { | ||
104 | struct inode *inode = dentry->d_inode; | ||
105 | int error; | ||
106 | |||
107 | error = xattr_permission(inode, name, MAY_READ); | ||
108 | if (error) | ||
109 | return error; | ||
110 | |||
111 | error = security_inode_getxattr(dentry, name); | ||
112 | if (error) | ||
113 | return error; | ||
114 | |||
115 | if (inode->i_op->getxattr) | ||
116 | error = inode->i_op->getxattr(dentry, name, value, size); | ||
117 | else | ||
118 | error = -EOPNOTSUPP; | ||
119 | |||
120 | if (!strncmp(name, XATTR_SECURITY_PREFIX, | ||
121 | XATTR_SECURITY_PREFIX_LEN)) { | ||
122 | const char *suffix = name + XATTR_SECURITY_PREFIX_LEN; | ||
123 | int ret = security_inode_getsecurity(inode, suffix, value, | ||
124 | size, error); | ||
125 | /* | ||
126 | * Only overwrite the return value if a security module | ||
127 | * is actually active. | ||
128 | */ | ||
129 | if (ret != -EOPNOTSUPP) | ||
130 | error = ret; | ||
131 | } | ||
132 | |||
133 | return error; | ||
134 | } | ||
135 | EXPORT_SYMBOL_GPL(vfs_getxattr); | ||
136 | |||
137 | int | ||
138 | vfs_removexattr(struct dentry *dentry, char *name) | ||
139 | { | ||
140 | struct inode *inode = dentry->d_inode; | ||
141 | int error; | ||
142 | |||
143 | if (!inode->i_op->removexattr) | ||
144 | return -EOPNOTSUPP; | ||
145 | |||
146 | error = xattr_permission(inode, name, MAY_WRITE); | ||
147 | if (error) | ||
148 | return error; | ||
149 | |||
150 | error = security_inode_removexattr(dentry, name); | ||
151 | if (error) | ||
152 | return error; | ||
153 | |||
154 | mutex_lock(&inode->i_mutex); | ||
155 | error = inode->i_op->removexattr(dentry, name); | ||
156 | mutex_unlock(&inode->i_mutex); | ||
157 | |||
158 | if (!error) | ||
159 | fsnotify_xattr(dentry); | ||
160 | return error; | ||
161 | } | ||
162 | EXPORT_SYMBOL_GPL(vfs_removexattr); | ||
163 | |||
164 | |||
22 | /* | 165 | /* |
23 | * Extended attribute SET operations | 166 | * Extended attribute SET operations |
24 | */ | 167 | */ |
@@ -51,29 +194,7 @@ setxattr(struct dentry *d, char __user *name, void __user *value, | |||
51 | } | 194 | } |
52 | } | 195 | } |
53 | 196 | ||
54 | mutex_lock(&d->d_inode->i_mutex); | 197 | error = vfs_setxattr(d, kname, kvalue, size, flags); |
55 | error = security_inode_setxattr(d, kname, kvalue, size, flags); | ||
56 | if (error) | ||
57 | goto out; | ||
58 | error = -EOPNOTSUPP; | ||
59 | if (d->d_inode->i_op && d->d_inode->i_op->setxattr) { | ||
60 | error = d->d_inode->i_op->setxattr(d, kname, kvalue, | ||
61 | size, flags); | ||
62 | if (!error) { | ||
63 | fsnotify_xattr(d); | ||
64 | security_inode_post_setxattr(d, kname, kvalue, | ||
65 | size, flags); | ||
66 | } | ||
67 | } else if (!strncmp(kname, XATTR_SECURITY_PREFIX, | ||
68 | sizeof XATTR_SECURITY_PREFIX - 1)) { | ||
69 | const char *suffix = kname + sizeof XATTR_SECURITY_PREFIX - 1; | ||
70 | error = security_inode_setsecurity(d->d_inode, suffix, kvalue, | ||
71 | size, flags); | ||
72 | if (!error) | ||
73 | fsnotify_xattr(d); | ||
74 | } | ||
75 | out: | ||
76 | mutex_unlock(&d->d_inode->i_mutex); | ||
77 | kfree(kvalue); | 198 | kfree(kvalue); |
78 | return error; | 199 | return error; |
79 | } | 200 | } |
@@ -147,22 +268,7 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size) | |||
147 | return -ENOMEM; | 268 | return -ENOMEM; |
148 | } | 269 | } |
149 | 270 | ||
150 | error = security_inode_getxattr(d, kname); | 271 | error = vfs_getxattr(d, kname, kvalue, size); |
151 | if (error) | ||
152 | goto out; | ||
153 | error = -EOPNOTSUPP; | ||
154 | if (d->d_inode->i_op && d->d_inode->i_op->getxattr) | ||
155 | error = d->d_inode->i_op->getxattr(d, kname, kvalue, size); | ||
156 | |||
157 | if (!strncmp(kname, XATTR_SECURITY_PREFIX, | ||
158 | sizeof XATTR_SECURITY_PREFIX - 1)) { | ||
159 | const char *suffix = kname + sizeof XATTR_SECURITY_PREFIX - 1; | ||
160 | int rv = security_inode_getsecurity(d->d_inode, suffix, kvalue, | ||
161 | size, error); | ||
162 | /* Security module active: overwrite error value */ | ||
163 | if (rv != -EOPNOTSUPP) | ||
164 | error = rv; | ||
165 | } | ||
166 | if (error > 0) { | 272 | if (error > 0) { |
167 | if (size && copy_to_user(value, kvalue, error)) | 273 | if (size && copy_to_user(value, kvalue, error)) |
168 | error = -EFAULT; | 274 | error = -EFAULT; |
@@ -171,7 +277,6 @@ getxattr(struct dentry *d, char __user *name, void __user *value, size_t size) | |||
171 | than XATTR_SIZE_MAX bytes. Not possible. */ | 277 | than XATTR_SIZE_MAX bytes. Not possible. */ |
172 | error = -E2BIG; | 278 | error = -E2BIG; |
173 | } | 279 | } |
174 | out: | ||
175 | kfree(kvalue); | 280 | kfree(kvalue); |
176 | return error; | 281 | return error; |
177 | } | 282 | } |
@@ -318,19 +423,7 @@ removexattr(struct dentry *d, char __user *name) | |||
318 | if (error < 0) | 423 | if (error < 0) |
319 | return error; | 424 | return error; |
320 | 425 | ||
321 | error = -EOPNOTSUPP; | 426 | return vfs_removexattr(d, kname); |
322 | if (d->d_inode->i_op && d->d_inode->i_op->removexattr) { | ||
323 | error = security_inode_removexattr(d, kname); | ||
324 | if (error) | ||
325 | goto out; | ||
326 | mutex_lock(&d->d_inode->i_mutex); | ||
327 | error = d->d_inode->i_op->removexattr(d, kname); | ||
328 | mutex_unlock(&d->d_inode->i_mutex); | ||
329 | if (!error) | ||
330 | fsnotify_xattr(d); | ||
331 | } | ||
332 | out: | ||
333 | return error; | ||
334 | } | 427 | } |
335 | 428 | ||
336 | asmlinkage long | 429 | asmlinkage long |
diff --git a/fs/xfs/Kbuild b/fs/xfs/Kbuild new file mode 100644 index 000000000000..2566e96706f1 --- /dev/null +++ b/fs/xfs/Kbuild | |||
@@ -0,0 +1,6 @@ | |||
1 | # | ||
2 | # The xfs people like to share Makefile with 2.6 and 2.4. | ||
3 | # Utilise file named Kbuild file which has precedence over Makefile. | ||
4 | # | ||
5 | |||
6 | include $(srctree)/$(obj)/Makefile-linux-2.6 | ||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index b78b5eb9e96c..f98c5be3dfe7 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -530,6 +530,8 @@ xfs_attrmulti_attr_set( | |||
530 | char *kbuf; | 530 | char *kbuf; |
531 | int error = EFAULT; | 531 | int error = EFAULT; |
532 | 532 | ||
533 | if (IS_RDONLY(&vp->v_inode)) | ||
534 | return -EROFS; | ||
533 | if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) | 535 | if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) |
534 | return EPERM; | 536 | return EPERM; |
535 | if (len > XATTR_SIZE_MAX) | 537 | if (len > XATTR_SIZE_MAX) |
@@ -557,6 +559,9 @@ xfs_attrmulti_attr_remove( | |||
557 | { | 559 | { |
558 | int error; | 560 | int error; |
559 | 561 | ||
562 | |||
563 | if (IS_RDONLY(&vp->v_inode)) | ||
564 | return -EROFS; | ||
560 | if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) | 565 | if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode)) |
561 | return EPERM; | 566 | return EPERM; |
562 | 567 | ||
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index c83ae15bb0e6..a7c9ba1a9f7b 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/compat.h> | 19 | #include <linux/compat.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/ioctl.h> | 21 | #include <linux/ioctl.h> |
22 | #include <linux/ioctl32.h> | ||
23 | #include <linux/syscalls.h> | 22 | #include <linux/syscalls.h> |
24 | #include <linux/types.h> | 23 | #include <linux/types.h> |
25 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 41c478bb1ffc..97fb1470cf28 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -54,6 +54,9 @@ | |||
54 | #include <linux/xattr.h> | 54 | #include <linux/xattr.h> |
55 | #include <linux/namei.h> | 55 | #include <linux/namei.h> |
56 | 56 | ||
57 | #define IS_NOATIME(inode) ((inode->i_sb->s_flags & MS_NOATIME) || \ | ||
58 | (S_ISDIR(inode->i_mode) && inode->i_sb->s_flags & MS_NODIRATIME)) | ||
59 | |||
57 | /* | 60 | /* |
58 | * Change the requested timestamp in the given inode. | 61 | * Change the requested timestamp in the given inode. |
59 | * We don't lock across timestamp updates, and we don't log them but | 62 | * We don't lock across timestamp updates, and we don't log them but |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 5675117ef227..885dfafeabee 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -713,7 +713,7 @@ start: | |||
713 | } | 713 | } |
714 | 714 | ||
715 | if (likely(!(ioflags & IO_INVIS))) { | 715 | if (likely(!(ioflags & IO_INVIS))) { |
716 | inode_update_time(inode, 1); | 716 | file_update_time(file); |
717 | xfs_ichgtime_fast(xip, inode, | 717 | xfs_ichgtime_fast(xip, inode, |
718 | XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 718 | XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
719 | } | 719 | } |
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 5484eeb460c8..1a11c2b51701 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -117,11 +117,6 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen, | |||
117 | ip->i_d.di_anextents == 0)) | 117 | ip->i_d.di_anextents == 0)) |
118 | return(ENOATTR); | 118 | return(ENOATTR); |
119 | 119 | ||
120 | if (!(flags & (ATTR_KERNACCESS|ATTR_SECURE))) { | ||
121 | if ((error = xfs_iaccess(ip, S_IRUSR, cred))) | ||
122 | return(XFS_ERROR(error)); | ||
123 | } | ||
124 | |||
125 | /* | 120 | /* |
126 | * Fill in the arg structure for this request. | 121 | * Fill in the arg structure for this request. |
127 | */ | 122 | */ |
@@ -425,7 +420,7 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f | |||
425 | struct cred *cred) | 420 | struct cred *cred) |
426 | { | 421 | { |
427 | xfs_inode_t *dp; | 422 | xfs_inode_t *dp; |
428 | int namelen, error; | 423 | int namelen; |
429 | 424 | ||
430 | namelen = strlen(name); | 425 | namelen = strlen(name); |
431 | if (namelen >= MAXNAMELEN) | 426 | if (namelen >= MAXNAMELEN) |
@@ -437,14 +432,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f | |||
437 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 432 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
438 | return (EIO); | 433 | return (EIO); |
439 | 434 | ||
440 | xfs_ilock(dp, XFS_ILOCK_SHARED); | ||
441 | if (!(flags & ATTR_SECURE) && | ||
442 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | ||
443 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
444 | return(XFS_ERROR(error)); | ||
445 | } | ||
446 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
447 | |||
448 | return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags); | 435 | return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags); |
449 | } | 436 | } |
450 | 437 | ||
@@ -579,7 +566,7 @@ int | |||
579 | xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) | 566 | xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) |
580 | { | 567 | { |
581 | xfs_inode_t *dp; | 568 | xfs_inode_t *dp; |
582 | int namelen, error; | 569 | int namelen; |
583 | 570 | ||
584 | namelen = strlen(name); | 571 | namelen = strlen(name); |
585 | if (namelen >= MAXNAMELEN) | 572 | if (namelen >= MAXNAMELEN) |
@@ -592,11 +579,7 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) | |||
592 | return (EIO); | 579 | return (EIO); |
593 | 580 | ||
594 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 581 | xfs_ilock(dp, XFS_ILOCK_SHARED); |
595 | if (!(flags & ATTR_SECURE) && | 582 | if (XFS_IFORK_Q(dp) == 0 || |
596 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | ||
597 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
598 | return(XFS_ERROR(error)); | ||
599 | } else if (XFS_IFORK_Q(dp) == 0 || | ||
600 | (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && | 583 | (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && |
601 | dp->i_d.di_anextents == 0)) { | 584 | dp->i_d.di_anextents == 0)) { |
602 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | 585 | xfs_iunlock(dp, XFS_ILOCK_SHARED); |
@@ -668,12 +651,6 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, | |||
668 | return (EIO); | 651 | return (EIO); |
669 | 652 | ||
670 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 653 | xfs_ilock(dp, XFS_ILOCK_SHARED); |
671 | if (!(flags & ATTR_SECURE) && | ||
672 | (error = xfs_iaccess(dp, S_IRUSR, cred))) { | ||
673 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
674 | return(XFS_ERROR(error)); | ||
675 | } | ||
676 | |||
677 | /* | 654 | /* |
678 | * Decide on what work routines to call based on the inode size. | 655 | * Decide on what work routines to call based on the inode size. |
679 | */ | 656 | */ |
diff --git a/include/asm-arm/ioctl.h b/include/asm-arm/ioctl.h index 2cbb7d0e9dc6..b279fe06dfe5 100644 --- a/include/asm-arm/ioctl.h +++ b/include/asm-arm/ioctl.h | |||
@@ -1,74 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASMARM_IOCTL_H | ||
6 | #define _ASMARM_IOCTL_H | ||
7 | |||
8 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
9 | * size of the parameter structure in the lower 14 bits of the | ||
10 | * upper 16 bits. | ||
11 | * Encoding the size of the parameter structure in the ioctl request | ||
12 | * is useful for catching programs compiled with old versions | ||
13 | * and to avoid overwriting user space outside the user buffer area. | ||
14 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
15 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * The following is for compatibility across the various Linux | ||
20 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
21 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
22 | * bits are indeed used as a type field, so we might just as well make | ||
23 | * this explicit here. Please be sure to use the decoding macros | ||
24 | * below from now on. | ||
25 | */ | ||
26 | #define _IOC_NRBITS 8 | ||
27 | #define _IOC_TYPEBITS 8 | ||
28 | #define _IOC_SIZEBITS 14 | ||
29 | #define _IOC_DIRBITS 2 | ||
30 | |||
31 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
32 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
33 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
34 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
35 | |||
36 | #define _IOC_NRSHIFT 0 | ||
37 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
38 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
39 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
40 | |||
41 | /* | ||
42 | * Direction bits. | ||
43 | */ | ||
44 | #define _IOC_NONE 0U | ||
45 | #define _IOC_WRITE 1U | ||
46 | #define _IOC_READ 2U | ||
47 | |||
48 | #define _IOC(dir,type,nr,size) \ | ||
49 | (((dir) << _IOC_DIRSHIFT) | \ | ||
50 | ((type) << _IOC_TYPESHIFT) | \ | ||
51 | ((nr) << _IOC_NRSHIFT) | \ | ||
52 | ((size) << _IOC_SIZESHIFT)) | ||
53 | |||
54 | /* used to create numbers */ | ||
55 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
56 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
57 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
58 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | |||
60 | /* used to decode ioctl numbers.. */ | ||
61 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
62 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
63 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
64 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
65 | |||
66 | /* ...and for the drivers/sound files... */ | ||
67 | |||
68 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
69 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
70 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
71 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
72 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
73 | |||
74 | #endif /* _ASMARM_IOCTL_H */ | ||
diff --git a/include/asm-arm26/ioctl.h b/include/asm-arm26/ioctl.h index 2cbb7d0e9dc6..b279fe06dfe5 100644 --- a/include/asm-arm26/ioctl.h +++ b/include/asm-arm26/ioctl.h | |||
@@ -1,74 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASMARM_IOCTL_H | ||
6 | #define _ASMARM_IOCTL_H | ||
7 | |||
8 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
9 | * size of the parameter structure in the lower 14 bits of the | ||
10 | * upper 16 bits. | ||
11 | * Encoding the size of the parameter structure in the ioctl request | ||
12 | * is useful for catching programs compiled with old versions | ||
13 | * and to avoid overwriting user space outside the user buffer area. | ||
14 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
15 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * The following is for compatibility across the various Linux | ||
20 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
21 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
22 | * bits are indeed used as a type field, so we might just as well make | ||
23 | * this explicit here. Please be sure to use the decoding macros | ||
24 | * below from now on. | ||
25 | */ | ||
26 | #define _IOC_NRBITS 8 | ||
27 | #define _IOC_TYPEBITS 8 | ||
28 | #define _IOC_SIZEBITS 14 | ||
29 | #define _IOC_DIRBITS 2 | ||
30 | |||
31 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
32 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
33 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
34 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
35 | |||
36 | #define _IOC_NRSHIFT 0 | ||
37 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
38 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
39 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
40 | |||
41 | /* | ||
42 | * Direction bits. | ||
43 | */ | ||
44 | #define _IOC_NONE 0U | ||
45 | #define _IOC_WRITE 1U | ||
46 | #define _IOC_READ 2U | ||
47 | |||
48 | #define _IOC(dir,type,nr,size) \ | ||
49 | (((dir) << _IOC_DIRSHIFT) | \ | ||
50 | ((type) << _IOC_TYPESHIFT) | \ | ||
51 | ((nr) << _IOC_NRSHIFT) | \ | ||
52 | ((size) << _IOC_SIZESHIFT)) | ||
53 | |||
54 | /* used to create numbers */ | ||
55 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
56 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
57 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
58 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | |||
60 | /* used to decode ioctl numbers.. */ | ||
61 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
62 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
63 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
64 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
65 | |||
66 | /* ...and for the drivers/sound files... */ | ||
67 | |||
68 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
69 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
70 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
71 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
72 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
73 | |||
74 | #endif /* _ASMARM_IOCTL_H */ | ||
diff --git a/include/asm-cris/ioctl.h b/include/asm-cris/ioctl.h index be2d8f667a38..b279fe06dfe5 100644 --- a/include/asm-cris/ioctl.h +++ b/include/asm-cris/ioctl.h | |||
@@ -1,83 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | * | ||
4 | * This is the same as the i386 version. | ||
5 | */ | ||
6 | |||
7 | #ifndef _ASMCRIS_IOCTL_H | ||
8 | #define _ASMCRIS_IOCTL_H | ||
9 | |||
10 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
11 | * size of the parameter structure in the lower 14 bits of the | ||
12 | * upper 16 bits. | ||
13 | * Encoding the size of the parameter structure in the ioctl request | ||
14 | * is useful for catching programs compiled with old versions | ||
15 | * and to avoid overwriting user space outside the user buffer area. | ||
16 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
17 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
18 | */ | ||
19 | |||
20 | /* | ||
21 | * The following is for compatibility across the various Linux | ||
22 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
23 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
24 | * bits are indeed used as a type field, so we might just as well make | ||
25 | * this explicit here. Please be sure to use the decoding macros | ||
26 | * below from now on. | ||
27 | */ | ||
28 | #define _IOC_NRBITS 8 | ||
29 | #define _IOC_TYPEBITS 8 | ||
30 | #define _IOC_SIZEBITS 14 | ||
31 | #define _IOC_DIRBITS 2 | ||
32 | |||
33 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
34 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
35 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
36 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
37 | |||
38 | #define _IOC_NRSHIFT 0 | ||
39 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
40 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
41 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
42 | |||
43 | /* | ||
44 | * Direction bits. | ||
45 | */ | ||
46 | #define _IOC_NONE 0U | ||
47 | #define _IOC_WRITE 1U | ||
48 | #define _IOC_READ 2U | ||
49 | |||
50 | #define _IOC(dir,type,nr,size) \ | ||
51 | (((dir) << _IOC_DIRSHIFT) | \ | ||
52 | ((type) << _IOC_TYPESHIFT) | \ | ||
53 | ((nr) << _IOC_NRSHIFT) | \ | ||
54 | ((size) << _IOC_SIZESHIFT)) | ||
55 | |||
56 | /* provoke compile error for invalid uses of size argument */ | ||
57 | extern int __invalid_size_argument_for_IOC; | ||
58 | #define _IOC_TYPECHECK(t) \ | ||
59 | ((sizeof(t) == sizeof(t[1]) && \ | ||
60 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
61 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif /* _ASMCRIS_IOCTL_H */ | ||
diff --git a/include/asm-frv/ioctl.h b/include/asm-frv/ioctl.h index 8aee76905545..b279fe06dfe5 100644 --- a/include/asm-frv/ioctl.h +++ b/include/asm-frv/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
3 | */ | ||
4 | |||
5 | #ifndef _ASM_IOCTL_H | ||
6 | #define _ASM_IOCTL_H | ||
7 | |||
8 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
9 | * size of the parameter structure in the lower 14 bits of the | ||
10 | * upper 16 bits. | ||
11 | * Encoding the size of the parameter structure in the ioctl request | ||
12 | * is useful for catching programs compiled with old versions | ||
13 | * and to avoid overwriting user space outside the user buffer area. | ||
14 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
15 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
16 | */ | ||
17 | |||
18 | /* | ||
19 | * I don't really have any idea about what this should look like, so | ||
20 | * for the time being, this is heavily based on the PC definitions. | ||
21 | */ | ||
22 | |||
23 | /* | ||
24 | * The following is for compatibility across the various Linux | ||
25 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
26 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
27 | * bits are indeed used as a type field, so we might just as well make | ||
28 | * this explicit here. Please be sure to use the decoding macros | ||
29 | * below from now on. | ||
30 | */ | ||
31 | #define _IOC_NRBITS 8 | ||
32 | #define _IOC_TYPEBITS 8 | ||
33 | #define _IOC_SIZEBITS 14 | ||
34 | #define _IOC_DIRBITS 2 | ||
35 | |||
36 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
37 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
38 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
39 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
40 | |||
41 | #define _IOC_NRSHIFT 0 | ||
42 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
43 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
44 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
45 | |||
46 | /* | ||
47 | * Direction bits. | ||
48 | */ | ||
49 | #define _IOC_NONE 0U | ||
50 | #define _IOC_WRITE 1U | ||
51 | #define _IOC_READ 2U | ||
52 | |||
53 | #define _IOC(dir,type,nr,size) \ | ||
54 | (((dir) << _IOC_DIRSHIFT) | \ | ||
55 | ((type) << _IOC_TYPESHIFT) | \ | ||
56 | ((nr) << _IOC_NRSHIFT) | \ | ||
57 | ((size) << _IOC_SIZESHIFT)) | ||
58 | |||
59 | /* used to create numbers */ | ||
60 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
61 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
62 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
63 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | |||
65 | /* used to decode ioctl numbers.. */ | ||
66 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
67 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
68 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
69 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
70 | |||
71 | /* ...and for the drivers/sound files... */ | ||
72 | |||
73 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
74 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
75 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
76 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
77 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
78 | |||
79 | #endif /* _ASM_IOCTL_H */ | ||
80 | |||
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h new file mode 100644 index 000000000000..cd027298beb1 --- /dev/null +++ b/include/asm-generic/ioctl.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef _ASM_GENERIC_IOCTL_H | ||
2 | #define _ASM_GENERIC_IOCTL_H | ||
3 | |||
4 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
5 | * size of the parameter structure in the lower 14 bits of the | ||
6 | * upper 16 bits. | ||
7 | * Encoding the size of the parameter structure in the ioctl request | ||
8 | * is useful for catching programs compiled with old versions | ||
9 | * and to avoid overwriting user space outside the user buffer area. | ||
10 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
11 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
12 | */ | ||
13 | |||
14 | /* | ||
15 | * The following is for compatibility across the various Linux | ||
16 | * platforms. The generic ioctl numbering scheme doesn't really enforce | ||
17 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
18 | * bits are indeed used as a type field, so we might just as well make | ||
19 | * this explicit here. Please be sure to use the decoding macros | ||
20 | * below from now on. | ||
21 | */ | ||
22 | #define _IOC_NRBITS 8 | ||
23 | #define _IOC_TYPEBITS 8 | ||
24 | #define _IOC_SIZEBITS 14 | ||
25 | #define _IOC_DIRBITS 2 | ||
26 | |||
27 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
28 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
29 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
30 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
31 | |||
32 | #define _IOC_NRSHIFT 0 | ||
33 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
34 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
35 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
36 | |||
37 | /* | ||
38 | * Direction bits. | ||
39 | */ | ||
40 | #define _IOC_NONE 0U | ||
41 | #define _IOC_WRITE 1U | ||
42 | #define _IOC_READ 2U | ||
43 | |||
44 | #define _IOC(dir,type,nr,size) \ | ||
45 | (((dir) << _IOC_DIRSHIFT) | \ | ||
46 | ((type) << _IOC_TYPESHIFT) | \ | ||
47 | ((nr) << _IOC_NRSHIFT) | \ | ||
48 | ((size) << _IOC_SIZESHIFT)) | ||
49 | |||
50 | /* provoke compile error for invalid uses of size argument */ | ||
51 | extern unsigned int __invalid_size_argument_for_IOC; | ||
52 | #define _IOC_TYPECHECK(t) \ | ||
53 | ((sizeof(t) == sizeof(t[1]) && \ | ||
54 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
55 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
56 | |||
57 | /* used to create numbers */ | ||
58 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
59 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
60 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
61 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
62 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _ASM_GENERIC_IOCTL_H */ | ||
diff --git a/include/asm-h8300/ioctl.h b/include/asm-h8300/ioctl.h index 031c623478b3..b279fe06dfe5 100644 --- a/include/asm-h8300/ioctl.h +++ b/include/asm-h8300/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.1 2002/11/19 02:09:26 gerg Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _H8300_IOCTL_H | ||
7 | #define _H8300_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _H8300_IOCTL_H */ | ||
diff --git a/include/asm-i386/ioctl.h b/include/asm-i386/ioctl.h index 543f7843d553..b279fe06dfe5 100644 --- a/include/asm-i386/ioctl.h +++ b/include/asm-i386/ioctl.h | |||
@@ -1,85 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _ASMI386_IOCTL_H | ||
7 | #define _ASMI386_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * The following is for compatibility across the various Linux | ||
21 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
22 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
23 | * bits are indeed used as a type field, so we might just as well make | ||
24 | * this explicit here. Please be sure to use the decoding macros | ||
25 | * below from now on. | ||
26 | */ | ||
27 | #define _IOC_NRBITS 8 | ||
28 | #define _IOC_TYPEBITS 8 | ||
29 | #define _IOC_SIZEBITS 14 | ||
30 | #define _IOC_DIRBITS 2 | ||
31 | |||
32 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
33 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
34 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
35 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
36 | |||
37 | #define _IOC_NRSHIFT 0 | ||
38 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
39 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
40 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
41 | |||
42 | /* | ||
43 | * Direction bits. | ||
44 | */ | ||
45 | #define _IOC_NONE 0U | ||
46 | #define _IOC_WRITE 1U | ||
47 | #define _IOC_READ 2U | ||
48 | |||
49 | #define _IOC(dir,type,nr,size) \ | ||
50 | (((dir) << _IOC_DIRSHIFT) | \ | ||
51 | ((type) << _IOC_TYPESHIFT) | \ | ||
52 | ((nr) << _IOC_NRSHIFT) | \ | ||
53 | ((size) << _IOC_SIZESHIFT)) | ||
54 | |||
55 | /* provoke compile error for invalid uses of size argument */ | ||
56 | extern unsigned int __invalid_size_argument_for_IOC; | ||
57 | #define _IOC_TYPECHECK(t) \ | ||
58 | ((sizeof(t) == sizeof(t[1]) && \ | ||
59 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
60 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
61 | |||
62 | /* used to create numbers */ | ||
63 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
64 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
65 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
66 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
67 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
68 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
69 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
70 | |||
71 | /* used to decode ioctl numbers.. */ | ||
72 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
73 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
74 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
75 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
76 | |||
77 | /* ...and for the drivers/sound files... */ | ||
78 | |||
79 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
80 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
81 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
82 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
83 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
84 | |||
85 | #endif /* _ASMI386_IOCTL_H */ | ||
diff --git a/include/asm-i386/kexec.h b/include/asm-i386/kexec.h index 6ed2a03e37b3..53f0e06672dc 100644 --- a/include/asm-i386/kexec.h +++ b/include/asm-i386/kexec.h | |||
@@ -2,6 +2,8 @@ | |||
2 | #define _I386_KEXEC_H | 2 | #define _I386_KEXEC_H |
3 | 3 | ||
4 | #include <asm/fixmap.h> | 4 | #include <asm/fixmap.h> |
5 | #include <asm/ptrace.h> | ||
6 | #include <asm/string.h> | ||
5 | 7 | ||
6 | /* | 8 | /* |
7 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | 9 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. |
@@ -26,8 +28,49 @@ | |||
26 | #define KEXEC_ARCH KEXEC_ARCH_386 | 28 | #define KEXEC_ARCH KEXEC_ARCH_386 |
27 | 29 | ||
28 | #define MAX_NOTE_BYTES 1024 | 30 | #define MAX_NOTE_BYTES 1024 |
29 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
30 | 31 | ||
31 | extern note_buf_t crash_notes[]; | 32 | /* CPU does not save ss and esp on stack if execution is already |
33 | * running in kernel mode at the time of NMI occurrence. This code | ||
34 | * fixes it. | ||
35 | */ | ||
36 | static inline void crash_fixup_ss_esp(struct pt_regs *newregs, | ||
37 | struct pt_regs *oldregs) | ||
38 | { | ||
39 | memcpy(newregs, oldregs, sizeof(*newregs)); | ||
40 | newregs->esp = (unsigned long)&(oldregs->esp); | ||
41 | __asm__ __volatile__( | ||
42 | "xorl %%eax, %%eax\n\t" | ||
43 | "movw %%ss, %%ax\n\t" | ||
44 | :"=a"(newregs->xss)); | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * This function is responsible for capturing register states if coming | ||
49 | * via panic otherwise just fix up the ss and esp if coming via kernel | ||
50 | * mode exception. | ||
51 | */ | ||
52 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
53 | struct pt_regs *oldregs) | ||
54 | { | ||
55 | if (oldregs) | ||
56 | crash_fixup_ss_esp(newregs, oldregs); | ||
57 | else { | ||
58 | __asm__ __volatile__("movl %%ebx,%0" : "=m"(newregs->ebx)); | ||
59 | __asm__ __volatile__("movl %%ecx,%0" : "=m"(newregs->ecx)); | ||
60 | __asm__ __volatile__("movl %%edx,%0" : "=m"(newregs->edx)); | ||
61 | __asm__ __volatile__("movl %%esi,%0" : "=m"(newregs->esi)); | ||
62 | __asm__ __volatile__("movl %%edi,%0" : "=m"(newregs->edi)); | ||
63 | __asm__ __volatile__("movl %%ebp,%0" : "=m"(newregs->ebp)); | ||
64 | __asm__ __volatile__("movl %%eax,%0" : "=m"(newregs->eax)); | ||
65 | __asm__ __volatile__("movl %%esp,%0" : "=m"(newregs->esp)); | ||
66 | __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(newregs->xss)); | ||
67 | __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(newregs->xcs)); | ||
68 | __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(newregs->xds)); | ||
69 | __asm__ __volatile__("movw %%es, %%ax;" :"=a"(newregs->xes)); | ||
70 | __asm__ __volatile__("pushfl; popl %0" :"=m"(newregs->eflags)); | ||
71 | |||
72 | newregs->eip = (unsigned long)current_text_addr(); | ||
73 | } | ||
74 | } | ||
32 | 75 | ||
33 | #endif /* _I386_KEXEC_H */ | 76 | #endif /* _I386_KEXEC_H */ |
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h index ca916a892877..27cac050a60e 100644 --- a/include/asm-i386/kprobes.h +++ b/include/asm-i386/kprobes.h | |||
@@ -40,6 +40,7 @@ typedef u8 kprobe_opcode_t; | |||
40 | 40 | ||
41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 41 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
42 | #define ARCH_SUPPORTS_KRETPROBES | 42 | #define ARCH_SUPPORTS_KRETPROBES |
43 | #define arch_remove_kprobe(p) do {} while (0) | ||
43 | 44 | ||
44 | void kretprobe_trampoline(void); | 45 | void kretprobe_trampoline(void); |
45 | 46 | ||
@@ -76,14 +77,6 @@ static inline void restore_interrupts(struct pt_regs *regs) | |||
76 | local_irq_enable(); | 77 | local_irq_enable(); |
77 | } | 78 | } |
78 | 79 | ||
79 | #ifdef CONFIG_KPROBES | ||
80 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 80 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
81 | unsigned long val, void *data); | 81 | unsigned long val, void *data); |
82 | #else /* !CONFIG_KPROBES */ | ||
83 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
84 | unsigned long val, void *data) | ||
85 | { | ||
86 | return 0; | ||
87 | } | ||
88 | #endif | ||
89 | #endif /* _ASM_KPROBES_H */ | 82 | #endif /* _ASM_KPROBES_H */ |
diff --git a/include/asm-ia64/ioctl.h b/include/asm-ia64/ioctl.h index be9cc2403d2a..b279fe06dfe5 100644 --- a/include/asm-ia64/ioctl.h +++ b/include/asm-ia64/ioctl.h | |||
@@ -1,77 +1 @@ | |||
1 | #ifndef _ASM_IA64_IOCTL_H | #include <asm-generic/ioctl.h> | |
2 | #define _ASM_IA64_IOCTL_H | ||
3 | |||
4 | /* | ||
5 | * Based on <asm-i386/ioctl.h>. | ||
6 | * | ||
7 | * Modified 1998, 1999 | ||
8 | * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co | ||
9 | */ | ||
10 | |||
11 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
12 | * size of the parameter structure in the lower 14 bits of the | ||
13 | * upper 16 bits. | ||
14 | * Encoding the size of the parameter structure in the ioctl request | ||
15 | * is useful for catching programs compiled with old versions | ||
16 | * and to avoid overwriting user space outside the user buffer area. | ||
17 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
18 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
19 | */ | ||
20 | |||
21 | /* | ||
22 | * The following is for compatibility across the various Linux | ||
23 | * platforms. The ia64 ioctl numbering scheme doesn't really enforce | ||
24 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
25 | * bits are indeed used as a type field, so we might just as well make | ||
26 | * this explicit here. Please be sure to use the decoding macros | ||
27 | * below from now on. | ||
28 | */ | ||
29 | #define _IOC_NRBITS 8 | ||
30 | #define _IOC_TYPEBITS 8 | ||
31 | #define _IOC_SIZEBITS 14 | ||
32 | #define _IOC_DIRBITS 2 | ||
33 | |||
34 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
35 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
36 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
37 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
38 | |||
39 | #define _IOC_NRSHIFT 0 | ||
40 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
41 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
42 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
43 | |||
44 | /* | ||
45 | * Direction bits. | ||
46 | */ | ||
47 | #define _IOC_NONE 0U | ||
48 | #define _IOC_WRITE 1U | ||
49 | #define _IOC_READ 2U | ||
50 | |||
51 | #define _IOC(dir,type,nr,size) \ | ||
52 | (((dir) << _IOC_DIRSHIFT) | \ | ||
53 | ((type) << _IOC_TYPESHIFT) | \ | ||
54 | ((nr) << _IOC_NRSHIFT) | \ | ||
55 | ((size) << _IOC_SIZESHIFT)) | ||
56 | |||
57 | /* used to create numbers */ | ||
58 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
59 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
60 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
61 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
62 | |||
63 | /* used to decode ioctl numbers.. */ | ||
64 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
65 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
66 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
67 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
68 | |||
69 | /* ...and for the drivers/sound files... */ | ||
70 | |||
71 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
72 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
73 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
74 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
75 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
76 | |||
77 | #endif /* _ASM_IA64_IOCTL_H */ | ||
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h index 592abb000e29..a74b68104559 100644 --- a/include/asm-ia64/kprobes.h +++ b/include/asm-ia64/kprobes.h | |||
@@ -89,6 +89,7 @@ struct kprobe_ctlblk { | |||
89 | #define IP_RELATIVE_PREDICT_OPCODE (7) | 89 | #define IP_RELATIVE_PREDICT_OPCODE (7) |
90 | #define LONG_BRANCH_OPCODE (0xC) | 90 | #define LONG_BRANCH_OPCODE (0xC) |
91 | #define LONG_CALL_OPCODE (0xD) | 91 | #define LONG_CALL_OPCODE (0xD) |
92 | #define arch_remove_kprobe(p) do {} while (0) | ||
92 | 93 | ||
93 | typedef struct kprobe_opcode { | 94 | typedef struct kprobe_opcode { |
94 | bundle_t bundle; | 95 | bundle_t bundle; |
@@ -110,12 +111,6 @@ struct arch_specific_insn { | |||
110 | unsigned short target_br_reg; | 111 | unsigned short target_br_reg; |
111 | }; | 112 | }; |
112 | 113 | ||
113 | /* ia64 does not need this */ | ||
114 | static inline void arch_copy_kprobe(struct kprobe *p) | ||
115 | { | ||
116 | } | ||
117 | |||
118 | #ifdef CONFIG_KPROBES | ||
119 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 114 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
120 | unsigned long val, void *data); | 115 | unsigned long val, void *data); |
121 | 116 | ||
@@ -124,11 +119,4 @@ static inline void jprobe_return(void) | |||
124 | { | 119 | { |
125 | } | 120 | } |
126 | 121 | ||
127 | #else /* !CONFIG_KPROBES */ | ||
128 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
129 | unsigned long val, void *data) | ||
130 | { | ||
131 | return 0; | ||
132 | } | ||
133 | #endif | ||
134 | #endif /* _ASM_KPROBES_H */ | 122 | #endif /* _ASM_KPROBES_H */ |
diff --git a/include/asm-m32r/ioctl.h b/include/asm-m32r/ioctl.h index 87d8f7db6af1..b279fe06dfe5 100644 --- a/include/asm-m32r/ioctl.h +++ b/include/asm-m32r/ioctl.h | |||
@@ -1,78 +1 @@ | |||
1 | #ifndef _ASM_M32R_IOCTL_H | #include <asm-generic/ioctl.h> | |
2 | #define _ASM_M32R_IOCTL_H | ||
3 | |||
4 | /* $Id$ */ | ||
5 | |||
6 | /* orig : i386 2.4.18 */ | ||
7 | |||
8 | /* | ||
9 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
10 | */ | ||
11 | |||
12 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
13 | * size of the parameter structure in the lower 14 bits of the | ||
14 | * upper 16 bits. | ||
15 | * Encoding the size of the parameter structure in the ioctl request | ||
16 | * is useful for catching programs compiled with old versions | ||
17 | * and to avoid overwriting user space outside the user buffer area. | ||
18 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
19 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * The following is for compatibility across the various Linux | ||
24 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
25 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
26 | * bits are indeed used as a type field, so we might just as well make | ||
27 | * this explicit here. Please be sure to use the decoding macros | ||
28 | * below from now on. | ||
29 | */ | ||
30 | #define _IOC_NRBITS 8 | ||
31 | #define _IOC_TYPEBITS 8 | ||
32 | #define _IOC_SIZEBITS 14 | ||
33 | #define _IOC_DIRBITS 2 | ||
34 | |||
35 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
36 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
37 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
38 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
39 | |||
40 | #define _IOC_NRSHIFT 0 | ||
41 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
42 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
43 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
44 | |||
45 | /* | ||
46 | * Direction bits. | ||
47 | */ | ||
48 | #define _IOC_NONE 0U | ||
49 | #define _IOC_WRITE 1U | ||
50 | #define _IOC_READ 2U | ||
51 | |||
52 | #define _IOC(dir,type,nr,size) \ | ||
53 | (((dir) << _IOC_DIRSHIFT) | \ | ||
54 | ((type) << _IOC_TYPESHIFT) | \ | ||
55 | ((nr) << _IOC_NRSHIFT) | \ | ||
56 | ((size) << _IOC_SIZESHIFT)) | ||
57 | |||
58 | /* used to create numbers */ | ||
59 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
60 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
61 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
62 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
63 | |||
64 | /* used to decode ioctl numbers.. */ | ||
65 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
66 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
67 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
68 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
69 | |||
70 | /* ...and for the drivers/sound files... */ | ||
71 | |||
72 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
73 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
74 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
75 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
76 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
77 | |||
78 | #endif /* _ASM_M32R_IOCTL_H */ | ||
diff --git a/include/asm-m68k/ioctl.h b/include/asm-m68k/ioctl.h index fd68914ab292..b279fe06dfe5 100644 --- a/include/asm-m68k/ioctl.h +++ b/include/asm-m68k/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.3 1997/04/16 15:10:07 jes Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _M68K_IOCTL_H | ||
7 | #define _M68K_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* _M68K_IOCTL_H */ | ||
diff --git a/include/asm-m68knommu/ioctl.h b/include/asm-m68knommu/ioctl.h index cff72f33350f..b279fe06dfe5 100644 --- a/include/asm-m68knommu/ioctl.h +++ b/include/asm-m68knommu/ioctl.h | |||
@@ -1 +1 @@ | |||
#include <asm-m68k/ioctl.h> | #include <asm-generic/ioctl.h> | ||
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h index 4263af3cadfd..fffdf690b840 100644 --- a/include/asm-powerpc/kexec.h +++ b/include/asm-powerpc/kexec.h | |||
@@ -38,9 +38,6 @@ | |||
38 | #ifdef CONFIG_KEXEC | 38 | #ifdef CONFIG_KEXEC |
39 | 39 | ||
40 | #define MAX_NOTE_BYTES 1024 | 40 | #define MAX_NOTE_BYTES 1024 |
41 | typedef u32 note_buf_t[MAX_NOTE_BYTES / sizeof(u32)]; | ||
42 | |||
43 | extern note_buf_t crash_notes[]; | ||
44 | 41 | ||
45 | #ifdef __powerpc64__ | 42 | #ifdef __powerpc64__ |
46 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for | 43 | extern void kexec_smp_wait(void); /* get and clear naca physid, wait for |
@@ -58,6 +55,12 @@ extern void default_machine_crash_shutdown(struct pt_regs *regs); | |||
58 | 55 | ||
59 | #endif /* !CONFIG_KEXEC */ | 56 | #endif /* !CONFIG_KEXEC */ |
60 | 57 | ||
58 | /* | ||
59 | * Provide a dummy definition to avoid build failures. Will remain | ||
60 | * empty till crash dump support is enabled. | ||
61 | */ | ||
62 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
63 | struct pt_regs *oldregs) { } | ||
61 | #endif /* ! __ASSEMBLY__ */ | 64 | #endif /* ! __ASSEMBLY__ */ |
62 | #endif /* __KERNEL__ */ | 65 | #endif /* __KERNEL__ */ |
63 | #endif /* _ASM_POWERPC_KEXEC_H */ | 66 | #endif /* _ASM_POWERPC_KEXEC_H */ |
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h index 0654f79b06df..f466bc804f41 100644 --- a/include/asm-powerpc/kprobes.h +++ b/include/asm-powerpc/kprobes.h | |||
@@ -30,7 +30,10 @@ | |||
30 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
31 | #include <linux/percpu.h> | 31 | #include <linux/percpu.h> |
32 | 32 | ||
33 | #define __ARCH_WANT_KPROBES_INSN_SLOT | ||
34 | |||
33 | struct pt_regs; | 35 | struct pt_regs; |
36 | struct kprobe; | ||
34 | 37 | ||
35 | typedef unsigned int kprobe_opcode_t; | 38 | typedef unsigned int kprobe_opcode_t; |
36 | #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ | 39 | #define BREAKPOINT_INSTRUCTION 0x7fe00008 /* trap */ |
@@ -48,6 +51,7 @@ typedef unsigned int kprobe_opcode_t; | |||
48 | 51 | ||
49 | #define ARCH_SUPPORTS_KRETPROBES | 52 | #define ARCH_SUPPORTS_KRETPROBES |
50 | void kretprobe_trampoline(void); | 53 | void kretprobe_trampoline(void); |
54 | extern void arch_remove_kprobe(struct kprobe *p); | ||
51 | 55 | ||
52 | /* Architecture specific copy of original instruction */ | 56 | /* Architecture specific copy of original instruction */ |
53 | struct arch_specific_insn { | 57 | struct arch_specific_insn { |
@@ -69,15 +73,7 @@ struct kprobe_ctlblk { | |||
69 | struct prev_kprobe prev_kprobe; | 73 | struct prev_kprobe prev_kprobe; |
70 | }; | 74 | }; |
71 | 75 | ||
72 | #ifdef CONFIG_KPROBES | ||
73 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 76 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
74 | unsigned long val, void *data); | 77 | unsigned long val, void *data); |
75 | #else /* !CONFIG_KPROBES */ | ||
76 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
77 | unsigned long val, void *data) | ||
78 | { | ||
79 | return 0; | ||
80 | } | ||
81 | #endif | ||
82 | #endif /* __KERNEL__ */ | 78 | #endif /* __KERNEL__ */ |
83 | #endif /* _ASM_POWERPC_KPROBES_H */ | 79 | #endif /* _ASM_POWERPC_KPROBES_H */ |
diff --git a/include/asm-s390/ioctl.h b/include/asm-s390/ioctl.h index df7394345ac4..b279fe06dfe5 100644 --- a/include/asm-s390/ioctl.h +++ b/include/asm-s390/ioctl.h | |||
@@ -1,88 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * include/asm-s390/ioctl.h | ||
3 | * | ||
4 | * S390 version | ||
5 | * | ||
6 | * Derived from "include/asm-i386/ioctl.h" | ||
7 | */ | ||
8 | |||
9 | #ifndef _S390_IOCTL_H | ||
10 | #define _S390_IOCTL_H | ||
11 | |||
12 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
13 | * size of the parameter structure in the lower 14 bits of the | ||
14 | * upper 16 bits. | ||
15 | * Encoding the size of the parameter structure in the ioctl request | ||
16 | * is useful for catching programs compiled with old versions | ||
17 | * and to avoid overwriting user space outside the user buffer area. | ||
18 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
19 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * The following is for compatibility across the various Linux | ||
24 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
25 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
26 | * bits are indeed used as a type field, so we might just as well make | ||
27 | * this explicit here. Please be sure to use the decoding macros | ||
28 | * below from now on. | ||
29 | */ | ||
30 | #define _IOC_NRBITS 8 | ||
31 | #define _IOC_TYPEBITS 8 | ||
32 | #define _IOC_SIZEBITS 14 | ||
33 | #define _IOC_DIRBITS 2 | ||
34 | |||
35 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
36 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
37 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
38 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
39 | |||
40 | #define _IOC_NRSHIFT 0 | ||
41 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
42 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
43 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
44 | |||
45 | /* | ||
46 | * Direction bits. | ||
47 | */ | ||
48 | #define _IOC_NONE 0U | ||
49 | #define _IOC_WRITE 1U | ||
50 | #define _IOC_READ 2U | ||
51 | |||
52 | #define _IOC(dir,type,nr,size) \ | ||
53 | (((dir) << _IOC_DIRSHIFT) | \ | ||
54 | ((type) << _IOC_TYPESHIFT) | \ | ||
55 | ((nr) << _IOC_NRSHIFT) | \ | ||
56 | ((size) << _IOC_SIZESHIFT)) | ||
57 | |||
58 | /* provoke compile error for invalid uses of size argument */ | ||
59 | extern unsigned long __invalid_size_argument_for_IOC; | ||
60 | #define _IOC_TYPECHECK(t) \ | ||
61 | ((sizeof(t) == sizeof(t[1]) && \ | ||
62 | sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ | ||
63 | sizeof(t) : __invalid_size_argument_for_IOC) | ||
64 | |||
65 | /* used to create numbers */ | ||
66 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
67 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) | ||
68 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
69 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) | ||
70 | #define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
71 | #define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
72 | #define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
73 | |||
74 | /* used to decode ioctl numbers.. */ | ||
75 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
76 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
77 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
78 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
79 | |||
80 | /* ...and for the drivers/sound files... */ | ||
81 | |||
82 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
83 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
84 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
85 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
86 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
87 | |||
88 | #endif /* _S390_IOCTL_H */ | ||
diff --git a/include/asm-s390/kexec.h b/include/asm-s390/kexec.h index 54cf7d9f251c..ce28ddda0f50 100644 --- a/include/asm-s390/kexec.h +++ b/include/asm-s390/kexec.h | |||
@@ -35,8 +35,9 @@ | |||
35 | #define KEXEC_ARCH KEXEC_ARCH_S390 | 35 | #define KEXEC_ARCH KEXEC_ARCH_S390 |
36 | 36 | ||
37 | #define MAX_NOTE_BYTES 1024 | 37 | #define MAX_NOTE_BYTES 1024 |
38 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
39 | 38 | ||
40 | extern note_buf_t crash_notes[]; | 39 | /* Provide a dummy definition to avoid build failures. */ |
40 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
41 | struct pt_regs *oldregs) { } | ||
41 | 42 | ||
42 | #endif /*_S390_KEXEC_H */ | 43 | #endif /*_S390_KEXEC_H */ |
diff --git a/include/asm-sh/ioctl.h b/include/asm-sh/ioctl.h index 524700e84acd..b279fe06dfe5 100644 --- a/include/asm-sh/ioctl.h +++ b/include/asm-sh/ioctl.h | |||
@@ -1,75 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.1.1.1 2001/10/15 20:45:09 mrbrown Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef __ASM_SH_IOCTL_H | ||
7 | #define __ASM_SH_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * The following is for compatibility across the various Linux | ||
21 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
22 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
23 | * bits are indeed used as a type field, so we might just as well make | ||
24 | * this explicit here. Please be sure to use the decoding macros | ||
25 | * below from now on. | ||
26 | */ | ||
27 | #define _IOC_NRBITS 8 | ||
28 | #define _IOC_TYPEBITS 8 | ||
29 | #define _IOC_SIZEBITS 14 | ||
30 | #define _IOC_DIRBITS 2 | ||
31 | |||
32 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
33 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
34 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
35 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
36 | |||
37 | #define _IOC_NRSHIFT 0 | ||
38 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
39 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
40 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
41 | |||
42 | /* | ||
43 | * Direction bits. | ||
44 | */ | ||
45 | #define _IOC_NONE 0U | ||
46 | #define _IOC_WRITE 1U | ||
47 | #define _IOC_READ 2U | ||
48 | |||
49 | #define _IOC(dir,type,nr,size) \ | ||
50 | (((dir) << _IOC_DIRSHIFT) | \ | ||
51 | ((type) << _IOC_TYPESHIFT) | \ | ||
52 | ((nr) << _IOC_NRSHIFT) | \ | ||
53 | ((size) << _IOC_SIZESHIFT)) | ||
54 | |||
55 | /* used to create numbers */ | ||
56 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
57 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
58 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
60 | |||
61 | /* used to decode ioctl numbers.. */ | ||
62 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
63 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
64 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
65 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
66 | |||
67 | /* ...and for the drivers/sound files... */ | ||
68 | |||
69 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
70 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
71 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
72 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
73 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
74 | |||
75 | #endif /* __ASM_SH_IOCTL_H */ | ||
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h index cfafaa73b2b0..dee4f77929a4 100644 --- a/include/asm-sh64/io.h +++ b/include/asm-sh64/io.h | |||
@@ -143,12 +143,12 @@ extern unsigned long pciio_virt; | |||
143 | * Change virtual addresses to physical addresses and vv. | 143 | * Change virtual addresses to physical addresses and vv. |
144 | * These are trivial on the 1:1 Linux/SuperH mapping | 144 | * These are trivial on the 1:1 Linux/SuperH mapping |
145 | */ | 145 | */ |
146 | extern __inline__ unsigned long virt_to_phys(volatile void * address) | 146 | static inline unsigned long virt_to_phys(volatile void * address) |
147 | { | 147 | { |
148 | return __pa(address); | 148 | return __pa(address); |
149 | } | 149 | } |
150 | 150 | ||
151 | extern __inline__ void * phys_to_virt(unsigned long address) | 151 | static inline void * phys_to_virt(unsigned long address) |
152 | { | 152 | { |
153 | return __va(address); | 153 | return __va(address); |
154 | } | 154 | } |
@@ -156,12 +156,12 @@ extern __inline__ void * phys_to_virt(unsigned long address) | |||
156 | extern void * __ioremap(unsigned long phys_addr, unsigned long size, | 156 | extern void * __ioremap(unsigned long phys_addr, unsigned long size, |
157 | unsigned long flags); | 157 | unsigned long flags); |
158 | 158 | ||
159 | extern __inline__ void * ioremap(unsigned long phys_addr, unsigned long size) | 159 | static inline void * ioremap(unsigned long phys_addr, unsigned long size) |
160 | { | 160 | { |
161 | return __ioremap(phys_addr, size, 1); | 161 | return __ioremap(phys_addr, size, 1); |
162 | } | 162 | } |
163 | 163 | ||
164 | extern __inline__ void * ioremap_nocache (unsigned long phys_addr, unsigned long size) | 164 | static inline void * ioremap_nocache (unsigned long phys_addr, unsigned long size) |
165 | { | 165 | { |
166 | return __ioremap(phys_addr, size, 0); | 166 | return __ioremap(phys_addr, size, 0); |
167 | } | 167 | } |
diff --git a/include/asm-sh64/ioctl.h b/include/asm-sh64/ioctl.h index c089a6fb78e0..b279fe06dfe5 100644 --- a/include/asm-sh64/ioctl.h +++ b/include/asm-sh64/ioctl.h | |||
@@ -1,83 +1 @@ | |||
1 | #ifndef __ASM_SH64_IOCTL_H | #include <asm-generic/ioctl.h> | |
2 | #define __ASM_SH64_IOCTL_H | ||
3 | |||
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 | * include/asm-sh64/ioctl.h | ||
10 | * | ||
11 | * Copyright (C) 2000, 2001 Paolo Alberelli | ||
12 | * | ||
13 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif /* __ASM_SH64_IOCTL_H */ | ||
diff --git a/include/asm-sh64/mmu_context.h b/include/asm-sh64/mmu_context.h index f062e1513272..991cfda4cdf6 100644 --- a/include/asm-sh64/mmu_context.h +++ b/include/asm-sh64/mmu_context.h | |||
@@ -50,7 +50,7 @@ extern pgd_t *mmu_pdtp_cache; | |||
50 | */ | 50 | */ |
51 | #define MMU_VPN_MASK 0xfffff000 | 51 | #define MMU_VPN_MASK 0xfffff000 |
52 | 52 | ||
53 | extern __inline__ void | 53 | static inline void |
54 | get_new_mmu_context(struct mm_struct *mm) | 54 | get_new_mmu_context(struct mm_struct *mm) |
55 | { | 55 | { |
56 | extern void flush_tlb_all(void); | 56 | extern void flush_tlb_all(void); |
diff --git a/include/asm-sh64/pgalloc.h b/include/asm-sh64/pgalloc.h index b25f5df5535c..678251ac1db8 100644 --- a/include/asm-sh64/pgalloc.h +++ b/include/asm-sh64/pgalloc.h | |||
@@ -38,14 +38,14 @@ static inline void pgd_init(unsigned long page) | |||
38 | * if any. | 38 | * if any. |
39 | */ | 39 | */ |
40 | 40 | ||
41 | extern __inline__ pgd_t *get_pgd_slow(void) | 41 | static inline pgd_t *get_pgd_slow(void) |
42 | { | 42 | { |
43 | unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); | 43 | unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); |
44 | pgd_t *ret = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); | 44 | pgd_t *ret = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL); |
45 | return ret; | 45 | return ret; |
46 | } | 46 | } |
47 | 47 | ||
48 | extern __inline__ pgd_t *get_pgd_fast(void) | 48 | static inline pgd_t *get_pgd_fast(void) |
49 | { | 49 | { |
50 | unsigned long *ret; | 50 | unsigned long *ret; |
51 | 51 | ||
@@ -62,14 +62,14 @@ extern __inline__ pgd_t *get_pgd_fast(void) | |||
62 | return (pgd_t *)ret; | 62 | return (pgd_t *)ret; |
63 | } | 63 | } |
64 | 64 | ||
65 | extern __inline__ void free_pgd_fast(pgd_t *pgd) | 65 | static inline void free_pgd_fast(pgd_t *pgd) |
66 | { | 66 | { |
67 | *(unsigned long *)pgd = (unsigned long) pgd_quicklist; | 67 | *(unsigned long *)pgd = (unsigned long) pgd_quicklist; |
68 | pgd_quicklist = (unsigned long *) pgd; | 68 | pgd_quicklist = (unsigned long *) pgd; |
69 | pgtable_cache_size++; | 69 | pgtable_cache_size++; |
70 | } | 70 | } |
71 | 71 | ||
72 | extern __inline__ void free_pgd_slow(pgd_t *pgd) | 72 | static inline void free_pgd_slow(pgd_t *pgd) |
73 | { | 73 | { |
74 | kfree((void *)pgd); | 74 | kfree((void *)pgd); |
75 | } | 75 | } |
@@ -77,7 +77,7 @@ extern __inline__ void free_pgd_slow(pgd_t *pgd) | |||
77 | extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); | 77 | extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted); |
78 | extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); | 78 | extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted); |
79 | 79 | ||
80 | extern __inline__ pte_t *get_pte_fast(void) | 80 | static inline pte_t *get_pte_fast(void) |
81 | { | 81 | { |
82 | unsigned long *ret; | 82 | unsigned long *ret; |
83 | 83 | ||
@@ -89,7 +89,7 @@ extern __inline__ pte_t *get_pte_fast(void) | |||
89 | return (pte_t *)ret; | 89 | return (pte_t *)ret; |
90 | } | 90 | } |
91 | 91 | ||
92 | extern __inline__ void free_pte_fast(pte_t *pte) | 92 | static inline void free_pte_fast(pte_t *pte) |
93 | { | 93 | { |
94 | *(unsigned long *)pte = (unsigned long) pte_quicklist; | 94 | *(unsigned long *)pte = (unsigned long) pte_quicklist; |
95 | pte_quicklist = (unsigned long *) pte; | 95 | pte_quicklist = (unsigned long *) pte; |
@@ -167,7 +167,7 @@ static __inline__ void pmd_free(pmd_t *pmd) | |||
167 | 167 | ||
168 | extern int do_check_pgt_cache(int, int); | 168 | extern int do_check_pgt_cache(int, int); |
169 | 169 | ||
170 | extern inline void set_pgdir(unsigned long address, pgd_t entry) | 170 | static inline void set_pgdir(unsigned long address, pgd_t entry) |
171 | { | 171 | { |
172 | struct task_struct * p; | 172 | struct task_struct * p; |
173 | pgd_t *pgd; | 173 | pgd_t *pgd; |
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h index a1906a772df9..57af6b3eb271 100644 --- a/include/asm-sh64/pgtable.h +++ b/include/asm-sh64/pgtable.h | |||
@@ -421,18 +421,18 @@ static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } | |||
421 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } | 421 | static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } |
422 | static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } | 422 | static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } |
423 | 423 | ||
424 | extern inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; } | 424 | static inline pte_t pte_rdprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_READ)); return pte; } |
425 | extern inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } | 425 | static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } |
426 | extern inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; } | 426 | static inline pte_t pte_exprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_EXECUTE)); return pte; } |
427 | extern inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } | 427 | static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } |
428 | extern inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } | 428 | static inline pte_t pte_mkold(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED)); return pte; } |
429 | 429 | ||
430 | extern inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; } | 430 | static inline pte_t pte_mkread(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_READ)); return pte; } |
431 | extern inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } | 431 | static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_WRITE)); return pte; } |
432 | extern inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } | 432 | static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_EXECUTE)); return pte; } |
433 | extern inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } | 433 | static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } |
434 | extern inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } | 434 | static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } |
435 | extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } | 435 | static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } |
436 | 436 | ||
437 | 437 | ||
438 | /* | 438 | /* |
@@ -456,7 +456,7 @@ extern inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _ | |||
456 | #define mk_pte_phys(physpage, pgprot) \ | 456 | #define mk_pte_phys(physpage, pgprot) \ |
457 | ({ pte_t __pte; set_pte(&__pte, __pte(physpage | pgprot_val(pgprot))); __pte; }) | 457 | ({ pte_t __pte; set_pte(&__pte, __pte(physpage | pgprot_val(pgprot))); __pte; }) |
458 | 458 | ||
459 | extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | 459 | static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) |
460 | { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } | 460 | { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } |
461 | 461 | ||
462 | typedef pte_t *pte_addr_t; | 462 | typedef pte_t *pte_addr_t; |
diff --git a/include/asm-sh64/processor.h b/include/asm-sh64/processor.h index a51bd41e6fbc..1bf252dad824 100644 --- a/include/asm-sh64/processor.h +++ b/include/asm-sh64/processor.h | |||
@@ -228,7 +228,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | |||
228 | * FPU lazy state save handling. | 228 | * FPU lazy state save handling. |
229 | */ | 229 | */ |
230 | 230 | ||
231 | extern __inline__ void release_fpu(void) | 231 | static inline void release_fpu(void) |
232 | { | 232 | { |
233 | unsigned long long __dummy; | 233 | unsigned long long __dummy; |
234 | 234 | ||
@@ -240,7 +240,7 @@ extern __inline__ void release_fpu(void) | |||
240 | : "r" (SR_FD)); | 240 | : "r" (SR_FD)); |
241 | } | 241 | } |
242 | 242 | ||
243 | extern __inline__ void grab_fpu(void) | 243 | static inline void grab_fpu(void) |
244 | { | 244 | { |
245 | unsigned long long __dummy; | 245 | unsigned long long __dummy; |
246 | 246 | ||
diff --git a/include/asm-sh64/system.h b/include/asm-sh64/system.h index 42510e496eb5..3002e988180c 100644 --- a/include/asm-sh64/system.h +++ b/include/asm-sh64/system.h | |||
@@ -132,7 +132,7 @@ static __inline__ void local_irq_disable(void) | |||
132 | (flags != 0); \ | 132 | (flags != 0); \ |
133 | }) | 133 | }) |
134 | 134 | ||
135 | extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) | 135 | static inline unsigned long xchg_u32(volatile int * m, unsigned long val) |
136 | { | 136 | { |
137 | unsigned long flags, retval; | 137 | unsigned long flags, retval; |
138 | 138 | ||
@@ -143,7 +143,7 @@ extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val) | |||
143 | return retval; | 143 | return retval; |
144 | } | 144 | } |
145 | 145 | ||
146 | extern __inline__ unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) | 146 | static inline unsigned long xchg_u8(volatile unsigned char * m, unsigned long val) |
147 | { | 147 | { |
148 | unsigned long flags, retval; | 148 | unsigned long flags, retval; |
149 | 149 | ||
diff --git a/include/asm-sh64/tlbflush.h b/include/asm-sh64/tlbflush.h index 15c0719eecc3..e45beadc29ee 100644 --- a/include/asm-sh64/tlbflush.h +++ b/include/asm-sh64/tlbflush.h | |||
@@ -20,7 +20,7 @@ extern void flush_tlb_mm(struct mm_struct *mm); | |||
20 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, | 20 | extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, |
21 | unsigned long end); | 21 | unsigned long end); |
22 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); | 22 | extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); |
23 | extern inline void flush_tlb_pgtables(struct mm_struct *mm, | 23 | static inline void flush_tlb_pgtables(struct mm_struct *mm, |
24 | unsigned long start, unsigned long end) | 24 | unsigned long start, unsigned long end) |
25 | { | 25 | { |
26 | } | 26 | } |
diff --git a/include/asm-sh64/uaccess.h b/include/asm-sh64/uaccess.h index 56aa3cf0f273..f4936d8fa617 100644 --- a/include/asm-sh64/uaccess.h +++ b/include/asm-sh64/uaccess.h | |||
@@ -287,7 +287,7 @@ __sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); | |||
287 | */ | 287 | */ |
288 | extern long __strnlen_user(const char *__s, long __n); | 288 | extern long __strnlen_user(const char *__s, long __n); |
289 | 289 | ||
290 | extern __inline__ long strnlen_user(const char *s, long n) | 290 | static inline long strnlen_user(const char *s, long n) |
291 | { | 291 | { |
292 | if (!__addr_ok(s)) | 292 | if (!__addr_ok(s)) |
293 | return 0; | 293 | return 0; |
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index 7ba845320f5c..e4efe652b54b 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h | |||
@@ -12,6 +12,7 @@ typedef u32 kprobe_opcode_t; | |||
12 | #define MAX_INSN_SIZE 2 | 12 | #define MAX_INSN_SIZE 2 |
13 | 13 | ||
14 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry | 14 | #define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry |
15 | #define arch_remove_kprobe(p) do {} while (0) | ||
15 | 16 | ||
16 | /* Architecture specific copy of original instruction*/ | 17 | /* Architecture specific copy of original instruction*/ |
17 | struct arch_specific_insn { | 18 | struct arch_specific_insn { |
@@ -38,15 +39,6 @@ struct kprobe_ctlblk { | |||
38 | struct prev_kprobe prev_kprobe; | 39 | struct prev_kprobe prev_kprobe; |
39 | }; | 40 | }; |
40 | 41 | ||
41 | #ifdef CONFIG_KPROBES | ||
42 | extern int kprobe_exceptions_notify(struct notifier_block *self, | 42 | extern int kprobe_exceptions_notify(struct notifier_block *self, |
43 | unsigned long val, void *data); | 43 | unsigned long val, void *data); |
44 | #else /* !CONFIG_KPROBES */ | ||
45 | static inline int kprobe_exceptions_notify(struct notifier_block *self, | ||
46 | unsigned long val, void *data) | ||
47 | { | ||
48 | return 0; | ||
49 | } | ||
50 | #endif | ||
51 | |||
52 | #endif /* _SPARC64_KPROBES_H */ | 44 | #endif /* _SPARC64_KPROBES_H */ |
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h index 075771c371f6..da07a69ce82a 100644 --- a/include/asm-um/processor-generic.h +++ b/include/asm-um/processor-generic.h | |||
@@ -89,7 +89,6 @@ extern struct task_struct *alloc_task_struct(void); | |||
89 | 89 | ||
90 | extern void release_thread(struct task_struct *); | 90 | extern void release_thread(struct task_struct *); |
91 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | 91 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); |
92 | extern void dump_thread(struct pt_regs *regs, struct user *u); | ||
93 | 92 | ||
94 | static inline void prepare_to_copy(struct task_struct *tsk) | 93 | static inline void prepare_to_copy(struct task_struct *tsk) |
95 | { | 94 | { |
diff --git a/include/asm-v850/ioctl.h b/include/asm-v850/ioctl.h index 1765df6c7b87..b279fe06dfe5 100644 --- a/include/asm-v850/ioctl.h +++ b/include/asm-v850/ioctl.h | |||
@@ -1,80 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.1 2002/09/28 14:58:41 gerg Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _V850_IOCTL_H | ||
7 | #define _V850_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * I don't really have any idea about what this should look like, so | ||
21 | * for the time being, this is heavily based on the PC definitions. | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * The following is for compatibility across the various Linux | ||
26 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
27 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
28 | * bits are indeed used as a type field, so we might just as well make | ||
29 | * this explicit here. Please be sure to use the decoding macros | ||
30 | * below from now on. | ||
31 | */ | ||
32 | #define _IOC_NRBITS 8 | ||
33 | #define _IOC_TYPEBITS 8 | ||
34 | #define _IOC_SIZEBITS 14 | ||
35 | #define _IOC_DIRBITS 2 | ||
36 | |||
37 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
38 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
39 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
40 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
41 | |||
42 | #define _IOC_NRSHIFT 0 | ||
43 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
44 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
45 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
46 | |||
47 | /* | ||
48 | * Direction bits. | ||
49 | */ | ||
50 | #define _IOC_NONE 0U | ||
51 | #define _IOC_WRITE 1U | ||
52 | #define _IOC_READ 2U | ||
53 | |||
54 | #define _IOC(dir,type,nr,size) \ | ||
55 | (((dir) << _IOC_DIRSHIFT) | \ | ||
56 | ((type) << _IOC_TYPESHIFT) | \ | ||
57 | ((nr) << _IOC_NRSHIFT) | \ | ||
58 | ((size) << _IOC_SIZESHIFT)) | ||
59 | |||
60 | /* used to create numbers */ | ||
61 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
62 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
63 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
64 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
65 | |||
66 | /* used to decode ioctl numbers.. */ | ||
67 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
68 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
69 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
70 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
71 | |||
72 | /* ...and for the drivers/sound files... */ | ||
73 | |||
74 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
75 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
76 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
77 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
78 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
79 | |||
80 | #endif /* __V850_IOCTL_H__ */ | ||
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h index e682edc24a68..8dcc32665240 100644 --- a/include/asm-x86_64/e820.h +++ b/include/asm-x86_64/e820.h | |||
@@ -55,6 +55,7 @@ extern unsigned long e820_hole_size(unsigned long start_pfn, | |||
55 | unsigned long end_pfn); | 55 | unsigned long end_pfn); |
56 | 56 | ||
57 | extern void __init parse_memopt(char *p, char **end); | 57 | extern void __init parse_memopt(char *p, char **end); |
58 | extern void __init parse_memmapopt(char *p, char **end); | ||
58 | 59 | ||
59 | extern struct e820map e820; | 60 | extern struct e820map e820; |
60 | #endif/*!__ASSEMBLY__*/ | 61 | #endif/*!__ASSEMBLY__*/ |
diff --git a/include/asm-x86_64/ioctl.h b/include/asm-x86_64/ioctl.h index 609b663b6bf4..b279fe06dfe5 100644 --- a/include/asm-x86_64/ioctl.h +++ b/include/asm-x86_64/ioctl.h | |||
@@ -1,75 +1 @@ | |||
1 | /* $Id: ioctl.h,v 1.2 2001/07/04 09:08:13 ak Exp $ | #include <asm-generic/ioctl.h> | |
2 | * | ||
3 | * linux/ioctl.h for Linux by H.H. Bergman. | ||
4 | */ | ||
5 | |||
6 | #ifndef _ASMX8664_IOCTL_H | ||
7 | #define _ASMX8664_IOCTL_H | ||
8 | |||
9 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
10 | * size of the parameter structure in the lower 14 bits of the | ||
11 | * upper 16 bits. | ||
12 | * Encoding the size of the parameter structure in the ioctl request | ||
13 | * is useful for catching programs compiled with old versions | ||
14 | * and to avoid overwriting user space outside the user buffer area. | ||
15 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
16 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
17 | */ | ||
18 | |||
19 | /* | ||
20 | * The following is for compatibility across the various Linux | ||
21 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
22 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
23 | * bits are indeed used as a type field, so we might just as well make | ||
24 | * this explicit here. Please be sure to use the decoding macros | ||
25 | * below from now on. | ||
26 | */ | ||
27 | #define _IOC_NRBITS 8 | ||
28 | #define _IOC_TYPEBITS 8 | ||
29 | #define _IOC_SIZEBITS 14 | ||
30 | #define _IOC_DIRBITS 2 | ||
31 | |||
32 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
33 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
34 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
35 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
36 | |||
37 | #define _IOC_NRSHIFT 0 | ||
38 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
39 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
40 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
41 | |||
42 | /* | ||
43 | * Direction bits. | ||
44 | */ | ||
45 | #define _IOC_NONE 0U | ||
46 | #define _IOC_WRITE 1U | ||
47 | #define _IOC_READ 2U | ||
48 | |||
49 | #define _IOC(dir,type,nr,size) \ | ||
50 | (((dir) << _IOC_DIRSHIFT) | \ | ||
51 | ((type) << _IOC_TYPESHIFT) | \ | ||
52 | ((nr) << _IOC_NRSHIFT) | \ | ||
53 | ((size) << _IOC_SIZESHIFT)) | ||
54 | |||
55 | /* used to create numbers */ | ||
56 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
57 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
58 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
59 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
60 | |||
61 | /* used to decode ioctl numbers.. */ | ||
62 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
63 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
64 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
65 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
66 | |||
67 | /* ...and for the drivers/sound files... */ | ||
68 | |||
69 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
70 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
71 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
72 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
73 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
74 | |||
75 | #endif /* _ASMX8664_IOCTL_H */ | ||
diff --git a/include/asm-x86_64/kexec.h b/include/asm-x86_64/kexec.h index 42d2ff15c592..ae28cd44bcd3 100644 --- a/include/asm-x86_64/kexec.h +++ b/include/asm-x86_64/kexec.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <asm/page.h> | 4 | #include <asm/page.h> |
5 | #include <asm/proto.h> | 5 | #include <asm/proto.h> |
6 | #include <asm/ptrace.h> | ||
6 | 7 | ||
7 | /* | 8 | /* |
8 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | 9 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. |
@@ -26,8 +27,40 @@ | |||
26 | #define KEXEC_ARCH KEXEC_ARCH_X86_64 | 27 | #define KEXEC_ARCH KEXEC_ARCH_X86_64 |
27 | 28 | ||
28 | #define MAX_NOTE_BYTES 1024 | 29 | #define MAX_NOTE_BYTES 1024 |
29 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
30 | 30 | ||
31 | extern note_buf_t crash_notes[]; | 31 | /* |
32 | * Saving the registers of the cpu on which panic occured in | ||
33 | * crash_kexec to save a valid sp. The registers of other cpus | ||
34 | * will be saved in machine_crash_shutdown while shooting down them. | ||
35 | */ | ||
36 | |||
37 | static inline void crash_setup_regs(struct pt_regs *newregs, | ||
38 | struct pt_regs *oldregs) | ||
39 | { | ||
40 | if (oldregs) | ||
41 | memcpy(newregs, oldregs, sizeof(*newregs)); | ||
42 | else { | ||
43 | __asm__ __volatile__("movq %%rbx,%0" : "=m"(newregs->rbx)); | ||
44 | __asm__ __volatile__("movq %%rcx,%0" : "=m"(newregs->rcx)); | ||
45 | __asm__ __volatile__("movq %%rdx,%0" : "=m"(newregs->rdx)); | ||
46 | __asm__ __volatile__("movq %%rsi,%0" : "=m"(newregs->rsi)); | ||
47 | __asm__ __volatile__("movq %%rdi,%0" : "=m"(newregs->rdi)); | ||
48 | __asm__ __volatile__("movq %%rbp,%0" : "=m"(newregs->rbp)); | ||
49 | __asm__ __volatile__("movq %%rax,%0" : "=m"(newregs->rax)); | ||
50 | __asm__ __volatile__("movq %%rsp,%0" : "=m"(newregs->rsp)); | ||
51 | __asm__ __volatile__("movq %%r8,%0" : "=m"(newregs->r8)); | ||
52 | __asm__ __volatile__("movq %%r9,%0" : "=m"(newregs->r9)); | ||
53 | __asm__ __volatile__("movq %%r10,%0" : "=m"(newregs->r10)); | ||
54 | __asm__ __volatile__("movq %%r11,%0" : "=m"(newregs->r11)); | ||
55 | __asm__ __volatile__("movq %%r12,%0" : "=m"(newregs->r12)); | ||
56 | __asm__ __volatile__("movq %%r13,%0" : "=m"(newregs->r13)); | ||
57 | __asm__ __volatile__("movq %%r14,%0" : "=m"(newregs->r14)); | ||
58 | __asm__ __volatile__("movq %%r15,%0" : "=m"(newregs->r15)); | ||
59 | __asm__ __volatile__("movl %%ss, %%eax;" :"=a"(newregs->ss)); | ||
60 | __asm__ __volatile__("movl %%cs, %%eax;" :"=a"(newregs->cs)); | ||
61 | __asm__ __volatile__("pushfq; popq %0" :"=m"(newregs->eflags)); | ||
32 | 62 | ||
63 | newregs->rip = (unsigned long)current_text_addr(); | ||
64 | } | ||
65 | } | ||
33 | #endif /* _X86_64_KEXEC_H */ | 66 | #endif /* _X86_64_KEXEC_H */ |
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h index 4dd7a7e148d4..98a1e95ddb98 100644 --- a/include/asm-x86_64/kprobes.h +++ b/include/asm-x86_64/kprobes.h | |||
@@ -27,7 +27,10 @@ | |||
27 | #include <linux/ptrace.h> | 27 | #include <linux/ptrace.h> |
28 | #include <linux/percpu.h> | 28 | #include <linux/percpu.h> |
29 | 29 | ||
30 | #define __ARCH_WANT_KPROBES_INSN_SLOT | ||
31 | |||
30 | struct pt_regs; | 32 | struct pt_regs; |
33 | struct kprobe; | ||
31 | 34 | ||
32 | typedef u8 kprobe_opcode_t; | 35 | typedef u8 kprobe_opcode_t; |
33 | #define BREAKPOINT_INSTRUCTION 0xcc | 36 | #define BREAKPOINT_INSTRUCTION 0xcc |
@@ -42,6 +45,7 @@ typedef u8 kprobe_opcode_t; | |||
42 | #define ARCH_SUPPORTS_KRETPROBES | 45 | #define ARCH_SUPPORTS_KRETPROBES |
43 | 46 | ||
44 | void kretprobe_trampoline(void); | 47 | void kretprobe_trampoline(void); |
48 | extern void arch_remove_kprobe(struct kprobe *p); | ||
45 | 49 | ||
46 | /* Architecture specific copy of original instruction*/ | 50 | /* Architecture specific copy of original instruction*/ |
47 | struct arch_specific_insn { | 51 | struct arch_specific_insn { |
diff --git a/include/asm-xtensa/ioctl.h b/include/asm-xtensa/ioctl.h index 856c605d62b1..b279fe06dfe5 100644 --- a/include/asm-xtensa/ioctl.h +++ b/include/asm-xtensa/ioctl.h | |||
@@ -1,83 +1 @@ | |||
1 | /* | #include <asm-generic/ioctl.h> | |
2 | * include/asm-xtensa/ioctl.h | ||
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 | * Copyright (C) 2003 - 2005 Tensilica Inc. | ||
9 | * | ||
10 | * Derived from "include/asm-i386/ioctl.h" | ||
11 | */ | ||
12 | |||
13 | #ifndef _XTENSA_IOCTL_H | ||
14 | #define _XTENSA_IOCTL_H | ||
15 | |||
16 | |||
17 | /* ioctl command encoding: 32 bits total, command in lower 16 bits, | ||
18 | * size of the parameter structure in the lower 14 bits of the | ||
19 | * upper 16 bits. | ||
20 | * Encoding the size of the parameter structure in the ioctl request | ||
21 | * is useful for catching programs compiled with old versions | ||
22 | * and to avoid overwriting user space outside the user buffer area. | ||
23 | * The highest 2 bits are reserved for indicating the ``access mode''. | ||
24 | * NOTE: This limits the max parameter size to 16kB -1 ! | ||
25 | */ | ||
26 | |||
27 | /* | ||
28 | * The following is for compatibility across the various Linux | ||
29 | * platforms. The i386 ioctl numbering scheme doesn't really enforce | ||
30 | * a type field. De facto, however, the top 8 bits of the lower 16 | ||
31 | * bits are indeed used as a type field, so we might just as well make | ||
32 | * this explicit here. Please be sure to use the decoding macros | ||
33 | * below from now on. | ||
34 | */ | ||
35 | #define _IOC_NRBITS 8 | ||
36 | #define _IOC_TYPEBITS 8 | ||
37 | #define _IOC_SIZEBITS 14 | ||
38 | #define _IOC_DIRBITS 2 | ||
39 | |||
40 | #define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) | ||
41 | #define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) | ||
42 | #define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) | ||
43 | #define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) | ||
44 | |||
45 | #define _IOC_NRSHIFT 0 | ||
46 | #define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) | ||
47 | #define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) | ||
48 | #define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) | ||
49 | |||
50 | /* | ||
51 | * Direction bits. | ||
52 | */ | ||
53 | #define _IOC_NONE 0U | ||
54 | #define _IOC_WRITE 1U | ||
55 | #define _IOC_READ 2U | ||
56 | |||
57 | #define _IOC(dir,type,nr,size) \ | ||
58 | (((dir) << _IOC_DIRSHIFT) | \ | ||
59 | ((type) << _IOC_TYPESHIFT) | \ | ||
60 | ((nr) << _IOC_NRSHIFT) | \ | ||
61 | ((size) << _IOC_SIZESHIFT)) | ||
62 | |||
63 | /* used to create numbers */ | ||
64 | #define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) | ||
65 | #define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) | ||
66 | #define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) | ||
67 | #define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) | ||
68 | |||
69 | /* used to decode ioctl numbers.. */ | ||
70 | #define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) | ||
71 | #define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) | ||
72 | #define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) | ||
73 | #define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) | ||
74 | |||
75 | /* ...and for the drivers/sound files... */ | ||
76 | |||
77 | #define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) | ||
78 | #define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) | ||
79 | #define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) | ||
80 | #define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) | ||
81 | #define IOCSIZE_SHIFT (_IOC_SIZESHIFT) | ||
82 | |||
83 | #endif | ||
diff --git a/include/linux/calc64.h b/include/linux/calc64.h new file mode 100644 index 000000000000..ebf4b8f38d88 --- /dev/null +++ b/include/linux/calc64.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _LINUX_CALC64_H | ||
2 | #define _LINUX_CALC64_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <asm/div64.h> | ||
6 | |||
7 | /* | ||
8 | * This is a generic macro which is used when the architecture | ||
9 | * specific div64.h does not provide a optimized one. | ||
10 | * | ||
11 | * The 64bit dividend is divided by the divisor (data type long), the | ||
12 | * result is returned and the remainder stored in the variable | ||
13 | * referenced by remainder (data type long *). In contrast to the | ||
14 | * do_div macro the dividend is kept intact. | ||
15 | */ | ||
16 | #ifndef div_long_long_rem | ||
17 | #define div_long_long_rem(dividend, divisor, remainder) \ | ||
18 | do_div_llr((dividend), divisor, remainder) | ||
19 | |||
20 | static inline unsigned long do_div_llr(const long long dividend, | ||
21 | const long divisor, long *remainder) | ||
22 | { | ||
23 | u64 result = dividend; | ||
24 | |||
25 | *(remainder) = do_div(result, divisor); | ||
26 | return (unsigned long) result; | ||
27 | } | ||
28 | #endif | ||
29 | |||
30 | /* | ||
31 | * Sign aware variation of the above. On some architectures a | ||
32 | * negative dividend leads to an divide overflow exception, which | ||
33 | * is avoided by the sign check. | ||
34 | */ | ||
35 | static inline long div_long_long_rem_signed(const long long dividend, | ||
36 | const long divisor, long *remainder) | ||
37 | { | ||
38 | long res; | ||
39 | |||
40 | if (unlikely(dividend < 0)) { | ||
41 | res = -div_long_long_rem(-dividend, divisor, remainder); | ||
42 | *remainder = -(*remainder); | ||
43 | } else | ||
44 | res = div_long_long_rem(dividend, divisor, remainder); | ||
45 | |||
46 | return res; | ||
47 | } | ||
48 | |||
49 | #endif | ||
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h index 339878952f12..8fad50f8e389 100644 --- a/include/linux/compat_ioctl.h +++ b/include/linux/compat_ioctl.h | |||
@@ -2,14 +2,6 @@ | |||
2 | * compatible types passed or none at all... Please include | 2 | * compatible types passed or none at all... Please include |
3 | * only stuff that is compatible on *all architectures*. | 3 | * only stuff that is compatible on *all architectures*. |
4 | */ | 4 | */ |
5 | #ifndef COMPATIBLE_IOCTL /* pointer to compatible structure or no argument */ | ||
6 | #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl) | ||
7 | #endif | ||
8 | |||
9 | #ifndef ULONG_IOCTL /* argument is an unsigned long integer, not a pointer */ | ||
10 | #define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl) | ||
11 | #endif | ||
12 | |||
13 | 5 | ||
14 | COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ | 6 | COMPATIBLE_IOCTL(0x4B50) /* KDGHWCLK - not in the kernel, but don't complain */ |
15 | COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ | 7 | COMPATIBLE_IOCTL(0x4B51) /* KDSHWCLK - not in the kernel, but don't complain */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 92ae3e2067b0..d1e370d25f7b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -114,8 +114,7 @@ extern int dir_notify_enable; | |||
114 | /* | 114 | /* |
115 | * Superblock flags that can be altered by MS_REMOUNT | 115 | * Superblock flags that can be altered by MS_REMOUNT |
116 | */ | 116 | */ |
117 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\ | 117 | #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK) |
118 | MS_NODIRATIME) | ||
119 | 118 | ||
120 | /* | 119 | /* |
121 | * Old magic mount flag and mask | 120 | * Old magic mount flag and mask |
@@ -161,8 +160,6 @@ extern int dir_notify_enable; | |||
161 | #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) | 160 | #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) |
162 | #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) | 161 | #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) |
163 | #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) | 162 | #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) |
164 | #define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME)) | ||
165 | #define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME) | ||
166 | #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) | 163 | #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL) |
167 | 164 | ||
168 | #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) | 165 | #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD) |
@@ -235,9 +232,6 @@ struct kstatfs; | |||
235 | struct vm_area_struct; | 232 | struct vm_area_struct; |
236 | struct vfsmount; | 233 | struct vfsmount; |
237 | 234 | ||
238 | /* Used to be a macro which just called the function, now just a function */ | ||
239 | extern void update_atime (struct inode *); | ||
240 | |||
241 | extern void __init inode_init(unsigned long); | 235 | extern void __init inode_init(unsigned long); |
242 | extern void __init inode_init_early(void); | 236 | extern void __init inode_init_early(void); |
243 | extern void __init mnt_init(unsigned long); | 237 | extern void __init mnt_init(unsigned long); |
@@ -1118,12 +1112,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode) | |||
1118 | __mark_inode_dirty(inode, I_DIRTY_SYNC); | 1112 | __mark_inode_dirty(inode, I_DIRTY_SYNC); |
1119 | } | 1113 | } |
1120 | 1114 | ||
1121 | static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry) | 1115 | extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); |
1122 | { | ||
1123 | /* per-mountpoint checks will go here */ | ||
1124 | update_atime(dentry->d_inode); | ||
1125 | } | ||
1126 | |||
1127 | static inline void file_accessed(struct file *file) | 1116 | static inline void file_accessed(struct file *file) |
1128 | { | 1117 | { |
1129 | if (!(file->f_flags & O_NOATIME)) | 1118 | if (!(file->f_flags & O_NOATIME)) |
@@ -1716,7 +1705,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo | |||
1716 | extern int inode_change_ok(struct inode *, struct iattr *); | 1705 | extern int inode_change_ok(struct inode *, struct iattr *); |
1717 | extern int __must_check inode_setattr(struct inode *, struct iattr *); | 1706 | extern int __must_check inode_setattr(struct inode *, struct iattr *); |
1718 | 1707 | ||
1719 | extern void inode_update_time(struct inode *inode, int ctime_too); | 1708 | extern void file_update_time(struct file *file); |
1720 | 1709 | ||
1721 | static inline ino_t parent_ino(struct dentry *dentry) | 1710 | static inline ino_t parent_ino(struct dentry *dentry) |
1722 | { | 1711 | { |
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h new file mode 100644 index 000000000000..cf5cfdf8d613 --- /dev/null +++ b/include/linux/hrtimer.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * include/linux/hrtimer.h | ||
3 | * | ||
4 | * hrtimers - High-resolution kernel timers | ||
5 | * | ||
6 | * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de> | ||
7 | * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar | ||
8 | * | ||
9 | * data type definitions, declarations, prototypes | ||
10 | * | ||
11 | * Started by: Thomas Gleixner and Ingo Molnar | ||
12 | * | ||
13 | * For licencing details see kernel-base/COPYING | ||
14 | */ | ||
15 | #ifndef _LINUX_HRTIMER_H | ||
16 | #define _LINUX_HRTIMER_H | ||
17 | |||
18 | #include <linux/rbtree.h> | ||
19 | #include <linux/ktime.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/list.h> | ||
22 | #include <linux/wait.h> | ||
23 | |||
24 | /* | ||
25 | * Mode arguments of xxx_hrtimer functions: | ||
26 | */ | ||
27 | enum hrtimer_mode { | ||
28 | HRTIMER_ABS, /* Time value is absolute */ | ||
29 | HRTIMER_REL, /* Time value is relative to now */ | ||
30 | }; | ||
31 | |||
32 | enum hrtimer_restart { | ||
33 | HRTIMER_NORESTART, | ||
34 | HRTIMER_RESTART, | ||
35 | }; | ||
36 | |||
37 | /* | ||
38 | * Timer states: | ||
39 | */ | ||
40 | enum hrtimer_state { | ||
41 | HRTIMER_INACTIVE, /* Timer is inactive */ | ||
42 | HRTIMER_EXPIRED, /* Timer is expired */ | ||
43 | HRTIMER_PENDING, /* Timer is pending */ | ||
44 | }; | ||
45 | |||
46 | struct hrtimer_base; | ||
47 | |||
48 | /** | ||
49 | * struct hrtimer - the basic hrtimer structure | ||
50 | * | ||
51 | * @node: red black tree node for time ordered insertion | ||
52 | * @list: list head for easier access to the time ordered list, | ||
53 | * without walking the red black tree. | ||
54 | * @expires: the absolute expiry time in the hrtimers internal | ||
55 | * representation. The time is related to the clock on | ||
56 | * which the timer is based. | ||
57 | * @state: state of the timer | ||
58 | * @function: timer expiry callback function | ||
59 | * @data: argument for the callback function | ||
60 | * @base: pointer to the timer base (per cpu and per clock) | ||
61 | * | ||
62 | * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() | ||
63 | */ | ||
64 | struct hrtimer { | ||
65 | struct rb_node node; | ||
66 | struct list_head list; | ||
67 | ktime_t expires; | ||
68 | enum hrtimer_state state; | ||
69 | int (*function)(void *); | ||
70 | void *data; | ||
71 | struct hrtimer_base *base; | ||
72 | }; | ||
73 | |||
74 | /** | ||
75 | * struct hrtimer_base - the timer base for a specific clock | ||
76 | * | ||
77 | * @index: clock type index for per_cpu support when moving a timer | ||
78 | * to a base on another cpu. | ||
79 | * @lock: lock protecting the base and associated timers | ||
80 | * @active: red black tree root node for the active timers | ||
81 | * @pending: list of pending timers for simple time ordered access | ||
82 | * @resolution: the resolution of the clock, in nanoseconds | ||
83 | * @get_time: function to retrieve the current time of the clock | ||
84 | * @curr_timer: the timer which is executing a callback right now | ||
85 | */ | ||
86 | struct hrtimer_base { | ||
87 | clockid_t index; | ||
88 | spinlock_t lock; | ||
89 | struct rb_root active; | ||
90 | struct list_head pending; | ||
91 | unsigned long resolution; | ||
92 | ktime_t (*get_time)(void); | ||
93 | struct hrtimer *curr_timer; | ||
94 | }; | ||
95 | |||
96 | /* | ||
97 | * clock_was_set() is a NOP for non- high-resolution systems. The | ||
98 | * time-sorted order guarantees that a timer does not expire early and | ||
99 | * is expired in the next softirq when the clock was advanced. | ||
100 | */ | ||
101 | #define clock_was_set() do { } while (0) | ||
102 | |||
103 | /* Exported timer functions: */ | ||
104 | |||
105 | /* Initialize timers: */ | ||
106 | extern void hrtimer_init(struct hrtimer *timer, const clockid_t which_clock); | ||
107 | extern void hrtimer_rebase(struct hrtimer *timer, const clockid_t which_clock); | ||
108 | |||
109 | |||
110 | /* Basic timer operations: */ | ||
111 | extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, | ||
112 | const enum hrtimer_mode mode); | ||
113 | extern int hrtimer_cancel(struct hrtimer *timer); | ||
114 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); | ||
115 | |||
116 | #define hrtimer_restart(timer) hrtimer_start((timer), (timer)->expires, HRTIMER_ABS) | ||
117 | |||
118 | /* Query timers: */ | ||
119 | extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer); | ||
120 | extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp); | ||
121 | |||
122 | static inline int hrtimer_active(const struct hrtimer *timer) | ||
123 | { | ||
124 | return timer->state == HRTIMER_PENDING; | ||
125 | } | ||
126 | |||
127 | /* Forward a hrtimer so it expires after now: */ | ||
128 | extern unsigned long hrtimer_forward(struct hrtimer *timer, | ||
129 | const ktime_t interval); | ||
130 | |||
131 | /* Precise sleep: */ | ||
132 | extern long hrtimer_nanosleep(struct timespec *rqtp, | ||
133 | struct timespec __user *rmtp, | ||
134 | const enum hrtimer_mode mode, | ||
135 | const clockid_t clockid); | ||
136 | |||
137 | /* Soft interrupt function to run the hrtimer queues: */ | ||
138 | extern void hrtimer_run_queues(void); | ||
139 | |||
140 | /* Bootup initialization: */ | ||
141 | extern void __init hrtimers_init(void); | ||
142 | |||
143 | #endif | ||
diff --git a/include/linux/isicom.h b/include/linux/isicom.h index 7c6eae7f6ed7..45b3d48f0978 100644 --- a/include/linux/isicom.h +++ b/include/linux/isicom.h | |||
@@ -4,47 +4,12 @@ | |||
4 | /*#define ISICOM_DEBUG*/ | 4 | /*#define ISICOM_DEBUG*/ |
5 | /*#define ISICOM_DEBUG_DTR_RTS*/ | 5 | /*#define ISICOM_DEBUG_DTR_RTS*/ |
6 | 6 | ||
7 | |||
8 | /* | ||
9 | * Firmware Loader definitions ... | ||
10 | */ | ||
11 | |||
12 | #define __MultiTech ('M'<<8) | ||
13 | #define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01) | ||
14 | #define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02) | ||
15 | #define MIOCTL_XFER_CTRL (__MultiTech | 0x03) | ||
16 | #define MIOCTL_RESET_CARD (__MultiTech | 0x04) | ||
17 | |||
18 | #define DATA_SIZE 16 | ||
19 | |||
20 | typedef struct { | ||
21 | unsigned short exec_segment; | ||
22 | unsigned short exec_addr; | ||
23 | } exec_record; | ||
24 | |||
25 | typedef struct { | ||
26 | int board; /* Board to load */ | ||
27 | unsigned short addr; | ||
28 | unsigned short count; | ||
29 | } bin_header; | ||
30 | |||
31 | typedef struct { | ||
32 | int board; /* Board to load */ | ||
33 | unsigned short addr; | ||
34 | unsigned short count; | ||
35 | unsigned short segment; | ||
36 | unsigned char bin_data[DATA_SIZE]; | ||
37 | } bin_frame; | ||
38 | |||
39 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
40 | 8 | ||
41 | #define YES 1 | 9 | #define YES 1 |
42 | #define NO 0 | 10 | #define NO 0 |
43 | 11 | ||
44 | #define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ | 12 | /* |
45 | #define ISILOAD_NAME "ISILoad" | ||
46 | |||
47 | /* | ||
48 | * ISICOM Driver definitions ... | 13 | * ISICOM Driver definitions ... |
49 | * | 14 | * |
50 | */ | 15 | */ |
@@ -55,8 +20,8 @@ typedef struct { | |||
55 | * PCI definitions | 20 | * PCI definitions |
56 | */ | 21 | */ |
57 | 22 | ||
58 | #define DEVID_COUNT 9 | 23 | #define DEVID_COUNT 9 |
59 | #define VENDOR_ID 0x10b5 | 24 | #define VENDOR_ID 0x10b5 |
60 | 25 | ||
61 | /* | 26 | /* |
62 | * These are now officially allocated numbers | 27 | * These are now officially allocated numbers |
@@ -66,9 +31,9 @@ typedef struct { | |||
66 | #define ISICOM_CMAJOR 113 /* callout */ | 31 | #define ISICOM_CMAJOR 113 /* callout */ |
67 | #define ISICOM_MAGIC (('M' << 8) | 'T') | 32 | #define ISICOM_MAGIC (('M' << 8) | 'T') |
68 | 33 | ||
69 | #define WAKEUP_CHARS 256 /* hard coded for now */ | 34 | #define WAKEUP_CHARS 256 /* hard coded for now */ |
70 | #define TX_SIZE 254 | 35 | #define TX_SIZE 254 |
71 | 36 | ||
72 | #define BOARD_COUNT 4 | 37 | #define BOARD_COUNT 4 |
73 | #define PORT_COUNT (BOARD_COUNT*16) | 38 | #define PORT_COUNT (BOARD_COUNT*16) |
74 | 39 | ||
@@ -98,18 +63,15 @@ typedef struct { | |||
98 | #define ISICOM_INITIATE_XONXOFF 0x04 | 63 | #define ISICOM_INITIATE_XONXOFF 0x04 |
99 | #define ISICOM_RESPOND_XONXOFF 0x08 | 64 | #define ISICOM_RESPOND_XONXOFF 0x08 |
100 | 65 | ||
101 | #define InterruptTheCard(base) (outw(0,(base)+0xc)) | ||
102 | #define ClearInterrupt(base) (inw((base)+0x0a)) | ||
103 | |||
104 | #define BOARD(line) (((line) >> 4) & 0x3) | 66 | #define BOARD(line) (((line) >> 4) & 0x3) |
105 | 67 | ||
106 | /* isi kill queue bitmap */ | 68 | /* isi kill queue bitmap */ |
107 | 69 | ||
108 | #define ISICOM_KILLTX 0x01 | 70 | #define ISICOM_KILLTX 0x01 |
109 | #define ISICOM_KILLRX 0x02 | 71 | #define ISICOM_KILLRX 0x02 |
110 | 72 | ||
111 | /* isi_board status bitmap */ | 73 | /* isi_board status bitmap */ |
112 | 74 | ||
113 | #define FIRMWARE_LOADED 0x0001 | 75 | #define FIRMWARE_LOADED 0x0001 |
114 | #define BOARD_ACTIVE 0x0002 | 76 | #define BOARD_ACTIVE 0x0002 |
115 | 77 | ||
@@ -123,9 +85,8 @@ typedef struct { | |||
123 | #define ISI_RTS 0x0200 | 85 | #define ISI_RTS 0x0200 |
124 | 86 | ||
125 | 87 | ||
126 | #define ISI_TXOK 0x0001 | 88 | #define ISI_TXOK 0x0001 |
127 | 89 | ||
128 | #endif /* __KERNEL__ */ | 90 | #endif /* __KERNEL__ */ |
129 | 91 | ||
130 | #endif /* ISICOM_H */ | 92 | #endif /* ISICOM_H */ |
131 | |||
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 6acfdbba734b..99905e180532 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h | |||
@@ -1,21 +1,12 @@ | |||
1 | #ifndef _LINUX_JIFFIES_H | 1 | #ifndef _LINUX_JIFFIES_H |
2 | #define _LINUX_JIFFIES_H | 2 | #define _LINUX_JIFFIES_H |
3 | 3 | ||
4 | #include <linux/calc64.h> | ||
4 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
5 | #include <linux/types.h> | 6 | #include <linux/types.h> |
6 | #include <linux/time.h> | 7 | #include <linux/time.h> |
7 | #include <linux/timex.h> | 8 | #include <linux/timex.h> |
8 | #include <asm/param.h> /* for HZ */ | 9 | #include <asm/param.h> /* for HZ */ |
9 | #include <asm/div64.h> | ||
10 | |||
11 | #ifndef div_long_long_rem | ||
12 | #define div_long_long_rem(dividend,divisor,remainder) \ | ||
13 | ({ \ | ||
14 | u64 result = dividend; \ | ||
15 | *remainder = do_div(result,divisor); \ | ||
16 | result; \ | ||
17 | }) | ||
18 | #endif | ||
19 | 10 | ||
20 | /* | 11 | /* |
21 | * The following defines establish the engineering parameters of the PLL | 12 | * The following defines establish the engineering parameters of the PLL |
@@ -373,8 +364,11 @@ jiffies_to_timeval(const unsigned long jiffies, struct timeval *value) | |||
373 | * one divide. | 364 | * one divide. |
374 | */ | 365 | */ |
375 | u64 nsec = (u64)jiffies * TICK_NSEC; | 366 | u64 nsec = (u64)jiffies * TICK_NSEC; |
376 | value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &value->tv_usec); | 367 | long tv_usec; |
377 | value->tv_usec /= NSEC_PER_USEC; | 368 | |
369 | value->tv_sec = div_long_long_rem(nsec, NSEC_PER_SEC, &tv_usec); | ||
370 | tv_usec /= NSEC_PER_USEC; | ||
371 | value->tv_usec = tv_usec; | ||
378 | } | 372 | } |
379 | 373 | ||
380 | /* | 374 | /* |
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h index 7428198111eb..45f625d7d0b2 100644 --- a/include/linux/kbd_kern.h +++ b/include/linux/kbd_kern.h | |||
@@ -151,7 +151,7 @@ extern unsigned int keymap_count; | |||
151 | 151 | ||
152 | static inline void con_schedule_flip(struct tty_struct *t) | 152 | static inline void con_schedule_flip(struct tty_struct *t) |
153 | { | 153 | { |
154 | schedule_work(&t->flip.work); | 154 | schedule_work(&t->buf.work); |
155 | } | 155 | } |
156 | 156 | ||
157 | #endif | 157 | #endif |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d0e6ca3b00ef..e6ee2d95da7a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -47,6 +47,8 @@ extern int console_printk[]; | |||
47 | #define default_console_loglevel (console_printk[3]) | 47 | #define default_console_loglevel (console_printk[3]) |
48 | 48 | ||
49 | struct completion; | 49 | struct completion; |
50 | struct pt_regs; | ||
51 | struct user; | ||
50 | 52 | ||
51 | /** | 53 | /** |
52 | * might_sleep - annotation for functions that can sleep | 54 | * might_sleep - annotation for functions that can sleep |
@@ -123,6 +125,8 @@ extern int __kernel_text_address(unsigned long addr); | |||
123 | extern int kernel_text_address(unsigned long addr); | 125 | extern int kernel_text_address(unsigned long addr); |
124 | extern int session_of_pgrp(int pgrp); | 126 | extern int session_of_pgrp(int pgrp); |
125 | 127 | ||
128 | extern void dump_thread(struct pt_regs *regs, struct user *dump); | ||
129 | |||
126 | #ifdef CONFIG_PRINTK | 130 | #ifdef CONFIG_PRINTK |
127 | asmlinkage int vprintk(const char *fmt, va_list args) | 131 | asmlinkage int vprintk(const char *fmt, va_list args) |
128 | __attribute__ ((format (printf, 1, 0))); | 132 | __attribute__ ((format (printf, 1, 0))); |
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index c8468472aec0..94abc07cb164 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
@@ -41,7 +41,7 @@ typedef unsigned long kimage_entry_t; | |||
41 | #define IND_DONE 0x4 | 41 | #define IND_DONE 0x4 |
42 | #define IND_SOURCE 0x8 | 42 | #define IND_SOURCE 0x8 |
43 | 43 | ||
44 | #define KEXEC_SEGMENT_MAX 8 | 44 | #define KEXEC_SEGMENT_MAX 16 |
45 | struct kexec_segment { | 45 | struct kexec_segment { |
46 | void __user *buf; | 46 | void __user *buf; |
47 | size_t bufsz; | 47 | size_t bufsz; |
@@ -125,6 +125,8 @@ extern struct kimage *kexec_image; | |||
125 | /* Location of a reserved region to hold the crash kernel. | 125 | /* Location of a reserved region to hold the crash kernel. |
126 | */ | 126 | */ |
127 | extern struct resource crashk_res; | 127 | extern struct resource crashk_res; |
128 | typedef u32 note_buf_t[MAX_NOTE_BYTES/4]; | ||
129 | extern note_buf_t *crash_notes; | ||
128 | 130 | ||
129 | #else /* !CONFIG_KEXEC */ | 131 | #else /* !CONFIG_KEXEC */ |
130 | struct pt_regs; | 132 | struct pt_regs; |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index c03f2dc933de..10005bc92a31 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -149,11 +149,10 @@ struct kretprobe_instance { | |||
149 | }; | 149 | }; |
150 | 150 | ||
151 | extern spinlock_t kretprobe_lock; | 151 | extern spinlock_t kretprobe_lock; |
152 | extern struct semaphore kprobe_mutex; | ||
152 | extern int arch_prepare_kprobe(struct kprobe *p); | 153 | extern int arch_prepare_kprobe(struct kprobe *p); |
153 | extern void arch_copy_kprobe(struct kprobe *p); | ||
154 | extern void arch_arm_kprobe(struct kprobe *p); | 154 | extern void arch_arm_kprobe(struct kprobe *p); |
155 | extern void arch_disarm_kprobe(struct kprobe *p); | 155 | extern void arch_disarm_kprobe(struct kprobe *p); |
156 | extern void arch_remove_kprobe(struct kprobe *p); | ||
157 | extern int arch_init_kprobes(void); | 156 | extern int arch_init_kprobes(void); |
158 | extern void show_registers(struct pt_regs *regs); | 157 | extern void show_registers(struct pt_regs *regs); |
159 | extern kprobe_opcode_t *get_insn_slot(void); | 158 | extern kprobe_opcode_t *get_insn_slot(void); |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h new file mode 100644 index 000000000000..222a047cc145 --- /dev/null +++ b/include/linux/ktime.h | |||
@@ -0,0 +1,284 @@ | |||
1 | /* | ||
2 | * include/linux/ktime.h | ||
3 | * | ||
4 | * ktime_t - nanosecond-resolution time format. | ||
5 | * | ||
6 | * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de> | ||
7 | * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar | ||
8 | * | ||
9 | * data type definitions, declarations, prototypes and macros. | ||
10 | * | ||
11 | * Started by: Thomas Gleixner and Ingo Molnar | ||
12 | * | ||
13 | * For licencing details see kernel-base/COPYING | ||
14 | */ | ||
15 | #ifndef _LINUX_KTIME_H | ||
16 | #define _LINUX_KTIME_H | ||
17 | |||
18 | #include <linux/time.h> | ||
19 | #include <linux/jiffies.h> | ||
20 | |||
21 | /* | ||
22 | * ktime_t: | ||
23 | * | ||
24 | * On 64-bit CPUs a single 64-bit variable is used to store the hrtimers | ||
25 | * internal representation of time values in scalar nanoseconds. The | ||
26 | * design plays out best on 64-bit CPUs, where most conversions are | ||
27 | * NOPs and most arithmetic ktime_t operations are plain arithmetic | ||
28 | * operations. | ||
29 | * | ||
30 | * On 32-bit CPUs an optimized representation of the timespec structure | ||
31 | * is used to avoid expensive conversions from and to timespecs. The | ||
32 | * endian-aware order of the tv struct members is choosen to allow | ||
33 | * mathematical operations on the tv64 member of the union too, which | ||
34 | * for certain operations produces better code. | ||
35 | * | ||
36 | * For architectures with efficient support for 64/32-bit conversions the | ||
37 | * plain scalar nanosecond based representation can be selected by the | ||
38 | * config switch CONFIG_KTIME_SCALAR. | ||
39 | */ | ||
40 | typedef union { | ||
41 | s64 tv64; | ||
42 | #if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR) | ||
43 | struct { | ||
44 | # ifdef __BIG_ENDIAN | ||
45 | s32 sec, nsec; | ||
46 | # else | ||
47 | s32 nsec, sec; | ||
48 | # endif | ||
49 | } tv; | ||
50 | #endif | ||
51 | } ktime_t; | ||
52 | |||
53 | #define KTIME_MAX (~((u64)1 << 63)) | ||
54 | |||
55 | /* | ||
56 | * ktime_t definitions when using the 64-bit scalar representation: | ||
57 | */ | ||
58 | |||
59 | #if (BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR) | ||
60 | |||
61 | /* Define a ktime_t variable and initialize it to zero: */ | ||
62 | #define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 } | ||
63 | |||
64 | /** | ||
65 | * ktime_set - Set a ktime_t variable from a seconds/nanoseconds value | ||
66 | * | ||
67 | * @secs: seconds to set | ||
68 | * @nsecs: nanoseconds to set | ||
69 | * | ||
70 | * Return the ktime_t representation of the value | ||
71 | */ | ||
72 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | ||
73 | { | ||
74 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; | ||
75 | } | ||
76 | |||
77 | /* Subtract two ktime_t variables. rem = lhs -rhs: */ | ||
78 | #define ktime_sub(lhs, rhs) \ | ||
79 | ({ (ktime_t){ .tv64 = (lhs).tv64 - (rhs).tv64 }; }) | ||
80 | |||
81 | /* Add two ktime_t variables. res = lhs + rhs: */ | ||
82 | #define ktime_add(lhs, rhs) \ | ||
83 | ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; }) | ||
84 | |||
85 | /* | ||
86 | * Add a ktime_t variable and a scalar nanosecond value. | ||
87 | * res = kt + nsval: | ||
88 | */ | ||
89 | #define ktime_add_ns(kt, nsval) \ | ||
90 | ({ (ktime_t){ .tv64 = (kt).tv64 + (nsval) }; }) | ||
91 | |||
92 | /* convert a timespec to ktime_t format: */ | ||
93 | #define timespec_to_ktime(ts) ktime_set((ts).tv_sec, (ts).tv_nsec) | ||
94 | |||
95 | /* convert a timeval to ktime_t format: */ | ||
96 | #define timeval_to_ktime(tv) ktime_set((tv).tv_sec, (tv).tv_usec * 1000) | ||
97 | |||
98 | /* Map the ktime_t to timespec conversion to ns_to_timespec function */ | ||
99 | #define ktime_to_timespec(kt) ns_to_timespec((kt).tv64) | ||
100 | |||
101 | /* Map the ktime_t to timeval conversion to ns_to_timeval function */ | ||
102 | #define ktime_to_timeval(kt) ns_to_timeval((kt).tv64) | ||
103 | |||
104 | /* Map the ktime_t to clock_t conversion to the inline in jiffies.h: */ | ||
105 | #define ktime_to_clock_t(kt) nsec_to_clock_t((kt).tv64) | ||
106 | |||
107 | /* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ | ||
108 | #define ktime_to_ns(kt) ((kt).tv64) | ||
109 | |||
110 | #else | ||
111 | |||
112 | /* | ||
113 | * Helper macros/inlines to get the ktime_t math right in the timespec | ||
114 | * representation. The macros are sometimes ugly - their actual use is | ||
115 | * pretty okay-ish, given the circumstances. We do all this for | ||
116 | * performance reasons. The pure scalar nsec_t based code was nice and | ||
117 | * simple, but created too many 64-bit / 32-bit conversions and divisions. | ||
118 | * | ||
119 | * Be especially aware that negative values are represented in a way | ||
120 | * that the tv.sec field is negative and the tv.nsec field is greater | ||
121 | * or equal to zero but less than nanoseconds per second. This is the | ||
122 | * same representation which is used by timespecs. | ||
123 | * | ||
124 | * tv.sec < 0 and 0 >= tv.nsec < NSEC_PER_SEC | ||
125 | */ | ||
126 | |||
127 | /* Define a ktime_t variable and initialize it to zero: */ | ||
128 | #define DEFINE_KTIME(kt) ktime_t kt = { .tv64 = 0 } | ||
129 | |||
130 | /* Set a ktime_t variable to a value in sec/nsec representation: */ | ||
131 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | ||
132 | { | ||
133 | return (ktime_t) { .tv = { .sec = secs, .nsec = nsecs } }; | ||
134 | } | ||
135 | |||
136 | /** | ||
137 | * ktime_sub - subtract two ktime_t variables | ||
138 | * | ||
139 | * @lhs: minuend | ||
140 | * @rhs: subtrahend | ||
141 | * | ||
142 | * Returns the remainder of the substraction | ||
143 | */ | ||
144 | static inline ktime_t ktime_sub(const ktime_t lhs, const ktime_t rhs) | ||
145 | { | ||
146 | ktime_t res; | ||
147 | |||
148 | res.tv64 = lhs.tv64 - rhs.tv64; | ||
149 | if (res.tv.nsec < 0) | ||
150 | res.tv.nsec += NSEC_PER_SEC; | ||
151 | |||
152 | return res; | ||
153 | } | ||
154 | |||
155 | /** | ||
156 | * ktime_add - add two ktime_t variables | ||
157 | * | ||
158 | * @add1: addend1 | ||
159 | * @add2: addend2 | ||
160 | * | ||
161 | * Returns the sum of addend1 and addend2 | ||
162 | */ | ||
163 | static inline ktime_t ktime_add(const ktime_t add1, const ktime_t add2) | ||
164 | { | ||
165 | ktime_t res; | ||
166 | |||
167 | res.tv64 = add1.tv64 + add2.tv64; | ||
168 | /* | ||
169 | * performance trick: the (u32) -NSEC gives 0x00000000Fxxxxxxx | ||
170 | * so we subtract NSEC_PER_SEC and add 1 to the upper 32 bit. | ||
171 | * | ||
172 | * it's equivalent to: | ||
173 | * tv.nsec -= NSEC_PER_SEC | ||
174 | * tv.sec ++; | ||
175 | */ | ||
176 | if (res.tv.nsec >= NSEC_PER_SEC) | ||
177 | res.tv64 += (u32)-NSEC_PER_SEC; | ||
178 | |||
179 | return res; | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable | ||
184 | * | ||
185 | * @kt: addend | ||
186 | * @nsec: the scalar nsec value to add | ||
187 | * | ||
188 | * Returns the sum of kt and nsec in ktime_t format | ||
189 | */ | ||
190 | extern ktime_t ktime_add_ns(const ktime_t kt, u64 nsec); | ||
191 | |||
192 | /** | ||
193 | * timespec_to_ktime - convert a timespec to ktime_t format | ||
194 | * | ||
195 | * @ts: the timespec variable to convert | ||
196 | * | ||
197 | * Returns a ktime_t variable with the converted timespec value | ||
198 | */ | ||
199 | static inline ktime_t timespec_to_ktime(const struct timespec ts) | ||
200 | { | ||
201 | return (ktime_t) { .tv = { .sec = (s32)ts.tv_sec, | ||
202 | .nsec = (s32)ts.tv_nsec } }; | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * timeval_to_ktime - convert a timeval to ktime_t format | ||
207 | * | ||
208 | * @tv: the timeval variable to convert | ||
209 | * | ||
210 | * Returns a ktime_t variable with the converted timeval value | ||
211 | */ | ||
212 | static inline ktime_t timeval_to_ktime(const struct timeval tv) | ||
213 | { | ||
214 | return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, | ||
215 | .nsec = (s32)tv.tv_usec * 1000 } }; | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * ktime_to_timespec - convert a ktime_t variable to timespec format | ||
220 | * | ||
221 | * @kt: the ktime_t variable to convert | ||
222 | * | ||
223 | * Returns the timespec representation of the ktime value | ||
224 | */ | ||
225 | static inline struct timespec ktime_to_timespec(const ktime_t kt) | ||
226 | { | ||
227 | return (struct timespec) { .tv_sec = (time_t) kt.tv.sec, | ||
228 | .tv_nsec = (long) kt.tv.nsec }; | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * ktime_to_timeval - convert a ktime_t variable to timeval format | ||
233 | * | ||
234 | * @kt: the ktime_t variable to convert | ||
235 | * | ||
236 | * Returns the timeval representation of the ktime value | ||
237 | */ | ||
238 | static inline struct timeval ktime_to_timeval(const ktime_t kt) | ||
239 | { | ||
240 | return (struct timeval) { | ||
241 | .tv_sec = (time_t) kt.tv.sec, | ||
242 | .tv_usec = (suseconds_t) (kt.tv.nsec / NSEC_PER_USEC) }; | ||
243 | } | ||
244 | |||
245 | /** | ||
246 | * ktime_to_clock_t - convert a ktime_t variable to clock_t format | ||
247 | * @kt: the ktime_t variable to convert | ||
248 | * | ||
249 | * Returns a clock_t variable with the converted value | ||
250 | */ | ||
251 | static inline clock_t ktime_to_clock_t(const ktime_t kt) | ||
252 | { | ||
253 | return nsec_to_clock_t( (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec); | ||
254 | } | ||
255 | |||
256 | /** | ||
257 | * ktime_to_ns - convert a ktime_t variable to scalar nanoseconds | ||
258 | * @kt: the ktime_t variable to convert | ||
259 | * | ||
260 | * Returns the scalar nanoseconds representation of kt | ||
261 | */ | ||
262 | static inline u64 ktime_to_ns(const ktime_t kt) | ||
263 | { | ||
264 | return (u64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; | ||
265 | } | ||
266 | |||
267 | #endif | ||
268 | |||
269 | /* | ||
270 | * The resolution of the clocks. The resolution value is returned in | ||
271 | * the clock_getres() system call to give application programmers an | ||
272 | * idea of the (in)accuracy of timers. Timer values are rounded up to | ||
273 | * this resolution values. | ||
274 | */ | ||
275 | #define KTIME_REALTIME_RES (NSEC_PER_SEC/HZ) | ||
276 | #define KTIME_MONOTONIC_RES (NSEC_PER_SEC/HZ) | ||
277 | |||
278 | /* Get the monotonic time in timespec format: */ | ||
279 | extern void ktime_get_ts(struct timespec *ts); | ||
280 | |||
281 | /* Get the real (wall-) time in timespec format: */ | ||
282 | #define ktime_get_real_ts(ts) getnstimeofday(ts) | ||
283 | |||
284 | #endif | ||
diff --git a/include/linux/list.h b/include/linux/list.h index 8e3388284530..945daa1f13dd 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -436,6 +436,20 @@ static inline void list_splice_init(struct list_head *list, | |||
436 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 436 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
437 | 437 | ||
438 | /** | 438 | /** |
439 | * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against | ||
440 | * removal of list entry | ||
441 | * @pos: the type * to use as a loop counter. | ||
442 | * @n: another type * to use as temporary storage | ||
443 | * @head: the head for your list. | ||
444 | * @member: the name of the list_struct within the struct. | ||
445 | */ | ||
446 | #define list_for_each_entry_safe_reverse(pos, n, head, member) \ | ||
447 | for (pos = list_entry((head)->prev, typeof(*pos), member), \ | ||
448 | n = list_entry(pos->member.prev, typeof(*pos), member); \ | ||
449 | &pos->member != (head); \ | ||
450 | pos = n, n = list_entry(n->member.prev, typeof(*n), member)) | ||
451 | |||
452 | /** | ||
439 | * list_for_each_rcu - iterate over an rcu-protected list | 453 | * list_for_each_rcu - iterate over an rcu-protected list |
440 | * @pos: the &struct list_head to use as a loop counter. | 454 | * @pos: the &struct list_head to use as a loop counter. |
441 | * @head: the head for your list. | 455 | * @head: the head for your list. |
diff --git a/include/linux/mount.h b/include/linux/mount.h index b98a709f1794..b7472ae91fa4 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
@@ -20,10 +20,12 @@ | |||
20 | #define MNT_NOSUID 0x01 | 20 | #define MNT_NOSUID 0x01 |
21 | #define MNT_NODEV 0x02 | 21 | #define MNT_NODEV 0x02 |
22 | #define MNT_NOEXEC 0x04 | 22 | #define MNT_NOEXEC 0x04 |
23 | #define MNT_SHARED 0x10 /* if the vfsmount is a shared mount */ | 23 | #define MNT_NOATIME 0x08 |
24 | #define MNT_UNBINDABLE 0x20 /* if the vfsmount is a unbindable mount */ | 24 | #define MNT_NODIRATIME 0x10 |
25 | 25 | ||
26 | #define MNT_PNODE_MASK (MNT_SHARED | MNT_UNBINDABLE) | 26 | #define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ |
27 | #define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ | ||
28 | #define MNT_PNODE_MASK 0x3000 /* propogation flag mask */ | ||
27 | 29 | ||
28 | struct vfsmount { | 30 | struct vfsmount { |
29 | struct list_head mnt_hash; | 31 | struct list_head mnt_hash; |
diff --git a/include/linux/namei.h b/include/linux/namei.h index 455660eafba9..b699e427c00c 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -74,7 +74,7 @@ extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | |||
74 | extern void release_open_intent(struct nameidata *); | 74 | extern void release_open_intent(struct nameidata *); |
75 | 75 | ||
76 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); | 76 | extern struct dentry * lookup_one_len(const char *, struct dentry *, int); |
77 | extern struct dentry * lookup_hash(struct nameidata *); | 77 | extern __deprecated_for_modules struct dentry * lookup_hash(struct nameidata *); |
78 | 78 | ||
79 | extern int follow_down(struct vfsmount **, struct dentry **); | 79 | extern int follow_down(struct vfsmount **, struct dentry **); |
80 | extern int follow_up(struct vfsmount **, struct dentry **); | 80 | extern int follow_up(struct vfsmount **, struct dentry **); |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index c3caa93efb10..f55c98a68aa9 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -377,6 +377,7 @@ | |||
377 | #define PCI_DEVICE_ID_NS_87560_USB 0x0012 | 377 | #define PCI_DEVICE_ID_NS_87560_USB 0x0012 |
378 | #define PCI_DEVICE_ID_NS_83815 0x0020 | 378 | #define PCI_DEVICE_ID_NS_83815 0x0020 |
379 | #define PCI_DEVICE_ID_NS_83820 0x0022 | 379 | #define PCI_DEVICE_ID_NS_83820 0x0022 |
380 | #define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b | ||
380 | #define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d | 381 | #define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d |
381 | #define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e | 382 | #define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e |
382 | #define PCI_DEVICE_ID_NS_CS5535_USB 0x002f | 383 | #define PCI_DEVICE_ID_NS_CS5535_USB 0x002f |
@@ -500,6 +501,14 @@ | |||
500 | #define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d | 501 | #define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d |
501 | #define PCI_DEVICE_ID_AMD_8151_0 0x7454 | 502 | #define PCI_DEVICE_ID_AMD_8151_0 0x7454 |
502 | #define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 | 503 | #define PCI_DEVICE_ID_AMD_8131_APIC 0x7450 |
504 | #define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 | ||
505 | #define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 | ||
506 | #define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 | ||
507 | #define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094 | ||
508 | #define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095 | ||
509 | #define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 | ||
510 | #define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 | ||
511 | #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A | ||
503 | 512 | ||
504 | #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A | 513 | #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A |
505 | 514 | ||
@@ -1041,6 +1050,11 @@ | |||
1041 | #define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 | 1050 | #define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 |
1042 | #define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea | 1051 | #define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea |
1043 | #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee | 1052 | #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee |
1053 | #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0 | ||
1054 | #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1 | ||
1055 | #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2 | ||
1056 | #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3 | ||
1057 | #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9 | ||
1044 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 | 1058 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 |
1045 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 | 1059 | #define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 |
1046 | #define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 | 1060 | #define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 |
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index f942e2bad8e3..54faf5236da0 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -42,7 +42,7 @@ struct k_itimer { | |||
42 | timer_t it_id; /* timer id */ | 42 | timer_t it_id; /* timer id */ |
43 | int it_overrun; /* overrun on pending signal */ | 43 | int it_overrun; /* overrun on pending signal */ |
44 | int it_overrun_last; /* overrun on last delivered signal */ | 44 | int it_overrun_last; /* overrun on last delivered signal */ |
45 | int it_requeue_pending; /* waiting to requeue this timer */ | 45 | int it_requeue_pending; /* waiting to requeue this timer */ |
46 | #define REQUEUE_PENDING 1 | 46 | #define REQUEUE_PENDING 1 |
47 | int it_sigev_notify; /* notify word of sigevent struct */ | 47 | int it_sigev_notify; /* notify word of sigevent struct */ |
48 | int it_sigev_signo; /* signo word of sigevent struct */ | 48 | int it_sigev_signo; /* signo word of sigevent struct */ |
@@ -51,10 +51,8 @@ struct k_itimer { | |||
51 | struct sigqueue *sigq; /* signal queue entry. */ | 51 | struct sigqueue *sigq; /* signal queue entry. */ |
52 | union { | 52 | union { |
53 | struct { | 53 | struct { |
54 | struct timer_list timer; | 54 | struct hrtimer timer; |
55 | struct list_head abs_timer_entry; /* clock abs_timer_list */ | 55 | ktime_t interval; |
56 | struct timespec wall_to_prev; /* wall_to_monotonic used when set */ | ||
57 | unsigned long incr; /* interval in jiffies */ | ||
58 | } real; | 56 | } real; |
59 | struct cpu_timer_list cpu; | 57 | struct cpu_timer_list cpu; |
60 | struct { | 58 | struct { |
@@ -66,18 +64,14 @@ struct k_itimer { | |||
66 | } it; | 64 | } it; |
67 | }; | 65 | }; |
68 | 66 | ||
69 | struct k_clock_abs { | ||
70 | struct list_head list; | ||
71 | spinlock_t lock; | ||
72 | }; | ||
73 | struct k_clock { | 67 | struct k_clock { |
74 | int res; /* in nano seconds */ | 68 | int res; /* in nanoseconds */ |
75 | int (*clock_getres) (clockid_t which_clock, struct timespec *tp); | 69 | int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); |
76 | struct k_clock_abs *abs_struct; | 70 | int (*clock_set) (const clockid_t which_clock, struct timespec * tp); |
77 | int (*clock_set) (clockid_t which_clock, struct timespec * tp); | 71 | int (*clock_get) (const clockid_t which_clock, struct timespec * tp); |
78 | int (*clock_get) (clockid_t which_clock, struct timespec * tp); | ||
79 | int (*timer_create) (struct k_itimer *timer); | 72 | int (*timer_create) (struct k_itimer *timer); |
80 | int (*nsleep) (clockid_t which_clock, int flags, struct timespec *); | 73 | int (*nsleep) (const clockid_t which_clock, int flags, |
74 | struct timespec *, struct timespec __user *); | ||
81 | int (*timer_set) (struct k_itimer * timr, int flags, | 75 | int (*timer_set) (struct k_itimer * timr, int flags, |
82 | struct itimerspec * new_setting, | 76 | struct itimerspec * new_setting, |
83 | struct itimerspec * old_setting); | 77 | struct itimerspec * old_setting); |
@@ -87,53 +81,35 @@ struct k_clock { | |||
87 | struct itimerspec * cur_setting); | 81 | struct itimerspec * cur_setting); |
88 | }; | 82 | }; |
89 | 83 | ||
90 | void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock); | 84 | void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); |
91 | 85 | ||
92 | /* Error handlers for timer_create, nanosleep and settime */ | 86 | /* error handlers for timer_create, nanosleep and settime */ |
93 | int do_posix_clock_notimer_create(struct k_itimer *timer); | 87 | int do_posix_clock_notimer_create(struct k_itimer *timer); |
94 | int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *); | 88 | int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *, |
95 | int do_posix_clock_nosettime(clockid_t, struct timespec *tp); | 89 | struct timespec __user *); |
90 | int do_posix_clock_nosettime(const clockid_t, struct timespec *tp); | ||
96 | 91 | ||
97 | /* function to call to trigger timer event */ | 92 | /* function to call to trigger timer event */ |
98 | int posix_timer_event(struct k_itimer *timr, int si_private); | 93 | int posix_timer_event(struct k_itimer *timr, int si_private); |
99 | 94 | ||
100 | struct now_struct { | 95 | int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts); |
101 | unsigned long jiffies; | 96 | int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts); |
102 | }; | 97 | int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts); |
103 | 98 | int posix_cpu_timer_create(struct k_itimer *timer); | |
104 | #define posix_get_now(now) (now)->jiffies = jiffies; | 99 | int posix_cpu_nsleep(const clockid_t which_clock, int flags, |
105 | #define posix_time_before(timer, now) \ | 100 | struct timespec *rqtp, struct timespec __user *rmtp); |
106 | time_before((timer)->expires, (now)->jiffies) | 101 | int posix_cpu_timer_set(struct k_itimer *timer, int flags, |
107 | 102 | struct itimerspec *new, struct itimerspec *old); | |
108 | #define posix_bump_timer(timr, now) \ | 103 | int posix_cpu_timer_del(struct k_itimer *timer); |
109 | do { \ | 104 | void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp); |
110 | long delta, orun; \ | 105 | |
111 | delta = now.jiffies - (timr)->it.real.timer.expires; \ | 106 | void posix_cpu_timer_schedule(struct k_itimer *timer); |
112 | if (delta >= 0) { \ | 107 | |
113 | orun = 1 + (delta / (timr)->it.real.incr); \ | 108 | void run_posix_cpu_timers(struct task_struct *task); |
114 | (timr)->it.real.timer.expires += \ | 109 | void posix_cpu_timers_exit(struct task_struct *task); |
115 | orun * (timr)->it.real.incr; \ | 110 | void posix_cpu_timers_exit_group(struct task_struct *task); |
116 | (timr)->it_overrun += orun; \ | 111 | |
117 | } \ | 112 | void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx, |
118 | }while (0) | 113 | cputime_t *newval, cputime_t *oldval); |
119 | |||
120 | int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *); | ||
121 | int posix_cpu_clock_get(clockid_t which_clock, struct timespec *); | ||
122 | int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp); | ||
123 | int posix_cpu_timer_create(struct k_itimer *); | ||
124 | int posix_cpu_nsleep(clockid_t, int, struct timespec *); | ||
125 | int posix_cpu_timer_set(struct k_itimer *, int, | ||
126 | struct itimerspec *, struct itimerspec *); | ||
127 | int posix_cpu_timer_del(struct k_itimer *); | ||
128 | void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *); | ||
129 | |||
130 | void posix_cpu_timer_schedule(struct k_itimer *); | ||
131 | |||
132 | void run_posix_cpu_timers(struct task_struct *); | ||
133 | void posix_cpu_timers_exit(struct task_struct *); | ||
134 | void posix_cpu_timers_exit_group(struct task_struct *); | ||
135 | |||
136 | void set_process_cpu_timer(struct task_struct *, unsigned int, | ||
137 | cputime_t *, cputime_t *); | ||
138 | 114 | ||
139 | #endif | 115 | #endif |
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h index 157d7e3236b5..f54772d0e7f8 100644 --- a/include/linux/rio_drv.h +++ b/include/linux/rio_drv.h | |||
@@ -337,8 +337,8 @@ static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end) | |||
337 | 337 | ||
338 | /** | 338 | /** |
339 | * RIO_DEVICE - macro used to describe a specific RIO device | 339 | * RIO_DEVICE - macro used to describe a specific RIO device |
340 | * @vid: the 16 bit RIO vendor ID | 340 | * @dev: the 16 bit RIO device ID |
341 | * @did: the 16 bit RIO device ID | 341 | * @ven: the 16 bit RIO vendor ID |
342 | * | 342 | * |
343 | * This macro is used to create a struct rio_device_id that matches a | 343 | * This macro is used to create a struct rio_device_id that matches a |
344 | * specific device. The assembly vendor and assembly device fields | 344 | * specific device. The assembly vendor and assembly device fields |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 85b53f87c703..c4ee35dd18ae 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -105,6 +105,7 @@ extern unsigned long nr_iowait(void); | |||
105 | #include <linux/param.h> | 105 | #include <linux/param.h> |
106 | #include <linux/resource.h> | 106 | #include <linux/resource.h> |
107 | #include <linux/timer.h> | 107 | #include <linux/timer.h> |
108 | #include <linux/hrtimer.h> | ||
108 | 109 | ||
109 | #include <asm/processor.h> | 110 | #include <asm/processor.h> |
110 | 111 | ||
@@ -398,8 +399,8 @@ struct signal_struct { | |||
398 | struct list_head posix_timers; | 399 | struct list_head posix_timers; |
399 | 400 | ||
400 | /* ITIMER_REAL timer for the process */ | 401 | /* ITIMER_REAL timer for the process */ |
401 | struct timer_list real_timer; | 402 | struct hrtimer real_timer; |
402 | unsigned long it_real_value, it_real_incr; | 403 | ktime_t it_real_incr; |
403 | 404 | ||
404 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ | 405 | /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ |
405 | cputime_t it_prof_expires, it_virt_expires; | 406 | cputime_t it_prof_expires, it_virt_expires; |
@@ -1389,12 +1390,8 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) | |||
1389 | extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); | 1390 | extern long sched_setaffinity(pid_t pid, cpumask_t new_mask); |
1390 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); | 1391 | extern long sched_getaffinity(pid_t pid, cpumask_t *mask); |
1391 | 1392 | ||
1392 | #ifdef CONFIG_MAGIC_SYSRQ | ||
1393 | |||
1394 | extern void normalize_rt_tasks(void); | 1393 | extern void normalize_rt_tasks(void); |
1395 | 1394 | ||
1396 | #endif | ||
1397 | |||
1398 | #ifdef CONFIG_PM | 1395 | #ifdef CONFIG_PM |
1399 | /* | 1396 | /* |
1400 | * Check if a process has been frozen | 1397 | * Check if a process has been frozen |
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h index 76850b75b3f6..6336987dae62 100644 --- a/include/linux/screen_info.h +++ b/include/linux/screen_info.h | |||
@@ -41,8 +41,7 @@ struct screen_info { | |||
41 | u16 vesapm_off; /* 0x30 */ | 41 | u16 vesapm_off; /* 0x30 */ |
42 | u16 pages; /* 0x32 */ | 42 | u16 pages; /* 0x32 */ |
43 | u16 vesa_attributes; /* 0x34 */ | 43 | u16 vesa_attributes; /* 0x34 */ |
44 | u32 capabilities; /* 0x36 */ | 44 | /* 0x36 -- 0x3f reserved for future expansion */ |
45 | /* 0x3a -- 0x3f reserved for future expansion */ | ||
46 | }; | 45 | }; |
47 | 46 | ||
48 | extern struct screen_info screen_info; | 47 | extern struct screen_info screen_info; |
diff --git a/include/linux/time.h b/include/linux/time.h index 797ccd813bb0..f2aca7ec6325 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | ||
6 | #ifdef __KERNEL__ | 6 | #ifdef __KERNEL__ |
7 | #include <linux/seqlock.h> | 7 | # include <linux/seqlock.h> |
8 | #endif | 8 | #endif |
9 | 9 | ||
10 | #ifndef _STRUCT_TIMESPEC | 10 | #ifndef _STRUCT_TIMESPEC |
@@ -13,7 +13,7 @@ struct timespec { | |||
13 | time_t tv_sec; /* seconds */ | 13 | time_t tv_sec; /* seconds */ |
14 | long tv_nsec; /* nanoseconds */ | 14 | long tv_nsec; /* nanoseconds */ |
15 | }; | 15 | }; |
16 | #endif /* _STRUCT_TIMESPEC */ | 16 | #endif |
17 | 17 | ||
18 | struct timeval { | 18 | struct timeval { |
19 | time_t tv_sec; /* seconds */ | 19 | time_t tv_sec; /* seconds */ |
@@ -27,93 +27,103 @@ struct timezone { | |||
27 | 27 | ||
28 | #ifdef __KERNEL__ | 28 | #ifdef __KERNEL__ |
29 | 29 | ||
30 | /* Parameters used to convert the timespec values */ | 30 | /* Parameters used to convert the timespec values: */ |
31 | #define MSEC_PER_SEC (1000L) | 31 | #define MSEC_PER_SEC 1000L |
32 | #define USEC_PER_SEC (1000000L) | 32 | #define USEC_PER_SEC 1000000L |
33 | #define NSEC_PER_SEC (1000000000L) | 33 | #define NSEC_PER_SEC 1000000000L |
34 | #define NSEC_PER_USEC (1000L) | 34 | #define NSEC_PER_USEC 1000L |
35 | 35 | ||
36 | static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) | 36 | static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) |
37 | { | 37 | { |
38 | return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); | 38 | return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); |
39 | } | 39 | } |
40 | 40 | ||
41 | /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. | 41 | extern unsigned long mktime(const unsigned int year, const unsigned int mon, |
42 | * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 | 42 | const unsigned int day, const unsigned int hour, |
43 | * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. | 43 | const unsigned int min, const unsigned int sec); |
44 | * | 44 | |
45 | * [For the Julian calendar (which was used in Russia before 1917, | 45 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec); |
46 | * Britain & colonies before 1752, anywhere else before 1582, | 46 | |
47 | * and is still in use by some communities) leave out the | 47 | /* |
48 | * -year/100+year/400 terms, and add 10.] | 48 | * Returns true if the timespec is norm, false if denorm: |
49 | * | ||
50 | * This algorithm was first published by Gauss (I think). | ||
51 | * | ||
52 | * WARNING: this function will overflow on 2106-02-07 06:28:16 on | ||
53 | * machines were long is 32-bit! (However, as time_t is signed, we | ||
54 | * will already get problems at other places on 2038-01-19 03:14:08) | ||
55 | */ | 49 | */ |
56 | static inline unsigned long | 50 | #define timespec_valid(ts) \ |
57 | mktime (unsigned int year, unsigned int mon, | 51 | (((ts)->tv_sec >= 0) && (((unsigned) (ts)->tv_nsec) < NSEC_PER_SEC)) |
58 | unsigned int day, unsigned int hour, | 52 | |
59 | unsigned int min, unsigned int sec) | 53 | /* |
60 | { | 54 | * 64-bit nanosec type. Large enough to span 292+ years in nanosecond |
61 | if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ | 55 | * resolution. Ought to be enough for a while. |
62 | mon += 12; /* Puts Feb last since it has leap day */ | 56 | */ |
63 | year -= 1; | 57 | typedef s64 nsec_t; |
64 | } | ||
65 | |||
66 | return ((( | ||
67 | (unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) + | ||
68 | year*365 - 719499 | ||
69 | )*24 + hour /* now have hours */ | ||
70 | )*60 + min /* now have minutes */ | ||
71 | )*60 + sec; /* finally seconds */ | ||
72 | } | ||
73 | 58 | ||
74 | extern struct timespec xtime; | 59 | extern struct timespec xtime; |
75 | extern struct timespec wall_to_monotonic; | 60 | extern struct timespec wall_to_monotonic; |
76 | extern seqlock_t xtime_lock; | 61 | extern seqlock_t xtime_lock; |
77 | 62 | ||
78 | static inline unsigned long get_seconds(void) | 63 | static inline unsigned long get_seconds(void) |
79 | { | 64 | { |
80 | return xtime.tv_sec; | 65 | return xtime.tv_sec; |
81 | } | 66 | } |
82 | 67 | ||
83 | struct timespec current_kernel_time(void); | 68 | struct timespec current_kernel_time(void); |
84 | 69 | ||
85 | #define CURRENT_TIME (current_kernel_time()) | 70 | #define CURRENT_TIME (current_kernel_time()) |
86 | #define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) | 71 | #define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 }) |
87 | 72 | ||
88 | extern void do_gettimeofday(struct timeval *tv); | 73 | extern void do_gettimeofday(struct timeval *tv); |
89 | extern int do_settimeofday(struct timespec *tv); | 74 | extern int do_settimeofday(struct timespec *tv); |
90 | extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); | 75 | extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); |
91 | extern void clock_was_set(void); // call when ever the clock is set | 76 | #define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) |
92 | extern int do_posix_clock_monotonic_gettime(struct timespec *tp); | 77 | extern long do_utimes(char __user *filename, struct timeval *times); |
93 | extern long do_utimes(char __user * filename, struct timeval * times); | ||
94 | struct itimerval; | 78 | struct itimerval; |
95 | extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); | 79 | extern int do_setitimer(int which, struct itimerval *value, |
80 | struct itimerval *ovalue); | ||
96 | extern int do_getitimer(int which, struct itimerval *value); | 81 | extern int do_getitimer(int which, struct itimerval *value); |
97 | extern void getnstimeofday (struct timespec *tv); | 82 | extern void getnstimeofday(struct timespec *tv); |
98 | extern void getnstimestamp(struct timespec *ts); | ||
99 | 83 | ||
100 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); | 84 | extern struct timespec timespec_trunc(struct timespec t, unsigned gran); |
101 | 85 | ||
102 | static inline void | 86 | /** |
103 | set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) | 87 | * timespec_to_ns - Convert timespec to nanoseconds |
88 | * @ts: pointer to the timespec variable to be converted | ||
89 | * | ||
90 | * Returns the scalar nanosecond representation of the timespec | ||
91 | * parameter. | ||
92 | */ | ||
93 | static inline nsec_t timespec_to_ns(const struct timespec *ts) | ||
104 | { | 94 | { |
105 | while (nsec >= NSEC_PER_SEC) { | 95 | return ((nsec_t) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; |
106 | nsec -= NSEC_PER_SEC; | ||
107 | ++sec; | ||
108 | } | ||
109 | while (nsec < 0) { | ||
110 | nsec += NSEC_PER_SEC; | ||
111 | --sec; | ||
112 | } | ||
113 | ts->tv_sec = sec; | ||
114 | ts->tv_nsec = nsec; | ||
115 | } | 96 | } |
116 | 97 | ||
98 | /** | ||
99 | * timeval_to_ns - Convert timeval to nanoseconds | ||
100 | * @ts: pointer to the timeval variable to be converted | ||
101 | * | ||
102 | * Returns the scalar nanosecond representation of the timeval | ||
103 | * parameter. | ||
104 | */ | ||
105 | static inline nsec_t timeval_to_ns(const struct timeval *tv) | ||
106 | { | ||
107 | return ((nsec_t) tv->tv_sec * NSEC_PER_SEC) + | ||
108 | tv->tv_usec * NSEC_PER_USEC; | ||
109 | } | ||
110 | |||
111 | /** | ||
112 | * ns_to_timespec - Convert nanoseconds to timespec | ||
113 | * @nsec: the nanoseconds value to be converted | ||
114 | * | ||
115 | * Returns the timespec representation of the nsec parameter. | ||
116 | */ | ||
117 | extern struct timespec ns_to_timespec(const nsec_t nsec); | ||
118 | |||
119 | /** | ||
120 | * ns_to_timeval - Convert nanoseconds to timeval | ||
121 | * @nsec: the nanoseconds value to be converted | ||
122 | * | ||
123 | * Returns the timeval representation of the nsec parameter. | ||
124 | */ | ||
125 | extern struct timeval ns_to_timeval(const nsec_t nsec); | ||
126 | |||
117 | #endif /* __KERNEL__ */ | 127 | #endif /* __KERNEL__ */ |
118 | 128 | ||
119 | #define NFDBITS __NFDBITS | 129 | #define NFDBITS __NFDBITS |
@@ -126,49 +136,41 @@ set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) | |||
126 | 136 | ||
127 | /* | 137 | /* |
128 | * Names of the interval timers, and structure | 138 | * Names of the interval timers, and structure |
129 | * defining a timer setting. | 139 | * defining a timer setting: |
130 | */ | 140 | */ |
131 | #define ITIMER_REAL 0 | 141 | #define ITIMER_REAL 0 |
132 | #define ITIMER_VIRTUAL 1 | 142 | #define ITIMER_VIRTUAL 1 |
133 | #define ITIMER_PROF 2 | 143 | #define ITIMER_PROF 2 |
134 | 144 | ||
135 | struct itimerspec { | 145 | struct itimerspec { |
136 | struct timespec it_interval; /* timer period */ | 146 | struct timespec it_interval; /* timer period */ |
137 | struct timespec it_value; /* timer expiration */ | 147 | struct timespec it_value; /* timer expiration */ |
138 | }; | 148 | }; |
139 | 149 | ||
140 | struct itimerval { | 150 | struct itimerval { |
141 | struct timeval it_interval; /* timer interval */ | 151 | struct timeval it_interval; /* timer interval */ |
142 | struct timeval it_value; /* current value */ | 152 | struct timeval it_value; /* current value */ |
143 | }; | 153 | }; |
144 | 154 | ||
145 | |||
146 | /* | 155 | /* |
147 | * The IDs of the various system clocks (for POSIX.1b interval timers). | 156 | * The IDs of the various system clocks (for POSIX.1b interval timers): |
148 | */ | 157 | */ |
149 | #define CLOCK_REALTIME 0 | 158 | #define CLOCK_REALTIME 0 |
150 | #define CLOCK_MONOTONIC 1 | 159 | #define CLOCK_MONOTONIC 1 |
151 | #define CLOCK_PROCESS_CPUTIME_ID 2 | 160 | #define CLOCK_PROCESS_CPUTIME_ID 2 |
152 | #define CLOCK_THREAD_CPUTIME_ID 3 | 161 | #define CLOCK_THREAD_CPUTIME_ID 3 |
153 | #define CLOCK_REALTIME_HR 4 | ||
154 | #define CLOCK_MONOTONIC_HR 5 | ||
155 | 162 | ||
156 | /* | 163 | /* |
157 | * The IDs of various hardware clocks | 164 | * The IDs of various hardware clocks: |
158 | */ | 165 | */ |
159 | 166 | #define CLOCK_SGI_CYCLE 10 | |
160 | 167 | #define MAX_CLOCKS 16 | |
161 | #define CLOCK_SGI_CYCLE 10 | 168 | #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC) |
162 | #define MAX_CLOCKS 16 | 169 | #define CLOCKS_MONO CLOCK_MONOTONIC |
163 | #define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC | \ | ||
164 | CLOCK_REALTIME_HR | CLOCK_MONOTONIC_HR) | ||
165 | #define CLOCKS_MONO (CLOCK_MONOTONIC & CLOCK_MONOTONIC_HR) | ||
166 | 170 | ||
167 | /* | 171 | /* |
168 | * The various flags for setting POSIX.1b interval timers. | 172 | * The various flags for setting POSIX.1b interval timers: |
169 | */ | 173 | */ |
170 | 174 | #define TIMER_ABSTIME 0x01 | |
171 | #define TIMER_ABSTIME 0x01 | ||
172 | |||
173 | 175 | ||
174 | #endif | 176 | #endif |
diff --git a/include/linux/timer.h b/include/linux/timer.h index 72f3a7781106..9b9877fd2505 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h | |||
@@ -96,6 +96,6 @@ static inline void add_timer(struct timer_list *timer) | |||
96 | 96 | ||
97 | extern void init_timers(void); | 97 | extern void init_timers(void); |
98 | extern void run_local_timers(void); | 98 | extern void run_local_timers(void); |
99 | extern void it_real_fn(unsigned long); | 99 | extern int it_real_fn(void *); |
100 | 100 | ||
101 | #endif | 101 | #endif |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 57449704a47b..3787102e4b12 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -51,16 +51,22 @@ | |||
51 | */ | 51 | */ |
52 | #define TTY_FLIPBUF_SIZE 512 | 52 | #define TTY_FLIPBUF_SIZE 512 |
53 | 53 | ||
54 | struct tty_flip_buffer { | 54 | struct tty_buffer { |
55 | struct tty_buffer *next; | ||
56 | char *char_buf_ptr; | ||
57 | unsigned char *flag_buf_ptr; | ||
58 | int used; | ||
59 | int size; | ||
60 | /* Data points here */ | ||
61 | unsigned long data[0]; | ||
62 | }; | ||
63 | |||
64 | struct tty_bufhead { | ||
55 | struct work_struct work; | 65 | struct work_struct work; |
56 | struct semaphore pty_sem; | 66 | struct semaphore pty_sem; |
57 | char *char_buf_ptr; | 67 | struct tty_buffer *head; /* Queue head */ |
58 | unsigned char *flag_buf_ptr; | 68 | struct tty_buffer *tail; /* Active buffer */ |
59 | int count; | 69 | struct tty_buffer *free; /* Free queue head */ |
60 | int buf_num; | ||
61 | unsigned char char_buf[2*TTY_FLIPBUF_SIZE]; | ||
62 | char flag_buf[2*TTY_FLIPBUF_SIZE]; | ||
63 | unsigned char slop[4]; /* N.B. bug overwrites buffer by 1 */ | ||
64 | }; | 70 | }; |
65 | /* | 71 | /* |
66 | * The pty uses char_buf and flag_buf as a contiguous buffer | 72 | * The pty uses char_buf and flag_buf as a contiguous buffer |
@@ -186,10 +192,11 @@ struct tty_struct { | |||
186 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; | 192 | unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; |
187 | unsigned char low_latency:1, warned:1; | 193 | unsigned char low_latency:1, warned:1; |
188 | unsigned char ctrl_status; | 194 | unsigned char ctrl_status; |
195 | unsigned int receive_room; /* Bytes free for queue */ | ||
189 | 196 | ||
190 | struct tty_struct *link; | 197 | struct tty_struct *link; |
191 | struct fasync_struct *fasync; | 198 | struct fasync_struct *fasync; |
192 | struct tty_flip_buffer flip; | 199 | struct tty_bufhead buf; |
193 | int max_flip_cnt; | 200 | int max_flip_cnt; |
194 | int alt_speed; /* For magic substitution of 38400 bps */ | 201 | int alt_speed; /* For magic substitution of 38400 bps */ |
195 | wait_queue_head_t write_wait; | 202 | wait_queue_head_t write_wait; |
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index abe9bfcf226c..be1400e82482 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h | |||
@@ -1,25 +1,33 @@ | |||
1 | #ifndef _LINUX_TTY_FLIP_H | 1 | #ifndef _LINUX_TTY_FLIP_H |
2 | #define _LINUX_TTY_FLIP_H | 2 | #define _LINUX_TTY_FLIP_H |
3 | 3 | ||
4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); | ||
5 | extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size); | ||
6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size); | ||
7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); | ||
8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); | ||
9 | |||
4 | #ifdef INCLUDE_INLINE_FUNCS | 10 | #ifdef INCLUDE_INLINE_FUNCS |
5 | #define _INLINE_ extern | 11 | #define _INLINE_ extern |
6 | #else | 12 | #else |
7 | #define _INLINE_ static __inline__ | 13 | #define _INLINE_ static __inline__ |
8 | #endif | 14 | #endif |
9 | 15 | ||
10 | _INLINE_ void tty_insert_flip_char(struct tty_struct *tty, | 16 | _INLINE_ int tty_insert_flip_char(struct tty_struct *tty, |
11 | unsigned char ch, char flag) | 17 | unsigned char ch, char flag) |
12 | { | 18 | { |
13 | if (tty->flip.count < TTY_FLIPBUF_SIZE) { | 19 | struct tty_buffer *tb = tty->buf.tail; |
14 | tty->flip.count++; | 20 | if (tb && tb->used < tb->size) { |
15 | *tty->flip.flag_buf_ptr++ = flag; | 21 | tb->flag_buf_ptr[tb->used] = flag; |
16 | *tty->flip.char_buf_ptr++ = ch; | 22 | tb->char_buf_ptr[tb->used++] = ch; |
23 | return 1; | ||
17 | } | 24 | } |
25 | return tty_insert_flip_string_flags(tty, &ch, &flag, 1); | ||
18 | } | 26 | } |
19 | 27 | ||
20 | _INLINE_ void tty_schedule_flip(struct tty_struct *tty) | 28 | _INLINE_ void tty_schedule_flip(struct tty_struct *tty) |
21 | { | 29 | { |
22 | schedule_delayed_work(&tty->flip.work, 1); | 30 | schedule_delayed_work(&tty->buf.work, 1); |
23 | } | 31 | } |
24 | 32 | ||
25 | #undef _INLINE_ | 33 | #undef _INLINE_ |
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 6066afde5ce4..83c6e6c10ebb 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h | |||
@@ -81,14 +81,6 @@ | |||
81 | * pointer of flag bytes which indicate whether a character was | 81 | * pointer of flag bytes which indicate whether a character was |
82 | * received with a parity error, etc. | 82 | * received with a parity error, etc. |
83 | * | 83 | * |
84 | * int (*receive_room)(struct tty_struct *); | ||
85 | * | ||
86 | * This function is called by the low-level tty driver to | ||
87 | * determine how many characters the line discpline can accept. | ||
88 | * The low-level driver must not send more characters than was | ||
89 | * indicated by receive_room, or the line discpline may drop | ||
90 | * those characters. | ||
91 | * | ||
92 | * void (*write_wakeup)(struct tty_struct *); | 84 | * void (*write_wakeup)(struct tty_struct *); |
93 | * | 85 | * |
94 | * This function is called by the low-level tty driver to signal | 86 | * This function is called by the low-level tty driver to signal |
@@ -136,7 +128,6 @@ struct tty_ldisc { | |||
136 | */ | 128 | */ |
137 | void (*receive_buf)(struct tty_struct *, const unsigned char *cp, | 129 | void (*receive_buf)(struct tty_struct *, const unsigned char *cp, |
138 | char *fp, int count); | 130 | char *fp, int count); |
139 | int (*receive_room)(struct tty_struct *); | ||
140 | void (*write_wakeup)(struct tty_struct *); | 131 | void (*write_wakeup)(struct tty_struct *); |
141 | 132 | ||
142 | struct module *owner; | 133 | struct module *owner; |
diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 23f9c61d9546..cda8a96e2fa0 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h | |||
@@ -13,7 +13,22 @@ | |||
13 | #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ | 13 | #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ |
14 | #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ | 14 | #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ |
15 | 15 | ||
16 | /* Namespaces */ | ||
17 | #define XATTR_OS2_PREFIX "os2." | ||
18 | #define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1) | ||
19 | |||
16 | #define XATTR_SECURITY_PREFIX "security." | 20 | #define XATTR_SECURITY_PREFIX "security." |
21 | #define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1) | ||
22 | |||
23 | #define XATTR_SYSTEM_PREFIX "system." | ||
24 | #define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1) | ||
25 | |||
26 | #define XATTR_TRUSTED_PREFIX "trusted." | ||
27 | #define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1) | ||
28 | |||
29 | #define XATTR_USER_PREFIX "user." | ||
30 | #define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) | ||
31 | |||
17 | 32 | ||
18 | struct xattr_handler { | 33 | struct xattr_handler { |
19 | char *prefix; | 34 | char *prefix; |
@@ -25,6 +40,10 @@ struct xattr_handler { | |||
25 | size_t size, int flags); | 40 | size_t size, int flags); |
26 | }; | 41 | }; |
27 | 42 | ||
43 | ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); | ||
44 | int vfs_setxattr(struct dentry *, char *, void *, size_t, int); | ||
45 | int vfs_removexattr(struct dentry *, char *); | ||
46 | |||
28 | ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); | 47 | ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size); |
29 | ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); | 48 | ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size); |
30 | int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); | 49 | int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags); |
diff --git a/include/linux/zlib.h b/include/linux/zlib.h index 74f7b78c22d2..4fa32f0d4df8 100644 --- a/include/linux/zlib.h +++ b/include/linux/zlib.h | |||
@@ -442,9 +442,11 @@ extern int deflateInit2 (z_streamp strm, | |||
442 | not perform any compression: this will be done by deflate(). | 442 | not perform any compression: this will be done by deflate(). |
443 | */ | 443 | */ |
444 | 444 | ||
445 | #if 0 | ||
445 | extern int zlib_deflateSetDictionary (z_streamp strm, | 446 | extern int zlib_deflateSetDictionary (z_streamp strm, |
446 | const Byte *dictionary, | 447 | const Byte *dictionary, |
447 | uInt dictLength); | 448 | uInt dictLength); |
449 | #endif | ||
448 | /* | 450 | /* |
449 | Initializes the compression dictionary from the given byte sequence | 451 | Initializes the compression dictionary from the given byte sequence |
450 | without producing any compressed output. This function must be called | 452 | without producing any compressed output. This function must be called |
@@ -478,7 +480,10 @@ extern int zlib_deflateSetDictionary (z_streamp strm, | |||
478 | perform any compression: this will be done by deflate(). | 480 | perform any compression: this will be done by deflate(). |
479 | */ | 481 | */ |
480 | 482 | ||
483 | #if 0 | ||
481 | extern int zlib_deflateCopy (z_streamp dest, z_streamp source); | 484 | extern int zlib_deflateCopy (z_streamp dest, z_streamp source); |
485 | #endif | ||
486 | |||
482 | /* | 487 | /* |
483 | Sets the destination stream as a complete copy of the source stream. | 488 | Sets the destination stream as a complete copy of the source stream. |
484 | 489 | ||
@@ -511,7 +516,9 @@ static inline unsigned long deflateBound(unsigned long s) | |||
511 | return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; | 516 | return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; |
512 | } | 517 | } |
513 | 518 | ||
519 | #if 0 | ||
514 | extern int zlib_deflateParams (z_streamp strm, int level, int strategy); | 520 | extern int zlib_deflateParams (z_streamp strm, int level, int strategy); |
521 | #endif | ||
515 | /* | 522 | /* |
516 | Dynamically update the compression level and compression strategy. The | 523 | Dynamically update the compression level and compression strategy. The |
517 | interpretation of level and strategy is as in deflateInit2. This can be | 524 | interpretation of level and strategy is as in deflateInit2. This can be |
@@ -571,7 +578,9 @@ extern int zlib_inflateSetDictionary (z_streamp strm, | |||
571 | inflate(). | 578 | inflate(). |
572 | */ | 579 | */ |
573 | 580 | ||
581 | #if 0 | ||
574 | extern int zlib_inflateSync (z_streamp strm); | 582 | extern int zlib_inflateSync (z_streamp strm); |
583 | #endif | ||
575 | /* | 584 | /* |
576 | Skips invalid compressed data until a full flush point (see above the | 585 | Skips invalid compressed data until a full flush point (see above the |
577 | description of deflate with Z_FULL_FLUSH) can be found, or until all | 586 | description of deflate with Z_FULL_FLUSH) can be found, or until all |
@@ -636,7 +645,9 @@ extern int zlib_inflateInit2_ (z_streamp strm, int windowBits, | |||
636 | #endif | 645 | #endif |
637 | 646 | ||
638 | extern const char * zlib_zError (int err); | 647 | extern const char * zlib_zError (int err); |
648 | #if 0 | ||
639 | extern int zlib_inflateSyncPoint (z_streamp z); | 649 | extern int zlib_inflateSyncPoint (z_streamp z); |
650 | #endif | ||
640 | extern const uLong * zlib_get_crc_table (void); | 651 | extern const uLong * zlib_get_crc_table (void); |
641 | 652 | ||
642 | #endif /* _ZLIB_H */ | 653 | #endif /* _ZLIB_H */ |
diff --git a/include/sound/core.h b/include/sound/core.h index 90ac6132ea3b..3093e3ddcf36 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -317,7 +317,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
317 | #ifdef CONFIG_SND_VERBOSE_PRINTK | 317 | #ifdef CONFIG_SND_VERBOSE_PRINTK |
318 | /** | 318 | /** |
319 | * snd_printd - debug printk | 319 | * snd_printd - debug printk |
320 | * @format: format string | 320 | * @fmt: format string |
321 | * | 321 | * |
322 | * Compiled only when Works like snd_printk() for debugging purpose. | 322 | * Compiled only when Works like snd_printk() for debugging purpose. |
323 | * Ignored when CONFIG_SND_DEBUG is not set. | 323 | * Ignored when CONFIG_SND_DEBUG is not set. |
@@ -331,7 +331,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
331 | /** | 331 | /** |
332 | * snd_assert - run-time assertion macro | 332 | * snd_assert - run-time assertion macro |
333 | * @expr: expression | 333 | * @expr: expression |
334 | * @args...: the action | ||
335 | * | 334 | * |
336 | * This macro checks the expression in run-time and invokes the commands | 335 | * This macro checks the expression in run-time and invokes the commands |
337 | * given in the rest arguments if the assertion is failed. | 336 | * given in the rest arguments if the assertion is failed. |
diff --git a/include/video/kyro.h b/include/video/kyro.h index 1bed37cfa68c..dba7de2ee4a8 100644 --- a/include/video/kyro.h +++ b/include/video/kyro.h | |||
@@ -15,6 +15,7 @@ | |||
15 | struct kyrofb_info { | 15 | struct kyrofb_info { |
16 | void __iomem *regbase; | 16 | void __iomem *regbase; |
17 | 17 | ||
18 | u32 palette[16]; | ||
18 | u32 HTot; /* Hor Total Time */ | 19 | u32 HTot; /* Hor Total Time */ |
19 | u32 HFP; /* Hor Front Porch */ | 20 | u32 HFP; /* Hor Front Porch */ |
20 | u32 HST; /* Hor Sync Time */ | 21 | u32 HST; /* Hor Sync Time */ |
diff --git a/include/video/neomagic.h b/include/video/neomagic.h index bdaee70868dd..1d69049bd4c1 100644 --- a/include/video/neomagic.h +++ b/include/video/neomagic.h | |||
@@ -196,6 +196,7 @@ struct neofb_par { | |||
196 | int internal_display; | 196 | int internal_display; |
197 | int external_display; | 197 | int external_display; |
198 | int libretto; | 198 | int libretto; |
199 | u32 palette[16]; | ||
199 | }; | 200 | }; |
200 | 201 | ||
201 | typedef struct { | 202 | typedef struct { |
diff --git a/include/video/newport.h b/include/video/newport.h index 812dac5b55f4..1f5ebeaa818f 100644 --- a/include/video/newport.h +++ b/include/video/newport.h | |||
@@ -382,7 +382,8 @@ typedef struct { | |||
382 | #define VC2_IREG_CONTROL 0x10 | 382 | #define VC2_IREG_CONTROL 0x10 |
383 | #define VC2_IREG_CONFIG 0x20 | 383 | #define VC2_IREG_CONFIG 0x20 |
384 | 384 | ||
385 | extern __inline__ void newport_vc2_set(struct newport_regs *regs, unsigned char vc2ireg, | 385 | static inline void newport_vc2_set(struct newport_regs *regs, |
386 | unsigned char vc2ireg, | ||
386 | unsigned short val) | 387 | unsigned short val) |
387 | { | 388 | { |
388 | regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | | 389 | regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | |
@@ -390,7 +391,7 @@ extern __inline__ void newport_vc2_set(struct newport_regs *regs, unsigned char | |||
390 | regs->set.dcbdata0.byword = (vc2ireg << 24) | (val << 8); | 391 | regs->set.dcbdata0.byword = (vc2ireg << 24) | (val << 8); |
391 | } | 392 | } |
392 | 393 | ||
393 | extern __inline__ unsigned short newport_vc2_get(struct newport_regs *regs, | 394 | static inline unsigned short newport_vc2_get(struct newport_regs *regs, |
394 | unsigned char vc2ireg) | 395 | unsigned char vc2ireg) |
395 | { | 396 | { |
396 | regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | | 397 | regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | |
diff --git a/include/video/sstfb.h b/include/video/sstfb.h index 0d77b5205372..3570f9c9b111 100644 --- a/include/video/sstfb.h +++ b/include/video/sstfb.h | |||
@@ -334,6 +334,7 @@ struct sst_spec { | |||
334 | }; | 334 | }; |
335 | 335 | ||
336 | struct sstfb_par { | 336 | struct sstfb_par { |
337 | u32 palette[16]; | ||
337 | unsigned int yDim; | 338 | unsigned int yDim; |
338 | unsigned int hSyncOn; /* hsync_len */ | 339 | unsigned int hSyncOn; /* hsync_len */ |
339 | unsigned int hSyncOff; /* left_margin + xres + right_margin */ | 340 | unsigned int hSyncOff; /* left_margin + xres + right_margin */ |
diff --git a/include/video/tdfx.h b/include/video/tdfx.h index 04237676b17c..c1cc94ba3fdd 100644 --- a/include/video/tdfx.h +++ b/include/video/tdfx.h | |||
@@ -140,52 +140,52 @@ | |||
140 | #ifdef __KERNEL__ | 140 | #ifdef __KERNEL__ |
141 | 141 | ||
142 | struct banshee_reg { | 142 | struct banshee_reg { |
143 | /* VGA rubbish */ | 143 | /* VGA rubbish */ |
144 | unsigned char att[21]; | 144 | unsigned char att[21]; |
145 | unsigned char crt[25]; | 145 | unsigned char crt[25]; |
146 | unsigned char gra[ 9]; | 146 | unsigned char gra[ 9]; |
147 | unsigned char misc[1]; | 147 | unsigned char misc[1]; |
148 | unsigned char seq[ 5]; | 148 | unsigned char seq[ 5]; |
149 | 149 | ||
150 | /* Banshee extensions */ | 150 | /* Banshee extensions */ |
151 | unsigned char ext[2]; | 151 | unsigned char ext[2]; |
152 | unsigned long vidcfg; | 152 | unsigned long vidcfg; |
153 | unsigned long vidpll; | 153 | unsigned long vidpll; |
154 | unsigned long mempll; | 154 | unsigned long mempll; |
155 | unsigned long gfxpll; | 155 | unsigned long gfxpll; |
156 | unsigned long dacmode; | 156 | unsigned long dacmode; |
157 | unsigned long vgainit0; | 157 | unsigned long vgainit0; |
158 | unsigned long vgainit1; | 158 | unsigned long vgainit1; |
159 | unsigned long screensize; | 159 | unsigned long screensize; |
160 | unsigned long stride; | 160 | unsigned long stride; |
161 | unsigned long cursloc; | 161 | unsigned long cursloc; |
162 | unsigned long curspataddr; | 162 | unsigned long curspataddr; |
163 | unsigned long cursc0; | 163 | unsigned long cursc0; |
164 | unsigned long cursc1; | 164 | unsigned long cursc1; |
165 | unsigned long startaddr; | 165 | unsigned long startaddr; |
166 | unsigned long clip0min; | 166 | unsigned long clip0min; |
167 | unsigned long clip0max; | 167 | unsigned long clip0max; |
168 | unsigned long clip1min; | 168 | unsigned long clip1min; |
169 | unsigned long clip1max; | 169 | unsigned long clip1max; |
170 | unsigned long srcbase; | 170 | unsigned long srcbase; |
171 | unsigned long dstbase; | 171 | unsigned long dstbase; |
172 | unsigned long miscinit0; | 172 | unsigned long miscinit0; |
173 | }; | 173 | }; |
174 | 174 | ||
175 | struct tdfx_par { | 175 | struct tdfx_par { |
176 | u32 max_pixclock; | 176 | u32 max_pixclock; |
177 | 177 | u32 palette[16]; | |
178 | void __iomem *regbase_virt; | 178 | void __iomem *regbase_virt; |
179 | unsigned long iobase; | 179 | unsigned long iobase; |
180 | u32 baseline; | 180 | u32 baseline; |
181 | 181 | ||
182 | struct { | 182 | struct { |
183 | int w,u,d; | 183 | int w,u,d; |
184 | unsigned long enable,disable; | 184 | unsigned long enable,disable; |
185 | struct timer_list timer; | 185 | struct timer_list timer; |
186 | } hwcursor; | 186 | } hwcursor; |
187 | 187 | ||
188 | spinlock_t DAClock; | 188 | spinlock_t DAClock; |
189 | }; | 189 | }; |
190 | 190 | ||
191 | #endif /* __KERNEL__ */ | 191 | #endif /* __KERNEL__ */ |
diff --git a/init/Kconfig b/init/Kconfig index f8f6929d8f25..9bdd5492a95b 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -230,9 +230,7 @@ source "usr/Kconfig" | |||
230 | 230 | ||
231 | config UID16 | 231 | config UID16 |
232 | bool "Enable 16-bit UID system calls" if EMBEDDED | 232 | bool "Enable 16-bit UID system calls" if EMBEDDED |
233 | depends !ALPHA && !PPC && !PPC64 && !PARISC && !V850 && !ARCH_S390X | 233 | depends on ARM || CRIS || FRV || H8300 || X86_32 || M68K || (S390 && !64BIT) || SUPERH || SPARC32 || (SPARC64 && SPARC32_COMPAT) || UML || (X86_64 && IA32_EMULATION) |
234 | depends !X86_64 || IA32_EMULATION | ||
235 | depends !SPARC64 || SPARC32_COMPAT | ||
236 | default y | 234 | default y |
237 | help | 235 | help |
238 | This enables the legacy 16-bit UID syscall wrappers. | 236 | This enables the legacy 16-bit UID syscall wrappers. |
diff --git a/init/main.c b/init/main.c index 8342c2890b16..e092b1979a90 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -485,6 +485,7 @@ asmlinkage void __init start_kernel(void) | |||
485 | init_IRQ(); | 485 | init_IRQ(); |
486 | pidhash_init(); | 486 | pidhash_init(); |
487 | init_timers(); | 487 | init_timers(); |
488 | hrtimers_init(); | ||
488 | softirq_init(); | 489 | softirq_init(); |
489 | time_init(); | 490 | time_init(); |
490 | 491 | ||
diff --git a/kernel/Makefile b/kernel/Makefile index a940bac02837..355126606d1b 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -7,7 +7,8 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \ | |||
7 | sysctl.o capability.o ptrace.o timer.o user.o \ | 7 | sysctl.o capability.o ptrace.o timer.o user.o \ |
8 | signal.o sys.o kmod.o workqueue.o pid.o \ | 8 | signal.o sys.o kmod.o workqueue.o pid.o \ |
9 | rcupdate.o intermodule.o extable.o params.o posix-timers.o \ | 9 | rcupdate.o intermodule.o extable.o params.o posix-timers.o \ |
10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o | 10 | kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ |
11 | hrtimer.o | ||
11 | 12 | ||
12 | obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o | 13 | obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o |
13 | obj-$(CONFIG_FUTEX) += futex.o | 14 | obj-$(CONFIG_FUTEX) += futex.o |
@@ -30,7 +31,6 @@ obj-$(CONFIG_KPROBES) += kprobes.o | |||
30 | obj-$(CONFIG_SYSFS) += ksysfs.o | 31 | obj-$(CONFIG_SYSFS) += ksysfs.o |
31 | obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o | 32 | obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o |
32 | obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ | 33 | obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ |
33 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o | ||
34 | obj-$(CONFIG_SECCOMP) += seccomp.o | 34 | obj-$(CONFIG_SECCOMP) += seccomp.o |
35 | obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o | 35 | obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o |
36 | 36 | ||
diff --git a/kernel/compat.c b/kernel/compat.c index 102296e21ea8..256e5d9f0647 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -514,6 +514,24 @@ static int put_compat_itimerspec(struct compat_itimerspec __user *dst, | |||
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | 516 | ||
517 | long compat_sys_timer_create(clockid_t which_clock, | ||
518 | struct compat_sigevent __user *timer_event_spec, | ||
519 | timer_t __user *created_timer_id) | ||
520 | { | ||
521 | struct sigevent __user *event = NULL; | ||
522 | |||
523 | if (timer_event_spec) { | ||
524 | struct sigevent kevent; | ||
525 | |||
526 | event = compat_alloc_user_space(sizeof(*event)); | ||
527 | if (get_compat_sigevent(&kevent, timer_event_spec) || | ||
528 | copy_to_user(event, &kevent, sizeof(*event))) | ||
529 | return -EFAULT; | ||
530 | } | ||
531 | |||
532 | return sys_timer_create(which_clock, event, created_timer_id); | ||
533 | } | ||
534 | |||
517 | long compat_sys_timer_settime(timer_t timer_id, int flags, | 535 | long compat_sys_timer_settime(timer_t timer_id, int flags, |
518 | struct compat_itimerspec __user *new, | 536 | struct compat_itimerspec __user *new, |
519 | struct compat_itimerspec __user *old) | 537 | struct compat_itimerspec __user *old) |
@@ -649,8 +667,6 @@ int get_compat_sigevent(struct sigevent *event, | |||
649 | ? -EFAULT : 0; | 667 | ? -EFAULT : 0; |
650 | } | 668 | } |
651 | 669 | ||
652 | /* timer_create is architecture specific because it needs sigevent conversion */ | ||
653 | |||
654 | long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, | 670 | long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask, |
655 | unsigned long bitmap_size) | 671 | unsigned long bitmap_size) |
656 | { | 672 | { |
diff --git a/kernel/exit.c b/kernel/exit.c index 309a46fa16f8..802722814925 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -842,7 +842,7 @@ fastcall NORET_TYPE void do_exit(long code) | |||
842 | } | 842 | } |
843 | group_dead = atomic_dec_and_test(&tsk->signal->live); | 843 | group_dead = atomic_dec_and_test(&tsk->signal->live); |
844 | if (group_dead) { | 844 | if (group_dead) { |
845 | del_timer_sync(&tsk->signal->real_timer); | 845 | hrtimer_cancel(&tsk->signal->real_timer); |
846 | exit_itimers(tsk->signal); | 846 | exit_itimers(tsk->signal); |
847 | acct_process(code); | 847 | acct_process(code); |
848 | } | 848 | } |
@@ -1071,6 +1071,9 @@ static int wait_task_zombie(task_t *p, int noreap, | |||
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | if (likely(p->real_parent == p->parent) && likely(p->signal)) { | 1073 | if (likely(p->real_parent == p->parent) && likely(p->signal)) { |
1074 | struct signal_struct *psig; | ||
1075 | struct signal_struct *sig; | ||
1076 | |||
1074 | /* | 1077 | /* |
1075 | * The resource counters for the group leader are in its | 1078 | * The resource counters for the group leader are in its |
1076 | * own task_struct. Those for dead threads in the group | 1079 | * own task_struct. Those for dead threads in the group |
@@ -1087,24 +1090,26 @@ static int wait_task_zombie(task_t *p, int noreap, | |||
1087 | * here reaping other children at the same time. | 1090 | * here reaping other children at the same time. |
1088 | */ | 1091 | */ |
1089 | spin_lock_irq(&p->parent->sighand->siglock); | 1092 | spin_lock_irq(&p->parent->sighand->siglock); |
1090 | p->parent->signal->cutime = | 1093 | psig = p->parent->signal; |
1091 | cputime_add(p->parent->signal->cutime, | 1094 | sig = p->signal; |
1095 | psig->cutime = | ||
1096 | cputime_add(psig->cutime, | ||
1092 | cputime_add(p->utime, | 1097 | cputime_add(p->utime, |
1093 | cputime_add(p->signal->utime, | 1098 | cputime_add(sig->utime, |
1094 | p->signal->cutime))); | 1099 | sig->cutime))); |
1095 | p->parent->signal->cstime = | 1100 | psig->cstime = |
1096 | cputime_add(p->parent->signal->cstime, | 1101 | cputime_add(psig->cstime, |
1097 | cputime_add(p->stime, | 1102 | cputime_add(p->stime, |
1098 | cputime_add(p->signal->stime, | 1103 | cputime_add(sig->stime, |
1099 | p->signal->cstime))); | 1104 | sig->cstime))); |
1100 | p->parent->signal->cmin_flt += | 1105 | psig->cmin_flt += |
1101 | p->min_flt + p->signal->min_flt + p->signal->cmin_flt; | 1106 | p->min_flt + sig->min_flt + sig->cmin_flt; |
1102 | p->parent->signal->cmaj_flt += | 1107 | psig->cmaj_flt += |
1103 | p->maj_flt + p->signal->maj_flt + p->signal->cmaj_flt; | 1108 | p->maj_flt + sig->maj_flt + sig->cmaj_flt; |
1104 | p->parent->signal->cnvcsw += | 1109 | psig->cnvcsw += |
1105 | p->nvcsw + p->signal->nvcsw + p->signal->cnvcsw; | 1110 | p->nvcsw + sig->nvcsw + sig->cnvcsw; |
1106 | p->parent->signal->cnivcsw += | 1111 | psig->cnivcsw += |
1107 | p->nivcsw + p->signal->nivcsw + p->signal->cnivcsw; | 1112 | p->nivcsw + sig->nivcsw + sig->cnivcsw; |
1108 | spin_unlock_irq(&p->parent->sighand->siglock); | 1113 | spin_unlock_irq(&p->parent->sighand->siglock); |
1109 | } | 1114 | } |
1110 | 1115 | ||
diff --git a/kernel/fork.c b/kernel/fork.c index b18d64554feb..3bdcab49998d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -801,10 +801,10 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
801 | init_sigpending(&sig->shared_pending); | 801 | init_sigpending(&sig->shared_pending); |
802 | INIT_LIST_HEAD(&sig->posix_timers); | 802 | INIT_LIST_HEAD(&sig->posix_timers); |
803 | 803 | ||
804 | sig->it_real_value = sig->it_real_incr = 0; | 804 | hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC); |
805 | sig->it_real_incr.tv64 = 0; | ||
805 | sig->real_timer.function = it_real_fn; | 806 | sig->real_timer.function = it_real_fn; |
806 | sig->real_timer.data = (unsigned long) tsk; | 807 | sig->real_timer.data = tsk; |
807 | init_timer(&sig->real_timer); | ||
808 | 808 | ||
809 | sig->it_virt_expires = cputime_zero; | 809 | sig->it_virt_expires = cputime_zero; |
810 | sig->it_virt_incr = cputime_zero; | 810 | sig->it_virt_incr = cputime_zero; |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c new file mode 100644 index 000000000000..f073a2461faa --- /dev/null +++ b/kernel/hrtimer.c | |||
@@ -0,0 +1,821 @@ | |||
1 | /* | ||
2 | * linux/kernel/hrtimer.c | ||
3 | * | ||
4 | * Copyright(C) 2005, Thomas Gleixner <tglx@linutronix.de> | ||
5 | * Copyright(C) 2005, Red Hat, Inc., Ingo Molnar | ||
6 | * | ||
7 | * High-resolution kernel timers | ||
8 | * | ||
9 | * In contrast to the low-resolution timeout API implemented in | ||
10 | * kernel/timer.c, hrtimers provide finer resolution and accuracy | ||
11 | * depending on system configuration and capabilities. | ||
12 | * | ||
13 | * These timers are currently used for: | ||
14 | * - itimers | ||
15 | * - POSIX timers | ||
16 | * - nanosleep | ||
17 | * - precise in-kernel timing | ||
18 | * | ||
19 | * Started by: Thomas Gleixner and Ingo Molnar | ||
20 | * | ||
21 | * Credits: | ||
22 | * based on kernel/timer.c | ||
23 | * | ||
24 | * For licencing details see kernel-base/COPYING | ||
25 | */ | ||
26 | |||
27 | #include <linux/cpu.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/percpu.h> | ||
30 | #include <linux/hrtimer.h> | ||
31 | #include <linux/notifier.h> | ||
32 | #include <linux/syscalls.h> | ||
33 | #include <linux/interrupt.h> | ||
34 | |||
35 | #include <asm/uaccess.h> | ||
36 | |||
37 | /** | ||
38 | * ktime_get - get the monotonic time in ktime_t format | ||
39 | * | ||
40 | * returns the time in ktime_t format | ||
41 | */ | ||
42 | static ktime_t ktime_get(void) | ||
43 | { | ||
44 | struct timespec now; | ||
45 | |||
46 | ktime_get_ts(&now); | ||
47 | |||
48 | return timespec_to_ktime(now); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * ktime_get_real - get the real (wall-) time in ktime_t format | ||
53 | * | ||
54 | * returns the time in ktime_t format | ||
55 | */ | ||
56 | static ktime_t ktime_get_real(void) | ||
57 | { | ||
58 | struct timespec now; | ||
59 | |||
60 | getnstimeofday(&now); | ||
61 | |||
62 | return timespec_to_ktime(now); | ||
63 | } | ||
64 | |||
65 | EXPORT_SYMBOL_GPL(ktime_get_real); | ||
66 | |||
67 | /* | ||
68 | * The timer bases: | ||
69 | */ | ||
70 | |||
71 | #define MAX_HRTIMER_BASES 2 | ||
72 | |||
73 | static DEFINE_PER_CPU(struct hrtimer_base, hrtimer_bases[MAX_HRTIMER_BASES]) = | ||
74 | { | ||
75 | { | ||
76 | .index = CLOCK_REALTIME, | ||
77 | .get_time = &ktime_get_real, | ||
78 | .resolution = KTIME_REALTIME_RES, | ||
79 | }, | ||
80 | { | ||
81 | .index = CLOCK_MONOTONIC, | ||
82 | .get_time = &ktime_get, | ||
83 | .resolution = KTIME_MONOTONIC_RES, | ||
84 | }, | ||
85 | }; | ||
86 | |||
87 | /** | ||
88 | * ktime_get_ts - get the monotonic clock in timespec format | ||
89 | * | ||
90 | * @ts: pointer to timespec variable | ||
91 | * | ||
92 | * The function calculates the monotonic clock from the realtime | ||
93 | * clock and the wall_to_monotonic offset and stores the result | ||
94 | * in normalized timespec format in the variable pointed to by ts. | ||
95 | */ | ||
96 | void ktime_get_ts(struct timespec *ts) | ||
97 | { | ||
98 | struct timespec tomono; | ||
99 | unsigned long seq; | ||
100 | |||
101 | do { | ||
102 | seq = read_seqbegin(&xtime_lock); | ||
103 | getnstimeofday(ts); | ||
104 | tomono = wall_to_monotonic; | ||
105 | |||
106 | } while (read_seqretry(&xtime_lock, seq)); | ||
107 | |||
108 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, | ||
109 | ts->tv_nsec + tomono.tv_nsec); | ||
110 | } | ||
111 | EXPORT_SYMBOL_GPL(ktime_get_ts); | ||
112 | |||
113 | /* | ||
114 | * Functions and macros which are different for UP/SMP systems are kept in a | ||
115 | * single place | ||
116 | */ | ||
117 | #ifdef CONFIG_SMP | ||
118 | |||
119 | #define set_curr_timer(b, t) do { (b)->curr_timer = (t); } while (0) | ||
120 | |||
121 | /* | ||
122 | * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock | ||
123 | * means that all timers which are tied to this base via timer->base are | ||
124 | * locked, and the base itself is locked too. | ||
125 | * | ||
126 | * So __run_timers/migrate_timers can safely modify all timers which could | ||
127 | * be found on the lists/queues. | ||
128 | * | ||
129 | * When the timer's base is locked, and the timer removed from list, it is | ||
130 | * possible to set timer->base = NULL and drop the lock: the timer remains | ||
131 | * locked. | ||
132 | */ | ||
133 | static struct hrtimer_base *lock_hrtimer_base(const struct hrtimer *timer, | ||
134 | unsigned long *flags) | ||
135 | { | ||
136 | struct hrtimer_base *base; | ||
137 | |||
138 | for (;;) { | ||
139 | base = timer->base; | ||
140 | if (likely(base != NULL)) { | ||
141 | spin_lock_irqsave(&base->lock, *flags); | ||
142 | if (likely(base == timer->base)) | ||
143 | return base; | ||
144 | /* The timer has migrated to another CPU: */ | ||
145 | spin_unlock_irqrestore(&base->lock, *flags); | ||
146 | } | ||
147 | cpu_relax(); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | /* | ||
152 | * Switch the timer base to the current CPU when possible. | ||
153 | */ | ||
154 | static inline struct hrtimer_base * | ||
155 | switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_base *base) | ||
156 | { | ||
157 | struct hrtimer_base *new_base; | ||
158 | |||
159 | new_base = &__get_cpu_var(hrtimer_bases[base->index]); | ||
160 | |||
161 | if (base != new_base) { | ||
162 | /* | ||
163 | * We are trying to schedule the timer on the local CPU. | ||
164 | * However we can't change timer's base while it is running, | ||
165 | * so we keep it on the same CPU. No hassle vs. reprogramming | ||
166 | * the event source in the high resolution case. The softirq | ||
167 | * code will take care of this when the timer function has | ||
168 | * completed. There is no conflict as we hold the lock until | ||
169 | * the timer is enqueued. | ||
170 | */ | ||
171 | if (unlikely(base->curr_timer == timer)) | ||
172 | return base; | ||
173 | |||
174 | /* See the comment in lock_timer_base() */ | ||
175 | timer->base = NULL; | ||
176 | spin_unlock(&base->lock); | ||
177 | spin_lock(&new_base->lock); | ||
178 | timer->base = new_base; | ||
179 | } | ||
180 | return new_base; | ||
181 | } | ||
182 | |||
183 | #else /* CONFIG_SMP */ | ||
184 | |||
185 | #define set_curr_timer(b, t) do { } while (0) | ||
186 | |||
187 | static inline struct hrtimer_base * | ||
188 | lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) | ||
189 | { | ||
190 | struct hrtimer_base *base = timer->base; | ||
191 | |||
192 | spin_lock_irqsave(&base->lock, *flags); | ||
193 | |||
194 | return base; | ||
195 | } | ||
196 | |||
197 | #define switch_hrtimer_base(t, b) (b) | ||
198 | |||
199 | #endif /* !CONFIG_SMP */ | ||
200 | |||
201 | /* | ||
202 | * Functions for the union type storage format of ktime_t which are | ||
203 | * too large for inlining: | ||
204 | */ | ||
205 | #if BITS_PER_LONG < 64 | ||
206 | # ifndef CONFIG_KTIME_SCALAR | ||
207 | /** | ||
208 | * ktime_add_ns - Add a scalar nanoseconds value to a ktime_t variable | ||
209 | * | ||
210 | * @kt: addend | ||
211 | * @nsec: the scalar nsec value to add | ||
212 | * | ||
213 | * Returns the sum of kt and nsec in ktime_t format | ||
214 | */ | ||
215 | ktime_t ktime_add_ns(const ktime_t kt, u64 nsec) | ||
216 | { | ||
217 | ktime_t tmp; | ||
218 | |||
219 | if (likely(nsec < NSEC_PER_SEC)) { | ||
220 | tmp.tv64 = nsec; | ||
221 | } else { | ||
222 | unsigned long rem = do_div(nsec, NSEC_PER_SEC); | ||
223 | |||
224 | tmp = ktime_set((long)nsec, rem); | ||
225 | } | ||
226 | |||
227 | return ktime_add(kt, tmp); | ||
228 | } | ||
229 | |||
230 | #else /* CONFIG_KTIME_SCALAR */ | ||
231 | |||
232 | # endif /* !CONFIG_KTIME_SCALAR */ | ||
233 | |||
234 | /* | ||
235 | * Divide a ktime value by a nanosecond value | ||
236 | */ | ||
237 | static unsigned long ktime_divns(const ktime_t kt, nsec_t div) | ||
238 | { | ||
239 | u64 dclc, inc, dns; | ||
240 | int sft = 0; | ||
241 | |||
242 | dclc = dns = ktime_to_ns(kt); | ||
243 | inc = div; | ||
244 | /* Make sure the divisor is less than 2^32: */ | ||
245 | while (div >> 32) { | ||
246 | sft++; | ||
247 | div >>= 1; | ||
248 | } | ||
249 | dclc >>= sft; | ||
250 | do_div(dclc, (unsigned long) div); | ||
251 | |||
252 | return (unsigned long) dclc; | ||
253 | } | ||
254 | |||
255 | #else /* BITS_PER_LONG < 64 */ | ||
256 | # define ktime_divns(kt, div) (unsigned long)((kt).tv64 / (div)) | ||
257 | #endif /* BITS_PER_LONG >= 64 */ | ||
258 | |||
259 | /* | ||
260 | * Counterpart to lock_timer_base above: | ||
261 | */ | ||
262 | static inline | ||
263 | void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) | ||
264 | { | ||
265 | spin_unlock_irqrestore(&timer->base->lock, *flags); | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * hrtimer_forward - forward the timer expiry | ||
270 | * | ||
271 | * @timer: hrtimer to forward | ||
272 | * @interval: the interval to forward | ||
273 | * | ||
274 | * Forward the timer expiry so it will expire in the future. | ||
275 | * The number of overruns is added to the overrun field. | ||
276 | */ | ||
277 | unsigned long | ||
278 | hrtimer_forward(struct hrtimer *timer, const ktime_t interval) | ||
279 | { | ||
280 | unsigned long orun = 1; | ||
281 | ktime_t delta, now; | ||
282 | |||
283 | now = timer->base->get_time(); | ||
284 | |||
285 | delta = ktime_sub(now, timer->expires); | ||
286 | |||
287 | if (delta.tv64 < 0) | ||
288 | return 0; | ||
289 | |||
290 | if (unlikely(delta.tv64 >= interval.tv64)) { | ||
291 | nsec_t incr = ktime_to_ns(interval); | ||
292 | |||
293 | orun = ktime_divns(delta, incr); | ||
294 | timer->expires = ktime_add_ns(timer->expires, incr * orun); | ||
295 | if (timer->expires.tv64 > now.tv64) | ||
296 | return orun; | ||
297 | /* | ||
298 | * This (and the ktime_add() below) is the | ||
299 | * correction for exact: | ||
300 | */ | ||
301 | orun++; | ||
302 | } | ||
303 | timer->expires = ktime_add(timer->expires, interval); | ||
304 | |||
305 | return orun; | ||
306 | } | ||
307 | |||
308 | /* | ||
309 | * enqueue_hrtimer - internal function to (re)start a timer | ||
310 | * | ||
311 | * The timer is inserted in expiry order. Insertion into the | ||
312 | * red black tree is O(log(n)). Must hold the base lock. | ||
313 | */ | ||
314 | static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | ||
315 | { | ||
316 | struct rb_node **link = &base->active.rb_node; | ||
317 | struct list_head *prev = &base->pending; | ||
318 | struct rb_node *parent = NULL; | ||
319 | struct hrtimer *entry; | ||
320 | |||
321 | /* | ||
322 | * Find the right place in the rbtree: | ||
323 | */ | ||
324 | while (*link) { | ||
325 | parent = *link; | ||
326 | entry = rb_entry(parent, struct hrtimer, node); | ||
327 | /* | ||
328 | * We dont care about collisions. Nodes with | ||
329 | * the same expiry time stay together. | ||
330 | */ | ||
331 | if (timer->expires.tv64 < entry->expires.tv64) | ||
332 | link = &(*link)->rb_left; | ||
333 | else { | ||
334 | link = &(*link)->rb_right; | ||
335 | prev = &entry->list; | ||
336 | } | ||
337 | } | ||
338 | |||
339 | /* | ||
340 | * Insert the timer to the rbtree and to the sorted list: | ||
341 | */ | ||
342 | rb_link_node(&timer->node, parent, link); | ||
343 | rb_insert_color(&timer->node, &base->active); | ||
344 | list_add(&timer->list, prev); | ||
345 | |||
346 | timer->state = HRTIMER_PENDING; | ||
347 | } | ||
348 | |||
349 | |||
350 | /* | ||
351 | * __remove_hrtimer - internal function to remove a timer | ||
352 | * | ||
353 | * Caller must hold the base lock. | ||
354 | */ | ||
355 | static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | ||
356 | { | ||
357 | /* | ||
358 | * Remove the timer from the sorted list and from the rbtree: | ||
359 | */ | ||
360 | list_del(&timer->list); | ||
361 | rb_erase(&timer->node, &base->active); | ||
362 | } | ||
363 | |||
364 | /* | ||
365 | * remove hrtimer, called with base lock held | ||
366 | */ | ||
367 | static inline int | ||
368 | remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base) | ||
369 | { | ||
370 | if (hrtimer_active(timer)) { | ||
371 | __remove_hrtimer(timer, base); | ||
372 | timer->state = HRTIMER_INACTIVE; | ||
373 | return 1; | ||
374 | } | ||
375 | return 0; | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * hrtimer_start - (re)start an relative timer on the current CPU | ||
380 | * | ||
381 | * @timer: the timer to be added | ||
382 | * @tim: expiry time | ||
383 | * @mode: expiry mode: absolute (HRTIMER_ABS) or relative (HRTIMER_REL) | ||
384 | * | ||
385 | * Returns: | ||
386 | * 0 on success | ||
387 | * 1 when the timer was active | ||
388 | */ | ||
389 | int | ||
390 | hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode) | ||
391 | { | ||
392 | struct hrtimer_base *base, *new_base; | ||
393 | unsigned long flags; | ||
394 | int ret; | ||
395 | |||
396 | base = lock_hrtimer_base(timer, &flags); | ||
397 | |||
398 | /* Remove an active timer from the queue: */ | ||
399 | ret = remove_hrtimer(timer, base); | ||
400 | |||
401 | /* Switch the timer base, if necessary: */ | ||
402 | new_base = switch_hrtimer_base(timer, base); | ||
403 | |||
404 | if (mode == HRTIMER_REL) | ||
405 | tim = ktime_add(tim, new_base->get_time()); | ||
406 | timer->expires = tim; | ||
407 | |||
408 | enqueue_hrtimer(timer, new_base); | ||
409 | |||
410 | unlock_hrtimer_base(timer, &flags); | ||
411 | |||
412 | return ret; | ||
413 | } | ||
414 | |||
415 | /** | ||
416 | * hrtimer_try_to_cancel - try to deactivate a timer | ||
417 | * | ||
418 | * @timer: hrtimer to stop | ||
419 | * | ||
420 | * Returns: | ||
421 | * 0 when the timer was not active | ||
422 | * 1 when the timer was active | ||
423 | * -1 when the timer is currently excuting the callback function and | ||
424 | * can not be stopped | ||
425 | */ | ||
426 | int hrtimer_try_to_cancel(struct hrtimer *timer) | ||
427 | { | ||
428 | struct hrtimer_base *base; | ||
429 | unsigned long flags; | ||
430 | int ret = -1; | ||
431 | |||
432 | base = lock_hrtimer_base(timer, &flags); | ||
433 | |||
434 | if (base->curr_timer != timer) | ||
435 | ret = remove_hrtimer(timer, base); | ||
436 | |||
437 | unlock_hrtimer_base(timer, &flags); | ||
438 | |||
439 | return ret; | ||
440 | |||
441 | } | ||
442 | |||
443 | /** | ||
444 | * hrtimer_cancel - cancel a timer and wait for the handler to finish. | ||
445 | * | ||
446 | * @timer: the timer to be cancelled | ||
447 | * | ||
448 | * Returns: | ||
449 | * 0 when the timer was not active | ||
450 | * 1 when the timer was active | ||
451 | */ | ||
452 | int hrtimer_cancel(struct hrtimer *timer) | ||
453 | { | ||
454 | for (;;) { | ||
455 | int ret = hrtimer_try_to_cancel(timer); | ||
456 | |||
457 | if (ret >= 0) | ||
458 | return ret; | ||
459 | } | ||
460 | } | ||
461 | |||
462 | /** | ||
463 | * hrtimer_get_remaining - get remaining time for the timer | ||
464 | * | ||
465 | * @timer: the timer to read | ||
466 | */ | ||
467 | ktime_t hrtimer_get_remaining(const struct hrtimer *timer) | ||
468 | { | ||
469 | struct hrtimer_base *base; | ||
470 | unsigned long flags; | ||
471 | ktime_t rem; | ||
472 | |||
473 | base = lock_hrtimer_base(timer, &flags); | ||
474 | rem = ktime_sub(timer->expires, timer->base->get_time()); | ||
475 | unlock_hrtimer_base(timer, &flags); | ||
476 | |||
477 | return rem; | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * hrtimer_rebase - rebase an initialized hrtimer to a different base | ||
482 | * | ||
483 | * @timer: the timer to be rebased | ||
484 | * @clock_id: the clock to be used | ||
485 | */ | ||
486 | void hrtimer_rebase(struct hrtimer *timer, const clockid_t clock_id) | ||
487 | { | ||
488 | struct hrtimer_base *bases; | ||
489 | |||
490 | bases = per_cpu(hrtimer_bases, raw_smp_processor_id()); | ||
491 | timer->base = &bases[clock_id]; | ||
492 | } | ||
493 | |||
494 | /** | ||
495 | * hrtimer_init - initialize a timer to the given clock | ||
496 | * | ||
497 | * @timer: the timer to be initialized | ||
498 | * @clock_id: the clock to be used | ||
499 | */ | ||
500 | void hrtimer_init(struct hrtimer *timer, const clockid_t clock_id) | ||
501 | { | ||
502 | memset(timer, 0, sizeof(struct hrtimer)); | ||
503 | hrtimer_rebase(timer, clock_id); | ||
504 | } | ||
505 | |||
506 | /** | ||
507 | * hrtimer_get_res - get the timer resolution for a clock | ||
508 | * | ||
509 | * @which_clock: which clock to query | ||
510 | * @tp: pointer to timespec variable to store the resolution | ||
511 | * | ||
512 | * Store the resolution of the clock selected by which_clock in the | ||
513 | * variable pointed to by tp. | ||
514 | */ | ||
515 | int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) | ||
516 | { | ||
517 | struct hrtimer_base *bases; | ||
518 | |||
519 | tp->tv_sec = 0; | ||
520 | bases = per_cpu(hrtimer_bases, raw_smp_processor_id()); | ||
521 | tp->tv_nsec = bases[which_clock].resolution; | ||
522 | |||
523 | return 0; | ||
524 | } | ||
525 | |||
526 | /* | ||
527 | * Expire the per base hrtimer-queue: | ||
528 | */ | ||
529 | static inline void run_hrtimer_queue(struct hrtimer_base *base) | ||
530 | { | ||
531 | ktime_t now = base->get_time(); | ||
532 | |||
533 | spin_lock_irq(&base->lock); | ||
534 | |||
535 | while (!list_empty(&base->pending)) { | ||
536 | struct hrtimer *timer; | ||
537 | int (*fn)(void *); | ||
538 | int restart; | ||
539 | void *data; | ||
540 | |||
541 | timer = list_entry(base->pending.next, struct hrtimer, list); | ||
542 | if (now.tv64 <= timer->expires.tv64) | ||
543 | break; | ||
544 | |||
545 | fn = timer->function; | ||
546 | data = timer->data; | ||
547 | set_curr_timer(base, timer); | ||
548 | __remove_hrtimer(timer, base); | ||
549 | spin_unlock_irq(&base->lock); | ||
550 | |||
551 | /* | ||
552 | * fn == NULL is special case for the simplest timer | ||
553 | * variant - wake up process and do not restart: | ||
554 | */ | ||
555 | if (!fn) { | ||
556 | wake_up_process(data); | ||
557 | restart = HRTIMER_NORESTART; | ||
558 | } else | ||
559 | restart = fn(data); | ||
560 | |||
561 | spin_lock_irq(&base->lock); | ||
562 | |||
563 | if (restart == HRTIMER_RESTART) | ||
564 | enqueue_hrtimer(timer, base); | ||
565 | else | ||
566 | timer->state = HRTIMER_EXPIRED; | ||
567 | } | ||
568 | set_curr_timer(base, NULL); | ||
569 | spin_unlock_irq(&base->lock); | ||
570 | } | ||
571 | |||
572 | /* | ||
573 | * Called from timer softirq every jiffy, expire hrtimers: | ||
574 | */ | ||
575 | void hrtimer_run_queues(void) | ||
576 | { | ||
577 | struct hrtimer_base *base = __get_cpu_var(hrtimer_bases); | ||
578 | int i; | ||
579 | |||
580 | for (i = 0; i < MAX_HRTIMER_BASES; i++) | ||
581 | run_hrtimer_queue(&base[i]); | ||
582 | } | ||
583 | |||
584 | /* | ||
585 | * Sleep related functions: | ||
586 | */ | ||
587 | |||
588 | /** | ||
589 | * schedule_hrtimer - sleep until timeout | ||
590 | * | ||
591 | * @timer: hrtimer variable initialized with the correct clock base | ||
592 | * @mode: timeout value is abs/rel | ||
593 | * | ||
594 | * Make the current task sleep until @timeout is | ||
595 | * elapsed. | ||
596 | * | ||
597 | * You can set the task state as follows - | ||
598 | * | ||
599 | * %TASK_UNINTERRUPTIBLE - at least @timeout is guaranteed to | ||
600 | * pass before the routine returns. The routine will return 0 | ||
601 | * | ||
602 | * %TASK_INTERRUPTIBLE - the routine may return early if a signal is | ||
603 | * delivered to the current task. In this case the remaining time | ||
604 | * will be returned | ||
605 | * | ||
606 | * The current task state is guaranteed to be TASK_RUNNING when this | ||
607 | * routine returns. | ||
608 | */ | ||
609 | static ktime_t __sched | ||
610 | schedule_hrtimer(struct hrtimer *timer, const enum hrtimer_mode mode) | ||
611 | { | ||
612 | /* fn stays NULL, meaning single-shot wakeup: */ | ||
613 | timer->data = current; | ||
614 | |||
615 | hrtimer_start(timer, timer->expires, mode); | ||
616 | |||
617 | schedule(); | ||
618 | hrtimer_cancel(timer); | ||
619 | |||
620 | /* Return the remaining time: */ | ||
621 | if (timer->state != HRTIMER_EXPIRED) | ||
622 | return ktime_sub(timer->expires, timer->base->get_time()); | ||
623 | else | ||
624 | return (ktime_t) {.tv64 = 0 }; | ||
625 | } | ||
626 | |||
627 | static inline ktime_t __sched | ||
628 | schedule_hrtimer_interruptible(struct hrtimer *timer, | ||
629 | const enum hrtimer_mode mode) | ||
630 | { | ||
631 | set_current_state(TASK_INTERRUPTIBLE); | ||
632 | |||
633 | return schedule_hrtimer(timer, mode); | ||
634 | } | ||
635 | |||
636 | static long __sched | ||
637 | nanosleep_restart(struct restart_block *restart, clockid_t clockid) | ||
638 | { | ||
639 | struct timespec __user *rmtp, tu; | ||
640 | void *rfn_save = restart->fn; | ||
641 | struct hrtimer timer; | ||
642 | ktime_t rem; | ||
643 | |||
644 | restart->fn = do_no_restart_syscall; | ||
645 | |||
646 | hrtimer_init(&timer, clockid); | ||
647 | |||
648 | timer.expires.tv64 = ((u64)restart->arg1 << 32) | (u64) restart->arg0; | ||
649 | |||
650 | rem = schedule_hrtimer_interruptible(&timer, HRTIMER_ABS); | ||
651 | |||
652 | if (rem.tv64 <= 0) | ||
653 | return 0; | ||
654 | |||
655 | rmtp = (struct timespec __user *) restart->arg2; | ||
656 | tu = ktime_to_timespec(rem); | ||
657 | if (rmtp && copy_to_user(rmtp, &tu, sizeof(tu))) | ||
658 | return -EFAULT; | ||
659 | |||
660 | restart->fn = rfn_save; | ||
661 | |||
662 | /* The other values in restart are already filled in */ | ||
663 | return -ERESTART_RESTARTBLOCK; | ||
664 | } | ||
665 | |||
666 | static long __sched nanosleep_restart_mono(struct restart_block *restart) | ||
667 | { | ||
668 | return nanosleep_restart(restart, CLOCK_MONOTONIC); | ||
669 | } | ||
670 | |||
671 | static long __sched nanosleep_restart_real(struct restart_block *restart) | ||
672 | { | ||
673 | return nanosleep_restart(restart, CLOCK_REALTIME); | ||
674 | } | ||
675 | |||
676 | long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, | ||
677 | const enum hrtimer_mode mode, const clockid_t clockid) | ||
678 | { | ||
679 | struct restart_block *restart; | ||
680 | struct hrtimer timer; | ||
681 | struct timespec tu; | ||
682 | ktime_t rem; | ||
683 | |||
684 | hrtimer_init(&timer, clockid); | ||
685 | |||
686 | timer.expires = timespec_to_ktime(*rqtp); | ||
687 | |||
688 | rem = schedule_hrtimer_interruptible(&timer, mode); | ||
689 | if (rem.tv64 <= 0) | ||
690 | return 0; | ||
691 | |||
692 | /* Absolute timers do not update the rmtp value: */ | ||
693 | if (mode == HRTIMER_ABS) | ||
694 | return -ERESTARTNOHAND; | ||
695 | |||
696 | tu = ktime_to_timespec(rem); | ||
697 | |||
698 | if (rmtp && copy_to_user(rmtp, &tu, sizeof(tu))) | ||
699 | return -EFAULT; | ||
700 | |||
701 | restart = ¤t_thread_info()->restart_block; | ||
702 | restart->fn = (clockid == CLOCK_MONOTONIC) ? | ||
703 | nanosleep_restart_mono : nanosleep_restart_real; | ||
704 | restart->arg0 = timer.expires.tv64 & 0xFFFFFFFF; | ||
705 | restart->arg1 = timer.expires.tv64 >> 32; | ||
706 | restart->arg2 = (unsigned long) rmtp; | ||
707 | |||
708 | return -ERESTART_RESTARTBLOCK; | ||
709 | } | ||
710 | |||
711 | asmlinkage long | ||
712 | sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) | ||
713 | { | ||
714 | struct timespec tu; | ||
715 | |||
716 | if (copy_from_user(&tu, rqtp, sizeof(tu))) | ||
717 | return -EFAULT; | ||
718 | |||
719 | if (!timespec_valid(&tu)) | ||
720 | return -EINVAL; | ||
721 | |||
722 | return hrtimer_nanosleep(&tu, rmtp, HRTIMER_REL, CLOCK_MONOTONIC); | ||
723 | } | ||
724 | |||
725 | /* | ||
726 | * Functions related to boot-time initialization: | ||
727 | */ | ||
728 | static void __devinit init_hrtimers_cpu(int cpu) | ||
729 | { | ||
730 | struct hrtimer_base *base = per_cpu(hrtimer_bases, cpu); | ||
731 | int i; | ||
732 | |||
733 | for (i = 0; i < MAX_HRTIMER_BASES; i++) { | ||
734 | spin_lock_init(&base->lock); | ||
735 | INIT_LIST_HEAD(&base->pending); | ||
736 | base++; | ||
737 | } | ||
738 | } | ||
739 | |||
740 | #ifdef CONFIG_HOTPLUG_CPU | ||
741 | |||
742 | static void migrate_hrtimer_list(struct hrtimer_base *old_base, | ||
743 | struct hrtimer_base *new_base) | ||
744 | { | ||
745 | struct hrtimer *timer; | ||
746 | struct rb_node *node; | ||
747 | |||
748 | while ((node = rb_first(&old_base->active))) { | ||
749 | timer = rb_entry(node, struct hrtimer, node); | ||
750 | __remove_hrtimer(timer, old_base); | ||
751 | timer->base = new_base; | ||
752 | enqueue_hrtimer(timer, new_base); | ||
753 | } | ||
754 | } | ||
755 | |||
756 | static void migrate_hrtimers(int cpu) | ||
757 | { | ||
758 | struct hrtimer_base *old_base, *new_base; | ||
759 | int i; | ||
760 | |||
761 | BUG_ON(cpu_online(cpu)); | ||
762 | old_base = per_cpu(hrtimer_bases, cpu); | ||
763 | new_base = get_cpu_var(hrtimer_bases); | ||
764 | |||
765 | local_irq_disable(); | ||
766 | |||
767 | for (i = 0; i < MAX_HRTIMER_BASES; i++) { | ||
768 | |||
769 | spin_lock(&new_base->lock); | ||
770 | spin_lock(&old_base->lock); | ||
771 | |||
772 | BUG_ON(old_base->curr_timer); | ||
773 | |||
774 | migrate_hrtimer_list(old_base, new_base); | ||
775 | |||
776 | spin_unlock(&old_base->lock); | ||
777 | spin_unlock(&new_base->lock); | ||
778 | old_base++; | ||
779 | new_base++; | ||
780 | } | ||
781 | |||
782 | local_irq_enable(); | ||
783 | put_cpu_var(hrtimer_bases); | ||
784 | } | ||
785 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
786 | |||
787 | static int __devinit hrtimer_cpu_notify(struct notifier_block *self, | ||
788 | unsigned long action, void *hcpu) | ||
789 | { | ||
790 | long cpu = (long)hcpu; | ||
791 | |||
792 | switch (action) { | ||
793 | |||
794 | case CPU_UP_PREPARE: | ||
795 | init_hrtimers_cpu(cpu); | ||
796 | break; | ||
797 | |||
798 | #ifdef CONFIG_HOTPLUG_CPU | ||
799 | case CPU_DEAD: | ||
800 | migrate_hrtimers(cpu); | ||
801 | break; | ||
802 | #endif | ||
803 | |||
804 | default: | ||
805 | break; | ||
806 | } | ||
807 | |||
808 | return NOTIFY_OK; | ||
809 | } | ||
810 | |||
811 | static struct notifier_block __devinitdata hrtimers_nb = { | ||
812 | .notifier_call = hrtimer_cpu_notify, | ||
813 | }; | ||
814 | |||
815 | void __init hrtimers_init(void) | ||
816 | { | ||
817 | hrtimer_cpu_notify(&hrtimers_nb, (unsigned long)CPU_UP_PREPARE, | ||
818 | (void *)(long)smp_processor_id()); | ||
819 | register_cpu_notifier(&hrtimers_nb); | ||
820 | } | ||
821 | |||
diff --git a/kernel/itimer.c b/kernel/itimer.c index 7c1b25e25e47..c2c05c4ff28d 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c | |||
@@ -12,36 +12,46 @@ | |||
12 | #include <linux/syscalls.h> | 12 | #include <linux/syscalls.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/posix-timers.h> | 14 | #include <linux/posix-timers.h> |
15 | #include <linux/hrtimer.h> | ||
15 | 16 | ||
16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
17 | 18 | ||
18 | static unsigned long it_real_value(struct signal_struct *sig) | 19 | /** |
20 | * itimer_get_remtime - get remaining time for the timer | ||
21 | * | ||
22 | * @timer: the timer to read | ||
23 | * | ||
24 | * Returns the delta between the expiry time and now, which can be | ||
25 | * less than zero or 1usec for an pending expired timer | ||
26 | */ | ||
27 | static struct timeval itimer_get_remtime(struct hrtimer *timer) | ||
19 | { | 28 | { |
20 | unsigned long val = 0; | 29 | ktime_t rem = hrtimer_get_remaining(timer); |
21 | if (timer_pending(&sig->real_timer)) { | ||
22 | val = sig->real_timer.expires - jiffies; | ||
23 | 30 | ||
24 | /* look out for negative/zero itimer.. */ | 31 | /* |
25 | if ((long) val <= 0) | 32 | * Racy but safe: if the itimer expires after the above |
26 | val = 1; | 33 | * hrtimer_get_remtime() call but before this condition |
27 | } | 34 | * then we return 0 - which is correct. |
28 | return val; | 35 | */ |
36 | if (hrtimer_active(timer)) { | ||
37 | if (rem.tv64 <= 0) | ||
38 | rem.tv64 = NSEC_PER_USEC; | ||
39 | } else | ||
40 | rem.tv64 = 0; | ||
41 | |||
42 | return ktime_to_timeval(rem); | ||
29 | } | 43 | } |
30 | 44 | ||
31 | int do_getitimer(int which, struct itimerval *value) | 45 | int do_getitimer(int which, struct itimerval *value) |
32 | { | 46 | { |
33 | struct task_struct *tsk = current; | 47 | struct task_struct *tsk = current; |
34 | unsigned long interval, val; | ||
35 | cputime_t cinterval, cval; | 48 | cputime_t cinterval, cval; |
36 | 49 | ||
37 | switch (which) { | 50 | switch (which) { |
38 | case ITIMER_REAL: | 51 | case ITIMER_REAL: |
39 | spin_lock_irq(&tsk->sighand->siglock); | 52 | value->it_value = itimer_get_remtime(&tsk->signal->real_timer); |
40 | interval = tsk->signal->it_real_incr; | 53 | value->it_interval = |
41 | val = it_real_value(tsk->signal); | 54 | ktime_to_timeval(tsk->signal->it_real_incr); |
42 | spin_unlock_irq(&tsk->sighand->siglock); | ||
43 | jiffies_to_timeval(val, &value->it_value); | ||
44 | jiffies_to_timeval(interval, &value->it_interval); | ||
45 | break; | 55 | break; |
46 | case ITIMER_VIRTUAL: | 56 | case ITIMER_VIRTUAL: |
47 | read_lock(&tasklist_lock); | 57 | read_lock(&tasklist_lock); |
@@ -113,59 +123,45 @@ asmlinkage long sys_getitimer(int which, struct itimerval __user *value) | |||
113 | } | 123 | } |
114 | 124 | ||
115 | 125 | ||
116 | void it_real_fn(unsigned long __data) | 126 | /* |
127 | * The timer is automagically restarted, when interval != 0 | ||
128 | */ | ||
129 | int it_real_fn(void *data) | ||
117 | { | 130 | { |
118 | struct task_struct * p = (struct task_struct *) __data; | 131 | struct task_struct *tsk = (struct task_struct *) data; |
119 | unsigned long inc = p->signal->it_real_incr; | ||
120 | 132 | ||
121 | send_group_sig_info(SIGALRM, SEND_SIG_PRIV, p); | 133 | send_group_sig_info(SIGALRM, SEND_SIG_PRIV, tsk); |
122 | 134 | ||
123 | /* | 135 | if (tsk->signal->it_real_incr.tv64 != 0) { |
124 | * Now restart the timer if necessary. We don't need any locking | 136 | hrtimer_forward(&tsk->signal->real_timer, |
125 | * here because do_setitimer makes sure we have finished running | 137 | tsk->signal->it_real_incr); |
126 | * before it touches anything. | 138 | |
127 | * Note, we KNOW we are (or should be) at a jiffie edge here so | 139 | return HRTIMER_RESTART; |
128 | * we don't need the +1 stuff. Also, we want to use the prior | 140 | } |
129 | * expire value so as to not "slip" a jiffie if we are late. | 141 | return HRTIMER_NORESTART; |
130 | * Deal with requesting a time prior to "now" here rather than | ||
131 | * in add_timer. | ||
132 | */ | ||
133 | if (!inc) | ||
134 | return; | ||
135 | while (time_before_eq(p->signal->real_timer.expires, jiffies)) | ||
136 | p->signal->real_timer.expires += inc; | ||
137 | add_timer(&p->signal->real_timer); | ||
138 | } | 142 | } |
139 | 143 | ||
140 | int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | 144 | int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) |
141 | { | 145 | { |
142 | struct task_struct *tsk = current; | 146 | struct task_struct *tsk = current; |
143 | unsigned long val, interval, expires; | 147 | struct hrtimer *timer; |
148 | ktime_t expires; | ||
144 | cputime_t cval, cinterval, nval, ninterval; | 149 | cputime_t cval, cinterval, nval, ninterval; |
145 | 150 | ||
146 | switch (which) { | 151 | switch (which) { |
147 | case ITIMER_REAL: | 152 | case ITIMER_REAL: |
148 | again: | 153 | timer = &tsk->signal->real_timer; |
149 | spin_lock_irq(&tsk->sighand->siglock); | 154 | hrtimer_cancel(timer); |
150 | interval = tsk->signal->it_real_incr; | ||
151 | val = it_real_value(tsk->signal); | ||
152 | /* We are sharing ->siglock with it_real_fn() */ | ||
153 | if (try_to_del_timer_sync(&tsk->signal->real_timer) < 0) { | ||
154 | spin_unlock_irq(&tsk->sighand->siglock); | ||
155 | goto again; | ||
156 | } | ||
157 | tsk->signal->it_real_incr = | ||
158 | timeval_to_jiffies(&value->it_interval); | ||
159 | expires = timeval_to_jiffies(&value->it_value); | ||
160 | if (expires) | ||
161 | mod_timer(&tsk->signal->real_timer, | ||
162 | jiffies + 1 + expires); | ||
163 | spin_unlock_irq(&tsk->sighand->siglock); | ||
164 | if (ovalue) { | 155 | if (ovalue) { |
165 | jiffies_to_timeval(val, &ovalue->it_value); | 156 | ovalue->it_value = itimer_get_remtime(timer); |
166 | jiffies_to_timeval(interval, | 157 | ovalue->it_interval |
167 | &ovalue->it_interval); | 158 | = ktime_to_timeval(tsk->signal->it_real_incr); |
168 | } | 159 | } |
160 | tsk->signal->it_real_incr = | ||
161 | timeval_to_ktime(value->it_interval); | ||
162 | expires = timeval_to_ktime(value->it_value); | ||
163 | if (expires.tv64 != 0) | ||
164 | hrtimer_start(timer, expires, HRTIMER_REL); | ||
169 | break; | 165 | break; |
170 | case ITIMER_VIRTUAL: | 166 | case ITIMER_VIRTUAL: |
171 | nval = timeval_to_cputime(&value->it_value); | 167 | nval = timeval_to_cputime(&value->it_value); |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 2c95848fbce8..de1441656efd 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <asm/system.h> | 26 | #include <asm/system.h> |
27 | #include <asm/semaphore.h> | 27 | #include <asm/semaphore.h> |
28 | 28 | ||
29 | /* Per cpu memory for storing cpu states in case of system crash. */ | ||
30 | note_buf_t* crash_notes; | ||
31 | |||
29 | /* Location of the reserved area for the crash kernel */ | 32 | /* Location of the reserved area for the crash kernel */ |
30 | struct resource crashk_res = { | 33 | struct resource crashk_res = { |
31 | .name = "Crash kernel", | 34 | .name = "Crash kernel", |
@@ -1054,9 +1057,24 @@ void crash_kexec(struct pt_regs *regs) | |||
1054 | if (!locked) { | 1057 | if (!locked) { |
1055 | image = xchg(&kexec_crash_image, NULL); | 1058 | image = xchg(&kexec_crash_image, NULL); |
1056 | if (image) { | 1059 | if (image) { |
1057 | machine_crash_shutdown(regs); | 1060 | struct pt_regs fixed_regs; |
1061 | crash_setup_regs(&fixed_regs, regs); | ||
1062 | machine_crash_shutdown(&fixed_regs); | ||
1058 | machine_kexec(image); | 1063 | machine_kexec(image); |
1059 | } | 1064 | } |
1060 | xchg(&kexec_lock, 0); | 1065 | xchg(&kexec_lock, 0); |
1061 | } | 1066 | } |
1062 | } | 1067 | } |
1068 | |||
1069 | static int __init crash_notes_memory_init(void) | ||
1070 | { | ||
1071 | /* Allocate memory for saving cpu registers. */ | ||
1072 | crash_notes = alloc_percpu(note_buf_t); | ||
1073 | if (!crash_notes) { | ||
1074 | printk("Kexec: Memory allocation for saving cpu register" | ||
1075 | " states failed\n"); | ||
1076 | return -ENOMEM; | ||
1077 | } | ||
1078 | return 0; | ||
1079 | } | ||
1080 | module_init(crash_notes_memory_init) | ||
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 3bb71e63a37e..34a885bb82e0 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -48,10 +48,11 @@ | |||
48 | static struct hlist_head kprobe_table[KPROBE_TABLE_SIZE]; | 48 | static struct hlist_head kprobe_table[KPROBE_TABLE_SIZE]; |
49 | static struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE]; | 49 | static struct hlist_head kretprobe_inst_table[KPROBE_TABLE_SIZE]; |
50 | 50 | ||
51 | static DEFINE_SPINLOCK(kprobe_lock); /* Protects kprobe_table */ | 51 | DECLARE_MUTEX(kprobe_mutex); /* Protects kprobe_table */ |
52 | DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */ | 52 | DEFINE_SPINLOCK(kretprobe_lock); /* Protects kretprobe_inst_table */ |
53 | static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL; | 53 | static DEFINE_PER_CPU(struct kprobe *, kprobe_instance) = NULL; |
54 | 54 | ||
55 | #ifdef __ARCH_WANT_KPROBES_INSN_SLOT | ||
55 | /* | 56 | /* |
56 | * kprobe->ainsn.insn points to the copy of the instruction to be | 57 | * kprobe->ainsn.insn points to the copy of the instruction to be |
57 | * single-stepped. x86_64, POWER4 and above have no-exec support and | 58 | * single-stepped. x86_64, POWER4 and above have no-exec support and |
@@ -151,6 +152,7 @@ void __kprobes free_insn_slot(kprobe_opcode_t *slot) | |||
151 | } | 152 | } |
152 | } | 153 | } |
153 | } | 154 | } |
155 | #endif | ||
154 | 156 | ||
155 | /* We have preemption disabled.. so it is safe to use __ versions */ | 157 | /* We have preemption disabled.. so it is safe to use __ versions */ |
156 | static inline void set_kprobe_instance(struct kprobe *kp) | 158 | static inline void set_kprobe_instance(struct kprobe *kp) |
@@ -165,7 +167,7 @@ static inline void reset_kprobe_instance(void) | |||
165 | 167 | ||
166 | /* | 168 | /* |
167 | * This routine is called either: | 169 | * This routine is called either: |
168 | * - under the kprobe_lock spinlock - during kprobe_[un]register() | 170 | * - under the kprobe_mutex - during kprobe_[un]register() |
169 | * OR | 171 | * OR |
170 | * - with preemption disabled - from arch/xxx/kernel/kprobes.c | 172 | * - with preemption disabled - from arch/xxx/kernel/kprobes.c |
171 | */ | 173 | */ |
@@ -418,7 +420,6 @@ static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p) | |||
418 | /* | 420 | /* |
419 | * This is the second or subsequent kprobe at the address - handle | 421 | * This is the second or subsequent kprobe at the address - handle |
420 | * the intricacies | 422 | * the intricacies |
421 | * TODO: Move kcalloc outside the spin_lock | ||
422 | */ | 423 | */ |
423 | static int __kprobes register_aggr_kprobe(struct kprobe *old_p, | 424 | static int __kprobes register_aggr_kprobe(struct kprobe *old_p, |
424 | struct kprobe *p) | 425 | struct kprobe *p) |
@@ -430,7 +431,7 @@ static int __kprobes register_aggr_kprobe(struct kprobe *old_p, | |||
430 | copy_kprobe(old_p, p); | 431 | copy_kprobe(old_p, p); |
431 | ret = add_new_kprobe(old_p, p); | 432 | ret = add_new_kprobe(old_p, p); |
432 | } else { | 433 | } else { |
433 | ap = kcalloc(1, sizeof(struct kprobe), GFP_ATOMIC); | 434 | ap = kzalloc(sizeof(struct kprobe), GFP_KERNEL); |
434 | if (!ap) | 435 | if (!ap) |
435 | return -ENOMEM; | 436 | return -ENOMEM; |
436 | add_aggr_kprobe(ap, old_p); | 437 | add_aggr_kprobe(ap, old_p); |
@@ -440,25 +441,6 @@ static int __kprobes register_aggr_kprobe(struct kprobe *old_p, | |||
440 | return ret; | 441 | return ret; |
441 | } | 442 | } |
442 | 443 | ||
443 | /* kprobe removal house-keeping routines */ | ||
444 | static inline void cleanup_kprobe(struct kprobe *p, unsigned long flags) | ||
445 | { | ||
446 | arch_disarm_kprobe(p); | ||
447 | hlist_del_rcu(&p->hlist); | ||
448 | spin_unlock_irqrestore(&kprobe_lock, flags); | ||
449 | arch_remove_kprobe(p); | ||
450 | } | ||
451 | |||
452 | static inline void cleanup_aggr_kprobe(struct kprobe *old_p, | ||
453 | struct kprobe *p, unsigned long flags) | ||
454 | { | ||
455 | list_del_rcu(&p->list); | ||
456 | if (list_empty(&old_p->list)) | ||
457 | cleanup_kprobe(old_p, flags); | ||
458 | else | ||
459 | spin_unlock_irqrestore(&kprobe_lock, flags); | ||
460 | } | ||
461 | |||
462 | static int __kprobes in_kprobes_functions(unsigned long addr) | 444 | static int __kprobes in_kprobes_functions(unsigned long addr) |
463 | { | 445 | { |
464 | if (addr >= (unsigned long)__kprobes_text_start | 446 | if (addr >= (unsigned long)__kprobes_text_start |
@@ -470,7 +452,6 @@ static int __kprobes in_kprobes_functions(unsigned long addr) | |||
470 | int __kprobes register_kprobe(struct kprobe *p) | 452 | int __kprobes register_kprobe(struct kprobe *p) |
471 | { | 453 | { |
472 | int ret = 0; | 454 | int ret = 0; |
473 | unsigned long flags = 0; | ||
474 | struct kprobe *old_p; | 455 | struct kprobe *old_p; |
475 | struct module *mod; | 456 | struct module *mod; |
476 | 457 | ||
@@ -482,18 +463,17 @@ int __kprobes register_kprobe(struct kprobe *p) | |||
482 | (unlikely(!try_module_get(mod)))) | 463 | (unlikely(!try_module_get(mod)))) |
483 | return -EINVAL; | 464 | return -EINVAL; |
484 | 465 | ||
485 | if ((ret = arch_prepare_kprobe(p)) != 0) | ||
486 | goto rm_kprobe; | ||
487 | |||
488 | p->nmissed = 0; | 466 | p->nmissed = 0; |
489 | spin_lock_irqsave(&kprobe_lock, flags); | 467 | down(&kprobe_mutex); |
490 | old_p = get_kprobe(p->addr); | 468 | old_p = get_kprobe(p->addr); |
491 | if (old_p) { | 469 | if (old_p) { |
492 | ret = register_aggr_kprobe(old_p, p); | 470 | ret = register_aggr_kprobe(old_p, p); |
493 | goto out; | 471 | goto out; |
494 | } | 472 | } |
495 | 473 | ||
496 | arch_copy_kprobe(p); | 474 | if ((ret = arch_prepare_kprobe(p)) != 0) |
475 | goto out; | ||
476 | |||
497 | INIT_HLIST_NODE(&p->hlist); | 477 | INIT_HLIST_NODE(&p->hlist); |
498 | hlist_add_head_rcu(&p->hlist, | 478 | hlist_add_head_rcu(&p->hlist, |
499 | &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]); | 479 | &kprobe_table[hash_ptr(p->addr, KPROBE_HASH_BITS)]); |
@@ -501,10 +481,8 @@ int __kprobes register_kprobe(struct kprobe *p) | |||
501 | arch_arm_kprobe(p); | 481 | arch_arm_kprobe(p); |
502 | 482 | ||
503 | out: | 483 | out: |
504 | spin_unlock_irqrestore(&kprobe_lock, flags); | 484 | up(&kprobe_mutex); |
505 | rm_kprobe: | 485 | |
506 | if (ret == -EEXIST) | ||
507 | arch_remove_kprobe(p); | ||
508 | if (ret && mod) | 486 | if (ret && mod) |
509 | module_put(mod); | 487 | module_put(mod); |
510 | return ret; | 488 | return ret; |
@@ -512,29 +490,50 @@ rm_kprobe: | |||
512 | 490 | ||
513 | void __kprobes unregister_kprobe(struct kprobe *p) | 491 | void __kprobes unregister_kprobe(struct kprobe *p) |
514 | { | 492 | { |
515 | unsigned long flags; | ||
516 | struct kprobe *old_p; | ||
517 | struct module *mod; | 493 | struct module *mod; |
494 | struct kprobe *old_p, *list_p; | ||
495 | int cleanup_p; | ||
518 | 496 | ||
519 | spin_lock_irqsave(&kprobe_lock, flags); | 497 | down(&kprobe_mutex); |
520 | old_p = get_kprobe(p->addr); | 498 | old_p = get_kprobe(p->addr); |
521 | if (old_p) { | 499 | if (unlikely(!old_p)) { |
522 | /* cleanup_*_kprobe() does the spin_unlock_irqrestore */ | 500 | up(&kprobe_mutex); |
523 | if (old_p->pre_handler == aggr_pre_handler) | 501 | return; |
524 | cleanup_aggr_kprobe(old_p, p, flags); | 502 | } |
525 | else | 503 | if (p != old_p) { |
526 | cleanup_kprobe(p, flags); | 504 | list_for_each_entry_rcu(list_p, &old_p->list, list) |
505 | if (list_p == p) | ||
506 | /* kprobe p is a valid probe */ | ||
507 | goto valid_p; | ||
508 | up(&kprobe_mutex); | ||
509 | return; | ||
510 | } | ||
511 | valid_p: | ||
512 | if ((old_p == p) || ((old_p->pre_handler == aggr_pre_handler) && | ||
513 | (p->list.next == &old_p->list) && | ||
514 | (p->list.prev == &old_p->list))) { | ||
515 | /* Only probe on the hash list */ | ||
516 | arch_disarm_kprobe(p); | ||
517 | hlist_del_rcu(&old_p->hlist); | ||
518 | cleanup_p = 1; | ||
519 | } else { | ||
520 | list_del_rcu(&p->list); | ||
521 | cleanup_p = 0; | ||
522 | } | ||
527 | 523 | ||
528 | synchronize_sched(); | 524 | up(&kprobe_mutex); |
529 | 525 | ||
530 | if ((mod = module_text_address((unsigned long)p->addr))) | 526 | synchronize_sched(); |
531 | module_put(mod); | 527 | if ((mod = module_text_address((unsigned long)p->addr))) |
528 | module_put(mod); | ||
532 | 529 | ||
533 | if (old_p->pre_handler == aggr_pre_handler && | 530 | if (cleanup_p) { |
534 | list_empty(&old_p->list)) | 531 | if (p != old_p) { |
532 | list_del_rcu(&p->list); | ||
535 | kfree(old_p); | 533 | kfree(old_p); |
536 | } else | 534 | } |
537 | spin_unlock_irqrestore(&kprobe_lock, flags); | 535 | arch_remove_kprobe(p); |
536 | } | ||
538 | } | 537 | } |
539 | 538 | ||
540 | static struct notifier_block kprobe_exceptions_nb = { | 539 | static struct notifier_block kprobe_exceptions_nb = { |
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 99af8b05eeaa..d5eeae0fa5bc 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -51,16 +51,6 @@ static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, s | |||
51 | KERNEL_ATTR_RW(uevent_helper); | 51 | KERNEL_ATTR_RW(uevent_helper); |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #ifdef CONFIG_KEXEC | ||
55 | #include <asm/kexec.h> | ||
56 | |||
57 | static ssize_t crash_notes_show(struct subsystem *subsys, char *page) | ||
58 | { | ||
59 | return sprintf(page, "%p\n", (void *)crash_notes); | ||
60 | } | ||
61 | KERNEL_ATTR_RO(crash_notes); | ||
62 | #endif | ||
63 | |||
64 | decl_subsys(kernel, NULL, NULL); | 54 | decl_subsys(kernel, NULL, NULL); |
65 | EXPORT_SYMBOL_GPL(kernel_subsys); | 55 | EXPORT_SYMBOL_GPL(kernel_subsys); |
66 | 56 | ||
@@ -69,9 +59,6 @@ static struct attribute * kernel_attrs[] = { | |||
69 | &uevent_seqnum_attr.attr, | 59 | &uevent_seqnum_attr.attr, |
70 | &uevent_helper_attr.attr, | 60 | &uevent_helper_attr.attr, |
71 | #endif | 61 | #endif |
72 | #ifdef CONFIG_KEXEC | ||
73 | &crash_notes_attr.attr, | ||
74 | #endif | ||
75 | NULL | 62 | NULL |
76 | }; | 63 | }; |
77 | 64 | ||
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index 4c68edff900b..520f6c59948d 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
8 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
9 | 9 | ||
10 | static int check_clock(clockid_t which_clock) | 10 | static int check_clock(const clockid_t which_clock) |
11 | { | 11 | { |
12 | int error = 0; | 12 | int error = 0; |
13 | struct task_struct *p; | 13 | struct task_struct *p; |
@@ -31,7 +31,7 @@ static int check_clock(clockid_t which_clock) | |||
31 | } | 31 | } |
32 | 32 | ||
33 | static inline union cpu_time_count | 33 | static inline union cpu_time_count |
34 | timespec_to_sample(clockid_t which_clock, const struct timespec *tp) | 34 | timespec_to_sample(const clockid_t which_clock, const struct timespec *tp) |
35 | { | 35 | { |
36 | union cpu_time_count ret; | 36 | union cpu_time_count ret; |
37 | ret.sched = 0; /* high half always zero when .cpu used */ | 37 | ret.sched = 0; /* high half always zero when .cpu used */ |
@@ -43,7 +43,7 @@ timespec_to_sample(clockid_t which_clock, const struct timespec *tp) | |||
43 | return ret; | 43 | return ret; |
44 | } | 44 | } |
45 | 45 | ||
46 | static void sample_to_timespec(clockid_t which_clock, | 46 | static void sample_to_timespec(const clockid_t which_clock, |
47 | union cpu_time_count cpu, | 47 | union cpu_time_count cpu, |
48 | struct timespec *tp) | 48 | struct timespec *tp) |
49 | { | 49 | { |
@@ -55,7 +55,7 @@ static void sample_to_timespec(clockid_t which_clock, | |||
55 | } | 55 | } |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline int cpu_time_before(clockid_t which_clock, | 58 | static inline int cpu_time_before(const clockid_t which_clock, |
59 | union cpu_time_count now, | 59 | union cpu_time_count now, |
60 | union cpu_time_count then) | 60 | union cpu_time_count then) |
61 | { | 61 | { |
@@ -65,7 +65,7 @@ static inline int cpu_time_before(clockid_t which_clock, | |||
65 | return cputime_lt(now.cpu, then.cpu); | 65 | return cputime_lt(now.cpu, then.cpu); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | static inline void cpu_time_add(clockid_t which_clock, | 68 | static inline void cpu_time_add(const clockid_t which_clock, |
69 | union cpu_time_count *acc, | 69 | union cpu_time_count *acc, |
70 | union cpu_time_count val) | 70 | union cpu_time_count val) |
71 | { | 71 | { |
@@ -75,7 +75,7 @@ static inline void cpu_time_add(clockid_t which_clock, | |||
75 | acc->cpu = cputime_add(acc->cpu, val.cpu); | 75 | acc->cpu = cputime_add(acc->cpu, val.cpu); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | static inline union cpu_time_count cpu_time_sub(clockid_t which_clock, | 78 | static inline union cpu_time_count cpu_time_sub(const clockid_t which_clock, |
79 | union cpu_time_count a, | 79 | union cpu_time_count a, |
80 | union cpu_time_count b) | 80 | union cpu_time_count b) |
81 | { | 81 | { |
@@ -151,7 +151,7 @@ static inline unsigned long long sched_ns(struct task_struct *p) | |||
151 | return (p == current) ? current_sched_time(p) : p->sched_time; | 151 | return (p == current) ? current_sched_time(p) : p->sched_time; |
152 | } | 152 | } |
153 | 153 | ||
154 | int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *tp) | 154 | int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *tp) |
155 | { | 155 | { |
156 | int error = check_clock(which_clock); | 156 | int error = check_clock(which_clock); |
157 | if (!error) { | 157 | if (!error) { |
@@ -169,7 +169,7 @@ int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *tp) | |||
169 | return error; | 169 | return error; |
170 | } | 170 | } |
171 | 171 | ||
172 | int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp) | 172 | int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *tp) |
173 | { | 173 | { |
174 | /* | 174 | /* |
175 | * You can never reset a CPU clock, but we check for other errors | 175 | * You can never reset a CPU clock, but we check for other errors |
@@ -186,7 +186,7 @@ int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp) | |||
186 | /* | 186 | /* |
187 | * Sample a per-thread clock for the given task. | 187 | * Sample a per-thread clock for the given task. |
188 | */ | 188 | */ |
189 | static int cpu_clock_sample(clockid_t which_clock, struct task_struct *p, | 189 | static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p, |
190 | union cpu_time_count *cpu) | 190 | union cpu_time_count *cpu) |
191 | { | 191 | { |
192 | switch (CPUCLOCK_WHICH(which_clock)) { | 192 | switch (CPUCLOCK_WHICH(which_clock)) { |
@@ -248,7 +248,7 @@ static int cpu_clock_sample_group_locked(unsigned int clock_idx, | |||
248 | * Sample a process (thread group) clock for the given group_leader task. | 248 | * Sample a process (thread group) clock for the given group_leader task. |
249 | * Must be called with tasklist_lock held for reading. | 249 | * Must be called with tasklist_lock held for reading. |
250 | */ | 250 | */ |
251 | static int cpu_clock_sample_group(clockid_t which_clock, | 251 | static int cpu_clock_sample_group(const clockid_t which_clock, |
252 | struct task_struct *p, | 252 | struct task_struct *p, |
253 | union cpu_time_count *cpu) | 253 | union cpu_time_count *cpu) |
254 | { | 254 | { |
@@ -262,7 +262,7 @@ static int cpu_clock_sample_group(clockid_t which_clock, | |||
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | int posix_cpu_clock_get(clockid_t which_clock, struct timespec *tp) | 265 | int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp) |
266 | { | 266 | { |
267 | const pid_t pid = CPUCLOCK_PID(which_clock); | 267 | const pid_t pid = CPUCLOCK_PID(which_clock); |
268 | int error = -EINVAL; | 268 | int error = -EINVAL; |
@@ -1399,8 +1399,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, | |||
1399 | 1399 | ||
1400 | static long posix_cpu_clock_nanosleep_restart(struct restart_block *); | 1400 | static long posix_cpu_clock_nanosleep_restart(struct restart_block *); |
1401 | 1401 | ||
1402 | int posix_cpu_nsleep(clockid_t which_clock, int flags, | 1402 | int posix_cpu_nsleep(const clockid_t which_clock, int flags, |
1403 | struct timespec *rqtp) | 1403 | struct timespec *rqtp, struct timespec __user *rmtp) |
1404 | { | 1404 | { |
1405 | struct restart_block *restart_block = | 1405 | struct restart_block *restart_block = |
1406 | ¤t_thread_info()->restart_block; | 1406 | ¤t_thread_info()->restart_block; |
@@ -1425,7 +1425,6 @@ int posix_cpu_nsleep(clockid_t which_clock, int flags, | |||
1425 | error = posix_cpu_timer_create(&timer); | 1425 | error = posix_cpu_timer_create(&timer); |
1426 | timer.it_process = current; | 1426 | timer.it_process = current; |
1427 | if (!error) { | 1427 | if (!error) { |
1428 | struct timespec __user *rmtp; | ||
1429 | static struct itimerspec zero_it; | 1428 | static struct itimerspec zero_it; |
1430 | struct itimerspec it = { .it_value = *rqtp, | 1429 | struct itimerspec it = { .it_value = *rqtp, |
1431 | .it_interval = {} }; | 1430 | .it_interval = {} }; |
@@ -1472,7 +1471,6 @@ int posix_cpu_nsleep(clockid_t which_clock, int flags, | |||
1472 | /* | 1471 | /* |
1473 | * Report back to the user the time still remaining. | 1472 | * Report back to the user the time still remaining. |
1474 | */ | 1473 | */ |
1475 | rmtp = (struct timespec __user *) restart_block->arg1; | ||
1476 | if (rmtp != NULL && !(flags & TIMER_ABSTIME) && | 1474 | if (rmtp != NULL && !(flags & TIMER_ABSTIME) && |
1477 | copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) | 1475 | copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) |
1478 | return -EFAULT; | 1476 | return -EFAULT; |
@@ -1480,6 +1478,7 @@ int posix_cpu_nsleep(clockid_t which_clock, int flags, | |||
1480 | restart_block->fn = posix_cpu_clock_nanosleep_restart; | 1478 | restart_block->fn = posix_cpu_clock_nanosleep_restart; |
1481 | /* Caller already set restart_block->arg1 */ | 1479 | /* Caller already set restart_block->arg1 */ |
1482 | restart_block->arg0 = which_clock; | 1480 | restart_block->arg0 = which_clock; |
1481 | restart_block->arg1 = (unsigned long) rmtp; | ||
1483 | restart_block->arg2 = rqtp->tv_sec; | 1482 | restart_block->arg2 = rqtp->tv_sec; |
1484 | restart_block->arg3 = rqtp->tv_nsec; | 1483 | restart_block->arg3 = rqtp->tv_nsec; |
1485 | 1484 | ||
@@ -1493,21 +1492,28 @@ static long | |||
1493 | posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block) | 1492 | posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block) |
1494 | { | 1493 | { |
1495 | clockid_t which_clock = restart_block->arg0; | 1494 | clockid_t which_clock = restart_block->arg0; |
1496 | struct timespec t = { .tv_sec = restart_block->arg2, | 1495 | struct timespec __user *rmtp; |
1497 | .tv_nsec = restart_block->arg3 }; | 1496 | struct timespec t; |
1497 | |||
1498 | rmtp = (struct timespec __user *) restart_block->arg1; | ||
1499 | t.tv_sec = restart_block->arg2; | ||
1500 | t.tv_nsec = restart_block->arg3; | ||
1501 | |||
1498 | restart_block->fn = do_no_restart_syscall; | 1502 | restart_block->fn = do_no_restart_syscall; |
1499 | return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t); | 1503 | return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t, rmtp); |
1500 | } | 1504 | } |
1501 | 1505 | ||
1502 | 1506 | ||
1503 | #define PROCESS_CLOCK MAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED) | 1507 | #define PROCESS_CLOCK MAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED) |
1504 | #define THREAD_CLOCK MAKE_THREAD_CPUCLOCK(0, CPUCLOCK_SCHED) | 1508 | #define THREAD_CLOCK MAKE_THREAD_CPUCLOCK(0, CPUCLOCK_SCHED) |
1505 | 1509 | ||
1506 | static int process_cpu_clock_getres(clockid_t which_clock, struct timespec *tp) | 1510 | static int process_cpu_clock_getres(const clockid_t which_clock, |
1511 | struct timespec *tp) | ||
1507 | { | 1512 | { |
1508 | return posix_cpu_clock_getres(PROCESS_CLOCK, tp); | 1513 | return posix_cpu_clock_getres(PROCESS_CLOCK, tp); |
1509 | } | 1514 | } |
1510 | static int process_cpu_clock_get(clockid_t which_clock, struct timespec *tp) | 1515 | static int process_cpu_clock_get(const clockid_t which_clock, |
1516 | struct timespec *tp) | ||
1511 | { | 1517 | { |
1512 | return posix_cpu_clock_get(PROCESS_CLOCK, tp); | 1518 | return posix_cpu_clock_get(PROCESS_CLOCK, tp); |
1513 | } | 1519 | } |
@@ -1516,16 +1522,19 @@ static int process_cpu_timer_create(struct k_itimer *timer) | |||
1516 | timer->it_clock = PROCESS_CLOCK; | 1522 | timer->it_clock = PROCESS_CLOCK; |
1517 | return posix_cpu_timer_create(timer); | 1523 | return posix_cpu_timer_create(timer); |
1518 | } | 1524 | } |
1519 | static int process_cpu_nsleep(clockid_t which_clock, int flags, | 1525 | static int process_cpu_nsleep(const clockid_t which_clock, int flags, |
1520 | struct timespec *rqtp) | 1526 | struct timespec *rqtp, |
1527 | struct timespec __user *rmtp) | ||
1521 | { | 1528 | { |
1522 | return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp); | 1529 | return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp, rmtp); |
1523 | } | 1530 | } |
1524 | static int thread_cpu_clock_getres(clockid_t which_clock, struct timespec *tp) | 1531 | static int thread_cpu_clock_getres(const clockid_t which_clock, |
1532 | struct timespec *tp) | ||
1525 | { | 1533 | { |
1526 | return posix_cpu_clock_getres(THREAD_CLOCK, tp); | 1534 | return posix_cpu_clock_getres(THREAD_CLOCK, tp); |
1527 | } | 1535 | } |
1528 | static int thread_cpu_clock_get(clockid_t which_clock, struct timespec *tp) | 1536 | static int thread_cpu_clock_get(const clockid_t which_clock, |
1537 | struct timespec *tp) | ||
1529 | { | 1538 | { |
1530 | return posix_cpu_clock_get(THREAD_CLOCK, tp); | 1539 | return posix_cpu_clock_get(THREAD_CLOCK, tp); |
1531 | } | 1540 | } |
@@ -1534,8 +1543,8 @@ static int thread_cpu_timer_create(struct k_itimer *timer) | |||
1534 | timer->it_clock = THREAD_CLOCK; | 1543 | timer->it_clock = THREAD_CLOCK; |
1535 | return posix_cpu_timer_create(timer); | 1544 | return posix_cpu_timer_create(timer); |
1536 | } | 1545 | } |
1537 | static int thread_cpu_nsleep(clockid_t which_clock, int flags, | 1546 | static int thread_cpu_nsleep(const clockid_t which_clock, int flags, |
1538 | struct timespec *rqtp) | 1547 | struct timespec *rqtp, struct timespec __user *rmtp) |
1539 | { | 1548 | { |
1540 | return -EINVAL; | 1549 | return -EINVAL; |
1541 | } | 1550 | } |
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 5870efb3e200..9e66e614862a 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -48,21 +48,6 @@ | |||
48 | #include <linux/workqueue.h> | 48 | #include <linux/workqueue.h> |
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | 50 | ||
51 | #ifndef div_long_long_rem | ||
52 | #include <asm/div64.h> | ||
53 | |||
54 | #define div_long_long_rem(dividend,divisor,remainder) ({ \ | ||
55 | u64 result = dividend; \ | ||
56 | *remainder = do_div(result,divisor); \ | ||
57 | result; }) | ||
58 | |||
59 | #endif | ||
60 | #define CLOCK_REALTIME_RES TICK_NSEC /* In nano seconds. */ | ||
61 | |||
62 | static inline u64 mpy_l_X_l_ll(unsigned long mpy1,unsigned long mpy2) | ||
63 | { | ||
64 | return (u64)mpy1 * mpy2; | ||
65 | } | ||
66 | /* | 51 | /* |
67 | * Management arrays for POSIX timers. Timers are kept in slab memory | 52 | * Management arrays for POSIX timers. Timers are kept in slab memory |
68 | * Timer ids are allocated by an external routine that keeps track of the | 53 | * Timer ids are allocated by an external routine that keeps track of the |
@@ -148,18 +133,18 @@ static DEFINE_SPINLOCK(idr_lock); | |||
148 | */ | 133 | */ |
149 | 134 | ||
150 | static struct k_clock posix_clocks[MAX_CLOCKS]; | 135 | static struct k_clock posix_clocks[MAX_CLOCKS]; |
136 | |||
151 | /* | 137 | /* |
152 | * We only have one real clock that can be set so we need only one abs list, | 138 | * These ones are defined below. |
153 | * even if we should want to have several clocks with differing resolutions. | ||
154 | */ | 139 | */ |
155 | static struct k_clock_abs abs_list = {.list = LIST_HEAD_INIT(abs_list.list), | 140 | static int common_nsleep(const clockid_t, int flags, struct timespec *t, |
156 | .lock = SPIN_LOCK_UNLOCKED}; | 141 | struct timespec __user *rmtp); |
142 | static void common_timer_get(struct k_itimer *, struct itimerspec *); | ||
143 | static int common_timer_set(struct k_itimer *, int, | ||
144 | struct itimerspec *, struct itimerspec *); | ||
145 | static int common_timer_del(struct k_itimer *timer); | ||
157 | 146 | ||
158 | static void posix_timer_fn(unsigned long); | 147 | static int posix_timer_fn(void *data); |
159 | static u64 do_posix_clock_monotonic_gettime_parts( | ||
160 | struct timespec *tp, struct timespec *mo); | ||
161 | int do_posix_clock_monotonic_gettime(struct timespec *tp); | ||
162 | static int do_posix_clock_monotonic_get(clockid_t, struct timespec *tp); | ||
163 | 148 | ||
164 | static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags); | 149 | static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags); |
165 | 150 | ||
@@ -184,7 +169,7 @@ static inline void unlock_timer(struct k_itimer *timr, unsigned long flags) | |||
184 | * the function pointer CALL in struct k_clock. | 169 | * the function pointer CALL in struct k_clock. |
185 | */ | 170 | */ |
186 | 171 | ||
187 | static inline int common_clock_getres(clockid_t which_clock, | 172 | static inline int common_clock_getres(const clockid_t which_clock, |
188 | struct timespec *tp) | 173 | struct timespec *tp) |
189 | { | 174 | { |
190 | tp->tv_sec = 0; | 175 | tp->tv_sec = 0; |
@@ -192,39 +177,33 @@ static inline int common_clock_getres(clockid_t which_clock, | |||
192 | return 0; | 177 | return 0; |
193 | } | 178 | } |
194 | 179 | ||
195 | static inline int common_clock_get(clockid_t which_clock, struct timespec *tp) | 180 | /* |
181 | * Get real time for posix timers | ||
182 | */ | ||
183 | static int common_clock_get(clockid_t which_clock, struct timespec *tp) | ||
196 | { | 184 | { |
197 | getnstimeofday(tp); | 185 | ktime_get_real_ts(tp); |
198 | return 0; | 186 | return 0; |
199 | } | 187 | } |
200 | 188 | ||
201 | static inline int common_clock_set(clockid_t which_clock, struct timespec *tp) | 189 | static inline int common_clock_set(const clockid_t which_clock, |
190 | struct timespec *tp) | ||
202 | { | 191 | { |
203 | return do_sys_settimeofday(tp, NULL); | 192 | return do_sys_settimeofday(tp, NULL); |
204 | } | 193 | } |
205 | 194 | ||
206 | static inline int common_timer_create(struct k_itimer *new_timer) | 195 | static inline int common_timer_create(struct k_itimer *new_timer) |
207 | { | 196 | { |
208 | INIT_LIST_HEAD(&new_timer->it.real.abs_timer_entry); | 197 | hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock); |
209 | init_timer(&new_timer->it.real.timer); | 198 | new_timer->it.real.timer.data = new_timer; |
210 | new_timer->it.real.timer.data = (unsigned long) new_timer; | ||
211 | new_timer->it.real.timer.function = posix_timer_fn; | 199 | new_timer->it.real.timer.function = posix_timer_fn; |
212 | return 0; | 200 | return 0; |
213 | } | 201 | } |
214 | 202 | ||
215 | /* | 203 | /* |
216 | * These ones are defined below. | 204 | * Return nonzero if we know a priori this clockid_t value is bogus. |
217 | */ | ||
218 | static int common_nsleep(clockid_t, int flags, struct timespec *t); | ||
219 | static void common_timer_get(struct k_itimer *, struct itimerspec *); | ||
220 | static int common_timer_set(struct k_itimer *, int, | ||
221 | struct itimerspec *, struct itimerspec *); | ||
222 | static int common_timer_del(struct k_itimer *timer); | ||
223 | |||
224 | /* | ||
225 | * Return nonzero iff we know a priori this clockid_t value is bogus. | ||
226 | */ | 205 | */ |
227 | static inline int invalid_clockid(clockid_t which_clock) | 206 | static inline int invalid_clockid(const clockid_t which_clock) |
228 | { | 207 | { |
229 | if (which_clock < 0) /* CPU clock, posix_cpu_* will check it */ | 208 | if (which_clock < 0) /* CPU clock, posix_cpu_* will check it */ |
230 | return 0; | 209 | return 0; |
@@ -232,26 +211,32 @@ static inline int invalid_clockid(clockid_t which_clock) | |||
232 | return 1; | 211 | return 1; |
233 | if (posix_clocks[which_clock].clock_getres != NULL) | 212 | if (posix_clocks[which_clock].clock_getres != NULL) |
234 | return 0; | 213 | return 0; |
235 | #ifndef CLOCK_DISPATCH_DIRECT | ||
236 | if (posix_clocks[which_clock].res != 0) | 214 | if (posix_clocks[which_clock].res != 0) |
237 | return 0; | 215 | return 0; |
238 | #endif | ||
239 | return 1; | 216 | return 1; |
240 | } | 217 | } |
241 | 218 | ||
219 | /* | ||
220 | * Get monotonic time for posix timers | ||
221 | */ | ||
222 | static int posix_ktime_get_ts(clockid_t which_clock, struct timespec *tp) | ||
223 | { | ||
224 | ktime_get_ts(tp); | ||
225 | return 0; | ||
226 | } | ||
242 | 227 | ||
243 | /* | 228 | /* |
244 | * Initialize everything, well, just everything in Posix clocks/timers ;) | 229 | * Initialize everything, well, just everything in Posix clocks/timers ;) |
245 | */ | 230 | */ |
246 | static __init int init_posix_timers(void) | 231 | static __init int init_posix_timers(void) |
247 | { | 232 | { |
248 | struct k_clock clock_realtime = {.res = CLOCK_REALTIME_RES, | 233 | struct k_clock clock_realtime = { |
249 | .abs_struct = &abs_list | 234 | .clock_getres = hrtimer_get_res, |
250 | }; | 235 | }; |
251 | struct k_clock clock_monotonic = {.res = CLOCK_REALTIME_RES, | 236 | struct k_clock clock_monotonic = { |
252 | .abs_struct = NULL, | 237 | .clock_getres = hrtimer_get_res, |
253 | .clock_get = do_posix_clock_monotonic_get, | 238 | .clock_get = posix_ktime_get_ts, |
254 | .clock_set = do_posix_clock_nosettime | 239 | .clock_set = do_posix_clock_nosettime, |
255 | }; | 240 | }; |
256 | 241 | ||
257 | register_posix_clock(CLOCK_REALTIME, &clock_realtime); | 242 | register_posix_clock(CLOCK_REALTIME, &clock_realtime); |
@@ -265,117 +250,17 @@ static __init int init_posix_timers(void) | |||
265 | 250 | ||
266 | __initcall(init_posix_timers); | 251 | __initcall(init_posix_timers); |
267 | 252 | ||
268 | static void tstojiffie(struct timespec *tp, int res, u64 *jiff) | ||
269 | { | ||
270 | long sec = tp->tv_sec; | ||
271 | long nsec = tp->tv_nsec + res - 1; | ||
272 | |||
273 | if (nsec >= NSEC_PER_SEC) { | ||
274 | sec++; | ||
275 | nsec -= NSEC_PER_SEC; | ||
276 | } | ||
277 | |||
278 | /* | ||
279 | * The scaling constants are defined in <linux/time.h> | ||
280 | * The difference between there and here is that we do the | ||
281 | * res rounding and compute a 64-bit result (well so does that | ||
282 | * but it then throws away the high bits). | ||
283 | */ | ||
284 | *jiff = (mpy_l_X_l_ll(sec, SEC_CONVERSION) + | ||
285 | (mpy_l_X_l_ll(nsec, NSEC_CONVERSION) >> | ||
286 | (NSEC_JIFFIE_SC - SEC_JIFFIE_SC))) >> SEC_JIFFIE_SC; | ||
287 | } | ||
288 | |||
289 | /* | ||
290 | * This function adjusts the timer as needed as a result of the clock | ||
291 | * being set. It should only be called for absolute timers, and then | ||
292 | * under the abs_list lock. It computes the time difference and sets | ||
293 | * the new jiffies value in the timer. It also updates the timers | ||
294 | * reference wall_to_monotonic value. It is complicated by the fact | ||
295 | * that tstojiffies() only handles positive times and it needs to work | ||
296 | * with both positive and negative times. Also, for negative offsets, | ||
297 | * we need to defeat the res round up. | ||
298 | * | ||
299 | * Return is true if there is a new time, else false. | ||
300 | */ | ||
301 | static long add_clockset_delta(struct k_itimer *timr, | ||
302 | struct timespec *new_wall_to) | ||
303 | { | ||
304 | struct timespec delta; | ||
305 | int sign = 0; | ||
306 | u64 exp; | ||
307 | |||
308 | set_normalized_timespec(&delta, | ||
309 | new_wall_to->tv_sec - | ||
310 | timr->it.real.wall_to_prev.tv_sec, | ||
311 | new_wall_to->tv_nsec - | ||
312 | timr->it.real.wall_to_prev.tv_nsec); | ||
313 | if (likely(!(delta.tv_sec | delta.tv_nsec))) | ||
314 | return 0; | ||
315 | if (delta.tv_sec < 0) { | ||
316 | set_normalized_timespec(&delta, | ||
317 | -delta.tv_sec, | ||
318 | 1 - delta.tv_nsec - | ||
319 | posix_clocks[timr->it_clock].res); | ||
320 | sign++; | ||
321 | } | ||
322 | tstojiffie(&delta, posix_clocks[timr->it_clock].res, &exp); | ||
323 | timr->it.real.wall_to_prev = *new_wall_to; | ||
324 | timr->it.real.timer.expires += (sign ? -exp : exp); | ||
325 | return 1; | ||
326 | } | ||
327 | |||
328 | static void remove_from_abslist(struct k_itimer *timr) | ||
329 | { | ||
330 | if (!list_empty(&timr->it.real.abs_timer_entry)) { | ||
331 | spin_lock(&abs_list.lock); | ||
332 | list_del_init(&timr->it.real.abs_timer_entry); | ||
333 | spin_unlock(&abs_list.lock); | ||
334 | } | ||
335 | } | ||
336 | |||
337 | static void schedule_next_timer(struct k_itimer *timr) | 253 | static void schedule_next_timer(struct k_itimer *timr) |
338 | { | 254 | { |
339 | struct timespec new_wall_to; | 255 | if (timr->it.real.interval.tv64 == 0) |
340 | struct now_struct now; | ||
341 | unsigned long seq; | ||
342 | |||
343 | /* | ||
344 | * Set up the timer for the next interval (if there is one). | ||
345 | * Note: this code uses the abs_timer_lock to protect | ||
346 | * it.real.wall_to_prev and must hold it until exp is set, not exactly | ||
347 | * obvious... | ||
348 | |||
349 | * This function is used for CLOCK_REALTIME* and | ||
350 | * CLOCK_MONOTONIC* timers. If we ever want to handle other | ||
351 | * CLOCKs, the calling code (do_schedule_next_timer) would need | ||
352 | * to pull the "clock" info from the timer and dispatch the | ||
353 | * "other" CLOCKs "next timer" code (which, I suppose should | ||
354 | * also be added to the k_clock structure). | ||
355 | */ | ||
356 | if (!timr->it.real.incr) | ||
357 | return; | 256 | return; |
358 | 257 | ||
359 | do { | 258 | timr->it_overrun += hrtimer_forward(&timr->it.real.timer, |
360 | seq = read_seqbegin(&xtime_lock); | 259 | timr->it.real.interval); |
361 | new_wall_to = wall_to_monotonic; | ||
362 | posix_get_now(&now); | ||
363 | } while (read_seqretry(&xtime_lock, seq)); | ||
364 | |||
365 | if (!list_empty(&timr->it.real.abs_timer_entry)) { | ||
366 | spin_lock(&abs_list.lock); | ||
367 | add_clockset_delta(timr, &new_wall_to); | ||
368 | |||
369 | posix_bump_timer(timr, now); | ||
370 | |||
371 | spin_unlock(&abs_list.lock); | ||
372 | } else { | ||
373 | posix_bump_timer(timr, now); | ||
374 | } | ||
375 | timr->it_overrun_last = timr->it_overrun; | 260 | timr->it_overrun_last = timr->it_overrun; |
376 | timr->it_overrun = -1; | 261 | timr->it_overrun = -1; |
377 | ++timr->it_requeue_pending; | 262 | ++timr->it_requeue_pending; |
378 | add_timer(&timr->it.real.timer); | 263 | hrtimer_restart(&timr->it.real.timer); |
379 | } | 264 | } |
380 | 265 | ||
381 | /* | 266 | /* |
@@ -396,31 +281,23 @@ void do_schedule_next_timer(struct siginfo *info) | |||
396 | 281 | ||
397 | timr = lock_timer(info->si_tid, &flags); | 282 | timr = lock_timer(info->si_tid, &flags); |
398 | 283 | ||
399 | if (!timr || timr->it_requeue_pending != info->si_sys_private) | 284 | if (timr && timr->it_requeue_pending == info->si_sys_private) { |
400 | goto exit; | 285 | if (timr->it_clock < 0) |
286 | posix_cpu_timer_schedule(timr); | ||
287 | else | ||
288 | schedule_next_timer(timr); | ||
401 | 289 | ||
402 | if (timr->it_clock < 0) /* CPU clock */ | 290 | info->si_overrun = timr->it_overrun_last; |
403 | posix_cpu_timer_schedule(timr); | 291 | } |
404 | else | 292 | |
405 | schedule_next_timer(timr); | 293 | unlock_timer(timr, flags); |
406 | info->si_overrun = timr->it_overrun_last; | ||
407 | exit: | ||
408 | if (timr) | ||
409 | unlock_timer(timr, flags); | ||
410 | } | 294 | } |
411 | 295 | ||
412 | int posix_timer_event(struct k_itimer *timr,int si_private) | 296 | int posix_timer_event(struct k_itimer *timr,int si_private) |
413 | { | 297 | { |
414 | memset(&timr->sigq->info, 0, sizeof(siginfo_t)); | 298 | memset(&timr->sigq->info, 0, sizeof(siginfo_t)); |
415 | timr->sigq->info.si_sys_private = si_private; | 299 | timr->sigq->info.si_sys_private = si_private; |
416 | /* | 300 | /* Send signal to the process that owns this timer.*/ |
417 | * Send signal to the process that owns this timer. | ||
418 | |||
419 | * This code assumes that all the possible abs_lists share the | ||
420 | * same lock (there is only one list at this time). If this is | ||
421 | * not the case, the CLOCK info would need to be used to find | ||
422 | * the proper abs list lock. | ||
423 | */ | ||
424 | 301 | ||
425 | timr->sigq->info.si_signo = timr->it_sigev_signo; | 302 | timr->sigq->info.si_signo = timr->it_sigev_signo; |
426 | timr->sigq->info.si_errno = 0; | 303 | timr->sigq->info.si_errno = 0; |
@@ -454,64 +331,35 @@ EXPORT_SYMBOL_GPL(posix_timer_event); | |||
454 | 331 | ||
455 | * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers. | 332 | * This code is for CLOCK_REALTIME* and CLOCK_MONOTONIC* timers. |
456 | */ | 333 | */ |
457 | static void posix_timer_fn(unsigned long __data) | 334 | static int posix_timer_fn(void *data) |
458 | { | 335 | { |
459 | struct k_itimer *timr = (struct k_itimer *) __data; | 336 | struct k_itimer *timr = data; |
460 | unsigned long flags; | 337 | unsigned long flags; |
461 | unsigned long seq; | 338 | int si_private = 0; |
462 | struct timespec delta, new_wall_to; | 339 | int ret = HRTIMER_NORESTART; |
463 | u64 exp = 0; | ||
464 | int do_notify = 1; | ||
465 | 340 | ||
466 | spin_lock_irqsave(&timr->it_lock, flags); | 341 | spin_lock_irqsave(&timr->it_lock, flags); |
467 | if (!list_empty(&timr->it.real.abs_timer_entry)) { | ||
468 | spin_lock(&abs_list.lock); | ||
469 | do { | ||
470 | seq = read_seqbegin(&xtime_lock); | ||
471 | new_wall_to = wall_to_monotonic; | ||
472 | } while (read_seqretry(&xtime_lock, seq)); | ||
473 | set_normalized_timespec(&delta, | ||
474 | new_wall_to.tv_sec - | ||
475 | timr->it.real.wall_to_prev.tv_sec, | ||
476 | new_wall_to.tv_nsec - | ||
477 | timr->it.real.wall_to_prev.tv_nsec); | ||
478 | if (likely((delta.tv_sec | delta.tv_nsec ) == 0)) { | ||
479 | /* do nothing, timer is on time */ | ||
480 | } else if (delta.tv_sec < 0) { | ||
481 | /* do nothing, timer is already late */ | ||
482 | } else { | ||
483 | /* timer is early due to a clock set */ | ||
484 | tstojiffie(&delta, | ||
485 | posix_clocks[timr->it_clock].res, | ||
486 | &exp); | ||
487 | timr->it.real.wall_to_prev = new_wall_to; | ||
488 | timr->it.real.timer.expires += exp; | ||
489 | add_timer(&timr->it.real.timer); | ||
490 | do_notify = 0; | ||
491 | } | ||
492 | spin_unlock(&abs_list.lock); | ||
493 | 342 | ||
494 | } | 343 | if (timr->it.real.interval.tv64 != 0) |
495 | if (do_notify) { | 344 | si_private = ++timr->it_requeue_pending; |
496 | int si_private=0; | ||
497 | 345 | ||
498 | if (timr->it.real.incr) | 346 | if (posix_timer_event(timr, si_private)) { |
499 | si_private = ++timr->it_requeue_pending; | 347 | /* |
500 | else { | 348 | * signal was not sent because of sig_ignor |
501 | remove_from_abslist(timr); | 349 | * we will not get a call back to restart it AND |
350 | * it should be restarted. | ||
351 | */ | ||
352 | if (timr->it.real.interval.tv64 != 0) { | ||
353 | timr->it_overrun += | ||
354 | hrtimer_forward(&timr->it.real.timer, | ||
355 | timr->it.real.interval); | ||
356 | ret = HRTIMER_RESTART; | ||
502 | } | 357 | } |
503 | |||
504 | if (posix_timer_event(timr, si_private)) | ||
505 | /* | ||
506 | * signal was not sent because of sig_ignor | ||
507 | * we will not get a call back to restart it AND | ||
508 | * it should be restarted. | ||
509 | */ | ||
510 | schedule_next_timer(timr); | ||
511 | } | 358 | } |
512 | unlock_timer(timr, flags); /* hold thru abs lock to keep irq off */ | ||
513 | } | ||
514 | 359 | ||
360 | unlock_timer(timr, flags); | ||
361 | return ret; | ||
362 | } | ||
515 | 363 | ||
516 | static inline struct task_struct * good_sigevent(sigevent_t * event) | 364 | static inline struct task_struct * good_sigevent(sigevent_t * event) |
517 | { | 365 | { |
@@ -530,7 +378,7 @@ static inline struct task_struct * good_sigevent(sigevent_t * event) | |||
530 | return rtn; | 378 | return rtn; |
531 | } | 379 | } |
532 | 380 | ||
533 | void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock) | 381 | void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock) |
534 | { | 382 | { |
535 | if ((unsigned) clock_id >= MAX_CLOCKS) { | 383 | if ((unsigned) clock_id >= MAX_CLOCKS) { |
536 | printk("POSIX clock register failed for clock_id %d\n", | 384 | printk("POSIX clock register failed for clock_id %d\n", |
@@ -576,7 +424,7 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set) | |||
576 | /* Create a POSIX.1b interval timer. */ | 424 | /* Create a POSIX.1b interval timer. */ |
577 | 425 | ||
578 | asmlinkage long | 426 | asmlinkage long |
579 | sys_timer_create(clockid_t which_clock, | 427 | sys_timer_create(const clockid_t which_clock, |
580 | struct sigevent __user *timer_event_spec, | 428 | struct sigevent __user *timer_event_spec, |
581 | timer_t __user * created_timer_id) | 429 | timer_t __user * created_timer_id) |
582 | { | 430 | { |
@@ -602,8 +450,7 @@ sys_timer_create(clockid_t which_clock, | |||
602 | goto out; | 450 | goto out; |
603 | } | 451 | } |
604 | spin_lock_irq(&idr_lock); | 452 | spin_lock_irq(&idr_lock); |
605 | error = idr_get_new(&posix_timers_id, | 453 | error = idr_get_new(&posix_timers_id, (void *) new_timer, |
606 | (void *) new_timer, | ||
607 | &new_timer_id); | 454 | &new_timer_id); |
608 | spin_unlock_irq(&idr_lock); | 455 | spin_unlock_irq(&idr_lock); |
609 | if (error == -EAGAIN) | 456 | if (error == -EAGAIN) |
@@ -704,27 +551,6 @@ out: | |||
704 | } | 551 | } |
705 | 552 | ||
706 | /* | 553 | /* |
707 | * good_timespec | ||
708 | * | ||
709 | * This function checks the elements of a timespec structure. | ||
710 | * | ||
711 | * Arguments: | ||
712 | * ts : Pointer to the timespec structure to check | ||
713 | * | ||
714 | * Return value: | ||
715 | * If a NULL pointer was passed in, or the tv_nsec field was less than 0 | ||
716 | * or greater than NSEC_PER_SEC, or the tv_sec field was less than 0, | ||
717 | * this function returns 0. Otherwise it returns 1. | ||
718 | */ | ||
719 | static int good_timespec(const struct timespec *ts) | ||
720 | { | ||
721 | if ((!ts) || (ts->tv_sec < 0) || | ||
722 | ((unsigned) ts->tv_nsec >= NSEC_PER_SEC)) | ||
723 | return 0; | ||
724 | return 1; | ||
725 | } | ||
726 | |||
727 | /* | ||
728 | * Locking issues: We need to protect the result of the id look up until | 554 | * Locking issues: We need to protect the result of the id look up until |
729 | * we get the timer locked down so it is not deleted under us. The | 555 | * we get the timer locked down so it is not deleted under us. The |
730 | * removal is done under the idr spinlock so we use that here to bridge | 556 | * removal is done under the idr spinlock so we use that here to bridge |
@@ -776,39 +602,39 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags) | |||
776 | static void | 602 | static void |
777 | common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) | 603 | common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting) |
778 | { | 604 | { |
779 | unsigned long expires; | 605 | ktime_t remaining; |
780 | struct now_struct now; | 606 | struct hrtimer *timer = &timr->it.real.timer; |
781 | 607 | ||
782 | do | 608 | memset(cur_setting, 0, sizeof(struct itimerspec)); |
783 | expires = timr->it.real.timer.expires; | 609 | remaining = hrtimer_get_remaining(timer); |
784 | while ((volatile long) (timr->it.real.timer.expires) != expires); | ||
785 | |||
786 | posix_get_now(&now); | ||
787 | |||
788 | if (expires && | ||
789 | ((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) && | ||
790 | !timr->it.real.incr && | ||
791 | posix_time_before(&timr->it.real.timer, &now)) | ||
792 | timr->it.real.timer.expires = expires = 0; | ||
793 | if (expires) { | ||
794 | if (timr->it_requeue_pending & REQUEUE_PENDING || | ||
795 | (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) { | ||
796 | posix_bump_timer(timr, now); | ||
797 | expires = timr->it.real.timer.expires; | ||
798 | } | ||
799 | else | ||
800 | if (!timer_pending(&timr->it.real.timer)) | ||
801 | expires = 0; | ||
802 | if (expires) | ||
803 | expires -= now.jiffies; | ||
804 | } | ||
805 | jiffies_to_timespec(expires, &cur_setting->it_value); | ||
806 | jiffies_to_timespec(timr->it.real.incr, &cur_setting->it_interval); | ||
807 | 610 | ||
808 | if (cur_setting->it_value.tv_sec < 0) { | 611 | /* Time left ? or timer pending */ |
612 | if (remaining.tv64 > 0 || hrtimer_active(timer)) | ||
613 | goto calci; | ||
614 | /* interval timer ? */ | ||
615 | if (timr->it.real.interval.tv64 == 0) | ||
616 | return; | ||
617 | /* | ||
618 | * When a requeue is pending or this is a SIGEV_NONE timer | ||
619 | * move the expiry time forward by intervals, so expiry is > | ||
620 | * now. | ||
621 | */ | ||
622 | if (timr->it_requeue_pending & REQUEUE_PENDING || | ||
623 | (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) { | ||
624 | timr->it_overrun += | ||
625 | hrtimer_forward(timer, timr->it.real.interval); | ||
626 | remaining = hrtimer_get_remaining(timer); | ||
627 | } | ||
628 | calci: | ||
629 | /* interval timer ? */ | ||
630 | if (timr->it.real.interval.tv64 != 0) | ||
631 | cur_setting->it_interval = | ||
632 | ktime_to_timespec(timr->it.real.interval); | ||
633 | /* Return 0 only, when the timer is expired and not pending */ | ||
634 | if (remaining.tv64 <= 0) | ||
809 | cur_setting->it_value.tv_nsec = 1; | 635 | cur_setting->it_value.tv_nsec = 1; |
810 | cur_setting->it_value.tv_sec = 0; | 636 | else |
811 | } | 637 | cur_setting->it_value = ktime_to_timespec(remaining); |
812 | } | 638 | } |
813 | 639 | ||
814 | /* Get the time remaining on a POSIX.1b interval timer. */ | 640 | /* Get the time remaining on a POSIX.1b interval timer. */ |
@@ -832,6 +658,7 @@ sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting) | |||
832 | 658 | ||
833 | return 0; | 659 | return 0; |
834 | } | 660 | } |
661 | |||
835 | /* | 662 | /* |
836 | * Get the number of overruns of a POSIX.1b interval timer. This is to | 663 | * Get the number of overruns of a POSIX.1b interval timer. This is to |
837 | * be the overrun of the timer last delivered. At the same time we are | 664 | * be the overrun of the timer last delivered. At the same time we are |
@@ -841,7 +668,6 @@ sys_timer_gettime(timer_t timer_id, struct itimerspec __user *setting) | |||
841 | * the call back to do_schedule_next_timer(). So all we need to do is | 668 | * the call back to do_schedule_next_timer(). So all we need to do is |
842 | * to pick up the frozen overrun. | 669 | * to pick up the frozen overrun. |
843 | */ | 670 | */ |
844 | |||
845 | asmlinkage long | 671 | asmlinkage long |
846 | sys_timer_getoverrun(timer_t timer_id) | 672 | sys_timer_getoverrun(timer_t timer_id) |
847 | { | 673 | { |
@@ -858,84 +684,6 @@ sys_timer_getoverrun(timer_t timer_id) | |||
858 | 684 | ||
859 | return overrun; | 685 | return overrun; |
860 | } | 686 | } |
861 | /* | ||
862 | * Adjust for absolute time | ||
863 | * | ||
864 | * If absolute time is given and it is not CLOCK_MONOTONIC, we need to | ||
865 | * adjust for the offset between the timer clock (CLOCK_MONOTONIC) and | ||
866 | * what ever clock he is using. | ||
867 | * | ||
868 | * If it is relative time, we need to add the current (CLOCK_MONOTONIC) | ||
869 | * time to it to get the proper time for the timer. | ||
870 | */ | ||
871 | static int adjust_abs_time(struct k_clock *clock, struct timespec *tp, | ||
872 | int abs, u64 *exp, struct timespec *wall_to) | ||
873 | { | ||
874 | struct timespec now; | ||
875 | struct timespec oc = *tp; | ||
876 | u64 jiffies_64_f; | ||
877 | int rtn =0; | ||
878 | |||
879 | if (abs) { | ||
880 | /* | ||
881 | * The mask pick up the 4 basic clocks | ||
882 | */ | ||
883 | if (!((clock - &posix_clocks[0]) & ~CLOCKS_MASK)) { | ||
884 | jiffies_64_f = do_posix_clock_monotonic_gettime_parts( | ||
885 | &now, wall_to); | ||
886 | /* | ||
887 | * If we are doing a MONOTONIC clock | ||
888 | */ | ||
889 | if((clock - &posix_clocks[0]) & CLOCKS_MONO){ | ||
890 | now.tv_sec += wall_to->tv_sec; | ||
891 | now.tv_nsec += wall_to->tv_nsec; | ||
892 | } | ||
893 | } else { | ||
894 | /* | ||
895 | * Not one of the basic clocks | ||
896 | */ | ||
897 | clock->clock_get(clock - posix_clocks, &now); | ||
898 | jiffies_64_f = get_jiffies_64(); | ||
899 | } | ||
900 | /* | ||
901 | * Take away now to get delta and normalize | ||
902 | */ | ||
903 | set_normalized_timespec(&oc, oc.tv_sec - now.tv_sec, | ||
904 | oc.tv_nsec - now.tv_nsec); | ||
905 | }else{ | ||
906 | jiffies_64_f = get_jiffies_64(); | ||
907 | } | ||
908 | /* | ||
909 | * Check if the requested time is prior to now (if so set now) | ||
910 | */ | ||
911 | if (oc.tv_sec < 0) | ||
912 | oc.tv_sec = oc.tv_nsec = 0; | ||
913 | |||
914 | if (oc.tv_sec | oc.tv_nsec) | ||
915 | set_normalized_timespec(&oc, oc.tv_sec, | ||
916 | oc.tv_nsec + clock->res); | ||
917 | tstojiffie(&oc, clock->res, exp); | ||
918 | |||
919 | /* | ||
920 | * Check if the requested time is more than the timer code | ||
921 | * can handle (if so we error out but return the value too). | ||
922 | */ | ||
923 | if (*exp > ((u64)MAX_JIFFY_OFFSET)) | ||
924 | /* | ||
925 | * This is a considered response, not exactly in | ||
926 | * line with the standard (in fact it is silent on | ||
927 | * possible overflows). We assume such a large | ||
928 | * value is ALMOST always a programming error and | ||
929 | * try not to compound it by setting a really dumb | ||
930 | * value. | ||
931 | */ | ||
932 | rtn = -EINVAL; | ||
933 | /* | ||
934 | * return the actual jiffies expire time, full 64 bits | ||
935 | */ | ||
936 | *exp += jiffies_64_f; | ||
937 | return rtn; | ||
938 | } | ||
939 | 687 | ||
940 | /* Set a POSIX.1b interval timer. */ | 688 | /* Set a POSIX.1b interval timer. */ |
941 | /* timr->it_lock is taken. */ | 689 | /* timr->it_lock is taken. */ |
@@ -943,68 +691,48 @@ static inline int | |||
943 | common_timer_set(struct k_itimer *timr, int flags, | 691 | common_timer_set(struct k_itimer *timr, int flags, |
944 | struct itimerspec *new_setting, struct itimerspec *old_setting) | 692 | struct itimerspec *new_setting, struct itimerspec *old_setting) |
945 | { | 693 | { |
946 | struct k_clock *clock = &posix_clocks[timr->it_clock]; | 694 | struct hrtimer *timer = &timr->it.real.timer; |
947 | u64 expire_64; | ||
948 | 695 | ||
949 | if (old_setting) | 696 | if (old_setting) |
950 | common_timer_get(timr, old_setting); | 697 | common_timer_get(timr, old_setting); |
951 | 698 | ||
952 | /* disable the timer */ | 699 | /* disable the timer */ |
953 | timr->it.real.incr = 0; | 700 | timr->it.real.interval.tv64 = 0; |
954 | /* | 701 | /* |
955 | * careful here. If smp we could be in the "fire" routine which will | 702 | * careful here. If smp we could be in the "fire" routine which will |
956 | * be spinning as we hold the lock. But this is ONLY an SMP issue. | 703 | * be spinning as we hold the lock. But this is ONLY an SMP issue. |
957 | */ | 704 | */ |
958 | if (try_to_del_timer_sync(&timr->it.real.timer) < 0) { | 705 | if (hrtimer_try_to_cancel(timer) < 0) |
959 | #ifdef CONFIG_SMP | ||
960 | /* | ||
961 | * It can only be active if on an other cpu. Since | ||
962 | * we have cleared the interval stuff above, it should | ||
963 | * clear once we release the spin lock. Of course once | ||
964 | * we do that anything could happen, including the | ||
965 | * complete melt down of the timer. So return with | ||
966 | * a "retry" exit status. | ||
967 | */ | ||
968 | return TIMER_RETRY; | 706 | return TIMER_RETRY; |
969 | #endif | ||
970 | } | ||
971 | |||
972 | remove_from_abslist(timr); | ||
973 | 707 | ||
974 | timr->it_requeue_pending = (timr->it_requeue_pending + 2) & | 708 | timr->it_requeue_pending = (timr->it_requeue_pending + 2) & |
975 | ~REQUEUE_PENDING; | 709 | ~REQUEUE_PENDING; |
976 | timr->it_overrun_last = 0; | 710 | timr->it_overrun_last = 0; |
977 | timr->it_overrun = -1; | ||
978 | /* | ||
979 | *switch off the timer when it_value is zero | ||
980 | */ | ||
981 | if (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec) { | ||
982 | timr->it.real.timer.expires = 0; | ||
983 | return 0; | ||
984 | } | ||
985 | 711 | ||
986 | if (adjust_abs_time(clock, | 712 | /* switch off the timer when it_value is zero */ |
987 | &new_setting->it_value, flags & TIMER_ABSTIME, | 713 | if (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec) |
988 | &expire_64, &(timr->it.real.wall_to_prev))) { | 714 | return 0; |
989 | return -EINVAL; | ||
990 | } | ||
991 | timr->it.real.timer.expires = (unsigned long)expire_64; | ||
992 | tstojiffie(&new_setting->it_interval, clock->res, &expire_64); | ||
993 | timr->it.real.incr = (unsigned long)expire_64; | ||
994 | 715 | ||
995 | /* | 716 | /* Posix madness. Only absolute CLOCK_REALTIME timers |
996 | * We do not even queue SIGEV_NONE timers! But we do put them | 717 | * are affected by clock sets. So we must reiniatilize |
997 | * in the abs list so we can do that right. | 718 | * the timer. |
998 | */ | 719 | */ |
999 | if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE)) | 720 | if (timr->it_clock == CLOCK_REALTIME && (flags & TIMER_ABSTIME)) |
1000 | add_timer(&timr->it.real.timer); | 721 | hrtimer_rebase(timer, CLOCK_REALTIME); |
1001 | 722 | else | |
1002 | if (flags & TIMER_ABSTIME && clock->abs_struct) { | 723 | hrtimer_rebase(timer, CLOCK_MONOTONIC); |
1003 | spin_lock(&clock->abs_struct->lock); | 724 | |
1004 | list_add_tail(&(timr->it.real.abs_timer_entry), | 725 | timer->expires = timespec_to_ktime(new_setting->it_value); |
1005 | &(clock->abs_struct->list)); | 726 | |
1006 | spin_unlock(&clock->abs_struct->lock); | 727 | /* Convert interval */ |
1007 | } | 728 | timr->it.real.interval = timespec_to_ktime(new_setting->it_interval); |
729 | |||
730 | /* SIGEV_NONE timers are not queued ! See common_timer_get */ | ||
731 | if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE)) | ||
732 | return 0; | ||
733 | |||
734 | hrtimer_start(timer, timer->expires, (flags & TIMER_ABSTIME) ? | ||
735 | HRTIMER_ABS : HRTIMER_REL); | ||
1008 | return 0; | 736 | return 0; |
1009 | } | 737 | } |
1010 | 738 | ||
@@ -1026,8 +754,8 @@ sys_timer_settime(timer_t timer_id, int flags, | |||
1026 | if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) | 754 | if (copy_from_user(&new_spec, new_setting, sizeof (new_spec))) |
1027 | return -EFAULT; | 755 | return -EFAULT; |
1028 | 756 | ||
1029 | if ((!good_timespec(&new_spec.it_interval)) || | 757 | if (!timespec_valid(&new_spec.it_interval) || |
1030 | (!good_timespec(&new_spec.it_value))) | 758 | !timespec_valid(&new_spec.it_value)) |
1031 | return -EINVAL; | 759 | return -EINVAL; |
1032 | retry: | 760 | retry: |
1033 | timr = lock_timer(timer_id, &flag); | 761 | timr = lock_timer(timer_id, &flag); |
@@ -1043,8 +771,8 @@ retry: | |||
1043 | goto retry; | 771 | goto retry; |
1044 | } | 772 | } |
1045 | 773 | ||
1046 | if (old_setting && !error && copy_to_user(old_setting, | 774 | if (old_setting && !error && |
1047 | &old_spec, sizeof (old_spec))) | 775 | copy_to_user(old_setting, &old_spec, sizeof (old_spec))) |
1048 | error = -EFAULT; | 776 | error = -EFAULT; |
1049 | 777 | ||
1050 | return error; | 778 | return error; |
@@ -1052,24 +780,10 @@ retry: | |||
1052 | 780 | ||
1053 | static inline int common_timer_del(struct k_itimer *timer) | 781 | static inline int common_timer_del(struct k_itimer *timer) |
1054 | { | 782 | { |
1055 | timer->it.real.incr = 0; | 783 | timer->it.real.interval.tv64 = 0; |
1056 | 784 | ||
1057 | if (try_to_del_timer_sync(&timer->it.real.timer) < 0) { | 785 | if (hrtimer_try_to_cancel(&timer->it.real.timer) < 0) |
1058 | #ifdef CONFIG_SMP | ||
1059 | /* | ||
1060 | * It can only be active if on an other cpu. Since | ||
1061 | * we have cleared the interval stuff above, it should | ||
1062 | * clear once we release the spin lock. Of course once | ||
1063 | * we do that anything could happen, including the | ||
1064 | * complete melt down of the timer. So return with | ||
1065 | * a "retry" exit status. | ||
1066 | */ | ||
1067 | return TIMER_RETRY; | 786 | return TIMER_RETRY; |
1068 | #endif | ||
1069 | } | ||
1070 | |||
1071 | remove_from_abslist(timer); | ||
1072 | |||
1073 | return 0; | 787 | return 0; |
1074 | } | 788 | } |
1075 | 789 | ||
@@ -1085,24 +799,16 @@ sys_timer_delete(timer_t timer_id) | |||
1085 | struct k_itimer *timer; | 799 | struct k_itimer *timer; |
1086 | long flags; | 800 | long flags; |
1087 | 801 | ||
1088 | #ifdef CONFIG_SMP | ||
1089 | int error; | ||
1090 | retry_delete: | 802 | retry_delete: |
1091 | #endif | ||
1092 | timer = lock_timer(timer_id, &flags); | 803 | timer = lock_timer(timer_id, &flags); |
1093 | if (!timer) | 804 | if (!timer) |
1094 | return -EINVAL; | 805 | return -EINVAL; |
1095 | 806 | ||
1096 | #ifdef CONFIG_SMP | 807 | if (timer_delete_hook(timer) == TIMER_RETRY) { |
1097 | error = timer_delete_hook(timer); | ||
1098 | |||
1099 | if (error == TIMER_RETRY) { | ||
1100 | unlock_timer(timer, flags); | 808 | unlock_timer(timer, flags); |
1101 | goto retry_delete; | 809 | goto retry_delete; |
1102 | } | 810 | } |
1103 | #else | 811 | |
1104 | timer_delete_hook(timer); | ||
1105 | #endif | ||
1106 | spin_lock(¤t->sighand->siglock); | 812 | spin_lock(¤t->sighand->siglock); |
1107 | list_del(&timer->list); | 813 | list_del(&timer->list); |
1108 | spin_unlock(¤t->sighand->siglock); | 814 | spin_unlock(¤t->sighand->siglock); |
@@ -1119,6 +825,7 @@ retry_delete: | |||
1119 | release_posix_timer(timer, IT_ID_SET); | 825 | release_posix_timer(timer, IT_ID_SET); |
1120 | return 0; | 826 | return 0; |
1121 | } | 827 | } |
828 | |||
1122 | /* | 829 | /* |
1123 | * return timer owned by the process, used by exit_itimers | 830 | * return timer owned by the process, used by exit_itimers |
1124 | */ | 831 | */ |
@@ -1126,22 +833,13 @@ static inline void itimer_delete(struct k_itimer *timer) | |||
1126 | { | 833 | { |
1127 | unsigned long flags; | 834 | unsigned long flags; |
1128 | 835 | ||
1129 | #ifdef CONFIG_SMP | ||
1130 | int error; | ||
1131 | retry_delete: | 836 | retry_delete: |
1132 | #endif | ||
1133 | spin_lock_irqsave(&timer->it_lock, flags); | 837 | spin_lock_irqsave(&timer->it_lock, flags); |
1134 | 838 | ||
1135 | #ifdef CONFIG_SMP | 839 | if (timer_delete_hook(timer) == TIMER_RETRY) { |
1136 | error = timer_delete_hook(timer); | ||
1137 | |||
1138 | if (error == TIMER_RETRY) { | ||
1139 | unlock_timer(timer, flags); | 840 | unlock_timer(timer, flags); |
1140 | goto retry_delete; | 841 | goto retry_delete; |
1141 | } | 842 | } |
1142 | #else | ||
1143 | timer_delete_hook(timer); | ||
1144 | #endif | ||
1145 | list_del(&timer->list); | 843 | list_del(&timer->list); |
1146 | /* | 844 | /* |
1147 | * This keeps any tasks waiting on the spin lock from thinking | 845 | * This keeps any tasks waiting on the spin lock from thinking |
@@ -1170,57 +868,8 @@ void exit_itimers(struct signal_struct *sig) | |||
1170 | } | 868 | } |
1171 | } | 869 | } |
1172 | 870 | ||
1173 | /* | 871 | /* Not available / possible... functions */ |
1174 | * And now for the "clock" calls | 872 | int do_posix_clock_nosettime(const clockid_t clockid, struct timespec *tp) |
1175 | * | ||
1176 | * These functions are called both from timer functions (with the timer | ||
1177 | * spin_lock_irq() held and from clock calls with no locking. They must | ||
1178 | * use the save flags versions of locks. | ||
1179 | */ | ||
1180 | |||
1181 | /* | ||
1182 | * We do ticks here to avoid the irq lock ( they take sooo long). | ||
1183 | * The seqlock is great here. Since we a reader, we don't really care | ||
1184 | * if we are interrupted since we don't take lock that will stall us or | ||
1185 | * any other cpu. Voila, no irq lock is needed. | ||
1186 | * | ||
1187 | */ | ||
1188 | |||
1189 | static u64 do_posix_clock_monotonic_gettime_parts( | ||
1190 | struct timespec *tp, struct timespec *mo) | ||
1191 | { | ||
1192 | u64 jiff; | ||
1193 | unsigned int seq; | ||
1194 | |||
1195 | do { | ||
1196 | seq = read_seqbegin(&xtime_lock); | ||
1197 | getnstimeofday(tp); | ||
1198 | *mo = wall_to_monotonic; | ||
1199 | jiff = jiffies_64; | ||
1200 | |||
1201 | } while(read_seqretry(&xtime_lock, seq)); | ||
1202 | |||
1203 | return jiff; | ||
1204 | } | ||
1205 | |||
1206 | static int do_posix_clock_monotonic_get(clockid_t clock, struct timespec *tp) | ||
1207 | { | ||
1208 | struct timespec wall_to_mono; | ||
1209 | |||
1210 | do_posix_clock_monotonic_gettime_parts(tp, &wall_to_mono); | ||
1211 | |||
1212 | set_normalized_timespec(tp, tp->tv_sec + wall_to_mono.tv_sec, | ||
1213 | tp->tv_nsec + wall_to_mono.tv_nsec); | ||
1214 | |||
1215 | return 0; | ||
1216 | } | ||
1217 | |||
1218 | int do_posix_clock_monotonic_gettime(struct timespec *tp) | ||
1219 | { | ||
1220 | return do_posix_clock_monotonic_get(CLOCK_MONOTONIC, tp); | ||
1221 | } | ||
1222 | |||
1223 | int do_posix_clock_nosettime(clockid_t clockid, struct timespec *tp) | ||
1224 | { | 873 | { |
1225 | return -EINVAL; | 874 | return -EINVAL; |
1226 | } | 875 | } |
@@ -1232,7 +881,8 @@ int do_posix_clock_notimer_create(struct k_itimer *timer) | |||
1232 | } | 881 | } |
1233 | EXPORT_SYMBOL_GPL(do_posix_clock_notimer_create); | 882 | EXPORT_SYMBOL_GPL(do_posix_clock_notimer_create); |
1234 | 883 | ||
1235 | int do_posix_clock_nonanosleep(clockid_t clock, int flags, struct timespec *t) | 884 | int do_posix_clock_nonanosleep(const clockid_t clock, int flags, |
885 | struct timespec *t, struct timespec __user *r) | ||
1236 | { | 886 | { |
1237 | #ifndef ENOTSUP | 887 | #ifndef ENOTSUP |
1238 | return -EOPNOTSUPP; /* aka ENOTSUP in userland for POSIX */ | 888 | return -EOPNOTSUPP; /* aka ENOTSUP in userland for POSIX */ |
@@ -1242,8 +892,8 @@ int do_posix_clock_nonanosleep(clockid_t clock, int flags, struct timespec *t) | |||
1242 | } | 892 | } |
1243 | EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep); | 893 | EXPORT_SYMBOL_GPL(do_posix_clock_nonanosleep); |
1244 | 894 | ||
1245 | asmlinkage long | 895 | asmlinkage long sys_clock_settime(const clockid_t which_clock, |
1246 | sys_clock_settime(clockid_t which_clock, const struct timespec __user *tp) | 896 | const struct timespec __user *tp) |
1247 | { | 897 | { |
1248 | struct timespec new_tp; | 898 | struct timespec new_tp; |
1249 | 899 | ||
@@ -1256,7 +906,7 @@ sys_clock_settime(clockid_t which_clock, const struct timespec __user *tp) | |||
1256 | } | 906 | } |
1257 | 907 | ||
1258 | asmlinkage long | 908 | asmlinkage long |
1259 | sys_clock_gettime(clockid_t which_clock, struct timespec __user *tp) | 909 | sys_clock_gettime(const clockid_t which_clock, struct timespec __user *tp) |
1260 | { | 910 | { |
1261 | struct timespec kernel_tp; | 911 | struct timespec kernel_tp; |
1262 | int error; | 912 | int error; |
@@ -1273,7 +923,7 @@ sys_clock_gettime(clockid_t which_clock, struct timespec __user *tp) | |||
1273 | } | 923 | } |
1274 | 924 | ||
1275 | asmlinkage long | 925 | asmlinkage long |
1276 | sys_clock_getres(clockid_t which_clock, struct timespec __user *tp) | 926 | sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp) |
1277 | { | 927 | { |
1278 | struct timespec rtn_tp; | 928 | struct timespec rtn_tp; |
1279 | int error; | 929 | int error; |
@@ -1292,117 +942,34 @@ sys_clock_getres(clockid_t which_clock, struct timespec __user *tp) | |||
1292 | } | 942 | } |
1293 | 943 | ||
1294 | /* | 944 | /* |
1295 | * The standard says that an absolute nanosleep call MUST wake up at | 945 | * nanosleep for monotonic and realtime clocks |
1296 | * the requested time in spite of clock settings. Here is what we do: | ||
1297 | * For each nanosleep call that needs it (only absolute and not on | ||
1298 | * CLOCK_MONOTONIC* (as it can not be set)) we thread a little structure | ||
1299 | * into the "nanosleep_abs_list". All we need is the task_struct pointer. | ||
1300 | * When ever the clock is set we just wake up all those tasks. The rest | ||
1301 | * is done by the while loop in clock_nanosleep(). | ||
1302 | * | ||
1303 | * On locking, clock_was_set() is called from update_wall_clock which | ||
1304 | * holds (or has held for it) a write_lock_irq( xtime_lock) and is | ||
1305 | * called from the timer bh code. Thus we need the irq save locks. | ||
1306 | * | ||
1307 | * Also, on the call from update_wall_clock, that is done as part of a | ||
1308 | * softirq thing. We don't want to delay the system that much (possibly | ||
1309 | * long list of timers to fix), so we defer that work to keventd. | ||
1310 | */ | 946 | */ |
1311 | 947 | static int common_nsleep(const clockid_t which_clock, int flags, | |
1312 | static DECLARE_WAIT_QUEUE_HEAD(nanosleep_abs_wqueue); | 948 | struct timespec *tsave, struct timespec __user *rmtp) |
1313 | static DECLARE_WORK(clock_was_set_work, (void(*)(void*))clock_was_set, NULL); | 949 | { |
1314 | 950 | int mode = flags & TIMER_ABSTIME ? HRTIMER_ABS : HRTIMER_REL; | |
1315 | static DECLARE_MUTEX(clock_was_set_lock); | 951 | int clockid = which_clock; |
1316 | 952 | ||
1317 | void clock_was_set(void) | 953 | switch (which_clock) { |
1318 | { | 954 | case CLOCK_REALTIME: |
1319 | struct k_itimer *timr; | 955 | /* Posix madness. Only absolute timers on clock realtime |
1320 | struct timespec new_wall_to; | 956 | are affected by clock set. */ |
1321 | LIST_HEAD(cws_list); | 957 | if (mode != HRTIMER_ABS) |
1322 | unsigned long seq; | 958 | clockid = CLOCK_MONOTONIC; |
1323 | 959 | case CLOCK_MONOTONIC: | |
1324 | 960 | break; | |
1325 | if (unlikely(in_interrupt())) { | 961 | default: |
1326 | schedule_work(&clock_was_set_work); | 962 | return -EINVAL; |
1327 | return; | ||
1328 | } | 963 | } |
1329 | wake_up_all(&nanosleep_abs_wqueue); | 964 | return hrtimer_nanosleep(tsave, rmtp, mode, clockid); |
1330 | |||
1331 | /* | ||
1332 | * Check if there exist TIMER_ABSTIME timers to correct. | ||
1333 | * | ||
1334 | * Notes on locking: This code is run in task context with irq | ||
1335 | * on. We CAN be interrupted! All other usage of the abs list | ||
1336 | * lock is under the timer lock which holds the irq lock as | ||
1337 | * well. We REALLY don't want to scan the whole list with the | ||
1338 | * interrupt system off, AND we would like a sequence lock on | ||
1339 | * this code as well. Since we assume that the clock will not | ||
1340 | * be set often, it seems ok to take and release the irq lock | ||
1341 | * for each timer. In fact add_timer will do this, so this is | ||
1342 | * not an issue. So we know when we are done, we will move the | ||
1343 | * whole list to a new location. Then as we process each entry, | ||
1344 | * we will move it to the actual list again. This way, when our | ||
1345 | * copy is empty, we are done. We are not all that concerned | ||
1346 | * about preemption so we will use a semaphore lock to protect | ||
1347 | * aginst reentry. This way we will not stall another | ||
1348 | * processor. It is possible that this may delay some timers | ||
1349 | * that should have expired, given the new clock, but even this | ||
1350 | * will be minimal as we will always update to the current time, | ||
1351 | * even if it was set by a task that is waiting for entry to | ||
1352 | * this code. Timers that expire too early will be caught by | ||
1353 | * the expire code and restarted. | ||
1354 | |||
1355 | * Absolute timers that repeat are left in the abs list while | ||
1356 | * waiting for the task to pick up the signal. This means we | ||
1357 | * may find timers that are not in the "add_timer" list, but are | ||
1358 | * in the abs list. We do the same thing for these, save | ||
1359 | * putting them back in the "add_timer" list. (Note, these are | ||
1360 | * left in the abs list mainly to indicate that they are | ||
1361 | * ABSOLUTE timers, a fact that is used by the re-arm code, and | ||
1362 | * for which we have no other flag.) | ||
1363 | |||
1364 | */ | ||
1365 | |||
1366 | down(&clock_was_set_lock); | ||
1367 | spin_lock_irq(&abs_list.lock); | ||
1368 | list_splice_init(&abs_list.list, &cws_list); | ||
1369 | spin_unlock_irq(&abs_list.lock); | ||
1370 | do { | ||
1371 | do { | ||
1372 | seq = read_seqbegin(&xtime_lock); | ||
1373 | new_wall_to = wall_to_monotonic; | ||
1374 | } while (read_seqretry(&xtime_lock, seq)); | ||
1375 | |||
1376 | spin_lock_irq(&abs_list.lock); | ||
1377 | if (list_empty(&cws_list)) { | ||
1378 | spin_unlock_irq(&abs_list.lock); | ||
1379 | break; | ||
1380 | } | ||
1381 | timr = list_entry(cws_list.next, struct k_itimer, | ||
1382 | it.real.abs_timer_entry); | ||
1383 | |||
1384 | list_del_init(&timr->it.real.abs_timer_entry); | ||
1385 | if (add_clockset_delta(timr, &new_wall_to) && | ||
1386 | del_timer(&timr->it.real.timer)) /* timer run yet? */ | ||
1387 | add_timer(&timr->it.real.timer); | ||
1388 | list_add(&timr->it.real.abs_timer_entry, &abs_list.list); | ||
1389 | spin_unlock_irq(&abs_list.lock); | ||
1390 | } while (1); | ||
1391 | |||
1392 | up(&clock_was_set_lock); | ||
1393 | } | 965 | } |
1394 | 966 | ||
1395 | long clock_nanosleep_restart(struct restart_block *restart_block); | ||
1396 | |||
1397 | asmlinkage long | 967 | asmlinkage long |
1398 | sys_clock_nanosleep(clockid_t which_clock, int flags, | 968 | sys_clock_nanosleep(const clockid_t which_clock, int flags, |
1399 | const struct timespec __user *rqtp, | 969 | const struct timespec __user *rqtp, |
1400 | struct timespec __user *rmtp) | 970 | struct timespec __user *rmtp) |
1401 | { | 971 | { |
1402 | struct timespec t; | 972 | struct timespec t; |
1403 | struct restart_block *restart_block = | ||
1404 | &(current_thread_info()->restart_block); | ||
1405 | int ret; | ||
1406 | 973 | ||
1407 | if (invalid_clockid(which_clock)) | 974 | if (invalid_clockid(which_clock)) |
1408 | return -EINVAL; | 975 | return -EINVAL; |
@@ -1410,125 +977,9 @@ sys_clock_nanosleep(clockid_t which_clock, int flags, | |||
1410 | if (copy_from_user(&t, rqtp, sizeof (struct timespec))) | 977 | if (copy_from_user(&t, rqtp, sizeof (struct timespec))) |
1411 | return -EFAULT; | 978 | return -EFAULT; |
1412 | 979 | ||
1413 | if ((unsigned) t.tv_nsec >= NSEC_PER_SEC || t.tv_sec < 0) | 980 | if (!timespec_valid(&t)) |
1414 | return -EINVAL; | 981 | return -EINVAL; |
1415 | 982 | ||
1416 | /* | 983 | return CLOCK_DISPATCH(which_clock, nsleep, |
1417 | * Do this here as nsleep function does not have the real address. | 984 | (which_clock, flags, &t, rmtp)); |
1418 | */ | ||
1419 | restart_block->arg1 = (unsigned long)rmtp; | ||
1420 | |||
1421 | ret = CLOCK_DISPATCH(which_clock, nsleep, (which_clock, flags, &t)); | ||
1422 | |||
1423 | if ((ret == -ERESTART_RESTARTBLOCK) && rmtp && | ||
1424 | copy_to_user(rmtp, &t, sizeof (t))) | ||
1425 | return -EFAULT; | ||
1426 | return ret; | ||
1427 | } | ||
1428 | |||
1429 | |||
1430 | static int common_nsleep(clockid_t which_clock, | ||
1431 | int flags, struct timespec *tsave) | ||
1432 | { | ||
1433 | struct timespec t, dum; | ||
1434 | DECLARE_WAITQUEUE(abs_wqueue, current); | ||
1435 | u64 rq_time = (u64)0; | ||
1436 | s64 left; | ||
1437 | int abs; | ||
1438 | struct restart_block *restart_block = | ||
1439 | ¤t_thread_info()->restart_block; | ||
1440 | |||
1441 | abs_wqueue.flags = 0; | ||
1442 | abs = flags & TIMER_ABSTIME; | ||
1443 | |||
1444 | if (restart_block->fn == clock_nanosleep_restart) { | ||
1445 | /* | ||
1446 | * Interrupted by a non-delivered signal, pick up remaining | ||
1447 | * time and continue. Remaining time is in arg2 & 3. | ||
1448 | */ | ||
1449 | restart_block->fn = do_no_restart_syscall; | ||
1450 | |||
1451 | rq_time = restart_block->arg3; | ||
1452 | rq_time = (rq_time << 32) + restart_block->arg2; | ||
1453 | if (!rq_time) | ||
1454 | return -EINTR; | ||
1455 | left = rq_time - get_jiffies_64(); | ||
1456 | if (left <= (s64)0) | ||
1457 | return 0; /* Already passed */ | ||
1458 | } | ||
1459 | |||
1460 | if (abs && (posix_clocks[which_clock].clock_get != | ||
1461 | posix_clocks[CLOCK_MONOTONIC].clock_get)) | ||
1462 | add_wait_queue(&nanosleep_abs_wqueue, &abs_wqueue); | ||
1463 | |||
1464 | do { | ||
1465 | t = *tsave; | ||
1466 | if (abs || !rq_time) { | ||
1467 | adjust_abs_time(&posix_clocks[which_clock], &t, abs, | ||
1468 | &rq_time, &dum); | ||
1469 | } | ||
1470 | |||
1471 | left = rq_time - get_jiffies_64(); | ||
1472 | if (left >= (s64)MAX_JIFFY_OFFSET) | ||
1473 | left = (s64)MAX_JIFFY_OFFSET; | ||
1474 | if (left < (s64)0) | ||
1475 | break; | ||
1476 | |||
1477 | schedule_timeout_interruptible(left); | ||
1478 | |||
1479 | left = rq_time - get_jiffies_64(); | ||
1480 | } while (left > (s64)0 && !test_thread_flag(TIF_SIGPENDING)); | ||
1481 | |||
1482 | if (abs_wqueue.task_list.next) | ||
1483 | finish_wait(&nanosleep_abs_wqueue, &abs_wqueue); | ||
1484 | |||
1485 | if (left > (s64)0) { | ||
1486 | |||
1487 | /* | ||
1488 | * Always restart abs calls from scratch to pick up any | ||
1489 | * clock shifting that happened while we are away. | ||
1490 | */ | ||
1491 | if (abs) | ||
1492 | return -ERESTARTNOHAND; | ||
1493 | |||
1494 | left *= TICK_NSEC; | ||
1495 | tsave->tv_sec = div_long_long_rem(left, | ||
1496 | NSEC_PER_SEC, | ||
1497 | &tsave->tv_nsec); | ||
1498 | /* | ||
1499 | * Restart works by saving the time remaing in | ||
1500 | * arg2 & 3 (it is 64-bits of jiffies). The other | ||
1501 | * info we need is the clock_id (saved in arg0). | ||
1502 | * The sys_call interface needs the users | ||
1503 | * timespec return address which _it_ saves in arg1. | ||
1504 | * Since we have cast the nanosleep call to a clock_nanosleep | ||
1505 | * both can be restarted with the same code. | ||
1506 | */ | ||
1507 | restart_block->fn = clock_nanosleep_restart; | ||
1508 | restart_block->arg0 = which_clock; | ||
1509 | /* | ||
1510 | * Caller sets arg1 | ||
1511 | */ | ||
1512 | restart_block->arg2 = rq_time & 0xffffffffLL; | ||
1513 | restart_block->arg3 = rq_time >> 32; | ||
1514 | |||
1515 | return -ERESTART_RESTARTBLOCK; | ||
1516 | } | ||
1517 | |||
1518 | return 0; | ||
1519 | } | ||
1520 | /* | ||
1521 | * This will restart clock_nanosleep. | ||
1522 | */ | ||
1523 | long | ||
1524 | clock_nanosleep_restart(struct restart_block *restart_block) | ||
1525 | { | ||
1526 | struct timespec t; | ||
1527 | int ret = common_nsleep(restart_block->arg0, 0, &t); | ||
1528 | |||
1529 | if ((ret == -ERESTART_RESTARTBLOCK) && restart_block->arg1 && | ||
1530 | copy_to_user((struct timespec __user *)(restart_block->arg1), &t, | ||
1531 | sizeof (t))) | ||
1532 | return -EFAULT; | ||
1533 | return ret; | ||
1534 | } | 985 | } |
diff --git a/kernel/resource.c b/kernel/resource.c index 92285d822de6..e3080fcc66a3 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -464,7 +464,7 @@ struct resource * __request_region(struct resource *parent, unsigned long start, | |||
464 | 464 | ||
465 | EXPORT_SYMBOL(__request_region); | 465 | EXPORT_SYMBOL(__request_region); |
466 | 466 | ||
467 | int __deprecated __check_region(struct resource *parent, unsigned long start, unsigned long n) | 467 | int __check_region(struct resource *parent, unsigned long start, unsigned long n) |
468 | { | 468 | { |
469 | struct resource * res; | 469 | struct resource * res; |
470 | 470 | ||
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index b3d4dc858e35..dcfb5d731466 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
@@ -87,13 +87,9 @@ static int stop_machine(void) | |||
87 | { | 87 | { |
88 | int i, ret = 0; | 88 | int i, ret = 0; |
89 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; | 89 | struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 }; |
90 | mm_segment_t old_fs = get_fs(); | ||
91 | 90 | ||
92 | /* One high-prio thread per cpu. We'll do this one. */ | 91 | /* One high-prio thread per cpu. We'll do this one. */ |
93 | set_fs(KERNEL_DS); | 92 | sched_setscheduler(current, SCHED_FIFO, ¶m); |
94 | sys_sched_setscheduler(current->pid, SCHED_FIFO, | ||
95 | (struct sched_param __user *)¶m); | ||
96 | set_fs(old_fs); | ||
97 | 93 | ||
98 | atomic_set(&stopmachine_thread_ack, 0); | 94 | atomic_set(&stopmachine_thread_ack, 0); |
99 | stopmachine_num_threads = 0; | 95 | stopmachine_num_threads = 0; |
diff --git a/kernel/time.c b/kernel/time.c index b94bfa8c03e0..169e8329e0b6 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -154,6 +154,9 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz) | |||
154 | static int firsttime = 1; | 154 | static int firsttime = 1; |
155 | int error = 0; | 155 | int error = 0; |
156 | 156 | ||
157 | if (!timespec_valid(tv)) | ||
158 | return -EINVAL; | ||
159 | |||
157 | error = security_settime(tv, tz); | 160 | error = security_settime(tv, tz); |
158 | if (error) | 161 | if (error) |
159 | return error; | 162 | return error; |
@@ -561,27 +564,107 @@ void getnstimeofday(struct timespec *tv) | |||
561 | EXPORT_SYMBOL_GPL(getnstimeofday); | 564 | EXPORT_SYMBOL_GPL(getnstimeofday); |
562 | #endif | 565 | #endif |
563 | 566 | ||
564 | void getnstimestamp(struct timespec *ts) | 567 | /* Converts Gregorian date to seconds since 1970-01-01 00:00:00. |
568 | * Assumes input in normal date format, i.e. 1980-12-31 23:59:59 | ||
569 | * => year=1980, mon=12, day=31, hour=23, min=59, sec=59. | ||
570 | * | ||
571 | * [For the Julian calendar (which was used in Russia before 1917, | ||
572 | * Britain & colonies before 1752, anywhere else before 1582, | ||
573 | * and is still in use by some communities) leave out the | ||
574 | * -year/100+year/400 terms, and add 10.] | ||
575 | * | ||
576 | * This algorithm was first published by Gauss (I think). | ||
577 | * | ||
578 | * WARNING: this function will overflow on 2106-02-07 06:28:16 on | ||
579 | * machines were long is 32-bit! (However, as time_t is signed, we | ||
580 | * will already get problems at other places on 2038-01-19 03:14:08) | ||
581 | */ | ||
582 | unsigned long | ||
583 | mktime(const unsigned int year0, const unsigned int mon0, | ||
584 | const unsigned int day, const unsigned int hour, | ||
585 | const unsigned int min, const unsigned int sec) | ||
565 | { | 586 | { |
566 | unsigned int seq; | 587 | unsigned int mon = mon0, year = year0; |
567 | struct timespec wall2mono; | ||
568 | 588 | ||
569 | /* synchronize with settimeofday() changes */ | 589 | /* 1..12 -> 11,12,1..10 */ |
570 | do { | 590 | if (0 >= (int) (mon -= 2)) { |
571 | seq = read_seqbegin(&xtime_lock); | 591 | mon += 12; /* Puts Feb last since it has leap day */ |
572 | getnstimeofday(ts); | 592 | year -= 1; |
573 | wall2mono = wall_to_monotonic; | ||
574 | } while(unlikely(read_seqretry(&xtime_lock, seq))); | ||
575 | |||
576 | /* adjust to monotonicaly-increasing values */ | ||
577 | ts->tv_sec += wall2mono.tv_sec; | ||
578 | ts->tv_nsec += wall2mono.tv_nsec; | ||
579 | while (unlikely(ts->tv_nsec >= NSEC_PER_SEC)) { | ||
580 | ts->tv_nsec -= NSEC_PER_SEC; | ||
581 | ts->tv_sec++; | ||
582 | } | 593 | } |
594 | |||
595 | return ((((unsigned long) | ||
596 | (year/4 - year/100 + year/400 + 367*mon/12 + day) + | ||
597 | year*365 - 719499 | ||
598 | )*24 + hour /* now have hours */ | ||
599 | )*60 + min /* now have minutes */ | ||
600 | )*60 + sec; /* finally seconds */ | ||
601 | } | ||
602 | |||
603 | EXPORT_SYMBOL(mktime); | ||
604 | |||
605 | /** | ||
606 | * set_normalized_timespec - set timespec sec and nsec parts and normalize | ||
607 | * | ||
608 | * @ts: pointer to timespec variable to be set | ||
609 | * @sec: seconds to set | ||
610 | * @nsec: nanoseconds to set | ||
611 | * | ||
612 | * Set seconds and nanoseconds field of a timespec variable and | ||
613 | * normalize to the timespec storage format | ||
614 | * | ||
615 | * Note: The tv_nsec part is always in the range of | ||
616 | * 0 <= tv_nsec < NSEC_PER_SEC | ||
617 | * For negative values only the tv_sec field is negative ! | ||
618 | */ | ||
619 | void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec) | ||
620 | { | ||
621 | while (nsec >= NSEC_PER_SEC) { | ||
622 | nsec -= NSEC_PER_SEC; | ||
623 | ++sec; | ||
624 | } | ||
625 | while (nsec < 0) { | ||
626 | nsec += NSEC_PER_SEC; | ||
627 | --sec; | ||
628 | } | ||
629 | ts->tv_sec = sec; | ||
630 | ts->tv_nsec = nsec; | ||
631 | } | ||
632 | |||
633 | /** | ||
634 | * ns_to_timespec - Convert nanoseconds to timespec | ||
635 | * @nsec: the nanoseconds value to be converted | ||
636 | * | ||
637 | * Returns the timespec representation of the nsec parameter. | ||
638 | */ | ||
639 | inline struct timespec ns_to_timespec(const nsec_t nsec) | ||
640 | { | ||
641 | struct timespec ts; | ||
642 | |||
643 | if (nsec) | ||
644 | ts.tv_sec = div_long_long_rem_signed(nsec, NSEC_PER_SEC, | ||
645 | &ts.tv_nsec); | ||
646 | else | ||
647 | ts.tv_sec = ts.tv_nsec = 0; | ||
648 | |||
649 | return ts; | ||
650 | } | ||
651 | |||
652 | /** | ||
653 | * ns_to_timeval - Convert nanoseconds to timeval | ||
654 | * @nsec: the nanoseconds value to be converted | ||
655 | * | ||
656 | * Returns the timeval representation of the nsec parameter. | ||
657 | */ | ||
658 | struct timeval ns_to_timeval(const nsec_t nsec) | ||
659 | { | ||
660 | struct timespec ts = ns_to_timespec(nsec); | ||
661 | struct timeval tv; | ||
662 | |||
663 | tv.tv_sec = ts.tv_sec; | ||
664 | tv.tv_usec = (suseconds_t) ts.tv_nsec / 1000; | ||
665 | |||
666 | return tv; | ||
583 | } | 667 | } |
584 | EXPORT_SYMBOL_GPL(getnstimestamp); | ||
585 | 668 | ||
586 | #if (BITS_PER_LONG < 64) | 669 | #if (BITS_PER_LONG < 64) |
587 | u64 get_jiffies_64(void) | 670 | u64 get_jiffies_64(void) |
diff --git a/kernel/timer.c b/kernel/timer.c index 074b4bd5cfd8..4f1cb0ab5251 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -858,6 +858,7 @@ static void run_timer_softirq(struct softirq_action *h) | |||
858 | { | 858 | { |
859 | tvec_base_t *base = &__get_cpu_var(tvec_bases); | 859 | tvec_base_t *base = &__get_cpu_var(tvec_bases); |
860 | 860 | ||
861 | hrtimer_run_queues(); | ||
861 | if (time_after_eq(jiffies, base->timer_jiffies)) | 862 | if (time_after_eq(jiffies, base->timer_jiffies)) |
862 | __run_timers(base); | 863 | __run_timers(base); |
863 | } | 864 | } |
@@ -1119,62 +1120,6 @@ asmlinkage long sys_gettid(void) | |||
1119 | return current->pid; | 1120 | return current->pid; |
1120 | } | 1121 | } |
1121 | 1122 | ||
1122 | static long __sched nanosleep_restart(struct restart_block *restart) | ||
1123 | { | ||
1124 | unsigned long expire = restart->arg0, now = jiffies; | ||
1125 | struct timespec __user *rmtp = (struct timespec __user *) restart->arg1; | ||
1126 | long ret; | ||
1127 | |||
1128 | /* Did it expire while we handled signals? */ | ||
1129 | if (!time_after(expire, now)) | ||
1130 | return 0; | ||
1131 | |||
1132 | expire = schedule_timeout_interruptible(expire - now); | ||
1133 | |||
1134 | ret = 0; | ||
1135 | if (expire) { | ||
1136 | struct timespec t; | ||
1137 | jiffies_to_timespec(expire, &t); | ||
1138 | |||
1139 | ret = -ERESTART_RESTARTBLOCK; | ||
1140 | if (rmtp && copy_to_user(rmtp, &t, sizeof(t))) | ||
1141 | ret = -EFAULT; | ||
1142 | /* The 'restart' block is already filled in */ | ||
1143 | } | ||
1144 | return ret; | ||
1145 | } | ||
1146 | |||
1147 | asmlinkage long sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) | ||
1148 | { | ||
1149 | struct timespec t; | ||
1150 | unsigned long expire; | ||
1151 | long ret; | ||
1152 | |||
1153 | if (copy_from_user(&t, rqtp, sizeof(t))) | ||
1154 | return -EFAULT; | ||
1155 | |||
1156 | if ((t.tv_nsec >= 1000000000L) || (t.tv_nsec < 0) || (t.tv_sec < 0)) | ||
1157 | return -EINVAL; | ||
1158 | |||
1159 | expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); | ||
1160 | expire = schedule_timeout_interruptible(expire); | ||
1161 | |||
1162 | ret = 0; | ||
1163 | if (expire) { | ||
1164 | struct restart_block *restart; | ||
1165 | jiffies_to_timespec(expire, &t); | ||
1166 | if (rmtp && copy_to_user(rmtp, &t, sizeof(t))) | ||
1167 | return -EFAULT; | ||
1168 | |||
1169 | restart = ¤t_thread_info()->restart_block; | ||
1170 | restart->fn = nanosleep_restart; | ||
1171 | restart->arg0 = jiffies + expire; | ||
1172 | restart->arg1 = (unsigned long) rmtp; | ||
1173 | ret = -ERESTART_RESTARTBLOCK; | ||
1174 | } | ||
1175 | return ret; | ||
1176 | } | ||
1177 | |||
1178 | /* | 1123 | /* |
1179 | * sys_sysinfo - fill in sysinfo struct | 1124 | * sys_sysinfo - fill in sysinfo struct |
1180 | */ | 1125 | */ |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1fcd856edec1..a609235a517f 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -9,15 +9,9 @@ config PRINTK_TIME | |||
9 | in kernel startup. | 9 | in kernel startup. |
10 | 10 | ||
11 | 11 | ||
12 | config DEBUG_KERNEL | ||
13 | bool "Kernel debugging" | ||
14 | help | ||
15 | Say Y here if you are developing drivers or trying to debug and | ||
16 | identify kernel problems. | ||
17 | |||
18 | config MAGIC_SYSRQ | 12 | config MAGIC_SYSRQ |
19 | bool "Magic SysRq key" | 13 | bool "Magic SysRq key" |
20 | depends on DEBUG_KERNEL && !UML | 14 | depends on !UML |
21 | help | 15 | help |
22 | If you say Y here, you will have some control over the system even | 16 | If you say Y here, you will have some control over the system even |
23 | if the system crashes for example during kernel debugging (e.g., you | 17 | if the system crashes for example during kernel debugging (e.g., you |
@@ -29,6 +23,12 @@ config MAGIC_SYSRQ | |||
29 | keys are documented in <file:Documentation/sysrq.txt>. Don't say Y | 23 | keys are documented in <file:Documentation/sysrq.txt>. Don't say Y |
30 | unless you really know what this hack does. | 24 | unless you really know what this hack does. |
31 | 25 | ||
26 | config DEBUG_KERNEL | ||
27 | bool "Kernel debugging" | ||
28 | help | ||
29 | Say Y here if you are developing drivers or trying to debug and | ||
30 | identify kernel problems. | ||
31 | |||
32 | config LOG_BUF_SHIFT | 32 | config LOG_BUF_SHIFT |
33 | int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" if DEBUG_KERNEL | 33 | int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" if DEBUG_KERNEL |
34 | range 12 21 | 34 | range 12 21 |
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index dcd4be9bd4e5..c8bb8cc899d7 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
@@ -19,10 +19,11 @@ static void spin_bug(spinlock_t *lock, const char *msg) | |||
19 | if (xchg(&print_once, 0)) { | 19 | if (xchg(&print_once, 0)) { |
20 | if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) | 20 | if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT) |
21 | owner = lock->owner; | 21 | owner = lock->owner; |
22 | printk("BUG: spinlock %s on CPU#%d, %s/%d\n", | 22 | printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n", |
23 | msg, raw_smp_processor_id(), | 23 | msg, raw_smp_processor_id(), |
24 | current->comm, current->pid); | 24 | current->comm, current->pid); |
25 | printk(" lock: %p, .magic: %08x, .owner: %s/%d, .owner_cpu: %d\n", | 25 | printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, " |
26 | ".owner_cpu: %d\n", | ||
26 | lock, lock->magic, | 27 | lock, lock->magic, |
27 | owner ? owner->comm : "<none>", | 28 | owner ? owner->comm : "<none>", |
28 | owner ? owner->pid : -1, | 29 | owner ? owner->pid : -1, |
@@ -78,7 +79,8 @@ static void __spin_lock_debug(spinlock_t *lock) | |||
78 | /* lockup suspected: */ | 79 | /* lockup suspected: */ |
79 | if (print_once) { | 80 | if (print_once) { |
80 | print_once = 0; | 81 | print_once = 0; |
81 | printk("BUG: spinlock lockup on CPU#%d, %s/%d, %p\n", | 82 | printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, " |
83 | "%s/%d, %p\n", | ||
82 | raw_smp_processor_id(), current->comm, | 84 | raw_smp_processor_id(), current->comm, |
83 | current->pid, lock); | 85 | current->pid, lock); |
84 | dump_stack(); | 86 | dump_stack(); |
@@ -120,8 +122,8 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) | |||
120 | static long print_once = 1; | 122 | static long print_once = 1; |
121 | 123 | ||
122 | if (xchg(&print_once, 0)) { | 124 | if (xchg(&print_once, 0)) { |
123 | printk("BUG: rwlock %s on CPU#%d, %s/%d, %p\n", msg, | 125 | printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n", |
124 | raw_smp_processor_id(), current->comm, | 126 | msg, raw_smp_processor_id(), current->comm, |
125 | current->pid, lock); | 127 | current->pid, lock); |
126 | dump_stack(); | 128 | dump_stack(); |
127 | #ifdef CONFIG_SMP | 129 | #ifdef CONFIG_SMP |
@@ -149,7 +151,8 @@ static void __read_lock_debug(rwlock_t *lock) | |||
149 | /* lockup suspected: */ | 151 | /* lockup suspected: */ |
150 | if (print_once) { | 152 | if (print_once) { |
151 | print_once = 0; | 153 | print_once = 0; |
152 | printk("BUG: read-lock lockup on CPU#%d, %s/%d, %p\n", | 154 | printk(KERN_EMERG "BUG: read-lock lockup on CPU#%d, " |
155 | "%s/%d, %p\n", | ||
153 | raw_smp_processor_id(), current->comm, | 156 | raw_smp_processor_id(), current->comm, |
154 | current->pid, lock); | 157 | current->pid, lock); |
155 | dump_stack(); | 158 | dump_stack(); |
@@ -221,7 +224,8 @@ static void __write_lock_debug(rwlock_t *lock) | |||
221 | /* lockup suspected: */ | 224 | /* lockup suspected: */ |
222 | if (print_once) { | 225 | if (print_once) { |
223 | print_once = 0; | 226 | print_once = 0; |
224 | printk("BUG: write-lock lockup on CPU#%d, %s/%d, %p\n", | 227 | printk(KERN_EMERG "BUG: write-lock lockup on CPU#%d, " |
228 | "%s/%d, %p\n", | ||
225 | raw_smp_processor_id(), current->comm, | 229 | raw_smp_processor_id(), current->comm, |
226 | current->pid, lock); | 230 | current->pid, lock); |
227 | dump_stack(); | 231 | dump_stack(); |
diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c index ad9a1bf4fc63..1653dd9bb01a 100644 --- a/lib/zlib_deflate/deflate.c +++ b/lib/zlib_deflate/deflate.c | |||
@@ -255,6 +255,7 @@ int zlib_deflateInit2_( | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /* ========================================================================= */ | 257 | /* ========================================================================= */ |
258 | #if 0 | ||
258 | int zlib_deflateSetDictionary( | 259 | int zlib_deflateSetDictionary( |
259 | z_streamp strm, | 260 | z_streamp strm, |
260 | const Byte *dictionary, | 261 | const Byte *dictionary, |
@@ -297,6 +298,7 @@ int zlib_deflateSetDictionary( | |||
297 | if (hash_head) hash_head = 0; /* to make compiler happy */ | 298 | if (hash_head) hash_head = 0; /* to make compiler happy */ |
298 | return Z_OK; | 299 | return Z_OK; |
299 | } | 300 | } |
301 | #endif /* 0 */ | ||
300 | 302 | ||
301 | /* ========================================================================= */ | 303 | /* ========================================================================= */ |
302 | int zlib_deflateReset( | 304 | int zlib_deflateReset( |
@@ -330,6 +332,7 @@ int zlib_deflateReset( | |||
330 | } | 332 | } |
331 | 333 | ||
332 | /* ========================================================================= */ | 334 | /* ========================================================================= */ |
335 | #if 0 | ||
333 | int zlib_deflateParams( | 336 | int zlib_deflateParams( |
334 | z_streamp strm, | 337 | z_streamp strm, |
335 | int level, | 338 | int level, |
@@ -365,6 +368,7 @@ int zlib_deflateParams( | |||
365 | s->strategy = strategy; | 368 | s->strategy = strategy; |
366 | return err; | 369 | return err; |
367 | } | 370 | } |
371 | #endif /* 0 */ | ||
368 | 372 | ||
369 | /* ========================================================================= | 373 | /* ========================================================================= |
370 | * Put a short in the pending buffer. The 16-bit value is put in MSB order. | 374 | * Put a short in the pending buffer. The 16-bit value is put in MSB order. |
@@ -572,6 +576,7 @@ int zlib_deflateEnd( | |||
572 | /* ========================================================================= | 576 | /* ========================================================================= |
573 | * Copy the source state to the destination state. | 577 | * Copy the source state to the destination state. |
574 | */ | 578 | */ |
579 | #if 0 | ||
575 | int zlib_deflateCopy ( | 580 | int zlib_deflateCopy ( |
576 | z_streamp dest, | 581 | z_streamp dest, |
577 | z_streamp source | 582 | z_streamp source |
@@ -624,6 +629,7 @@ int zlib_deflateCopy ( | |||
624 | return Z_OK; | 629 | return Z_OK; |
625 | #endif | 630 | #endif |
626 | } | 631 | } |
632 | #endif /* 0 */ | ||
627 | 633 | ||
628 | /* =========================================================================== | 634 | /* =========================================================================== |
629 | * Read a new buffer from the current input stream, update the adler32 | 635 | * Read a new buffer from the current input stream, update the adler32 |
diff --git a/lib/zlib_deflate/deflate_syms.c b/lib/zlib_deflate/deflate_syms.c index 5985b28c8e30..767b573d1ef6 100644 --- a/lib/zlib_deflate/deflate_syms.c +++ b/lib/zlib_deflate/deflate_syms.c | |||
@@ -16,6 +16,4 @@ EXPORT_SYMBOL(zlib_deflateInit_); | |||
16 | EXPORT_SYMBOL(zlib_deflateInit2_); | 16 | EXPORT_SYMBOL(zlib_deflateInit2_); |
17 | EXPORT_SYMBOL(zlib_deflateEnd); | 17 | EXPORT_SYMBOL(zlib_deflateEnd); |
18 | EXPORT_SYMBOL(zlib_deflateReset); | 18 | EXPORT_SYMBOL(zlib_deflateReset); |
19 | EXPORT_SYMBOL(zlib_deflateCopy); | ||
20 | EXPORT_SYMBOL(zlib_deflateParams); | ||
21 | MODULE_LICENSE("GPL"); | 19 | MODULE_LICENSE("GPL"); |
diff --git a/lib/zlib_inflate/infblock.c b/lib/zlib_inflate/infblock.c index 50f21ca4ef7f..c16cdeff51aa 100644 --- a/lib/zlib_inflate/infblock.c +++ b/lib/zlib_inflate/infblock.c | |||
@@ -338,6 +338,7 @@ int zlib_inflate_blocks_free( | |||
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | #if 0 | ||
341 | void zlib_inflate_set_dictionary( | 342 | void zlib_inflate_set_dictionary( |
342 | inflate_blocks_statef *s, | 343 | inflate_blocks_statef *s, |
343 | const Byte *d, | 344 | const Byte *d, |
@@ -347,15 +348,18 @@ void zlib_inflate_set_dictionary( | |||
347 | memcpy(s->window, d, n); | 348 | memcpy(s->window, d, n); |
348 | s->read = s->write = s->window + n; | 349 | s->read = s->write = s->window + n; |
349 | } | 350 | } |
351 | #endif /* 0 */ | ||
350 | 352 | ||
351 | 353 | ||
352 | /* Returns true if inflate is currently at the end of a block generated | 354 | /* Returns true if inflate is currently at the end of a block generated |
353 | * by Z_SYNC_FLUSH or Z_FULL_FLUSH. | 355 | * by Z_SYNC_FLUSH or Z_FULL_FLUSH. |
354 | * IN assertion: s != NULL | 356 | * IN assertion: s != NULL |
355 | */ | 357 | */ |
358 | #if 0 | ||
356 | int zlib_inflate_blocks_sync_point( | 359 | int zlib_inflate_blocks_sync_point( |
357 | inflate_blocks_statef *s | 360 | inflate_blocks_statef *s |
358 | ) | 361 | ) |
359 | { | 362 | { |
360 | return s->mode == LENS; | 363 | return s->mode == LENS; |
361 | } | 364 | } |
365 | #endif /* 0 */ | ||
diff --git a/lib/zlib_inflate/infblock.h b/lib/zlib_inflate/infblock.h index f5221ddf6054..ceee60b5107c 100644 --- a/lib/zlib_inflate/infblock.h +++ b/lib/zlib_inflate/infblock.h | |||
@@ -33,12 +33,16 @@ extern int zlib_inflate_blocks_free ( | |||
33 | inflate_blocks_statef *, | 33 | inflate_blocks_statef *, |
34 | z_streamp); | 34 | z_streamp); |
35 | 35 | ||
36 | #if 0 | ||
36 | extern void zlib_inflate_set_dictionary ( | 37 | extern void zlib_inflate_set_dictionary ( |
37 | inflate_blocks_statef *s, | 38 | inflate_blocks_statef *s, |
38 | const Byte *d, /* dictionary */ | 39 | const Byte *d, /* dictionary */ |
39 | uInt n); /* dictionary length */ | 40 | uInt n); /* dictionary length */ |
41 | #endif /* 0 */ | ||
40 | 42 | ||
43 | #if 0 | ||
41 | extern int zlib_inflate_blocks_sync_point ( | 44 | extern int zlib_inflate_blocks_sync_point ( |
42 | inflate_blocks_statef *s); | 45 | inflate_blocks_statef *s); |
46 | #endif /* 0 */ | ||
43 | 47 | ||
44 | #endif /* _INFBLOCK_H */ | 48 | #endif /* _INFBLOCK_H */ |
diff --git a/lib/zlib_inflate/inflate_syms.c b/lib/zlib_inflate/inflate_syms.c index aa1b08189121..ef49738f57ec 100644 --- a/lib/zlib_inflate/inflate_syms.c +++ b/lib/zlib_inflate/inflate_syms.c | |||
@@ -15,8 +15,6 @@ EXPORT_SYMBOL(zlib_inflate); | |||
15 | EXPORT_SYMBOL(zlib_inflateInit_); | 15 | EXPORT_SYMBOL(zlib_inflateInit_); |
16 | EXPORT_SYMBOL(zlib_inflateInit2_); | 16 | EXPORT_SYMBOL(zlib_inflateInit2_); |
17 | EXPORT_SYMBOL(zlib_inflateEnd); | 17 | EXPORT_SYMBOL(zlib_inflateEnd); |
18 | EXPORT_SYMBOL(zlib_inflateSync); | ||
19 | EXPORT_SYMBOL(zlib_inflateReset); | 18 | EXPORT_SYMBOL(zlib_inflateReset); |
20 | EXPORT_SYMBOL(zlib_inflateSyncPoint); | ||
21 | EXPORT_SYMBOL(zlib_inflateIncomp); | 19 | EXPORT_SYMBOL(zlib_inflateIncomp); |
22 | MODULE_LICENSE("GPL"); | 20 | MODULE_LICENSE("GPL"); |
diff --git a/lib/zlib_inflate/inflate_sync.c b/lib/zlib_inflate/inflate_sync.c index e07bdb21f55c..61411ff89d61 100644 --- a/lib/zlib_inflate/inflate_sync.c +++ b/lib/zlib_inflate/inflate_sync.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "infblock.h" | 7 | #include "infblock.h" |
8 | #include "infutil.h" | 8 | #include "infutil.h" |
9 | 9 | ||
10 | #if 0 | ||
10 | int zlib_inflateSync( | 11 | int zlib_inflateSync( |
11 | z_streamp z | 12 | z_streamp z |
12 | ) | 13 | ) |
@@ -57,6 +58,7 @@ int zlib_inflateSync( | |||
57 | z->state->mode = BLOCKS; | 58 | z->state->mode = BLOCKS; |
58 | return Z_OK; | 59 | return Z_OK; |
59 | } | 60 | } |
61 | #endif /* 0 */ | ||
60 | 62 | ||
61 | 63 | ||
62 | /* Returns true if inflate is currently at the end of a block generated | 64 | /* Returns true if inflate is currently at the end of a block generated |
@@ -66,6 +68,7 @@ int zlib_inflateSync( | |||
66 | * decompressing, PPP checks that at the end of input packet, inflate is | 68 | * decompressing, PPP checks that at the end of input packet, inflate is |
67 | * waiting for these length bytes. | 69 | * waiting for these length bytes. |
68 | */ | 70 | */ |
71 | #if 0 | ||
69 | int zlib_inflateSyncPoint( | 72 | int zlib_inflateSyncPoint( |
70 | z_streamp z | 73 | z_streamp z |
71 | ) | 74 | ) |
@@ -74,6 +77,7 @@ int zlib_inflateSyncPoint( | |||
74 | return Z_STREAM_ERROR; | 77 | return Z_STREAM_ERROR; |
75 | return zlib_inflate_blocks_sync_point(z->state->blocks); | 78 | return zlib_inflate_blocks_sync_point(z->state->blocks); |
76 | } | 79 | } |
80 | #endif /* 0 */ | ||
77 | 81 | ||
78 | /* | 82 | /* |
79 | * This subroutine adds the data at next_in/avail_in to the output history | 83 | * This subroutine adds the data at next_in/avail_in to the output history |
diff --git a/mm/filemap.c b/mm/filemap.c index 5fca2737c971..96de772be487 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2108,7 +2108,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov, | |||
2108 | if (err) | 2108 | if (err) |
2109 | goto out; | 2109 | goto out; |
2110 | 2110 | ||
2111 | inode_update_time(inode, 1); | 2111 | file_update_time(file); |
2112 | 2112 | ||
2113 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ | 2113 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ |
2114 | if (unlikely(file->f_flags & O_DIRECT)) { | 2114 | if (unlikely(file->f_flags & O_DIRECT)) { |
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index e2b34e95913e..b960ac8e5918 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c | |||
@@ -383,7 +383,7 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, | |||
383 | if (ret) | 383 | if (ret) |
384 | goto out_backing; | 384 | goto out_backing; |
385 | 385 | ||
386 | inode_update_time(inode, 1); | 386 | file_update_time(filp); |
387 | 387 | ||
388 | ret = __xip_file_write (filp, buf, count, pos, ppos); | 388 | ret = __xip_file_write (filp, buf, count, pos, ppos); |
389 | 389 | ||
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 158a9c46d863..f57cde78c3de 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -480,13 +480,8 @@ static void rfcomm_dev_data_ready(struct rfcomm_dlc *dlc, struct sk_buff *skb) | |||
480 | BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); | 480 | BT_DBG("dlc %p tty %p len %d", dlc, tty, skb->len); |
481 | 481 | ||
482 | if (test_bit(TTY_DONT_FLIP, &tty->flags)) { | 482 | if (test_bit(TTY_DONT_FLIP, &tty->flags)) { |
483 | register int i; | 483 | tty_buffer_request_room(tty, skb->len); |
484 | for (i = 0; i < skb->len; i++) { | 484 | tty_insert_flip_string(tty, skb->data, skb->len); |
485 | if (tty->flip.count >= TTY_FLIPBUF_SIZE) | ||
486 | tty_flip_buffer_push(tty); | ||
487 | |||
488 | tty_insert_flip_char(tty, skb->data[i], 0); | ||
489 | } | ||
490 | tty_flip_buffer_push(tty); | 485 | tty_flip_buffer_push(tty); |
491 | } else | 486 | } else |
492 | tty->ldisc.receive_buf(tty, skb->data, NULL, skb->len); | 487 | tty->ldisc.receive_buf(tty, skb->data, NULL, skb->len); |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index e1da81d261d1..58adaf208dd6 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <net/sock.h> | 16 | #include <net/sock.h> |
17 | #include <linux/rtnetlink.h> | 17 | #include <linux/rtnetlink.h> |
18 | #include <linux/wireless.h> | 18 | #include <linux/wireless.h> |
19 | #include <net/iw_handler.h> | ||
19 | 20 | ||
20 | #define to_class_dev(obj) container_of(obj,struct class_device,kobj) | 21 | #define to_class_dev(obj) container_of(obj,struct class_device,kobj) |
21 | #define to_net_dev(class) container_of(class, struct net_device, class_dev) | 22 | #define to_net_dev(class) container_of(class, struct net_device, class_dev) |
@@ -294,13 +295,19 @@ static ssize_t wireless_show(struct class_device *cd, char *buf, | |||
294 | char *)) | 295 | char *)) |
295 | { | 296 | { |
296 | struct net_device *dev = to_net_dev(cd); | 297 | struct net_device *dev = to_net_dev(cd); |
297 | const struct iw_statistics *iw; | 298 | const struct iw_statistics *iw = NULL; |
298 | ssize_t ret = -EINVAL; | 299 | ssize_t ret = -EINVAL; |
299 | 300 | ||
300 | read_lock(&dev_base_lock); | 301 | read_lock(&dev_base_lock); |
301 | if (dev_isalive(dev) && dev->get_wireless_stats | 302 | if (dev_isalive(dev)) { |
302 | && (iw = dev->get_wireless_stats(dev)) != NULL) | 303 | if(dev->wireless_handlers && |
303 | ret = (*format)(iw, buf); | 304 | dev->wireless_handlers->get_wireless_stats) |
305 | iw = dev->wireless_handlers->get_wireless_stats(dev); | ||
306 | else if (dev->get_wireless_stats) | ||
307 | iw = dev->get_wireless_stats(dev); | ||
308 | if (iw != NULL) | ||
309 | ret = (*format)(iw, buf); | ||
310 | } | ||
304 | read_unlock(&dev_base_lock); | 311 | read_unlock(&dev_base_lock); |
305 | 312 | ||
306 | return ret; | 313 | return ret; |
@@ -402,7 +409,8 @@ void netdev_unregister_sysfs(struct net_device * net) | |||
402 | sysfs_remove_group(&class_dev->kobj, &netstat_group); | 409 | sysfs_remove_group(&class_dev->kobj, &netstat_group); |
403 | 410 | ||
404 | #ifdef WIRELESS_EXT | 411 | #ifdef WIRELESS_EXT |
405 | if (net->get_wireless_stats) | 412 | if (net->get_wireless_stats || (net->wireless_handlers && |
413 | net->wireless_handlers->get_wireless_stats)) | ||
406 | sysfs_remove_group(&class_dev->kobj, &wireless_group); | 414 | sysfs_remove_group(&class_dev->kobj, &wireless_group); |
407 | #endif | 415 | #endif |
408 | class_device_del(class_dev); | 416 | class_device_del(class_dev); |
@@ -427,10 +435,12 @@ int netdev_register_sysfs(struct net_device *net) | |||
427 | goto out_unreg; | 435 | goto out_unreg; |
428 | 436 | ||
429 | #ifdef WIRELESS_EXT | 437 | #ifdef WIRELESS_EXT |
430 | if (net->get_wireless_stats && | 438 | if (net->get_wireless_stats || (net->wireless_handlers && |
431 | (ret = sysfs_create_group(&class_dev->kobj, &wireless_group))) | 439 | net->wireless_handlers->get_wireless_stats)) { |
432 | goto out_cleanup; | 440 | ret = sysfs_create_group(&class_dev->kobj, &wireless_group); |
433 | 441 | if (ret) | |
442 | goto out_cleanup; | ||
443 | } | ||
434 | return 0; | 444 | return 0; |
435 | out_cleanup: | 445 | out_cleanup: |
436 | if (net->get_stats) | 446 | if (net->get_stats) |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 5530ac8c6df9..a44da8b3d240 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -268,7 +268,8 @@ rpc_shutdown_client(struct rpc_clnt *clnt) | |||
268 | clnt->cl_oneshot = 0; | 268 | clnt->cl_oneshot = 0; |
269 | clnt->cl_dead = 0; | 269 | clnt->cl_dead = 0; |
270 | rpc_killall_tasks(clnt); | 270 | rpc_killall_tasks(clnt); |
271 | sleep_on_timeout(&destroy_wait, 1*HZ); | 271 | wait_event_timeout(destroy_wait, |
272 | atomic_read(&clnt->cl_users) > 0, 1*HZ); | ||
272 | } | 273 | } |
273 | 274 | ||
274 | if (atomic_read(&clnt->cl_users) < 0) { | 275 | if (atomic_read(&clnt->cl_users) < 0) { |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index db3c708e546b..0168d6c37075 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | # Convinient variables | 4 | # Convinient variables |
5 | comma := , | 5 | comma := , |
6 | squote := ' | ||
6 | empty := | 7 | empty := |
7 | space := $(empty) $(empty) | 8 | space := $(empty) $(empty) |
8 | 9 | ||
@@ -12,6 +13,10 @@ space := $(empty) $(empty) | |||
12 | depfile = $(subst $(comma),_,$(@D)/.$(@F).d) | 13 | depfile = $(subst $(comma),_,$(@D)/.$(@F).d) |
13 | 14 | ||
14 | ### | 15 | ### |
16 | # Escape single quote for use in echo statements | ||
17 | escsq = $(subst $(squote),'\$(squote)',$1) | ||
18 | |||
19 | ### | ||
15 | # filechk is used to check if the content of a generated file is updated. | 20 | # filechk is used to check if the content of a generated file is updated. |
16 | # Sample usage: | 21 | # Sample usage: |
17 | # define filechk_sample | 22 | # define filechk_sample |
@@ -47,7 +52,7 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj | |||
47 | 52 | ||
48 | # If quiet is set, only print short version of command | 53 | # If quiet is set, only print short version of command |
49 | cmd = @$(if $($(quiet)cmd_$(1)),\ | 54 | cmd = @$(if $($(quiet)cmd_$(1)),\ |
50 | echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) | 55 | echo ' $(call escsq,$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) |
51 | 56 | ||
52 | # Add $(obj)/ for paths that is not absolute | 57 | # Add $(obj)/ for paths that is not absolute |
53 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) | 58 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) |
@@ -68,7 +73,7 @@ endif | |||
68 | 73 | ||
69 | # echo command. Short version is $(quiet) equals quiet, otherwise full command | 74 | # echo command. Short version is $(quiet) equals quiet, otherwise full command |
70 | echo-cmd = $(if $($(quiet)cmd_$(1)), \ | 75 | echo-cmd = $(if $($(quiet)cmd_$(1)), \ |
71 | echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) | 76 | echo ' $(call escsq,$($(quiet)cmd_$(1)))';) |
72 | 77 | ||
73 | # function to only execute the passed command if necessary | 78 | # function to only execute the passed command if necessary |
74 | # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file | 79 | # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file |
@@ -78,7 +83,7 @@ if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ | |||
78 | @set -e; \ | 83 | @set -e; \ |
79 | $(echo-cmd) \ | 84 | $(echo-cmd) \ |
80 | $(cmd_$(1)); \ | 85 | $(cmd_$(1)); \ |
81 | echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) | 86 | echo 'cmd_$@ := $(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).cmd) |
82 | 87 | ||
83 | # execute the command and also postprocess generated .d dependencies | 88 | # execute the command and also postprocess generated .d dependencies |
84 | # file | 89 | # file |
@@ -87,7 +92,7 @@ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ | |||
87 | @set -e; \ | 92 | @set -e; \ |
88 | $(echo-cmd) \ | 93 | $(echo-cmd) \ |
89 | $(cmd_$(1)); \ | 94 | $(cmd_$(1)); \ |
90 | scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ | 95 | scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ |
91 | rm -f $(depfile); \ | 96 | rm -f $(depfile); \ |
92 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) | 97 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) |
93 | 98 | ||
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 506e3f3befe3..c33e62bde6b0 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -179,10 +179,10 @@ endif | |||
179 | define rule_cc_o_c | 179 | define rule_cc_o_c |
180 | $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ | 180 | $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ |
181 | $(cmd_checksrc) \ | 181 | $(cmd_checksrc) \ |
182 | $(if $($(quiet)cmd_cc_o_c),echo ' $(subst ','\'',$($(quiet)cmd_cc_o_c))';) \ | 182 | $(if $($(quiet)cmd_cc_o_c),echo ' $(call escsq,$($(quiet)cmd_cc_o_c))';) \ |
183 | $(cmd_cc_o_c); \ | 183 | $(cmd_cc_o_c); \ |
184 | $(cmd_modversions) \ | 184 | $(cmd_modversions) \ |
185 | scripts/basic/fixdep $(depfile) $@ '$(subst ','\'',$(cmd_cc_o_c))' > $(@D)/.$(@F).tmp; \ | 185 | scripts/basic/fixdep $(depfile) $@ '$(call escsq,$(cmd_cc_o_c))' > $(@D)/.$(@F).tmp; \ |
186 | rm -f $(depfile); \ | 186 | rm -f $(depfile); \ |
187 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd | 187 | mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd |
188 | endef | 188 | endef |
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile index a45a13fb26ed..8f41d9a57aaa 100644 --- a/scripts/kconfig/lxdialog/Makefile +++ b/scripts/kconfig/lxdialog/Makefile | |||
@@ -1,42 +1,18 @@ | |||
1 | HOST_EXTRACFLAGS := -DLOCALE | 1 | # Makefile to build lxdialog package |
2 | ifeq ($(shell uname),SunOS) | 2 | # |
3 | HOST_LOADLIBES := -lcurses | ||
4 | else | ||
5 | HOST_LOADLIBES := -lncurses | ||
6 | endif | ||
7 | 3 | ||
8 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) | 4 | check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh |
9 | HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" | 5 | HOST_EXTRACFLAGS := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) |
10 | else | 6 | HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags) |
11 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) | 7 | |
12 | HOST_EXTRACFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" | 8 | HOST_EXTRACFLAGS += -DLOCALE |
13 | else | 9 | |
14 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) | 10 | .PHONY: dochecklxdialog |
15 | HOST_EXTRACFLAGS += -DCURSES_LOC="<ncurses.h>" | 11 | $(obj)/dochecklxdialog: |
16 | else | 12 | $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) |
17 | HOST_EXTRACFLAGS += -DCURSES_LOC="<curses.h>" | ||
18 | endif | ||
19 | endif | ||
20 | endif | ||
21 | 13 | ||
22 | hostprogs-y := lxdialog | 14 | hostprogs-y := lxdialog |
23 | always := ncurses $(hostprogs-y) | 15 | always := $(hostprogs-y) dochecklxdialog |
24 | 16 | ||
25 | lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ | 17 | lxdialog-objs := checklist.o menubox.o textbox.o yesno.o inputbox.o \ |
26 | util.o lxdialog.o msgbox.o | 18 | util.o lxdialog.o msgbox.o |
27 | |||
28 | .PHONY: $(obj)/ncurses | ||
29 | $(obj)/ncurses: | ||
30 | @echo "main() {}" > lxtemp.c | ||
31 | @if $(HOSTCC) lxtemp.c $(HOST_LOADLIBES); then \ | ||
32 | rm -f lxtemp.c a.out; \ | ||
33 | else \ | ||
34 | rm -f lxtemp.c; \ | ||
35 | echo -e "\007" ;\ | ||
36 | echo ">> Unable to find the Ncurses libraries." ;\ | ||
37 | echo ">>" ;\ | ||
38 | echo ">> You must install ncurses-devel in order" ;\ | ||
39 | echo ">> to use 'make menuconfig'" ;\ | ||
40 | echo ;\ | ||
41 | exit 1 ;\ | ||
42 | fi | ||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh new file mode 100644 index 000000000000..a3c141b49670 --- /dev/null +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
@@ -0,0 +1,67 @@ | |||
1 | #!/bin/sh | ||
2 | # Check ncurses compatibility | ||
3 | |||
4 | # What library to link | ||
5 | ldflags() | ||
6 | { | ||
7 | if [ `uname` == SunOS ]; then | ||
8 | echo '-lcurses' | ||
9 | else | ||
10 | echo '-lncurses' | ||
11 | fi | ||
12 | } | ||
13 | |||
14 | # Where is ncurses.h? | ||
15 | ccflags() | ||
16 | { | ||
17 | if [ -f /usr/include/ncurses/ncurses.h ]; then | ||
18 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' | ||
19 | elif [ -f /usr/include/ncurses/curses.h ]; then | ||
20 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' | ||
21 | elif [ -f /usr/include/ncurses.h ]; then | ||
22 | echo '-DCURSES_LOC="<ncurses.h>"' | ||
23 | else | ||
24 | echo '-DCURSES_LOC="<curses.h>"' | ||
25 | fi | ||
26 | } | ||
27 | |||
28 | compiler="" | ||
29 | # Check if we can link to ncurses | ||
30 | check() { | ||
31 | echo "main() {}" | $compiler -xc - | ||
32 | if [ $? != 0 ]; then | ||
33 | echo " *** Unable to find the ncurses libraries." 1>&2 | ||
34 | echo " *** make menuconfig require the ncurses libraries" 1>&2 | ||
35 | echo " *** " 1>&2 | ||
36 | echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 | ||
37 | echo " *** " 1>&2 | ||
38 | exit 1 | ||
39 | fi | ||
40 | } | ||
41 | |||
42 | usage() { | ||
43 | printf "Usage: $0 [-check compiler options|-header|-library]\n" | ||
44 | } | ||
45 | |||
46 | if [ $# == 0 ]; then | ||
47 | usage | ||
48 | exit 1 | ||
49 | fi | ||
50 | |||
51 | case "$1" in | ||
52 | "-check") | ||
53 | shift | ||
54 | compiler="$@" | ||
55 | check | ||
56 | ;; | ||
57 | "-ccflags") | ||
58 | ccflags | ||
59 | ;; | ||
60 | "-ldflags") | ||
61 | ldflags | ||
62 | ;; | ||
63 | "*") | ||
64 | usage | ||
65 | exit 1 | ||
66 | ;; | ||
67 | esac | ||
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 2f45fd2969d0..9fd5f5b87d1e 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1405,6 +1405,7 @@ sub create_parameterlist($$$) { | |||
1405 | my $type; | 1405 | my $type; |
1406 | my $param; | 1406 | my $param; |
1407 | 1407 | ||
1408 | # temporarily replace commas inside function pointer definition | ||
1408 | while ($args =~ /(\([^\),]+),/) { | 1409 | while ($args =~ /(\([^\),]+),/) { |
1409 | $args =~ s/(\([^\),]+),/$1#/g; | 1410 | $args =~ s/(\([^\),]+),/$1#/g; |
1410 | } | 1411 | } |
@@ -1465,11 +1466,10 @@ sub push_parameter($$$) { | |||
1465 | my $param_name = $param; | 1466 | my $param_name = $param; |
1466 | $param_name =~ s/\[.*//; | 1467 | $param_name =~ s/\[.*//; |
1467 | 1468 | ||
1468 | if ($type eq "" && $param eq "...") | 1469 | if ($type eq "" && $param =~ /\.\.\.$/) |
1469 | { | 1470 | { |
1470 | $type=""; | 1471 | $type=""; |
1471 | $param="..."; | 1472 | $parameterdescs{$param} = "variable arguments"; |
1472 | $parameterdescs{"..."} = "variable arguments"; | ||
1473 | } | 1473 | } |
1474 | elsif ($type eq "" && ($param eq "" or $param eq "void")) | 1474 | elsif ($type eq "" && ($param eq "" or $param eq "void")) |
1475 | { | 1475 | { |
@@ -1477,7 +1477,11 @@ sub push_parameter($$$) { | |||
1477 | $param="void"; | 1477 | $param="void"; |
1478 | $parameterdescs{void} = "no arguments"; | 1478 | $parameterdescs{void} = "no arguments"; |
1479 | } | 1479 | } |
1480 | if (defined $type && $type && !defined $parameterdescs{$param_name}) { | 1480 | # warn if parameter has no description |
1481 | # (but ignore ones starting with # as these are no parameters | ||
1482 | # but inline preprocessor statements | ||
1483 | if (!defined $parameterdescs{$param_name} && $param_name !~ /^#/) { | ||
1484 | |||
1481 | $parameterdescs{$param_name} = $undescribed; | 1485 | $parameterdescs{$param_name} = $undescribed; |
1482 | 1486 | ||
1483 | if (($type eq 'function') || ($type eq 'enum')) { | 1487 | if (($type eq 'function') || ($type eq 'enum')) { |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index e0eedffe565b..be97caf664bb 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -417,7 +417,7 @@ static int do_input_entry(const char *filename, struct input_device_id *id, | |||
417 | do_input(alias, id->sndbit, 0, SND_MAX); | 417 | do_input(alias, id->sndbit, 0, SND_MAX); |
418 | sprintf(alias + strlen(alias), "f*"); | 418 | sprintf(alias + strlen(alias), "f*"); |
419 | if (id->flags&INPUT_DEVICE_ID_MATCH_FFBIT) | 419 | if (id->flags&INPUT_DEVICE_ID_MATCH_FFBIT) |
420 | do_input(alias, id->ffbit, 0, SND_MAX); | 420 | do_input(alias, id->ffbit, 0, FF_MAX); |
421 | sprintf(alias + strlen(alias), "w*"); | 421 | sprintf(alias + strlen(alias), "w*"); |
422 | if (id->flags&INPUT_DEVICE_ID_MATCH_SWBIT) | 422 | if (id->flags&INPUT_DEVICE_ID_MATCH_SWBIT) |
423 | do_input(alias, id->swbit, 0, SW_MAX); | 423 | do_input(alias, id->swbit, 0, SW_MAX); |
diff --git a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl index c2d54148a91f..4ee6ab2135b3 100644 --- a/scripts/reference_discarded.pl +++ b/scripts/reference_discarded.pl | |||
@@ -71,6 +71,11 @@ foreach $object (keys(%object)) { | |||
71 | # printf("ignoring %d conglomerate(s)\n", $ignore); | 71 | # printf("ignoring %d conglomerate(s)\n", $ignore); |
72 | 72 | ||
73 | # printf("Scanning objects\n"); | 73 | # printf("Scanning objects\n"); |
74 | |||
75 | # Keith Ownes <kaos@sgi.com> commented: | ||
76 | # For our future {in}sanity, add a comment that this is the ppc .opd | ||
77 | # section, not the ia64 .opd section. | ||
78 | # ia64 .opd should not point to discarded sections. | ||
74 | $errorcount = 0; | 79 | $errorcount = 0; |
75 | foreach $object (keys(%object)) { | 80 | foreach $object (keys(%object)) { |
76 | my $from; | 81 | my $from; |
@@ -88,6 +93,7 @@ foreach $object (keys(%object)) { | |||
88 | ($from !~ /\.text\.exit$/ && | 93 | ($from !~ /\.text\.exit$/ && |
89 | $from !~ /\.exit\.text$/ && | 94 | $from !~ /\.exit\.text$/ && |
90 | $from !~ /\.data\.exit$/ && | 95 | $from !~ /\.data\.exit$/ && |
96 | $from !~ /\.opd$/ && | ||
91 | $from !~ /\.exit\.data$/ && | 97 | $from !~ /\.exit\.data$/ && |
92 | $from !~ /\.altinstructions$/ && | 98 | $from !~ /\.altinstructions$/ && |
93 | $from !~ /\.pdr$/ && | 99 | $from !~ /\.pdr$/ && |
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index f54dac88cfd1..9a23825218f2 100644 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -17,6 +17,6 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then | |||
17 | 17 | ||
18 | # Are there uncommitted changes? | 18 | # Are there uncommitted changes? |
19 | if git diff-files | read dummy; then | 19 | if git diff-files | read dummy; then |
20 | printf '%s' -git_dirty | 20 | printf '%s' -dirty |
21 | fi | 21 | fi |
22 | fi | 22 | fi |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index 44eb4d74908d..8a764928ff4b 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -1712,11 +1712,11 @@ int security_get_bools(int *len, char ***names, int **values) | |||
1712 | goto out; | 1712 | goto out; |
1713 | } | 1713 | } |
1714 | 1714 | ||
1715 | *names = (char**)kcalloc(*len, sizeof(char*), GFP_ATOMIC); | 1715 | *names = kcalloc(*len, sizeof(char*), GFP_ATOMIC); |
1716 | if (!*names) | 1716 | if (!*names) |
1717 | goto err; | 1717 | goto err; |
1718 | 1718 | ||
1719 | *values = (int*)kcalloc(*len, sizeof(int), GFP_ATOMIC); | 1719 | *values = kcalloc(*len, sizeof(int), GFP_ATOMIC); |
1720 | if (!*values) | 1720 | if (!*values) |
1721 | goto err; | 1721 | goto err; |
1722 | 1722 | ||
@@ -1724,7 +1724,7 @@ int security_get_bools(int *len, char ***names, int **values) | |||
1724 | size_t name_len; | 1724 | size_t name_len; |
1725 | (*values)[i] = policydb.bool_val_to_struct[i]->state; | 1725 | (*values)[i] = policydb.bool_val_to_struct[i]->state; |
1726 | name_len = strlen(policydb.p_bool_val_to_name[i]) + 1; | 1726 | name_len = strlen(policydb.p_bool_val_to_name[i]) + 1; |
1727 | (*names)[i] = (char*)kmalloc(sizeof(char) * name_len, GFP_ATOMIC); | 1727 | (*names)[i] = kmalloc(sizeof(char) * name_len, GFP_ATOMIC); |
1728 | if (!(*names)[i]) | 1728 | if (!(*names)[i]) |
1729 | goto err; | 1729 | goto err; |
1730 | strncpy((*names)[i], policydb.p_bool_val_to_name[i], name_len); | 1730 | strncpy((*names)[i], policydb.p_bool_val_to_name[i], name_len); |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 202c7cf3e328..f36ede827479 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -385,7 +385,7 @@ static struct pci_driver driver = { | |||
385 | 385 | ||
386 | static int __init alsa_card_cs5535audio_init(void) | 386 | static int __init alsa_card_cs5535audio_init(void) |
387 | { | 387 | { |
388 | return pci_module_init(&driver); | 388 | return pci_register_driver(&driver); |
389 | } | 389 | } |
390 | 390 | ||
391 | static void __exit alsa_card_cs5535audio_exit(void) | 391 | static void __exit alsa_card_cs5535audio_exit(void) |