aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CREDITS4
-rw-r--r--Documentation/DMA-mapping.txt2
-rw-r--r--Documentation/RCU/whatisRCU.txt2
-rw-r--r--Documentation/cpu-hotplug.txt4
-rw-r--r--Documentation/cputopology.txt4
-rw-r--r--Documentation/filesystems/00-INDEX54
-rw-r--r--Documentation/ioctl-number.txt2
-rw-r--r--Documentation/m68k/README.buddha2
-rw-r--r--Documentation/networking/ifenslave.c2
-rw-r--r--arch/alpha/kernel/time.c3
-rw-r--r--arch/arm/lib/copy_template.S2
-rw-r--r--arch/arm/mach-footbridge/time.c17
-rw-r--r--arch/i386/kernel/io_apic.c4
-rw-r--r--arch/i386/kernel/microcode.c17
-rw-r--r--arch/i386/kernel/nmi.c9
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c2
-rw-r--r--arch/i386/oprofile/nmi_int.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c39
-rw-r--r--arch/m68k/mvme16x/rtc.c4
-rw-r--r--arch/mips/dec/time.c47
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c34
-rw-r--r--arch/mips/tx4938/common/rtc_rx5c348.c12
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c2
-rw-r--r--arch/powerpc/platforms/chrp/time.c22
-rw-r--r--arch/powerpc/platforms/maple/time.c24
-rw-r--r--arch/ppc/kernel/ppc_htab.c2
-rw-r--r--arch/ppc/platforms/chrp_time.c42
-rw-r--r--arch/sh/boards/mpc1211/rtc.c50
-rw-r--r--arch/sh/boards/sh03/rtc.c13
-rw-r--r--arch/sh/kernel/cpu/rtc.c10
-rw-r--r--arch/sh64/kernel/time.c9
-rw-r--r--arch/sparc64/kernel/time.c16
-rw-r--r--arch/x86_64/kernel/time.c41
-rw-r--r--block/ll_rw_blk.c2
-rw-r--r--drivers/atm/lanai.c2
-rw-r--r--drivers/block/DAC960.c17
-rw-r--r--drivers/block/Kconfig3
-rw-r--r--drivers/block/acsi_slm.c2
-rw-r--r--drivers/block/floppy.c9
-rw-r--r--drivers/block/paride/pd.c3
-rw-r--r--drivers/block/paride/pg.c8
-rw-r--r--drivers/block/paride/pt.c8
-rw-r--r--drivers/block/umem.c5
-rw-r--r--drivers/char/agp/nvidia-agp.c3
-rw-r--r--drivers/char/drm/drm_fops.c2
-rw-r--r--drivers/char/drm/i810_dma.c2
-rw-r--r--drivers/char/drm/i830_dma.c2
-rw-r--r--drivers/char/mem.c2
-rw-r--r--drivers/char/misc.c2
-rw-r--r--drivers/char/mxser.h2
-rw-r--r--drivers/char/synclink.c33
-rw-r--r--drivers/char/synclink_gt.c250
-rw-r--r--drivers/edac/edac_mc.c2
-rw-r--r--drivers/ide/ide-tape.c5
-rw-r--r--drivers/ide/pci/amd74xx.c8
-rw-r--r--drivers/ide/pci/generic.c3
-rw-r--r--drivers/ide/pci/sis5513.c2
-rw-r--r--drivers/input/input.c2
-rw-r--r--drivers/isdn/capi/capi.c8
-rw-r--r--drivers/isdn/capi/kcapi_proc.c2
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c2
-rw-r--r--drivers/media/video/videodev.c2
-rw-r--r--drivers/message/i2o/i2o_proc.c2
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c2
-rw-r--r--drivers/net/forcedeth.c3
-rw-r--r--drivers/net/ioc3-eth.c7
-rw-r--r--drivers/net/irda/nsc-ircc.c2
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/ns83820.c6
-rw-r--r--drivers/net/sis900.c2
-rw-r--r--drivers/net/tulip/de4x5.c2
-rw-r--r--drivers/net/tulip/pnic2.c2
-rw-r--r--drivers/net/typhoon.c4
-rw-r--r--drivers/net/wan/wanxl.c4
-rw-r--r--drivers/net/wireless/orinoco.c2
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c2
-rw-r--r--drivers/net/wireless/prism54/islpci_hotplug.c3
-rw-r--r--drivers/oprofile/cpu_buffer.c13
-rw-r--r--drivers/oprofile/oprofile_stats.c4
-rw-r--r--drivers/oprofile/oprofilefs.c6
-rw-r--r--drivers/scsi/3w-9xxx.c2
-rw-r--r--drivers/scsi/BusLogic.c10
-rw-r--r--drivers/scsi/a100u2w.c3
-rw-r--r--drivers/scsi/aacraid/aachba.c1
-rw-r--r--drivers/scsi/aacraid/linit.c5
-rw-r--r--drivers/scsi/atp870u.c3
-rw-r--r--drivers/scsi/dpt_i2o.c5
-rw-r--r--drivers/scsi/eata.c3
-rw-r--r--drivers/scsi/gdth.c7
-rw-r--r--drivers/scsi/initio.c3
-rw-r--r--drivers/scsi/ips.c5
-rw-r--r--drivers/scsi/megaraid.c7
-rw-r--r--drivers/scsi/nsp32.c3
-rw-r--r--drivers/scsi/osst.c5
-rw-r--r--drivers/scsi/ppa.c3
-rw-r--r--drivers/scsi/qla1280.c5
-rw-r--r--drivers/scsi/qlogicfc.c8
-rw-r--r--drivers/scsi/qlogicpti.c3
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/serial/serial_txx9.c2
-rw-r--r--drivers/serial/sunsu.c2
-rw-r--r--drivers/telephony/phonedev.c2
-rw-r--r--drivers/usb/core/file.c6
-rw-r--r--drivers/usb/gadget/inode.c6
-rw-r--r--drivers/usb/host/ohci-s3c2410.c2
-rw-r--r--drivers/usb/net/zaurus.c2
-rw-r--r--fs/9p/v9fs_vfs.h4
-rw-r--r--fs/9p/vfs_dir.c2
-rw-r--r--fs/9p/vfs_file.c2
-rw-r--r--fs/adfs/adfs.h4
-rw-r--r--fs/adfs/dir.c2
-rw-r--r--fs/adfs/file.c2
-rw-r--r--fs/affs/affs.h6
-rw-r--r--fs/affs/dir.c2
-rw-r--r--fs/affs/file.c2
-rw-r--r--fs/afs/dir.c2
-rw-r--r--fs/afs/internal.h4
-rw-r--r--fs/afs/mntpt.c2
-rw-r--r--fs/afs/proc.c10
-rw-r--r--fs/autofs/autofs_i.h2
-rw-r--r--fs/autofs/root.c2
-rw-r--r--fs/autofs4/autofs_i.h7
-rw-r--r--fs/autofs4/inode.c1
-rw-r--r--fs/autofs4/root.c4
-rw-r--r--fs/bad_inode.c2
-rw-r--r--fs/befs/linuxvfs.c2
-rw-r--r--fs/bfs/bfs.h4
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/bfs/file.c2
-rw-r--r--fs/binfmt_misc.c6
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/char_dev.c6
-rw-r--r--fs/cifs/cifsfs.c10
-rw-r--r--fs/cifs/cifsfs.h10
-rw-r--r--fs/coda/dir.c2
-rw-r--r--fs/coda/file.c2
-rw-r--r--fs/coda/pioctl.c2
-rw-r--r--fs/coda/psdev.c2
-rw-r--r--fs/compat.c13
-rw-r--r--fs/configfs/configfs_internal.h6
-rw-r--r--fs/configfs/dir.c2
-rw-r--r--fs/configfs/file.c2
-rw-r--r--fs/cramfs/inode.c4
-rw-r--r--fs/debugfs/file.c4
-rw-r--r--fs/debugfs/inode.c2
-rw-r--r--fs/devfs/base.c12
-rw-r--r--fs/efs/dir.c2
-rw-r--r--fs/eventpoll.c2
-rw-r--r--fs/ext2/dir.c2
-rw-r--r--fs/ext2/ext2.h6
-rw-r--r--fs/ext2/file.c4
-rw-r--r--fs/ext3/dir.c2
-rw-r--r--fs/ext3/file.c2
-rw-r--r--fs/fat/dir.c2
-rw-r--r--fs/fat/file.c2
-rw-r--r--fs/fat/inode.c3
-rw-r--r--fs/fifo.c2
-rw-r--r--fs/file.c2
-rw-r--r--fs/freevxfs/vxfs_extern.h2
-rw-r--r--fs/freevxfs/vxfs_lookup.c2
-rw-r--r--fs/fuse/dev.c2
-rw-r--r--fs/fuse/dir.c2
-rw-r--r--fs/fuse/file.c6
-rw-r--r--fs/fuse/fuse_i.h2
-rw-r--r--fs/hfs/dir.c2
-rw-r--r--fs/hfs/hfs_fs.h2
-rw-r--r--fs/hfs/inode.c4
-rw-r--r--fs/hfsplus/dir.c2
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hostfs/hostfs_kern.c4
-rw-r--r--fs/hpfs/dir.c2
-rw-r--r--fs/hpfs/file.c2
-rw-r--r--fs/hpfs/hpfs_fn.h4
-rw-r--r--fs/hppfs/hppfs_kern.c4
-rw-r--r--fs/hugetlbfs/inode.c4
-rw-r--r--fs/inode.c2
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/isofs/dir.c2
-rw-r--r--fs/isofs/isofs.h2
-rw-r--r--fs/jffs/inode-v23.c8
-rw-r--r--fs/jffs2/dir.c2
-rw-r--r--fs/jffs2/file.c2
-rw-r--r--fs/jffs2/os-linux.h4
-rw-r--r--fs/jfs/file.c2
-rw-r--r--fs/jfs/jfs_inode.h4
-rw-r--r--fs/jfs/namei.c2
-rw-r--r--fs/libfs.c2
-rw-r--r--fs/mbcache.c2
-rw-r--r--fs/minix/dir.c2
-rw-r--r--fs/minix/file.c2
-rw-r--r--fs/minix/minix.h4
-rw-r--r--fs/ncpfs/dir.c2
-rw-r--r--fs/ncpfs/file.c2
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfsd/nfsctl.c4
-rw-r--r--fs/nfsd/stats.c2
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/ntfs/dir.c2
-rw-r--r--fs/ntfs/file.c4
-rw-r--r--fs/ntfs/ntfs.h6
-rw-r--r--fs/ocfs2/dlmglue.c2
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/file.h4
-rw-r--r--fs/openpromfs/inode.c6
-rw-r--r--fs/pipe.c6
-rw-r--r--fs/proc/generic.c2
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/kcore.c2
-rw-r--r--fs/proc/kmsg.c2
-rw-r--r--fs/proc/proc_misc.c4
-rw-r--r--fs/proc/vmcore.c2
-rw-r--r--fs/qnx4/dir.c2
-rw-r--r--fs/qnx4/file.c2
-rw-r--r--fs/ramfs/file-mmu.c2
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/ramfs/internal.h2
-rw-r--r--fs/read_write.c2
-rw-r--r--fs/reiserfs/dir.c2
-rw-r--r--fs/reiserfs/file.c2
-rw-r--r--fs/reiserfs/procfs.c2
-rw-r--r--fs/romfs/inode.c2
-rw-r--r--fs/select.c118
-rw-r--r--fs/smbfs/dir.c2
-rw-r--r--fs/smbfs/file.c2
-rw-r--r--fs/smbfs/proto.h4
-rw-r--r--fs/sysfs/bin.c2
-rw-r--r--fs/sysfs/dir.c2
-rw-r--r--fs/sysfs/file.c2
-rw-r--r--fs/sysfs/sysfs.h6
-rw-r--r--fs/sysv/dir.c2
-rw-r--r--fs/sysv/file.c2
-rw-r--r--fs/sysv/sysv.h4
-rw-r--r--fs/udf/dir.c2
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/udf/udfdecl.h4
-rw-r--r--fs/ufs/dir.c2
-rw-r--r--fs/ufs/file.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c6
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.h6
-rw-r--r--include/asm-alpha/poll.h4
-rw-r--r--include/asm-generic/local.h80
-rw-r--r--include/asm-generic/percpu.h2
-rw-r--r--include/asm-i386/mach-default/mach_time.h37
-rw-r--r--include/asm-i386/processor.h2
-rw-r--r--include/asm-mips/mc146818-time.h33
-rw-r--r--include/asm-parisc/pdc.h2
-rw-r--r--include/asm-sh/addrspace.h2
-rw-r--r--include/asm-sparc64/floppy.h2
-rw-r--r--include/asm-x86_64/processor.h3
-rw-r--r--include/linux/cdev.h4
-rw-r--r--include/linux/coda_linux.h6
-rw-r--r--include/linux/cpumask.h5
-rw-r--r--include/linux/crash_dump.h2
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/dma-mapping.h1
-rw-r--r--include/linux/efs_fs.h2
-rw-r--r--include/linux/ext3_fs.h4
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fs.h26
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/hugetlb.h2
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/msdos_fs.h7
-rw-r--r--include/linux/ncp_fs.h4
-rw-r--r--include/linux/nfs_fs.h4
-rw-r--r--include/linux/oprofile.h14
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/poll.h17
-rw-r--r--include/linux/proc_fs.h10
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/ramfs.h2
-rw-r--r--include/linux/reiserfs_fs.h4
-rw-r--r--include/linux/relayfs_fs.h287
-rw-r--r--include/linux/sound.h12
-rw-r--r--include/linux/sunrpc/stats.h4
-rw-r--r--include/linux/synclink.h11
-rw-r--r--include/linux/ufs_fs.h4
-rw-r--r--include/linux/usb.h2
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/sound/core.h6
-rw-r--r--init/main.c2
-rw-r--r--ipc/mqueue.c2
-rw-r--r--kernel/futex_compat.c3
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/params.c2
-rw-r--r--kernel/rcutorture.c4
-rw-r--r--kernel/sched.c8
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/slab.c4
-rw-r--r--mm/swap.c2
-rw-r--r--net/irda/af_irda.c6
-rw-r--r--net/nonet.c2
-rw-r--r--net/socket.c2
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--net/sunrpc/stats.c4
-rw-r--r--sound/core/init.c3
-rw-r--r--sound/core/rawmidi.c6
-rw-r--r--sound/core/sound.c4
-rw-r--r--sound/core/sound_oss.c2
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c2
-rw-r--r--sound/oss/emu10k1/midi.c9
-rw-r--r--sound/oss/esssolo1.c2
-rw-r--r--sound/oss/maestro3.c10
-rw-r--r--sound/oss/msnd.c6
-rw-r--r--sound/oss/sb_card.c6
-rw-r--r--sound/oss/sequencer.c13
-rw-r--r--sound/oss/sh_dac_audio.c2
-rw-r--r--sound/oss/sonicvibes.c3
-rw-r--r--sound/pci/ad1889.c1
-rw-r--r--sound/pci/ali5451/ali5451.c5
-rw-r--r--sound/pci/als4000.c5
-rw-r--r--sound/pci/azt3328.c5
-rw-r--r--sound/pci/emu10k1/emu10k1x.c1
-rw-r--r--sound/pci/es1938.c5
-rw-r--r--sound/pci/es1968.c1
-rw-r--r--sound/pci/ice1712/ice1712.c2
-rw-r--r--sound/pci/maestro3.c1
-rw-r--r--sound/pci/mixart/mixart.c2
-rw-r--r--sound/pci/pcxhr/pcxhr.c1
-rw-r--r--sound/pci/rme32.c8
-rw-r--r--sound/pci/rme96.c8
-rw-r--r--sound/pci/rme9652/hdspm.c2
-rw-r--r--sound/pci/sonicvibes.c5
-rw-r--r--sound/pci/trident/trident_main.c5
-rw-r--r--sound/sound_core.c22
-rw-r--r--sound/usb/usx2y/usx2yhwdeppcm.c2
329 files changed, 1092 insertions, 1333 deletions
diff --git a/CREDITS b/CREDITS
index 35850d882c34..0bf31eac6dc2 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1127,8 +1127,10 @@ S: Carnegie, Pennsylvania 15106-4304
1127S: USA 1127S: USA
1128 1128
1129N: Philip Gladstone 1129N: Philip Gladstone
1130E: philip@raptor.com 1130E: philip@gladstonefamily.net
1131D: Kernel / timekeeping stuff 1131D: Kernel / timekeeping stuff
1132S: Carlisle, MA 01741
1133S: USA
1132 1134
1133N: Jan-Benedict Glaw 1135N: Jan-Benedict Glaw
1134E: jbglaw@lug-owl.de 1136E: jbglaw@lug-owl.de
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index 684557474c15..ee4bb73683cd 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -199,6 +199,8 @@ address during PCI bus mastering you might do something like:
199 "mydev: 24-bit DMA addressing not available.\n"); 199 "mydev: 24-bit DMA addressing not available.\n");
200 goto ignore_this_device; 200 goto ignore_this_device;
201 } 201 }
202[Better use DMA_24BIT_MASK instead of 0x00ffffff.
203See linux/include/dma-mapping.h for reference.]
202 204
203When pci_set_dma_mask() is successful, and returns zero, the PCI layer 205When pci_set_dma_mask() is successful, and returns zero, the PCI layer
204saves away this mask you have provided. The PCI layer will use this 206saves away this mask you have provided. The PCI layer will use this
diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
index b4ea51ad3610..07cb93b82ba9 100644
--- a/Documentation/RCU/whatisRCU.txt
+++ b/Documentation/RCU/whatisRCU.txt
@@ -605,7 +605,7 @@ are the same as those shown in the preceding section, so they are omitted.
605 { 605 {
606 int cpu; 606 int cpu;
607 607
608 for_each_cpu(cpu) 608 for_each_possible_cpu(cpu)
609 run_on(cpu); 609 run_on(cpu);
610 } 610 }
611 611
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 57a09f99ecb0..1bcf69996c9d 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -97,13 +97,13 @@ at which time hotplug is disabled.
97 97
98You really dont need to manipulate any of the system cpu maps. They should 98You really dont need to manipulate any of the system cpu maps. They should
99be read-only for most use. When setting up per-cpu resources almost always use 99be read-only for most use. When setting up per-cpu resources almost always use
100cpu_possible_map/for_each_cpu() to iterate. 100cpu_possible_map/for_each_possible_cpu() to iterate.
101 101
102Never use anything other than cpumask_t to represent bitmap of CPUs. 102Never use anything other than cpumask_t to represent bitmap of CPUs.
103 103
104#include <linux/cpumask.h> 104#include <linux/cpumask.h>
105 105
106for_each_cpu - Iterate over cpu_possible_map 106for_each_possible_cpu - Iterate over cpu_possible_map
107for_each_online_cpu - Iterate over cpu_online_map 107for_each_online_cpu - Iterate over cpu_online_map
108for_each_present_cpu - Iterate over cpu_present_map 108for_each_present_cpu - Iterate over cpu_present_map
109for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask. 109for_each_cpu_mask(x,mask) - Iterate over some random collection of cpu mask.
diff --git a/Documentation/cputopology.txt b/Documentation/cputopology.txt
index ff280e2e1613..2b28e9ec4e3a 100644
--- a/Documentation/cputopology.txt
+++ b/Documentation/cputopology.txt
@@ -1,5 +1,5 @@
1 1
2Export cpu topology info by sysfs. Items (attributes) are similar 2Export cpu topology info via sysfs. Items (attributes) are similar
3to /proc/cpuinfo. 3to /proc/cpuinfo.
4 4
51) /sys/devices/system/cpu/cpuX/topology/physical_package_id: 51) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
@@ -12,7 +12,7 @@ represent the thread siblings to cpu X in the same core;
12represent the thread siblings to cpu X in the same physical package; 12represent the thread siblings to cpu X in the same physical package;
13 13
14To implement it in an architecture-neutral way, a new source file, 14To implement it in an architecture-neutral way, a new source file,
15driver/base/topology.c, is to export the 5 attributes. 15drivers/base/topology.c, is to export the 4 attributes.
16 16
17If one architecture wants to support this feature, it just needs to 17If one architecture wants to support this feature, it just needs to
18implement 4 defines, typically in file include/asm-XXX/topology.h. 18implement 4 defines, typically in file include/asm-XXX/topology.h.
diff --git a/Documentation/filesystems/00-INDEX b/Documentation/filesystems/00-INDEX
index 74052d22d868..66fdc0744fe0 100644
--- a/Documentation/filesystems/00-INDEX
+++ b/Documentation/filesystems/00-INDEX
@@ -1,27 +1,47 @@
100-INDEX 100-INDEX
2 - this file (info on some of the filesystems supported by linux). 2 - this file (info on some of the filesystems supported by linux).
3Exporting
4 - explanation of how to make filesystems exportable.
3Locking 5Locking
4 - info on locking rules as they pertain to Linux VFS. 6 - info on locking rules as they pertain to Linux VFS.
5adfs.txt 7adfs.txt
6 - info and mount options for the Acorn Advanced Disc Filing System. 8 - info and mount options for the Acorn Advanced Disc Filing System.
9afs.txt
10 - info and examples for the distributed AFS (Andrew File System) fs.
7affs.txt 11affs.txt
8 - info and mount options for the Amiga Fast File System. 12 - info and mount options for the Amiga Fast File System.
13automount-support.txt
14 - information about filesystem automount support.
15befs.txt
16 - information about the BeOS filesystem for Linux.
9bfs.txt 17bfs.txt
10 - info for the SCO UnixWare Boot Filesystem (BFS). 18 - info for the SCO UnixWare Boot Filesystem (BFS).
11cifs.txt 19cifs.txt
12 - description of the CIFS filesystem 20 - description of the CIFS filesystem.
13coda.txt 21coda.txt
14 - description of the CODA filesystem. 22 - description of the CODA filesystem.
15configfs/ 23configfs/
16 - directory containing configfs documentation and example code. 24 - directory containing configfs documentation and example code.
17cramfs.txt 25cramfs.txt
18 - info on the cram filesystem for small storage (ROMs etc) 26 - info on the cram filesystem for small storage (ROMs etc).
27dentry-locking.txt
28 - info on the RCU-based dcache locking model.
19devfs/ 29devfs/
20 - directory containing devfs documentation. 30 - directory containing devfs documentation.
31directory-locking
32 - info about the locking scheme used for directory operations.
21dlmfs.txt 33dlmfs.txt
22 - info on the userspace interface to the OCFS2 DLM. 34 - info on the userspace interface to the OCFS2 DLM.
23ext2.txt 35ext2.txt
24 - info, mount options and specifications for the Ext2 filesystem. 36 - info, mount options and specifications for the Ext2 filesystem.
37ext3.txt
38 - info, mount options and specifications for the Ext3 filesystem.
39files.txt
40 - info on file management in the Linux kernel.
41fuse.txt
42 - info on the Filesystem in User SpacE including mount options.
43hfs.txt
44 - info on the Macintosh HFS Filesystem for Linux.
25hpfs.txt 45hpfs.txt
26 - info and mount options for the OS/2 HPFS. 46 - info and mount options for the OS/2 HPFS.
27isofs.txt 47isofs.txt
@@ -32,23 +52,43 @@ ncpfs.txt
32 - info on Novell Netware(tm) filesystem using NCP protocol. 52 - info on Novell Netware(tm) filesystem using NCP protocol.
33ntfs.txt 53ntfs.txt
34 - info and mount options for the NTFS filesystem (Windows NT). 54 - info and mount options for the NTFS filesystem (Windows NT).
35proc.txt
36 - info on Linux's /proc filesystem.
37ocfs2.txt 55ocfs2.txt
38 - info and mount options for the OCFS2 clustered filesystem. 56 - info and mount options for the OCFS2 clustered filesystem.
57porting
58 - various information on filesystem porting.
59proc.txt
60 - info on Linux's /proc filesystem.
61ramfs-rootfs-initramfs.txt
62 - info on the 'in memory' filesystems ramfs, rootfs and initramfs.
63reiser4.txt
64 - info on the Reiser4 filesystem based on dancing tree algorithms.
65relayfs.txt
66 - info on relayfs, for efficient streaming from kernel to user space.
39romfs.txt 67romfs.txt
40 - Description of the ROMFS filesystem. 68 - description of the ROMFS filesystem.
41smbfs.txt 69smbfs.txt
42 - info on using filesystems with the SMB protocol (Windows 3.11 and NT) 70 - info on using filesystems with the SMB protocol (Win 3.11 and NT).
71spufs.txt
72 - info and mount options for the SPU filesystem used on Cell.
73sysfs-pci.txt
74 - info on accessing PCI device resources through sysfs.
75sysfs.txt
76 - info on sysfs, a ram-based filesystem for exporting kernel objects.
43sysv-fs.txt 77sysv-fs.txt
44 - info on the SystemV/V7/Xenix/Coherent filesystem. 78 - info on the SystemV/V7/Xenix/Coherent filesystem.
79tmpfs.txt
80 - info on tmpfs, a filesystem that holds all files in virtual memory.
45udf.txt 81udf.txt
46 - info and mount options for the UDF filesystem. 82 - info and mount options for the UDF filesystem.
47ufs.txt 83ufs.txt
48 - info on the ufs filesystem. 84 - info on the ufs filesystem.
85v9fs.txt
86 - v9fs is a Unix implementation of the Plan 9 9p remote fs protocol.
49vfat.txt 87vfat.txt
50 - info on using the VFAT filesystem used in Windows NT and Windows 95 88 - info on using the VFAT filesystem used in Windows NT and Windows 95
51vfs.txt 89vfs.txt
52 - Overview of the Virtual File System 90 - overview of the Virtual File System
53xfs.txt 91xfs.txt
54 - info and mount options for the XFS filesystem. 92 - info and mount options for the XFS filesystem.
93xip.txt
94 - info on execute-in-place for file mappings.
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt
index aa7ba00ec082..171a44ebd939 100644
--- a/Documentation/ioctl-number.txt
+++ b/Documentation/ioctl-number.txt
@@ -78,8 +78,6 @@ Code Seq# Include File Comments
78'#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem 78'#' 00-3F IEEE 1394 Subsystem Block for the entire subsystem
79'1' 00-1F <linux/timepps.h> PPS kit from Ulrich Windl 79'1' 00-1F <linux/timepps.h> PPS kit from Ulrich Windl
80 <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/> 80 <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/>
81'6' 00-10 <asm-i386/processor.h> Intel IA32 microcode update driver
82 <mailto:tigran@veritas.com>
83'8' all SNP8023 advanced NIC card 81'8' all SNP8023 advanced NIC card
84 <mailto:mcr@solidum.com> 82 <mailto:mcr@solidum.com>
85'A' 00-1F linux/apm_bios.h 83'A' 00-1F linux/apm_bios.h
diff --git a/Documentation/m68k/README.buddha b/Documentation/m68k/README.buddha
index bf802ffc98ad..ef484a719bb9 100644
--- a/Documentation/m68k/README.buddha
+++ b/Documentation/m68k/README.buddha
@@ -29,7 +29,7 @@ address is written to $4a, then the whole Byte is written to
29$48, while it doesn't matter how often you're writing to $4a 29$48, while it doesn't matter how often you're writing to $4a
30as long as $48 is not touched. After $48 has been written, 30as long as $48 is not touched. After $48 has been written,
31the whole card disappears from $e8 and is mapped to the new 31the whole card disappears from $e8 and is mapped to the new
32address just written. Make shure $4a is written before $48, 32address just written. Make sure $4a is written before $48,
33otherwise your chance is only 1:16 to find the board :-). 33otherwise your chance is only 1:16 to find the board :-).
34 34
35The local memory-map is even active when mapped to $e8: 35The local memory-map is even active when mapped to $e8:
diff --git a/Documentation/networking/ifenslave.c b/Documentation/networking/ifenslave.c
index 545447ac503a..a12059886755 100644
--- a/Documentation/networking/ifenslave.c
+++ b/Documentation/networking/ifenslave.c
@@ -87,7 +87,7 @@
87 * would fail and generate an error message in the system log. 87 * would fail and generate an error message in the system log.
88 * - For opt_c: slave should not be set to the master's setting 88 * - For opt_c: slave should not be set to the master's setting
89 * while it is running. It was already set during enslave. To 89 * while it is running. It was already set during enslave. To
90 * simplify things, it is now handeled separately. 90 * simplify things, it is now handled separately.
91 * 91 *
92 * - 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com> 92 * - 2003/12/01 - Shmulik Hen <shmulik.hen at intel dot com>
93 * - Code cleanup and style changes 93 * - Code cleanup and style changes
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 6b2921be1909..3859749810b4 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -314,10 +314,11 @@ time_init(void)
314 if (!est_cycle_freq) 314 if (!est_cycle_freq)
315 est_cycle_freq = validate_cc_value(calibrate_cc_with_pit()); 315 est_cycle_freq = validate_cc_value(calibrate_cc_with_pit());
316 316
317 cc1 = rpcc_after_update_in_progress(); 317 cc1 = rpcc();
318 318
319 /* Calibrate CPU clock -- attempt #2. */ 319 /* Calibrate CPU clock -- attempt #2. */
320 if (!est_cycle_freq) { 320 if (!est_cycle_freq) {
321 cc1 = rpcc_after_update_in_progress();
321 cc2 = rpcc_after_update_in_progress(); 322 cc2 = rpcc_after_update_in_progress();
322 est_cycle_freq = validate_cc_value(cc2 - cc1); 323 est_cycle_freq = validate_cc_value(cc2 - cc1);
323 cc1 = cc2; 324 cc1 = cc2;
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 838e435e4922..cab355c0c1f7 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -236,7 +236,7 @@
236 236
237 237
238/* 238/*
239 * Abort preanble and completion macros. 239 * Abort preamble and completion macros.
240 * If a fixup handler is required then those macros must surround it. 240 * If a fixup handler is required then those macros must surround it.
241 * It is assumed that the fixup code will handle the private part of 241 * It is assumed that the fixup code will handle the private part of
242 * the exit macro. 242 * the exit macro.
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index 2c64a0b0502e..5d02e95dede3 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -34,27 +34,12 @@ static int rtc_base;
34static unsigned long __init get_isa_cmos_time(void) 34static unsigned long __init get_isa_cmos_time(void)
35{ 35{
36 unsigned int year, mon, day, hour, min, sec; 36 unsigned int year, mon, day, hour, min, sec;
37 int i;
38 37
39 // check to see if the RTC makes sense..... 38 // check to see if the RTC makes sense.....
40 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) 39 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0)
41 return mktime(1970, 1, 1, 0, 0, 0); 40 return mktime(1970, 1, 1, 0, 0, 0);
42 41
43 /* The Linux interpretation of the CMOS clock register contents: 42 do {
44 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
45 * RTC registers show the second which has precisely just started.
46 * Let's hope other operating systems interpret the RTC the same way.
47 */
48 /* read RTC exactly on falling edge of update flag */
49 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
50 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
51 break;
52
53 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
54 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
55 break;
56
57 do { /* Isn't this overkill ? UIP above should guarantee consistency */
58 sec = CMOS_READ(RTC_SECONDS); 43 sec = CMOS_READ(RTC_SECONDS);
59 min = CMOS_READ(RTC_MINUTES); 44 min = CMOS_READ(RTC_MINUTES);
60 hour = CMOS_READ(RTC_HOURS); 45 hour = CMOS_READ(RTC_HOURS);
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 311b4e7266f1..3b329af4afc5 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -381,7 +381,7 @@ static void do_irq_balance(void)
381 unsigned long imbalance = 0; 381 unsigned long imbalance = 0;
382 cpumask_t allowed_mask, target_cpu_mask, tmp; 382 cpumask_t allowed_mask, target_cpu_mask, tmp;
383 383
384 for_each_cpu(i) { 384 for_each_possible_cpu(i) {
385 int package_index; 385 int package_index;
386 CPU_IRQ(i) = 0; 386 CPU_IRQ(i) = 0;
387 if (!cpu_online(i)) 387 if (!cpu_online(i))
@@ -632,7 +632,7 @@ static int __init balanced_irq_init(void)
632 else 632 else
633 printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); 633 printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq");
634failed: 634failed:
635 for_each_cpu(i) { 635 for_each_possible_cpu(i) {
636 kfree(irq_cpu_data[i].irq_delta); 636 kfree(irq_cpu_data[i].irq_delta);
637 irq_cpu_data[i].irq_delta = NULL; 637 irq_cpu_data[i].irq_delta = NULL;
638 kfree(irq_cpu_data[i].last_irq); 638 kfree(irq_cpu_data[i].last_irq);
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index dd780a00553f..e7c138f66c5a 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -459,26 +459,9 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
459 return ret; 459 return ret;
460} 460}
461 461
462static int microcode_ioctl (struct inode *inode, struct file *file,
463 unsigned int cmd, unsigned long arg)
464{
465 switch (cmd) {
466 /*
467 * XXX: will be removed after microcode_ctl
468 * is updated to ignore failure of this ioctl()
469 */
470 case MICROCODE_IOCFREE:
471 return 0;
472 default:
473 return -EINVAL;
474 }
475 return -EINVAL;
476}
477
478static struct file_operations microcode_fops = { 462static struct file_operations microcode_fops = {
479 .owner = THIS_MODULE, 463 .owner = THIS_MODULE,
480 .write = microcode_write, 464 .write = microcode_write,
481 .ioctl = microcode_ioctl,
482 .open = microcode_open, 465 .open = microcode_open,
483}; 466};
484 467
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 9074818b9473..d43b498ec745 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -138,12 +138,12 @@ static int __init check_nmi_watchdog(void)
138 if (nmi_watchdog == NMI_LOCAL_APIC) 138 if (nmi_watchdog == NMI_LOCAL_APIC)
139 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); 139 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
140 140
141 for_each_cpu(cpu) 141 for_each_possible_cpu(cpu)
142 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; 142 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
143 local_irq_enable(); 143 local_irq_enable();
144 mdelay((10*1000)/nmi_hz); // wait 10 ticks 144 mdelay((10*1000)/nmi_hz); // wait 10 ticks
145 145
146 for_each_cpu(cpu) { 146 for_each_possible_cpu(cpu) {
147#ifdef CONFIG_SMP 147#ifdef CONFIG_SMP
148 /* Check cpu_callin_map here because that is set 148 /* Check cpu_callin_map here because that is set
149 after the timer is started. */ 149 after the timer is started. */
@@ -510,7 +510,7 @@ void touch_nmi_watchdog (void)
510 * Just reset the alert counters, (other CPUs might be 510 * Just reset the alert counters, (other CPUs might be
511 * spinning on locks we hold): 511 * spinning on locks we hold):
512 */ 512 */
513 for_each_cpu(i) 513 for_each_possible_cpu(i)
514 alert_counter[i] = 0; 514 alert_counter[i] = 0;
515 515
516 /* 516 /*
@@ -529,7 +529,8 @@ void nmi_watchdog_tick (struct pt_regs * regs)
529 * always switch the stack NMI-atomically, it's safe to use 529 * always switch the stack NMI-atomically, it's safe to use
530 * smp_processor_id(). 530 * smp_processor_id().
531 */ 531 */
532 int sum, cpu = smp_processor_id(); 532 unsigned int sum;
533 int cpu = smp_processor_id();
533 534
534 sum = per_cpu(irq_stat, cpu).apic_timer_irqs; 535 sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
535 536
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 8165626a5c30..70e560a1b79a 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -1700,7 +1700,7 @@ after_handle_vic_irq(unsigned int irq)
1700 1700
1701 printk("VOYAGER SMP: CPU%d lost interrupt %d\n", 1701 printk("VOYAGER SMP: CPU%d lost interrupt %d\n",
1702 cpu, irq); 1702 cpu, irq);
1703 for_each_cpu(real_cpu, mask) { 1703 for_each_possible_cpu(real_cpu, mask) {
1704 1704
1705 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, 1705 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu,
1706 VIC_PROCESSOR_ID); 1706 VIC_PROCESSOR_ID);
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 1accce50c2c7..1a2076ce6f6a 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -122,7 +122,7 @@ static void nmi_save_registers(void * dummy)
122static void free_msrs(void) 122static void free_msrs(void)
123{ 123{
124 int i; 124 int i;
125 for_each_cpu(i) { 125 for_each_possible_cpu(i) {
126 kfree(cpu_msrs[i].counters); 126 kfree(cpu_msrs[i].counters);
127 cpu_msrs[i].counters = NULL; 127 cpu_msrs[i].counters = NULL;
128 kfree(cpu_msrs[i].controls); 128 kfree(cpu_msrs[i].controls);
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index c686d9c12f7b..5100261310f7 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -93,19 +93,22 @@ static int coherence_id_open(struct inode *inode, struct file *file)
93static struct proc_dir_entry 93static struct proc_dir_entry
94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent, 94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent,
95 int (*openfunc)(struct inode *, struct file *), 95 int (*openfunc)(struct inode *, struct file *),
96 int (*releasefunc)(struct inode *, struct file *)) 96 int (*releasefunc)(struct inode *, struct file *),
97 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *))
97{ 98{
98 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); 99 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent);
99 100
100 if (e) { 101 if (e) {
101 e->proc_fops = (struct file_operations *)kmalloc( 102 struct file_operations *f;
102 sizeof(struct file_operations), GFP_KERNEL); 103
103 if (e->proc_fops) { 104 f = kzalloc(sizeof(*f), GFP_KERNEL);
104 memset(e->proc_fops, 0, sizeof(struct file_operations)); 105 if (f) {
105 e->proc_fops->open = openfunc; 106 f->open = openfunc;
106 e->proc_fops->read = seq_read; 107 f->read = seq_read;
107 e->proc_fops->llseek = seq_lseek; 108 f->llseek = seq_lseek;
108 e->proc_fops->release = releasefunc; 109 f->release = releasefunc;
110 f->write = write;
111 e->proc_fops = f;
109 } 112 }
110 } 113 }
111 114
@@ -119,31 +122,29 @@ extern int sn_topology_release(struct inode *, struct file *);
119void register_sn_procfs(void) 122void register_sn_procfs(void)
120{ 123{
121 static struct proc_dir_entry *sgi_proc_dir = NULL; 124 static struct proc_dir_entry *sgi_proc_dir = NULL;
122 struct proc_dir_entry *e;
123 125
124 BUG_ON(sgi_proc_dir != NULL); 126 BUG_ON(sgi_proc_dir != NULL);
125 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 127 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
126 return; 128 return;
127 129
128 sn_procfs_create_entry("partition_id", sgi_proc_dir, 130 sn_procfs_create_entry("partition_id", sgi_proc_dir,
129 partition_id_open, single_release); 131 partition_id_open, single_release, NULL);
130 132
131 sn_procfs_create_entry("system_serial_number", sgi_proc_dir, 133 sn_procfs_create_entry("system_serial_number", sgi_proc_dir,
132 system_serial_number_open, single_release); 134 system_serial_number_open, single_release, NULL);
133 135
134 sn_procfs_create_entry("licenseID", sgi_proc_dir, 136 sn_procfs_create_entry("licenseID", sgi_proc_dir,
135 licenseID_open, single_release); 137 licenseID_open, single_release, NULL);
136 138
137 e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, 139 sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir,
138 sn_force_interrupt_open, single_release); 140 sn_force_interrupt_open, single_release,
139 if (e) 141 sn_force_interrupt_write_proc);
140 e->proc_fops->write = sn_force_interrupt_write_proc;
141 142
142 sn_procfs_create_entry("coherence_id", sgi_proc_dir, 143 sn_procfs_create_entry("coherence_id", sgi_proc_dir,
143 coherence_id_open, single_release); 144 coherence_id_open, single_release, NULL);
144 145
145 sn_procfs_create_entry("sn_topology", sgi_proc_dir, 146 sn_procfs_create_entry("sn_topology", sgi_proc_dir,
146 sn_topology_open, sn_topology_release); 147 sn_topology_open, sn_topology_release, NULL);
147} 148}
148 149
149#endif /* CONFIG_PROC_FS */ 150#endif /* CONFIG_PROC_FS */
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index a69fe3048edc..b0e4c084df8a 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -17,6 +17,7 @@
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */ 18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/bcd.h>
20#include <asm/mvme16xhw.h> 21#include <asm/mvme16xhw.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
@@ -31,9 +32,6 @@
31 * ioctls. 32 * ioctls.
32 */ 33 */
33 34
34#define BCD2BIN(val) (((val)&15) + ((val)>>4)*10)
35#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
36
37static const unsigned char days_in_mo[] = 35static const unsigned char days_in_mo[] =
38{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 36{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
39 37
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index f17d3378e9a6..74cb055d4bf6 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -36,41 +36,13 @@
36#include <asm/dec/ioasic_addrs.h> 36#include <asm/dec/ioasic_addrs.h>
37#include <asm/dec/machtype.h> 37#include <asm/dec/machtype.h>
38 38
39
40/*
41 * Returns true if a clock update is in progress
42 */
43static inline unsigned char dec_rtc_is_updating(void)
44{
45 unsigned char uip;
46 unsigned long flags;
47
48 spin_lock_irqsave(&rtc_lock, flags);
49 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
50 spin_unlock_irqrestore(&rtc_lock, flags);
51 return uip;
52}
53
54static unsigned long dec_rtc_get_time(void) 39static unsigned long dec_rtc_get_time(void)
55{ 40{
56 unsigned int year, mon, day, hour, min, sec, real_year; 41 unsigned int year, mon, day, hour, min, sec, real_year;
57 int i;
58 unsigned long flags; 42 unsigned long flags;
59 43
60 /* The Linux interpretation of the DS1287 clock register contents:
61 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
62 * RTC registers show the second which has precisely just started.
63 * Let's hope other operating systems interpret the RTC the same way.
64 */
65 /* read RTC exactly on falling edge of update flag */
66 for (i = 0; i < 1000000; i++) /* may take up to 1 second... */
67 if (dec_rtc_is_updating())
68 break;
69 for (i = 0; i < 1000000; i++) /* must try at least 2.228 ms */
70 if (!dec_rtc_is_updating())
71 break;
72 spin_lock_irqsave(&rtc_lock, flags); 44 spin_lock_irqsave(&rtc_lock, flags);
73 /* Isn't this overkill? UIP above should guarantee consistency */ 45
74 do { 46 do {
75 sec = CMOS_READ(RTC_SECONDS); 47 sec = CMOS_READ(RTC_SECONDS);
76 min = CMOS_READ(RTC_MINUTES); 48 min = CMOS_READ(RTC_MINUTES);
@@ -78,7 +50,16 @@ static unsigned long dec_rtc_get_time(void)
78 day = CMOS_READ(RTC_DAY_OF_MONTH); 50 day = CMOS_READ(RTC_DAY_OF_MONTH);
79 mon = CMOS_READ(RTC_MONTH); 51 mon = CMOS_READ(RTC_MONTH);
80 year = CMOS_READ(RTC_YEAR); 52 year = CMOS_READ(RTC_YEAR);
53 /*
54 * The PROM will reset the year to either '72 or '73.
55 * Therefore we store the real year separately, in one
56 * of unused BBU RAM locations.
57 */
58 real_year = CMOS_READ(RTC_DEC_YEAR);
81 } while (sec != CMOS_READ(RTC_SECONDS)); 59 } while (sec != CMOS_READ(RTC_SECONDS));
60
61 spin_unlock_irqrestore(&rtc_lock, flags);
62
82 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 63 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
83 sec = BCD2BIN(sec); 64 sec = BCD2BIN(sec);
84 min = BCD2BIN(min); 65 min = BCD2BIN(min);
@@ -87,13 +68,7 @@ static unsigned long dec_rtc_get_time(void)
87 mon = BCD2BIN(mon); 68 mon = BCD2BIN(mon);
88 year = BCD2BIN(year); 69 year = BCD2BIN(year);
89 } 70 }
90 /* 71
91 * The PROM will reset the year to either '72 or '73.
92 * Therefore we store the real year separately, in one
93 * of unused BBU RAM locations.
94 */
95 real_year = CMOS_READ(RTC_DEC_YEAR);
96 spin_unlock_irqrestore(&rtc_lock, flags);
97 year += real_year - 72 + 2000; 72 year += real_year - 72 + 2000;
98 73
99 return mktime(year, mon, day, hour, min, sec); 74 return mktime(year, mon, day, hour, min, sec);
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index 969612eab8a6..370e75d0e75c 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -58,6 +58,7 @@
58#include <linux/bootmem.h> 58#include <linux/bootmem.h>
59#include <linux/mv643xx.h> 59#include <linux/mv643xx.h>
60#include <linux/pm.h> 60#include <linux/pm.h>
61#include <linux/bcd.h>
61 62
62#include <asm/time.h> 63#include <asm/time.h>
63#include <asm/page.h> 64#include <asm/page.h>
@@ -131,9 +132,6 @@ void setup_wired_tlb_entries(void)
131 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M); 132 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M);
132} 133}
133 134
134#define CONV_BCD_TO_BIN(val) (((val) & 0xf) + (((val) >> 4) * 10))
135#define CONV_BIN_TO_BCD(val) (((val) % 10) + (((val) / 10) << 4))
136
137unsigned long m48t37y_get_time(void) 135unsigned long m48t37y_get_time(void)
138{ 136{
139 unsigned int year, month, day, hour, min, sec; 137 unsigned int year, month, day, hour, min, sec;
@@ -143,16 +141,16 @@ unsigned long m48t37y_get_time(void)
143 /* stop the update */ 141 /* stop the update */
144 rtc_base[0x7ff8] = 0x40; 142 rtc_base[0x7ff8] = 0x40;
145 143
146 year = CONV_BCD_TO_BIN(rtc_base[0x7fff]); 144 year = BCD2BIN(rtc_base[0x7fff]);
147 year += CONV_BCD_TO_BIN(rtc_base[0x7ff1]) * 100; 145 year += BCD2BIN(rtc_base[0x7ff1]) * 100;
148 146
149 month = CONV_BCD_TO_BIN(rtc_base[0x7ffe]); 147 month = BCD2BIN(rtc_base[0x7ffe]);
150 148
151 day = CONV_BCD_TO_BIN(rtc_base[0x7ffd]); 149 day = BCD2BIN(rtc_base[0x7ffd]);
152 150
153 hour = CONV_BCD_TO_BIN(rtc_base[0x7ffb]); 151 hour = BCD2BIN(rtc_base[0x7ffb]);
154 min = CONV_BCD_TO_BIN(rtc_base[0x7ffa]); 152 min = BCD2BIN(rtc_base[0x7ffa]);
155 sec = CONV_BCD_TO_BIN(rtc_base[0x7ff9]); 153 sec = BCD2BIN(rtc_base[0x7ff9]);
156 154
157 /* start the update */ 155 /* start the update */
158 rtc_base[0x7ff8] = 0x00; 156 rtc_base[0x7ff8] = 0x00;
@@ -175,22 +173,22 @@ int m48t37y_set_time(unsigned long sec)
175 rtc_base[0x7ff8] = 0x80; 173 rtc_base[0x7ff8] = 0x80;
176 174
177 /* year */ 175 /* year */
178 rtc_base[0x7fff] = CONV_BIN_TO_BCD(tm.tm_year % 100); 176 rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100);
179 rtc_base[0x7ff1] = CONV_BIN_TO_BCD(tm.tm_year / 100); 177 rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100);
180 178
181 /* month */ 179 /* month */
182 rtc_base[0x7ffe] = CONV_BIN_TO_BCD(tm.tm_mon); 180 rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon);
183 181
184 /* day */ 182 /* day */
185 rtc_base[0x7ffd] = CONV_BIN_TO_BCD(tm.tm_mday); 183 rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday);
186 184
187 /* hour/min/sec */ 185 /* hour/min/sec */
188 rtc_base[0x7ffb] = CONV_BIN_TO_BCD(tm.tm_hour); 186 rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour);
189 rtc_base[0x7ffa] = CONV_BIN_TO_BCD(tm.tm_min); 187 rtc_base[0x7ffa] = BIN2BCD(tm.tm_min);
190 rtc_base[0x7ff9] = CONV_BIN_TO_BCD(tm.tm_sec); 188 rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec);
191 189
192 /* day of week -- not really used, but let's keep it up-to-date */ 190 /* day of week -- not really used, but let's keep it up-to-date */
193 rtc_base[0x7ffc] = CONV_BIN_TO_BCD(tm.tm_wday + 1); 191 rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1);
194 192
195 /* disable writing */ 193 /* disable writing */
196 rtc_base[0x7ff8] = 0x00; 194 rtc_base[0x7ff8] = 0x00;
diff --git a/arch/mips/tx4938/common/rtc_rx5c348.c b/arch/mips/tx4938/common/rtc_rx5c348.c
index f74295f28527..07f782fc0725 100644
--- a/arch/mips/tx4938/common/rtc_rx5c348.c
+++ b/arch/mips/tx4938/common/rtc_rx5c348.c
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/rtc.h> 15#include <linux/rtc.h>
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/bcd.h>
17#include <asm/time.h> 18#include <asm/time.h>
18#include <asm/tx4938/spi.h> 19#include <asm/tx4938/spi.h>
19 20
@@ -77,17 +78,6 @@ spi_rtc_io(unsigned char *inbuf, unsigned char *outbuf, unsigned int count)
77 inbufs, incounts, outbufs, outcounts, 0); 78 inbufs, incounts, outbufs, outcounts, 0);
78} 79}
79 80
80/*
81 * Conversion between binary and BCD.
82 */
83#ifndef BCD_TO_BIN
84#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
85#endif
86
87#ifndef BIN_TO_BCD
88#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
89#endif
90
91/* RTC-dependent code for time.c */ 81/* RTC-dependent code for time.c */
92 82
93static int 83static int
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index b3962c3a0348..5be40aa483fd 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -103,7 +103,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr)
103 103
104static int 104static int
105spufs_new_file(struct super_block *sb, struct dentry *dentry, 105spufs_new_file(struct super_block *sb, struct dentry *dentry,
106 struct file_operations *fops, int mode, 106 const struct file_operations *fops, int mode,
107 struct spu_context *ctx) 107 struct spu_context *ctx)
108{ 108{
109 static struct inode_operations spufs_file_iops = { 109 static struct inode_operations spufs_file_iops = {
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 12c6f689b1aa..7d7889026936 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -120,33 +120,15 @@ int chrp_set_rtc_time(struct rtc_time *tmarg)
120void chrp_get_rtc_time(struct rtc_time *tm) 120void chrp_get_rtc_time(struct rtc_time *tm)
121{ 121{
122 unsigned int year, mon, day, hour, min, sec; 122 unsigned int year, mon, day, hour, min, sec;
123 int uip, i;
124 123
125 /* The Linux interpretation of the CMOS clock register contents: 124 do {
126 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
127 * RTC registers show the second which has precisely just started.
128 * Let's hope other operating systems interpret the RTC the same way.
129 */
130
131 /* Since the UIP flag is set for about 2.2 ms and the clock
132 * is typically written with a precision of 1 jiffy, trying
133 * to obtain a precision better than a few milliseconds is
134 * an illusion. Only consistency is interesting, this also
135 * allows to use the routine for /dev/rtc without a potential
136 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
137 */
138
139 for ( i = 0; i<1000000; i++) {
140 uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
141 sec = chrp_cmos_clock_read(RTC_SECONDS); 125 sec = chrp_cmos_clock_read(RTC_SECONDS);
142 min = chrp_cmos_clock_read(RTC_MINUTES); 126 min = chrp_cmos_clock_read(RTC_MINUTES);
143 hour = chrp_cmos_clock_read(RTC_HOURS); 127 hour = chrp_cmos_clock_read(RTC_HOURS);
144 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); 128 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
145 mon = chrp_cmos_clock_read(RTC_MONTH); 129 mon = chrp_cmos_clock_read(RTC_MONTH);
146 year = chrp_cmos_clock_read(RTC_YEAR); 130 year = chrp_cmos_clock_read(RTC_YEAR);
147 uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT); 131 } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
148 if ((uip & RTC_UIP)==0) break;
149 }
150 132
151 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 133 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
152 BCD_TO_BIN(sec); 134 BCD_TO_BIN(sec);
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 5e6981d17379..b9a2b3d4bf33 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -60,34 +60,14 @@ static void maple_clock_write(unsigned long val, int addr)
60 60
61void maple_get_rtc_time(struct rtc_time *tm) 61void maple_get_rtc_time(struct rtc_time *tm)
62{ 62{
63 int uip, i; 63 do {
64
65 /* The Linux interpretation of the CMOS clock register contents:
66 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
67 * RTC registers show the second which has precisely just started.
68 * Let's hope other operating systems interpret the RTC the same way.
69 */
70
71 /* Since the UIP flag is set for about 2.2 ms and the clock
72 * is typically written with a precision of 1 jiffy, trying
73 * to obtain a precision better than a few milliseconds is
74 * an illusion. Only consistency is interesting, this also
75 * allows to use the routine for /dev/rtc without a potential
76 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
77 */
78
79 for (i = 0; i<1000000; i++) {
80 uip = maple_clock_read(RTC_FREQ_SELECT);
81 tm->tm_sec = maple_clock_read(RTC_SECONDS); 64 tm->tm_sec = maple_clock_read(RTC_SECONDS);
82 tm->tm_min = maple_clock_read(RTC_MINUTES); 65 tm->tm_min = maple_clock_read(RTC_MINUTES);
83 tm->tm_hour = maple_clock_read(RTC_HOURS); 66 tm->tm_hour = maple_clock_read(RTC_HOURS);
84 tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH); 67 tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH);
85 tm->tm_mon = maple_clock_read(RTC_MONTH); 68 tm->tm_mon = maple_clock_read(RTC_MONTH);
86 tm->tm_year = maple_clock_read(RTC_YEAR); 69 tm->tm_year = maple_clock_read(RTC_YEAR);
87 uip |= maple_clock_read(RTC_FREQ_SELECT); 70 } while (tm->tm_sec != maple_clock_read(RTC_SECONDS));
88 if ((uip & RTC_UIP)==0)
89 break;
90 }
91 71
92 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY) 72 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
93 || RTC_ALWAYS_BCD) { 73 || RTC_ALWAYS_BCD) {
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
index 2f5c7650274f..9b84bffdefce 100644
--- a/arch/ppc/kernel/ppc_htab.c
+++ b/arch/ppc/kernel/ppc_htab.c
@@ -52,7 +52,7 @@ static int ppc_htab_open(struct inode *inode, struct file *file)
52 return single_open(file, ppc_htab_show, NULL); 52 return single_open(file, ppc_htab_show, NULL);
53} 53}
54 54
55struct file_operations ppc_htab_operations = { 55const struct file_operations ppc_htab_operations = {
56 .open = ppc_htab_open, 56 .open = ppc_htab_open,
57 .read = seq_read, 57 .read = seq_read,
58 .llseek = seq_lseek, 58 .llseek = seq_lseek,
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c
index c8627770af13..51e06ad66168 100644
--- a/arch/ppc/platforms/chrp_time.c
+++ b/arch/ppc/platforms/chrp_time.c
@@ -119,44 +119,28 @@ int chrp_set_rtc_time(unsigned long nowtime)
119unsigned long chrp_get_rtc_time(void) 119unsigned long chrp_get_rtc_time(void)
120{ 120{
121 unsigned int year, mon, day, hour, min, sec; 121 unsigned int year, mon, day, hour, min, sec;
122 int uip, i;
123 122
124 /* The Linux interpretation of the CMOS clock register contents: 123 do {
125 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
126 * RTC registers show the second which has precisely just started.
127 * Let's hope other operating systems interpret the RTC the same way.
128 */
129
130 /* Since the UIP flag is set for about 2.2 ms and the clock
131 * is typically written with a precision of 1 jiffy, trying
132 * to obtain a precision better than a few milliseconds is
133 * an illusion. Only consistency is interesting, this also
134 * allows to use the routine for /dev/rtc without a potential
135 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
136 */
137
138 for ( i = 0; i<1000000; i++) {
139 uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
140 sec = chrp_cmos_clock_read(RTC_SECONDS); 124 sec = chrp_cmos_clock_read(RTC_SECONDS);
141 min = chrp_cmos_clock_read(RTC_MINUTES); 125 min = chrp_cmos_clock_read(RTC_MINUTES);
142 hour = chrp_cmos_clock_read(RTC_HOURS); 126 hour = chrp_cmos_clock_read(RTC_HOURS);
143 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); 127 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
144 mon = chrp_cmos_clock_read(RTC_MONTH); 128 mon = chrp_cmos_clock_read(RTC_MONTH);
145 year = chrp_cmos_clock_read(RTC_YEAR); 129 year = chrp_cmos_clock_read(RTC_YEAR);
146 uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT); 130 } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
147 if ((uip & RTC_UIP)==0) break; 131
132 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
133 || RTC_ALWAYS_BCD) {
134 BCD_TO_BIN(sec);
135 BCD_TO_BIN(min);
136 BCD_TO_BIN(hour);
137 BCD_TO_BIN(day);
138 BCD_TO_BIN(mon);
139 BCD_TO_BIN(year);
148 } 140 }
149 141
150 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 142 year += 1900;
151 { 143 if (year < 1970)
152 BCD_TO_BIN(sec);
153 BCD_TO_BIN(min);
154 BCD_TO_BIN(hour);
155 BCD_TO_BIN(day);
156 BCD_TO_BIN(mon);
157 BCD_TO_BIN(year);
158 }
159 if ((year += 1900) < 1970)
160 year += 100; 144 year += 100;
161 return mktime(year, mon, day, hour, min, sec); 145 return mktime(year, mon, day, hour, min, sec);
162} 146}
diff --git a/arch/sh/boards/mpc1211/rtc.c b/arch/sh/boards/mpc1211/rtc.c
index 4d100f048072..a76c655dceee 100644
--- a/arch/sh/boards/mpc1211/rtc.c
+++ b/arch/sh/boards/mpc1211/rtc.c
@@ -9,36 +9,16 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h>
12#include <linux/mc146818rtc.h> 13#include <linux/mc146818rtc.h>
13 14
14#ifndef BCD_TO_BIN
15#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
16#endif
17
18#ifndef BIN_TO_BCD
19#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
20#endif
21
22/* arc/i386/kernel/time.c */
23unsigned long get_cmos_time(void) 15unsigned long get_cmos_time(void)
24{ 16{
25 unsigned int year, mon, day, hour, min, sec; 17 unsigned int year, mon, day, hour, min, sec;
26 int i;
27 18
28 spin_lock(&rtc_lock); 19 spin_lock(&rtc_lock);
29 /* The Linux interpretation of the CMOS clock register contents: 20
30 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the 21 do {
31 * RTC registers show the second which has precisely just started.
32 * Let's hope other operating systems interpret the RTC the same way.
33 */
34 /* read RTC exactly on falling edge of update flag */
35 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
36 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
37 break;
38 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
39 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
40 break;
41 do { /* Isn't this overkill ? UIP above should guarantee consistency */
42 sec = CMOS_READ(RTC_SECONDS); 22 sec = CMOS_READ(RTC_SECONDS);
43 min = CMOS_READ(RTC_MINUTES); 23 min = CMOS_READ(RTC_MINUTES);
44 hour = CMOS_READ(RTC_HOURS); 24 hour = CMOS_READ(RTC_HOURS);
@@ -46,18 +26,22 @@ unsigned long get_cmos_time(void)
46 mon = CMOS_READ(RTC_MONTH); 26 mon = CMOS_READ(RTC_MONTH);
47 year = CMOS_READ(RTC_YEAR); 27 year = CMOS_READ(RTC_YEAR);
48 } while (sec != CMOS_READ(RTC_SECONDS)); 28 } while (sec != CMOS_READ(RTC_SECONDS));
49 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 29
50 { 30 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
51 BCD_TO_BIN(sec); 31 BCD_TO_BIN(sec);
52 BCD_TO_BIN(min); 32 BCD_TO_BIN(min);
53 BCD_TO_BIN(hour); 33 BCD_TO_BIN(hour);
54 BCD_TO_BIN(day); 34 BCD_TO_BIN(day);
55 BCD_TO_BIN(mon); 35 BCD_TO_BIN(mon);
56 BCD_TO_BIN(year); 36 BCD_TO_BIN(year);
57 } 37 }
38
58 spin_unlock(&rtc_lock); 39 spin_unlock(&rtc_lock);
59 if ((year += 1900) < 1970) 40
41 year += 1900;
42 if (year < 1970)
60 year += 100; 43 year += 100;
44
61 return mktime(year, mon, day, hour, min, sec); 45 return mktime(year, mon, day, hour, min, sec);
62} 46}
63 47
diff --git a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/sh03/rtc.c
index cbeca7037ba5..d609863cfe53 100644
--- a/arch/sh/boards/sh03/rtc.c
+++ b/arch/sh/boards/sh03/rtc.c
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h>
12#include <asm/io.h> 13#include <asm/io.h>
13#include <linux/rtc.h> 14#include <linux/rtc.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -33,14 +34,6 @@
33#define RTC_BUSY 1 34#define RTC_BUSY 1
34#define RTC_STOP 2 35#define RTC_STOP 2
35 36
36#ifndef BCD_TO_BIN
37#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
38#endif
39
40#ifndef BIN_TO_BCD
41#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
42#endif
43
44extern void (*rtc_get_time)(struct timespec *); 37extern void (*rtc_get_time)(struct timespec *);
45extern int (*rtc_set_time)(const time_t); 38extern int (*rtc_set_time)(const time_t);
46extern spinlock_t rtc_lock; 39extern spinlock_t rtc_lock;
@@ -48,13 +41,9 @@ extern spinlock_t rtc_lock;
48unsigned long get_cmos_time(void) 41unsigned long get_cmos_time(void)
49{ 42{
50 unsigned int year, mon, day, hour, min, sec; 43 unsigned int year, mon, day, hour, min, sec;
51 int i;
52 44
53 spin_lock(&rtc_lock); 45 spin_lock(&rtc_lock);
54 again: 46 again:
55 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
56 if (!(ctrl_inb(RTC_CTL) & RTC_BUSY))
57 break;
58 do { 47 do {
59 sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10; 48 sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10;
60 min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10; 49 min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10;
diff --git a/arch/sh/kernel/cpu/rtc.c b/arch/sh/kernel/cpu/rtc.c
index f8361f5e788b..4304cf75cfa2 100644
--- a/arch/sh/kernel/cpu/rtc.c
+++ b/arch/sh/kernel/cpu/rtc.c
@@ -9,18 +9,10 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12 12#include <linux/bcd.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/rtc.h> 14#include <asm/rtc.h>
15 15
16#ifndef BCD_TO_BIN
17#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
18#endif
19
20#ifndef BIN_TO_BCD
21#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
22#endif
23
24void sh_rtc_gettimeofday(struct timespec *ts) 16void sh_rtc_gettimeofday(struct timespec *ts)
25{ 17{
26 unsigned int sec128, sec, sec2, min, hr, wk, day, mon, yr, yr100, cf_bit; 18 unsigned int sec128, sec, sec2, min, hr, wk, day, mon, yr, yr100, cf_bit;
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 0773c9f389f3..6b8f4d22abc6 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -30,6 +30,7 @@
30#include <linux/profile.h> 30#include <linux/profile.h>
31#include <linux/smp.h> 31#include <linux/smp.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/bcd.h>
33 34
34#include <asm/registers.h> /* required by inline __asm__ stmt. */ 35#include <asm/registers.h> /* required by inline __asm__ stmt. */
35 36
@@ -105,14 +106,6 @@
105#define RCR1 rtc_base+0x38 106#define RCR1 rtc_base+0x38
106#define RCR2 rtc_base+0x3c 107#define RCR2 rtc_base+0x3c
107 108
108#ifndef BCD_TO_BIN
109#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
110#endif
111
112#ifndef BIN_TO_BCD
113#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
114#endif
115
116#define TICK_SIZE (tick_nsec / 1000) 109#define TICK_SIZE (tick_nsec / 1000)
117 110
118extern unsigned long wall_jiffies; 111extern unsigned long wall_jiffies;
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 7d61f1bfd3d3..e55b5c6ece02 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -641,23 +641,8 @@ static void __init set_system_time(void)
641 mon = MSTK_REG_MONTH(mregs); 641 mon = MSTK_REG_MONTH(mregs);
642 year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) ); 642 year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
643 } else { 643 } else {
644 int i;
645
646 /* Dallas 12887 RTC chip. */ 644 /* Dallas 12887 RTC chip. */
647 645
648 /* Stolen from arch/i386/kernel/time.c, see there for
649 * credits and descriptive comments.
650 */
651 for (i = 0; i < 1000000; i++) {
652 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
653 break;
654 udelay(10);
655 }
656 for (i = 0; i < 1000000; i++) {
657 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
658 break;
659 udelay(10);
660 }
661 do { 646 do {
662 sec = CMOS_READ(RTC_SECONDS); 647 sec = CMOS_READ(RTC_SECONDS);
663 min = CMOS_READ(RTC_MINUTES); 648 min = CMOS_READ(RTC_MINUTES);
@@ -666,6 +651,7 @@ static void __init set_system_time(void)
666 mon = CMOS_READ(RTC_MONTH); 651 mon = CMOS_READ(RTC_MONTH);
667 year = CMOS_READ(RTC_YEAR); 652 year = CMOS_READ(RTC_YEAR);
668 } while (sec != CMOS_READ(RTC_SECONDS)); 653 } while (sec != CMOS_READ(RTC_SECONDS));
654
669 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 655 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
670 BCD_TO_BIN(sec); 656 BCD_TO_BIN(sec);
671 BCD_TO_BIN(min); 657 BCD_TO_BIN(min);
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 7f58fa682491..473b514b66e4 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -504,42 +504,25 @@ unsigned long long sched_clock(void)
504 504
505static unsigned long get_cmos_time(void) 505static unsigned long get_cmos_time(void)
506{ 506{
507 unsigned int timeout = 1000000, year, mon, day, hour, min, sec; 507 unsigned int year, mon, day, hour, min, sec;
508 unsigned char uip = 0, this = 0;
509 unsigned long flags; 508 unsigned long flags;
510 unsigned extyear = 0; 509 unsigned extyear = 0;
511 510
512/*
513 * The Linux interpretation of the CMOS clock register contents: When the
514 * Update-In-Progress (UIP) flag goes from 1 to 0, the RTC registers show the
515 * second which has precisely just started. Waiting for this can take up to 1
516 * second, we timeout approximately after 2.4 seconds on a machine with
517 * standard 8.3 MHz ISA bus.
518 */
519
520 spin_lock_irqsave(&rtc_lock, flags); 511 spin_lock_irqsave(&rtc_lock, flags);
521 512
522 while (timeout && (!uip || this)) { 513 do {
523 uip |= this; 514 sec = CMOS_READ(RTC_SECONDS);
524 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; 515 min = CMOS_READ(RTC_MINUTES);
525 timeout--; 516 hour = CMOS_READ(RTC_HOURS);
526 } 517 day = CMOS_READ(RTC_DAY_OF_MONTH);
527 518 mon = CMOS_READ(RTC_MONTH);
528 /* 519 year = CMOS_READ(RTC_YEAR);
529 * Here we are safe to assume the registers won't change for a whole
530 * second, so we just go ahead and read them.
531 */
532 sec = CMOS_READ(RTC_SECONDS);
533 min = CMOS_READ(RTC_MINUTES);
534 hour = CMOS_READ(RTC_HOURS);
535 day = CMOS_READ(RTC_DAY_OF_MONTH);
536 mon = CMOS_READ(RTC_MONTH);
537 year = CMOS_READ(RTC_YEAR);
538
539#ifdef CONFIG_ACPI 520#ifdef CONFIG_ACPI
540 if (acpi_fadt.revision >= FADT2_REVISION_ID && acpi_fadt.century) 521 if (acpi_fadt.revision >= FADT2_REVISION_ID &&
541 extyear = CMOS_READ(acpi_fadt.century); 522 acpi_fadt.century)
523 extyear = CMOS_READ(acpi_fadt.century);
542#endif 524#endif
525 } while (sec != CMOS_READ(RTC_SECONDS));
543 526
544 spin_unlock_irqrestore(&rtc_lock, flags); 527 spin_unlock_irqrestore(&rtc_lock, flags);
545 528
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 82469db25100..5a19e2eb5711 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3514,7 +3514,7 @@ int __init blk_dev_init(void)
3514 iocontext_cachep = kmem_cache_create("blkdev_ioc", 3514 iocontext_cachep = kmem_cache_create("blkdev_ioc",
3515 sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL); 3515 sizeof(struct io_context), 0, SLAB_PANIC, NULL, NULL);
3516 3516
3517 for_each_cpu(i) 3517 for_each_possible_cpu(i)
3518 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i)); 3518 INIT_LIST_HEAD(&per_cpu(blk_cpu_done, i));
3519 3519
3520 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL); 3520 open_softirq(BLOCK_SOFTIRQ, blk_done_softirq, NULL);
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 69f4c7ce9a63..cac09e353be8 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -1972,7 +1972,7 @@ static int __devinit lanai_pci_start(struct lanai_dev *lanai)
1972 "(itf %d): No suitable DMA available.\n", lanai->number); 1972 "(itf %d): No suitable DMA available.\n", lanai->number);
1973 return -EBUSY; 1973 return -EBUSY;
1974 } 1974 }
1975 if (pci_set_consistent_dma_mask(pci, 0xFFFFFFFF) != 0) { 1975 if (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) != 0) {
1976 printk(KERN_WARNING DEV_LABEL 1976 printk(KERN_WARNING DEV_LABEL
1977 "(itf %d): No suitable DMA available.\n", lanai->number); 1977 "(itf %d): No suitable DMA available.\n", lanai->number);
1978 return -EBUSY; 1978 return -EBUSY;
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index 49c7cd558ddf..45bcda544880 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -41,6 +41,7 @@
41#include <linux/timer.h> 41#include <linux/timer.h>
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/init.h> 43#include <linux/init.h>
44#include <linux/jiffies.h>
44#include <linux/random.h> 45#include <linux/random.h>
45#include <asm/io.h> 46#include <asm/io.h>
46#include <asm/uaccess.h> 47#include <asm/uaccess.h>
@@ -3654,8 +3655,8 @@ static void DAC960_V1_ProcessCompletedCommand(DAC960_Command_T *Command)
3654 (NewEnquiry->EventLogSequenceNumber != 3655 (NewEnquiry->EventLogSequenceNumber !=
3655 OldEnquiry->EventLogSequenceNumber) || 3656 OldEnquiry->EventLogSequenceNumber) ||
3656 Controller->MonitoringTimerCount == 0 || 3657 Controller->MonitoringTimerCount == 0 ||
3657 (jiffies - Controller->SecondaryMonitoringTime 3658 time_after_eq(jiffies, Controller->SecondaryMonitoringTime
3658 >= DAC960_SecondaryMonitoringInterval)) 3659 + DAC960_SecondaryMonitoringInterval))
3659 { 3660 {
3660 Controller->V1.NeedLogicalDriveInformation = true; 3661 Controller->V1.NeedLogicalDriveInformation = true;
3661 Controller->V1.NewEventLogSequenceNumber = 3662 Controller->V1.NewEventLogSequenceNumber =
@@ -5640,8 +5641,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
5640 unsigned int StatusChangeCounter = 5641 unsigned int StatusChangeCounter =
5641 Controller->V2.HealthStatusBuffer->StatusChangeCounter; 5642 Controller->V2.HealthStatusBuffer->StatusChangeCounter;
5642 boolean ForceMonitoringCommand = false; 5643 boolean ForceMonitoringCommand = false;
5643 if (jiffies - Controller->SecondaryMonitoringTime 5644 if (time_after(jiffies, Controller->SecondaryMonitoringTime
5644 > DAC960_SecondaryMonitoringInterval) 5645 + DAC960_SecondaryMonitoringInterval))
5645 { 5646 {
5646 int LogicalDriveNumber; 5647 int LogicalDriveNumber;
5647 for (LogicalDriveNumber = 0; 5648 for (LogicalDriveNumber = 0;
@@ -5669,8 +5670,8 @@ static void DAC960_MonitoringTimerFunction(unsigned long TimerData)
5669 ControllerInfo->ConsistencyChecksActive + 5670 ControllerInfo->ConsistencyChecksActive +
5670 ControllerInfo->RebuildsActive + 5671 ControllerInfo->RebuildsActive +
5671 ControllerInfo->OnlineExpansionsActive == 0 || 5672 ControllerInfo->OnlineExpansionsActive == 0 ||
5672 jiffies - Controller->PrimaryMonitoringTime 5673 time_before(jiffies, Controller->PrimaryMonitoringTime
5673 < DAC960_MonitoringTimerInterval) && 5674 + DAC960_MonitoringTimerInterval)) &&
5674 !ForceMonitoringCommand) 5675 !ForceMonitoringCommand)
5675 { 5676 {
5676 Controller->MonitoringTimer.expires = 5677 Controller->MonitoringTimer.expires =
@@ -5807,8 +5808,8 @@ static void DAC960_Message(DAC960_MessageLevel_T MessageLevel,
5807 Controller->ProgressBufferLength = Length; 5808 Controller->ProgressBufferLength = Length;
5808 if (Controller->EphemeralProgressMessage) 5809 if (Controller->EphemeralProgressMessage)
5809 { 5810 {
5810 if (jiffies - Controller->LastProgressReportTime 5811 if (time_after_eq(jiffies, Controller->LastProgressReportTime
5811 >= DAC960_ProgressReportingInterval) 5812 + DAC960_ProgressReportingInterval))
5812 { 5813 {
5813 printk("%sDAC960#%d: %s", DAC960_MessageLevelMap[MessageLevel], 5814 printk("%sDAC960#%d: %s", DAC960_MessageLevelMap[MessageLevel],
5814 Controller->ControllerNumber, Buffer); 5815 Controller->ControllerNumber, Buffer);
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index 875ae7699025..ae0949b3394f 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -383,8 +383,9 @@ config BLK_DEV_RAM
383 thus say N here. 383 thus say N here.
384 384
385config BLK_DEV_RAM_COUNT 385config BLK_DEV_RAM_COUNT
386 int "Default number of RAM disks" if BLK_DEV_RAM 386 int "Default number of RAM disks"
387 default "16" 387 default "16"
388 depends on BLK_DEV_RAM
388 help 389 help
389 The default value is 16 RAM disks. Change this if you know what 390 The default value is 16 RAM disks. Change this if you know what
390 are doing. If you boot from a filesystem that needs to be extracted 391 are doing. If you boot from a filesystem that needs to be extracted
diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
index a5c1c8e871ec..4cb9c1336287 100644
--- a/drivers/block/acsi_slm.c
+++ b/drivers/block/acsi_slm.c
@@ -369,8 +369,6 @@ static ssize_t slm_read( struct file *file, char *buf, size_t count,
369 int length; 369 int length;
370 int end; 370 int end;
371 371
372 if (count < 0)
373 return( -EINVAL );
374 if (!(page = __get_free_page( GFP_KERNEL ))) 372 if (!(page = __get_free_page( GFP_KERNEL )))
375 return( -ENOMEM ); 373 return( -ENOMEM );
376 374
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index d3ad9081697e..bedb689b051f 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -170,6 +170,7 @@ static int print_unex = 1;
170#include <linux/mm.h> 170#include <linux/mm.h>
171#include <linux/bio.h> 171#include <linux/bio.h>
172#include <linux/string.h> 172#include <linux/string.h>
173#include <linux/jiffies.h>
173#include <linux/fcntl.h> 174#include <linux/fcntl.h>
174#include <linux/delay.h> 175#include <linux/delay.h>
175#include <linux/mc146818rtc.h> /* CMOS defines */ 176#include <linux/mc146818rtc.h> /* CMOS defines */
@@ -747,7 +748,7 @@ static int disk_change(int drive)
747{ 748{
748 int fdc = FDC(drive); 749 int fdc = FDC(drive);
749#ifdef FLOPPY_SANITY_CHECK 750#ifdef FLOPPY_SANITY_CHECK
750 if (jiffies - UDRS->select_date < UDP->select_delay) 751 if (time_before(jiffies, UDRS->select_date + UDP->select_delay))
751 DPRINT("WARNING disk change called early\n"); 752 DPRINT("WARNING disk change called early\n");
752 if (!(FDCS->dor & (0x10 << UNIT(drive))) || 753 if (!(FDCS->dor & (0x10 << UNIT(drive))) ||
753 (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) { 754 (FDCS->dor & 3) != UNIT(drive) || fdc != FDC(drive)) {
@@ -1075,7 +1076,7 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function)
1075 return 1; 1076 return 1;
1076 } 1077 }
1077 1078
1078 if ((signed)(jiffies - delay) < 0) { 1079 if (time_before(jiffies, delay)) {
1079 del_timer(&fd_timer); 1080 del_timer(&fd_timer);
1080 fd_timer.function = function; 1081 fd_timer.function = function;
1081 fd_timer.expires = delay; 1082 fd_timer.expires = delay;
@@ -1535,7 +1536,7 @@ static void setup_rw_floppy(void)
1535 * again just before spinup completion. Beware that 1536 * again just before spinup completion. Beware that
1536 * after scandrives, we must again wait for selection. 1537 * after scandrives, we must again wait for selection.
1537 */ 1538 */
1538 if ((signed)(ready_date - jiffies) > DP->select_delay) { 1539 if (time_after(ready_date, jiffies + DP->select_delay)) {
1539 ready_date -= DP->select_delay; 1540 ready_date -= DP->select_delay;
1540 function = (timeout_fn) floppy_start; 1541 function = (timeout_fn) floppy_start;
1541 } else 1542 } else
@@ -3823,7 +3824,7 @@ static int check_floppy_change(struct gendisk *disk)
3823 if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY)) 3824 if (UTESTF(FD_DISK_CHANGED) || UTESTF(FD_VERIFY))
3824 return 1; 3825 return 1;
3825 3826
3826 if (UDP->checkfreq < (int)(jiffies - UDRS->last_checked)) { 3827 if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
3827 if (floppy_grab_irq_and_dma()) { 3828 if (floppy_grab_irq_and_dma()) {
3828 return 1; 3829 return 1;
3829 } 3830 }
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 62d2464c12f2..2403721f9db1 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -151,6 +151,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
151#include <linux/cdrom.h> /* for the eject ioctl */ 151#include <linux/cdrom.h> /* for the eject ioctl */
152#include <linux/blkdev.h> 152#include <linux/blkdev.h>
153#include <linux/blkpg.h> 153#include <linux/blkpg.h>
154#include <linux/kernel.h>
154#include <asm/uaccess.h> 155#include <asm/uaccess.h>
155#include <linux/sched.h> 156#include <linux/sched.h>
156#include <linux/workqueue.h> 157#include <linux/workqueue.h>
@@ -275,7 +276,7 @@ static void pd_print_error(struct pd_unit *disk, char *msg, int status)
275 int i; 276 int i;
276 277
277 printk("%s: %s: status = 0x%x =", disk->name, msg, status); 278 printk("%s: %s: status = 0x%x =", disk->name, msg, status);
278 for (i = 0; i < 18; i++) 279 for (i = 0; i < ARRAY_SIZE(pd_errs); i++)
279 if (status & (1 << i)) 280 if (status & (1 << i))
280 printk(" %s", pd_errs[i]); 281 printk(" %s", pd_errs[i]);
281 printk("\n"); 282 printk("\n");
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 6f5df0fad703..79b868254032 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -643,7 +643,8 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t
643 643
644static int __init pg_init(void) 644static int __init pg_init(void)
645{ 645{
646 int unit, err = 0; 646 int unit;
647 int err;
647 648
648 if (disable){ 649 if (disable){
649 err = -1; 650 err = -1;
@@ -657,16 +658,17 @@ static int __init pg_init(void)
657 goto out; 658 goto out;
658 } 659 }
659 660
660 if (register_chrdev(major, name, &pg_fops)) { 661 err = register_chrdev(major, name, &pg_fops);
662 if (err < 0) {
661 printk("pg_init: unable to get major number %d\n", major); 663 printk("pg_init: unable to get major number %d\n", major);
662 for (unit = 0; unit < PG_UNITS; unit++) { 664 for (unit = 0; unit < PG_UNITS; unit++) {
663 struct pg *dev = &devices[unit]; 665 struct pg *dev = &devices[unit];
664 if (dev->present) 666 if (dev->present)
665 pi_release(dev->pi); 667 pi_release(dev->pi);
666 } 668 }
667 err = -1;
668 goto out; 669 goto out;
669 } 670 }
671 major = err; /* In case the user specified `major=0' (dynamic) */
670 pg_class = class_create(THIS_MODULE, "pg"); 672 pg_class = class_create(THIS_MODULE, "pg");
671 if (IS_ERR(pg_class)) { 673 if (IS_ERR(pg_class)) {
672 err = PTR_ERR(pg_class); 674 err = PTR_ERR(pg_class);
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 715ae5dc88fb..d2013d362403 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -943,7 +943,8 @@ static ssize_t pt_write(struct file *filp, const char __user *buf, size_t count,
943 943
944static int __init pt_init(void) 944static int __init pt_init(void)
945{ 945{
946 int unit, err = 0; 946 int unit;
947 int err;
947 948
948 if (disable) { 949 if (disable) {
949 err = -1; 950 err = -1;
@@ -955,14 +956,15 @@ static int __init pt_init(void)
955 goto out; 956 goto out;
956 } 957 }
957 958
958 if (register_chrdev(major, name, &pt_fops)) { 959 err = register_chrdev(major, name, &pt_fops);
960 if (err < 0) {
959 printk("pt_init: unable to get major number %d\n", major); 961 printk("pt_init: unable to get major number %d\n", major);
960 for (unit = 0; unit < PT_UNITS; unit++) 962 for (unit = 0; unit < PT_UNITS; unit++)
961 if (pt[unit].present) 963 if (pt[unit].present)
962 pi_release(pt[unit].pi); 964 pi_release(pt[unit].pi);
963 err = -1;
964 goto out; 965 goto out;
965 } 966 }
967 major = err;
966 pt_class = class_create(THIS_MODULE, "pt"); 968 pt_class = class_create(THIS_MODULE, "pt");
967 if (IS_ERR(pt_class)) { 969 if (IS_ERR(pt_class)) {
968 err = PTR_ERR(pt_class); 970 err = PTR_ERR(pt_class);
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index c16e66b9c7a7..f7d4c65a7b8c 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -50,6 +50,7 @@
50#include <linux/timer.h> 50#include <linux/timer.h>
51#include <linux/pci.h> 51#include <linux/pci.h>
52#include <linux/slab.h> 52#include <linux/slab.h>
53#include <linux/dma-mapping.h>
53 54
54#include <linux/fcntl.h> /* O_ACCMODE */ 55#include <linux/fcntl.h> /* O_ACCMODE */
55#include <linux/hdreg.h> /* HDIO_GETGEO */ 56#include <linux/hdreg.h> /* HDIO_GETGEO */
@@ -881,8 +882,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
881 printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n", 882 printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n",
882 card->card_number, dev->bus->number, dev->devfn); 883 card->card_number, dev->bus->number, dev->devfn);
883 884
884 if (pci_set_dma_mask(dev, 0xffffffffffffffffLL) && 885 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
885 pci_set_dma_mask(dev, 0xffffffffLL)) { 886 pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
886 printk(KERN_WARNING "MM%d: NO suitable DMA found\n",num_cards); 887 printk(KERN_WARNING "MM%d: NO suitable DMA found\n",num_cards);
887 return -ENOMEM; 888 return -ENOMEM;
888 } 889 }
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index 70b8ed9cd172..4c67135c12d8 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -11,6 +11,7 @@
11#include <linux/gfp.h> 11#include <linux/gfp.h>
12#include <linux/page-flags.h> 12#include <linux/page-flags.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/jiffies.h>
14#include "agp.h" 15#include "agp.h"
15 16
16/* NVIDIA registers */ 17/* NVIDIA registers */
@@ -256,7 +257,7 @@ static void nvidia_tlbflush(struct agp_memory *mem)
256 do { 257 do {
257 pci_read_config_dword(nvidia_private.dev_1, 258 pci_read_config_dword(nvidia_private.dev_1,
258 NVIDIA_1_WBC, &wbc_reg); 259 NVIDIA_1_WBC, &wbc_reg);
259 if ((signed)(end - jiffies) <= 0) { 260 if (time_before_eq(end, jiffies)) {
260 printk(KERN_ERR PFX 261 printk(KERN_ERR PFX
261 "TLB flush took more than 3 seconds.\n"); 262 "TLB flush took more than 3 seconds.\n");
262 } 263 }
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index 641f7633878c..b7f7951c4587 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -175,7 +175,7 @@ int drm_stub_open(struct inode *inode, struct file *filp)
175 drm_device_t *dev = NULL; 175 drm_device_t *dev = NULL;
176 int minor = iminor(inode); 176 int minor = iminor(inode);
177 int err = -ENODEV; 177 int err = -ENODEV;
178 struct file_operations *old_fops; 178 const struct file_operations *old_fops;
179 179
180 DRM_DEBUG("\n"); 180 DRM_DEBUG("\n");
181 181
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index ae0aa6d7e0bb..c658dde3633b 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -126,7 +126,7 @@ static int i810_map_buffer(drm_buf_t * buf, struct file *filp)
126 drm_device_t *dev = priv->head->dev; 126 drm_device_t *dev = priv->head->dev;
127 drm_i810_buf_priv_t *buf_priv = buf->dev_private; 127 drm_i810_buf_priv_t *buf_priv = buf->dev_private;
128 drm_i810_private_t *dev_priv = dev->dev_private; 128 drm_i810_private_t *dev_priv = dev->dev_private;
129 struct file_operations *old_fops; 129 const struct file_operations *old_fops;
130 int retcode = 0; 130 int retcode = 0;
131 131
132 if (buf_priv->currently_mapped == I810_BUF_MAPPED) 132 if (buf_priv->currently_mapped == I810_BUF_MAPPED)
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
index 163f2cbfe60d..b0f815d8cea8 100644
--- a/drivers/char/drm/i830_dma.c
+++ b/drivers/char/drm/i830_dma.c
@@ -128,7 +128,7 @@ static int i830_map_buffer(drm_buf_t * buf, struct file *filp)
128 drm_device_t *dev = priv->head->dev; 128 drm_device_t *dev = priv->head->dev;
129 drm_i830_buf_priv_t *buf_priv = buf->dev_private; 129 drm_i830_buf_priv_t *buf_priv = buf->dev_private;
130 drm_i830_private_t *dev_priv = dev->dev_private; 130 drm_i830_private_t *dev_priv = dev->dev_private;
131 struct file_operations *old_fops; 131 const struct file_operations *old_fops;
132 unsigned long virtual; 132 unsigned long virtual;
133 int retcode = 0; 133 int retcode = 0;
134 134
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 5245ba1649ed..66719f9d294c 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -899,7 +899,7 @@ static const struct {
899 unsigned int minor; 899 unsigned int minor;
900 char *name; 900 char *name;
901 umode_t mode; 901 umode_t mode;
902 struct file_operations *fops; 902 const struct file_operations *fops;
903} devlist[] = { /* list of minor devices */ 903} devlist[] = { /* list of minor devices */
904 {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops}, 904 {1, "mem", S_IRUSR | S_IWUSR | S_IRGRP, &mem_fops},
905 {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops}, 905 {2, "kmem", S_IRUSR | S_IWUSR | S_IRGRP, &kmem_fops},
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 3e4c0414a01a..96eb2a709e21 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -129,7 +129,7 @@ static int misc_open(struct inode * inode, struct file * file)
129 int minor = iminor(inode); 129 int minor = iminor(inode);
130 struct miscdevice *c; 130 struct miscdevice *c;
131 int err = -ENODEV; 131 int err = -ENODEV;
132 struct file_operations *old_fops, *new_fops = NULL; 132 const struct file_operations *old_fops, *new_fops = NULL;
133 133
134 down(&misc_sem); 134 down(&misc_sem);
135 135
diff --git a/drivers/char/mxser.h b/drivers/char/mxser.h
index e7fd0b08e0b7..7e188a4d602a 100644
--- a/drivers/char/mxser.h
+++ b/drivers/char/mxser.h
@@ -118,7 +118,7 @@
118 118
119// enable CTS interrupt 119// enable CTS interrupt
120#define MOXA_MUST_IER_ECTSI 0x80 120#define MOXA_MUST_IER_ECTSI 0x80
121// eanble RTS interrupt 121// enable RTS interrupt
122#define MOXA_MUST_IER_ERTSI 0x40 122#define MOXA_MUST_IER_ERTSI 0x40
123// enable Xon/Xoff interrupt 123// enable Xon/Xoff interrupt
124#define MOXA_MUST_IER_XINT 0x20 124#define MOXA_MUST_IER_XINT 0x20
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index d68be61f0a49..fee2aca3f6a5 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -941,17 +941,6 @@ static void* mgsl_get_text_ptr(void)
941 return mgsl_get_text_ptr; 941 return mgsl_get_text_ptr;
942} 942}
943 943
944/*
945 * tmp_buf is used as a temporary buffer by mgsl_write. We need to
946 * lock it in case the COPY_FROM_USER blocks while swapping in a page,
947 * and some other program tries to do a serial write at the same time.
948 * Since the lock will only come under contention when the system is
949 * swapping and available memory is low, it makes sense to share one
950 * buffer across all the serial ioports, since it significantly saves
951 * memory if large numbers of serial ports are open.
952 */
953static unsigned char *tmp_buf;
954
955static inline int mgsl_paranoia_check(struct mgsl_struct *info, 944static inline int mgsl_paranoia_check(struct mgsl_struct *info,
956 char *name, const char *routine) 945 char *name, const char *routine)
957{ 946{
@@ -2150,7 +2139,7 @@ static int mgsl_write(struct tty_struct * tty,
2150 if (mgsl_paranoia_check(info, tty->name, "mgsl_write")) 2139 if (mgsl_paranoia_check(info, tty->name, "mgsl_write"))
2151 goto cleanup; 2140 goto cleanup;
2152 2141
2153 if (!tty || !info->xmit_buf || !tmp_buf) 2142 if (!tty || !info->xmit_buf)
2154 goto cleanup; 2143 goto cleanup;
2155 2144
2156 if ( info->params.mode == MGSL_MODE_HDLC || 2145 if ( info->params.mode == MGSL_MODE_HDLC ||
@@ -3438,7 +3427,6 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
3438{ 3427{
3439 struct mgsl_struct *info; 3428 struct mgsl_struct *info;
3440 int retval, line; 3429 int retval, line;
3441 unsigned long page;
3442 unsigned long flags; 3430 unsigned long flags;
3443 3431
3444 /* verify range of specified line number */ 3432 /* verify range of specified line number */
@@ -3472,18 +3460,6 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
3472 goto cleanup; 3460 goto cleanup;
3473 } 3461 }
3474 3462
3475 if (!tmp_buf) {
3476 page = get_zeroed_page(GFP_KERNEL);
3477 if (!page) {
3478 retval = -ENOMEM;
3479 goto cleanup;
3480 }
3481 if (tmp_buf)
3482 free_page(page);
3483 else
3484 tmp_buf = (unsigned char *) page;
3485 }
3486
3487 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 3463 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
3488 3464
3489 spin_lock_irqsave(&info->netlock, flags); 3465 spin_lock_irqsave(&info->netlock, flags);
@@ -4502,11 +4478,6 @@ static void synclink_cleanup(void)
4502 kfree(tmp); 4478 kfree(tmp);
4503 } 4479 }
4504 4480
4505 if (tmp_buf) {
4506 free_page((unsigned long) tmp_buf);
4507 tmp_buf = NULL;
4508 }
4509
4510 if (pci_registered) 4481 if (pci_registered)
4511 pci_unregister_driver(&synclink_pci_driver); 4482 pci_unregister_driver(&synclink_pci_driver);
4512} 4483}
@@ -6025,7 +5996,7 @@ static void usc_set_async_mode( struct mgsl_struct *info )
6025 * <15..8> ? RxFIFO IRQ Request Level 5996 * <15..8> ? RxFIFO IRQ Request Level
6026 * 5997 *
6027 * Note: For async mode the receive FIFO level must be set 5998 * Note: For async mode the receive FIFO level must be set
6028 * to 0 to aviod the situation where the FIFO contains fewer bytes 5999 * to 0 to avoid the situation where the FIFO contains fewer bytes
6029 * than the trigger level and no more data is expected. 6000 * than the trigger level and no more data is expected.
6030 * 6001 *
6031 * <7> 0 Exited Hunt IA (Interrupt Arm) 6002 * <7> 0 Exited Hunt IA (Interrupt Arm)
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index 738ec2f4e563..b4d1f4eea435 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: synclink_gt.c,v 4.22 2006/01/09 20:16:06 paulkf Exp $ 2 * $Id: synclink_gt.c,v 4.25 2006/02/06 21:20:33 paulkf Exp $
3 * 3 *
4 * Device driver for Microgate SyncLink GT serial adapters. 4 * Device driver for Microgate SyncLink GT serial adapters.
5 * 5 *
@@ -92,7 +92,7 @@
92 * module identification 92 * module identification
93 */ 93 */
94static char *driver_name = "SyncLink GT"; 94static char *driver_name = "SyncLink GT";
95static char *driver_version = "$Revision: 4.22 $"; 95static char *driver_version = "$Revision: 4.25 $";
96static char *tty_driver_name = "synclink_gt"; 96static char *tty_driver_name = "synclink_gt";
97static char *tty_dev_prefix = "ttySLG"; 97static char *tty_dev_prefix = "ttySLG";
98MODULE_LICENSE("GPL"); 98MODULE_LICENSE("GPL");
@@ -188,6 +188,20 @@ static void hdlcdev_exit(struct slgt_info *info);
188#define SLGT_REG_SIZE 256 188#define SLGT_REG_SIZE 256
189 189
190/* 190/*
191 * conditional wait facility
192 */
193struct cond_wait {
194 struct cond_wait *next;
195 wait_queue_head_t q;
196 wait_queue_t wait;
197 unsigned int data;
198};
199static void init_cond_wait(struct cond_wait *w, unsigned int data);
200static void add_cond_wait(struct cond_wait **head, struct cond_wait *w);
201static void remove_cond_wait(struct cond_wait **head, struct cond_wait *w);
202static void flush_cond_wait(struct cond_wait **head);
203
204/*
191 * DMA buffer descriptor and access macros 205 * DMA buffer descriptor and access macros
192 */ 206 */
193struct slgt_desc 207struct slgt_desc
@@ -269,6 +283,9 @@ struct slgt_info {
269 struct timer_list tx_timer; 283 struct timer_list tx_timer;
270 struct timer_list rx_timer; 284 struct timer_list rx_timer;
271 285
286 unsigned int gpio_present;
287 struct cond_wait *gpio_wait_q;
288
272 spinlock_t lock; /* spinlock for synchronizing with ISR */ 289 spinlock_t lock; /* spinlock for synchronizing with ISR */
273 290
274 struct work_struct task; 291 struct work_struct task;
@@ -379,6 +396,11 @@ static MGSL_PARAMS default_params = {
379#define MASK_OVERRUN BIT4 396#define MASK_OVERRUN BIT4
380 397
381#define GSR 0x00 /* global status */ 398#define GSR 0x00 /* global status */
399#define JCR 0x04 /* JTAG control */
400#define IODR 0x08 /* GPIO direction */
401#define IOER 0x0c /* GPIO interrupt enable */
402#define IOVR 0x10 /* GPIO value */
403#define IOSR 0x14 /* GPIO interrupt status */
382#define TDR 0x80 /* tx data */ 404#define TDR 0x80 /* tx data */
383#define RDR 0x80 /* rx data */ 405#define RDR 0x80 /* rx data */
384#define TCR 0x82 /* tx control */ 406#define TCR 0x82 /* tx control */
@@ -503,6 +525,9 @@ static int tiocmset(struct tty_struct *tty, struct file *file,
503static void set_break(struct tty_struct *tty, int break_state); 525static void set_break(struct tty_struct *tty, int break_state);
504static int get_interface(struct slgt_info *info, int __user *if_mode); 526static int get_interface(struct slgt_info *info, int __user *if_mode);
505static int set_interface(struct slgt_info *info, int if_mode); 527static int set_interface(struct slgt_info *info, int if_mode);
528static int set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
529static int get_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
530static int wait_gpio(struct slgt_info *info, struct gpio_desc __user *gpio);
506 531
507/* 532/*
508 * driver functions 533 * driver functions
@@ -1112,6 +1137,12 @@ static int ioctl(struct tty_struct *tty, struct file *file,
1112 return get_interface(info, argp); 1137 return get_interface(info, argp);
1113 case MGSL_IOCSIF: 1138 case MGSL_IOCSIF:
1114 return set_interface(info,(int)arg); 1139 return set_interface(info,(int)arg);
1140 case MGSL_IOCSGPIO:
1141 return set_gpio(info, argp);
1142 case MGSL_IOCGGPIO:
1143 return get_gpio(info, argp);
1144 case MGSL_IOCWAITGPIO:
1145 return wait_gpio(info, argp);
1115 case TIOCGICOUNT: 1146 case TIOCGICOUNT:
1116 spin_lock_irqsave(&info->lock,flags); 1147 spin_lock_irqsave(&info->lock,flags);
1117 cnow = info->icount; 1148 cnow = info->icount;
@@ -1762,10 +1793,6 @@ static void rx_async(struct slgt_info *info)
1762 DBGDATA(info, p, count, "rx"); 1793 DBGDATA(info, p, count, "rx");
1763 1794
1764 for(i=0 ; i < count; i+=2, p+=2) { 1795 for(i=0 ; i < count; i+=2, p+=2) {
1765 if (tty && chars) {
1766 tty_flip_buffer_push(tty);
1767 chars = 0;
1768 }
1769 ch = *p; 1796 ch = *p;
1770 icount->rx++; 1797 icount->rx++;
1771 1798
@@ -2158,6 +2185,24 @@ static void isr_txeom(struct slgt_info *info, unsigned short status)
2158 } 2185 }
2159} 2186}
2160 2187
2188static void isr_gpio(struct slgt_info *info, unsigned int changed, unsigned int state)
2189{
2190 struct cond_wait *w, *prev;
2191
2192 /* wake processes waiting for specific transitions */
2193 for (w = info->gpio_wait_q, prev = NULL ; w != NULL ; w = w->next) {
2194 if (w->data & changed) {
2195 w->data = state;
2196 wake_up_interruptible(&w->q);
2197 if (prev != NULL)
2198 prev->next = w->next;
2199 else
2200 info->gpio_wait_q = w->next;
2201 } else
2202 prev = w;
2203 }
2204}
2205
2161/* interrupt service routine 2206/* interrupt service routine
2162 * 2207 *
2163 * irq interrupt number 2208 * irq interrupt number
@@ -2193,6 +2238,22 @@ static irqreturn_t slgt_interrupt(int irq, void *dev_id, struct pt_regs * regs)
2193 } 2238 }
2194 } 2239 }
2195 2240
2241 if (info->gpio_present) {
2242 unsigned int state;
2243 unsigned int changed;
2244 while ((changed = rd_reg32(info, IOSR)) != 0) {
2245 DBGISR(("%s iosr=%08x\n", info->device_name, changed));
2246 /* read latched state of GPIO signals */
2247 state = rd_reg32(info, IOVR);
2248 /* clear pending GPIO interrupt bits */
2249 wr_reg32(info, IOSR, changed);
2250 for (i=0 ; i < info->port_count ; i++) {
2251 if (info->port_array[i] != NULL)
2252 isr_gpio(info->port_array[i], changed, state);
2253 }
2254 }
2255 }
2256
2196 for(i=0; i < info->port_count ; i++) { 2257 for(i=0; i < info->port_count ; i++) {
2197 struct slgt_info *port = info->port_array[i]; 2258 struct slgt_info *port = info->port_array[i];
2198 2259
@@ -2276,6 +2337,8 @@ static void shutdown(struct slgt_info *info)
2276 set_signals(info); 2337 set_signals(info);
2277 } 2338 }
2278 2339
2340 flush_cond_wait(&info->gpio_wait_q);
2341
2279 spin_unlock_irqrestore(&info->lock,flags); 2342 spin_unlock_irqrestore(&info->lock,flags);
2280 2343
2281 if (info->tty) 2344 if (info->tty)
@@ -2650,6 +2713,175 @@ static int set_interface(struct slgt_info *info, int if_mode)
2650 return 0; 2713 return 0;
2651} 2714}
2652 2715
2716/*
2717 * set general purpose IO pin state and direction
2718 *
2719 * user_gpio fields:
2720 * state each bit indicates a pin state
2721 * smask set bit indicates pin state to set
2722 * dir each bit indicates a pin direction (0=input, 1=output)
2723 * dmask set bit indicates pin direction to set
2724 */
2725static int set_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
2726{
2727 unsigned long flags;
2728 struct gpio_desc gpio;
2729 __u32 data;
2730
2731 if (!info->gpio_present)
2732 return -EINVAL;
2733 if (copy_from_user(&gpio, user_gpio, sizeof(gpio)))
2734 return -EFAULT;
2735 DBGINFO(("%s set_gpio state=%08x smask=%08x dir=%08x dmask=%08x\n",
2736 info->device_name, gpio.state, gpio.smask,
2737 gpio.dir, gpio.dmask));
2738
2739 spin_lock_irqsave(&info->lock,flags);
2740 if (gpio.dmask) {
2741 data = rd_reg32(info, IODR);
2742 data |= gpio.dmask & gpio.dir;
2743 data &= ~(gpio.dmask & ~gpio.dir);
2744 wr_reg32(info, IODR, data);
2745 }
2746 if (gpio.smask) {
2747 data = rd_reg32(info, IOVR);
2748 data |= gpio.smask & gpio.state;
2749 data &= ~(gpio.smask & ~gpio.state);
2750 wr_reg32(info, IOVR, data);
2751 }
2752 spin_unlock_irqrestore(&info->lock,flags);
2753
2754 return 0;
2755}
2756
2757/*
2758 * get general purpose IO pin state and direction
2759 */
2760static int get_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
2761{
2762 struct gpio_desc gpio;
2763 if (!info->gpio_present)
2764 return -EINVAL;
2765 gpio.state = rd_reg32(info, IOVR);
2766 gpio.smask = 0xffffffff;
2767 gpio.dir = rd_reg32(info, IODR);
2768 gpio.dmask = 0xffffffff;
2769 if (copy_to_user(user_gpio, &gpio, sizeof(gpio)))
2770 return -EFAULT;
2771 DBGINFO(("%s get_gpio state=%08x dir=%08x\n",
2772 info->device_name, gpio.state, gpio.dir));
2773 return 0;
2774}
2775
2776/*
2777 * conditional wait facility
2778 */
2779static void init_cond_wait(struct cond_wait *w, unsigned int data)
2780{
2781 init_waitqueue_head(&w->q);
2782 init_waitqueue_entry(&w->wait, current);
2783 w->data = data;
2784}
2785
2786static void add_cond_wait(struct cond_wait **head, struct cond_wait *w)
2787{
2788 set_current_state(TASK_INTERRUPTIBLE);
2789 add_wait_queue(&w->q, &w->wait);
2790 w->next = *head;
2791 *head = w;
2792}
2793
2794static void remove_cond_wait(struct cond_wait **head, struct cond_wait *cw)
2795{
2796 struct cond_wait *w, *prev;
2797 remove_wait_queue(&cw->q, &cw->wait);
2798 set_current_state(TASK_RUNNING);
2799 for (w = *head, prev = NULL ; w != NULL ; prev = w, w = w->next) {
2800 if (w == cw) {
2801 if (prev != NULL)
2802 prev->next = w->next;
2803 else
2804 *head = w->next;
2805 break;
2806 }
2807 }
2808}
2809
2810static void flush_cond_wait(struct cond_wait **head)
2811{
2812 while (*head != NULL) {
2813 wake_up_interruptible(&(*head)->q);
2814 *head = (*head)->next;
2815 }
2816}
2817
2818/*
2819 * wait for general purpose I/O pin(s) to enter specified state
2820 *
2821 * user_gpio fields:
2822 * state - bit indicates target pin state
2823 * smask - set bit indicates watched pin
2824 *
2825 * The wait ends when at least one watched pin enters the specified
2826 * state. When 0 (no error) is returned, user_gpio->state is set to the
2827 * state of all GPIO pins when the wait ends.
2828 *
2829 * Note: Each pin may be a dedicated input, dedicated output, or
2830 * configurable input/output. The number and configuration of pins
2831 * varies with the specific adapter model. Only input pins (dedicated
2832 * or configured) can be monitored with this function.
2833 */
2834static int wait_gpio(struct slgt_info *info, struct gpio_desc __user *user_gpio)
2835{
2836 unsigned long flags;
2837 int rc = 0;
2838 struct gpio_desc gpio;
2839 struct cond_wait wait;
2840 u32 state;
2841
2842 if (!info->gpio_present)
2843 return -EINVAL;
2844 if (copy_from_user(&gpio, user_gpio, sizeof(gpio)))
2845 return -EFAULT;
2846 DBGINFO(("%s wait_gpio() state=%08x smask=%08x\n",
2847 info->device_name, gpio.state, gpio.smask));
2848 /* ignore output pins identified by set IODR bit */
2849 if ((gpio.smask &= ~rd_reg32(info, IODR)) == 0)
2850 return -EINVAL;
2851 init_cond_wait(&wait, gpio.smask);
2852
2853 spin_lock_irqsave(&info->lock, flags);
2854 /* enable interrupts for watched pins */
2855 wr_reg32(info, IOER, rd_reg32(info, IOER) | gpio.smask);
2856 /* get current pin states */
2857 state = rd_reg32(info, IOVR);
2858
2859 if (gpio.smask & ~(state ^ gpio.state)) {
2860 /* already in target state */
2861 gpio.state = state;
2862 } else {
2863 /* wait for target state */
2864 add_cond_wait(&info->gpio_wait_q, &wait);
2865 spin_unlock_irqrestore(&info->lock, flags);
2866 schedule();
2867 if (signal_pending(current))
2868 rc = -ERESTARTSYS;
2869 else
2870 gpio.state = wait.data;
2871 spin_lock_irqsave(&info->lock, flags);
2872 remove_cond_wait(&info->gpio_wait_q, &wait);
2873 }
2874
2875 /* disable all GPIO interrupts if no waiting processes */
2876 if (info->gpio_wait_q == NULL)
2877 wr_reg32(info, IOER, 0);
2878 spin_unlock_irqrestore(&info->lock,flags);
2879
2880 if ((rc == 0) && copy_to_user(user_gpio, &gpio, sizeof(gpio)))
2881 rc = -EFAULT;
2882 return rc;
2883}
2884
2653static int modem_input_wait(struct slgt_info *info,int arg) 2885static int modem_input_wait(struct slgt_info *info,int arg)
2654{ 2886{
2655 unsigned long flags; 2887 unsigned long flags;
@@ -3166,8 +3398,10 @@ static void device_init(int adapter_num, struct pci_dev *pdev)
3166 } else { 3398 } else {
3167 port_array[0]->irq_requested = 1; 3399 port_array[0]->irq_requested = 1;
3168 adapter_test(port_array[0]); 3400 adapter_test(port_array[0]);
3169 for (i=1 ; i < port_count ; i++) 3401 for (i=1 ; i < port_count ; i++) {
3170 port_array[i]->init_error = port_array[0]->init_error; 3402 port_array[i]->init_error = port_array[0]->init_error;
3403 port_array[i]->gpio_present = port_array[0]->gpio_present;
3404 }
3171 } 3405 }
3172 } 3406 }
3173} 3407}
@@ -4301,7 +4535,7 @@ static int register_test(struct slgt_info *info)
4301 break; 4535 break;
4302 } 4536 }
4303 } 4537 }
4304 4538 info->gpio_present = (rd_reg32(info, JCR) & BIT5) ? 1 : 0;
4305 info->init_error = rc ? 0 : DiagStatus_AddressFailure; 4539 info->init_error = rc ? 0 : DiagStatus_AddressFailure;
4306 return rc; 4540 return rc;
4307} 4541}
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 905f58ba8e16..ea06e3a4dc35 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -2044,7 +2044,7 @@ static int __init edac_mc_init(void)
2044 */ 2044 */
2045 clear_pci_parity_errors(); 2045 clear_pci_parity_errors();
2046 2046
2047 /* Create the MC sysfs entires */ 2047 /* Create the MC sysfs entries */
2048 if (edac_sysfs_memctrl_setup()) { 2048 if (edac_sysfs_memctrl_setup()) {
2049 edac_printk(KERN_ERR, EDAC_MC, 2049 edac_printk(KERN_ERR, EDAC_MC,
2050 "Error initializing sysfs code\n"); 2050 "Error initializing sysfs code\n");
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index ebc59064b475..f04791a58df0 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -433,6 +433,7 @@
433#include <linux/timer.h> 433#include <linux/timer.h>
434#include <linux/mm.h> 434#include <linux/mm.h>
435#include <linux/interrupt.h> 435#include <linux/interrupt.h>
436#include <linux/jiffies.h>
436#include <linux/major.h> 437#include <linux/major.h>
437#include <linux/devfs_fs_kernel.h> 438#include <linux/devfs_fs_kernel.h>
438#include <linux/errno.h> 439#include <linux/errno.h>
@@ -2336,7 +2337,7 @@ static ide_startstop_t idetape_rw_callback (ide_drive_t *drive)
2336 } 2337 }
2337 if (time_after(jiffies, tape->insert_time)) 2338 if (time_after(jiffies, tape->insert_time))
2338 tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time); 2339 tape->insert_speed = tape->insert_size / 1024 * HZ / (jiffies - tape->insert_time);
2339 if (jiffies - tape->avg_time >= HZ) { 2340 if (time_after_eq(jiffies, tape->avg_time + HZ)) {
2340 tape->avg_speed = tape->avg_size * HZ / (jiffies - tape->avg_time) / 1024; 2341 tape->avg_speed = tape->avg_size * HZ / (jiffies - tape->avg_time) / 1024;
2341 tape->avg_size = 0; 2342 tape->avg_size = 0;
2342 tape->avg_time = jiffies; 2343 tape->avg_time = jiffies;
@@ -2497,7 +2498,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
2497 } else { 2498 } else {
2498 return ide_do_reset(drive); 2499 return ide_do_reset(drive);
2499 } 2500 }
2500 } else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD) 2501 } else if (time_after(jiffies, tape->dsc_polling_start + IDETAPE_DSC_MA_THRESHOLD))
2501 tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW; 2502 tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW;
2502 idetape_postpone_request(drive); 2503 idetape_postpone_request(drive);
2503 return ide_stopped; 2504 return ide_stopped;
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 21965e5ef25e..b22ee5462318 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -347,10 +347,8 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
347 break; 347 break;
348 348
349 case AMD_UDMA_66: 349 case AMD_UDMA_66:
350 pci_read_config_dword(dev, AMD_UDMA_TIMING, &u); 350 /* no host side cable detection */
351 for (i = 24; i >= 0; i -= 8) 351 amd_80w = 0x03;
352 if ((u >> i) & 4)
353 amd_80w |= (1 << (1 - (i >> 4)));
354 break; 352 break;
355 } 353 }
356 354
@@ -386,8 +384,6 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
386 if (amd_clock < 20000 || amd_clock > 50000) { 384 if (amd_clock < 20000 || amd_clock > 50000) {
387 printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n", 385 printk(KERN_WARNING "%s: User given PCI clock speed impossible (%d), using 33 MHz instead.\n",
388 amd_chipset->name, amd_clock); 386 amd_chipset->name, amd_clock);
389 printk(KERN_WARNING "%s: Use ide0=ata66 if you want to assume 80-wire cable\n",
390 amd_chipset->name);
391 amd_clock = 33333; 387 amd_clock = 33333;
392 } 388 }
393 389
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index 6e3ab0c38c4d..f82e82109728 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -41,14 +41,15 @@
41 41
42static int ide_generic_all; /* Set to claim all devices */ 42static int ide_generic_all; /* Set to claim all devices */
43 43
44#ifndef MODULE
44static int __init ide_generic_all_on(char *unused) 45static int __init ide_generic_all_on(char *unused)
45{ 46{
46 ide_generic_all = 1; 47 ide_generic_all = 1;
47 printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n"); 48 printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n");
48 return 1; 49 return 1;
49} 50}
50
51__setup("all-generic-ide", ide_generic_all_on); 51__setup("all-generic-ide", ide_generic_all_on);
52#endif
52 53
53static void __devinit init_hwif_generic (ide_hwif_t *hwif) 54static void __devinit init_hwif_generic (ide_hwif_t *hwif)
54{ 55{
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 75a2253a3e68..8e9d87701ce2 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -112,6 +112,7 @@ static const struct {
112 112
113 { "SiS5596", PCI_DEVICE_ID_SI_5596, ATA_16 }, 113 { "SiS5596", PCI_DEVICE_ID_SI_5596, ATA_16 },
114 { "SiS5571", PCI_DEVICE_ID_SI_5571, ATA_16 }, 114 { "SiS5571", PCI_DEVICE_ID_SI_5571, ATA_16 },
115 { "SiS5517", PCI_DEVICE_ID_SI_5517, ATA_16 },
115 { "SiS551x", PCI_DEVICE_ID_SI_5511, ATA_16 }, 116 { "SiS551x", PCI_DEVICE_ID_SI_5511, ATA_16 },
116}; 117};
117 118
@@ -524,6 +525,7 @@ static void config_art_rwp_pio (ide_drive_t *drive, u8 pio)
524 case 3: test1 = 0x30|0x03; break; 525 case 3: test1 = 0x30|0x03; break;
525 case 2: test1 = 0x40|0x04; break; 526 case 2: test1 = 0x40|0x04; break;
526 case 1: test1 = 0x60|0x07; break; 527 case 1: test1 = 0x60|0x07; break;
528 case 0: test1 = 0x00; break;
527 default: break; 529 default: break;
528 } 530 }
529 pci_write_config_byte(dev, drive_pci, test1); 531 pci_write_config_byte(dev, drive_pci, test1);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 4fe3da3c667a..f8af0945964e 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -923,7 +923,7 @@ void input_unregister_handler(struct input_handler *handler)
923static int input_open_file(struct inode *inode, struct file *file) 923static int input_open_file(struct inode *inode, struct file *file)
924{ 924{
925 struct input_handler *handler = input_table[iminor(inode) >> 5]; 925 struct input_handler *handler = input_table[iminor(inode) >> 5];
926 struct file_operations *old_fops, *new_fops = NULL; 926 const struct file_operations *old_fops, *new_fops = NULL;
927 int err; 927 int err;
928 928
929 /* No load-on-demand here? */ 929 /* No load-on-demand here? */
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 623adbb0d13a..9b493f0becc4 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1485,6 +1485,7 @@ static int __init capi_init(void)
1485{ 1485{
1486 char *p; 1486 char *p;
1487 char *compileinfo; 1487 char *compileinfo;
1488 int major_ret;
1488 1489
1489 if ((p = strchr(revision, ':')) != 0 && p[1]) { 1490 if ((p = strchr(revision, ':')) != 0 && p[1]) {
1490 strlcpy(rev, p + 2, sizeof(rev)); 1491 strlcpy(rev, p + 2, sizeof(rev));
@@ -1493,11 +1494,12 @@ static int __init capi_init(void)
1493 } else 1494 } else
1494 strcpy(rev, "1.0"); 1495 strcpy(rev, "1.0");
1495 1496
1496 if (register_chrdev(capi_major, "capi20", &capi_fops)) { 1497 major_ret = register_chrdev(capi_major, "capi20", &capi_fops);
1498 if (major_ret < 0) {
1497 printk(KERN_ERR "capi20: unable to get major %d\n", capi_major); 1499 printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);
1498 return -EIO; 1500 return major_ret;
1499 } 1501 }
1500 1502 capi_major = major_ret;
1501 capi_class = class_create(THIS_MODULE, "capi"); 1503 capi_class = class_create(THIS_MODULE, "capi");
1502 if (IS_ERR(capi_class)) { 1504 if (IS_ERR(capi_class)) {
1503 unregister_chrdev(capi_major, "capi20"); 1505 unregister_chrdev(capi_major, "capi20");
diff --git a/drivers/isdn/capi/kcapi_proc.c b/drivers/isdn/capi/kcapi_proc.c
index 2cc8b27e4c3b..ca9dc00a45c4 100644
--- a/drivers/isdn/capi/kcapi_proc.c
+++ b/drivers/isdn/capi/kcapi_proc.c
@@ -233,7 +233,7 @@ static struct file_operations proc_applstats_ops = {
233}; 233};
234 234
235static void 235static void
236create_seq_entry(char *name, mode_t mode, struct file_operations *f) 236create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
237{ 237{
238 struct proc_dir_entry *entry; 238 struct proc_dir_entry *entry;
239 entry = create_proc_entry(name, mode, NULL); 239 entry = create_proc_entry(name, mode, NULL);
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 54f8b95717b0..96fe0ecae250 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -86,7 +86,7 @@ static int dvb_device_open(struct inode *inode, struct file *file)
86 86
87 if (dvbdev && dvbdev->fops) { 87 if (dvbdev && dvbdev->fops) {
88 int err = 0; 88 int err = 0;
89 struct file_operations *old_fops; 89 const struct file_operations *old_fops;
90 90
91 file->private_data = dvbdev; 91 file->private_data = dvbdev;
92 old_fops = file->f_op; 92 old_fops = file->f_op;
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 75e3d41382f2..5f87dd5f1d0b 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -97,7 +97,7 @@ static int video_open(struct inode *inode, struct file *file)
97 unsigned int minor = iminor(inode); 97 unsigned int minor = iminor(inode);
98 int err = 0; 98 int err = 0;
99 struct video_device *vfl; 99 struct video_device *vfl;
100 struct file_operations *old_fops; 100 const struct file_operations *old_fops;
101 101
102 if(minor>=VIDEO_NUM_DEVICES) 102 if(minor>=VIDEO_NUM_DEVICES)
103 return -ENODEV; 103 return -ENODEV;
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 2a0c42b8cda5..3d2e76eea93e 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -56,7 +56,7 @@
56typedef struct _i2o_proc_entry_t { 56typedef struct _i2o_proc_entry_t {
57 char *name; /* entry name */ 57 char *name; /* entry name */
58 mode_t mode; /* mode */ 58 mode_t mode; /* mode */
59 struct file_operations *fops; /* open function */ 59 const struct file_operations *fops; /* open function */
60} i2o_proc_entry; 60} i2o_proc_entry;
61 61
62/* global I2O /proc/i2o entry */ 62/* global I2O /proc/i2o entry */
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 5c550fcac2c4..26a230b6ff80 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -101,7 +101,7 @@ static struct super_operations ibmasmfs_s_ops = {
101 .drop_inode = generic_delete_inode, 101 .drop_inode = generic_delete_inode,
102}; 102};
103 103
104static struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations; 104static const struct file_operations *ibmasmfs_dir_ops = &simple_dir_operations;
105 105
106static struct file_system_type ibmasmfs_type = { 106static struct file_system_type ibmasmfs_type = {
107 .owner = THIS_MODULE, 107 .owner = THIS_MODULE,
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index e7fc28b07e5a..7627a75f4f7c 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -134,6 +134,7 @@
134#include <linux/random.h> 134#include <linux/random.h>
135#include <linux/init.h> 135#include <linux/init.h>
136#include <linux/if_vlan.h> 136#include <linux/if_vlan.h>
137#include <linux/dma-mapping.h>
137 138
138#include <asm/irq.h> 139#include <asm/irq.h>
139#include <asm/io.h> 140#include <asm/io.h>
@@ -2932,7 +2933,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
2932 if (id->driver_data & DEV_HAS_HIGH_DMA) { 2933 if (id->driver_data & DEV_HAS_HIGH_DMA) {
2933 /* packet format 3: supports 40-bit addressing */ 2934 /* packet format 3: supports 40-bit addressing */
2934 np->desc_ver = DESC_VER_3; 2935 np->desc_ver = DESC_VER_3;
2935 if (pci_set_dma_mask(pci_dev, 0x0000007fffffffffULL)) { 2936 if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) {
2936 printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n", 2937 printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n",
2937 pci_name(pci_dev)); 2938 pci_name(pci_dev));
2938 } else { 2939 } else {
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 9b8295ee06ef..ae71ed57c12d 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -44,6 +44,7 @@
44#include <linux/ip.h> 44#include <linux/ip.h>
45#include <linux/tcp.h> 45#include <linux/tcp.h>
46#include <linux/udp.h> 46#include <linux/udp.h>
47#include <linux/dma-mapping.h>
47 48
48#ifdef CONFIG_SERIAL_8250 49#ifdef CONFIG_SERIAL_8250
49#include <linux/serial_core.h> 50#include <linux/serial_core.h>
@@ -1195,17 +1196,17 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1195 int err, pci_using_dac; 1196 int err, pci_using_dac;
1196 1197
1197 /* Configure DMA attributes. */ 1198 /* Configure DMA attributes. */
1198 err = pci_set_dma_mask(pdev, 0xffffffffffffffffULL); 1199 err = pci_set_dma_mask(pdev, DMA_64BIT_MASK);
1199 if (!err) { 1200 if (!err) {
1200 pci_using_dac = 1; 1201 pci_using_dac = 1;
1201 err = pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL); 1202 err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
1202 if (err < 0) { 1203 if (err < 0) {
1203 printk(KERN_ERR "%s: Unable to obtain 64 bit DMA " 1204 printk(KERN_ERR "%s: Unable to obtain 64 bit DMA "
1204 "for consistent allocations\n", pci_name(pdev)); 1205 "for consistent allocations\n", pci_name(pdev));
1205 goto out; 1206 goto out;
1206 } 1207 }
1207 } else { 1208 } else {
1208 err = pci_set_dma_mask(pdev, 0xffffffffULL); 1209 err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
1209 if (err) { 1210 if (err) {
1210 printk(KERN_ERR "%s: No usable DMA configuration, " 1211 printk(KERN_ERR "%s: No usable DMA configuration, "
1211 "aborting.\n", pci_name(pdev)); 1212 "aborting.\n", pci_name(pdev));
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 9aa074b44dd3..cc7ff8f00e42 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -812,7 +812,7 @@ static int nsc_ircc_init_39x(nsc_chip_t *chip, chipio_t *info)
812 int cfg_base = info->cfg_base; 812 int cfg_base = info->cfg_base;
813 int enabled; 813 int enabled;
814 814
815 /* User is shure about his config... accept it. */ 815 /* User is sure about his config... accept it. */
816 IRDA_DEBUG(2, "%s(): nsc_ircc_init_39x (user settings): " 816 IRDA_DEBUG(2, "%s(): nsc_ircc_init_39x (user settings): "
817 "io=0x%04x, irq=%d, dma=%d\n", 817 "io=0x%04x, irq=%d, dma=%d\n",
818 __FUNCTION__, info->fir_base, info->irq, info->dma); 818 __FUNCTION__, info->fir_base, info->irq, info->dma);
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 0c13795dca38..b79d6e8d3045 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -172,7 +172,7 @@ static struct net_device_stats *get_stats(struct net_device *dev)
172 172
173 memset(stats, 0, sizeof(struct net_device_stats)); 173 memset(stats, 0, sizeof(struct net_device_stats));
174 174
175 for_each_cpu(i) { 175 for_each_possible_cpu(i) {
176 struct net_device_stats *lb_stats; 176 struct net_device_stats *lb_stats;
177 177
178 lb_stats = &per_cpu(loopback_stats, i); 178 lb_stats = &per_cpu(loopback_stats, i);
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 0fede50abd3e..8e9b1a537dee 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1828,10 +1828,10 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
1828 int using_dac = 0; 1828 int using_dac = 0;
1829 1829
1830 /* See if we can set the dma mask early on; failure is fatal. */ 1830 /* See if we can set the dma mask early on; failure is fatal. */
1831 if (sizeof(dma_addr_t) == 8 && 1831 if (sizeof(dma_addr_t) == 8 &&
1832 !pci_set_dma_mask(pci_dev, 0xffffffffffffffffULL)) { 1832 !pci_set_dma_mask(pci_dev, DMA_64BIT_MASK)) {
1833 using_dac = 1; 1833 using_dac = 1;
1834 } else if (!pci_set_dma_mask(pci_dev, 0xffffffff)) { 1834 } else if (!pci_set_dma_mask(pci_dev, DMA_32BIT_MASK)) {
1835 using_dac = 0; 1835 using_dac = 0;
1836 } else { 1836 } else {
1837 printk(KERN_WARNING "ns83820.c: pci_set_dma_mask failed!\n"); 1837 printk(KERN_WARNING "ns83820.c: pci_set_dma_mask failed!\n");
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 8429ceb01389..b82191d2bee1 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -2283,7 +2283,7 @@ static void set_rx_mode(struct net_device *net_dev)
2283 int i, table_entries; 2283 int i, table_entries;
2284 u32 rx_mode; 2284 u32 rx_mode;
2285 2285
2286 /* 635 Hash Table entires = 256(2^16) */ 2286 /* 635 Hash Table entries = 256(2^16) */
2287 if((sis_priv->chipset_rev >= SIS635A_900_REV) || 2287 if((sis_priv->chipset_rev >= SIS635A_900_REV) ||
2288 (sis_priv->chipset_rev == SIS900B_900_REV)) 2288 (sis_priv->chipset_rev == SIS900B_900_REV))
2289 table_entries = 16; 2289 table_entries = 16;
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index ee48bfd67349..d1a86a080a65 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -513,7 +513,7 @@ struct mii_phy {
513 u_char *rst; /* Start of reset sequence in SROM */ 513 u_char *rst; /* Start of reset sequence in SROM */
514 u_int mc; /* Media Capabilities */ 514 u_int mc; /* Media Capabilities */
515 u_int ana; /* NWay Advertisement */ 515 u_int ana; /* NWay Advertisement */
516 u_int fdx; /* Full DupleX capabilites for each media */ 516 u_int fdx; /* Full DupleX capabilities for each media */
517 u_int ttm; /* Transmit Threshold Mode for each media */ 517 u_int ttm; /* Transmit Threshold Mode for each media */
518 u_int mci; /* 21142 MII Connector Interrupt info */ 518 u_int mci; /* 21142 MII Connector Interrupt info */
519}; 519};
diff --git a/drivers/net/tulip/pnic2.c b/drivers/net/tulip/pnic2.c
index 55f4a9a631bc..ab985023fcca 100644
--- a/drivers/net/tulip/pnic2.c
+++ b/drivers/net/tulip/pnic2.c
@@ -199,7 +199,7 @@ void pnic2_lnk_change(struct net_device *dev, int csr5)
199 /* negotiation ended successfully */ 199 /* negotiation ended successfully */
200 200
201 /* get the link partners reply and mask out all but 201 /* get the link partners reply and mask out all but
202 * bits 24-21 which show the partners capabilites 202 * bits 24-21 which show the partners capabilities
203 * and match those to what we advertised 203 * and match those to what we advertised
204 * 204 *
205 * then begin to interpret the results of the negotiation. 205 * then begin to interpret the results of the negotiation.
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index cde35dd87906..c1ce87a5f8d3 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -208,7 +208,7 @@ static const struct typhoon_card_info typhoon_card_info[] __devinitdata = {
208}; 208};
209 209
210/* Notes on the new subsystem numbering scheme: 210/* Notes on the new subsystem numbering scheme:
211 * bits 0-1 indicate crypto capabilites: (0) variable, (1) DES, or (2) 3DES 211 * bits 0-1 indicate crypto capabilities: (0) variable, (1) DES, or (2) 3DES
212 * bit 4 indicates if this card has secured firmware (we don't support it) 212 * bit 4 indicates if this card has secured firmware (we don't support it)
213 * bit 8 indicates if this is a (0) copper or (1) fiber card 213 * bit 8 indicates if this is a (0) copper or (1) fiber card
214 * bits 12-16 indicate card type: (0) client and (1) server 214 * bits 12-16 indicate card type: (0) client and (1) server
@@ -788,7 +788,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
788 /* we have two rings to choose from, but we only use txLo for now 788 /* we have two rings to choose from, but we only use txLo for now
789 * If we start using the Hi ring as well, we'll need to update 789 * If we start using the Hi ring as well, we'll need to update
790 * typhoon_stop_runtime(), typhoon_interrupt(), typhoon_num_free_tx(), 790 * typhoon_stop_runtime(), typhoon_interrupt(), typhoon_num_free_tx(),
791 * and TXHI_ENTIRES to match, as well as update the TSO code below 791 * and TXHI_ENTRIES to match, as well as update the TSO code below
792 * to get the right DMA address 792 * to get the right DMA address
793 */ 793 */
794 txRing = &tp->txLoRing; 794 txRing = &tp->txLoRing;
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
index 9d3b51c3ef54..29a756dd979b 100644
--- a/drivers/net/wan/wanxl.c
+++ b/drivers/net/wan/wanxl.c
@@ -577,8 +577,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
577 We set both dma_mask and consistent_dma_mask to 28 bits 577 We set both dma_mask and consistent_dma_mask to 28 bits
578 and pray pci_alloc_consistent() will use this info. It should 578 and pray pci_alloc_consistent() will use this info. It should
579 work on most platforms */ 579 work on most platforms */
580 if (pci_set_consistent_dma_mask(pdev, 0x0FFFFFFF) || 580 if (pci_set_consistent_dma_mask(pdev, DMA_28BIT_MASK) ||
581 pci_set_dma_mask(pdev, 0x0FFFFFFF)) { 581 pci_set_dma_mask(pdev, DMA_28BIT_MASK)) {
582 printk(KERN_ERR "wanXL: No usable DMA configuration\n"); 582 printk(KERN_ERR "wanXL: No usable DMA configuration\n");
583 return -EIO; 583 return -EIO;
584 } 584 }
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 6fd0bf736830..8dfdfbd5966c 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -3858,7 +3858,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
3858 unsigned long flags; 3858 unsigned long flags;
3859 3859
3860 /* Note : you may have realised that, as this is a SET operation, 3860 /* Note : you may have realised that, as this is a SET operation,
3861 * this is priviledged and therefore a normal user can't 3861 * this is privileged and therefore a normal user can't
3862 * perform scanning. 3862 * perform scanning.
3863 * This is not an error, while the device perform scanning, 3863 * This is not an error, while the device perform scanning,
3864 * traffic doesn't flow, so it's a perfect DoS... 3864 * traffic doesn't flow, so it's a perfect DoS...
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index e5bb9f5ae429..989599ad33ef 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -747,7 +747,7 @@ prism54_get_essid(struct net_device *ndev, struct iw_request_info *info,
747 747
748 if (essid->length) { 748 if (essid->length) {
749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */ 749 dwrq->flags = 1; /* set ESSID to ON for Wireless Extensions */
750 /* if it is to big, trunk it */ 750 /* if it is too big, trunk it */
751 dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length); 751 dwrq->length = min((u8)IW_ESSID_MAX_SIZE, essid->length);
752 } else { 752 } else {
753 dwrq->flags = 0; 753 dwrq->flags = 0;
diff --git a/drivers/net/wireless/prism54/islpci_hotplug.c b/drivers/net/wireless/prism54/islpci_hotplug.c
index b41d666fea3c..bfa0cc319a09 100644
--- a/drivers/net/wireless/prism54/islpci_hotplug.c
+++ b/drivers/net/wireless/prism54/islpci_hotplug.c
@@ -22,6 +22,7 @@
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/init.h> /* For __init, __exit */ 24#include <linux/init.h> /* For __init, __exit */
25#include <linux/dma-mapping.h>
25 26
26#include "prismcompat.h" 27#include "prismcompat.h"
27#include "islpci_dev.h" 28#include "islpci_dev.h"
@@ -124,7 +125,7 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
124 } 125 }
125 126
126 /* enable PCI DMA */ 127 /* enable PCI DMA */
127 if (pci_set_dma_mask(pdev, 0xffffffff)) { 128 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
128 printk(KERN_ERR "%s: 32-bit PCI DMA not supported", DRV_NAME); 129 printk(KERN_ERR "%s: 32-bit PCI DMA not supported", DRV_NAME);
129 goto do_pci_disable_device; 130 goto do_pci_disable_device;
130 } 131 }
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index 330d3869b41e..fc4bc9b94c74 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -217,11 +217,10 @@ static void oprofile_end_trace(struct oprofile_cpu_buffer * cpu_buf)
217 cpu_buf->tracing = 0; 217 cpu_buf->tracing = 0;
218} 218}
219 219
220void oprofile_add_sample(struct pt_regs * const regs, unsigned long event) 220void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
221 unsigned long event, int is_kernel)
221{ 222{
222 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; 223 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
223 unsigned long pc = profile_pc(regs);
224 int is_kernel = !user_mode(regs);
225 224
226 if (!backtrace_depth) { 225 if (!backtrace_depth) {
227 log_sample(cpu_buf, pc, is_kernel, event); 226 log_sample(cpu_buf, pc, is_kernel, event);
@@ -238,6 +237,14 @@ void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
238 oprofile_end_trace(cpu_buf); 237 oprofile_end_trace(cpu_buf);
239} 238}
240 239
240void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
241{
242 int is_kernel = !user_mode(regs);
243 unsigned long pc = profile_pc(regs);
244
245 oprofile_add_ext_sample(pc, regs, event, is_kernel);
246}
247
241void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event) 248void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event)
242{ 249{
243 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()]; 250 struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c
index e94b1e4a2a84..f0acb661c253 100644
--- a/drivers/oprofile/oprofile_stats.c
+++ b/drivers/oprofile/oprofile_stats.c
@@ -22,7 +22,7 @@ void oprofile_reset_stats(void)
22 struct oprofile_cpu_buffer * cpu_buf; 22 struct oprofile_cpu_buffer * cpu_buf;
23 int i; 23 int i;
24 24
25 for_each_cpu(i) { 25 for_each_possible_cpu(i) {
26 cpu_buf = &cpu_buffer[i]; 26 cpu_buf = &cpu_buffer[i];
27 cpu_buf->sample_received = 0; 27 cpu_buf->sample_received = 0;
28 cpu_buf->sample_lost_overflow = 0; 28 cpu_buf->sample_lost_overflow = 0;
@@ -46,7 +46,7 @@ void oprofile_create_stats_files(struct super_block * sb, struct dentry * root)
46 if (!dir) 46 if (!dir)
47 return; 47 return;
48 48
49 for_each_cpu(i) { 49 for_each_possible_cpu(i) {
50 cpu_buf = &cpu_buffer[i]; 50 cpu_buf = &cpu_buffer[i];
51 snprintf(buf, 10, "cpu%d", i); 51 snprintf(buf, 10, "cpu%d", i);
52 cpudir = oprofilefs_mkdir(sb, dir, buf); 52 cpudir = oprofilefs_mkdir(sb, dir, buf);
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index d6bae699749a..b62da9b0cbf0 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -130,7 +130,7 @@ static struct file_operations ulong_ro_fops = {
130 130
131 131
132static struct dentry * __oprofilefs_create_file(struct super_block * sb, 132static struct dentry * __oprofilefs_create_file(struct super_block * sb,
133 struct dentry * root, char const * name, struct file_operations * fops, 133 struct dentry * root, char const * name, const struct file_operations * fops,
134 int perm) 134 int perm)
135{ 135{
136 struct dentry * dentry; 136 struct dentry * dentry;
@@ -203,7 +203,7 @@ int oprofilefs_create_ro_atomic(struct super_block * sb, struct dentry * root,
203 203
204 204
205int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 205int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
206 char const * name, struct file_operations * fops) 206 char const * name, const struct file_operations * fops)
207{ 207{
208 if (!__oprofilefs_create_file(sb, root, name, fops, 0644)) 208 if (!__oprofilefs_create_file(sb, root, name, fops, 0644))
209 return -EFAULT; 209 return -EFAULT;
@@ -212,7 +212,7 @@ int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
212 212
213 213
214int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 214int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
215 char const * name, struct file_operations * fops, int perm) 215 char const * name, const struct file_operations * fops, int perm)
216{ 216{
217 if (!__oprofilefs_create_file(sb, root, name, fops, perm)) 217 if (!__oprofilefs_create_file(sb, root, name, fops, perm))
218 return -EFAULT; 218 return -EFAULT;
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 0ab26d01877b..0d2b447c50ed 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1026,7 +1026,7 @@ static void twa_free_request_id(TW_Device_Extension *tw_dev, int request_id)
1026 tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH; 1026 tw_dev->free_tail = (tw_dev->free_tail + 1) % TW_Q_LENGTH;
1027} /* End twa_free_request_id() */ 1027} /* End twa_free_request_id() */
1028 1028
1029/* This function will get parameter table entires from the firmware */ 1029/* This function will get parameter table entries from the firmware */
1030static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter_id, int parameter_size_bytes) 1030static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int table_id, int parameter_id, int parameter_size_bytes)
1031{ 1031{
1032 TW_Command_Full *full_command_packet; 1032 TW_Command_Full *full_command_packet;
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 1c459343292b..bde3d5834ade 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -41,6 +41,8 @@
41#include <linux/stat.h> 41#include <linux/stat.h>
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/spinlock.h> 43#include <linux/spinlock.h>
44#include <linux/jiffies.h>
45#include <linux/dma-mapping.h>
44#include <scsi/scsicam.h> 46#include <scsi/scsicam.h>
45 47
46#include <asm/dma.h> 48#include <asm/dma.h>
@@ -676,7 +678,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
676 if (pci_enable_device(PCI_Device)) 678 if (pci_enable_device(PCI_Device))
677 continue; 679 continue;
678 680
679 if (pci_set_dma_mask(PCI_Device, (u64) 0xffffffff)) 681 if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK ))
680 continue; 682 continue;
681 683
682 Bus = PCI_Device->bus->number; 684 Bus = PCI_Device->bus->number;
@@ -831,7 +833,7 @@ static int __init BusLogic_InitializeMultiMasterProbeInfo(struct BusLogic_HostAd
831 if (pci_enable_device(PCI_Device)) 833 if (pci_enable_device(PCI_Device))
832 continue; 834 continue;
833 835
834 if (pci_set_dma_mask(PCI_Device, (u64) 0xffffffff)) 836 if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK))
835 continue; 837 continue;
836 838
837 Bus = PCI_Device->bus->number; 839 Bus = PCI_Device->bus->number;
@@ -885,7 +887,7 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
885 if (pci_enable_device(PCI_Device)) 887 if (pci_enable_device(PCI_Device))
886 continue; 888 continue;
887 889
888 if (pci_set_dma_mask(PCI_Device, (u64) 0xffffffff)) 890 if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK))
889 continue; 891 continue;
890 892
891 Bus = PCI_Device->bus->number; 893 Bus = PCI_Device->bus->number;
@@ -2896,7 +2898,7 @@ static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRou
2896 */ 2898 */
2897 if (HostAdapter->ActiveCommands[TargetID] == 0) 2899 if (HostAdapter->ActiveCommands[TargetID] == 0)
2898 HostAdapter->LastSequencePoint[TargetID] = jiffies; 2900 HostAdapter->LastSequencePoint[TargetID] = jiffies;
2899 else if (jiffies - HostAdapter->LastSequencePoint[TargetID] > 4 * HZ) { 2901 else if (time_after(jiffies, HostAdapter->LastSequencePoint[TargetID] + 4 * HZ)) {
2900 HostAdapter->LastSequencePoint[TargetID] = jiffies; 2902 HostAdapter->LastSequencePoint[TargetID] = jiffies;
2901 QueueTag = BusLogic_OrderedQueueTag; 2903 QueueTag = BusLogic_OrderedQueueTag;
2902 } 2904 }
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 9f45ae1745da..3dce21c78737 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -89,6 +89,7 @@
89#include <linux/string.h> 89#include <linux/string.h>
90#include <linux/ioport.h> 90#include <linux/ioport.h>
91#include <linux/slab.h> 91#include <linux/slab.h>
92#include <linux/dma-mapping.h>
92 93
93#include <asm/io.h> 94#include <asm/io.h>
94#include <asm/irq.h> 95#include <asm/irq.h>
@@ -1052,7 +1053,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
1052 1053
1053 if (pci_enable_device(pdev)) 1054 if (pci_enable_device(pdev))
1054 goto out; 1055 goto out;
1055 if (pci_set_dma_mask(pdev, 0xffffffffULL)) { 1056 if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
1056 printk(KERN_WARNING "Unable to set 32bit DMA " 1057 printk(KERN_WARNING "Unable to set 32bit DMA "
1057 "on inia100 adapter, ignoring.\n"); 1058 "on inia100 adapter, ignoring.\n");
1058 goto out_disable_device; 1059 goto out_disable_device;
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index a16f8ded8f1d..8df4a0ea3761 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -32,6 +32,7 @@
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/completion.h> 33#include <linux/completion.h>
34#include <linux/blkdev.h> 34#include <linux/blkdev.h>
35#include <linux/dma-mapping.h>
35#include <asm/semaphore.h> 36#include <asm/semaphore.h>
36#include <asm/uaccess.h> 37#include <asm/uaccess.h>
37 38
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index c2596335549d..720330778648 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -45,6 +45,7 @@
45#include <linux/pci.h> 45#include <linux/pci.h>
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/spinlock.h> 47#include <linux/spinlock.h>
48#include <linux/dma-mapping.h>
48#include <linux/syscalls.h> 49#include <linux/syscalls.h>
49#include <linux/delay.h> 50#include <linux/delay.h>
50#include <linux/smp_lock.h> 51#include <linux/smp_lock.h>
@@ -806,8 +807,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
806 * to driver communication memory to be allocated below 2gig 807 * to driver communication memory to be allocated below 2gig
807 */ 808 */
808 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT) 809 if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
809 if (pci_set_dma_mask(pdev, 0x7FFFFFFFULL) || 810 if (pci_set_dma_mask(pdev, DMA_31BIT_MASK) ||
810 pci_set_consistent_dma_mask(pdev, 0x7FFFFFFFULL)) 811 pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK))
811 goto out; 812 goto out;
812 813
813 pci_set_master(pdev); 814 pci_set_master(pdev);
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 5227a779c05c..a198d86667e9 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -28,6 +28,7 @@
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/blkdev.h> 30#include <linux/blkdev.h>
31#include <linux/dma-mapping.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/io.h> 33#include <asm/io.h>
33 34
@@ -2631,7 +2632,7 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2631 if (pci_enable_device(pdev)) 2632 if (pci_enable_device(pdev))
2632 return -EIO; 2633 return -EIO;
2633 2634
2634 if (!pci_set_dma_mask(pdev, 0xFFFFFFFFUL)) { 2635 if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
2635 printk(KERN_INFO "atp870u: use 32bit DMA mask.\n"); 2636 printk(KERN_INFO "atp870u: use 32bit DMA mask.\n");
2636 } else { 2637 } else {
2637 printk(KERN_ERR "atp870u: DMA mask required but not available.\n"); 2638 printk(KERN_ERR "atp870u: DMA mask required but not available.\n");
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 6e6b293dcb28..b1b704a42efd 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -57,6 +57,7 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
57#include <linux/reboot.h> 57#include <linux/reboot.h>
58#include <linux/spinlock.h> 58#include <linux/spinlock.h>
59#include <linux/smp_lock.h> 59#include <linux/smp_lock.h>
60#include <linux/dma-mapping.h>
60 61
61#include <linux/timer.h> 62#include <linux/timer.h>
62#include <linux/string.h> 63#include <linux/string.h>
@@ -906,8 +907,8 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
906 } 907 }
907 908
908 pci_set_master(pDev); 909 pci_set_master(pDev);
909 if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) && 910 if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) &&
910 pci_set_dma_mask(pDev, 0xffffffffULL)) 911 pci_set_dma_mask(pDev, DMA_32BIT_MASK))
911 return -EINVAL; 912 return -EINVAL;
912 913
913 base_addr0_phys = pci_resource_start(pDev,0); 914 base_addr0_phys = pci_resource_start(pDev,0);
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index b3f9de8f7595..059eeee4b554 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -490,6 +490,7 @@
490#include <linux/init.h> 490#include <linux/init.h>
491#include <linux/ctype.h> 491#include <linux/ctype.h>
492#include <linux/spinlock.h> 492#include <linux/spinlock.h>
493#include <linux/dma-mapping.h>
493#include <asm/byteorder.h> 494#include <asm/byteorder.h>
494#include <asm/dma.h> 495#include <asm/dma.h>
495#include <asm/io.h> 496#include <asm/io.h>
@@ -1426,7 +1427,7 @@ static int port_detect(unsigned long port_base, unsigned int j,
1426 1427
1427 if (ha->pdev) { 1428 if (ha->pdev) {
1428 pci_set_master(ha->pdev); 1429 pci_set_master(ha->pdev);
1429 if (pci_set_dma_mask(ha->pdev, 0xffffffff)) 1430 if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK))
1430 printk("%s: warning, pci_set_dma_mask failed.\n", 1431 printk("%s: warning, pci_set_dma_mask failed.\n",
1431 ha->board_name); 1432 ha->board_name);
1432 } 1433 }
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 7f7013e80a88..d5740bbdef3e 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -388,6 +388,7 @@
388#include <linux/proc_fs.h> 388#include <linux/proc_fs.h>
389#include <linux/time.h> 389#include <linux/time.h>
390#include <linux/timer.h> 390#include <linux/timer.h>
391#include <linux/dma-mapping.h>
391#ifdef GDTH_RTC 392#ifdef GDTH_RTC
392#include <linux/mc146818rtc.h> 393#include <linux/mc146818rtc.h>
393#endif 394#endif
@@ -4527,15 +4528,15 @@ static int __init gdth_detect(struct scsi_host_template *shtp)
4527 if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT)|| 4528 if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT)||
4528 /* 64-bit DMA only supported from FW >= x.43 */ 4529 /* 64-bit DMA only supported from FW >= x.43 */
4529 (!ha->dma64_support)) { 4530 (!ha->dma64_support)) {
4530 if (pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffff)) { 4531 if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) {
4531 printk(KERN_WARNING "GDT-PCI %d: Unable to set 32-bit DMA\n", hanum); 4532 printk(KERN_WARNING "GDT-PCI %d: Unable to set 32-bit DMA\n", hanum);
4532 err = TRUE; 4533 err = TRUE;
4533 } 4534 }
4534 } else { 4535 } else {
4535 shp->max_cmd_len = 16; 4536 shp->max_cmd_len = 16;
4536 if (!pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffffffffffffULL)) { 4537 if (!pci_set_dma_mask(pcistr[ctr].pdev, DMA_64BIT_MASK)) {
4537 printk("GDT-PCI %d: 64-bit DMA enabled\n", hanum); 4538 printk("GDT-PCI %d: 64-bit DMA enabled\n", hanum);
4538 } else if (pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffff)) { 4539 } else if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) {
4539 printk(KERN_WARNING "GDT-PCI %d: Unable to set 64/32-bit DMA\n", hanum); 4540 printk(KERN_WARNING "GDT-PCI %d: Unable to set 64/32-bit DMA\n", hanum);
4540 err = TRUE; 4541 err = TRUE;
4541 } 4542 }
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index ea6f3c0e05d9..0cc7f65b584f 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -127,6 +127,7 @@
127#include <linux/sched.h> 127#include <linux/sched.h>
128#include <linux/slab.h> 128#include <linux/slab.h>
129#include <linux/jiffies.h> 129#include <linux/jiffies.h>
130#include <linux/dma-mapping.h>
130#include <asm/io.h> 131#include <asm/io.h>
131 132
132#include <scsi/scsi.h> 133#include <scsi/scsi.h>
@@ -2780,7 +2781,7 @@ static int tul_NewReturnNumberOfAdapters(void)
2780 if (((dRegValue & 0xFF00) >> 8) == 0xFF) 2781 if (((dRegValue & 0xFF00) >> 8) == 0xFF)
2781 dRegValue = 0; 2782 dRegValue = 0;
2782 wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8)); 2783 wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8));
2783 if (pci_set_dma_mask(pDev, 0xffffffff)) { 2784 if (pci_set_dma_mask(pDev, DMA_32BIT_MASK)) {
2784 printk(KERN_WARNING 2785 printk(KERN_WARNING
2785 "i91u: Could not set 32 bit DMA mask\n"); 2786 "i91u: Could not set 32 bit DMA mask\n");
2786 continue; 2787 continue;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 481708d527ae..a4c0b04cfdbd 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -179,6 +179,7 @@
179 179
180#include <linux/blkdev.h> 180#include <linux/blkdev.h>
181#include <linux/types.h> 181#include <linux/types.h>
182#include <linux/dma-mapping.h>
182 183
183#include <scsi/sg.h> 184#include <scsi/sg.h>
184 185
@@ -7284,10 +7285,10 @@ ips_init_phase1(struct pci_dev *pci_dev, int *indexPtr)
7284 * are guaranteed to be < 4G. 7285 * are guaranteed to be < 4G.
7285 */ 7286 */
7286 if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) && 7287 if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) &&
7287 !pci_set_dma_mask(ha->pcidev, 0xffffffffffffffffULL)) { 7288 !pci_set_dma_mask(ha->pcidev, DMA_64BIT_MASK)) {
7288 (ha)->flags |= IPS_HA_ENH_SG; 7289 (ha)->flags |= IPS_HA_ENH_SG;
7289 } else { 7290 } else {
7290 if (pci_set_dma_mask(ha->pcidev, 0xffffffffULL) != 0) { 7291 if (pci_set_dma_mask(ha->pcidev, DMA_32BIT_MASK) != 0) {
7291 printk(KERN_WARNING "Unable to set DMA Mask\n"); 7292 printk(KERN_WARNING "Unable to set DMA Mask\n");
7292 return ips_abort_init(ha, index); 7293 return ips_abort_init(ha, index);
7293 } 7294 }
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 7144674bc8e6..80b68a2481b3 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -45,6 +45,7 @@
45#include <linux/interrupt.h> 45#include <linux/interrupt.h>
46#include <linux/pci.h> 46#include <linux/pci.h>
47#include <linux/init.h> 47#include <linux/init.h>
48#include <linux/dma-mapping.h>
48#include <scsi/scsicam.h> 49#include <scsi/scsicam.h>
49 50
50#include "scsi.h" 51#include "scsi.h"
@@ -2094,7 +2095,7 @@ make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
2094 2095
2095 memcpy(*pdev, adapter->dev, sizeof(struct pci_dev)); 2096 memcpy(*pdev, adapter->dev, sizeof(struct pci_dev));
2096 2097
2097 if( pci_set_dma_mask(*pdev, 0xffffffff) != 0 ) { 2098 if( pci_set_dma_mask(*pdev, DMA_32BIT_MASK) != 0 ) {
2098 kfree(*pdev); 2099 kfree(*pdev);
2099 return -1; 2100 return -1;
2100 } 2101 }
@@ -4859,10 +4860,10 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4859 4860
4860 /* Set the Mode of addressing to 64 bit if we can */ 4861 /* Set the Mode of addressing to 64 bit if we can */
4861 if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) { 4862 if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) {
4862 pci_set_dma_mask(pdev, 0xffffffffffffffffULL); 4863 pci_set_dma_mask(pdev, DMA_64BIT_MASK);
4863 adapter->has_64bit_addr = 1; 4864 adapter->has_64bit_addr = 1;
4864 } else { 4865 } else {
4865 pci_set_dma_mask(pdev, 0xffffffff); 4866 pci_set_dma_mask(pdev, DMA_32BIT_MASK);
4866 adapter->has_64bit_addr = 0; 4867 adapter->has_64bit_addr = 0;
4867 } 4868 }
4868 4869
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index a279ebb61447..30ee0ef4b459 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -38,6 +38,7 @@
38#include <linux/pci.h> 38#include <linux/pci.h>
39#include <linux/delay.h> 39#include <linux/delay.h>
40#include <linux/ctype.h> 40#include <linux/ctype.h>
41#include <linux/dma-mapping.h>
41 42
42#include <asm/dma.h> 43#include <asm/dma.h>
43#include <asm/system.h> 44#include <asm/system.h>
@@ -2776,7 +2777,7 @@ static int nsp32_detect(struct scsi_host_template *sht)
2776 /* 2777 /*
2777 * setup DMA 2778 * setup DMA
2778 */ 2779 */
2779 if (pci_set_dma_mask(PCIDEV, 0xffffffffUL) != 0) { 2780 if (pci_set_dma_mask(PCIDEV, DMA_32BIT_MASK) != 0) {
2780 nsp32_msg (KERN_ERR, "failed to set PCI DMA mask"); 2781 nsp32_msg (KERN_ERR, "failed to set PCI DMA mask");
2781 goto scsi_unregister; 2782 goto scsi_unregister;
2782 } 2783 }
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 66ea47a9c53c..e3bd4bc339f4 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -49,6 +49,7 @@ static const char * osst_version = "0.99.4";
49#include <linux/blkdev.h> 49#include <linux/blkdev.h>
50#include <linux/moduleparam.h> 50#include <linux/moduleparam.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/jiffies.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/dma.h> 54#include <asm/dma.h>
54#include <asm/system.h> 55#include <asm/system.h>
@@ -856,7 +857,7 @@ static int osst_wait_frame(struct osst_tape * STp, struct osst_request ** aSRpnt
856 ) && result >= 0) 857 ) && result >= 0)
857 { 858 {
858#if DEBUG 859#if DEBUG
859 if (debugging || jiffies - startwait >= 2*HZ/OSST_POLL_PER_SEC) 860 if (debugging || time_after_eq(jiffies, startwait + 2*HZ/OSST_POLL_PER_SEC))
860 printk (OSST_DEB_MSG 861 printk (OSST_DEB_MSG
861 "%s:D: Succ wait f fr %i (>%i): %i-%i %i (%i): %3li.%li s\n", 862 "%s:D: Succ wait f fr %i (>%i): %i-%i %i (%i): %3li.%li s\n",
862 name, curr, curr+minlast, STp->first_frame_position, 863 name, curr, curr+minlast, STp->first_frame_position,
@@ -867,7 +868,7 @@ static int osst_wait_frame(struct osst_tape * STp, struct osst_request ** aSRpnt
867 return 0; 868 return 0;
868 } 869 }
869#if DEBUG 870#if DEBUG
870 if (jiffies - startwait >= 2*HZ/OSST_POLL_PER_SEC && notyetprinted) 871 if (time_after_eq(jiffies, startwait + 2*HZ/OSST_POLL_PER_SEC) && notyetprinted)
871 { 872 {
872 printk (OSST_DEB_MSG "%s:D: Wait for frame %i (>%i): %i-%i %i (%i)\n", 873 printk (OSST_DEB_MSG "%s:D: Wait for frame %i (>%i): %i-%i %i (%i)\n",
873 name, curr, curr+minlast, STp->first_frame_position, 874 name, curr, curr+minlast, STp->first_frame_position,
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 05347eed9dd5..fee843fab1c7 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -18,6 +18,7 @@
18#include <linux/parport.h> 18#include <linux/parport.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/jiffies.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include <scsi/scsi.h> 24#include <scsi/scsi.h>
@@ -726,7 +727,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
726 retv--; 727 retv--;
727 728
728 if (retv) { 729 if (retv) {
729 if ((jiffies - dev->jstart) > (1 * HZ)) { 730 if (time_after(jiffies, dev->jstart + (1 * HZ))) {
730 printk 731 printk
731 ("ppa: Parallel port cable is unplugged!!\n"); 732 ("ppa: Parallel port cable is unplugged!!\n");
732 ppa_fail(dev, DID_BUS_BUSY); 733 ppa_fail(dev, DID_BUS_BUSY);
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index e0230249fa0f..5a48e55f9418 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -350,6 +350,7 @@
350#include <linux/pci_ids.h> 350#include <linux/pci_ids.h>
351#include <linux/interrupt.h> 351#include <linux/interrupt.h>
352#include <linux/init.h> 352#include <linux/init.h>
353#include <linux/dma-mapping.h>
353 354
354#include <asm/io.h> 355#include <asm/io.h>
355#include <asm/irq.h> 356#include <asm/irq.h>
@@ -4321,7 +4322,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4321 4322
4322#ifdef QLA_64BIT_PTR 4323#ifdef QLA_64BIT_PTR
4323 if (pci_set_dma_mask(ha->pdev, (dma_addr_t) ~ 0ULL)) { 4324 if (pci_set_dma_mask(ha->pdev, (dma_addr_t) ~ 0ULL)) {
4324 if (pci_set_dma_mask(ha->pdev, 0xffffffff)) { 4325 if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) {
4325 printk(KERN_WARNING "scsi(%li): Unable to set a " 4326 printk(KERN_WARNING "scsi(%li): Unable to set a "
4326 "suitable DMA mask - aborting\n", ha->host_no); 4327 "suitable DMA mask - aborting\n", ha->host_no);
4327 error = -ENODEV; 4328 error = -ENODEV;
@@ -4331,7 +4332,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4331 dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n", 4332 dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n",
4332 ha->host_no); 4333 ha->host_no);
4333#else 4334#else
4334 if (pci_set_dma_mask(ha->pdev, 0xffffffff)) { 4335 if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) {
4335 printk(KERN_WARNING "scsi(%li): Unable to set a " 4336 printk(KERN_WARNING "scsi(%li): Unable to set a "
4336 "suitable DMA mask - aborting\n", ha->host_no); 4337 "suitable DMA mask - aborting\n", ha->host_no);
4337 error = -ENODEV; 4338 error = -ENODEV;
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
index 94ef3f08d378..52b224a5d6fd 100644
--- a/drivers/scsi/qlogicfc.c
+++ b/drivers/scsi/qlogicfc.c
@@ -61,6 +61,8 @@
61#include <linux/unistd.h> 61#include <linux/unistd.h>
62#include <linux/spinlock.h> 62#include <linux/spinlock.h>
63#include <linux/interrupt.h> 63#include <linux/interrupt.h>
64#include <linux/dma-mapping.h>
65#include <linux/jiffies.h>
64#include <asm/io.h> 66#include <asm/io.h>
65#include <asm/irq.h> 67#include <asm/irq.h>
66#include "scsi.h" 68#include "scsi.h"
@@ -737,8 +739,8 @@ static int isp2x00_detect(struct scsi_host_template * tmpt)
737 continue; 739 continue;
738 740
739 /* Try to configure DMA attributes. */ 741 /* Try to configure DMA attributes. */
740 if (pci_set_dma_mask(pdev, 0xffffffffffffffffULL) && 742 if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
741 pci_set_dma_mask(pdev, 0xffffffffULL)) 743 pci_set_dma_mask(pdev, DMA_32BIT_MASK))
742 continue; 744 continue;
743 745
744 host = scsi_register(tmpt, sizeof(struct isp2x00_hostdata)); 746 host = scsi_register(tmpt, sizeof(struct isp2x00_hostdata));
@@ -1325,7 +1327,7 @@ static int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1325 cmd->control_flags = cpu_to_le16(CFLAG_READ); 1327 cmd->control_flags = cpu_to_le16(CFLAG_READ);
1326 1328
1327 if (Cmnd->device->tagged_supported) { 1329 if (Cmnd->device->tagged_supported) {
1328 if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * ISP_TIMEOUT)) { 1330 if (time_after(jiffies, hostdata->tag_ages[Cmnd->device->id] + (2 * ISP_TIMEOUT))) {
1329 cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG); 1331 cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG);
1330 hostdata->tag_ages[Cmnd->device->id] = jiffies; 1332 hostdata->tag_ages[Cmnd->device->id] = jiffies;
1331 } else 1333 } else
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 1fd5fc6d0fe3..c7e78dcf09df 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -24,6 +24,7 @@
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/jiffies.h>
27 28
28#include <asm/byteorder.h> 29#include <asm/byteorder.h>
29 30
@@ -1017,7 +1018,7 @@ static inline void cmd_frob(struct Command_Entry *cmd, struct scsi_cmnd *Cmnd,
1017 if (Cmnd->device->tagged_supported) { 1018 if (Cmnd->device->tagged_supported) {
1018 if (qpti->cmd_count[Cmnd->device->id] == 0) 1019 if (qpti->cmd_count[Cmnd->device->id] == 0)
1019 qpti->tag_ages[Cmnd->device->id] = jiffies; 1020 qpti->tag_ages[Cmnd->device->id] = jiffies;
1020 if ((jiffies - qpti->tag_ages[Cmnd->device->id]) > (5*HZ)) { 1021 if (time_after(jiffies, qpti->tag_ages[Cmnd->device->id] + (5*HZ))) {
1021 cmd->control_flags = CFLAG_ORDERED_TAG; 1022 cmd->control_flags = CFLAG_ORDERED_TAG;
1022 qpti->tag_ages[Cmnd->device->id] = jiffies; 1023 qpti->tag_ages[Cmnd->device->id] = jiffies;
1023 } else 1024 } else
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 5996d3cd0ed8..674b15c78f68 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1528,7 +1528,7 @@ static int serial8250_startup(struct uart_port *port)
1528 1528
1529 /* 1529 /*
1530 * Clear the FIFO buffers and disable them. 1530 * Clear the FIFO buffers and disable them.
1531 * (they will be reeanbled in set_termios()) 1531 * (they will be reenabled in set_termios())
1532 */ 1532 */
1533 serial8250_clear_fifos(up); 1533 serial8250_clear_fifos(up);
1534 1534
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index b848b7d94412..3bdee64d1a99 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -483,7 +483,7 @@ static int serial_txx9_startup(struct uart_port *port)
483 483
484 /* 484 /*
485 * Clear the FIFO buffers and disable them. 485 * Clear the FIFO buffers and disable them.
486 * (they will be reeanbled in set_termios()) 486 * (they will be reenabled in set_termios())
487 */ 487 */
488 sio_set(up, TXX9_SIFCR, 488 sio_set(up, TXX9_SIFCR,
489 TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE); 489 TXX9_SIFCR_TFRST | TXX9_SIFCR_RFRST | TXX9_SIFCR_FRSTE);
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 9fe2283d91e5..1c4396c2962d 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -641,7 +641,7 @@ static int sunsu_startup(struct uart_port *port)
641 641
642 /* 642 /*
643 * Clear the FIFO buffers and disable them. 643 * Clear the FIFO buffers and disable them.
644 * (they will be reeanbled in set_termios()) 644 * (they will be reenabled in set_termios())
645 */ 645 */
646 if (uart_config[up->port.type].flags & UART_CLEAR_FIFO) { 646 if (uart_config[up->port.type].flags & UART_CLEAR_FIFO) {
647 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO); 647 serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index 7a6db1c5c8c5..e166fffea86b 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -49,7 +49,7 @@ static int phone_open(struct inode *inode, struct file *file)
49 unsigned int minor = iminor(inode); 49 unsigned int minor = iminor(inode);
50 int err = 0; 50 int err = 0;
51 struct phone_device *p; 51 struct phone_device *p;
52 struct file_operations *old_fops, *new_fops = NULL; 52 const struct file_operations *old_fops, *new_fops = NULL;
53 53
54 if (minor >= PHONE_NUM_DEVICES) 54 if (minor >= PHONE_NUM_DEVICES)
55 return -ENODEV; 55 return -ENODEV;
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 37b13368c814..b263a54a13c0 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -24,15 +24,15 @@
24#include "usb.h" 24#include "usb.h"
25 25
26#define MAX_USB_MINORS 256 26#define MAX_USB_MINORS 256
27static struct file_operations *usb_minors[MAX_USB_MINORS]; 27static const struct file_operations *usb_minors[MAX_USB_MINORS];
28static DEFINE_SPINLOCK(minor_lock); 28static DEFINE_SPINLOCK(minor_lock);
29 29
30static int usb_open(struct inode * inode, struct file * file) 30static int usb_open(struct inode * inode, struct file * file)
31{ 31{
32 int minor = iminor(inode); 32 int minor = iminor(inode);
33 struct file_operations *c; 33 const struct file_operations *c;
34 int err = -ENODEV; 34 int err = -ENODEV;
35 struct file_operations *old_fops, *new_fops = NULL; 35 const struct file_operations *old_fops, *new_fops = NULL;
36 36
37 spin_lock (&minor_lock); 37 spin_lock (&minor_lock);
38 c = usb_minors[minor]; 38 c = usb_minors[minor];
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index b44cfda76b61..3f618ce6998d 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1581,7 +1581,7 @@ restart:
1581 1581
1582static struct inode * 1582static struct inode *
1583gadgetfs_create_file (struct super_block *sb, char const *name, 1583gadgetfs_create_file (struct super_block *sb, char const *name,
1584 void *data, struct file_operations *fops, 1584 void *data, const struct file_operations *fops,
1585 struct dentry **dentry_p); 1585 struct dentry **dentry_p);
1586 1586
1587static int activate_ep_files (struct dev_data *dev) 1587static int activate_ep_files (struct dev_data *dev)
@@ -1955,7 +1955,7 @@ module_param (default_perm, uint, 0644);
1955 1955
1956static struct inode * 1956static struct inode *
1957gadgetfs_make_inode (struct super_block *sb, 1957gadgetfs_make_inode (struct super_block *sb,
1958 void *data, struct file_operations *fops, 1958 void *data, const struct file_operations *fops,
1959 int mode) 1959 int mode)
1960{ 1960{
1961 struct inode *inode = new_inode (sb); 1961 struct inode *inode = new_inode (sb);
@@ -1979,7 +1979,7 @@ gadgetfs_make_inode (struct super_block *sb,
1979 */ 1979 */
1980static struct inode * 1980static struct inode *
1981gadgetfs_create_file (struct super_block *sb, char const *name, 1981gadgetfs_create_file (struct super_block *sb, char const *name,
1982 void *data, struct file_operations *fops, 1982 void *data, const struct file_operations *fops,
1983 struct dentry **dentry_p) 1983 struct dentry **dentry_p)
1984{ 1984{
1985 struct dentry *dentry; 1985 struct dentry *dentry;
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 372527a83593..682bf2215660 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -158,7 +158,7 @@ static int ohci_s3c2410_hub_control (
158 "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", 158 "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
159 hcd, typeReq, wValue, wIndex, buf, wLength); 159 hcd, typeReq, wValue, wIndex, buf, wLength);
160 160
161 /* if we are only an humble host without any special capabilites 161 /* if we are only an humble host without any special capabilities
162 * process the request straight away and exit */ 162 * process the request straight away and exit */
163 163
164 if (info == NULL) { 164 if (info == NULL) {
diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c
index 9c5ab251370c..f7ac9d6b9856 100644
--- a/drivers/usb/net/zaurus.c
+++ b/drivers/usb/net/zaurus.c
@@ -217,7 +217,7 @@ static int blan_mdlm_bind(struct usbnet *dev, struct usb_interface *intf)
217 * with devices that use it and those that don't. 217 * with devices that use it and those that don't.
218 */ 218 */
219 if ((detail->bDetailData[1] & ~0x02) != 0x01) { 219 if ((detail->bDetailData[1] & ~0x02) != 0x01) {
220 /* bmDataCapabilites == 0 would be fine too, 220 /* bmDataCapabilities == 0 would be fine too,
221 * but framing is minidriver-coupled for now. 221 * but framing is minidriver-coupled for now.
222 */ 222 */
223bad_detail: 223bad_detail:
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index 43c9f7de0314..f867b8d3e973 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -39,8 +39,8 @@
39 39
40extern struct file_system_type v9fs_fs_type; 40extern struct file_system_type v9fs_fs_type;
41extern struct address_space_operations v9fs_addr_operations; 41extern struct address_space_operations v9fs_addr_operations;
42extern struct file_operations v9fs_file_operations; 42extern const struct file_operations v9fs_file_operations;
43extern struct file_operations v9fs_dir_operations; 43extern const struct file_operations v9fs_dir_operations;
44extern struct dentry_operations v9fs_dentry_operations; 44extern struct dentry_operations v9fs_dentry_operations;
45 45
46struct inode *v9fs_get_inode(struct super_block *sb, int mode); 46struct inode *v9fs_get_inode(struct super_block *sb, int mode);
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 766f11f1215c..e32d5971039b 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -204,7 +204,7 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
204 return 0; 204 return 0;
205} 205}
206 206
207struct file_operations v9fs_dir_operations = { 207const struct file_operations v9fs_dir_operations = {
208 .read = generic_read_dir, 208 .read = generic_read_dir,
209 .readdir = v9fs_dir_readdir, 209 .readdir = v9fs_dir_readdir,
210 .open = v9fs_file_open, 210 .open = v9fs_file_open,
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 59e744163407..083dcfcd158e 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -266,7 +266,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
266 return total; 266 return total;
267} 267}
268 268
269struct file_operations v9fs_file_operations = { 269const struct file_operations v9fs_file_operations = {
270 .llseek = generic_file_llseek, 270 .llseek = generic_file_llseek,
271 .read = v9fs_file_read, 271 .read = v9fs_file_read,
272 .write = v9fs_file_write, 272 .write = v9fs_file_write,
diff --git a/fs/adfs/adfs.h b/fs/adfs/adfs.h
index f6cd01352cc8..29217ff36d44 100644
--- a/fs/adfs/adfs.h
+++ b/fs/adfs/adfs.h
@@ -85,7 +85,7 @@ void __adfs_error(struct super_block *sb, const char *function,
85 85
86/* dir_*.c */ 86/* dir_*.c */
87extern struct inode_operations adfs_dir_inode_operations; 87extern struct inode_operations adfs_dir_inode_operations;
88extern struct file_operations adfs_dir_operations; 88extern const struct file_operations adfs_dir_operations;
89extern struct dentry_operations adfs_dentry_operations; 89extern struct dentry_operations adfs_dentry_operations;
90extern struct adfs_dir_ops adfs_f_dir_ops; 90extern struct adfs_dir_ops adfs_f_dir_ops;
91extern struct adfs_dir_ops adfs_fplus_dir_ops; 91extern struct adfs_dir_ops adfs_fplus_dir_ops;
@@ -94,7 +94,7 @@ extern int adfs_dir_update(struct super_block *sb, struct object_info *obj);
94 94
95/* file.c */ 95/* file.c */
96extern struct inode_operations adfs_file_inode_operations; 96extern struct inode_operations adfs_file_inode_operations;
97extern struct file_operations adfs_file_operations; 97extern const struct file_operations adfs_file_operations;
98 98
99static inline __u32 signed_asl(__u32 val, signed int shift) 99static inline __u32 signed_asl(__u32 val, signed int shift)
100{ 100{
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c
index 0b4c3a028076..7b075fc397da 100644
--- a/fs/adfs/dir.c
+++ b/fs/adfs/dir.c
@@ -196,7 +196,7 @@ out:
196 return ret; 196 return ret;
197} 197}
198 198
199struct file_operations adfs_dir_operations = { 199const struct file_operations adfs_dir_operations = {
200 .read = generic_read_dir, 200 .read = generic_read_dir,
201 .readdir = adfs_readdir, 201 .readdir = adfs_readdir,
202 .fsync = file_fsync, 202 .fsync = file_fsync,
diff --git a/fs/adfs/file.c b/fs/adfs/file.c
index 6af10885f9d6..1014b9f2117b 100644
--- a/fs/adfs/file.c
+++ b/fs/adfs/file.c
@@ -25,7 +25,7 @@
25 25
26#include "adfs.h" 26#include "adfs.h"
27 27
28struct file_operations adfs_file_operations = { 28const struct file_operations adfs_file_operations = {
29 .llseek = generic_file_llseek, 29 .llseek = generic_file_llseek,
30 .read = generic_file_read, 30 .read = generic_file_read,
31 .mmap = generic_file_mmap, 31 .mmap = generic_file_mmap,
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 0c6799f2137a..a43a876742b8 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -192,9 +192,9 @@ extern void affs_dir_truncate(struct inode *);
192extern struct inode_operations affs_file_inode_operations; 192extern struct inode_operations affs_file_inode_operations;
193extern struct inode_operations affs_dir_inode_operations; 193extern struct inode_operations affs_dir_inode_operations;
194extern struct inode_operations affs_symlink_inode_operations; 194extern struct inode_operations affs_symlink_inode_operations;
195extern struct file_operations affs_file_operations; 195extern const struct file_operations affs_file_operations;
196extern struct file_operations affs_file_operations_ofs; 196extern const struct file_operations affs_file_operations_ofs;
197extern struct file_operations affs_dir_operations; 197extern const struct file_operations affs_dir_operations;
198extern struct address_space_operations affs_symlink_aops; 198extern struct address_space_operations affs_symlink_aops;
199extern struct address_space_operations affs_aops; 199extern struct address_space_operations affs_aops;
200extern struct address_space_operations affs_aops_ofs; 200extern struct address_space_operations affs_aops_ofs;
diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index 548efd0ee98c..5d9649fa1814 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -17,7 +17,7 @@
17 17
18static int affs_readdir(struct file *, void *, filldir_t); 18static int affs_readdir(struct file *, void *, filldir_t);
19 19
20struct file_operations affs_dir_operations = { 20const struct file_operations affs_dir_operations = {
21 .read = generic_read_dir, 21 .read = generic_read_dir,
22 .readdir = affs_readdir, 22 .readdir = affs_readdir,
23 .fsync = file_fsync, 23 .fsync = file_fsync,
diff --git a/fs/affs/file.c b/fs/affs/file.c
index f72fb776ecdf..7076262af39b 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -25,7 +25,7 @@ static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext);
25static int affs_file_open(struct inode *inode, struct file *filp); 25static int affs_file_open(struct inode *inode, struct file *filp);
26static int affs_file_release(struct inode *inode, struct file *filp); 26static int affs_file_release(struct inode *inode, struct file *filp);
27 27
28struct file_operations affs_file_operations = { 28const struct file_operations affs_file_operations = {
29 .llseek = generic_file_llseek, 29 .llseek = generic_file_llseek,
30 .read = generic_file_read, 30 .read = generic_file_read,
31 .write = generic_file_write, 31 .write = generic_file_write,
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index 5c61c24dab2a..a6dff6a4f204 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -32,7 +32,7 @@ static int afs_d_delete(struct dentry *dentry);
32static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen, 32static int afs_dir_lookup_filldir(void *_cookie, const char *name, int nlen,
33 loff_t fpos, ino_t ino, unsigned dtype); 33 loff_t fpos, ino_t ino, unsigned dtype);
34 34
35struct file_operations afs_dir_file_operations = { 35const struct file_operations afs_dir_file_operations = {
36 .open = afs_dir_open, 36 .open = afs_dir_open,
37 .readdir = afs_dir_readdir, 37 .readdir = afs_dir_readdir,
38}; 38};
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index ab8f87c66319..72febdf9a35a 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -64,7 +64,7 @@ extern struct cachefs_index_def afs_cache_cell_index_def;
64 * dir.c 64 * dir.c
65 */ 65 */
66extern struct inode_operations afs_dir_inode_operations; 66extern struct inode_operations afs_dir_inode_operations;
67extern struct file_operations afs_dir_file_operations; 67extern const struct file_operations afs_dir_file_operations;
68 68
69/* 69/*
70 * file.c 70 * file.c
@@ -105,7 +105,7 @@ extern struct cachefs_netfs afs_cache_netfs;
105 * mntpt.c 105 * mntpt.c
106 */ 106 */
107extern struct inode_operations afs_mntpt_inode_operations; 107extern struct inode_operations afs_mntpt_inode_operations;
108extern struct file_operations afs_mntpt_file_operations; 108extern const struct file_operations afs_mntpt_file_operations;
109extern struct afs_timer afs_mntpt_expiry_timer; 109extern struct afs_timer afs_mntpt_expiry_timer;
110extern struct afs_timer_ops afs_mntpt_expiry_timer_ops; 110extern struct afs_timer_ops afs_mntpt_expiry_timer_ops;
111extern unsigned long afs_mntpt_expiry_timeout; 111extern unsigned long afs_mntpt_expiry_timeout;
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
index 31ee06590de5..4e6eeb59b83c 100644
--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -32,7 +32,7 @@ static struct dentry *afs_mntpt_lookup(struct inode *dir,
32static int afs_mntpt_open(struct inode *inode, struct file *file); 32static int afs_mntpt_open(struct inode *inode, struct file *file);
33static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd); 33static void *afs_mntpt_follow_link(struct dentry *dentry, struct nameidata *nd);
34 34
35struct file_operations afs_mntpt_file_operations = { 35const struct file_operations afs_mntpt_file_operations = {
36 .open = afs_mntpt_open, 36 .open = afs_mntpt_open,
37}; 37};
38 38
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 9c81b8f7eef0..101d21b6c037 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -37,7 +37,7 @@ static struct seq_operations afs_proc_cells_ops = {
37 .show = afs_proc_cells_show, 37 .show = afs_proc_cells_show,
38}; 38};
39 39
40static struct file_operations afs_proc_cells_fops = { 40static const struct file_operations afs_proc_cells_fops = {
41 .open = afs_proc_cells_open, 41 .open = afs_proc_cells_open,
42 .read = seq_read, 42 .read = seq_read,
43 .write = afs_proc_cells_write, 43 .write = afs_proc_cells_write,
@@ -53,7 +53,7 @@ static ssize_t afs_proc_rootcell_write(struct file *file,
53 const char __user *buf, 53 const char __user *buf,
54 size_t size, loff_t *_pos); 54 size_t size, loff_t *_pos);
55 55
56static struct file_operations afs_proc_rootcell_fops = { 56static const struct file_operations afs_proc_rootcell_fops = {
57 .open = afs_proc_rootcell_open, 57 .open = afs_proc_rootcell_open,
58 .read = afs_proc_rootcell_read, 58 .read = afs_proc_rootcell_read,
59 .write = afs_proc_rootcell_write, 59 .write = afs_proc_rootcell_write,
@@ -77,7 +77,7 @@ static struct seq_operations afs_proc_cell_volumes_ops = {
77 .show = afs_proc_cell_volumes_show, 77 .show = afs_proc_cell_volumes_show,
78}; 78};
79 79
80static struct file_operations afs_proc_cell_volumes_fops = { 80static const struct file_operations afs_proc_cell_volumes_fops = {
81 .open = afs_proc_cell_volumes_open, 81 .open = afs_proc_cell_volumes_open,
82 .read = seq_read, 82 .read = seq_read,
83 .llseek = seq_lseek, 83 .llseek = seq_lseek,
@@ -101,7 +101,7 @@ static struct seq_operations afs_proc_cell_vlservers_ops = {
101 .show = afs_proc_cell_vlservers_show, 101 .show = afs_proc_cell_vlservers_show,
102}; 102};
103 103
104static struct file_operations afs_proc_cell_vlservers_fops = { 104static const struct file_operations afs_proc_cell_vlservers_fops = {
105 .open = afs_proc_cell_vlservers_open, 105 .open = afs_proc_cell_vlservers_open,
106 .read = seq_read, 106 .read = seq_read,
107 .llseek = seq_lseek, 107 .llseek = seq_lseek,
@@ -124,7 +124,7 @@ static struct seq_operations afs_proc_cell_servers_ops = {
124 .show = afs_proc_cell_servers_show, 124 .show = afs_proc_cell_servers_show,
125}; 125};
126 126
127static struct file_operations afs_proc_cell_servers_fops = { 127static const struct file_operations afs_proc_cell_servers_fops = {
128 .open = afs_proc_cell_servers_open, 128 .open = afs_proc_cell_servers_open,
129 .read = seq_read, 129 .read = seq_read,
130 .llseek = seq_lseek, 130 .llseek = seq_lseek,
diff --git a/fs/autofs/autofs_i.h b/fs/autofs/autofs_i.h
index 990c28da5aec..a62327f1bdff 100644
--- a/fs/autofs/autofs_i.h
+++ b/fs/autofs/autofs_i.h
@@ -146,7 +146,7 @@ struct autofs_dir_ent *autofs_expire(struct super_block *,struct autofs_sb_info
146 146
147extern struct inode_operations autofs_root_inode_operations; 147extern struct inode_operations autofs_root_inode_operations;
148extern struct inode_operations autofs_symlink_inode_operations; 148extern struct inode_operations autofs_symlink_inode_operations;
149extern struct file_operations autofs_root_operations; 149extern const struct file_operations autofs_root_operations;
150 150
151/* Initializing function */ 151/* Initializing function */
152 152
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 870e2cf33016..9cac08d6a873 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -26,7 +26,7 @@ static int autofs_root_rmdir(struct inode *,struct dentry *);
26static int autofs_root_mkdir(struct inode *,struct dentry *,int); 26static int autofs_root_mkdir(struct inode *,struct dentry *,int);
27static int autofs_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long); 27static int autofs_root_ioctl(struct inode *, struct file *,unsigned int,unsigned long);
28 28
29struct file_operations autofs_root_operations = { 29const struct file_operations autofs_root_operations = {
30 .read = generic_read_dir, 30 .read = generic_read_dir,
31 .readdir = autofs_root_readdir, 31 .readdir = autofs_root_readdir,
32 .ioctl = autofs_root_ioctl, 32 .ioctl = autofs_root_ioctl,
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 617fd7b37447..57c4903614e5 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -176,8 +176,8 @@ extern struct inode_operations autofs4_dir_inode_operations;
176extern struct inode_operations autofs4_root_inode_operations; 176extern struct inode_operations autofs4_root_inode_operations;
177extern struct inode_operations autofs4_indirect_root_inode_operations; 177extern struct inode_operations autofs4_indirect_root_inode_operations;
178extern struct inode_operations autofs4_direct_root_inode_operations; 178extern struct inode_operations autofs4_direct_root_inode_operations;
179extern struct file_operations autofs4_dir_operations; 179extern const struct file_operations autofs4_dir_operations;
180extern struct file_operations autofs4_root_operations; 180extern const struct file_operations autofs4_root_operations;
181 181
182/* Initializing function */ 182/* Initializing function */
183 183
@@ -230,3 +230,6 @@ static inline int __simple_empty(struct dentry *dentry)
230out: 230out:
231 return ret; 231 return ret;
232} 232}
233
234void autofs4_dentry_release(struct dentry *);
235
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 4eddee4e76fc..fde78b110ddd 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -292,7 +292,6 @@ static struct autofs_info *autofs4_mkroot(struct autofs_sb_info *sbi)
292 return ino; 292 return ino;
293} 293}
294 294
295void autofs4_dentry_release(struct dentry *);
296static struct dentry_operations autofs4_sb_dentry_operations = { 295static struct dentry_operations autofs4_sb_dentry_operations = {
297 .d_release = autofs4_dentry_release, 296 .d_release = autofs4_dentry_release,
298}; 297};
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index c8fe43a475e2..84e030c8ddd0 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -32,7 +32,7 @@ static int autofs4_root_readdir(struct file * filp, void * dirent, filldir_t fil
32static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *); 32static struct dentry *autofs4_lookup(struct inode *,struct dentry *, struct nameidata *);
33static void *autofs4_follow_link(struct dentry *, struct nameidata *); 33static void *autofs4_follow_link(struct dentry *, struct nameidata *);
34 34
35struct file_operations autofs4_root_operations = { 35const struct file_operations autofs4_root_operations = {
36 .open = dcache_dir_open, 36 .open = dcache_dir_open,
37 .release = dcache_dir_close, 37 .release = dcache_dir_close,
38 .read = generic_read_dir, 38 .read = generic_read_dir,
@@ -40,7 +40,7 @@ struct file_operations autofs4_root_operations = {
40 .ioctl = autofs4_root_ioctl, 40 .ioctl = autofs4_root_ioctl,
41}; 41};
42 42
43struct file_operations autofs4_dir_operations = { 43const struct file_operations autofs4_dir_operations = {
44 .open = autofs4_dir_open, 44 .open = autofs4_dir_open,
45 .release = autofs4_dir_close, 45 .release = autofs4_dir_close,
46 .read = generic_read_dir, 46 .read = generic_read_dir,
diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index e172180a1d8c..80599ae33966 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -22,7 +22,7 @@ static int return_EIO(void)
22 22
23#define EIO_ERROR ((void *) (return_EIO)) 23#define EIO_ERROR ((void *) (return_EIO))
24 24
25static struct file_operations bad_file_ops = 25static const struct file_operations bad_file_ops =
26{ 26{
27 .llseek = EIO_ERROR, 27 .llseek = EIO_ERROR,
28 .aio_read = EIO_ERROR, 28 .aio_read = EIO_ERROR,
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 044a59587829..68ebd10f345d 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -64,7 +64,7 @@ static const struct super_operations befs_sops = {
64/* slab cache for befs_inode_info objects */ 64/* slab cache for befs_inode_info objects */
65static kmem_cache_t *befs_inode_cachep; 65static kmem_cache_t *befs_inode_cachep;
66 66
67static struct file_operations befs_dir_operations = { 67static const struct file_operations befs_dir_operations = {
68 .read = generic_read_dir, 68 .read = generic_read_dir,
69 .readdir = befs_readdir, 69 .readdir = befs_readdir,
70}; 70};
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 1fbc53f14aba..9d791004b21c 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -49,11 +49,11 @@ static inline struct bfs_inode_info *BFS_I(struct inode *inode)
49 49
50/* file.c */ 50/* file.c */
51extern struct inode_operations bfs_file_inops; 51extern struct inode_operations bfs_file_inops;
52extern struct file_operations bfs_file_operations; 52extern const struct file_operations bfs_file_operations;
53extern struct address_space_operations bfs_aops; 53extern struct address_space_operations bfs_aops;
54 54
55/* dir.c */ 55/* dir.c */
56extern struct inode_operations bfs_dir_inops; 56extern struct inode_operations bfs_dir_inops;
57extern struct file_operations bfs_dir_operations; 57extern const struct file_operations bfs_dir_operations;
58 58
59#endif /* _FS_BFS_BFS_H */ 59#endif /* _FS_BFS_BFS_H */
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 5af928fa0449..26fad9621738 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -70,7 +70,7 @@ static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir)
70 return 0; 70 return 0;
71} 71}
72 72
73struct file_operations bfs_dir_operations = { 73const struct file_operations bfs_dir_operations = {
74 .read = generic_read_dir, 74 .read = generic_read_dir,
75 .readdir = bfs_readdir, 75 .readdir = bfs_readdir,
76 .fsync = file_fsync, 76 .fsync = file_fsync,
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 807723b65daf..d83cd74a2e4e 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -17,7 +17,7 @@
17#define dprintf(x...) 17#define dprintf(x...)
18#endif 18#endif
19 19
20struct file_operations bfs_file_operations = { 20const struct file_operations bfs_file_operations = {
21 .llseek = generic_file_llseek, 21 .llseek = generic_file_llseek,
22 .read = generic_file_read, 22 .read = generic_file_read,
23 .write = generic_file_write, 23 .write = generic_file_write,
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 6a7b730c206b..d73d75591a39 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -600,7 +600,7 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,
600 return count; 600 return count;
601} 601}
602 602
603static struct file_operations bm_entry_operations = { 603static const struct file_operations bm_entry_operations = {
604 .read = bm_entry_read, 604 .read = bm_entry_read,
605 .write = bm_entry_write, 605 .write = bm_entry_write,
606}; 606};
@@ -668,7 +668,7 @@ out:
668 return count; 668 return count;
669} 669}
670 670
671static struct file_operations bm_register_operations = { 671static const struct file_operations bm_register_operations = {
672 .write = bm_register_write, 672 .write = bm_register_write,
673}; 673};
674 674
@@ -715,7 +715,7 @@ static ssize_t bm_status_write(struct file * file, const char __user * buffer,
715 return count; 715 return count;
716} 716}
717 717
718static struct file_operations bm_status_operations = { 718static const struct file_operations bm_status_operations = {
719 .read = bm_status_read, 719 .read = bm_status_read,
720 .write = bm_status_write, 720 .write = bm_status_write,
721}; 721};
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 17c76182f389..af88c43043d5 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1087,7 +1087,7 @@ struct address_space_operations def_blk_aops = {
1087 .direct_IO = blkdev_direct_IO, 1087 .direct_IO = blkdev_direct_IO,
1088}; 1088};
1089 1089
1090struct file_operations def_blk_fops = { 1090const struct file_operations def_blk_fops = {
1091 .open = blkdev_open, 1091 .open = blkdev_open,
1092 .release = blkdev_close, 1092 .release = blkdev_close,
1093 .llseek = block_llseek, 1093 .llseek = block_llseek,
diff --git a/fs/char_dev.c b/fs/char_dev.c
index 8c6eb04d31e2..4e1b849f912f 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -250,7 +250,7 @@ int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count,
250} 250}
251 251
252int register_chrdev(unsigned int major, const char *name, 252int register_chrdev(unsigned int major, const char *name,
253 struct file_operations *fops) 253 const struct file_operations *fops)
254{ 254{
255 struct char_device_struct *cd; 255 struct char_device_struct *cd;
256 struct cdev *cdev; 256 struct cdev *cdev;
@@ -406,7 +406,7 @@ static void cdev_purge(struct cdev *cdev)
406 * is contain the open that then fills in the correct operations 406 * is contain the open that then fills in the correct operations
407 * depending on the special file... 407 * depending on the special file...
408 */ 408 */
409struct file_operations def_chr_fops = { 409const struct file_operations def_chr_fops = {
410 .open = chrdev_open, 410 .open = chrdev_open,
411}; 411};
412 412
@@ -473,7 +473,7 @@ struct cdev *cdev_alloc(void)
473 return p; 473 return p;
474} 474}
475 475
476void cdev_init(struct cdev *cdev, struct file_operations *fops) 476void cdev_init(struct cdev *cdev, const struct file_operations *fops)
477{ 477{
478 memset(cdev, 0, sizeof *cdev); 478 memset(cdev, 0, sizeof *cdev);
479 INIT_LIST_HEAD(&cdev->list); 479 INIT_LIST_HEAD(&cdev->list);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 6b99b51d6694..4bbc544857bc 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -583,7 +583,7 @@ struct inode_operations cifs_symlink_inode_ops = {
583#endif 583#endif
584}; 584};
585 585
586struct file_operations cifs_file_ops = { 586const struct file_operations cifs_file_ops = {
587 .read = do_sync_read, 587 .read = do_sync_read,
588 .write = do_sync_write, 588 .write = do_sync_write,
589 .readv = generic_file_readv, 589 .readv = generic_file_readv,
@@ -607,7 +607,7 @@ struct file_operations cifs_file_ops = {
607#endif /* CONFIG_CIFS_EXPERIMENTAL */ 607#endif /* CONFIG_CIFS_EXPERIMENTAL */
608}; 608};
609 609
610struct file_operations cifs_file_direct_ops = { 610const struct file_operations cifs_file_direct_ops = {
611 /* no mmap, no aio, no readv - 611 /* no mmap, no aio, no readv -
612 BB reevaluate whether they can be done with directio, no cache */ 612 BB reevaluate whether they can be done with directio, no cache */
613 .read = cifs_user_read, 613 .read = cifs_user_read,
@@ -626,7 +626,7 @@ struct file_operations cifs_file_direct_ops = {
626 .dir_notify = cifs_dir_notify, 626 .dir_notify = cifs_dir_notify,
627#endif /* CONFIG_CIFS_EXPERIMENTAL */ 627#endif /* CONFIG_CIFS_EXPERIMENTAL */
628}; 628};
629struct file_operations cifs_file_nobrl_ops = { 629const struct file_operations cifs_file_nobrl_ops = {
630 .read = do_sync_read, 630 .read = do_sync_read,
631 .write = do_sync_write, 631 .write = do_sync_write,
632 .readv = generic_file_readv, 632 .readv = generic_file_readv,
@@ -649,7 +649,7 @@ struct file_operations cifs_file_nobrl_ops = {
649#endif /* CONFIG_CIFS_EXPERIMENTAL */ 649#endif /* CONFIG_CIFS_EXPERIMENTAL */
650}; 650};
651 651
652struct file_operations cifs_file_direct_nobrl_ops = { 652const struct file_operations cifs_file_direct_nobrl_ops = {
653 /* no mmap, no aio, no readv - 653 /* no mmap, no aio, no readv -
654 BB reevaluate whether they can be done with directio, no cache */ 654 BB reevaluate whether they can be done with directio, no cache */
655 .read = cifs_user_read, 655 .read = cifs_user_read,
@@ -668,7 +668,7 @@ struct file_operations cifs_file_direct_nobrl_ops = {
668#endif /* CONFIG_CIFS_EXPERIMENTAL */ 668#endif /* CONFIG_CIFS_EXPERIMENTAL */
669}; 669};
670 670
671struct file_operations cifs_dir_ops = { 671const struct file_operations cifs_dir_ops = {
672 .readdir = cifs_readdir, 672 .readdir = cifs_readdir,
673 .release = cifs_closedir, 673 .release = cifs_closedir,
674 .read = generic_read_dir, 674 .read = generic_read_dir,
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 821a8eb22559..74f405ae4da3 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -61,10 +61,10 @@ extern struct inode_operations cifs_file_inode_ops;
61extern struct inode_operations cifs_symlink_inode_ops; 61extern struct inode_operations cifs_symlink_inode_ops;
62 62
63/* Functions related to files and directories */ 63/* Functions related to files and directories */
64extern struct file_operations cifs_file_ops; 64extern const struct file_operations cifs_file_ops;
65extern struct file_operations cifs_file_direct_ops; /* if directio mount */ 65extern const struct file_operations cifs_file_direct_ops; /* if directio mount */
66extern struct file_operations cifs_file_nobrl_ops; 66extern const struct file_operations cifs_file_nobrl_ops;
67extern struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */ 67extern const struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
68extern int cifs_open(struct inode *inode, struct file *file); 68extern int cifs_open(struct inode *inode, struct file *file);
69extern int cifs_close(struct inode *inode, struct file *file); 69extern int cifs_close(struct inode *inode, struct file *file);
70extern int cifs_closedir(struct inode *inode, struct file *file); 70extern int cifs_closedir(struct inode *inode, struct file *file);
@@ -76,7 +76,7 @@ extern int cifs_lock(struct file *, int, struct file_lock *);
76extern int cifs_fsync(struct file *, struct dentry *, int); 76extern int cifs_fsync(struct file *, struct dentry *, int);
77extern int cifs_flush(struct file *); 77extern int cifs_flush(struct file *);
78extern int cifs_file_mmap(struct file * , struct vm_area_struct *); 78extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
79extern struct file_operations cifs_dir_ops; 79extern const struct file_operations cifs_dir_ops;
80extern int cifs_dir_open(struct inode *inode, struct file *file); 80extern int cifs_dir_open(struct inode *inode, struct file *file);
81extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir); 81extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir);
82extern int cifs_dir_notify(struct file *, unsigned long arg); 82extern int cifs_dir_notify(struct file *, unsigned long arg);
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 54f76de8a686..71f2ea632e53 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -82,7 +82,7 @@ struct inode_operations coda_dir_inode_operations =
82 .setattr = coda_setattr, 82 .setattr = coda_setattr,
83}; 83};
84 84
85struct file_operations coda_dir_operations = { 85const struct file_operations coda_dir_operations = {
86 .llseek = generic_file_llseek, 86 .llseek = generic_file_llseek,
87 .read = generic_read_dir, 87 .read = generic_read_dir,
88 .readdir = coda_readdir, 88 .readdir = coda_readdir,
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 146a991d6eb5..7c2642431fa5 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -288,7 +288,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
288 return err; 288 return err;
289} 289}
290 290
291struct file_operations coda_file_operations = { 291const struct file_operations coda_file_operations = {
292 .llseek = generic_file_llseek, 292 .llseek = generic_file_llseek,
293 .read = coda_file_read, 293 .read = coda_file_read,
294 .write = coda_file_write, 294 .write = coda_file_write,
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 127714936c66..214822be87bd 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -36,7 +36,7 @@ struct inode_operations coda_ioctl_inode_operations =
36 .setattr = coda_setattr, 36 .setattr = coda_setattr,
37}; 37};
38 38
39struct file_operations coda_ioctl_operations = { 39const struct file_operations coda_ioctl_operations = {
40 .owner = THIS_MODULE, 40 .owner = THIS_MODULE,
41 .ioctl = coda_pioctl, 41 .ioctl = coda_pioctl,
42}; 42};
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 98c74fe2e139..6c6771db36da 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -342,7 +342,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
342} 342}
343 343
344 344
345static struct file_operations coda_psdev_fops = { 345static const struct file_operations coda_psdev_fops = {
346 .owner = THIS_MODULE, 346 .owner = THIS_MODULE,
347 .read = coda_psdev_read, 347 .read = coda_psdev_read,
348 .write = coda_psdev_write, 348 .write = coda_psdev_write,
diff --git a/fs/compat.c b/fs/compat.c
index ef5a0771592d..7f8e26ea427c 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1639,15 +1639,6 @@ void compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
1639 * This is a virtual copy of sys_select from fs/select.c and probably 1639 * This is a virtual copy of sys_select from fs/select.c and probably
1640 * should be compared to it from time to time 1640 * should be compared to it from time to time
1641 */ 1641 */
1642static void *select_bits_alloc(int size)
1643{
1644 return kmalloc(6 * size, GFP_KERNEL);
1645}
1646
1647static void select_bits_free(void *bits, int size)
1648{
1649 kfree(bits);
1650}
1651 1642
1652/* 1643/*
1653 * We can actually return ERESTARTSYS instead of EINTR, but I'd 1644 * We can actually return ERESTARTSYS instead of EINTR, but I'd
@@ -1686,7 +1677,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1686 */ 1677 */
1687 ret = -ENOMEM; 1678 ret = -ENOMEM;
1688 size = FDS_BYTES(n); 1679 size = FDS_BYTES(n);
1689 bits = select_bits_alloc(size); 1680 bits = kmalloc(6 * size, GFP_KERNEL);
1690 if (!bits) 1681 if (!bits)
1691 goto out_nofds; 1682 goto out_nofds;
1692 fds.in = (unsigned long *) bits; 1683 fds.in = (unsigned long *) bits;
@@ -1720,7 +1711,7 @@ int compat_core_sys_select(int n, compat_ulong_t __user *inp,
1720 compat_set_fd_set(n, exp, fds.res_ex); 1711 compat_set_fd_set(n, exp, fds.res_ex);
1721 1712
1722out: 1713out:
1723 select_bits_free(bits, size); 1714 kfree(bits);
1724out_nofds: 1715out_nofds:
1725 return ret; 1716 return ret;
1726} 1717}
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h
index f70e46951b37..3f4ff7a242b9 100644
--- a/fs/configfs/configfs_internal.h
+++ b/fs/configfs/configfs_internal.h
@@ -72,9 +72,9 @@ extern void configfs_release_fs(void);
72 72
73extern struct rw_semaphore configfs_rename_sem; 73extern struct rw_semaphore configfs_rename_sem;
74extern struct super_block * configfs_sb; 74extern struct super_block * configfs_sb;
75extern struct file_operations configfs_dir_operations; 75extern const struct file_operations configfs_dir_operations;
76extern struct file_operations configfs_file_operations; 76extern const struct file_operations configfs_file_operations;
77extern struct file_operations bin_fops; 77extern const struct file_operations bin_fops;
78extern struct inode_operations configfs_dir_inode_operations; 78extern struct inode_operations configfs_dir_inode_operations;
79extern struct inode_operations configfs_symlink_inode_operations; 79extern struct inode_operations configfs_symlink_inode_operations;
80 80
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index ca60e3abef45..8ed9b06a9828 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1027,7 +1027,7 @@ static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin)
1027 return offset; 1027 return offset;
1028} 1028}
1029 1029
1030struct file_operations configfs_dir_operations = { 1030const struct file_operations configfs_dir_operations = {
1031 .open = configfs_dir_open, 1031 .open = configfs_dir_open,
1032 .release = configfs_dir_close, 1032 .release = configfs_dir_close,
1033 .llseek = configfs_dir_lseek, 1033 .llseek = configfs_dir_lseek,
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 3921920d8716..f499803743e0 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -322,7 +322,7 @@ static int configfs_release(struct inode * inode, struct file * filp)
322 return 0; 322 return 0;
323} 323}
324 324
325struct file_operations configfs_file_operations = { 325const struct file_operations configfs_file_operations = {
326 .read = configfs_read_file, 326 .read = configfs_read_file,
327 .write = configfs_write_file, 327 .write = configfs_write_file,
328 .llseek = generic_file_llseek, 328 .llseek = generic_file_llseek,
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index acc1b2c10a86..9efcc3a164e8 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -29,7 +29,7 @@
29 29
30static struct super_operations cramfs_ops; 30static struct super_operations cramfs_ops;
31static struct inode_operations cramfs_dir_inode_operations; 31static struct inode_operations cramfs_dir_inode_operations;
32static struct file_operations cramfs_directory_operations; 32static const struct file_operations cramfs_directory_operations;
33static struct address_space_operations cramfs_aops; 33static struct address_space_operations cramfs_aops;
34 34
35static DEFINE_MUTEX(read_mutex); 35static DEFINE_MUTEX(read_mutex);
@@ -512,7 +512,7 @@ static struct address_space_operations cramfs_aops = {
512/* 512/*
513 * A directory can only readdir 513 * A directory can only readdir
514 */ 514 */
515static struct file_operations cramfs_directory_operations = { 515static const struct file_operations cramfs_directory_operations = {
516 .llseek = generic_file_llseek, 516 .llseek = generic_file_llseek,
517 .read = generic_read_dir, 517 .read = generic_read_dir,
518 .readdir = cramfs_readdir, 518 .readdir = cramfs_readdir,
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index 40c4fc973fad..66a505422e5c 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -39,7 +39,7 @@ static int default_open(struct inode *inode, struct file *file)
39 return 0; 39 return 0;
40} 40}
41 41
42struct file_operations debugfs_file_operations = { 42const struct file_operations debugfs_file_operations = {
43 .read = default_read_file, 43 .read = default_read_file,
44 .write = default_write_file, 44 .write = default_write_file,
45 .open = default_open, 45 .open = default_open,
@@ -213,7 +213,7 @@ static ssize_t write_file_bool(struct file *file, const char __user *user_buf,
213 return count; 213 return count;
214} 214}
215 215
216static struct file_operations fops_bool = { 216static const struct file_operations fops_bool = {
217 .read = read_file_bool, 217 .read = read_file_bool,
218 .write = write_file_bool, 218 .write = write_file_bool,
219 .open = default_open, 219 .open = default_open,
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index d4f1a2cddd47..85d166cdcae4 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -191,7 +191,7 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
191 */ 191 */
192struct dentry *debugfs_create_file(const char *name, mode_t mode, 192struct dentry *debugfs_create_file(const char *name, mode_t mode,
193 struct dentry *parent, void *data, 193 struct dentry *parent, void *data,
194 struct file_operations *fops) 194 const struct file_operations *fops)
195{ 195{
196 struct dentry *dentry = NULL; 196 struct dentry *dentry = NULL;
197 int error; 197 int error;
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
index b621521e09d4..52f5059c4f31 100644
--- a/fs/devfs/base.c
+++ b/fs/devfs/base.c
@@ -856,14 +856,14 @@ static int devfsd_close(struct inode *inode, struct file *file);
856#ifdef CONFIG_DEVFS_DEBUG 856#ifdef CONFIG_DEVFS_DEBUG
857static ssize_t stat_read(struct file *file, char __user *buf, size_t len, 857static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
858 loff_t * ppos); 858 loff_t * ppos);
859static struct file_operations stat_fops = { 859static const struct file_operations stat_fops = {
860 .open = nonseekable_open, 860 .open = nonseekable_open,
861 .read = stat_read, 861 .read = stat_read,
862}; 862};
863#endif 863#endif
864 864
865/* Devfs daemon file operations */ 865/* Devfs daemon file operations */
866static struct file_operations devfsd_fops = { 866static const struct file_operations devfsd_fops = {
867 .open = nonseekable_open, 867 .open = nonseekable_open,
868 .read = devfsd_read, 868 .read = devfsd_read,
869 .ioctl = devfsd_ioctl, 869 .ioctl = devfsd_ioctl,
@@ -1842,8 +1842,8 @@ static int try_modload(struct devfs_entry *parent, struct fs_info *fs_info,
1842 1842
1843static struct inode_operations devfs_iops; 1843static struct inode_operations devfs_iops;
1844static struct inode_operations devfs_dir_iops; 1844static struct inode_operations devfs_dir_iops;
1845static struct file_operations devfs_fops; 1845static const struct file_operations devfs_fops;
1846static struct file_operations devfs_dir_fops; 1846static const struct file_operations devfs_dir_fops;
1847static struct inode_operations devfs_symlink_iops; 1847static struct inode_operations devfs_symlink_iops;
1848 1848
1849static int devfs_notify_change(struct dentry *dentry, struct iattr *iattr) 1849static int devfs_notify_change(struct dentry *dentry, struct iattr *iattr)
@@ -2061,11 +2061,11 @@ static int devfs_open(struct inode *inode, struct file *file)
2061 return err; 2061 return err;
2062} /* End Function devfs_open */ 2062} /* End Function devfs_open */
2063 2063
2064static struct file_operations devfs_fops = { 2064static const struct file_operations devfs_fops = {
2065 .open = devfs_open, 2065 .open = devfs_open,
2066}; 2066};
2067 2067
2068static struct file_operations devfs_dir_fops = { 2068static const struct file_operations devfs_dir_fops = {
2069 .read = generic_read_dir, 2069 .read = generic_read_dir,
2070 .readdir = devfs_readdir, 2070 .readdir = devfs_readdir,
2071}; 2071};
diff --git a/fs/efs/dir.c b/fs/efs/dir.c
index 777c614ff360..17f5b2d3c16a 100644
--- a/fs/efs/dir.c
+++ b/fs/efs/dir.c
@@ -10,7 +10,7 @@
10 10
11static int efs_readdir(struct file *, void *, filldir_t); 11static int efs_readdir(struct file *, void *, filldir_t);
12 12
13struct file_operations efs_dir_operations = { 13const struct file_operations efs_dir_operations = {
14 .read = generic_read_dir, 14 .read = generic_read_dir,
15 .readdir = efs_readdir, 15 .readdir = efs_readdir,
16}; 16};
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index e067a06c6464..242fe1a66ce5 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -290,7 +290,7 @@ static kmem_cache_t *pwq_cache __read_mostly;
290static struct vfsmount *eventpoll_mnt __read_mostly; 290static struct vfsmount *eventpoll_mnt __read_mostly;
291 291
292/* File callbacks that implement the eventpoll file behaviour */ 292/* File callbacks that implement the eventpoll file behaviour */
293static struct file_operations eventpoll_fops = { 293static const struct file_operations eventpoll_fops = {
294 .release = ep_eventpoll_close, 294 .release = ep_eventpoll_close,
295 .poll = ep_eventpoll_poll 295 .poll = ep_eventpoll_poll
296}; 296};
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 0165388c425c..d672aa9f4061 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -658,7 +658,7 @@ not_empty:
658 return 0; 658 return 0;
659} 659}
660 660
661struct file_operations ext2_dir_operations = { 661const struct file_operations ext2_dir_operations = {
662 .llseek = generic_file_llseek, 662 .llseek = generic_file_llseek,
663 .read = generic_read_dir, 663 .read = generic_read_dir,
664 .readdir = ext2_readdir, 664 .readdir = ext2_readdir,
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 11035ac7986f..9f74a62be555 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -154,12 +154,12 @@ extern void ext2_write_super (struct super_block *);
154 */ 154 */
155 155
156/* dir.c */ 156/* dir.c */
157extern struct file_operations ext2_dir_operations; 157extern const struct file_operations ext2_dir_operations;
158 158
159/* file.c */ 159/* file.c */
160extern struct inode_operations ext2_file_inode_operations; 160extern struct inode_operations ext2_file_inode_operations;
161extern struct file_operations ext2_file_operations; 161extern const struct file_operations ext2_file_operations;
162extern struct file_operations ext2_xip_file_operations; 162extern const struct file_operations ext2_xip_file_operations;
163 163
164/* inode.c */ 164/* inode.c */
165extern struct address_space_operations ext2_aops; 165extern struct address_space_operations ext2_aops;
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index a484412fc782..509cceca04db 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -39,7 +39,7 @@ static int ext2_release_file (struct inode * inode, struct file * filp)
39 * We have mostly NULL's here: the current defaults are ok for 39 * We have mostly NULL's here: the current defaults are ok for
40 * the ext2 filesystem. 40 * the ext2 filesystem.
41 */ 41 */
42struct file_operations ext2_file_operations = { 42const struct file_operations ext2_file_operations = {
43 .llseek = generic_file_llseek, 43 .llseek = generic_file_llseek,
44 .read = generic_file_read, 44 .read = generic_file_read,
45 .write = generic_file_write, 45 .write = generic_file_write,
@@ -56,7 +56,7 @@ struct file_operations ext2_file_operations = {
56}; 56};
57 57
58#ifdef CONFIG_EXT2_FS_XIP 58#ifdef CONFIG_EXT2_FS_XIP
59struct file_operations ext2_xip_file_operations = { 59const struct file_operations ext2_xip_file_operations = {
60 .llseek = generic_file_llseek, 60 .llseek = generic_file_llseek,
61 .read = xip_file_read, 61 .read = xip_file_read,
62 .write = xip_file_write, 62 .write = xip_file_write,
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c
index 38bd3f6ec147..f37528ed222e 100644
--- a/fs/ext3/dir.c
+++ b/fs/ext3/dir.c
@@ -39,7 +39,7 @@ static int ext3_dx_readdir(struct file * filp,
39static int ext3_release_dir (struct inode * inode, 39static int ext3_release_dir (struct inode * inode,
40 struct file * filp); 40 struct file * filp);
41 41
42struct file_operations ext3_dir_operations = { 42const struct file_operations ext3_dir_operations = {
43 .llseek = generic_file_llseek, 43 .llseek = generic_file_llseek,
44 .read = generic_read_dir, 44 .read = generic_read_dir,
45 .readdir = ext3_readdir, /* we take BKL. needed?*/ 45 .readdir = ext3_readdir, /* we take BKL. needed?*/
diff --git a/fs/ext3/file.c b/fs/ext3/file.c
index 59098ea56711..783a796220bb 100644
--- a/fs/ext3/file.c
+++ b/fs/ext3/file.c
@@ -105,7 +105,7 @@ force_commit:
105 return ret; 105 return ret;
106} 106}
107 107
108struct file_operations ext3_file_operations = { 108const struct file_operations ext3_file_operations = {
109 .llseek = generic_file_llseek, 109 .llseek = generic_file_llseek,
110 .read = do_sync_read, 110 .read = do_sync_read,
111 .write = do_sync_write, 111 .write = do_sync_write,
diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 4095bc149eb1..698b85bb1dd4 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -741,7 +741,7 @@ static int fat_dir_ioctl(struct inode * inode, struct file * filp,
741 return ret; 741 return ret;
742} 742}
743 743
744struct file_operations fat_dir_operations = { 744const struct file_operations fat_dir_operations = {
745 .read = generic_read_dir, 745 .read = generic_read_dir,
746 .readdir = fat_readdir, 746 .readdir = fat_readdir,
747 .ioctl = fat_dir_ioctl, 747 .ioctl = fat_dir_ioctl,
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 88aa1ae13f9f..1ee25232e6af 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -112,7 +112,7 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp,
112 } 112 }
113} 113}
114 114
115struct file_operations fat_file_operations = { 115const struct file_operations fat_file_operations = {
116 .llseek = generic_file_llseek, 116 .llseek = generic_file_llseek,
117 .read = do_sync_read, 117 .read = do_sync_read,
118 .write = do_sync_write, 118 .write = do_sync_write,
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 404bfc9f7385..c1ce284f8a94 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1435,9 +1435,6 @@ out_fail:
1435 1435
1436EXPORT_SYMBOL_GPL(fat_fill_super); 1436EXPORT_SYMBOL_GPL(fat_fill_super);
1437 1437
1438int __init fat_cache_init(void);
1439void fat_cache_destroy(void);
1440
1441static int __init init_fat_fs(void) 1438static int __init init_fat_fs(void)
1442{ 1439{
1443 int err; 1440 int err;
diff --git a/fs/fifo.c b/fs/fifo.c
index d13fcd3ec803..889f722ee36d 100644
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -145,6 +145,6 @@ err_nocleanup:
145 * is contain the open that then fills in the correct operations 145 * is contain the open that then fills in the correct operations
146 * depending on the access mode of the file... 146 * depending on the access mode of the file...
147 */ 147 */
148struct file_operations def_fifo_fops = { 148const struct file_operations def_fifo_fops = {
149 .open = fifo_open, /* will set read or write pipe_fops */ 149 .open = fifo_open, /* will set read or write pipe_fops */
150}; 150};
diff --git a/fs/file.c b/fs/file.c
index bbc743314730..55f4e7022563 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -373,6 +373,6 @@ static void __devinit fdtable_defer_list_init(int cpu)
373void __init files_defer_init(void) 373void __init files_defer_init(void)
374{ 374{
375 int i; 375 int i;
376 for_each_cpu(i) 376 for_each_possible_cpu(i)
377 fdtable_defer_list_init(i); 377 fdtable_defer_list_init(i);
378} 378}
diff --git a/fs/freevxfs/vxfs_extern.h b/fs/freevxfs/vxfs_extern.h
index 927acf70c591..1cf1fe8466a2 100644
--- a/fs/freevxfs/vxfs_extern.h
+++ b/fs/freevxfs/vxfs_extern.h
@@ -63,7 +63,7 @@ extern void vxfs_clear_inode(struct inode *);
63 63
64/* vxfs_lookup.c */ 64/* vxfs_lookup.c */
65extern struct inode_operations vxfs_dir_inode_ops; 65extern struct inode_operations vxfs_dir_inode_ops;
66extern struct file_operations vxfs_dir_operations; 66extern const struct file_operations vxfs_dir_operations;
67 67
68/* vxfs_olt.c */ 68/* vxfs_olt.c */
69extern int vxfs_read_olt(struct super_block *, u_long); 69extern int vxfs_read_olt(struct super_block *, u_long);
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
index 554eb455722c..29cce456c7ce 100644
--- a/fs/freevxfs/vxfs_lookup.c
+++ b/fs/freevxfs/vxfs_lookup.c
@@ -56,7 +56,7 @@ struct inode_operations vxfs_dir_inode_ops = {
56 .lookup = vxfs_lookup, 56 .lookup = vxfs_lookup,
57}; 57};
58 58
59struct file_operations vxfs_dir_operations = { 59const struct file_operations vxfs_dir_operations = {
60 .readdir = vxfs_readdir, 60 .readdir = vxfs_readdir,
61}; 61};
62 62
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 0c9a2ee54c91..23d1f52eb1b8 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -922,7 +922,7 @@ static int fuse_dev_release(struct inode *inode, struct file *file)
922 return 0; 922 return 0;
923} 923}
924 924
925struct file_operations fuse_dev_operations = { 925const struct file_operations fuse_dev_operations = {
926 .owner = THIS_MODULE, 926 .owner = THIS_MODULE,
927 .llseek = no_llseek, 927 .llseek = no_llseek,
928 .read = fuse_dev_read, 928 .read = fuse_dev_read,
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index c72a8a97935c..256355b80256 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1170,7 +1170,7 @@ static struct inode_operations fuse_dir_inode_operations = {
1170 .removexattr = fuse_removexattr, 1170 .removexattr = fuse_removexattr,
1171}; 1171};
1172 1172
1173static struct file_operations fuse_dir_operations = { 1173static const struct file_operations fuse_dir_operations = {
1174 .llseek = generic_file_llseek, 1174 .llseek = generic_file_llseek,
1175 .read = generic_read_dir, 1175 .read = generic_read_dir,
1176 .readdir = fuse_readdir, 1176 .readdir = fuse_readdir,
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6f05379b0a0d..975f2697e866 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -12,7 +12,7 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14 14
15static struct file_operations fuse_direct_io_file_operations; 15static const struct file_operations fuse_direct_io_file_operations;
16 16
17static int fuse_send_open(struct inode *inode, struct file *file, int isdir, 17static int fuse_send_open(struct inode *inode, struct file *file, int isdir,
18 struct fuse_open_out *outargp) 18 struct fuse_open_out *outargp)
@@ -611,7 +611,7 @@ static int fuse_set_page_dirty(struct page *page)
611 return 0; 611 return 0;
612} 612}
613 613
614static struct file_operations fuse_file_operations = { 614static const struct file_operations fuse_file_operations = {
615 .llseek = generic_file_llseek, 615 .llseek = generic_file_llseek,
616 .read = generic_file_read, 616 .read = generic_file_read,
617 .write = generic_file_write, 617 .write = generic_file_write,
@@ -623,7 +623,7 @@ static struct file_operations fuse_file_operations = {
623 .sendfile = generic_file_sendfile, 623 .sendfile = generic_file_sendfile,
624}; 624};
625 625
626static struct file_operations fuse_direct_io_file_operations = { 626static const struct file_operations fuse_direct_io_file_operations = {
627 .llseek = generic_file_llseek, 627 .llseek = generic_file_llseek,
628 .read = fuse_direct_read, 628 .read = fuse_direct_read,
629 .write = fuse_direct_write, 629 .write = fuse_direct_write,
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 4a83adfec968..a16a04fcf41e 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -346,7 +346,7 @@ static inline u64 get_node_id(struct inode *inode)
346} 346}
347 347
348/** Device operations */ 348/** Device operations */
349extern struct file_operations fuse_dev_operations; 349extern const struct file_operations fuse_dev_operations;
350 350
351/** 351/**
352 * This is the single global spinlock which protects FUSE's structures 352 * This is the single global spinlock which protects FUSE's structures
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 534e5a7480ef..7cd8cc03aea7 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -313,7 +313,7 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry,
313 return res; 313 return res;
314} 314}
315 315
316struct file_operations hfs_dir_operations = { 316const struct file_operations hfs_dir_operations = {
317 .read = generic_read_dir, 317 .read = generic_read_dir,
318 .readdir = hfs_readdir, 318 .readdir = hfs_readdir,
319 .llseek = generic_file_llseek, 319 .llseek = generic_file_llseek,
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h
index 18ce47ab1b71..3ed8663a8db1 100644
--- a/fs/hfs/hfs_fs.h
+++ b/fs/hfs/hfs_fs.h
@@ -169,7 +169,7 @@ extern int hfs_cat_move(u32, struct inode *, struct qstr *,
169extern void hfs_cat_build_key(struct super_block *, btree_key *, u32, struct qstr *); 169extern void hfs_cat_build_key(struct super_block *, btree_key *, u32, struct qstr *);
170 170
171/* dir.c */ 171/* dir.c */
172extern struct file_operations hfs_dir_operations; 172extern const struct file_operations hfs_dir_operations;
173extern struct inode_operations hfs_dir_inode_operations; 173extern struct inode_operations hfs_dir_inode_operations;
174 174
175/* extent.c */ 175/* extent.c */
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 2c564701724f..2d4ced22201b 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -17,7 +17,7 @@
17#include "hfs_fs.h" 17#include "hfs_fs.h"
18#include "btree.h" 18#include "btree.h"
19 19
20static struct file_operations hfs_file_operations; 20static const struct file_operations hfs_file_operations;
21static struct inode_operations hfs_file_inode_operations; 21static struct inode_operations hfs_file_inode_operations;
22 22
23/*================ Variable-like macros ================*/ 23/*================ Variable-like macros ================*/
@@ -601,7 +601,7 @@ int hfs_inode_setattr(struct dentry *dentry, struct iattr * attr)
601} 601}
602 602
603 603
604static struct file_operations hfs_file_operations = { 604static const struct file_operations hfs_file_operations = {
605 .llseek = generic_file_llseek, 605 .llseek = generic_file_llseek,
606 .read = generic_file_read, 606 .read = generic_file_read,
607 .write = generic_file_write, 607 .write = generic_file_write,
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 01a6fe3a395c..1f9ece0de326 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -483,7 +483,7 @@ struct inode_operations hfsplus_dir_inode_operations = {
483 .rename = hfsplus_rename, 483 .rename = hfsplus_rename,
484}; 484};
485 485
486struct file_operations hfsplus_dir_operations = { 486const struct file_operations hfsplus_dir_operations = {
487 .read = generic_read_dir, 487 .read = generic_read_dir,
488 .readdir = hfsplus_readdir, 488 .readdir = hfsplus_readdir,
489 .ioctl = hfsplus_ioctl, 489 .ioctl = hfsplus_ioctl,
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 9fbe4d2aeece..acf66dba3e01 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -280,7 +280,7 @@ static struct inode_operations hfsplus_file_inode_operations = {
280 .listxattr = hfsplus_listxattr, 280 .listxattr = hfsplus_listxattr,
281}; 281};
282 282
283static struct file_operations hfsplus_file_operations = { 283static const struct file_operations hfsplus_file_operations = {
284 .llseek = generic_file_llseek, 284 .llseek = generic_file_llseek,
285 .read = generic_file_read, 285 .read = generic_file_read,
286 .write = generic_file_write, 286 .write = generic_file_write,
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index b3ad0bd0312f..bf0f8e16e433 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -384,7 +384,7 @@ int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync)
384 return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync); 384 return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync);
385} 385}
386 386
387static struct file_operations hostfs_file_fops = { 387static const struct file_operations hostfs_file_fops = {
388 .llseek = generic_file_llseek, 388 .llseek = generic_file_llseek,
389 .read = generic_file_read, 389 .read = generic_file_read,
390 .sendfile = generic_file_sendfile, 390 .sendfile = generic_file_sendfile,
@@ -399,7 +399,7 @@ static struct file_operations hostfs_file_fops = {
399 .fsync = hostfs_fsync, 399 .fsync = hostfs_fsync,
400}; 400};
401 401
402static struct file_operations hostfs_dir_fops = { 402static const struct file_operations hostfs_dir_fops = {
403 .llseek = generic_file_llseek, 403 .llseek = generic_file_llseek,
404 .readdir = hostfs_readdir, 404 .readdir = hostfs_readdir,
405 .read = generic_read_dir, 405 .read = generic_read_dir,
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index 5591f9623aa2..ecc9180645ae 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -310,7 +310,7 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
310 return ERR_PTR(-ENOENT); 310 return ERR_PTR(-ENOENT);
311} 311}
312 312
313struct file_operations hpfs_dir_ops = 313const struct file_operations hpfs_dir_ops =
314{ 314{
315 .llseek = hpfs_dir_lseek, 315 .llseek = hpfs_dir_lseek,
316 .read = generic_read_dir, 316 .read = generic_read_dir,
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 7c995ac4081b..d3b9fffe45a1 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -119,7 +119,7 @@ static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
119 return retval; 119 return retval;
120} 120}
121 121
122struct file_operations hpfs_file_ops = 122const struct file_operations hpfs_file_ops =
123{ 123{
124 .llseek = generic_file_llseek, 124 .llseek = generic_file_llseek,
125 .read = generic_file_read, 125 .read = generic_file_read,
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index 4c6473ab3b34..29b7a3e55173 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -240,7 +240,7 @@ void hpfs_set_dentry_operations(struct dentry *);
240/* dir.c */ 240/* dir.c */
241 241
242struct dentry *hpfs_lookup(struct inode *, struct dentry *, struct nameidata *); 242struct dentry *hpfs_lookup(struct inode *, struct dentry *, struct nameidata *);
243extern struct file_operations hpfs_dir_ops; 243extern const struct file_operations hpfs_dir_ops;
244 244
245/* dnode.c */ 245/* dnode.c */
246 246
@@ -266,7 +266,7 @@ void hpfs_set_ea(struct inode *, struct fnode *, char *, char *, int);
266/* file.c */ 266/* file.c */
267 267
268int hpfs_file_fsync(struct file *, struct dentry *, int); 268int hpfs_file_fsync(struct file *, struct dentry *, int);
269extern struct file_operations hpfs_file_ops; 269extern const struct file_operations hpfs_file_ops;
270extern struct inode_operations hpfs_file_iops; 270extern struct inode_operations hpfs_file_iops;
271extern struct address_space_operations hpfs_aops; 271extern struct address_space_operations hpfs_aops;
272 272
diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c
index a44dc5897399..2ba20cdb5baa 100644
--- a/fs/hppfs/hppfs_kern.c
+++ b/fs/hppfs/hppfs_kern.c
@@ -558,7 +558,7 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
558 return(default_llseek(file, off, where)); 558 return(default_llseek(file, off, where));
559} 559}
560 560
561static struct file_operations hppfs_file_fops = { 561static const struct file_operations hppfs_file_fops = {
562 .owner = NULL, 562 .owner = NULL,
563 .llseek = hppfs_llseek, 563 .llseek = hppfs_llseek,
564 .read = hppfs_read, 564 .read = hppfs_read,
@@ -609,7 +609,7 @@ static int hppfs_fsync(struct file *file, struct dentry *dentry, int datasync)
609 return(0); 609 return(0);
610} 610}
611 611
612static struct file_operations hppfs_dir_fops = { 612static const struct file_operations hppfs_dir_fops = {
613 .owner = NULL, 613 .owner = NULL,
614 .readdir = hppfs_readdir, 614 .readdir = hppfs_readdir,
615 .open = hppfs_dir_open, 615 .open = hppfs_dir_open,
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 25fa8bba8cb5..3a5b4e923455 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -35,7 +35,7 @@
35 35
36static struct super_operations hugetlbfs_ops; 36static struct super_operations hugetlbfs_ops;
37static struct address_space_operations hugetlbfs_aops; 37static struct address_space_operations hugetlbfs_aops;
38struct file_operations hugetlbfs_file_operations; 38const struct file_operations hugetlbfs_file_operations;
39static struct inode_operations hugetlbfs_dir_inode_operations; 39static struct inode_operations hugetlbfs_dir_inode_operations;
40static struct inode_operations hugetlbfs_inode_operations; 40static struct inode_operations hugetlbfs_inode_operations;
41 41
@@ -566,7 +566,7 @@ static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
566 inode_init_once(&ei->vfs_inode); 566 inode_init_once(&ei->vfs_inode);
567} 567}
568 568
569struct file_operations hugetlbfs_file_operations = { 569const struct file_operations hugetlbfs_file_operations = {
570 .mmap = hugetlbfs_file_mmap, 570 .mmap = hugetlbfs_file_mmap,
571 .fsync = simple_sync_file, 571 .fsync = simple_sync_file,
572 .get_unmapped_area = hugetlb_get_unmapped_area, 572 .get_unmapped_area = hugetlb_get_unmapped_area,
diff --git a/fs/inode.c b/fs/inode.c
index 1fddf2803af8..32b7c3375021 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -104,7 +104,7 @@ static struct inode *alloc_inode(struct super_block *sb)
104{ 104{
105 static struct address_space_operations empty_aops; 105 static struct address_space_operations empty_aops;
106 static struct inode_operations empty_iops; 106 static struct inode_operations empty_iops;
107 static struct file_operations empty_fops; 107 static const struct file_operations empty_fops;
108 struct inode *inode; 108 struct inode *inode;
109 109
110 if (sb->s_op->alloc_inode) 110 if (sb->s_op->alloc_inode)
diff --git a/fs/inotify.c b/fs/inotify.c
index f48a3dae0712..367c487c014b 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -920,7 +920,7 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
920 return ret; 920 return ret;
921} 921}
922 922
923static struct file_operations inotify_fops = { 923static const struct file_operations inotify_fops = {
924 .poll = inotify_poll, 924 .poll = inotify_poll,
925 .read = inotify_read, 925 .read = inotify_read,
926 .release = inotify_release, 926 .release = inotify_release,
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 7901ac9f97ab..5440ea292c69 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -16,7 +16,7 @@
16 16
17static int isofs_readdir(struct file *, void *, filldir_t); 17static int isofs_readdir(struct file *, void *, filldir_t);
18 18
19struct file_operations isofs_dir_operations = 19const struct file_operations isofs_dir_operations =
20{ 20{
21 .read = generic_read_dir, 21 .read = generic_read_dir,
22 .readdir = isofs_readdir, 22 .readdir = isofs_readdir,
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h
index 439a19b1bf3e..b87ba066f5e7 100644
--- a/fs/isofs/isofs.h
+++ b/fs/isofs/isofs.h
@@ -175,6 +175,6 @@ isofs_normalize_block_and_offset(struct iso_directory_record* de,
175} 175}
176 176
177extern struct inode_operations isofs_dir_inode_operations; 177extern struct inode_operations isofs_dir_inode_operations;
178extern struct file_operations isofs_dir_operations; 178extern const struct file_operations isofs_dir_operations;
179extern struct address_space_operations isofs_symlink_aops; 179extern struct address_space_operations isofs_symlink_aops;
180extern struct export_operations isofs_export_ops; 180extern struct export_operations isofs_export_ops;
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 5a4519e834da..020cc097c539 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -55,9 +55,9 @@
55static int jffs_remove(struct inode *dir, struct dentry *dentry, int type); 55static int jffs_remove(struct inode *dir, struct dentry *dentry, int type);
56 56
57static struct super_operations jffs_ops; 57static struct super_operations jffs_ops;
58static struct file_operations jffs_file_operations; 58static const struct file_operations jffs_file_operations;
59static struct inode_operations jffs_file_inode_operations; 59static struct inode_operations jffs_file_inode_operations;
60static struct file_operations jffs_dir_operations; 60static const struct file_operations jffs_dir_operations;
61static struct inode_operations jffs_dir_inode_operations; 61static struct inode_operations jffs_dir_inode_operations;
62static struct address_space_operations jffs_address_operations; 62static struct address_space_operations jffs_address_operations;
63 63
@@ -1629,7 +1629,7 @@ static int jffs_fsync(struct file *f, struct dentry *d, int datasync)
1629} 1629}
1630 1630
1631 1631
1632static struct file_operations jffs_file_operations = 1632static const struct file_operations jffs_file_operations =
1633{ 1633{
1634 .open = generic_file_open, 1634 .open = generic_file_open,
1635 .llseek = generic_file_llseek, 1635 .llseek = generic_file_llseek,
@@ -1649,7 +1649,7 @@ static struct inode_operations jffs_file_inode_operations =
1649}; 1649};
1650 1650
1651 1651
1652static struct file_operations jffs_dir_operations = 1652static const struct file_operations jffs_dir_operations =
1653{ 1653{
1654 .readdir = jffs_readdir, 1654 .readdir = jffs_readdir,
1655}; 1655};
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index a7bf9cb2567f..8bc7a5018e40 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -37,7 +37,7 @@ static int jffs2_mknod (struct inode *,struct dentry *,int,dev_t);
37static int jffs2_rename (struct inode *, struct dentry *, 37static int jffs2_rename (struct inode *, struct dentry *,
38 struct inode *, struct dentry *); 38 struct inode *, struct dentry *);
39 39
40struct file_operations jffs2_dir_operations = 40const struct file_operations jffs2_dir_operations =
41{ 41{
42 .read = generic_read_dir, 42 .read = generic_read_dir,
43 .readdir = jffs2_readdir, 43 .readdir = jffs2_readdir,
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 935f273dc57b..9f4171213e58 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -38,7 +38,7 @@ int jffs2_fsync(struct file *filp, struct dentry *dentry, int datasync)
38 return 0; 38 return 0;
39} 39}
40 40
41struct file_operations jffs2_file_operations = 41const struct file_operations jffs2_file_operations =
42{ 42{
43 .llseek = generic_file_llseek, 43 .llseek = generic_file_llseek,
44 .open = generic_file_open, 44 .open = generic_file_open,
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h
index 59e7a393200c..d307cf548625 100644
--- a/fs/jffs2/os-linux.h
+++ b/fs/jffs2/os-linux.h
@@ -159,11 +159,11 @@ void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c);
159void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c); 159void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c);
160 160
161/* dir.c */ 161/* dir.c */
162extern struct file_operations jffs2_dir_operations; 162extern const struct file_operations jffs2_dir_operations;
163extern struct inode_operations jffs2_dir_inode_operations; 163extern struct inode_operations jffs2_dir_inode_operations;
164 164
165/* file.c */ 165/* file.c */
166extern struct file_operations jffs2_file_operations; 166extern const struct file_operations jffs2_file_operations;
167extern struct inode_operations jffs2_file_inode_operations; 167extern struct inode_operations jffs2_file_inode_operations;
168extern struct address_space_operations jffs2_file_address_operations; 168extern struct address_space_operations jffs2_file_address_operations;
169int jffs2_fsync(struct file *, struct dentry *, int); 169int jffs2_fsync(struct file *, struct dentry *, int);
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index e1ac6e497e2b..1c9745be5ada 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -100,7 +100,7 @@ struct inode_operations jfs_file_inode_operations = {
100#endif 100#endif
101}; 101};
102 102
103struct file_operations jfs_file_operations = { 103const struct file_operations jfs_file_operations = {
104 .open = jfs_open, 104 .open = jfs_open,
105 .llseek = generic_file_llseek, 105 .llseek = generic_file_llseek,
106 .write = generic_file_write, 106 .write = generic_file_write,
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h
index 095d471b9f9a..c30072674464 100644
--- a/fs/jfs/jfs_inode.h
+++ b/fs/jfs/jfs_inode.h
@@ -35,9 +35,9 @@ extern void jfs_set_inode_flags(struct inode *);
35 35
36extern struct address_space_operations jfs_aops; 36extern struct address_space_operations jfs_aops;
37extern struct inode_operations jfs_dir_inode_operations; 37extern struct inode_operations jfs_dir_inode_operations;
38extern struct file_operations jfs_dir_operations; 38extern const struct file_operations jfs_dir_operations;
39extern struct inode_operations jfs_file_inode_operations; 39extern struct inode_operations jfs_file_inode_operations;
40extern struct file_operations jfs_file_operations; 40extern const struct file_operations jfs_file_operations;
41extern struct inode_operations jfs_symlink_inode_operations; 41extern struct inode_operations jfs_symlink_inode_operations;
42extern struct dentry_operations jfs_ci_dentry_operations; 42extern struct dentry_operations jfs_ci_dentry_operations;
43#endif /* _H_JFS_INODE */ 43#endif /* _H_JFS_INODE */
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 309cee575f7d..09ea03f62277 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1519,7 +1519,7 @@ struct inode_operations jfs_dir_inode_operations = {
1519#endif 1519#endif
1520}; 1520};
1521 1521
1522struct file_operations jfs_dir_operations = { 1522const struct file_operations jfs_dir_operations = {
1523 .read = generic_read_dir, 1523 .read = generic_read_dir,
1524 .readdir = jfs_readdir, 1524 .readdir = jfs_readdir,
1525 .fsync = jfs_fsync, 1525 .fsync = jfs_fsync,
diff --git a/fs/libfs.c b/fs/libfs.c
index 4fdeaceb892c..7145ba7a48d0 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -179,7 +179,7 @@ ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t
179 return -EISDIR; 179 return -EISDIR;
180} 180}
181 181
182struct file_operations simple_dir_operations = { 182const struct file_operations simple_dir_operations = {
183 .open = dcache_dir_open, 183 .open = dcache_dir_open,
184 .release = dcache_dir_close, 184 .release = dcache_dir_close,
185 .llseek = dcache_dir_lseek, 185 .llseek = dcache_dir_lseek,
diff --git a/fs/mbcache.c b/fs/mbcache.c
index 73e754fea2d8..e4fde1ab22cd 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -311,7 +311,7 @@ fail:
311/* 311/*
312 * mb_cache_shrink() 312 * mb_cache_shrink()
313 * 313 *
314 * Removes all cache entires of a device from the cache. All cache entries 314 * Removes all cache entries of a device from the cache. All cache entries
315 * currently in use cannot be freed, and thus remain in the cache. All others 315 * currently in use cannot be freed, and thus remain in the cache. All others
316 * are freed. 316 * are freed.
317 * 317 *
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index 732502aabc05..69224d1fe043 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -14,7 +14,7 @@ typedef struct minix_dir_entry minix_dirent;
14 14
15static int minix_readdir(struct file *, void *, filldir_t); 15static int minix_readdir(struct file *, void *, filldir_t);
16 16
17struct file_operations minix_dir_operations = { 17const struct file_operations minix_dir_operations = {
18 .read = generic_read_dir, 18 .read = generic_read_dir,
19 .readdir = minix_readdir, 19 .readdir = minix_readdir,
20 .fsync = minix_sync_file, 20 .fsync = minix_sync_file,
diff --git a/fs/minix/file.c b/fs/minix/file.c
index f1d77acb3f01..420b32882a10 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -15,7 +15,7 @@
15 */ 15 */
16int minix_sync_file(struct file *, struct dentry *, int); 16int minix_sync_file(struct file *, struct dentry *, int);
17 17
18struct file_operations minix_file_operations = { 18const struct file_operations minix_file_operations = {
19 .llseek = generic_file_llseek, 19 .llseek = generic_file_llseek,
20 .read = generic_file_read, 20 .read = generic_file_read,
21 .write = generic_file_write, 21 .write = generic_file_write,
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index e42a8bb89001..c55b77cdcc8e 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -81,8 +81,8 @@ extern int minix_sync_file(struct file *, struct dentry *, int);
81 81
82extern struct inode_operations minix_file_inode_operations; 82extern struct inode_operations minix_file_inode_operations;
83extern struct inode_operations minix_dir_inode_operations; 83extern struct inode_operations minix_dir_inode_operations;
84extern struct file_operations minix_file_operations; 84extern const struct file_operations minix_file_operations;
85extern struct file_operations minix_dir_operations; 85extern const struct file_operations minix_dir_operations;
86extern struct dentry_operations minix_dentry_operations; 86extern struct dentry_operations minix_dentry_operations;
87 87
88static inline struct minix_sb_info *minix_sb(struct super_block *sb) 88static inline struct minix_sb_info *minix_sb(struct super_block *sb)
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index cfd76f431dc0..f0860c602d8b 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -49,7 +49,7 @@ extern int ncp_symlink(struct inode *, struct dentry *, const char *);
49#define ncp_symlink NULL 49#define ncp_symlink NULL
50#endif 50#endif
51 51
52struct file_operations ncp_dir_operations = 52const struct file_operations ncp_dir_operations =
53{ 53{
54 .read = generic_read_dir, 54 .read = generic_read_dir,
55 .readdir = ncp_readdir, 55 .readdir = ncp_readdir,
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index ebdad8f6398f..e6b7c67cf057 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -283,7 +283,7 @@ static int ncp_release(struct inode *inode, struct file *file) {
283 return 0; 283 return 0;
284} 284}
285 285
286struct file_operations ncp_file_operations = 286const struct file_operations ncp_file_operations =
287{ 287{
288 .llseek = remote_llseek, 288 .llseek = remote_llseek,
289 .read = ncp_file_read, 289 .read = ncp_file_read,
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 06c48b385c94..a23f34894167 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -54,7 +54,7 @@ static int nfs_rename(struct inode *, struct dentry *,
54static int nfs_fsync_dir(struct file *, struct dentry *, int); 54static int nfs_fsync_dir(struct file *, struct dentry *, int);
55static loff_t nfs_llseek_dir(struct file *, loff_t, int); 55static loff_t nfs_llseek_dir(struct file *, loff_t, int);
56 56
57struct file_operations nfs_dir_operations = { 57const struct file_operations nfs_dir_operations = {
58 .llseek = nfs_llseek_dir, 58 .llseek = nfs_llseek_dir,
59 .read = generic_read_dir, 59 .read = generic_read_dir,
60 .readdir = nfs_readdir, 60 .readdir = nfs_readdir,
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index dee49a0cb995..f1df2c8d9259 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -49,7 +49,7 @@ static int nfs_check_flags(int flags);
49static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); 49static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl);
50static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl); 50static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl);
51 51
52struct file_operations nfs_file_operations = { 52const struct file_operations nfs_file_operations = {
53 .llseek = nfs_file_llseek, 53 .llseek = nfs_file_llseek,
54 .read = do_sync_read, 54 .read = do_sync_read,
55 .write = do_sync_write, 55 .write = do_sync_write,
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index c8960aff0968..3ef017b3b5bd 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -134,7 +134,7 @@ static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size
134 return simple_transaction_read(file, buf, size, pos); 134 return simple_transaction_read(file, buf, size, pos);
135} 135}
136 136
137static struct file_operations transaction_ops = { 137static const struct file_operations transaction_ops = {
138 .write = nfsctl_transaction_write, 138 .write = nfsctl_transaction_write,
139 .read = nfsctl_transaction_read, 139 .read = nfsctl_transaction_read,
140 .release = simple_transaction_release, 140 .release = simple_transaction_release,
@@ -146,7 +146,7 @@ static int exports_open(struct inode *inode, struct file *file)
146 return seq_open(file, &nfs_exports_op); 146 return seq_open(file, &nfs_exports_op);
147} 147}
148 148
149static struct file_operations exports_operations = { 149static const struct file_operations exports_operations = {
150 .open = exports_open, 150 .open = exports_open,
151 .read = seq_read, 151 .read = seq_read,
152 .llseek = seq_lseek, 152 .llseek = seq_lseek,
diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c
index 1cf955bcc526..57265d563804 100644
--- a/fs/nfsd/stats.c
+++ b/fs/nfsd/stats.c
@@ -80,7 +80,7 @@ static int nfsd_proc_open(struct inode *inode, struct file *file)
80 return single_open(file, nfsd_proc_show, NULL); 80 return single_open(file, nfsd_proc_show, NULL);
81} 81}
82 82
83static struct file_operations nfsd_proc_fops = { 83static const struct file_operations nfsd_proc_fops = {
84 .owner = THIS_MODULE, 84 .owner = THIS_MODULE,
85 .open = nfsd_proc_open, 85 .open = nfsd_proc_open,
86 .read = seq_read, 86 .read = seq_read,
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 5320e5afaddb..31018333dc38 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -706,7 +706,7 @@ nfsd_close(struct file *filp)
706 * after it. 706 * after it.
707 */ 707 */
708static inline int nfsd_dosync(struct file *filp, struct dentry *dp, 708static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
709 struct file_operations *fop) 709 const struct file_operations *fop)
710{ 710{
711 struct inode *inode = dp->d_inode; 711 struct inode *inode = dp->d_inode;
712 int (*fsync) (struct file *, struct dentry *, int); 712 int (*fsync) (struct file *, struct dentry *, int);
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c
index 9d9ed3fe371d..d1e2c6f9f05e 100644
--- a/fs/ntfs/dir.c
+++ b/fs/ntfs/dir.c
@@ -1553,7 +1553,7 @@ static int ntfs_dir_fsync(struct file *filp, struct dentry *dentry,
1553 1553
1554#endif /* NTFS_RW */ 1554#endif /* NTFS_RW */
1555 1555
1556struct file_operations ntfs_dir_ops = { 1556const struct file_operations ntfs_dir_ops = {
1557 .llseek = generic_file_llseek, /* Seek inside directory. */ 1557 .llseek = generic_file_llseek, /* Seek inside directory. */
1558 .read = generic_read_dir, /* Return -EISDIR. */ 1558 .read = generic_read_dir, /* Return -EISDIR. */
1559 .readdir = ntfs_readdir, /* Read directory contents. */ 1559 .readdir = ntfs_readdir, /* Read directory contents. */
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index f5d057e4acc2..c63a83e8da98 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -2294,7 +2294,7 @@ static int ntfs_file_fsync(struct file *filp, struct dentry *dentry,
2294 2294
2295#endif /* NTFS_RW */ 2295#endif /* NTFS_RW */
2296 2296
2297struct file_operations ntfs_file_ops = { 2297const struct file_operations ntfs_file_ops = {
2298 .llseek = generic_file_llseek, /* Seek inside file. */ 2298 .llseek = generic_file_llseek, /* Seek inside file. */
2299 .read = generic_file_read, /* Read from file. */ 2299 .read = generic_file_read, /* Read from file. */
2300 .aio_read = generic_file_aio_read, /* Async read from file. */ 2300 .aio_read = generic_file_aio_read, /* Async read from file. */
@@ -2337,6 +2337,6 @@ struct inode_operations ntfs_file_inode_ops = {
2337#endif /* NTFS_RW */ 2337#endif /* NTFS_RW */
2338}; 2338};
2339 2339
2340struct file_operations ntfs_empty_file_ops = {}; 2340const struct file_operations ntfs_empty_file_ops = {};
2341 2341
2342struct inode_operations ntfs_empty_inode_ops = {}; 2342struct inode_operations ntfs_empty_inode_ops = {};
diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h
index 166142960b53..bf7b3d7c0930 100644
--- a/fs/ntfs/ntfs.h
+++ b/fs/ntfs/ntfs.h
@@ -60,13 +60,13 @@ extern struct kmem_cache *ntfs_index_ctx_cache;
60extern struct address_space_operations ntfs_aops; 60extern struct address_space_operations ntfs_aops;
61extern struct address_space_operations ntfs_mst_aops; 61extern struct address_space_operations ntfs_mst_aops;
62 62
63extern struct file_operations ntfs_file_ops; 63extern const struct file_operations ntfs_file_ops;
64extern struct inode_operations ntfs_file_inode_ops; 64extern struct inode_operations ntfs_file_inode_ops;
65 65
66extern struct file_operations ntfs_dir_ops; 66extern const struct file_operations ntfs_dir_ops;
67extern struct inode_operations ntfs_dir_inode_ops; 67extern struct inode_operations ntfs_dir_inode_ops;
68 68
69extern struct file_operations ntfs_empty_file_ops; 69extern const struct file_operations ntfs_empty_file_ops;
70extern struct inode_operations ntfs_empty_inode_ops; 70extern struct inode_operations ntfs_empty_inode_ops;
71 71
72extern struct export_operations ntfs_export_ops; 72extern struct export_operations ntfs_export_ops;
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 84f153aca692..64cd52860c87 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2017,7 +2017,7 @@ out:
2017 return ret; 2017 return ret;
2018} 2018}
2019 2019
2020static struct file_operations ocfs2_dlm_debug_fops = { 2020static const struct file_operations ocfs2_dlm_debug_fops = {
2021 .open = ocfs2_dlm_debug_open, 2021 .open = ocfs2_dlm_debug_open,
2022 .release = ocfs2_dlm_debug_release, 2022 .release = ocfs2_dlm_debug_release,
2023 .read = seq_read, 2023 .read = seq_read,
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 4b4cbadd5838..34e903a6a46b 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1176,7 +1176,7 @@ struct inode_operations ocfs2_special_file_iops = {
1176 .getattr = ocfs2_getattr, 1176 .getattr = ocfs2_getattr,
1177}; 1177};
1178 1178
1179struct file_operations ocfs2_fops = { 1179const struct file_operations ocfs2_fops = {
1180 .read = do_sync_read, 1180 .read = do_sync_read,
1181 .write = do_sync_write, 1181 .write = do_sync_write,
1182 .sendfile = generic_file_sendfile, 1182 .sendfile = generic_file_sendfile,
@@ -1188,7 +1188,7 @@ struct file_operations ocfs2_fops = {
1188 .aio_write = ocfs2_file_aio_write, 1188 .aio_write = ocfs2_file_aio_write,
1189}; 1189};
1190 1190
1191struct file_operations ocfs2_dops = { 1191const struct file_operations ocfs2_dops = {
1192 .read = generic_read_dir, 1192 .read = generic_read_dir,
1193 .readdir = ocfs2_readdir, 1193 .readdir = ocfs2_readdir,
1194 .fsync = ocfs2_sync_file, 1194 .fsync = ocfs2_sync_file,
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
index a5ea33b24060..740c9e7ca599 100644
--- a/fs/ocfs2/file.h
+++ b/fs/ocfs2/file.h
@@ -26,8 +26,8 @@
26#ifndef OCFS2_FILE_H 26#ifndef OCFS2_FILE_H
27#define OCFS2_FILE_H 27#define OCFS2_FILE_H
28 28
29extern struct file_operations ocfs2_fops; 29extern const struct file_operations ocfs2_fops;
30extern struct file_operations ocfs2_dops; 30extern const struct file_operations ocfs2_dops;
31extern struct inode_operations ocfs2_file_iops; 31extern struct inode_operations ocfs2_file_iops;
32extern struct inode_operations ocfs2_special_file_iops; 32extern struct inode_operations ocfs2_special_file_iops;
33struct ocfs2_alloc_context; 33struct ocfs2_alloc_context;
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index aeb0106890e4..0f14276a2e51 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -581,17 +581,17 @@ int property_release (struct inode *inode, struct file *filp)
581 return 0; 581 return 0;
582} 582}
583 583
584static struct file_operations openpromfs_prop_ops = { 584static const struct file_operations openpromfs_prop_ops = {
585 .read = property_read, 585 .read = property_read,
586 .write = property_write, 586 .write = property_write,
587 .release = property_release, 587 .release = property_release,
588}; 588};
589 589
590static struct file_operations openpromfs_nodenum_ops = { 590static const struct file_operations openpromfs_nodenum_ops = {
591 .read = nodenum_read, 591 .read = nodenum_read,
592}; 592};
593 593
594static struct file_operations openprom_operations = { 594static const struct file_operations openprom_operations = {
595 .read = generic_read_dir, 595 .read = generic_read_dir,
596 .readdir = openpromfs_readdir, 596 .readdir = openpromfs_readdir,
597}; 597};
diff --git a/fs/pipe.c b/fs/pipe.c
index 4384c9290943..e2f4f1d9ffc2 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -568,7 +568,7 @@ pipe_rdwr_open(struct inode *inode, struct file *filp)
568 * The file_operations structs are not static because they 568 * The file_operations structs are not static because they
569 * are also used in linux/fs/fifo.c to do operations on FIFOs. 569 * are also used in linux/fs/fifo.c to do operations on FIFOs.
570 */ 570 */
571struct file_operations read_fifo_fops = { 571const struct file_operations read_fifo_fops = {
572 .llseek = no_llseek, 572 .llseek = no_llseek,
573 .read = pipe_read, 573 .read = pipe_read,
574 .readv = pipe_readv, 574 .readv = pipe_readv,
@@ -580,7 +580,7 @@ struct file_operations read_fifo_fops = {
580 .fasync = pipe_read_fasync, 580 .fasync = pipe_read_fasync,
581}; 581};
582 582
583struct file_operations write_fifo_fops = { 583const struct file_operations write_fifo_fops = {
584 .llseek = no_llseek, 584 .llseek = no_llseek,
585 .read = bad_pipe_r, 585 .read = bad_pipe_r,
586 .write = pipe_write, 586 .write = pipe_write,
@@ -592,7 +592,7 @@ struct file_operations write_fifo_fops = {
592 .fasync = pipe_write_fasync, 592 .fasync = pipe_write_fasync,
593}; 593};
594 594
595struct file_operations rdwr_fifo_fops = { 595const struct file_operations rdwr_fifo_fops = {
596 .llseek = no_llseek, 596 .llseek = no_llseek,
597 .read = pipe_read, 597 .read = pipe_read,
598 .readv = pipe_readv, 598 .readv = pipe_readv,
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 47b7a20d45eb..4ba03009cf72 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -560,7 +560,7 @@ static void proc_kill_inodes(struct proc_dir_entry *de)
560 struct file * filp = list_entry(p, struct file, f_u.fu_list); 560 struct file * filp = list_entry(p, struct file, f_u.fu_list);
561 struct dentry * dentry = filp->f_dentry; 561 struct dentry * dentry = filp->f_dentry;
562 struct inode * inode; 562 struct inode * inode;
563 struct file_operations *fops; 563 const struct file_operations *fops;
564 564
565 if (dentry->d_op != &proc_dentry_operations) 565 if (dentry->d_op != &proc_dentry_operations)
566 continue; 566 continue;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 95a1cf32b838..0502f17b860d 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -30,7 +30,7 @@ do { \
30 30
31#endif 31#endif
32 32
33extern void create_seq_entry(char *name, mode_t mode, struct file_operations *f); 33extern void create_seq_entry(char *name, mode_t mode, const struct file_operations *f);
34extern int proc_exe_link(struct inode *, struct dentry **, struct vfsmount **); 34extern int proc_exe_link(struct inode *, struct dentry **, struct vfsmount **);
35extern int proc_tid_stat(struct task_struct *, char *); 35extern int proc_tid_stat(struct task_struct *, char *);
36extern int proc_tgid_stat(struct task_struct *, char *); 36extern int proc_tgid_stat(struct task_struct *, char *);
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index adc2cd95169a..17f6e8fa1397 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -31,7 +31,7 @@ static int open_kcore(struct inode * inode, struct file * filp)
31 31
32static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); 32static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *);
33 33
34struct file_operations proc_kcore_operations = { 34const struct file_operations proc_kcore_operations = {
35 .read = read_kcore, 35 .read = read_kcore,
36 .open = open_kcore, 36 .open = open_kcore,
37}; 37};
diff --git a/fs/proc/kmsg.c b/fs/proc/kmsg.c
index 10d37bf25206..ff3b90b56e9d 100644
--- a/fs/proc/kmsg.c
+++ b/fs/proc/kmsg.c
@@ -47,7 +47,7 @@ static unsigned int kmsg_poll(struct file *file, poll_table *wait)
47} 47}
48 48
49 49
50struct file_operations proc_kmsg_operations = { 50const struct file_operations proc_kmsg_operations = {
51 .read = kmsg_read, 51 .read = kmsg_read,
52 .poll = kmsg_poll, 52 .poll = kmsg_poll,
53 .open = kmsg_open, 53 .open = kmsg_open,
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 1e9ea37d457e..ef5a3323f4b5 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -534,7 +534,7 @@ static int show_stat(struct seq_file *p, void *v)
534 if (wall_to_monotonic.tv_nsec) 534 if (wall_to_monotonic.tv_nsec)
535 --jif; 535 --jif;
536 536
537 for_each_cpu(i) { 537 for_each_possible_cpu(i) {
538 int j; 538 int j;
539 539
540 user = cputime64_add(user, kstat_cpu(i).cpustat.user); 540 user = cputime64_add(user, kstat_cpu(i).cpustat.user);
@@ -731,7 +731,7 @@ static struct file_operations proc_sysrq_trigger_operations = {
731 731
732struct proc_dir_entry *proc_root_kcore; 732struct proc_dir_entry *proc_root_kcore;
733 733
734void create_seq_entry(char *name, mode_t mode, struct file_operations *f) 734void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
735{ 735{
736 struct proc_dir_entry *entry; 736 struct proc_dir_entry *entry;
737 entry = create_proc_entry(name, mode, NULL); 737 entry = create_proc_entry(name, mode, NULL);
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index 4063fb32f78c..7efa73d44c9a 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -172,7 +172,7 @@ static int open_vmcore(struct inode *inode, struct file *filp)
172 return 0; 172 return 0;
173} 173}
174 174
175struct file_operations proc_vmcore_operations = { 175const struct file_operations proc_vmcore_operations = {
176 .read = read_vmcore, 176 .read = read_vmcore,
177 .open = open_vmcore, 177 .open = open_vmcore,
178}; 178};
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c
index 7a8f5595c26f..9031948fefd0 100644
--- a/fs/qnx4/dir.c
+++ b/fs/qnx4/dir.c
@@ -81,7 +81,7 @@ out:
81 return 0; 81 return 0;
82} 82}
83 83
84struct file_operations qnx4_dir_operations = 84const struct file_operations qnx4_dir_operations =
85{ 85{
86 .read = generic_read_dir, 86 .read = generic_read_dir,
87 .readdir = qnx4_readdir, 87 .readdir = qnx4_readdir,
diff --git a/fs/qnx4/file.c b/fs/qnx4/file.c
index c33963fded9e..62af4b1348bd 100644
--- a/fs/qnx4/file.c
+++ b/fs/qnx4/file.c
@@ -19,7 +19,7 @@
19 * We have mostly NULL's here: the current defaults are ok for 19 * We have mostly NULL's here: the current defaults are ok for
20 * the qnx4 filesystem. 20 * the qnx4 filesystem.
21 */ 21 */
22struct file_operations qnx4_file_operations = 22const struct file_operations qnx4_file_operations =
23{ 23{
24 .llseek = generic_file_llseek, 24 .llseek = generic_file_llseek,
25 .read = generic_file_read, 25 .read = generic_file_read,
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 6ada2095b9ac..00a933eb820c 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -32,7 +32,7 @@ struct address_space_operations ramfs_aops = {
32 .commit_write = simple_commit_write 32 .commit_write = simple_commit_write
33}; 33};
34 34
35struct file_operations ramfs_file_operations = { 35const struct file_operations ramfs_file_operations = {
36 .read = generic_file_read, 36 .read = generic_file_read,
37 .write = generic_file_write, 37 .write = generic_file_write,
38 .mmap = generic_file_mmap, 38 .mmap = generic_file_mmap,
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index b1ca234068f6..f443a84b98a5 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -33,7 +33,7 @@ struct address_space_operations ramfs_aops = {
33 .commit_write = simple_commit_write 33 .commit_write = simple_commit_write
34}; 34};
35 35
36struct file_operations ramfs_file_operations = { 36const struct file_operations ramfs_file_operations = {
37 .mmap = ramfs_nommu_mmap, 37 .mmap = ramfs_nommu_mmap,
38 .get_unmapped_area = ramfs_nommu_get_unmapped_area, 38 .get_unmapped_area = ramfs_nommu_get_unmapped_area,
39 .read = generic_file_read, 39 .read = generic_file_read,
diff --git a/fs/ramfs/internal.h b/fs/ramfs/internal.h
index 272c8a7120b0..313237631b49 100644
--- a/fs/ramfs/internal.h
+++ b/fs/ramfs/internal.h
@@ -11,5 +11,5 @@
11 11
12 12
13extern struct address_space_operations ramfs_aops; 13extern struct address_space_operations ramfs_aops;
14extern struct file_operations ramfs_file_operations; 14extern const struct file_operations ramfs_file_operations;
15extern struct inode_operations ramfs_file_inode_operations; 15extern struct inode_operations ramfs_file_inode_operations;
diff --git a/fs/read_write.c b/fs/read_write.c
index 34b1bf259efd..6256ca81a718 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -19,7 +19,7 @@
19#include <asm/uaccess.h> 19#include <asm/uaccess.h>
20#include <asm/unistd.h> 20#include <asm/unistd.h>
21 21
22struct file_operations generic_ro_fops = { 22const struct file_operations generic_ro_fops = {
23 .llseek = generic_file_llseek, 23 .llseek = generic_file_llseek,
24 .read = generic_file_read, 24 .read = generic_file_read,
25 .mmap = generic_file_readonly_mmap, 25 .mmap = generic_file_readonly_mmap,
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index d71ac6579289..973c819f8033 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -18,7 +18,7 @@ static int reiserfs_readdir(struct file *, void *, filldir_t);
18static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, 18static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
19 int datasync); 19 int datasync);
20 20
21struct file_operations reiserfs_dir_operations = { 21const struct file_operations reiserfs_dir_operations = {
22 .read = generic_read_dir, 22 .read = generic_read_dir,
23 .readdir = reiserfs_readdir, 23 .readdir = reiserfs_readdir,
24 .fsync = reiserfs_dir_fsync, 24 .fsync = reiserfs_dir_fsync,
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index d0c1e865963e..010094d14da6 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -1566,7 +1566,7 @@ static ssize_t reiserfs_aio_write(struct kiocb *iocb, const char __user * buf,
1566 return generic_file_aio_write(iocb, buf, count, pos); 1566 return generic_file_aio_write(iocb, buf, count, pos);
1567} 1567}
1568 1568
1569struct file_operations reiserfs_file_operations = { 1569const struct file_operations reiserfs_file_operations = {
1570 .read = generic_file_read, 1570 .read = generic_file_read,
1571 .write = reiserfs_file_write, 1571 .write = reiserfs_file_write,
1572 .ioctl = reiserfs_ioctl, 1572 .ioctl = reiserfs_ioctl,
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index ef6caed9336b..731688e1cfe3 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -470,7 +470,7 @@ static int r_open(struct inode *inode, struct file *file)
470 return ret; 470 return ret;
471} 471}
472 472
473static struct file_operations r_file_operations = { 473static const struct file_operations r_file_operations = {
474 .open = r_open, 474 .open = r_open,
475 .read = seq_read, 475 .read = seq_read,
476 .llseek = seq_lseek, 476 .llseek = seq_lseek,
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index c2fc424d7d5c..9b9eda7b335c 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -463,7 +463,7 @@ static struct address_space_operations romfs_aops = {
463 .readpage = romfs_readpage 463 .readpage = romfs_readpage
464}; 464};
465 465
466static struct file_operations romfs_dir_operations = { 466static const struct file_operations romfs_dir_operations = {
467 .read = generic_read_dir, 467 .read = generic_read_dir,
468 .readdir = romfs_readdir, 468 .readdir = romfs_readdir,
469}; 469};
diff --git a/fs/select.c b/fs/select.c
index 1815a57d2255..b3a3a1326af6 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -29,12 +29,6 @@
29#define ROUND_UP(x,y) (((x)+(y)-1)/(y)) 29#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
30#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) 30#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
31 31
32struct poll_table_entry {
33 struct file * filp;
34 wait_queue_t wait;
35 wait_queue_head_t * wait_address;
36};
37
38struct poll_table_page { 32struct poll_table_page {
39 struct poll_table_page * next; 33 struct poll_table_page * next;
40 struct poll_table_entry * entry; 34 struct poll_table_entry * entry;
@@ -64,13 +58,23 @@ void poll_initwait(struct poll_wqueues *pwq)
64 init_poll_funcptr(&pwq->pt, __pollwait); 58 init_poll_funcptr(&pwq->pt, __pollwait);
65 pwq->error = 0; 59 pwq->error = 0;
66 pwq->table = NULL; 60 pwq->table = NULL;
61 pwq->inline_index = 0;
67} 62}
68 63
69EXPORT_SYMBOL(poll_initwait); 64EXPORT_SYMBOL(poll_initwait);
70 65
66static void free_poll_entry(struct poll_table_entry *entry)
67{
68 remove_wait_queue(entry->wait_address,&entry->wait);
69 fput(entry->filp);
70}
71
71void poll_freewait(struct poll_wqueues *pwq) 72void poll_freewait(struct poll_wqueues *pwq)
72{ 73{
73 struct poll_table_page * p = pwq->table; 74 struct poll_table_page * p = pwq->table;
75 int i;
76 for (i = 0; i < pwq->inline_index; i++)
77 free_poll_entry(pwq->inline_entries + i);
74 while (p) { 78 while (p) {
75 struct poll_table_entry * entry; 79 struct poll_table_entry * entry;
76 struct poll_table_page *old; 80 struct poll_table_page *old;
@@ -78,8 +82,7 @@ void poll_freewait(struct poll_wqueues *pwq)
78 entry = p->entry; 82 entry = p->entry;
79 do { 83 do {
80 entry--; 84 entry--;
81 remove_wait_queue(entry->wait_address,&entry->wait); 85 free_poll_entry(entry);
82 fput(entry->filp);
83 } while (entry > p->entries); 86 } while (entry > p->entries);
84 old = p; 87 old = p;
85 p = p->next; 88 p = p->next;
@@ -89,12 +92,14 @@ void poll_freewait(struct poll_wqueues *pwq)
89 92
90EXPORT_SYMBOL(poll_freewait); 93EXPORT_SYMBOL(poll_freewait);
91 94
92static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, 95static struct poll_table_entry *poll_get_entry(poll_table *_p)
93 poll_table *_p)
94{ 96{
95 struct poll_wqueues *p = container_of(_p, struct poll_wqueues, pt); 97 struct poll_wqueues *p = container_of(_p, struct poll_wqueues, pt);
96 struct poll_table_page *table = p->table; 98 struct poll_table_page *table = p->table;
97 99
100 if (p->inline_index < N_INLINE_POLL_ENTRIES)
101 return p->inline_entries + p->inline_index++;
102
98 if (!table || POLL_TABLE_FULL(table)) { 103 if (!table || POLL_TABLE_FULL(table)) {
99 struct poll_table_page *new_table; 104 struct poll_table_page *new_table;
100 105
@@ -102,7 +107,7 @@ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,
102 if (!new_table) { 107 if (!new_table) {
103 p->error = -ENOMEM; 108 p->error = -ENOMEM;
104 __set_current_state(TASK_RUNNING); 109 __set_current_state(TASK_RUNNING);
105 return; 110 return NULL;
106 } 111 }
107 new_table->entry = new_table->entries; 112 new_table->entry = new_table->entries;
108 new_table->next = table; 113 new_table->next = table;
@@ -110,16 +115,21 @@ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,
110 table = new_table; 115 table = new_table;
111 } 116 }
112 117
113 /* Add a new entry */ 118 return table->entry++;
114 { 119}
115 struct poll_table_entry * entry = table->entry; 120
116 table->entry = entry+1; 121/* Add a new entry */
117 get_file(filp); 122static void __pollwait(struct file *filp, wait_queue_head_t *wait_address,
118 entry->filp = filp; 123 poll_table *p)
119 entry->wait_address = wait_address; 124{
120 init_waitqueue_entry(&entry->wait, current); 125 struct poll_table_entry *entry = poll_get_entry(p);
121 add_wait_queue(wait_address,&entry->wait); 126 if (!entry)
122 } 127 return;
128 get_file(filp);
129 entry->filp = filp;
130 entry->wait_address = wait_address;
131 init_waitqueue_entry(&entry->wait, current);
132 add_wait_queue(wait_address,&entry->wait);
123} 133}
124 134
125#define FDS_IN(fds, n) (fds->in + n) 135#define FDS_IN(fds, n) (fds->in + n)
@@ -210,7 +220,7 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
210 for (i = 0; i < n; ++rinp, ++routp, ++rexp) { 220 for (i = 0; i < n; ++rinp, ++routp, ++rexp) {
211 unsigned long in, out, ex, all_bits, bit = 1, mask, j; 221 unsigned long in, out, ex, all_bits, bit = 1, mask, j;
212 unsigned long res_in = 0, res_out = 0, res_ex = 0; 222 unsigned long res_in = 0, res_out = 0, res_ex = 0;
213 struct file_operations *f_op = NULL; 223 const struct file_operations *f_op = NULL;
214 struct file *file = NULL; 224 struct file *file = NULL;
215 225
216 in = *inp++; out = *outp++; ex = *exp++; 226 in = *inp++; out = *outp++; ex = *exp++;
@@ -221,17 +231,18 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
221 } 231 }
222 232
223 for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) { 233 for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
234 int fput_needed;
224 if (i >= n) 235 if (i >= n)
225 break; 236 break;
226 if (!(bit & all_bits)) 237 if (!(bit & all_bits))
227 continue; 238 continue;
228 file = fget(i); 239 file = fget_light(i, &fput_needed);
229 if (file) { 240 if (file) {
230 f_op = file->f_op; 241 f_op = file->f_op;
231 mask = DEFAULT_POLLMASK; 242 mask = DEFAULT_POLLMASK;
232 if (f_op && f_op->poll) 243 if (f_op && f_op->poll)
233 mask = (*f_op->poll)(file, retval ? NULL : wait); 244 mask = (*f_op->poll)(file, retval ? NULL : wait);
234 fput(file); 245 fput_light(file, fput_needed);
235 if ((mask & POLLIN_SET) && (in & bit)) { 246 if ((mask & POLLIN_SET) && (in & bit)) {
236 res_in |= bit; 247 res_in |= bit;
237 retval++; 248 retval++;
@@ -284,16 +295,6 @@ int do_select(int n, fd_set_bits *fds, s64 *timeout)
284 return retval; 295 return retval;
285} 296}
286 297
287static void *select_bits_alloc(int size)
288{
289 return kmalloc(6 * size, GFP_KERNEL);
290}
291
292static void select_bits_free(void *bits, int size)
293{
294 kfree(bits);
295}
296
297/* 298/*
298 * We can actually return ERESTARTSYS instead of EINTR, but I'd 299 * We can actually return ERESTARTSYS instead of EINTR, but I'd
299 * like to be certain this leads to no problems. So I return 300 * like to be certain this leads to no problems. So I return
@@ -312,6 +313,8 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
312 char *bits; 313 char *bits;
313 int ret, size, max_fdset; 314 int ret, size, max_fdset;
314 struct fdtable *fdt; 315 struct fdtable *fdt;
316 /* Allocate small arguments on the stack to save memory and be faster */
317 char stack_fds[SELECT_STACK_ALLOC];
315 318
316 ret = -EINVAL; 319 ret = -EINVAL;
317 if (n < 0) 320 if (n < 0)
@@ -332,7 +335,10 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
332 */ 335 */
333 ret = -ENOMEM; 336 ret = -ENOMEM;
334 size = FDS_BYTES(n); 337 size = FDS_BYTES(n);
335 bits = select_bits_alloc(size); 338 if (6*size < SELECT_STACK_ALLOC)
339 bits = stack_fds;
340 else
341 bits = kmalloc(6 * size, GFP_KERNEL);
336 if (!bits) 342 if (!bits)
337 goto out_nofds; 343 goto out_nofds;
338 fds.in = (unsigned long *) bits; 344 fds.in = (unsigned long *) bits;
@@ -367,7 +373,8 @@ static int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
367 ret = -EFAULT; 373 ret = -EFAULT;
368 374
369out: 375out:
370 select_bits_free(bits, size); 376 if (bits != stack_fds)
377 kfree(bits);
371out_nofds: 378out_nofds:
372 return ret; 379 return ret;
373} 380}
@@ -551,14 +558,15 @@ static void do_pollfd(unsigned int num, struct pollfd * fdpage,
551 fdp = fdpage+i; 558 fdp = fdpage+i;
552 fd = fdp->fd; 559 fd = fdp->fd;
553 if (fd >= 0) { 560 if (fd >= 0) {
554 struct file * file = fget(fd); 561 int fput_needed;
562 struct file * file = fget_light(fd, &fput_needed);
555 mask = POLLNVAL; 563 mask = POLLNVAL;
556 if (file != NULL) { 564 if (file != NULL) {
557 mask = DEFAULT_POLLMASK; 565 mask = DEFAULT_POLLMASK;
558 if (file->f_op && file->f_op->poll) 566 if (file->f_op && file->f_op->poll)
559 mask = file->f_op->poll(file, *pwait); 567 mask = file->f_op->poll(file, *pwait);
560 mask &= fdp->events | POLLERR | POLLHUP; 568 mask &= fdp->events | POLLERR | POLLHUP;
561 fput(file); 569 fput_light(file, fput_needed);
562 } 570 }
563 if (mask) { 571 if (mask) {
564 *pwait = NULL; 572 *pwait = NULL;
@@ -619,6 +627,9 @@ static int do_poll(unsigned int nfds, struct poll_list *list,
619 return count; 627 return count;
620} 628}
621 629
630#define N_STACK_PPS ((sizeof(stack_pps) - sizeof(struct poll_list)) / \
631 sizeof(struct pollfd))
632
622int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout) 633int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
623{ 634{
624 struct poll_wqueues table; 635 struct poll_wqueues table;
@@ -628,6 +639,9 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
628 struct poll_list *walk; 639 struct poll_list *walk;
629 struct fdtable *fdt; 640 struct fdtable *fdt;
630 int max_fdset; 641 int max_fdset;
642 /* Allocate small arguments on the stack to save memory and be faster */
643 char stack_pps[POLL_STACK_ALLOC];
644 struct poll_list *stack_pp = NULL;
631 645
632 /* Do a sanity check on nfds ... */ 646 /* Do a sanity check on nfds ... */
633 rcu_read_lock(); 647 rcu_read_lock();
@@ -645,14 +659,23 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
645 err = -ENOMEM; 659 err = -ENOMEM;
646 while(i!=0) { 660 while(i!=0) {
647 struct poll_list *pp; 661 struct poll_list *pp;
648 pp = kmalloc(sizeof(struct poll_list)+ 662 int num, size;
649 sizeof(struct pollfd)* 663 if (stack_pp == NULL)
650 (i>POLLFD_PER_PAGE?POLLFD_PER_PAGE:i), 664 num = N_STACK_PPS;
651 GFP_KERNEL); 665 else
652 if(pp==NULL) 666 num = POLLFD_PER_PAGE;
653 goto out_fds; 667 if (num > i)
668 num = i;
669 size = sizeof(struct poll_list) + sizeof(struct pollfd)*num;
670 if (!stack_pp)
671 stack_pp = pp = (struct poll_list *)stack_pps;
672 else {
673 pp = kmalloc(size, GFP_KERNEL);
674 if (!pp)
675 goto out_fds;
676 }
654 pp->next=NULL; 677 pp->next=NULL;
655 pp->len = (i>POLLFD_PER_PAGE?POLLFD_PER_PAGE:i); 678 pp->len = num;
656 if (head == NULL) 679 if (head == NULL)
657 head = pp; 680 head = pp;
658 else 681 else
@@ -660,7 +683,7 @@ int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, s64 *timeout)
660 683
661 walk = pp; 684 walk = pp;
662 if (copy_from_user(pp->entries, ufds + nfds-i, 685 if (copy_from_user(pp->entries, ufds + nfds-i,
663 sizeof(struct pollfd)*pp->len)) { 686 sizeof(struct pollfd)*num)) {
664 err = -EFAULT; 687 err = -EFAULT;
665 goto out_fds; 688 goto out_fds;
666 } 689 }
@@ -689,7 +712,8 @@ out_fds:
689 walk = head; 712 walk = head;
690 while(walk!=NULL) { 713 while(walk!=NULL) {
691 struct poll_list *pp = walk->next; 714 struct poll_list *pp = walk->next;
692 kfree(walk); 715 if (walk != stack_pp)
716 kfree(walk);
693 walk = pp; 717 walk = pp;
694 } 718 }
695 poll_freewait(&table); 719 poll_freewait(&table);
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 0424d06b147e..34c7a11d91f0 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -34,7 +34,7 @@ static int smb_rename(struct inode *, struct dentry *,
34static int smb_make_node(struct inode *,struct dentry *,int,dev_t); 34static int smb_make_node(struct inode *,struct dentry *,int,dev_t);
35static int smb_link(struct dentry *, struct inode *, struct dentry *); 35static int smb_link(struct dentry *, struct inode *, struct dentry *);
36 36
37struct file_operations smb_dir_operations = 37const struct file_operations smb_dir_operations =
38{ 38{
39 .read = generic_read_dir, 39 .read = generic_read_dir,
40 .readdir = smb_readdir, 40 .readdir = smb_readdir,
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index 7042e62726a4..c56bd99a9701 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -401,7 +401,7 @@ smb_file_permission(struct inode *inode, int mask, struct nameidata *nd)
401 return error; 401 return error;
402} 402}
403 403
404struct file_operations smb_file_operations = 404const struct file_operations smb_file_operations =
405{ 405{
406 .llseek = remote_llseek, 406 .llseek = remote_llseek,
407 .read = smb_file_read, 407 .read = smb_file_read,
diff --git a/fs/smbfs/proto.h b/fs/smbfs/proto.h
index e866ec8660d0..47664597e6b1 100644
--- a/fs/smbfs/proto.h
+++ b/fs/smbfs/proto.h
@@ -35,7 +35,7 @@ extern int smb_proc_symlink(struct smb_sb_info *server, struct dentry *d, const
35extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry); 35extern int smb_proc_link(struct smb_sb_info *server, struct dentry *dentry, struct dentry *new_dentry);
36extern void smb_install_null_ops(struct smb_ops *ops); 36extern void smb_install_null_ops(struct smb_ops *ops);
37/* dir.c */ 37/* dir.c */
38extern struct file_operations smb_dir_operations; 38extern const struct file_operations smb_dir_operations;
39extern struct inode_operations smb_dir_inode_operations; 39extern struct inode_operations smb_dir_inode_operations;
40extern struct inode_operations smb_dir_inode_operations_unix; 40extern struct inode_operations smb_dir_inode_operations_unix;
41extern void smb_new_dentry(struct dentry *dentry); 41extern void smb_new_dentry(struct dentry *dentry);
@@ -64,7 +64,7 @@ extern int smb_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat
64extern int smb_notify_change(struct dentry *dentry, struct iattr *attr); 64extern int smb_notify_change(struct dentry *dentry, struct iattr *attr);
65/* file.c */ 65/* file.c */
66extern struct address_space_operations smb_file_aops; 66extern struct address_space_operations smb_file_aops;
67extern struct file_operations smb_file_operations; 67extern const struct file_operations smb_file_operations;
68extern struct inode_operations smb_file_inode_operations; 68extern struct inode_operations smb_file_inode_operations;
69/* ioctl.c */ 69/* ioctl.c */
70extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); 70extern int smb_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 78899eeab974..c16a93c353c0 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -163,7 +163,7 @@ static int release(struct inode * inode, struct file * file)
163 return 0; 163 return 0;
164} 164}
165 165
166struct file_operations bin_fops = { 166const struct file_operations bin_fops = {
167 .read = read, 167 .read = read,
168 .write = write, 168 .write = write,
169 .mmap = mmap, 169 .mmap = mmap,
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 9ee956864445..f26880a4785e 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -503,7 +503,7 @@ static loff_t sysfs_dir_lseek(struct file * file, loff_t offset, int origin)
503 return offset; 503 return offset;
504} 504}
505 505
506struct file_operations sysfs_dir_operations = { 506const struct file_operations sysfs_dir_operations = {
507 .open = sysfs_dir_open, 507 .open = sysfs_dir_open,
508 .release = sysfs_dir_close, 508 .release = sysfs_dir_close,
509 .llseek = sysfs_dir_lseek, 509 .llseek = sysfs_dir_lseek,
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 5e83e7246788..830f76fa098c 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -348,7 +348,7 @@ static int sysfs_release(struct inode * inode, struct file * filp)
348 return 0; 348 return 0;
349} 349}
350 350
351struct file_operations sysfs_file_operations = { 351const struct file_operations sysfs_file_operations = {
352 .read = sysfs_read_file, 352 .read = sysfs_read_file,
353 .write = sysfs_write_file, 353 .write = sysfs_write_file,
354 .llseek = generic_file_llseek, 354 .llseek = generic_file_llseek,
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index cf11d5b789d9..32958a7c50e9 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -21,9 +21,9 @@ extern int sysfs_setattr(struct dentry *dentry, struct iattr *iattr);
21 21
22extern struct rw_semaphore sysfs_rename_sem; 22extern struct rw_semaphore sysfs_rename_sem;
23extern struct super_block * sysfs_sb; 23extern struct super_block * sysfs_sb;
24extern struct file_operations sysfs_dir_operations; 24extern const struct file_operations sysfs_dir_operations;
25extern struct file_operations sysfs_file_operations; 25extern const struct file_operations sysfs_file_operations;
26extern struct file_operations bin_fops; 26extern const struct file_operations bin_fops;
27extern struct inode_operations sysfs_dir_inode_operations; 27extern struct inode_operations sysfs_dir_inode_operations;
28extern struct inode_operations sysfs_symlink_inode_operations; 28extern struct inode_operations sysfs_symlink_inode_operations;
29 29
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index cce8b05cba5a..8c66e9270dd6 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -20,7 +20,7 @@
20 20
21static int sysv_readdir(struct file *, void *, filldir_t); 21static int sysv_readdir(struct file *, void *, filldir_t);
22 22
23struct file_operations sysv_dir_operations = { 23const struct file_operations sysv_dir_operations = {
24 .read = generic_read_dir, 24 .read = generic_read_dir,
25 .readdir = sysv_readdir, 25 .readdir = sysv_readdir,
26 .fsync = sysv_sync_file, 26 .fsync = sysv_sync_file,
diff --git a/fs/sysv/file.c b/fs/sysv/file.c
index da69abc06240..a59e303135fa 100644
--- a/fs/sysv/file.c
+++ b/fs/sysv/file.c
@@ -19,7 +19,7 @@
19 * We have mostly NULLs here: the current defaults are OK for 19 * We have mostly NULLs here: the current defaults are OK for
20 * the coh filesystem. 20 * the coh filesystem.
21 */ 21 */
22struct file_operations sysv_file_operations = { 22const struct file_operations sysv_file_operations = {
23 .llseek = generic_file_llseek, 23 .llseek = generic_file_llseek,
24 .read = generic_file_read, 24 .read = generic_file_read,
25 .write = generic_file_write, 25 .write = generic_file_write,
diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h
index b7f9b4a42aab..393a480e4deb 100644
--- a/fs/sysv/sysv.h
+++ b/fs/sysv/sysv.h
@@ -159,8 +159,8 @@ extern ino_t sysv_inode_by_name(struct dentry *);
159extern struct inode_operations sysv_file_inode_operations; 159extern struct inode_operations sysv_file_inode_operations;
160extern struct inode_operations sysv_dir_inode_operations; 160extern struct inode_operations sysv_dir_inode_operations;
161extern struct inode_operations sysv_fast_symlink_inode_operations; 161extern struct inode_operations sysv_fast_symlink_inode_operations;
162extern struct file_operations sysv_file_operations; 162extern const struct file_operations sysv_file_operations;
163extern struct file_operations sysv_dir_operations; 163extern const struct file_operations sysv_dir_operations;
164extern struct address_space_operations sysv_aops; 164extern struct address_space_operations sysv_aops;
165extern struct super_operations sysv_sops; 165extern struct super_operations sysv_sops;
166extern struct dentry_operations sysv_dentry_operations; 166extern struct dentry_operations sysv_dentry_operations;
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index f5222527fe39..8c28efa3b8ff 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -42,7 +42,7 @@ static int do_udf_readdir(struct inode *, struct file *, filldir_t, void *);
42 42
43/* readdir and lookup functions */ 43/* readdir and lookup functions */
44 44
45struct file_operations udf_dir_operations = { 45const struct file_operations udf_dir_operations = {
46 .read = generic_read_dir, 46 .read = generic_read_dir,
47 .readdir = udf_readdir, 47 .readdir = udf_readdir,
48 .ioctl = udf_ioctl, 48 .ioctl = udf_ioctl,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index a6f2acc1f15c..e34b00e303f1 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -248,7 +248,7 @@ static int udf_release_file(struct inode * inode, struct file * filp)
248 return 0; 248 return 0;
249} 249}
250 250
251struct file_operations udf_file_operations = { 251const struct file_operations udf_file_operations = {
252 .read = generic_file_read, 252 .read = generic_file_read,
253 .ioctl = udf_ioctl, 253 .ioctl = udf_ioctl,
254 .open = generic_file_open, 254 .open = generic_file_open,
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 1d5800e0cbe7..023e19ba5a2e 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -44,9 +44,9 @@ struct buffer_head;
44struct super_block; 44struct super_block;
45 45
46extern struct inode_operations udf_dir_inode_operations; 46extern struct inode_operations udf_dir_inode_operations;
47extern struct file_operations udf_dir_operations; 47extern const struct file_operations udf_dir_operations;
48extern struct inode_operations udf_file_inode_operations; 48extern struct inode_operations udf_file_inode_operations;
49extern struct file_operations udf_file_operations; 49extern const struct file_operations udf_file_operations;
50extern struct address_space_operations udf_aops; 50extern struct address_space_operations udf_aops;
51extern struct address_space_operations udf_adinicb_aops; 51extern struct address_space_operations udf_adinicb_aops;
52extern struct address_space_operations udf_symlink_aops; 52extern struct address_space_operations udf_symlink_aops;
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 7c10c68902ae..1a561202d3f4 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -620,7 +620,7 @@ int ufs_empty_dir (struct inode * inode)
620 return 1; 620 return 1;
621} 621}
622 622
623struct file_operations ufs_dir_operations = { 623const struct file_operations ufs_dir_operations = {
624 .read = generic_read_dir, 624 .read = generic_read_dir,
625 .readdir = ufs_readdir, 625 .readdir = ufs_readdir,
626 .fsync = file_fsync, 626 .fsync = file_fsync,
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index 62ad481810ef..312fd3f86313 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -31,7 +31,7 @@
31 * the ufs filesystem. 31 * the ufs filesystem.
32 */ 32 */
33 33
34struct file_operations ufs_file_operations = { 34const struct file_operations ufs_file_operations = {
35 .llseek = generic_file_llseek, 35 .llseek = generic_file_llseek,
36 .read = generic_file_read, 36 .read = generic_file_read,
37 .write = generic_file_write, 37 .write = generic_file_write,
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 185567a6a561..85997b1205f5 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -528,7 +528,7 @@ open_exec_out:
528} 528}
529#endif /* HAVE_FOP_OPEN_EXEC */ 529#endif /* HAVE_FOP_OPEN_EXEC */
530 530
531struct file_operations xfs_file_operations = { 531const struct file_operations xfs_file_operations = {
532 .llseek = generic_file_llseek, 532 .llseek = generic_file_llseek,
533 .read = do_sync_read, 533 .read = do_sync_read,
534 .write = do_sync_write, 534 .write = do_sync_write,
@@ -550,7 +550,7 @@ struct file_operations xfs_file_operations = {
550#endif 550#endif
551}; 551};
552 552
553struct file_operations xfs_invis_file_operations = { 553const struct file_operations xfs_invis_file_operations = {
554 .llseek = generic_file_llseek, 554 .llseek = generic_file_llseek,
555 .read = do_sync_read, 555 .read = do_sync_read,
556 .write = do_sync_write, 556 .write = do_sync_write,
@@ -570,7 +570,7 @@ struct file_operations xfs_invis_file_operations = {
570}; 570};
571 571
572 572
573struct file_operations xfs_dir_file_operations = { 573const struct file_operations xfs_dir_file_operations = {
574 .read = generic_read_dir, 574 .read = generic_read_dir,
575 .readdir = xfs_file_readdir, 575 .readdir = xfs_file_readdir,
576 .unlocked_ioctl = xfs_file_ioctl, 576 .unlocked_ioctl = xfs_file_ioctl,
diff --git a/fs/xfs/linux-2.6/xfs_iops.h b/fs/xfs/linux-2.6/xfs_iops.h
index a8417d7af5f9..ad6173da5678 100644
--- a/fs/xfs/linux-2.6/xfs_iops.h
+++ b/fs/xfs/linux-2.6/xfs_iops.h
@@ -22,9 +22,9 @@ extern struct inode_operations xfs_inode_operations;
22extern struct inode_operations xfs_dir_inode_operations; 22extern struct inode_operations xfs_dir_inode_operations;
23extern struct inode_operations xfs_symlink_inode_operations; 23extern struct inode_operations xfs_symlink_inode_operations;
24 24
25extern struct file_operations xfs_file_operations; 25extern const struct file_operations xfs_file_operations;
26extern struct file_operations xfs_dir_file_operations; 26extern const struct file_operations xfs_dir_file_operations;
27extern struct file_operations xfs_invis_file_operations; 27extern const struct file_operations xfs_invis_file_operations;
28 28
29extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *, 29extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
30 int, unsigned int, void __user *); 30 int, unsigned int, void __user *);
diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h
index 95707182b3ed..76f89356b6a7 100644
--- a/include/asm-alpha/poll.h
+++ b/include/asm-alpha/poll.h
@@ -12,8 +12,8 @@
12#define POLLWRNORM (1 << 8) 12#define POLLWRNORM (1 << 8)
13#define POLLWRBAND (1 << 9) 13#define POLLWRBAND (1 << 9)
14#define POLLMSG (1 << 10) 14#define POLLMSG (1 << 10)
15#define POLLREMOVE (1 << 11) 15#define POLLREMOVE (1 << 12)
16#define POLLRDHUP (1 << 12) 16#define POLLRDHUP (1 << 13)
17 17
18 18
19struct pollfd { 19struct pollfd {
diff --git a/include/asm-generic/local.h b/include/asm-generic/local.h
index 16fc00360f75..de4614840c2c 100644
--- a/include/asm-generic/local.h
+++ b/include/asm-generic/local.h
@@ -4,28 +4,28 @@
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/percpu.h> 5#include <linux/percpu.h>
6#include <linux/hardirq.h> 6#include <linux/hardirq.h>
7#include <asm/atomic.h>
7#include <asm/types.h> 8#include <asm/types.h>
8 9
9/* An unsigned long type for operations which are atomic for a single 10/* An unsigned long type for operations which are atomic for a single
10 * CPU. Usually used in combination with per-cpu variables. */ 11 * CPU. Usually used in combination with per-cpu variables. */
11 12
12#if BITS_PER_LONG == 32
13/* Implement in terms of atomics. */ 13/* Implement in terms of atomics. */
14 14
15/* Don't use typedef: don't want them to be mixed with atomic_t's. */ 15/* Don't use typedef: don't want them to be mixed with atomic_t's. */
16typedef struct 16typedef struct
17{ 17{
18 atomic_t a; 18 atomic_long_t a;
19} local_t; 19} local_t;
20 20
21#define LOCAL_INIT(i) { ATOMIC_INIT(i) } 21#define LOCAL_INIT(i) { ATOMIC_LONG_INIT(i) }
22 22
23#define local_read(l) ((unsigned long)atomic_read(&(l)->a)) 23#define local_read(l) ((unsigned long)atomic_long_read(&(l)->a))
24#define local_set(l,i) atomic_set((&(l)->a),(i)) 24#define local_set(l,i) atomic_long_set((&(l)->a),(i))
25#define local_inc(l) atomic_inc(&(l)->a) 25#define local_inc(l) atomic_long_inc(&(l)->a)
26#define local_dec(l) atomic_dec(&(l)->a) 26#define local_dec(l) atomic_long_dec(&(l)->a)
27#define local_add(i,l) atomic_add((i),(&(l)->a)) 27#define local_add(i,l) atomic_long_add((i),(&(l)->a))
28#define local_sub(i,l) atomic_sub((i),(&(l)->a)) 28#define local_sub(i,l) atomic_long_sub((i),(&(l)->a))
29 29
30/* Non-atomic variants, ie. preemption disabled and won't be touched 30/* Non-atomic variants, ie. preemption disabled and won't be touched
31 * in interrupt, etc. Some archs can optimize this case well. */ 31 * in interrupt, etc. Some archs can optimize this case well. */
@@ -34,68 +34,6 @@ typedef struct
34#define __local_add(i,l) local_set((l), local_read(l) + (i)) 34#define __local_add(i,l) local_set((l), local_read(l) + (i))
35#define __local_sub(i,l) local_set((l), local_read(l) - (i)) 35#define __local_sub(i,l) local_set((l), local_read(l) - (i))
36 36
37#else /* ... can't use atomics. */
38/* Implement in terms of three variables.
39 Another option would be to use local_irq_save/restore. */
40
41typedef struct
42{
43 /* 0 = in hardirq, 1 = in softirq, 2 = usermode. */
44 unsigned long v[3];
45} local_t;
46
47#define _LOCAL_VAR(l) ((l)->v[!in_interrupt() + !in_irq()])
48
49#define LOCAL_INIT(i) { { (i), 0, 0 } }
50
51static inline unsigned long local_read(local_t *l)
52{
53 return l->v[0] + l->v[1] + l->v[2];
54}
55
56static inline void local_set(local_t *l, unsigned long v)
57{
58 l->v[0] = v;
59 l->v[1] = l->v[2] = 0;
60}
61
62static inline void local_inc(local_t *l)
63{
64 preempt_disable();
65 _LOCAL_VAR(l)++;
66 preempt_enable();
67}
68
69static inline void local_dec(local_t *l)
70{
71 preempt_disable();
72 _LOCAL_VAR(l)--;
73 preempt_enable();
74}
75
76static inline void local_add(unsigned long v, local_t *l)
77{
78 preempt_disable();
79 _LOCAL_VAR(l) += v;
80 preempt_enable();
81}
82
83static inline void local_sub(unsigned long v, local_t *l)
84{
85 preempt_disable();
86 _LOCAL_VAR(l) -= v;
87 preempt_enable();
88}
89
90/* Non-atomic variants, ie. preemption disabled and won't be touched
91 * in interrupt, etc. Some archs can optimize this case well. */
92#define __local_inc(l) ((l)->v[0]++)
93#define __local_dec(l) ((l)->v[0]--)
94#define __local_add(i,l) ((l)->v[0] += (i))
95#define __local_sub(i,l) ((l)->v[0] -= (i))
96
97#endif /* Non-atomic implementation */
98
99/* Use these for per-cpu local_t variables: on some archs they are 37/* Use these for per-cpu local_t variables: on some archs they are
100 * much more efficient than these naive implementations. Note they take 38 * much more efficient than these naive implementations. Note they take
101 * a variable (eg. mystruct.foo), not an address. 39 * a variable (eg. mystruct.foo), not an address.
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index 78cf45547e31..c0caf433a7d7 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -19,7 +19,7 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
19#define percpu_modcopy(pcpudst, src, size) \ 19#define percpu_modcopy(pcpudst, src, size) \
20do { \ 20do { \
21 unsigned int __i; \ 21 unsigned int __i; \
22 for_each_cpu(__i) \ 22 for_each_possible_cpu(__i) \
23 memcpy((pcpudst)+__per_cpu_offset[__i], \ 23 memcpy((pcpudst)+__per_cpu_offset[__i], \
24 (src), (size)); \ 24 (src), (size)); \
25} while (0) 25} while (0)
diff --git a/include/asm-i386/mach-default/mach_time.h b/include/asm-i386/mach-default/mach_time.h
index b749aa44a86f..31eb5de6f3dc 100644
--- a/include/asm-i386/mach-default/mach_time.h
+++ b/include/asm-i386/mach-default/mach_time.h
@@ -82,21 +82,8 @@ static inline int mach_set_rtc_mmss(unsigned long nowtime)
82static inline unsigned long mach_get_cmos_time(void) 82static inline unsigned long mach_get_cmos_time(void)
83{ 83{
84 unsigned int year, mon, day, hour, min, sec; 84 unsigned int year, mon, day, hour, min, sec;
85 int i;
86 85
87 /* The Linux interpretation of the CMOS clock register contents: 86 do {
88 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
89 * RTC registers show the second which has precisely just started.
90 * Let's hope other operating systems interpret the RTC the same way.
91 */
92 /* read RTC exactly on falling edge of update flag */
93 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
94 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
95 break;
96 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
97 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
98 break;
99 do { /* Isn't this overkill ? UIP above should guarantee consistency */
100 sec = CMOS_READ(RTC_SECONDS); 87 sec = CMOS_READ(RTC_SECONDS);
101 min = CMOS_READ(RTC_MINUTES); 88 min = CMOS_READ(RTC_MINUTES);
102 hour = CMOS_READ(RTC_HOURS); 89 hour = CMOS_READ(RTC_HOURS);
@@ -104,16 +91,18 @@ static inline unsigned long mach_get_cmos_time(void)
104 mon = CMOS_READ(RTC_MONTH); 91 mon = CMOS_READ(RTC_MONTH);
105 year = CMOS_READ(RTC_YEAR); 92 year = CMOS_READ(RTC_YEAR);
106 } while (sec != CMOS_READ(RTC_SECONDS)); 93 } while (sec != CMOS_READ(RTC_SECONDS));
107 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 94
108 { 95 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
109 BCD_TO_BIN(sec); 96 BCD_TO_BIN(sec);
110 BCD_TO_BIN(min); 97 BCD_TO_BIN(min);
111 BCD_TO_BIN(hour); 98 BCD_TO_BIN(hour);
112 BCD_TO_BIN(day); 99 BCD_TO_BIN(day);
113 BCD_TO_BIN(mon); 100 BCD_TO_BIN(mon);
114 BCD_TO_BIN(year); 101 BCD_TO_BIN(year);
115 } 102 }
116 if ((year += 1900) < 1970) 103
104 year += 1900;
105 if (year < 1970)
117 year += 100; 106 year += 100;
118 107
119 return mktime(year, mon, day, hour, min, sec); 108 return mktime(year, mon, day, hour, min, sec);
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index af4bfd012475..805f0dcda468 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -621,8 +621,6 @@ struct extended_sigtable {
621 unsigned int reserved[3]; 621 unsigned int reserved[3];
622 struct extended_signature sigs[0]; 622 struct extended_signature sigs[0];
623}; 623};
624/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */
625#define MICROCODE_IOCFREE _IO('6',0)
626 624
627/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 625/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
628static inline void rep_nop(void) 626static inline void rep_nop(void)
diff --git a/include/asm-mips/mc146818-time.h b/include/asm-mips/mc146818-time.h
index 47214861093b..41ac8d363c67 100644
--- a/include/asm-mips/mc146818-time.h
+++ b/include/asm-mips/mc146818-time.h
@@ -86,43 +86,14 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime)
86 return retval; 86 return retval;
87} 87}
88 88
89/*
90 * Returns true if a clock update is in progress
91 */
92static inline unsigned char rtc_is_updating(void)
93{
94 unsigned char uip;
95 unsigned long flags;
96
97 spin_lock_irqsave(&rtc_lock, flags);
98 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
99 spin_unlock_irqrestore(&rtc_lock, flags);
100 return uip;
101}
102
103static inline unsigned long mc146818_get_cmos_time(void) 89static inline unsigned long mc146818_get_cmos_time(void)
104{ 90{
105 unsigned int year, mon, day, hour, min, sec; 91 unsigned int year, mon, day, hour, min, sec;
106 int i;
107 unsigned long flags; 92 unsigned long flags;
108 93
109 /*
110 * The Linux interpretation of the CMOS clock register contents:
111 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
112 * RTC registers show the second which has precisely just started.
113 * Let's hope other operating systems interpret the RTC the same way.
114 */
115
116 /* read RTC exactly on falling edge of update flag */
117 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
118 if (rtc_is_updating())
119 break;
120 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
121 if (!rtc_is_updating())
122 break;
123
124 spin_lock_irqsave(&rtc_lock, flags); 94 spin_lock_irqsave(&rtc_lock, flags);
125 do { /* Isn't this overkill ? UIP above should guarantee consistency */ 95
96 do {
126 sec = CMOS_READ(RTC_SECONDS); 97 sec = CMOS_READ(RTC_SECONDS);
127 min = CMOS_READ(RTC_MINUTES); 98 min = CMOS_READ(RTC_MINUTES);
128 hour = CMOS_READ(RTC_HOURS); 99 hour = CMOS_READ(RTC_HOURS);
diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h
index 8e23e4c674f6..0a3face6c480 100644
--- a/include/asm-parisc/pdc.h
+++ b/include/asm-parisc/pdc.h
@@ -333,7 +333,7 @@ struct pdc_model { /* for PDC_MODEL */
333 unsigned long curr_key; 333 unsigned long curr_key;
334}; 334};
335 335
336/* Values for PDC_MODEL_CAPABILITES non-equivalent virtual aliasing support */ 336/* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */
337 337
338#define PDC_MODEL_IOPDIR_FDC (1 << 2) /* see sba_iommu.c */ 338#define PDC_MODEL_IOPDIR_FDC (1 << 2) /* see sba_iommu.c */
339#define PDC_MODEL_NVA_MASK (3 << 4) 339#define PDC_MODEL_NVA_MASK (3 << 4)
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
index dbb05d1a26d1..720afc11c2ca 100644
--- a/include/asm-sh/addrspace.h
+++ b/include/asm-sh/addrspace.h
@@ -13,7 +13,7 @@
13 13
14#include <asm/cpu/addrspace.h> 14#include <asm/cpu/addrspace.h>
15 15
16/* Memory segments (32bit Priviledged mode addresses) */ 16/* Memory segments (32bit Privileged mode addresses) */
17#define P0SEG 0x00000000 17#define P0SEG 0x00000000
18#define P1SEG 0x80000000 18#define P1SEG 0x80000000
19#define P2SEG 0xa0000000 19#define P2SEG 0xa0000000
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 49d49a285943..6a95d5d0c576 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -738,7 +738,7 @@ static unsigned long __init sun_floppy_init(void)
738 if (!sun_floppy_types[0] && sun_floppy_types[1]) { 738 if (!sun_floppy_types[0] && sun_floppy_types[1]) {
739 /* 739 /*
740 * Set the drive exchange bit in FCR on NS87303, 740 * Set the drive exchange bit in FCR on NS87303,
741 * make shure other bits are sane before doing so. 741 * make sure other bits are sane before doing so.
742 */ 742 */
743 ns87303_modify(config, FER, FER_EDM, 0); 743 ns87303_modify(config, FER, FER_EDM, 0);
744 ns87303_modify(config, ASC, ASC_DRV2_SEL, 0); 744 ns87303_modify(config, ASC, ASC_DRV2_SEL, 0);
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 1aa2cee43344..37a3ec433ee5 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -358,9 +358,6 @@ struct extended_sigtable {
358 struct extended_signature sigs[0]; 358 struct extended_signature sigs[0];
359}; 359};
360 360
361/* '6' because it used to be for P6 only (but now covers Pentium 4 as well) */
362#define MICROCODE_IOCFREE _IO('6',0)
363
364 361
365#define ASM_NOP1 K8_NOP1 362#define ASM_NOP1 K8_NOP1
366#define ASM_NOP2 K8_NOP2 363#define ASM_NOP2 K8_NOP2
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index 8da37e29cb87..2216638962d2 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -5,13 +5,13 @@
5struct cdev { 5struct cdev {
6 struct kobject kobj; 6 struct kobject kobj;
7 struct module *owner; 7 struct module *owner;
8 struct file_operations *ops; 8 const struct file_operations *ops;
9 struct list_head list; 9 struct list_head list;
10 dev_t dev; 10 dev_t dev;
11 unsigned int count; 11 unsigned int count;
12}; 12};
13 13
14void cdev_init(struct cdev *, struct file_operations *); 14void cdev_init(struct cdev *, const struct file_operations *);
15 15
16struct cdev *cdev_alloc(void); 16struct cdev *cdev_alloc(void);
17 17
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index cc621ec409d8..b3ecf8f71d97 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -30,9 +30,9 @@ extern struct inode_operations coda_ioctl_inode_operations;
30extern struct address_space_operations coda_file_aops; 30extern struct address_space_operations coda_file_aops;
31extern struct address_space_operations coda_symlink_aops; 31extern struct address_space_operations coda_symlink_aops;
32 32
33extern struct file_operations coda_dir_operations; 33extern const struct file_operations coda_dir_operations;
34extern struct file_operations coda_file_operations; 34extern const struct file_operations coda_file_operations;
35extern struct file_operations coda_ioctl_operations; 35extern const struct file_operations coda_ioctl_operations;
36 36
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 99e6115d8e52..9cbb781d6f80 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -67,7 +67,7 @@
67 * 67 *
68 * int any_online_cpu(mask) First online cpu in mask 68 * int any_online_cpu(mask) First online cpu in mask
69 * 69 *
70 * for_each_cpu(cpu) for-loop cpu over cpu_possible_map 70 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
71 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map 71 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
72 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map 72 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
73 * 73 *
@@ -405,7 +405,8 @@ int __any_online_cpu(const cpumask_t *mask);
405#define any_online_cpu(mask) 0 405#define any_online_cpu(mask) 0
406#endif 406#endif
407 407
408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) 408#define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
409#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) 410#define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map)
410#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) 411#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
411 412
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 534d750d922d..32503657f14f 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -11,7 +11,7 @@
11extern unsigned long long elfcorehdr_addr; 11extern unsigned long long elfcorehdr_addr;
12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
13 unsigned long, int); 13 unsigned long, int);
14extern struct file_operations proc_vmcore_operations; 14extern const struct file_operations proc_vmcore_operations;
15extern struct proc_dir_entry *proc_vmcore; 15extern struct proc_dir_entry *proc_vmcore;
16 16
17#endif /* CONFIG_CRASH_DUMP */ 17#endif /* CONFIG_CRASH_DUMP */
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 4b0428e335be..176e2d371577 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -29,7 +29,7 @@ struct debugfs_blob_wrapper {
29#if defined(CONFIG_DEBUG_FS) 29#if defined(CONFIG_DEBUG_FS)
30struct dentry *debugfs_create_file(const char *name, mode_t mode, 30struct dentry *debugfs_create_file(const char *name, mode_t mode,
31 struct dentry *parent, void *data, 31 struct dentry *parent, void *data,
32 struct file_operations *fops); 32 const struct file_operations *fops);
33 33
34struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); 34struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
35 35
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index a8731062a74c..9b4751aecc23 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -21,6 +21,7 @@ enum dma_data_direction {
21#define DMA_30BIT_MASK 0x000000003fffffffULL 21#define DMA_30BIT_MASK 0x000000003fffffffULL
22#define DMA_29BIT_MASK 0x000000001fffffffULL 22#define DMA_29BIT_MASK 0x000000001fffffffULL
23#define DMA_28BIT_MASK 0x000000000fffffffULL 23#define DMA_28BIT_MASK 0x000000000fffffffULL
24#define DMA_24BIT_MASK 0x0000000000ffffffULL
24 25
25#include <asm/dma-mapping.h> 26#include <asm/dma-mapping.h>
26 27
diff --git a/include/linux/efs_fs.h b/include/linux/efs_fs.h
index 28f368c526fb..fbfa6b52e2fb 100644
--- a/include/linux/efs_fs.h
+++ b/include/linux/efs_fs.h
@@ -37,7 +37,7 @@ static inline struct efs_sb_info *SUPER_INFO(struct super_block *sb)
37struct statfs; 37struct statfs;
38 38
39extern struct inode_operations efs_dir_inode_operations; 39extern struct inode_operations efs_dir_inode_operations;
40extern struct file_operations efs_dir_operations; 40extern const struct file_operations efs_dir_operations;
41extern struct address_space_operations efs_symlink_aops; 41extern struct address_space_operations efs_symlink_aops;
42 42
43extern void efs_read_inode(struct inode *); 43extern void efs_read_inode(struct inode *);
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 8bb4f842cded..3ade6a4e3bdd 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -833,11 +833,11 @@ do { \
833 */ 833 */
834 834
835/* dir.c */ 835/* dir.c */
836extern struct file_operations ext3_dir_operations; 836extern const struct file_operations ext3_dir_operations;
837 837
838/* file.c */ 838/* file.c */
839extern struct inode_operations ext3_file_inode_operations; 839extern struct inode_operations ext3_file_inode_operations;
840extern struct file_operations ext3_file_operations; 840extern const struct file_operations ext3_file_operations;
841 841
842/* namei.c */ 842/* namei.c */
843extern struct inode_operations ext3_dir_inode_operations; 843extern struct inode_operations ext3_dir_inode_operations;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 2cb19e6503aa..d03fadfcafe3 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -734,7 +734,7 @@ struct fb_tile_ops {
734 734
735/* A driver may set this flag to indicate that it does want a set_par to be 735/* A driver may set this flag to indicate that it does want a set_par to be
736 * called every time when fbcon_switch is executed. The advantage is that with 736 * called every time when fbcon_switch is executed. The advantage is that with
737 * this flag set you can really be shure that set_par is always called before 737 * this flag set you can really be sure that set_par is always called before
738 * any of the functions dependant on the correct hardware state or altering 738 * any of the functions dependant on the correct hardware state or altering
739 * that state, even if you are using some broken X releases. The disadvantage 739 * that state, even if you are using some broken X releases. The disadvantage
740 * is that it introduces unwanted delays to every console switch if set_par 740 * is that it introduces unwanted delays to every console switch if set_par
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 680d913350e7..408fe89498f4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -496,7 +496,7 @@ struct inode {
496 struct mutex i_mutex; 496 struct mutex i_mutex;
497 struct rw_semaphore i_alloc_sem; 497 struct rw_semaphore i_alloc_sem;
498 struct inode_operations *i_op; 498 struct inode_operations *i_op;
499 struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 499 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
500 struct super_block *i_sb; 500 struct super_block *i_sb;
501 struct file_lock *i_flock; 501 struct file_lock *i_flock;
502 struct address_space *i_mapping; 502 struct address_space *i_mapping;
@@ -636,7 +636,7 @@ struct file {
636 } f_u; 636 } f_u;
637 struct dentry *f_dentry; 637 struct dentry *f_dentry;
638 struct vfsmount *f_vfsmnt; 638 struct vfsmount *f_vfsmnt;
639 struct file_operations *f_op; 639 const struct file_operations *f_op;
640 atomic_t f_count; 640 atomic_t f_count;
641 unsigned int f_flags; 641 unsigned int f_flags;
642 mode_t f_mode; 642 mode_t f_mode;
@@ -1390,11 +1390,11 @@ extern void bd_set_size(struct block_device *, loff_t size);
1390extern void bd_forget(struct inode *inode); 1390extern void bd_forget(struct inode *inode);
1391extern void bdput(struct block_device *); 1391extern void bdput(struct block_device *);
1392extern struct block_device *open_by_devnum(dev_t, unsigned); 1392extern struct block_device *open_by_devnum(dev_t, unsigned);
1393extern struct file_operations def_blk_fops; 1393extern const struct file_operations def_blk_fops;
1394extern struct address_space_operations def_blk_aops; 1394extern struct address_space_operations def_blk_aops;
1395extern struct file_operations def_chr_fops; 1395extern const struct file_operations def_chr_fops;
1396extern struct file_operations bad_sock_fops; 1396extern const struct file_operations bad_sock_fops;
1397extern struct file_operations def_fifo_fops; 1397extern const struct file_operations def_fifo_fops;
1398extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long); 1398extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
1399extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long); 1399extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
1400extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1400extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
@@ -1414,7 +1414,7 @@ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
1414extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); 1414extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
1415extern int register_chrdev_region(dev_t, unsigned, const char *); 1415extern int register_chrdev_region(dev_t, unsigned, const char *);
1416extern int register_chrdev(unsigned int, const char *, 1416extern int register_chrdev(unsigned int, const char *,
1417 struct file_operations *); 1417 const struct file_operations *);
1418extern int unregister_chrdev(unsigned int, const char *); 1418extern int unregister_chrdev(unsigned int, const char *);
1419extern void unregister_chrdev_region(dev_t, unsigned); 1419extern void unregister_chrdev_region(dev_t, unsigned);
1420extern int chrdev_open(struct inode *, struct file *); 1420extern int chrdev_open(struct inode *, struct file *);
@@ -1444,9 +1444,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
1444extern void make_bad_inode(struct inode *); 1444extern void make_bad_inode(struct inode *);
1445extern int is_bad_inode(struct inode *); 1445extern int is_bad_inode(struct inode *);
1446 1446
1447extern struct file_operations read_fifo_fops; 1447extern const struct file_operations read_fifo_fops;
1448extern struct file_operations write_fifo_fops; 1448extern const struct file_operations write_fifo_fops;
1449extern struct file_operations rdwr_fifo_fops; 1449extern const struct file_operations rdwr_fifo_fops;
1450 1450
1451extern int fs_may_remount_ro(struct super_block *); 1451extern int fs_may_remount_ro(struct super_block *);
1452 1452
@@ -1688,7 +1688,7 @@ static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
1688 nr_segs, get_block, end_io, DIO_OWN_LOCKING); 1688 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
1689} 1689}
1690 1690
1691extern struct file_operations generic_ro_fops; 1691extern const struct file_operations generic_ro_fops;
1692 1692
1693#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 1693#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
1694 1694
@@ -1744,9 +1744,9 @@ extern int simple_commit_write(struct file *file, struct page *page,
1744 1744
1745extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *); 1745extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
1746extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); 1746extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
1747extern struct file_operations simple_dir_operations; 1747extern const struct file_operations simple_dir_operations;
1748extern struct inode_operations simple_dir_inode_operations; 1748extern struct inode_operations simple_dir_inode_operations;
1749struct tree_descr { char *name; struct file_operations *ops; int mode; }; 1749struct tree_descr { char *name; const struct file_operations *ops; int mode; };
1750struct dentry *d_alloc_name(struct dentry *, const char *); 1750struct dentry *d_alloc_name(struct dentry *, const char *);
1751extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 1751extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
1752extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count); 1752extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3c1b0294a742..10a27f29d692 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -152,14 +152,14 @@ struct disk_attribute {
152({ \ 152({ \
153 typeof(gendiskp->dkstats->field) res = 0; \ 153 typeof(gendiskp->dkstats->field) res = 0; \
154 int i; \ 154 int i; \
155 for_each_cpu(i) \ 155 for_each_possible_cpu(i) \
156 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \ 156 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
157 res; \ 157 res; \
158}) 158})
159 159
160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 160static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) {
161 int i; 161 int i;
162 for_each_cpu(i) 162 for_each_possible_cpu(i)
163 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 163 memset(per_cpu_ptr(gendiskp->dkstats, i), value,
164 sizeof (struct disk_stats)); 164 sizeof (struct disk_stats));
165} 165}
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index d6f1019625af..4c5e610fe442 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -154,7 +154,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
154 return sb->s_fs_info; 154 return sb->s_fs_info;
155} 155}
156 156
157extern struct file_operations hugetlbfs_file_operations; 157extern const struct file_operations hugetlbfs_file_operations;
158extern struct vm_operations_struct hugetlb_vm_ops; 158extern struct vm_operations_struct hugetlb_vm_ops;
159struct file *hugetlb_zero_setup(size_t); 159struct file *hugetlb_zero_setup(size_t);
160int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info, 160int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info,
diff --git a/include/linux/input.h b/include/linux/input.h
index 6d4cc3c110d6..1d4e341b72e6 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -957,7 +957,7 @@ struct input_handler {
957 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id); 957 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
958 void (*disconnect)(struct input_handle *handle); 958 void (*disconnect)(struct input_handle *handle);
959 959
960 struct file_operations *fops; 960 const struct file_operations *fops;
961 int minor; 961 int minor;
962 char *name; 962 char *name;
963 963
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index a484572c302e..b46249082cca 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -46,7 +46,7 @@ static inline int kstat_irqs(int irq)
46{ 46{
47 int cpu, sum = 0; 47 int cpu, sum = 0;
48 48
49 for_each_cpu(cpu) 49 for_each_possible_cpu(cpu)
50 sum += kstat_cpu(cpu).irqs[irq]; 50 sum += kstat_cpu(cpu).irqs[irq];
51 51
52 return sum; 52 return sum;
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 14ceebfc1efa..5b584dafb5a6 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -36,7 +36,7 @@ struct class_device;
36struct miscdevice { 36struct miscdevice {
37 int minor; 37 int minor;
38 const char *name; 38 const char *name;
39 struct file_operations *fops; 39 const struct file_operations *fops;
40 struct list_head list; 40 struct list_head list;
41 struct device *dev; 41 struct device *dev;
42 struct class_device *class; 42 struct class_device *class;
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 779e6a5744c7..d9035c73e5d1 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -334,7 +334,7 @@ extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys,
334 unsigned long *mapped_blocks); 334 unsigned long *mapped_blocks);
335 335
336/* fat/dir.c */ 336/* fat/dir.c */
337extern struct file_operations fat_dir_operations; 337extern const struct file_operations fat_dir_operations;
338extern int fat_search_long(struct inode *inode, const unsigned char *name, 338extern int fat_search_long(struct inode *inode, const unsigned char *name,
339 int name_len, struct fat_slot_info *sinfo); 339 int name_len, struct fat_slot_info *sinfo);
340extern int fat_dir_empty(struct inode *dir); 340extern int fat_dir_empty(struct inode *dir);
@@ -397,7 +397,7 @@ extern int fat_count_free_clusters(struct super_block *sb);
397/* fat/file.c */ 397/* fat/file.c */
398extern int fat_generic_ioctl(struct inode *inode, struct file *filp, 398extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
399 unsigned int cmd, unsigned long arg); 399 unsigned int cmd, unsigned long arg);
400extern struct file_operations fat_file_operations; 400extern const struct file_operations fat_file_operations;
401extern struct inode_operations fat_file_inode_operations; 401extern struct inode_operations fat_file_inode_operations;
402extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 402extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
403extern void fat_truncate(struct inode *inode); 403extern void fat_truncate(struct inode *inode);
@@ -420,6 +420,9 @@ extern int date_dos2unix(unsigned short time, unsigned short date);
420extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date); 420extern void fat_date_unix2dos(int unix_date, __le16 *time, __le16 *date);
421extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs); 421extern int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs);
422 422
423int fat_cache_init(void);
424void fat_cache_destroy(void);
425
423#endif /* __KERNEL__ */ 426#endif /* __KERNEL__ */
424 427
425#endif 428#endif
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index e01342568530..96dc237b8f03 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -209,7 +209,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
209 209
210/* linux/fs/ncpfs/dir.c */ 210/* linux/fs/ncpfs/dir.c */
211extern struct inode_operations ncp_dir_inode_operations; 211extern struct inode_operations ncp_dir_inode_operations;
212extern struct file_operations ncp_dir_operations; 212extern const struct file_operations ncp_dir_operations;
213int ncp_conn_logged_in(struct super_block *); 213int ncp_conn_logged_in(struct super_block *);
214int ncp_date_dos2unix(__le16 time, __le16 date); 214int ncp_date_dos2unix(__le16 time, __le16 date);
215void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 215void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
@@ -230,7 +230,7 @@ void ncp_unlock_server(struct ncp_server *server);
230 230
231/* linux/fs/ncpfs/file.c */ 231/* linux/fs/ncpfs/file.c */
232extern struct inode_operations ncp_file_inode_operations; 232extern struct inode_operations ncp_file_inode_operations;
233extern struct file_operations ncp_file_operations; 233extern const struct file_operations ncp_file_operations;
234int ncp_make_open(struct inode *, int); 234int ncp_make_open(struct inode *, int);
235 235
236/* linux/fs/ncpfs/mmap.c */ 236/* linux/fs/ncpfs/mmap.c */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index cbebd7d1b9e8..c71227dd4389 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -324,7 +324,7 @@ extern struct inode_operations nfs_file_inode_operations;
324#ifdef CONFIG_NFS_V3 324#ifdef CONFIG_NFS_V3
325extern struct inode_operations nfs3_file_inode_operations; 325extern struct inode_operations nfs3_file_inode_operations;
326#endif /* CONFIG_NFS_V3 */ 326#endif /* CONFIG_NFS_V3 */
327extern struct file_operations nfs_file_operations; 327extern const struct file_operations nfs_file_operations;
328extern struct address_space_operations nfs_file_aops; 328extern struct address_space_operations nfs_file_aops;
329 329
330static inline struct rpc_cred *nfs_file_cred(struct file *file) 330static inline struct rpc_cred *nfs_file_cred(struct file *file)
@@ -371,7 +371,7 @@ extern struct inode_operations nfs_dir_inode_operations;
371#ifdef CONFIG_NFS_V3 371#ifdef CONFIG_NFS_V3
372extern struct inode_operations nfs3_dir_inode_operations; 372extern struct inode_operations nfs3_dir_inode_operations;
373#endif /* CONFIG_NFS_V3 */ 373#endif /* CONFIG_NFS_V3 */
374extern struct file_operations nfs_dir_operations; 374extern const struct file_operations nfs_dir_operations;
375extern struct dentry_operations nfs_dentry_operations; 375extern struct dentry_operations nfs_dentry_operations;
376 376
377extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 377extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 559c4c38a9c7..0d514b252454 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -61,6 +61,16 @@ void oprofile_arch_exit(void);
61 */ 61 */
62void oprofile_add_sample(struct pt_regs * const regs, unsigned long event); 62void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
63 63
64/**
65 * Add an extended sample. Use this when the PC is not from the regs, and
66 * we cannot determine if we're in kernel mode from the regs.
67 *
68 * This function does perform a backtrace.
69 *
70 */
71void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
72 unsigned long event, int is_kernel);
73
64/* Use this instead when the PC value is not from the regs. Doesn't 74/* Use this instead when the PC value is not from the regs. Doesn't
65 * backtrace. */ 75 * backtrace. */
66void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event); 76void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event);
@@ -74,10 +84,10 @@ void oprofile_add_trace(unsigned long eip);
74 * the specified file operations. 84 * the specified file operations.
75 */ 85 */
76int oprofilefs_create_file(struct super_block * sb, struct dentry * root, 86int oprofilefs_create_file(struct super_block * sb, struct dentry * root,
77 char const * name, struct file_operations * fops); 87 char const * name, const struct file_operations * fops);
78 88
79int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root, 89int oprofilefs_create_file_perm(struct super_block * sb, struct dentry * root,
80 char const * name, struct file_operations * fops, int perm); 90 char const * name, const struct file_operations * fops, int perm);
81 91
82/** Create a file for read/write access to an unsigned long. */ 92/** Create a file for read/write access to an unsigned long. */
83int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root, 93int oprofilefs_create_ulong(struct super_block * sb, struct dentry * root,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 02f6cf20b141..e2ab2ac18d6b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -642,6 +642,7 @@
642#define PCI_DEVICE_ID_SI_965 0x0965 642#define PCI_DEVICE_ID_SI_965 0x0965
643#define PCI_DEVICE_ID_SI_5511 0x5511 643#define PCI_DEVICE_ID_SI_5511 0x5511
644#define PCI_DEVICE_ID_SI_5513 0x5513 644#define PCI_DEVICE_ID_SI_5513 0x5513
645#define PCI_DEVICE_ID_SI_5517 0x5517
645#define PCI_DEVICE_ID_SI_5518 0x5518 646#define PCI_DEVICE_ID_SI_5518 0x5518
646#define PCI_DEVICE_ID_SI_5571 0x5571 647#define PCI_DEVICE_ID_SI_5571 0x5571
647#define PCI_DEVICE_ID_SI_5581 0x5581 648#define PCI_DEVICE_ID_SI_5581 0x5581
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8e8f6098508a..51e1b56741fb 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -11,6 +11,15 @@
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13 13
14/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
15 additional memory. */
16#define MAX_STACK_ALLOC 832
17#define FRONTEND_STACK_ALLOC 256
18#define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
19#define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
20#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
21#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
22
14struct poll_table_struct; 23struct poll_table_struct;
15 24
16/* 25/*
@@ -33,6 +42,12 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
33 pt->qproc = qproc; 42 pt->qproc = qproc;
34} 43}
35 44
45struct poll_table_entry {
46 struct file * filp;
47 wait_queue_t wait;
48 wait_queue_head_t * wait_address;
49};
50
36/* 51/*
37 * Structures and helpers for sys_poll/sys_poll 52 * Structures and helpers for sys_poll/sys_poll
38 */ 53 */
@@ -40,6 +55,8 @@ struct poll_wqueues {
40 poll_table pt; 55 poll_table pt;
41 struct poll_table_page * table; 56 struct poll_table_page * table;
42 int error; 57 int error;
58 int inline_index;
59 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
43}; 60};
44 61
45extern void poll_initwait(struct poll_wqueues *pwq); 62extern void poll_initwait(struct poll_wqueues *pwq);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index cb224cf653b1..135871df9911 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -58,7 +58,7 @@ struct proc_dir_entry {
58 gid_t gid; 58 gid_t gid;
59 loff_t size; 59 loff_t size;
60 struct inode_operations * proc_iops; 60 struct inode_operations * proc_iops;
61 struct file_operations * proc_fops; 61 const struct file_operations * proc_fops;
62 get_info_t *get_info; 62 get_info_t *get_info;
63 struct module *owner; 63 struct module *owner;
64 struct proc_dir_entry *next, *parent, *subdir; 64 struct proc_dir_entry *next, *parent, *subdir;
@@ -128,9 +128,9 @@ extern int proc_match(int, const char *,struct proc_dir_entry *);
128extern int proc_readdir(struct file *, void *, filldir_t); 128extern int proc_readdir(struct file *, void *, filldir_t);
129extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *); 129extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
130 130
131extern struct file_operations proc_kcore_operations; 131extern const struct file_operations proc_kcore_operations;
132extern struct file_operations proc_kmsg_operations; 132extern const struct file_operations proc_kmsg_operations;
133extern struct file_operations ppc_htab_operations; 133extern const struct file_operations ppc_htab_operations;
134 134
135/* 135/*
136 * proc_tty.c 136 * proc_tty.c
@@ -189,7 +189,7 @@ static inline struct proc_dir_entry *proc_net_create(const char *name,
189} 189}
190 190
191static inline struct proc_dir_entry *proc_net_fops_create(const char *name, 191static inline struct proc_dir_entry *proc_net_fops_create(const char *name,
192 mode_t mode, struct file_operations *fops) 192 mode_t mode, const struct file_operations *fops)
193{ 193{
194 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net); 194 struct proc_dir_entry *res = create_proc_entry(name, mode, proc_net);
195 if (res) 195 if (res)
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index fc610bb0f733..27f49c85d5d6 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -118,8 +118,8 @@ extern struct buffer_head *qnx4_bread(struct inode *, int, int);
118 118
119extern struct inode_operations qnx4_file_inode_operations; 119extern struct inode_operations qnx4_file_inode_operations;
120extern struct inode_operations qnx4_dir_inode_operations; 120extern struct inode_operations qnx4_dir_inode_operations;
121extern struct file_operations qnx4_file_operations; 121extern const struct file_operations qnx4_file_operations;
122extern struct file_operations qnx4_dir_operations; 122extern const struct file_operations qnx4_dir_operations;
123extern int qnx4_is_free(struct super_block *sb, long block); 123extern int qnx4_is_free(struct super_block *sb, long block);
124extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy); 124extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy);
125extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd); 125extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd);
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 953b6df5d037..78ecfa28b1c2 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -15,7 +15,7 @@ extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma); 15extern int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma);
16#endif 16#endif
17 17
18extern struct file_operations ramfs_file_operations; 18extern const struct file_operations ramfs_file_operations;
19extern struct vm_operations_struct generic_file_vm_ops; 19extern struct vm_operations_struct generic_file_vm_ops;
20 20
21#endif 21#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 912f1b7cb18f..5676c4210e2c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1960,7 +1960,7 @@ int reiserfs_global_version_in_proc(char *buffer, char **start, off_t offset,
1960extern struct inode_operations reiserfs_dir_inode_operations; 1960extern struct inode_operations reiserfs_dir_inode_operations;
1961extern struct inode_operations reiserfs_symlink_inode_operations; 1961extern struct inode_operations reiserfs_symlink_inode_operations;
1962extern struct inode_operations reiserfs_special_inode_operations; 1962extern struct inode_operations reiserfs_special_inode_operations;
1963extern struct file_operations reiserfs_dir_operations; 1963extern const struct file_operations reiserfs_dir_operations;
1964 1964
1965/* tail_conversion.c */ 1965/* tail_conversion.c */
1966int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 1966int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
@@ -1972,7 +1972,7 @@ void reiserfs_unmap_buffer(struct buffer_head *);
1972 1972
1973/* file.c */ 1973/* file.c */
1974extern struct inode_operations reiserfs_file_inode_operations; 1974extern struct inode_operations reiserfs_file_inode_operations;
1975extern struct file_operations reiserfs_file_operations; 1975extern const struct file_operations reiserfs_file_operations;
1976extern struct address_space_operations reiserfs_address_space_operations; 1976extern struct address_space_operations reiserfs_address_space_operations;
1977 1977
1978/* fix_nodes.c */ 1978/* fix_nodes.c */
diff --git a/include/linux/relayfs_fs.h b/include/linux/relayfs_fs.h
deleted file mode 100644
index 7342e66247fb..000000000000
--- a/include/linux/relayfs_fs.h
+++ /dev/null
@@ -1,287 +0,0 @@
1/*
2 * linux/include/linux/relayfs_fs.h
3 *
4 * Copyright (C) 2002, 2003 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp
5 * Copyright (C) 1999, 2000, 2001, 2002 - Karim Yaghmour (karim@opersys.com)
6 *
7 * RelayFS definitions and declarations
8 */
9
10#ifndef _LINUX_RELAYFS_FS_H
11#define _LINUX_RELAYFS_FS_H
12
13#include <linux/config.h>
14#include <linux/types.h>
15#include <linux/sched.h>
16#include <linux/wait.h>
17#include <linux/list.h>
18#include <linux/fs.h>
19#include <linux/poll.h>
20#include <linux/kref.h>
21
22/*
23 * Tracks changes to rchan/rchan_buf structs
24 */
25#define RELAYFS_CHANNEL_VERSION 6
26
27/*
28 * Per-cpu relay channel buffer
29 */
30struct rchan_buf
31{
32 void *start; /* start of channel buffer */
33 void *data; /* start of current sub-buffer */
34 size_t offset; /* current offset into sub-buffer */
35 size_t subbufs_produced; /* count of sub-buffers produced */
36 size_t subbufs_consumed; /* count of sub-buffers consumed */
37 struct rchan *chan; /* associated channel */
38 wait_queue_head_t read_wait; /* reader wait queue */
39 struct work_struct wake_readers; /* reader wake-up work struct */
40 struct dentry *dentry; /* channel file dentry */
41 struct kref kref; /* channel buffer refcount */
42 struct page **page_array; /* array of current buffer pages */
43 unsigned int page_count; /* number of current buffer pages */
44 unsigned int finalized; /* buffer has been finalized */
45 size_t *padding; /* padding counts per sub-buffer */
46 size_t prev_padding; /* temporary variable */
47 size_t bytes_consumed; /* bytes consumed in cur read subbuf */
48 unsigned int cpu; /* this buf's cpu */
49} ____cacheline_aligned;
50
51/*
52 * Relay channel data structure
53 */
54struct rchan
55{
56 u32 version; /* the version of this struct */
57 size_t subbuf_size; /* sub-buffer size */
58 size_t n_subbufs; /* number of sub-buffers per buffer */
59 size_t alloc_size; /* total buffer size allocated */
60 struct rchan_callbacks *cb; /* client callbacks */
61 struct kref kref; /* channel refcount */
62 void *private_data; /* for user-defined data */
63 size_t last_toobig; /* tried to log event > subbuf size */
64 struct rchan_buf *buf[NR_CPUS]; /* per-cpu channel buffers */
65};
66
67/*
68 * Relay channel client callbacks
69 */
70struct rchan_callbacks
71{
72 /*
73 * subbuf_start - called on buffer-switch to a new sub-buffer
74 * @buf: the channel buffer containing the new sub-buffer
75 * @subbuf: the start of the new sub-buffer
76 * @prev_subbuf: the start of the previous sub-buffer
77 * @prev_padding: unused space at the end of previous sub-buffer
78 *
79 * The client should return 1 to continue logging, 0 to stop
80 * logging.
81 *
82 * NOTE: subbuf_start will also be invoked when the buffer is
83 * created, so that the first sub-buffer can be initialized
84 * if necessary. In this case, prev_subbuf will be NULL.
85 *
86 * NOTE: the client can reserve bytes at the beginning of the new
87 * sub-buffer by calling subbuf_start_reserve() in this callback.
88 */
89 int (*subbuf_start) (struct rchan_buf *buf,
90 void *subbuf,
91 void *prev_subbuf,
92 size_t prev_padding);
93
94 /*
95 * buf_mapped - relayfs buffer mmap notification
96 * @buf: the channel buffer
97 * @filp: relayfs file pointer
98 *
99 * Called when a relayfs file is successfully mmapped
100 */
101 void (*buf_mapped)(struct rchan_buf *buf,
102 struct file *filp);
103
104 /*
105 * buf_unmapped - relayfs buffer unmap notification
106 * @buf: the channel buffer
107 * @filp: relayfs file pointer
108 *
109 * Called when a relayfs file is successfully unmapped
110 */
111 void (*buf_unmapped)(struct rchan_buf *buf,
112 struct file *filp);
113 /*
114 * create_buf_file - create file to represent a relayfs channel buffer
115 * @filename: the name of the file to create
116 * @parent: the parent of the file to create
117 * @mode: the mode of the file to create
118 * @buf: the channel buffer
119 * @is_global: outparam - set non-zero if the buffer should be global
120 *
121 * Called during relay_open(), once for each per-cpu buffer,
122 * to allow the client to create a file to be used to
123 * represent the corresponding channel buffer. If the file is
124 * created outside of relayfs, the parent must also exist in
125 * that filesystem.
126 *
127 * The callback should return the dentry of the file created
128 * to represent the relay buffer.
129 *
130 * Setting the is_global outparam to a non-zero value will
131 * cause relay_open() to create a single global buffer rather
132 * than the default set of per-cpu buffers.
133 *
134 * See Documentation/filesystems/relayfs.txt for more info.
135 */
136 struct dentry *(*create_buf_file)(const char *filename,
137 struct dentry *parent,
138 int mode,
139 struct rchan_buf *buf,
140 int *is_global);
141
142 /*
143 * remove_buf_file - remove file representing a relayfs channel buffer
144 * @dentry: the dentry of the file to remove
145 *
146 * Called during relay_close(), once for each per-cpu buffer,
147 * to allow the client to remove a file used to represent a
148 * channel buffer.
149 *
150 * The callback should return 0 if successful, negative if not.
151 */
152 int (*remove_buf_file)(struct dentry *dentry);
153};
154
155/*
156 * relayfs kernel API, fs/relayfs/relay.c
157 */
158
159struct rchan *relay_open(const char *base_filename,
160 struct dentry *parent,
161 size_t subbuf_size,
162 size_t n_subbufs,
163 struct rchan_callbacks *cb);
164extern void relay_close(struct rchan *chan);
165extern void relay_flush(struct rchan *chan);
166extern void relay_subbufs_consumed(struct rchan *chan,
167 unsigned int cpu,
168 size_t consumed);
169extern void relay_reset(struct rchan *chan);
170extern int relay_buf_full(struct rchan_buf *buf);
171
172extern size_t relay_switch_subbuf(struct rchan_buf *buf,
173 size_t length);
174extern struct dentry *relayfs_create_dir(const char *name,
175 struct dentry *parent);
176extern int relayfs_remove_dir(struct dentry *dentry);
177extern struct dentry *relayfs_create_file(const char *name,
178 struct dentry *parent,
179 int mode,
180 struct file_operations *fops,
181 void *data);
182extern int relayfs_remove_file(struct dentry *dentry);
183
184/**
185 * relay_write - write data into the channel
186 * @chan: relay channel
187 * @data: data to be written
188 * @length: number of bytes to write
189 *
190 * Writes data into the current cpu's channel buffer.
191 *
192 * Protects the buffer by disabling interrupts. Use this
193 * if you might be logging from interrupt context. Try
194 * __relay_write() if you know you won't be logging from
195 * interrupt context.
196 */
197static inline void relay_write(struct rchan *chan,
198 const void *data,
199 size_t length)
200{
201 unsigned long flags;
202 struct rchan_buf *buf;
203
204 local_irq_save(flags);
205 buf = chan->buf[smp_processor_id()];
206 if (unlikely(buf->offset + length > chan->subbuf_size))
207 length = relay_switch_subbuf(buf, length);
208 memcpy(buf->data + buf->offset, data, length);
209 buf->offset += length;
210 local_irq_restore(flags);
211}
212
213/**
214 * __relay_write - write data into the channel
215 * @chan: relay channel
216 * @data: data to be written
217 * @length: number of bytes to write
218 *
219 * Writes data into the current cpu's channel buffer.
220 *
221 * Protects the buffer by disabling preemption. Use
222 * relay_write() if you might be logging from interrupt
223 * context.
224 */
225static inline void __relay_write(struct rchan *chan,
226 const void *data,
227 size_t length)
228{
229 struct rchan_buf *buf;
230
231 buf = chan->buf[get_cpu()];
232 if (unlikely(buf->offset + length > buf->chan->subbuf_size))
233 length = relay_switch_subbuf(buf, length);
234 memcpy(buf->data + buf->offset, data, length);
235 buf->offset += length;
236 put_cpu();
237}
238
239/**
240 * relay_reserve - reserve slot in channel buffer
241 * @chan: relay channel
242 * @length: number of bytes to reserve
243 *
244 * Returns pointer to reserved slot, NULL if full.
245 *
246 * Reserves a slot in the current cpu's channel buffer.
247 * Does not protect the buffer at all - caller must provide
248 * appropriate synchronization.
249 */
250static inline void *relay_reserve(struct rchan *chan, size_t length)
251{
252 void *reserved;
253 struct rchan_buf *buf = chan->buf[smp_processor_id()];
254
255 if (unlikely(buf->offset + length > buf->chan->subbuf_size)) {
256 length = relay_switch_subbuf(buf, length);
257 if (!length)
258 return NULL;
259 }
260 reserved = buf->data + buf->offset;
261 buf->offset += length;
262
263 return reserved;
264}
265
266/**
267 * subbuf_start_reserve - reserve bytes at the start of a sub-buffer
268 * @buf: relay channel buffer
269 * @length: number of bytes to reserve
270 *
271 * Helper function used to reserve bytes at the beginning of
272 * a sub-buffer in the subbuf_start() callback.
273 */
274static inline void subbuf_start_reserve(struct rchan_buf *buf,
275 size_t length)
276{
277 BUG_ON(length >= buf->chan->subbuf_size - 1);
278 buf->offset = length;
279}
280
281/*
282 * exported relay file operations, fs/relayfs/inode.c
283 */
284extern struct file_operations relay_file_operations;
285
286#endif /* _LINUX_RELAYFS_FS_H */
287
diff --git a/include/linux/sound.h b/include/linux/sound.h
index 72b9af4c3fd4..f63d8342ffa3 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -30,12 +30,12 @@
30 */ 30 */
31 31
32struct device; 32struct device;
33extern int register_sound_special(struct file_operations *fops, int unit); 33extern int register_sound_special(const struct file_operations *fops, int unit);
34extern int register_sound_special_device(struct file_operations *fops, int unit, struct device *dev); 34extern int register_sound_special_device(const struct file_operations *fops, int unit, struct device *dev);
35extern int register_sound_mixer(struct file_operations *fops, int dev); 35extern int register_sound_mixer(const struct file_operations *fops, int dev);
36extern int register_sound_midi(struct file_operations *fops, int dev); 36extern int register_sound_midi(const struct file_operations *fops, int dev);
37extern int register_sound_dsp(struct file_operations *fops, int dev); 37extern int register_sound_dsp(const struct file_operations *fops, int dev);
38extern int register_sound_synth(struct file_operations *fops, int dev); 38extern int register_sound_synth(const struct file_operations *fops, int dev);
39 39
40extern void unregister_sound_special(int unit); 40extern void unregister_sound_special(int unit);
41extern void unregister_sound_mixer(int unit); 41extern void unregister_sound_mixer(int unit);
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 0d6ed3c8bdc4..d93c24b47f3f 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -50,7 +50,7 @@ struct proc_dir_entry * rpc_proc_register(struct rpc_stat *);
50void rpc_proc_unregister(const char *); 50void rpc_proc_unregister(const char *);
51void rpc_proc_zero(struct rpc_program *); 51void rpc_proc_zero(struct rpc_program *);
52struct proc_dir_entry * svc_proc_register(struct svc_stat *, 52struct proc_dir_entry * svc_proc_register(struct svc_stat *,
53 struct file_operations *); 53 const struct file_operations *);
54void svc_proc_unregister(const char *); 54void svc_proc_unregister(const char *);
55 55
56void svc_seq_show(struct seq_file *, 56void svc_seq_show(struct seq_file *,
@@ -65,7 +65,7 @@ static inline void rpc_proc_unregister(const char *p) {}
65static inline void rpc_proc_zero(struct rpc_program *p) {} 65static inline void rpc_proc_zero(struct rpc_program *p) {}
66 66
67static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s, 67static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
68 struct file_operations *f) { return NULL; } 68 const struct file_operations *f) { return NULL; }
69static inline void svc_proc_unregister(const char *p) {} 69static inline void svc_proc_unregister(const char *p) {}
70 70
71static inline void svc_seq_show(struct seq_file *seq, 71static inline void svc_seq_show(struct seq_file *seq,
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 1b7cd8d1a71b..2993302f7923 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * SyncLink Multiprotocol Serial Adapter Driver 2 * SyncLink Multiprotocol Serial Adapter Driver
3 * 3 *
4 * $Id: synclink.h,v 3.10 2005/11/08 19:50:54 paulkf Exp $ 4 * $Id: synclink.h,v 3.11 2006/02/06 21:20:29 paulkf Exp $
5 * 5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation 6 * Copyright (C) 1998-2000 by Microgate Corporation
7 * 7 *
@@ -221,6 +221,12 @@ struct mgsl_icount {
221 __u32 rxidle; 221 __u32 rxidle;
222}; 222};
223 223
224struct gpio_desc {
225 __u32 state;
226 __u32 smask;
227 __u32 dir;
228 __u32 dmask;
229};
224 230
225#define DEBUG_LEVEL_DATA 1 231#define DEBUG_LEVEL_DATA 1
226#define DEBUG_LEVEL_ERROR 2 232#define DEBUG_LEVEL_ERROR 2
@@ -276,5 +282,8 @@ struct mgsl_icount {
276#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9) 282#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
277#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10) 283#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10)
278#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11) 284#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11)
285#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
286#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
287#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
279 288
280#endif /* _SYNCLINK_H_ */ 289#endif /* _SYNCLINK_H_ */
diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h
index b0ffe4356e5a..843aeaaa79d4 100644
--- a/include/linux/ufs_fs.h
+++ b/include/linux/ufs_fs.h
@@ -895,7 +895,7 @@ extern void ufs_set_link(struct inode *, struct ufs_dir_entry *, struct buffer_h
895 895
896/* file.c */ 896/* file.c */
897extern struct inode_operations ufs_file_inode_operations; 897extern struct inode_operations ufs_file_inode_operations;
898extern struct file_operations ufs_file_operations; 898extern const struct file_operations ufs_file_operations;
899 899
900extern struct address_space_operations ufs_aops; 900extern struct address_space_operations ufs_aops;
901 901
@@ -915,7 +915,7 @@ extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
915extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); 915extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create);
916 916
917/* namei.c */ 917/* namei.c */
918extern struct file_operations ufs_dir_operations; 918extern const struct file_operations ufs_dir_operations;
919 919
920/* super.c */ 920/* super.c */
921extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); 921extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 130d125fda12..e34e5e3dce52 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -615,7 +615,7 @@ extern struct bus_type usb_bus_type;
615 */ 615 */
616struct usb_class_driver { 616struct usb_class_driver {
617 char *name; 617 char *name;
618 struct file_operations *fops; 618 const struct file_operations *fops;
619 int minor_base; 619 int minor_base;
620}; 620};
621 621
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 2275bfec5b68..af2d6155d3fe 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -75,7 +75,7 @@ struct video_device
75 int minor; 75 int minor;
76 76
77 /* device ops + callbacks */ 77 /* device ops + callbacks */
78 struct file_operations *fops; 78 const struct file_operations *fops;
79 void (*release)(struct video_device *vfd); 79 void (*release)(struct video_device *vfd);
80 80
81 81
diff --git a/include/sound/core.h b/include/sound/core.h
index 144bdc2f217f..7f32c12b4a0a 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -186,7 +186,7 @@ struct snd_minor {
186 int type; /* SNDRV_DEVICE_TYPE_XXX */ 186 int type; /* SNDRV_DEVICE_TYPE_XXX */
187 int card; /* card number */ 187 int card; /* card number */
188 int device; /* device number */ 188 int device; /* device number */
189 struct file_operations *f_ops; /* file operations */ 189 const struct file_operations *f_ops; /* file operations */
190 void *private_data; /* private data for f_ops->open */ 190 void *private_data; /* private data for f_ops->open */
191 char name[0]; /* device name (keep at the end of 191 char name[0]; /* device name (keep at the end of
192 structure) */ 192 structure) */
@@ -200,14 +200,14 @@ extern int snd_ecards_limit;
200void snd_request_card(int card); 200void snd_request_card(int card);
201 201
202int snd_register_device(int type, struct snd_card *card, int dev, 202int snd_register_device(int type, struct snd_card *card, int dev,
203 struct file_operations *f_ops, void *private_data, 203 const struct file_operations *f_ops, void *private_data,
204 const char *name); 204 const char *name);
205int snd_unregister_device(int type, struct snd_card *card, int dev); 205int snd_unregister_device(int type, struct snd_card *card, int dev);
206void *snd_lookup_minor_data(unsigned int minor, int type); 206void *snd_lookup_minor_data(unsigned int minor, int type);
207 207
208#ifdef CONFIG_SND_OSSEMUL 208#ifdef CONFIG_SND_OSSEMUL
209int snd_register_oss_device(int type, struct snd_card *card, int dev, 209int snd_register_oss_device(int type, struct snd_card *card, int dev,
210 struct file_operations *f_ops, void *private_data, 210 const struct file_operations *f_ops, void *private_data,
211 const char *name); 211 const char *name);
212int snd_unregister_oss_device(int type, struct snd_card *card, int dev); 212int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
213void *snd_lookup_oss_minor_data(unsigned int minor, int type); 213void *snd_lookup_oss_minor_data(unsigned int minor, int type);
diff --git a/init/main.c b/init/main.c
index 64466ea1984c..4a2f0898dda1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -341,7 +341,7 @@ static void __init setup_per_cpu_areas(void)
341#endif 341#endif
342 ptr = alloc_bootmem(size * nr_possible_cpus); 342 ptr = alloc_bootmem(size * nr_possible_cpus);
343 343
344 for_each_cpu(i) { 344 for_each_possible_cpu(i) {
345 __per_cpu_offset[i] = ptr - __per_cpu_start; 345 __per_cpu_offset[i] = ptr - __per_cpu_start;
346 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 346 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
347 ptr += size; 347 ptr += size;
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 532ec3bf18d6..41ecbd440fed 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -762,7 +762,7 @@ out_unlock:
762 * The receiver accepts the message and returns without grabbing the queue 762 * The receiver accepts the message and returns without grabbing the queue
763 * spinlock. Therefore an intermediate STATE_PENDING state and memory barriers 763 * spinlock. Therefore an intermediate STATE_PENDING state and memory barriers
764 * are necessary. The same algorithm is used for sysv semaphores, see 764 * are necessary. The same algorithm is used for sysv semaphores, see
765 * ipc/sem.c fore more details. 765 * ipc/sem.c for more details.
766 * 766 *
767 * The same algorithm is used for senders. 767 * The same algorithm is used for senders.
768 */ 768 */
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 9c077cf9aa84..54274fc85321 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -137,5 +137,6 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
137 if (op >= FUTEX_REQUEUE) 137 if (op >= FUTEX_REQUEUE)
138 val2 = (int) (unsigned long) utime; 138 val2 = (int) (unsigned long) utime;
139 139
140 return do_futex(uaddr, op, val, timeout, uaddr2, val2, val3); 140 return do_futex((unsigned long)uaddr, op, val, timeout,
141 (unsigned long)uaddr2, val2, val3);
141} 142}
diff --git a/kernel/module.c b/kernel/module.c
index 4fafd58038a0..bd088a7c1499 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -127,7 +127,7 @@ extern const unsigned long __start___kcrctab_gpl_future[];
127#ifndef CONFIG_MODVERSIONS 127#ifndef CONFIG_MODVERSIONS
128#define symversion(base, idx) NULL 128#define symversion(base, idx) NULL
129#else 129#else
130#define symversion(base, idx) ((base) ? ((base) + (idx)) : NULL) 130#define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL)
131#endif 131#endif
132 132
133/* lookup symbol in given range of kernel_symbols */ 133/* lookup symbol in given range of kernel_symbols */
diff --git a/kernel/params.c b/kernel/params.c
index 9de637a5c8bc..af43ecdc8d9b 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -31,7 +31,7 @@
31#define DEBUGP(fmt, a...) 31#define DEBUGP(fmt, a...)
32#endif 32#endif
33 33
34static inline int dash2underscore(char c) 34static inline char dash2underscore(char c)
35{ 35{
36 if (c == '-') 36 if (c == '-')
37 return '_'; 37 return '_';
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index b4b362b5baf5..8154e7589d12 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -301,7 +301,7 @@ rcu_torture_printk(char *page)
301 long pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 }; 301 long pipesummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };
302 long batchsummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 }; 302 long batchsummary[RCU_TORTURE_PIPE_LEN + 1] = { 0 };
303 303
304 for_each_cpu(cpu) { 304 for_each_possible_cpu(cpu) {
305 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { 305 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {
306 pipesummary[i] += per_cpu(rcu_torture_count, cpu)[i]; 306 pipesummary[i] += per_cpu(rcu_torture_count, cpu)[i];
307 batchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i]; 307 batchsummary[i] += per_cpu(rcu_torture_batch, cpu)[i];
@@ -535,7 +535,7 @@ rcu_torture_init(void)
535 atomic_set(&n_rcu_torture_error, 0); 535 atomic_set(&n_rcu_torture_error, 0);
536 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) 536 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++)
537 atomic_set(&rcu_torture_wcount[i], 0); 537 atomic_set(&rcu_torture_wcount[i], 0);
538 for_each_cpu(cpu) { 538 for_each_possible_cpu(cpu) {
539 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) { 539 for (i = 0; i < RCU_TORTURE_PIPE_LEN + 1; i++) {
540 per_cpu(rcu_torture_count, cpu)[i] = 0; 540 per_cpu(rcu_torture_count, cpu)[i] = 0;
541 per_cpu(rcu_torture_batch, cpu)[i] = 0; 541 per_cpu(rcu_torture_batch, cpu)[i] = 0;
diff --git a/kernel/sched.c b/kernel/sched.c
index 7854ee516b92..a9ecac398bb9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1625,7 +1625,7 @@ unsigned long nr_uninterruptible(void)
1625{ 1625{
1626 unsigned long i, sum = 0; 1626 unsigned long i, sum = 0;
1627 1627
1628 for_each_cpu(i) 1628 for_each_possible_cpu(i)
1629 sum += cpu_rq(i)->nr_uninterruptible; 1629 sum += cpu_rq(i)->nr_uninterruptible;
1630 1630
1631 /* 1631 /*
@@ -1642,7 +1642,7 @@ unsigned long long nr_context_switches(void)
1642{ 1642{
1643 unsigned long long i, sum = 0; 1643 unsigned long long i, sum = 0;
1644 1644
1645 for_each_cpu(i) 1645 for_each_possible_cpu(i)
1646 sum += cpu_rq(i)->nr_switches; 1646 sum += cpu_rq(i)->nr_switches;
1647 1647
1648 return sum; 1648 return sum;
@@ -1652,7 +1652,7 @@ unsigned long nr_iowait(void)
1652{ 1652{
1653 unsigned long i, sum = 0; 1653 unsigned long i, sum = 0;
1654 1654
1655 for_each_cpu(i) 1655 for_each_possible_cpu(i)
1656 sum += atomic_read(&cpu_rq(i)->nr_iowait); 1656 sum += atomic_read(&cpu_rq(i)->nr_iowait);
1657 1657
1658 return sum; 1658 return sum;
@@ -6080,7 +6080,7 @@ void __init sched_init(void)
6080 runqueue_t *rq; 6080 runqueue_t *rq;
6081 int i, j, k; 6081 int i, j, k;
6082 6082
6083 for_each_cpu(i) { 6083 for_each_possible_cpu(i) {
6084 prio_array_t *array; 6084 prio_array_t *array;
6085 6085
6086 rq = cpu_rq(i); 6086 rq = cpu_rq(i);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 4f71cfd29c6f..dec8249e972d 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -912,7 +912,7 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
912 /* 912 /*
913 * Check if this process has the right to modify the specified 913 * Check if this process has the right to modify the specified
914 * process. The right exists if the process has administrative 914 * process. The right exists if the process has administrative
915 * capabilities, superuser priviledges or the same 915 * capabilities, superuser privileges or the same
916 * userid as the target process. 916 * userid as the target process.
917 */ 917 */
918 if ((current->euid != task->suid) && (current->euid != task->uid) && 918 if ((current->euid != task->suid) && (current->euid != task->uid) &&
diff --git a/mm/slab.c b/mm/slab.c
index 681837499d7d..4cbf8bb13557 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3311,7 +3311,7 @@ void *__alloc_percpu(size_t size)
3311 * and we have no way of figuring out how to fix the array 3311 * and we have no way of figuring out how to fix the array
3312 * that we have allocated then.... 3312 * that we have allocated then....
3313 */ 3313 */
3314 for_each_cpu(i) { 3314 for_each_possible_cpu(i) {
3315 int node = cpu_to_node(i); 3315 int node = cpu_to_node(i);
3316 3316
3317 if (node_online(node)) 3317 if (node_online(node))
@@ -3398,7 +3398,7 @@ void free_percpu(const void *objp)
3398 /* 3398 /*
3399 * We allocate for all cpus so we cannot use for online cpu here. 3399 * We allocate for all cpus so we cannot use for online cpu here.
3400 */ 3400 */
3401 for_each_cpu(i) 3401 for_each_possible_cpu(i)
3402 kfree(p->ptrs[i]); 3402 kfree(p->ptrs[i]);
3403 kfree(p); 3403 kfree(p);
3404} 3404}
diff --git a/mm/swap.c b/mm/swap.c
index 91b7e2026f69..88895c249bc9 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -512,7 +512,7 @@ long percpu_counter_sum(struct percpu_counter *fbc)
512 512
513 spin_lock(&fbc->lock); 513 spin_lock(&fbc->lock);
514 ret = fbc->count; 514 ret = fbc->count;
515 for_each_cpu(cpu) { 515 for_each_possible_cpu(cpu) {
516 long *pcount = per_cpu_ptr(fbc->counters, cpu); 516 long *pcount = per_cpu_ptr(fbc->counters, cpu);
517 ret += *pcount; 517 ret += *pcount;
518 } 518 }
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 759445648667..627b11342233 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1302,7 +1302,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
1302 if (sk->sk_state != TCP_ESTABLISHED) 1302 if (sk->sk_state != TCP_ESTABLISHED)
1303 return -ENOTCONN; 1303 return -ENOTCONN;
1304 1304
1305 /* Check that we don't send out to big frames */ 1305 /* Check that we don't send out too big frames */
1306 if (len > self->max_data_size) { 1306 if (len > self->max_data_size) {
1307 IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n", 1307 IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n",
1308 __FUNCTION__, len, self->max_data_size); 1308 __FUNCTION__, len, self->max_data_size);
@@ -1546,7 +1546,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
1546 IRDA_ASSERT(self != NULL, return -1;); 1546 IRDA_ASSERT(self != NULL, return -1;);
1547 1547
1548 /* 1548 /*
1549 * Check that we don't send out to big frames. This is an unreliable 1549 * Check that we don't send out too big frames. This is an unreliable
1550 * service, so we have no fragmentation and no coalescence 1550 * service, so we have no fragmentation and no coalescence
1551 */ 1551 */
1552 if (len > self->max_data_size) { 1552 if (len > self->max_data_size) {
@@ -1642,7 +1642,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
1642 } 1642 }
1643 1643
1644 /* 1644 /*
1645 * Check that we don't send out to big frames. This is an unreliable 1645 * Check that we don't send out too big frames. This is an unreliable
1646 * service, so we have no fragmentation and no coalescence 1646 * service, so we have no fragmentation and no coalescence
1647 */ 1647 */
1648 if (len > self->max_data_size) { 1648 if (len > self->max_data_size) {
diff --git a/net/nonet.c b/net/nonet.c
index 1230f0ae832e..92e76640c7cd 100644
--- a/net/nonet.c
+++ b/net/nonet.c
@@ -19,7 +19,7 @@ static int sock_no_open(struct inode *irrelevant, struct file *dontcare)
19 return -ENXIO; 19 return -ENXIO;
20} 20}
21 21
22struct file_operations bad_sock_fops = { 22const struct file_operations bad_sock_fops = {
23 .owner = THIS_MODULE, 23 .owner = THIS_MODULE,
24 .open = sock_no_open, 24 .open = sock_no_open,
25}; 25};
diff --git a/net/socket.c b/net/socket.c
index 5211ba270375..fcd77eac0ccf 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -539,7 +539,7 @@ static int sock_no_open(struct inode *irrelevant, struct file *dontcare)
539 return -ENXIO; 539 return -ENXIO;
540} 540}
541 541
542struct file_operations bad_sock_fops = { 542const struct file_operations bad_sock_fops = {
543 .owner = THIS_MODULE, 543 .owner = THIS_MODULE,
544 .open = sock_no_open, 544 .open = sock_no_open,
545}; 545};
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index aa4158be9900..cc673dd8433f 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -395,7 +395,7 @@ enum {
395 */ 395 */
396struct rpc_filelist { 396struct rpc_filelist {
397 char *name; 397 char *name;
398 struct file_operations *i_fop; 398 const struct file_operations *i_fop;
399 int mode; 399 int mode;
400}; 400};
401 401
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 790941e8af4d..dea529666d69 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -225,7 +225,7 @@ EXPORT_SYMBOL(rpc_print_iostats);
225 * Register/unregister RPC proc files 225 * Register/unregister RPC proc files
226 */ 226 */
227static inline struct proc_dir_entry * 227static inline struct proc_dir_entry *
228do_register(const char *name, void *data, struct file_operations *fops) 228do_register(const char *name, void *data, const struct file_operations *fops)
229{ 229{
230 struct proc_dir_entry *ent; 230 struct proc_dir_entry *ent;
231 231
@@ -253,7 +253,7 @@ rpc_proc_unregister(const char *name)
253} 253}
254 254
255struct proc_dir_entry * 255struct proc_dir_entry *
256svc_proc_register(struct svc_stat *statp, struct file_operations *fops) 256svc_proc_register(struct svc_stat *statp, const struct file_operations *fops)
257{ 257{
258 return do_register(statp->program->pg_name, statp, fops); 258 return do_register(statp->program->pg_name, statp, fops);
259} 259}
diff --git a/sound/core/init.c b/sound/core/init.c
index ad68761abba1..5bb8a8b23d51 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -223,7 +223,8 @@ int snd_card_disconnect(struct snd_card *card)
223 struct snd_monitor_file *mfile; 223 struct snd_monitor_file *mfile;
224 struct file *file; 224 struct file *file;
225 struct snd_shutdown_f_ops *s_f_ops; 225 struct snd_shutdown_f_ops *s_f_ops;
226 struct file_operations *f_ops, *old_f_ops; 226 struct file_operations *f_ops;
227 const struct file_operations *old_f_ops;
227 int err; 228 int err;
228 229
229 spin_lock(&card->files_lock); 230 spin_lock(&card->files_lock);
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 6b7a36774298..87b47c9564f7 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -631,7 +631,8 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
631 return -EINVAL; 631 return -EINVAL;
632 } 632 }
633 if (params->buffer_size != runtime->buffer_size) { 633 if (params->buffer_size != runtime->buffer_size) {
634 if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) 634 newbuf = kmalloc(params->buffer_size, GFP_KERNEL);
635 if (!newbuf)
635 return -ENOMEM; 636 return -ENOMEM;
636 kfree(runtime->buffer); 637 kfree(runtime->buffer);
637 runtime->buffer = newbuf; 638 runtime->buffer = newbuf;
@@ -657,7 +658,8 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
657 return -EINVAL; 658 return -EINVAL;
658 } 659 }
659 if (params->buffer_size != runtime->buffer_size) { 660 if (params->buffer_size != runtime->buffer_size) {
660 if ((newbuf = (char *) kmalloc(params->buffer_size, GFP_KERNEL)) == NULL) 661 newbuf = kmalloc(params->buffer_size, GFP_KERNEL);
662 if (!newbuf)
661 return -ENOMEM; 663 return -ENOMEM;
662 kfree(runtime->buffer); 664 kfree(runtime->buffer);
663 runtime->buffer = newbuf; 665 runtime->buffer = newbuf;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 4d28e5212611..108e430b5036 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -137,7 +137,7 @@ static int snd_open(struct inode *inode, struct file *file)
137{ 137{
138 unsigned int minor = iminor(inode); 138 unsigned int minor = iminor(inode);
139 struct snd_minor *mptr = NULL; 139 struct snd_minor *mptr = NULL;
140 struct file_operations *old_fops; 140 const struct file_operations *old_fops;
141 int err = 0; 141 int err = 0;
142 142
143 if (minor >= ARRAY_SIZE(snd_minors)) 143 if (minor >= ARRAY_SIZE(snd_minors))
@@ -240,7 +240,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
240 * Retrurns zero if successful, or a negative error code on failure. 240 * Retrurns zero if successful, or a negative error code on failure.
241 */ 241 */
242int snd_register_device(int type, struct snd_card *card, int dev, 242int snd_register_device(int type, struct snd_card *card, int dev,
243 struct file_operations *f_ops, void *private_data, 243 const struct file_operations *f_ops, void *private_data,
244 const char *name) 244 const char *name)
245{ 245{
246 int minor; 246 int minor;
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index 4023d3b406de..9055c6de9587 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -95,7 +95,7 @@ static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
95} 95}
96 96
97int snd_register_oss_device(int type, struct snd_card *card, int dev, 97int snd_register_oss_device(int type, struct snd_card *card, int dev,
98 struct file_operations *f_ops, void *private_data, 98 const struct file_operations *f_ops, void *private_data,
99 const char *name) 99 const char *name)
100{ 100{
101 int minor = snd_oss_kernel_minor(type, card, dev); 101 int minor = snd_oss_kernel_minor(type, card, dev);
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
index 6ba8d6f45fe8..3bbc8105e9f1 100644
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ b/sound/oss/dmasound/dmasound_awacs.c
@@ -2798,7 +2798,7 @@ __init setup_beep(void)
2798 DBDMA_ALIGN(beep_dbdma_cmd_space); 2798 DBDMA_ALIGN(beep_dbdma_cmd_space);
2799 /* set up emergency dbdma cmd */ 2799 /* set up emergency dbdma cmd */
2800 emergency_dbdma_cmd = beep_dbdma_cmd+1 ; 2800 emergency_dbdma_cmd = beep_dbdma_cmd+1 ;
2801 beep_buf = (short *) kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL); 2801 beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2802 if (beep_buf == NULL) { 2802 if (beep_buf == NULL) {
2803 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n"); 2803 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n");
2804 kfree(beep_dbdma_cmd_space) ; 2804 kfree(beep_dbdma_cmd_space) ;
diff --git a/sound/oss/emu10k1/midi.c b/sound/oss/emu10k1/midi.c
index 959a96794dba..25ae8e4a488d 100644
--- a/sound/oss/emu10k1/midi.c
+++ b/sound/oss/emu10k1/midi.c
@@ -65,7 +65,8 @@ static int midiin_add_buffer(struct emu10k1_mididevice *midi_dev, struct midi_hd
65 65
66 init_midi_hdr(midihdr); 66 init_midi_hdr(midihdr);
67 67
68 if ((midihdr->data = (u8 *) kmalloc(MIDIIN_BUFLEN, GFP_KERNEL)) == NULL) { 68 midihdr->data = kmalloc(MIDIIN_BUFLEN, GFP_KERNEL);
69 if (!midihdr->data) {
69 ERROR(); 70 ERROR();
70 kfree(midihdr); 71 kfree(midihdr);
71 return -1; 72 return -1;
@@ -334,7 +335,8 @@ static ssize_t emu10k1_midi_write(struct file *file, const char __user *buffer,
334 midihdr->bytesrecorded = 0; 335 midihdr->bytesrecorded = 0;
335 midihdr->flags = 0; 336 midihdr->flags = 0;
336 337
337 if ((midihdr->data = (u8 *) kmalloc(count, GFP_KERNEL)) == NULL) { 338 midihdr->data = kmalloc(count, GFP_KERNEL);
339 if (!midihdr->data) {
338 ERROR(); 340 ERROR();
339 kfree(midihdr); 341 kfree(midihdr);
340 return -EINVAL; 342 return -EINVAL;
@@ -545,7 +547,8 @@ int emu10k1_seq_midi_out(int dev, unsigned char midi_byte)
545 midihdr->bytesrecorded = 0; 547 midihdr->bytesrecorded = 0;
546 midihdr->flags = 0; 548 midihdr->flags = 0;
547 549
548 if ((midihdr->data = (u8 *) kmalloc(1, GFP_KERNEL)) == NULL) { 550 midihdr->data = kmalloc(1, GFP_KERNEL);
551 if (!midihdr->data) {
549 ERROR(); 552 ERROR();
550 kfree(midihdr); 553 kfree(midihdr);
551 return -EINVAL; 554 return -EINVAL;
diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
index 78d3e29ce968..6861563d7525 100644
--- a/sound/oss/esssolo1.c
+++ b/sound/oss/esssolo1.c
@@ -2348,7 +2348,7 @@ static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device
2348 /* Recording requires 24-bit DMA, so attempt to set dma mask 2348 /* Recording requires 24-bit DMA, so attempt to set dma mask
2349 * to 24 bits first, then 32 bits (playback only) if that fails. 2349 * to 24 bits first, then 32 bits (playback only) if that fails.
2350 */ 2350 */
2351 if (pci_set_dma_mask(pcidev, 0x00ffffff) && 2351 if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK) &&
2352 pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) { 2352 pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) {
2353 printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n"); 2353 printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n");
2354 return -ENODEV; 2354 return -ENODEV;
diff --git a/sound/oss/maestro3.c b/sound/oss/maestro3.c
index 66044aff2586..4a5e4237a110 100644
--- a/sound/oss/maestro3.c
+++ b/sound/oss/maestro3.c
@@ -2582,15 +2582,9 @@ static int alloc_dsp_suspendmem(struct m3_card *card)
2582 2582
2583 return 0; 2583 return 0;
2584} 2584}
2585static void free_dsp_suspendmem(struct m3_card *card)
2586{
2587 if(card->suspend_mem)
2588 vfree(card->suspend_mem);
2589}
2590 2585
2591#else 2586#else
2592#define alloc_dsp_suspendmem(args...) 0 2587#define alloc_dsp_suspendmem(args...) 0
2593#define free_dsp_suspendmem(args...)
2594#endif 2588#endif
2595 2589
2596/* 2590/*
@@ -2717,7 +2711,7 @@ out:
2717 if(ret) { 2711 if(ret) {
2718 if(card->iobase) 2712 if(card->iobase)
2719 release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0)); 2713 release_region(pci_resource_start(pci_dev, 0), pci_resource_len(pci_dev, 0));
2720 free_dsp_suspendmem(card); 2714 vfree(card->suspend_mem);
2721 if(card->ac97) { 2715 if(card->ac97) {
2722 unregister_sound_mixer(card->ac97->dev_mixer); 2716 unregister_sound_mixer(card->ac97->dev_mixer);
2723 kfree(card->ac97); 2717 kfree(card->ac97);
@@ -2760,7 +2754,7 @@ static void m3_remove(struct pci_dev *pci_dev)
2760 } 2754 }
2761 2755
2762 release_region(card->iobase, 256); 2756 release_region(card->iobase, 256);
2763 free_dsp_suspendmem(card); 2757 vfree(card->suspend_mem);
2764 kfree(card); 2758 kfree(card);
2765 } 2759 }
2766 devs = NULL; 2760 devs = NULL;
diff --git a/sound/oss/msnd.c b/sound/oss/msnd.c
index a7ad2b0a2ac0..5dbfc0f9c3c7 100644
--- a/sound/oss/msnd.c
+++ b/sound/oss/msnd.c
@@ -95,10 +95,8 @@ void msnd_fifo_init(msnd_fifo *f)
95 95
96void msnd_fifo_free(msnd_fifo *f) 96void msnd_fifo_free(msnd_fifo *f)
97{ 97{
98 if (f->data) { 98 vfree(f->data);
99 vfree(f->data); 99 f->data = NULL;
100 f->data = NULL;
101 }
102} 100}
103 101
104int msnd_fifo_alloc(msnd_fifo *f, size_t n) 102int msnd_fifo_alloc(msnd_fifo *f, size_t n)
diff --git a/sound/oss/sb_card.c b/sound/oss/sb_card.c
index d38e88abc8fa..4708cbdc3149 100644
--- a/sound/oss/sb_card.c
+++ b/sound/oss/sb_card.c
@@ -348,10 +348,8 @@ static void __exit sb_exit(void)
348 348
349 sb_unregister_all(); 349 sb_unregister_all();
350 350
351 if (smw_free) { 351 vfree(smw_free);
352 vfree(smw_free); 352 smw_free = NULL;
353 smw_free = NULL;
354 }
355} 353}
356 354
357module_init(sb_init); 355module_init(sb_init);
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c
index 347cd79c2502..6815c30e0bc1 100644
--- a/sound/oss/sequencer.c
+++ b/sound/oss/sequencer.c
@@ -1671,14 +1671,7 @@ void sequencer_init(void)
1671 1671
1672void sequencer_unload(void) 1672void sequencer_unload(void)
1673{ 1673{
1674 if(queue) 1674 vfree(queue);
1675 { 1675 vfree(iqueue);
1676 vfree(queue); 1676 queue = iqueue = NULL;
1677 queue=NULL;
1678 }
1679 if(iqueue)
1680 {
1681 vfree(iqueue);
1682 iqueue=NULL;
1683 }
1684} 1677}
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
index 8a9917c919c2..3f7427cd195a 100644
--- a/sound/oss/sh_dac_audio.c
+++ b/sound/oss/sh_dac_audio.c
@@ -289,7 +289,7 @@ static int __init dac_audio_init(void)
289 289
290 in_use = 0; 290 in_use = 0;
291 291
292 data_buffer = (char *)kmalloc(BUFFER_SIZE, GFP_KERNEL); 292 data_buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL);
293 if (data_buffer == NULL) 293 if (data_buffer == NULL)
294 return -ENOMEM; 294 return -ENOMEM;
295 295
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c
index 4471757b7985..42bd276cfc39 100644
--- a/sound/oss/sonicvibes.c
+++ b/sound/oss/sonicvibes.c
@@ -116,6 +116,7 @@
116#include <linux/spinlock.h> 116#include <linux/spinlock.h>
117#include <linux/smp_lock.h> 117#include <linux/smp_lock.h>
118#include <linux/gameport.h> 118#include <linux/gameport.h>
119#include <linux/dma-mapping.h>
119#include <linux/mutex.h> 120#include <linux/mutex.h>
120 121
121 122
@@ -2535,7 +2536,7 @@ static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id
2535 return -ENODEV; 2536 return -ENODEV;
2536 if (pcidev->irq == 0) 2537 if (pcidev->irq == 0)
2537 return -ENODEV; 2538 return -ENODEV;
2538 if (pci_set_dma_mask(pcidev, 0x00ffffff)) { 2539 if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK)) {
2539 printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n"); 2540 printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n");
2540 return -ENODEV; 2541 return -ENODEV;
2541 } 2542 }
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 2aa5a7fdb6e0..c6c8333acc62 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -39,6 +39,7 @@
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/compiler.h> 40#include <linux/compiler.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42#include <linux/dma-mapping.h>
42 43
43#include <sound/driver.h> 44#include <sound/driver.h>
44#include <sound/core.h> 45#include <sound/core.h>
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index e264136e8fb4..fc92b6896c24 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -33,6 +33,7 @@
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/moduleparam.h> 35#include <linux/moduleparam.h>
36#include <linux/dma-mapping.h>
36#include <sound/core.h> 37#include <sound/core.h>
37#include <sound/pcm.h> 38#include <sound/pcm.h>
38#include <sound/info.h> 39#include <sound/info.h>
@@ -2220,8 +2221,8 @@ static int __devinit snd_ali_create(struct snd_card *card,
2220 if ((err = pci_enable_device(pci)) < 0) 2221 if ((err = pci_enable_device(pci)) < 0)
2221 return err; 2222 return err;
2222 /* check, if we can restrict PCI DMA transfers to 31 bits */ 2223 /* check, if we can restrict PCI DMA transfers to 31 bits */
2223 if (pci_set_dma_mask(pci, 0x7fffffff) < 0 || 2224 if (pci_set_dma_mask(pci, DMA_31BIT_MASK) < 0 ||
2224 pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) { 2225 pci_set_consistent_dma_mask(pci, DMA_31BIT_MASK) < 0) {
2225 snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n"); 2226 snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n");
2226 pci_disable_device(pci); 2227 pci_disable_device(pci);
2227 return -ENXIO; 2228 return -ENXIO;
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 7b2ff5f4672e..100d8127a411 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -70,6 +70,7 @@
70#include <linux/slab.h> 70#include <linux/slab.h>
71#include <linux/gameport.h> 71#include <linux/gameport.h>
72#include <linux/moduleparam.h> 72#include <linux/moduleparam.h>
73#include <linux/dma-mapping.h>
73#include <sound/core.h> 74#include <sound/core.h>
74#include <sound/pcm.h> 75#include <sound/pcm.h>
75#include <sound/rawmidi.h> 76#include <sound/rawmidi.h>
@@ -688,8 +689,8 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci,
688 return err; 689 return err;
689 } 690 }
690 /* check, if we can restrict PCI DMA transfers to 24 bits */ 691 /* check, if we can restrict PCI DMA transfers to 24 bits */
691 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 692 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
692 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 693 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
693 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 694 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
694 pci_disable_device(pci); 695 pci_disable_device(pci);
695 return -ENXIO; 696 return -ENXIO;
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index e077eb3fbe2f..680077e1e057 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -104,6 +104,7 @@
104#include <linux/slab.h> 104#include <linux/slab.h>
105#include <linux/gameport.h> 105#include <linux/gameport.h>
106#include <linux/moduleparam.h> 106#include <linux/moduleparam.h>
107#include <linux/dma-mapping.h>
107#include <sound/core.h> 108#include <sound/core.h>
108#include <sound/control.h> 109#include <sound/control.h>
109#include <sound/pcm.h> 110#include <sound/pcm.h>
@@ -1669,8 +1670,8 @@ snd_azf3328_create(struct snd_card *card,
1669 chip->irq = -1; 1670 chip->irq = -1;
1670 1671
1671 /* check if we can restrict PCI DMA transfers to 24 bits */ 1672 /* check if we can restrict PCI DMA transfers to 24 bits */
1672 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1673 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
1673 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1674 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
1674 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1675 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1675 err = -ENXIO; 1676 err = -ENXIO;
1676 goto out_err; 1677 goto out_err;
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 2208dbd48be9..3e332f398162 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -36,6 +36,7 @@
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/moduleparam.h> 38#include <linux/moduleparam.h>
39#include <linux/dma-mapping.h>
39#include <sound/core.h> 40#include <sound/core.h>
40#include <sound/initval.h> 41#include <sound/initval.h>
41#include <sound/pcm.h> 42#include <sound/pcm.h>
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 0d556b09ad04..4d62fe439177 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -55,6 +55,7 @@
55#include <linux/gameport.h> 55#include <linux/gameport.h>
56#include <linux/moduleparam.h> 56#include <linux/moduleparam.h>
57#include <linux/delay.h> 57#include <linux/delay.h>
58#include <linux/dma-mapping.h>
58#include <sound/core.h> 59#include <sound/core.h>
59#include <sound/control.h> 60#include <sound/control.h>
60#include <sound/pcm.h> 61#include <sound/pcm.h>
@@ -1517,8 +1518,8 @@ static int __devinit snd_es1938_create(struct snd_card *card,
1517 if ((err = pci_enable_device(pci)) < 0) 1518 if ((err = pci_enable_device(pci)) < 0)
1518 return err; 1519 return err;
1519 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1520 /* check, if we can restrict PCI DMA transfers to 24 bits */
1520 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1521 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
1521 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1522 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
1522 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1523 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1523 pci_disable_device(pci); 1524 pci_disable_device(pci);
1524 return -ENXIO; 1525 return -ENXIO;
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index dd465a186e11..e3ad17f53c29 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -104,6 +104,7 @@
104#include <linux/slab.h> 104#include <linux/slab.h>
105#include <linux/gameport.h> 105#include <linux/gameport.h>
106#include <linux/moduleparam.h> 106#include <linux/moduleparam.h>
107#include <linux/dma-mapping.h>
107#include <linux/mutex.h> 108#include <linux/mutex.h>
108 109
109#include <sound/core.h> 110#include <sound/core.h>
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 672e198317e1..b88eeba2f5d1 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -56,7 +56,9 @@
56#include <linux/dma-mapping.h> 56#include <linux/dma-mapping.h>
57#include <linux/slab.h> 57#include <linux/slab.h>
58#include <linux/moduleparam.h> 58#include <linux/moduleparam.h>
59#include <linux/dma-mapping.h>
59#include <linux/mutex.h> 60#include <linux/mutex.h>
61
60#include <sound/core.h> 62#include <sound/core.h>
61#include <sound/cs8427.h> 63#include <sound/cs8427.h>
62#include <sound/info.h> 64#include <sound/info.h>
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 8bc084956c28..44393e190929 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -41,6 +41,7 @@
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/vmalloc.h> 42#include <linux/vmalloc.h>
43#include <linux/moduleparam.h> 43#include <linux/moduleparam.h>
44#include <linux/dma-mapping.h>
44#include <sound/core.h> 45#include <sound/core.h>
45#include <sound/info.h> 46#include <sound/info.h>
46#include <sound/control.h> 47#include <sound/control.h>
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 43ee3b2b948f..b5a095052d4c 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -28,6 +28,8 @@
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
30#include <linux/mutex.h> 30#include <linux/mutex.h>
31#include <linux/dma-mapping.h>
32
31#include <sound/core.h> 33#include <sound/core.h>
32#include <sound/initval.h> 34#include <sound/initval.h>
33#include <sound/info.h> 35#include <sound/info.h>
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index f679779d96e3..35875c8aa299 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/moduleparam.h> 31#include <linux/moduleparam.h>
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/dma-mapping.h>
33 34
34#include <sound/core.h> 35#include <sound/core.h>
35#include <sound/initval.h> 36#include <sound/initval.h>
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 0cbef5fe6c63..ab78544bf042 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -313,7 +313,7 @@ static int snd_rme32_capture_copy(struct snd_pcm_substream *substream, int chann
313} 313}
314 314
315/* 315/*
316 * SPDIF I/O capabilites (half-duplex mode) 316 * SPDIF I/O capabilities (half-duplex mode)
317 */ 317 */
318static struct snd_pcm_hardware snd_rme32_spdif_info = { 318static struct snd_pcm_hardware snd_rme32_spdif_info = {
319 .info = (SNDRV_PCM_INFO_MMAP_IOMEM | 319 .info = (SNDRV_PCM_INFO_MMAP_IOMEM |
@@ -339,7 +339,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_info = {
339}; 339};
340 340
341/* 341/*
342 * ADAT I/O capabilites (half-duplex mode) 342 * ADAT I/O capabilities (half-duplex mode)
343 */ 343 */
344static struct snd_pcm_hardware snd_rme32_adat_info = 344static struct snd_pcm_hardware snd_rme32_adat_info =
345{ 345{
@@ -364,7 +364,7 @@ static struct snd_pcm_hardware snd_rme32_adat_info =
364}; 364};
365 365
366/* 366/*
367 * SPDIF I/O capabilites (full-duplex mode) 367 * SPDIF I/O capabilities (full-duplex mode)
368 */ 368 */
369static struct snd_pcm_hardware snd_rme32_spdif_fd_info = { 369static struct snd_pcm_hardware snd_rme32_spdif_fd_info = {
370 .info = (SNDRV_PCM_INFO_MMAP | 370 .info = (SNDRV_PCM_INFO_MMAP |
@@ -390,7 +390,7 @@ static struct snd_pcm_hardware snd_rme32_spdif_fd_info = {
390}; 390};
391 391
392/* 392/*
393 * ADAT I/O capabilites (full-duplex mode) 393 * ADAT I/O capabilities (full-duplex mode)
394 */ 394 */
395static struct snd_pcm_hardware snd_rme32_adat_fd_info = 395static struct snd_pcm_hardware snd_rme32_adat_fd_info =
396{ 396{
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 0e694b011dcc..6c2a9f4a7659 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -359,7 +359,7 @@ snd_rme96_capture_copy(struct snd_pcm_substream *substream,
359} 359}
360 360
361/* 361/*
362 * Digital output capabilites (S/PDIF) 362 * Digital output capabilities (S/PDIF)
363 */ 363 */
364static struct snd_pcm_hardware snd_rme96_playback_spdif_info = 364static struct snd_pcm_hardware snd_rme96_playback_spdif_info =
365{ 365{
@@ -388,7 +388,7 @@ static struct snd_pcm_hardware snd_rme96_playback_spdif_info =
388}; 388};
389 389
390/* 390/*
391 * Digital input capabilites (S/PDIF) 391 * Digital input capabilities (S/PDIF)
392 */ 392 */
393static struct snd_pcm_hardware snd_rme96_capture_spdif_info = 393static struct snd_pcm_hardware snd_rme96_capture_spdif_info =
394{ 394{
@@ -417,7 +417,7 @@ static struct snd_pcm_hardware snd_rme96_capture_spdif_info =
417}; 417};
418 418
419/* 419/*
420 * Digital output capabilites (ADAT) 420 * Digital output capabilities (ADAT)
421 */ 421 */
422static struct snd_pcm_hardware snd_rme96_playback_adat_info = 422static struct snd_pcm_hardware snd_rme96_playback_adat_info =
423{ 423{
@@ -442,7 +442,7 @@ static struct snd_pcm_hardware snd_rme96_playback_adat_info =
442}; 442};
443 443
444/* 444/*
445 * Digital input capabilites (ADAT) 445 * Digital input capabilities (ADAT)
446 */ 446 */
447static struct snd_pcm_hardware snd_rme96_capture_adat_info = 447static struct snd_pcm_hardware snd_rme96_capture_adat_info =
448{ 448{
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 980b9cd689dd..b5538efd146b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -2256,7 +2256,7 @@ static int snd_hdspm_create_controls(struct snd_card *card, struct hdspm * hdspm
2256 } 2256 }
2257 2257
2258 /* Channel playback mixer as default control 2258 /* Channel playback mixer as default control
2259 Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats to big for any alsamixer 2259 Note: the whole matrix would be 128*HDSPM_MIXER_CHANNELS Faders, thats too big for any alsamixer
2260 they are accesible via special IOCTL on hwdep 2260 they are accesible via special IOCTL on hwdep
2261 and the mixer 2dimensional mixer control */ 2261 and the mixer 2dimensional mixer control */
2262 2262
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 7bbea3738b8a..2d66a09fe5ee 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -30,6 +30,7 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/gameport.h> 31#include <linux/gameport.h>
32#include <linux/moduleparam.h> 32#include <linux/moduleparam.h>
33#include <linux/dma-mapping.h>
33 34
34#include <sound/core.h> 35#include <sound/core.h>
35#include <sound/pcm.h> 36#include <sound/pcm.h>
@@ -1227,8 +1228,8 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card,
1227 if ((err = pci_enable_device(pci)) < 0) 1228 if ((err = pci_enable_device(pci)) < 0)
1228 return err; 1229 return err;
1229 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1230 /* check, if we can restrict PCI DMA transfers to 24 bits */
1230 if (pci_set_dma_mask(pci, 0x00ffffff) < 0 || 1231 if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
1231 pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) { 1232 pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
1232 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1233 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
1233 pci_disable_device(pci); 1234 pci_disable_device(pci);
1234 return -ENXIO; 1235 return -ENXIO;
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 83b7d8aba9e6..52178b8ad49d 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -35,6 +35,7 @@
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37#include <linux/gameport.h> 37#include <linux/gameport.h>
38#include <linux/dma-mapping.h>
38 39
39#include <sound/core.h> 40#include <sound/core.h>
40#include <sound/info.h> 41#include <sound/info.h>
@@ -3554,8 +3555,8 @@ int __devinit snd_trident_create(struct snd_card *card,
3554 if ((err = pci_enable_device(pci)) < 0) 3555 if ((err = pci_enable_device(pci)) < 0)
3555 return err; 3556 return err;
3556 /* check, if we can restrict PCI DMA transfers to 30 bits */ 3557 /* check, if we can restrict PCI DMA transfers to 30 bits */
3557 if (pci_set_dma_mask(pci, 0x3fffffff) < 0 || 3558 if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0 ||
3558 pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) { 3559 pci_set_consistent_dma_mask(pci, DMA_30BIT_MASK) < 0) {
3559 snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); 3560 snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n");
3560 pci_disable_device(pci); 3561 pci_disable_device(pci);
3561 return -ENXIO; 3562 return -ENXIO;
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 394b53e20cb8..6f849720aef3 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -53,7 +53,7 @@
53struct sound_unit 53struct sound_unit
54{ 54{
55 int unit_minor; 55 int unit_minor;
56 struct file_operations *unit_fops; 56 const struct file_operations *unit_fops;
57 struct sound_unit *next; 57 struct sound_unit *next;
58 char name[32]; 58 char name[32];
59}; 59};
@@ -73,7 +73,7 @@ EXPORT_SYMBOL(sound_class);
73 * join into it. Called with the lock asserted 73 * join into it. Called with the lock asserted
74 */ 74 */
75 75
76static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, struct file_operations *fops, int index, int low, int top) 76static int __sound_insert_unit(struct sound_unit * s, struct sound_unit **list, const struct file_operations *fops, int index, int low, int top)
77{ 77{
78 int n=low; 78 int n=low;
79 79
@@ -153,7 +153,7 @@ static DEFINE_SPINLOCK(sound_loader_lock);
153 * list. Acquires locks as needed 153 * list. Acquires locks as needed
154 */ 154 */
155 155
156static int sound_insert_unit(struct sound_unit **list, struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev) 156static int sound_insert_unit(struct sound_unit **list, const struct file_operations *fops, int index, int low, int top, const char *name, umode_t mode, struct device *dev)
157{ 157{
158 struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL); 158 struct sound_unit *s = kmalloc(sizeof(*s), GFP_KERNEL);
159 int r; 159 int r;
@@ -237,7 +237,7 @@ static struct sound_unit *chains[SOUND_STEP];
237 * a negative error code is returned. 237 * a negative error code is returned.
238 */ 238 */
239 239
240int register_sound_special_device(struct file_operations *fops, int unit, 240int register_sound_special_device(const struct file_operations *fops, int unit,
241 struct device *dev) 241 struct device *dev)
242{ 242{
243 const int chain = unit % SOUND_STEP; 243 const int chain = unit % SOUND_STEP;
@@ -301,7 +301,7 @@ int register_sound_special_device(struct file_operations *fops, int unit,
301 301
302EXPORT_SYMBOL(register_sound_special_device); 302EXPORT_SYMBOL(register_sound_special_device);
303 303
304int register_sound_special(struct file_operations *fops, int unit) 304int register_sound_special(const struct file_operations *fops, int unit)
305{ 305{
306 return register_sound_special_device(fops, unit, NULL); 306 return register_sound_special_device(fops, unit, NULL);
307} 307}
@@ -318,7 +318,7 @@ EXPORT_SYMBOL(register_sound_special);
318 * number is returned, on failure a negative error code is returned. 318 * number is returned, on failure a negative error code is returned.
319 */ 319 */
320 320
321int register_sound_mixer(struct file_operations *fops, int dev) 321int register_sound_mixer(const struct file_operations *fops, int dev)
322{ 322{
323 return sound_insert_unit(&chains[0], fops, dev, 0, 128, 323 return sound_insert_unit(&chains[0], fops, dev, 0, 128,
324 "mixer", S_IRUSR | S_IWUSR, NULL); 324 "mixer", S_IRUSR | S_IWUSR, NULL);
@@ -336,7 +336,7 @@ EXPORT_SYMBOL(register_sound_mixer);
336 * number is returned, on failure a negative error code is returned. 336 * number is returned, on failure a negative error code is returned.
337 */ 337 */
338 338
339int register_sound_midi(struct file_operations *fops, int dev) 339int register_sound_midi(const struct file_operations *fops, int dev)
340{ 340{
341 return sound_insert_unit(&chains[2], fops, dev, 2, 130, 341 return sound_insert_unit(&chains[2], fops, dev, 2, 130,
342 "midi", S_IRUSR | S_IWUSR, NULL); 342 "midi", S_IRUSR | S_IWUSR, NULL);
@@ -362,7 +362,7 @@ EXPORT_SYMBOL(register_sound_midi);
362 * and will always allocate them as a matching pair - eg dsp3/audio3 362 * and will always allocate them as a matching pair - eg dsp3/audio3
363 */ 363 */
364 364
365int register_sound_dsp(struct file_operations *fops, int dev) 365int register_sound_dsp(const struct file_operations *fops, int dev)
366{ 366{
367 return sound_insert_unit(&chains[3], fops, dev, 3, 131, 367 return sound_insert_unit(&chains[3], fops, dev, 3, 131,
368 "dsp", S_IWUSR | S_IRUSR, NULL); 368 "dsp", S_IWUSR | S_IRUSR, NULL);
@@ -381,7 +381,7 @@ EXPORT_SYMBOL(register_sound_dsp);
381 */ 381 */
382 382
383 383
384int register_sound_synth(struct file_operations *fops, int dev) 384int register_sound_synth(const struct file_operations *fops, int dev)
385{ 385{
386 return sound_insert_unit(&chains[9], fops, dev, 9, 137, 386 return sound_insert_unit(&chains[9], fops, dev, 9, 137,
387 "synth", S_IRUSR | S_IWUSR, NULL); 387 "synth", S_IRUSR | S_IWUSR, NULL);
@@ -501,7 +501,7 @@ int soundcore_open(struct inode *inode, struct file *file)
501 int chain; 501 int chain;
502 int unit = iminor(inode); 502 int unit = iminor(inode);
503 struct sound_unit *s; 503 struct sound_unit *s;
504 struct file_operations *new_fops = NULL; 504 const struct file_operations *new_fops = NULL;
505 505
506 chain=unit&0x0F; 506 chain=unit&0x0F;
507 if(chain==4 || chain==5) /* dsp/audio/dsp16 */ 507 if(chain==4 || chain==5) /* dsp/audio/dsp16 */
@@ -540,7 +540,7 @@ int soundcore_open(struct inode *inode, struct file *file)
540 * switching ->f_op in the first place. 540 * switching ->f_op in the first place.
541 */ 541 */
542 int err = 0; 542 int err = 0;
543 struct file_operations *old_fops = file->f_op; 543 const struct file_operations *old_fops = file->f_op;
544 file->f_op = new_fops; 544 file->f_op = new_fops;
545 spin_unlock(&sound_loader_lock); 545 spin_unlock(&sound_loader_lock);
546 if(file->f_op->open) 546 if(file->f_op->open)
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 315855082fe1..fe67a92e2a1a 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -404,7 +404,7 @@ static void usX2Y_usbpcm_subs_startup(struct snd_usX2Y_substream *subs)
404 struct usX2Ydev * usX2Y = subs->usX2Y; 404 struct usX2Ydev * usX2Y = subs->usX2Y;
405 usX2Y->prepare_subs = subs; 405 usX2Y->prepare_subs = subs;
406 subs->urb[0]->start_frame = -1; 406 subs->urb[0]->start_frame = -1;
407 smp_wmb(); // Make shure above modifications are seen by i_usX2Y_subs_startup() 407 smp_wmb(); // Make sure above modifications are seen by i_usX2Y_subs_startup()
408 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup); 408 usX2Y_urbs_set_complete(usX2Y, i_usX2Y_usbpcm_subs_startup);
409} 409}
410 410