diff options
78 files changed, 1201 insertions, 886 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index afc286775891..b49b92edb396 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
@@ -495,29 +495,40 @@ re-formatting you may want to take a look at the man page. But | |||
495 | remember: "indent" is not a fix for bad programming. | 495 | remember: "indent" is not a fix for bad programming. |
496 | 496 | ||
497 | 497 | ||
498 | Chapter 10: Configuration-files | 498 | Chapter 10: Kconfig configuration files |
499 | 499 | ||
500 | For configuration options (arch/xxx/Kconfig, and all the Kconfig files), | 500 | For all of the Kconfig* configuration files throughout the source tree, |
501 | somewhat different indentation is used. | 501 | the indentation is somewhat different. Lines under a "config" definition |
502 | are indented with one tab, while help text is indented an additional two | ||
503 | spaces. Example: | ||
502 | 504 | ||
503 | Help text is indented with 2 spaces. | 505 | config AUDIT |
504 | 506 | bool "Auditing support" | |
505 | if CONFIG_EXPERIMENTAL | 507 | depends on NET |
506 | tristate CONFIG_BOOM | ||
507 | default n | ||
508 | help | ||
509 | Apply nitroglycerine inside the keyboard (DANGEROUS) | ||
510 | bool CONFIG_CHEER | ||
511 | depends on CONFIG_BOOM | ||
512 | default y | ||
513 | help | 508 | help |
514 | Output nice messages when you explode | 509 | Enable auditing infrastructure that can be used with another |
515 | endif | 510 | kernel subsystem, such as SELinux (which requires this for |
511 | logging of avc messages output). Does not do system-call | ||
512 | auditing without CONFIG_AUDITSYSCALL. | ||
513 | |||
514 | Features that might still be considered unstable should be defined as | ||
515 | dependent on "EXPERIMENTAL": | ||
516 | |||
517 | config SLUB | ||
518 | depends on EXPERIMENTAL && !ARCH_USES_SLAB_PAGE_STRUCT | ||
519 | bool "SLUB (Unqueued Allocator)" | ||
520 | ... | ||
521 | |||
522 | while seriously dangerous features (such as write support for certain | ||
523 | filesystems) should advertise this prominently in their prompt string: | ||
524 | |||
525 | config ADFS_FS_RW | ||
526 | bool "ADFS write support (DANGEROUS)" | ||
527 | depends on ADFS_FS | ||
528 | ... | ||
516 | 529 | ||
517 | Generally, CONFIG_EXPERIMENTAL should surround all options not considered | 530 | For full documentation on the configuration files, see the file |
518 | stable. All options that are known to trash data (experimental write- | 531 | Documentation/kbuild/kconfig-language.txt. |
519 | support for file-systems, for instance) should be denoted (DANGEROUS), other | ||
520 | experimental options should be denoted (EXPERIMENTAL). | ||
521 | 532 | ||
522 | 533 | ||
523 | Chapter 11: Data structures | 534 | Chapter 11: Data structures |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 48123dba5e6a..ced9207bedcf 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -396,26 +396,6 @@ bugme-janitor mailing list (every change in the bugzilla is mailed here) | |||
396 | 396 | ||
397 | 397 | ||
398 | 398 | ||
399 | Managing bug reports | ||
400 | -------------------- | ||
401 | |||
402 | One of the best ways to put into practice your hacking skills is by fixing | ||
403 | bugs reported by other people. Not only you will help to make the kernel | ||
404 | more stable, you'll learn to fix real world problems and you will improve | ||
405 | your skills, and other developers will be aware of your presence. Fixing | ||
406 | bugs is one of the best ways to get merits among other developers, because | ||
407 | not many people like wasting time fixing other people's bugs. | ||
408 | |||
409 | To work in the already reported bug reports, go to http://bugzilla.kernel.org. | ||
410 | If you want to be advised of the future bug reports, you can subscribe to the | ||
411 | bugme-new mailing list (only new bug reports are mailed here) or to the | ||
412 | bugme-janitor mailing list (every change in the bugzilla is mailed here) | ||
413 | |||
414 | http://lists.osdl.org/mailman/listinfo/bugme-new | ||
415 | http://lists.osdl.org/mailman/listinfo/bugme-janitors | ||
416 | |||
417 | |||
418 | |||
419 | Mailing lists | 399 | Mailing lists |
420 | ------------- | 400 | ------------- |
421 | 401 | ||
diff --git a/Documentation/block/capability.txt b/Documentation/block/capability.txt new file mode 100644 index 000000000000..2f1729424ef4 --- /dev/null +++ b/Documentation/block/capability.txt | |||
@@ -0,0 +1,15 @@ | |||
1 | Generic Block Device Capability | ||
2 | =============================================================================== | ||
3 | This file documents the sysfs file block/<disk>/capability | ||
4 | |||
5 | capability is a hex word indicating which capabilities a specific disk | ||
6 | supports. For more information on bits not listed here, see | ||
7 | include/linux/genhd.h | ||
8 | |||
9 | Capability Value | ||
10 | ------------------------------------------------------------------------------- | ||
11 | GENHD_FL_MEDIA_CHANGE_NOTIFY 4 | ||
12 | When this bit is set, the disk supports Asynchronous Notification | ||
13 | of media change events. These events will be broadcast to user | ||
14 | space via kernel uevent. | ||
15 | |||
diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 64e9f6c4826b..595a5ea4c690 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff | |||
@@ -10,10 +10,12 @@ | |||
10 | *.grp | 10 | *.grp |
11 | *.gz | 11 | *.gz |
12 | *.html | 12 | *.html |
13 | *.i | ||
13 | *.jpeg | 14 | *.jpeg |
14 | *.ko | 15 | *.ko |
15 | *.log | 16 | *.log |
16 | *.lst | 17 | *.lst |
18 | *.moc | ||
17 | *.mod.c | 19 | *.mod.c |
18 | *.o | 20 | *.o |
19 | *.orig | 21 | *.orig |
@@ -25,6 +27,9 @@ | |||
25 | *.s | 27 | *.s |
26 | *.sgml | 28 | *.sgml |
27 | *.so | 29 | *.so |
30 | *.symtypes | ||
31 | *.tab.c | ||
32 | *.tab.h | ||
28 | *.tex | 33 | *.tex |
29 | *.ver | 34 | *.ver |
30 | *.xml | 35 | *.xml |
@@ -32,9 +37,13 @@ | |||
32 | *_vga16.c | 37 | *_vga16.c |
33 | *cscope* | 38 | *cscope* |
34 | *~ | 39 | *~ |
40 | *.9 | ||
41 | *.9.gz | ||
35 | .* | 42 | .* |
36 | .cscope | 43 | .cscope |
37 | 53c700_d.h | 44 | 53c700_d.h |
45 | 53c7xx_d.h | ||
46 | 53c7xx_u.h | ||
38 | 53c8xx_d.h* | 47 | 53c8xx_d.h* |
39 | BitKeeper | 48 | BitKeeper |
40 | COPYING | 49 | COPYING |
@@ -70,9 +79,11 @@ bzImage* | |||
70 | classlist.h* | 79 | classlist.h* |
71 | comp*.log | 80 | comp*.log |
72 | compile.h* | 81 | compile.h* |
82 | conf | ||
73 | config | 83 | config |
74 | config-* | 84 | config-* |
75 | config_data.h* | 85 | config_data.h* |
86 | config_data.gz* | ||
76 | conmakehash | 87 | conmakehash |
77 | consolemap_deftbl.c* | 88 | consolemap_deftbl.c* |
78 | crc32table.h* | 89 | crc32table.h* |
@@ -81,18 +92,23 @@ defkeymap.c* | |||
81 | devlist.h* | 92 | devlist.h* |
82 | docproc | 93 | docproc |
83 | dummy_sym.c* | 94 | dummy_sym.c* |
95 | elf2ecoff | ||
84 | elfconfig.h* | 96 | elfconfig.h* |
85 | filelist | 97 | filelist |
86 | fixdep | 98 | fixdep |
87 | fore200e_mkfirm | 99 | fore200e_mkfirm |
88 | fore200e_pca_fw.c* | 100 | fore200e_pca_fw.c* |
101 | gconf | ||
89 | gen-devlist | 102 | gen-devlist |
90 | gen-kdb_cmds.c* | 103 | gen-kdb_cmds.c* |
91 | gen_crc32table | 104 | gen_crc32table |
92 | gen_init_cpio | 105 | gen_init_cpio |
93 | genksyms | 106 | genksyms |
94 | gentbl | 107 | gentbl |
108 | *_gray256.c | ||
95 | ikconfig.h* | 109 | ikconfig.h* |
110 | initramfs_data.cpio | ||
111 | initramfs_data.cpio.gz | ||
96 | initramfs_list | 112 | initramfs_list |
97 | kallsyms | 113 | kallsyms |
98 | kconfig | 114 | kconfig |
@@ -100,19 +116,30 @@ kconfig.tk | |||
100 | keywords.c* | 116 | keywords.c* |
101 | ksym.c* | 117 | ksym.c* |
102 | ksym.h* | 118 | ksym.h* |
119 | kxgettext | ||
120 | lkc_defs.h | ||
103 | lex.c* | 121 | lex.c* |
122 | lex.*.c | ||
123 | lk201-map.c | ||
104 | logo_*.c | 124 | logo_*.c |
105 | logo_*_clut224.c | 125 | logo_*_clut224.c |
106 | logo_*_mono.c | 126 | logo_*_mono.c |
107 | lxdialog | 127 | lxdialog |
108 | mach-types | 128 | mach-types |
109 | mach-types.h | 129 | mach-types.h |
130 | machtypes.h | ||
110 | make_times_h | 131 | make_times_h |
111 | map | 132 | map |
112 | maui_boot.h | 133 | maui_boot.h |
134 | mconf | ||
135 | miboot* | ||
113 | mk_elfconfig | 136 | mk_elfconfig |
137 | mkboot | ||
138 | mkbugboot | ||
114 | mkdep | 139 | mkdep |
140 | mkprep | ||
115 | mktables | 141 | mktables |
142 | mktree | ||
116 | modpost | 143 | modpost |
117 | modversions.h* | 144 | modversions.h* |
118 | offset.h | 145 | offset.h |
@@ -120,18 +147,28 @@ offsets.h | |||
120 | oui.c* | 147 | oui.c* |
121 | parse.c* | 148 | parse.c* |
122 | parse.h* | 149 | parse.h* |
150 | patches* | ||
151 | pca200e.bin | ||
152 | pca200e_ecd.bin2 | ||
153 | piggy.gz | ||
154 | piggyback | ||
123 | pnmtologo | 155 | pnmtologo |
124 | ppc_defs.h* | 156 | ppc_defs.h* |
125 | promcon_tbl.c* | 157 | promcon_tbl.c* |
126 | pss_boot.h | 158 | pss_boot.h |
159 | qconf | ||
127 | raid6altivec*.c | 160 | raid6altivec*.c |
128 | raid6int*.c | 161 | raid6int*.c |
129 | raid6tables.c | 162 | raid6tables.c |
163 | relocs | ||
164 | series | ||
130 | setup | 165 | setup |
131 | sim710_d.h* | 166 | sim710_d.h* |
167 | sImage | ||
132 | sm_tbl* | 168 | sm_tbl* |
133 | split-include | 169 | split-include |
134 | tags | 170 | tags |
171 | tftpboot.img | ||
135 | times.h* | 172 | times.h* |
136 | tkparse | 173 | tkparse |
137 | trix_boot.h | 174 | trix_boot.h |
@@ -139,8 +176,11 @@ utsrelease.h* | |||
139 | version.h* | 176 | version.h* |
140 | vmlinux | 177 | vmlinux |
141 | vmlinux-* | 178 | vmlinux-* |
179 | vmlinux.aout | ||
142 | vmlinux.lds | 180 | vmlinux.lds |
143 | vsyscall.lds | 181 | vsyscall.lds |
144 | wanxlfw.inc | 182 | wanxlfw.inc |
145 | uImage | 183 | uImage |
146 | zImage | 184 | unifdef |
185 | zImage* | ||
186 | zconf.hash.c | ||
diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt index 66fa67fec2a7..35985b34d5a6 100644 --- a/Documentation/i386/boot.txt +++ b/Documentation/i386/boot.txt | |||
@@ -2,7 +2,7 @@ | |||
2 | ---------------------------- | 2 | ---------------------------- |
3 | 3 | ||
4 | H. Peter Anvin <hpa@zytor.com> | 4 | H. Peter Anvin <hpa@zytor.com> |
5 | Last update 2007-05-16 | 5 | Last update 2007-05-23 |
6 | 6 | ||
7 | On the i386 platform, the Linux kernel uses a rather complicated boot | 7 | On the i386 platform, the Linux kernel uses a rather complicated boot |
8 | convention. This has evolved partially due to historical aspects, as | 8 | convention. This has evolved partially due to historical aspects, as |
@@ -202,6 +202,8 @@ All general purpose boot loaders should write the fields marked | |||
202 | nonstandard address should fill in the fields marked (reloc); other | 202 | nonstandard address should fill in the fields marked (reloc); other |
203 | boot loaders can ignore those fields. | 203 | boot loaders can ignore those fields. |
204 | 204 | ||
205 | The byte order of all fields is littleendian (this is x86, after all.) | ||
206 | |||
205 | Field name: setup_secs | 207 | Field name: setup_secs |
206 | Type: read | 208 | Type: read |
207 | Offset/size: 0x1f1/1 | 209 | Offset/size: 0x1f1/1 |
@@ -280,14 +282,16 @@ Type: read | |||
280 | Offset/size: 0x206/2 | 282 | Offset/size: 0x206/2 |
281 | Protocol: 2.00+ | 283 | Protocol: 2.00+ |
282 | 284 | ||
283 | Contains the boot protocol version, e.g. 0x0204 for version 2.04. | 285 | Contains the boot protocol version, in (major << 8)+minor format, |
286 | e.g. 0x0204 for version 2.04, and 0x0a11 for a hypothetical version | ||
287 | 10.17. | ||
284 | 288 | ||
285 | Field name: readmode_swtch | 289 | Field name: readmode_swtch |
286 | Type: modify (optional) | 290 | Type: modify (optional) |
287 | Offset/size: 0x208/4 | 291 | Offset/size: 0x208/4 |
288 | Protocol: 2.00+ | 292 | Protocol: 2.00+ |
289 | 293 | ||
290 | Boot loader hook (see separate chapter.) | 294 | Boot loader hook (see ADVANCED BOOT LOADER HOOKS below.) |
291 | 295 | ||
292 | Field name: start_sys | 296 | Field name: start_sys |
293 | Type: read | 297 | Type: read |
@@ -304,10 +308,17 @@ Protocol: 2.00+ | |||
304 | If set to a nonzero value, contains a pointer to a NUL-terminated | 308 | If set to a nonzero value, contains a pointer to a NUL-terminated |
305 | human-readable kernel version number string, less 0x200. This can | 309 | human-readable kernel version number string, less 0x200. This can |
306 | be used to display the kernel version to the user. This value | 310 | be used to display the kernel version to the user. This value |
307 | should be less than (0x200*setup_sects). For example, if this value | 311 | should be less than (0x200*setup_sects). |
308 | is set to 0x1c00, the kernel version number string can be found at | 312 | |
309 | offset 0x1e00 in the kernel file. This is a valid value if and only | 313 | For example, if this value is set to 0x1c00, the kernel version |
310 | if the "setup_sects" field contains the value 14 or higher. | 314 | number string can be found at offset 0x1e00 in the kernel file. |
315 | This is a valid value if and only if the "setup_sects" field | ||
316 | contains the value 15 or higher, as: | ||
317 | |||
318 | 0x1c00 < 15*0x200 (= 0x1e00) but | ||
319 | 0x1c00 >= 14*0x200 (= 0x1c00) | ||
320 | |||
321 | 0x1c00 >> 9 = 14, so the minimum value for setup_secs is 15. | ||
311 | 322 | ||
312 | Field name: type_of_loader | 323 | Field name: type_of_loader |
313 | Type: write (obligatory) | 324 | Type: write (obligatory) |
@@ -377,7 +388,7 @@ Protocol: 2.00+ | |||
377 | 388 | ||
378 | This field can be modified for two purposes: | 389 | This field can be modified for two purposes: |
379 | 390 | ||
380 | 1. as a boot loader hook (see separate chapter.) | 391 | 1. as a boot loader hook (see ADVANCED BOOT LOADER HOOKS below.) |
381 | 392 | ||
382 | 2. if a bootloader which does not install a hook loads a | 393 | 2. if a bootloader which does not install a hook loads a |
383 | relocatable kernel at a nonstandard address it will have to modify | 394 | relocatable kernel at a nonstandard address it will have to modify |
@@ -715,7 +726,7 @@ switched off, especially if the loaded kernel has the floppy driver as | |||
715 | a demand-loaded module! | 726 | a demand-loaded module! |
716 | 727 | ||
717 | 728 | ||
718 | **** ADVANCED BOOT TIME HOOKS | 729 | **** ADVANCED BOOT LOADER HOOKS |
719 | 730 | ||
720 | If the boot loader runs in a particularly hostile environment (such as | 731 | If the boot loader runs in a particularly hostile environment (such as |
721 | LOADLIN, which runs under DOS) it may be impossible to follow the | 732 | LOADLIN, which runs under DOS) it may be impossible to follow the |
@@ -740,4 +751,5 @@ IMPORTANT: All the hooks are required to preserve %esp, %ebp, %esi and | |||
740 | set them up to BOOT_DS (0x18) yourself. | 751 | set them up to BOOT_DS (0x18) yourself. |
741 | 752 | ||
742 | After completing your hook, you should jump to the address | 753 | After completing your hook, you should jump to the address |
743 | that was in this field before your boot loader overwrote it. | 754 | that was in this field before your boot loader overwrote it |
755 | (relocated, if appropriate.) | ||
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt index 15f1b35deb34..d3dc505104da 100644 --- a/Documentation/initrd.txt +++ b/Documentation/initrd.txt | |||
@@ -27,16 +27,20 @@ When using initrd, the system typically boots as follows: | |||
27 | 1) the boot loader loads the kernel and the initial RAM disk | 27 | 1) the boot loader loads the kernel and the initial RAM disk |
28 | 2) the kernel converts initrd into a "normal" RAM disk and | 28 | 2) the kernel converts initrd into a "normal" RAM disk and |
29 | frees the memory used by initrd | 29 | frees the memory used by initrd |
30 | 3) initrd is mounted read-write as root | 30 | 3) if the root device is not /dev/ram0, the old (deprecated) |
31 | 4) /linuxrc is executed (this can be any valid executable, including | 31 | change_root procedure is followed. see the "Obsolete root change |
32 | mechanism" section below. | ||
33 | 4) root device is mounted. if it is /dev/ram0, the initrd image is | ||
34 | then mounted as root | ||
35 | 5) /sbin/init is executed (this can be any valid executable, including | ||
32 | shell scripts; it is run with uid 0 and can do basically everything | 36 | shell scripts; it is run with uid 0 and can do basically everything |
33 | init can do) | 37 | init can do). |
34 | 5) linuxrc mounts the "real" root file system | 38 | 6) init mounts the "real" root file system |
35 | 6) linuxrc places the root file system at the root directory using the | 39 | 7) init places the root file system at the root directory using the |
36 | pivot_root system call | 40 | pivot_root system call |
37 | 7) the usual boot sequence (e.g. invocation of /sbin/init) is performed | 41 | 8) init execs the /sbin/init on the new root filesystem, performing |
38 | on the root file system | 42 | the usual boot sequence |
39 | 8) the initrd file system is removed | 43 | 9) the initrd file system is removed |
40 | 44 | ||
41 | Note that changing the root directory does not involve unmounting it. | 45 | Note that changing the root directory does not involve unmounting it. |
42 | It is therefore possible to leave processes running on initrd during that | 46 | It is therefore possible to leave processes running on initrd during that |
@@ -70,7 +74,7 @@ initrd adds the following new options: | |||
70 | root=/dev/ram0 | 74 | root=/dev/ram0 |
71 | 75 | ||
72 | initrd is mounted as root, and the normal boot procedure is followed, | 76 | initrd is mounted as root, and the normal boot procedure is followed, |
73 | with the RAM disk still mounted as root. | 77 | with the RAM disk mounted as root. |
74 | 78 | ||
75 | Compressed cpio images | 79 | Compressed cpio images |
76 | ---------------------- | 80 | ---------------------- |
@@ -137,11 +141,11 @@ We'll describe the loopback device method: | |||
137 | # mkdir /mnt/dev | 141 | # mkdir /mnt/dev |
138 | # mknod /mnt/dev/console c 5 1 | 142 | # mknod /mnt/dev/console c 5 1 |
139 | 5) copy all the files that are needed to properly use the initrd | 143 | 5) copy all the files that are needed to properly use the initrd |
140 | environment. Don't forget the most important file, /linuxrc | 144 | environment. Don't forget the most important file, /sbin/init |
141 | Note that /linuxrc's permissions must include "x" (execute). | 145 | Note that /sbin/init's permissions must include "x" (execute). |
142 | 6) correct operation the initrd environment can frequently be tested | 146 | 6) correct operation the initrd environment can frequently be tested |
143 | even without rebooting with the command | 147 | even without rebooting with the command |
144 | # chroot /mnt /linuxrc | 148 | # chroot /mnt /sbin/init |
145 | This is of course limited to initrds that do not interfere with the | 149 | This is of course limited to initrds that do not interfere with the |
146 | general system state (e.g. by reconfiguring network interfaces, | 150 | general system state (e.g. by reconfiguring network interfaces, |
147 | overwriting mounted devices, trying to start already running demons, | 151 | overwriting mounted devices, trying to start already running demons, |
@@ -154,7 +158,7 @@ We'll describe the loopback device method: | |||
154 | # gzip -9 initrd | 158 | # gzip -9 initrd |
155 | 159 | ||
156 | For experimenting with initrd, you may want to take a rescue floppy and | 160 | For experimenting with initrd, you may want to take a rescue floppy and |
157 | only add a symbolic link from /linuxrc to /bin/sh. Alternatively, you | 161 | only add a symbolic link from /sbin/init to /bin/sh. Alternatively, you |
158 | can try the experimental newlib environment [2] to create a small | 162 | can try the experimental newlib environment [2] to create a small |
159 | initrd. | 163 | initrd. |
160 | 164 | ||
@@ -163,15 +167,14 @@ boot loaders support initrd. Since the boot process is still compatible | |||
163 | with an older mechanism, the following boot command line parameters | 167 | with an older mechanism, the following boot command line parameters |
164 | have to be given: | 168 | have to be given: |
165 | 169 | ||
166 | root=/dev/ram0 init=/linuxrc rw | 170 | root=/dev/ram0 rw |
167 | 171 | ||
168 | (rw is only necessary if writing to the initrd file system.) | 172 | (rw is only necessary if writing to the initrd file system.) |
169 | 173 | ||
170 | With LOADLIN, you simply execute | 174 | With LOADLIN, you simply execute |
171 | 175 | ||
172 | LOADLIN <kernel> initrd=<disk_image> | 176 | LOADLIN <kernel> initrd=<disk_image> |
173 | e.g. LOADLIN C:\LINUX\BZIMAGE initrd=C:\LINUX\INITRD.GZ root=/dev/ram0 | 177 | e.g. LOADLIN C:\LINUX\BZIMAGE initrd=C:\LINUX\INITRD.GZ root=/dev/ram0 rw |
174 | init=/linuxrc rw | ||
175 | 178 | ||
176 | With LILO, you add the option INITRD=<path> to either the global section | 179 | With LILO, you add the option INITRD=<path> to either the global section |
177 | or to the section of the respective kernel in /etc/lilo.conf, and pass | 180 | or to the section of the respective kernel in /etc/lilo.conf, and pass |
@@ -179,7 +182,7 @@ the options using APPEND, e.g. | |||
179 | 182 | ||
180 | image = /bzImage | 183 | image = /bzImage |
181 | initrd = /boot/initrd.gz | 184 | initrd = /boot/initrd.gz |
182 | append = "root=/dev/ram0 init=/linuxrc rw" | 185 | append = "root=/dev/ram0 rw" |
183 | 186 | ||
184 | and run /sbin/lilo | 187 | and run /sbin/lilo |
185 | 188 | ||
@@ -191,7 +194,7 @@ Now you can boot and enjoy using initrd. | |||
191 | Changing the root device | 194 | Changing the root device |
192 | ------------------------ | 195 | ------------------------ |
193 | 196 | ||
194 | When finished with its duties, linuxrc typically changes the root device | 197 | When finished with its duties, init typically changes the root device |
195 | and proceeds with starting the Linux system on the "real" root device. | 198 | and proceeds with starting the Linux system on the "real" root device. |
196 | 199 | ||
197 | The procedure involves the following steps: | 200 | The procedure involves the following steps: |
@@ -217,7 +220,7 @@ must exist before calling pivot_root. Example: | |||
217 | # mkdir initrd | 220 | # mkdir initrd |
218 | # pivot_root . initrd | 221 | # pivot_root . initrd |
219 | 222 | ||
220 | Now, the linuxrc process may still access the old root via its | 223 | Now, the init process may still access the old root via its |
221 | executable, shared libraries, standard input/output/error, and its | 224 | executable, shared libraries, standard input/output/error, and its |
222 | current root directory. All these references are dropped by the | 225 | current root directory. All these references are dropped by the |
223 | following command: | 226 | following command: |
@@ -249,10 +252,6 @@ disk can be freed: | |||
249 | It is also possible to use initrd with an NFS-mounted root, see the | 252 | It is also possible to use initrd with an NFS-mounted root, see the |
250 | pivot_root(8) man page for details. | 253 | pivot_root(8) man page for details. |
251 | 254 | ||
252 | Note: if linuxrc or any program exec'ed from it terminates for some | ||
253 | reason, the old change_root mechanism is invoked (see section "Obsolete | ||
254 | root change mechanism"). | ||
255 | |||
256 | 255 | ||
257 | Usage scenarios | 256 | Usage scenarios |
258 | --------------- | 257 | --------------- |
@@ -264,15 +263,15 @@ as follows: | |||
264 | 1) system boots from floppy or other media with a minimal kernel | 263 | 1) system boots from floppy or other media with a minimal kernel |
265 | (e.g. support for RAM disks, initrd, a.out, and the Ext2 FS) and | 264 | (e.g. support for RAM disks, initrd, a.out, and the Ext2 FS) and |
266 | loads initrd | 265 | loads initrd |
267 | 2) /linuxrc determines what is needed to (1) mount the "real" root FS | 266 | 2) /sbin/init determines what is needed to (1) mount the "real" root FS |
268 | (i.e. device type, device drivers, file system) and (2) the | 267 | (i.e. device type, device drivers, file system) and (2) the |
269 | distribution media (e.g. CD-ROM, network, tape, ...). This can be | 268 | distribution media (e.g. CD-ROM, network, tape, ...). This can be |
270 | done by asking the user, by auto-probing, or by using a hybrid | 269 | done by asking the user, by auto-probing, or by using a hybrid |
271 | approach. | 270 | approach. |
272 | 3) /linuxrc loads the necessary kernel modules | 271 | 3) /sbin/init loads the necessary kernel modules |
273 | 4) /linuxrc creates and populates the root file system (this doesn't | 272 | 4) /sbin/init creates and populates the root file system (this doesn't |
274 | have to be a very usable system yet) | 273 | have to be a very usable system yet) |
275 | 5) /linuxrc invokes pivot_root to change the root file system and | 274 | 5) /sbin/init invokes pivot_root to change the root file system and |
276 | execs - via chroot - a program that continues the installation | 275 | execs - via chroot - a program that continues the installation |
277 | 6) the boot loader is installed | 276 | 6) the boot loader is installed |
278 | 7) the boot loader is configured to load an initrd with the set of | 277 | 7) the boot loader is configured to load an initrd with the set of |
@@ -291,7 +290,7 @@ different hardware configurations in a single administrative domain. In | |||
291 | such cases, it is desirable to generate only a small set of kernels | 290 | such cases, it is desirable to generate only a small set of kernels |
292 | (ideally only one) and to keep the system-specific part of configuration | 291 | (ideally only one) and to keep the system-specific part of configuration |
293 | information as small as possible. In this case, a common initrd could be | 292 | information as small as possible. In this case, a common initrd could be |
294 | generated with all the necessary modules. Then, only /linuxrc or a file | 293 | generated with all the necessary modules. Then, only /sbin/init or a file |
295 | read by it would have to be different. | 294 | read by it would have to be different. |
296 | 295 | ||
297 | A third scenario are more convenient recovery disks, because information | 296 | A third scenario are more convenient recovery disks, because information |
@@ -337,6 +336,25 @@ This old, deprecated mechanism is commonly called "change_root", while | |||
337 | the new, supported mechanism is called "pivot_root". | 336 | the new, supported mechanism is called "pivot_root". |
338 | 337 | ||
339 | 338 | ||
339 | Mixed change_root and pivot_root mechanism | ||
340 | ------------------------------------------ | ||
341 | |||
342 | In case you did not want to use root=/dev/ram0 to trig the pivot_root mechanism, | ||
343 | you may create both /linuxrc and /sbin/init in your initrd image. | ||
344 | |||
345 | /linuxrc would contain only the following: | ||
346 | |||
347 | #! /bin/sh | ||
348 | mount -n -t proc proc /proc | ||
349 | echo 0x0100 >/proc/sys/kernel/real-root-dev | ||
350 | umount -n /proc | ||
351 | |||
352 | Once linuxrc exited, the kernel would mount again your initrd as root, | ||
353 | this time executing /sbin/init. Again, it would be duty of this init | ||
354 | to build the right environment (maybe using the root= device passed on | ||
355 | the cmdline) before the final execution of the real /sbin/init. | ||
356 | |||
357 | |||
340 | Resources | 358 | Resources |
341 | --------- | 359 | --------- |
342 | 360 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 09220a1e22d9..aae2282600ca 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -396,6 +396,26 @@ and is between 256 and 4096 characters. It is defined in the file | |||
396 | clocksource is not available, it defaults to PIT. | 396 | clocksource is not available, it defaults to PIT. |
397 | Format: { pit | tsc | cyclone | pmtmr } | 397 | Format: { pit | tsc | cyclone | pmtmr } |
398 | 398 | ||
399 | clocksource= [GENERIC_TIME] Override the default clocksource | ||
400 | Format: <string> | ||
401 | Override the default clocksource and use the clocksource | ||
402 | with the name specified. | ||
403 | Some clocksource names to choose from, depending on | ||
404 | the platform: | ||
405 | [all] jiffies (this is the base, fallback clocksource) | ||
406 | [ACPI] acpi_pm | ||
407 | [ARM] imx_timer1,OSTS,netx_timer,mpu_timer2, | ||
408 | pxa_timer,timer3,32k_counter,timer0_1 | ||
409 | [AVR32] avr32 | ||
410 | [IA-32] pit,hpet,tsc,vmi-timer; | ||
411 | scx200_hrt on Geode; cyclone on IBM x440 | ||
412 | [MIPS] MIPS | ||
413 | [PARISC] cr16 | ||
414 | [S390] tod | ||
415 | [SH] SuperH | ||
416 | [SPARC64] tick | ||
417 | [X86-64] hpet,tsc | ||
418 | |||
399 | code_bytes [IA32] How many bytes of object code to print in an | 419 | code_bytes [IA32] How many bytes of object code to print in an |
400 | oops report. | 420 | oops report. |
401 | Range: 0 - 8192 | 421 | Range: 0 - 8192 |
@@ -1807,10 +1827,6 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1807 | 1827 | ||
1808 | time Show timing data prefixed to each printk message line | 1828 | time Show timing data prefixed to each printk message line |
1809 | 1829 | ||
1810 | clocksource= [GENERIC_TIME] Override the default clocksource | ||
1811 | Override the default clocksource and use the clocksource | ||
1812 | with the name specified. | ||
1813 | |||
1814 | tipar.timeout= [HW,PPT] | 1830 | tipar.timeout= [HW,PPT] |
1815 | Set communications timeout in tenths of a second | 1831 | Set communications timeout in tenths of a second |
1816 | (default 15). | 1832 | (default 15). |
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index 58408dd023c7..650657c54733 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt | |||
@@ -24,7 +24,7 @@ Contents: | |||
24 | (*) Explicit kernel barriers. | 24 | (*) Explicit kernel barriers. |
25 | 25 | ||
26 | - Compiler barrier. | 26 | - Compiler barrier. |
27 | - The CPU memory barriers. | 27 | - CPU memory barriers. |
28 | - MMIO write barrier. | 28 | - MMIO write barrier. |
29 | 29 | ||
30 | (*) Implicit kernel memory barriers. | 30 | (*) Implicit kernel memory barriers. |
@@ -265,7 +265,7 @@ Memory barriers are such interventions. They impose a perceived partial | |||
265 | ordering over the memory operations on either side of the barrier. | 265 | ordering over the memory operations on either side of the barrier. |
266 | 266 | ||
267 | Such enforcement is important because the CPUs and other devices in a system | 267 | Such enforcement is important because the CPUs and other devices in a system |
268 | can use a variety of tricks to improve performance - including reordering, | 268 | can use a variety of tricks to improve performance, including reordering, |
269 | deferral and combination of memory operations; speculative loads; speculative | 269 | deferral and combination of memory operations; speculative loads; speculative |
270 | branch prediction and various types of caching. Memory barriers are used to | 270 | branch prediction and various types of caching. Memory barriers are used to |
271 | override or suppress these tricks, allowing the code to sanely control the | 271 | override or suppress these tricks, allowing the code to sanely control the |
@@ -457,7 +457,7 @@ sequence, Q must be either &A or &B, and that: | |||
457 | (Q == &A) implies (D == 1) | 457 | (Q == &A) implies (D == 1) |
458 | (Q == &B) implies (D == 4) | 458 | (Q == &B) implies (D == 4) |
459 | 459 | ||
460 | But! CPU 2's perception of P may be updated _before_ its perception of B, thus | 460 | But! CPU 2's perception of P may be updated _before_ its perception of B, thus |
461 | leading to the following situation: | 461 | leading to the following situation: |
462 | 462 | ||
463 | (Q == &B) and (D == 2) ???? | 463 | (Q == &B) and (D == 2) ???? |
@@ -573,7 +573,7 @@ Basically, the read barrier always has to be there, even though it can be of | |||
573 | the "weaker" type. | 573 | the "weaker" type. |
574 | 574 | ||
575 | [!] Note that the stores before the write barrier would normally be expected to | 575 | [!] Note that the stores before the write barrier would normally be expected to |
576 | match the loads after the read barrier or data dependency barrier, and vice | 576 | match the loads after the read barrier or the data dependency barrier, and vice |
577 | versa: | 577 | versa: |
578 | 578 | ||
579 | CPU 1 CPU 2 | 579 | CPU 1 CPU 2 |
@@ -588,7 +588,7 @@ versa: | |||
588 | EXAMPLES OF MEMORY BARRIER SEQUENCES | 588 | EXAMPLES OF MEMORY BARRIER SEQUENCES |
589 | ------------------------------------ | 589 | ------------------------------------ |
590 | 590 | ||
591 | Firstly, write barriers act as a partial orderings on store operations. | 591 | Firstly, write barriers act as partial orderings on store operations. |
592 | Consider the following sequence of events: | 592 | Consider the following sequence of events: |
593 | 593 | ||
594 | CPU 1 | 594 | CPU 1 |
@@ -608,15 +608,15 @@ STORE B, STORE C } all occurring before the unordered set of { STORE D, STORE E | |||
608 | +-------+ : : | 608 | +-------+ : : |
609 | | | +------+ | 609 | | | +------+ |
610 | | |------>| C=3 | } /\ | 610 | | |------>| C=3 | } /\ |
611 | | | : +------+ }----- \ -----> Events perceptible | 611 | | | : +------+ }----- \ -----> Events perceptible to |
612 | | | : | A=1 | } \/ to rest of system | 612 | | | : | A=1 | } \/ the rest of the system |
613 | | | : +------+ } | 613 | | | : +------+ } |
614 | | CPU 1 | : | B=2 | } | 614 | | CPU 1 | : | B=2 | } |
615 | | | +------+ } | 615 | | | +------+ } |
616 | | | wwwwwwwwwwwwwwww } <--- At this point the write barrier | 616 | | | wwwwwwwwwwwwwwww } <--- At this point the write barrier |
617 | | | +------+ } requires all stores prior to the | 617 | | | +------+ } requires all stores prior to the |
618 | | | : | E=5 | } barrier to be committed before | 618 | | | : | E=5 | } barrier to be committed before |
619 | | | : +------+ } further stores may be take place. | 619 | | | : +------+ } further stores may take place |
620 | | |------>| D=4 | } | 620 | | |------>| D=4 | } |
621 | | | +------+ | 621 | | | +------+ |
622 | +-------+ : : | 622 | +-------+ : : |
@@ -626,7 +626,7 @@ STORE B, STORE C } all occurring before the unordered set of { STORE D, STORE E | |||
626 | V | 626 | V |
627 | 627 | ||
628 | 628 | ||
629 | Secondly, data dependency barriers act as a partial orderings on data-dependent | 629 | Secondly, data dependency barriers act as partial orderings on data-dependent |
630 | loads. Consider the following sequence of events: | 630 | loads. Consider the following sequence of events: |
631 | 631 | ||
632 | CPU 1 CPU 2 | 632 | CPU 1 CPU 2 |
@@ -975,7 +975,7 @@ compiler from moving the memory accesses either side of it to the other side: | |||
975 | 975 | ||
976 | barrier(); | 976 | barrier(); |
977 | 977 | ||
978 | This a general barrier - lesser varieties of compiler barrier do not exist. | 978 | This is a general barrier - lesser varieties of compiler barrier do not exist. |
979 | 979 | ||
980 | The compiler barrier has no direct effect on the CPU, which may then reorder | 980 | The compiler barrier has no direct effect on the CPU, which may then reorder |
981 | things however it wishes. | 981 | things however it wishes. |
@@ -997,7 +997,7 @@ The Linux kernel has eight basic CPU memory barriers: | |||
997 | All CPU memory barriers unconditionally imply compiler barriers. | 997 | All CPU memory barriers unconditionally imply compiler barriers. |
998 | 998 | ||
999 | SMP memory barriers are reduced to compiler barriers on uniprocessor compiled | 999 | SMP memory barriers are reduced to compiler barriers on uniprocessor compiled |
1000 | systems because it is assumed that a CPU will be appear to be self-consistent, | 1000 | systems because it is assumed that a CPU will appear to be self-consistent, |
1001 | and will order overlapping accesses correctly with respect to itself. | 1001 | and will order overlapping accesses correctly with respect to itself. |
1002 | 1002 | ||
1003 | [!] Note that SMP memory barriers _must_ be used to control the ordering of | 1003 | [!] Note that SMP memory barriers _must_ be used to control the ordering of |
@@ -1146,9 +1146,9 @@ for each construct. These operations all imply certain barriers: | |||
1146 | Therefore, from (1), (2) and (4) an UNLOCK followed by an unconditional LOCK is | 1146 | Therefore, from (1), (2) and (4) an UNLOCK followed by an unconditional LOCK is |
1147 | equivalent to a full barrier, but a LOCK followed by an UNLOCK is not. | 1147 | equivalent to a full barrier, but a LOCK followed by an UNLOCK is not. |
1148 | 1148 | ||
1149 | [!] Note: one of the consequence of LOCKs and UNLOCKs being only one-way | 1149 | [!] Note: one of the consequences of LOCKs and UNLOCKs being only one-way |
1150 | barriers is that the effects instructions outside of a critical section may | 1150 | barriers is that the effects of instructions outside of a critical section |
1151 | seep into the inside of the critical section. | 1151 | may seep into the inside of the critical section. |
1152 | 1152 | ||
1153 | A LOCK followed by an UNLOCK may not be assumed to be full memory barrier | 1153 | A LOCK followed by an UNLOCK may not be assumed to be full memory barrier |
1154 | because it is possible for an access preceding the LOCK to happen after the | 1154 | because it is possible for an access preceding the LOCK to happen after the |
@@ -1239,7 +1239,7 @@ three CPUs; then should the following sequence of events occur: | |||
1239 | UNLOCK M UNLOCK Q | 1239 | UNLOCK M UNLOCK Q |
1240 | *D = d; *H = h; | 1240 | *D = d; *H = h; |
1241 | 1241 | ||
1242 | Then there is no guarantee as to what order CPU #3 will see the accesses to *A | 1242 | Then there is no guarantee as to what order CPU 3 will see the accesses to *A |
1243 | through *H occur in, other than the constraints imposed by the separate locks | 1243 | through *H occur in, other than the constraints imposed by the separate locks |
1244 | on the separate CPUs. It might, for example, see: | 1244 | on the separate CPUs. It might, for example, see: |
1245 | 1245 | ||
@@ -1269,12 +1269,12 @@ However, if the following occurs: | |||
1269 | UNLOCK M [2] | 1269 | UNLOCK M [2] |
1270 | *H = h; | 1270 | *H = h; |
1271 | 1271 | ||
1272 | CPU #3 might see: | 1272 | CPU 3 might see: |
1273 | 1273 | ||
1274 | *E, LOCK M [1], *C, *B, *A, UNLOCK M [1], | 1274 | *E, LOCK M [1], *C, *B, *A, UNLOCK M [1], |
1275 | LOCK M [2], *H, *F, *G, UNLOCK M [2], *D | 1275 | LOCK M [2], *H, *F, *G, UNLOCK M [2], *D |
1276 | 1276 | ||
1277 | But assuming CPU #1 gets the lock first, it won't see any of: | 1277 | But assuming CPU 1 gets the lock first, CPU 3 won't see any of: |
1278 | 1278 | ||
1279 | *B, *C, *D, *F, *G or *H preceding LOCK M [1] | 1279 | *B, *C, *D, *F, *G or *H preceding LOCK M [1] |
1280 | *A, *B or *C following UNLOCK M [1] | 1280 | *A, *B or *C following UNLOCK M [1] |
@@ -1327,12 +1327,12 @@ spinlock, for example: | |||
1327 | mmiowb(); | 1327 | mmiowb(); |
1328 | spin_unlock(Q); | 1328 | spin_unlock(Q); |
1329 | 1329 | ||
1330 | this will ensure that the two stores issued on CPU #1 appear at the PCI bridge | 1330 | this will ensure that the two stores issued on CPU 1 appear at the PCI bridge |
1331 | before either of the stores issued on CPU #2. | 1331 | before either of the stores issued on CPU 2. |
1332 | 1332 | ||
1333 | 1333 | ||
1334 | Furthermore, following a store by a load to the same device obviates the need | 1334 | Furthermore, following a store by a load from the same device obviates the need |
1335 | for an mmiowb(), because the load forces the store to complete before the load | 1335 | for the mmiowb(), because the load forces the store to complete before the load |
1336 | is performed: | 1336 | is performed: |
1337 | 1337 | ||
1338 | CPU 1 CPU 2 | 1338 | CPU 1 CPU 2 |
@@ -1363,7 +1363,7 @@ circumstances in which reordering definitely _could_ be a problem: | |||
1363 | 1363 | ||
1364 | (*) Atomic operations. | 1364 | (*) Atomic operations. |
1365 | 1365 | ||
1366 | (*) Accessing devices (I/O). | 1366 | (*) Accessing devices. |
1367 | 1367 | ||
1368 | (*) Interrupts. | 1368 | (*) Interrupts. |
1369 | 1369 | ||
@@ -1399,7 +1399,7 @@ To wake up a particular waiter, the up_read() or up_write() functions have to: | |||
1399 | (1) read the next pointer from this waiter's record to know as to where the | 1399 | (1) read the next pointer from this waiter's record to know as to where the |
1400 | next waiter record is; | 1400 | next waiter record is; |
1401 | 1401 | ||
1402 | (4) read the pointer to the waiter's task structure; | 1402 | (2) read the pointer to the waiter's task structure; |
1403 | 1403 | ||
1404 | (3) clear the task pointer to tell the waiter it has been given the semaphore; | 1404 | (3) clear the task pointer to tell the waiter it has been given the semaphore; |
1405 | 1405 | ||
@@ -1407,7 +1407,7 @@ To wake up a particular waiter, the up_read() or up_write() functions have to: | |||
1407 | 1407 | ||
1408 | (5) release the reference held on the waiter's task struct. | 1408 | (5) release the reference held on the waiter's task struct. |
1409 | 1409 | ||
1410 | In otherwords, it has to perform this sequence of events: | 1410 | In other words, it has to perform this sequence of events: |
1411 | 1411 | ||
1412 | LOAD waiter->list.next; | 1412 | LOAD waiter->list.next; |
1413 | LOAD waiter->task; | 1413 | LOAD waiter->task; |
@@ -1502,7 +1502,7 @@ operations and adjusting reference counters towards object destruction, and as | |||
1502 | such the implicit memory barrier effects are necessary. | 1502 | such the implicit memory barrier effects are necessary. |
1503 | 1503 | ||
1504 | 1504 | ||
1505 | The following operation are potential problems as they do _not_ imply memory | 1505 | The following operations are potential problems as they do _not_ imply memory |
1506 | barriers, but might be used for implementing such things as UNLOCK-class | 1506 | barriers, but might be used for implementing such things as UNLOCK-class |
1507 | operations: | 1507 | operations: |
1508 | 1508 | ||
@@ -1517,7 +1517,7 @@ With these the appropriate explicit memory barrier should be used if necessary | |||
1517 | 1517 | ||
1518 | The following also do _not_ imply memory barriers, and so may require explicit | 1518 | The following also do _not_ imply memory barriers, and so may require explicit |
1519 | memory barriers under some circumstances (smp_mb__before_atomic_dec() for | 1519 | memory barriers under some circumstances (smp_mb__before_atomic_dec() for |
1520 | instance)): | 1520 | instance): |
1521 | 1521 | ||
1522 | atomic_add(); | 1522 | atomic_add(); |
1523 | atomic_sub(); | 1523 | atomic_sub(); |
@@ -1641,8 +1641,8 @@ functions: | |||
1641 | indeed have special I/O space access cycles and instructions, but many | 1641 | indeed have special I/O space access cycles and instructions, but many |
1642 | CPUs don't have such a concept. | 1642 | CPUs don't have such a concept. |
1643 | 1643 | ||
1644 | The PCI bus, amongst others, defines an I/O space concept - which on such | 1644 | The PCI bus, amongst others, defines an I/O space concept which - on such |
1645 | CPUs as i386 and x86_64 cpus readily maps to the CPU's concept of I/O | 1645 | CPUs as i386 and x86_64 - readily maps to the CPU's concept of I/O |
1646 | space. However, it may also be mapped as a virtual I/O space in the CPU's | 1646 | space. However, it may also be mapped as a virtual I/O space in the CPU's |
1647 | memory map, particularly on those CPUs that don't support alternate I/O | 1647 | memory map, particularly on those CPUs that don't support alternate I/O |
1648 | spaces. | 1648 | spaces. |
@@ -1664,7 +1664,7 @@ functions: | |||
1664 | i386 architecture machines, for example, this is controlled by way of the | 1664 | i386 architecture machines, for example, this is controlled by way of the |
1665 | MTRR registers. | 1665 | MTRR registers. |
1666 | 1666 | ||
1667 | Ordinarily, these will be guaranteed to be fully ordered and uncombined,, | 1667 | Ordinarily, these will be guaranteed to be fully ordered and uncombined, |
1668 | provided they're not accessing a prefetchable device. | 1668 | provided they're not accessing a prefetchable device. |
1669 | 1669 | ||
1670 | However, intermediary hardware (such as a PCI bridge) may indulge in | 1670 | However, intermediary hardware (such as a PCI bridge) may indulge in |
@@ -1689,7 +1689,7 @@ functions: | |||
1689 | 1689 | ||
1690 | (*) ioreadX(), iowriteX() | 1690 | (*) ioreadX(), iowriteX() |
1691 | 1691 | ||
1692 | These will perform as appropriate for the type of access they're actually | 1692 | These will perform appropriately for the type of access they're actually |
1693 | doing, be it inX()/outX() or readX()/writeX(). | 1693 | doing, be it inX()/outX() or readX()/writeX(). |
1694 | 1694 | ||
1695 | 1695 | ||
@@ -1705,7 +1705,7 @@ of arch-specific code. | |||
1705 | 1705 | ||
1706 | This means that it must be considered that the CPU will execute its instruction | 1706 | This means that it must be considered that the CPU will execute its instruction |
1707 | stream in any order it feels like - or even in parallel - provided that if an | 1707 | stream in any order it feels like - or even in parallel - provided that if an |
1708 | instruction in the stream depends on the an earlier instruction, then that | 1708 | instruction in the stream depends on an earlier instruction, then that |
1709 | earlier instruction must be sufficiently complete[*] before the later | 1709 | earlier instruction must be sufficiently complete[*] before the later |
1710 | instruction may proceed; in other words: provided that the appearance of | 1710 | instruction may proceed; in other words: provided that the appearance of |
1711 | causality is maintained. | 1711 | causality is maintained. |
@@ -1795,8 +1795,8 @@ eventually become visible on all CPUs, there's no guarantee that they will | |||
1795 | become apparent in the same order on those other CPUs. | 1795 | become apparent in the same order on those other CPUs. |
1796 | 1796 | ||
1797 | 1797 | ||
1798 | Consider dealing with a system that has pair of CPUs (1 & 2), each of which has | 1798 | Consider dealing with a system that has a pair of CPUs (1 & 2), each of which |
1799 | a pair of parallel data caches (CPU 1 has A/B, and CPU 2 has C/D): | 1799 | has a pair of parallel data caches (CPU 1 has A/B, and CPU 2 has C/D): |
1800 | 1800 | ||
1801 | : | 1801 | : |
1802 | : +--------+ | 1802 | : +--------+ |
@@ -1835,7 +1835,7 @@ Imagine the system has the following properties: | |||
1835 | 1835 | ||
1836 | (*) the coherency queue is not flushed by normal loads to lines already | 1836 | (*) the coherency queue is not flushed by normal loads to lines already |
1837 | present in the cache, even though the contents of the queue may | 1837 | present in the cache, even though the contents of the queue may |
1838 | potentially effect those loads. | 1838 | potentially affect those loads. |
1839 | 1839 | ||
1840 | Imagine, then, that two writes are made on the first CPU, with a write barrier | 1840 | Imagine, then, that two writes are made on the first CPU, with a write barrier |
1841 | between them to guarantee that they will appear to reach that CPU's caches in | 1841 | between them to guarantee that they will appear to reach that CPU's caches in |
@@ -1845,7 +1845,7 @@ the requisite order: | |||
1845 | =============== =============== ======================================= | 1845 | =============== =============== ======================================= |
1846 | u == 0, v == 1 and p == &u, q == &u | 1846 | u == 0, v == 1 and p == &u, q == &u |
1847 | v = 2; | 1847 | v = 2; |
1848 | smp_wmb(); Make sure change to v visible before | 1848 | smp_wmb(); Make sure change to v is visible before |
1849 | change to p | 1849 | change to p |
1850 | <A:modify v=2> v is now in cache A exclusively | 1850 | <A:modify v=2> v is now in cache A exclusively |
1851 | p = &v; | 1851 | p = &v; |
@@ -1853,7 +1853,7 @@ the requisite order: | |||
1853 | 1853 | ||
1854 | The write memory barrier forces the other CPUs in the system to perceive that | 1854 | The write memory barrier forces the other CPUs in the system to perceive that |
1855 | the local CPU's caches have apparently been updated in the correct order. But | 1855 | the local CPU's caches have apparently been updated in the correct order. But |
1856 | now imagine that the second CPU that wants to read those values: | 1856 | now imagine that the second CPU wants to read those values: |
1857 | 1857 | ||
1858 | CPU 1 CPU 2 COMMENT | 1858 | CPU 1 CPU 2 COMMENT |
1859 | =============== =============== ======================================= | 1859 | =============== =============== ======================================= |
@@ -1861,7 +1861,7 @@ now imagine that the second CPU that wants to read those values: | |||
1861 | q = p; | 1861 | q = p; |
1862 | x = *q; | 1862 | x = *q; |
1863 | 1863 | ||
1864 | The above pair of reads may then fail to happen in expected order, as the | 1864 | The above pair of reads may then fail to happen in the expected order, as the |
1865 | cacheline holding p may get updated in one of the second CPU's caches whilst | 1865 | cacheline holding p may get updated in one of the second CPU's caches whilst |
1866 | the update to the cacheline holding v is delayed in the other of the second | 1866 | the update to the cacheline holding v is delayed in the other of the second |
1867 | CPU's caches by some other cache event: | 1867 | CPU's caches by some other cache event: |
@@ -1916,7 +1916,7 @@ access depends on a read, not all do, so it may not be relied on. | |||
1916 | 1916 | ||
1917 | Other CPUs may also have split caches, but must coordinate between the various | 1917 | Other CPUs may also have split caches, but must coordinate between the various |
1918 | cachelets for normal memory accesses. The semantics of the Alpha removes the | 1918 | cachelets for normal memory accesses. The semantics of the Alpha removes the |
1919 | need for coordination in absence of memory barriers. | 1919 | need for coordination in the absence of memory barriers. |
1920 | 1920 | ||
1921 | 1921 | ||
1922 | CACHE COHERENCY VS DMA | 1922 | CACHE COHERENCY VS DMA |
@@ -1931,10 +1931,10 @@ invalidate them as well). | |||
1931 | 1931 | ||
1932 | In addition, the data DMA'd to RAM by a device may be overwritten by dirty | 1932 | In addition, the data DMA'd to RAM by a device may be overwritten by dirty |
1933 | cache lines being written back to RAM from a CPU's cache after the device has | 1933 | cache lines being written back to RAM from a CPU's cache after the device has |
1934 | installed its own data, or cache lines simply present in a CPUs cache may | 1934 | installed its own data, or cache lines present in the CPU's cache may simply |
1935 | simply obscure the fact that RAM has been updated, until at such time as the | 1935 | obscure the fact that RAM has been updated, until at such time as the cacheline |
1936 | cacheline is discarded from the CPU's cache and reloaded. To deal with this, | 1936 | is discarded from the CPU's cache and reloaded. To deal with this, the |
1937 | the appropriate part of the kernel must invalidate the overlapping bits of the | 1937 | appropriate part of the kernel must invalidate the overlapping bits of the |
1938 | cache on each CPU. | 1938 | cache on each CPU. |
1939 | 1939 | ||
1940 | See Documentation/cachetlb.txt for more information on cache management. | 1940 | See Documentation/cachetlb.txt for more information on cache management. |
@@ -1944,7 +1944,7 @@ CACHE COHERENCY VS MMIO | |||
1944 | ----------------------- | 1944 | ----------------------- |
1945 | 1945 | ||
1946 | Memory mapped I/O usually takes place through memory locations that are part of | 1946 | Memory mapped I/O usually takes place through memory locations that are part of |
1947 | a window in the CPU's memory space that have different properties assigned than | 1947 | a window in the CPU's memory space that has different properties assigned than |
1948 | the usual RAM directed window. | 1948 | the usual RAM directed window. |
1949 | 1949 | ||
1950 | Amongst these properties is usually the fact that such accesses bypass the | 1950 | Amongst these properties is usually the fact that such accesses bypass the |
@@ -1960,7 +1960,7 @@ THE THINGS CPUS GET UP TO | |||
1960 | ========================= | 1960 | ========================= |
1961 | 1961 | ||
1962 | A programmer might take it for granted that the CPU will perform memory | 1962 | A programmer might take it for granted that the CPU will perform memory |
1963 | operations in exactly the order specified, so that if a CPU is, for example, | 1963 | operations in exactly the order specified, so that if the CPU is, for example, |
1964 | given the following piece of code to execute: | 1964 | given the following piece of code to execute: |
1965 | 1965 | ||
1966 | a = *A; | 1966 | a = *A; |
@@ -1969,7 +1969,7 @@ given the following piece of code to execute: | |||
1969 | d = *D; | 1969 | d = *D; |
1970 | *E = e; | 1970 | *E = e; |
1971 | 1971 | ||
1972 | They would then expect that the CPU will complete the memory operation for each | 1972 | they would then expect that the CPU will complete the memory operation for each |
1973 | instruction before moving on to the next one, leading to a definite sequence of | 1973 | instruction before moving on to the next one, leading to a definite sequence of |
1974 | operations as seen by external observers in the system: | 1974 | operations as seen by external observers in the system: |
1975 | 1975 | ||
@@ -1986,8 +1986,8 @@ assumption doesn't hold because: | |||
1986 | (*) loads may be done speculatively, and the result discarded should it prove | 1986 | (*) loads may be done speculatively, and the result discarded should it prove |
1987 | to have been unnecessary; | 1987 | to have been unnecessary; |
1988 | 1988 | ||
1989 | (*) loads may be done speculatively, leading to the result having being | 1989 | (*) loads may be done speculatively, leading to the result having been fetched |
1990 | fetched at the wrong time in the expected sequence of events; | 1990 | at the wrong time in the expected sequence of events; |
1991 | 1991 | ||
1992 | (*) the order of the memory accesses may be rearranged to promote better use | 1992 | (*) the order of the memory accesses may be rearranged to promote better use |
1993 | of the CPU buses and caches; | 1993 | of the CPU buses and caches; |
@@ -2069,12 +2069,12 @@ AND THEN THERE'S THE ALPHA | |||
2069 | 2069 | ||
2070 | The DEC Alpha CPU is one of the most relaxed CPUs there is. Not only that, | 2070 | The DEC Alpha CPU is one of the most relaxed CPUs there is. Not only that, |
2071 | some versions of the Alpha CPU have a split data cache, permitting them to have | 2071 | some versions of the Alpha CPU have a split data cache, permitting them to have |
2072 | two semantically related cache lines updating at separate times. This is where | 2072 | two semantically-related cache lines updated at separate times. This is where |
2073 | the data dependency barrier really becomes necessary as this synchronises both | 2073 | the data dependency barrier really becomes necessary as this synchronises both |
2074 | caches with the memory coherence system, thus making it seem like pointer | 2074 | caches with the memory coherence system, thus making it seem like pointer |
2075 | changes vs new data occur in the right order. | 2075 | changes vs new data occur in the right order. |
2076 | 2076 | ||
2077 | The Alpha defines the Linux's kernel's memory barrier model. | 2077 | The Alpha defines the Linux kernel's memory barrier model. |
2078 | 2078 | ||
2079 | See the subsection on "Cache Coherency" above. | 2079 | See the subsection on "Cache Coherency" above. |
2080 | 2080 | ||
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 795fbb48ffa7..76ea6c837be5 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -1,26 +1,30 @@ | |||
1 | Overview of Linux kernel SPI support | 1 | Overview of Linux kernel SPI support |
2 | ==================================== | 2 | ==================================== |
3 | 3 | ||
4 | 02-Dec-2005 | 4 | 21-May-2007 |
5 | 5 | ||
6 | What is SPI? | 6 | What is SPI? |
7 | ------------ | 7 | ------------ |
8 | The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial | 8 | The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial |
9 | link used to connect microcontrollers to sensors, memory, and peripherals. | 9 | link used to connect microcontrollers to sensors, memory, and peripherals. |
10 | It's a simple "de facto" standard, not complicated enough to acquire a | ||
11 | standardization body. SPI uses a master/slave configuration. | ||
10 | 12 | ||
11 | The three signal wires hold a clock (SCK, often on the order of 10 MHz), | 13 | The three signal wires hold a clock (SCK, often on the order of 10 MHz), |
12 | and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In, | 14 | and parallel data lines with "Master Out, Slave In" (MOSI) or "Master In, |
13 | Slave Out" (MISO) signals. (Other names are also used.) There are four | 15 | Slave Out" (MISO) signals. (Other names are also used.) There are four |
14 | clocking modes through which data is exchanged; mode-0 and mode-3 are most | 16 | clocking modes through which data is exchanged; mode-0 and mode-3 are most |
15 | commonly used. Each clock cycle shifts data out and data in; the clock | 17 | commonly used. Each clock cycle shifts data out and data in; the clock |
16 | doesn't cycle except when there is data to shift. | 18 | doesn't cycle except when there is a data bit to shift. Not all data bits |
19 | are used though; not every protocol uses those full duplex capabilities. | ||
17 | 20 | ||
18 | SPI masters may use a "chip select" line to activate a given SPI slave | 21 | SPI masters use a fourth "chip select" line to activate a given SPI slave |
19 | device, so those three signal wires may be connected to several chips | 22 | device, so those three signal wires may be connected to several chips |
20 | in parallel. All SPI slaves support chipselects. Some devices have | 23 | in parallel. All SPI slaves support chipselects; they are usually active |
24 | low signals, labeled nCSx for slave 'x' (e.g. nCS0). Some devices have | ||
21 | other signals, often including an interrupt to the master. | 25 | other signals, often including an interrupt to the master. |
22 | 26 | ||
23 | Unlike serial busses like USB or SMBUS, even low level protocols for | 27 | Unlike serial busses like USB or SMBus, even low level protocols for |
24 | SPI slave functions are usually not interoperable between vendors | 28 | SPI slave functions are usually not interoperable between vendors |
25 | (except for commodities like SPI memory chips). | 29 | (except for commodities like SPI memory chips). |
26 | 30 | ||
@@ -33,6 +37,11 @@ SPI slave functions are usually not interoperable between vendors | |||
33 | - Some devices may use eight bit words. Others may different word | 37 | - Some devices may use eight bit words. Others may different word |
34 | lengths, such as streams of 12-bit or 20-bit digital samples. | 38 | lengths, such as streams of 12-bit or 20-bit digital samples. |
35 | 39 | ||
40 | - Words are usually sent with their most significant bit (MSB) first, | ||
41 | but sometimes the least significant bit (LSB) goes first instead. | ||
42 | |||
43 | - Sometimes SPI is used to daisy-chain devices, like shift registers. | ||
44 | |||
36 | In the same way, SPI slaves will only rarely support any kind of automatic | 45 | In the same way, SPI slaves will only rarely support any kind of automatic |
37 | discovery/enumeration protocol. The tree of slave devices accessible from | 46 | discovery/enumeration protocol. The tree of slave devices accessible from |
38 | a given SPI master will normally be set up manually, with configuration | 47 | a given SPI master will normally be set up manually, with configuration |
@@ -44,6 +53,14 @@ half-duplex SPI, for request/response protocols), SSP ("Synchronous | |||
44 | Serial Protocol"), PSP ("Programmable Serial Protocol"), and other | 53 | Serial Protocol"), PSP ("Programmable Serial Protocol"), and other |
45 | related protocols. | 54 | related protocols. |
46 | 55 | ||
56 | Some chips eliminate a signal line by combining MOSI and MISO, and | ||
57 | limiting themselves to half-duplex at the hardware level. In fact | ||
58 | some SPI chips have this signal mode as a strapping option. These | ||
59 | can be accessed using the same programming interface as SPI, but of | ||
60 | course they won't handle full duplex transfers. You may find such | ||
61 | chips described as using "three wire" signaling: SCK, data, nCSx. | ||
62 | (That data line is sometimes called MOMI or SISO.) | ||
63 | |||
47 | Microcontrollers often support both master and slave sides of the SPI | 64 | Microcontrollers often support both master and slave sides of the SPI |
48 | protocol. This document (and Linux) currently only supports the master | 65 | protocol. This document (and Linux) currently only supports the master |
49 | side of SPI interactions. | 66 | side of SPI interactions. |
@@ -74,6 +91,32 @@ interfaces with SPI modes. Given SPI support, they could use MMC or SD | |||
74 | cards without needing a special purpose MMC/SD/SDIO controller. | 91 | cards without needing a special purpose MMC/SD/SDIO controller. |
75 | 92 | ||
76 | 93 | ||
94 | I'm confused. What are these four SPI "clock modes"? | ||
95 | ----------------------------------------------------- | ||
96 | It's easy to be confused here, and the vendor documentation you'll | ||
97 | find isn't necessarily helpful. The four modes combine two mode bits: | ||
98 | |||
99 | - CPOL indicates the initial clock polarity. CPOL=0 means the | ||
100 | clock starts low, so the first (leading) edge is rising, and | ||
101 | the second (trailing) edge is falling. CPOL=1 means the clock | ||
102 | starts high, so the first (leading) edge is falling. | ||
103 | |||
104 | - CPHA indicates the clock phase used to sample data; CPHA=0 says | ||
105 | sample on the leading edge, CPHA=1 means the trailing edge. | ||
106 | |||
107 | Since the signal needs to stablize before it's sampled, CPHA=0 | ||
108 | implies that its data is written half a clock before the first | ||
109 | clock edge. The chipselect may have made it become available. | ||
110 | |||
111 | Chip specs won't always say "uses SPI mode X" in as many words, | ||
112 | but their timing diagrams will make the CPOL and CPHA modes clear. | ||
113 | |||
114 | In the SPI mode number, CPOL is the high order bit and CPHA is the | ||
115 | low order bit. So when a chip's timing diagram shows the clock | ||
116 | starting low (CPOL=0) and data stabilized for sampling during the | ||
117 | trailing clock edge (CPHA=1), that's SPI mode 1. | ||
118 | |||
119 | |||
77 | How do these driver programming interfaces work? | 120 | How do these driver programming interfaces work? |
78 | ------------------------------------------------ | 121 | ------------------------------------------------ |
79 | The <linux/spi/spi.h> header file includes kerneldoc, as does the | 122 | The <linux/spi/spi.h> header file includes kerneldoc, as does the |
diff --git a/MAINTAINERS b/MAINTAINERS index 22ab4019972b..953291d08c76 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -332,6 +332,9 @@ L: linux-usb-devel@lists.sourceforge.net | |||
332 | W: http://www.linux-usb.org/SpeedTouch/ | 332 | W: http://www.linux-usb.org/SpeedTouch/ |
333 | S: Maintained | 333 | S: Maintained |
334 | 334 | ||
335 | ALCHEMY AU1XX0 MMC DRIVER | ||
336 | S: Orphan | ||
337 | |||
335 | ALI1563 I2C DRIVER | 338 | ALI1563 I2C DRIVER |
336 | P: Rudolf Marek | 339 | P: Rudolf Marek |
337 | M: r.marek@assembler.cz | 340 | M: r.marek@assembler.cz |
@@ -418,6 +421,12 @@ P: Ian Molton | |||
418 | M: spyro@f2s.com | 421 | M: spyro@f2s.com |
419 | S: Maintained | 422 | S: Maintained |
420 | 423 | ||
424 | ARM PRIMECELL MMCI PL180/1 DRIVER | ||
425 | P: Russell King | ||
426 | M: rmk@arm.linux.org.uk | ||
427 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) | ||
428 | S: Maintained | ||
429 | |||
421 | ARM/ADI ROADRUNNER MACHINE SUPPORT | 430 | ARM/ADI ROADRUNNER MACHINE SUPPORT |
422 | P: Lennert Buytenhek | 431 | P: Lennert Buytenhek |
423 | M: kernel@wantstofly.org | 432 | M: kernel@wantstofly.org |
@@ -649,6 +658,9 @@ L: linux-atm-general@lists.sourceforge.net (subscribers-only) | |||
649 | W: http://linux-atm.sourceforge.net | 658 | W: http://linux-atm.sourceforge.net |
650 | S: Maintained | 659 | S: Maintained |
651 | 660 | ||
661 | ATMEL AT91 MCI DRIVER | ||
662 | S: Orphan | ||
663 | |||
652 | ATMEL MACB ETHERNET DRIVER | 664 | ATMEL MACB ETHERNET DRIVER |
653 | P: Haavard Skinnemoen | 665 | P: Haavard Skinnemoen |
654 | M: hskinnemoen@atmel.com | 666 | M: hskinnemoen@atmel.com |
@@ -2380,6 +2392,13 @@ M: stelian@popies.net | |||
2380 | W: http://popies.net/meye/ | 2392 | W: http://popies.net/meye/ |
2381 | S: Maintained | 2393 | S: Maintained |
2382 | 2394 | ||
2395 | MOTOROLA IMX MMC/SD HOST CONTROLLER INTERFACE DRIVER | ||
2396 | P: Pavel Pisa | ||
2397 | M: ppisa@pikron.com | ||
2398 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) | ||
2399 | W: http://mmc.drzeus.cx/wiki/Controllers/Freescale/SDHC | ||
2400 | S: Maintained | ||
2401 | |||
2383 | MOUSE AND MISC DEVICES [GENERAL] | 2402 | MOUSE AND MISC DEVICES [GENERAL] |
2384 | P: Alessandro Rubini | 2403 | P: Alessandro Rubini |
2385 | M: rubini@ipvvis.unipv.it | 2404 | M: rubini@ipvvis.unipv.it |
@@ -2900,6 +2919,9 @@ M: nico@cam.org | |||
2900 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) | 2919 | L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) |
2901 | S: Maintained | 2920 | S: Maintained |
2902 | 2921 | ||
2922 | PXA MMCI DRIVER | ||
2923 | S: Orphan | ||
2924 | |||
2903 | QLOGIC QLA2XXX FC-SCSI DRIVER | 2925 | QLOGIC QLA2XXX FC-SCSI DRIVER |
2904 | P: Andrew Vasquez | 2926 | P: Andrew Vasquez |
2905 | M: linux-driver@qlogic.com | 2927 | M: linux-driver@qlogic.com |
@@ -3416,6 +3438,13 @@ P: Alex Dubov | |||
3416 | M: oakad@yahoo.com | 3438 | M: oakad@yahoo.com |
3417 | S: Maintained | 3439 | S: Maintained |
3418 | 3440 | ||
3441 | TI OMAP MMC INTERFACE DRIVER | ||
3442 | P: Carlos Aguiar, Anderson Briglia and Syed Khasim | ||
3443 | M: linux-omap-open-source@linux.omap.com | ||
3444 | W: http://linux.omap.com | ||
3445 | W: http://www.muru.com/linux/omap/ | ||
3446 | S: Maintained | ||
3447 | |||
3419 | TI OMAP RANDOM NUMBER GENERATOR SUPPORT | 3448 | TI OMAP RANDOM NUMBER GENERATOR SUPPORT |
3420 | P: Deepak Saxena | 3449 | P: Deepak Saxena |
3421 | M: dsaxena@plexity.net | 3450 | M: dsaxena@plexity.net |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index c2d54b802232..8770a5d0b143 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -891,7 +891,7 @@ config PHYSICAL_ALIGN | |||
891 | Don't change this unless you know what you are doing. | 891 | Don't change this unless you know what you are doing. |
892 | 892 | ||
893 | config HOTPLUG_CPU | 893 | config HOTPLUG_CPU |
894 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 894 | bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)" |
895 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER | 895 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER |
896 | ---help--- | 896 | ---help--- |
897 | Say Y here to experiment with turning CPUs off and on, and to | 897 | Say Y here to experiment with turning CPUs off and on, and to |
diff --git a/arch/i386/mach-generic/bigsmp.c b/arch/i386/mach-generic/bigsmp.c index e932d3485ae2..58a477baec30 100644 --- a/arch/i386/mach-generic/bigsmp.c +++ b/arch/i386/mach-generic/bigsmp.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | static int dmi_bigsmp; /* can be set by dmi scanners */ | 22 | static int dmi_bigsmp; /* can be set by dmi scanners */ |
23 | 23 | ||
24 | static __init int hp_ht_bigsmp(struct dmi_system_id *d) | 24 | static int hp_ht_bigsmp(struct dmi_system_id *d) |
25 | { | 25 | { |
26 | #ifdef CONFIG_X86_GENERICARCH | 26 | #ifdef CONFIG_X86_GENERICARCH |
27 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); | 27 | printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident); |
@@ -31,7 +31,7 @@ static __init int hp_ht_bigsmp(struct dmi_system_id *d) | |||
31 | } | 31 | } |
32 | 32 | ||
33 | 33 | ||
34 | static struct dmi_system_id __initdata bigsmp_dmi_table[] = { | 34 | static struct dmi_system_id bigsmp_dmi_table[] = { |
35 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", { | 35 | { hp_ht_bigsmp, "HP ProLiant DL760 G2", { |
36 | DMI_MATCH(DMI_BIOS_VENDOR, "HP"), | 36 | DMI_MATCH(DMI_BIOS_VENDOR, "HP"), |
37 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"), | 37 | DMI_MATCH(DMI_BIOS_VERSION, "P44-"), |
@@ -45,7 +45,7 @@ static struct dmi_system_id __initdata bigsmp_dmi_table[] = { | |||
45 | }; | 45 | }; |
46 | 46 | ||
47 | 47 | ||
48 | static int __init probe_bigsmp(void) | 48 | static int probe_bigsmp(void) |
49 | { | 49 | { |
50 | if (def_to_bigsmp) | 50 | if (def_to_bigsmp) |
51 | dmi_bigsmp = 1; | 51 | dmi_bigsmp = 1; |
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c index 79471f85eb89..3fc13fa8729d 100644 --- a/arch/um/os-Linux/start_up.c +++ b/arch/um/os-Linux/start_up.c | |||
@@ -144,9 +144,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode, | |||
144 | int exit_with = WEXITSTATUS(status); | 144 | int exit_with = WEXITSTATUS(status); |
145 | if (exit_with == 2) | 145 | if (exit_with == 2) |
146 | non_fatal("check_ptrace : child exited with status 2. " | 146 | non_fatal("check_ptrace : child exited with status 2. " |
147 | "Serious trouble happening! Try updating " | 147 | "\nDisabling SYSEMU support.\n"); |
148 | "your host skas patch!\nDisabling SYSEMU " | ||
149 | "support."); | ||
150 | non_fatal("check_ptrace : child exited with exitcode %d, while " | 148 | non_fatal("check_ptrace : child exited with exitcode %d, while " |
151 | "expecting %d; status 0x%x\n", exit_with, | 149 | "expecting %d; status 0x%x\n", exit_with, |
152 | exitcode, status); | 150 | exitcode, status); |
@@ -209,6 +207,7 @@ __uml_setup("nosysemu", nosysemu_cmd_param, | |||
209 | static void __init check_sysemu(void) | 207 | static void __init check_sysemu(void) |
210 | { | 208 | { |
211 | void *stack; | 209 | void *stack; |
210 | unsigned long regs[MAX_REG_NR]; | ||
212 | int pid, n, status, count=0; | 211 | int pid, n, status, count=0; |
213 | 212 | ||
214 | non_fatal("Checking syscall emulation patch for ptrace..."); | 213 | non_fatal("Checking syscall emulation patch for ptrace..."); |
@@ -225,11 +224,20 @@ static void __init check_sysemu(void) | |||
225 | fatal("check_sysemu : expected SIGTRAP, got status = %d", | 224 | fatal("check_sysemu : expected SIGTRAP, got status = %d", |
226 | status); | 225 | status); |
227 | 226 | ||
228 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, | 227 | if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) |
229 | os_getpid()); | 228 | fatal_perror("check_sysemu : PTRACE_GETREGS failed"); |
230 | if(n < 0) | 229 | if(PT_SYSCALL_NR(regs) != __NR_getpid){ |
231 | fatal_perror("check_sysemu : failed to modify system call " | 230 | non_fatal("check_sysemu got system call number %d, " |
232 | "return"); | 231 | "expected %d...", PT_SYSCALL_NR(regs), __NR_getpid); |
232 | goto fail; | ||
233 | } | ||
234 | |||
235 | n = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_RET_OFFSET, os_getpid()); | ||
236 | if(n < 0){ | ||
237 | non_fatal("check_sysemu : failed to modify system call " | ||
238 | "return"); | ||
239 | goto fail; | ||
240 | } | ||
233 | 241 | ||
234 | if (stop_ptraced_child(pid, stack, 0, 0) < 0) | 242 | if (stop_ptraced_child(pid, stack, 0, 0) < 0) |
235 | goto fail_stopped; | 243 | goto fail_stopped; |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 145bb824b2a8..5ce94430c019 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -428,12 +428,15 @@ config NR_CPUS | |||
428 | memory in the static kernel configuration. | 428 | memory in the static kernel configuration. |
429 | 429 | ||
430 | config HOTPLUG_CPU | 430 | config HOTPLUG_CPU |
431 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 431 | bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)" |
432 | depends on SMP && HOTPLUG && EXPERIMENTAL | 432 | depends on SMP && HOTPLUG && EXPERIMENTAL |
433 | help | 433 | help |
434 | Say Y here to experiment with turning CPUs off and on. CPUs | 434 | Say Y here to experiment with turning CPUs off and on. CPUs |
435 | can be controlled through /sys/devices/system/cpu/cpu#. | 435 | can be controlled through /sys/devices/system/cpu/cpu#. |
436 | Say N if you want to disable CPU hotplug. | 436 | This is also required for suspend/hibernation on SMP systems. |
437 | |||
438 | Say N if you want to disable CPU hotplug and don't need to | ||
439 | suspend. | ||
437 | 440 | ||
438 | config ARCH_ENABLE_MEMORY_HOTPLUG | 441 | config ARCH_ENABLE_MEMORY_HOTPLUG |
439 | def_bool y | 442 | def_bool y |
diff --git a/arch/x86_64/kernel/k8.c b/arch/x86_64/kernel/k8.c index bc11b32e8b4d..7377ccb21335 100644 --- a/arch/x86_64/kernel/k8.c +++ b/arch/x86_64/kernel/k8.c | |||
@@ -39,10 +39,10 @@ int cache_k8_northbridges(void) | |||
39 | { | 39 | { |
40 | int i; | 40 | int i; |
41 | struct pci_dev *dev; | 41 | struct pci_dev *dev; |
42 | |||
42 | if (num_k8_northbridges) | 43 | if (num_k8_northbridges) |
43 | return 0; | 44 | return 0; |
44 | 45 | ||
45 | num_k8_northbridges = 0; | ||
46 | dev = NULL; | 46 | dev = NULL; |
47 | while ((dev = next_k8_northbridge(dev)) != NULL) | 47 | while ((dev = next_k8_northbridge(dev)) != NULL) |
48 | num_k8_northbridges++; | 48 | num_k8_northbridges++; |
@@ -52,6 +52,11 @@ int cache_k8_northbridges(void) | |||
52 | if (!k8_northbridges) | 52 | if (!k8_northbridges) |
53 | return -ENOMEM; | 53 | return -ENOMEM; |
54 | 54 | ||
55 | if (!num_k8_northbridges) { | ||
56 | k8_northbridges[0] = NULL; | ||
57 | return 0; | ||
58 | } | ||
59 | |||
55 | flush_words = kmalloc(num_k8_northbridges * sizeof(u32), GFP_KERNEL); | 60 | flush_words = kmalloc(num_k8_northbridges * sizeof(u32), GFP_KERNEL); |
56 | if (!flush_words) { | 61 | if (!flush_words) { |
57 | kfree(k8_northbridges); | 62 | kfree(k8_northbridges); |
diff --git a/block/genhd.c b/block/genhd.c index 93a2cf654597..863a8c0623ed 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -423,7 +423,10 @@ static ssize_t disk_size_read(struct gendisk * disk, char *page) | |||
423 | { | 423 | { |
424 | return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk)); | 424 | return sprintf(page, "%llu\n", (unsigned long long)get_capacity(disk)); |
425 | } | 425 | } |
426 | 426 | static ssize_t disk_capability_read(struct gendisk *disk, char *page) | |
427 | { | ||
428 | return sprintf(page, "%x\n", disk->flags); | ||
429 | } | ||
427 | static ssize_t disk_stats_read(struct gendisk * disk, char *page) | 430 | static ssize_t disk_stats_read(struct gendisk * disk, char *page) |
428 | { | 431 | { |
429 | preempt_disable(); | 432 | preempt_disable(); |
@@ -466,6 +469,10 @@ static struct disk_attribute disk_attr_size = { | |||
466 | .attr = {.name = "size", .mode = S_IRUGO }, | 469 | .attr = {.name = "size", .mode = S_IRUGO }, |
467 | .show = disk_size_read | 470 | .show = disk_size_read |
468 | }; | 471 | }; |
472 | static struct disk_attribute disk_attr_capability = { | ||
473 | .attr = {.name = "capability", .mode = S_IRUGO }, | ||
474 | .show = disk_capability_read | ||
475 | }; | ||
469 | static struct disk_attribute disk_attr_stat = { | 476 | static struct disk_attribute disk_attr_stat = { |
470 | .attr = {.name = "stat", .mode = S_IRUGO }, | 477 | .attr = {.name = "stat", .mode = S_IRUGO }, |
471 | .show = disk_stats_read | 478 | .show = disk_stats_read |
@@ -506,6 +513,7 @@ static struct attribute * default_attrs[] = { | |||
506 | &disk_attr_removable.attr, | 513 | &disk_attr_removable.attr, |
507 | &disk_attr_size.attr, | 514 | &disk_attr_size.attr, |
508 | &disk_attr_stat.attr, | 515 | &disk_attr_stat.attr, |
516 | &disk_attr_capability.attr, | ||
509 | #ifdef CONFIG_FAIL_MAKE_REQUEST | 517 | #ifdef CONFIG_FAIL_MAKE_REQUEST |
510 | &disk_attr_fail.attr, | 518 | &disk_attr_fail.attr, |
511 | #endif | 519 | #endif |
@@ -688,6 +696,27 @@ struct seq_operations diskstats_op = { | |||
688 | .show = diskstats_show | 696 | .show = diskstats_show |
689 | }; | 697 | }; |
690 | 698 | ||
699 | static void media_change_notify_thread(struct work_struct *work) | ||
700 | { | ||
701 | struct gendisk *gd = container_of(work, struct gendisk, async_notify); | ||
702 | char event[] = "MEDIA_CHANGE=1"; | ||
703 | char *envp[] = { event, NULL }; | ||
704 | |||
705 | /* | ||
706 | * set enviroment vars to indicate which event this is for | ||
707 | * so that user space will know to go check the media status. | ||
708 | */ | ||
709 | kobject_uevent_env(&gd->kobj, KOBJ_CHANGE, envp); | ||
710 | put_device(gd->driverfs_dev); | ||
711 | } | ||
712 | |||
713 | void genhd_media_change_notify(struct gendisk *disk) | ||
714 | { | ||
715 | get_device(disk->driverfs_dev); | ||
716 | schedule_work(&disk->async_notify); | ||
717 | } | ||
718 | EXPORT_SYMBOL_GPL(genhd_media_change_notify); | ||
719 | |||
691 | struct gendisk *alloc_disk(int minors) | 720 | struct gendisk *alloc_disk(int minors) |
692 | { | 721 | { |
693 | return alloc_disk_node(minors, -1); | 722 | return alloc_disk_node(minors, -1); |
@@ -717,6 +746,8 @@ struct gendisk *alloc_disk_node(int minors, int node_id) | |||
717 | kobj_set_kset_s(disk,block_subsys); | 746 | kobj_set_kset_s(disk,block_subsys); |
718 | kobject_init(&disk->kobj); | 747 | kobject_init(&disk->kobj); |
719 | rand_initialize_disk(disk); | 748 | rand_initialize_disk(disk); |
749 | INIT_WORK(&disk->async_notify, | ||
750 | media_change_notify_thread); | ||
720 | } | 751 | } |
721 | return disk; | 752 | return disk; |
722 | } | 753 | } |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 3587cb434371..fe088045dd08 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -670,7 +670,7 @@ static void __reschedule_timeout(int drive, const char *message, int marg) | |||
670 | if (drive == current_reqD) | 670 | if (drive == current_reqD) |
671 | drive = current_drive; | 671 | drive = current_drive; |
672 | del_timer(&fd_timeout); | 672 | del_timer(&fd_timeout); |
673 | if (drive < 0 || drive > N_DRIVE) { | 673 | if (drive < 0 || drive >= N_DRIVE) { |
674 | fd_timeout.expires = jiffies + 20UL * HZ; | 674 | fd_timeout.expires = jiffies + 20UL * HZ; |
675 | drive = 0; | 675 | drive = 0; |
676 | } else | 676 | } else |
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index c72ee97d3892..ca376b92162c 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -1061,6 +1061,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, | |||
1061 | 1061 | ||
1062 | if (data & info->ignore_status_mask) { | 1062 | if (data & info->ignore_status_mask) { |
1063 | info->icount.rx++; | 1063 | info->icount.rx++; |
1064 | spin_unlock(&cinfo->card_lock); | ||
1064 | return; | 1065 | return; |
1065 | } | 1066 | } |
1066 | if (tty_buffer_request_room(tty, 1)) { | 1067 | if (tty_buffer_request_room(tty, 1)) { |
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c index 6d3840e629de..6a86958b577f 100644 --- a/drivers/crypto/geode-aes.c +++ b/drivers/crypto/geode-aes.c | |||
@@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op) | |||
102 | u32 flags = 0; | 102 | u32 flags = 0; |
103 | unsigned long iflags; | 103 | unsigned long iflags; |
104 | 104 | ||
105 | if (op->len == 0 || op->src == op->dst) | 105 | if (op->len == 0) |
106 | return 0; | 106 | return 0; |
107 | 107 | ||
108 | if (op->flags & AES_FLAGS_COHERENT) | 108 | /* If the source and destination is the same, then |
109 | * we need to turn on the coherent flags, otherwise | ||
110 | * we don't need to worry | ||
111 | */ | ||
112 | |||
113 | if (op->src == op->dst) | ||
109 | flags |= (AES_CTRL_DCA | AES_CTRL_SCA); | 114 | flags |= (AES_CTRL_DCA | AES_CTRL_SCA); |
110 | 115 | ||
111 | if (op->dir == AES_DIR_ENCRYPT) | 116 | if (op->dir == AES_DIR_ENCRYPT) |
@@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op) | |||
120 | _writefield(AES_WRITEIV0_REG, op->iv); | 125 | _writefield(AES_WRITEIV0_REG, op->iv); |
121 | } | 126 | } |
122 | 127 | ||
123 | if (op->flags & AES_FLAGS_USRKEY) { | 128 | if (!(op->flags & AES_FLAGS_HIDDENKEY)) { |
124 | flags |= AES_CTRL_WRKEY; | 129 | flags |= AES_CTRL_WRKEY; |
125 | _writefield(AES_WRITEKEY0_REG, op->key); | 130 | _writefield(AES_WRITEKEY0_REG, op->key); |
126 | } | 131 | } |
@@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = { | |||
289 | .setkey = geode_setkey, | 294 | .setkey = geode_setkey, |
290 | .encrypt = geode_cbc_encrypt, | 295 | .encrypt = geode_cbc_encrypt, |
291 | .decrypt = geode_cbc_decrypt, | 296 | .decrypt = geode_cbc_decrypt, |
297 | .ivsize = AES_IV_LENGTH, | ||
292 | } | 298 | } |
293 | } | 299 | } |
294 | }; | 300 | }; |
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h index 8003a36f3a83..f47968671ae7 100644 --- a/drivers/crypto/geode-aes.h +++ b/drivers/crypto/geode-aes.h | |||
@@ -20,8 +20,7 @@ | |||
20 | #define AES_DIR_DECRYPT 0 | 20 | #define AES_DIR_DECRYPT 0 |
21 | #define AES_DIR_ENCRYPT 1 | 21 | #define AES_DIR_ENCRYPT 1 |
22 | 22 | ||
23 | #define AES_FLAGS_USRKEY (1 << 0) | 23 | #define AES_FLAGS_HIDDENKEY (1 << 0) |
24 | #define AES_FLAGS_COHERENT (1 << 1) | ||
25 | 24 | ||
26 | struct geode_aes_op { | 25 | struct geode_aes_op { |
27 | 26 | ||
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index 0c160675b3ac..366f4a1a2cb8 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
@@ -491,6 +491,12 @@ out: | |||
491 | 491 | ||
492 | /* Sysfs Files */ | 492 | /* Sysfs Files */ |
493 | 493 | ||
494 | static ssize_t applesmc_name_show(struct device *dev, | ||
495 | struct device_attribute *attr, char *buf) | ||
496 | { | ||
497 | return snprintf(buf, PAGE_SIZE, "applesmc\n"); | ||
498 | } | ||
499 | |||
494 | static ssize_t applesmc_position_show(struct device *dev, | 500 | static ssize_t applesmc_position_show(struct device *dev, |
495 | struct device_attribute *attr, char *buf) | 501 | struct device_attribute *attr, char *buf) |
496 | { | 502 | { |
@@ -913,6 +919,8 @@ static struct led_classdev applesmc_backlight = { | |||
913 | .brightness_set = applesmc_brightness_set, | 919 | .brightness_set = applesmc_brightness_set, |
914 | }; | 920 | }; |
915 | 921 | ||
922 | static DEVICE_ATTR(name, 0444, applesmc_name_show, NULL); | ||
923 | |||
916 | static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL); | 924 | static DEVICE_ATTR(position, 0444, applesmc_position_show, NULL); |
917 | static DEVICE_ATTR(calibrate, 0644, | 925 | static DEVICE_ATTR(calibrate, 0644, |
918 | applesmc_calibrate_show, applesmc_calibrate_store); | 926 | applesmc_calibrate_show, applesmc_calibrate_store); |
@@ -1197,6 +1205,8 @@ static int __init applesmc_init(void) | |||
1197 | goto out_driver; | 1205 | goto out_driver; |
1198 | } | 1206 | } |
1199 | 1207 | ||
1208 | ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_name.attr); | ||
1209 | |||
1200 | /* Create key enumeration sysfs files */ | 1210 | /* Create key enumeration sysfs files */ |
1201 | ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); | 1211 | ret = sysfs_create_group(&pdev->dev.kobj, &key_enumeration_group); |
1202 | if (ret) | 1212 | if (ret) |
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c index ff284aeb8fbb..82edc1c1db7a 100644 --- a/drivers/isdn/hardware/eicon/capifunc.c +++ b/drivers/isdn/hardware/eicon/capifunc.c | |||
@@ -189,21 +189,21 @@ void *TransmitBufferSet(APPL * appl, dword ref) | |||
189 | { | 189 | { |
190 | appl->xbuffer_used[ref] = true; | 190 | appl->xbuffer_used[ref] = true; |
191 | DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1)) | 191 | DBG_PRV1(("%d:xbuf_used(%d)", appl->Id, ref + 1)) |
192 | return (void *) ref; | 192 | return (void *)(long)ref; |
193 | } | 193 | } |
194 | 194 | ||
195 | void *TransmitBufferGet(APPL * appl, void *p) | 195 | void *TransmitBufferGet(APPL * appl, void *p) |
196 | { | 196 | { |
197 | if (appl->xbuffer_internal[(dword) p]) | 197 | if (appl->xbuffer_internal[(dword)(long)p]) |
198 | return appl->xbuffer_internal[(dword) p]; | 198 | return appl->xbuffer_internal[(dword)(long)p]; |
199 | 199 | ||
200 | return appl->xbuffer_ptr[(dword) p]; | 200 | return appl->xbuffer_ptr[(dword)(long)p]; |
201 | } | 201 | } |
202 | 202 | ||
203 | void TransmitBufferFree(APPL * appl, void *p) | 203 | void TransmitBufferFree(APPL * appl, void *p) |
204 | { | 204 | { |
205 | appl->xbuffer_used[(dword) p] = false; | 205 | appl->xbuffer_used[(dword)(long)p] = false; |
206 | DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword) p) + 1)) | 206 | DBG_PRV1(("%d:xbuf_free(%d)", appl->Id, ((dword)(long)p) + 1)) |
207 | } | 207 | } |
208 | 208 | ||
209 | void *ReceiveBufferGet(APPL * appl, int Num) | 209 | void *ReceiveBufferGet(APPL * appl, int Num) |
@@ -301,7 +301,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...) | |||
301 | /* if DATA_B3_IND, copy data too */ | 301 | /* if DATA_B3_IND, copy data too */ |
302 | if (command == _DATA_B3_I) { | 302 | if (command == _DATA_B3_I) { |
303 | dword data = GET_DWORD(&msg.info.data_b3_ind.Data); | 303 | dword data = GET_DWORD(&msg.info.data_b3_ind.Data); |
304 | memcpy(write + length, (void *) data, dlength); | 304 | memcpy(write + length, (void *)(long)data, dlength); |
305 | } | 305 | } |
306 | 306 | ||
307 | #ifndef DIVA_NO_DEBUGLIB | 307 | #ifndef DIVA_NO_DEBUGLIB |
@@ -318,7 +318,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...) | |||
318 | if (myDriverDebugHandle.dbgMask & DL_BLK) { | 318 | if (myDriverDebugHandle.dbgMask & DL_BLK) { |
319 | xlog("\x00\x02", &msg, 0x81, length); | 319 | xlog("\x00\x02", &msg, 0x81, length); |
320 | for (i = 0; i < dlength; i += 256) { | 320 | for (i = 0; i < dlength; i += 256) { |
321 | DBG_BLK((((char *) GET_DWORD(&msg.info.data_b3_ind.Data)) + i, | 321 | DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i, |
322 | ((dlength - i) < 256) ? (dlength - i) : 256)) | 322 | ((dlength - i) < 256) ? (dlength - i) : 256)) |
323 | if (!(myDriverDebugHandle.dbgMask & DL_PRV0)) | 323 | if (!(myDriverDebugHandle.dbgMask & DL_PRV0)) |
324 | break; /* not more if not explicitely requested */ | 324 | break; /* not more if not explicitely requested */ |
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c index 784232a144c8..ccd35d047ec8 100644 --- a/drivers/isdn/hardware/eicon/message.c +++ b/drivers/isdn/hardware/eicon/message.c | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | * | 2 | * |
4 | Copyright (c) Eicon Networks, 2002. | 3 | Copyright (c) Eicon Networks, 2002. |
@@ -533,7 +532,7 @@ word api_put(APPL * appl, CAPI_MSG * msg) | |||
533 | if (m->header.command == _DATA_B3_R) | 532 | if (m->header.command == _DATA_B3_R) |
534 | { | 533 | { |
535 | 534 | ||
536 | m->info.data_b3_req.Data = (dword)(TransmitBufferSet (appl, m->info.data_b3_req.Data)); | 535 | m->info.data_b3_req.Data = (dword)(long)(TransmitBufferSet (appl, m->info.data_b3_req.Data)); |
537 | 536 | ||
538 | } | 537 | } |
539 | 538 | ||
@@ -1032,7 +1031,7 @@ static void plci_free_msg_in_queue (PLCI *plci) | |||
1032 | { | 1031 | { |
1033 | 1032 | ||
1034 | TransmitBufferFree (plci->appl, | 1033 | TransmitBufferFree (plci->appl, |
1035 | (byte *)(((CAPI_MSG *)(&((byte *)(plci->msg_in_queue))[i]))->info.data_b3_req.Data)); | 1034 | (byte *)(long)(((CAPI_MSG *)(&((byte *)(plci->msg_in_queue))[i]))->info.data_b3_req.Data)); |
1036 | 1035 | ||
1037 | } | 1036 | } |
1038 | 1037 | ||
@@ -3118,7 +3117,7 @@ byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci, | |||
3118 | && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) | 3117 | && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) |
3119 | { | 3118 | { |
3120 | 3119 | ||
3121 | data->P = (byte *)(*((dword *)(parms[0].info))); | 3120 | data->P = (byte *)(long)(*((dword *)(parms[0].info))); |
3122 | 3121 | ||
3123 | } | 3122 | } |
3124 | else | 3123 | else |
@@ -3151,7 +3150,7 @@ byte data_b3_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci, | |||
3151 | && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) | 3150 | && (((byte *)(parms[0].info)) < ((byte *)(plci->msg_in_queue)) + sizeof(plci->msg_in_queue))) |
3152 | { | 3151 | { |
3153 | 3152 | ||
3154 | TransmitBufferFree (appl, (byte *)(*((dword *)(parms[0].info)))); | 3153 | TransmitBufferFree (appl, (byte *)(long)(*((dword *)(parms[0].info)))); |
3155 | 3154 | ||
3156 | } | 3155 | } |
3157 | } | 3156 | } |
@@ -4057,7 +4056,7 @@ capi_callback_suffix: | |||
4057 | { | 4056 | { |
4058 | if (m->header.command == _DATA_B3_R) | 4057 | if (m->header.command == _DATA_B3_R) |
4059 | 4058 | ||
4060 | TransmitBufferFree (appl, (byte *)(m->info.data_b3_req.Data)); | 4059 | TransmitBufferFree (appl, (byte *)(long)(m->info.data_b3_req.Data)); |
4061 | 4060 | ||
4062 | dbug(1,dprintf("Error 0x%04x from msg(0x%04x)", i, m->header.command)); | 4061 | dbug(1,dprintf("Error 0x%04x from msg(0x%04x)", i, m->header.command)); |
4063 | break; | 4062 | break; |
@@ -7134,7 +7133,7 @@ void nl_ind(PLCI * plci) | |||
7134 | case N_UDATA: | 7133 | case N_UDATA: |
7135 | if (!(udata_forwarding_table[plci->NL.RBuffer->P[0] >> 5] & (1L << (plci->NL.RBuffer->P[0] & 0x1f)))) | 7134 | if (!(udata_forwarding_table[plci->NL.RBuffer->P[0] >> 5] & (1L << (plci->NL.RBuffer->P[0] & 0x1f)))) |
7136 | { | 7135 | { |
7137 | plci->RData[0].P = plci->internal_ind_buffer + (-((int)(plci->internal_ind_buffer)) & 3); | 7136 | plci->RData[0].P = plci->internal_ind_buffer + (-((int)(long)(plci->internal_ind_buffer)) & 3); |
7138 | plci->RData[0].PLength = INTERNAL_IND_BUFFER_SIZE; | 7137 | plci->RData[0].PLength = INTERNAL_IND_BUFFER_SIZE; |
7139 | plci->NL.R = plci->RData; | 7138 | plci->NL.R = plci->RData; |
7140 | plci->NL.RNum = 1; | 7139 | plci->NL.RNum = 1; |
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c index da4196f21e0f..8d53a7fd2671 100644 --- a/drivers/isdn/hisax/config.c +++ b/drivers/isdn/hisax/config.c | |||
@@ -1551,7 +1551,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[], | |||
1551 | if (retval == 0) { // yuck | 1551 | if (retval == 0) { // yuck |
1552 | cards[i].typ = 0; | 1552 | cards[i].typ = 0; |
1553 | nrcards--; | 1553 | nrcards--; |
1554 | return retval; | 1554 | return -EINVAL; |
1555 | } | 1555 | } |
1556 | cs = cards[i].cs; | 1556 | cs = cards[i].cs; |
1557 | hisax_d_if->cs = cs; | 1557 | hisax_d_if->cs = cs; |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 1f18f1993387..b1a26e02df02 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
@@ -485,7 +485,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, | |||
485 | { | 485 | { |
486 | int k; | 486 | int k; |
487 | 487 | ||
488 | spin_lock_init(&urb->lock); | ||
489 | urb->dev = dev; | 488 | urb->dev = dev; |
490 | urb->pipe = pipe; | 489 | urb->pipe = pipe; |
491 | urb->complete = complete; | 490 | urb->complete = complete; |
@@ -578,16 +577,14 @@ stop_isoc_chain(usb_fifo * fifo) | |||
578 | "HFC-S USB: Stopping iso chain for fifo %i.%i", | 577 | "HFC-S USB: Stopping iso chain for fifo %i.%i", |
579 | fifo->fifonum, i); | 578 | fifo->fifonum, i); |
580 | #endif | 579 | #endif |
581 | usb_unlink_urb(fifo->iso[i].purb); | 580 | usb_kill_urb(fifo->iso[i].purb); |
582 | usb_free_urb(fifo->iso[i].purb); | 581 | usb_free_urb(fifo->iso[i].purb); |
583 | fifo->iso[i].purb = NULL; | 582 | fifo->iso[i].purb = NULL; |
584 | } | 583 | } |
585 | } | 584 | } |
586 | if (fifo->urb) { | 585 | usb_kill_urb(fifo->urb); |
587 | usb_unlink_urb(fifo->urb); | 586 | usb_free_urb(fifo->urb); |
588 | usb_free_urb(fifo->urb); | 587 | fifo->urb = NULL; |
589 | fifo->urb = NULL; | ||
590 | } | ||
591 | fifo->active = 0; | 588 | fifo->active = 0; |
592 | } | 589 | } |
593 | 590 | ||
@@ -1305,7 +1302,11 @@ usb_init(hfcusb_data * hfc) | |||
1305 | } | 1302 | } |
1306 | /* default Prot: EURO ISDN, should be a module_param */ | 1303 | /* default Prot: EURO ISDN, should be a module_param */ |
1307 | hfc->protocol = 2; | 1304 | hfc->protocol = 2; |
1308 | hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); | 1305 | i = hisax_register(&hfc->d_if, p_b_if, "hfc_usb", hfc->protocol); |
1306 | if (i) { | ||
1307 | printk(KERN_INFO "HFC-S USB: hisax_register -> %d\n", i); | ||
1308 | return i; | ||
1309 | } | ||
1309 | 1310 | ||
1310 | #ifdef CONFIG_HISAX_DEBUG | 1311 | #ifdef CONFIG_HISAX_DEBUG |
1311 | hfc_debug = debug; | 1312 | hfc_debug = debug; |
@@ -1626,11 +1627,9 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
1626 | #endif | 1627 | #endif |
1627 | /* init the chip and register the driver */ | 1628 | /* init the chip and register the driver */ |
1628 | if (usb_init(context)) { | 1629 | if (usb_init(context)) { |
1629 | if (context->ctrl_urb) { | 1630 | usb_kill_urb(context->ctrl_urb); |
1630 | usb_unlink_urb(context->ctrl_urb); | 1631 | usb_free_urb(context->ctrl_urb); |
1631 | usb_free_urb(context->ctrl_urb); | 1632 | context->ctrl_urb = NULL; |
1632 | context->ctrl_urb = NULL; | ||
1633 | } | ||
1634 | kfree(context); | 1633 | kfree(context); |
1635 | return (-EIO); | 1634 | return (-EIO); |
1636 | } | 1635 | } |
@@ -1682,21 +1681,15 @@ hfc_usb_disconnect(struct usb_interface | |||
1682 | i); | 1681 | i); |
1683 | #endif | 1682 | #endif |
1684 | } | 1683 | } |
1685 | if (context->fifos[i].urb) { | 1684 | usb_kill_urb(context->fifos[i].urb); |
1686 | usb_unlink_urb(context->fifos[i].urb); | 1685 | usb_free_urb(context->fifos[i].urb); |
1687 | usb_free_urb(context->fifos[i].urb); | 1686 | context->fifos[i].urb = NULL; |
1688 | context->fifos[i].urb = NULL; | ||
1689 | } | ||
1690 | } | 1687 | } |
1691 | context->fifos[i].active = 0; | 1688 | context->fifos[i].active = 0; |
1692 | } | 1689 | } |
1693 | /* wait for all URBS to terminate */ | 1690 | usb_kill_urb(context->ctrl_urb); |
1694 | mdelay(10); | 1691 | usb_free_urb(context->ctrl_urb); |
1695 | if (context->ctrl_urb) { | 1692 | context->ctrl_urb = NULL; |
1696 | usb_unlink_urb(context->ctrl_urb); | ||
1697 | usb_free_urb(context->ctrl_urb); | ||
1698 | context->ctrl_urb = NULL; | ||
1699 | } | ||
1700 | hisax_unregister(&context->d_if); | 1693 | hisax_unregister(&context->d_if); |
1701 | kfree(context); /* free our structure again */ | 1694 | kfree(context); /* free our structure again */ |
1702 | } /* hfc_usb_disconnect */ | 1695 | } /* hfc_usb_disconnect */ |
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c index 9e088fce8c3a..7993e01f9fc5 100644 --- a/drivers/isdn/hisax/hisax_fcpcipnp.c +++ b/drivers/isdn/hisax/hisax_fcpcipnp.c | |||
@@ -859,7 +859,11 @@ new_adapter(void) | |||
859 | for (i = 0; i < 2; i++) | 859 | for (i = 0; i < 2; i++) |
860 | b_if[i] = &adapter->bcs[i].b_if; | 860 | b_if[i] = &adapter->bcs[i].b_if; |
861 | 861 | ||
862 | hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp", protocol); | 862 | if (hisax_register(&adapter->isac.hisax_d_if, b_if, "fcpcipnp", |
863 | protocol) != 0) { | ||
864 | kfree(adapter); | ||
865 | adapter = NULL; | ||
866 | } | ||
863 | 867 | ||
864 | return adapter; | 868 | return adapter; |
865 | } | 869 | } |
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c index bb3a28a53ff4..13751237bfcd 100644 --- a/drivers/isdn/hisax/st5481_init.c +++ b/drivers/isdn/hisax/st5481_init.c | |||
@@ -107,12 +107,17 @@ static int probe_st5481(struct usb_interface *intf, | |||
107 | for (i = 0; i < 2; i++) | 107 | for (i = 0; i < 2; i++) |
108 | b_if[i] = &adapter->bcs[i].b_if; | 108 | b_if[i] = &adapter->bcs[i].b_if; |
109 | 109 | ||
110 | hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", protocol); | 110 | if (hisax_register(&adapter->hisax_d_if, b_if, "st5481_usb", |
111 | protocol) != 0) | ||
112 | goto err_b1; | ||
113 | |||
111 | st5481_start(adapter); | 114 | st5481_start(adapter); |
112 | 115 | ||
113 | usb_set_intfdata(intf, adapter); | 116 | usb_set_intfdata(intf, adapter); |
114 | return 0; | 117 | return 0; |
115 | 118 | ||
119 | err_b1: | ||
120 | st5481_release_b(&adapter->bcs[1]); | ||
116 | err_b: | 121 | err_b: |
117 | st5481_release_b(&adapter->bcs[0]); | 122 | st5481_release_b(&adapter->bcs[0]); |
118 | err_d: | 123 | err_d: |
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c index ff1595122048..4ada66b8b679 100644 --- a/drivers/isdn/hisax/st5481_usb.c +++ b/drivers/isdn/hisax/st5481_usb.c | |||
@@ -407,7 +407,6 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, | |||
407 | { | 407 | { |
408 | int k; | 408 | int k; |
409 | 409 | ||
410 | spin_lock_init(&urb->lock); | ||
411 | urb->dev=dev; | 410 | urb->dev=dev; |
412 | urb->pipe=pipe; | 411 | urb->pipe=pipe; |
413 | urb->interval = 1; | 412 | urb->interval = 1; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 5a4a74c1097c..9620d452d030 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -255,19 +255,25 @@ static struct page *read_sb_page(mddev_t *mddev, long offset, unsigned long inde | |||
255 | 255 | ||
256 | } | 256 | } |
257 | 257 | ||
258 | static int write_sb_page(mddev_t *mddev, long offset, struct page *page, int wait) | 258 | static int write_sb_page(struct bitmap *bitmap, struct page *page, int wait) |
259 | { | 259 | { |
260 | mdk_rdev_t *rdev; | 260 | mdk_rdev_t *rdev; |
261 | struct list_head *tmp; | 261 | struct list_head *tmp; |
262 | mddev_t *mddev = bitmap->mddev; | ||
262 | 263 | ||
263 | ITERATE_RDEV(mddev, rdev, tmp) | 264 | ITERATE_RDEV(mddev, rdev, tmp) |
264 | if (test_bit(In_sync, &rdev->flags) | 265 | if (test_bit(In_sync, &rdev->flags) |
265 | && !test_bit(Faulty, &rdev->flags)) | 266 | && !test_bit(Faulty, &rdev->flags)) { |
267 | int size = PAGE_SIZE; | ||
268 | if (page->index == bitmap->file_pages-1) | ||
269 | size = roundup(bitmap->last_page_size, | ||
270 | bdev_hardsect_size(rdev->bdev)); | ||
266 | md_super_write(mddev, rdev, | 271 | md_super_write(mddev, rdev, |
267 | (rdev->sb_offset<<1) + offset | 272 | (rdev->sb_offset<<1) + bitmap->offset |
268 | + page->index * (PAGE_SIZE/512), | 273 | + page->index * (PAGE_SIZE/512), |
269 | PAGE_SIZE, | 274 | size, |
270 | page); | 275 | page); |
276 | } | ||
271 | 277 | ||
272 | if (wait) | 278 | if (wait) |
273 | md_super_wait(mddev); | 279 | md_super_wait(mddev); |
@@ -282,7 +288,7 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait) | |||
282 | struct buffer_head *bh; | 288 | struct buffer_head *bh; |
283 | 289 | ||
284 | if (bitmap->file == NULL) | 290 | if (bitmap->file == NULL) |
285 | return write_sb_page(bitmap->mddev, bitmap->offset, page, wait); | 291 | return write_sb_page(bitmap, page, wait); |
286 | 292 | ||
287 | bh = page_buffers(page); | 293 | bh = page_buffers(page); |
288 | 294 | ||
@@ -923,6 +929,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
923 | } | 929 | } |
924 | 930 | ||
925 | bitmap->filemap[bitmap->file_pages++] = page; | 931 | bitmap->filemap[bitmap->file_pages++] = page; |
932 | bitmap->last_page_size = count; | ||
926 | } | 933 | } |
927 | paddr = kmap_atomic(page, KM_USER0); | 934 | paddr = kmap_atomic(page, KM_USER0); |
928 | if (bitmap->flags & BITMAP_HOSTENDIAN) | 935 | if (bitmap->flags & BITMAP_HOSTENDIAN) |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index d5ecd2d53046..192741083196 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -139,8 +139,6 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
139 | if (!conf) | 139 | if (!conf) |
140 | return NULL; | 140 | return NULL; |
141 | 141 | ||
142 | mddev->private = conf; | ||
143 | |||
144 | cnt = 0; | 142 | cnt = 0; |
145 | conf->array_size = 0; | 143 | conf->array_size = 0; |
146 | 144 | ||
@@ -232,7 +230,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
232 | * First calculate the device offsets. | 230 | * First calculate the device offsets. |
233 | */ | 231 | */ |
234 | conf->disks[0].offset = 0; | 232 | conf->disks[0].offset = 0; |
235 | for (i=1; i<mddev->raid_disks; i++) | 233 | for (i = 1; i < raid_disks; i++) |
236 | conf->disks[i].offset = | 234 | conf->disks[i].offset = |
237 | conf->disks[i-1].offset + | 235 | conf->disks[i-1].offset + |
238 | conf->disks[i-1].size; | 236 | conf->disks[i-1].size; |
@@ -244,7 +242,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
244 | curr_offset < conf->array_size; | 242 | curr_offset < conf->array_size; |
245 | curr_offset += conf->hash_spacing) { | 243 | curr_offset += conf->hash_spacing) { |
246 | 244 | ||
247 | while (i < mddev->raid_disks-1 && | 245 | while (i < raid_disks-1 && |
248 | curr_offset >= conf->disks[i+1].offset) | 246 | curr_offset >= conf->disks[i+1].offset) |
249 | i++; | 247 | i++; |
250 | 248 | ||
@@ -299,9 +297,11 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev) | |||
299 | */ | 297 | */ |
300 | linear_conf_t *newconf; | 298 | linear_conf_t *newconf; |
301 | 299 | ||
302 | if (rdev->raid_disk != mddev->raid_disks) | 300 | if (rdev->saved_raid_disk != mddev->raid_disks) |
303 | return -EINVAL; | 301 | return -EINVAL; |
304 | 302 | ||
303 | rdev->raid_disk = rdev->saved_raid_disk; | ||
304 | |||
305 | newconf = linear_conf(mddev,mddev->raid_disks+1); | 305 | newconf = linear_conf(mddev,mddev->raid_disks+1); |
306 | 306 | ||
307 | if (!newconf) | 307 | if (!newconf) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index c10ce91b64e9..1c54f3c1cca7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1298,8 +1298,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1298 | ITERATE_RDEV(mddev,rdev2,tmp) | 1298 | ITERATE_RDEV(mddev,rdev2,tmp) |
1299 | if (rdev2->desc_nr+1 > max_dev) | 1299 | if (rdev2->desc_nr+1 > max_dev) |
1300 | max_dev = rdev2->desc_nr+1; | 1300 | max_dev = rdev2->desc_nr+1; |
1301 | 1301 | ||
1302 | sb->max_dev = cpu_to_le32(max_dev); | 1302 | if (max_dev > le32_to_cpu(sb->max_dev)) |
1303 | sb->max_dev = cpu_to_le32(max_dev); | ||
1303 | for (i=0; i<max_dev;i++) | 1304 | for (i=0; i<max_dev;i++) |
1304 | sb->dev_roles[i] = cpu_to_le16(0xfffe); | 1305 | sb->dev_roles[i] = cpu_to_le16(0xfffe); |
1305 | 1306 | ||
@@ -1365,10 +1366,14 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1365 | } | 1366 | } |
1366 | /* make sure rdev->size exceeds mddev->size */ | 1367 | /* make sure rdev->size exceeds mddev->size */ |
1367 | if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) { | 1368 | if (rdev->size && (mddev->size == 0 || rdev->size < mddev->size)) { |
1368 | if (mddev->pers) | 1369 | if (mddev->pers) { |
1369 | /* Cannot change size, so fail */ | 1370 | /* Cannot change size, so fail |
1370 | return -ENOSPC; | 1371 | * If mddev->level <= 0, then we don't care |
1371 | else | 1372 | * about aligning sizes (e.g. linear) |
1373 | */ | ||
1374 | if (mddev->level > 0) | ||
1375 | return -ENOSPC; | ||
1376 | } else | ||
1372 | mddev->size = rdev->size; | 1377 | mddev->size = rdev->size; |
1373 | } | 1378 | } |
1374 | 1379 | ||
@@ -2142,6 +2147,9 @@ static void analyze_sbs(mddev_t * mddev) | |||
2142 | rdev->desc_nr = i++; | 2147 | rdev->desc_nr = i++; |
2143 | rdev->raid_disk = rdev->desc_nr; | 2148 | rdev->raid_disk = rdev->desc_nr; |
2144 | set_bit(In_sync, &rdev->flags); | 2149 | set_bit(In_sync, &rdev->flags); |
2150 | } else if (rdev->raid_disk >= mddev->raid_disks) { | ||
2151 | rdev->raid_disk = -1; | ||
2152 | clear_bit(In_sync, &rdev->flags); | ||
2145 | } | 2153 | } |
2146 | } | 2154 | } |
2147 | 2155 | ||
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index dfe32149ad3a..2c404f73a377 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -415,7 +415,7 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio) | |||
415 | raid0_conf_t *conf = mddev_to_conf(mddev); | 415 | raid0_conf_t *conf = mddev_to_conf(mddev); |
416 | struct strip_zone *zone; | 416 | struct strip_zone *zone; |
417 | mdk_rdev_t *tmp_dev; | 417 | mdk_rdev_t *tmp_dev; |
418 | unsigned long chunk; | 418 | sector_t chunk; |
419 | sector_t block, rsect; | 419 | sector_t block, rsect; |
420 | const int rw = bio_data_dir(bio); | 420 | const int rw = bio_data_dir(bio); |
421 | 421 | ||
@@ -470,7 +470,6 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio) | |||
470 | 470 | ||
471 | sector_div(x, zone->nb_dev); | 471 | sector_div(x, zone->nb_dev); |
472 | chunk = x; | 472 | chunk = x; |
473 | BUG_ON(x != (sector_t)chunk); | ||
474 | 473 | ||
475 | x = block >> chunksize_bits; | 474 | x = block >> chunksize_bits; |
476 | tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; | 475 | tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; |
diff --git a/drivers/message/i2o/driver.c b/drivers/message/i2o/driver.c index d3235f213c89..e0d474b17433 100644 --- a/drivers/message/i2o/driver.c +++ b/drivers/message/i2o/driver.c | |||
@@ -123,8 +123,12 @@ int i2o_driver_register(struct i2o_driver *drv) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | rc = driver_register(&drv->driver); | 125 | rc = driver_register(&drv->driver); |
126 | if (rc) | 126 | if (rc) { |
127 | destroy_workqueue(drv->event_queue); | 127 | if (drv->event) { |
128 | destroy_workqueue(drv->event_queue); | ||
129 | drv->event_queue = NULL; | ||
130 | } | ||
131 | } | ||
128 | 132 | ||
129 | return rc; | 133 | return rc; |
130 | }; | 134 | }; |
@@ -256,7 +260,7 @@ void i2o_driver_notify_controller_add_all(struct i2o_controller *c) | |||
256 | int i; | 260 | int i; |
257 | struct i2o_driver *drv; | 261 | struct i2o_driver *drv; |
258 | 262 | ||
259 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 263 | for (i = 0; i < i2o_max_drivers; i++) { |
260 | drv = i2o_drivers[i]; | 264 | drv = i2o_drivers[i]; |
261 | 265 | ||
262 | if (drv) | 266 | if (drv) |
@@ -276,7 +280,7 @@ void i2o_driver_notify_controller_remove_all(struct i2o_controller *c) | |||
276 | int i; | 280 | int i; |
277 | struct i2o_driver *drv; | 281 | struct i2o_driver *drv; |
278 | 282 | ||
279 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 283 | for (i = 0; i < i2o_max_drivers; i++) { |
280 | drv = i2o_drivers[i]; | 284 | drv = i2o_drivers[i]; |
281 | 285 | ||
282 | if (drv) | 286 | if (drv) |
@@ -295,7 +299,7 @@ void i2o_driver_notify_device_add_all(struct i2o_device *i2o_dev) | |||
295 | int i; | 299 | int i; |
296 | struct i2o_driver *drv; | 300 | struct i2o_driver *drv; |
297 | 301 | ||
298 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 302 | for (i = 0; i < i2o_max_drivers; i++) { |
299 | drv = i2o_drivers[i]; | 303 | drv = i2o_drivers[i]; |
300 | 304 | ||
301 | if (drv) | 305 | if (drv) |
@@ -314,7 +318,7 @@ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev) | |||
314 | int i; | 318 | int i; |
315 | struct i2o_driver *drv; | 319 | struct i2o_driver *drv; |
316 | 320 | ||
317 | for (i = 0; i < I2O_MAX_DRIVERS; i++) { | 321 | for (i = 0; i < i2o_max_drivers; i++) { |
318 | drv = i2o_drivers[i]; | 322 | drv = i2o_drivers[i]; |
319 | 323 | ||
320 | if (drv) | 324 | if (drv) |
@@ -335,17 +339,15 @@ int __init i2o_driver_init(void) | |||
335 | 339 | ||
336 | spin_lock_init(&i2o_drivers_lock); | 340 | spin_lock_init(&i2o_drivers_lock); |
337 | 341 | ||
338 | if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64) || | 342 | if ((i2o_max_drivers < 2) || (i2o_max_drivers > 64)) { |
339 | ((i2o_max_drivers ^ (i2o_max_drivers - 1)) != | 343 | osm_warn("max_drivers set to %d, but must be >=2 and <= 64\n", |
340 | (2 * i2o_max_drivers - 1))) { | 344 | i2o_max_drivers); |
341 | osm_warn("max_drivers set to %d, but must be >=2 and <= 64 and " | ||
342 | "a power of 2\n", i2o_max_drivers); | ||
343 | i2o_max_drivers = I2O_MAX_DRIVERS; | 345 | i2o_max_drivers = I2O_MAX_DRIVERS; |
344 | } | 346 | } |
345 | osm_info("max drivers = %d\n", i2o_max_drivers); | 347 | osm_info("max drivers = %d\n", i2o_max_drivers); |
346 | 348 | ||
347 | i2o_drivers = | 349 | i2o_drivers = |
348 | kzalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); | 350 | kcalloc(i2o_max_drivers, sizeof(*i2o_drivers), GFP_KERNEL); |
349 | if (!i2o_drivers) | 351 | if (!i2o_drivers) |
350 | return -ENOMEM; | 352 | return -ENOMEM; |
351 | 353 | ||
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index 35b139b0e5f2..5108b7c576df 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
@@ -47,6 +47,7 @@ struct phantom_device { | |||
47 | struct cdev cdev; | 47 | struct cdev cdev; |
48 | 48 | ||
49 | struct mutex open_lock; | 49 | struct mutex open_lock; |
50 | spinlock_t ioctl_lock; | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | static unsigned char phantom_devices[PHANTOM_MAX_MINORS]; | 53 | static unsigned char phantom_devices[PHANTOM_MAX_MINORS]; |
@@ -59,8 +60,11 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat) | |||
59 | atomic_set(&dev->counter, 0); | 60 | atomic_set(&dev->counter, 0); |
60 | iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL); | 61 | iowrite32(PHN_CTL_IRQ, dev->iaddr + PHN_CONTROL); |
61 | iowrite32(0x43, dev->caddr + PHN_IRQCTL); | 62 | iowrite32(0x43, dev->caddr + PHN_IRQCTL); |
62 | } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) | 63 | ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */ |
64 | } else if ((dev->status & PHB_RUNNING) && !(newstat & PHB_RUNNING)) { | ||
63 | iowrite32(0, dev->caddr + PHN_IRQCTL); | 65 | iowrite32(0, dev->caddr + PHN_IRQCTL); |
66 | ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */ | ||
67 | } | ||
64 | 68 | ||
65 | dev->status = newstat; | 69 | dev->status = newstat; |
66 | 70 | ||
@@ -71,8 +75,8 @@ static int phantom_status(struct phantom_device *dev, unsigned long newstat) | |||
71 | * File ops | 75 | * File ops |
72 | */ | 76 | */ |
73 | 77 | ||
74 | static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd, | 78 | static long phantom_ioctl(struct file *file, unsigned int cmd, |
75 | u_long arg) | 79 | unsigned long arg) |
76 | { | 80 | { |
77 | struct phantom_device *dev = file->private_data; | 81 | struct phantom_device *dev = file->private_data; |
78 | struct phm_regs rs; | 82 | struct phm_regs rs; |
@@ -92,24 +96,32 @@ static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd, | |||
92 | if (r.reg > 7) | 96 | if (r.reg > 7) |
93 | return -EINVAL; | 97 | return -EINVAL; |
94 | 98 | ||
99 | spin_lock(&dev->ioctl_lock); | ||
95 | if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) && | 100 | if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) && |
96 | phantom_status(dev, dev->status | PHB_RUNNING)) | 101 | phantom_status(dev, dev->status | PHB_RUNNING)){ |
102 | spin_unlock(&dev->ioctl_lock); | ||
97 | return -ENODEV; | 103 | return -ENODEV; |
104 | } | ||
98 | 105 | ||
99 | pr_debug("phantom: writing %x to %u\n", r.value, r.reg); | 106 | pr_debug("phantom: writing %x to %u\n", r.value, r.reg); |
100 | iowrite32(r.value, dev->iaddr + r.reg); | 107 | iowrite32(r.value, dev->iaddr + r.reg); |
108 | ioread32(dev->iaddr); /* PCI posting */ | ||
101 | 109 | ||
102 | if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) | 110 | if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) |
103 | phantom_status(dev, dev->status & ~PHB_RUNNING); | 111 | phantom_status(dev, dev->status & ~PHB_RUNNING); |
112 | spin_unlock(&dev->ioctl_lock); | ||
104 | break; | 113 | break; |
105 | case PHN_SET_REGS: | 114 | case PHN_SET_REGS: |
106 | if (copy_from_user(&rs, argp, sizeof(rs))) | 115 | if (copy_from_user(&rs, argp, sizeof(rs))) |
107 | return -EFAULT; | 116 | return -EFAULT; |
108 | 117 | ||
109 | pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask); | 118 | pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask); |
119 | spin_lock(&dev->ioctl_lock); | ||
110 | for (i = 0; i < min(rs.count, 8U); i++) | 120 | for (i = 0; i < min(rs.count, 8U); i++) |
111 | if ((1 << i) & rs.mask) | 121 | if ((1 << i) & rs.mask) |
112 | iowrite32(rs.values[i], dev->oaddr + i); | 122 | iowrite32(rs.values[i], dev->oaddr + i); |
123 | ioread32(dev->iaddr); /* PCI posting */ | ||
124 | spin_unlock(&dev->ioctl_lock); | ||
113 | break; | 125 | break; |
114 | case PHN_GET_REG: | 126 | case PHN_GET_REG: |
115 | if (copy_from_user(&r, argp, sizeof(r))) | 127 | if (copy_from_user(&r, argp, sizeof(r))) |
@@ -128,9 +140,11 @@ static int phantom_ioctl(struct inode *inode, struct file *file, u_int cmd, | |||
128 | return -EFAULT; | 140 | return -EFAULT; |
129 | 141 | ||
130 | pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask); | 142 | pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask); |
143 | spin_lock(&dev->ioctl_lock); | ||
131 | for (i = 0; i < min(rs.count, 8U); i++) | 144 | for (i = 0; i < min(rs.count, 8U); i++) |
132 | if ((1 << i) & rs.mask) | 145 | if ((1 << i) & rs.mask) |
133 | rs.values[i] = ioread32(dev->iaddr + i); | 146 | rs.values[i] = ioread32(dev->iaddr + i); |
147 | spin_unlock(&dev->ioctl_lock); | ||
134 | 148 | ||
135 | if (copy_to_user(argp, &rs, sizeof(rs))) | 149 | if (copy_to_user(argp, &rs, sizeof(rs))) |
136 | return -EFAULT; | 150 | return -EFAULT; |
@@ -199,7 +213,7 @@ static unsigned int phantom_poll(struct file *file, poll_table *wait) | |||
199 | static struct file_operations phantom_file_ops = { | 213 | static struct file_operations phantom_file_ops = { |
200 | .open = phantom_open, | 214 | .open = phantom_open, |
201 | .release = phantom_release, | 215 | .release = phantom_release, |
202 | .ioctl = phantom_ioctl, | 216 | .unlocked_ioctl = phantom_ioctl, |
203 | .poll = phantom_poll, | 217 | .poll = phantom_poll, |
204 | }; | 218 | }; |
205 | 219 | ||
@@ -212,6 +226,7 @@ static irqreturn_t phantom_isr(int irq, void *data) | |||
212 | 226 | ||
213 | iowrite32(0, dev->iaddr); | 227 | iowrite32(0, dev->iaddr); |
214 | iowrite32(0xc0, dev->iaddr); | 228 | iowrite32(0xc0, dev->iaddr); |
229 | ioread32(dev->iaddr); /* PCI posting */ | ||
215 | 230 | ||
216 | atomic_inc(&dev->counter); | 231 | atomic_inc(&dev->counter); |
217 | wake_up_interruptible(&dev->wait); | 232 | wake_up_interruptible(&dev->wait); |
@@ -282,11 +297,13 @@ static int __devinit phantom_probe(struct pci_dev *pdev, | |||
282 | } | 297 | } |
283 | 298 | ||
284 | mutex_init(&pht->open_lock); | 299 | mutex_init(&pht->open_lock); |
300 | spin_lock_init(&pht->ioctl_lock); | ||
285 | init_waitqueue_head(&pht->wait); | 301 | init_waitqueue_head(&pht->wait); |
286 | cdev_init(&pht->cdev, &phantom_file_ops); | 302 | cdev_init(&pht->cdev, &phantom_file_ops); |
287 | pht->cdev.owner = THIS_MODULE; | 303 | pht->cdev.owner = THIS_MODULE; |
288 | 304 | ||
289 | iowrite32(0, pht->caddr + PHN_IRQCTL); | 305 | iowrite32(0, pht->caddr + PHN_IRQCTL); |
306 | ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */ | ||
290 | retval = request_irq(pdev->irq, phantom_isr, | 307 | retval = request_irq(pdev->irq, phantom_isr, |
291 | IRQF_SHARED | IRQF_DISABLED, "phantom", pht); | 308 | IRQF_SHARED | IRQF_DISABLED, "phantom", pht); |
292 | if (retval) { | 309 | if (retval) { |
@@ -337,6 +354,7 @@ static void __devexit phantom_remove(struct pci_dev *pdev) | |||
337 | cdev_del(&pht->cdev); | 354 | cdev_del(&pht->cdev); |
338 | 355 | ||
339 | iowrite32(0, pht->caddr + PHN_IRQCTL); | 356 | iowrite32(0, pht->caddr + PHN_IRQCTL); |
357 | ioread32(pht->caddr + PHN_IRQCTL); /* PCI posting */ | ||
340 | free_irq(pdev->irq, pht); | 358 | free_irq(pdev->irq, pht); |
341 | 359 | ||
342 | pci_iounmap(pdev, pht->oaddr); | 360 | pci_iounmap(pdev, pht->oaddr); |
@@ -358,6 +376,7 @@ static int phantom_suspend(struct pci_dev *pdev, pm_message_t state) | |||
358 | struct phantom_device *dev = pci_get_drvdata(pdev); | 376 | struct phantom_device *dev = pci_get_drvdata(pdev); |
359 | 377 | ||
360 | iowrite32(0, dev->caddr + PHN_IRQCTL); | 378 | iowrite32(0, dev->caddr + PHN_IRQCTL); |
379 | ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */ | ||
361 | 380 | ||
362 | return 0; | 381 | return 0; |
363 | } | 382 | } |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index a7562f7fc0b3..540ff4bea54c 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -135,23 +135,6 @@ struct mmc_blk_request { | |||
135 | struct mmc_data data; | 135 | struct mmc_data data; |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static int mmc_blk_prep_rq(struct mmc_queue *mq, struct request *req) | ||
139 | { | ||
140 | struct mmc_blk_data *md = mq->data; | ||
141 | int stat = BLKPREP_OK; | ||
142 | |||
143 | /* | ||
144 | * If we have no device, we haven't finished initialising. | ||
145 | */ | ||
146 | if (!md || !mq->card) { | ||
147 | printk(KERN_ERR "%s: killing request - no device/host\n", | ||
148 | req->rq_disk->disk_name); | ||
149 | stat = BLKPREP_KILL; | ||
150 | } | ||
151 | |||
152 | return stat; | ||
153 | } | ||
154 | |||
155 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | 138 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) |
156 | { | 139 | { |
157 | int err; | 140 | int err; |
@@ -460,7 +443,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) | |||
460 | if (ret) | 443 | if (ret) |
461 | goto err_putdisk; | 444 | goto err_putdisk; |
462 | 445 | ||
463 | md->queue.prep_fn = mmc_blk_prep_rq; | ||
464 | md->queue.issue_fn = mmc_blk_issue_rq; | 446 | md->queue.issue_fn = mmc_blk_issue_rq; |
465 | md->queue.data = md; | 447 | md->queue.data = md; |
466 | 448 | ||
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 2e77963db334..dd97bc798409 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -20,40 +20,21 @@ | |||
20 | #define MMC_QUEUE_SUSPENDED (1 << 0) | 20 | #define MMC_QUEUE_SUSPENDED (1 << 0) |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Prepare a MMC request. Essentially, this means passing the | 23 | * Prepare a MMC request. This just filters out odd stuff. |
24 | * preparation off to the media driver. The media driver will | ||
25 | * create a mmc_io_request in req->special. | ||
26 | */ | 24 | */ |
27 | static int mmc_prep_request(struct request_queue *q, struct request *req) | 25 | static int mmc_prep_request(struct request_queue *q, struct request *req) |
28 | { | 26 | { |
29 | struct mmc_queue *mq = q->queuedata; | 27 | /* |
30 | int ret = BLKPREP_KILL; | 28 | * We only like normal block requests. |
31 | 29 | */ | |
32 | if (blk_special_request(req)) { | 30 | if (!blk_fs_request(req) && !blk_pc_request(req)) { |
33 | /* | ||
34 | * Special commands already have the command | ||
35 | * blocks already setup in req->special. | ||
36 | */ | ||
37 | BUG_ON(!req->special); | ||
38 | |||
39 | ret = BLKPREP_OK; | ||
40 | } else if (blk_fs_request(req) || blk_pc_request(req)) { | ||
41 | /* | ||
42 | * Block I/O requests need translating according | ||
43 | * to the protocol. | ||
44 | */ | ||
45 | ret = mq->prep_fn(mq, req); | ||
46 | } else { | ||
47 | /* | ||
48 | * Everything else is invalid. | ||
49 | */ | ||
50 | blk_dump_rq_flags(req, "MMC bad request"); | 31 | blk_dump_rq_flags(req, "MMC bad request"); |
32 | return BLKPREP_KILL; | ||
51 | } | 33 | } |
52 | 34 | ||
53 | if (ret == BLKPREP_OK) | 35 | req->cmd_flags |= REQ_DONTPREP; |
54 | req->cmd_flags |= REQ_DONTPREP; | ||
55 | 36 | ||
56 | return ret; | 37 | return BLKPREP_OK; |
57 | } | 38 | } |
58 | 39 | ||
59 | static int mmc_queue_thread(void *d) | 40 | static int mmc_queue_thread(void *d) |
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h index c9f139e764f6..1590b3f3f1f7 100644 --- a/drivers/mmc/card/queue.h +++ b/drivers/mmc/card/queue.h | |||
@@ -10,20 +10,12 @@ struct mmc_queue { | |||
10 | struct semaphore thread_sem; | 10 | struct semaphore thread_sem; |
11 | unsigned int flags; | 11 | unsigned int flags; |
12 | struct request *req; | 12 | struct request *req; |
13 | int (*prep_fn)(struct mmc_queue *, struct request *); | ||
14 | int (*issue_fn)(struct mmc_queue *, struct request *); | 13 | int (*issue_fn)(struct mmc_queue *, struct request *); |
15 | void *data; | 14 | void *data; |
16 | struct request_queue *queue; | 15 | struct request_queue *queue; |
17 | struct scatterlist *sg; | 16 | struct scatterlist *sg; |
18 | }; | 17 | }; |
19 | 18 | ||
20 | struct mmc_io_request { | ||
21 | struct request *rq; | ||
22 | int num; | ||
23 | struct mmc_command selcmd; /* mmc_queue private */ | ||
24 | struct mmc_command cmd[4]; /* max 4 commands */ | ||
25 | }; | ||
26 | |||
27 | extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); | 19 | extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); |
28 | extern void mmc_cleanup_queue(struct mmc_queue *); | 20 | extern void mmc_cleanup_queue(struct mmc_queue *); |
29 | extern void mmc_queue_suspend(struct mmc_queue *); | 21 | extern void mmc_queue_suspend(struct mmc_queue *); |
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 052359fc41ee..11f36bef3057 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
@@ -329,8 +329,8 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) | |||
329 | int ret = 0; | 329 | int ret = 0; |
330 | 330 | ||
331 | #if defined(CONFIG_PPC_MERGE) | 331 | #if defined(CONFIG_PPC_MERGE) |
332 | cdm = mpc52xx_find_and_map("mpc52xx-cdm"); | 332 | cdm = mpc52xx_find_and_map("mpc5200-cdm"); |
333 | gpio = mpc52xx_find_and_map("mpc52xx-gpio"); | 333 | gpio = mpc52xx_find_and_map("mpc5200-gpio"); |
334 | #else | 334 | #else |
335 | cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); | 335 | cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); |
336 | gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); | 336 | gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); |
@@ -445,9 +445,6 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
445 | struct spi_master *master; | 445 | struct spi_master *master; |
446 | int ret; | 446 | int ret; |
447 | 447 | ||
448 | if (pdata == NULL) | ||
449 | return -ENODEV; | ||
450 | |||
451 | master = spi_alloc_master(dev, sizeof *mps); | 448 | master = spi_alloc_master(dev, sizeof *mps); |
452 | if (master == NULL) | 449 | if (master == NULL) |
453 | return -ENOMEM; | 450 | return -ENOMEM; |
@@ -594,17 +591,17 @@ static int __init mpc52xx_psc_spi_of_probe(struct of_device *op, | |||
594 | } | 591 | } |
595 | regaddr64 = of_translate_address(op->node, regaddr_p); | 592 | regaddr64 = of_translate_address(op->node, regaddr_p); |
596 | 593 | ||
594 | /* get PSC id (1..6, used by port_config) */ | ||
597 | if (op->dev.platform_data == NULL) { | 595 | if (op->dev.platform_data == NULL) { |
598 | struct device_node *np; | 596 | const u32 *psc_nump; |
599 | int i = 0; | ||
600 | 597 | ||
601 | for_each_node_by_type(np, "spi") { | 598 | psc_nump = of_get_property(op->node, "cell-index", NULL); |
602 | if (of_find_device_by_node(np) == op) { | 599 | if (!psc_nump || *psc_nump > 5) { |
603 | id = i; | 600 | printk(KERN_ERR "mpc52xx_psc_spi: Device node %s has invalid " |
604 | break; | 601 | "cell-index property\n", op->node->full_name); |
605 | } | 602 | return -EINVAL; |
606 | i++; | ||
607 | } | 603 | } |
604 | id = *psc_nump + 1; | ||
608 | } | 605 | } |
609 | 606 | ||
610 | return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, | 607 | return mpc52xx_psc_spi_do_probe(&op->dev, (u32)regaddr64, (u32)size64, |
@@ -617,7 +614,7 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op) | |||
617 | } | 614 | } |
618 | 615 | ||
619 | static struct of_device_id mpc52xx_psc_spi_of_match[] = { | 616 | static struct of_device_id mpc52xx_psc_spi_of_match[] = { |
620 | { .type = "spi", .compatible = "mpc52xx-psc-spi", }, | 617 | { .type = "spi", .compatible = "mpc5200-psc-spi", }, |
621 | {}, | 618 | {}, |
622 | }; | 619 | }; |
623 | 620 | ||
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c index 96f62b2df300..95183e1df525 100644 --- a/drivers/spi/omap_uwire.c +++ b/drivers/spi/omap_uwire.c | |||
@@ -358,11 +358,11 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
358 | switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { | 358 | switch (spi->mode & (SPI_CPOL | SPI_CPHA)) { |
359 | case SPI_MODE_0: | 359 | case SPI_MODE_0: |
360 | case SPI_MODE_3: | 360 | case SPI_MODE_3: |
361 | flags |= UWIRE_WRITE_RISING_EDGE | UWIRE_READ_FALLING_EDGE; | 361 | flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE; |
362 | break; | 362 | break; |
363 | case SPI_MODE_1: | 363 | case SPI_MODE_1: |
364 | case SPI_MODE_2: | 364 | case SPI_MODE_2: |
365 | flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE; | 365 | flags |= UWIRE_WRITE_RISING_EDGE | UWIRE_READ_FALLING_EDGE; |
366 | break; | 366 | break; |
367 | } | 367 | } |
368 | 368 | ||
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 225d6b2f82dd..d04242aee40d 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -168,6 +168,12 @@ static int spidev_message(struct spidev_data *spidev, | |||
168 | n--, k_tmp++, u_tmp++) { | 168 | n--, k_tmp++, u_tmp++) { |
169 | k_tmp->len = u_tmp->len; | 169 | k_tmp->len = u_tmp->len; |
170 | 170 | ||
171 | total += k_tmp->len; | ||
172 | if (total > bufsiz) { | ||
173 | status = -EMSGSIZE; | ||
174 | goto done; | ||
175 | } | ||
176 | |||
171 | if (u_tmp->rx_buf) { | 177 | if (u_tmp->rx_buf) { |
172 | k_tmp->rx_buf = buf; | 178 | k_tmp->rx_buf = buf; |
173 | if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) | 179 | if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len)) |
@@ -179,12 +185,6 @@ static int spidev_message(struct spidev_data *spidev, | |||
179 | u_tmp->len)) | 185 | u_tmp->len)) |
180 | goto done; | 186 | goto done; |
181 | } | 187 | } |
182 | |||
183 | total += k_tmp->len; | ||
184 | if (total > bufsiz) { | ||
185 | status = -EMSGSIZE; | ||
186 | goto done; | ||
187 | } | ||
188 | buf += k_tmp->len; | 188 | buf += k_tmp->len; |
189 | 189 | ||
190 | k_tmp->cs_change = !!u_tmp->cs_change; | 190 | k_tmp->cs_change = !!u_tmp->cs_change; |
@@ -364,6 +364,7 @@ spidev_ioctl(struct inode *inode, struct file *filp, | |||
364 | break; | 364 | break; |
365 | } | 365 | } |
366 | if (__copy_from_user(ioc, (void __user *)arg, tmp)) { | 366 | if (__copy_from_user(ioc, (void __user *)arg, tmp)) { |
367 | kfree(ioc); | ||
367 | retval = -EFAULT; | 368 | retval = -EFAULT; |
368 | break; | 369 | break; |
369 | } | 370 | } |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index a52480505f78..c7a7c590426f 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -193,6 +193,19 @@ static void mpc83xx_usb_setup(struct usb_hcd *hcd) | |||
193 | out_be32(non_ehci + FSL_SOC_USB_CTRL, 0x00000004); | 193 | out_be32(non_ehci + FSL_SOC_USB_CTRL, 0x00000004); |
194 | out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b); | 194 | out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0000001b); |
195 | 195 | ||
196 | #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) | ||
197 | /* | ||
198 | * Turn on cache snooping hardware, since some PowerPC platforms | ||
199 | * wholly rely on hardware to deal with cache coherent | ||
200 | */ | ||
201 | |||
202 | /* Setup Snooping for all the 4GB space */ | ||
203 | /* SNOOP1 starts from 0x0, size 2G */ | ||
204 | out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); | ||
205 | /* SNOOP2 starts from 0x80000000, size 2G */ | ||
206 | out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x80000000 | SNOOP_SIZE_2GB); | ||
207 | #endif | ||
208 | |||
196 | if (pdata->operating_mode == FSL_USB2_DR_HOST) | 209 | if (pdata->operating_mode == FSL_USB2_DR_HOST) |
197 | mpc83xx_setup_phy(ehci, pdata->phy_mode, 0); | 210 | mpc83xx_setup_phy(ehci, pdata->phy_mode, 0); |
198 | 211 | ||
diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h index f28736a917e4..b5e59db53347 100644 --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h | |||
@@ -34,4 +34,5 @@ | |||
34 | #define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */ | 34 | #define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */ |
35 | #define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ | 35 | #define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ |
36 | #define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ | 36 | #define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ |
37 | #define SNOOP_SIZE_2GB 0x1e | ||
37 | #endif /* _EHCI_FSL_H */ | 38 | #endif /* _EHCI_FSL_H */ |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 4d7485fa553f..6e1f1ea21b38 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -704,6 +704,91 @@ config FB_CG6 | |||
704 | This is the frame buffer device driver for the CGsix (GX, TurboGX) | 704 | This is the frame buffer device driver for the CGsix (GX, TurboGX) |
705 | frame buffer. | 705 | frame buffer. |
706 | 706 | ||
707 | config FB_FFB | ||
708 | bool "Creator/Creator3D/Elite3D support" | ||
709 | depends on FB_SBUS && SPARC64 | ||
710 | select FB_CFB_COPYAREA | ||
711 | select FB_CFB_IMAGEBLIT | ||
712 | help | ||
713 | This is the frame buffer device driver for the Creator, Creator3D, | ||
714 | and Elite3D graphics boards. | ||
715 | |||
716 | config FB_TCX | ||
717 | bool "TCX (SS4/SS5 only) support" | ||
718 | depends on FB_SBUS | ||
719 | select FB_CFB_FILLRECT | ||
720 | select FB_CFB_COPYAREA | ||
721 | select FB_CFB_IMAGEBLIT | ||
722 | help | ||
723 | This is the frame buffer device driver for the TCX 24/8bit frame | ||
724 | buffer. | ||
725 | |||
726 | config FB_CG14 | ||
727 | bool "CGfourteen (SX) support" | ||
728 | depends on FB_SBUS | ||
729 | select FB_CFB_FILLRECT | ||
730 | select FB_CFB_COPYAREA | ||
731 | select FB_CFB_IMAGEBLIT | ||
732 | help | ||
733 | This is the frame buffer device driver for the CGfourteen frame | ||
734 | buffer on Desktop SPARCsystems with the SX graphics option. | ||
735 | |||
736 | config FB_P9100 | ||
737 | bool "P9100 (Sparcbook 3 only) support" | ||
738 | depends on FB_SBUS | ||
739 | select FB_CFB_FILLRECT | ||
740 | select FB_CFB_COPYAREA | ||
741 | select FB_CFB_IMAGEBLIT | ||
742 | help | ||
743 | This is the frame buffer device driver for the P9100 card | ||
744 | supported on Sparcbook 3 machines. | ||
745 | |||
746 | config FB_LEO | ||
747 | bool "Leo (ZX) support" | ||
748 | depends on FB_SBUS | ||
749 | select FB_CFB_FILLRECT | ||
750 | select FB_CFB_COPYAREA | ||
751 | select FB_CFB_IMAGEBLIT | ||
752 | help | ||
753 | This is the frame buffer device driver for the SBUS-based Sun ZX | ||
754 | (leo) frame buffer cards. | ||
755 | |||
756 | config FB_IGA | ||
757 | bool "IGA 168x display support" | ||
758 | depends on FB && SPARC32 | ||
759 | select FB_CFB_FILLRECT | ||
760 | select FB_CFB_COPYAREA | ||
761 | select FB_CFB_IMAGEBLIT | ||
762 | help | ||
763 | This is the framebuffer device for the INTERGRAPHICS 1680 and | ||
764 | successor frame buffer cards. | ||
765 | |||
766 | config FB_XVR500 | ||
767 | bool "Sun XVR-500 3DLABS Wildcat support" | ||
768 | depends on FB && PCI && SPARC64 | ||
769 | select FB_CFB_FILLRECT | ||
770 | select FB_CFB_COPYAREA | ||
771 | select FB_CFB_IMAGEBLIT | ||
772 | help | ||
773 | This is the framebuffer device for the Sun XVR-500 and similar | ||
774 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
775 | only works on sparc64 systems where the system firwmare has | ||
776 | mostly initialized the card already. It is treated as a | ||
777 | completely dumb framebuffer device. | ||
778 | |||
779 | config FB_XVR2500 | ||
780 | bool "Sun XVR-2500 3DLABS Wildcat support" | ||
781 | depends on FB && PCI && SPARC64 | ||
782 | select FB_CFB_FILLRECT | ||
783 | select FB_CFB_COPYAREA | ||
784 | select FB_CFB_IMAGEBLIT | ||
785 | help | ||
786 | This is the framebuffer device for the Sun XVR-2500 and similar | ||
787 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
788 | only works on sparc64 systems where the system firwmare has | ||
789 | mostly initialized the card already. It is treated as a | ||
790 | completely dumb framebuffer device. | ||
791 | |||
707 | config FB_PVR2 | 792 | config FB_PVR2 |
708 | tristate "NEC PowerVR 2 display support" | 793 | tristate "NEC PowerVR 2 display support" |
709 | depends on FB && SH_DREAMCAST | 794 | depends on FB && SH_DREAMCAST |
@@ -1195,7 +1280,7 @@ config FB_ATY | |||
1195 | config FB_ATY_CT | 1280 | config FB_ATY_CT |
1196 | bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" | 1281 | bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" |
1197 | depends on PCI && FB_ATY | 1282 | depends on PCI && FB_ATY |
1198 | default y if SPARC64 && FB_PCI | 1283 | default y if SPARC64 && PCI |
1199 | help | 1284 | help |
1200 | Say Y here to support use of ATI's 64-bit Rage boards (or other | 1285 | Say Y here to support use of ATI's 64-bit Rage boards (or other |
1201 | boards based on the Mach64 CT, VT, GT, and LT chipsets) as a | 1286 | boards based on the Mach64 CT, VT, GT, and LT chipsets) as a |
@@ -1484,95 +1569,6 @@ config FB_AU1200 | |||
1484 | 1569 | ||
1485 | source "drivers/video/geode/Kconfig" | 1570 | source "drivers/video/geode/Kconfig" |
1486 | 1571 | ||
1487 | config FB_FFB | ||
1488 | bool "Creator/Creator3D/Elite3D support" | ||
1489 | depends on FB_SBUS && SPARC64 | ||
1490 | select FB_CFB_COPYAREA | ||
1491 | select FB_CFB_IMAGEBLIT | ||
1492 | help | ||
1493 | This is the frame buffer device driver for the Creator, Creator3D, | ||
1494 | and Elite3D graphics boards. | ||
1495 | |||
1496 | config FB_TCX | ||
1497 | bool "TCX (SS4/SS5 only) support" | ||
1498 | depends on FB_SBUS | ||
1499 | select FB_CFB_FILLRECT | ||
1500 | select FB_CFB_COPYAREA | ||
1501 | select FB_CFB_IMAGEBLIT | ||
1502 | help | ||
1503 | This is the frame buffer device driver for the TCX 24/8bit frame | ||
1504 | buffer. | ||
1505 | |||
1506 | config FB_CG14 | ||
1507 | bool "CGfourteen (SX) support" | ||
1508 | depends on FB_SBUS | ||
1509 | select FB_CFB_FILLRECT | ||
1510 | select FB_CFB_COPYAREA | ||
1511 | select FB_CFB_IMAGEBLIT | ||
1512 | help | ||
1513 | This is the frame buffer device driver for the CGfourteen frame | ||
1514 | buffer on Desktop SPARCsystems with the SX graphics option. | ||
1515 | |||
1516 | config FB_P9100 | ||
1517 | bool "P9100 (Sparcbook 3 only) support" | ||
1518 | depends on FB_SBUS | ||
1519 | select FB_CFB_FILLRECT | ||
1520 | select FB_CFB_COPYAREA | ||
1521 | select FB_CFB_IMAGEBLIT | ||
1522 | help | ||
1523 | This is the frame buffer device driver for the P9100 card | ||
1524 | supported on Sparcbook 3 machines. | ||
1525 | |||
1526 | config FB_LEO | ||
1527 | bool "Leo (ZX) support" | ||
1528 | depends on FB_SBUS | ||
1529 | select FB_CFB_FILLRECT | ||
1530 | select FB_CFB_COPYAREA | ||
1531 | select FB_CFB_IMAGEBLIT | ||
1532 | help | ||
1533 | This is the frame buffer device driver for the SBUS-based Sun ZX | ||
1534 | (leo) frame buffer cards. | ||
1535 | |||
1536 | config FB_XVR500 | ||
1537 | bool "Sun XVR-500 3DLABS Wildcat support" | ||
1538 | depends on (FB = y) && PCI && SPARC64 | ||
1539 | select FB_CFB_FILLRECT | ||
1540 | select FB_CFB_COPYAREA | ||
1541 | select FB_CFB_IMAGEBLIT | ||
1542 | help | ||
1543 | This is the framebuffer device for the Sun XVR-500 and similar | ||
1544 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
1545 | only works on sparc64 systems where the system firwmare has | ||
1546 | mostly initialized the card already. It is treated as a | ||
1547 | completely dumb framebuffer device. | ||
1548 | |||
1549 | config FB_XVR2500 | ||
1550 | bool "Sun XVR-2500 3DLABS Wildcat support" | ||
1551 | depends on (FB = y) && PCI && SPARC64 | ||
1552 | select FB_CFB_FILLRECT | ||
1553 | select FB_CFB_COPYAREA | ||
1554 | select FB_CFB_IMAGEBLIT | ||
1555 | help | ||
1556 | This is the framebuffer device for the Sun XVR-2500 and similar | ||
1557 | graphics cards based upon the 3DLABS Wildcat chipset. The driver | ||
1558 | only works on sparc64 systems where the system firwmare has | ||
1559 | mostly initialized the card already. It is treated as a | ||
1560 | completely dumb framebuffer device. | ||
1561 | |||
1562 | config FB_PCI | ||
1563 | bool "PCI framebuffers" | ||
1564 | depends on (FB = y) && PCI && SPARC | ||
1565 | |||
1566 | config FB_IGA | ||
1567 | bool "IGA 168x display support" | ||
1568 | depends on SPARC32 && FB_PCI | ||
1569 | select FB_CFB_FILLRECT | ||
1570 | select FB_CFB_COPYAREA | ||
1571 | select FB_CFB_IMAGEBLIT | ||
1572 | help | ||
1573 | This is the framebuffer device for the INTERGRAPHICS 1680 and | ||
1574 | successor frame buffer cards. | ||
1575 | |||
1576 | config FB_HIT | 1572 | config FB_HIT |
1577 | tristate "HD64461 Frame Buffer support" | 1573 | tristate "HD64461 Frame Buffer support" |
1578 | depends on FB && HD64461 | 1574 | depends on FB && HD64461 |
@@ -1796,9 +1792,10 @@ config FB_IBM_GXT4500 | |||
1796 | config FB_PS3 | 1792 | config FB_PS3 |
1797 | bool "PS3 GPU framebuffer driver" | 1793 | bool "PS3 GPU framebuffer driver" |
1798 | depends on (FB = y) && PS3_PS3AV | 1794 | depends on (FB = y) && PS3_PS3AV |
1799 | select FB_CFB_FILLRECT | 1795 | select FB_SYS_FILLRECT |
1800 | select FB_CFB_COPYAREA | 1796 | select FB_SYS_COPYAREA |
1801 | select FB_CFB_IMAGEBLIT | 1797 | select FB_SYS_IMAGEBLIT |
1798 | select FB_SYS_FOPS | ||
1802 | ---help--- | 1799 | ---help--- |
1803 | Include support for the virtual frame buffer in the PS3 platform. | 1800 | Include support for the virtual frame buffer in the PS3 platform. |
1804 | 1801 | ||
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 267c1ff9ebd9..a12589898597 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c | |||
@@ -394,26 +394,18 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi) | |||
394 | 394 | ||
395 | /* initialize GPIOs */ | 395 | /* initialize GPIOs */ |
396 | imx_gpio_mode(PD6_PF_LSCLK); | 396 | imx_gpio_mode(PD6_PF_LSCLK); |
397 | imx_gpio_mode(PD10_PF_SPL_SPR); | ||
398 | imx_gpio_mode(PD11_PF_CONTRAST); | 397 | imx_gpio_mode(PD11_PF_CONTRAST); |
399 | imx_gpio_mode(PD14_PF_FLM_VSYNC); | 398 | imx_gpio_mode(PD14_PF_FLM_VSYNC); |
400 | imx_gpio_mode(PD13_PF_LP_HSYNC); | 399 | imx_gpio_mode(PD13_PF_LP_HSYNC); |
401 | imx_gpio_mode(PD7_PF_REV); | ||
402 | imx_gpio_mode(PD8_PF_CLS); | ||
403 | |||
404 | #ifndef CONFIG_MACH_PIMX1 | ||
405 | /* on PiMX1 used as buffers enable signal | ||
406 | */ | ||
407 | imx_gpio_mode(PD9_PF_PS); | ||
408 | #endif | ||
409 | |||
410 | #ifndef CONFIG_MACH_MX1FS2 | ||
411 | /* on mx1fs2 this pin is used to (de)activate the display, so we need | ||
412 | * it as a normal gpio | ||
413 | */ | ||
414 | imx_gpio_mode(PD12_PF_ACD_OE); | 400 | imx_gpio_mode(PD12_PF_ACD_OE); |
415 | #endif | ||
416 | 401 | ||
402 | /* These are only needed for Sharp HR TFT displays */ | ||
403 | if (fbi->pcr & PCR_SHARP) { | ||
404 | imx_gpio_mode(PD7_PF_REV); | ||
405 | imx_gpio_mode(PD8_PF_CLS); | ||
406 | imx_gpio_mode(PD9_PF_PS); | ||
407 | imx_gpio_mode(PD10_PF_SPL_SPR); | ||
408 | } | ||
417 | } | 409 | } |
418 | 410 | ||
419 | #ifdef CONFIG_PM | 411 | #ifdef CONFIG_PM |
@@ -476,7 +468,6 @@ static int __init imxfb_init_fbinfo(struct device *dev) | |||
476 | 468 | ||
477 | info->fbops = &imxfb_ops; | 469 | info->fbops = &imxfb_ops; |
478 | info->flags = FBINFO_FLAG_DEFAULT; | 470 | info->flags = FBINFO_FLAG_DEFAULT; |
479 | info->pseudo_palette = (fbi + 1); | ||
480 | 471 | ||
481 | fbi->rgb[RGB_16] = &def_rgb_16; | 472 | fbi->rgb[RGB_16] = &def_rgb_16; |
482 | fbi->rgb[RGB_8] = &def_rgb_8; | 473 | fbi->rgb[RGB_8] = &def_rgb_8; |
@@ -499,6 +490,7 @@ static int __init imxfb_init_fbinfo(struct device *dev) | |||
499 | info->var.sync = inf->sync; | 490 | info->var.sync = inf->sync; |
500 | info->var.grayscale = inf->cmap_greyscale; | 491 | info->var.grayscale = inf->cmap_greyscale; |
501 | fbi->cmap_inverse = inf->cmap_inverse; | 492 | fbi->cmap_inverse = inf->cmap_inverse; |
493 | fbi->cmap_static = inf->cmap_static; | ||
502 | fbi->pcr = inf->pcr; | 494 | fbi->pcr = inf->pcr; |
503 | fbi->lscr1 = inf->lscr1; | 495 | fbi->lscr1 = inf->lscr1; |
504 | fbi->dmacr = inf->dmacr; | 496 | fbi->dmacr = inf->dmacr; |
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index ab5e66890e4e..0a04483aa3e0 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
@@ -183,15 +183,17 @@ static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) | |||
183 | index = PM2VR_RD_INDEXED_DATA; | 183 | index = PM2VR_RD_INDEXED_DATA; |
184 | break; | 184 | break; |
185 | } | 185 | } |
186 | mb(); | 186 | wmb(); |
187 | pm2_WR(p, index, v); | 187 | pm2_WR(p, index, v); |
188 | wmb(); | ||
188 | } | 189 | } |
189 | 190 | ||
190 | static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) | 191 | static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) |
191 | { | 192 | { |
192 | pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); | 193 | pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); |
193 | mb(); | 194 | wmb(); |
194 | pm2_WR(p, PM2VR_RD_INDEXED_DATA, v); | 195 | pm2_WR(p, PM2VR_RD_INDEXED_DATA, v); |
196 | wmb(); | ||
195 | } | 197 | } |
196 | 198 | ||
197 | #ifdef CONFIG_FB_PM2_FIFO_DISCONNECT | 199 | #ifdef CONFIG_FB_PM2_FIFO_DISCONNECT |
@@ -466,11 +468,9 @@ static void set_memclock(struct pm2fb_par* par, u32 clk) | |||
466 | WAIT_FIFO(par, 8); | 468 | WAIT_FIFO(par, 8); |
467 | pm2_WR(par, PM2VR_RD_INDEX_HIGH, PM2VI_RD_MCLK_CONTROL >> 8); | 469 | pm2_WR(par, PM2VR_RD_INDEX_HIGH, PM2VI_RD_MCLK_CONTROL >> 8); |
468 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 0); | 470 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 0); |
469 | wmb(); | ||
470 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_PRESCALE, m); | 471 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_PRESCALE, m); |
471 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_FEEDBACK, n); | 472 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_FEEDBACK, n); |
472 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_POSTSCALE, p); | 473 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_POSTSCALE, p); |
473 | wmb(); | ||
474 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 1); | 474 | pm2v_RDAC_WR(par, PM2VI_RD_MCLK_CONTROL, 1); |
475 | rmb(); | 475 | rmb(); |
476 | for (i = 256; | 476 | for (i = 256; |
@@ -483,12 +483,9 @@ static void set_memclock(struct pm2fb_par* par, u32 clk) | |||
483 | pm2_mnp(clk, &m, &n, &p); | 483 | pm2_mnp(clk, &m, &n, &p); |
484 | WAIT_FIFO(par, 10); | 484 | WAIT_FIFO(par, 10); |
485 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 6); | 485 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 6); |
486 | wmb(); | ||
487 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_1, m); | 486 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_1, m); |
488 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_2, n); | 487 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_2, n); |
489 | wmb(); | ||
490 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 8|p); | 488 | pm2_RDAC_WR(par, PM2I_RD_MEMORY_CLOCK_3, 8|p); |
491 | wmb(); | ||
492 | pm2_RDAC_RD(par, PM2I_RD_MEMORY_CLOCK_STATUS); | 489 | pm2_RDAC_RD(par, PM2I_RD_MEMORY_CLOCK_STATUS); |
493 | rmb(); | 490 | rmb(); |
494 | for (i = 256; | 491 | for (i = 256; |
@@ -509,12 +506,9 @@ static void set_pixclock(struct pm2fb_par* par, u32 clk) | |||
509 | pm2_mnp(clk, &m, &n, &p); | 506 | pm2_mnp(clk, &m, &n, &p); |
510 | WAIT_FIFO(par, 8); | 507 | WAIT_FIFO(par, 8); |
511 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 0); | 508 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 0); |
512 | wmb(); | ||
513 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A1, m); | 509 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A1, m); |
514 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A2, n); | 510 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A2, n); |
515 | wmb(); | ||
516 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 8|p); | 511 | pm2_RDAC_WR(par, PM2I_RD_PIXEL_CLOCK_A3, 8|p); |
517 | wmb(); | ||
518 | pm2_RDAC_RD(par, PM2I_RD_PIXEL_CLOCK_STATUS); | 512 | pm2_RDAC_RD(par, PM2I_RD_PIXEL_CLOCK_STATUS); |
519 | rmb(); | 513 | rmb(); |
520 | for (i = 256; | 514 | for (i = 256; |
@@ -1066,10 +1060,9 @@ static void pm2fb_block_op(struct fb_info* info, int copy, | |||
1066 | 1060 | ||
1067 | if (!w || !h) | 1061 | if (!w || !h) |
1068 | return; | 1062 | return; |
1069 | WAIT_FIFO(par, 6); | 1063 | WAIT_FIFO(par, 5); |
1070 | pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE | | 1064 | pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE | |
1071 | PM2F_CONFIG_FB_READ_SOURCE_ENABLE); | 1065 | PM2F_CONFIG_FB_READ_SOURCE_ENABLE); |
1072 | pm2_WR(par, PM2R_FB_PIXEL_OFFSET, 0); | ||
1073 | if (copy) | 1066 | if (copy) |
1074 | pm2_WR(par, PM2R_FB_SOURCE_DELTA, | 1067 | pm2_WR(par, PM2R_FB_SOURCE_DELTA, |
1075 | ((ysrc-y) & 0xfff) << 16 | ((xsrc-x) & 0xfff)); | 1068 | ((ysrc-y) & 0xfff) << 16 | ((xsrc-x) & 0xfff)); |
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index c77a1a1fd46b..616a0c08e30c 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -52,11 +52,6 @@ | |||
52 | static char *mode_option __devinitdata; | 52 | static char *mode_option __devinitdata; |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * If your driver supports multiple boards, you should make the | ||
56 | * below data types arrays, or allocate them dynamically (using kmalloc()). | ||
57 | */ | ||
58 | |||
59 | /* | ||
60 | * This structure defines the hardware state of the graphics card. Normally | 55 | * This structure defines the hardware state of the graphics card. Normally |
61 | * you place this in a header file in linux/include/video. This file usually | 56 | * you place this in a header file in linux/include/video. This file usually |
62 | * also includes register information. That allows other driver subsystems | 57 | * also includes register information. That allows other driver subsystems |
@@ -67,7 +62,7 @@ struct pm3_par { | |||
67 | unsigned char __iomem *v_regs;/* virtual address of p_regs */ | 62 | unsigned char __iomem *v_regs;/* virtual address of p_regs */ |
68 | u32 video; /* video flags before blanking */ | 63 | u32 video; /* video flags before blanking */ |
69 | u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */ | 64 | u32 base; /* screen base (xoffset+yoffset) in 128 bits unit */ |
70 | u32 palette[16]; | 65 | u32 palette[16]; |
71 | }; | 66 | }; |
72 | 67 | ||
73 | /* | 68 | /* |
@@ -104,36 +99,28 @@ static inline void PM3_WAIT(struct pm3_par *par, u32 n) | |||
104 | while (PM3_READ_REG(par, PM3InFIFOSpace) < n); | 99 | while (PM3_READ_REG(par, PM3InFIFOSpace) < n); |
105 | } | 100 | } |
106 | 101 | ||
107 | static inline void PM3_SLOW_WRITE_REG(struct pm3_par *par, s32 off, u32 v) | ||
108 | { | ||
109 | if (par->v_regs) { | ||
110 | mb(); | ||
111 | PM3_WAIT(par, 1); | ||
112 | wmb(); | ||
113 | PM3_WRITE_REG(par, off, v); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | static inline void PM3_SET_INDEX(struct pm3_par *par, unsigned index) | ||
118 | { | ||
119 | PM3_SLOW_WRITE_REG(par, PM3RD_IndexHigh, (index >> 8) & 0xff); | ||
120 | PM3_SLOW_WRITE_REG(par, PM3RD_IndexLow, index & 0xff); | ||
121 | } | ||
122 | |||
123 | static inline void PM3_WRITE_DAC_REG(struct pm3_par *par, unsigned r, u8 v) | 102 | static inline void PM3_WRITE_DAC_REG(struct pm3_par *par, unsigned r, u8 v) |
124 | { | 103 | { |
125 | PM3_SET_INDEX(par, r); | 104 | PM3_WAIT(par, 3); |
105 | PM3_WRITE_REG(par, PM3RD_IndexHigh, (r >> 8) & 0xff); | ||
106 | PM3_WRITE_REG(par, PM3RD_IndexLow, r & 0xff); | ||
126 | wmb(); | 107 | wmb(); |
127 | PM3_WRITE_REG(par, PM3RD_IndexedData, v); | 108 | PM3_WRITE_REG(par, PM3RD_IndexedData, v); |
109 | wmb(); | ||
128 | } | 110 | } |
129 | 111 | ||
130 | static inline void pm3fb_set_color(struct pm3_par *par, unsigned char regno, | 112 | static inline void pm3fb_set_color(struct pm3_par *par, unsigned char regno, |
131 | unsigned char r, unsigned char g, unsigned char b) | 113 | unsigned char r, unsigned char g, unsigned char b) |
132 | { | 114 | { |
133 | PM3_SLOW_WRITE_REG(par, PM3RD_PaletteWriteAddress, regno); | 115 | PM3_WAIT(par, 4); |
134 | PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, r); | 116 | PM3_WRITE_REG(par, PM3RD_PaletteWriteAddress, regno); |
135 | PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, g); | 117 | wmb(); |
136 | PM3_SLOW_WRITE_REG(par, PM3RD_PaletteData, b); | 118 | PM3_WRITE_REG(par, PM3RD_PaletteData, r); |
119 | wmb(); | ||
120 | PM3_WRITE_REG(par, PM3RD_PaletteData, g); | ||
121 | wmb(); | ||
122 | PM3_WRITE_REG(par, PM3RD_PaletteData, b); | ||
123 | wmb(); | ||
137 | } | 124 | } |
138 | 125 | ||
139 | static void pm3fb_clear_colormap(struct pm3_par *par, | 126 | static void pm3fb_clear_colormap(struct pm3_par *par, |
@@ -141,7 +128,7 @@ static void pm3fb_clear_colormap(struct pm3_par *par, | |||
141 | { | 128 | { |
142 | int i; | 129 | int i; |
143 | 130 | ||
144 | for (i = 0; i < 256 ; i++) /* fill color map with white */ | 131 | for (i = 0; i < 256 ; i++) |
145 | pm3fb_set_color(par, i, r, g, b); | 132 | pm3fb_set_color(par, i, r, g, b); |
146 | 133 | ||
147 | } | 134 | } |
@@ -175,19 +162,26 @@ static void pm3fb_calculate_clock(unsigned long reqclock, | |||
175 | } | 162 | } |
176 | } | 163 | } |
177 | 164 | ||
178 | static inline int pm3fb_shift_bpp(unsigned long depth, int v) | 165 | static inline int pm3fb_depth(const struct fb_var_screeninfo *var) |
179 | { | 166 | { |
180 | switch (depth) { | 167 | if ( var->bits_per_pixel == 16 ) |
168 | return var->red.length + var->green.length | ||
169 | + var->blue.length; | ||
170 | |||
171 | return var->bits_per_pixel; | ||
172 | } | ||
173 | |||
174 | static inline int pm3fb_shift_bpp(unsigned bpp, int v) | ||
175 | { | ||
176 | switch (bpp) { | ||
181 | case 8: | 177 | case 8: |
182 | return (v >> 4); | 178 | return (v >> 4); |
183 | case 12: | ||
184 | case 15: | ||
185 | case 16: | 179 | case 16: |
186 | return (v >> 3); | 180 | return (v >> 3); |
187 | case 32: | 181 | case 32: |
188 | return (v >> 2); | 182 | return (v >> 2); |
189 | } | 183 | } |
190 | DPRINTK("Unsupported depth %ld\n", depth); | 184 | DPRINTK("Unsupported depth %u\n", bpp); |
191 | return 0; | 185 | return 0; |
192 | } | 186 | } |
193 | 187 | ||
@@ -206,56 +200,50 @@ static void pm3fb_write_mode(struct fb_info *info) | |||
206 | const u32 vbend = vsend + info->var.upper_margin; | 200 | const u32 vbend = vsend + info->var.upper_margin; |
207 | const u32 vtotal = info->var.yres + vbend; | 201 | const u32 vtotal = info->var.yres + vbend; |
208 | const u32 width = (info->var.xres_virtual + 7) & ~7; | 202 | const u32 width = (info->var.xres_virtual + 7) & ~7; |
209 | 203 | const unsigned bpp = info->var.bits_per_pixel; | |
210 | PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, 0xffffffff); | 204 | |
211 | PM3_SLOW_WRITE_REG(par, PM3Aperture0, 0x00000000); | 205 | PM3_WAIT(par, 20); |
212 | PM3_SLOW_WRITE_REG(par, PM3Aperture1, 0x00000000); | 206 | PM3_WRITE_REG(par, PM3MemBypassWriteMask, 0xffffffff); |
213 | PM3_SLOW_WRITE_REG(par, PM3FIFODis, 0x00000007); | 207 | PM3_WRITE_REG(par, PM3Aperture0, 0x00000000); |
214 | 208 | PM3_WRITE_REG(par, PM3Aperture1, 0x00000000); | |
215 | PM3_SLOW_WRITE_REG(par, PM3HTotal, | 209 | PM3_WRITE_REG(par, PM3FIFODis, 0x00000007); |
216 | pm3fb_shift_bpp(info->var.bits_per_pixel, | 210 | |
217 | htotal - 1)); | 211 | PM3_WRITE_REG(par, PM3HTotal, |
218 | PM3_SLOW_WRITE_REG(par, PM3HsEnd, | 212 | pm3fb_shift_bpp(bpp, htotal - 1)); |
219 | pm3fb_shift_bpp(info->var.bits_per_pixel, | 213 | PM3_WRITE_REG(par, PM3HsEnd, |
220 | hsend)); | 214 | pm3fb_shift_bpp(bpp, hsend)); |
221 | PM3_SLOW_WRITE_REG(par, PM3HsStart, | 215 | PM3_WRITE_REG(par, PM3HsStart, |
222 | pm3fb_shift_bpp(info->var.bits_per_pixel, | 216 | pm3fb_shift_bpp(bpp, hsstart)); |
223 | hsstart)); | 217 | PM3_WRITE_REG(par, PM3HbEnd, |
224 | PM3_SLOW_WRITE_REG(par, PM3HbEnd, | 218 | pm3fb_shift_bpp(bpp, hbend)); |
225 | pm3fb_shift_bpp(info->var.bits_per_pixel, | 219 | PM3_WRITE_REG(par, PM3HgEnd, |
226 | hbend)); | 220 | pm3fb_shift_bpp(bpp, hbend)); |
227 | PM3_SLOW_WRITE_REG(par, PM3HgEnd, | 221 | PM3_WRITE_REG(par, PM3ScreenStride, |
228 | pm3fb_shift_bpp(info->var.bits_per_pixel, | 222 | pm3fb_shift_bpp(bpp, width)); |
229 | hbend)); | 223 | PM3_WRITE_REG(par, PM3VTotal, vtotal - 1); |
230 | PM3_SLOW_WRITE_REG(par, PM3ScreenStride, | 224 | PM3_WRITE_REG(par, PM3VsEnd, vsend - 1); |
231 | pm3fb_shift_bpp(info->var.bits_per_pixel, | 225 | PM3_WRITE_REG(par, PM3VsStart, vsstart - 1); |
232 | width)); | 226 | PM3_WRITE_REG(par, PM3VbEnd, vbend); |
233 | PM3_SLOW_WRITE_REG(par, PM3VTotal, vtotal - 1); | 227 | |
234 | PM3_SLOW_WRITE_REG(par, PM3VsEnd, vsend - 1); | 228 | switch (bpp) { |
235 | PM3_SLOW_WRITE_REG(par, PM3VsStart, vsstart - 1); | ||
236 | PM3_SLOW_WRITE_REG(par, PM3VbEnd, vbend); | ||
237 | |||
238 | switch (info->var.bits_per_pixel) { | ||
239 | case 8: | 229 | case 8: |
240 | PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, | 230 | PM3_WRITE_REG(par, PM3ByAperture1Mode, |
241 | PM3ByApertureMode_PIXELSIZE_8BIT); | 231 | PM3ByApertureMode_PIXELSIZE_8BIT); |
242 | PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, | 232 | PM3_WRITE_REG(par, PM3ByAperture2Mode, |
243 | PM3ByApertureMode_PIXELSIZE_8BIT); | 233 | PM3ByApertureMode_PIXELSIZE_8BIT); |
244 | break; | 234 | break; |
245 | 235 | ||
246 | case 12: | ||
247 | case 15: | ||
248 | case 16: | 236 | case 16: |
249 | #ifndef __BIG_ENDIAN | 237 | #ifndef __BIG_ENDIAN |
250 | PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, | 238 | PM3_WRITE_REG(par, PM3ByAperture1Mode, |
251 | PM3ByApertureMode_PIXELSIZE_16BIT); | 239 | PM3ByApertureMode_PIXELSIZE_16BIT); |
252 | PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, | 240 | PM3_WRITE_REG(par, PM3ByAperture2Mode, |
253 | PM3ByApertureMode_PIXELSIZE_16BIT); | 241 | PM3ByApertureMode_PIXELSIZE_16BIT); |
254 | #else | 242 | #else |
255 | PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, | 243 | PM3_WRITE_REG(par, PM3ByAperture1Mode, |
256 | PM3ByApertureMode_PIXELSIZE_16BIT | | 244 | PM3ByApertureMode_PIXELSIZE_16BIT | |
257 | PM3ByApertureMode_BYTESWAP_BADC); | 245 | PM3ByApertureMode_BYTESWAP_BADC); |
258 | PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, | 246 | PM3_WRITE_REG(par, PM3ByAperture2Mode, |
259 | PM3ByApertureMode_PIXELSIZE_16BIT | | 247 | PM3ByApertureMode_PIXELSIZE_16BIT | |
260 | PM3ByApertureMode_BYTESWAP_BADC); | 248 | PM3ByApertureMode_BYTESWAP_BADC); |
261 | #endif /* ! __BIG_ENDIAN */ | 249 | #endif /* ! __BIG_ENDIAN */ |
@@ -263,23 +251,22 @@ static void pm3fb_write_mode(struct fb_info *info) | |||
263 | 251 | ||
264 | case 32: | 252 | case 32: |
265 | #ifndef __BIG_ENDIAN | 253 | #ifndef __BIG_ENDIAN |
266 | PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, | 254 | PM3_WRITE_REG(par, PM3ByAperture1Mode, |
267 | PM3ByApertureMode_PIXELSIZE_32BIT); | 255 | PM3ByApertureMode_PIXELSIZE_32BIT); |
268 | PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, | 256 | PM3_WRITE_REG(par, PM3ByAperture2Mode, |
269 | PM3ByApertureMode_PIXELSIZE_32BIT); | 257 | PM3ByApertureMode_PIXELSIZE_32BIT); |
270 | #else | 258 | #else |
271 | PM3_SLOW_WRITE_REG(par, PM3ByAperture1Mode, | 259 | PM3_WRITE_REG(par, PM3ByAperture1Mode, |
272 | PM3ByApertureMode_PIXELSIZE_32BIT | | 260 | PM3ByApertureMode_PIXELSIZE_32BIT | |
273 | PM3ByApertureMode_BYTESWAP_DCBA); | 261 | PM3ByApertureMode_BYTESWAP_DCBA); |
274 | PM3_SLOW_WRITE_REG(par, PM3ByAperture2Mode, | 262 | PM3_WRITE_REG(par, PM3ByAperture2Mode, |
275 | PM3ByApertureMode_PIXELSIZE_32BIT | | 263 | PM3ByApertureMode_PIXELSIZE_32BIT | |
276 | PM3ByApertureMode_BYTESWAP_DCBA); | 264 | PM3ByApertureMode_BYTESWAP_DCBA); |
277 | #endif /* ! __BIG_ENDIAN */ | 265 | #endif /* ! __BIG_ENDIAN */ |
278 | break; | 266 | break; |
279 | 267 | ||
280 | default: | 268 | default: |
281 | DPRINTK("Unsupported depth %d\n", | 269 | DPRINTK("Unsupported depth %d\n", bpp); |
282 | info->var.bits_per_pixel); | ||
283 | break; | 270 | break; |
284 | } | 271 | } |
285 | 272 | ||
@@ -296,14 +283,15 @@ static void pm3fb_write_mode(struct fb_info *info) | |||
296 | PM3VideoControl_VSYNC_MASK); | 283 | PM3VideoControl_VSYNC_MASK); |
297 | video |= PM3VideoControl_HSYNC_ACTIVE_HIGH | | 284 | video |= PM3VideoControl_HSYNC_ACTIVE_HIGH | |
298 | PM3VideoControl_VSYNC_ACTIVE_HIGH; | 285 | PM3VideoControl_VSYNC_ACTIVE_HIGH; |
299 | PM3_SLOW_WRITE_REG(par, PM3VideoControl, video); | 286 | PM3_WRITE_REG(par, PM3VideoControl, video); |
300 | } | 287 | } |
301 | PM3_SLOW_WRITE_REG(par, PM3VClkCtl, | 288 | PM3_WRITE_REG(par, PM3VClkCtl, |
302 | (PM3_READ_REG(par, PM3VClkCtl) & 0xFFFFFFFC)); | 289 | (PM3_READ_REG(par, PM3VClkCtl) & 0xFFFFFFFC)); |
303 | PM3_SLOW_WRITE_REG(par, PM3ScreenBase, par->base); | 290 | PM3_WRITE_REG(par, PM3ScreenBase, par->base); |
304 | PM3_SLOW_WRITE_REG(par, PM3ChipConfig, | 291 | PM3_WRITE_REG(par, PM3ChipConfig, |
305 | (PM3_READ_REG(par, PM3ChipConfig) & 0xFFFFFFFD)); | 292 | (PM3_READ_REG(par, PM3ChipConfig) & 0xFFFFFFFD)); |
306 | 293 | ||
294 | wmb(); | ||
307 | { | 295 | { |
308 | unsigned char uninitialized_var(m); /* ClkPreScale */ | 296 | unsigned char uninitialized_var(m); /* ClkPreScale */ |
309 | unsigned char uninitialized_var(n); /* ClkFeedBackScale */ | 297 | unsigned char uninitialized_var(n); /* ClkFeedBackScale */ |
@@ -337,7 +325,7 @@ static void pm3fb_write_mode(struct fb_info *info) | |||
337 | 325 | ||
338 | PM3_WRITE_DAC_REG(par, PM3RD_DACControl, 0x00); | 326 | PM3_WRITE_DAC_REG(par, PM3RD_DACControl, 0x00); |
339 | 327 | ||
340 | switch (info->var.bits_per_pixel) { | 328 | switch (pm3fb_depth(&info->var)) { |
341 | case 8: | 329 | case 8: |
342 | PM3_WRITE_DAC_REG(par, PM3RD_PixelSize, | 330 | PM3_WRITE_DAC_REG(par, PM3RD_PixelSize, |
343 | PM3RD_PixelSize_8_BIT_PIXELS); | 331 | PM3RD_PixelSize_8_BIT_PIXELS); |
@@ -393,57 +381,44 @@ static void pm3fb_write_mode(struct fb_info *info) | |||
393 | * hardware independent functions | 381 | * hardware independent functions |
394 | */ | 382 | */ |
395 | int pm3fb_init(void); | 383 | int pm3fb_init(void); |
396 | int pm3fb_setup(char*); | ||
397 | 384 | ||
398 | static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | 385 | static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
399 | { | 386 | { |
400 | u32 lpitch; | 387 | u32 lpitch; |
388 | unsigned bpp = var->red.length + var->green.length | ||
389 | + var->blue.length + var->transp.length; | ||
401 | 390 | ||
402 | var->transp.offset = 0; | 391 | if ( bpp != var->bits_per_pixel ) { |
403 | var->transp.length = 0; | 392 | /* set predefined mode for bits_per_pixel settings */ |
404 | switch(var->bits_per_pixel) { | 393 | |
405 | case 8: | 394 | switch(var->bits_per_pixel) { |
406 | var->red.length = var->green.length = var->blue.length = 8; | 395 | case 8: |
407 | var->red.offset = var->green.offset = var->blue.offset = 0; | 396 | var->red.length = var->green.length = var->blue.length = 8; |
408 | break; | 397 | var->red.offset = var->green.offset = var->blue.offset = 0; |
409 | case 12: | 398 | var->transp.offset = 0; |
410 | var->red.offset = 8; | 399 | var->transp.length = 0; |
411 | var->red.length = 4; | 400 | break; |
412 | var->green.offset = 4; | 401 | case 16: |
413 | var->green.length = 4; | 402 | var->red.length = var->blue.length = 5; |
414 | var->blue.offset = 0; | 403 | var->green.length = 6; |
415 | var->blue.length = 4; | 404 | var->transp.length = 0; |
416 | var->transp.offset = 12; | 405 | break; |
417 | var->transp.length = 4; | 406 | case 32: |
418 | case 15: | 407 | var->red.length = var->green.length = var->blue.length = 8; |
419 | var->red.offset = 10; | 408 | var->transp.length = 8; |
420 | var->red.length = 5; | 409 | break; |
421 | var->green.offset = 5; | 410 | default: |
422 | var->green.length = 5; | 411 | DPRINTK("depth not supported: %u\n", var->bits_per_pixel); |
423 | var->blue.offset = 0; | 412 | return -EINVAL; |
424 | var->blue.length = 5; | 413 | } |
425 | var->transp.offset = 15; | 414 | } |
426 | var->transp.length = 1; | 415 | /* it is assumed BGRA order */ |
427 | break; | 416 | if (var->bits_per_pixel > 8 ) |
428 | case 16: | 417 | { |
429 | var->red.offset = 11; | 418 | var->blue.offset = 0; |
430 | var->red.length = 5; | 419 | var->green.offset = var->blue.length; |
431 | var->green.offset = 5; | 420 | var->red.offset = var->green.offset + var->green.length; |
432 | var->green.length = 6; | 421 | var->transp.offset = var->red.offset + var->red.length; |
433 | var->blue.offset = 0; | ||
434 | var->blue.length = 5; | ||
435 | break; | ||
436 | case 32: | ||
437 | var->transp.offset = 24; | ||
438 | var->transp.length = 8; | ||
439 | var->red.offset = 16; | ||
440 | var->green.offset = 8; | ||
441 | var->blue.offset = 0; | ||
442 | var->red.length = var->green.length = var->blue.length = 8; | ||
443 | break; | ||
444 | default: | ||
445 | DPRINTK("depth not supported: %u\n", var->bits_per_pixel); | ||
446 | return -EINVAL; | ||
447 | } | 422 | } |
448 | var->height = var->width = -1; | 423 | var->height = var->width = -1; |
449 | 424 | ||
@@ -502,10 +477,9 @@ static int pm3fb_set_par(struct fb_info *info) | |||
502 | { | 477 | { |
503 | struct pm3_par *par = info->par; | 478 | struct pm3_par *par = info->par; |
504 | const u32 xres = (info->var.xres + 31) & ~31; | 479 | const u32 xres = (info->var.xres + 31) & ~31; |
505 | const int depth = (info->var.bits_per_pixel + 7) & ~7; | 480 | const unsigned bpp = info->var.bits_per_pixel; |
506 | 481 | ||
507 | par->base = pm3fb_shift_bpp(info->var.bits_per_pixel, | 482 | par->base = pm3fb_shift_bpp(bpp,(info->var.yoffset * xres) |
508 | (info->var.yoffset * xres) | ||
509 | + info->var.xoffset); | 483 | + info->var.xoffset); |
510 | par->video = 0; | 484 | par->video = 0; |
511 | 485 | ||
@@ -530,12 +504,10 @@ static int pm3fb_set_par(struct fb_info *info) | |||
530 | par->video |= PM3VideoControl_DISABLE; | 504 | par->video |= PM3VideoControl_DISABLE; |
531 | DPRINTK("PM3Video disabled\n"); | 505 | DPRINTK("PM3Video disabled\n"); |
532 | } | 506 | } |
533 | switch (depth) { | 507 | switch (bpp) { |
534 | case 8: | 508 | case 8: |
535 | par->video |= PM3VideoControl_PIXELSIZE_8BIT; | 509 | par->video |= PM3VideoControl_PIXELSIZE_8BIT; |
536 | break; | 510 | break; |
537 | case 12: | ||
538 | case 15: | ||
539 | case 16: | 511 | case 16: |
540 | par->video |= PM3VideoControl_PIXELSIZE_16BIT; | 512 | par->video |= PM3VideoControl_PIXELSIZE_16BIT; |
541 | break; | 513 | break; |
@@ -548,9 +520,9 @@ static int pm3fb_set_par(struct fb_info *info) | |||
548 | } | 520 | } |
549 | 521 | ||
550 | info->fix.visual = | 522 | info->fix.visual = |
551 | (depth == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; | 523 | (bpp == 8) ? FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; |
552 | info->fix.line_length = ((info->var.xres_virtual + 7) & ~7) | 524 | info->fix.line_length = ((info->var.xres_virtual + 7) & ~7) |
553 | * depth / 8; | 525 | * bpp / 8; |
554 | 526 | ||
555 | /* pm3fb_clear_memory(info, 0);*/ | 527 | /* pm3fb_clear_memory(info, 0);*/ |
556 | pm3fb_clear_colormap(par, 0, 0, 0); | 528 | pm3fb_clear_colormap(par, 0, 0, 0); |
@@ -580,8 +552,8 @@ static int pm3fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
580 | * var->{color}.length contains length of bitfield | 552 | * var->{color}.length contains length of bitfield |
581 | * {hardwarespecific} contains width of DAC | 553 | * {hardwarespecific} contains width of DAC |
582 | * pseudo_palette[X] is programmed to (X << red.offset) | | 554 | * pseudo_palette[X] is programmed to (X << red.offset) | |
583 | * (X << green.offset) | | 555 | * (X << green.offset) | |
584 | * (X << blue.offset) | 556 | * (X << blue.offset) |
585 | * RAMDAC[X] is programmed to (red, green, blue) | 557 | * RAMDAC[X] is programmed to (red, green, blue) |
586 | * color depth = SUM(var->{color}.length) | 558 | * color depth = SUM(var->{color}.length) |
587 | * | 559 | * |
@@ -621,7 +593,6 @@ static int pm3fb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
621 | case 8: | 593 | case 8: |
622 | break; | 594 | break; |
623 | case 16: | 595 | case 16: |
624 | case 24: | ||
625 | case 32: | 596 | case 32: |
626 | ((u32*)(info->pseudo_palette))[regno] = v; | 597 | ((u32*)(info->pseudo_palette))[regno] = v; |
627 | break; | 598 | break; |
@@ -643,7 +614,8 @@ static int pm3fb_pan_display(struct fb_var_screeninfo *var, | |||
643 | par->base = pm3fb_shift_bpp(var->bits_per_pixel, | 614 | par->base = pm3fb_shift_bpp(var->bits_per_pixel, |
644 | (var->yoffset * xres) | 615 | (var->yoffset * xres) |
645 | + var->xoffset); | 616 | + var->xoffset); |
646 | PM3_SLOW_WRITE_REG(par, PM3ScreenBase, par->base); | 617 | PM3_WAIT(par, 1); |
618 | PM3_WRITE_REG(par, PM3ScreenBase, par->base); | ||
647 | return 0; | 619 | return 0; |
648 | } | 620 | } |
649 | 621 | ||
@@ -665,31 +637,31 @@ static int pm3fb_blank(int blank_mode, struct fb_info *info) | |||
665 | 637 | ||
666 | switch (blank_mode) { | 638 | switch (blank_mode) { |
667 | case FB_BLANK_UNBLANK: | 639 | case FB_BLANK_UNBLANK: |
668 | video = video | PM3VideoControl_ENABLE; | 640 | video |= PM3VideoControl_ENABLE; |
669 | break; | 641 | break; |
670 | case FB_BLANK_NORMAL: /* FIXME */ | 642 | case FB_BLANK_NORMAL: |
671 | video = video & ~(PM3VideoControl_ENABLE); | 643 | video &= ~(PM3VideoControl_ENABLE); |
672 | break; | 644 | break; |
673 | case FB_BLANK_HSYNC_SUSPEND: | 645 | case FB_BLANK_HSYNC_SUSPEND: |
674 | video = video & ~(PM3VideoControl_HSYNC_MASK | | 646 | video &= ~(PM3VideoControl_HSYNC_MASK | |
675 | PM3VideoControl_BLANK_ACTIVE_LOW); | 647 | PM3VideoControl_BLANK_ACTIVE_LOW); |
676 | break; | 648 | break; |
677 | case FB_BLANK_VSYNC_SUSPEND: | 649 | case FB_BLANK_VSYNC_SUSPEND: |
678 | video = video & ~(PM3VideoControl_VSYNC_MASK | | 650 | video &= ~(PM3VideoControl_VSYNC_MASK | |
679 | PM3VideoControl_BLANK_ACTIVE_LOW); | 651 | PM3VideoControl_BLANK_ACTIVE_LOW); |
680 | break; | 652 | break; |
681 | case FB_BLANK_POWERDOWN: | 653 | case FB_BLANK_POWERDOWN: |
682 | video = video & ~(PM3VideoControl_HSYNC_MASK | | 654 | video &= ~(PM3VideoControl_HSYNC_MASK | |
683 | PM3VideoControl_VSYNC_MASK | | 655 | PM3VideoControl_VSYNC_MASK | |
684 | PM3VideoControl_BLANK_ACTIVE_LOW); | 656 | PM3VideoControl_BLANK_ACTIVE_LOW); |
685 | break; | 657 | break; |
686 | default: | 658 | default: |
687 | DPRINTK("Unsupported blanking %d\n", blank_mode); | 659 | DPRINTK("Unsupported blanking %d\n", blank_mode); |
688 | return 1; | 660 | return 1; |
689 | } | 661 | } |
690 | 662 | ||
691 | PM3_SLOW_WRITE_REG(par,PM3VideoControl, video); | 663 | PM3_WAIT(par, 1); |
692 | 664 | PM3_WRITE_REG(par,PM3VideoControl, video); | |
693 | return 0; | 665 | return 0; |
694 | } | 666 | } |
695 | 667 | ||
@@ -703,9 +675,9 @@ static struct fb_ops pm3fb_ops = { | |||
703 | .fb_set_par = pm3fb_set_par, | 675 | .fb_set_par = pm3fb_set_par, |
704 | .fb_setcolreg = pm3fb_setcolreg, | 676 | .fb_setcolreg = pm3fb_setcolreg, |
705 | .fb_pan_display = pm3fb_pan_display, | 677 | .fb_pan_display = pm3fb_pan_display, |
706 | .fb_fillrect = cfb_fillrect, /* Needed !!! */ | 678 | .fb_fillrect = cfb_fillrect, |
707 | .fb_copyarea = cfb_copyarea, /* Needed !!! */ | 679 | .fb_copyarea = cfb_copyarea, |
708 | .fb_imageblit = cfb_imageblit, /* Needed !!! */ | 680 | .fb_imageblit = cfb_imageblit, |
709 | .fb_blank = pm3fb_blank, | 681 | .fb_blank = pm3fb_blank, |
710 | }; | 682 | }; |
711 | 683 | ||
@@ -722,7 +694,7 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par) | |||
722 | unsigned long memsize = 0, tempBypass, i, temp1, temp2; | 694 | unsigned long memsize = 0, tempBypass, i, temp1, temp2; |
723 | unsigned char __iomem *screen_mem; | 695 | unsigned char __iomem *screen_mem; |
724 | 696 | ||
725 | pm3fb_fix.smem_len = 64 * 1024 * 1024; /* request full aperture size */ | 697 | pm3fb_fix.smem_len = 64 * 1024l * 1024; /* request full aperture size */ |
726 | /* Linear frame buffer - request region and map it. */ | 698 | /* Linear frame buffer - request region and map it. */ |
727 | if (!request_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len, | 699 | if (!request_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len, |
728 | "pm3fb smem")) { | 700 | "pm3fb smem")) { |
@@ -744,7 +716,8 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par) | |||
744 | 716 | ||
745 | DPRINTK("PM3MemBypassWriteMask was: 0x%08lx\n", tempBypass); | 717 | DPRINTK("PM3MemBypassWriteMask was: 0x%08lx\n", tempBypass); |
746 | 718 | ||
747 | PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, 0xFFFFFFFF); | 719 | PM3_WAIT(par, 1); |
720 | PM3_WRITE_REG(par, PM3MemBypassWriteMask, 0xFFFFFFFF); | ||
748 | 721 | ||
749 | /* pm3 split up memory, replicates, and do a lot of nasty stuff IMHO ;-) */ | 722 | /* pm3 split up memory, replicates, and do a lot of nasty stuff IMHO ;-) */ |
750 | for (i = 0; i < 32; i++) { | 723 | for (i = 0; i < 32; i++) { |
@@ -765,10 +738,9 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par) | |||
765 | if (memsize + 1 == i) { | 738 | if (memsize + 1 == i) { |
766 | for (i = 0; i < 32; i++) { | 739 | for (i = 0; i < 32; i++) { |
767 | /* Clear first 32MB ; 0 is 0, no need to byteswap */ | 740 | /* Clear first 32MB ; 0 is 0, no need to byteswap */ |
768 | writel(0x0000000, | 741 | writel(0x0000000, (screen_mem + (i * 1048576))); |
769 | (screen_mem + (i * 1048576))); | ||
770 | mb(); | ||
771 | } | 742 | } |
743 | wmb(); | ||
772 | 744 | ||
773 | for (i = 32; i < 64; i++) { | 745 | for (i = 32; i < 64; i++) { |
774 | fb_writel(i * 0x00345678, | 746 | fb_writel(i * 0x00345678, |
@@ -787,7 +759,8 @@ static unsigned long pm3fb_size_memory(struct pm3_par *par) | |||
787 | } | 759 | } |
788 | DPRINTK("Second detect pass got %ld MB\n", memsize + 1); | 760 | DPRINTK("Second detect pass got %ld MB\n", memsize + 1); |
789 | 761 | ||
790 | PM3_SLOW_WRITE_REG(par, PM3MemBypassWriteMask, tempBypass); | 762 | PM3_WAIT(par, 1); |
763 | PM3_WRITE_REG(par, PM3MemBypassWriteMask, tempBypass); | ||
791 | 764 | ||
792 | iounmap(screen_mem); | 765 | iounmap(screen_mem); |
793 | release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len); | 766 | release_mem_region(pm3fb_fix.smem_start, pm3fb_fix.smem_len); |
@@ -890,7 +863,6 @@ static int __devinit pm3fb_probe(struct pci_dev *dev, | |||
890 | goto err_exit_both; | 863 | goto err_exit_both; |
891 | } | 864 | } |
892 | 865 | ||
893 | /* This has to been done !!! */ | ||
894 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 866 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { |
895 | retval = -ENOMEM; | 867 | retval = -ENOMEM; |
896 | goto err_exit_both; | 868 | goto err_exit_both; |
@@ -907,7 +879,7 @@ static int __devinit pm3fb_probe(struct pci_dev *dev, | |||
907 | } | 879 | } |
908 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 880 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, |
909 | info->fix.id); | 881 | info->fix.id); |
910 | pci_set_drvdata(dev, info); /* or dev_set_drvdata(device, info) */ | 882 | pci_set_drvdata(dev, info); |
911 | return 0; | 883 | return 0; |
912 | 884 | ||
913 | err_exit_all: | 885 | err_exit_all: |
@@ -949,8 +921,7 @@ static void __devexit pm3fb_remove(struct pci_dev *dev) | |||
949 | 921 | ||
950 | static struct pci_device_id pm3fb_id_table[] = { | 922 | static struct pci_device_id pm3fb_id_table[] = { |
951 | { PCI_VENDOR_ID_3DLABS, 0x0a, | 923 | { PCI_VENDOR_ID_3DLABS, 0x0a, |
952 | PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY << 16, | 924 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
953 | 0xff0000, 0 }, | ||
954 | { 0, } | 925 | { 0, } |
955 | }; | 926 | }; |
956 | 927 | ||
@@ -964,6 +935,22 @@ static struct pci_driver pm3fb_driver = { | |||
964 | 935 | ||
965 | MODULE_DEVICE_TABLE(pci, pm3fb_id_table); | 936 | MODULE_DEVICE_TABLE(pci, pm3fb_id_table); |
966 | 937 | ||
938 | #ifndef MODULE | ||
939 | /* | ||
940 | * Setup | ||
941 | */ | ||
942 | |||
943 | /* | ||
944 | * Only necessary if your driver takes special options, | ||
945 | * otherwise we fall back on the generic fb_setup(). | ||
946 | */ | ||
947 | static int __init pm3fb_setup(char *options) | ||
948 | { | ||
949 | /* Parse user speficied options (`video=pm3fb:') */ | ||
950 | return 0; | ||
951 | } | ||
952 | #endif /* MODULE */ | ||
953 | |||
967 | int __init pm3fb_init(void) | 954 | int __init pm3fb_init(void) |
968 | { | 955 | { |
969 | /* | 956 | /* |
@@ -985,22 +972,6 @@ static void __exit pm3fb_exit(void) | |||
985 | pci_unregister_driver(&pm3fb_driver); | 972 | pci_unregister_driver(&pm3fb_driver); |
986 | } | 973 | } |
987 | 974 | ||
988 | #ifndef MODULE | ||
989 | /* | ||
990 | * Setup | ||
991 | */ | ||
992 | |||
993 | /* | ||
994 | * Only necessary if your driver takes special options, | ||
995 | * otherwise we fall back on the generic fb_setup(). | ||
996 | */ | ||
997 | int __init pm3fb_setup(char *options) | ||
998 | { | ||
999 | /* Parse user speficied options (`video=pm3fb:') */ | ||
1000 | return 0; | ||
1001 | } | ||
1002 | #endif /* MODULE */ | ||
1003 | |||
1004 | module_init(pm3fb_init); | 975 | module_init(pm3fb_init); |
1005 | module_exit(pm3fb_exit); | 976 | module_exit(pm3fb_exit); |
1006 | 977 | ||
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 9756a728b74f..9cf92ba5d6e3 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -951,12 +951,14 @@ static int ps3fb_xdr_settings(u64 xdr_lpar) | |||
951 | static struct fb_ops ps3fb_ops = { | 951 | static struct fb_ops ps3fb_ops = { |
952 | .fb_open = ps3fb_open, | 952 | .fb_open = ps3fb_open, |
953 | .fb_release = ps3fb_release, | 953 | .fb_release = ps3fb_release, |
954 | .fb_read = fb_sys_read, | ||
955 | .fb_write = fb_sys_write, | ||
954 | .fb_check_var = ps3fb_check_var, | 956 | .fb_check_var = ps3fb_check_var, |
955 | .fb_set_par = ps3fb_set_par, | 957 | .fb_set_par = ps3fb_set_par, |
956 | .fb_setcolreg = ps3fb_setcolreg, | 958 | .fb_setcolreg = ps3fb_setcolreg, |
957 | .fb_fillrect = cfb_fillrect, | 959 | .fb_fillrect = sys_fillrect, |
958 | .fb_copyarea = cfb_copyarea, | 960 | .fb_copyarea = sys_copyarea, |
959 | .fb_imageblit = cfb_imageblit, | 961 | .fb_imageblit = sys_imageblit, |
960 | .fb_mmap = ps3fb_mmap, | 962 | .fb_mmap = ps3fb_mmap, |
961 | .fb_blank = ps3fb_blank, | 963 | .fb_blank = ps3fb_blank, |
962 | .fb_ioctl = ps3fb_ioctl, | 964 | .fb_ioctl = ps3fb_ioctl, |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 5fc86ea20692..003c49a490eb 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
@@ -660,7 +660,7 @@ int __init w100fb_probe(struct platform_device *pdev) | |||
660 | err = -ENODEV; | 660 | err = -ENODEV; |
661 | goto out; | 661 | goto out; |
662 | } | 662 | } |
663 | printk(" at 0x%08lx.\n", mem->start+W100_CFG_BASE); | 663 | printk(" at 0x%08lx.\n", (unsigned long) mem->start+W100_CFG_BASE); |
664 | 664 | ||
665 | /* Remap the framebuffer */ | 665 | /* Remap the framebuffer */ |
666 | remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE); | 666 | remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE); |
@@ -753,10 +753,14 @@ int __init w100fb_probe(struct platform_device *pdev) | |||
753 | goto out; | 753 | goto out; |
754 | } | 754 | } |
755 | 755 | ||
756 | device_create_file(&pdev->dev, &dev_attr_fastpllclk); | 756 | err = device_create_file(&pdev->dev, &dev_attr_fastpllclk); |
757 | device_create_file(&pdev->dev, &dev_attr_reg_read); | 757 | err |= device_create_file(&pdev->dev, &dev_attr_reg_read); |
758 | device_create_file(&pdev->dev, &dev_attr_reg_write); | 758 | err |= device_create_file(&pdev->dev, &dev_attr_reg_write); |
759 | device_create_file(&pdev->dev, &dev_attr_flip); | 759 | err |= device_create_file(&pdev->dev, &dev_attr_flip); |
760 | |||
761 | if (err != 0) | ||
762 | printk(KERN_WARNING "fb%d: failed to register attributes (%d)\n", | ||
763 | info->node, err); | ||
760 | 764 | ||
761 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); | 765 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id); |
762 | return 0; | 766 | return 0; |
diff --git a/fs/compat.c b/fs/compat.c index 1de2331db844..4db6216e5266 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1544,9 +1544,10 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp, | |||
1544 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, s64 *timeout) | 1544 | compat_ulong_t __user *outp, compat_ulong_t __user *exp, s64 *timeout) |
1545 | { | 1545 | { |
1546 | fd_set_bits fds; | 1546 | fd_set_bits fds; |
1547 | char *bits; | 1547 | void *bits; |
1548 | int size, max_fds, ret = -EINVAL; | 1548 | int size, max_fds, ret = -EINVAL; |
1549 | struct fdtable *fdt; | 1549 | struct fdtable *fdt; |
1550 | long stack_fds[SELECT_STACK_ALLOC/sizeof(long)]; | ||
1550 | 1551 | ||
1551 | if (n < 0) | 1552 | if (n < 0) |
1552 | goto out_nofds; | 1553 | goto out_nofds; |
@@ -1564,11 +1565,14 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp, | |||
1564 | * since we used fdset we need to allocate memory in units of | 1565 | * since we used fdset we need to allocate memory in units of |
1565 | * long-words. | 1566 | * long-words. |
1566 | */ | 1567 | */ |
1567 | ret = -ENOMEM; | ||
1568 | size = FDS_BYTES(n); | 1568 | size = FDS_BYTES(n); |
1569 | bits = kmalloc(6 * size, GFP_KERNEL); | 1569 | bits = stack_fds; |
1570 | if (!bits) | 1570 | if (size > sizeof(stack_fds) / 6) { |
1571 | goto out_nofds; | 1571 | bits = kmalloc(6 * size, GFP_KERNEL); |
1572 | ret = -ENOMEM; | ||
1573 | if (!bits) | ||
1574 | goto out_nofds; | ||
1575 | } | ||
1572 | fds.in = (unsigned long *) bits; | 1576 | fds.in = (unsigned long *) bits; |
1573 | fds.out = (unsigned long *) (bits + size); | 1577 | fds.out = (unsigned long *) (bits + size); |
1574 | fds.ex = (unsigned long *) (bits + 2*size); | 1578 | fds.ex = (unsigned long *) (bits + 2*size); |
@@ -1600,7 +1604,8 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp, | |||
1600 | compat_set_fd_set(n, exp, fds.res_ex)) | 1604 | compat_set_fd_set(n, exp, fds.res_ex)) |
1601 | ret = -EFAULT; | 1605 | ret = -EFAULT; |
1602 | out: | 1606 | out: |
1603 | kfree(bits); | 1607 | if (bits != stack_fds) |
1608 | kfree(bits); | ||
1604 | out_nofds: | 1609 | out_nofds: |
1605 | return ret; | 1610 | return ret; |
1606 | } | 1611 | } |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 9881b5c5de59..59288d817078 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -33,63 +33,6 @@ | |||
33 | #include "ecryptfs_kernel.h" | 33 | #include "ecryptfs_kernel.h" |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * ecryptfs_llseek | ||
37 | * @file: File we are seeking in | ||
38 | * @offset: The offset to seek to | ||
39 | * @origin: 2 - offset from i_size; 1 - offset from f_pos | ||
40 | * | ||
41 | * Returns the position we have seeked to, or negative on error | ||
42 | */ | ||
43 | static loff_t ecryptfs_llseek(struct file *file, loff_t offset, int origin) | ||
44 | { | ||
45 | loff_t rv; | ||
46 | loff_t new_end_pos; | ||
47 | int rc; | ||
48 | int expanding_file = 0; | ||
49 | struct inode *inode = file->f_mapping->host; | ||
50 | |||
51 | /* If our offset is past the end of our file, we're going to | ||
52 | * need to grow it so we have a valid length of 0's */ | ||
53 | new_end_pos = offset; | ||
54 | switch (origin) { | ||
55 | case 2: | ||
56 | new_end_pos += i_size_read(inode); | ||
57 | expanding_file = 1; | ||
58 | break; | ||
59 | case 1: | ||
60 | new_end_pos += file->f_pos; | ||
61 | if (new_end_pos > i_size_read(inode)) { | ||
62 | ecryptfs_printk(KERN_DEBUG, "new_end_pos(=[0x%.16x]) " | ||
63 | "> i_size_read(inode)(=[0x%.16x])\n", | ||
64 | new_end_pos, i_size_read(inode)); | ||
65 | expanding_file = 1; | ||
66 | } | ||
67 | break; | ||
68 | default: | ||
69 | if (new_end_pos > i_size_read(inode)) { | ||
70 | ecryptfs_printk(KERN_DEBUG, "new_end_pos(=[0x%.16x]) " | ||
71 | "> i_size_read(inode)(=[0x%.16x])\n", | ||
72 | new_end_pos, i_size_read(inode)); | ||
73 | expanding_file = 1; | ||
74 | } | ||
75 | } | ||
76 | ecryptfs_printk(KERN_DEBUG, "new_end_pos = [0x%.16x]\n", new_end_pos); | ||
77 | if (expanding_file) { | ||
78 | rc = ecryptfs_truncate(file->f_path.dentry, new_end_pos); | ||
79 | if (rc) { | ||
80 | rv = rc; | ||
81 | ecryptfs_printk(KERN_ERR, "Error on attempt to " | ||
82 | "truncate to (higher) offset [0x%.16x];" | ||
83 | " rc = [%d]\n", new_end_pos, rc); | ||
84 | goto out; | ||
85 | } | ||
86 | } | ||
87 | rv = generic_file_llseek(file, offset, origin); | ||
88 | out: | ||
89 | return rv; | ||
90 | } | ||
91 | |||
92 | /** | ||
93 | * ecryptfs_read_update_atime | 36 | * ecryptfs_read_update_atime |
94 | * | 37 | * |
95 | * generic_file_read updates the atime of upper layer inode. But, it | 38 | * generic_file_read updates the atime of upper layer inode. But, it |
@@ -425,7 +368,7 @@ const struct file_operations ecryptfs_dir_fops = { | |||
425 | }; | 368 | }; |
426 | 369 | ||
427 | const struct file_operations ecryptfs_main_fops = { | 370 | const struct file_operations ecryptfs_main_fops = { |
428 | .llseek = ecryptfs_llseek, | 371 | .llseek = generic_file_llseek, |
429 | .read = do_sync_read, | 372 | .read = do_sync_read, |
430 | .aio_read = ecryptfs_read_update_atime, | 373 | .aio_read = ecryptfs_read_update_atime, |
431 | .write = do_sync_write, | 374 | .write = do_sync_write, |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 88ea6697908f..55cec98a84e7 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -376,9 +376,31 @@ out: | |||
376 | return 0; | 376 | return 0; |
377 | } | 377 | } |
378 | 378 | ||
379 | /** | ||
380 | * eCryptfs does not currently support holes. When writing after a | ||
381 | * seek past the end of the file, eCryptfs fills in 0's through to the | ||
382 | * current location. The code to fill in the 0's to all the | ||
383 | * intermediate pages calls ecryptfs_prepare_write_no_truncate(). | ||
384 | */ | ||
385 | static int | ||
386 | ecryptfs_prepare_write_no_truncate(struct file *file, struct page *page, | ||
387 | unsigned from, unsigned to) | ||
388 | { | ||
389 | int rc = 0; | ||
390 | |||
391 | if (from == 0 && to == PAGE_CACHE_SIZE) | ||
392 | goto out; /* If we are writing a full page, it will be | ||
393 | up to date. */ | ||
394 | if (!PageUptodate(page)) | ||
395 | rc = ecryptfs_do_readpage(file, page, page->index); | ||
396 | out: | ||
397 | return rc; | ||
398 | } | ||
399 | |||
379 | static int ecryptfs_prepare_write(struct file *file, struct page *page, | 400 | static int ecryptfs_prepare_write(struct file *file, struct page *page, |
380 | unsigned from, unsigned to) | 401 | unsigned from, unsigned to) |
381 | { | 402 | { |
403 | loff_t pos; | ||
382 | int rc = 0; | 404 | int rc = 0; |
383 | 405 | ||
384 | if (from == 0 && to == PAGE_CACHE_SIZE) | 406 | if (from == 0 && to == PAGE_CACHE_SIZE) |
@@ -386,6 +408,16 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page, | |||
386 | up to date. */ | 408 | up to date. */ |
387 | if (!PageUptodate(page)) | 409 | if (!PageUptodate(page)) |
388 | rc = ecryptfs_do_readpage(file, page, page->index); | 410 | rc = ecryptfs_do_readpage(file, page, page->index); |
411 | pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; | ||
412 | if (pos > i_size_read(page->mapping->host)) { | ||
413 | rc = ecryptfs_truncate(file->f_path.dentry, pos); | ||
414 | if (rc) { | ||
415 | printk(KERN_ERR "Error on attempt to " | ||
416 | "truncate to (higher) offset [%lld];" | ||
417 | " rc = [%d]\n", pos, rc); | ||
418 | goto out; | ||
419 | } | ||
420 | } | ||
389 | out: | 421 | out: |
390 | return rc; | 422 | return rc; |
391 | } | 423 | } |
@@ -744,10 +776,10 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros) | |||
744 | rc = PTR_ERR(tmp_page); | 776 | rc = PTR_ERR(tmp_page); |
745 | goto out; | 777 | goto out; |
746 | } | 778 | } |
747 | rc = ecryptfs_prepare_write(file, tmp_page, start, start + num_zeros); | 779 | if ((rc = ecryptfs_prepare_write_no_truncate(file, tmp_page, start, |
748 | if (rc) { | 780 | (start + num_zeros)))) { |
749 | ecryptfs_printk(KERN_ERR, "Error preparing to write zero's " | 781 | ecryptfs_printk(KERN_ERR, "Error preparing to write zero's " |
750 | "to remainder of page at index [0x%.16x]\n", | 782 | "to page at index [0x%.16x]\n", |
751 | index); | 783 | index); |
752 | page_cache_release(tmp_page); | 784 | page_cache_release(tmp_page); |
753 | goto out; | 785 | goto out; |
@@ -134,6 +134,9 @@ asmlinkage long sys_uselib(const char __user * library) | |||
134 | if (error) | 134 | if (error) |
135 | goto out; | 135 | goto out; |
136 | 136 | ||
137 | error = -EACCES; | ||
138 | if (nd.mnt->mnt_flags & MNT_NOEXEC) | ||
139 | goto exit; | ||
137 | error = -EINVAL; | 140 | error = -EINVAL; |
138 | if (!S_ISREG(nd.dentry->d_inode->i_mode)) | 141 | if (!S_ISREG(nd.dentry->d_inode->i_mode)) |
139 | goto exit; | 142 | goto exit; |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 8890eba1db52..bd5a772d8ccf 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -485,7 +485,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode, | |||
485 | static int fuse_create(struct inode *dir, struct dentry *entry, int mode, | 485 | static int fuse_create(struct inode *dir, struct dentry *entry, int mode, |
486 | struct nameidata *nd) | 486 | struct nameidata *nd) |
487 | { | 487 | { |
488 | if (nd && (nd->flags & LOOKUP_CREATE)) { | 488 | if (nd && (nd->flags & LOOKUP_OPEN)) { |
489 | int err = fuse_create_open(dir, entry, mode, nd); | 489 | int err = fuse_create_open(dir, entry, mode, nd); |
490 | if (err != -ENOSYS) | 490 | if (err != -ENOSYS) |
491 | return err; | 491 | return err; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index d0ed60bc3188..adf7995232b8 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -610,7 +610,9 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | |||
610 | ssize_t res; | 610 | ssize_t res; |
611 | /* Don't allow parallel writes to the same file */ | 611 | /* Don't allow parallel writes to the same file */ |
612 | mutex_lock(&inode->i_mutex); | 612 | mutex_lock(&inode->i_mutex); |
613 | res = fuse_direct_io(file, buf, count, ppos, 1); | 613 | res = generic_write_checks(file, ppos, &count, 0); |
614 | if (!res) | ||
615 | res = fuse_direct_io(file, buf, count, ppos, 1); | ||
614 | mutex_unlock(&inode->i_mutex); | 616 | mutex_unlock(&inode->i_mutex); |
615 | return res; | 617 | return res; |
616 | } | 618 | } |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 78f7a1dc90dd..9804c0cdcb42 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -454,6 +454,7 @@ static const struct super_operations fuse_super_operations = { | |||
454 | .destroy_inode = fuse_destroy_inode, | 454 | .destroy_inode = fuse_destroy_inode, |
455 | .read_inode = fuse_read_inode, | 455 | .read_inode = fuse_read_inode, |
456 | .clear_inode = fuse_clear_inode, | 456 | .clear_inode = fuse_clear_inode, |
457 | .drop_inode = generic_delete_inode, | ||
457 | .remount_fs = fuse_remount_fs, | 458 | .remount_fs = fuse_remount_fs, |
458 | .put_super = fuse_put_super, | 459 | .put_super = fuse_put_super, |
459 | .umount_begin = fuse_umount_begin, | 460 | .umount_begin = fuse_umount_begin, |
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 9c23fee3bae9..ffbfc2caaf20 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/buffer_head.h> | 10 | #include <linux/buffer_head.h> |
11 | #include <asm/uaccess.h> | 11 | #include <asm/uaccess.h> |
12 | 12 | ||
13 | extern struct reiserfs_key MIN_KEY; | 13 | extern const struct reiserfs_key MIN_KEY; |
14 | 14 | ||
15 | static int reiserfs_readdir(struct file *, void *, filldir_t); | 15 | static int reiserfs_readdir(struct file *, void *, filldir_t); |
16 | static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, | 16 | static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, |
diff --git a/fs/signalfd.c b/fs/signalfd.c index 7cfeab412b45..f1da89203a9a 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * Now using anonymous inode source. | 11 | * Now using anonymous inode source. |
12 | * Thanks to Oleg Nesterov for useful code review and suggestions. | 12 | * Thanks to Oleg Nesterov for useful code review and suggestions. |
13 | * More comments and suggestions from Arnd Bergmann. | 13 | * More comments and suggestions from Arnd Bergmann. |
14 | * Sat May 19, 2007: Davi E. M. Arnaut <davi@haxent.com.br> | ||
15 | * Retrieve multiple signals with one read() call | ||
14 | */ | 16 | */ |
15 | 17 | ||
16 | #include <linux/file.h> | 18 | #include <linux/file.h> |
@@ -206,6 +208,59 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, | |||
206 | return err ? -EFAULT: sizeof(*uinfo); | 208 | return err ? -EFAULT: sizeof(*uinfo); |
207 | } | 209 | } |
208 | 210 | ||
211 | static ssize_t signalfd_dequeue(struct signalfd_ctx *ctx, siginfo_t *info, | ||
212 | int nonblock) | ||
213 | { | ||
214 | ssize_t ret; | ||
215 | struct signalfd_lockctx lk; | ||
216 | DECLARE_WAITQUEUE(wait, current); | ||
217 | |||
218 | if (!signalfd_lock(ctx, &lk)) | ||
219 | return 0; | ||
220 | |||
221 | ret = dequeue_signal(lk.tsk, &ctx->sigmask, info); | ||
222 | switch (ret) { | ||
223 | case 0: | ||
224 | if (!nonblock) | ||
225 | break; | ||
226 | ret = -EAGAIN; | ||
227 | default: | ||
228 | signalfd_unlock(&lk); | ||
229 | return ret; | ||
230 | } | ||
231 | |||
232 | add_wait_queue(&ctx->wqh, &wait); | ||
233 | for (;;) { | ||
234 | set_current_state(TASK_INTERRUPTIBLE); | ||
235 | ret = dequeue_signal(lk.tsk, &ctx->sigmask, info); | ||
236 | signalfd_unlock(&lk); | ||
237 | if (ret != 0) | ||
238 | break; | ||
239 | if (signal_pending(current)) { | ||
240 | ret = -ERESTARTSYS; | ||
241 | break; | ||
242 | } | ||
243 | schedule(); | ||
244 | ret = signalfd_lock(ctx, &lk); | ||
245 | if (unlikely(!ret)) { | ||
246 | /* | ||
247 | * Let the caller read zero byte, ala socket | ||
248 | * recv() when the peer disconnect. This test | ||
249 | * must be done before doing a dequeue_signal(), | ||
250 | * because if the sighand has been orphaned, | ||
251 | * the dequeue_signal() call is going to crash | ||
252 | * because ->sighand will be long gone. | ||
253 | */ | ||
254 | break; | ||
255 | } | ||
256 | } | ||
257 | |||
258 | remove_wait_queue(&ctx->wqh, &wait); | ||
259 | __set_current_state(TASK_RUNNING); | ||
260 | |||
261 | return ret; | ||
262 | } | ||
263 | |||
209 | /* | 264 | /* |
210 | * Returns either the size of a "struct signalfd_siginfo", or zero if the | 265 | * Returns either the size of a "struct signalfd_siginfo", or zero if the |
211 | * sighand we are attached to, has been orphaned. The "count" parameter | 266 | * sighand we are attached to, has been orphaned. The "count" parameter |
@@ -215,55 +270,30 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count, | |||
215 | loff_t *ppos) | 270 | loff_t *ppos) |
216 | { | 271 | { |
217 | struct signalfd_ctx *ctx = file->private_data; | 272 | struct signalfd_ctx *ctx = file->private_data; |
218 | ssize_t res = 0; | 273 | struct signalfd_siginfo __user *siginfo; |
219 | int locked, signo; | 274 | int nonblock = file->f_flags & O_NONBLOCK; |
275 | ssize_t ret, total = 0; | ||
220 | siginfo_t info; | 276 | siginfo_t info; |
221 | struct signalfd_lockctx lk; | ||
222 | DECLARE_WAITQUEUE(wait, current); | ||
223 | 277 | ||
224 | if (count < sizeof(struct signalfd_siginfo)) | 278 | count /= sizeof(struct signalfd_siginfo); |
279 | if (!count) | ||
225 | return -EINVAL; | 280 | return -EINVAL; |
226 | locked = signalfd_lock(ctx, &lk); | ||
227 | if (!locked) | ||
228 | return 0; | ||
229 | res = -EAGAIN; | ||
230 | signo = dequeue_signal(lk.tsk, &ctx->sigmask, &info); | ||
231 | if (signo == 0 && !(file->f_flags & O_NONBLOCK)) { | ||
232 | add_wait_queue(&ctx->wqh, &wait); | ||
233 | for (;;) { | ||
234 | set_current_state(TASK_INTERRUPTIBLE); | ||
235 | signo = dequeue_signal(lk.tsk, &ctx->sigmask, &info); | ||
236 | if (signo != 0) | ||
237 | break; | ||
238 | if (signal_pending(current)) { | ||
239 | res = -ERESTARTSYS; | ||
240 | break; | ||
241 | } | ||
242 | signalfd_unlock(&lk); | ||
243 | schedule(); | ||
244 | locked = signalfd_lock(ctx, &lk); | ||
245 | if (unlikely(!locked)) { | ||
246 | /* | ||
247 | * Let the caller read zero byte, ala socket | ||
248 | * recv() when the peer disconnect. This test | ||
249 | * must be done before doing a dequeue_signal(), | ||
250 | * because if the sighand has been orphaned, | ||
251 | * the dequeue_signal() call is going to crash. | ||
252 | */ | ||
253 | res = 0; | ||
254 | break; | ||
255 | } | ||
256 | } | ||
257 | remove_wait_queue(&ctx->wqh, &wait); | ||
258 | __set_current_state(TASK_RUNNING); | ||
259 | } | ||
260 | if (likely(locked)) | ||
261 | signalfd_unlock(&lk); | ||
262 | if (likely(signo)) | ||
263 | res = signalfd_copyinfo((struct signalfd_siginfo __user *) buf, | ||
264 | &info); | ||
265 | 281 | ||
266 | return res; | 282 | siginfo = (struct signalfd_siginfo __user *) buf; |
283 | |||
284 | do { | ||
285 | ret = signalfd_dequeue(ctx, &info, nonblock); | ||
286 | if (unlikely(ret <= 0)) | ||
287 | break; | ||
288 | ret = signalfd_copyinfo(siginfo, &info); | ||
289 | if (ret < 0) | ||
290 | break; | ||
291 | siginfo++; | ||
292 | total += ret; | ||
293 | nonblock = 1; | ||
294 | } while (--count); | ||
295 | |||
296 | return total ? total : ret; | ||
267 | } | 297 | } |
268 | 298 | ||
269 | static const struct file_operations signalfd_fops = { | 299 | static const struct file_operations signalfd_fops = { |
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 0baa2f89463c..437aac801711 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h | |||
@@ -182,7 +182,7 @@ static __inline__ int atomic_add_return(int i, atomic_t *v) | |||
182 | int __i; | 182 | int __i; |
183 | #ifdef CONFIG_M386 | 183 | #ifdef CONFIG_M386 |
184 | unsigned long flags; | 184 | unsigned long flags; |
185 | if(unlikely(boot_cpu_data.x86==3)) | 185 | if(unlikely(boot_cpu_data.x86 <= 3)) |
186 | goto no_xadd; | 186 | goto no_xadd; |
187 | #endif | 187 | #endif |
188 | /* Modern 486+ processor */ | 188 | /* Modern 486+ processor */ |
diff --git a/include/asm-i386/local.h b/include/asm-i386/local.h index e13d3e98823f..6e85975b9ed2 100644 --- a/include/asm-i386/local.h +++ b/include/asm-i386/local.h | |||
@@ -135,7 +135,7 @@ static __inline__ long local_add_return(long i, local_t *l) | |||
135 | long __i; | 135 | long __i; |
136 | #ifdef CONFIG_M386 | 136 | #ifdef CONFIG_M386 |
137 | unsigned long flags; | 137 | unsigned long flags; |
138 | if(unlikely(boot_cpu_data.x86==3)) | 138 | if(unlikely(boot_cpu_data.x86 <= 3)) |
139 | goto no_xadd; | 139 | goto no_xadd; |
140 | #endif | 140 | #endif |
141 | /* Modern 486+ processor */ | 141 | /* Modern 486+ processor */ |
diff --git a/include/linux/capability.h b/include/linux/capability.h index 6548b35ab9f6..bbf8df7de28f 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/compiler.h> | 17 | #include <linux/compiler.h> |
18 | 18 | ||
19 | struct task_struct; | ||
20 | |||
19 | /* User-level do most of the mapping between kernel and user | 21 | /* User-level do most of the mapping between kernel and user |
20 | capabilities based on the version tag given by the kernel. The | 22 | capabilities based on the version tag given by the kernel. The |
21 | kernel might be somewhat backwards compatible, but don't bet on | 23 | kernel might be somewhat backwards compatible, but don't bet on |
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 5e75e26d4787..4631086f5060 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -37,25 +37,25 @@ static inline void do_not_freeze(struct task_struct *p) | |||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Wake up a frozen process | 39 | * Wake up a frozen process |
40 | * | ||
41 | * task_lock() is taken to prevent the race with refrigerator() which may | ||
42 | * occur if the freezing of tasks fails. Namely, without the lock, if the | ||
43 | * freezing of tasks failed, thaw_tasks() might have run before a task in | ||
44 | * refrigerator() could call frozen_process(), in which case the task would be | ||
45 | * frozen and no one would thaw it. | ||
40 | */ | 46 | */ |
41 | static inline int thaw_process(struct task_struct *p) | 47 | static inline int thaw_process(struct task_struct *p) |
42 | { | 48 | { |
49 | task_lock(p); | ||
43 | if (frozen(p)) { | 50 | if (frozen(p)) { |
44 | p->flags &= ~PF_FROZEN; | 51 | p->flags &= ~PF_FROZEN; |
52 | task_unlock(p); | ||
45 | wake_up_process(p); | 53 | wake_up_process(p); |
46 | return 1; | 54 | return 1; |
47 | } | 55 | } |
48 | return 0; | ||
49 | } | ||
50 | |||
51 | /* | ||
52 | * freezing is complete, mark process as frozen | ||
53 | */ | ||
54 | static inline void frozen_process(struct task_struct *p) | ||
55 | { | ||
56 | p->flags |= PF_FROZEN; | ||
57 | wmb(); | ||
58 | clear_tsk_thread_flag(p, TIF_FREEZE); | 56 | clear_tsk_thread_flag(p, TIF_FREEZE); |
57 | task_unlock(p); | ||
58 | return 0; | ||
59 | } | 59 | } |
60 | 60 | ||
61 | extern void refrigerator(void); | 61 | extern void refrigerator(void); |
@@ -71,14 +71,55 @@ static inline int try_to_freeze(void) | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | extern void thaw_some_processes(int all); | 74 | /* |
75 | * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it | ||
76 | * calls wait_for_completion(&vfork) and reset right after it returns from this | ||
77 | * function. Next, the parent should call try_to_freeze() to freeze itself | ||
78 | * appropriately in case the child has exited before the freezing of tasks is | ||
79 | * complete. However, we don't want kernel threads to be frozen in unexpected | ||
80 | * places, so we allow them to block freeze_processes() instead or to set | ||
81 | * PF_NOFREEZE if needed and PF_FREEZER_SKIP is only set for userland vfork | ||
82 | * parents. Fortunately, in the ____call_usermodehelper() case the parent won't | ||
83 | * really block freeze_processes(), since ____call_usermodehelper() (the child) | ||
84 | * does a little before exec/exit and it can't be frozen before waking up the | ||
85 | * parent. | ||
86 | */ | ||
87 | |||
88 | /* | ||
89 | * If the current task is a user space one, tell the freezer not to count it as | ||
90 | * freezable. | ||
91 | */ | ||
92 | static inline void freezer_do_not_count(void) | ||
93 | { | ||
94 | if (current->mm) | ||
95 | current->flags |= PF_FREEZER_SKIP; | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * If the current task is a user space one, tell the freezer to count it as | ||
100 | * freezable again and try to freeze it. | ||
101 | */ | ||
102 | static inline void freezer_count(void) | ||
103 | { | ||
104 | if (current->mm) { | ||
105 | current->flags &= ~PF_FREEZER_SKIP; | ||
106 | try_to_freeze(); | ||
107 | } | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Check if the task should be counted as freezeable by the freezer | ||
112 | */ | ||
113 | static inline int freezer_should_skip(struct task_struct *p) | ||
114 | { | ||
115 | return !!(p->flags & PF_FREEZER_SKIP); | ||
116 | } | ||
75 | 117 | ||
76 | #else | 118 | #else |
77 | static inline int frozen(struct task_struct *p) { return 0; } | 119 | static inline int frozen(struct task_struct *p) { return 0; } |
78 | static inline int freezing(struct task_struct *p) { return 0; } | 120 | static inline int freezing(struct task_struct *p) { return 0; } |
79 | static inline void freeze(struct task_struct *p) { BUG(); } | 121 | static inline void freeze(struct task_struct *p) { BUG(); } |
80 | static inline int thaw_process(struct task_struct *p) { return 1; } | 122 | static inline int thaw_process(struct task_struct *p) { return 1; } |
81 | static inline void frozen_process(struct task_struct *p) { BUG(); } | ||
82 | 123 | ||
83 | static inline void refrigerator(void) {} | 124 | static inline void refrigerator(void) {} |
84 | static inline int freeze_processes(void) { BUG(); return 0; } | 125 | static inline int freeze_processes(void) { BUG(); return 0; } |
@@ -86,5 +127,7 @@ static inline void thaw_processes(void) {} | |||
86 | 127 | ||
87 | static inline int try_to_freeze(void) { return 0; } | 128 | static inline int try_to_freeze(void) { return 0; } |
88 | 129 | ||
89 | 130 | static inline void freezer_do_not_count(void) {} | |
131 | static inline void freezer_count(void) {} | ||
132 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } | ||
90 | #endif | 133 | #endif |
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 4c03ee353e78..9756fc102a83 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -66,6 +66,7 @@ struct partition { | |||
66 | #include <linux/smp.h> | 66 | #include <linux/smp.h> |
67 | #include <linux/string.h> | 67 | #include <linux/string.h> |
68 | #include <linux/fs.h> | 68 | #include <linux/fs.h> |
69 | #include <linux/workqueue.h> | ||
69 | 70 | ||
70 | struct partition { | 71 | struct partition { |
71 | unsigned char boot_ind; /* 0x80 - active */ | 72 | unsigned char boot_ind; /* 0x80 - active */ |
@@ -94,6 +95,7 @@ struct hd_struct { | |||
94 | 95 | ||
95 | #define GENHD_FL_REMOVABLE 1 | 96 | #define GENHD_FL_REMOVABLE 1 |
96 | #define GENHD_FL_DRIVERFS 2 | 97 | #define GENHD_FL_DRIVERFS 2 |
98 | #define GENHD_FL_MEDIA_CHANGE_NOTIFY 4 | ||
97 | #define GENHD_FL_CD 8 | 99 | #define GENHD_FL_CD 8 |
98 | #define GENHD_FL_UP 16 | 100 | #define GENHD_FL_UP 16 |
99 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 | 101 | #define GENHD_FL_SUPPRESS_PARTITION_INFO 32 |
@@ -138,6 +140,7 @@ struct gendisk { | |||
138 | #else | 140 | #else |
139 | struct disk_stats dkstats; | 141 | struct disk_stats dkstats; |
140 | #endif | 142 | #endif |
143 | struct work_struct async_notify; | ||
141 | }; | 144 | }; |
142 | 145 | ||
143 | /* Structure for sysfs attributes on block devices */ | 146 | /* Structure for sysfs attributes on block devices */ |
@@ -419,7 +422,7 @@ extern struct gendisk *alloc_disk_node(int minors, int node_id); | |||
419 | extern struct gendisk *alloc_disk(int minors); | 422 | extern struct gendisk *alloc_disk(int minors); |
420 | extern struct kobject *get_disk(struct gendisk *disk); | 423 | extern struct kobject *get_disk(struct gendisk *disk); |
421 | extern void put_disk(struct gendisk *disk); | 424 | extern void put_disk(struct gendisk *disk); |
422 | 425 | extern void genhd_media_change_notify(struct gendisk *disk); | |
423 | extern void blk_register_region(dev_t dev, unsigned long range, | 426 | extern void blk_register_region(dev_t dev, unsigned long range, |
424 | struct module *module, | 427 | struct module *module, |
425 | struct kobject *(*probe)(dev_t, int *, void *), | 428 | struct kobject *(*probe)(dev_t, int *, void *), |
diff --git a/include/linux/raid/bitmap.h b/include/linux/raid/bitmap.h index 6db9a4c15355..dd5a05d03d4f 100644 --- a/include/linux/raid/bitmap.h +++ b/include/linux/raid/bitmap.h | |||
@@ -232,6 +232,7 @@ struct bitmap { | |||
232 | struct page **filemap; /* list of cache pages for the file */ | 232 | struct page **filemap; /* list of cache pages for the file */ |
233 | unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ | 233 | unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ |
234 | unsigned long file_pages; /* number of pages in the file */ | 234 | unsigned long file_pages; /* number of pages in the file */ |
235 | int last_page_size; /* bytes in the last page */ | ||
235 | 236 | ||
236 | unsigned long flags; | 237 | unsigned long flags; |
237 | 238 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index a81897e2a244..d58e74b98367 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1182,6 +1182,7 @@ static inline void put_task_struct(struct task_struct *t) | |||
1182 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ | 1182 | #define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ |
1183 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ | 1183 | #define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */ |
1184 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ | 1184 | #define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ |
1185 | #define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezeable */ | ||
1185 | 1186 | ||
1186 | /* | 1187 | /* |
1187 | * Only the _current_ task can read/write to tsk->flags, but other | 1188 | * Only the _current_ task can read/write to tsk->flags, but other |
@@ -1615,11 +1616,13 @@ static inline int lock_need_resched(spinlock_t *lock) | |||
1615 | return 0; | 1616 | return 0; |
1616 | } | 1617 | } |
1617 | 1618 | ||
1618 | /* Reevaluate whether the task has signals pending delivery. | 1619 | /* |
1619 | This is required every time the blocked sigset_t changes. | 1620 | * Reevaluate whether the task has signals pending delivery. |
1620 | callers must hold sighand->siglock. */ | 1621 | * Wake the task if so. |
1621 | 1622 | * This is required every time the blocked sigset_t changes. | |
1622 | extern FASTCALL(void recalc_sigpending_tsk(struct task_struct *t)); | 1623 | * callers must hold sighand->siglock. |
1624 | */ | ||
1625 | extern void recalc_sigpending_and_wake(struct task_struct *t); | ||
1623 | extern void recalc_sigpending(void); | 1626 | extern void recalc_sigpending(void); |
1624 | 1627 | ||
1625 | extern void signal_wake_up(struct task_struct *t, int resume_stopped); | 1628 | extern void signal_wake_up(struct task_struct *t, int resume_stopped); |
diff --git a/kernel/exit.c b/kernel/exit.c index c6d14b8008dd..5b888c24e43e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -762,11 +762,8 @@ static void exit_notify(struct task_struct *tsk) | |||
762 | read_lock(&tasklist_lock); | 762 | read_lock(&tasklist_lock); |
763 | spin_lock_irq(&tsk->sighand->siglock); | 763 | spin_lock_irq(&tsk->sighand->siglock); |
764 | for (t = next_thread(tsk); t != tsk; t = next_thread(t)) | 764 | for (t = next_thread(tsk); t != tsk; t = next_thread(t)) |
765 | if (!signal_pending(t) && !(t->flags & PF_EXITING)) { | 765 | if (!signal_pending(t) && !(t->flags & PF_EXITING)) |
766 | recalc_sigpending_tsk(t); | 766 | recalc_sigpending_and_wake(t); |
767 | if (signal_pending(t)) | ||
768 | signal_wake_up(t, 0); | ||
769 | } | ||
770 | spin_unlock_irq(&tsk->sighand->siglock); | 767 | spin_unlock_irq(&tsk->sighand->siglock); |
771 | read_unlock(&tasklist_lock); | 768 | read_unlock(&tasklist_lock); |
772 | } | 769 | } |
diff --git a/kernel/fork.c b/kernel/fork.c index 87069cfc18a1..73ad5cda1bcd 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/acct.h> | 45 | #include <linux/acct.h> |
46 | #include <linux/tsacct_kern.h> | 46 | #include <linux/tsacct_kern.h> |
47 | #include <linux/cn_proc.h> | 47 | #include <linux/cn_proc.h> |
48 | #include <linux/freezer.h> | ||
48 | #include <linux/delayacct.h> | 49 | #include <linux/delayacct.h> |
49 | #include <linux/taskstats_kern.h> | 50 | #include <linux/taskstats_kern.h> |
50 | #include <linux/random.h> | 51 | #include <linux/random.h> |
@@ -1405,7 +1406,9 @@ long do_fork(unsigned long clone_flags, | |||
1405 | } | 1406 | } |
1406 | 1407 | ||
1407 | if (clone_flags & CLONE_VFORK) { | 1408 | if (clone_flags & CLONE_VFORK) { |
1409 | freezer_do_not_count(); | ||
1408 | wait_for_completion(&vfork); | 1410 | wait_for_completion(&vfork); |
1411 | freezer_count(); | ||
1409 | if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) { | 1412 | if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) { |
1410 | current->ptrace_message = nr; | 1413 | current->ptrace_message = nr; |
1411 | ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); | 1414 | ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP); |
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index b0d81aae472f..bd9e272d55e9 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -135,6 +135,39 @@ report_bad_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int try_misrouted_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) | ||
139 | { | ||
140 | struct irqaction *action; | ||
141 | |||
142 | if (!irqfixup) | ||
143 | return 0; | ||
144 | |||
145 | /* We didn't actually handle the IRQ - see if it was misrouted? */ | ||
146 | if (action_ret == IRQ_NONE) | ||
147 | return 1; | ||
148 | |||
149 | /* | ||
150 | * But for 'irqfixup == 2' we also do it for handled interrupts if | ||
151 | * they are marked as IRQF_IRQPOLL (or for irq zero, which is the | ||
152 | * traditional PC timer interrupt.. Legacy) | ||
153 | */ | ||
154 | if (irqfixup < 2) | ||
155 | return 0; | ||
156 | |||
157 | if (!irq) | ||
158 | return 1; | ||
159 | |||
160 | /* | ||
161 | * Since we don't get the descriptor lock, "action" can | ||
162 | * change under us. We don't really care, but we don't | ||
163 | * want to follow a NULL pointer. So tell the compiler to | ||
164 | * just load it once by using a barrier. | ||
165 | */ | ||
166 | action = desc->action; | ||
167 | barrier(); | ||
168 | return action && (action->flags & IRQF_IRQPOLL); | ||
169 | } | ||
170 | |||
138 | void note_interrupt(unsigned int irq, struct irq_desc *desc, | 171 | void note_interrupt(unsigned int irq, struct irq_desc *desc, |
139 | irqreturn_t action_ret) | 172 | irqreturn_t action_ret) |
140 | { | 173 | { |
@@ -144,15 +177,10 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc, | |||
144 | report_bad_irq(irq, desc, action_ret); | 177 | report_bad_irq(irq, desc, action_ret); |
145 | } | 178 | } |
146 | 179 | ||
147 | if (unlikely(irqfixup)) { | 180 | if (unlikely(try_misrouted_irq(irq, desc, action_ret))) { |
148 | /* Don't punish working computers */ | 181 | int ok = misrouted_irq(irq); |
149 | if ((irqfixup == 2 && ((irq == 0) || | 182 | if (action_ret == IRQ_NONE) |
150 | (desc->action->flags & IRQF_IRQPOLL))) || | 183 | desc->irqs_unhandled -= ok; |
151 | action_ret == IRQ_NONE) { | ||
152 | int ok = misrouted_irq(irq); | ||
153 | if (action_ret == IRQ_NONE) | ||
154 | desc->irqs_unhandled -= ok; | ||
155 | } | ||
156 | } | 184 | } |
157 | 185 | ||
158 | desc->irq_count++; | 186 | desc->irq_count++; |
diff --git a/kernel/kthread.c b/kernel/kthread.c index df8a8e8f6ca4..bbd51b81a3e8 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -70,7 +70,7 @@ static int kthread(void *_create) | |||
70 | data = create->data; | 70 | data = create->data; |
71 | 71 | ||
72 | /* OK, tell user we're spawned, wait for stop or wakeup */ | 72 | /* OK, tell user we're spawned, wait for stop or wakeup */ |
73 | __set_current_state(TASK_INTERRUPTIBLE); | 73 | __set_current_state(TASK_UNINTERRUPTIBLE); |
74 | complete(&create->started); | 74 | complete(&create->started); |
75 | schedule(); | 75 | schedule(); |
76 | 76 | ||
@@ -162,7 +162,10 @@ EXPORT_SYMBOL(kthread_create); | |||
162 | */ | 162 | */ |
163 | void kthread_bind(struct task_struct *k, unsigned int cpu) | 163 | void kthread_bind(struct task_struct *k, unsigned int cpu) |
164 | { | 164 | { |
165 | BUG_ON(k->state != TASK_INTERRUPTIBLE); | 165 | if (k->state != TASK_UNINTERRUPTIBLE) { |
166 | WARN_ON(1); | ||
167 | return; | ||
168 | } | ||
166 | /* Must have done schedule() in kthread() before we set_task_cpu */ | 169 | /* Must have done schedule() in kthread() before we set_task_cpu */ |
167 | wait_task_inactive(k); | 170 | wait_task_inactive(k); |
168 | set_task_cpu(k, cpu); | 171 | set_task_cpu(k, cpu); |
diff --git a/kernel/power/process.c b/kernel/power/process.c index 088419387388..e0233d8422b9 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
@@ -31,16 +31,36 @@ static inline int freezeable(struct task_struct * p) | |||
31 | return 1; | 31 | return 1; |
32 | } | 32 | } |
33 | 33 | ||
34 | /* | ||
35 | * freezing is complete, mark current process as frozen | ||
36 | */ | ||
37 | static inline void frozen_process(void) | ||
38 | { | ||
39 | if (!unlikely(current->flags & PF_NOFREEZE)) { | ||
40 | current->flags |= PF_FROZEN; | ||
41 | wmb(); | ||
42 | } | ||
43 | clear_tsk_thread_flag(current, TIF_FREEZE); | ||
44 | } | ||
45 | |||
34 | /* Refrigerator is place where frozen processes are stored :-). */ | 46 | /* Refrigerator is place where frozen processes are stored :-). */ |
35 | void refrigerator(void) | 47 | void refrigerator(void) |
36 | { | 48 | { |
37 | /* Hmm, should we be allowed to suspend when there are realtime | 49 | /* Hmm, should we be allowed to suspend when there are realtime |
38 | processes around? */ | 50 | processes around? */ |
39 | long save; | 51 | long save; |
52 | |||
53 | task_lock(current); | ||
54 | if (freezing(current)) { | ||
55 | frozen_process(); | ||
56 | task_unlock(current); | ||
57 | } else { | ||
58 | task_unlock(current); | ||
59 | return; | ||
60 | } | ||
40 | save = current->state; | 61 | save = current->state; |
41 | pr_debug("%s entered refrigerator\n", current->comm); | 62 | pr_debug("%s entered refrigerator\n", current->comm); |
42 | 63 | ||
43 | frozen_process(current); | ||
44 | spin_lock_irq(¤t->sighand->siglock); | 64 | spin_lock_irq(¤t->sighand->siglock); |
45 | recalc_sigpending(); /* We sent fake signal, clean it up */ | 65 | recalc_sigpending(); /* We sent fake signal, clean it up */ |
46 | spin_unlock_irq(¤t->sighand->siglock); | 66 | spin_unlock_irq(¤t->sighand->siglock); |
@@ -81,7 +101,7 @@ static void cancel_freezing(struct task_struct *p) | |||
81 | pr_debug(" clean up: %s\n", p->comm); | 101 | pr_debug(" clean up: %s\n", p->comm); |
82 | do_not_freeze(p); | 102 | do_not_freeze(p); |
83 | spin_lock_irqsave(&p->sighand->siglock, flags); | 103 | spin_lock_irqsave(&p->sighand->siglock, flags); |
84 | recalc_sigpending_tsk(p); | 104 | recalc_sigpending_and_wake(p); |
85 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | 105 | spin_unlock_irqrestore(&p->sighand->siglock, flags); |
86 | } | 106 | } |
87 | } | 107 | } |
@@ -112,22 +132,12 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space) | |||
112 | cancel_freezing(p); | 132 | cancel_freezing(p); |
113 | continue; | 133 | continue; |
114 | } | 134 | } |
115 | if (is_user_space(p)) { | 135 | if (freeze_user_space && !is_user_space(p)) |
116 | if (!freeze_user_space) | 136 | continue; |
117 | continue; | 137 | |
118 | 138 | freeze_process(p); | |
119 | /* Freeze the task unless there is a vfork | 139 | if (!freezer_should_skip(p)) |
120 | * completion pending | 140 | todo++; |
121 | */ | ||
122 | if (!p->vfork_done) | ||
123 | freeze_process(p); | ||
124 | } else { | ||
125 | if (freeze_user_space) | ||
126 | continue; | ||
127 | |||
128 | freeze_process(p); | ||
129 | } | ||
130 | todo++; | ||
131 | } while_each_thread(g, p); | 141 | } while_each_thread(g, p); |
132 | read_unlock(&tasklist_lock); | 142 | read_unlock(&tasklist_lock); |
133 | yield(); /* Yield is okay here */ | 143 | yield(); /* Yield is okay here */ |
@@ -149,13 +159,16 @@ static unsigned int try_to_freeze_tasks(int freeze_user_space) | |||
149 | TIMEOUT / HZ, todo); | 159 | TIMEOUT / HZ, todo); |
150 | read_lock(&tasklist_lock); | 160 | read_lock(&tasklist_lock); |
151 | do_each_thread(g, p) { | 161 | do_each_thread(g, p) { |
152 | if (is_user_space(p) == !freeze_user_space) | 162 | if (freeze_user_space && !is_user_space(p)) |
153 | continue; | 163 | continue; |
154 | 164 | ||
155 | if (freezeable(p) && !frozen(p)) | 165 | task_lock(p); |
166 | if (freezeable(p) && !frozen(p) && | ||
167 | !freezer_should_skip(p)) | ||
156 | printk(KERN_ERR " %s\n", p->comm); | 168 | printk(KERN_ERR " %s\n", p->comm); |
157 | 169 | ||
158 | cancel_freezing(p); | 170 | cancel_freezing(p); |
171 | task_unlock(p); | ||
159 | } while_each_thread(g, p); | 172 | } while_each_thread(g, p); |
160 | read_unlock(&tasklist_lock); | 173 | read_unlock(&tasklist_lock); |
161 | } | 174 | } |
@@ -200,9 +213,7 @@ static void thaw_tasks(int thaw_user_space) | |||
200 | if (is_user_space(p) == !thaw_user_space) | 213 | if (is_user_space(p) == !thaw_user_space) |
201 | continue; | 214 | continue; |
202 | 215 | ||
203 | if (!thaw_process(p)) | 216 | thaw_process(p); |
204 | printk(KERN_WARNING " Strange, %s not stopped\n", | ||
205 | p->comm ); | ||
206 | } while_each_thread(g, p); | 217 | } while_each_thread(g, p); |
207 | read_unlock(&tasklist_lock); | 218 | read_unlock(&tasklist_lock); |
208 | } | 219 | } |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index b8b235cc19d1..8b1a1b837145 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -584,7 +584,7 @@ int swsusp_check(void) | |||
584 | resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); | 584 | resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); |
585 | if (!IS_ERR(resume_bdev)) { | 585 | if (!IS_ERR(resume_bdev)) { |
586 | set_blocksize(resume_bdev, PAGE_SIZE); | 586 | set_blocksize(resume_bdev, PAGE_SIZE); |
587 | memset(swsusp_header, 0, sizeof(PAGE_SIZE)); | 587 | memset(swsusp_header, 0, PAGE_SIZE); |
588 | error = bio_read_page(swsusp_resume_block, | 588 | error = bio_read_page(swsusp_resume_block, |
589 | swsusp_header, NULL); | 589 | swsusp_header, NULL); |
590 | if (error) | 590 | if (error) |
diff --git a/kernel/sched.c b/kernel/sched.c index 799d23b4e35d..13cdab3b4c48 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4775,9 +4775,7 @@ int __sched cond_resched_softirq(void) | |||
4775 | BUG_ON(!in_softirq()); | 4775 | BUG_ON(!in_softirq()); |
4776 | 4776 | ||
4777 | if (need_resched() && system_state == SYSTEM_RUNNING) { | 4777 | if (need_resched() && system_state == SYSTEM_RUNNING) { |
4778 | raw_local_irq_disable(); | 4778 | local_bh_enable(); |
4779 | _local_bh_enable(); | ||
4780 | raw_local_irq_enable(); | ||
4781 | __cond_resched(); | 4779 | __cond_resched(); |
4782 | local_bh_disable(); | 4780 | local_bh_disable(); |
4783 | return 1; | 4781 | return 1; |
diff --git a/kernel/signal.c b/kernel/signal.c index 364fc95bf97c..acdfc0549c6f 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -96,15 +96,27 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked) | |||
96 | 96 | ||
97 | #define PENDING(p,b) has_pending_signals(&(p)->signal, (b)) | 97 | #define PENDING(p,b) has_pending_signals(&(p)->signal, (b)) |
98 | 98 | ||
99 | fastcall void recalc_sigpending_tsk(struct task_struct *t) | 99 | static int recalc_sigpending_tsk(struct task_struct *t) |
100 | { | 100 | { |
101 | if (t->signal->group_stop_count > 0 || | 101 | if (t->signal->group_stop_count > 0 || |
102 | (freezing(t)) || | 102 | (freezing(t)) || |
103 | PENDING(&t->pending, &t->blocked) || | 103 | PENDING(&t->pending, &t->blocked) || |
104 | PENDING(&t->signal->shared_pending, &t->blocked)) | 104 | PENDING(&t->signal->shared_pending, &t->blocked)) { |
105 | set_tsk_thread_flag(t, TIF_SIGPENDING); | 105 | set_tsk_thread_flag(t, TIF_SIGPENDING); |
106 | else | 106 | return 1; |
107 | clear_tsk_thread_flag(t, TIF_SIGPENDING); | 107 | } |
108 | clear_tsk_thread_flag(t, TIF_SIGPENDING); | ||
109 | return 0; | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * After recalculating TIF_SIGPENDING, we need to make sure the task wakes up. | ||
114 | * This is superfluous when called on current, the wakeup is a harmless no-op. | ||
115 | */ | ||
116 | void recalc_sigpending_and_wake(struct task_struct *t) | ||
117 | { | ||
118 | if (recalc_sigpending_tsk(t)) | ||
119 | signal_wake_up(t, 0); | ||
108 | } | 120 | } |
109 | 121 | ||
110 | void recalc_sigpending(void) | 122 | void recalc_sigpending(void) |
@@ -744,7 +756,7 @@ force_sig_info(int sig, struct siginfo *info, struct task_struct *t) | |||
744 | action->sa.sa_handler = SIG_DFL; | 756 | action->sa.sa_handler = SIG_DFL; |
745 | if (blocked) { | 757 | if (blocked) { |
746 | sigdelset(&t->blocked, sig); | 758 | sigdelset(&t->blocked, sig); |
747 | recalc_sigpending_tsk(t); | 759 | recalc_sigpending_and_wake(t); |
748 | } | 760 | } |
749 | } | 761 | } |
750 | ret = specific_send_sig_info(sig, info, t); | 762 | ret = specific_send_sig_info(sig, info, t); |
@@ -2273,7 +2285,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) | |||
2273 | rm_from_queue_full(&mask, &t->signal->shared_pending); | 2285 | rm_from_queue_full(&mask, &t->signal->shared_pending); |
2274 | do { | 2286 | do { |
2275 | rm_from_queue_full(&mask, &t->pending); | 2287 | rm_from_queue_full(&mask, &t->pending); |
2276 | recalc_sigpending_tsk(t); | 2288 | recalc_sigpending_and_wake(t); |
2277 | t = next_thread(t); | 2289 | t = next_thread(t); |
2278 | } while (t != current); | 2290 | } while (t != current); |
2279 | } | 2291 | } |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index eadfce2fff74..8001d37071f5 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -243,11 +243,18 @@ void tick_broadcast_on_off(unsigned long reason, int *oncpu) | |||
243 | { | 243 | { |
244 | int cpu = get_cpu(); | 244 | int cpu = get_cpu(); |
245 | 245 | ||
246 | if (cpu == *oncpu) | 246 | if (!cpu_isset(*oncpu, cpu_online_map)) { |
247 | tick_do_broadcast_on_off(&reason); | 247 | printk(KERN_ERR "tick-braodcast: ignoring broadcast for " |
248 | else | 248 | "offline CPU #%d\n", *oncpu); |
249 | smp_call_function_single(*oncpu, tick_do_broadcast_on_off, | 249 | } else { |
250 | &reason, 1, 1); | 250 | |
251 | if (cpu == *oncpu) | ||
252 | tick_do_broadcast_on_off(&reason); | ||
253 | else | ||
254 | smp_call_function_single(*oncpu, | ||
255 | tick_do_broadcast_on_off, | ||
256 | &reason, 1, 1); | ||
257 | } | ||
251 | put_cpu(); | 258 | put_cpu(); |
252 | } | 259 | } |
253 | 260 | ||
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3483e6cb9549..3e7ebc4646b7 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -167,9 +167,15 @@ void tick_nohz_stop_sched_tick(void) | |||
167 | goto end; | 167 | goto end; |
168 | 168 | ||
169 | cpu = smp_processor_id(); | 169 | cpu = smp_processor_id(); |
170 | if (unlikely(local_softirq_pending())) | 170 | if (unlikely(local_softirq_pending())) { |
171 | printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n", | 171 | static int ratelimit; |
172 | local_softirq_pending()); | 172 | |
173 | if (ratelimit < 10) { | ||
174 | printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n", | ||
175 | local_softirq_pending()); | ||
176 | ratelimit++; | ||
177 | } | ||
178 | } | ||
173 | 179 | ||
174 | now = ktime_get(); | 180 | now = ktime_get(); |
175 | /* | 181 | /* |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index fb56fedd5c02..3bebf73be976 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -47,7 +47,6 @@ struct cpu_workqueue_struct { | |||
47 | 47 | ||
48 | struct workqueue_struct *wq; | 48 | struct workqueue_struct *wq; |
49 | struct task_struct *thread; | 49 | struct task_struct *thread; |
50 | int should_stop; | ||
51 | 50 | ||
52 | int run_depth; /* Detect run_workqueue() recursion depth */ | 51 | int run_depth; /* Detect run_workqueue() recursion depth */ |
53 | } ____cacheline_aligned; | 52 | } ____cacheline_aligned; |
@@ -71,7 +70,13 @@ static LIST_HEAD(workqueues); | |||
71 | 70 | ||
72 | static int singlethread_cpu __read_mostly; | 71 | static int singlethread_cpu __read_mostly; |
73 | static cpumask_t cpu_singlethread_map __read_mostly; | 72 | static cpumask_t cpu_singlethread_map __read_mostly; |
74 | /* optimization, we could use cpu_possible_map */ | 73 | /* |
74 | * _cpu_down() first removes CPU from cpu_online_map, then CPU_DEAD | ||
75 | * flushes cwq->worklist. This means that flush_workqueue/wait_on_work | ||
76 | * which comes in between can't use for_each_online_cpu(). We could | ||
77 | * use cpu_possible_map, the cpumask below is more a documentation | ||
78 | * than optimization. | ||
79 | */ | ||
75 | static cpumask_t cpu_populated_map __read_mostly; | 80 | static cpumask_t cpu_populated_map __read_mostly; |
76 | 81 | ||
77 | /* If it's single threaded, it isn't in the list of workqueues. */ | 82 | /* If it's single threaded, it isn't in the list of workqueues. */ |
@@ -272,24 +277,6 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq) | |||
272 | spin_unlock_irq(&cwq->lock); | 277 | spin_unlock_irq(&cwq->lock); |
273 | } | 278 | } |
274 | 279 | ||
275 | /* | ||
276 | * NOTE: the caller must not touch *cwq if this func returns true | ||
277 | */ | ||
278 | static int cwq_should_stop(struct cpu_workqueue_struct *cwq) | ||
279 | { | ||
280 | int should_stop = cwq->should_stop; | ||
281 | |||
282 | if (unlikely(should_stop)) { | ||
283 | spin_lock_irq(&cwq->lock); | ||
284 | should_stop = cwq->should_stop && list_empty(&cwq->worklist); | ||
285 | if (should_stop) | ||
286 | cwq->thread = NULL; | ||
287 | spin_unlock_irq(&cwq->lock); | ||
288 | } | ||
289 | |||
290 | return should_stop; | ||
291 | } | ||
292 | |||
293 | static int worker_thread(void *__cwq) | 280 | static int worker_thread(void *__cwq) |
294 | { | 281 | { |
295 | struct cpu_workqueue_struct *cwq = __cwq; | 282 | struct cpu_workqueue_struct *cwq = __cwq; |
@@ -302,14 +289,15 @@ static int worker_thread(void *__cwq) | |||
302 | 289 | ||
303 | for (;;) { | 290 | for (;;) { |
304 | prepare_to_wait(&cwq->more_work, &wait, TASK_INTERRUPTIBLE); | 291 | prepare_to_wait(&cwq->more_work, &wait, TASK_INTERRUPTIBLE); |
305 | if (!freezing(current) && !cwq->should_stop | 292 | if (!freezing(current) && |
306 | && list_empty(&cwq->worklist)) | 293 | !kthread_should_stop() && |
294 | list_empty(&cwq->worklist)) | ||
307 | schedule(); | 295 | schedule(); |
308 | finish_wait(&cwq->more_work, &wait); | 296 | finish_wait(&cwq->more_work, &wait); |
309 | 297 | ||
310 | try_to_freeze(); | 298 | try_to_freeze(); |
311 | 299 | ||
312 | if (cwq_should_stop(cwq)) | 300 | if (kthread_should_stop()) |
313 | break; | 301 | break; |
314 | 302 | ||
315 | run_workqueue(cwq); | 303 | run_workqueue(cwq); |
@@ -340,18 +328,21 @@ static void insert_wq_barrier(struct cpu_workqueue_struct *cwq, | |||
340 | insert_work(cwq, &barr->work, tail); | 328 | insert_work(cwq, &barr->work, tail); |
341 | } | 329 | } |
342 | 330 | ||
343 | static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) | 331 | static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) |
344 | { | 332 | { |
333 | int active; | ||
334 | |||
345 | if (cwq->thread == current) { | 335 | if (cwq->thread == current) { |
346 | /* | 336 | /* |
347 | * Probably keventd trying to flush its own queue. So simply run | 337 | * Probably keventd trying to flush its own queue. So simply run |
348 | * it by hand rather than deadlocking. | 338 | * it by hand rather than deadlocking. |
349 | */ | 339 | */ |
350 | run_workqueue(cwq); | 340 | run_workqueue(cwq); |
341 | active = 1; | ||
351 | } else { | 342 | } else { |
352 | struct wq_barrier barr; | 343 | struct wq_barrier barr; |
353 | int active = 0; | ||
354 | 344 | ||
345 | active = 0; | ||
355 | spin_lock_irq(&cwq->lock); | 346 | spin_lock_irq(&cwq->lock); |
356 | if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) { | 347 | if (!list_empty(&cwq->worklist) || cwq->current_work != NULL) { |
357 | insert_wq_barrier(cwq, &barr, 1); | 348 | insert_wq_barrier(cwq, &barr, 1); |
@@ -362,6 +353,8 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) | |||
362 | if (active) | 353 | if (active) |
363 | wait_for_completion(&barr.done); | 354 | wait_for_completion(&barr.done); |
364 | } | 355 | } |
356 | |||
357 | return active; | ||
365 | } | 358 | } |
366 | 359 | ||
367 | /** | 360 | /** |
@@ -674,7 +667,6 @@ static int create_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) | |||
674 | return PTR_ERR(p); | 667 | return PTR_ERR(p); |
675 | 668 | ||
676 | cwq->thread = p; | 669 | cwq->thread = p; |
677 | cwq->should_stop = 0; | ||
678 | 670 | ||
679 | return 0; | 671 | return 0; |
680 | } | 672 | } |
@@ -740,29 +732,27 @@ EXPORT_SYMBOL_GPL(__create_workqueue); | |||
740 | 732 | ||
741 | static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) | 733 | static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) |
742 | { | 734 | { |
743 | struct wq_barrier barr; | 735 | /* |
744 | int alive = 0; | 736 | * Our caller is either destroy_workqueue() or CPU_DEAD, |
745 | 737 | * workqueue_mutex protects cwq->thread | |
746 | spin_lock_irq(&cwq->lock); | 738 | */ |
747 | if (cwq->thread != NULL) { | 739 | if (cwq->thread == NULL) |
748 | insert_wq_barrier(cwq, &barr, 1); | 740 | return; |
749 | cwq->should_stop = 1; | ||
750 | alive = 1; | ||
751 | } | ||
752 | spin_unlock_irq(&cwq->lock); | ||
753 | 741 | ||
754 | if (alive) { | 742 | /* |
755 | wait_for_completion(&barr.done); | 743 | * If the caller is CPU_DEAD the single flush_cpu_workqueue() |
744 | * is not enough, a concurrent flush_workqueue() can insert a | ||
745 | * barrier after us. | ||
746 | * When ->worklist becomes empty it is safe to exit because no | ||
747 | * more work_structs can be queued on this cwq: flush_workqueue | ||
748 | * checks list_empty(), and a "normal" queue_work() can't use | ||
749 | * a dead CPU. | ||
750 | */ | ||
751 | while (flush_cpu_workqueue(cwq)) | ||
752 | ; | ||
756 | 753 | ||
757 | while (unlikely(cwq->thread != NULL)) | 754 | kthread_stop(cwq->thread); |
758 | cpu_relax(); | 755 | cwq->thread = NULL; |
759 | /* | ||
760 | * Wait until cwq->thread unlocks cwq->lock, | ||
761 | * it won't touch *cwq after that. | ||
762 | */ | ||
763 | smp_rmb(); | ||
764 | spin_unlock_wait(&cwq->lock); | ||
765 | } | ||
766 | } | 756 | } |
767 | 757 | ||
768 | /** | 758 | /** |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index fbc5c622acb0..1ba77ca7d165 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -378,14 +378,13 @@ config FORCED_INLINING | |||
378 | config RCU_TORTURE_TEST | 378 | config RCU_TORTURE_TEST |
379 | tristate "torture tests for RCU" | 379 | tristate "torture tests for RCU" |
380 | depends on DEBUG_KERNEL | 380 | depends on DEBUG_KERNEL |
381 | depends on m | ||
381 | default n | 382 | default n |
382 | help | 383 | help |
383 | This option provides a kernel module that runs torture tests | 384 | This option provides a kernel module that runs torture tests |
384 | on the RCU infrastructure. The kernel module may be built | 385 | on the RCU infrastructure. The kernel module may be built |
385 | after the fact on the running kernel to be tested, if desired. | 386 | after the fact on the running kernel to be tested, if desired. |
386 | 387 | ||
387 | Say Y here if you want RCU torture tests to start automatically | ||
388 | at boot time (you probably don't). | ||
389 | Say M if you want the RCU torture tests to build as a module. | 388 | Say M if you want the RCU torture tests to build as a module. |
390 | Say N if you are unsure. | 389 | Say N if you are unsure. |
391 | 390 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8b000d6803c2..d8970623c566 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -136,6 +136,11 @@ static unsigned long __meminitdata dma_reserve; | |||
136 | #endif /* CONFIG_MEMORY_HOTPLUG_RESERVE */ | 136 | #endif /* CONFIG_MEMORY_HOTPLUG_RESERVE */ |
137 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | 137 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ |
138 | 138 | ||
139 | #if MAX_NUMNODES > 1 | ||
140 | int nr_node_ids __read_mostly = MAX_NUMNODES; | ||
141 | EXPORT_SYMBOL(nr_node_ids); | ||
142 | #endif | ||
143 | |||
139 | #ifdef CONFIG_DEBUG_VM | 144 | #ifdef CONFIG_DEBUG_VM |
140 | static int page_outside_zone_boundaries(struct zone *zone, struct page *page) | 145 | static int page_outside_zone_boundaries(struct zone *zone, struct page *page) |
141 | { | 146 | { |
@@ -669,26 +674,6 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order, | |||
669 | return i; | 674 | return i; |
670 | } | 675 | } |
671 | 676 | ||
672 | #if MAX_NUMNODES > 1 | ||
673 | int nr_node_ids __read_mostly = MAX_NUMNODES; | ||
674 | EXPORT_SYMBOL(nr_node_ids); | ||
675 | |||
676 | /* | ||
677 | * Figure out the number of possible node ids. | ||
678 | */ | ||
679 | static void __init setup_nr_node_ids(void) | ||
680 | { | ||
681 | unsigned int node; | ||
682 | unsigned int highest = 0; | ||
683 | |||
684 | for_each_node_mask(node, node_possible_map) | ||
685 | highest = node; | ||
686 | nr_node_ids = highest + 1; | ||
687 | } | ||
688 | #else | ||
689 | static void __init setup_nr_node_ids(void) {} | ||
690 | #endif | ||
691 | |||
692 | #ifdef CONFIG_NUMA | 677 | #ifdef CONFIG_NUMA |
693 | /* | 678 | /* |
694 | * Called from the vmstat counter updater to drain pagesets of this | 679 | * Called from the vmstat counter updater to drain pagesets of this |
@@ -2733,6 +2718,26 @@ void __meminit free_area_init_node(int nid, struct pglist_data *pgdat, | |||
2733 | } | 2718 | } |
2734 | 2719 | ||
2735 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP | 2720 | #ifdef CONFIG_ARCH_POPULATES_NODE_MAP |
2721 | |||
2722 | #if MAX_NUMNODES > 1 | ||
2723 | /* | ||
2724 | * Figure out the number of possible node ids. | ||
2725 | */ | ||
2726 | static void __init setup_nr_node_ids(void) | ||
2727 | { | ||
2728 | unsigned int node; | ||
2729 | unsigned int highest = 0; | ||
2730 | |||
2731 | for_each_node_mask(node, node_possible_map) | ||
2732 | highest = node; | ||
2733 | nr_node_ids = highest + 1; | ||
2734 | } | ||
2735 | #else | ||
2736 | static inline void setup_nr_node_ids(void) | ||
2737 | { | ||
2738 | } | ||
2739 | #endif | ||
2740 | |||
2736 | /** | 2741 | /** |
2737 | * add_active_range - Register a range of PFNs backed by physical memory | 2742 | * add_active_range - Register a range of PFNs backed by physical memory |
2738 | * @nid: The node ID the range resides on | 2743 | * @nid: The node ID the range resides on |
@@ -939,7 +939,7 @@ static void kmem_cache_open_debug_check(struct kmem_cache *s) | |||
939 | * Debugging or ctor may create a need to move the free | 939 | * Debugging or ctor may create a need to move the free |
940 | * pointer. Fail if this happens. | 940 | * pointer. Fail if this happens. |
941 | */ | 941 | */ |
942 | if (s->size >= 65535 * sizeof(void *)) { | 942 | if (s->objsize >= 65535 * sizeof(void *)) { |
943 | BUG_ON(s->flags & (SLAB_RED_ZONE | SLAB_POISON | | 943 | BUG_ON(s->flags & (SLAB_RED_ZONE | SLAB_POISON | |
944 | SLAB_STORE_USER | SLAB_DESTROY_BY_RCU)); | 944 | SLAB_STORE_USER | SLAB_DESTROY_BY_RCU)); |
945 | BUG_ON(s->ctor); | 945 | BUG_ON(s->ctor); |
@@ -1917,7 +1917,6 @@ static int calculate_sizes(struct kmem_cache *s) | |||
1917 | */ | 1917 | */ |
1918 | s->inuse = size; | 1918 | s->inuse = size; |
1919 | 1919 | ||
1920 | #ifdef CONFIG_SLUB_DEBUG | ||
1921 | if (((flags & (SLAB_DESTROY_BY_RCU | SLAB_POISON)) || | 1920 | if (((flags & (SLAB_DESTROY_BY_RCU | SLAB_POISON)) || |
1922 | s->ctor)) { | 1921 | s->ctor)) { |
1923 | /* | 1922 | /* |
@@ -1932,6 +1931,7 @@ static int calculate_sizes(struct kmem_cache *s) | |||
1932 | size += sizeof(void *); | 1931 | size += sizeof(void *); |
1933 | } | 1932 | } |
1934 | 1933 | ||
1934 | #ifdef CONFIG_SLUB_DEBUG | ||
1935 | if (flags & SLAB_STORE_USER) | 1935 | if (flags & SLAB_STORE_USER) |
1936 | /* | 1936 | /* |
1937 | * Need to store information about allocs and frees after | 1937 | * Need to store information about allocs and frees after |