aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore5
-rw-r--r--Documentation/DocBook/kernel-api.tmpl9
-rw-r--r--Documentation/SubmittingPatches10
-rw-r--r--Documentation/accounting/delay-accounting.txt10
-rw-r--r--Documentation/cpu-hotplug.txt12
-rw-r--r--Documentation/devices.txt8
-rw-r--r--Documentation/infiniband/ipoib.txt2
-rw-r--r--Documentation/initrd.txt16
-rw-r--r--Documentation/kbuild/makefiles.txt14
-rw-r--r--Documentation/kernel-parameters.txt4
-rw-r--r--Documentation/usb/proc_usb_info.txt2
-rw-r--r--Documentation/usb/usb-help.txt3
-rw-r--r--MAINTAINERS15
-rw-r--r--Makefile7
-rw-r--r--arch/alpha/kernel/err_ev7.c8
-rw-r--r--arch/alpha/kernel/osf_sys.c4
-rw-r--r--arch/alpha/kernel/setup.c50
-rw-r--r--arch/alpha/kernel/sys_ruffian.c8
-rw-r--r--arch/alpha/kernel/time.c2
-rw-r--r--arch/arm/common/gic.c3
-rw-r--r--arch/arm/common/locomo.c15
-rw-r--r--arch/arm/common/sa1111.c6
-rw-r--r--arch/arm/common/vic.c3
-rw-r--r--arch/arm/configs/ep93xx_defconfig15
-rw-r--r--arch/arm/kernel/ecard.c3
-rw-r--r--arch/arm/kernel/head.S6
-rw-r--r--arch/arm/kernel/irq.c1
-rw-r--r--arch/arm/kernel/traps.c7
-rw-r--r--arch/arm/mach-at91rm9200/gpio.c3
-rw-r--r--arch/arm/mach-at91rm9200/irq.c3
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c2
-rw-r--r--arch/arm/mach-imx/irq.c6
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c3
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c9
-rw-r--r--arch/arm/mach-iop3xx/iop321-irq.c3
-rw-r--r--arch/arm/mach-iop3xx/iop331-irq.c6
-rw-r--r--arch/arm/mach-lh7a40x/arch-kev7a400.c3
-rw-r--r--arch/arm/mach-lh7a40x/arch-lpd7a40x.c3
-rw-r--r--arch/arm/mach-lh7a40x/irq-kev7a400.c3
-rw-r--r--arch/arm/mach-lh7a40x/irq-lh7a400.c6
-rw-r--r--arch/arm/mach-lh7a40x/irq-lh7a404.c12
-rw-r--r--arch/arm/mach-lh7a40x/irq-lpd7a40x.c3
-rw-r--r--arch/arm/mach-omap1/fpga.c6
-rw-r--r--arch/arm/mach-omap1/irq.c3
-rw-r--r--arch/arm/mach-omap2/irq.c3
-rw-r--r--arch/arm/mach-pxa/irq.c12
-rw-r--r--arch/arm/mach-pxa/lpd270.c3
-rw-r--r--arch/arm/mach-pxa/lubbock.c3
-rw-r--r--arch/arm/mach-pxa/mainstone.c3
-rw-r--r--arch/arm/mach-s3c2410/mach-anubis.c49
-rw-r--r--arch/arm/mach-s3c2410/mach-osiris.c20
-rw-r--r--arch/arm/mach-sa1100/irq.c9
-rw-r--r--arch/arm/mach-shark/irq.c3
-rw-r--r--arch/arm/mach-versatile/core.c3
-rw-r--r--arch/arm/mm/ioremap.c2
-rw-r--r--arch/arm/mm/proc-syms.c8
-rw-r--r--arch/arm/mm/proc-xscale.S30
-rw-r--r--arch/arm/plat-omap/gpio.c8
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/kernel/Makefile3
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c2
-rw-r--r--arch/i386/kernel/cpu/mcheck/mce.h2
-rw-r--r--arch/i386/kernel/entry.S2
-rw-r--r--arch/i386/kernel/kprobes.c9
-rw-r--r--arch/i386/kernel/machine_kexec.c13
-rw-r--r--arch/i386/kernel/nmi.c1
-rw-r--r--arch/i386/kernel/smpboot.c62
-rw-r--r--arch/i386/kernel/traps.c18
-rw-r--r--arch/i386/kernel/vsyscall.lds.S1
-rw-r--r--arch/ia64/configs/sn2_defconfig2
-rw-r--r--arch/ia64/defconfig2
-rw-r--r--arch/ia64/kernel/Makefile3
-rw-r--r--arch/ia64/kernel/gate.lds.S1
-rw-r--r--arch/ia64/kernel/kprobes.c9
-rw-r--r--arch/ia64/kernel/palinfo.c13
-rw-r--r--arch/ia64/kernel/topology.c2
-rw-r--r--arch/ia64/kernel/traps.c7
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S1
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/configs/pmac32_defconfig112
-rw-r--r--arch/powerpc/kernel/head_64.S35
-rw-r--r--arch/powerpc/kernel/legacy_serial.c13
-rw-r--r--arch/powerpc/kernel/misc_64.S2
-rw-r--r--arch/powerpc/kernel/prom_init.c36
-rw-r--r--arch/powerpc/kernel/smp.c24
-rw-r--r--arch/powerpc/kernel/sysfs.c4
-rw-r--r--arch/powerpc/kernel/traps.c10
-rw-r--r--arch/powerpc/kernel/udbg_16550.c6
-rw-r--r--arch/powerpc/kernel/vdso32/Makefile3
-rw-r--r--arch/powerpc/kernel/vdso32/vdso32.lds.S1
-rw-r--r--arch/powerpc/kernel/vdso64/Makefile3
-rw-r--r--arch/powerpc/kernel/vdso64/vdso64.lds.S1
-rw-r--r--arch/powerpc/mm/lmb.c3
-rw-r--r--arch/powerpc/platforms/chrp/setup.c12
-rw-r--r--arch/powerpc/platforms/maple/setup.c17
-rw-r--r--arch/powerpc/platforms/powermac/backlight.c58
-rw-r--r--arch/powerpc/platforms/powermac/bootx_init.c35
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c78
-rw-r--r--arch/powerpc/platforms/pseries/setup.c6
-rw-r--r--arch/ppc/kernel/vmlinux.lds.S1
-rw-r--r--arch/s390/appldata/appldata_base.c10
-rw-r--r--arch/um/kernel/dyn.lds.S1
-rw-r--r--arch/v850/kernel/setup.c6
-rw-r--r--arch/v850/kernel/v850_ksyms.c16
-rw-r--r--arch/x86_64/defconfig9
-rw-r--r--arch/x86_64/ia32/Makefile1
-rw-r--r--arch/x86_64/ia32/vsyscall.lds1
-rw-r--r--arch/x86_64/kernel/entry.S18
-rw-r--r--arch/x86_64/kernel/machine_kexec.c13
-rw-r--r--arch/x86_64/kernel/mce.c12
-rw-r--r--arch/x86_64/kernel/mce_amd.c19
-rw-r--r--arch/x86_64/kernel/pci-calgary.c77
-rw-r--r--arch/x86_64/kernel/pci-nommu.c2
-rw-r--r--arch/x86_64/kernel/pci-swiotlb.c5
-rw-r--r--arch/x86_64/kernel/tce.c4
-rw-r--r--arch/x86_64/kernel/time.c16
-rw-r--r--arch/x86_64/kernel/traps.c2
-rw-r--r--arch/x86_64/pci/k8-bus.c10
-rw-r--r--arch/xtensa/kernel/traps.c8
-rw-r--r--drivers/base/topology.c2
-rw-r--r--drivers/block/nbd.c19
-rw-r--r--drivers/block/pktcdvd.c6
-rw-r--r--drivers/char/hw_random/geode-rng.c6
-rw-r--r--drivers/char/hw_random/intel-rng.c2
-rw-r--r--drivers/char/pc8736x_gpio.c1
-rw-r--r--drivers/connector/cn_proc.c20
-rw-r--r--drivers/ide/Kconfig15
-rw-r--r--drivers/ide/ide-iops.c2
-rw-r--r--drivers/infiniband/core/addr.c30
-rw-r--r--drivers/infiniband/core/cm.c4
-rw-r--r--drivers/infiniband/core/uverbs.h2
-rw-r--r--drivers/infiniband/core/uverbs_main.c8
-rw-r--r--drivers/infiniband/hw/mthca/mthca_allocator.c15
-rw-r--r--drivers/infiniband/ulp/ipoib/Kconfig3
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c19
-rw-r--r--drivers/macintosh/Kconfig13
-rw-r--r--drivers/macintosh/adbhid.c14
-rw-r--r--drivers/macintosh/therm_pm72.c218
-rw-r--r--drivers/macintosh/therm_pm72.h33
-rw-r--r--drivers/macintosh/via-pmu-backlight.c68
-rw-r--r--drivers/macintosh/via-pmu-led.c2
-rw-r--r--drivers/macintosh/via-pmu.c39
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c15
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c24
-rw-r--r--drivers/media/dvb/ttpci/av7110.c4
-rw-r--r--drivers/media/dvb/ttpci/av7110_v4l.c12
-rw-r--r--drivers/media/dvb/ttpci/budget-av.c3
-rw-r--r--drivers/media/dvb/ttpci/budget-ci.c2
-rw-r--r--drivers/media/dvb/ttpci/budget-core.c57
-rw-r--r--drivers/media/dvb/ttpci/budget-patch.c2
-rw-r--r--drivers/media/dvb/ttpci/budget.c5
-rw-r--r--drivers/media/dvb/ttpci/budget.h7
-rw-r--r--drivers/media/video/Kconfig4
-rw-r--r--drivers/media/video/bt8xx/Kconfig2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c15
-rw-r--r--drivers/media/video/bt8xx/bttv-vbi.c15
-rw-r--r--drivers/media/video/compat_ioctl32.c24
-rw-r--r--drivers/media/video/cpia2/Kconfig2
-rw-r--r--drivers/media/video/cx88/cx88-input.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c5
-rw-r--r--drivers/media/video/msp3400-driver.c10
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-io.c9
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-io.h2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ioread.c5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c85
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c10
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c10
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c6
-rw-r--r--drivers/media/video/saa7134/saa7134.h4
-rw-r--r--drivers/media/video/stradis.c1
-rw-r--r--drivers/media/video/tuner-core.c31
-rw-r--r--drivers/media/video/tuner-simple.c19
-rw-r--r--drivers/media/video/usbvideo/Kconfig8
-rw-r--r--drivers/media/video/v4l2-common.c24
-rw-r--r--drivers/media/video/videodev.c29
-rw-r--r--drivers/media/video/vivi.c4
-rw-r--r--drivers/net/appletalk/Kconfig2
-rw-r--r--drivers/net/e1000/e1000_main.c11
-rw-r--r--drivers/net/tg3.c10
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h10
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c16
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c7
-rw-r--r--drivers/pci/search.c46
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c16
-rw-r--r--drivers/pcmcia/pcmcia_resource.c15
-rw-r--r--drivers/pnp/pnpbios/core.c2
-rw-r--r--drivers/scsi/aic7xxx/aicasm/Makefile2
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/core/devio.c20
-rw-r--r--drivers/usb/core/file.c13
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/at91_udc.c176
-rw-r--r--drivers/usb/gadget/at91_udc.h1
-rw-r--r--drivers/usb/gadget/dummy_hcd.c6
-rw-r--r--drivers/usb/host/ehci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-at91.c88
-rw-r--r--drivers/usb/host/ohci-hcd.c3
-rw-r--r--drivers/usb/host/uhci-q.c4
-rw-r--r--drivers/usb/input/ati_remote.c5
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c9
-rw-r--r--drivers/usb/net/rtl8150.c83
-rw-r--r--drivers/usb/serial/Kconfig24
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/anydata.c123
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.h4
-rw-r--r--drivers/usb/serial/ipaq.c1
-rw-r--r--drivers/usb/serial/option.c76
-rw-r--r--drivers/usb/serial/pl2303.c1
-rw-r--r--drivers/usb/serial/pl2303.h4
-rw-r--r--drivers/usb/storage/unusual_devs.h29
-rw-r--r--drivers/usb/storage/usb.c13
-rw-r--r--drivers/video/Kconfig38
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/aty/aty128fb.c3
-rw-r--r--drivers/video/aty/atyfb_base.c4
-rw-r--r--drivers/video/aty/radeon_base.c18
-rw-r--r--drivers/video/aty/radeon_pm.c146
-rw-r--r--drivers/video/aty/radeonfb.h6
-rw-r--r--drivers/video/backlight/Kconfig4
-rw-r--r--drivers/video/console/mdacon.c4
-rw-r--r--drivers/video/fb_notify.c46
-rw-r--r--drivers/video/fbmem.c54
-rw-r--r--drivers/video/nvidia/nvidia.c9
-rw-r--r--drivers/video/offb.c307
-rw-r--r--drivers/video/riva/fbdev.c7
-rw-r--r--fs/9p/conv.c6
-rw-r--r--fs/9p/vfs_inode.c6
-rw-r--r--fs/buffer.c7
-rw-r--r--fs/coda/file.c4
-rw-r--r--fs/efs/symlink.c3
-rw-r--r--fs/ext3/inode.c19
-rw-r--r--fs/ext3/namei.c15
-rw-r--r--fs/freevxfs/vxfs_lookup.c2
-rw-r--r--fs/fuse/control.c4
-rw-r--r--fs/fuse/dir.c47
-rw-r--r--fs/fuse/fuse_i.h2
-rw-r--r--fs/fuse/inode.c2
-rw-r--r--fs/inotify_user.c2
-rw-r--r--fs/namei.c8
-rw-r--r--fs/nfsd/nfsfh.c20
-rw-r--r--fs/partitions/Kconfig2
-rw-r--r--fs/ufs/namei.c3
-rw-r--r--include/asm-arm/arch-iop3xx/iop331-irqs.h4
-rw-r--r--include/asm-arm/arch-omap/clock.h2
-rw-r--r--include/asm-i386/kprobes.h1
-rw-r--r--include/asm-ia64/kprobes.h1
-rw-r--r--include/asm-powerpc/backlight.h4
-rw-r--r--include/asm-powerpc/kprobes.h1
-rw-r--r--include/asm-sparc64/kprobes.h1
-rw-r--r--include/asm-x86_64/calgary.h5
-rw-r--r--include/asm-x86_64/kprobes.h1
-rw-r--r--include/asm-x86_64/swiotlb.h2
-rw-r--r--include/linux/audit.h43
-rw-r--r--include/linux/cn_proc.h3
-rw-r--r--include/linux/delayacct.h6
-rw-r--r--include/linux/ext3_fs.h9
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fsnotify.h6
-rw-r--r--include/linux/irq.h5
-rw-r--r--include/linux/jiffies.h4
-rw-r--r--include/linux/netfilter_bridge.h1
-rw-r--r--include/linux/pmu.h3
-rw-r--r--include/linux/security.h40
-rw-r--r--include/linux/skbuff.h33
-rw-r--r--include/linux/usb.h7
-rw-r--r--include/linux/usb_usual.h4
-rw-r--r--include/linux/videodev.h7
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/media/v4l2-dev.h7
-rw-r--r--include/net/af_unix.h6
-rw-r--r--include/net/ip6_route.h12
-rw-r--r--include/net/ipv6.h3
-rw-r--r--include/net/netdma.h2
-rw-r--r--include/net/netevent.h33
-rw-r--r--include/net/scm.h29
-rw-r--r--include/net/tcp.h3
-rw-r--r--ipc/msg.c389
-rw-r--r--kernel/audit.c4
-rw-r--r--kernel/auditfilter.c26
-rw-r--r--kernel/auditsc.c117
-rw-r--r--kernel/delayacct.c8
-rw-r--r--kernel/hrtimer.c4
-rw-r--r--kernel/irq/manage.c28
-rw-r--r--kernel/kprobes.c1
-rw-r--r--kernel/rcupdate.c4
-rw-r--r--kernel/rtmutex.c2
-rw-r--r--kernel/sched.c22
-rw-r--r--kernel/signal.c25
-rw-r--r--kernel/softirq.c22
-rw-r--r--kernel/softlockup.c4
-rw-r--r--kernel/taskstats.c32
-rw-r--r--kernel/timer.c8
-rw-r--r--kernel/workqueue.c58
-rw-r--r--lib/zlib_inflate/inflate.c5
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/slab.c4
-rw-r--r--net/core/Makefile2
-rw-r--r--net/core/dev.c19
-rw-r--r--net/core/neighbour.c14
-rw-r--r--net/core/netevent.c69
-rw-r--r--net/core/skbuff.c45
-rw-r--r--net/dccp/ipv6.c4
-rw-r--r--net/decnet/dn_route.c9
-rw-r--r--net/ipv4/ip_output.c7
-rw-r--r--net/ipv4/ip_sockglue.c9
-rw-r--r--net/ipv4/netfilter/ip_conntrack_sip.c2
-rw-r--r--net/ipv4/netfilter/ipt_hashlimit.c3
-rw-r--r--net/ipv4/route.c8
-rw-r--r--net/ipv4/tcp.c5
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/tcp_minisocks.c4
-rw-r--r--net/ipv4/tcp_probe.c2
-rw-r--r--net/ipv6/addrconf.c174
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/ipv6/inet6_connection_sock.c2
-rw-r--r--net/ipv6/ip6_output.c129
-rw-r--r--net/ipv6/route.c7
-rw-r--r--net/ipv6/tcp_ipv6.c6
-rw-r--r--net/ipv6/udp.c2
-rw-r--r--net/ipv6/xfrm6_output.c2
-rw-r--r--net/netfilter/xt_SECMARK.c2
-rw-r--r--net/netfilter/xt_string.c5
-rw-r--r--net/unix/af_unix.c17
-rw-r--r--scripts/Kbuild.include10
-rw-r--r--scripts/Makefile.modpost2
-rw-r--r--scripts/kconfig/confdata.c2
-rwxr-xr-xscripts/kernel-doc1
-rw-r--r--scripts/mod/file2alias.c62
-rw-r--r--security/dummy.c14
-rw-r--r--security/selinux/hooks.c38
-rw-r--r--security/selinux/ss/policydb.c12
-rw-r--r--security/selinux/ss/services.c4
336 files changed, 3747 insertions, 1985 deletions
diff --git a/.gitignore b/.gitignore
index 27fd37621255..b1f5b9df2ae1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,6 +30,11 @@ include/config
30include/linux/autoconf.h 30include/linux/autoconf.h
31include/linux/compile.h 31include/linux/compile.h
32include/linux/version.h 32include/linux/version.h
33include/linux/utsrelease.h
33 34
34# stgit generated dirs 35# stgit generated dirs
35patches-* 36patches-*
37
38# quilt's files
39patches
40series
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 1ae4dc0fd856..f8fe882e33dc 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -59,6 +59,9 @@
59!Iinclude/linux/hrtimer.h 59!Iinclude/linux/hrtimer.h
60!Ekernel/hrtimer.c 60!Ekernel/hrtimer.c
61 </sect1> 61 </sect1>
62 <sect1><title>Workqueues and Kevents</title>
63!Ekernel/workqueue.c
64 </sect1>
62 <sect1><title>Internal Functions</title> 65 <sect1><title>Internal Functions</title>
63!Ikernel/exit.c 66!Ikernel/exit.c
64!Ikernel/signal.c 67!Ikernel/signal.c
@@ -300,7 +303,7 @@ X!Ekernel/module.c
300 </sect1> 303 </sect1>
301 304
302 <sect1><title>Resources Management</title> 305 <sect1><title>Resources Management</title>
303!Ekernel/resource.c 306!Ikernel/resource.c
304 </sect1> 307 </sect1>
305 308
306 <sect1><title>MTRR Handling</title> 309 <sect1><title>MTRR Handling</title>
@@ -312,9 +315,7 @@ X!Ekernel/module.c
312!Edrivers/pci/pci-driver.c 315!Edrivers/pci/pci-driver.c
313!Edrivers/pci/remove.c 316!Edrivers/pci/remove.c
314!Edrivers/pci/pci-acpi.c 317!Edrivers/pci/pci-acpi.c
315<!-- kerneldoc does not understand __devinit 318!Edrivers/pci/search.c
316X!Edrivers/pci/search.c
317 -->
318!Edrivers/pci/msi.c 319!Edrivers/pci/msi.c
319!Edrivers/pci/bus.c 320!Edrivers/pci/bus.c
320<!-- FIXME: Removed for now since no structured comments in source 321<!-- FIXME: Removed for now since no structured comments in source
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index c2c85bcb3d43..2cd7f02ffd0b 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -10,7 +10,9 @@ kernel, the process can sometimes be daunting if you're not familiar
10with "the system." This text is a collection of suggestions which 10with "the system." This text is a collection of suggestions which
11can greatly increase the chances of your change being accepted. 11can greatly increase the chances of your change being accepted.
12 12
13If you are submitting a driver, also read Documentation/SubmittingDrivers. 13Read Documentation/SubmitChecklist for a list of items to check
14before submitting code. If you are submitting a driver, also read
15Documentation/SubmittingDrivers.
14 16
15 17
16 18
@@ -74,9 +76,6 @@ There are a number of scripts which can aid in this:
74Quilt: 76Quilt:
75http://savannah.nongnu.org/projects/quilt 77http://savannah.nongnu.org/projects/quilt
76 78
77Randy Dunlap's patch scripts:
78http://www.xenotime.net/linux/scripts/patching-scripts-002.tar.gz
79
80Andrew Morton's patch scripts: 79Andrew Morton's patch scripts:
81http://www.zip.com.au/~akpm/linux/patches/ 80http://www.zip.com.au/~akpm/linux/patches/
82Instead of these scripts, quilt is the recommended patch management 81Instead of these scripts, quilt is the recommended patch management
@@ -484,7 +483,7 @@ Greg Kroah-Hartman "How to piss off a kernel subsystem maintainer".
484 <http://www.kroah.com/log/2005/10/19/> 483 <http://www.kroah.com/log/2005/10/19/>
485 <http://www.kroah.com/log/2006/01/11/> 484 <http://www.kroah.com/log/2006/01/11/>
486 485
487NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!. 486NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
488 <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2> 487 <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2>
489 488
490Kernel Documentation/CodingStyle 489Kernel Documentation/CodingStyle
@@ -493,4 +492,3 @@ Kernel Documentation/CodingStyle
493Linus Torvald's mail on the canonical patch format: 492Linus Torvald's mail on the canonical patch format:
494 <http://lkml.org/lkml/2005/4/7/183> 493 <http://lkml.org/lkml/2005/4/7/183>
495-- 494--
496Last updated on 17 Nov 2005.
diff --git a/Documentation/accounting/delay-accounting.txt b/Documentation/accounting/delay-accounting.txt
index be215e58423b..1443cd71d263 100644
--- a/Documentation/accounting/delay-accounting.txt
+++ b/Documentation/accounting/delay-accounting.txt
@@ -64,11 +64,13 @@ Compile the kernel with
64 CONFIG_TASK_DELAY_ACCT=y 64 CONFIG_TASK_DELAY_ACCT=y
65 CONFIG_TASKSTATS=y 65 CONFIG_TASKSTATS=y
66 66
67Enable the accounting at boot time by adding 67Delay accounting is enabled by default at boot up.
68the following to the kernel boot options 68To disable, add
69 delayacct 69 nodelayacct
70to the kernel boot options. The rest of the instructions
71below assume this has not been done.
70 72
71and after the system has booted up, use a utility 73After the system has booted up, use a utility
72similar to getdelays.c to access the delays 74similar to getdelays.c to access the delays
73seen by a given task or a task group (tgid). 75seen by a given task or a task group (tgid).
74The utility also allows a given command to be 76The utility also allows a given command to be
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 1bcf69996c9d..bc107cb157a8 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -251,16 +251,24 @@ A: This is what you would need in your kernel code to receive notifications.
251 return NOTIFY_OK; 251 return NOTIFY_OK;
252 } 252 }
253 253
254 static struct notifier_block foobar_cpu_notifer = 254 static struct notifier_block __cpuinitdata foobar_cpu_notifer =
255 { 255 {
256 .notifier_call = foobar_cpu_callback, 256 .notifier_call = foobar_cpu_callback,
257 }; 257 };
258 258
259You need to call register_cpu_notifier() from your init function.
260Init functions could be of two types:
2611. early init (init function called when only the boot processor is online).
2622. late init (init function called _after_ all the CPUs are online).
259 263
260In your init function, 264For the first case, you should add the following to your init function
261 265
262 register_cpu_notifier(&foobar_cpu_notifier); 266 register_cpu_notifier(&foobar_cpu_notifier);
263 267
268For the second case, you should add the following to your init function
269
270 register_hotcpu_notifier(&foobar_cpu_notifier);
271
264You can fail PREPARE notifiers if something doesn't work to prepare resources. 272You can fail PREPARE notifiers if something doesn't work to prepare resources.
265This will stop the activity and send a following CANCELED event back. 273This will stop the activity and send a following CANCELED event back.
266 274
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index 4aaf68fafebe..66c725f530f3 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -2565,10 +2565,10 @@ Your cooperation is appreciated.
2565 243 = /dev/usb/dabusb3 Fourth dabusb device 2565 243 = /dev/usb/dabusb3 Fourth dabusb device
2566 2566
2567180 block USB block devices 2567180 block USB block devices
2568 0 = /dev/uba First USB block device 2568 0 = /dev/uba First USB block device
2569 8 = /dev/ubb Second USB block device 2569 8 = /dev/ubb Second USB block device
2570 16 = /dev/ubc Thrid USB block device 2570 16 = /dev/ubc Third USB block device
2571 ... 2571 ...
2572 2572
2573181 char Conrad Electronic parallel port radio clocks 2573181 char Conrad Electronic parallel port radio clocks
2574 0 = /dev/pcfclock0 First Conrad radio clock 2574 0 = /dev/pcfclock0 First Conrad radio clock
diff --git a/Documentation/infiniband/ipoib.txt b/Documentation/infiniband/ipoib.txt
index 187035560d7f..864ff3283780 100644
--- a/Documentation/infiniband/ipoib.txt
+++ b/Documentation/infiniband/ipoib.txt
@@ -51,8 +51,6 @@ Debugging Information
51 51
52References 52References
53 53
54 IETF IP over InfiniBand (ipoib) Working Group
55 http://ietf.org/html.charters/ipoib-charter.html
56 Transmission of IP over InfiniBand (IPoIB) (RFC 4391) 54 Transmission of IP over InfiniBand (IPoIB) (RFC 4391)
57 http://ietf.org/rfc/rfc4391.txt 55 http://ietf.org/rfc/rfc4391.txt
58 IP over InfiniBand (IPoIB) Architecture (RFC 4392) 56 IP over InfiniBand (IPoIB) Architecture (RFC 4392)
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt
index b1b6440237a6..15f1b35deb34 100644
--- a/Documentation/initrd.txt
+++ b/Documentation/initrd.txt
@@ -72,6 +72,22 @@ initrd adds the following new options:
72 initrd is mounted as root, and the normal boot procedure is followed, 72 initrd is mounted as root, and the normal boot procedure is followed,
73 with the RAM disk still mounted as root. 73 with the RAM disk still mounted as root.
74 74
75Compressed cpio images
76----------------------
77
78Recent kernels have support for populating a ramdisk from a compressed cpio
79archive, on such systems, the creation of a ramdisk image doesn't need to
80involve special block devices or loopbacks, you merely create a directory on
81disk with the desired initrd content, cd to that directory, and run (as an
82example):
83
84find . | cpio --quiet -c -o | gzip -9 -n > /boot/imagefile.img
85
86Examining the contents of an existing image file is just as simple:
87
88mkdir /tmp/imagefile
89cd /tmp/imagefile
90gzip -cd /boot/imagefile.img | cpio -imd --quiet
75 91
76Installation 92Installation
77------------ 93------------
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 14ef3868a328..0706699c9da9 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -407,6 +407,20 @@ more details, with real examples.
407 The second argument is optional, and if supplied will be used 407 The second argument is optional, and if supplied will be used
408 if first argument is not supported. 408 if first argument is not supported.
409 409
410 ld-option
411 ld-option is used to check if $(CC) when used to link object files
412 supports the given option. An optional second option may be
413 specified if first option are not supported.
414
415 Example:
416 #arch/i386/kernel/Makefile
417 vsyscall-flags += $(call ld-option, -Wl$(comma)--hash-style=sysv)
418
419 In the above example vsyscall-flags will be assigned the option
420 -Wl$(comma)--hash-style=sysv if it is supported by $(CC).
421 The second argument is optional, and if supplied will be used
422 if first argument is not supported.
423
410 cc-option 424 cc-option
411 cc-option is used to check if $(CC) support a given option, and not 425 cc-option is used to check if $(CC) support a given option, and not
412 supported to use an optional second option. 426 supported to use an optional second option.
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index e11f7728ec6f..b50595a0550f 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -448,8 +448,6 @@ running once the system is up.
448 Format: <area>[,<node>] 448 Format: <area>[,<node>]
449 See also Documentation/networking/decnet.txt. 449 See also Documentation/networking/decnet.txt.
450 450
451 delayacct [KNL] Enable per-task delay accounting
452
453 dhash_entries= [KNL] 451 dhash_entries= [KNL]
454 Set number of hash buckets for dentry cache. 452 Set number of hash buckets for dentry cache.
455 453
@@ -1031,6 +1029,8 @@ running once the system is up.
1031 1029
1032 nocache [ARM] 1030 nocache [ARM]
1033 1031
1032 nodelayacct [KNL] Disable per-task delay accounting
1033
1034 nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. 1034 nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects.
1035 1035
1036 noexec [IA-64] 1036 noexec [IA-64]
diff --git a/Documentation/usb/proc_usb_info.txt b/Documentation/usb/proc_usb_info.txt
index f86550fe38ee..22c5331260ca 100644
--- a/Documentation/usb/proc_usb_info.txt
+++ b/Documentation/usb/proc_usb_info.txt
@@ -59,7 +59,7 @@ bind to an interface (or perhaps several) using an ioctl call. You
59would issue more ioctls to the device to communicate to it using 59would issue more ioctls to the device to communicate to it using
60control, bulk, or other kinds of USB transfers. The IOCTLs are 60control, bulk, or other kinds of USB transfers. The IOCTLs are
61listed in the <linux/usbdevice_fs.h> file, and at this writing the 61listed in the <linux/usbdevice_fs.h> file, and at this writing the
62source code (linux/drivers/usb/devio.c) is the primary reference 62source code (linux/drivers/usb/core/devio.c) is the primary reference
63for how to access devices through those files. 63for how to access devices through those files.
64 64
65Note that since by default these BBB/DDD files are writable only by 65Note that since by default these BBB/DDD files are writable only by
diff --git a/Documentation/usb/usb-help.txt b/Documentation/usb/usb-help.txt
index b7c324973695..a7408593829f 100644
--- a/Documentation/usb/usb-help.txt
+++ b/Documentation/usb/usb-help.txt
@@ -5,8 +5,7 @@ For USB help other than the readme files that are located in
5Documentation/usb/*, see the following: 5Documentation/usb/*, see the following:
6 6
7Linux-USB project: http://www.linux-usb.org 7Linux-USB project: http://www.linux-usb.org
8 mirrors at http://www.suse.cz/development/linux-usb/ 8 mirrors at http://usb.in.tum.de/linux-usb/
9 and http://usb.in.tum.de/linux-usb/
10 and http://it.linux-usb.org 9 and http://it.linux-usb.org
11Linux USB Guide: http://linux-usb.sourceforge.net 10Linux USB Guide: http://linux-usb.sourceforge.net
12Linux-USB device overview (working devices and drivers): 11Linux-USB device overview (working devices and drivers):
diff --git a/MAINTAINERS b/MAINTAINERS
index dbb9d90ccad8..fb20abdb805d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -968,6 +968,10 @@ P: Andrey V. Savochkin
968M: saw@saw.sw.com.sg 968M: saw@saw.sw.com.sg
969S: Maintained 969S: Maintained
970 970
971EFS FILESYSTEM
972W: http://aeschi.ch.eu.org/efs/
973S: Orphan
974
971EMU10K1 SOUND DRIVER 975EMU10K1 SOUND DRIVER
972P: James Courtier-Dutton 976P: James Courtier-Dutton
973M: James@superbug.demon.co.uk 977M: James@superbug.demon.co.uk
@@ -1598,7 +1602,7 @@ W: http://jfs.sourceforge.net/
1598T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git 1602T: git kernel.org:/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git
1599S: Supported 1603S: Supported
1600 1604
1601JOURNALLING LAYER FOR BLOCK DEVICS (JBD) 1605JOURNALLING LAYER FOR BLOCK DEVICES (JBD)
1602P: Stephen Tweedie, Andrew Morton 1606P: Stephen Tweedie, Andrew Morton
1603M: sct@redhat.com, akpm@osdl.org 1607M: sct@redhat.com, akpm@osdl.org
1604L: ext2-devel@lists.sourceforge.net 1608L: ext2-devel@lists.sourceforge.net
@@ -1642,9 +1646,8 @@ S: Maintained
1642 1646
1643KERNEL JANITORS 1647KERNEL JANITORS
1644P: Several 1648P: Several
1645L: kernel-janitors@osdl.org 1649L: kernel-janitors@lists.osdl.org
1646W: http://www.kerneljanitors.org/ 1650W: http://www.kerneljanitors.org/
1647W: http://sf.net/projects/kernel-janitor/
1648S: Maintained 1651S: Maintained
1649 1652
1650KERNEL NFSD 1653KERNEL NFSD
@@ -1882,6 +1885,12 @@ S: linux-scsi@vger.kernel.org
1882W: http://megaraid.lsilogic.com 1885W: http://megaraid.lsilogic.com
1883S: Maintained 1886S: Maintained
1884 1887
1888MEMORY MANAGEMENT
1889L: linux-mm@kvack.org
1890L: linux-kernel@vger.kernel.org
1891W: http://www.linux-mm.org
1892S: Maintained
1893
1885MEMORY TECHNOLOGY DEVICES (MTD) 1894MEMORY TECHNOLOGY DEVICES (MTD)
1886P: David Woodhouse 1895P: David Woodhouse
1887M: dwmw2@infradead.org 1896M: dwmw2@infradead.org
diff --git a/Makefile b/Makefile
index 1dd58d35d72c..110db856e966 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 18 3SUBLEVEL = 18
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc3
5NAME=Crazed Snow-Weasel 5NAME=Crazed Snow-Weasel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -310,8 +310,8 @@ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
310CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 310CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
311 -fno-strict-aliasing -fno-common 311 -fno-strict-aliasing -fno-common
312# Force gcc to behave correct even for buggy distributions 312# Force gcc to behave correct even for buggy distributions
313CFLAGS += $(call cc-option, -fno-stack-protector-all \ 313CFLAGS += $(call cc-option, -fno-stack-protector)
314 -fno-stack-protector) 314
315AFLAGS := -D__ASSEMBLY__ 315AFLAGS := -D__ASSEMBLY__
316 316
317# Read KERNELRELEASE from include/config/kernel.release (if it exists) 317# Read KERNELRELEASE from include/config/kernel.release (if it exists)
@@ -368,6 +368,7 @@ endif
368 368
369no-dot-config-targets := clean mrproper distclean \ 369no-dot-config-targets := clean mrproper distclean \
370 cscope TAGS tags help %docs check% \ 370 cscope TAGS tags help %docs check% \
371 include/linux/version.h headers_% \
371 kernelrelease kernelversion 372 kernelrelease kernelversion
372 373
373config-targets := 0 374config-targets := 0
diff --git a/arch/alpha/kernel/err_ev7.c b/arch/alpha/kernel/err_ev7.c
index bf52ba691957..fed6b3d1b803 100644
--- a/arch/alpha/kernel/err_ev7.c
+++ b/arch/alpha/kernel/err_ev7.c
@@ -274,16 +274,14 @@ ev7_process_pal_subpacket(struct el_subpacket *header)
274struct el_subpacket_handler ev7_pal_subpacket_handler = 274struct el_subpacket_handler ev7_pal_subpacket_handler =
275 SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket); 275 SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket);
276 276
277void 277void
278ev7_register_error_handlers(void) 278ev7_register_error_handlers(void)
279{ 279{
280 int i; 280 int i;
281 281
282 for(i = 0; 282 for (i = 0; i < ARRAY_SIZE(el_ev7_pal_annotations); i++)
283 i<sizeof(el_ev7_pal_annotations)/sizeof(el_ev7_pal_annotations[1]);
284 i++) {
285 cdl_register_subpacket_annotation(&el_ev7_pal_annotations[i]); 283 cdl_register_subpacket_annotation(&el_ev7_pal_annotations[i]);
286 } 284
287 cdl_register_subpacket_handler(&ev7_pal_subpacket_handler); 285 cdl_register_subpacket_handler(&ev7_pal_subpacket_handler);
288} 286}
289 287
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index e15dcf4f3dcd..73c7622b5297 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -623,12 +623,12 @@ osf_sysinfo(int command, char __user *buf, long count)
623 long len, err = -EINVAL; 623 long len, err = -EINVAL;
624 624
625 offset = command-1; 625 offset = command-1;
626 if (offset >= sizeof(sysinfo_table)/sizeof(char *)) { 626 if (offset >= ARRAY_SIZE(sysinfo_table)) {
627 /* Digital UNIX has a few unpublished interfaces here */ 627 /* Digital UNIX has a few unpublished interfaces here */
628 printk("sysinfo(%d)", command); 628 printk("sysinfo(%d)", command);
629 goto out; 629 goto out;
630 } 630 }
631 631
632 down_read(&uts_sem); 632 down_read(&uts_sem);
633 res = sysinfo_table[offset]; 633 res = sysinfo_table[offset];
634 len = strlen(res)+1; 634 len = strlen(res)+1;
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index 2cb9c4380113..fd4a8fa0c93d 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -114,8 +114,6 @@ struct alpha_machine_vector alpha_mv;
114int alpha_using_srm; 114int alpha_using_srm;
115#endif 115#endif
116 116
117#define N(a) (sizeof(a)/sizeof(a[0]))
118
119static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, 117static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long,
120 unsigned long); 118 unsigned long);
121static struct alpha_machine_vector *get_sysvec_byname(const char *); 119static struct alpha_machine_vector *get_sysvec_byname(const char *);
@@ -240,7 +238,7 @@ reserve_std_resources(void)
240 standard_io_resources[0].start = RTC_PORT(0); 238 standard_io_resources[0].start = RTC_PORT(0);
241 standard_io_resources[0].end = RTC_PORT(0) + 0x10; 239 standard_io_resources[0].end = RTC_PORT(0) + 0x10;
242 240
243 for (i = 0; i < N(standard_io_resources); ++i) 241 for (i = 0; i < ARRAY_SIZE(standard_io_resources); ++i)
244 request_resource(io, standard_io_resources+i); 242 request_resource(io, standard_io_resources+i);
245} 243}
246 244
@@ -918,13 +916,13 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
918 916
919 /* Search the system tables first... */ 917 /* Search the system tables first... */
920 vec = NULL; 918 vec = NULL;
921 if (type < N(systype_vecs)) { 919 if (type < ARRAY_SIZE(systype_vecs)) {
922 vec = systype_vecs[type]; 920 vec = systype_vecs[type];
923 } else if ((type > ST_API_BIAS) && 921 } else if ((type > ST_API_BIAS) &&
924 (type - ST_API_BIAS) < N(api_vecs)) { 922 (type - ST_API_BIAS) < ARRAY_SIZE(api_vecs)) {
925 vec = api_vecs[type - ST_API_BIAS]; 923 vec = api_vecs[type - ST_API_BIAS];
926 } else if ((type > ST_UNOFFICIAL_BIAS) && 924 } else if ((type > ST_UNOFFICIAL_BIAS) &&
927 (type - ST_UNOFFICIAL_BIAS) < N(unofficial_vecs)) { 925 (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_vecs)) {
928 vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS]; 926 vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS];
929 } 927 }
930 928
@@ -938,11 +936,11 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
938 936
939 switch (type) { 937 switch (type) {
940 case ST_DEC_ALCOR: 938 case ST_DEC_ALCOR:
941 if (member < N(alcor_indices)) 939 if (member < ARRAY_SIZE(alcor_indices))
942 vec = alcor_vecs[alcor_indices[member]]; 940 vec = alcor_vecs[alcor_indices[member]];
943 break; 941 break;
944 case ST_DEC_EB164: 942 case ST_DEC_EB164:
945 if (member < N(eb164_indices)) 943 if (member < ARRAY_SIZE(eb164_indices))
946 vec = eb164_vecs[eb164_indices[member]]; 944 vec = eb164_vecs[eb164_indices[member]];
947 /* PC164 may show as EB164 variation with EV56 CPU, 945 /* PC164 may show as EB164 variation with EV56 CPU,
948 but, since no true EB164 had anything but EV5... */ 946 but, since no true EB164 had anything but EV5... */
@@ -950,24 +948,24 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
950 vec = &pc164_mv; 948 vec = &pc164_mv;
951 break; 949 break;
952 case ST_DEC_EB64P: 950 case ST_DEC_EB64P:
953 if (member < N(eb64p_indices)) 951 if (member < ARRAY_SIZE(eb64p_indices))
954 vec = eb64p_vecs[eb64p_indices[member]]; 952 vec = eb64p_vecs[eb64p_indices[member]];
955 break; 953 break;
956 case ST_DEC_EB66: 954 case ST_DEC_EB66:
957 if (member < N(eb66_indices)) 955 if (member < ARRAY_SIZE(eb66_indices))
958 vec = eb66_vecs[eb66_indices[member]]; 956 vec = eb66_vecs[eb66_indices[member]];
959 break; 957 break;
960 case ST_DEC_MARVEL: 958 case ST_DEC_MARVEL:
961 if (member < N(marvel_indices)) 959 if (member < ARRAY_SIZE(marvel_indices))
962 vec = marvel_vecs[marvel_indices[member]]; 960 vec = marvel_vecs[marvel_indices[member]];
963 break; 961 break;
964 case ST_DEC_TITAN: 962 case ST_DEC_TITAN:
965 vec = titan_vecs[0]; /* default */ 963 vec = titan_vecs[0]; /* default */
966 if (member < N(titan_indices)) 964 if (member < ARRAY_SIZE(titan_indices))
967 vec = titan_vecs[titan_indices[member]]; 965 vec = titan_vecs[titan_indices[member]];
968 break; 966 break;
969 case ST_DEC_TSUNAMI: 967 case ST_DEC_TSUNAMI:
970 if (member < N(tsunami_indices)) 968 if (member < ARRAY_SIZE(tsunami_indices))
971 vec = tsunami_vecs[tsunami_indices[member]]; 969 vec = tsunami_vecs[tsunami_indices[member]];
972 break; 970 break;
973 case ST_DEC_1000: 971 case ST_DEC_1000:
@@ -1039,7 +1037,7 @@ get_sysvec_byname(const char *name)
1039 1037
1040 size_t i; 1038 size_t i;
1041 1039
1042 for (i = 0; i < N(all_vecs); ++i) { 1040 for (i = 0; i < ARRAY_SIZE(all_vecs); ++i) {
1043 struct alpha_machine_vector *mv = all_vecs[i]; 1041 struct alpha_machine_vector *mv = all_vecs[i];
1044 if (strcasecmp(mv->vector_name, name) == 0) 1042 if (strcasecmp(mv->vector_name, name) == 0)
1045 return mv; 1043 return mv;
@@ -1055,13 +1053,13 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
1055 1053
1056 /* If not in the tables, make it UNKNOWN, 1054 /* If not in the tables, make it UNKNOWN,
1057 else set type name to family */ 1055 else set type name to family */
1058 if (type < N(systype_names)) { 1056 if (type < ARRAY_SIZE(systype_names)) {
1059 *type_name = systype_names[type]; 1057 *type_name = systype_names[type];
1060 } else if ((type > ST_API_BIAS) && 1058 } else if ((type > ST_API_BIAS) &&
1061 (type - ST_API_BIAS) < N(api_names)) { 1059 (type - ST_API_BIAS) < ARRAY_SIZE(api_names)) {
1062 *type_name = api_names[type - ST_API_BIAS]; 1060 *type_name = api_names[type - ST_API_BIAS];
1063 } else if ((type > ST_UNOFFICIAL_BIAS) && 1061 } else if ((type > ST_UNOFFICIAL_BIAS) &&
1064 (type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) { 1062 (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_names)) {
1065 *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; 1063 *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS];
1066 } else { 1064 } else {
1067 *type_name = sys_unknown; 1065 *type_name = sys_unknown;
@@ -1083,7 +1081,7 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
1083 default: /* default to variation "0" for now */ 1081 default: /* default to variation "0" for now */
1084 break; 1082 break;
1085 case ST_DEC_EB164: 1083 case ST_DEC_EB164:
1086 if (member < N(eb164_indices)) 1084 if (member < ARRAY_SIZE(eb164_indices))
1087 *variation_name = eb164_names[eb164_indices[member]]; 1085 *variation_name = eb164_names[eb164_indices[member]];
1088 /* PC164 may show as EB164 variation, but with EV56 CPU, 1086 /* PC164 may show as EB164 variation, but with EV56 CPU,
1089 so, since no true EB164 had anything but EV5... */ 1087 so, since no true EB164 had anything but EV5... */
@@ -1091,32 +1089,32 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
1091 *variation_name = eb164_names[1]; /* make it PC164 */ 1089 *variation_name = eb164_names[1]; /* make it PC164 */
1092 break; 1090 break;
1093 case ST_DEC_ALCOR: 1091 case ST_DEC_ALCOR:
1094 if (member < N(alcor_indices)) 1092 if (member < ARRAY_SIZE(alcor_indices))
1095 *variation_name = alcor_names[alcor_indices[member]]; 1093 *variation_name = alcor_names[alcor_indices[member]];
1096 break; 1094 break;
1097 case ST_DEC_EB64P: 1095 case ST_DEC_EB64P:
1098 if (member < N(eb64p_indices)) 1096 if (member < ARRAY_SIZE(eb64p_indices))
1099 *variation_name = eb64p_names[eb64p_indices[member]]; 1097 *variation_name = eb64p_names[eb64p_indices[member]];
1100 break; 1098 break;
1101 case ST_DEC_EB66: 1099 case ST_DEC_EB66:
1102 if (member < N(eb66_indices)) 1100 if (member < ARRAY_SIZE(eb66_indices))
1103 *variation_name = eb66_names[eb66_indices[member]]; 1101 *variation_name = eb66_names[eb66_indices[member]];
1104 break; 1102 break;
1105 case ST_DEC_MARVEL: 1103 case ST_DEC_MARVEL:
1106 if (member < N(marvel_indices)) 1104 if (member < ARRAY_SIZE(marvel_indices))
1107 *variation_name = marvel_names[marvel_indices[member]]; 1105 *variation_name = marvel_names[marvel_indices[member]];
1108 break; 1106 break;
1109 case ST_DEC_RAWHIDE: 1107 case ST_DEC_RAWHIDE:
1110 if (member < N(rawhide_indices)) 1108 if (member < ARRAY_SIZE(rawhide_indices))
1111 *variation_name = rawhide_names[rawhide_indices[member]]; 1109 *variation_name = rawhide_names[rawhide_indices[member]];
1112 break; 1110 break;
1113 case ST_DEC_TITAN: 1111 case ST_DEC_TITAN:
1114 *variation_name = titan_names[0]; /* default */ 1112 *variation_name = titan_names[0]; /* default */
1115 if (member < N(titan_indices)) 1113 if (member < ARRAY_SIZE(titan_indices))
1116 *variation_name = titan_names[titan_indices[member]]; 1114 *variation_name = titan_names[titan_indices[member]];
1117 break; 1115 break;
1118 case ST_DEC_TSUNAMI: 1116 case ST_DEC_TSUNAMI:
1119 if (member < N(tsunami_indices)) 1117 if (member < ARRAY_SIZE(tsunami_indices))
1120 *variation_name = tsunami_names[tsunami_indices[member]]; 1118 *variation_name = tsunami_names[tsunami_indices[member]];
1121 break; 1119 break;
1122 } 1120 }
@@ -1211,7 +1209,7 @@ show_cpuinfo(struct seq_file *f, void *slot)
1211 1209
1212 cpu_index = (unsigned) (cpu->type - 1); 1210 cpu_index = (unsigned) (cpu->type - 1);
1213 cpu_name = "Unknown"; 1211 cpu_name = "Unknown";
1214 if (cpu_index < N(cpu_names)) 1212 if (cpu_index < ARRAY_SIZE(cpu_names))
1215 cpu_name = cpu_names[cpu_index]; 1213 cpu_name = cpu_names[cpu_index];
1216 1214
1217 get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, 1215 get_sysnames(hwrpb->sys_type, hwrpb->sys_variation,
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index 78c30decf3ff..5b99cf3cd69c 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -182,16 +182,16 @@ static unsigned long __init
182ruffian_get_bank_size(unsigned long offset) 182ruffian_get_bank_size(unsigned long offset)
183{ 183{
184 unsigned long bank_addr, bank, ret = 0; 184 unsigned long bank_addr, bank, ret = 0;
185 185
186 /* Valid offsets are: 0x800, 0x840 and 0x880 186 /* Valid offsets are: 0x800, 0x840 and 0x880
187 since Ruffian only uses three banks. */ 187 since Ruffian only uses three banks. */
188 bank_addr = (unsigned long)PYXIS_MCR + offset; 188 bank_addr = (unsigned long)PYXIS_MCR + offset;
189 bank = *(vulp)bank_addr; 189 bank = *(vulp)bank_addr;
190 190
191 /* Check BANK_ENABLE */ 191 /* Check BANK_ENABLE */
192 if (bank & 0x01) { 192 if (bank & 0x01) {
193 static unsigned long size[] __initdata = { 193 static unsigned long size[] __initdata = {
194 0x40000000UL, /* 0x00, 1G */ 194 0x40000000UL, /* 0x00, 1G */
195 0x20000000UL, /* 0x02, 512M */ 195 0x20000000UL, /* 0x02, 512M */
196 0x10000000UL, /* 0x04, 256M */ 196 0x10000000UL, /* 0x04, 256M */
197 0x08000000UL, /* 0x06, 128M */ 197 0x08000000UL, /* 0x06, 128M */
@@ -203,7 +203,7 @@ ruffian_get_bank_size(unsigned long offset)
203 }; 203 };
204 204
205 bank = (bank & 0x1e) >> 1; 205 bank = (bank & 0x1e) >> 1;
206 if (bank < sizeof(size)/sizeof(*size)) 206 if (bank < ARRAY_SIZE(size))
207 ret = size[bank]; 207 ret = size[bank];
208 } 208 }
209 209
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 50eccde2dcd8..b191cc759737 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -233,7 +233,7 @@ validate_cc_value(unsigned long cc)
233 index = cpu->type & 0xffffffff; 233 index = cpu->type & 0xffffffff;
234 234
235 /* If index out of bounds, no way to validate. */ 235 /* If index out of bounds, no way to validate. */
236 if (index >= sizeof(cpu_hz)/sizeof(cpu_hz[0])) 236 if (index >= ARRAY_SIZE(cpu_hz))
237 return cc; 237 return cc;
238 238
239 /* If index contains no data, no way to validate. */ 239 /* If index contains no data, no way to validate. */
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index f3c1ebfdd0aa..f3e020f2227f 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -95,7 +95,8 @@ static void gic_set_cpu(unsigned int irq, cpumask_t mask_val)
95} 95}
96#endif 96#endif
97 97
98static struct irqchip gic_chip = { 98static struct irq_chip gic_chip = {
99 .name = "GIC",
99 .ack = gic_ack_irq, 100 .ack = gic_ack_irq,
100 .mask = gic_mask_irq, 101 .mask = gic_mask_irq,
101 .unmask = gic_unmask_irq, 102 .unmask = gic_unmask_irq,
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 04de83f4f008..4e0dcaef6eb2 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -204,7 +204,8 @@ static void locomo_unmask_irq(unsigned int irq)
204 locomo_writel(r, mapbase + LOCOMO_ICR); 204 locomo_writel(r, mapbase + LOCOMO_ICR);
205} 205}
206 206
207static struct irqchip locomo_chip = { 207static struct irq_chip locomo_chip = {
208 .name = "LOCOMO",
208 .ack = locomo_ack_irq, 209 .ack = locomo_ack_irq,
209 .mask = locomo_mask_irq, 210 .mask = locomo_mask_irq,
210 .unmask = locomo_unmask_irq, 211 .unmask = locomo_unmask_irq,
@@ -249,7 +250,8 @@ static void locomo_key_unmask_irq(unsigned int irq)
249 locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC); 250 locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
250} 251}
251 252
252static struct irqchip locomo_key_chip = { 253static struct irq_chip locomo_key_chip = {
254 .name = "LOCOMO-key",
253 .ack = locomo_key_ack_irq, 255 .ack = locomo_key_ack_irq,
254 .mask = locomo_key_mask_irq, 256 .mask = locomo_key_mask_irq,
255 .unmask = locomo_key_unmask_irq, 257 .unmask = locomo_key_unmask_irq,
@@ -312,7 +314,8 @@ static void locomo_gpio_unmask_irq(unsigned int irq)
312 locomo_writel(r, mapbase + LOCOMO_GIE); 314 locomo_writel(r, mapbase + LOCOMO_GIE);
313} 315}
314 316
315static struct irqchip locomo_gpio_chip = { 317static struct irq_chip locomo_gpio_chip = {
318 .name = "LOCOMO-gpio",
316 .ack = locomo_gpio_ack_irq, 319 .ack = locomo_gpio_ack_irq,
317 .mask = locomo_gpio_mask_irq, 320 .mask = locomo_gpio_mask_irq,
318 .unmask = locomo_gpio_unmask_irq, 321 .unmask = locomo_gpio_unmask_irq,
@@ -357,7 +360,8 @@ static void locomo_lt_unmask_irq(unsigned int irq)
357 locomo_writel(r, mapbase + LOCOMO_LTINT); 360 locomo_writel(r, mapbase + LOCOMO_LTINT);
358} 361}
359 362
360static struct irqchip locomo_lt_chip = { 363static struct irq_chip locomo_lt_chip = {
364 .name = "LOCOMO-lt",
361 .ack = locomo_lt_ack_irq, 365 .ack = locomo_lt_ack_irq,
362 .mask = locomo_lt_mask_irq, 366 .mask = locomo_lt_mask_irq,
363 .unmask = locomo_lt_unmask_irq, 367 .unmask = locomo_lt_unmask_irq,
@@ -418,7 +422,8 @@ static void locomo_spi_unmask_irq(unsigned int irq)
418 locomo_writel(r, mapbase + LOCOMO_SPIIE); 422 locomo_writel(r, mapbase + LOCOMO_SPIIE);
419} 423}
420 424
421static struct irqchip locomo_spi_chip = { 425static struct irq_chip locomo_spi_chip = {
426 .name = "LOCOMO-spi",
422 .ack = locomo_spi_ack_irq, 427 .ack = locomo_spi_ack_irq,
423 .mask = locomo_spi_mask_irq, 428 .mask = locomo_spi_mask_irq,
424 .unmask = locomo_spi_unmask_irq, 429 .unmask = locomo_spi_unmask_irq,
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 1cdb26a47e1f..a331c12cead9 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -272,7 +272,8 @@ static int sa1111_wake_lowirq(unsigned int irq, unsigned int on)
272 return 0; 272 return 0;
273} 273}
274 274
275static struct irqchip sa1111_low_chip = { 275static struct irq_chip sa1111_low_chip = {
276 .name = "SA1111-l",
276 .ack = sa1111_ack_irq, 277 .ack = sa1111_ack_irq,
277 .mask = sa1111_mask_lowirq, 278 .mask = sa1111_mask_lowirq,
278 .unmask = sa1111_unmask_lowirq, 279 .unmask = sa1111_unmask_lowirq,
@@ -368,7 +369,8 @@ static int sa1111_wake_highirq(unsigned int irq, unsigned int on)
368 return 0; 369 return 0;
369} 370}
370 371
371static struct irqchip sa1111_high_chip = { 372static struct irq_chip sa1111_high_chip = {
373 .name = "SA1111-h",
372 .ack = sa1111_ack_irq, 374 .ack = sa1111_ack_irq,
373 .mask = sa1111_mask_highirq, 375 .mask = sa1111_mask_highirq,
374 .unmask = sa1111_unmask_highirq, 376 .unmask = sa1111_unmask_highirq,
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index a19bc4a6196d..43d278134521 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -39,7 +39,8 @@ static void vic_unmask_irq(unsigned int irq)
39 writel(1 << irq, base + VIC_INT_ENABLE); 39 writel(1 << irq, base + VIC_INT_ENABLE);
40} 40}
41 41
42static struct irqchip vic_chip = { 42static struct irq_chip vic_chip = {
43 .name = "VIC",
43 .ack = vic_mask_irq, 44 .ack = vic_mask_irq,
44 .mask = vic_mask_irq, 45 .mask = vic_mask_irq,
45 .unmask = vic_unmask_irq, 46 .unmask = vic_unmask_irq,
diff --git a/arch/arm/configs/ep93xx_defconfig b/arch/arm/configs/ep93xx_defconfig
index c0de6fcd488a..2948b4589a8b 100644
--- a/arch/arm/configs/ep93xx_defconfig
+++ b/arch/arm/configs/ep93xx_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1 3# Linux kernel version: 2.6.18-rc1-git9
4# Sun Jul 9 15:21:30 2006 4# Sat Jul 15 15:08:10 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -30,6 +30,7 @@ CONFIG_SWAP=y
30CONFIG_SYSVIPC=y 30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
33# CONFIG_TASKSTATS is not set
33CONFIG_SYSCTL=y 34CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set 35# CONFIG_AUDIT is not set
35CONFIG_IKCONFIG=y 36CONFIG_IKCONFIG=y
@@ -749,7 +750,7 @@ CONFIG_VIDEO_V4L2=y
749# USB support 750# USB support
750# 751#
751CONFIG_USB_ARCH_HAS_HCD=y 752CONFIG_USB_ARCH_HAS_HCD=y
752# CONFIG_USB_ARCH_HAS_OHCI is not set 753CONFIG_USB_ARCH_HAS_OHCI=y
753# CONFIG_USB_ARCH_HAS_EHCI is not set 754# CONFIG_USB_ARCH_HAS_EHCI is not set
754CONFIG_USB=y 755CONFIG_USB=y
755CONFIG_USB_DEBUG=y 756CONFIG_USB_DEBUG=y
@@ -766,6 +767,9 @@ CONFIG_USB_DYNAMIC_MINORS=y
766# USB Host Controller Drivers 767# USB Host Controller Drivers
767# 768#
768# CONFIG_USB_ISP116X_HCD is not set 769# CONFIG_USB_ISP116X_HCD is not set
770CONFIG_USB_OHCI_HCD=y
771# CONFIG_USB_OHCI_BIG_ENDIAN is not set
772CONFIG_USB_OHCI_LITTLE_ENDIAN=y
769# CONFIG_USB_SL811_HCD is not set 773# CONFIG_USB_SL811_HCD is not set
770 774
771# 775#
@@ -855,6 +859,7 @@ CONFIG_USB_SERIAL_CONSOLE=y
855CONFIG_USB_SERIAL_PL2303=y 859CONFIG_USB_SERIAL_PL2303=y
856# CONFIG_USB_SERIAL_HP4X is not set 860# CONFIG_USB_SERIAL_HP4X is not set
857# CONFIG_USB_SERIAL_SAFE is not set 861# CONFIG_USB_SERIAL_SAFE is not set
862# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
858# CONFIG_USB_SERIAL_TI is not set 863# CONFIG_USB_SERIAL_TI is not set
859# CONFIG_USB_SERIAL_CYBERJACK is not set 864# CONFIG_USB_SERIAL_CYBERJACK is not set
860# CONFIG_USB_SERIAL_XIRCOM is not set 865# CONFIG_USB_SERIAL_XIRCOM is not set
@@ -871,7 +876,7 @@ CONFIG_USB_SERIAL_PL2303=y
871# CONFIG_USB_LEGOTOWER is not set 876# CONFIG_USB_LEGOTOWER is not set
872# CONFIG_USB_LCD is not set 877# CONFIG_USB_LCD is not set
873# CONFIG_USB_LED is not set 878# CONFIG_USB_LED is not set
874# CONFIG_USB_CY7C63 is not set 879# CONFIG_USB_CYPRESS_CY7C63 is not set
875# CONFIG_USB_CYTHERM is not set 880# CONFIG_USB_CYTHERM is not set
876# CONFIG_USB_PHIDGETKIT is not set 881# CONFIG_USB_PHIDGETKIT is not set
877# CONFIG_USB_PHIDGETSERVO is not set 882# CONFIG_USB_PHIDGETSERVO is not set
@@ -916,6 +921,7 @@ CONFIG_RTC_INTF_DEV=y
916# CONFIG_RTC_DRV_X1205 is not set 921# CONFIG_RTC_DRV_X1205 is not set
917# CONFIG_RTC_DRV_DS1307 is not set 922# CONFIG_RTC_DRV_DS1307 is not set
918# CONFIG_RTC_DRV_DS1553 is not set 923# CONFIG_RTC_DRV_DS1553 is not set
924# CONFIG_RTC_DRV_ISL1208 is not set
919# CONFIG_RTC_DRV_DS1672 is not set 925# CONFIG_RTC_DRV_DS1672 is not set
920# CONFIG_RTC_DRV_DS1742 is not set 926# CONFIG_RTC_DRV_DS1742 is not set
921# CONFIG_RTC_DRV_PCF8563 is not set 927# CONFIG_RTC_DRV_PCF8563 is not set
@@ -1023,7 +1029,6 @@ CONFIG_SUNRPC=y
1023# CONFIG_RPCSEC_GSS_SPKM3 is not set 1029# CONFIG_RPCSEC_GSS_SPKM3 is not set
1024# CONFIG_SMB_FS is not set 1030# CONFIG_SMB_FS is not set
1025# CONFIG_CIFS is not set 1031# CONFIG_CIFS is not set
1026# CONFIG_CIFS_DEBUG2 is not set
1027# CONFIG_NCP_FS is not set 1032# CONFIG_NCP_FS is not set
1028# CONFIG_CODA_FS is not set 1033# CONFIG_CODA_FS is not set
1029# CONFIG_AFS_FS is not set 1034# CONFIG_AFS_FS is not set
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index b9a74a741d00..eca248d9eba4 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -470,7 +470,8 @@ static void ecard_irq_mask(unsigned int irqnr)
470 } 470 }
471} 471}
472 472
473static struct irqchip ecard_chip = { 473static struct irq_chip ecard_chip = {
474 .name = "ECARD",
474 .ack = ecard_irq_mask, 475 .ack = ecard_irq_mask,
475 .mask = ecard_irq_mask, 476 .mask = ecard_irq_mask,
476 .unmask = ecard_irq_unmask, 477 .unmask = ecard_irq_unmask,
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 2242f5f7cb7d..4fe386eea4b4 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -114,9 +114,9 @@ ENTRY(secondary_startup)
114 * Use the page tables supplied from __cpu_up. 114 * Use the page tables supplied from __cpu_up.
115 */ 115 */
116 adr r4, __secondary_data 116 adr r4, __secondary_data
117 ldmia r4, {r5, r6, r13} @ address to jump to after 117 ldmia r4, {r5, r7, r13} @ address to jump to after
118 sub r4, r4, r5 @ mmu has been enabled 118 sub r4, r4, r5 @ mmu has been enabled
119 ldr r4, [r6, r4] @ get secondary_data.pgdir 119 ldr r4, [r7, r4] @ get secondary_data.pgdir
120 adr lr, __enable_mmu @ return address 120 adr lr, __enable_mmu @ return address
121 add pc, r10, #12 @ initialise processor 121 add pc, r10, #12 @ initialise processor
122 @ (return control reg) 122 @ (return control reg)
@@ -125,7 +125,7 @@ ENTRY(secondary_startup)
125 * r6 = &secondary_data 125 * r6 = &secondary_data
126 */ 126 */
127ENTRY(__secondary_switched) 127ENTRY(__secondary_switched)
128 ldr sp, [r6, #4] @ get secondary_data.stack 128 ldr sp, [r7, #4] @ get secondary_data.stack
129 mov fp, #0 129 mov fp, #0
130 b secondary_start_kernel 130 b secondary_start_kernel
131 131
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 626feeec0ade..2e1bf830fe11 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -77,6 +77,7 @@ int show_interrupts(struct seq_file *p, void *v)
77 seq_printf(p, "%3d: ", i); 77 seq_printf(p, "%3d: ", i);
78 for_each_present_cpu(cpu) 78 for_each_present_cpu(cpu)
79 seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[i]); 79 seq_printf(p, "%10u ", kstat_cpu(cpu).irqs[i]);
80 seq_printf(p, " %10s", irq_desc[i].chip->name ? : "-");
80 seq_printf(p, " %s", action->name); 81 seq_printf(p, " %s", action->name);
81 for (action = action->next; action; action = action->next) 82 for (action = action->next; action; action = action->next)
82 seq_printf(p, ", %s", action->name); 83 seq_printf(p, ", %s", action->name);
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 35a052fc177a..4e29dd03e582 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -232,11 +232,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
232 bust_spinlocks(0); 232 bust_spinlocks(0);
233 spin_unlock_irq(&die_lock); 233 spin_unlock_irq(&die_lock);
234 234
235 if (panic_on_oops) { 235 if (panic_on_oops)
236 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 236 panic("Fatal exception: panic_on_oops");
237 ssleep(5);
238 panic("Fatal exception");
239 }
240 237
241 do_exit(SIGSEGV); 238 do_exit(SIGSEGV);
242} 239}
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c
index 5783c282ae7b..cec199fd6721 100644
--- a/arch/arm/mach-at91rm9200/gpio.c
+++ b/arch/arm/mach-at91rm9200/gpio.c
@@ -327,7 +327,8 @@ static int gpio_irq_type(unsigned pin, unsigned type)
327 return (type == IRQT_BOTHEDGE) ? 0 : -EINVAL; 327 return (type == IRQT_BOTHEDGE) ? 0 : -EINVAL;
328} 328}
329 329
330static struct irqchip gpio_irqchip = { 330static struct irq_chip gpio_irqchip = {
331 .name = "GPIO",
331 .mask = gpio_irq_mask, 332 .mask = gpio_irq_mask,
332 .unmask = gpio_irq_unmask, 333 .unmask = gpio_irq_unmask,
333 .set_type = gpio_irq_type, 334 .set_type = gpio_irq_type,
diff --git a/arch/arm/mach-at91rm9200/irq.c b/arch/arm/mach-at91rm9200/irq.c
index 9b0911320417..c3a5e777f9f8 100644
--- a/arch/arm/mach-at91rm9200/irq.c
+++ b/arch/arm/mach-at91rm9200/irq.c
@@ -114,7 +114,8 @@ void at91_irq_resume(void)
114#define at91_aic_set_wake NULL 114#define at91_aic_set_wake NULL
115#endif 115#endif
116 116
117static struct irqchip at91_aic_chip = { 117static struct irq_chip at91_aic_chip = {
118 .name = "AIC",
118 .ack = at91_aic_mask_irq, 119 .ack = at91_aic_mask_irq,
119 .mask = at91_aic_mask_irq, 120 .mask = at91_aic_mask_irq,
120 .unmask = at91_aic_unmask_irq, 121 .unmask = at91_aic_unmask_irq,
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index 5b64d5c5b967..ef6ccc8993e9 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -8,7 +8,7 @@
8#include <linux/ioport.h> 8#include <linux/ioport.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/tty.h> 11#include <linux/screen_info.h>
12 12
13#include <asm/hardware/dec21285.h> 13#include <asm/hardware/dec21285.h>
14#include <asm/io.h> 14#include <asm/io.h>
diff --git a/arch/arm/mach-imx/irq.c b/arch/arm/mach-imx/irq.c
index a5de5f1da9f2..2688bd82c2a2 100644
--- a/arch/arm/mach-imx/irq.c
+++ b/arch/arm/mach-imx/irq.c
@@ -204,13 +204,15 @@ imx_gpiod_demux_handler(unsigned int irq_unused, struct irqdesc *desc,
204 imx_gpio_handler(mask, irq, desc, regs); 204 imx_gpio_handler(mask, irq, desc, regs);
205} 205}
206 206
207static struct irqchip imx_internal_chip = { 207static struct irq_chip imx_internal_chip = {
208 .name = "MPU",
208 .ack = imx_mask_irq, 209 .ack = imx_mask_irq,
209 .mask = imx_mask_irq, 210 .mask = imx_mask_irq,
210 .unmask = imx_unmask_irq, 211 .unmask = imx_unmask_irq,
211}; 212};
212 213
213static struct irqchip imx_gpio_chip = { 214static struct irq_chip imx_gpio_chip = {
215 .name = "GPIO",
214 .ack = imx_gpio_ack_irq, 216 .ack = imx_gpio_ack_irq,
215 .mask = imx_gpio_mask_irq, 217 .mask = imx_gpio_mask_irq,
216 .unmask = imx_gpio_unmask_irq, 218 .unmask = imx_gpio_unmask_irq,
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 6d65c96ebfd2..191c57a3b997 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -161,7 +161,8 @@ static void sc_unmask_irq(unsigned int irq)
161 writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_SET); 161 writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_SET);
162} 162}
163 163
164static struct irqchip sc_chip = { 164static struct irq_chip sc_chip = {
165 .name = "SC",
165 .ack = sc_mask_irq, 166 .ack = sc_mask_irq,
166 .mask = sc_mask_irq, 167 .mask = sc_mask_irq,
167 .unmask = sc_unmask_irq, 168 .unmask = sc_unmask_irq,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 9f55f5ae1044..678b6ba2b463 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -156,7 +156,8 @@ static void cic_unmask_irq(unsigned int irq)
156 cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_SET); 156 cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_SET);
157} 157}
158 158
159static struct irqchip cic_chip = { 159static struct irq_chip cic_chip = {
160 .name = "CIC",
160 .ack = cic_mask_irq, 161 .ack = cic_mask_irq,
161 .mask = cic_mask_irq, 162 .mask = cic_mask_irq,
162 .unmask = cic_unmask_irq, 163 .unmask = cic_unmask_irq,
@@ -174,7 +175,8 @@ static void pic_unmask_irq(unsigned int irq)
174 pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_SET); 175 pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_SET);
175} 176}
176 177
177static struct irqchip pic_chip = { 178static struct irq_chip pic_chip = {
179 .name = "PIC",
178 .ack = pic_mask_irq, 180 .ack = pic_mask_irq,
179 .mask = pic_mask_irq, 181 .mask = pic_mask_irq,
180 .unmask = pic_unmask_irq, 182 .unmask = pic_unmask_irq,
@@ -192,7 +194,8 @@ static void sic_unmask_irq(unsigned int irq)
192 sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_SET); 194 sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_SET);
193} 195}
194 196
195static struct irqchip sic_chip = { 197static struct irq_chip sic_chip = {
198 .name = "SIC",
196 .ack = sic_mask_irq, 199 .ack = sic_mask_irq,
197 .mask = sic_mask_irq, 200 .mask = sic_mask_irq,
198 .unmask = sic_unmask_irq, 201 .unmask = sic_unmask_irq,
diff --git a/arch/arm/mach-iop3xx/iop321-irq.c b/arch/arm/mach-iop3xx/iop321-irq.c
index d42aae6aef03..88ac333472c8 100644
--- a/arch/arm/mach-iop3xx/iop321-irq.c
+++ b/arch/arm/mach-iop3xx/iop321-irq.c
@@ -52,7 +52,8 @@ iop321_irq_unmask (unsigned int irq)
52 intctl_write(iop321_mask); 52 intctl_write(iop321_mask);
53} 53}
54 54
55struct irqchip ext_chip = { 55struct irq_chip ext_chip = {
56 .name = "IOP",
56 .ack = iop321_irq_mask, 57 .ack = iop321_irq_mask,
57 .mask = iop321_irq_mask, 58 .mask = iop321_irq_mask,
58 .unmask = iop321_irq_unmask, 59 .unmask = iop321_irq_unmask,
diff --git a/arch/arm/mach-iop3xx/iop331-irq.c b/arch/arm/mach-iop3xx/iop331-irq.c
index f4d4321737a4..cab11722ced2 100644
--- a/arch/arm/mach-iop3xx/iop331-irq.c
+++ b/arch/arm/mach-iop3xx/iop331-irq.c
@@ -77,13 +77,15 @@ iop331_irq_unmask2(unsigned int irq)
77 intctl_write1(iop331_mask1); 77 intctl_write1(iop331_mask1);
78} 78}
79 79
80struct irqchip iop331_irqchip1 = { 80struct irq_chip iop331_irqchip1 = {
81 .name = "IOP-1",
81 .ack = iop331_irq_mask1, 82 .ack = iop331_irq_mask1,
82 .mask = iop331_irq_mask1, 83 .mask = iop331_irq_mask1,
83 .unmask = iop331_irq_unmask1, 84 .unmask = iop331_irq_unmask1,
84}; 85};
85 86
86struct irqchip iop331_irqchip2 = { 87struct irq_chip iop331_irqchip2 = {
88 .name = "IOP-2",
87 .ack = iop331_irq_mask2, 89 .ack = iop331_irq_mask2,
88 .mask = iop331_irq_mask2, 90 .mask = iop331_irq_mask2,
89 .unmask = iop331_irq_unmask2, 91 .unmask = iop331_irq_unmask2,
diff --git a/arch/arm/mach-lh7a40x/arch-kev7a400.c b/arch/arm/mach-lh7a40x/arch-kev7a400.c
index 2cccc27c62e4..4f2ab48800a5 100644
--- a/arch/arm/mach-lh7a40x/arch-kev7a400.c
+++ b/arch/arm/mach-lh7a40x/arch-kev7a400.c
@@ -63,7 +63,8 @@ static void kev7a400_unmask_cpld_irq (u32 irq)
63 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask; 63 CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
64} 64}
65 65
66static struct irqchip kev7a400_cpld_chip = { 66static struct irq_chip kev7a400_cpld_chip = {
67 .name = "CPLD",
67 .ack = kev7a400_ack_cpld_irq, 68 .ack = kev7a400_ack_cpld_irq,
68 .mask = kev7a400_mask_cpld_irq, 69 .mask = kev7a400_mask_cpld_irq,
69 .unmask = kev7a400_unmask_cpld_irq, 70 .unmask = kev7a400_unmask_cpld_irq,
diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
index 35c3606a2079..a6910114b24c 100644
--- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
@@ -200,7 +200,8 @@ static void lh7a40x_unmask_cpld_irq (u32 irq)
200 } 200 }
201} 201}
202 202
203static struct irqchip lpd7a40x_cpld_chip = { 203static struct irq_chip lpd7a40x_cpld_chip = {
204 .name = "CPLD",
204 .ack = lh7a40x_ack_cpld_irq, 205 .ack = lh7a40x_ack_cpld_irq,
205 .mask = lh7a40x_mask_cpld_irq, 206 .mask = lh7a40x_mask_cpld_irq,
206 .unmask = lh7a40x_unmask_cpld_irq, 207 .unmask = lh7a40x_unmask_cpld_irq,
diff --git a/arch/arm/mach-lh7a40x/irq-kev7a400.c b/arch/arm/mach-lh7a40x/irq-kev7a400.c
index 8535764d89ca..f9b3fe9174a5 100644
--- a/arch/arm/mach-lh7a40x/irq-kev7a400.c
+++ b/arch/arm/mach-lh7a40x/irq-kev7a400.c
@@ -43,7 +43,8 @@ lh7a400_unmask_cpld_irq (u32 irq)
43} 43}
44 44
45static struct 45static struct
46irqchip lh7a400_cpld_chip = { 46irq_chip lh7a400_cpld_chip = {
47 .name = "CPLD",
47 .ack = lh7a400_ack_cpld_irq, 48 .ack = lh7a400_ack_cpld_irq,
48 .mask = lh7a400_mask_cpld_irq, 49 .mask = lh7a400_mask_cpld_irq,
49 .unmask = lh7a400_unmask_cpld_irq, 50 .unmask = lh7a400_unmask_cpld_irq,
diff --git a/arch/arm/mach-lh7a40x/irq-lh7a400.c b/arch/arm/mach-lh7a40x/irq-lh7a400.c
index f9fdefef6d6f..091b2dc58d25 100644
--- a/arch/arm/mach-lh7a40x/irq-lh7a400.c
+++ b/arch/arm/mach-lh7a40x/irq-lh7a400.c
@@ -38,13 +38,15 @@ static void lh7a400_ack_gpio_irq (u32 irq)
38 INTC_INTENC = (1 << irq); 38 INTC_INTENC = (1 << irq);
39} 39}
40 40
41static struct irqchip lh7a400_internal_chip = { 41static struct irq_chip lh7a400_internal_chip = {
42 .name = "MPU",
42 .ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */ 43 .ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */
43 .mask = lh7a400_mask_irq, 44 .mask = lh7a400_mask_irq,
44 .unmask = lh7a400_unmask_irq, 45 .unmask = lh7a400_unmask_irq,
45}; 46};
46 47
47static struct irqchip lh7a400_gpio_chip = { 48static struct irq_chip lh7a400_gpio_chip = {
49 .name = "GPIO",
48 .ack = lh7a400_ack_gpio_irq, 50 .ack = lh7a400_ack_gpio_irq,
49 .mask = lh7a400_mask_irq, 51 .mask = lh7a400_mask_irq,
50 .unmask = lh7a400_unmask_irq, 52 .unmask = lh7a400_unmask_irq,
diff --git a/arch/arm/mach-lh7a40x/irq-lh7a404.c b/arch/arm/mach-lh7a40x/irq-lh7a404.c
index 2685a81454d2..7059b983724f 100644
--- a/arch/arm/mach-lh7a40x/irq-lh7a404.c
+++ b/arch/arm/mach-lh7a40x/irq-lh7a404.c
@@ -76,25 +76,29 @@ static void lh7a404_vic2_ack_gpio_irq (u32 irq)
76 VIC2_INTENCLR = (1 << irq); 76 VIC2_INTENCLR = (1 << irq);
77} 77}
78 78
79static struct irqchip lh7a404_vic1_chip = { 79static struct irq_chip lh7a404_vic1_chip = {
80 .name = "VIC1",
80 .ack = lh7a404_vic1_mask_irq, /* Because level-triggered */ 81 .ack = lh7a404_vic1_mask_irq, /* Because level-triggered */
81 .mask = lh7a404_vic1_mask_irq, 82 .mask = lh7a404_vic1_mask_irq,
82 .unmask = lh7a404_vic1_unmask_irq, 83 .unmask = lh7a404_vic1_unmask_irq,
83}; 84};
84 85
85static struct irqchip lh7a404_vic2_chip = { 86static struct irq_chip lh7a404_vic2_chip = {
87 .name = "VIC2",
86 .ack = lh7a404_vic2_mask_irq, /* Because level-triggered */ 88 .ack = lh7a404_vic2_mask_irq, /* Because level-triggered */
87 .mask = lh7a404_vic2_mask_irq, 89 .mask = lh7a404_vic2_mask_irq,
88 .unmask = lh7a404_vic2_unmask_irq, 90 .unmask = lh7a404_vic2_unmask_irq,
89}; 91};
90 92
91static struct irqchip lh7a404_gpio_vic1_chip = { 93static struct irq_chip lh7a404_gpio_vic1_chip = {
94 .name = "GPIO-VIC1",
92 .ack = lh7a404_vic1_ack_gpio_irq, 95 .ack = lh7a404_vic1_ack_gpio_irq,
93 .mask = lh7a404_vic1_mask_irq, 96 .mask = lh7a404_vic1_mask_irq,
94 .unmask = lh7a404_vic1_unmask_irq, 97 .unmask = lh7a404_vic1_unmask_irq,
95}; 98};
96 99
97static struct irqchip lh7a404_gpio_vic2_chip = { 100static struct irq_chip lh7a404_gpio_vic2_chip = {
101 .name = "GPIO-VIC2",
98 .ack = lh7a404_vic2_ack_gpio_irq, 102 .ack = lh7a404_vic2_ack_gpio_irq,
99 .mask = lh7a404_vic2_mask_irq, 103 .mask = lh7a404_vic2_mask_irq,
100 .unmask = lh7a404_vic2_unmask_irq, 104 .unmask = lh7a404_vic2_unmask_irq,
diff --git a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
index dcb4e17b9419..d6055dde6468 100644
--- a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
@@ -50,7 +50,8 @@ static void lh7a40x_unmask_cpld_irq (u32 irq)
50 } 50 }
51} 51}
52 52
53static struct irqchip lh7a40x_cpld_chip = { 53static struct irq_chip lh7a40x_cpld_chip = {
54 .name = "CPLD",
54 .ack = lh7a40x_ack_cpld_irq, 55 .ack = lh7a40x_ack_cpld_irq,
55 .mask = lh7a40x_mask_cpld_irq, 56 .mask = lh7a40x_mask_cpld_irq,
56 .unmask = lh7a40x_unmask_cpld_irq, 57 .unmask = lh7a40x_unmask_cpld_irq,
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index 34eb79ee6e61..efe9bfc6e55f 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -106,14 +106,16 @@ void innovator_fpga_IRQ_demux(unsigned int irq, struct irqdesc *desc,
106 } 106 }
107} 107}
108 108
109static struct irqchip omap_fpga_irq_ack = { 109static struct irq_chip omap_fpga_irq_ack = {
110 .name = "FPGA-ack",
110 .ack = fpga_mask_ack_irq, 111 .ack = fpga_mask_ack_irq,
111 .mask = fpga_mask_irq, 112 .mask = fpga_mask_irq,
112 .unmask = fpga_unmask_irq, 113 .unmask = fpga_unmask_irq,
113}; 114};
114 115
115 116
116static struct irqchip omap_fpga_irq = { 117static struct irq_chip omap_fpga_irq = {
118 .name = "FPGA",
117 .ack = fpga_ack_irq, 119 .ack = fpga_ack_irq,
118 .mask = fpga_mask_irq, 120 .mask = fpga_mask_irq,
119 .unmask = fpga_unmask_irq, 121 .unmask = fpga_unmask_irq,
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 9e039845b50e..3ea140bb9eba 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -168,7 +168,8 @@ static struct omap_irq_bank omap1610_irq_banks[] = {
168}; 168};
169#endif 169#endif
170 170
171static struct irqchip omap_irq_chip = { 171static struct irq_chip omap_irq_chip = {
172 .name = "MPU",
172 .ack = omap_mask_ack_irq, 173 .ack = omap_mask_ack_irq,
173 .mask = omap_mask_irq, 174 .mask = omap_mask_irq,
174 .unmask = omap_unmask_irq, 175 .unmask = omap_unmask_irq,
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 3eed6a737bf8..dfc3b35cc1ff 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -94,7 +94,8 @@ static void omap_mask_ack_irq(unsigned int irq)
94 omap_ack_irq(irq); 94 omap_ack_irq(irq);
95} 95}
96 96
97static struct irqchip omap_irq_chip = { 97static struct irq_chip omap_irq_chip = {
98 .name = "INTC",
98 .ack = omap_mask_ack_irq, 99 .ack = omap_mask_ack_irq,
99 .mask = omap_mask_irq, 100 .mask = omap_mask_irq,
100 .unmask = omap_unmask_irq, 101 .unmask = omap_unmask_irq,
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index d9635ff4b10c..12141e2a50cc 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -39,7 +39,8 @@ static void pxa_unmask_low_irq(unsigned int irq)
39 ICMR |= (1 << (irq + PXA_IRQ_SKIP)); 39 ICMR |= (1 << (irq + PXA_IRQ_SKIP));
40} 40}
41 41
42static struct irqchip pxa_internal_chip_low = { 42static struct irq_chip pxa_internal_chip_low = {
43 .name = "SC",
43 .ack = pxa_mask_low_irq, 44 .ack = pxa_mask_low_irq,
44 .mask = pxa_mask_low_irq, 45 .mask = pxa_mask_low_irq,
45 .unmask = pxa_unmask_low_irq, 46 .unmask = pxa_unmask_low_irq,
@@ -61,7 +62,8 @@ static void pxa_unmask_high_irq(unsigned int irq)
61 ICMR2 |= (1 << (irq - 32 + PXA_IRQ_SKIP)); 62 ICMR2 |= (1 << (irq - 32 + PXA_IRQ_SKIP));
62} 63}
63 64
64static struct irqchip pxa_internal_chip_high = { 65static struct irq_chip pxa_internal_chip_high = {
66 .name = "SC-hi",
65 .ack = pxa_mask_high_irq, 67 .ack = pxa_mask_high_irq,
66 .mask = pxa_mask_high_irq, 68 .mask = pxa_mask_high_irq,
67 .unmask = pxa_unmask_high_irq, 69 .unmask = pxa_unmask_high_irq,
@@ -129,7 +131,8 @@ static void pxa_ack_low_gpio(unsigned int irq)
129 GEDR0 = (1 << (irq - IRQ_GPIO0)); 131 GEDR0 = (1 << (irq - IRQ_GPIO0));
130} 132}
131 133
132static struct irqchip pxa_low_gpio_chip = { 134static struct irq_chip pxa_low_gpio_chip = {
135 .name = "GPIO-l",
133 .ack = pxa_ack_low_gpio, 136 .ack = pxa_ack_low_gpio,
134 .mask = pxa_mask_low_irq, 137 .mask = pxa_mask_low_irq,
135 .unmask = pxa_unmask_low_irq, 138 .unmask = pxa_unmask_low_irq,
@@ -237,7 +240,8 @@ static void pxa_unmask_muxed_gpio(unsigned int irq)
237 GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx]; 240 GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx];
238} 241}
239 242
240static struct irqchip pxa_muxed_gpio_chip = { 243static struct irq_chip pxa_muxed_gpio_chip = {
244 .name = "GPIO",
241 .ack = pxa_ack_muxed_gpio, 245 .ack = pxa_ack_muxed_gpio,
242 .mask = pxa_mask_muxed_gpio, 246 .mask = pxa_mask_muxed_gpio,
243 .unmask = pxa_unmask_muxed_gpio, 247 .unmask = pxa_unmask_muxed_gpio,
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 1a5f5c21481e..12479ae26db2 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -68,7 +68,8 @@ static void lpd270_unmask_irq(unsigned int irq)
68 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK); 68 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
69} 69}
70 70
71static struct irqchip lpd270_irq_chip = { 71static struct irq_chip lpd270_irq_chip = {
72 .name = "CPLD",
72 .ack = lpd270_mask_irq, 73 .ack = lpd270_mask_irq,
73 .mask = lpd270_mask_irq, 74 .mask = lpd270_mask_irq,
74 .unmask = lpd270_unmask_irq, 75 .unmask = lpd270_unmask_irq,
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 6a9a669d60de..83ff5cee64d9 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -78,7 +78,8 @@ static void lubbock_unmask_irq(unsigned int irq)
78 LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq)); 78 LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq));
79} 79}
80 80
81static struct irqchip lubbock_irq_chip = { 81static struct irq_chip lubbock_irq_chip = {
82 .name = "FPGA",
82 .ack = lubbock_mask_irq, 83 .ack = lubbock_mask_irq,
83 .mask = lubbock_mask_irq, 84 .mask = lubbock_mask_irq,
84 .unmask = lubbock_unmask_irq, 85 .unmask = lubbock_unmask_irq,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 21ddf3de2f6e..a7e9b96f258a 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -64,7 +64,8 @@ static void mainstone_unmask_irq(unsigned int irq)
64 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq)); 64 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq));
65} 65}
66 66
67static struct irqchip mainstone_irq_chip = { 67static struct irq_chip mainstone_irq_chip = {
68 .name = "FPGA",
68 .ack = mainstone_mask_irq, 69 .ack = mainstone_mask_irq,
69 .mask = mainstone_mask_irq, 70 .mask = mainstone_mask_irq,
70 .unmask = mainstone_unmask_irq, 71 .unmask = mainstone_unmask_irq,
diff --git a/arch/arm/mach-s3c2410/mach-anubis.c b/arch/arm/mach-s3c2410/mach-anubis.c
index 4a92d6f92d6b..60641d452db3 100644
--- a/arch/arm/mach-s3c2410/mach-anubis.c
+++ b/arch/arm/mach-s3c2410/mach-anubis.c
@@ -60,11 +60,12 @@ static struct map_desc anubis_iodesc[] __initdata = {
60 .virtual = (u32)S3C24XX_VA_ISA_BYTE, 60 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
61 .pfn = __phys_to_pfn(0x0), 61 .pfn = __phys_to_pfn(0x0),
62 .length = SZ_4M, 62 .length = SZ_4M,
63 .type = MT_DEVICE 63 .type = MT_DEVICE,
64 }, { 64 }, {
65 .virtual = (u32)S3C24XX_VA_ISA_WORD, 65 .virtual = (u32)S3C24XX_VA_ISA_WORD,
66 .pfn = __phys_to_pfn(0x0), 66 .pfn = __phys_to_pfn(0x0),
67 .length = SZ_4M, MT_DEVICE 67 .length = SZ_4M,
68 .type = MT_DEVICE,
68 }, 69 },
69 70
70 /* we could possibly compress the next set down into a set of smaller tables 71 /* we could possibly compress the next set down into a set of smaller tables
@@ -78,36 +79,12 @@ static struct map_desc anubis_iodesc[] __initdata = {
78 .virtual = (u32)ANUBIS_VA_CTRL1, 79 .virtual = (u32)ANUBIS_VA_CTRL1,
79 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL1), 80 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL1),
80 .length = SZ_4K, 81 .length = SZ_4K,
81 .type = MT_DEVICE 82 .type = MT_DEVICE,
82 }, { 83 }, {
83 .virtual = (u32)ANUBIS_VA_CTRL2, 84 .virtual = (u32)ANUBIS_VA_CTRL2,
84 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL2), 85 .pfn = __phys_to_pfn(ANUBIS_PA_CTRL2),
85 .length = SZ_4K, 86 .length = SZ_4K,
86 .type =MT_DEVICE 87 .type = MT_DEVICE,
87 },
88
89 /* IDE drives */
90
91 {
92 .virtual = (u32)ANUBIS_IDEPRI,
93 .pfn = __phys_to_pfn(S3C2410_CS3),
94 .length = SZ_1M,
95 .type = MT_DEVICE
96 }, {
97 .virtual = (u32)ANUBIS_IDEPRIAUX,
98 .pfn = __phys_to_pfn(S3C2410_CS3+(1<<26)),
99 .length = SZ_1M,
100 .type = MT_DEVICE
101 }, {
102 .virtual = (u32)ANUBIS_IDESEC,
103 .pfn = __phys_to_pfn(S3C2410_CS4),
104 .length = SZ_1M,
105 .type = MT_DEVICE
106 }, {
107 .virtual = (u32)ANUBIS_IDESECAUX,
108 .pfn = __phys_to_pfn(S3C2410_CS4+(1<<26)),
109 .length = SZ_1M,
110 .type = MT_DEVICE
111 }, 88 },
112}; 89};
113 90
@@ -126,7 +103,7 @@ static struct s3c24xx_uart_clksrc anubis_serial_clocks[] = {
126 .name = "pclk", 103 .name = "pclk",
127 .divisor = 1, 104 .divisor = 1,
128 .min_baud = 0, 105 .min_baud = 0,
129 .max_baud = 0. 106 .max_baud = 0,
130 } 107 }
131}; 108};
132 109
@@ -139,7 +116,7 @@ static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
139 .ulcon = ULCON, 116 .ulcon = ULCON,
140 .ufcon = UFCON, 117 .ufcon = UFCON,
141 .clocks = anubis_serial_clocks, 118 .clocks = anubis_serial_clocks,
142 .clocks_size = ARRAY_SIZE(anubis_serial_clocks) 119 .clocks_size = ARRAY_SIZE(anubis_serial_clocks),
143 }, 120 },
144 [1] = { 121 [1] = {
145 .hwport = 2, 122 .hwport = 2,
@@ -148,7 +125,7 @@ static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
148 .ulcon = ULCON, 125 .ulcon = ULCON,
149 .ufcon = UFCON, 126 .ufcon = UFCON,
150 .clocks = anubis_serial_clocks, 127 .clocks = anubis_serial_clocks,
151 .clocks_size = ARRAY_SIZE(anubis_serial_clocks) 128 .clocks_size = ARRAY_SIZE(anubis_serial_clocks),
152 }, 129 },
153}; 130};
154 131
@@ -162,7 +139,7 @@ static struct mtd_partition anubis_default_nand_part[] = {
162 [0] = { 139 [0] = {
163 .name = "Boot Agent", 140 .name = "Boot Agent",
164 .size = SZ_16K, 141 .size = SZ_16K,
165 .offset = 0 142 .offset = 0,
166 }, 143 },
167 [1] = { 144 [1] = {
168 .name = "/boot", 145 .name = "/boot",
@@ -194,21 +171,21 @@ static struct s3c2410_nand_set anubis_nand_sets[] = {
194 .nr_chips = 1, 171 .nr_chips = 1,
195 .nr_map = external_map, 172 .nr_map = external_map,
196 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part), 173 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
197 .partitions = anubis_default_nand_part 174 .partitions = anubis_default_nand_part,
198 }, 175 },
199 [0] = { 176 [0] = {
200 .name = "chip0", 177 .name = "chip0",
201 .nr_chips = 1, 178 .nr_chips = 1,
202 .nr_map = chip0_map, 179 .nr_map = chip0_map,
203 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part), 180 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
204 .partitions = anubis_default_nand_part 181 .partitions = anubis_default_nand_part,
205 }, 182 },
206 [2] = { 183 [2] = {
207 .name = "chip1", 184 .name = "chip1",
208 .nr_chips = 1, 185 .nr_chips = 1,
209 .nr_map = chip1_map, 186 .nr_map = chip1_map,
210 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part), 187 .nr_partitions = ARRAY_SIZE(anubis_default_nand_part),
211 .partitions = anubis_default_nand_part 188 .partitions = anubis_default_nand_part,
212 }, 189 },
213}; 190};
214 191
@@ -313,7 +290,7 @@ static struct s3c24xx_board anubis_board __initdata = {
313 .devices = anubis_devices, 290 .devices = anubis_devices,
314 .devices_count = ARRAY_SIZE(anubis_devices), 291 .devices_count = ARRAY_SIZE(anubis_devices),
315 .clocks = anubis_clocks, 292 .clocks = anubis_clocks,
316 .clocks_count = ARRAY_SIZE(anubis_clocks) 293 .clocks_count = ARRAY_SIZE(anubis_clocks),
317}; 294};
318 295
319static void __init anubis_map_io(void) 296static void __init anubis_map_io(void)
diff --git a/arch/arm/mach-s3c2410/mach-osiris.c b/arch/arm/mach-s3c2410/mach-osiris.c
index 858fd03c6bc5..e193ba69e652 100644
--- a/arch/arm/mach-s3c2410/mach-osiris.c
+++ b/arch/arm/mach-s3c2410/mach-osiris.c
@@ -67,12 +67,12 @@ static struct map_desc osiris_iodesc[] __initdata = {
67 .virtual = (u32)OSIRIS_VA_CTRL1, 67 .virtual = (u32)OSIRIS_VA_CTRL1,
68 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL1), 68 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL1),
69 .length = SZ_16K, 69 .length = SZ_16K,
70 .type = MT_DEVICE 70 .type = MT_DEVICE,
71 }, { 71 }, {
72 .virtual = (u32)OSIRIS_VA_CTRL2, 72 .virtual = (u32)OSIRIS_VA_CTRL2,
73 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL2), 73 .pfn = __phys_to_pfn(OSIRIS_PA_CTRL2),
74 .length = SZ_16K, 74 .length = SZ_16K,
75 .type = MT_DEVICE 75 .type = MT_DEVICE,
76 }, 76 },
77}; 77};
78 78
@@ -91,7 +91,7 @@ static struct s3c24xx_uart_clksrc osiris_serial_clocks[] = {
91 .name = "pclk", 91 .name = "pclk",
92 .divisor = 1, 92 .divisor = 1,
93 .min_baud = 0, 93 .min_baud = 0,
94 .max_baud = 0. 94 .max_baud = 0,
95 } 95 }
96}; 96};
97 97
@@ -103,7 +103,7 @@ static struct s3c2410_uartcfg osiris_uartcfgs[] __initdata = {
103 .ulcon = ULCON, 103 .ulcon = ULCON,
104 .ufcon = UFCON, 104 .ufcon = UFCON,
105 .clocks = osiris_serial_clocks, 105 .clocks = osiris_serial_clocks,
106 .clocks_size = ARRAY_SIZE(osiris_serial_clocks) 106 .clocks_size = ARRAY_SIZE(osiris_serial_clocks),
107 }, 107 },
108 [1] = { 108 [1] = {
109 .hwport = 1, 109 .hwport = 1,
@@ -112,7 +112,7 @@ static struct s3c2410_uartcfg osiris_uartcfgs[] __initdata = {
112 .ulcon = ULCON, 112 .ulcon = ULCON,
113 .ufcon = UFCON, 113 .ufcon = UFCON,
114 .clocks = osiris_serial_clocks, 114 .clocks = osiris_serial_clocks,
115 .clocks_size = ARRAY_SIZE(osiris_serial_clocks) 115 .clocks_size = ARRAY_SIZE(osiris_serial_clocks),
116 }, 116 },
117}; 117};
118 118
@@ -126,7 +126,7 @@ static struct mtd_partition osiris_default_nand_part[] = {
126 [0] = { 126 [0] = {
127 .name = "Boot Agent", 127 .name = "Boot Agent",
128 .size = SZ_16K, 128 .size = SZ_16K,
129 .offset = 0 129 .offset = 0,
130 }, 130 },
131 [1] = { 131 [1] = {
132 .name = "/boot", 132 .name = "/boot",
@@ -158,21 +158,21 @@ static struct s3c2410_nand_set osiris_nand_sets[] = {
158 .nr_chips = 1, 158 .nr_chips = 1,
159 .nr_map = external_map, 159 .nr_map = external_map,
160 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), 160 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
161 .partitions = osiris_default_nand_part 161 .partitions = osiris_default_nand_part,
162 }, 162 },
163 [0] = { 163 [0] = {
164 .name = "chip0", 164 .name = "chip0",
165 .nr_chips = 1, 165 .nr_chips = 1,
166 .nr_map = chip0_map, 166 .nr_map = chip0_map,
167 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), 167 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
168 .partitions = osiris_default_nand_part 168 .partitions = osiris_default_nand_part,
169 }, 169 },
170 [2] = { 170 [2] = {
171 .name = "chip1", 171 .name = "chip1",
172 .nr_chips = 1, 172 .nr_chips = 1,
173 .nr_map = chip1_map, 173 .nr_map = chip1_map,
174 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part), 174 .nr_partitions = ARRAY_SIZE(osiris_default_nand_part),
175 .partitions = osiris_default_nand_part 175 .partitions = osiris_default_nand_part,
176 }, 176 },
177}; 177};
178 178
@@ -245,7 +245,7 @@ static struct s3c24xx_board osiris_board __initdata = {
245 .devices = osiris_devices, 245 .devices = osiris_devices,
246 .devices_count = ARRAY_SIZE(osiris_devices), 246 .devices_count = ARRAY_SIZE(osiris_devices),
247 .clocks = osiris_clocks, 247 .clocks = osiris_clocks,
248 .clocks_count = ARRAY_SIZE(osiris_clocks) 248 .clocks_count = ARRAY_SIZE(osiris_clocks),
249}; 249};
250 250
251static void __init osiris_map_io(void) 251static void __init osiris_map_io(void)
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index 2891b8ca86dd..b55b90a2e8fe 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -95,7 +95,8 @@ static int sa1100_low_gpio_wake(unsigned int irq, unsigned int on)
95 return 0; 95 return 0;
96} 96}
97 97
98static struct irqchip sa1100_low_gpio_chip = { 98static struct irq_chip sa1100_low_gpio_chip = {
99 .name = "GPIO-l",
99 .ack = sa1100_low_gpio_ack, 100 .ack = sa1100_low_gpio_ack,
100 .mask = sa1100_low_gpio_mask, 101 .mask = sa1100_low_gpio_mask,
101 .unmask = sa1100_low_gpio_unmask, 102 .unmask = sa1100_low_gpio_unmask,
@@ -178,7 +179,8 @@ static int sa1100_high_gpio_wake(unsigned int irq, unsigned int on)
178 return 0; 179 return 0;
179} 180}
180 181
181static struct irqchip sa1100_high_gpio_chip = { 182static struct irq_chip sa1100_high_gpio_chip = {
183 .name = "GPIO-h",
182 .ack = sa1100_high_gpio_ack, 184 .ack = sa1100_high_gpio_ack,
183 .mask = sa1100_high_gpio_mask, 185 .mask = sa1100_high_gpio_mask,
184 .unmask = sa1100_high_gpio_unmask, 186 .unmask = sa1100_high_gpio_unmask,
@@ -215,7 +217,8 @@ static int sa1100_set_wake(unsigned int irq, unsigned int on)
215 return -EINVAL; 217 return -EINVAL;
216} 218}
217 219
218static struct irqchip sa1100_normal_chip = { 220static struct irq_chip sa1100_normal_chip = {
221 .name = "SC",
219 .ack = sa1100_mask_irq, 222 .ack = sa1100_mask_irq,
220 .mask = sa1100_mask_irq, 223 .mask = sa1100_mask_irq,
221 .unmask = sa1100_unmask_irq, 224 .unmask = sa1100_unmask_irq,
diff --git a/arch/arm/mach-shark/irq.c b/arch/arm/mach-shark/irq.c
index 6cb67bd3dfd3..b227052296cf 100644
--- a/arch/arm/mach-shark/irq.c
+++ b/arch/arm/mach-shark/irq.c
@@ -69,7 +69,8 @@ static irqreturn_t bogus_int(int irq, void *dev_id, struct pt_regs *regs)
69 69
70static struct irqaction cascade; 70static struct irqaction cascade;
71 71
72static struct irqchip fb_chip = { 72static struct irq_chip fb_chip = {
73 .name = "XT-PIC",
73 .ack = shark_ack_8259A_irq, 74 .ack = shark_ack_8259A_irq,
74 .mask = shark_disable_8259A_irq, 75 .mask = shark_disable_8259A_irq,
75 .unmask = shark_enable_8259A_irq, 76 .unmask = shark_enable_8259A_irq,
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 864377176015..c4e3f8c68479 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -69,7 +69,8 @@ static void sic_unmask_irq(unsigned int irq)
69 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_SET); 69 writel(1 << irq, VA_SIC_BASE + SIC_IRQ_ENABLE_SET);
70} 70}
71 71
72static struct irqchip sic_chip = { 72static struct irq_chip sic_chip = {
73 .name = "SIC",
73 .ack = sic_mask_irq, 74 .ack = sic_mask_irq,
74 .mask = sic_mask_irq, 75 .mask = sic_mask_irq,
75 .unmask = sic_unmask_irq, 76 .unmask = sic_unmask_irq,
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index dba7dddfe57d..88a999df0ab3 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -363,7 +363,9 @@ EXPORT_SYMBOL(__ioremap);
363 363
364void __iounmap(void __iomem *addr) 364void __iounmap(void __iomem *addr)
365{ 365{
366#ifndef CONFIG_SMP
366 struct vm_struct **p, *tmp; 367 struct vm_struct **p, *tmp;
368#endif
367 unsigned int section_mapping = 0; 369 unsigned int section_mapping = 0;
368 370
369 addr = (void __iomem *)(PAGE_MASK & (unsigned long)addr); 371 addr = (void __iomem *)(PAGE_MASK & (unsigned long)addr);
diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c
index 6c5f0fe578a5..ab143557e688 100644
--- a/arch/arm/mm/proc-syms.c
+++ b/arch/arm/mm/proc-syms.c
@@ -13,6 +13,7 @@
13#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
14#include <asm/proc-fns.h> 14#include <asm/proc-fns.h>
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16#include <asm/page.h>
16 17
17#ifndef MULTI_CPU 18#ifndef MULTI_CPU
18EXPORT_SYMBOL(cpu_dcache_clean_area); 19EXPORT_SYMBOL(cpu_dcache_clean_area);
@@ -30,6 +31,13 @@ EXPORT_SYMBOL(__cpuc_coherent_kern_range);
30EXPORT_SYMBOL(cpu_cache); 31EXPORT_SYMBOL(cpu_cache);
31#endif 32#endif
32 33
34#ifndef MULTI_USER
35EXPORT_SYMBOL(__cpu_clear_user_page);
36EXPORT_SYMBOL(__cpu_copy_user_page);
37#else
38EXPORT_SYMBOL(cpu_user);
39#endif
40
33/* 41/*
34 * No module should need to touch the TLB (and currently 42 * No module should need to touch the TLB (and currently
35 * no modules do. We export this for "loadkernel" support 43 * no modules do. We export this for "loadkernel" support
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index 521538671f4c..561bff73a036 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -536,6 +536,11 @@ cpu_80200_name:
536 .asciz "XScale-80200" 536 .asciz "XScale-80200"
537 .size cpu_80200_name, . - cpu_80200_name 537 .size cpu_80200_name, . - cpu_80200_name
538 538
539 .type cpu_80219_name, #object
540cpu_80219_name:
541 .asciz "XScale-80219"
542 .size cpu_80219_name, . - cpu_80219_name
543
539 .type cpu_8032x_name, #object 544 .type cpu_8032x_name, #object
540cpu_8032x_name: 545cpu_8032x_name:
541 .asciz "XScale-IOP8032x Family" 546 .asciz "XScale-IOP8032x Family"
@@ -613,10 +618,33 @@ __80200_proc_info:
613 .long xscale_cache_fns 618 .long xscale_cache_fns
614 .size __80200_proc_info, . - __80200_proc_info 619 .size __80200_proc_info, . - __80200_proc_info
615 620
621 .type __80219_proc_info,#object
622__80219_proc_info:
623 .long 0x69052e20
624 .long 0xffffffe0
625 .long PMD_TYPE_SECT | \
626 PMD_SECT_BUFFERABLE | \
627 PMD_SECT_CACHEABLE | \
628 PMD_SECT_AP_WRITE | \
629 PMD_SECT_AP_READ
630 .long PMD_TYPE_SECT | \
631 PMD_SECT_AP_WRITE | \
632 PMD_SECT_AP_READ
633 b __xscale_setup
634 .long cpu_arch_name
635 .long cpu_elf_name
636 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
637 .long cpu_80219_name
638 .long xscale_processor_functions
639 .long v4wbi_tlb_fns
640 .long xscale_mc_user_fns
641 .long xscale_cache_fns
642 .size __80219_proc_info, . - __80219_proc_info
643
616 .type __8032x_proc_info,#object 644 .type __8032x_proc_info,#object
617__8032x_proc_info: 645__8032x_proc_info:
618 .long 0x69052420 646 .long 0x69052420
619 .long 0xfffff5e0 @ mask should accomodate IOP80219 also 647 .long 0xffffffe0
620 .long PMD_TYPE_SECT | \ 648 .long PMD_TYPE_SECT | \
621 PMD_SECT_BUFFERABLE | \ 649 PMD_SECT_BUFFERABLE | \
622 PMD_SECT_CACHEABLE | \ 650 PMD_SECT_CACHEABLE | \
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index fec7970e564d..cd7f973fb286 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -944,7 +944,8 @@ static void mpuio_unmask_irq(unsigned int irq)
944 _set_gpio_irqenable(bank, gpio, 1); 944 _set_gpio_irqenable(bank, gpio, 1);
945} 945}
946 946
947static struct irqchip gpio_irq_chip = { 947static struct irq_chip gpio_irq_chip = {
948 .name = "GPIO",
948 .ack = gpio_ack_irq, 949 .ack = gpio_ack_irq,
949 .mask = gpio_mask_irq, 950 .mask = gpio_mask_irq,
950 .unmask = gpio_unmask_irq, 951 .unmask = gpio_unmask_irq,
@@ -952,10 +953,11 @@ static struct irqchip gpio_irq_chip = {
952 .set_wake = gpio_wake_enable, 953 .set_wake = gpio_wake_enable,
953}; 954};
954 955
955static struct irqchip mpuio_irq_chip = { 956static struct irq_chip mpuio_irq_chip = {
957 .name = "MPUIO",
956 .ack = mpuio_ack_irq, 958 .ack = mpuio_ack_irq,
957 .mask = mpuio_mask_irq, 959 .mask = mpuio_mask_irq,
958 .unmask = mpuio_unmask_irq 960 .unmask = mpuio_unmask_irq
959}; 961};
960 962
961static int initialized; 963static int initialized;
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index daa75ce4b777..f71fb4a029cb 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -672,7 +672,7 @@ config MTRR
672 See <file:Documentation/mtrr.txt> for more information. 672 See <file:Documentation/mtrr.txt> for more information.
673 673
674config EFI 674config EFI
675 bool "Boot from EFI support (EXPERIMENTAL)" 675 bool "Boot from EFI support"
676 depends on ACPI 676 depends on ACPI
677 default n 677 default n
678 ---help--- 678 ---help---
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index 1b452a1665c4..ab98fc21a541 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -59,7 +59,8 @@ quiet_cmd_syscall = SYSCALL $@
59 59
60export CPPFLAGS_vsyscall.lds += -P -C -U$(ARCH) 60export CPPFLAGS_vsyscall.lds += -P -C -U$(ARCH)
61 61
62vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 62vsyscall-flags = -shared -s -Wl,-soname=linux-gate.so.1 \
63 $(call ld-option, -Wl$(comma)--hash-style=sysv)
63SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags) 64SYSCFLAGS_vsyscall-sysenter.so = $(vsyscall-flags)
64SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags) 65SYSCFLAGS_vsyscall-int80.so = $(vsyscall-flags)
65 66
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index e9f0b928b0a9..5c43be47587f 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -759,7 +759,7 @@ static int __cpuinit cache_sysfs_init(void)
759 if (num_cache_leaves == 0) 759 if (num_cache_leaves == 0)
760 return 0; 760 return 0;
761 761
762 register_cpu_notifier(&cacheinfo_cpu_notifier); 762 register_hotcpu_notifier(&cacheinfo_cpu_notifier);
763 763
764 for_each_online_cpu(i) { 764 for_each_online_cpu(i) {
765 cacheinfo_cpu_callback(&cacheinfo_cpu_notifier, CPU_ONLINE, 765 cacheinfo_cpu_callback(&cacheinfo_cpu_notifier, CPU_ONLINE,
diff --git a/arch/i386/kernel/cpu/mcheck/mce.h b/arch/i386/kernel/cpu/mcheck/mce.h
index dc2416dfef15..84fd4cf7d0fb 100644
--- a/arch/i386/kernel/cpu/mcheck/mce.h
+++ b/arch/i386/kernel/cpu/mcheck/mce.h
@@ -9,6 +9,6 @@ void winchip_mcheck_init(struct cpuinfo_x86 *c);
9/* Call the installed machine check handler for this CPU setup. */ 9/* Call the installed machine check handler for this CPU setup. */
10extern fastcall void (*machine_check_vector)(struct pt_regs *, long error_code); 10extern fastcall void (*machine_check_vector)(struct pt_regs *, long error_code);
11 11
12extern int mce_disabled __initdata; 12extern int mce_disabled;
13extern int nr_mce_banks; 13extern int nr_mce_banks;
14 14
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index d9a260f2efb4..37a7d2eaf4a0 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -204,7 +204,7 @@ VM_MASK = 0x00020000
204ENTRY(ret_from_fork) 204ENTRY(ret_from_fork)
205 CFI_STARTPROC 205 CFI_STARTPROC
206 pushl %eax 206 pushl %eax
207 CFI_ADJUST_CFA_OFFSET -4 207 CFI_ADJUST_CFA_OFFSET 4
208 call schedule_tail 208 call schedule_tail
209 GET_THREAD_INFO(%ebp) 209 GET_THREAD_INFO(%ebp)
210 popl %eax 210 popl %eax
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index de2e16e561c0..afe6505ca0b3 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -256,11 +256,6 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
256 int ret = 0; 256 int ret = 0;
257 kprobe_opcode_t *addr; 257 kprobe_opcode_t *addr;
258 struct kprobe_ctlblk *kcb; 258 struct kprobe_ctlblk *kcb;
259#ifdef CONFIG_PREEMPT
260 unsigned pre_preempt_count = preempt_count();
261#else
262 unsigned pre_preempt_count = 1;
263#endif
264 259
265 addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t)); 260 addr = (kprobe_opcode_t *)(regs->eip - sizeof(kprobe_opcode_t));
266 261
@@ -338,13 +333,15 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
338 return 1; 333 return 1;
339 334
340ss_probe: 335ss_probe:
341 if (pre_preempt_count && p->ainsn.boostable == 1 && !p->post_handler){ 336#ifndef CONFIG_PREEMPT
337 if (p->ainsn.boostable == 1 && !p->post_handler){
342 /* Boost up -- we can execute copied instructions directly */ 338 /* Boost up -- we can execute copied instructions directly */
343 reset_current_kprobe(); 339 reset_current_kprobe();
344 regs->eip = (unsigned long)p->ainsn.insn; 340 regs->eip = (unsigned long)p->ainsn.insn;
345 preempt_enable_no_resched(); 341 preempt_enable_no_resched();
346 return 1; 342 return 1;
347 } 343 }
344#endif
348 prepare_singlestep(p, regs); 345 prepare_singlestep(p, regs);
349 kcb->kprobe_status = KPROBE_HIT_SS; 346 kcb->kprobe_status = KPROBE_HIT_SS;
350 return 1; 347 return 1;
diff --git a/arch/i386/kernel/machine_kexec.c b/arch/i386/kernel/machine_kexec.c
index 511abe52a94e..6b1ae6ba76f0 100644
--- a/arch/i386/kernel/machine_kexec.c
+++ b/arch/i386/kernel/machine_kexec.c
@@ -189,14 +189,11 @@ NORET_TYPE void machine_kexec(struct kimage *image)
189 memcpy((void *)reboot_code_buffer, relocate_new_kernel, 189 memcpy((void *)reboot_code_buffer, relocate_new_kernel,
190 relocate_new_kernel_size); 190 relocate_new_kernel_size);
191 191
192 /* The segment registers are funny things, they are 192 /* The segment registers are funny things, they have both a
193 * automatically loaded from a table, in memory wherever you 193 * visible and an invisible part. Whenever the visible part is
194 * set them to a specific selector, but this table is never 194 * set to a specific selector, the invisible part is loaded
195 * accessed again you set the segment to a different selector. 195 * with from a table in memory. At no other time is the
196 * 196 * descriptor table in memory accessed.
197 * The more common model is are caches where the behide
198 * the scenes work is done, but is also dropped at arbitrary
199 * times.
200 * 197 *
201 * I take advantage of this here by force loading the 198 * I take advantage of this here by force loading the
202 * segments, before I zap the gdt with an invalid value. 199 * segments, before I zap the gdt with an invalid value.
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 2dd928a84645..acb351478e42 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -575,6 +575,7 @@ void touch_nmi_watchdog (void)
575 */ 575 */
576 touch_softlockup_watchdog(); 576 touch_softlockup_watchdog();
577} 577}
578EXPORT_SYMBOL(touch_nmi_watchdog);
578 579
579extern void die_nmi(struct pt_regs *, const char *msg); 580extern void die_nmi(struct pt_regs *, const char *msg);
580 581
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 6f5fea05f1d7..f948419c888a 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -212,14 +212,20 @@ valid_k7:
212 * then we print a warning if not, and always resync. 212 * then we print a warning if not, and always resync.
213 */ 213 */
214 214
215static atomic_t tsc_start_flag = ATOMIC_INIT(0); 215static struct {
216static atomic_t tsc_count_start = ATOMIC_INIT(0); 216 atomic_t start_flag;
217static atomic_t tsc_count_stop = ATOMIC_INIT(0); 217 atomic_t count_start;
218static unsigned long long tsc_values[NR_CPUS]; 218 atomic_t count_stop;
219 unsigned long long values[NR_CPUS];
220} tsc __initdata = {
221 .start_flag = ATOMIC_INIT(0),
222 .count_start = ATOMIC_INIT(0),
223 .count_stop = ATOMIC_INIT(0),
224};
219 225
220#define NR_LOOPS 5 226#define NR_LOOPS 5
221 227
222static void __init synchronize_tsc_bp (void) 228static void __init synchronize_tsc_bp(void)
223{ 229{
224 int i; 230 int i;
225 unsigned long long t0; 231 unsigned long long t0;
@@ -233,7 +239,7 @@ static void __init synchronize_tsc_bp (void)
233 /* convert from kcyc/sec to cyc/usec */ 239 /* convert from kcyc/sec to cyc/usec */
234 one_usec = cpu_khz / 1000; 240 one_usec = cpu_khz / 1000;
235 241
236 atomic_set(&tsc_start_flag, 1); 242 atomic_set(&tsc.start_flag, 1);
237 wmb(); 243 wmb();
238 244
239 /* 245 /*
@@ -250,16 +256,16 @@ static void __init synchronize_tsc_bp (void)
250 /* 256 /*
251 * all APs synchronize but they loop on '== num_cpus' 257 * all APs synchronize but they loop on '== num_cpus'
252 */ 258 */
253 while (atomic_read(&tsc_count_start) != num_booting_cpus()-1) 259 while (atomic_read(&tsc.count_start) != num_booting_cpus()-1)
254 cpu_relax(); 260 cpu_relax();
255 atomic_set(&tsc_count_stop, 0); 261 atomic_set(&tsc.count_stop, 0);
256 wmb(); 262 wmb();
257 /* 263 /*
258 * this lets the APs save their current TSC: 264 * this lets the APs save their current TSC:
259 */ 265 */
260 atomic_inc(&tsc_count_start); 266 atomic_inc(&tsc.count_start);
261 267
262 rdtscll(tsc_values[smp_processor_id()]); 268 rdtscll(tsc.values[smp_processor_id()]);
263 /* 269 /*
264 * We clear the TSC in the last loop: 270 * We clear the TSC in the last loop:
265 */ 271 */
@@ -269,56 +275,54 @@ static void __init synchronize_tsc_bp (void)
269 /* 275 /*
270 * Wait for all APs to leave the synchronization point: 276 * Wait for all APs to leave the synchronization point:
271 */ 277 */
272 while (atomic_read(&tsc_count_stop) != num_booting_cpus()-1) 278 while (atomic_read(&tsc.count_stop) != num_booting_cpus()-1)
273 cpu_relax(); 279 cpu_relax();
274 atomic_set(&tsc_count_start, 0); 280 atomic_set(&tsc.count_start, 0);
275 wmb(); 281 wmb();
276 atomic_inc(&tsc_count_stop); 282 atomic_inc(&tsc.count_stop);
277 } 283 }
278 284
279 sum = 0; 285 sum = 0;
280 for (i = 0; i < NR_CPUS; i++) { 286 for (i = 0; i < NR_CPUS; i++) {
281 if (cpu_isset(i, cpu_callout_map)) { 287 if (cpu_isset(i, cpu_callout_map)) {
282 t0 = tsc_values[i]; 288 t0 = tsc.values[i];
283 sum += t0; 289 sum += t0;
284 } 290 }
285 } 291 }
286 avg = sum; 292 avg = sum;
287 do_div(avg, num_booting_cpus()); 293 do_div(avg, num_booting_cpus());
288 294
289 sum = 0;
290 for (i = 0; i < NR_CPUS; i++) { 295 for (i = 0; i < NR_CPUS; i++) {
291 if (!cpu_isset(i, cpu_callout_map)) 296 if (!cpu_isset(i, cpu_callout_map))
292 continue; 297 continue;
293 delta = tsc_values[i] - avg; 298 delta = tsc.values[i] - avg;
294 if (delta < 0) 299 if (delta < 0)
295 delta = -delta; 300 delta = -delta;
296 /* 301 /*
297 * We report bigger than 2 microseconds clock differences. 302 * We report bigger than 2 microseconds clock differences.
298 */ 303 */
299 if (delta > 2*one_usec) { 304 if (delta > 2*one_usec) {
300 long realdelta; 305 long long realdelta;
306
301 if (!buggy) { 307 if (!buggy) {
302 buggy = 1; 308 buggy = 1;
303 printk("\n"); 309 printk("\n");
304 } 310 }
305 realdelta = delta; 311 realdelta = delta;
306 do_div(realdelta, one_usec); 312 do_div(realdelta, one_usec);
307 if (tsc_values[i] < avg) 313 if (tsc.values[i] < avg)
308 realdelta = -realdelta; 314 realdelta = -realdelta;
309 315
310 if (realdelta > 0) 316 if (realdelta)
311 printk(KERN_INFO "CPU#%d had %ld usecs TSC " 317 printk(KERN_INFO "CPU#%d had %Ld usecs TSC "
312 "skew, fixed it up.\n", i, realdelta); 318 "skew, fixed it up.\n", i, realdelta);
313 } 319 }
314
315 sum += delta;
316 } 320 }
317 if (!buggy) 321 if (!buggy)
318 printk("passed.\n"); 322 printk("passed.\n");
319} 323}
320 324
321static void __init synchronize_tsc_ap (void) 325static void __init synchronize_tsc_ap(void)
322{ 326{
323 int i; 327 int i;
324 328
@@ -327,20 +331,20 @@ static void __init synchronize_tsc_ap (void)
327 * this gets called, so we first wait for the BP to 331 * this gets called, so we first wait for the BP to
328 * finish SMP initialization: 332 * finish SMP initialization:
329 */ 333 */
330 while (!atomic_read(&tsc_start_flag)) 334 while (!atomic_read(&tsc.start_flag))
331 cpu_relax(); 335 cpu_relax();
332 336
333 for (i = 0; i < NR_LOOPS; i++) { 337 for (i = 0; i < NR_LOOPS; i++) {
334 atomic_inc(&tsc_count_start); 338 atomic_inc(&tsc.count_start);
335 while (atomic_read(&tsc_count_start) != num_booting_cpus()) 339 while (atomic_read(&tsc.count_start) != num_booting_cpus())
336 cpu_relax(); 340 cpu_relax();
337 341
338 rdtscll(tsc_values[smp_processor_id()]); 342 rdtscll(tsc.values[smp_processor_id()]);
339 if (i == NR_LOOPS-1) 343 if (i == NR_LOOPS-1)
340 write_tsc(0, 0); 344 write_tsc(0, 0);
341 345
342 atomic_inc(&tsc_count_stop); 346 atomic_inc(&tsc.count_stop);
343 while (atomic_read(&tsc_count_stop) != num_booting_cpus()) 347 while (atomic_read(&tsc.count_stop) != num_booting_cpus())
344 cpu_relax(); 348 cpu_relax();
345 } 349 }
346} 350}
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 3facc8fcb91e..0d4005dc06c5 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -190,11 +190,11 @@ static void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
190 if (unw_ret > 0 && !arch_unw_user_mode(&info)) { 190 if (unw_ret > 0 && !arch_unw_user_mode(&info)) {
191#ifdef CONFIG_STACK_UNWIND 191#ifdef CONFIG_STACK_UNWIND
192 print_symbol("DWARF2 unwinder stuck at %s\n", 192 print_symbol("DWARF2 unwinder stuck at %s\n",
193 UNW_PC(info.regs)); 193 UNW_PC(&info));
194 if (call_trace == 1) { 194 if (call_trace == 1) {
195 printk("Leftover inexact backtrace:\n"); 195 printk("Leftover inexact backtrace:\n");
196 if (UNW_SP(info.regs)) 196 if (UNW_SP(&info))
197 stack = (void *)UNW_SP(info.regs); 197 stack = (void *)UNW_SP(&info);
198 } else if (call_trace > 1) 198 } else if (call_trace > 1)
199 return; 199 return;
200 else 200 else
@@ -453,11 +453,9 @@ void die(const char * str, struct pt_regs * regs, long err)
453 if (in_interrupt()) 453 if (in_interrupt())
454 panic("Fatal exception in interrupt"); 454 panic("Fatal exception in interrupt");
455 455
456 if (panic_on_oops) { 456 if (panic_on_oops)
457 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 457 panic("Fatal exception: panic_on_oops");
458 ssleep(5); 458
459 panic("Fatal exception");
460 }
461 oops_exit(); 459 oops_exit();
462 do_exit(SIGSEGV); 460 do_exit(SIGSEGV);
463} 461}
@@ -1249,8 +1247,10 @@ static int __init call_trace_setup(char *s)
1249 call_trace = -1; 1247 call_trace = -1;
1250 else if (strcmp(s, "both") == 0) 1248 else if (strcmp(s, "both") == 0)
1251 call_trace = 0; 1249 call_trace = 0;
1252 else if (strcmp(s, "new") == 0) 1250 else if (strcmp(s, "newfallback") == 0)
1253 call_trace = 1; 1251 call_trace = 1;
1252 else if (strcmp(s, "new") == 2)
1253 call_trace = 2;
1254 return 1; 1254 return 1;
1255} 1255}
1256__setup("call_trace=", call_trace_setup); 1256__setup("call_trace=", call_trace_setup);
diff --git a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S
index e26975fc68b6..f66cd11adb72 100644
--- a/arch/i386/kernel/vsyscall.lds.S
+++ b/arch/i386/kernel/vsyscall.lds.S
@@ -10,6 +10,7 @@ SECTIONS
10 . = VDSO_PRELINK + SIZEOF_HEADERS; 10 . = VDSO_PRELINK + SIZEOF_HEADERS;
11 11
12 .hash : { *(.hash) } :text 12 .hash : { *(.hash) } :text
13 .gnu.hash : { *(.gnu.hash) }
13 .dynsym : { *(.dynsym) } 14 .dynsym : { *(.dynsym) }
14 .dynstr : { *(.dynstr) } 15 .dynstr : { *(.dynstr) }
15 .gnu.version : { *(.gnu.version) } 16 .gnu.version : { *(.gnu.version) }
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 9ea35398e10d..0f14a82b856e 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -363,7 +363,7 @@ CONFIG_BLK_DEV_IDECD=y
363# 363#
364CONFIG_IDE_GENERIC=y 364CONFIG_IDE_GENERIC=y
365CONFIG_BLK_DEV_IDEPCI=y 365CONFIG_BLK_DEV_IDEPCI=y
366# CONFIG_IDEPCI_SHARE_IRQ is not set 366CONFIG_IDEPCI_SHARE_IRQ=y
367# CONFIG_BLK_DEV_OFFBOARD is not set 367# CONFIG_BLK_DEV_OFFBOARD is not set
368# CONFIG_BLK_DEV_GENERIC is not set 368# CONFIG_BLK_DEV_GENERIC is not set
369# CONFIG_BLK_DEV_OPTI621 is not set 369# CONFIG_BLK_DEV_OPTI621 is not set
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 6cba55da572a..9001b3fbaa32 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -366,7 +366,7 @@ CONFIG_BLK_DEV_IDESCSI=m
366# CONFIG_IDE_GENERIC is not set 366# CONFIG_IDE_GENERIC is not set
367# CONFIG_BLK_DEV_IDEPNP is not set 367# CONFIG_BLK_DEV_IDEPNP is not set
368CONFIG_BLK_DEV_IDEPCI=y 368CONFIG_BLK_DEV_IDEPCI=y
369# CONFIG_IDEPCI_SHARE_IRQ is not set 369CONFIG_IDEPCI_SHARE_IRQ=y
370# CONFIG_BLK_DEV_OFFBOARD is not set 370# CONFIG_BLK_DEV_OFFBOARD is not set
371CONFIG_BLK_DEV_GENERIC=y 371CONFIG_BLK_DEV_GENERIC=y
372# CONFIG_BLK_DEV_OPTI621 is not set 372# CONFIG_BLK_DEV_OPTI621 is not set
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 0e4553f320bf..ad8215a3c586 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -45,7 +45,8 @@ CPPFLAGS_gate.lds := -P -C -U$(ARCH)
45quiet_cmd_gate = GATE $@ 45quiet_cmd_gate = GATE $@
46 cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@ 46 cmd_gate = $(CC) -nostdlib $(GATECFLAGS_$(@F)) -Wl,-T,$(filter-out FORCE,$^) -o $@
47 47
48GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 48GATECFLAGS_gate.so = -shared -s -Wl,-soname=linux-gate.so.1 \
49 $(call ld-option, -Wl$(comma)--hash-style=sysv)
49$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE 50$(obj)/gate.so: $(obj)/gate.lds $(obj)/gate.o FORCE
50 $(call if_changed,gate) 51 $(call if_changed,gate)
51 52
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S
index cc35cddfd4cf..6d198339bf85 100644
--- a/arch/ia64/kernel/gate.lds.S
+++ b/arch/ia64/kernel/gate.lds.S
@@ -12,6 +12,7 @@ SECTIONS
12 . = GATE_ADDR + SIZEOF_HEADERS; 12 . = GATE_ADDR + SIZEOF_HEADERS;
13 13
14 .hash : { *(.hash) } :readable 14 .hash : { *(.hash) } :readable
15 .gnu.hash : { *(.gnu.hash) }
15 .dynsym : { *(.dynsym) } 16 .dynsym : { *(.dynsym) }
16 .dynstr : { *(.dynstr) } 17 .dynstr : { *(.dynstr) }
17 .gnu.version : { *(.gnu.version) } 18 .gnu.version : { *(.gnu.version) }
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 00d9c83b8020..781960f80b6f 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -448,11 +448,20 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
448 return 0; 448 return 0;
449} 449}
450 450
451void __kprobes flush_insn_slot(struct kprobe *p)
452{
453 unsigned long arm_addr;
454
455 arm_addr = ((unsigned long)&p->opcode.bundle) & ~0xFULL;
456 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
457}
458
451void __kprobes arch_arm_kprobe(struct kprobe *p) 459void __kprobes arch_arm_kprobe(struct kprobe *p)
452{ 460{
453 unsigned long addr = (unsigned long)p->addr; 461 unsigned long addr = (unsigned long)p->addr;
454 unsigned long arm_addr = addr & ~0xFULL; 462 unsigned long arm_addr = addr & ~0xFULL;
455 463
464 flush_insn_slot(p);
456 memcpy((char *)arm_addr, &p->ainsn.insn.bundle, sizeof(bundle_t)); 465 memcpy((char *)arm_addr, &p->ainsn.insn.bundle, sizeof(bundle_t));
457 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); 466 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
458} 467}
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index 3f5bac59209a..ab5b52413e91 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -958,9 +958,9 @@ remove_palinfo_proc_entries(unsigned int hcpu)
958 } 958 }
959} 959}
960 960
961static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb, 961#ifdef CONFIG_HOTPLUG_CPU
962 unsigned long action, 962static int palinfo_cpu_callback(struct notifier_block *nfb,
963 void *hcpu) 963 unsigned long action, void *hcpu)
964{ 964{
965 unsigned int hotcpu = (unsigned long)hcpu; 965 unsigned int hotcpu = (unsigned long)hcpu;
966 966
@@ -968,20 +968,19 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
968 case CPU_ONLINE: 968 case CPU_ONLINE:
969 create_palinfo_proc_entries(hotcpu); 969 create_palinfo_proc_entries(hotcpu);
970 break; 970 break;
971#ifdef CONFIG_HOTPLUG_CPU
972 case CPU_DEAD: 971 case CPU_DEAD:
973 remove_palinfo_proc_entries(hotcpu); 972 remove_palinfo_proc_entries(hotcpu);
974 break; 973 break;
975#endif
976 } 974 }
977 return NOTIFY_OK; 975 return NOTIFY_OK;
978} 976}
979 977
980static struct notifier_block __cpuinitdata palinfo_cpu_notifier = 978static struct notifier_block palinfo_cpu_notifier =
981{ 979{
982 .notifier_call = palinfo_cpu_callback, 980 .notifier_call = palinfo_cpu_callback,
983 .priority = 0, 981 .priority = 0,
984}; 982};
983#endif
985 984
986static int __init 985static int __init
987palinfo_init(void) 986palinfo_init(void)
@@ -1020,7 +1019,7 @@ palinfo_exit(void)
1020 /* 1019 /*
1021 * Unregister from cpu notifier callbacks 1020 * Unregister from cpu notifier callbacks
1022 */ 1021 */
1023 unregister_cpu_notifier(&palinfo_cpu_notifier); 1022 unregister_hotcpu_notifier(&palinfo_cpu_notifier);
1024} 1023}
1025 1024
1026module_init(palinfo_init); 1025module_init(palinfo_init);
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index b146f1cfad31..d24fa393b182 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -435,7 +435,7 @@ static int __cpuinit cache_sysfs_init(void)
435 (void *)(long)i); 435 (void *)(long)i);
436 } 436 }
437 437
438 register_cpu_notifier(&cache_cpu_notifier); 438 register_hotcpu_notifier(&cache_cpu_notifier);
439 439
440 return 0; 440 return 0;
441} 441}
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index e7bbb0f40aa2..5a0420464c6c 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -117,11 +117,8 @@ die (const char *str, struct pt_regs *regs, long err)
117 die.lock_owner = -1; 117 die.lock_owner = -1;
118 spin_unlock_irq(&die.lock); 118 spin_unlock_irq(&die.lock);
119 119
120 if (panic_on_oops) { 120 if (panic_on_oops)
121 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 121 panic("Fatal exception: panic_on_oops");
122 ssleep(5);
123 panic("Fatal exception");
124 }
125 122
126 do_exit(SIGSEGV); 123 do_exit(SIGSEGV);
127} 124}
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 9989495a51dd..b3677fc8eef5 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -204,6 +204,7 @@ SECTIONS
204 *(.dynstr) 204 *(.dynstr)
205 *(.dynamic) 205 *(.dynamic)
206 *(.hash) 206 *(.hash)
207 *(.gnu.hash)
207#endif 208#endif
208 } 209 }
209 210
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2643dbc3f289..13e583f16ede 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -504,7 +504,7 @@ config CPU_FREQ_PMAC
504 504
505config CPU_FREQ_PMAC64 505config CPU_FREQ_PMAC64
506 bool "Support for some Apple G5s" 506 bool "Support for some Apple G5s"
507 depends on CPU_FREQ && PMAC_SMU && PPC64 507 depends on CPU_FREQ && PPC64
508 select CPU_FREQ_TABLE 508 select CPU_FREQ_TABLE
509 help 509 help
510 This adds support for frequency switching on Apple iMac G5, 510 This adds support for frequency switching on Apple iMac G5,
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index addc79381c3b..3545af9896af 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -1,16 +1,18 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-rc5 3# Linux kernel version: 2.6.17
4# Mon May 29 14:47:49 2006 4# Mon Jul 3 14:20:49 2006
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y 7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y 8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y 9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y 10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_IRQ_PER_CPU=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y 12CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_CALIBRATE_DELAY=y 14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_PPC=y 16CONFIG_PPC=y
15CONFIG_EARLY_PRINTK=y 17CONFIG_EARLY_PRINTK=y
16CONFIG_GENERIC_NVRAM=y 18CONFIG_GENERIC_NVRAM=y
@@ -29,6 +31,7 @@ CONFIG_CLASSIC32=y
29# CONFIG_PPC_82xx is not set 31# CONFIG_PPC_82xx is not set
30# CONFIG_PPC_83xx is not set 32# CONFIG_PPC_83xx is not set
31# CONFIG_PPC_85xx is not set 33# CONFIG_PPC_85xx is not set
34# CONFIG_PPC_86xx is not set
32# CONFIG_40x is not set 35# CONFIG_40x is not set
33# CONFIG_44x is not set 36# CONFIG_44x is not set
34# CONFIG_8xx is not set 37# CONFIG_8xx is not set
@@ -39,6 +42,7 @@ CONFIG_ALTIVEC=y
39CONFIG_PPC_STD_MMU=y 42CONFIG_PPC_STD_MMU=y
40CONFIG_PPC_STD_MMU_32=y 43CONFIG_PPC_STD_MMU_32=y
41# CONFIG_SMP is not set 44# CONFIG_SMP is not set
45CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
42 46
43# 47#
44# Code maturity level options 48# Code maturity level options
@@ -72,10 +76,12 @@ CONFIG_PRINTK=y
72CONFIG_BUG=y 76CONFIG_BUG=y
73CONFIG_ELF_CORE=y 77CONFIG_ELF_CORE=y
74CONFIG_BASE_FULL=y 78CONFIG_BASE_FULL=y
79CONFIG_RT_MUTEXES=y
75CONFIG_FUTEX=y 80CONFIG_FUTEX=y
76CONFIG_EPOLL=y 81CONFIG_EPOLL=y
77CONFIG_SHMEM=y 82CONFIG_SHMEM=y
78CONFIG_SLAB=y 83CONFIG_SLAB=y
84CONFIG_VM_EVENT_COUNTERS=y
79# CONFIG_TINY_SHMEM is not set 85# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0 86CONFIG_BASE_SMALL=0
81# CONFIG_SLOB is not set 87# CONFIG_SLOB is not set
@@ -119,6 +125,9 @@ CONFIG_PPC_MULTIPLATFORM=y
119# CONFIG_APUS is not set 125# CONFIG_APUS is not set
120# CONFIG_PPC_CHRP is not set 126# CONFIG_PPC_CHRP is not set
121CONFIG_PPC_PMAC=y 127CONFIG_PPC_PMAC=y
128# CONFIG_PPC_CELL is not set
129# CONFIG_PPC_CELL_NATIVE is not set
130# CONFIG_UDBG_RTAS_CONSOLE is not set
122CONFIG_MPIC=y 131CONFIG_MPIC=y
123# CONFIG_PPC_RTAS is not set 132# CONFIG_PPC_RTAS is not set
124# CONFIG_MMIO_NVRAM is not set 133# CONFIG_MMIO_NVRAM is not set
@@ -154,6 +163,7 @@ CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT is not set 163# CONFIG_PREEMPT is not set
155CONFIG_BINFMT_ELF=y 164CONFIG_BINFMT_ELF=y
156CONFIG_BINFMT_MISC=m 165CONFIG_BINFMT_MISC=m
166CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
157# CONFIG_KEXEC is not set 167# CONFIG_KEXEC is not set
158CONFIG_ARCH_FLATMEM_ENABLE=y 168CONFIG_ARCH_FLATMEM_ENABLE=y
159CONFIG_SELECT_MEMORY_MODEL=y 169CONFIG_SELECT_MEMORY_MODEL=y
@@ -164,6 +174,7 @@ CONFIG_FLATMEM=y
164CONFIG_FLAT_NODE_MEM_MAP=y 174CONFIG_FLAT_NODE_MEM_MAP=y
165# CONFIG_SPARSEMEM_STATIC is not set 175# CONFIG_SPARSEMEM_STATIC is not set
166CONFIG_SPLIT_PTLOCK_CPUS=4 176CONFIG_SPLIT_PTLOCK_CPUS=4
177# CONFIG_RESOURCES_64BIT is not set
167CONFIG_PROC_DEVICETREE=y 178CONFIG_PROC_DEVICETREE=y
168# CONFIG_CMDLINE_BOOL is not set 179# CONFIG_CMDLINE_BOOL is not set
169CONFIG_PM=y 180CONFIG_PM=y
@@ -182,6 +193,7 @@ CONFIG_GENERIC_ISA_DMA=y
182CONFIG_PPC_INDIRECT_PCI=y 193CONFIG_PPC_INDIRECT_PCI=y
183CONFIG_PCI=y 194CONFIG_PCI=y
184CONFIG_PCI_DOMAINS=y 195CONFIG_PCI_DOMAINS=y
196# CONFIG_PCIEPORTBUS is not set
185# CONFIG_PCI_DEBUG is not set 197# CONFIG_PCI_DEBUG is not set
186 198
187# 199#
@@ -256,6 +268,8 @@ CONFIG_INET_ESP=y
256# CONFIG_INET_IPCOMP is not set 268# CONFIG_INET_IPCOMP is not set
257# CONFIG_INET_XFRM_TUNNEL is not set 269# CONFIG_INET_XFRM_TUNNEL is not set
258# CONFIG_INET_TUNNEL is not set 270# CONFIG_INET_TUNNEL is not set
271# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
272# CONFIG_INET_XFRM_MODE_TUNNEL is not set
259CONFIG_INET_DIAG=y 273CONFIG_INET_DIAG=y
260CONFIG_INET_TCP_DIAG=y 274CONFIG_INET_TCP_DIAG=y
261# CONFIG_TCP_CONG_ADVANCED is not set 275# CONFIG_TCP_CONG_ADVANCED is not set
@@ -268,6 +282,7 @@ CONFIG_TCP_CONG_BIC=y
268# CONFIG_IPV6 is not set 282# CONFIG_IPV6 is not set
269# CONFIG_INET6_XFRM_TUNNEL is not set 283# CONFIG_INET6_XFRM_TUNNEL is not set
270# CONFIG_INET6_TUNNEL is not set 284# CONFIG_INET6_TUNNEL is not set
285# CONFIG_NETWORK_SECMARK is not set
271CONFIG_NETFILTER=y 286CONFIG_NETFILTER=y
272# CONFIG_NETFILTER_DEBUG is not set 287# CONFIG_NETFILTER_DEBUG is not set
273 288
@@ -292,9 +307,11 @@ CONFIG_NETFILTER_XT_MATCH_MARK=m
292CONFIG_NETFILTER_XT_MATCH_POLICY=m 307CONFIG_NETFILTER_XT_MATCH_POLICY=m
293CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m 308CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
294CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m 309CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
310# CONFIG_NETFILTER_XT_MATCH_QUOTA is not set
295CONFIG_NETFILTER_XT_MATCH_REALM=m 311CONFIG_NETFILTER_XT_MATCH_REALM=m
296CONFIG_NETFILTER_XT_MATCH_SCTP=m 312CONFIG_NETFILTER_XT_MATCH_SCTP=m
297CONFIG_NETFILTER_XT_MATCH_STATE=m 313CONFIG_NETFILTER_XT_MATCH_STATE=m
314# CONFIG_NETFILTER_XT_MATCH_STATISTIC is not set
298CONFIG_NETFILTER_XT_MATCH_STRING=m 315CONFIG_NETFILTER_XT_MATCH_STRING=m
299CONFIG_NETFILTER_XT_MATCH_TCPMSS=m 316CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
300 317
@@ -313,6 +330,7 @@ CONFIG_IP_NF_TFTP=m
313CONFIG_IP_NF_AMANDA=m 330CONFIG_IP_NF_AMANDA=m
314CONFIG_IP_NF_PPTP=m 331CONFIG_IP_NF_PPTP=m
315CONFIG_IP_NF_H323=m 332CONFIG_IP_NF_H323=m
333# CONFIG_IP_NF_SIP is not set
316# CONFIG_IP_NF_QUEUE is not set 334# CONFIG_IP_NF_QUEUE is not set
317CONFIG_IP_NF_IPTABLES=m 335CONFIG_IP_NF_IPTABLES=m
318CONFIG_IP_NF_MATCH_IPRANGE=m 336CONFIG_IP_NF_MATCH_IPRANGE=m
@@ -457,6 +475,7 @@ CONFIG_IRTTY_SIR=m
457# CONFIG_ALI_FIR is not set 475# CONFIG_ALI_FIR is not set
458# CONFIG_VLSI_FIR is not set 476# CONFIG_VLSI_FIR is not set
459# CONFIG_VIA_FIR is not set 477# CONFIG_VIA_FIR is not set
478# CONFIG_MCS_FIR is not set
460CONFIG_BT=m 479CONFIG_BT=m
461CONFIG_BT_L2CAP=m 480CONFIG_BT_L2CAP=m
462CONFIG_BT_SCO=m 481CONFIG_BT_SCO=m
@@ -500,6 +519,7 @@ CONFIG_WIRELESS_EXT=y
500CONFIG_PREVENT_FIRMWARE_BUILD=y 519CONFIG_PREVENT_FIRMWARE_BUILD=y
501CONFIG_FW_LOADER=y 520CONFIG_FW_LOADER=y
502# CONFIG_DEBUG_DRIVER is not set 521# CONFIG_DEBUG_DRIVER is not set
522# CONFIG_SYS_HYPERVISOR is not set
503 523
504# 524#
505# Connector - unified userspace <-> kernelspace linker 525# Connector - unified userspace <-> kernelspace linker
@@ -600,7 +620,6 @@ CONFIG_BLK_DEV_PDC202XX_NEW=y
600CONFIG_BLK_DEV_IDE_PMAC=y 620CONFIG_BLK_DEV_IDE_PMAC=y
601CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y 621CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
602CONFIG_BLK_DEV_IDEDMA_PMAC=y 622CONFIG_BLK_DEV_IDEDMA_PMAC=y
603CONFIG_BLK_DEV_IDE_PMAC_BLINK=y
604# CONFIG_IDE_ARM is not set 623# CONFIG_IDE_ARM is not set
605CONFIG_BLK_DEV_IDEDMA=y 624CONFIG_BLK_DEV_IDEDMA=y
606# CONFIG_IDEDMA_IVB is not set 625# CONFIG_IDEDMA_IVB is not set
@@ -661,6 +680,7 @@ CONFIG_SCSI_AIC7XXX_OLD=m
661# CONFIG_MEGARAID_LEGACY is not set 680# CONFIG_MEGARAID_LEGACY is not set
662# CONFIG_MEGARAID_SAS is not set 681# CONFIG_MEGARAID_SAS is not set
663# CONFIG_SCSI_SATA is not set 682# CONFIG_SCSI_SATA is not set
683# CONFIG_SCSI_HPTIOP is not set
664# CONFIG_SCSI_BUSLOGIC is not set 684# CONFIG_SCSI_BUSLOGIC is not set
665# CONFIG_SCSI_DMX3191D is not set 685# CONFIG_SCSI_DMX3191D is not set
666# CONFIG_SCSI_EATA is not set 686# CONFIG_SCSI_EATA is not set
@@ -705,9 +725,7 @@ CONFIG_MD_LINEAR=m
705CONFIG_MD_RAID0=m 725CONFIG_MD_RAID0=m
706CONFIG_MD_RAID1=m 726CONFIG_MD_RAID1=m
707CONFIG_MD_RAID10=m 727CONFIG_MD_RAID10=m
708CONFIG_MD_RAID5=m 728# CONFIG_MD_RAID456 is not set
709CONFIG_MD_RAID5_RESHAPE=y
710CONFIG_MD_RAID6=m
711CONFIG_MD_MULTIPATH=m 729CONFIG_MD_MULTIPATH=m
712CONFIG_MD_FAULTY=m 730CONFIG_MD_FAULTY=m
713CONFIG_BLK_DEV_DM=m 731CONFIG_BLK_DEV_DM=m
@@ -750,7 +768,6 @@ CONFIG_IEEE1394_OHCI1394=m
750# 768#
751CONFIG_IEEE1394_VIDEO1394=m 769CONFIG_IEEE1394_VIDEO1394=m
752CONFIG_IEEE1394_SBP2=m 770CONFIG_IEEE1394_SBP2=m
753# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
754# CONFIG_IEEE1394_ETH1394 is not set 771# CONFIG_IEEE1394_ETH1394 is not set
755CONFIG_IEEE1394_DV1394=m 772CONFIG_IEEE1394_DV1394=m
756CONFIG_IEEE1394_RAWIO=m 773CONFIG_IEEE1394_RAWIO=m
@@ -766,9 +783,12 @@ CONFIG_IEEE1394_RAWIO=m
766CONFIG_ADB=y 783CONFIG_ADB=y
767CONFIG_ADB_CUDA=y 784CONFIG_ADB_CUDA=y
768CONFIG_ADB_PMU=y 785CONFIG_ADB_PMU=y
786CONFIG_ADB_PMU_LED=y
787CONFIG_ADB_PMU_LED_IDE=y
769CONFIG_PMAC_APM_EMU=m 788CONFIG_PMAC_APM_EMU=m
770CONFIG_PMAC_MEDIABAY=y 789CONFIG_PMAC_MEDIABAY=y
771CONFIG_PMAC_BACKLIGHT=y 790CONFIG_PMAC_BACKLIGHT=y
791CONFIG_PMAC_BACKLIGHT_LEGACY=y
772CONFIG_INPUT_ADBHID=y 792CONFIG_INPUT_ADBHID=y
773CONFIG_MAC_EMUMOUSEBTN=y 793CONFIG_MAC_EMUMOUSEBTN=y
774CONFIG_THERM_WINDTUNNEL=m 794CONFIG_THERM_WINDTUNNEL=m
@@ -858,6 +878,7 @@ CONFIG_PCNET32=y
858# CONFIG_CHELSIO_T1 is not set 878# CONFIG_CHELSIO_T1 is not set
859# CONFIG_IXGB is not set 879# CONFIG_IXGB is not set
860# CONFIG_S2IO is not set 880# CONFIG_S2IO is not set
881# CONFIG_MYRI10GE is not set
861 882
862# 883#
863# Token Ring devices 884# Token Ring devices
@@ -908,6 +929,7 @@ CONFIG_APPLE_AIRPORT=m
908# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support 929# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
909# 930#
910CONFIG_PRISM54=m 931CONFIG_PRISM54=m
932# CONFIG_USB_ZD1201 is not set
911# CONFIG_HOSTAP is not set 933# CONFIG_HOSTAP is not set
912CONFIG_NET_WIRELESS=y 934CONFIG_NET_WIRELESS=y
913 935
@@ -998,6 +1020,7 @@ CONFIG_SERIO=y
998CONFIG_VT=y 1020CONFIG_VT=y
999CONFIG_VT_CONSOLE=y 1021CONFIG_VT_CONSOLE=y
1000CONFIG_HW_CONSOLE=y 1022CONFIG_HW_CONSOLE=y
1023# CONFIG_VT_HW_CONSOLE_BINDING is not set
1001# CONFIG_SERIAL_NONSTANDARD is not set 1024# CONFIG_SERIAL_NONSTANDARD is not set
1002 1025
1003# 1026#
@@ -1029,6 +1052,7 @@ CONFIG_LEGACY_PTY_COUNT=256
1029# Watchdog Cards 1052# Watchdog Cards
1030# 1053#
1031# CONFIG_WATCHDOG is not set 1054# CONFIG_WATCHDOG is not set
1055# CONFIG_HW_RANDOM is not set
1032CONFIG_NVRAM=y 1056CONFIG_NVRAM=y
1033CONFIG_GEN_RTC=y 1057CONFIG_GEN_RTC=y
1034# CONFIG_GEN_RTC_X is not set 1058# CONFIG_GEN_RTC_X is not set
@@ -1040,6 +1064,7 @@ CONFIG_GEN_RTC=y
1040# Ftape, the floppy tape device driver 1064# Ftape, the floppy tape device driver
1041# 1065#
1042CONFIG_AGP=m 1066CONFIG_AGP=m
1067# CONFIG_AGP_SIS is not set
1043# CONFIG_AGP_VIA is not set 1068# CONFIG_AGP_VIA is not set
1044CONFIG_AGP_UNINORTH=m 1069CONFIG_AGP_UNINORTH=m
1045CONFIG_DRM=m 1070CONFIG_DRM=m
@@ -1092,6 +1117,7 @@ CONFIG_I2C_ALGOBIT=y
1092CONFIG_I2C_POWERMAC=y 1117CONFIG_I2C_POWERMAC=y
1093# CONFIG_I2C_MPC is not set 1118# CONFIG_I2C_MPC is not set
1094# CONFIG_I2C_NFORCE2 is not set 1119# CONFIG_I2C_NFORCE2 is not set
1120# CONFIG_I2C_OCORES is not set
1095# CONFIG_I2C_PARPORT_LIGHT is not set 1121# CONFIG_I2C_PARPORT_LIGHT is not set
1096# CONFIG_I2C_PROSAVAGE is not set 1122# CONFIG_I2C_PROSAVAGE is not set
1097# CONFIG_I2C_SAVAGE4 is not set 1123# CONFIG_I2C_SAVAGE4 is not set
@@ -1156,12 +1182,13 @@ CONFIG_VIDEO_V4L2=y
1156# 1182#
1157# Graphics support 1183# Graphics support
1158# 1184#
1185# CONFIG_FIRMWARE_EDID is not set
1159CONFIG_FB=y 1186CONFIG_FB=y
1160CONFIG_FB_CFB_FILLRECT=y 1187CONFIG_FB_CFB_FILLRECT=y
1161CONFIG_FB_CFB_COPYAREA=y 1188CONFIG_FB_CFB_COPYAREA=y
1162CONFIG_FB_CFB_IMAGEBLIT=y 1189CONFIG_FB_CFB_IMAGEBLIT=y
1163CONFIG_FB_MACMODES=y 1190CONFIG_FB_MACMODES=y
1164CONFIG_FB_FIRMWARE_EDID=y 1191CONFIG_FB_BACKLIGHT=y
1165CONFIG_FB_MODE_HELPERS=y 1192CONFIG_FB_MODE_HELPERS=y
1166CONFIG_FB_TILEBLITTING=y 1193CONFIG_FB_TILEBLITTING=y
1167# CONFIG_FB_CIRRUS is not set 1194# CONFIG_FB_CIRRUS is not set
@@ -1178,6 +1205,7 @@ CONFIG_FB_IMSTT=y
1178# CONFIG_FB_S1D13XXX is not set 1205# CONFIG_FB_S1D13XXX is not set
1179CONFIG_FB_NVIDIA=y 1206CONFIG_FB_NVIDIA=y
1180CONFIG_FB_NVIDIA_I2C=y 1207CONFIG_FB_NVIDIA_I2C=y
1208CONFIG_FB_NVIDIA_BACKLIGHT=y
1181# CONFIG_FB_RIVA is not set 1209# CONFIG_FB_RIVA is not set
1182CONFIG_FB_MATROX=y 1210CONFIG_FB_MATROX=y
1183CONFIG_FB_MATROX_MILLENIUM=y 1211CONFIG_FB_MATROX_MILLENIUM=y
@@ -1187,12 +1215,15 @@ CONFIG_FB_MATROX_MYSTIQUE=y
1187# CONFIG_FB_MATROX_MULTIHEAD is not set 1215# CONFIG_FB_MATROX_MULTIHEAD is not set
1188CONFIG_FB_RADEON=y 1216CONFIG_FB_RADEON=y
1189CONFIG_FB_RADEON_I2C=y 1217CONFIG_FB_RADEON_I2C=y
1218CONFIG_FB_RADEON_BACKLIGHT=y
1190# CONFIG_FB_RADEON_DEBUG is not set 1219# CONFIG_FB_RADEON_DEBUG is not set
1191CONFIG_FB_ATY128=y 1220CONFIG_FB_ATY128=y
1221CONFIG_FB_ATY128_BACKLIGHT=y
1192CONFIG_FB_ATY=y 1222CONFIG_FB_ATY=y
1193CONFIG_FB_ATY_CT=y 1223CONFIG_FB_ATY_CT=y
1194# CONFIG_FB_ATY_GENERIC_LCD is not set 1224# CONFIG_FB_ATY_GENERIC_LCD is not set
1195CONFIG_FB_ATY_GX=y 1225CONFIG_FB_ATY_GX=y
1226CONFIG_FB_ATY_BACKLIGHT=y
1196# CONFIG_FB_SAVAGE is not set 1227# CONFIG_FB_SAVAGE is not set
1197# CONFIG_FB_SIS is not set 1228# CONFIG_FB_SIS is not set
1198# CONFIG_FB_NEOMAGIC is not set 1229# CONFIG_FB_NEOMAGIC is not set
@@ -1221,7 +1252,11 @@ CONFIG_LOGO=y
1221CONFIG_LOGO_LINUX_MONO=y 1252CONFIG_LOGO_LINUX_MONO=y
1222CONFIG_LOGO_LINUX_VGA16=y 1253CONFIG_LOGO_LINUX_VGA16=y
1223CONFIG_LOGO_LINUX_CLUT224=y 1254CONFIG_LOGO_LINUX_CLUT224=y
1224# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 1255CONFIG_BACKLIGHT_LCD_SUPPORT=y
1256CONFIG_BACKLIGHT_CLASS_DEVICE=y
1257CONFIG_BACKLIGHT_DEVICE=y
1258CONFIG_LCD_CLASS_DEVICE=m
1259CONFIG_LCD_DEVICE=y
1225 1260
1226# 1261#
1227# Sound 1262# Sound
@@ -1278,6 +1313,18 @@ CONFIG_SND_DUMMY=m
1278# CONFIG_SND_CMIPCI is not set 1313# CONFIG_SND_CMIPCI is not set
1279# CONFIG_SND_CS4281 is not set 1314# CONFIG_SND_CS4281 is not set
1280# CONFIG_SND_CS46XX is not set 1315# CONFIG_SND_CS46XX is not set
1316# CONFIG_SND_DARLA20 is not set
1317# CONFIG_SND_GINA20 is not set
1318# CONFIG_SND_LAYLA20 is not set
1319# CONFIG_SND_DARLA24 is not set
1320# CONFIG_SND_GINA24 is not set
1321# CONFIG_SND_LAYLA24 is not set
1322# CONFIG_SND_MONA is not set
1323# CONFIG_SND_MIA is not set
1324# CONFIG_SND_ECHO3G is not set
1325# CONFIG_SND_INDIGO is not set
1326# CONFIG_SND_INDIGOIO is not set
1327# CONFIG_SND_INDIGODJ is not set
1281# CONFIG_SND_EMU10K1 is not set 1328# CONFIG_SND_EMU10K1 is not set
1282# CONFIG_SND_EMU10K1X is not set 1329# CONFIG_SND_EMU10K1X is not set
1283# CONFIG_SND_ENS1370 is not set 1330# CONFIG_SND_ENS1370 is not set
@@ -1315,6 +1362,17 @@ CONFIG_SND_POWERMAC=m
1315CONFIG_SND_POWERMAC_AUTO_DRC=y 1362CONFIG_SND_POWERMAC_AUTO_DRC=y
1316 1363
1317# 1364#
1365# Apple Onboard Audio driver
1366#
1367CONFIG_SND_AOA=m
1368CONFIG_SND_AOA_FABRIC_LAYOUT=m
1369CONFIG_SND_AOA_ONYX=m
1370CONFIG_SND_AOA_TAS=m
1371CONFIG_SND_AOA_TOONIE=m
1372CONFIG_SND_AOA_SOUNDBUS=m
1373CONFIG_SND_AOA_SOUNDBUS_I2S=m
1374
1375#
1318# USB devices 1376# USB devices
1319# 1377#
1320CONFIG_SND_USB_AUDIO=m 1378CONFIG_SND_USB_AUDIO=m
@@ -1355,6 +1413,7 @@ CONFIG_USB_DYNAMIC_MINORS=y
1355CONFIG_USB_EHCI_HCD=m 1413CONFIG_USB_EHCI_HCD=m
1356CONFIG_USB_EHCI_SPLIT_ISO=y 1414CONFIG_USB_EHCI_SPLIT_ISO=y
1357CONFIG_USB_EHCI_ROOT_HUB_TT=y 1415CONFIG_USB_EHCI_ROOT_HUB_TT=y
1416# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1358# CONFIG_USB_ISP116X_HCD is not set 1417# CONFIG_USB_ISP116X_HCD is not set
1359CONFIG_USB_OHCI_HCD=y 1418CONFIG_USB_OHCI_HCD=y
1360# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1419# CONFIG_USB_OHCI_BIG_ENDIAN is not set
@@ -1431,7 +1490,6 @@ CONFIG_USB_NET_NET1080=m
1431# CONFIG_USB_NET_RNDIS_HOST is not set 1490# CONFIG_USB_NET_RNDIS_HOST is not set
1432# CONFIG_USB_NET_CDC_SUBSET is not set 1491# CONFIG_USB_NET_CDC_SUBSET is not set
1433CONFIG_USB_NET_ZAURUS=m 1492CONFIG_USB_NET_ZAURUS=m
1434# CONFIG_USB_ZD1201 is not set
1435CONFIG_USB_MON=y 1493CONFIG_USB_MON=y
1436 1494
1437# 1495#
@@ -1499,10 +1557,12 @@ CONFIG_USB_EZUSB=y
1499# CONFIG_USB_LEGOTOWER is not set 1557# CONFIG_USB_LEGOTOWER is not set
1500# CONFIG_USB_LCD is not set 1558# CONFIG_USB_LCD is not set
1501# CONFIG_USB_LED is not set 1559# CONFIG_USB_LED is not set
1560# CONFIG_USB_CY7C63 is not set
1502# CONFIG_USB_CYTHERM is not set 1561# CONFIG_USB_CYTHERM is not set
1503# CONFIG_USB_PHIDGETKIT is not set 1562# CONFIG_USB_PHIDGETKIT is not set
1504# CONFIG_USB_PHIDGETSERVO is not set 1563# CONFIG_USB_PHIDGETSERVO is not set
1505# CONFIG_USB_IDMOUSE is not set 1564# CONFIG_USB_IDMOUSE is not set
1565CONFIG_USB_APPLEDISPLAY=m
1506# CONFIG_USB_SISUSBVGA is not set 1566# CONFIG_USB_SISUSBVGA is not set
1507# CONFIG_USB_LD is not set 1567# CONFIG_USB_LD is not set
1508# CONFIG_USB_TEST is not set 1568# CONFIG_USB_TEST is not set
@@ -1524,7 +1584,8 @@ CONFIG_USB_EZUSB=y
1524# 1584#
1525# LED devices 1585# LED devices
1526# 1586#
1527# CONFIG_NEW_LEDS is not set 1587CONFIG_NEW_LEDS=y
1588CONFIG_LEDS_CLASS=y
1528 1589
1529# 1590#
1530# LED drivers 1591# LED drivers
@@ -1533,6 +1594,10 @@ CONFIG_USB_EZUSB=y
1533# 1594#
1534# LED Triggers 1595# LED Triggers
1535# 1596#
1597CONFIG_LEDS_TRIGGERS=y
1598# CONFIG_LEDS_TRIGGER_TIMER is not set
1599CONFIG_LEDS_TRIGGER_IDE_DISK=y
1600# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
1536 1601
1537# 1602#
1538# InfiniBand support 1603# InfiniBand support
@@ -1549,6 +1614,19 @@ CONFIG_USB_EZUSB=y
1549# CONFIG_RTC_CLASS is not set 1614# CONFIG_RTC_CLASS is not set
1550 1615
1551# 1616#
1617# DMA Engine support
1618#
1619# CONFIG_DMA_ENGINE is not set
1620
1621#
1622# DMA Clients
1623#
1624
1625#
1626# DMA Devices
1627#
1628
1629#
1552# File systems 1630# File systems
1553# 1631#
1554CONFIG_EXT2_FS=y 1632CONFIG_EXT2_FS=y
@@ -1569,6 +1647,7 @@ CONFIG_FS_POSIX_ACL=y
1569# CONFIG_MINIX_FS is not set 1647# CONFIG_MINIX_FS is not set
1570# CONFIG_ROMFS_FS is not set 1648# CONFIG_ROMFS_FS is not set
1571CONFIG_INOTIFY=y 1649CONFIG_INOTIFY=y
1650CONFIG_INOTIFY_USER=y
1572# CONFIG_QUOTA is not set 1651# CONFIG_QUOTA is not set
1573CONFIG_DNOTIFY=y 1652CONFIG_DNOTIFY=y
1574# CONFIG_AUTOFS_FS is not set 1653# CONFIG_AUTOFS_FS is not set
@@ -1649,6 +1728,7 @@ CONFIG_RPCSEC_GSS_KRB5=y
1649CONFIG_SMB_FS=m 1728CONFIG_SMB_FS=m
1650# CONFIG_SMB_NLS_DEFAULT is not set 1729# CONFIG_SMB_NLS_DEFAULT is not set
1651# CONFIG_CIFS is not set 1730# CONFIG_CIFS is not set
1731# CONFIG_CIFS_DEBUG2 is not set
1652# CONFIG_NCP_FS is not set 1732# CONFIG_NCP_FS is not set
1653# CONFIG_CODA_FS is not set 1733# CONFIG_CODA_FS is not set
1654# CONFIG_AFS_FS is not set 1734# CONFIG_AFS_FS is not set
@@ -1732,6 +1812,7 @@ CONFIG_TEXTSEARCH=y
1732CONFIG_TEXTSEARCH_KMP=m 1812CONFIG_TEXTSEARCH_KMP=m
1733CONFIG_TEXTSEARCH_BM=m 1813CONFIG_TEXTSEARCH_BM=m
1734CONFIG_TEXTSEARCH_FSM=m 1814CONFIG_TEXTSEARCH_FSM=m
1815CONFIG_PLIST=y
1735 1816
1736# 1817#
1737# Instrumentation Support 1818# Instrumentation Support
@@ -1744,12 +1825,15 @@ CONFIG_OPROFILE=y
1744# 1825#
1745# CONFIG_PRINTK_TIME is not set 1826# CONFIG_PRINTK_TIME is not set
1746# CONFIG_MAGIC_SYSRQ is not set 1827# CONFIG_MAGIC_SYSRQ is not set
1828# CONFIG_UNUSED_SYMBOLS is not set
1747CONFIG_DEBUG_KERNEL=y 1829CONFIG_DEBUG_KERNEL=y
1748CONFIG_LOG_BUF_SHIFT=14 1830CONFIG_LOG_BUF_SHIFT=14
1749CONFIG_DETECT_SOFTLOCKUP=y 1831CONFIG_DETECT_SOFTLOCKUP=y
1750# CONFIG_SCHEDSTATS is not set 1832# CONFIG_SCHEDSTATS is not set
1751# CONFIG_DEBUG_SLAB is not set 1833# CONFIG_DEBUG_SLAB is not set
1752# CONFIG_DEBUG_MUTEXES is not set 1834# CONFIG_DEBUG_MUTEXES is not set
1835# CONFIG_DEBUG_RT_MUTEXES is not set
1836# CONFIG_RT_MUTEX_TESTER is not set
1753# CONFIG_DEBUG_SPINLOCK is not set 1837# CONFIG_DEBUG_SPINLOCK is not set
1754# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1838# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1755# CONFIG_DEBUG_KOBJECT is not set 1839# CONFIG_DEBUG_KOBJECT is not set
@@ -1763,11 +1847,7 @@ CONFIG_XMON=y
1763CONFIG_XMON_DEFAULT=y 1847CONFIG_XMON_DEFAULT=y
1764# CONFIG_BDI_SWITCH is not set 1848# CONFIG_BDI_SWITCH is not set
1765CONFIG_BOOTX_TEXT=y 1849CONFIG_BOOTX_TEXT=y
1766# CONFIG_PPC_EARLY_DEBUG_LPAR is not set 1850# CONFIG_PPC_EARLY_DEBUG is not set
1767# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1768# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1769# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1770# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1771 1851
1772# 1852#
1773# Security options 1853# Security options
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index e16eb2a33173..6ff3cf506088 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -191,6 +191,37 @@ exception_marker:
191 ori reg,reg,(label)@l; /* virt addr of handler ... */ 191 ori reg,reg,(label)@l; /* virt addr of handler ... */
192#endif 192#endif
193 193
194/*
195 * Equal to EXCEPTION_PROLOG_PSERIES, except that it forces 64bit mode.
196 * The firmware calls the registered system_reset_fwnmi and
197 * machine_check_fwnmi handlers in 32bit mode if the cpu happens to run
198 * a 32bit application at the time of the event.
199 * This firmware bug is present on POWER4 and JS20.
200 */
201#define EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(area, label) \
202 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
203 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
204 std r10,area+EX_R10(r13); \
205 std r11,area+EX_R11(r13); \
206 std r12,area+EX_R12(r13); \
207 mfspr r9,SPRN_SPRG1; \
208 std r9,area+EX_R13(r13); \
209 mfcr r9; \
210 clrrdi r12,r13,32; /* get high part of &label */ \
211 mfmsr r10; \
212 /* force 64bit mode */ \
213 li r11,5; /* MSR_SF_LG|MSR_ISF_LG */ \
214 rldimi r10,r11,61,0; /* insert into top 3 bits */ \
215 /* done 64bit mode */ \
216 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
217 LOAD_HANDLER(r12,label) \
218 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
219 mtspr SPRN_SRR0,r12; \
220 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
221 mtspr SPRN_SRR1,r10; \
222 rfid; \
223 b . /* prevent speculative execution */
224
194#define EXCEPTION_PROLOG_PSERIES(area, label) \ 225#define EXCEPTION_PROLOG_PSERIES(area, label) \
195 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 226 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
196 std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 227 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
@@ -604,14 +635,14 @@ slb_miss_user_pseries:
604system_reset_fwnmi: 635system_reset_fwnmi:
605 HMT_MEDIUM 636 HMT_MEDIUM
606 mtspr SPRN_SPRG1,r13 /* save r13 */ 637 mtspr SPRN_SPRG1,r13 /* save r13 */
607 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) 638 EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(PACA_EXGEN, system_reset_common)
608 639
609 .globl machine_check_fwnmi 640 .globl machine_check_fwnmi
610 .align 7 641 .align 7
611machine_check_fwnmi: 642machine_check_fwnmi:
612 HMT_MEDIUM 643 HMT_MEDIUM
613 mtspr SPRN_SPRG1,r13 /* save r13 */ 644 mtspr SPRN_SPRG1,r13 /* save r13 */
614 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 645 EXCEPTION_PROLOG_PSERIES_FORCE_64BIT(PACA_EXMC, machine_check_common)
615 646
616#ifdef CONFIG_PPC_ISERIES 647#ifdef CONFIG_PPC_ISERIES
617/*** ISeries-LPAR interrupt handlers ***/ 648/*** ISeries-LPAR interrupt handlers ***/
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 7e98e778b52f..359ab89748e0 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -112,7 +112,7 @@ static int __init add_legacy_port(struct device_node *np, int want_index,
112static int __init add_legacy_soc_port(struct device_node *np, 112static int __init add_legacy_soc_port(struct device_node *np,
113 struct device_node *soc_dev) 113 struct device_node *soc_dev)
114{ 114{
115 phys_addr_t addr; 115 u64 addr;
116 u32 *addrp; 116 u32 *addrp;
117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; 117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
118 118
@@ -143,7 +143,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
143 u32 *reg; 143 u32 *reg;
144 char *typep; 144 char *typep;
145 int index = -1; 145 int index = -1;
146 phys_addr_t taddr; 146 u64 taddr;
147 147
148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); 148 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
149 149
@@ -165,10 +165,13 @@ static int __init add_legacy_isa_port(struct device_node *np,
165 if (typep && *typep == 'S') 165 if (typep && *typep == 'S')
166 index = simple_strtol(typep+1, NULL, 0) - 1; 166 index = simple_strtol(typep+1, NULL, 0) - 1;
167 167
168 /* Translate ISA address */ 168 /* Translate ISA address. If it fails, we still register the port
169 * with no translated address so that it can be picked up as an IO
170 * port later by the serial driver
171 */
169 taddr = of_translate_address(np, reg); 172 taddr = of_translate_address(np, reg);
170 if (taddr == OF_BAD_ADDR) 173 if (taddr == OF_BAD_ADDR)
171 return -1; 174 taddr = 0;
172 175
173 /* Add port, irq will be dealt with later */ 176 /* Add port, irq will be dealt with later */
174 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, 177 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr,
@@ -180,7 +183,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
180static int __init add_legacy_pci_port(struct device_node *np, 183static int __init add_legacy_pci_port(struct device_node *np,
181 struct device_node *pci_dev) 184 struct device_node *pci_dev)
182{ 185{
183 phys_addr_t addr, base; 186 u64 addr, base;
184 u32 *addrp; 187 u32 *addrp;
185 unsigned int flags; 188 unsigned int flags;
186 int iotype, index = -1, lindex = 0; 189 int iotype, index = -1, lindex = 0;
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index bfb407fc1aa1..e3ed21cd3d94 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -687,7 +687,7 @@ _GLOBAL(kexec_sequence)
687 /* clear out hardware hash page table and tlb */ 687 /* clear out hardware hash page table and tlb */
688 ld r5,0(r27) /* deref function descriptor */ 688 ld r5,0(r27) /* deref function descriptor */
689 mtctr r5 689 mtctr r5
690 bctrl /* ppc_md.hash_clear_all(void); */ 690 bctrl /* ppc_md.hpte_clear_all(void); */
691 691
692/* 692/*
693 * kexec image calling is: 693 * kexec image calling is:
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ebd501a59abd..462bced40c12 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -557,7 +557,9 @@ unsigned long prom_memparse(const char *ptr, const char **retptr)
557static void __init early_cmdline_parse(void) 557static void __init early_cmdline_parse(void)
558{ 558{
559 struct prom_t *_prom = &RELOC(prom); 559 struct prom_t *_prom = &RELOC(prom);
560#ifdef CONFIG_PPC64
560 const char *opt; 561 const char *opt;
562#endif
561 char *p; 563 char *p;
562 int l = 0; 564 int l = 0;
563 565
@@ -2030,6 +2032,39 @@ static void __init fixup_device_tree_maple(void)
2030#define fixup_device_tree_maple() 2032#define fixup_device_tree_maple()
2031#endif 2033#endif
2032 2034
2035#ifdef CONFIG_PPC_CHRP
2036/* Pegasos lacks the "ranges" property in the isa node */
2037static void __init fixup_device_tree_chrp(void)
2038{
2039 phandle isa;
2040 u32 isa_ranges[6];
2041 char *name;
2042 int rc;
2043
2044 name = "/pci@80000000/isa@c";
2045 isa = call_prom("finddevice", 1, 1, ADDR(name));
2046 if (!PHANDLE_VALID(isa))
2047 return;
2048
2049 rc = prom_getproplen(isa, "ranges");
2050 if (rc != 0 && rc != PROM_ERROR)
2051 return;
2052
2053 prom_printf("Fixing up missing ISA range on Pegasos...\n");
2054
2055 isa_ranges[0] = 0x1;
2056 isa_ranges[1] = 0x0;
2057 isa_ranges[2] = 0x01006000;
2058 isa_ranges[3] = 0x0;
2059 isa_ranges[4] = 0x0;
2060 isa_ranges[5] = 0x00010000;
2061 prom_setprop(isa, name, "ranges",
2062 isa_ranges, sizeof(isa_ranges));
2063}
2064#else
2065#define fixup_device_tree_chrp()
2066#endif
2067
2033#if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC) 2068#if defined(CONFIG_PPC64) && defined(CONFIG_PPC_PMAC)
2034static void __init fixup_device_tree_pmac(void) 2069static void __init fixup_device_tree_pmac(void)
2035{ 2070{
@@ -2077,6 +2112,7 @@ static void __init fixup_device_tree_pmac(void)
2077static void __init fixup_device_tree(void) 2112static void __init fixup_device_tree(void)
2078{ 2113{
2079 fixup_device_tree_maple(); 2114 fixup_device_tree_maple();
2115 fixup_device_tree_chrp();
2080 fixup_device_tree_pmac(); 2116 fixup_device_tree_pmac();
2081} 2117}
2082 2118
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 46c56cfd1b2f..6a9bc9ce54e0 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -144,13 +144,15 @@ void smp_message_recv(int msg, struct pt_regs *regs)
144 144
145void smp_send_reschedule(int cpu) 145void smp_send_reschedule(int cpu)
146{ 146{
147 smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE); 147 if (likely(smp_ops))
148 smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE);
148} 149}
149 150
150#ifdef CONFIG_DEBUGGER 151#ifdef CONFIG_DEBUGGER
151void smp_send_debugger_break(int cpu) 152void smp_send_debugger_break(int cpu)
152{ 153{
153 smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK); 154 if (likely(smp_ops))
155 smp_ops->message_pass(cpu, PPC_MSG_DEBUGGER_BREAK);
154} 156}
155#endif 157#endif
156 158
@@ -158,7 +160,7 @@ void smp_send_debugger_break(int cpu)
158void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *)) 160void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
159{ 161{
160 crash_ipi_function_ptr = crash_ipi_callback; 162 crash_ipi_function_ptr = crash_ipi_callback;
161 if (crash_ipi_callback) { 163 if (crash_ipi_callback && smp_ops) {
162 mb(); 164 mb();
163 smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_DEBUGGER_BREAK); 165 smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_DEBUGGER_BREAK);
164 } 166 }
@@ -220,6 +222,9 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
220 /* Can deadlock when called with interrupts disabled */ 222 /* Can deadlock when called with interrupts disabled */
221 WARN_ON(irqs_disabled()); 223 WARN_ON(irqs_disabled());
222 224
225 if (unlikely(smp_ops == NULL))
226 return -1;
227
223 data.func = func; 228 data.func = func;
224 data.info = info; 229 data.info = info;
225 atomic_set(&data.started, 0); 230 atomic_set(&data.started, 0);
@@ -357,7 +362,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
357 smp_store_cpu_info(boot_cpuid); 362 smp_store_cpu_info(boot_cpuid);
358 cpu_callin_map[boot_cpuid] = 1; 363 cpu_callin_map[boot_cpuid] = 1;
359 364
360 max_cpus = smp_ops->probe(); 365 if (smp_ops)
366 max_cpus = smp_ops->probe();
367 else
368 max_cpus = 1;
361 369
362 smp_space_timers(max_cpus); 370 smp_space_timers(max_cpus);
363 371
@@ -453,7 +461,7 @@ void generic_mach_cpu_die(void)
453 461
454static int __devinit cpu_enable(unsigned int cpu) 462static int __devinit cpu_enable(unsigned int cpu)
455{ 463{
456 if (smp_ops->cpu_enable) 464 if (smp_ops && smp_ops->cpu_enable)
457 return smp_ops->cpu_enable(cpu); 465 return smp_ops->cpu_enable(cpu);
458 466
459 return -ENOSYS; 467 return -ENOSYS;
@@ -467,7 +475,8 @@ int __devinit __cpu_up(unsigned int cpu)
467 if (!cpu_enable(cpu)) 475 if (!cpu_enable(cpu))
468 return 0; 476 return 0;
469 477
470 if (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)) 478 if (smp_ops == NULL ||
479 (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)))
471 return -EINVAL; 480 return -EINVAL;
472 481
473 /* Make sure callin-map entry is 0 (can be leftover a CPU 482 /* Make sure callin-map entry is 0 (can be leftover a CPU
@@ -568,7 +577,8 @@ void __init smp_cpus_done(unsigned int max_cpus)
568 old_mask = current->cpus_allowed; 577 old_mask = current->cpus_allowed;
569 set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid)); 578 set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid));
570 579
571 smp_ops->setup_cpu(boot_cpuid); 580 if (smp_ops)
581 smp_ops->setup_cpu(boot_cpuid);
572 582
573 set_cpus_allowed(current, old_mask); 583 set_cpus_allowed(current, old_mask);
574 584
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 010435095550..fec228cd0163 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -278,7 +278,7 @@ static void unregister_cpu_online(unsigned int cpu)
278} 278}
279#endif /* CONFIG_HOTPLUG_CPU */ 279#endif /* CONFIG_HOTPLUG_CPU */
280 280
281static int __devinit sysfs_cpu_notify(struct notifier_block *self, 281static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
282 unsigned long action, void *hcpu) 282 unsigned long action, void *hcpu)
283{ 283{
284 unsigned int cpu = (unsigned int)(long)hcpu; 284 unsigned int cpu = (unsigned int)(long)hcpu;
@@ -296,7 +296,7 @@ static int __devinit sysfs_cpu_notify(struct notifier_block *self,
296 return NOTIFY_OK; 296 return NOTIFY_OK;
297} 297}
298 298
299static struct notifier_block __devinitdata sysfs_cpu_nb = { 299static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
300 .notifier_call = sysfs_cpu_notify, 300 .notifier_call = sysfs_cpu_notify,
301}; 301};
302 302
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 3c668078e524..2105767fcc57 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -150,13 +150,9 @@ int die(const char *str, struct pt_regs *regs, long err)
150 if (in_interrupt()) 150 if (in_interrupt())
151 panic("Fatal exception in interrupt"); 151 panic("Fatal exception in interrupt");
152 152
153 if (panic_on_oops) { 153 if (panic_on_oops)
154#ifdef CONFIG_PPC64 154 panic("Fatal exception: panic_on_oops");
155 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 155
156 ssleep(5);
157#endif
158 panic("Fatal exception");
159 }
160 do_exit(err); 156 do_exit(err);
161 157
162 return 0; 158 return 0;
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 0835b4841dea..2d17f2b8eda7 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -81,10 +81,14 @@ static int udbg_550_getc(void)
81void udbg_init_uart(void __iomem *comport, unsigned int speed, 81void udbg_init_uart(void __iomem *comport, unsigned int speed,
82 unsigned int clock) 82 unsigned int clock)
83{ 83{
84 unsigned int dll, base_bauds = clock / 16; 84 unsigned int dll, base_bauds;
85 85
86 if (clock == 0)
87 clock = 1843200;
86 if (speed == 0) 88 if (speed == 0)
87 speed = 9600; 89 speed = 9600;
90
91 base_bauds = clock / 16;
88 dll = base_bauds / speed; 92 dll = base_bauds / speed;
89 93
90 if (comport) { 94 if (comport) {
diff --git a/arch/powerpc/kernel/vdso32/Makefile b/arch/powerpc/kernel/vdso32/Makefile
index 8a3bed5f143a..3726358faae8 100644
--- a/arch/powerpc/kernel/vdso32/Makefile
+++ b/arch/powerpc/kernel/vdso32/Makefile
@@ -14,7 +14,8 @@ obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
14 14
15 15
16EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin 16EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin
17EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso32.so.1 17EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso32.so.1 \
18 $(call ld-option, -Wl$(comma)--hash-style=sysv)
18EXTRA_AFLAGS := -D__VDSO32__ -s 19EXTRA_AFLAGS := -D__VDSO32__ -s
19 20
20obj-y += vdso32_wrapper.o 21obj-y += vdso32_wrapper.o
diff --git a/arch/powerpc/kernel/vdso32/vdso32.lds.S b/arch/powerpc/kernel/vdso32/vdso32.lds.S
index f4bad720cb0a..6187af2d54c3 100644
--- a/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ b/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -14,6 +14,7 @@ SECTIONS
14{ 14{
15 . = VDSO32_LBASE + SIZEOF_HEADERS; 15 . = VDSO32_LBASE + SIZEOF_HEADERS;
16 .hash : { *(.hash) } :text 16 .hash : { *(.hash) } :text
17 .gnu.hash : { *(.gnu.hash) }
17 .dynsym : { *(.dynsym) } 18 .dynsym : { *(.dynsym) }
18 .dynstr : { *(.dynstr) } 19 .dynstr : { *(.dynstr) }
19 .gnu.version : { *(.gnu.version) } 20 .gnu.version : { *(.gnu.version) }
diff --git a/arch/powerpc/kernel/vdso64/Makefile b/arch/powerpc/kernel/vdso64/Makefile
index ab39988452cc..43af9b2a6f3b 100644
--- a/arch/powerpc/kernel/vdso64/Makefile
+++ b/arch/powerpc/kernel/vdso64/Makefile
@@ -8,7 +8,8 @@ targets := $(obj-vdso64) vdso64.so
8obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64)) 8obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
9 9
10EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin 10EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin
11EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso64.so.1 11EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
12 $(call ld-option, -Wl$(comma)--hash-style=sysv)
12EXTRA_AFLAGS := -D__VDSO64__ -s 13EXTRA_AFLAGS := -D__VDSO64__ -s
13 14
14obj-y += vdso64_wrapper.o 15obj-y += vdso64_wrapper.o
diff --git a/arch/powerpc/kernel/vdso64/vdso64.lds.S b/arch/powerpc/kernel/vdso64/vdso64.lds.S
index 4bdf224464ab..4a2b6dc0960c 100644
--- a/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ b/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -12,6 +12,7 @@ SECTIONS
12{ 12{
13 . = VDSO64_LBASE + SIZEOF_HEADERS; 13 . = VDSO64_LBASE + SIZEOF_HEADERS;
14 .hash : { *(.hash) } :text 14 .hash : { *(.hash) } :text
15 .gnu.hash : { *(.gnu.hash) }
15 .dynsym : { *(.dynsym) } 16 .dynsym : { *(.dynsym) }
16 .dynstr : { *(.dynstr) } 17 .dynstr : { *(.dynstr) }
17 .gnu.version : { *(.gnu.version) } 18 .gnu.version : { *(.gnu.version) }
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 4b17a7359924..716a2906a24d 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -320,7 +320,8 @@ void __init lmb_enforce_memory_limit(unsigned long memory_limit)
320 break; 320 break;
321 } 321 }
322 322
323 lmb.rmo_size = lmb.memory.region[0].size; 323 if (lmb.memory.region[0].size < lmb.rmo_size)
324 lmb.rmo_size = lmb.memory.region[0].size;
324 325
325 /* And truncate any reserves above the limit also. */ 326 /* And truncate any reserves above the limit also. */
326 for (i = 0; i < lmb.reserved.cnt; i++) { 327 for (i = 0; i < lmb.reserved.cnt; i++) {
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 538e337d63e2..9c08ff322290 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -291,10 +291,6 @@ void __init chrp_setup_arch(void)
291 291
292 pci_create_OF_bus_map(); 292 pci_create_OF_bus_map();
293 293
294#ifdef CONFIG_SMP
295 smp_ops = &chrp_smp_ops;
296#endif /* CONFIG_SMP */
297
298 /* 294 /*
299 * Print the banner, then scroll down so boot progress 295 * Print the banner, then scroll down so boot progress
300 * can be printed. -- Cort 296 * can be printed. -- Cort
@@ -479,6 +475,14 @@ void __init chrp_init_IRQ(void)
479 chrp_find_openpic(); 475 chrp_find_openpic();
480 chrp_find_8259(); 476 chrp_find_8259();
481 477
478#ifdef CONFIG_SMP
479 /* Pegasos has no MPIC, those ops would make it crash. It might be an
480 * option to move setting them to after we probe the PIC though
481 */
482 if (chrp_mpic != NULL)
483 smp_ops = &chrp_smp_ops;
484#endif /* CONFIG_SMP */
485
482 if (_chrp_type == _CHRP_Pegasos) 486 if (_chrp_type == _CHRP_Pegasos)
483 ppc_md.get_irq = i8259_irq; 487 ppc_md.get_irq = i8259_irq;
484 488
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index cb528c9de4c3..57567dfb9819 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -221,10 +221,17 @@ static void __init maple_init_IRQ(void)
221 * in Maple device-tree where the type of the controller is 221 * in Maple device-tree where the type of the controller is
222 * open-pic and not interrupt-controller 222 * open-pic and not interrupt-controller
223 */ 223 */
224 for_each_node_by_type(np, "open-pic") { 224
225 mpic_node = np; 225 for_each_node_by_type(np, "interrupt-controller")
226 break; 226 if (device_is_compatible(np, "open-pic")) {
227 } 227 mpic_node = np;
228 break;
229 }
230 if (mpic_node == NULL)
231 for_each_node_by_type(np, "open-pic") {
232 mpic_node = np;
233 break;
234 }
228 if (mpic_node == NULL) { 235 if (mpic_node == NULL) {
229 printk(KERN_ERR 236 printk(KERN_ERR
230 "Failed to locate the MPIC interrupt controller\n"); 237 "Failed to locate the MPIC interrupt controller\n");
@@ -252,6 +259,8 @@ static void __init maple_init_IRQ(void)
252 259
253 /* XXX Maple specific bits */ 260 /* XXX Maple specific bits */
254 flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET; 261 flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET;
262 /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */
263 flags |= MPIC_BIG_ENDIAN;
255 264
256 /* Setup the openpic driver. More device-tree junks, we hard code no 265 /* Setup the openpic driver. More device-tree junks, we hard code no
257 * ISUs for now. I'll have to revisit some stuffs with the folks doing 266 * ISUs for now. I'll have to revisit some stuffs with the folks doing
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c
index 74eed6b74cd6..d66415491055 100644
--- a/arch/powerpc/platforms/powermac/backlight.c
+++ b/arch/powerpc/platforms/powermac/backlight.c
@@ -10,19 +10,32 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/fb.h> 11#include <linux/fb.h>
12#include <linux/backlight.h> 12#include <linux/backlight.h>
13#include <linux/adb.h>
14#include <linux/pmu.h>
15#include <asm/atomic.h>
13#include <asm/prom.h> 16#include <asm/prom.h>
14#include <asm/backlight.h> 17#include <asm/backlight.h>
15 18
16#define OLD_BACKLIGHT_MAX 15 19#define OLD_BACKLIGHT_MAX 15
17 20
18static void pmac_backlight_key_worker(void *data); 21static void pmac_backlight_key_worker(void *data);
22static void pmac_backlight_set_legacy_worker(void *data);
23
19static DECLARE_WORK(pmac_backlight_key_work, pmac_backlight_key_worker, NULL); 24static DECLARE_WORK(pmac_backlight_key_work, pmac_backlight_key_worker, NULL);
25static DECLARE_WORK(pmac_backlight_set_legacy_work, pmac_backlight_set_legacy_worker, NULL);
20 26
21/* Although this variable is used in interrupt context, it makes no sense to 27/* Although these variables are used in interrupt context, it makes no sense to
22 * protect it. No user is able to produce enough key events per second and 28 * protect them. No user is able to produce enough key events per second and
23 * notice the errors that might happen. 29 * notice the errors that might happen.
24 */ 30 */
25static int pmac_backlight_key_queued; 31static int pmac_backlight_key_queued;
32static int pmac_backlight_set_legacy_queued;
33
34/* The via-pmu code allows the backlight to be grabbed, in which case the
35 * in-kernel control of the brightness needs to be disabled. This should
36 * only be used by really old PowerBooks.
37 */
38static atomic_t kernel_backlight_disabled = ATOMIC_INIT(0);
26 39
27/* Protect the pmac_backlight variable */ 40/* Protect the pmac_backlight variable */
28DEFINE_MUTEX(pmac_backlight_mutex); 41DEFINE_MUTEX(pmac_backlight_mutex);
@@ -82,6 +95,9 @@ int pmac_backlight_curve_lookup(struct fb_info *info, int value)
82 95
83static void pmac_backlight_key_worker(void *data) 96static void pmac_backlight_key_worker(void *data)
84{ 97{
98 if (atomic_read(&kernel_backlight_disabled))
99 return;
100
85 mutex_lock(&pmac_backlight_mutex); 101 mutex_lock(&pmac_backlight_mutex);
86 if (pmac_backlight) { 102 if (pmac_backlight) {
87 struct backlight_properties *props; 103 struct backlight_properties *props;
@@ -107,8 +123,12 @@ static void pmac_backlight_key_worker(void *data)
107 mutex_unlock(&pmac_backlight_mutex); 123 mutex_unlock(&pmac_backlight_mutex);
108} 124}
109 125
126/* This function is called in interrupt context */
110void pmac_backlight_key(int direction) 127void pmac_backlight_key(int direction)
111{ 128{
129 if (atomic_read(&kernel_backlight_disabled))
130 return;
131
112 /* we can receive multiple interrupts here, but the scheduled work 132 /* we can receive multiple interrupts here, but the scheduled work
113 * will run only once, with the last value 133 * will run only once, with the last value
114 */ 134 */
@@ -116,7 +136,7 @@ void pmac_backlight_key(int direction)
116 schedule_work(&pmac_backlight_key_work); 136 schedule_work(&pmac_backlight_key_work);
117} 137}
118 138
119int pmac_backlight_set_legacy_brightness(int brightness) 139static int __pmac_backlight_set_legacy_brightness(int brightness)
120{ 140{
121 int error = -ENXIO; 141 int error = -ENXIO;
122 142
@@ -145,6 +165,28 @@ int pmac_backlight_set_legacy_brightness(int brightness)
145 return error; 165 return error;
146} 166}
147 167
168static void pmac_backlight_set_legacy_worker(void *data)
169{
170 if (atomic_read(&kernel_backlight_disabled))
171 return;
172
173 __pmac_backlight_set_legacy_brightness(pmac_backlight_set_legacy_queued);
174}
175
176/* This function is called in interrupt context */
177void pmac_backlight_set_legacy_brightness_pmu(int brightness) {
178 if (atomic_read(&kernel_backlight_disabled))
179 return;
180
181 pmac_backlight_set_legacy_queued = brightness;
182 schedule_work(&pmac_backlight_set_legacy_work);
183}
184
185int pmac_backlight_set_legacy_brightness(int brightness)
186{
187 return __pmac_backlight_set_legacy_brightness(brightness);
188}
189
148int pmac_backlight_get_legacy_brightness() 190int pmac_backlight_get_legacy_brightness()
149{ 191{
150 int result = -ENXIO; 192 int result = -ENXIO;
@@ -167,6 +209,16 @@ int pmac_backlight_get_legacy_brightness()
167 return result; 209 return result;
168} 210}
169 211
212void pmac_backlight_disable()
213{
214 atomic_inc(&kernel_backlight_disabled);
215}
216
217void pmac_backlight_enable()
218{
219 atomic_dec(&kernel_backlight_disabled);
220}
221
170EXPORT_SYMBOL_GPL(pmac_backlight); 222EXPORT_SYMBOL_GPL(pmac_backlight);
171EXPORT_SYMBOL_GPL(pmac_backlight_mutex); 223EXPORT_SYMBOL_GPL(pmac_backlight_mutex);
172EXPORT_SYMBOL_GPL(pmac_has_backlight_type); 224EXPORT_SYMBOL_GPL(pmac_has_backlight_type);
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index 871b002c9f90..6a026c733f6a 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -181,13 +181,18 @@ static void __init bootx_add_chosen_props(unsigned long base,
181} 181}
182 182
183static void __init bootx_add_display_props(unsigned long base, 183static void __init bootx_add_display_props(unsigned long base,
184 unsigned long *mem_end) 184 unsigned long *mem_end,
185 int has_real_node)
185{ 186{
186 boot_infos_t *bi = bootx_info; 187 boot_infos_t *bi = bootx_info;
187 u32 tmp; 188 u32 tmp;
188 189
189 bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end); 190 if (has_real_node) {
190 bootx_dt_add_prop("linux,opened", NULL, 0, mem_end); 191 bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end);
192 bootx_dt_add_prop("linux,opened", NULL, 0, mem_end);
193 } else
194 bootx_dt_add_prop("linux,bootx-noscreen", NULL, 0, mem_end);
195
191 tmp = bi->dispDeviceDepth; 196 tmp = bi->dispDeviceDepth;
192 bootx_dt_add_prop("linux,bootx-depth", &tmp, 4, mem_end); 197 bootx_dt_add_prop("linux,bootx-depth", &tmp, 4, mem_end);
193 tmp = bi->dispDeviceRect[2] - bi->dispDeviceRect[0]; 198 tmp = bi->dispDeviceRect[2] - bi->dispDeviceRect[0];
@@ -241,11 +246,6 @@ static void __init bootx_scan_dt_build_strings(unsigned long base,
241 DBG(" detected display ! adding properties names !\n"); 246 DBG(" detected display ! adding properties names !\n");
242 bootx_dt_add_string("linux,boot-display", mem_end); 247 bootx_dt_add_string("linux,boot-display", mem_end);
243 bootx_dt_add_string("linux,opened", mem_end); 248 bootx_dt_add_string("linux,opened", mem_end);
244 bootx_dt_add_string("linux,bootx-depth", mem_end);
245 bootx_dt_add_string("linux,bootx-width", mem_end);
246 bootx_dt_add_string("linux,bootx-height", mem_end);
247 bootx_dt_add_string("linux,bootx-linebytes", mem_end);
248 bootx_dt_add_string("linux,bootx-addr", mem_end);
249 strncpy(bootx_disp_path, namep, 255); 249 strncpy(bootx_disp_path, namep, 255);
250 } 250 }
251 251
@@ -329,10 +329,13 @@ static void __init bootx_scan_dt_build_struct(unsigned long base,
329 ppp = &pp->next; 329 ppp = &pp->next;
330 } 330 }
331 331
332 if (node == bootx_node_chosen) 332 if (node == bootx_node_chosen) {
333 bootx_add_chosen_props(base, mem_end); 333 bootx_add_chosen_props(base, mem_end);
334 if (node == bootx_info->dispDeviceRegEntryOffset) 334 if (bootx_info->dispDeviceRegEntryOffset == 0)
335 bootx_add_display_props(base, mem_end); 335 bootx_add_display_props(base, mem_end, 0);
336 }
337 else if (node == bootx_info->dispDeviceRegEntryOffset)
338 bootx_add_display_props(base, mem_end, 1);
336 339
337 /* do all our children */ 340 /* do all our children */
338 cpp = &np->child; 341 cpp = &np->child;
@@ -374,6 +377,14 @@ static unsigned long __init bootx_flatten_dt(unsigned long start)
374 mem_end += 4; 377 mem_end += 4;
375 bootx_dt_strend = mem_end; 378 bootx_dt_strend = mem_end;
376 bootx_scan_dt_build_strings(base, 4, &mem_end); 379 bootx_scan_dt_build_strings(base, 4, &mem_end);
380 /* Add some strings */
381 bootx_dt_add_string("linux,bootx-noscreen", &mem_end);
382 bootx_dt_add_string("linux,bootx-depth", &mem_end);
383 bootx_dt_add_string("linux,bootx-width", &mem_end);
384 bootx_dt_add_string("linux,bootx-height", &mem_end);
385 bootx_dt_add_string("linux,bootx-linebytes", &mem_end);
386 bootx_dt_add_string("linux,bootx-addr", &mem_end);
387 /* Wrap up strings */
377 hdr->off_dt_strings = bootx_dt_strbase - mem_start; 388 hdr->off_dt_strings = bootx_dt_strbase - mem_start;
378 hdr->dt_strings_size = bootx_dt_strend - bootx_dt_strbase; 389 hdr->dt_strings_size = bootx_dt_strend - bootx_dt_strbase;
379 390
@@ -471,6 +482,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
471 if (bi->dispDeviceDepth == 16) 482 if (bi->dispDeviceDepth == 16)
472 bi->dispDeviceDepth = 15; 483 bi->dispDeviceDepth = 15;
473 484
485
474#ifdef CONFIG_BOOTX_TEXT 486#ifdef CONFIG_BOOTX_TEXT
475 ptr = (unsigned long)bi->logicalDisplayBase; 487 ptr = (unsigned long)bi->logicalDisplayBase;
476 ptr += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes; 488 ptr += bi->dispDeviceRect[1] * bi->dispDeviceRowBytes;
@@ -508,6 +520,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
508#ifdef CONFIG_BOOTX_TEXT 520#ifdef CONFIG_BOOTX_TEXT
509 btext_welcome(bi); 521 btext_welcome(bi);
510#endif 522#endif
523
511 /* New BootX enters kernel with MMU off, i/os are not allowed 524 /* New BootX enters kernel with MMU off, i/os are not allowed
512 * here. This hack will have been done by the boostrap anyway. 525 * here. This hack will have been done by the boostrap anyway.
513 */ 526 */
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index f08a14516139..7b1156ea5341 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -10,6 +10,8 @@
10 * that is iMac G5 and latest single CPU desktop. 10 * that is iMac G5 and latest single CPU desktop.
11 */ 11 */
12 12
13#undef DEBUG
14
13#include <linux/module.h> 15#include <linux/module.h>
14#include <linux/types.h> 16#include <linux/types.h>
15#include <linux/errno.h> 17#include <linux/errno.h>
@@ -30,13 +32,7 @@
30#include <asm/smu.h> 32#include <asm/smu.h>
31#include <asm/pmac_pfunc.h> 33#include <asm/pmac_pfunc.h>
32 34
33#undef DEBUG 35#define DBG(fmt...) pr_debug(fmt)
34
35#ifdef DEBUG
36#define DBG(fmt...) printk(fmt)
37#else
38#define DBG(fmt...)
39#endif
40 36
41/* see 970FX user manual */ 37/* see 970FX user manual */
42 38
@@ -82,8 +78,6 @@ static struct freq_attr* g5_cpu_freqs_attr[] = {
82/* Power mode data is an array of the 32 bits PCR values to use for 78/* Power mode data is an array of the 32 bits PCR values to use for
83 * the various frequencies, retrieved from the device-tree 79 * the various frequencies, retrieved from the device-tree
84 */ 80 */
85static u32 *g5_pmode_data;
86static int g5_pmode_max;
87static int g5_pmode_cur; 81static int g5_pmode_cur;
88 82
89static void (*g5_switch_volt)(int speed_mode); 83static void (*g5_switch_volt)(int speed_mode);
@@ -93,6 +87,11 @@ static int (*g5_query_freq)(void);
93static DEFINE_MUTEX(g5_switch_mutex); 87static DEFINE_MUTEX(g5_switch_mutex);
94 88
95 89
90#ifdef CONFIG_PMAC_SMU
91
92static u32 *g5_pmode_data;
93static int g5_pmode_max;
94
96static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ 95static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */
97static int g5_fvt_count; /* number of op. points */ 96static int g5_fvt_count; /* number of op. points */
98static int g5_fvt_cur; /* current op. point */ 97static int g5_fvt_cur; /* current op. point */
@@ -210,6 +209,16 @@ static int g5_scom_query_freq(void)
210} 209}
211 210
212/* 211/*
212 * Fake voltage switching for platforms with missing support
213 */
214
215static void g5_dummy_switch_volt(int speed_mode)
216{
217}
218
219#endif /* CONFIG_PMAC_SMU */
220
221/*
213 * Platform function based voltage switching for PowerMac7,2 & 7,3 222 * Platform function based voltage switching for PowerMac7,2 & 7,3
214 */ 223 */
215 224
@@ -248,6 +257,9 @@ static int g5_pfunc_switch_freq(int speed_mode)
248 struct pmf_args args; 257 struct pmf_args args;
249 u32 done = 0; 258 u32 done = 0;
250 unsigned long timeout; 259 unsigned long timeout;
260 int rc;
261
262 DBG("g5_pfunc_switch_freq(%d)\n", speed_mode);
251 263
252 /* If frequency is going up, first ramp up the voltage */ 264 /* If frequency is going up, first ramp up the voltage */
253 if (speed_mode < g5_pmode_cur) 265 if (speed_mode < g5_pmode_cur)
@@ -255,9 +267,12 @@ static int g5_pfunc_switch_freq(int speed_mode)
255 267
256 /* Do it */ 268 /* Do it */
257 if (speed_mode == CPUFREQ_HIGH) 269 if (speed_mode == CPUFREQ_HIGH)
258 pmf_call_one(pfunc_cpu_setfreq_high, NULL); 270 rc = pmf_call_one(pfunc_cpu_setfreq_high, NULL);
259 else 271 else
260 pmf_call_one(pfunc_cpu_setfreq_low, NULL); 272 rc = pmf_call_one(pfunc_cpu_setfreq_low, NULL);
273
274 if (rc)
275 printk(KERN_WARNING "cpufreq: pfunc switch error %d\n", rc);
261 276
262 /* It's an irq GPIO so we should be able to just block here, 277 /* It's an irq GPIO so we should be able to just block here,
263 * I'll do that later after I've properly tested the IRQ code for 278 * I'll do that later after I've properly tested the IRQ code for
@@ -296,13 +311,6 @@ static int g5_pfunc_query_freq(void)
296 return val ? CPUFREQ_HIGH : CPUFREQ_LOW; 311 return val ? CPUFREQ_HIGH : CPUFREQ_LOW;
297} 312}
298 313
299/*
300 * Fake voltage switching for platforms with missing support
301 */
302
303static void g5_dummy_switch_volt(int speed_mode)
304{
305}
306 314
307/* 315/*
308 * Common interface to the cpufreq core 316 * Common interface to the cpufreq core
@@ -375,6 +383,8 @@ static struct cpufreq_driver g5_cpufreq_driver = {
375}; 383};
376 384
377 385
386#ifdef CONFIG_PMAC_SMU
387
378static int __init g5_neo2_cpufreq_init(struct device_node *cpus) 388static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
379{ 389{
380 struct device_node *cpunode; 390 struct device_node *cpunode;
@@ -525,6 +535,9 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
525 return rc; 535 return rc;
526} 536}
527 537
538#endif /* CONFIG_PMAC_SMU */
539
540
528static int __init g5_pm72_cpufreq_init(struct device_node *cpus) 541static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
529{ 542{
530 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; 543 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
@@ -533,6 +546,9 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
533 u64 max_freq, min_freq, ih, il; 546 u64 max_freq, min_freq, ih, il;
534 int has_volt = 1, rc = 0; 547 int has_volt = 1, rc = 0;
535 548
549 DBG("cpufreq: Initializing for PowerMac7,2, PowerMac7,3 and"
550 " RackMac3,1...\n");
551
536 /* Get first CPU node */ 552 /* Get first CPU node */
537 for (cpunode = NULL; 553 for (cpunode = NULL;
538 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { 554 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
@@ -636,6 +652,15 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
636 */ 652 */
637 ih = *((u32 *)(eeprom + 0x10)); 653 ih = *((u32 *)(eeprom + 0x10));
638 il = *((u32 *)(eeprom + 0x20)); 654 il = *((u32 *)(eeprom + 0x20));
655
656 /* Check for machines with no useful settings */
657 if (il == ih) {
658 printk(KERN_WARNING "cpufreq: No low frequency mode available"
659 " on this model !\n");
660 rc = -ENODEV;
661 goto bail;
662 }
663
639 min_freq = 0; 664 min_freq = 0;
640 if (ih != 0 && il != 0) 665 if (ih != 0 && il != 0)
641 min_freq = (max_freq * il) / ih; 666 min_freq = (max_freq * il) / ih;
@@ -643,7 +668,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
643 /* Sanity check */ 668 /* Sanity check */
644 if (min_freq >= max_freq || min_freq < 1000) { 669 if (min_freq >= max_freq || min_freq < 1000) {
645 printk(KERN_ERR "cpufreq: Can't calculate low frequency !\n"); 670 printk(KERN_ERR "cpufreq: Can't calculate low frequency !\n");
646 rc = -ENODEV; 671 rc = -ENXIO;
647 goto bail; 672 goto bail;
648 } 673 }
649 g5_cpu_freqs[0].frequency = max_freq; 674 g5_cpu_freqs[0].frequency = max_freq;
@@ -690,16 +715,10 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
690 return rc; 715 return rc;
691} 716}
692 717
693static int __init g5_rm31_cpufreq_init(struct device_node *cpus)
694{
695 /* NYI */
696 return 0;
697}
698
699static int __init g5_cpufreq_init(void) 718static int __init g5_cpufreq_init(void)
700{ 719{
701 struct device_node *cpus; 720 struct device_node *cpus;
702 int rc; 721 int rc = 0;
703 722
704 cpus = of_find_node_by_path("/cpus"); 723 cpus = of_find_node_by_path("/cpus");
705 if (cpus == NULL) { 724 if (cpus == NULL) {
@@ -708,12 +727,13 @@ static int __init g5_cpufreq_init(void)
708 } 727 }
709 728
710 if (machine_is_compatible("PowerMac7,2") || 729 if (machine_is_compatible("PowerMac7,2") ||
711 machine_is_compatible("PowerMac7,3")) 730 machine_is_compatible("PowerMac7,3") ||
731 machine_is_compatible("RackMac3,1"))
712 rc = g5_pm72_cpufreq_init(cpus); 732 rc = g5_pm72_cpufreq_init(cpus);
713 else if (machine_is_compatible("RackMac3,1")) 733#ifdef CONFIG_PMAC_SMU
714 rc = g5_rm31_cpufreq_init(cpus);
715 else 734 else
716 rc = g5_neo2_cpufreq_init(cpus); 735 rc = g5_neo2_cpufreq_init(cpus);
736#endif /* CONFIG_PMAC_SMU */
717 737
718 of_node_put(cpus); 738 of_node_put(cpus);
719 return rc; 739 return rc;
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 54a52437265c..71c634e0b87c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -501,7 +501,8 @@ static void pseries_dedicated_idle_sleep(void)
501 } 501 }
502 502
503 /* 503 /*
504 * Cede if the other thread is not idle, so that it can 504 * If not SMT, cede processor. If CPU is running SMT
505 * cede if the other thread is not idle, so that it can
505 * go single-threaded. If the other thread is idle, 506 * go single-threaded. If the other thread is idle,
506 * we ask the hypervisor if it has pending work it 507 * we ask the hypervisor if it has pending work it
507 * wants to do and cede if it does. Otherwise we keep 508 * wants to do and cede if it does. Otherwise we keep
@@ -514,7 +515,8 @@ static void pseries_dedicated_idle_sleep(void)
514 * very low priority. The cede enables interrupts, which 515 * very low priority. The cede enables interrupts, which
515 * doesn't matter here. 516 * doesn't matter here.
516 */ 517 */
517 if (!lppaca[cpu ^ 1].idle || poll_pending() == H_PENDING) 518 if (!cpu_has_feature(CPU_FTR_SMT) || !lppaca[cpu ^ 1].idle
519 || poll_pending() == H_PENDING)
518 cede_processor(); 520 cede_processor();
519 521
520out: 522out:
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 09c6525cfa61..095fd3323323 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -8,6 +8,7 @@ SECTIONS
8 . = + SIZEOF_HEADERS; 8 . = + SIZEOF_HEADERS;
9 .interp : { *(.interp) } 9 .interp : { *(.interp) }
10 .hash : { *(.hash) } 10 .hash : { *(.hash) }
11 .gnu.hash : { *(.gnu.hash) }
11 .dynsym : { *(.dynsym) } 12 .dynsym : { *(.dynsym) }
12 .dynstr : { *(.dynstr) } 13 .dynstr : { *(.dynstr) }
13 .rel.text : { *(.rel.text) } 14 .rel.text : { *(.rel.text) }
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index d0f82c995af6..6a4b5f9715c9 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -617,7 +617,8 @@ appldata_offline_cpu(int cpu)
617 spin_unlock(&appldata_timer_lock); 617 spin_unlock(&appldata_timer_lock);
618} 618}
619 619
620static int __cpuinit 620#ifdef CONFIG_HOTPLUG_CPU
621static int
621appldata_cpu_notify(struct notifier_block *self, 622appldata_cpu_notify(struct notifier_block *self,
622 unsigned long action, void *hcpu) 623 unsigned long action, void *hcpu)
623{ 624{
@@ -625,20 +626,19 @@ appldata_cpu_notify(struct notifier_block *self,
625 case CPU_ONLINE: 626 case CPU_ONLINE:
626 appldata_online_cpu((long) hcpu); 627 appldata_online_cpu((long) hcpu);
627 break; 628 break;
628#ifdef CONFIG_HOTPLUG_CPU
629 case CPU_DEAD: 629 case CPU_DEAD:
630 appldata_offline_cpu((long) hcpu); 630 appldata_offline_cpu((long) hcpu);
631 break; 631 break;
632#endif
633 default: 632 default:
634 break; 633 break;
635 } 634 }
636 return NOTIFY_OK; 635 return NOTIFY_OK;
637} 636}
638 637
639static struct notifier_block __devinitdata appldata_nb = { 638static struct notifier_block appldata_nb = {
640 .notifier_call = appldata_cpu_notify, 639 .notifier_call = appldata_cpu_notify,
641}; 640};
641#endif
642 642
643/* 643/*
644 * appldata_init() 644 * appldata_init()
@@ -662,7 +662,7 @@ static int __init appldata_init(void)
662 appldata_online_cpu(i); 662 appldata_online_cpu(i);
663 663
664 /* Register cpu hotplug notifier */ 664 /* Register cpu hotplug notifier */
665 register_cpu_notifier(&appldata_nb); 665 register_hotcpu_notifier(&appldata_nb);
666 666
667 appldata_sysctl_header = register_sysctl_table(appldata_dir_table, 1); 667 appldata_sysctl_header = register_sysctl_table(appldata_dir_table, 1);
668#ifdef MODULE 668#ifdef MODULE
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 2517ecb8bf27..68ed24df5c8f 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -26,6 +26,7 @@ SECTIONS
26 26
27 /* Read-only sections, merged into text segment: */ 27 /* Read-only sections, merged into text segment: */
28 .hash : { *(.hash) } 28 .hash : { *(.hash) }
29 .gnu.hash : { *(.gnu.hash) }
29 .dynsym : { *(.dynsym) } 30 .dynsym : { *(.dynsym) }
30 .dynstr : { *(.dynstr) } 31 .dynstr : { *(.dynstr) }
31 .gnu.version : { *(.gnu.version) } 32 .gnu.version : { *(.gnu.version) }
diff --git a/arch/v850/kernel/setup.c b/arch/v850/kernel/setup.c
index 62bdb8d29fc0..1bf672a25692 100644
--- a/arch/v850/kernel/setup.c
+++ b/arch/v850/kernel/setup.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * arch/v850/kernel/setup.c -- Arch-dependent initialization functions 2 * arch/v850/kernel/setup.c -- Arch-dependent initialization functions
3 * 3 *
4 * Copyright (C) 2001,02,03,05 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,05,06 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,05 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,05,06 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -190,7 +190,7 @@ void free_initmem (void)
190 for (addr = start; addr < end; addr += PAGE_SIZE) { 190 for (addr = start; addr < end; addr += PAGE_SIZE) {
191 struct page *page = virt_to_page (addr); 191 struct page *page = virt_to_page (addr);
192 ClearPageReserved (page); 192 ClearPageReserved (page);
193 set_page_count (page, 1); 193 init_page_count (page);
194 __free_page (page); 194 __free_page (page);
195 total_ram_pages++; 195 total_ram_pages++;
196 } 196 }
diff --git a/arch/v850/kernel/v850_ksyms.c b/arch/v850/kernel/v850_ksyms.c
index c03ad6ed61cc..67bc48e57c60 100644
--- a/arch/v850/kernel/v850_ksyms.c
+++ b/arch/v850/kernel/v850_ksyms.c
@@ -21,9 +21,6 @@ EXPORT_SYMBOL (trap_table);
21 21
22/* platform dependent support */ 22/* platform dependent support */
23EXPORT_SYMBOL (kernel_thread); 23EXPORT_SYMBOL (kernel_thread);
24EXPORT_SYMBOL (enable_irq);
25EXPORT_SYMBOL (disable_irq);
26EXPORT_SYMBOL (disable_irq_nosync);
27EXPORT_SYMBOL (__bug); 24EXPORT_SYMBOL (__bug);
28 25
29/* Networking helper routines. */ 26/* Networking helper routines. */
@@ -33,22 +30,9 @@ EXPORT_SYMBOL (ip_compute_csum);
33EXPORT_SYMBOL (ip_fast_csum); 30EXPORT_SYMBOL (ip_fast_csum);
34 31
35/* string / mem functions */ 32/* string / mem functions */
36EXPORT_SYMBOL (strcpy);
37EXPORT_SYMBOL (strncpy);
38EXPORT_SYMBOL (strcat);
39EXPORT_SYMBOL (strncat);
40EXPORT_SYMBOL (strcmp);
41EXPORT_SYMBOL (strncmp);
42EXPORT_SYMBOL (strchr);
43EXPORT_SYMBOL (strlen);
44EXPORT_SYMBOL (strnlen);
45EXPORT_SYMBOL (strrchr);
46EXPORT_SYMBOL (strstr);
47EXPORT_SYMBOL (memset); 33EXPORT_SYMBOL (memset);
48EXPORT_SYMBOL (memcpy); 34EXPORT_SYMBOL (memcpy);
49EXPORT_SYMBOL (memmove); 35EXPORT_SYMBOL (memmove);
50EXPORT_SYMBOL (memcmp);
51EXPORT_SYMBOL (memscan);
52 36
53/* semaphores */ 37/* semaphores */
54EXPORT_SYMBOL (__down); 38EXPORT_SYMBOL (__down);
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 83d389b8ebd8..840d5d93d5cc 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.17-git22 3# Linux kernel version: 2.6.18-rc2
4# Tue Jul 4 14:24:40 2006 4# Tue Jul 18 17:13:20 2006
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -37,6 +37,7 @@ CONFIG_SWAP=y
37CONFIG_SYSVIPC=y 37CONFIG_SYSVIPC=y
38CONFIG_POSIX_MQUEUE=y 38CONFIG_POSIX_MQUEUE=y
39# CONFIG_BSD_PROCESS_ACCT is not set 39# CONFIG_BSD_PROCESS_ACCT is not set
40# CONFIG_TASKSTATS is not set
40CONFIG_SYSCTL=y 41CONFIG_SYSCTL=y
41# CONFIG_AUDIT is not set 42# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 43CONFIG_IKCONFIG=y
@@ -413,6 +414,7 @@ CONFIG_BLK_DEV_LOOP=y
413CONFIG_BLK_DEV_RAM=y 414CONFIG_BLK_DEV_RAM=y
414CONFIG_BLK_DEV_RAM_COUNT=16 415CONFIG_BLK_DEV_RAM_COUNT=16
415CONFIG_BLK_DEV_RAM_SIZE=4096 416CONFIG_BLK_DEV_RAM_SIZE=4096
417CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
416CONFIG_BLK_DEV_INITRD=y 418CONFIG_BLK_DEV_INITRD=y
417# CONFIG_CDROM_PKTCDVD is not set 419# CONFIG_CDROM_PKTCDVD is not set
418# CONFIG_ATA_OVER_ETH is not set 420# CONFIG_ATA_OVER_ETH is not set
@@ -1195,7 +1197,7 @@ CONFIG_USB_MON=y
1195# CONFIG_USB_LEGOTOWER is not set 1197# CONFIG_USB_LEGOTOWER is not set
1196# CONFIG_USB_LCD is not set 1198# CONFIG_USB_LCD is not set
1197# CONFIG_USB_LED is not set 1199# CONFIG_USB_LED is not set
1198# CONFIG_USB_CY7C63 is not set 1200# CONFIG_USB_CYPRESS_CY7C63 is not set
1199# CONFIG_USB_CYTHERM is not set 1201# CONFIG_USB_CYTHERM is not set
1200# CONFIG_USB_PHIDGETKIT is not set 1202# CONFIG_USB_PHIDGETKIT is not set
1201# CONFIG_USB_PHIDGETSERVO is not set 1203# CONFIG_USB_PHIDGETSERVO is not set
@@ -1373,7 +1375,6 @@ CONFIG_SUNRPC=y
1373# CONFIG_RPCSEC_GSS_SPKM3 is not set 1375# CONFIG_RPCSEC_GSS_SPKM3 is not set
1374# CONFIG_SMB_FS is not set 1376# CONFIG_SMB_FS is not set
1375# CONFIG_CIFS is not set 1377# CONFIG_CIFS is not set
1376# CONFIG_CIFS_DEBUG2 is not set
1377# CONFIG_NCP_FS is not set 1378# CONFIG_NCP_FS is not set
1378# CONFIG_CODA_FS is not set 1379# CONFIG_CODA_FS is not set
1379# CONFIG_AFS_FS is not set 1380# CONFIG_AFS_FS is not set
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile
index 62bc5f56da9e..cdae36435e21 100644
--- a/arch/x86_64/ia32/Makefile
+++ b/arch/x86_64/ia32/Makefile
@@ -23,6 +23,7 @@ targets := $(foreach F,sysenter syscall,vsyscall-$F.o vsyscall-$F.so)
23# The DSO images are built using a special linker script 23# The DSO images are built using a special linker script
24quiet_cmd_syscall = SYSCALL $@ 24quiet_cmd_syscall = SYSCALL $@
25 cmd_syscall = $(CC) -m32 -nostdlib -shared -s \ 25 cmd_syscall = $(CC) -m32 -nostdlib -shared -s \
26 $(call ld-option, -Wl$(comma)--hash-style=sysv) \
26 -Wl,-soname=linux-gate.so.1 -o $@ \ 27 -Wl,-soname=linux-gate.so.1 -o $@ \
27 -Wl,-T,$(filter-out FORCE,$^) 28 -Wl,-T,$(filter-out FORCE,$^)
28 29
diff --git a/arch/x86_64/ia32/vsyscall.lds b/arch/x86_64/ia32/vsyscall.lds
index f2e75ed4c6c7..1dc86ff5bcb9 100644
--- a/arch/x86_64/ia32/vsyscall.lds
+++ b/arch/x86_64/ia32/vsyscall.lds
@@ -11,6 +11,7 @@ SECTIONS
11 . = VSYSCALL_BASE + SIZEOF_HEADERS; 11 . = VSYSCALL_BASE + SIZEOF_HEADERS;
12 12
13 .hash : { *(.hash) } :text 13 .hash : { *(.hash) } :text
14 .gnu.hash : { *(.gnu.hash) }
14 .dynsym : { *(.dynsym) } 15 .dynsym : { *(.dynsym) }
15 .dynstr : { *(.dynstr) } 16 .dynstr : { *(.dynstr) }
16 .gnu.version : { *(.gnu.version) } 17 .gnu.version : { *(.gnu.version) }
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index d464dded68c0..6f810424df44 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -513,6 +513,7 @@ END(stub_rt_sigreturn)
513 swapgs 513 swapgs
5141: incl %gs:pda_irqcount # RED-PEN should check preempt count 5141: incl %gs:pda_irqcount # RED-PEN should check preempt count
515 cmoveq %gs:pda_irqstackptr,%rsp 515 cmoveq %gs:pda_irqstackptr,%rsp
516 push %rbp # backlink for old unwinder
516 /* 517 /*
517 * We entered an interrupt context - irqs are off: 518 * We entered an interrupt context - irqs are off:
518 */ 519 */
@@ -1139,18 +1140,21 @@ ENTRY(machine_check)
1139END(machine_check) 1140END(machine_check)
1140#endif 1141#endif
1141 1142
1143/* Call softirq on interrupt stack. Interrupts are off. */
1142ENTRY(call_softirq) 1144ENTRY(call_softirq)
1143 CFI_STARTPROC 1145 CFI_STARTPROC
1144 movq %gs:pda_irqstackptr,%rax 1146 push %rbp
1145 movq %rsp,%rdx 1147 CFI_ADJUST_CFA_OFFSET 8
1146 CFI_DEF_CFA_REGISTER rdx 1148 CFI_REL_OFFSET rbp,0
1149 mov %rsp,%rbp
1150 CFI_DEF_CFA_REGISTER rbp
1147 incl %gs:pda_irqcount 1151 incl %gs:pda_irqcount
1148 cmove %rax,%rsp 1152 cmove %gs:pda_irqstackptr,%rsp
1149 pushq %rdx 1153 push %rbp # backlink for old unwinder
1150 /*todo CFI_DEF_CFA_EXPRESSION ...*/
1151 call __do_softirq 1154 call __do_softirq
1152 popq %rsp 1155 leaveq
1153 CFI_DEF_CFA_REGISTER rsp 1156 CFI_DEF_CFA_REGISTER rsp
1157 CFI_ADJUST_CFA_OFFSET -8
1154 decl %gs:pda_irqcount 1158 decl %gs:pda_irqcount
1155 ret 1159 ret
1156 CFI_ENDPROC 1160 CFI_ENDPROC
diff --git a/arch/x86_64/kernel/machine_kexec.c b/arch/x86_64/kernel/machine_kexec.c
index 83fb24a02821..106076b370fc 100644
--- a/arch/x86_64/kernel/machine_kexec.c
+++ b/arch/x86_64/kernel/machine_kexec.c
@@ -207,14 +207,11 @@ NORET_TYPE void machine_kexec(struct kimage *image)
207 __flush_tlb(); 207 __flush_tlb();
208 208
209 209
210 /* The segment registers are funny things, they are 210 /* The segment registers are funny things, they have both a
211 * automatically loaded from a table, in memory wherever you 211 * visible and an invisible part. Whenever the visible part is
212 * set them to a specific selector, but this table is never 212 * set to a specific selector, the invisible part is loaded
213 * accessed again unless you set the segment to a different selector. 213 * with from a table in memory. At no other time is the
214 * 214 * descriptor table in memory accessed.
215 * The more common model are caches where the behide
216 * the scenes work is done, but is also dropped at arbitrary
217 * times.
218 * 215 *
219 * I take advantage of this here by force loading the 216 * I take advantage of this here by force loading the
220 * segments, before I zap the gdt with an invalid value. 217 * segments, before I zap the gdt with an invalid value.
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 88845674c661..4e017fb30fb3 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -615,7 +615,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
615} 615}
616 616
617#ifdef CONFIG_HOTPLUG_CPU 617#ifdef CONFIG_HOTPLUG_CPU
618static __cpuinit void mce_remove_device(unsigned int cpu) 618static void mce_remove_device(unsigned int cpu)
619{ 619{
620 int i; 620 int i;
621 621
@@ -626,10 +626,9 @@ static __cpuinit void mce_remove_device(unsigned int cpu)
626 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval); 626 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
627 sysdev_unregister(&per_cpu(device_mce,cpu)); 627 sysdev_unregister(&per_cpu(device_mce,cpu));
628} 628}
629#endif
630 629
631/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 630/* Get notified when a cpu comes on/off. Be hotplug friendly. */
632static __cpuinit int 631static int
633mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 632mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
634{ 633{
635 unsigned int cpu = (unsigned long)hcpu; 634 unsigned int cpu = (unsigned long)hcpu;
@@ -638,18 +637,17 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
638 case CPU_ONLINE: 637 case CPU_ONLINE:
639 mce_create_device(cpu); 638 mce_create_device(cpu);
640 break; 639 break;
641#ifdef CONFIG_HOTPLUG_CPU
642 case CPU_DEAD: 640 case CPU_DEAD:
643 mce_remove_device(cpu); 641 mce_remove_device(cpu);
644 break; 642 break;
645#endif
646 } 643 }
647 return NOTIFY_OK; 644 return NOTIFY_OK;
648} 645}
649 646
650static struct notifier_block __cpuinitdata mce_cpu_notifier = { 647static struct notifier_block mce_cpu_notifier = {
651 .notifier_call = mce_cpu_callback, 648 .notifier_call = mce_cpu_callback,
652}; 649};
650#endif
653 651
654static __init int mce_init_device(void) 652static __init int mce_init_device(void)
655{ 653{
@@ -664,7 +662,7 @@ static __init int mce_init_device(void)
664 mce_create_device(i); 662 mce_create_device(i);
665 } 663 }
666 664
667 register_cpu_notifier(&mce_cpu_notifier); 665 register_hotcpu_notifier(&mce_cpu_notifier);
668 misc_register(&mce_log_device); 666 misc_register(&mce_log_device);
669 return err; 667 return err;
670} 668}
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c
index db2acbf7ad28..883fe747f64c 100644
--- a/arch/x86_64/kernel/mce_amd.c
+++ b/arch/x86_64/kernel/mce_amd.c
@@ -558,7 +558,7 @@ out:
558 * of shared sysfs dir/files, and rest of the cores will be symlinked to it. 558 * of shared sysfs dir/files, and rest of the cores will be symlinked to it.
559 */ 559 */
560 560
561static __cpuinit void deallocate_threshold_block(unsigned int cpu, 561static void deallocate_threshold_block(unsigned int cpu,
562 unsigned int bank) 562 unsigned int bank)
563{ 563{
564 struct threshold_block *pos = NULL; 564 struct threshold_block *pos = NULL;
@@ -578,7 +578,7 @@ static __cpuinit void deallocate_threshold_block(unsigned int cpu,
578 per_cpu(threshold_banks, cpu)[bank]->blocks = NULL; 578 per_cpu(threshold_banks, cpu)[bank]->blocks = NULL;
579} 579}
580 580
581static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank) 581static void threshold_remove_bank(unsigned int cpu, int bank)
582{ 582{
583 int i = 0; 583 int i = 0;
584 struct threshold_bank *b; 584 struct threshold_bank *b;
@@ -618,7 +618,7 @@ free_out:
618 per_cpu(threshold_banks, cpu)[bank] = NULL; 618 per_cpu(threshold_banks, cpu)[bank] = NULL;
619} 619}
620 620
621static __cpuinit void threshold_remove_device(unsigned int cpu) 621static void threshold_remove_device(unsigned int cpu)
622{ 622{
623 unsigned int bank; 623 unsigned int bank;
624 624
@@ -629,14 +629,8 @@ static __cpuinit void threshold_remove_device(unsigned int cpu)
629 } 629 }
630} 630}
631 631
632#else /* !CONFIG_HOTPLUG_CPU */
633static void threshold_remove_device(unsigned int cpu)
634{
635}
636#endif
637
638/* get notified when a cpu comes on/off */ 632/* get notified when a cpu comes on/off */
639static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb, 633static int threshold_cpu_callback(struct notifier_block *nfb,
640 unsigned long action, void *hcpu) 634 unsigned long action, void *hcpu)
641{ 635{
642 /* cpu was unsigned int to begin with */ 636 /* cpu was unsigned int to begin with */
@@ -659,9 +653,10 @@ static int __cpuinit threshold_cpu_callback(struct notifier_block *nfb,
659 return NOTIFY_OK; 653 return NOTIFY_OK;
660} 654}
661 655
662static struct notifier_block threshold_cpu_notifier __cpuinitdata = { 656static struct notifier_block threshold_cpu_notifier = {
663 .notifier_call = threshold_cpu_callback, 657 .notifier_call = threshold_cpu_callback,
664}; 658};
659#endif /* CONFIG_HOTPLUG_CPU */
665 660
666static __init int threshold_init_device(void) 661static __init int threshold_init_device(void)
667{ 662{
@@ -673,7 +668,7 @@ static __init int threshold_init_device(void)
673 if (err) 668 if (err)
674 return err; 669 return err;
675 } 670 }
676 register_cpu_notifier(&threshold_cpu_notifier); 671 register_hotcpu_notifier(&threshold_cpu_notifier);
677 return 0; 672 return 0;
678} 673}
679 674
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c
index e71ed53b08fb..146924ba5df5 100644
--- a/arch/x86_64/kernel/pci-calgary.c
+++ b/arch/x86_64/kernel/pci-calgary.c
@@ -85,7 +85,8 @@
85#define CSR_AGENT_MASK 0xffe0ffff 85#define CSR_AGENT_MASK 0xffe0ffff
86 86
87#define MAX_NUM_OF_PHBS 8 /* how many PHBs in total? */ 87#define MAX_NUM_OF_PHBS 8 /* how many PHBs in total? */
88#define MAX_PHB_BUS_NUM (MAX_NUM_OF_PHBS * 2) /* max dev->bus->number */ 88#define MAX_NUM_CHASSIS 8 /* max number of chassis */
89#define MAX_PHB_BUS_NUM (MAX_NUM_OF_PHBS * MAX_NUM_CHASSIS * 2) /* max dev->bus->number */
89#define PHBS_PER_CALGARY 4 90#define PHBS_PER_CALGARY 4
90 91
91/* register offsets in Calgary's internal register space */ 92/* register offsets in Calgary's internal register space */
@@ -110,7 +111,8 @@ static const unsigned long phb_offsets[] = {
110 0xB000 /* PHB3 */ 111 0xB000 /* PHB3 */
111}; 112};
112 113
113void* tce_table_kva[MAX_NUM_OF_PHBS * MAX_NUMNODES]; 114static char bus_to_phb[MAX_PHB_BUS_NUM];
115void* tce_table_kva[MAX_PHB_BUS_NUM];
114unsigned int specified_table_size = TCE_TABLE_SIZE_UNSPECIFIED; 116unsigned int specified_table_size = TCE_TABLE_SIZE_UNSPECIFIED;
115static int translate_empty_slots __read_mostly = 0; 117static int translate_empty_slots __read_mostly = 0;
116static int calgary_detected __read_mostly = 0; 118static int calgary_detected __read_mostly = 0;
@@ -119,7 +121,7 @@ static int calgary_detected __read_mostly = 0;
119 * the bitmap of PHBs the user requested that we disable 121 * the bitmap of PHBs the user requested that we disable
120 * translation on. 122 * translation on.
121 */ 123 */
122static DECLARE_BITMAP(translation_disabled, MAX_NUMNODES * MAX_PHB_BUS_NUM); 124static DECLARE_BITMAP(translation_disabled, MAX_PHB_BUS_NUM);
123 125
124static void tce_cache_blast(struct iommu_table *tbl); 126static void tce_cache_blast(struct iommu_table *tbl);
125 127
@@ -452,7 +454,7 @@ static struct dma_mapping_ops calgary_dma_ops = {
452 454
453static inline int busno_to_phbid(unsigned char num) 455static inline int busno_to_phbid(unsigned char num)
454{ 456{
455 return bus_to_phb(num) % PHBS_PER_CALGARY; 457 return bus_to_phb[num];
456} 458}
457 459
458static inline unsigned long split_queue_offset(unsigned char num) 460static inline unsigned long split_queue_offset(unsigned char num)
@@ -812,7 +814,7 @@ static int __init calgary_init(void)
812 int i, ret = -ENODEV; 814 int i, ret = -ENODEV;
813 struct pci_dev *dev = NULL; 815 struct pci_dev *dev = NULL;
814 816
815 for (i = 0; i <= num_online_nodes() * MAX_NUM_OF_PHBS; i++) { 817 for (i = 0; i < MAX_PHB_BUS_NUM; i++) {
816 dev = pci_get_device(PCI_VENDOR_ID_IBM, 818 dev = pci_get_device(PCI_VENDOR_ID_IBM,
817 PCI_DEVICE_ID_IBM_CALGARY, 819 PCI_DEVICE_ID_IBM_CALGARY,
818 dev); 820 dev);
@@ -822,7 +824,7 @@ static int __init calgary_init(void)
822 calgary_init_one_nontraslated(dev); 824 calgary_init_one_nontraslated(dev);
823 continue; 825 continue;
824 } 826 }
825 if (!tce_table_kva[i] && !translate_empty_slots) { 827 if (!tce_table_kva[dev->bus->number] && !translate_empty_slots) {
826 pci_dev_put(dev); 828 pci_dev_put(dev);
827 continue; 829 continue;
828 } 830 }
@@ -842,7 +844,7 @@ error:
842 pci_dev_put(dev); 844 pci_dev_put(dev);
843 continue; 845 continue;
844 } 846 }
845 if (!tce_table_kva[i] && !translate_empty_slots) 847 if (!tce_table_kva[dev->bus->number] && !translate_empty_slots)
846 continue; 848 continue;
847 calgary_disable_translation(dev); 849 calgary_disable_translation(dev);
848 calgary_free_tar(dev); 850 calgary_free_tar(dev);
@@ -876,9 +878,10 @@ static inline int __init determine_tce_table_size(u64 ram)
876void __init detect_calgary(void) 878void __init detect_calgary(void)
877{ 879{
878 u32 val; 880 u32 val;
879 int bus, table_idx; 881 int bus;
880 void *tbl; 882 void *tbl;
881 int detected = 0; 883 int calgary_found = 0;
884 int phb = -1;
882 885
883 /* 886 /*
884 * if the user specified iommu=off or iommu=soft or we found 887 * if the user specified iommu=off or iommu=soft or we found
@@ -889,38 +892,46 @@ void __init detect_calgary(void)
889 892
890 specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE); 893 specified_table_size = determine_tce_table_size(end_pfn * PAGE_SIZE);
891 894
892 for (bus = 0, table_idx = 0; 895 for (bus = 0; bus < MAX_PHB_BUS_NUM; bus++) {
893 bus <= num_online_nodes() * MAX_PHB_BUS_NUM; 896 int dev;
894 bus++) { 897
895 BUG_ON(bus > MAX_NUMNODES * MAX_PHB_BUS_NUM); 898 tce_table_kva[bus] = NULL;
899 bus_to_phb[bus] = -1;
900
896 if (read_pci_config(bus, 0, 0, 0) != PCI_VENDOR_DEVICE_ID_CALGARY) 901 if (read_pci_config(bus, 0, 0, 0) != PCI_VENDOR_DEVICE_ID_CALGARY)
897 continue; 902 continue;
903
904 /*
905 * There are 4 PHBs per Calgary chip. Set phb to which phb (0-3)
906 * it is connected to releative to the clagary chip.
907 */
908 phb = (phb + 1) % PHBS_PER_CALGARY;
909
898 if (test_bit(bus, translation_disabled)) { 910 if (test_bit(bus, translation_disabled)) {
899 printk(KERN_INFO "Calgary: translation is disabled for " 911 printk(KERN_INFO "Calgary: translation is disabled for "
900 "PHB 0x%x\n", bus); 912 "PHB 0x%x\n", bus);
901 /* skip this phb, don't allocate a tbl for it */ 913 /* skip this phb, don't allocate a tbl for it */
902 tce_table_kva[table_idx] = NULL;
903 table_idx++;
904 continue; 914 continue;
905 } 915 }
906 /* 916 /*
907 * scan the first slot of the PCI bus to see if there 917 * Scan the slots of the PCI bus to see if there is a device present.
908 * are any devices present 918 * The parent bus will be the zero-ith device, so start at 1.
909 */ 919 */
910 val = read_pci_config(bus, 1, 0, 0); 920 for (dev = 1; dev < 8; dev++) {
911 if (val != 0xffffffff || translate_empty_slots) { 921 val = read_pci_config(bus, dev, 0, 0);
912 tbl = alloc_tce_table(); 922 if (val != 0xffffffff || translate_empty_slots) {
913 if (!tbl) 923 tbl = alloc_tce_table();
914 goto cleanup; 924 if (!tbl)
915 detected = 1; 925 goto cleanup;
916 } else 926 tce_table_kva[bus] = tbl;
917 tbl = NULL; 927 bus_to_phb[bus] = phb;
918 928 calgary_found = 1;
919 tce_table_kva[table_idx] = tbl; 929 break;
920 table_idx++; 930 }
931 }
921 } 932 }
922 933
923 if (detected) { 934 if (calgary_found) {
924 iommu_detected = 1; 935 iommu_detected = 1;
925 calgary_detected = 1; 936 calgary_detected = 1;
926 printk(KERN_INFO "PCI-DMA: Calgary IOMMU detected. " 937 printk(KERN_INFO "PCI-DMA: Calgary IOMMU detected. "
@@ -929,9 +940,9 @@ void __init detect_calgary(void)
929 return; 940 return;
930 941
931cleanup: 942cleanup:
932 for (--table_idx; table_idx >= 0; --table_idx) 943 for (--bus; bus >= 0; --bus)
933 if (tce_table_kva[table_idx]) 944 if (tce_table_kva[bus])
934 free_tce_table(tce_table_kva[table_idx]); 945 free_tce_table(tce_table_kva[bus]);
935} 946}
936 947
937int __init calgary_iommu_init(void) 948int __init calgary_iommu_init(void)
@@ -1002,7 +1013,7 @@ static int __init calgary_parse_options(char *p)
1002 if (p == endp) 1013 if (p == endp)
1003 break; 1014 break;
1004 1015
1005 if (bridge <= (num_online_nodes() * MAX_PHB_BUS_NUM)) { 1016 if (bridge < MAX_PHB_BUS_NUM) {
1006 printk(KERN_INFO "Calgary: disabling " 1017 printk(KERN_INFO "Calgary: disabling "
1007 "translation for PHB 0x%x\n", bridge); 1018 "translation for PHB 0x%x\n", bridge);
1008 set_bit(bridge, translation_disabled); 1019 set_bit(bridge, translation_disabled);
diff --git a/arch/x86_64/kernel/pci-nommu.c b/arch/x86_64/kernel/pci-nommu.c
index c4c3cc36ac5b..aad7609d8e92 100644
--- a/arch/x86_64/kernel/pci-nommu.c
+++ b/arch/x86_64/kernel/pci-nommu.c
@@ -92,5 +92,7 @@ void __init no_iommu_init(void)
92{ 92{
93 if (dma_ops) 93 if (dma_ops)
94 return; 94 return;
95
96 force_iommu = 0; /* no HW IOMMU */
95 dma_ops = &nommu_dma_ops; 97 dma_ops = &nommu_dma_ops;
96} 98}
diff --git a/arch/x86_64/kernel/pci-swiotlb.c b/arch/x86_64/kernel/pci-swiotlb.c
index ebdb77fe2057..6a55f87ba97f 100644
--- a/arch/x86_64/kernel/pci-swiotlb.c
+++ b/arch/x86_64/kernel/pci-swiotlb.c
@@ -31,9 +31,10 @@ struct dma_mapping_ops swiotlb_dma_ops = {
31void pci_swiotlb_init(void) 31void pci_swiotlb_init(void)
32{ 32{
33 /* don't initialize swiotlb if iommu=off (no_iommu=1) */ 33 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
34 if (!iommu_detected && !no_iommu && 34 if (!iommu_detected && !no_iommu && end_pfn > MAX_DMA32_PFN)
35 (end_pfn > MAX_DMA32_PFN || force_iommu))
36 swiotlb = 1; 35 swiotlb = 1;
36 if (swiotlb_force)
37 swiotlb = 1;
37 if (swiotlb) { 38 if (swiotlb) {
38 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n"); 39 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
39 swiotlb_init(); 40 swiotlb_init();
diff --git a/arch/x86_64/kernel/tce.c b/arch/x86_64/kernel/tce.c
index d3a9e79e954c..5530dda3f27a 100644
--- a/arch/x86_64/kernel/tce.c
+++ b/arch/x86_64/kernel/tce.c
@@ -96,7 +96,6 @@ static inline unsigned int table_size_to_number_of_entries(unsigned char size)
96static int tce_table_setparms(struct pci_dev *dev, struct iommu_table *tbl) 96static int tce_table_setparms(struct pci_dev *dev, struct iommu_table *tbl)
97{ 97{
98 unsigned int bitmapsz; 98 unsigned int bitmapsz;
99 unsigned int tce_table_index;
100 unsigned long bmppages; 99 unsigned long bmppages;
101 int ret; 100 int ret;
102 101
@@ -105,8 +104,7 @@ static int tce_table_setparms(struct pci_dev *dev, struct iommu_table *tbl)
105 /* set the tce table size - measured in entries */ 104 /* set the tce table size - measured in entries */
106 tbl->it_size = table_size_to_number_of_entries(specified_table_size); 105 tbl->it_size = table_size_to_number_of_entries(specified_table_size);
107 106
108 tce_table_index = bus_to_phb(tbl->it_busno); 107 tbl->it_base = (unsigned long)tce_table_kva[dev->bus->number];
109 tbl->it_base = (unsigned long)tce_table_kva[tce_table_index];
110 if (!tbl->it_base) { 108 if (!tbl->it_base) {
111 printk(KERN_ERR "Calgary: iommu_table_setparms: " 109 printk(KERN_ERR "Calgary: iommu_table_setparms: "
112 "no table allocated?!\n"); 110 "no table allocated?!\n");
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index e0341c6808e5..7a9b18224182 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -28,6 +28,7 @@
28#include <linux/acpi.h> 28#include <linux/acpi.h>
29#ifdef CONFIG_ACPI 29#ifdef CONFIG_ACPI
30#include <acpi/achware.h> /* for PM timer frequency */ 30#include <acpi/achware.h> /* for PM timer frequency */
31#include <acpi/acpi_bus.h>
31#endif 32#endif
32#include <asm/8253pit.h> 33#include <asm/8253pit.h>
33#include <asm/pgtable.h> 34#include <asm/pgtable.h>
@@ -953,11 +954,18 @@ __cpuinit int unsynchronized_tsc(void)
953#ifdef CONFIG_SMP 954#ifdef CONFIG_SMP
954 if (apic_is_clustered_box()) 955 if (apic_is_clustered_box())
955 return 1; 956 return 1;
956 /* Intel systems are normally all synchronized. Exceptions
957 are handled in the check above. */
958 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
959 return 0;
960#endif 957#endif
958 /* Most intel systems have synchronized TSCs except for
959 multi node systems */
960 if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
961#ifdef CONFIG_ACPI
962 /* But TSC doesn't tick in C3 so don't use it there */
963 if (acpi_fadt.length > 0 && acpi_fadt.plvl3_lat < 100)
964 return 1;
965#endif
966 return 0;
967 }
968
961 /* Assume multi socket systems are not synchronized */ 969 /* Assume multi socket systems are not synchronized */
962 return num_present_cpus() > 1; 970 return num_present_cpus() > 1;
963} 971}
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index f7a9d1421078..4e9938dee060 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -529,7 +529,7 @@ void __kprobes oops_end(unsigned long flags)
529 /* Nest count reaches zero, release the lock. */ 529 /* Nest count reaches zero, release the lock. */
530 spin_unlock_irqrestore(&die_lock, flags); 530 spin_unlock_irqrestore(&die_lock, flags);
531 if (panic_on_oops) 531 if (panic_on_oops)
532 panic("Oops"); 532 panic("Fatal exception: panic_on_oops");
533} 533}
534 534
535void __kprobes __die(const char * str, struct pt_regs * regs, long err) 535void __kprobes __die(const char * str, struct pt_regs * regs, long err)
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c
index b50a7c7c47f8..3acf60ded2a0 100644
--- a/arch/x86_64/pci/k8-bus.c
+++ b/arch/x86_64/pci/k8-bus.c
@@ -2,7 +2,6 @@
2#include <linux/pci.h> 2#include <linux/pci.h>
3#include <asm/mpspec.h> 3#include <asm/mpspec.h>
4#include <linux/cpumask.h> 4#include <linux/cpumask.h>
5#include <asm/k8.h>
6 5
7/* 6/*
8 * This discovers the pcibus <-> node mapping on AMD K8. 7 * This discovers the pcibus <-> node mapping on AMD K8.
@@ -19,6 +18,7 @@
19#define NR_LDT_BUS_NUMBER_REGISTERS 3 18#define NR_LDT_BUS_NUMBER_REGISTERS 3
20#define SECONDARY_LDT_BUS_NUMBER(dword) ((dword >> 8) & 0xFF) 19#define SECONDARY_LDT_BUS_NUMBER(dword) ((dword >> 8) & 0xFF)
21#define SUBORDINATE_LDT_BUS_NUMBER(dword) ((dword >> 16) & 0xFF) 20#define SUBORDINATE_LDT_BUS_NUMBER(dword) ((dword >> 16) & 0xFF)
21#define PCI_DEVICE_ID_K8HTCONFIG 0x1100
22 22
23/** 23/**
24 * fill_mp_bus_to_cpumask() 24 * fill_mp_bus_to_cpumask()
@@ -28,7 +28,8 @@
28__init static int 28__init static int
29fill_mp_bus_to_cpumask(void) 29fill_mp_bus_to_cpumask(void)
30{ 30{
31 int i, j, k; 31 struct pci_dev *nb_dev = NULL;
32 int i, j;
32 u32 ldtbus, nid; 33 u32 ldtbus, nid;
33 static int lbnr[3] = { 34 static int lbnr[3] = {
34 LDT_BUS_NUMBER_REGISTER_0, 35 LDT_BUS_NUMBER_REGISTER_0,
@@ -36,9 +37,8 @@ fill_mp_bus_to_cpumask(void)
36 LDT_BUS_NUMBER_REGISTER_2 37 LDT_BUS_NUMBER_REGISTER_2
37 }; 38 };
38 39
39 cache_k8_northbridges(); 40 while ((nb_dev = pci_get_device(PCI_VENDOR_ID_AMD,
40 for (k = 0; k < num_k8_northbridges; k++) { 41 PCI_DEVICE_ID_K8HTCONFIG, nb_dev))) {
41 struct pci_dev *nb_dev = k8_northbridges[k];
42 pci_read_config_dword(nb_dev, NODE_ID_REGISTER, &nid); 42 pci_read_config_dword(nb_dev, NODE_ID_REGISTER, &nid);
43 43
44 for (i = 0; i < NR_LDT_BUS_NUMBER_REGISTERS; i++) { 44 for (i = 0; i < NR_LDT_BUS_NUMBER_REGISTERS; i++) {
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 27e409089a7b..9734960a2451 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -487,11 +487,9 @@ void die(const char * str, struct pt_regs * regs, long err)
487 if (in_interrupt()) 487 if (in_interrupt())
488 panic("Fatal exception in interrupt"); 488 panic("Fatal exception in interrupt");
489 489
490 if (panic_on_oops) { 490 if (panic_on_oops)
491 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 491 panic("Fatal exception: panic_on_oops");
492 ssleep(5); 492
493 panic("Fatal exception");
494 }
495 do_exit(err); 493 do_exit(err);
496} 494}
497 495
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index c2d621632383..3ef9d514b916 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -139,7 +139,7 @@ static int __cpuinit topology_sysfs_init(void)
139 (void *)(long)i); 139 (void *)(long)i);
140 } 140 }
141 141
142 register_cpu_notifier(&topology_cpu_notifier); 142 register_hotcpu_notifier(&topology_cpu_notifier);
143 143
144 return 0; 144 return 0;
145} 145}
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 0a1b1ea36ddc..bdbade9a5cf5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -300,6 +300,15 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
300 lo->disk->disk_name, result); 300 lo->disk->disk_name, result);
301 goto harderror; 301 goto harderror;
302 } 302 }
303
304 if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
305 printk(KERN_ERR "%s: Wrong magic (0x%lx)\n",
306 lo->disk->disk_name,
307 (unsigned long)ntohl(reply.magic));
308 result = -EPROTO;
309 goto harderror;
310 }
311
303 req = nbd_find_request(lo, reply.handle); 312 req = nbd_find_request(lo, reply.handle);
304 if (unlikely(IS_ERR(req))) { 313 if (unlikely(IS_ERR(req))) {
305 result = PTR_ERR(req); 314 result = PTR_ERR(req);
@@ -312,13 +321,6 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
312 goto harderror; 321 goto harderror;
313 } 322 }
314 323
315 if (ntohl(reply.magic) != NBD_REPLY_MAGIC) {
316 printk(KERN_ERR "%s: Wrong magic (0x%lx)\n",
317 lo->disk->disk_name,
318 (unsigned long)ntohl(reply.magic));
319 result = -EPROTO;
320 goto harderror;
321 }
322 if (ntohl(reply.error)) { 324 if (ntohl(reply.error)) {
323 printk(KERN_ERR "%s: Other side returned error (%d)\n", 325 printk(KERN_ERR "%s: Other side returned error (%d)\n",
324 lo->disk->disk_name, ntohl(reply.error)); 326 lo->disk->disk_name, ntohl(reply.error));
@@ -339,7 +341,8 @@ static struct request *nbd_read_stat(struct nbd_device *lo)
339 printk(KERN_ERR "%s: Receive data failed (result %d)\n", 341 printk(KERN_ERR "%s: Receive data failed (result %d)\n",
340 lo->disk->disk_name, 342 lo->disk->disk_name,
341 result); 343 result);
342 goto harderror; 344 req->errors++;
345 return req;
343 } 346 }
344 dprintk(DBG_RX, "%s: request %p: got %d bytes data\n", 347 dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
345 lo->disk->disk_name, req, bvec->bv_len); 348 lo->disk->disk_name, req, bvec->bv_len);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index bde2c64b6346..451b996bba91 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2577,19 +2577,19 @@ static int pkt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cm
2577 case PKT_CTRL_CMD_SETUP: 2577 case PKT_CTRL_CMD_SETUP:
2578 if (!capable(CAP_SYS_ADMIN)) 2578 if (!capable(CAP_SYS_ADMIN))
2579 return -EPERM; 2579 return -EPERM;
2580 mutex_lock(&ctl_mutex); 2580 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2581 ret = pkt_setup_dev(&ctrl_cmd); 2581 ret = pkt_setup_dev(&ctrl_cmd);
2582 mutex_unlock(&ctl_mutex); 2582 mutex_unlock(&ctl_mutex);
2583 break; 2583 break;
2584 case PKT_CTRL_CMD_TEARDOWN: 2584 case PKT_CTRL_CMD_TEARDOWN:
2585 if (!capable(CAP_SYS_ADMIN)) 2585 if (!capable(CAP_SYS_ADMIN))
2586 return -EPERM; 2586 return -EPERM;
2587 mutex_lock(&ctl_mutex); 2587 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2588 ret = pkt_remove_dev(&ctrl_cmd); 2588 ret = pkt_remove_dev(&ctrl_cmd);
2589 mutex_unlock(&ctl_mutex); 2589 mutex_unlock(&ctl_mutex);
2590 break; 2590 break;
2591 case PKT_CTRL_CMD_STATUS: 2591 case PKT_CTRL_CMD_STATUS:
2592 mutex_lock(&ctl_mutex); 2592 mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
2593 pkt_get_status(&ctrl_cmd); 2593 pkt_get_status(&ctrl_cmd);
2594 mutex_unlock(&ctl_mutex); 2594 mutex_unlock(&ctl_mutex);
2595 break; 2595 break;
diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c
index be61f22ee7bb..d37ced0d132b 100644
--- a/drivers/char/hw_random/geode-rng.c
+++ b/drivers/char/hw_random/geode-rng.c
@@ -107,10 +107,14 @@ found:
107 if (err) { 107 if (err) {
108 printk(KERN_ERR PFX "RNG registering failed (%d)\n", 108 printk(KERN_ERR PFX "RNG registering failed (%d)\n",
109 err); 109 err);
110 goto out; 110 goto err_unmap;
111 } 111 }
112out: 112out:
113 return err; 113 return err;
114
115err_unmap:
116 iounmap(mem);
117 goto out;
114} 118}
115 119
116static void __exit mod_exit(void) 120static void __exit mod_exit(void)
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c
index 6594bd5645f4..ccd7e7102234 100644
--- a/drivers/char/hw_random/intel-rng.c
+++ b/drivers/char/hw_random/intel-rng.c
@@ -164,7 +164,7 @@ static int __init mod_init(void)
164 if (err) { 164 if (err) {
165 printk(KERN_ERR PFX "RNG registering failed (%d)\n", 165 printk(KERN_ERR PFX "RNG registering failed (%d)\n",
166 err); 166 err);
167 goto out; 167 goto err_unmap;
168 } 168 }
169out: 169out:
170 return err; 170 return err;
diff --git a/drivers/char/pc8736x_gpio.c b/drivers/char/pc8736x_gpio.c
index 645eb81cb5a9..84e5a68635f1 100644
--- a/drivers/char/pc8736x_gpio.c
+++ b/drivers/char/pc8736x_gpio.c
@@ -221,7 +221,6 @@ static struct nsc_gpio_ops pc8736x_gpio_ops = {
221 .gpio_change = pc8736x_gpio_change, 221 .gpio_change = pc8736x_gpio_change,
222 .gpio_current = pc8736x_gpio_current 222 .gpio_current = pc8736x_gpio_current
223}; 223};
224EXPORT_SYMBOL(pc8736x_gpio_ops);
225 224
226static int pc8736x_gpio_open(struct inode *inode, struct file *file) 225static int pc8736x_gpio_open(struct inode *inode, struct file *file)
227{ 226{
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 498aa37bca22..3ece69231343 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -51,6 +51,7 @@ void proc_fork_connector(struct task_struct *task)
51 struct cn_msg *msg; 51 struct cn_msg *msg;
52 struct proc_event *ev; 52 struct proc_event *ev;
53 __u8 buffer[CN_PROC_MSG_SIZE]; 53 __u8 buffer[CN_PROC_MSG_SIZE];
54 struct timespec ts;
54 55
55 if (atomic_read(&proc_event_num_listeners) < 1) 56 if (atomic_read(&proc_event_num_listeners) < 1)
56 return; 57 return;
@@ -58,7 +59,8 @@ void proc_fork_connector(struct task_struct *task)
58 msg = (struct cn_msg*)buffer; 59 msg = (struct cn_msg*)buffer;
59 ev = (struct proc_event*)msg->data; 60 ev = (struct proc_event*)msg->data;
60 get_seq(&msg->seq, &ev->cpu); 61 get_seq(&msg->seq, &ev->cpu);
61 ktime_get_ts(&ev->timestamp); /* get high res monotonic timestamp */ 62 ktime_get_ts(&ts); /* get high res monotonic timestamp */
63 ev->timestamp_ns = timespec_to_ns(&ts);
62 ev->what = PROC_EVENT_FORK; 64 ev->what = PROC_EVENT_FORK;
63 ev->event_data.fork.parent_pid = task->real_parent->pid; 65 ev->event_data.fork.parent_pid = task->real_parent->pid;
64 ev->event_data.fork.parent_tgid = task->real_parent->tgid; 66 ev->event_data.fork.parent_tgid = task->real_parent->tgid;
@@ -76,6 +78,7 @@ void proc_exec_connector(struct task_struct *task)
76{ 78{
77 struct cn_msg *msg; 79 struct cn_msg *msg;
78 struct proc_event *ev; 80 struct proc_event *ev;
81 struct timespec ts;
79 __u8 buffer[CN_PROC_MSG_SIZE]; 82 __u8 buffer[CN_PROC_MSG_SIZE];
80 83
81 if (atomic_read(&proc_event_num_listeners) < 1) 84 if (atomic_read(&proc_event_num_listeners) < 1)
@@ -84,7 +87,8 @@ void proc_exec_connector(struct task_struct *task)
84 msg = (struct cn_msg*)buffer; 87 msg = (struct cn_msg*)buffer;
85 ev = (struct proc_event*)msg->data; 88 ev = (struct proc_event*)msg->data;
86 get_seq(&msg->seq, &ev->cpu); 89 get_seq(&msg->seq, &ev->cpu);
87 ktime_get_ts(&ev->timestamp); 90 ktime_get_ts(&ts); /* get high res monotonic timestamp */
91 ev->timestamp_ns = timespec_to_ns(&ts);
88 ev->what = PROC_EVENT_EXEC; 92 ev->what = PROC_EVENT_EXEC;
89 ev->event_data.exec.process_pid = task->pid; 93 ev->event_data.exec.process_pid = task->pid;
90 ev->event_data.exec.process_tgid = task->tgid; 94 ev->event_data.exec.process_tgid = task->tgid;
@@ -100,6 +104,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
100 struct cn_msg *msg; 104 struct cn_msg *msg;
101 struct proc_event *ev; 105 struct proc_event *ev;
102 __u8 buffer[CN_PROC_MSG_SIZE]; 106 __u8 buffer[CN_PROC_MSG_SIZE];
107 struct timespec ts;
103 108
104 if (atomic_read(&proc_event_num_listeners) < 1) 109 if (atomic_read(&proc_event_num_listeners) < 1)
105 return; 110 return;
@@ -118,7 +123,8 @@ void proc_id_connector(struct task_struct *task, int which_id)
118 } else 123 } else
119 return; 124 return;
120 get_seq(&msg->seq, &ev->cpu); 125 get_seq(&msg->seq, &ev->cpu);
121 ktime_get_ts(&ev->timestamp); 126 ktime_get_ts(&ts); /* get high res monotonic timestamp */
127 ev->timestamp_ns = timespec_to_ns(&ts);
122 128
123 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 129 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
124 msg->ack = 0; /* not used */ 130 msg->ack = 0; /* not used */
@@ -131,6 +137,7 @@ void proc_exit_connector(struct task_struct *task)
131 struct cn_msg *msg; 137 struct cn_msg *msg;
132 struct proc_event *ev; 138 struct proc_event *ev;
133 __u8 buffer[CN_PROC_MSG_SIZE]; 139 __u8 buffer[CN_PROC_MSG_SIZE];
140 struct timespec ts;
134 141
135 if (atomic_read(&proc_event_num_listeners) < 1) 142 if (atomic_read(&proc_event_num_listeners) < 1)
136 return; 143 return;
@@ -138,7 +145,8 @@ void proc_exit_connector(struct task_struct *task)
138 msg = (struct cn_msg*)buffer; 145 msg = (struct cn_msg*)buffer;
139 ev = (struct proc_event*)msg->data; 146 ev = (struct proc_event*)msg->data;
140 get_seq(&msg->seq, &ev->cpu); 147 get_seq(&msg->seq, &ev->cpu);
141 ktime_get_ts(&ev->timestamp); 148 ktime_get_ts(&ts); /* get high res monotonic timestamp */
149 ev->timestamp_ns = timespec_to_ns(&ts);
142 ev->what = PROC_EVENT_EXIT; 150 ev->what = PROC_EVENT_EXIT;
143 ev->event_data.exit.process_pid = task->pid; 151 ev->event_data.exit.process_pid = task->pid;
144 ev->event_data.exit.process_tgid = task->tgid; 152 ev->event_data.exit.process_tgid = task->tgid;
@@ -164,6 +172,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
164 struct cn_msg *msg; 172 struct cn_msg *msg;
165 struct proc_event *ev; 173 struct proc_event *ev;
166 __u8 buffer[CN_PROC_MSG_SIZE]; 174 __u8 buffer[CN_PROC_MSG_SIZE];
175 struct timespec ts;
167 176
168 if (atomic_read(&proc_event_num_listeners) < 1) 177 if (atomic_read(&proc_event_num_listeners) < 1)
169 return; 178 return;
@@ -171,7 +180,8 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
171 msg = (struct cn_msg*)buffer; 180 msg = (struct cn_msg*)buffer;
172 ev = (struct proc_event*)msg->data; 181 ev = (struct proc_event*)msg->data;
173 msg->seq = rcvd_seq; 182 msg->seq = rcvd_seq;
174 ktime_get_ts(&ev->timestamp); 183 ktime_get_ts(&ts); /* get high res monotonic timestamp */
184 ev->timestamp_ns = timespec_to_ns(&ts);
175 ev->cpu = -1; 185 ev->cpu = -1;
176 ev->what = PROC_EVENT_NONE; 186 ev->what = PROC_EVENT_NONE;
177 ev->event_data.ack.err = err; 187 ev->event_data.ack.err = err;
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index d1266fe2d1ab..b6fb167e20f6 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -682,6 +682,7 @@ config BLK_DEV_SVWKS
682config BLK_DEV_SGIIOC4 682config BLK_DEV_SGIIOC4
683 tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support" 683 tristate "Silicon Graphics IOC4 chipset ATA/ATAPI support"
684 depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4 684 depends on (IA64_SGI_SN2 || IA64_GENERIC) && SGI_IOC4
685 select IDEPCI_SHARE_IRQ
685 help 686 help
686 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4 687 This driver adds PIO & MultiMode DMA-2 support for the SGI IOC4
687 chipset, which has one channel and can support two devices. 688 chipset, which has one channel and can support two devices.
@@ -773,20 +774,6 @@ config BLK_DEV_IDEDMA_PMAC
773 to transfer data to and from memory. Saying Y is safe and improves 774 to transfer data to and from memory. Saying Y is safe and improves
774 performance. 775 performance.
775 776
776config BLK_DEV_IDE_PMAC_BLINK
777 bool "Blink laptop LED on drive activity (DEPRECATED)"
778 depends on BLK_DEV_IDE_PMAC && ADB_PMU
779 select ADB_PMU_LED
780 select LEDS_TRIGGERS
781 select LEDS_TRIGGER_IDE_DISK
782 help
783 This option enables the use of the sleep LED as a hard drive
784 activity LED.
785 This option is deprecated, it only selects ADB_PMU_LED and
786 LEDS_TRIGGER_IDE_DISK and changes the code in the new led class
787 device to default to the ide-disk trigger (which should be set
788 from userspace via sysfs).
789
790config BLK_DEV_IDE_SWARM 777config BLK_DEV_IDE_SWARM
791 tristate "IDE for Sibyte evaluation boards" 778 tristate "IDE for Sibyte evaluation boards"
792 depends on SIBYTE_SB1xxx_SOC 779 depends on SIBYTE_SB1xxx_SOC
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 657165297dc7..77703acaec17 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -23,6 +23,7 @@
23#include <linux/hdreg.h> 23#include <linux/hdreg.h>
24#include <linux/ide.h> 24#include <linux/ide.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/nmi.h>
26 27
27#include <asm/byteorder.h> 28#include <asm/byteorder.h>
28#include <asm/irq.h> 29#include <asm/irq.h>
@@ -1243,6 +1244,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout)
1243 if (stat == 0xff) 1244 if (stat == 0xff)
1244 return -ENODEV; 1245 return -ENODEV;
1245 touch_softlockup_watchdog(); 1246 touch_softlockup_watchdog();
1247 touch_nmi_watchdog();
1246 } 1248 }
1247 return -EBUSY; 1249 return -EBUSY;
1248} 1250}
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index d294bbc42f09..1205e8027829 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -35,6 +35,7 @@
35#include <net/arp.h> 35#include <net/arp.h>
36#include <net/neighbour.h> 36#include <net/neighbour.h>
37#include <net/route.h> 37#include <net/route.h>
38#include <net/netevent.h>
38#include <rdma/ib_addr.h> 39#include <rdma/ib_addr.h>
39 40
40MODULE_AUTHOR("Sean Hefty"); 41MODULE_AUTHOR("Sean Hefty");
@@ -326,25 +327,22 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr)
326} 327}
327EXPORT_SYMBOL(rdma_addr_cancel); 328EXPORT_SYMBOL(rdma_addr_cancel);
328 329
329static int addr_arp_recv(struct sk_buff *skb, struct net_device *dev, 330static int netevent_callback(struct notifier_block *self, unsigned long event,
330 struct packet_type *pkt, struct net_device *orig_dev) 331 void *ctx)
331{ 332{
332 struct arphdr *arp_hdr; 333 if (event == NETEVENT_NEIGH_UPDATE) {
334 struct neighbour *neigh = ctx;
333 335
334 arp_hdr = (struct arphdr *) skb->nh.raw; 336 if (neigh->dev->type == ARPHRD_INFINIBAND &&
335 337 (neigh->nud_state & NUD_VALID)) {
336 if (arp_hdr->ar_op == htons(ARPOP_REQUEST) || 338 set_timeout(jiffies);
337 arp_hdr->ar_op == htons(ARPOP_REPLY)) 339 }
338 set_timeout(jiffies); 340 }
339
340 kfree_skb(skb);
341 return 0; 341 return 0;
342} 342}
343 343
344static struct packet_type addr_arp = { 344static struct notifier_block nb = {
345 .type = __constant_htons(ETH_P_ARP), 345 .notifier_call = netevent_callback
346 .func = addr_arp_recv,
347 .af_packet_priv = (void*) 1,
348}; 346};
349 347
350static int addr_init(void) 348static int addr_init(void)
@@ -353,13 +351,13 @@ static int addr_init(void)
353 if (!addr_wq) 351 if (!addr_wq)
354 return -ENOMEM; 352 return -ENOMEM;
355 353
356 dev_add_pack(&addr_arp); 354 register_netevent_notifier(&nb);
357 return 0; 355 return 0;
358} 356}
359 357
360static void addr_cleanup(void) 358static void addr_cleanup(void)
361{ 359{
362 dev_remove_pack(&addr_arp); 360 unregister_netevent_notifier(&nb);
363 destroy_workqueue(addr_wq); 361 destroy_workqueue(addr_wq);
364} 362}
365 363
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index f85c97f7500a..0de335b7bfc2 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -975,8 +975,10 @@ int ib_send_cm_req(struct ib_cm_id *cm_id,
975 975
976 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> 976 cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
977 id.local_id); 977 id.local_id);
978 if (IS_ERR(cm_id_priv->timewait_info)) 978 if (IS_ERR(cm_id_priv->timewait_info)) {
979 ret = PTR_ERR(cm_id_priv->timewait_info);
979 goto out; 980 goto out;
981 }
980 982
981 ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av); 983 ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av);
982 if (ret) 984 if (ret)
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index bb9bee56a824..102a59c033ff 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -42,6 +42,7 @@
42#include <linux/kref.h> 42#include <linux/kref.h>
43#include <linux/idr.h> 43#include <linux/idr.h>
44#include <linux/mutex.h> 44#include <linux/mutex.h>
45#include <linux/completion.h>
45 46
46#include <rdma/ib_verbs.h> 47#include <rdma/ib_verbs.h>
47#include <rdma/ib_user_verbs.h> 48#include <rdma/ib_user_verbs.h>
@@ -69,6 +70,7 @@
69 70
70struct ib_uverbs_device { 71struct ib_uverbs_device {
71 struct kref ref; 72 struct kref ref;
73 struct completion comp;
72 int devnum; 74 int devnum;
73 struct cdev *dev; 75 struct cdev *dev;
74 struct class_device *class_dev; 76 struct class_device *class_dev;
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index e725cccc7cde..4e16314e8e6d 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -122,7 +122,7 @@ static void ib_uverbs_release_dev(struct kref *ref)
122 struct ib_uverbs_device *dev = 122 struct ib_uverbs_device *dev =
123 container_of(ref, struct ib_uverbs_device, ref); 123 container_of(ref, struct ib_uverbs_device, ref);
124 124
125 kfree(dev); 125 complete(&dev->comp);
126} 126}
127 127
128void ib_uverbs_release_ucq(struct ib_uverbs_file *file, 128void ib_uverbs_release_ucq(struct ib_uverbs_file *file,
@@ -740,6 +740,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
740 return; 740 return;
741 741
742 kref_init(&uverbs_dev->ref); 742 kref_init(&uverbs_dev->ref);
743 init_completion(&uverbs_dev->comp);
743 744
744 spin_lock(&map_lock); 745 spin_lock(&map_lock);
745 uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); 746 uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);
@@ -793,6 +794,8 @@ err_cdev:
793 794
794err: 795err:
795 kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); 796 kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
797 wait_for_completion(&uverbs_dev->comp);
798 kfree(uverbs_dev);
796 return; 799 return;
797} 800}
798 801
@@ -812,7 +815,10 @@ static void ib_uverbs_remove_one(struct ib_device *device)
812 spin_unlock(&map_lock); 815 spin_unlock(&map_lock);
813 816
814 clear_bit(uverbs_dev->devnum, dev_map); 817 clear_bit(uverbs_dev->devnum, dev_map);
818
815 kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); 819 kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
820 wait_for_completion(&uverbs_dev->comp);
821 kfree(uverbs_dev);
816} 822}
817 823
818static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags, 824static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags,
diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c
index 9ba3211cef7c..25157f57a6d0 100644
--- a/drivers/infiniband/hw/mthca/mthca_allocator.c
+++ b/drivers/infiniband/hw/mthca/mthca_allocator.c
@@ -108,14 +108,15 @@ void mthca_alloc_cleanup(struct mthca_alloc *alloc)
108 * serialize access to the array. 108 * serialize access to the array.
109 */ 109 */
110 110
111#define MTHCA_ARRAY_MASK (PAGE_SIZE / sizeof (void *) - 1)
112
111void *mthca_array_get(struct mthca_array *array, int index) 113void *mthca_array_get(struct mthca_array *array, int index)
112{ 114{
113 int p = (index * sizeof (void *)) >> PAGE_SHIFT; 115 int p = (index * sizeof (void *)) >> PAGE_SHIFT;
114 116
115 if (array->page_list[p].page) { 117 if (array->page_list[p].page)
116 int i = index & (PAGE_SIZE / sizeof (void *) - 1); 118 return array->page_list[p].page[index & MTHCA_ARRAY_MASK];
117 return array->page_list[p].page[i]; 119 else
118 } else
119 return NULL; 120 return NULL;
120} 121}
121 122
@@ -130,8 +131,7 @@ int mthca_array_set(struct mthca_array *array, int index, void *value)
130 if (!array->page_list[p].page) 131 if (!array->page_list[p].page)
131 return -ENOMEM; 132 return -ENOMEM;
132 133
133 array->page_list[p].page[index & (PAGE_SIZE / sizeof (void *) - 1)] = 134 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value;
134 value;
135 ++array->page_list[p].used; 135 ++array->page_list[p].used;
136 136
137 return 0; 137 return 0;
@@ -144,7 +144,8 @@ void mthca_array_clear(struct mthca_array *array, int index)
144 if (--array->page_list[p].used == 0) { 144 if (--array->page_list[p].used == 0) {
145 free_page((unsigned long) array->page_list[p].page); 145 free_page((unsigned long) array->page_list[p].page);
146 array->page_list[p].page = NULL; 146 array->page_list[p].page = NULL;
147 } 147 } else
148 array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL;
148 149
149 if (array->page_list[p].used < 0) 150 if (array->page_list[p].used < 0)
150 pr_debug("Array %p index %d page %d with ref count %d < 0\n", 151 pr_debug("Array %p index %d page %d with ref count %d < 0\n",
diff --git a/drivers/infiniband/ulp/ipoib/Kconfig b/drivers/infiniband/ulp/ipoib/Kconfig
index 13d6d01c72c0..d74653d7de1c 100644
--- a/drivers/infiniband/ulp/ipoib/Kconfig
+++ b/drivers/infiniband/ulp/ipoib/Kconfig
@@ -6,8 +6,7 @@ config INFINIBAND_IPOIB
6 transports IP packets over InfiniBand so you can use your IB 6 transports IP packets over InfiniBand so you can use your IB
7 device as a fancy NIC. 7 device as a fancy NIC.
8 8
9 The IPoIB protocol is defined by the IETF ipoib working 9 See Documentation/infiniband/ipoib.txt for more information
10 group: <http://www.ietf.org/html.charters/ipoib-charter.html>.
11 10
12config INFINIBAND_IPOIB_DEBUG 11config INFINIBAND_IPOIB_DEBUG
13 bool "IP-over-InfiniBand debugging" if EMBEDDED 12 bool "IP-over-InfiniBand debugging" if EMBEDDED
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 8f472e7113b4..8257d5a2c8f8 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -77,6 +77,14 @@ MODULE_PARM_DESC(topspin_workarounds,
77 77
78static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; 78static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };
79 79
80static int mellanox_workarounds = 1;
81
82module_param(mellanox_workarounds, int, 0444);
83MODULE_PARM_DESC(mellanox_workarounds,
84 "Enable workarounds for Mellanox SRP target bugs if != 0");
85
86static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 };
87
80static void srp_add_one(struct ib_device *device); 88static void srp_add_one(struct ib_device *device);
81static void srp_remove_one(struct ib_device *device); 89static void srp_remove_one(struct ib_device *device);
82static void srp_completion(struct ib_cq *cq, void *target_ptr); 90static void srp_completion(struct ib_cq *cq, void *target_ptr);
@@ -526,8 +534,10 @@ static int srp_reconnect_target(struct srp_target_port *target)
526 while (ib_poll_cq(target->cq, 1, &wc) > 0) 534 while (ib_poll_cq(target->cq, 1, &wc) > 0)
527 ; /* nothing */ 535 ; /* nothing */
528 536
537 spin_lock_irq(target->scsi_host->host_lock);
529 list_for_each_entry_safe(req, tmp, &target->req_queue, list) 538 list_for_each_entry_safe(req, tmp, &target->req_queue, list)
530 srp_reset_req(target, req); 539 srp_reset_req(target, req);
540 spin_unlock_irq(target->scsi_host->host_lock);
531 541
532 target->rx_head = 0; 542 target->rx_head = 0;
533 target->tx_head = 0; 543 target->tx_head = 0;
@@ -567,7 +577,7 @@ err:
567 return ret; 577 return ret;
568} 578}
569 579
570static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat, 580static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat,
571 int sg_cnt, struct srp_request *req, 581 int sg_cnt, struct srp_request *req,
572 struct srp_direct_buf *buf) 582 struct srp_direct_buf *buf)
573{ 583{
@@ -577,10 +587,15 @@ static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat,
577 int page_cnt; 587 int page_cnt;
578 int i, j; 588 int i, j;
579 int ret; 589 int ret;
590 struct srp_device *dev = target->srp_host->dev;
580 591
581 if (!dev->fmr_pool) 592 if (!dev->fmr_pool)
582 return -ENODEV; 593 return -ENODEV;
583 594
595 if ((sg_dma_address(&scat[0]) & ~dev->fmr_page_mask) &&
596 mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3))
597 return -EINVAL;
598
584 len = page_cnt = 0; 599 len = page_cnt = 0;
585 for (i = 0; i < sg_cnt; ++i) { 600 for (i = 0; i < sg_cnt; ++i) {
586 if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) { 601 if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) {
@@ -683,7 +698,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
683 buf->va = cpu_to_be64(sg_dma_address(scat)); 698 buf->va = cpu_to_be64(sg_dma_address(scat));
684 buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey); 699 buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey);
685 buf->len = cpu_to_be32(sg_dma_len(scat)); 700 buf->len = cpu_to_be32(sg_dma_len(scat));
686 } else if (srp_map_fmr(target->srp_host->dev, scat, count, req, 701 } else if (srp_map_fmr(target, scat, count, req,
687 (void *) cmd->add_data)) { 702 (void *) cmd->add_data)) {
688 /* 703 /*
689 * FMR mapping failed, and the scatterlist has more 704 * FMR mapping failed, and the scatterlist has more
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index f5fe7fb4b3ad..d5d649f5ccdb 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -90,6 +90,15 @@ config ADB_PMU_LED
90 and the ide-disk LED trigger and configure appropriately through 90 and the ide-disk LED trigger and configure appropriately through
91 sysfs. 91 sysfs.
92 92
93config ADB_PMU_LED_IDE
94 bool "Use front LED as IDE LED by default"
95 depends on ADB_PMU_LED
96 select LEDS_TRIGGERS
97 select LEDS_TRIGGER_IDE_DISK
98 help
99 This option makes the front LED default to the IDE trigger
100 so that it blinks on IDE activity.
101
93config PMAC_SMU 102config PMAC_SMU
94 bool "Support for SMU based PowerMacs" 103 bool "Support for SMU based PowerMacs"
95 depends on PPC_PMAC64 104 depends on PPC_PMAC64
@@ -100,7 +109,7 @@ config PMAC_SMU
100 109
101config PMAC_APM_EMU 110config PMAC_APM_EMU
102 tristate "APM emulation" 111 tristate "APM emulation"
103 depends on PPC_PMAC && PPC32 && PM 112 depends on PPC_PMAC && PPC32 && PM && ADB_PMU
104 113
105config PMAC_MEDIABAY 114config PMAC_MEDIABAY
106 bool "Support PowerBook hotswap media bay" 115 bool "Support PowerBook hotswap media bay"
@@ -115,8 +124,6 @@ config PMAC_BACKLIGHT
115 bool "Backlight control for LCD screens" 124 bool "Backlight control for LCD screens"
116 depends on ADB_PMU && FB = y && (BROKEN || !PPC64) 125 depends on ADB_PMU && FB = y && (BROKEN || !PPC64)
117 select FB_BACKLIGHT 126 select FB_BACKLIGHT
118 select BACKLIGHT_CLASS_DEVICE
119 select BACKLIGHT_LCD_SUPPORT
120 help 127 help
121 Say Y here to enable Macintosh specific extensions of the generic 128 Say Y here to enable Macintosh specific extensions of the generic
122 backlight code. With this enabled, the brightness keys on older 129 backlight code. With this enabled, the brightness keys on older
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 545be1ed6927..c69d23bb255e 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -45,14 +45,11 @@
45#include <linux/pmu.h> 45#include <linux/pmu.h>
46 46
47#include <asm/machdep.h> 47#include <asm/machdep.h>
48#include <asm/backlight.h>
48#ifdef CONFIG_PPC_PMAC 49#ifdef CONFIG_PPC_PMAC
49#include <asm/pmac_feature.h> 50#include <asm/pmac_feature.h>
50#endif 51#endif
51 52
52#ifdef CONFIG_PMAC_BACKLIGHT
53#include <asm/backlight.h>
54#endif
55
56MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>"); 53MODULE_AUTHOR("Franz Sirl <Franz.Sirl-kernel@lauterbach.com>");
57 54
58#define KEYB_KEYREG 0 /* register # for key up/down data */ 55#define KEYB_KEYREG 0 /* register # for key up/down data */
@@ -237,11 +234,6 @@ static struct adb_ids keyboard_ids;
237static struct adb_ids mouse_ids; 234static struct adb_ids mouse_ids;
238static struct adb_ids buttons_ids; 235static struct adb_ids buttons_ids;
239 236
240#ifdef CONFIG_PMAC_BACKLIGHT
241/* Exported to via-pmu.c */
242int disable_kernel_backlight = 0;
243#endif /* CONFIG_PMAC_BACKLIGHT */
244
245/* Kind of keyboard, see Apple technote 1152 */ 237/* Kind of keyboard, see Apple technote 1152 */
246#define ADB_KEYBOARD_UNKNOWN 0 238#define ADB_KEYBOARD_UNKNOWN 0
247#define ADB_KEYBOARD_ANSI 0x0100 239#define ADB_KEYBOARD_ANSI 0x0100
@@ -527,7 +519,7 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
527 519
528 case 0xa: /* brightness decrease */ 520 case 0xa: /* brightness decrease */
529#ifdef CONFIG_PMAC_BACKLIGHT 521#ifdef CONFIG_PMAC_BACKLIGHT
530 if (!disable_kernel_backlight && down) 522 if (down)
531 pmac_backlight_key_down(); 523 pmac_backlight_key_down();
532#endif 524#endif
533 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down); 525 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSDOWN, down);
@@ -535,7 +527,7 @@ adbhid_buttons_input(unsigned char *data, int nb, struct pt_regs *regs, int auto
535 527
536 case 0x9: /* brightness increase */ 528 case 0x9: /* brightness increase */
537#ifdef CONFIG_PMAC_BACKLIGHT 529#ifdef CONFIG_PMAC_BACKLIGHT
538 if (!disable_kernel_backlight && down) 530 if (down)
539 pmac_backlight_key_up(); 531 pmac_backlight_key_up();
540#endif 532#endif
541 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down); 533 input_report_key(adbhid[id]->input, KEY_BRIGHTNESSUP, down);
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c
index c1fe0b368f76..20bf67244e2c 100644
--- a/drivers/macintosh/therm_pm72.c
+++ b/drivers/macintosh/therm_pm72.c
@@ -95,6 +95,17 @@
95 * - Use min/max macros here or there 95 * - Use min/max macros here or there
96 * - Latest darwin updated U3H min fan speed to 20% PWM 96 * - Latest darwin updated U3H min fan speed to 20% PWM
97 * 97 *
98 * July. 06, 2006 : 1.3
99 * - Fix setting of RPM fans on Xserve G5 (they were going too fast)
100 * - Add missing slots fan control loop for Xserve G5
101 * - Lower fixed slots fan speed from 50% to 40% on desktop G5s. We
102 * still can't properly implement the control loop for these, so let's
103 * reduce the noise a little bit, it appears that 40% still gives us
104 * a pretty good air flow
105 * - Add code to "tickle" the FCU regulary so it doesn't think that
106 * we are gone while in fact, the machine just didn't need any fan
107 * speed change lately
108 *
98 */ 109 */
99 110
100#include <linux/types.h> 111#include <linux/types.h>
@@ -121,7 +132,7 @@
121 132
122#include "therm_pm72.h" 133#include "therm_pm72.h"
123 134
124#define VERSION "1.2b2" 135#define VERSION "1.3"
125 136
126#undef DEBUG 137#undef DEBUG
127 138
@@ -146,6 +157,7 @@ static struct basckside_pid_params backside_params;
146static struct backside_pid_state backside_state; 157static struct backside_pid_state backside_state;
147static struct drives_pid_state drives_state; 158static struct drives_pid_state drives_state;
148static struct dimm_pid_state dimms_state; 159static struct dimm_pid_state dimms_state;
160static struct slots_pid_state slots_state;
149static int state; 161static int state;
150static int cpu_count; 162static int cpu_count;
151static int cpu_pid_type; 163static int cpu_pid_type;
@@ -154,7 +166,8 @@ static struct completion ctrl_complete;
154static int critical_state; 166static int critical_state;
155static int rackmac; 167static int rackmac;
156static s32 dimm_output_clamp; 168static s32 dimm_output_clamp;
157 169static int fcu_rpm_shift;
170static int fcu_tickle_ticks;
158static DECLARE_MUTEX(driver_lock); 171static DECLARE_MUTEX(driver_lock);
159 172
160/* 173/*
@@ -495,13 +508,20 @@ static int start_fcu(void)
495 rc = fan_write_reg(0x2e, &buf, 1); 508 rc = fan_write_reg(0x2e, &buf, 1);
496 if (rc < 0) 509 if (rc < 0)
497 return -EIO; 510 return -EIO;
511 rc = fan_read_reg(0, &buf, 1);
512 if (rc < 0)
513 return -EIO;
514 fcu_rpm_shift = (buf == 1) ? 2 : 3;
515 printk(KERN_DEBUG "FCU Initialized, RPM fan shift is %d\n",
516 fcu_rpm_shift);
517
498 return 0; 518 return 0;
499} 519}
500 520
501static int set_rpm_fan(int fan_index, int rpm) 521static int set_rpm_fan(int fan_index, int rpm)
502{ 522{
503 unsigned char buf[2]; 523 unsigned char buf[2];
504 int rc, id; 524 int rc, id, min, max;
505 525
506 if (fcu_fans[fan_index].type != FCU_FAN_RPM) 526 if (fcu_fans[fan_index].type != FCU_FAN_RPM)
507 return -EINVAL; 527 return -EINVAL;
@@ -509,12 +529,15 @@ static int set_rpm_fan(int fan_index, int rpm)
509 if (id == FCU_FAN_ABSENT_ID) 529 if (id == FCU_FAN_ABSENT_ID)
510 return -EINVAL; 530 return -EINVAL;
511 531
512 if (rpm < 300) 532 min = 2400 >> fcu_rpm_shift;
513 rpm = 300; 533 max = 56000 >> fcu_rpm_shift;
514 else if (rpm > 8191) 534
515 rpm = 8191; 535 if (rpm < min)
516 buf[0] = rpm >> 5; 536 rpm = min;
517 buf[1] = rpm << 3; 537 else if (rpm > max)
538 rpm = max;
539 buf[0] = rpm >> (8 - fcu_rpm_shift);
540 buf[1] = rpm << fcu_rpm_shift;
518 rc = fan_write_reg(0x10 + (id * 2), buf, 2); 541 rc = fan_write_reg(0x10 + (id * 2), buf, 2);
519 if (rc < 0) 542 if (rc < 0)
520 return -EIO; 543 return -EIO;
@@ -551,7 +574,7 @@ static int get_rpm_fan(int fan_index, int programmed)
551 if (rc != 2) 574 if (rc != 2)
552 return -EIO; 575 return -EIO;
553 576
554 return (buf[0] << 5) | buf[1] >> 3; 577 return (buf[0] << (8 - fcu_rpm_shift)) | buf[1] >> fcu_rpm_shift;
555} 578}
556 579
557static int set_pwm_fan(int fan_index, int pwm) 580static int set_pwm_fan(int fan_index, int pwm)
@@ -609,6 +632,26 @@ static int get_pwm_fan(int fan_index)
609 return (buf[0] * 1000) / 2559; 632 return (buf[0] * 1000) / 2559;
610} 633}
611 634
635static void tickle_fcu(void)
636{
637 int pwm;
638
639 pwm = get_pwm_fan(SLOTS_FAN_PWM_INDEX);
640
641 DBG("FCU Tickle, slots fan is: %d\n", pwm);
642 if (pwm < 0)
643 pwm = 100;
644
645 if (!rackmac) {
646 pwm = SLOTS_FAN_DEFAULT_PWM;
647 } else if (pwm < SLOTS_PID_OUTPUT_MIN)
648 pwm = SLOTS_PID_OUTPUT_MIN;
649
650 /* That is hopefully enough to make the FCU happy */
651 set_pwm_fan(SLOTS_FAN_PWM_INDEX, pwm);
652}
653
654
612/* 655/*
613 * Utility routine to read the CPU calibration EEPROM data 656 * Utility routine to read the CPU calibration EEPROM data
614 * from the device-tree 657 * from the device-tree
@@ -715,6 +758,9 @@ BUILD_SHOW_FUNC_INT(backside_fan_pwm, backside_state.pwm)
715BUILD_SHOW_FUNC_FIX(drives_temperature, drives_state.last_temp) 758BUILD_SHOW_FUNC_FIX(drives_temperature, drives_state.last_temp)
716BUILD_SHOW_FUNC_INT(drives_fan_rpm, drives_state.rpm) 759BUILD_SHOW_FUNC_INT(drives_fan_rpm, drives_state.rpm)
717 760
761BUILD_SHOW_FUNC_FIX(slots_temperature, slots_state.last_temp)
762BUILD_SHOW_FUNC_INT(slots_fan_pwm, slots_state.pwm)
763
718BUILD_SHOW_FUNC_FIX(dimms_temperature, dimms_state.last_temp) 764BUILD_SHOW_FUNC_FIX(dimms_temperature, dimms_state.last_temp)
719 765
720static DEVICE_ATTR(cpu0_temperature,S_IRUGO,show_cpu0_temperature,NULL); 766static DEVICE_ATTR(cpu0_temperature,S_IRUGO,show_cpu0_temperature,NULL);
@@ -735,6 +781,9 @@ static DEVICE_ATTR(backside_fan_pwm,S_IRUGO,show_backside_fan_pwm,NULL);
735static DEVICE_ATTR(drives_temperature,S_IRUGO,show_drives_temperature,NULL); 781static DEVICE_ATTR(drives_temperature,S_IRUGO,show_drives_temperature,NULL);
736static DEVICE_ATTR(drives_fan_rpm,S_IRUGO,show_drives_fan_rpm,NULL); 782static DEVICE_ATTR(drives_fan_rpm,S_IRUGO,show_drives_fan_rpm,NULL);
737 783
784static DEVICE_ATTR(slots_temperature,S_IRUGO,show_slots_temperature,NULL);
785static DEVICE_ATTR(slots_fan_pwm,S_IRUGO,show_slots_fan_pwm,NULL);
786
738static DEVICE_ATTR(dimms_temperature,S_IRUGO,show_dimms_temperature,NULL); 787static DEVICE_ATTR(dimms_temperature,S_IRUGO,show_dimms_temperature,NULL);
739 788
740/* 789/*
@@ -1076,6 +1125,9 @@ static void do_monitor_cpu_rack(struct cpu_pid_state *state)
1076 fan_min = dimm_output_clamp; 1125 fan_min = dimm_output_clamp;
1077 fan_min = max(fan_min, (int)state->mpu.rminn_intake_fan); 1126 fan_min = max(fan_min, (int)state->mpu.rminn_intake_fan);
1078 1127
1128 DBG(" CPU min mpu = %d, min dimm = %d\n",
1129 state->mpu.rminn_intake_fan, dimm_output_clamp);
1130
1079 state->rpm = max(state->rpm, (int)fan_min); 1131 state->rpm = max(state->rpm, (int)fan_min);
1080 state->rpm = min(state->rpm, (int)state->mpu.rmaxn_intake_fan); 1132 state->rpm = min(state->rpm, (int)state->mpu.rmaxn_intake_fan);
1081 state->intake_rpm = state->rpm; 1133 state->intake_rpm = state->rpm;
@@ -1374,7 +1426,8 @@ static void do_monitor_drives(struct drives_pid_state *state)
1374 DBG(" current rpm: %d\n", state->rpm); 1426 DBG(" current rpm: %d\n", state->rpm);
1375 1427
1376 /* Get some sensor readings */ 1428 /* Get some sensor readings */
1377 temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor, DS1775_TEMP)) << 8; 1429 temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor,
1430 DS1775_TEMP)) << 8;
1378 state->last_temp = temp; 1431 state->last_temp = temp;
1379 DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp), 1432 DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp),
1380 FIX32TOPRINT(DRIVES_PID_INPUT_TARGET)); 1433 FIX32TOPRINT(DRIVES_PID_INPUT_TARGET));
@@ -1575,7 +1628,7 @@ static int init_dimms_state(struct dimm_pid_state *state)
1575} 1628}
1576 1629
1577/* 1630/*
1578 * Dispose of the state data for the drives control loop 1631 * Dispose of the state data for the DIMM control loop
1579 */ 1632 */
1580static void dispose_dimms_state(struct dimm_pid_state *state) 1633static void dispose_dimms_state(struct dimm_pid_state *state)
1581{ 1634{
@@ -1588,6 +1641,127 @@ static void dispose_dimms_state(struct dimm_pid_state *state)
1588 state->monitor = NULL; 1641 state->monitor = NULL;
1589} 1642}
1590 1643
1644/*
1645 * Slots fan control loop
1646 */
1647static void do_monitor_slots(struct slots_pid_state *state)
1648{
1649 s32 temp, integral, derivative;
1650 s64 integ_p, deriv_p, prop_p, sum;
1651 int i, rc;
1652
1653 if (--state->ticks != 0)
1654 return;
1655 state->ticks = SLOTS_PID_INTERVAL;
1656
1657 DBG("slots:\n");
1658
1659 /* Check fan status */
1660 rc = get_pwm_fan(SLOTS_FAN_PWM_INDEX);
1661 if (rc < 0) {
1662 printk(KERN_WARNING "Error %d reading slots fan !\n", rc);
1663 /* XXX What do we do now ? */
1664 } else
1665 state->pwm = rc;
1666 DBG(" current pwm: %d\n", state->pwm);
1667
1668 /* Get some sensor readings */
1669 temp = le16_to_cpu(i2c_smbus_read_word_data(state->monitor,
1670 DS1775_TEMP)) << 8;
1671 state->last_temp = temp;
1672 DBG(" temp: %d.%03d, target: %d.%03d\n", FIX32TOPRINT(temp),
1673 FIX32TOPRINT(SLOTS_PID_INPUT_TARGET));
1674
1675 /* Store temperature and error in history array */
1676 state->cur_sample = (state->cur_sample + 1) % SLOTS_PID_HISTORY_SIZE;
1677 state->sample_history[state->cur_sample] = temp;
1678 state->error_history[state->cur_sample] = temp - SLOTS_PID_INPUT_TARGET;
1679
1680 /* If first loop, fill the history table */
1681 if (state->first) {
1682 for (i = 0; i < (SLOTS_PID_HISTORY_SIZE - 1); i++) {
1683 state->cur_sample = (state->cur_sample + 1) %
1684 SLOTS_PID_HISTORY_SIZE;
1685 state->sample_history[state->cur_sample] = temp;
1686 state->error_history[state->cur_sample] =
1687 temp - SLOTS_PID_INPUT_TARGET;
1688 }
1689 state->first = 0;
1690 }
1691
1692 /* Calculate the integral term */
1693 sum = 0;
1694 integral = 0;
1695 for (i = 0; i < SLOTS_PID_HISTORY_SIZE; i++)
1696 integral += state->error_history[i];
1697 integral *= SLOTS_PID_INTERVAL;
1698 DBG(" integral: %08x\n", integral);
1699 integ_p = ((s64)SLOTS_PID_G_r) * (s64)integral;
1700 DBG(" integ_p: %d\n", (int)(integ_p >> 36));
1701 sum += integ_p;
1702
1703 /* Calculate the derivative term */
1704 derivative = state->error_history[state->cur_sample] -
1705 state->error_history[(state->cur_sample + SLOTS_PID_HISTORY_SIZE - 1)
1706 % SLOTS_PID_HISTORY_SIZE];
1707 derivative /= SLOTS_PID_INTERVAL;
1708 deriv_p = ((s64)SLOTS_PID_G_d) * (s64)derivative;
1709 DBG(" deriv_p: %d\n", (int)(deriv_p >> 36));
1710 sum += deriv_p;
1711
1712 /* Calculate the proportional term */
1713 prop_p = ((s64)SLOTS_PID_G_p) * (s64)(state->error_history[state->cur_sample]);
1714 DBG(" prop_p: %d\n", (int)(prop_p >> 36));
1715 sum += prop_p;
1716
1717 /* Scale sum */
1718 sum >>= 36;
1719
1720 DBG(" sum: %d\n", (int)sum);
1721 state->pwm = (s32)sum;
1722
1723 state->pwm = max(state->pwm, SLOTS_PID_OUTPUT_MIN);
1724 state->pwm = min(state->pwm, SLOTS_PID_OUTPUT_MAX);
1725
1726 DBG("** DRIVES PWM: %d\n", (int)state->pwm);
1727 set_pwm_fan(SLOTS_FAN_PWM_INDEX, state->pwm);
1728}
1729
1730/*
1731 * Initialize the state structure for the slots bay fan control loop
1732 */
1733static int init_slots_state(struct slots_pid_state *state)
1734{
1735 state->ticks = 1;
1736 state->first = 1;
1737 state->pwm = 50;
1738
1739 state->monitor = attach_i2c_chip(XSERVE_SLOTS_LM75, "slots_temp");
1740 if (state->monitor == NULL)
1741 return -ENODEV;
1742
1743 device_create_file(&of_dev->dev, &dev_attr_slots_temperature);
1744 device_create_file(&of_dev->dev, &dev_attr_slots_fan_pwm);
1745
1746 return 0;
1747}
1748
1749/*
1750 * Dispose of the state data for the slots control loop
1751 */
1752static void dispose_slots_state(struct slots_pid_state *state)
1753{
1754 if (state->monitor == NULL)
1755 return;
1756
1757 device_remove_file(&of_dev->dev, &dev_attr_slots_temperature);
1758 device_remove_file(&of_dev->dev, &dev_attr_slots_fan_pwm);
1759
1760 detach_i2c_chip(state->monitor);
1761 state->monitor = NULL;
1762}
1763
1764
1591static int call_critical_overtemp(void) 1765static int call_critical_overtemp(void)
1592{ 1766{
1593 char *argv[] = { critical_overtemp_path, NULL }; 1767 char *argv[] = { critical_overtemp_path, NULL };
@@ -1617,14 +1791,17 @@ static int main_control_loop(void *x)
1617 goto out; 1791 goto out;
1618 } 1792 }
1619 1793
1620 /* Set the PCI fan once for now */ 1794 /* Set the PCI fan once for now on non-RackMac */
1621 set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM); 1795 if (!rackmac)
1796 set_pwm_fan(SLOTS_FAN_PWM_INDEX, SLOTS_FAN_DEFAULT_PWM);
1622 1797
1623 /* Initialize ADCs */ 1798 /* Initialize ADCs */
1624 initialize_adc(&cpu_state[0]); 1799 initialize_adc(&cpu_state[0]);
1625 if (cpu_state[1].monitor != NULL) 1800 if (cpu_state[1].monitor != NULL)
1626 initialize_adc(&cpu_state[1]); 1801 initialize_adc(&cpu_state[1]);
1627 1802
1803 fcu_tickle_ticks = FCU_TICKLE_TICKS;
1804
1628 up(&driver_lock); 1805 up(&driver_lock);
1629 1806
1630 while (state == state_attached) { 1807 while (state == state_attached) {
@@ -1634,6 +1811,12 @@ static int main_control_loop(void *x)
1634 1811
1635 down(&driver_lock); 1812 down(&driver_lock);
1636 1813
1814 /* Tickle the FCU just in case */
1815 if (--fcu_tickle_ticks < 0) {
1816 fcu_tickle_ticks = FCU_TICKLE_TICKS;
1817 tickle_fcu();
1818 }
1819
1637 /* First, we always calculate the new DIMMs state on an Xserve */ 1820 /* First, we always calculate the new DIMMs state on an Xserve */
1638 if (rackmac) 1821 if (rackmac)
1639 do_monitor_dimms(&dimms_state); 1822 do_monitor_dimms(&dimms_state);
@@ -1654,7 +1837,9 @@ static int main_control_loop(void *x)
1654 } 1837 }
1655 /* Then, the rest */ 1838 /* Then, the rest */
1656 do_monitor_backside(&backside_state); 1839 do_monitor_backside(&backside_state);
1657 if (!rackmac) 1840 if (rackmac)
1841 do_monitor_slots(&slots_state);
1842 else
1658 do_monitor_drives(&drives_state); 1843 do_monitor_drives(&drives_state);
1659 up(&driver_lock); 1844 up(&driver_lock);
1660 1845
@@ -1696,6 +1881,7 @@ static void dispose_control_loops(void)
1696 dispose_cpu_state(&cpu_state[1]); 1881 dispose_cpu_state(&cpu_state[1]);
1697 dispose_backside_state(&backside_state); 1882 dispose_backside_state(&backside_state);
1698 dispose_drives_state(&drives_state); 1883 dispose_drives_state(&drives_state);
1884 dispose_slots_state(&slots_state);
1699 dispose_dimms_state(&dimms_state); 1885 dispose_dimms_state(&dimms_state);
1700} 1886}
1701 1887
@@ -1745,6 +1931,8 @@ static int create_control_loops(void)
1745 goto fail; 1931 goto fail;
1746 if (rackmac && init_dimms_state(&dimms_state)) 1932 if (rackmac && init_dimms_state(&dimms_state))
1747 goto fail; 1933 goto fail;
1934 if (rackmac && init_slots_state(&slots_state))
1935 goto fail;
1748 if (!rackmac && init_drives_state(&drives_state)) 1936 if (!rackmac && init_drives_state(&drives_state))
1749 goto fail; 1937 goto fail;
1750 1938
diff --git a/drivers/macintosh/therm_pm72.h b/drivers/macintosh/therm_pm72.h
index fc7e9b7ecaf2..393cc9df94e1 100644
--- a/drivers/macintosh/therm_pm72.h
+++ b/drivers/macintosh/therm_pm72.h
@@ -105,6 +105,7 @@ static char * critical_overtemp_path = "/sbin/critical_overtemp";
105#define DRIVES_DALLAS_ID 0x94 105#define DRIVES_DALLAS_ID 0x94
106#define BACKSIDE_MAX_ID 0x98 106#define BACKSIDE_MAX_ID 0x98
107#define XSERVE_DIMMS_LM87 0x25a 107#define XSERVE_DIMMS_LM87 0x25a
108#define XSERVE_SLOTS_LM75 0x290
108 109
109/* 110/*
110 * Some MAX6690, DS1775, LM87 register definitions 111 * Some MAX6690, DS1775, LM87 register definitions
@@ -198,7 +199,7 @@ struct drives_pid_state
198 199
199#define SLOTS_FAN_PWM_DEFAULT_ID 2 200#define SLOTS_FAN_PWM_DEFAULT_ID 2
200#define SLOTS_FAN_PWM_INDEX 2 201#define SLOTS_FAN_PWM_INDEX 2
201#define SLOTS_FAN_DEFAULT_PWM 50 /* Do better here ! */ 202#define SLOTS_FAN_DEFAULT_PWM 40 /* Do better here ! */
202 203
203 204
204/* 205/*
@@ -206,7 +207,7 @@ struct drives_pid_state
206 */ 207 */
207#define DIMM_PID_G_d 0 208#define DIMM_PID_G_d 0
208#define DIMM_PID_G_p 0 209#define DIMM_PID_G_p 0
209#define DIMM_PID_G_r 0x6553600 210#define DIMM_PID_G_r 0x06553600
210#define DIMM_PID_INPUT_TARGET 3276800 211#define DIMM_PID_INPUT_TARGET 3276800
211#define DIMM_PID_INTERVAL 1 212#define DIMM_PID_INTERVAL 1
212#define DIMM_PID_OUTPUT_MAX 14000 213#define DIMM_PID_OUTPUT_MAX 14000
@@ -226,6 +227,31 @@ struct dimm_pid_state
226}; 227};
227 228
228 229
230/*
231 * PID factors for the Xserve Slots control loop
232 */
233#define SLOTS_PID_G_d 0
234#define SLOTS_PID_G_p 0
235#define SLOTS_PID_G_r 0x00100000
236#define SLOTS_PID_INPUT_TARGET 3200000
237#define SLOTS_PID_INTERVAL 1
238#define SLOTS_PID_OUTPUT_MAX 100
239#define SLOTS_PID_OUTPUT_MIN 20
240#define SLOTS_PID_HISTORY_SIZE 20
241
242struct slots_pid_state
243{
244 int ticks;
245 struct i2c_client * monitor;
246 s32 sample_history[SLOTS_PID_HISTORY_SIZE];
247 s32 error_history[SLOTS_PID_HISTORY_SIZE];
248 int cur_sample;
249 s32 last_temp;
250 int first;
251 int pwm;
252};
253
254
229 255
230/* Desktops */ 256/* Desktops */
231 257
@@ -283,6 +309,9 @@ struct cpu_pid_state
283 s32 pump_max; 309 s32 pump_max;
284}; 310};
285 311
312/* Tickle FCU every 10 seconds */
313#define FCU_TICKLE_TICKS 10
314
286/* 315/*
287 * Driver state 316 * Driver state
288 */ 317 */
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index b42d05f2aaff..d3f8d75bcbb4 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -15,8 +15,9 @@
15 15
16#define MAX_PMU_LEVEL 0xFF 16#define MAX_PMU_LEVEL 0xFF
17 17
18static struct device_node *vias;
19static struct backlight_properties pmu_backlight_data; 18static struct backlight_properties pmu_backlight_data;
19static spinlock_t pmu_backlight_lock;
20static int sleeping;
20 21
21static int pmu_backlight_get_level_brightness(struct fb_info *info, 22static int pmu_backlight_get_level_brightness(struct fb_info *info,
22 int level) 23 int level)
@@ -40,23 +41,36 @@ static int pmu_backlight_update_status(struct backlight_device *bd)
40{ 41{
41 struct fb_info *info = class_get_devdata(&bd->class_dev); 42 struct fb_info *info = class_get_devdata(&bd->class_dev);
42 struct adb_request req; 43 struct adb_request req;
43 int pmulevel, level = bd->props->brightness; 44 unsigned long flags;
45 int level = bd->props->brightness;
44 46
45 if (vias == NULL) 47 spin_lock_irqsave(&pmu_backlight_lock, flags);
46 return -ENODEV; 48
49 /* Don't update brightness when sleeping */
50 if (sleeping)
51 goto out;
47 52
48 if (bd->props->power != FB_BLANK_UNBLANK || 53 if (bd->props->power != FB_BLANK_UNBLANK ||
49 bd->props->fb_blank != FB_BLANK_UNBLANK) 54 bd->props->fb_blank != FB_BLANK_UNBLANK)
50 level = 0; 55 level = 0;
51 56
52 pmulevel = pmu_backlight_get_level_brightness(info, level); 57 if (level > 0) {
58 int pmulevel = pmu_backlight_get_level_brightness(info, level);
53 59
54 pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, pmulevel); 60 pmu_request(&req, NULL, 2, PMU_BACKLIGHT_BRIGHT, pmulevel);
55 pmu_wait_complete(&req); 61 pmu_wait_complete(&req);
56 62
57 pmu_request(&req, NULL, 2, PMU_POWER_CTRL, 63 pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
58 PMU_POW_BACKLIGHT | (level > 0 ? PMU_POW_ON : PMU_POW_OFF)); 64 PMU_POW_BACKLIGHT | PMU_POW_ON);
59 pmu_wait_complete(&req); 65 pmu_wait_complete(&req);
66 } else {
67 pmu_request(&req, NULL, 2, PMU_POWER_CTRL,
68 PMU_POW_BACKLIGHT | PMU_POW_OFF);
69 pmu_wait_complete(&req);
70 }
71
72out:
73 spin_unlock_irqrestore(&pmu_backlight_lock, flags);
60 74
61 return 0; 75 return 0;
62} 76}
@@ -73,15 +87,39 @@ static struct backlight_properties pmu_backlight_data = {
73 .max_brightness = (FB_BACKLIGHT_LEVELS - 1), 87 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
74}; 88};
75 89
76void __init pmu_backlight_init(struct device_node *in_vias) 90#ifdef CONFIG_PM
91static int pmu_backlight_sleep_call(struct pmu_sleep_notifier *self, int when)
92{
93 unsigned long flags;
94
95 spin_lock_irqsave(&pmu_backlight_lock, flags);
96
97 switch (when) {
98 case PBOOK_SLEEP_REQUEST:
99 sleeping = 1;
100 break;
101 case PBOOK_WAKE:
102 sleeping = 0;
103 break;
104 }
105
106 spin_unlock_irqrestore(&pmu_backlight_lock, flags);
107
108 return PBOOK_SLEEP_OK;
109}
110
111static struct pmu_sleep_notifier pmu_backlight_sleep_notif = {
112 .notifier_call = pmu_backlight_sleep_call,
113};
114#endif
115
116void __init pmu_backlight_init()
77{ 117{
78 struct backlight_device *bd; 118 struct backlight_device *bd;
79 struct fb_info *info; 119 struct fb_info *info;
80 char name[10]; 120 char name[10];
81 int level, autosave; 121 int level, autosave;
82 122
83 vias = in_vias;
84
85 /* Special case for the old PowerBook since I can't test on it */ 123 /* Special case for the old PowerBook since I can't test on it */
86 autosave = 124 autosave =
87 machine_is_compatible("AAPL,3400/2400") || 125 machine_is_compatible("AAPL,3400/2400") ||
@@ -141,6 +179,10 @@ void __init pmu_backlight_init(struct device_node *in_vias)
141 pmac_backlight = bd; 179 pmac_backlight = bd;
142 mutex_unlock(&pmac_backlight_mutex); 180 mutex_unlock(&pmac_backlight_mutex);
143 181
182#ifdef CONFIG_PM
183 pmu_register_sleep_notifier(&pmu_backlight_sleep_notif);
184#endif
185
144 printk("pmubl: Backlight initialized (%s)\n", name); 186 printk("pmubl: Backlight initialized (%s)\n", name);
145 187
146 return; 188 return;
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index af8375ed0f5e..5189d5454b1f 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -74,7 +74,7 @@ static void pmu_led_set(struct led_classdev *led_cdev,
74 74
75static struct led_classdev pmu_led = { 75static struct led_classdev pmu_led = {
76 .name = "pmu-front-led", 76 .name = "pmu-front-led",
77#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK 77#ifdef CONFIG_ADB_PMU_LED_IDE
78 .default_trigger = "ide-disk", 78 .default_trigger = "ide-disk",
79#endif 79#endif
80 .brightness_set = pmu_led_set, 80 .brightness_set = pmu_led_set,
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 06ca80bfd6b9..ea386801e215 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -16,7 +16,6 @@
16 * a sleep or a freq. switch 16 * a sleep or a freq. switch
17 * - Move sleep code out of here to pmac_pm, merge into new 17 * - Move sleep code out of here to pmac_pm, merge into new
18 * common PM infrastructure 18 * common PM infrastructure
19 * - Move backlight code out as well
20 * - Save/Restore PCI space properly 19 * - Save/Restore PCI space properly
21 * 20 *
22 */ 21 */
@@ -60,9 +59,7 @@
60#include <asm/mmu_context.h> 59#include <asm/mmu_context.h>
61#include <asm/cputable.h> 60#include <asm/cputable.h>
62#include <asm/time.h> 61#include <asm/time.h>
63#ifdef CONFIG_PMAC_BACKLIGHT
64#include <asm/backlight.h> 62#include <asm/backlight.h>
65#endif
66 63
67#include "via-pmu-event.h" 64#include "via-pmu-event.h"
68 65
@@ -177,10 +174,6 @@ static int query_batt_timer = BATTERY_POLLING_COUNT;
177static struct adb_request batt_req; 174static struct adb_request batt_req;
178static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES]; 175static struct proc_dir_entry *proc_pmu_batt[PMU_MAX_BATTERIES];
179 176
180#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
181extern int disable_kernel_backlight;
182#endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */
183
184int __fake_sleep; 177int __fake_sleep;
185int asleep; 178int asleep;
186BLOCKING_NOTIFIER_HEAD(sleep_notifier_list); 179BLOCKING_NOTIFIER_HEAD(sleep_notifier_list);
@@ -466,7 +459,7 @@ static int __init via_pmu_dev_init(void)
466 459
467#ifdef CONFIG_PMAC_BACKLIGHT 460#ifdef CONFIG_PMAC_BACKLIGHT
468 /* Initialize backlight */ 461 /* Initialize backlight */
469 pmu_backlight_init(vias); 462 pmu_backlight_init();
470#endif 463#endif
471 464
472#ifdef CONFIG_PPC32 465#ifdef CONFIG_PPC32
@@ -1403,11 +1396,8 @@ next:
1403 else if ((1 << pirq) & PMU_INT_SNDBRT) { 1396 else if ((1 << pirq) & PMU_INT_SNDBRT) {
1404#ifdef CONFIG_PMAC_BACKLIGHT 1397#ifdef CONFIG_PMAC_BACKLIGHT
1405 if (len == 3) 1398 if (len == 3)
1406#ifdef CONFIG_INPUT_ADBHID 1399 pmac_backlight_set_legacy_brightness_pmu(data[1] >> 4);
1407 if (!disable_kernel_backlight) 1400#endif
1408#endif /* CONFIG_INPUT_ADBHID */
1409 pmac_backlight_set_legacy_brightness(data[1] >> 4);
1410#endif /* CONFIG_PMAC_BACKLIGHT */
1411 } 1401 }
1412 /* Tick interrupt */ 1402 /* Tick interrupt */
1413 else if ((1 << pirq) & PMU_INT_TICK) { 1403 else if ((1 << pirq) & PMU_INT_TICK) {
@@ -2414,7 +2404,7 @@ struct pmu_private {
2414 spinlock_t lock; 2404 spinlock_t lock;
2415#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) 2405#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
2416 int backlight_locker; 2406 int backlight_locker;
2417#endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ 2407#endif
2418}; 2408};
2419 2409
2420static LIST_HEAD(all_pmu_pvt); 2410static LIST_HEAD(all_pmu_pvt);
@@ -2464,7 +2454,7 @@ pmu_open(struct inode *inode, struct file *file)
2464 spin_lock_irqsave(&all_pvt_lock, flags); 2454 spin_lock_irqsave(&all_pvt_lock, flags);
2465#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) 2455#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
2466 pp->backlight_locker = 0; 2456 pp->backlight_locker = 0;
2467#endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */ 2457#endif
2468 list_add(&pp->list, &all_pmu_pvt); 2458 list_add(&pp->list, &all_pmu_pvt);
2469 spin_unlock_irqrestore(&all_pvt_lock, flags); 2459 spin_unlock_irqrestore(&all_pvt_lock, flags);
2470 file->private_data = pp; 2460 file->private_data = pp;
@@ -2559,13 +2549,12 @@ pmu_release(struct inode *inode, struct file *file)
2559 spin_lock_irqsave(&all_pvt_lock, flags); 2549 spin_lock_irqsave(&all_pvt_lock, flags);
2560 list_del(&pp->list); 2550 list_del(&pp->list);
2561 spin_unlock_irqrestore(&all_pvt_lock, flags); 2551 spin_unlock_irqrestore(&all_pvt_lock, flags);
2552
2562#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) 2553#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
2563 if (pp->backlight_locker) { 2554 if (pp->backlight_locker)
2564 spin_lock_irqsave(&pmu_lock, flags); 2555 pmac_backlight_enable();
2565 disable_kernel_backlight--; 2556#endif
2566 spin_unlock_irqrestore(&pmu_lock, flags); 2557
2567 }
2568#endif /* defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT) */
2569 kfree(pp); 2558 kfree(pp);
2570 } 2559 }
2571 unlock_kernel(); 2560 unlock_kernel();
@@ -2642,18 +2631,18 @@ pmu_ioctl(struct inode * inode, struct file *filp,
2642#ifdef CONFIG_INPUT_ADBHID 2631#ifdef CONFIG_INPUT_ADBHID
2643 case PMU_IOC_GRAB_BACKLIGHT: { 2632 case PMU_IOC_GRAB_BACKLIGHT: {
2644 struct pmu_private *pp = filp->private_data; 2633 struct pmu_private *pp = filp->private_data;
2645 unsigned long flags;
2646 2634
2647 if (pp->backlight_locker) 2635 if (pp->backlight_locker)
2648 return 0; 2636 return 0;
2637
2649 pp->backlight_locker = 1; 2638 pp->backlight_locker = 1;
2650 spin_lock_irqsave(&pmu_lock, flags); 2639 pmac_backlight_disable();
2651 disable_kernel_backlight++; 2640
2652 spin_unlock_irqrestore(&pmu_lock, flags);
2653 return 0; 2641 return 0;
2654 } 2642 }
2655#endif /* CONFIG_INPUT_ADBHID */ 2643#endif /* CONFIG_INPUT_ADBHID */
2656#endif /* CONFIG_PMAC_BACKLIGHT_LEGACY */ 2644#endif /* CONFIG_PMAC_BACKLIGHT_LEGACY */
2645
2657 case PMU_IOC_GET_MODEL: 2646 case PMU_IOC_GET_MODEL:
2658 return put_user(pmu_kind, argp); 2647 return put_user(pmu_kind, argp);
2659 case PMU_IOC_HAS_ADB: 2648 case PMU_IOC_HAS_ADB:
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 59ac35ddd51e..57b34cda99f5 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -526,7 +526,9 @@ static int dvb_frontend_thread(void *data)
526 fepriv->delay = 3*HZ; 526 fepriv->delay = 3*HZ;
527 fepriv->status = 0; 527 fepriv->status = 0;
528 fepriv->wakeup = 0; 528 fepriv->wakeup = 0;
529 fepriv->reinitialise = 1; 529 fepriv->reinitialise = 0;
530
531 dvb_frontend_init(fe);
530 532
531 while (1) { 533 while (1) {
532 up(&fepriv->sem); /* is locked when we enter the thread... */ 534 up(&fepriv->sem); /* is locked when we enter the thread... */
@@ -1013,17 +1015,18 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
1013 return ret; 1015 return ret;
1014 1016
1015 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 1017 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
1018
1019 /* normal tune mode when opened R/W */
1020 fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT;
1021 fepriv->tone = -1;
1022 fepriv->voltage = -1;
1023
1016 ret = dvb_frontend_start (fe); 1024 ret = dvb_frontend_start (fe);
1017 if (ret) 1025 if (ret)
1018 dvb_generic_release (inode, file); 1026 dvb_generic_release (inode, file);
1019 1027
1020 /* empty event queue */ 1028 /* empty event queue */
1021 fepriv->events.eventr = fepriv->events.eventw = 0; 1029 fepriv->events.eventr = fepriv->events.eventw = 0;
1022
1023 /* normal tune mode when opened R/W */
1024 fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT;
1025 fepriv->tone = -1;
1026 fepriv->voltage = -1;
1027 } 1030 }
1028 1031
1029 return ret; 1032 return ret;
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index a189683454b7..2be33f27c69f 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -194,11 +194,11 @@ struct dvb_pll_desc dvb_pll_tda665x = {
194 { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ }, 194 { 253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0 10 */ },
195 { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ }, 195 { 383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0 10 */ },
196 { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ }, 196 { 443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0 10 */ },
197 { 444000000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, 197 { 444000000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ },
198 { 583834000, 36249333, 166667, 0xca, 0x63 /* 011 0 0 0 11 */ }, 198 { 583834000, 36249333, 166667, 0xca, 0x64 /* 011 0 0 1 00 */ },
199 { 793834000, 36249333, 166667, 0xca, 0xa3 /* 101 0 0 0 11 */ }, 199 { 793834000, 36249333, 166667, 0xca, 0xa4 /* 101 0 0 1 00 */ },
200 { 444834000, 36249333, 166667, 0xca, 0xc3 /* 110 0 0 0 11 */ }, 200 { 444834000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1 00 */ },
201 { 861000000, 36249333, 166667, 0xca, 0xe3 /* 111 0 0 0 11 */ }, 201 { 861000000, 36249333, 166667, 0xca, 0xe4 /* 111 0 0 1 00 */ },
202 } 202 }
203}; 203};
204EXPORT_SYMBOL(dvb_pll_tda665x); 204EXPORT_SYMBOL(dvb_pll_tda665x);
@@ -613,7 +613,21 @@ static struct dvb_tuner_ops dvb_pll_tuner_ops = {
613 613
614int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc) 614int dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, struct i2c_adapter *i2c, struct dvb_pll_desc *desc)
615{ 615{
616 u8 b1 [] = { 0 };
617 struct i2c_msg msg = { .addr = pll_addr, .flags = I2C_M_RD, .buf = b1, .len = 1 };
616 struct dvb_pll_priv *priv = NULL; 618 struct dvb_pll_priv *priv = NULL;
619 int ret;
620
621 if (i2c != NULL) {
622 if (fe->ops.i2c_gate_ctrl)
623 fe->ops.i2c_gate_ctrl(fe, 1);
624
625 ret = i2c_transfer (i2c, &msg, 1);
626 if (ret != 1)
627 return -1;
628 if (fe->ops.i2c_gate_ctrl)
629 fe->ops.i2c_gate_ctrl(fe, 0);
630 }
617 631
618 priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); 632 priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL);
619 if (priv == NULL) 633 if (priv == NULL)
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 500f15c10aaf..4506165c5de2 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2203,8 +2203,8 @@ static int frontend_init(struct av7110 *av7110)
2203 av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params; 2203 av7110->fe->ops.tuner_ops.set_params = nexusca_stv0297_tuner_set_params;
2204 2204
2205 /* set TDA9819 into DVB mode */ 2205 /* set TDA9819 into DVB mode */
2206 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 2206 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
2207 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) 2207 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
2208 2208
2209 /* tuner on this needs a slower i2c bus speed */ 2209 /* tuner on this needs a slower i2c bus speed */
2210 av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240; 2210 av7110->dev->i2c_bitrate = SAA7146_I2C_BUS_BIT_RATE_240;
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c
index 64055461559d..6ffe53fdcf57 100644
--- a/drivers/media/dvb/ttpci/av7110_v4l.c
+++ b/drivers/media/dvb/ttpci/av7110_v4l.c
@@ -272,8 +272,8 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
272 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60)) 272 if (ves1820_writereg(dev, 0x09, 0x0f, 0x60))
273 dprintk(1, "setting band in demodulator failed.\n"); 273 dprintk(1, "setting band in demodulator failed.\n");
274 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 274 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
275 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD) 275 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9819 pin9(STD)
276 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF) 276 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9819 pin30(VIF)
277 } 277 }
278 if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1) 278 if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1)
279 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num); 279 dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
@@ -308,8 +308,8 @@ static int av7110_dvb_c_switch(struct saa7146_fh *fh)
308 if (ves1820_writereg(dev, 0x09, 0x0f, 0x20)) 308 if (ves1820_writereg(dev, 0x09, 0x0f, 0x20))
309 dprintk(1, "setting band in demodulator failed.\n"); 309 dprintk(1, "setting band in demodulator failed.\n");
310 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 310 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
311 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 311 saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
312 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) 312 saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
313 } 313 }
314 } 314 }
315 315
@@ -750,8 +750,8 @@ int av7110_init_analog_module(struct av7110 *av7110)
750 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20)) 750 if (ves1820_writereg(av7110->dev, 0x09, 0x0f, 0x20))
751 dprintk(1, "setting band in demodulator failed.\n"); 751 dprintk(1, "setting band in demodulator failed.\n");
752 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) { 752 } else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
753 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9198 pin9(STD) 753 saa7146_setgpio(av7110->dev, 1, SAA7146_GPIO_OUTLO); // TDA9819 pin9(STD)
754 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9198 pin30(VIF) 754 saa7146_setgpio(av7110->dev, 3, SAA7146_GPIO_OUTLO); // TDA9819 pin30(VIF)
755 } 755 }
756 756
757 /* init the saa7113 */ 757 /* init the saa7113 */
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index 5f111d407730..2d21fec23b4d 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1303,6 +1303,9 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1303 budget_av->budget.dvb_adapter.priv = budget_av; 1303 budget_av->budget.dvb_adapter.priv = budget_av;
1304 frontend_init(budget_av); 1304 frontend_init(budget_av);
1305 ciintf_init(budget_av); 1305 ciintf_init(budget_av);
1306
1307 ttpci_budget_init_hooks(&budget_av->budget);
1308
1306 return 0; 1309 return 0;
1307} 1310}
1308 1311
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c
index 4b966eea3834..ffbbb3e34be4 100644
--- a/drivers/media/dvb/ttpci/budget-ci.c
+++ b/drivers/media/dvb/ttpci/budget-ci.c
@@ -1101,6 +1101,8 @@ static int budget_ci_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio
1101 budget_ci->budget.dvb_adapter.priv = budget_ci; 1101 budget_ci->budget.dvb_adapter.priv = budget_ci;
1102 frontend_init(budget_ci); 1102 frontend_init(budget_ci);
1103 1103
1104 ttpci_budget_init_hooks(&budget_ci->budget);
1105
1104 return 0; 1106 return 0;
1105} 1107}
1106 1108
diff --git a/drivers/media/dvb/ttpci/budget-core.c b/drivers/media/dvb/ttpci/budget-core.c
index e4cf7775e07f..e15562f81664 100644
--- a/drivers/media/dvb/ttpci/budget-core.c
+++ b/drivers/media/dvb/ttpci/budget-core.c
@@ -63,9 +63,6 @@ static int stop_ts_capture(struct budget *budget)
63{ 63{
64 dprintk(2, "budget: %p\n", budget); 64 dprintk(2, "budget: %p\n", budget);
65 65
66 if (--budget->feeding)
67 return budget->feeding;
68
69 saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off 66 saa7146_write(budget->dev, MC1, MASK_20); // DMA3 off
70 SAA7146_IER_DISABLE(budget->dev, MASK_10); 67 SAA7146_IER_DISABLE(budget->dev, MASK_10);
71 return 0; 68 return 0;
@@ -77,8 +74,8 @@ static int start_ts_capture(struct budget *budget)
77 74
78 dprintk(2, "budget: %p\n", budget); 75 dprintk(2, "budget: %p\n", budget);
79 76
80 if (budget->feeding) 77 if (!budget->feeding || !budget->fe_synced)
81 return ++budget->feeding; 78 return 0;
82 79
83 saa7146_write(dev, MC1, MASK_20); // DMA3 off 80 saa7146_write(dev, MC1, MASK_20); // DMA3 off
84 81
@@ -139,7 +136,33 @@ static int start_ts_capture(struct budget *budget)
139 SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */ 136 SAA7146_IER_ENABLE(budget->dev, MASK_10); /* VPE */
140 saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */ 137 saa7146_write(dev, MC1, (MASK_04 | MASK_20)); /* DMA3 on */
141 138
142 return ++budget->feeding; 139 return 0;
140}
141
142static int budget_read_fe_status(struct dvb_frontend *fe, fe_status_t *status)
143{
144 struct budget *budget = (struct budget *) fe->dvb->priv;
145 int synced;
146 int ret;
147
148 if (budget->read_fe_status)
149 ret = budget->read_fe_status(fe, status);
150 else
151 ret = -EINVAL;
152
153 if (!ret) {
154 synced = (*status & FE_HAS_LOCK);
155 if (synced != budget->fe_synced) {
156 budget->fe_synced = synced;
157 spin_lock(&budget->feedlock);
158 if (synced)
159 start_ts_capture(budget);
160 else
161 stop_ts_capture(budget);
162 spin_unlock(&budget->feedlock);
163 }
164 }
165 return ret;
143} 166}
144 167
145static void vpeirq(unsigned long data) 168static void vpeirq(unsigned long data)
@@ -267,7 +290,7 @@ static int budget_start_feed(struct dvb_demux_feed *feed)
267{ 290{
268 struct dvb_demux *demux = feed->demux; 291 struct dvb_demux *demux = feed->demux;
269 struct budget *budget = (struct budget *) demux->priv; 292 struct budget *budget = (struct budget *) demux->priv;
270 int status; 293 int status = 0;
271 294
272 dprintk(2, "budget: %p\n", budget); 295 dprintk(2, "budget: %p\n", budget);
273 296
@@ -276,7 +299,8 @@ static int budget_start_feed(struct dvb_demux_feed *feed)
276 299
277 spin_lock(&budget->feedlock); 300 spin_lock(&budget->feedlock);
278 feed->pusi_seen = 0; /* have a clean section start */ 301 feed->pusi_seen = 0; /* have a clean section start */
279 status = start_ts_capture(budget); 302 if (budget->feeding++ == 0)
303 status = start_ts_capture(budget);
280 spin_unlock(&budget->feedlock); 304 spin_unlock(&budget->feedlock);
281 return status; 305 return status;
282} 306}
@@ -285,12 +309,13 @@ static int budget_stop_feed(struct dvb_demux_feed *feed)
285{ 309{
286 struct dvb_demux *demux = feed->demux; 310 struct dvb_demux *demux = feed->demux;
287 struct budget *budget = (struct budget *) demux->priv; 311 struct budget *budget = (struct budget *) demux->priv;
288 int status; 312 int status = 0;
289 313
290 dprintk(2, "budget: %p\n", budget); 314 dprintk(2, "budget: %p\n", budget);
291 315
292 spin_lock(&budget->feedlock); 316 spin_lock(&budget->feedlock);
293 status = stop_ts_capture(budget); 317 if (--budget->feeding == 0)
318 status = stop_ts_capture(budget);
294 spin_unlock(&budget->feedlock); 319 spin_unlock(&budget->feedlock);
295 return status; 320 return status;
296} 321}
@@ -470,6 +495,14 @@ err:
470 return ret; 495 return ret;
471} 496}
472 497
498void ttpci_budget_init_hooks(struct budget *budget)
499{
500 if (budget->dvb_frontend && !budget->read_fe_status) {
501 budget->read_fe_status = budget->dvb_frontend->ops.read_status;
502 budget->dvb_frontend->ops.read_status = budget_read_fe_status;
503 }
504}
505
473int ttpci_budget_deinit(struct budget *budget) 506int ttpci_budget_deinit(struct budget *budget)
474{ 507{
475 struct saa7146_dev *dev = budget->dev; 508 struct saa7146_dev *dev = budget->dev;
@@ -508,11 +541,8 @@ void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
508 spin_lock(&budget->feedlock); 541 spin_lock(&budget->feedlock);
509 budget->video_port = video_port; 542 budget->video_port = video_port;
510 if (budget->feeding) { 543 if (budget->feeding) {
511 int oldfeeding = budget->feeding;
512 budget->feeding = 1;
513 stop_ts_capture(budget); 544 stop_ts_capture(budget);
514 start_ts_capture(budget); 545 start_ts_capture(budget);
515 budget->feeding = oldfeeding;
516 } 546 }
517 spin_unlock(&budget->feedlock); 547 spin_unlock(&budget->feedlock);
518} 548}
@@ -520,6 +550,7 @@ void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port)
520EXPORT_SYMBOL_GPL(ttpci_budget_debiread); 550EXPORT_SYMBOL_GPL(ttpci_budget_debiread);
521EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite); 551EXPORT_SYMBOL_GPL(ttpci_budget_debiwrite);
522EXPORT_SYMBOL_GPL(ttpci_budget_init); 552EXPORT_SYMBOL_GPL(ttpci_budget_init);
553EXPORT_SYMBOL_GPL(ttpci_budget_init_hooks);
523EXPORT_SYMBOL_GPL(ttpci_budget_deinit); 554EXPORT_SYMBOL_GPL(ttpci_budget_deinit);
524EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler); 555EXPORT_SYMBOL_GPL(ttpci_budget_irq10_handler);
525EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port); 556EXPORT_SYMBOL_GPL(ttpci_budget_set_video_port);
diff --git a/drivers/media/dvb/ttpci/budget-patch.c b/drivers/media/dvb/ttpci/budget-patch.c
index ee60ce90a400..57227441891e 100644
--- a/drivers/media/dvb/ttpci/budget-patch.c
+++ b/drivers/media/dvb/ttpci/budget-patch.c
@@ -617,6 +617,8 @@ static int budget_patch_attach (struct saa7146_dev* dev, struct saa7146_pci_exte
617 budget->dvb_adapter.priv = budget; 617 budget->dvb_adapter.priv = budget;
618 frontend_init(budget); 618 frontend_init(budget);
619 619
620 ttpci_budget_init_hooks(budget);
621
620 return 0; 622 return 0;
621} 623}
622 624
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c
index 35761f13c12b..863dffb4ed8e 100644
--- a/drivers/media/dvb/ttpci/budget.c
+++ b/drivers/media/dvb/ttpci/budget.c
@@ -375,9 +375,6 @@ static void frontend_init(struct budget *budget)
375 if (budget->dvb_frontend) { 375 if (budget->dvb_frontend) {
376 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; 376 budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params;
377 budget->dvb_frontend->tuner_priv = &budget->i2c_adap; 377 budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
378 budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd;
379 budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst;
380 budget->dvb_frontend->ops.set_tone = budget_set_tone;
381 break; 378 break;
382 } 379 }
383 break; 380 break;
@@ -474,6 +471,8 @@ static int budget_attach (struct saa7146_dev* dev, struct saa7146_pci_extension_
474 budget->dvb_adapter.priv = budget; 471 budget->dvb_adapter.priv = budget;
475 frontend_init(budget); 472 frontend_init(budget);
476 473
474 ttpci_budget_init_hooks(budget);
475
477 return 0; 476 return 0;
478} 477}
479 478
diff --git a/drivers/media/dvb/ttpci/budget.h b/drivers/media/dvb/ttpci/budget.h
index ecea3a13030e..e8a5c79178e1 100644
--- a/drivers/media/dvb/ttpci/budget.h
+++ b/drivers/media/dvb/ttpci/budget.h
@@ -52,9 +52,6 @@ struct budget {
52 struct dmx_frontend hw_frontend; 52 struct dmx_frontend hw_frontend;
53 struct dmx_frontend mem_frontend; 53 struct dmx_frontend mem_frontend;
54 54
55 int fe_synced;
56 struct mutex pid_mutex;
57
58 int ci_present; 55 int ci_present;
59 int video_port; 56 int video_port;
60 57
@@ -74,6 +71,9 @@ struct budget {
74 71
75 struct dvb_adapter dvb_adapter; 72 struct dvb_adapter dvb_adapter;
76 struct dvb_frontend *dvb_frontend; 73 struct dvb_frontend *dvb_frontend;
74 int (*read_fe_status)(struct dvb_frontend *fe, fe_status_t *status);
75 int fe_synced;
76
77 void *priv; 77 void *priv;
78}; 78};
79 79
@@ -106,6 +106,7 @@ static struct saa7146_pci_extension_data x_var = { \
106extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, 106extern int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev,
107 struct saa7146_pci_extension_data *info, 107 struct saa7146_pci_extension_data *info,
108 struct module *owner); 108 struct module *owner);
109extern void ttpci_budget_init_hooks(struct budget *budget);
109extern int ttpci_budget_deinit(struct budget *budget); 110extern int ttpci_budget_deinit(struct budget *budget);
110extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr); 111extern void ttpci_budget_irq10_handler(struct saa7146_dev *dev, u32 * isr);
111extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port); 112extern void ttpci_budget_set_video_port(struct saa7146_dev *dev, int video_port);
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 6d532f170ce5..fe56862d51e4 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -145,7 +145,7 @@ config VIDEO_SAA5246A
145 145
146config VIDEO_SAA5249 146config VIDEO_SAA5249
147 tristate "SAA5249 Teletext processor" 147 tristate "SAA5249 Teletext processor"
148 depends on VIDEO_DEV && I2C 148 depends on VIDEO_DEV && I2C && VIDEO_V4L1
149 help 149 help
150 Support for I2C bus based teletext using the SAA5249 chip. At the 150 Support for I2C bus based teletext using the SAA5249 chip. At the
151 moment this is only useful on some European WinTV cards. 151 moment this is only useful on some European WinTV cards.
@@ -155,7 +155,7 @@ config VIDEO_SAA5249
155 155
156config TUNER_3036 156config TUNER_3036
157 tristate "SAB3036 tuner" 157 tristate "SAB3036 tuner"
158 depends on VIDEO_DEV && I2C 158 depends on VIDEO_DEV && I2C && VIDEO_V4L1
159 help 159 help
160 Say Y here to include support for Philips SAB3036 compatible tuners. 160 Say Y here to include support for Philips SAB3036 compatible tuners.
161 If in doubt, say N. 161 If in doubt, say N.
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig
index 153f6a4a96c9..cdcf55650714 100644
--- a/drivers/media/video/bt8xx/Kconfig
+++ b/drivers/media/video/bt8xx/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_BT848 1config VIDEO_BT848
2 tristate "BT848 Video For Linux" 2 tristate "BT848 Video For Linux"
3 depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L2 3 depends on VIDEO_DEV && PCI && I2C && VIDEO_V4L1
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 5764a89d3562..20dff7c316eb 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3923,7 +3923,12 @@ static int __devinit bttv_register_video(struct bttv *btv)
3923 goto err; 3923 goto err;
3924 printk(KERN_INFO "bttv%d: registered device video%d\n", 3924 printk(KERN_INFO "bttv%d: registered device video%d\n",
3925 btv->c.nr,btv->video_dev->minor & 0x1f); 3925 btv->c.nr,btv->video_dev->minor & 0x1f);
3926 video_device_create_file(btv->video_dev, &class_device_attr_card); 3926 if (class_device_create_file(&btv->video_dev->class_dev,
3927 &class_device_attr_card)<0) {
3928 printk(KERN_ERR "bttv%d: class_device_create_file 'card' "
3929 "failed\n", btv->c.nr);
3930 goto err;
3931 }
3927 3932
3928 /* vbi */ 3933 /* vbi */
3929 btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi"); 3934 btv->vbi_dev = vdev_init(btv, &bttv_vbi_template, "vbi");
@@ -4287,6 +4292,8 @@ static struct pci_driver bttv_pci_driver = {
4287 4292
4288static int bttv_init_module(void) 4293static int bttv_init_module(void)
4289{ 4294{
4295 int ret;
4296
4290 bttv_num = 0; 4297 bttv_num = 0;
4291 4298
4292 printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n", 4299 printk(KERN_INFO "bttv: driver version %d.%d.%d loaded\n",
@@ -4308,7 +4315,11 @@ static int bttv_init_module(void)
4308 4315
4309 bttv_check_chipset(); 4316 bttv_check_chipset();
4310 4317
4311 bus_register(&bttv_sub_bus_type); 4318 ret = bus_register(&bttv_sub_bus_type);
4319 if (ret < 0) {
4320 printk(KERN_WARNING "bttv: bus_register error: %d\n", ret);
4321 return ret;
4322 }
4312 return pci_register_driver(&bttv_pci_driver); 4323 return pci_register_driver(&bttv_pci_driver);
4313} 4324}
4314 4325
diff --git a/drivers/media/video/bt8xx/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c
index 8c9f0f7cf467..63676e7bd635 100644
--- a/drivers/media/video/bt8xx/bttv-vbi.c
+++ b/drivers/media/video/bt8xx/bttv-vbi.c
@@ -31,11 +31,16 @@
31#include <asm/io.h> 31#include <asm/io.h>
32#include "bttvp.h" 32#include "bttvp.h"
33 33
34/* Offset from line sync pulse leading edge (0H) in 1 / sampling_rate: 34/* Offset from line sync pulse leading edge (0H) to start of VBI capture,
35 bt8x8 /HRESET pulse starts at 0H and has length 64 / fCLKx1 (E|O_VTC 35 in fCLKx2 pixels. According to the datasheet, VBI capture starts
36 HSFMT = 0). VBI_HDELAY (always 0) is an offset from the trailing edge 36 VBI_HDELAY fCLKx1 pixels from the tailing edgeof /HRESET, and /HRESET
37 of /HRESET in 1 / fCLKx1, and the sampling_rate tvnorm->Fsc is fCLKx2. */ 37 is 64 fCLKx1 pixels wide. VBI_HDELAY is set to 0, so this should be
38#define VBI_OFFSET ((64 + 0) * 2) 38 (64 + 0) * 2 = 128 fCLKx2 pixels. But it's not! The datasheet is
39 Just Plain Wrong. The real value appears to be different for
40 different revisions of the bt8x8 chips, and to be affected by the
41 horizontal scaling factor. Experimentally, the value is measured
42 to be about 244. */
43#define VBI_OFFSET 244
39 44
40#define VBI_DEFLINES 16 45#define VBI_DEFLINES 16
41#define VBI_MAXLINES 32 46#define VBI_MAXLINES 32
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index 353d02b67c33..9dddff42ec13 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -490,6 +490,23 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user
490 return 0; 490 return 0;
491} 491}
492 492
493struct video_code32
494{
495 char loadwhat[16]; /* name or tag of file being passed */
496 compat_int_t datasize;
497 unsigned char *data;
498};
499
500static inline int microcode32(struct video_code *kp, struct video_code32 __user *up)
501{
502 if(!access_ok(VERIFY_READ, up, sizeof(struct video_code32)) ||
503 copy_from_user(kp->loadwhat, up->loadwhat, sizeof (up->loadwhat)) ||
504 get_user(kp->datasize, &up->datasize) ||
505 copy_from_user(kp->data, up->data, up->datasize))
506 return -EFAULT;
507 return 0;
508}
509
493#define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32) 510#define VIDIOCGTUNER32 _IOWR('v',4, struct video_tuner32)
494#define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32) 511#define VIDIOCSTUNER32 _IOW('v',5, struct video_tuner32)
495#define VIDIOCGWIN32 _IOR('v',9, struct video_window32) 512#define VIDIOCGWIN32 _IOR('v',9, struct video_window32)
@@ -498,6 +515,7 @@ static inline int put_v4l2_input(struct v4l2_input *kp, struct v4l2_input __user
498#define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32) 515#define VIDIOCSFBUF32 _IOW('v',12, struct video_buffer32)
499#define VIDIOCGFREQ32 _IOR('v',14, u32) 516#define VIDIOCGFREQ32 _IOR('v',14, u32)
500#define VIDIOCSFREQ32 _IOW('v',15, u32) 517#define VIDIOCSFREQ32 _IOW('v',15, u32)
518#define VIDIOCSMICROCODE32 _IOW('v',27, struct video_code32)
501 519
502/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */ 520/* VIDIOC_ENUMINPUT32 is VIDIOC_ENUMINPUT minus 4 bytes of padding alignement */
503#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4) 521#define VIDIOC_ENUMINPUT32 VIDIOC_ENUMINPUT - _IOC(0, 0, 0, 4)
@@ -590,6 +608,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
590 struct video_tuner vt; 608 struct video_tuner vt;
591 struct video_buffer vb; 609 struct video_buffer vb;
592 struct video_window vw; 610 struct video_window vw;
611 struct video_code vc;
593 struct v4l2_format v2f; 612 struct v4l2_format v2f;
594 struct v4l2_buffer v2b; 613 struct v4l2_buffer v2b;
595 struct v4l2_framebuffer v2fb; 614 struct v4l2_framebuffer v2fb;
@@ -628,6 +647,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
628 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; 647 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break;
629 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; 648 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break;
630 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; 649 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
650 case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break;
631 }; 651 };
632 652
633 switch(cmd) { 653 switch(cmd) {
@@ -703,6 +723,10 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
703 case VIDIOC_G_FBUF: 723 case VIDIOC_G_FBUF:
704 case VIDIOC_G_INPUT: 724 case VIDIOC_G_INPUT:
705 compatible_arg = 0; 725 compatible_arg = 0;
726 case VIDIOCSMICROCODE:
727 err = microcode32(&karg.vc, up);
728 compatible_arg = 0;
729 break;
706 }; 730 };
707 731
708 if(err) 732 if(err)
diff --git a/drivers/media/video/cpia2/Kconfig b/drivers/media/video/cpia2/Kconfig
index 513cc0927389..e39a96152004 100644
--- a/drivers/media/video/cpia2/Kconfig
+++ b/drivers/media/video/cpia2/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CPIA2 1config VIDEO_CPIA2
2 tristate "CPiA2 Video For Linux" 2 tristate "CPiA2 Video For Linux"
3 depends on VIDEO_DEV && USB 3 depends on VIDEO_DEV && USB && VIDEO_V4L1
4 ---help--- 4 ---help---
5 This is the video4linux driver for cameras based on Vision's CPiA2 5 This is the video4linux driver for cameras based on Vision's CPiA2
6 (Colour Processor Interface ASIC), such as the Digital Blue QX5 6 (Colour Processor Interface ASIC), such as the Digital Blue QX5
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 72b630a91f41..c25564648993 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -89,7 +89,7 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
89 89
90 auxgpio = cx_read(MO_GP1_IO); 90 auxgpio = cx_read(MO_GP1_IO);
91 /* Take out the parity part */ 91 /* Take out the parity part */
92 gpio+=(gpio & 0x7fd) + (auxgpio & 0xef); 92 gpio=(gpio & 0x7fd) + (auxgpio & 0xef);
93 } else 93 } else
94 auxgpio = gpio; 94 auxgpio = gpio;
95 95
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 2225d4b94140..547cdbdb644d 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1180,7 +1180,6 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1180 V4L2_CAP_READWRITE | 1180 V4L2_CAP_READWRITE |
1181 V4L2_CAP_STREAMING | 1181 V4L2_CAP_STREAMING |
1182 V4L2_CAP_VBI_CAPTURE | 1182 V4L2_CAP_VBI_CAPTURE |
1183 V4L2_CAP_VIDEO_OVERLAY |
1184 0; 1183 0;
1185 if (UNSET != core->tuner_type) 1184 if (UNSET != core->tuner_type)
1186 cap->capabilities |= V4L2_CAP_TUNER; 1185 cap->capabilities |= V4L2_CAP_TUNER;
@@ -1226,7 +1225,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
1226 struct v4l2_format *f = arg; 1225 struct v4l2_format *f = arg;
1227 return cx8800_try_fmt(dev,fh,f); 1226 return cx8800_try_fmt(dev,fh,f);
1228 } 1227 }
1229#ifdef HAVE_V4L1 1228#ifdef CONFIG_V4L1_COMPAT
1230 /* --- streaming capture ------------------------------------- */ 1229 /* --- streaming capture ------------------------------------- */
1231 case VIDIOCGMBUF: 1230 case VIDIOCGMBUF:
1232 { 1231 {
@@ -1585,7 +1584,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
1585 *id = 0; 1584 *id = 0;
1586 return 0; 1585 return 0;
1587 } 1586 }
1588#ifdef HAVE_V4L1 1587#ifdef CONFIG_V4L1_COMPAT
1589 case VIDIOCSTUNER: 1588 case VIDIOCSTUNER:
1590 { 1589 {
1591 struct video_tuner *v = arg; 1590 struct video_tuner *v = arg;
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index dbb75a7db199..56246b8578f3 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -362,7 +362,7 @@ int msp_sleep(struct msp_state *state, int timeout)
362} 362}
363 363
364/* ------------------------------------------------------------------------ */ 364/* ------------------------------------------------------------------------ */
365 365#ifdef CONFIG_VIDEO_V4L1
366static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode) 366static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode)
367{ 367{
368 if (rxsubchans == V4L2_TUNER_SUB_MONO) 368 if (rxsubchans == V4L2_TUNER_SUB_MONO)
@@ -384,6 +384,7 @@ static int msp_mode_v4l1_to_v4l2(int mode)
384 return V4L2_TUNER_MODE_LANG1; 384 return V4L2_TUNER_MODE_LANG1;
385 return V4L2_TUNER_MODE_MONO; 385 return V4L2_TUNER_MODE_MONO;
386} 386}
387#endif
387 388
388static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) 389static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
389{ 390{
@@ -509,6 +510,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
509 /* --- v4l ioctls --- */ 510 /* --- v4l ioctls --- */
510 /* take care: bttv does userspace copying, we'll get a 511 /* take care: bttv does userspace copying, we'll get a
511 kernel pointer here... */ 512 kernel pointer here... */
513#ifdef CONFIG_VIDEO_V4L1
512 case VIDIOCGAUDIO: 514 case VIDIOCGAUDIO:
513 { 515 {
514 struct video_audio *va = arg; 516 struct video_audio *va = arg;
@@ -577,6 +579,12 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
577 } 579 }
578 580
579 case VIDIOCSFREQ: 581 case VIDIOCSFREQ:
582 {
583 /* new channel -- kick audio carrier scan */
584 msp_wake_thread(client);
585 break;
586 }
587#endif
580 case VIDIOC_S_FREQUENCY: 588 case VIDIOC_S_FREQUENCY:
581 { 589 {
582 /* new channel -- kick audio carrier scan */ 590 /* new channel -- kick audio carrier scan */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 9b48abcf6089..be1e5cc78081 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -852,7 +852,6 @@ unsigned long pvr2_hdw_get_sn(struct pvr2_hdw *hdw)
852 return hdw->serial_number; 852 return hdw->serial_number;
853} 853}
854 854
855
856int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw) 855int pvr2_hdw_get_unit_number(struct pvr2_hdw *hdw)
857{ 856{
858 return hdw->unit_number; 857 return hdw->unit_number;
@@ -2318,7 +2317,6 @@ void pvr2_hdw_poll_trigger_unlocked(struct pvr2_hdw *hdw)
2318 } 2317 }
2319} 2318}
2320 2319
2321
2322/* Return name for this driver instance */ 2320/* Return name for this driver instance */
2323const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw) 2321const char *pvr2_hdw_get_driver_name(struct pvr2_hdw *hdw)
2324{ 2322{
@@ -2542,6 +2540,10 @@ static void pvr2_ctl_timeout(unsigned long data)
2542} 2540}
2543 2541
2544 2542
2543/* Issue a command and get a response from the device. This extended
2544 version includes a probe flag (which if set means that device errors
2545 should not be logged or treated as fatal) and a timeout in jiffies.
2546 This can be used to non-lethally probe the health of endpoint 1. */
2545static int pvr2_send_request_ex(struct pvr2_hdw *hdw, 2547static int pvr2_send_request_ex(struct pvr2_hdw *hdw,
2546 unsigned int timeout,int probe_fl, 2548 unsigned int timeout,int probe_fl,
2547 void *write_data,unsigned int write_len, 2549 void *write_data,unsigned int write_len,
@@ -2970,6 +2972,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
2970} 2972}
2971 2973
2972 2974
2975/* Stop / start video stream transport */
2973static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl) 2976static int pvr2_hdw_cmd_usbstream(struct pvr2_hdw *hdw,int runFl)
2974{ 2977{
2975 int status; 2978 int status;
@@ -3068,6 +3071,7 @@ int pvr2_hdw_gpio_chg_out(struct pvr2_hdw *hdw,u32 msk,u32 val)
3068} 3071}
3069 3072
3070 3073
3074/* Find I2C address of eeprom */
3071static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) 3075static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
3072{ 3076{
3073 int result; 3077 int result;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c
index 681f79c8064e..1e393762546c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-io.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-io.c
@@ -26,6 +26,8 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28 28
29static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state);
30
29#define BUFFER_SIG 0x47653271 31#define BUFFER_SIG 0x47653271
30 32
31// #define SANITY_CHECK_BUFFERS 33// #define SANITY_CHECK_BUFFERS
@@ -515,6 +517,10 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp,
515} 517}
516 518
517/* Query / set the nominal buffer count */ 519/* Query / set the nominal buffer count */
520int pvr2_stream_get_buffer_count(struct pvr2_stream *sp)
521{
522 return sp->buffer_target_count;
523}
518 524
519int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) 525int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
520{ 526{
@@ -553,7 +559,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp)
553 return sp->r_count; 559 return sp->r_count;
554} 560}
555 561
556
557void pvr2_stream_kill(struct pvr2_stream *sp) 562void pvr2_stream_kill(struct pvr2_stream *sp)
558{ 563{
559 struct pvr2_buffer *bp; 564 struct pvr2_buffer *bp;
@@ -607,7 +612,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
607 return ret; 612 return ret;
608} 613}
609 614
610
611int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) 615int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
612{ 616{
613 int ret = 0; 617 int ret = 0;
@@ -646,7 +650,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp)
646 return bp->status; 650 return bp->status;
647} 651}
648 652
649
650int pvr2_buffer_get_id(struct pvr2_buffer *bp) 653int pvr2_buffer_get_id(struct pvr2_buffer *bp)
651{ 654{
652 return bp->id; 655 return bp->id;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.h b/drivers/media/video/pvrusb2/pvrusb2-io.h
index 96285ad234a6..93279cc2a35e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-io.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-io.h
@@ -47,6 +47,7 @@ void pvr2_stream_set_callback(struct pvr2_stream *,
47 void *data); 47 void *data);
48 48
49/* Query / set the nominal buffer count */ 49/* Query / set the nominal buffer count */
50int pvr2_stream_get_buffer_count(struct pvr2_stream *);
50int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int); 51int pvr2_stream_set_buffer_count(struct pvr2_stream *,unsigned int);
51 52
52/* Get a pointer to a buffer that is either idle, ready, or is specified 53/* Get a pointer to a buffer that is either idle, ready, or is specified
@@ -58,6 +59,7 @@ struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id);
58/* Find out how many buffers are idle or ready */ 59/* Find out how many buffers are idle or ready */
59int pvr2_stream_get_ready_count(struct pvr2_stream *); 60int pvr2_stream_get_ready_count(struct pvr2_stream *);
60 61
62
61/* Kill all pending buffers and throw away any ready buffers as well */ 63/* Kill all pending buffers and throw away any ready buffers as well */
62void pvr2_stream_kill(struct pvr2_stream *); 64void pvr2_stream_kill(struct pvr2_stream *);
63 65
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ioread.c b/drivers/media/video/pvrusb2/pvrusb2-ioread.c
index f7a2e225a002..b71f9a961f8a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ioread.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ioread.c
@@ -213,7 +213,9 @@ int pvr2_ioread_setup(struct pvr2_ioread *cp,struct pvr2_stream *sp)
213 " pvr2_ioread_setup (tear-down) id=%p",cp); 213 " pvr2_ioread_setup (tear-down) id=%p",cp);
214 pvr2_ioread_stop(cp); 214 pvr2_ioread_stop(cp);
215 pvr2_stream_kill(cp->stream); 215 pvr2_stream_kill(cp->stream);
216 pvr2_stream_set_buffer_count(cp->stream,0); 216 if (pvr2_stream_get_buffer_count(cp->stream)) {
217 pvr2_stream_set_buffer_count(cp->stream,0);
218 }
217 cp->stream = NULL; 219 cp->stream = NULL;
218 } 220 }
219 if (sp) { 221 if (sp) {
@@ -251,7 +253,6 @@ int pvr2_ioread_set_enabled(struct pvr2_ioread *cp,int fl)
251 return ret; 253 return ret;
252} 254}
253 255
254
255static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp) 256static int pvr2_ioread_get_buffer(struct pvr2_ioread *cp)
256{ 257{
257 int stat; 258 int stat;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 6af55a8b6f05..d1dda5caf406 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -44,12 +44,16 @@ struct pvr2_sysfs {
44 struct kobj_type ktype; 44 struct kobj_type ktype;
45 struct class_device_attribute attr_v4l_minor_number; 45 struct class_device_attribute attr_v4l_minor_number;
46 struct class_device_attribute attr_unit_number; 46 struct class_device_attribute attr_unit_number;
47 int v4l_minor_number_created_ok;
48 int unit_number_created_ok;
47}; 49};
48 50
49#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC 51#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
50struct pvr2_sysfs_debugifc { 52struct pvr2_sysfs_debugifc {
51 struct class_device_attribute attr_debugcmd; 53 struct class_device_attribute attr_debugcmd;
52 struct class_device_attribute attr_debuginfo; 54 struct class_device_attribute attr_debuginfo;
55 int debugcmd_created_ok;
56 int debuginfo_created_ok;
53}; 57};
54#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ 58#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
55 59
@@ -67,6 +71,7 @@ struct pvr2_sysfs_ctl_item {
67 struct pvr2_sysfs_ctl_item *item_next; 71 struct pvr2_sysfs_ctl_item *item_next;
68 struct attribute *attr_gen[7]; 72 struct attribute *attr_gen[7];
69 struct attribute_group grp; 73 struct attribute_group grp;
74 int created_ok;
70 char name[80]; 75 char name[80];
71}; 76};
72 77
@@ -487,6 +492,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)
487 struct pvr2_sysfs_func_set *fp; 492 struct pvr2_sysfs_func_set *fp;
488 struct pvr2_ctrl *cptr; 493 struct pvr2_ctrl *cptr;
489 unsigned int cnt,acnt; 494 unsigned int cnt,acnt;
495 int ret;
490 496
491 if ((ctl_id < 0) || (ctl_id >= (sizeof(funcs)/sizeof(funcs[0])))) { 497 if ((ctl_id < 0) || (ctl_id >= (sizeof(funcs)/sizeof(funcs[0])))) {
492 return; 498 return;
@@ -589,7 +595,13 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id)
589 cip->grp.name = cip->name; 595 cip->grp.name = cip->name;
590 cip->grp.attrs = cip->attr_gen; 596 cip->grp.attrs = cip->attr_gen;
591 597
592 sysfs_create_group(&sfp->class_dev->kobj,&cip->grp); 598 ret = sysfs_create_group(&sfp->class_dev->kobj,&cip->grp);
599 if (ret) {
600 printk(KERN_WARNING "%s: sysfs_create_group error: %d\n",
601 __FUNCTION__, ret);
602 return;
603 }
604 cip->created_ok = !0;
593} 605}
594 606
595#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC 607#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
@@ -600,6 +612,8 @@ static ssize_t debugcmd_store(struct class_device *,const char *,size_t count);
600static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) 612static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
601{ 613{
602 struct pvr2_sysfs_debugifc *dip; 614 struct pvr2_sysfs_debugifc *dip;
615 int ret;
616
603 dip = kmalloc(sizeof(*dip),GFP_KERNEL); 617 dip = kmalloc(sizeof(*dip),GFP_KERNEL);
604 if (!dip) return; 618 if (!dip) return;
605 memset(dip,0,sizeof(*dip)); 619 memset(dip,0,sizeof(*dip));
@@ -613,17 +627,34 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp)
613 dip->attr_debuginfo.attr.mode = S_IRUGO; 627 dip->attr_debuginfo.attr.mode = S_IRUGO;
614 dip->attr_debuginfo.show = debuginfo_show; 628 dip->attr_debuginfo.show = debuginfo_show;
615 sfp->debugifc = dip; 629 sfp->debugifc = dip;
616 class_device_create_file(sfp->class_dev,&dip->attr_debugcmd); 630 ret = class_device_create_file(sfp->class_dev,&dip->attr_debugcmd);
617 class_device_create_file(sfp->class_dev,&dip->attr_debuginfo); 631 if (ret < 0) {
632 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
633 __FUNCTION__, ret);
634 } else {
635 dip->debugcmd_created_ok = !0;
636 }
637 ret = class_device_create_file(sfp->class_dev,&dip->attr_debuginfo);
638 if (ret < 0) {
639 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
640 __FUNCTION__, ret);
641 } else {
642 dip->debuginfo_created_ok = !0;
643 }
618} 644}
619 645
620 646
621static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp) 647static void pvr2_sysfs_tear_down_debugifc(struct pvr2_sysfs *sfp)
622{ 648{
623 if (!sfp->debugifc) return; 649 if (!sfp->debugifc) return;
624 class_device_remove_file(sfp->class_dev, 650 if (sfp->debugifc->debuginfo_created_ok) {
625 &sfp->debugifc->attr_debuginfo); 651 class_device_remove_file(sfp->class_dev,
626 class_device_remove_file(sfp->class_dev,&sfp->debugifc->attr_debugcmd); 652 &sfp->debugifc->attr_debuginfo);
653 }
654 if (sfp->debugifc->debugcmd_created_ok) {
655 class_device_remove_file(sfp->class_dev,
656 &sfp->debugifc->attr_debugcmd);
657 }
627 kfree(sfp->debugifc); 658 kfree(sfp->debugifc);
628 sfp->debugifc = NULL; 659 sfp->debugifc = NULL;
629} 660}
@@ -645,7 +676,9 @@ static void pvr2_sysfs_tear_down_controls(struct pvr2_sysfs *sfp)
645 struct pvr2_sysfs_ctl_item *cip1,*cip2; 676 struct pvr2_sysfs_ctl_item *cip1,*cip2;
646 for (cip1 = sfp->item_first; cip1; cip1 = cip2) { 677 for (cip1 = sfp->item_first; cip1; cip1 = cip2) {
647 cip2 = cip1->item_next; 678 cip2 = cip1->item_next;
648 sysfs_remove_group(&sfp->class_dev->kobj,&cip1->grp); 679 if (cip1->created_ok) {
680 sysfs_remove_group(&sfp->class_dev->kobj,&cip1->grp);
681 }
649 pvr2_sysfs_trace("Destroying pvr2_sysfs_ctl_item id=%p",cip1); 682 pvr2_sysfs_trace("Destroying pvr2_sysfs_ctl_item id=%p",cip1);
650 kfree(cip1); 683 kfree(cip1);
651 } 684 }
@@ -675,8 +708,14 @@ static void class_dev_destroy(struct pvr2_sysfs *sfp)
675 pvr2_sysfs_tear_down_debugifc(sfp); 708 pvr2_sysfs_tear_down_debugifc(sfp);
676#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ 709#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
677 pvr2_sysfs_tear_down_controls(sfp); 710 pvr2_sysfs_tear_down_controls(sfp);
678 class_device_remove_file(sfp->class_dev,&sfp->attr_v4l_minor_number); 711 if (sfp->v4l_minor_number_created_ok) {
679 class_device_remove_file(sfp->class_dev,&sfp->attr_unit_number); 712 class_device_remove_file(sfp->class_dev,
713 &sfp->attr_v4l_minor_number);
714 }
715 if (sfp->unit_number_created_ok) {
716 class_device_remove_file(sfp->class_dev,
717 &sfp->attr_unit_number);
718 }
680 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev); 719 pvr2_sysfs_trace("Destroying class_dev id=%p",sfp->class_dev);
681 sfp->class_dev->class_data = NULL; 720 sfp->class_dev->class_data = NULL;
682 class_device_unregister(sfp->class_dev); 721 class_device_unregister(sfp->class_dev);
@@ -709,6 +748,8 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
709{ 748{
710 struct usb_device *usb_dev; 749 struct usb_device *usb_dev;
711 struct class_device *class_dev; 750 struct class_device *class_dev;
751 int ret;
752
712 usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); 753 usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw);
713 if (!usb_dev) return; 754 if (!usb_dev) return;
714 class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL); 755 class_dev = kmalloc(sizeof(*class_dev),GFP_KERNEL);
@@ -733,20 +774,40 @@ static void class_dev_create(struct pvr2_sysfs *sfp,
733 774
734 sfp->class_dev = class_dev; 775 sfp->class_dev = class_dev;
735 class_dev->class_data = sfp; 776 class_dev->class_data = sfp;
736 class_device_register(class_dev); 777 ret = class_device_register(class_dev);
778 if (ret) {
779 printk(KERN_ERR "%s: class_device_register failed\n",
780 __FUNCTION__);
781 kfree(class_dev);
782 return;
783 }
737 784
738 sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE; 785 sfp->attr_v4l_minor_number.attr.owner = THIS_MODULE;
739 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number"; 786 sfp->attr_v4l_minor_number.attr.name = "v4l_minor_number";
740 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO; 787 sfp->attr_v4l_minor_number.attr.mode = S_IRUGO;
741 sfp->attr_v4l_minor_number.show = v4l_minor_number_show; 788 sfp->attr_v4l_minor_number.show = v4l_minor_number_show;
742 sfp->attr_v4l_minor_number.store = NULL; 789 sfp->attr_v4l_minor_number.store = NULL;
743 class_device_create_file(sfp->class_dev,&sfp->attr_v4l_minor_number); 790 ret = class_device_create_file(sfp->class_dev,
791 &sfp->attr_v4l_minor_number);
792 if (ret < 0) {
793 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
794 __FUNCTION__, ret);
795 } else {
796 sfp->v4l_minor_number_created_ok = !0;
797 }
798
744 sfp->attr_unit_number.attr.owner = THIS_MODULE; 799 sfp->attr_unit_number.attr.owner = THIS_MODULE;
745 sfp->attr_unit_number.attr.name = "unit_number"; 800 sfp->attr_unit_number.attr.name = "unit_number";
746 sfp->attr_unit_number.attr.mode = S_IRUGO; 801 sfp->attr_unit_number.attr.mode = S_IRUGO;
747 sfp->attr_unit_number.show = unit_number_show; 802 sfp->attr_unit_number.show = unit_number_show;
748 sfp->attr_unit_number.store = NULL; 803 sfp->attr_unit_number.store = NULL;
749 class_device_create_file(sfp->class_dev,&sfp->attr_unit_number); 804 ret = class_device_create_file(sfp->class_dev,&sfp->attr_unit_number);
805 if (ret < 0) {
806 printk(KERN_WARNING "%s: class_device_create_file error: %d\n",
807 __FUNCTION__, ret);
808 } else {
809 sfp->unit_number_created_ok = !0;
810 }
750 811
751 pvr2_sysfs_add_controls(sfp); 812 pvr2_sysfs_add_controls(sfp);
752#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC 813#ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index f1fd69e7f119..d73cff1970ae 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -997,9 +997,9 @@ static int saa7134_alsa_init(void)
997 struct saa7134_dev *dev = NULL; 997 struct saa7134_dev *dev = NULL;
998 struct list_head *list; 998 struct list_head *list;
999 999
1000 if (!dmasound_init && !dmasound_exit) { 1000 if (!saa7134_dmasound_init && !saa7134_dmasound_exit) {
1001 dmasound_init = alsa_device_init; 1001 saa7134_dmasound_init = alsa_device_init;
1002 dmasound_exit = alsa_device_exit; 1002 saa7134_dmasound_exit = alsa_device_exit;
1003 } else { 1003 } else {
1004 printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); 1004 printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n");
1005 return -EBUSY; 1005 return -EBUSY;
@@ -1036,8 +1036,8 @@ static void saa7134_alsa_exit(void)
1036 snd_card_free(snd_saa7134_cards[idx]); 1036 snd_card_free(snd_saa7134_cards[idx]);
1037 } 1037 }
1038 1038
1039 dmasound_init = NULL; 1039 saa7134_dmasound_init = NULL;
1040 dmasound_exit = NULL; 1040 saa7134_dmasound_exit = NULL;
1041 printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); 1041 printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n");
1042 1042
1043 return; 1043 return;
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 6e97cc84ba89..be3a81fc90a2 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -95,8 +95,8 @@ LIST_HEAD(saa7134_devlist);
95static LIST_HEAD(mops_list); 95static LIST_HEAD(mops_list);
96static unsigned int saa7134_devcount; 96static unsigned int saa7134_devcount;
97 97
98int (*dmasound_init)(struct saa7134_dev *dev); 98int (*saa7134_dmasound_init)(struct saa7134_dev *dev);
99int (*dmasound_exit)(struct saa7134_dev *dev); 99int (*saa7134_dmasound_exit)(struct saa7134_dev *dev);
100 100
101#define dprintk(fmt, arg...) if (core_debug) \ 101#define dprintk(fmt, arg...) if (core_debug) \
102 printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) 102 printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg)
@@ -1008,8 +1008,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1008 /* check for signal */ 1008 /* check for signal */
1009 saa7134_irq_video_intl(dev); 1009 saa7134_irq_video_intl(dev);
1010 1010
1011 if (dmasound_init && !dev->dmasound.priv_data) { 1011 if (saa7134_dmasound_init && !dev->dmasound.priv_data) {
1012 dmasound_init(dev); 1012 saa7134_dmasound_init(dev);
1013 } 1013 }
1014 1014
1015 return 0; 1015 return 0;
@@ -1036,8 +1036,8 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1036 struct saa7134_mpeg_ops *mops; 1036 struct saa7134_mpeg_ops *mops;
1037 1037
1038 /* Release DMA sound modules if present */ 1038 /* Release DMA sound modules if present */
1039 if (dmasound_exit && dev->dmasound.priv_data) { 1039 if (saa7134_dmasound_exit && dev->dmasound.priv_data) {
1040 dmasound_exit(dev); 1040 saa7134_dmasound_exit(dev);
1041 } 1041 }
1042 1042
1043 /* debugging ... */ 1043 /* debugging ... */
@@ -1169,8 +1169,8 @@ EXPORT_SYMBOL(saa7134_boards);
1169 1169
1170/* ----------------- for the DMA sound modules --------------- */ 1170/* ----------------- for the DMA sound modules --------------- */
1171 1171
1172EXPORT_SYMBOL(dmasound_init); 1172EXPORT_SYMBOL(saa7134_dmasound_init);
1173EXPORT_SYMBOL(dmasound_exit); 1173EXPORT_SYMBOL(saa7134_dmasound_exit);
1174EXPORT_SYMBOL(saa7134_pgtable_free); 1174EXPORT_SYMBOL(saa7134_pgtable_free);
1175EXPORT_SYMBOL(saa7134_pgtable_build); 1175EXPORT_SYMBOL(saa7134_pgtable_build);
1176EXPORT_SYMBOL(saa7134_pgtable_alloc); 1176EXPORT_SYMBOL(saa7134_pgtable_alloc);
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 3895d05804ae..2e3ba5f31453 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -993,9 +993,9 @@ static int saa7134_oss_init(void)
993 struct saa7134_dev *dev = NULL; 993 struct saa7134_dev *dev = NULL;
994 struct list_head *list; 994 struct list_head *list;
995 995
996 if (!dmasound_init && !dmasound_exit) { 996 if (!saa7134_dmasound_init && !saa7134_dmasound_exit) {
997 dmasound_init = oss_device_init; 997 saa7134_dmasound_init = oss_device_init;
998 dmasound_exit = oss_device_exit; 998 saa7134_dmasound_exit = oss_device_exit;
999 } else { 999 } else {
1000 printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n"); 1000 printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n");
1001 return -EBUSY; 1001 return -EBUSY;
@@ -1037,8 +1037,8 @@ static void saa7134_oss_exit(void)
1037 1037
1038 } 1038 }
1039 1039
1040 dmasound_init = NULL; 1040 saa7134_dmasound_init = NULL;
1041 dmasound_exit = NULL; 1041 saa7134_dmasound_exit = NULL;
1042 1042
1043 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); 1043 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n");
1044 1044
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index e4156ec9c6d7..8656f2400e18 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -40,7 +40,7 @@
40 40
41static unsigned int video_debug = 0; 41static unsigned int video_debug = 0;
42static unsigned int gbuffers = 8; 42static unsigned int gbuffers = 8;
43static unsigned int noninterlaced = 0; 43static unsigned int noninterlaced = 1;
44static unsigned int gbufsize = 720*576*4; 44static unsigned int gbufsize = 720*576*4;
45static unsigned int gbufsize_max = 720*576*4; 45static unsigned int gbufsize_max = 720*576*4;
46module_param(video_debug, int, 0644); 46module_param(video_debug, int, 0644);
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(video_debug,"enable debug messages [video]");
48module_param(gbuffers, int, 0444); 48module_param(gbuffers, int, 0444);
49MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32"); 49MODULE_PARM_DESC(gbuffers,"number of capture buffers, range 2-32");
50module_param(noninterlaced, int, 0644); 50module_param(noninterlaced, int, 0644);
51MODULE_PARM_DESC(noninterlaced,"video input is noninterlaced"); 51MODULE_PARM_DESC(noninterlaced,"capture non interlaced video");
52 52
53#define dprintk(fmt, arg...) if (video_debug) \ 53#define dprintk(fmt, arg...) if (video_debug) \
54 printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg) 54 printk(KERN_DEBUG "%s/video: " fmt, dev->name , ## arg)
@@ -2087,7 +2087,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
2087 struct v4l2_format *f = arg; 2087 struct v4l2_format *f = arg;
2088 return saa7134_try_fmt(dev,fh,f); 2088 return saa7134_try_fmt(dev,fh,f);
2089 } 2089 }
2090#ifdef HAVE_V4L1 2090#ifdef CONFIG_V4L1_COMPAT
2091 case VIDIOCGMBUF: 2091 case VIDIOCGMBUF:
2092 { 2092 {
2093 struct video_mbuf *mbuf = arg; 2093 struct video_mbuf *mbuf = arg;
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index d5ee99c574cc..c04ce6152fd5 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -586,8 +586,8 @@ void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf);
586 586
587int saa7134_set_dmabits(struct saa7134_dev *dev); 587int saa7134_set_dmabits(struct saa7134_dev *dev);
588 588
589extern int (*dmasound_init)(struct saa7134_dev *dev); 589extern int (*saa7134_dmasound_init)(struct saa7134_dev *dev);
590extern int (*dmasound_exit)(struct saa7134_dev *dev); 590extern int (*saa7134_dmasound_exit)(struct saa7134_dev *dev);
591 591
592 592
593/* ----------------------------------------------------------- */ 593/* ----------------------------------------------------------- */
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index b36ba9fa3a28..5686547ba76a 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -2181,7 +2181,6 @@ static struct pci_device_id stradis_pci_tbl[] = {
2181 { 0 } 2181 { 0 }
2182}; 2182};
2183 2183
2184MODULE_DEVICE_TABLE(pci, stradis_pci_tbl);
2185 2184
2186static struct pci_driver stradis_driver = { 2185static struct pci_driver stradis_driver = {
2187 .name = "stradis", 2186 .name = "stradis",
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index f7eb402d5f2b..40590bae5ff7 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -196,14 +196,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
196 i2c_master_send(c, buffer, 4); 196 i2c_master_send(c, buffer, 4);
197 default_tuner_init(c); 197 default_tuner_init(c);
198 break; 198 break;
199 case TUNER_LG_TDVS_H06XF:
200 /* Set the Auxiliary Byte. */
201 buffer[2] &= ~0x20;
202 buffer[2] |= 0x18;
203 buffer[3] = 0x20;
204 i2c_master_send(c, buffer, 4);
205 default_tuner_init(c);
206 break;
207 case TUNER_PHILIPS_TD1316: 199 case TUNER_PHILIPS_TD1316:
208 buffer[0] = 0x0b; 200 buffer[0] = 0x0b;
209 buffer[1] = 0xdc; 201 buffer[1] = 0xdc;
@@ -598,6 +590,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
598 if (t->standby) 590 if (t->standby)
599 t->standby (client); 591 t->standby (client);
600 break; 592 break;
593#ifdef CONFIG_VIDEO_V4L1
601 case VIDIOCSAUDIO: 594 case VIDIOCSAUDIO:
602 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) 595 if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
603 return 0; 596 return 0;
@@ -607,17 +600,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
607 /* Should be implemented, since bttv calls it */ 600 /* Should be implemented, since bttv calls it */
608 tuner_dbg("VIDIOCSAUDIO not implemented.\n"); 601 tuner_dbg("VIDIOCSAUDIO not implemented.\n");
609 break; 602 break;
610 case TDA9887_SET_CONFIG:
611 if (t->type == TUNER_TDA9887) {
612 int *i = arg;
613
614 t->tda9887_config = *i;
615 set_freq(client, t->tv_freq);
616 }
617 break;
618 /* --- v4l ioctls --- */
619 /* take care: bttv does userspace copying, we'll get a
620 kernel pointer here... */
621 case VIDIOCSCHAN: 603 case VIDIOCSCHAN:
622 { 604 {
623 static const v4l2_std_id map[] = { 605 static const v4l2_std_id map[] = {
@@ -701,7 +683,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
701 ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; 683 ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
702 return 0; 684 return 0;
703 } 685 }
686#endif
687 case TDA9887_SET_CONFIG:
688 if (t->type == TUNER_TDA9887) {
689 int *i = arg;
704 690
691 t->tda9887_config = *i;
692 set_freq(client, t->tv_freq);
693 }
694 break;
695 /* --- v4l ioctls --- */
696 /* take care: bttv does userspace copying, we'll get a
697 kernel pointer here... */
705 case VIDIOC_S_STD: 698 case VIDIOC_S_STD:
706 { 699 {
707 v4l2_std_id *id = arg; 700 v4l2_std_id *id = arg;
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index d071c5cbf013..abe37cf632c6 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -339,7 +339,20 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
339 if (4 != (rc = i2c_master_send(c,buffer,4))) 339 if (4 != (rc = i2c_master_send(c,buffer,4)))
340 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 340 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc);
341 341
342 if (t->type == TUNER_MICROTUNE_4042FI5) { 342 switch (t->type) {
343 case TUNER_LG_TDVS_H06XF:
344 /* Set the Auxiliary Byte. */
345 buffer[0] = buffer[2];
346 buffer[0] &= ~0x20;
347 buffer[0] |= 0x18;
348 buffer[1] = 0x20;
349 tuner_dbg("tv 0x%02x 0x%02x\n",buffer[0],buffer[1]);
350
351 if (2 != (rc = i2c_master_send(c,buffer,2)))
352 tuner_warn("i2c i/o error: rc == %d (should be 2)\n",rc);
353 break;
354 case TUNER_MICROTUNE_4042FI5:
355 {
343 // FIXME - this may also work for other tuners 356 // FIXME - this may also work for other tuners
344 unsigned long timeout = jiffies + msecs_to_jiffies(1); 357 unsigned long timeout = jiffies + msecs_to_jiffies(1);
345 u8 status_byte = 0; 358 u8 status_byte = 0;
@@ -364,10 +377,12 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
364 buffer[2] = config; 377 buffer[2] = config;
365 buffer[3] = cb; 378 buffer[3] = cb;
366 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 379 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
367 buffer[0],buffer[1],buffer[2],buffer[3]); 380 buffer[0],buffer[1],buffer[2],buffer[3]);
368 381
369 if (4 != (rc = i2c_master_send(c,buffer,4))) 382 if (4 != (rc = i2c_master_send(c,buffer,4)))
370 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc); 383 tuner_warn("i2c i/o error: rc == %d (should be 4)\n",rc);
384 break;
385 }
371 } 386 }
372} 387}
373 388
diff --git a/drivers/media/video/usbvideo/Kconfig b/drivers/media/video/usbvideo/Kconfig
index 59fb899f31f3..a0fd82b924f2 100644
--- a/drivers/media/video/usbvideo/Kconfig
+++ b/drivers/media/video/usbvideo/Kconfig
@@ -3,7 +3,7 @@ config VIDEO_USBVIDEO
3 3
4config USB_VICAM 4config USB_VICAM
5 tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" 5 tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)"
6 depends on USB && VIDEO_V4L1 && EXPERIMENTAL 6 depends on USB && VIDEO_DEV && VIDEO_V4L1 && EXPERIMENTAL
7 select VIDEO_USBVIDEO 7 select VIDEO_USBVIDEO
8 ---help--- 8 ---help---
9 Say Y here if you have 3com homeconnect camera (vicam). 9 Say Y here if you have 3com homeconnect camera (vicam).
@@ -13,7 +13,7 @@ config USB_VICAM
13 13
14config USB_IBMCAM 14config USB_IBMCAM
15 tristate "USB IBM (Xirlink) C-it Camera support" 15 tristate "USB IBM (Xirlink) C-it Camera support"
16 depends on USB && VIDEO_V4L1 16 depends on USB && VIDEO_DEV && VIDEO_V4L1
17 select VIDEO_USBVIDEO 17 select VIDEO_USBVIDEO
18 ---help--- 18 ---help---
19 Say Y here if you want to connect a IBM "C-It" camera, also known as 19 Say Y here if you want to connect a IBM "C-It" camera, also known as
@@ -28,7 +28,7 @@ config USB_IBMCAM
28 28
29config USB_KONICAWC 29config USB_KONICAWC
30 tristate "USB Konica Webcam support" 30 tristate "USB Konica Webcam support"
31 depends on USB && VIDEO_V4L1 31 depends on USB && VIDEO_DEV && VIDEO_V4L1
32 select VIDEO_USBVIDEO 32 select VIDEO_USBVIDEO
33 ---help--- 33 ---help---
34 Say Y here if you want support for webcams based on a Konica 34 Say Y here if you want support for webcams based on a Konica
@@ -39,7 +39,7 @@ config USB_KONICAWC
39 39
40config USB_QUICKCAM_MESSENGER 40config USB_QUICKCAM_MESSENGER
41 tristate "USB Logitech Quickcam Messenger" 41 tristate "USB Logitech Quickcam Messenger"
42 depends on USB && VIDEO_DEV 42 depends on USB && VIDEO_DEV && VIDEO_V4L1
43 select VIDEO_USBVIDEO 43 select VIDEO_USBVIDEO
44 ---help--- 44 ---help---
45 Say Y or M here to enable support for the USB Logitech Quickcam 45 Say Y or M here to enable support for the USB Logitech Quickcam
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index f06dc19e504a..2ecbeffb559e 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -202,7 +202,7 @@ static char *v4l2_memory_names[] = {
202/* ------------------------------------------------------------------ */ 202/* ------------------------------------------------------------------ */
203/* debug help functions */ 203/* debug help functions */
204 204
205#ifdef HAVE_V4L1 205#ifdef CONFIG_V4L1_COMPAT
206static const char *v4l1_ioctls[] = { 206static const char *v4l1_ioctls[] = {
207 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", 207 [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
208 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", 208 [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
@@ -301,7 +301,7 @@ static const char *v4l2_ioctls[] = {
301#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) 301#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
302 302
303static const char *v4l2_int_ioctls[] = { 303static const char *v4l2_int_ioctls[] = {
304#ifdef HAVE_VIDEO_DECODER 304#ifdef CONFIG_V4L1_COMPAT
305 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", 305 [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
306 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", 306 [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
307 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", 307 [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
@@ -367,7 +367,7 @@ void v4l_printk_ioctl(unsigned int cmd)
367 (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? 367 (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
368 v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); 368 v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
369 break; 369 break;
370#ifdef HAVE_V4L1 370#ifdef CONFIG_V4L1_COMPAT
371 case 'v': 371 case 'v':
372 printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", 372 printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
373 (_IOC_NR(cmd) < V4L1_IOCTLS) ? 373 (_IOC_NR(cmd) < V4L1_IOCTLS) ?
@@ -414,6 +414,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
414 printk ("%s: tuner type=%d\n", s, *p); 414 printk ("%s: tuner type=%d\n", s, *p);
415 break; 415 break;
416 } 416 }
417#ifdef CONFIG_VIDEO_V4L1_COMPAT
417 case DECODER_SET_VBI_BYPASS: 418 case DECODER_SET_VBI_BYPASS:
418 case DECODER_ENABLE_OUTPUT: 419 case DECODER_ENABLE_OUTPUT:
419 case DECODER_GET_STATUS: 420 case DECODER_GET_STATUS:
@@ -424,6 +425,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
424 case VIDIOCCAPTURE: 425 case VIDIOCCAPTURE:
425 case VIDIOCSYNC: 426 case VIDIOCSYNC:
426 case VIDIOCSWRITEMODE: 427 case VIDIOCSWRITEMODE:
428#endif
427 case TUNER_SET_TYPE_ADDR: 429 case TUNER_SET_TYPE_ADDR:
428 case TUNER_SET_STANDBY: 430 case TUNER_SET_STANDBY:
429 case TDA9887_SET_CONFIG: 431 case TDA9887_SET_CONFIG:
@@ -755,6 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
755 p->afc); 757 p->afc);
756 break; 758 break;
757 } 759 }
760#ifdef CONFIG_VIDEO_V4L1_COMPAT
758 case VIDIOCGVBIFMT: 761 case VIDIOCGVBIFMT:
759 case VIDIOCSVBIFMT: 762 case VIDIOCSVBIFMT:
760 { 763 {
@@ -924,6 +927,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
924 p->clipcount); 927 p->clipcount);
925 break; 928 break;
926 } 929 }
930 case VIDIOCGFREQ:
931 case VIDIOCSFREQ:
932 {
933 unsigned long *p=arg;
934 printk ("%s: value=%lu\n", s, *p);
935 break;
936 }
937#endif
927 case VIDIOC_INT_AUDIO_CLOCK_FREQ: 938 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
928 case VIDIOC_INT_I2S_CLOCK_FREQ: 939 case VIDIOC_INT_I2S_CLOCK_FREQ:
929 case VIDIOC_INT_S_STANDBY: 940 case VIDIOC_INT_S_STANDBY:
@@ -933,13 +944,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
933 printk ("%s: value=%d\n", s, *p); 944 printk ("%s: value=%d\n", s, *p);
934 break; 945 break;
935 } 946 }
936 case VIDIOCGFREQ:
937 case VIDIOCSFREQ:
938 {
939 unsigned long *p=arg;
940 printk ("%s: value=%lu\n", s, *p);
941 break;
942 }
943 case VIDIOC_G_STD: 947 case VIDIOC_G_STD:
944 case VIDIOC_S_STD: 948 case VIDIOC_S_STD:
945 case VIDIOC_QUERYSTD: 949 case VIDIOC_QUERYSTD:
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index b26ebaff226f..0fc90cd393f6 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
760 ret=vfd->vidioc_overlay(file, fh, *i); 760 ret=vfd->vidioc_overlay(file, fh, *i);
761 break; 761 break;
762 } 762 }
763#ifdef HAVE_V4L1 763#ifdef CONFIG_V4L1_COMPAT
764 /* --- streaming capture ------------------------------------- */ 764 /* --- streaming capture ------------------------------------- */
765 case VIDIOCGMBUF: 765 case VIDIOCGMBUF:
766 { 766 {
@@ -1512,6 +1512,7 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1512 int i=0; 1512 int i=0;
1513 int base; 1513 int base;
1514 int end; 1514 int end;
1515 int ret;
1515 char *name_base; 1516 char *name_base;
1516 1517
1517 switch(type) 1518 switch(type)
@@ -1537,6 +1538,8 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1537 name_base = "radio"; 1538 name_base = "radio";
1538 break; 1539 break;
1539 default: 1540 default:
1541 printk(KERN_ERR "%s called with unknown type: %d\n",
1542 __FUNCTION__, type);
1540 return -1; 1543 return -1;
1541 } 1544 }
1542 1545
@@ -1571,9 +1574,18 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1571 vfd->class_dev.class = &video_class; 1574 vfd->class_dev.class = &video_class;
1572 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); 1575 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
1573 sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base); 1576 sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
1574 class_device_register(&vfd->class_dev); 1577 ret = class_device_register(&vfd->class_dev);
1575 class_device_create_file(&vfd->class_dev, 1578 if (ret < 0) {
1576 &class_device_attr_name); 1579 printk(KERN_ERR "%s: class_device_register failed\n",
1580 __FUNCTION__);
1581 goto fail_minor;
1582 }
1583 ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name);
1584 if (ret < 0) {
1585 printk(KERN_ERR "%s: class_device_create_file 'name' failed\n",
1586 __FUNCTION__);
1587 goto fail_classdev;
1588 }
1577 1589
1578#if 1 1590#if 1
1579 /* needed until all drivers are fixed */ 1591 /* needed until all drivers are fixed */
@@ -1583,6 +1595,15 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1583 "http://lwn.net/Articles/36850/\n", vfd->name); 1595 "http://lwn.net/Articles/36850/\n", vfd->name);
1584#endif 1596#endif
1585 return 0; 1597 return 0;
1598
1599fail_classdev:
1600 class_device_unregister(&vfd->class_dev);
1601fail_minor:
1602 mutex_lock(&videodev_lock);
1603 video_device[vfd->minor] = NULL;
1604 vfd->minor = -1;
1605 mutex_unlock(&videodev_lock);
1606 return ret;
1586} 1607}
1587 1608
1588/** 1609/**
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 41d23c8acbd8..38bd0c1018c2 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -986,7 +986,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *p)
986 file->f_flags & O_NONBLOCK)); 986 file->f_flags & O_NONBLOCK));
987} 987}
988 988
989#ifdef HAVE_V4L1 989#ifdef CONFIG_V4L1_COMPAT
990static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) 990static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
991{ 991{
992 struct vivi_fh *fh=priv; 992 struct vivi_fh *fh=priv;
@@ -1328,7 +1328,7 @@ static struct video_device vivi = {
1328 .vidioc_s_ctrl = vidioc_s_ctrl, 1328 .vidioc_s_ctrl = vidioc_s_ctrl,
1329 .vidioc_streamon = vidioc_streamon, 1329 .vidioc_streamon = vidioc_streamon,
1330 .vidioc_streamoff = vidioc_streamoff, 1330 .vidioc_streamoff = vidioc_streamoff,
1331#ifdef HAVE_V4L1 1331#ifdef CONFIG_V4L1_COMPAT
1332 .vidiocgmbuf = vidiocgmbuf, 1332 .vidiocgmbuf = vidiocgmbuf,
1333#endif 1333#endif
1334 .tvnorms = tvnorms, 1334 .tvnorms = tvnorms,
diff --git a/drivers/net/appletalk/Kconfig b/drivers/net/appletalk/Kconfig
index b14e89004c3a..0a0e0cd81a23 100644
--- a/drivers/net/appletalk/Kconfig
+++ b/drivers/net/appletalk/Kconfig
@@ -29,7 +29,7 @@ config ATALK
29 even politically correct people are allowed to say Y here. 29 even politically correct people are allowed to say Y here.
30 30
31config DEV_APPLETALK 31config DEV_APPLETALK
32 bool "Appletalk interfaces support" 32 tristate "Appletalk interfaces support"
33 depends on ATALK 33 depends on ATALK
34 help 34 help
35 AppleTalk is the protocol that Apple computers can use to communicate 35 AppleTalk is the protocol that Apple computers can use to communicate
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index da62db897426..627f224d78bc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3127,7 +3127,7 @@ e1000_change_mtu(struct net_device *netdev, int new_mtu)
3127 break; 3127 break;
3128 } 3128 }
3129 3129
3130 /* NOTE: dev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN 3130 /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
3131 * means we reserve 2 more, this pushes us to allocate from the next 3131 * means we reserve 2 more, this pushes us to allocate from the next
3132 * larger slab size 3132 * larger slab size
3133 * i.e. RXBUFFER_2048 --> size-4096 slab */ 3133 * i.e. RXBUFFER_2048 --> size-4096 slab */
@@ -3708,7 +3708,7 @@ e1000_clean_rx_irq(struct e1000_adapter *adapter,
3708#define E1000_CB_LENGTH 256 3708#define E1000_CB_LENGTH 256
3709 if (length < E1000_CB_LENGTH) { 3709 if (length < E1000_CB_LENGTH) {
3710 struct sk_buff *new_skb = 3710 struct sk_buff *new_skb =
3711 dev_alloc_skb(length + NET_IP_ALIGN); 3711 netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
3712 if (new_skb) { 3712 if (new_skb) {
3713 skb_reserve(new_skb, NET_IP_ALIGN); 3713 skb_reserve(new_skb, NET_IP_ALIGN);
3714 new_skb->dev = netdev; 3714 new_skb->dev = netdev;
@@ -3979,7 +3979,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
3979 3979
3980 while (cleaned_count--) { 3980 while (cleaned_count--) {
3981 if (!(skb = buffer_info->skb)) 3981 if (!(skb = buffer_info->skb))
3982 skb = dev_alloc_skb(bufsz); 3982 skb = netdev_alloc_skb(netdev, bufsz);
3983 else { 3983 else {
3984 skb_trim(skb, 0); 3984 skb_trim(skb, 0);
3985 goto map_skb; 3985 goto map_skb;
@@ -3997,7 +3997,7 @@ e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
3997 DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes " 3997 DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes "
3998 "at %p\n", bufsz, skb->data); 3998 "at %p\n", bufsz, skb->data);
3999 /* Try again, without freeing the previous */ 3999 /* Try again, without freeing the previous */
4000 skb = dev_alloc_skb(bufsz); 4000 skb = netdev_alloc_skb(netdev, bufsz);
4001 /* Failed allocation, critical failure */ 4001 /* Failed allocation, critical failure */
4002 if (!skb) { 4002 if (!skb) {
4003 dev_kfree_skb(oldskb); 4003 dev_kfree_skb(oldskb);
@@ -4121,7 +4121,8 @@ e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
4121 rx_desc->read.buffer_addr[j+1] = ~0; 4121 rx_desc->read.buffer_addr[j+1] = ~0;
4122 } 4122 }
4123 4123
4124 skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN); 4124 skb = netdev_alloc_skb(netdev,
4125 adapter->rx_ps_bsize0 + NET_IP_ALIGN);
4125 4126
4126 if (unlikely(!skb)) { 4127 if (unlikely(!skb)) {
4127 adapter->alloc_rx_buff_failed++; 4128 adapter->alloc_rx_buff_failed++;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 1b8138f641e3..6f97962dd06b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -68,8 +68,8 @@
68 68
69#define DRV_MODULE_NAME "tg3" 69#define DRV_MODULE_NAME "tg3"
70#define PFX DRV_MODULE_NAME ": " 70#define PFX DRV_MODULE_NAME ": "
71#define DRV_MODULE_VERSION "3.63" 71#define DRV_MODULE_VERSION "3.64"
72#define DRV_MODULE_RELDATE "July 25, 2006" 72#define DRV_MODULE_RELDATE "July 31, 2006"
73 73
74#define TG3_DEF_MAC_MODE 0 74#define TG3_DEF_MAC_MODE 0
75#define TG3_DEF_RX_MODE 0 75#define TG3_DEF_RX_MODE 0
@@ -3097,7 +3097,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key,
3097 * Callers depend upon this behavior and assume that 3097 * Callers depend upon this behavior and assume that
3098 * we leave everything unchanged if we fail. 3098 * we leave everything unchanged if we fail.
3099 */ 3099 */
3100 skb = dev_alloc_skb(skb_size); 3100 skb = netdev_alloc_skb(tp->dev, skb_size);
3101 if (skb == NULL) 3101 if (skb == NULL)
3102 return -ENOMEM; 3102 return -ENOMEM;
3103 3103
@@ -3270,7 +3270,7 @@ static int tg3_rx(struct tg3 *tp, int budget)
3270 tg3_recycle_rx(tp, opaque_key, 3270 tg3_recycle_rx(tp, opaque_key,
3271 desc_idx, *post_ptr); 3271 desc_idx, *post_ptr);
3272 3272
3273 copy_skb = dev_alloc_skb(len + 2); 3273 copy_skb = netdev_alloc_skb(tp->dev, len + 2);
3274 if (copy_skb == NULL) 3274 if (copy_skb == NULL)
3275 goto drop_it_no_recycle; 3275 goto drop_it_no_recycle;
3276 3276
@@ -8618,7 +8618,7 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
8618 err = -EIO; 8618 err = -EIO;
8619 8619
8620 tx_len = 1514; 8620 tx_len = 1514;
8621 skb = dev_alloc_skb(tx_len); 8621 skb = netdev_alloc_skb(tp->dev, tx_len);
8622 if (!skb) 8622 if (!skb)
8623 return -ENOMEM; 8623 return -ENOMEM;
8624 8624
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index efc9c4bd826f..da9d06bdb818 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -797,7 +797,7 @@ static int zd1211_hw_init_hmac(struct zd_chip *chip)
797 { CR_ADDA_MBIAS_WARMTIME, 0x30000808 }, 797 { CR_ADDA_MBIAS_WARMTIME, 0x30000808 },
798 { CR_ZD1211_RETRY_MAX, 0x2 }, 798 { CR_ZD1211_RETRY_MAX, 0x2 },
799 { CR_SNIFFER_ON, 0 }, 799 { CR_SNIFFER_ON, 0 },
800 { CR_RX_FILTER, AP_RX_FILTER }, 800 { CR_RX_FILTER, STA_RX_FILTER },
801 { CR_GROUP_HASH_P1, 0x00 }, 801 { CR_GROUP_HASH_P1, 0x00 },
802 { CR_GROUP_HASH_P2, 0x80000000 }, 802 { CR_GROUP_HASH_P2, 0x80000000 },
803 { CR_REG1, 0xa4 }, 803 { CR_REG1, 0xa4 },
@@ -844,7 +844,7 @@ static int zd1211b_hw_init_hmac(struct zd_chip *chip)
844 { CR_ZD1211B_AIFS_CTL2, 0x008C003C }, 844 { CR_ZD1211B_AIFS_CTL2, 0x008C003C },
845 { CR_ZD1211B_TXOP, 0x01800824 }, 845 { CR_ZD1211B_TXOP, 0x01800824 },
846 { CR_SNIFFER_ON, 0 }, 846 { CR_SNIFFER_ON, 0 },
847 { CR_RX_FILTER, AP_RX_FILTER }, 847 { CR_RX_FILTER, STA_RX_FILTER },
848 { CR_GROUP_HASH_P1, 0x00 }, 848 { CR_GROUP_HASH_P1, 0x00 },
849 { CR_GROUP_HASH_P2, 0x80000000 }, 849 { CR_GROUP_HASH_P2, 0x80000000 },
850 { CR_REG1, 0xa4 }, 850 { CR_REG1, 0xa4 },
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 805121093ab5..069d2b467339 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -461,10 +461,15 @@
461 461
462#define CR_RX_FILTER CTL_REG(0x068c) 462#define CR_RX_FILTER CTL_REG(0x068c)
463#define RX_FILTER_ASSOC_RESPONSE 0x0002 463#define RX_FILTER_ASSOC_RESPONSE 0x0002
464#define RX_FILTER_REASSOC_RESPONSE 0x0008
464#define RX_FILTER_PROBE_RESPONSE 0x0020 465#define RX_FILTER_PROBE_RESPONSE 0x0020
465#define RX_FILTER_BEACON 0x0100 466#define RX_FILTER_BEACON 0x0100
467#define RX_FILTER_DISASSOC 0x0400
466#define RX_FILTER_AUTH 0x0800 468#define RX_FILTER_AUTH 0x0800
467/* Sniff modus sets filter to 0xfffff */ 469#define AP_RX_FILTER 0x0400feff
470#define STA_RX_FILTER 0x0000ffff
471
472/* Monitor mode sets filter to 0xfffff */
468 473
469#define CR_ACK_TIMEOUT_EXT CTL_REG(0x0690) 474#define CR_ACK_TIMEOUT_EXT CTL_REG(0x0690)
470#define CR_BCN_FIFO_SEMAPHORE CTL_REG(0x0694) 475#define CR_BCN_FIFO_SEMAPHORE CTL_REG(0x0694)
@@ -546,9 +551,6 @@
546#define CR_ZD1211B_TXOP CTL_REG(0x0b20) 551#define CR_ZD1211B_TXOP CTL_REG(0x0b20)
547#define CR_ZD1211B_RETRY_MAX CTL_REG(0x0b28) 552#define CR_ZD1211B_RETRY_MAX CTL_REG(0x0b28)
548 553
549#define AP_RX_FILTER 0x0400feff
550#define STA_RX_FILTER 0x0000ffff
551
552#define CWIN_SIZE 0x007f043f 554#define CWIN_SIZE 0x007f043f
553 555
554 556
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 3bdc54d128d0..d6f3e02a0b54 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -108,7 +108,9 @@ int zd_mac_init_hw(struct zd_mac *mac, u8 device_type)
108 if (r) 108 if (r)
109 goto disable_int; 109 goto disable_int;
110 110
111 r = zd_set_encryption_type(chip, NO_WEP); 111 /* We must inform the device that we are doing encryption/decryption in
112 * software at the moment. */
113 r = zd_set_encryption_type(chip, ENC_SNIFFER);
112 if (r) 114 if (r)
113 goto disable_int; 115 goto disable_int;
114 116
@@ -136,10 +138,8 @@ static int reset_mode(struct zd_mac *mac)
136{ 138{
137 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); 139 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
138 struct zd_ioreq32 ioreqs[3] = { 140 struct zd_ioreq32 ioreqs[3] = {
139 { CR_RX_FILTER, RX_FILTER_BEACON|RX_FILTER_PROBE_RESPONSE| 141 { CR_RX_FILTER, STA_RX_FILTER },
140 RX_FILTER_AUTH|RX_FILTER_ASSOC_RESPONSE },
141 { CR_SNIFFER_ON, 0U }, 142 { CR_SNIFFER_ON, 0U },
142 { CR_ENCRYPTION_TYPE, NO_WEP },
143 }; 143 };
144 144
145 if (ieee->iw_mode == IW_MODE_MONITOR) { 145 if (ieee->iw_mode == IW_MODE_MONITOR) {
@@ -713,10 +713,10 @@ static int zd_mac_tx(struct zd_mac *mac, struct ieee80211_txb *txb, int pri)
713struct zd_rt_hdr { 713struct zd_rt_hdr {
714 struct ieee80211_radiotap_header rt_hdr; 714 struct ieee80211_radiotap_header rt_hdr;
715 u8 rt_flags; 715 u8 rt_flags;
716 u8 rt_rate;
716 u16 rt_channel; 717 u16 rt_channel;
717 u16 rt_chbitmask; 718 u16 rt_chbitmask;
718 u16 rt_rate; 719} __attribute__((packed));
719};
720 720
721static void fill_rt_header(void *buffer, struct zd_mac *mac, 721static void fill_rt_header(void *buffer, struct zd_mac *mac,
722 const struct ieee80211_rx_stats *stats, 722 const struct ieee80211_rx_stats *stats,
@@ -735,14 +735,14 @@ static void fill_rt_header(void *buffer, struct zd_mac *mac,
735 if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256)) 735 if (status->decryption_type & (ZD_RX_WEP64|ZD_RX_WEP128|ZD_RX_WEP256))
736 hdr->rt_flags |= IEEE80211_RADIOTAP_F_WEP; 736 hdr->rt_flags |= IEEE80211_RADIOTAP_F_WEP;
737 737
738 hdr->rt_rate = stats->rate / 5;
739
738 /* FIXME: 802.11a */ 740 /* FIXME: 802.11a */
739 hdr->rt_channel = cpu_to_le16(ieee80211chan2mhz( 741 hdr->rt_channel = cpu_to_le16(ieee80211chan2mhz(
740 _zd_chip_get_channel(&mac->chip))); 742 _zd_chip_get_channel(&mac->chip)));
741 hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ | 743 hdr->rt_chbitmask = cpu_to_le16(IEEE80211_CHAN_2GHZ |
742 ((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) == 744 ((status->frame_status & ZD_RX_FRAME_MODULATION_MASK) ==
743 ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK)); 745 ZD_RX_OFDM ? IEEE80211_CHAN_OFDM : IEEE80211_CHAN_CCK));
744
745 hdr->rt_rate = stats->rate / 5;
746} 746}
747 747
748/* Returns 1 if the data packet is for us and 0 otherwise. */ 748/* Returns 1 if the data packet is for us and 0 otherwise. */
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index c68b9f8995c9..96551da769fc 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -325,7 +325,6 @@ static void disable_read_regs_int(struct zd_usb *usb)
325{ 325{
326 struct zd_usb_interrupt *intr = &usb->intr; 326 struct zd_usb_interrupt *intr = &usb->intr;
327 327
328 ZD_ASSERT(in_interrupt());
329 spin_lock(&intr->lock); 328 spin_lock(&intr->lock);
330 intr->read_regs_enabled = 0; 329 intr->read_regs_enabled = 0;
331 spin_unlock(&intr->lock); 330 spin_unlock(&intr->lock);
@@ -547,11 +546,11 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer,
547 * be padded. Unaligned access might also happen if the length_info 546 * be padded. Unaligned access might also happen if the length_info
548 * structure is not present. 547 * structure is not present.
549 */ 548 */
550 if (get_unaligned(&length_info->tag) == RX_LENGTH_INFO_TAG) { 549 if (get_unaligned(&length_info->tag) == cpu_to_le16(RX_LENGTH_INFO_TAG))
550 {
551 unsigned int l, k, n; 551 unsigned int l, k, n;
552 for (i = 0, l = 0;; i++) { 552 for (i = 0, l = 0;; i++) {
553 k = le16_to_cpu(get_unaligned( 553 k = le16_to_cpu(get_unaligned(&length_info->length[i]));
554 &length_info->length[i]));
555 n = l+k; 554 n = l+k;
556 if (n > length) 555 if (n > length)
557 return; 556 return;
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 622b3f8ba820..f8ae2b7db0a7 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -61,7 +61,7 @@ struct pci_bus * __devinit pci_find_bus(int domain, int busnr)
61 * @from: Previous PCI bus found, or %NULL for new search. 61 * @from: Previous PCI bus found, or %NULL for new search.
62 * 62 *
63 * Iterates through the list of known PCI busses. A new search is 63 * Iterates through the list of known PCI busses. A new search is
64 * initiated by passing %NULL to the @from argument. Otherwise if 64 * initiated by passing %NULL as the @from argument. Otherwise if
65 * @from is not %NULL, searches continue from next device on the 65 * @from is not %NULL, searches continue from next device on the
66 * global list. 66 * global list.
67 */ 67 */
@@ -148,13 +148,14 @@ struct pci_dev * pci_get_slot(struct pci_bus *bus, unsigned int devfn)
148 * @from: Previous PCI device found in search, or %NULL for new search. 148 * @from: Previous PCI device found in search, or %NULL for new search.
149 * 149 *
150 * Iterates through the list of known PCI devices. If a PCI device is 150 * Iterates through the list of known PCI devices. If a PCI device is
151 * found with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its 151 * found with a matching @vendor, @device, @ss_vendor and @ss_device, a
152 * device structure is returned. Otherwise, %NULL is returned. 152 * pointer to its device structure is returned. Otherwise, %NULL is returned.
153 * A new search is initiated by passing %NULL to the @from argument. 153 * A new search is initiated by passing %NULL as the @from argument.
154 * Otherwise if @from is not %NULL, searches continue from next device on the global list. 154 * Otherwise if @from is not %NULL, searches continue from next device
155 * on the global list.
155 * 156 *
156 * NOTE: Do not use this function anymore, use pci_get_subsys() instead, as 157 * NOTE: Do not use this function any more; use pci_get_subsys() instead, as
157 * the pci device returned by this function can disappear at any moment in 158 * the PCI device returned by this function can disappear at any moment in
158 * time. 159 * time.
159 */ 160 */
160static struct pci_dev * pci_find_subsys(unsigned int vendor, 161static struct pci_dev * pci_find_subsys(unsigned int vendor,
@@ -191,14 +192,15 @@ exit:
191 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids 192 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
192 * @from: Previous PCI device found in search, or %NULL for new search. 193 * @from: Previous PCI device found in search, or %NULL for new search.
193 * 194 *
194 * Iterates through the list of known PCI devices. If a PCI device is 195 * Iterates through the list of known PCI devices. If a PCI device is found
195 * found with a matching @vendor and @device, a pointer to its device structure is 196 * with a matching @vendor and @device, a pointer to its device structure is
196 * returned. Otherwise, %NULL is returned. 197 * returned. Otherwise, %NULL is returned.
197 * A new search is initiated by passing %NULL to the @from argument. 198 * A new search is initiated by passing %NULL as the @from argument.
198 * Otherwise if @from is not %NULL, searches continue from next device on the global list. 199 * Otherwise if @from is not %NULL, searches continue from next device
200 * on the global list.
199 * 201 *
200 * NOTE: Do not use this function anymore, use pci_get_device() instead, as 202 * NOTE: Do not use this function any more; use pci_get_device() instead, as
201 * the pci device returned by this function can disappear at any moment in 203 * the PCI device returned by this function can disappear at any moment in
202 * time. 204 * time.
203 */ 205 */
204struct pci_dev * 206struct pci_dev *
@@ -215,11 +217,11 @@ pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *
215 * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids 217 * @ss_device: PCI subsystem device id to match, or %PCI_ANY_ID to match all device ids
216 * @from: Previous PCI device found in search, or %NULL for new search. 218 * @from: Previous PCI device found in search, or %NULL for new search.
217 * 219 *
218 * Iterates through the list of known PCI devices. If a PCI device is 220 * Iterates through the list of known PCI devices. If a PCI device is found
219 * found with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its 221 * with a matching @vendor, @device, @ss_vendor and @ss_device, a pointer to its
220 * device structure is returned, and the reference count to the device is 222 * device structure is returned, and the reference count to the device is
221 * incremented. Otherwise, %NULL is returned. A new search is initiated by 223 * incremented. Otherwise, %NULL is returned. A new search is initiated by
222 * passing %NULL to the @from argument. Otherwise if @from is not %NULL, 224 * passing %NULL as the @from argument. Otherwise if @from is not %NULL,
223 * searches continue from next device on the global list. 225 * searches continue from next device on the global list.
224 * The reference count for @from is always decremented if it is not %NULL. 226 * The reference count for @from is always decremented if it is not %NULL.
225 */ 227 */
@@ -262,7 +264,7 @@ exit:
262 * found with a matching @vendor and @device, the reference count to the 264 * found with a matching @vendor and @device, the reference count to the
263 * device is incremented and a pointer to its device structure is returned. 265 * device is incremented and a pointer to its device structure is returned.
264 * Otherwise, %NULL is returned. A new search is initiated by passing %NULL 266 * Otherwise, %NULL is returned. A new search is initiated by passing %NULL
265 * to the @from argument. Otherwise if @from is not %NULL, searches continue 267 * as the @from argument. Otherwise if @from is not %NULL, searches continue
266 * from next device on the global list. The reference count for @from is 268 * from next device on the global list. The reference count for @from is
267 * always decremented if it is not %NULL. 269 * always decremented if it is not %NULL.
268 */ 270 */
@@ -279,11 +281,13 @@ pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from)
279 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids 281 * @device: PCI device id to match, or %PCI_ANY_ID to match all device ids
280 * @from: Previous PCI device found in search, or %NULL for new search. 282 * @from: Previous PCI device found in search, or %NULL for new search.
281 * 283 *
282 * Iterates through the list of known PCI devices in the reverse order of pci_find_device(). 284 * Iterates through the list of known PCI devices in the reverse order of
285 * pci_find_device().
283 * If a PCI device is found with a matching @vendor and @device, a pointer to 286 * If a PCI device is found with a matching @vendor and @device, a pointer to
284 * its device structure is returned. Otherwise, %NULL is returned. 287 * its device structure is returned. Otherwise, %NULL is returned.
285 * A new search is initiated by passing %NULL to the @from argument. 288 * A new search is initiated by passing %NULL as the @from argument.
286 * Otherwise if @from is not %NULL, searches continue from previous device on the global list. 289 * Otherwise if @from is not %NULL, searches continue from previous device
290 * on the global list.
287 */ 291 */
288struct pci_dev * 292struct pci_dev *
289pci_find_device_reverse(unsigned int vendor, unsigned int device, const struct pci_dev *from) 293pci_find_device_reverse(unsigned int vendor, unsigned int device, const struct pci_dev *from)
@@ -317,7 +321,7 @@ exit:
317 * found with a matching @class, the reference count to the device is 321 * found with a matching @class, the reference count to the device is
318 * incremented and a pointer to its device structure is returned. 322 * incremented and a pointer to its device structure is returned.
319 * Otherwise, %NULL is returned. 323 * Otherwise, %NULL is returned.
320 * A new search is initiated by passing %NULL to the @from argument. 324 * A new search is initiated by passing %NULL as the @from argument.
321 * Otherwise if @from is not %NULL, searches continue from next device 325 * Otherwise if @from is not %NULL, searches continue from next device
322 * on the global list. The reference count for @from is always decremented 326 * on the global list. The reference count for @from is always decremented
323 * if it is not %NULL. 327 * if it is not %NULL.
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index 738b1ef595a3..9ad18e62658d 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -601,12 +601,8 @@ static int ds_ioctl(struct inode * inode, struct file * file,
601 ret = CS_BAD_ARGS; 601 ret = CS_BAD_ARGS;
602 else { 602 else {
603 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); 603 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);
604 if (p_dev == NULL) 604 ret = pccard_get_configuration_info(s, p_dev, &buf->config);
605 ret = CS_BAD_ARGS; 605 pcmcia_put_dev(p_dev);
606 else {
607 ret = pccard_get_configuration_info(s, p_dev, &buf->config);
608 pcmcia_put_dev(p_dev);
609 }
610 } 606 }
611 break; 607 break;
612 case DS_GET_FIRST_TUPLE: 608 case DS_GET_FIRST_TUPLE:
@@ -636,12 +632,8 @@ static int ds_ioctl(struct inode * inode, struct file * file,
636 ret = CS_BAD_ARGS; 632 ret = CS_BAD_ARGS;
637 else { 633 else {
638 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); 634 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
639 if (p_dev == NULL) 635 ret = pccard_get_status(s, p_dev, &buf->status);
640 ret = CS_BAD_ARGS; 636 pcmcia_put_dev(p_dev);
641 else {
642 ret = pccard_get_status(s, p_dev, &buf->status);
643 pcmcia_put_dev(p_dev);
644 }
645 } 637 }
646 break; 638 break;
647 case DS_VALIDATE_CIS: 639 case DS_VALIDATE_CIS:
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 7bf25b88ea31..c8323399e9e4 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -245,10 +245,17 @@ int pccard_get_configuration_info(struct pcmcia_socket *s,
245 return CS_SUCCESS; 245 return CS_SUCCESS;
246 } 246 }
247 247
248 /* !!! This is a hack !!! */ 248 config->Attributes = c->Attributes | CONF_VALID_CLIENT;
249 memcpy(&config->Attributes, &c->Attributes, sizeof(config_t)); 249 config->Vcc = s->socket.Vcc;
250 config->Attributes |= CONF_VALID_CLIENT; 250 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
251 config->CardValues = c->CardValues; 251 config->IntType = c->IntType;
252 config->ConfigBase = c->ConfigBase;
253 config->Status = c->Status;
254 config->Pin = c->Pin;
255 config->Copy = c->Copy;
256 config->Option = c->Option;
257 config->ExtStatus = c->ExtStatus;
258 config->Present = config->CardValues = c->CardValues;
252 config->IRQAttributes = c->irq.Attributes; 259 config->IRQAttributes = c->irq.Attributes;
253 config->AssignedIRQ = s->irq.AssignedIRQ; 260 config->AssignedIRQ = s->irq.AssignedIRQ;
254 config->BasePort1 = c->io.BasePort1; 261 config->BasePort1 = c->io.BasePort1;
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index b154b3f52cbe..551f58e29810 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -346,7 +346,7 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node)
346 dev->flags = node->flags; 346 dev->flags = node->flags;
347 if (!(dev->flags & PNPBIOS_NO_CONFIG)) 347 if (!(dev->flags & PNPBIOS_NO_CONFIG))
348 dev->capabilities |= PNP_CONFIGURABLE; 348 dev->capabilities |= PNP_CONFIGURABLE;
349 if (!(dev->flags & PNPBIOS_NO_DISABLE)) 349 if (!(dev->flags & PNPBIOS_NO_DISABLE) && pnpbios_is_dynamic(dev))
350 dev->capabilities |= PNP_DISABLE; 350 dev->capabilities |= PNP_DISABLE;
351 dev->capabilities |= PNP_READ; 351 dev->capabilities |= PNP_READ;
352 if (pnpbios_is_dynamic(dev)) 352 if (pnpbios_is_dynamic(dev))
diff --git a/drivers/scsi/aic7xxx/aicasm/Makefile b/drivers/scsi/aic7xxx/aicasm/Makefile
index 8c91fda6482c..b98c5c1056c3 100644
--- a/drivers/scsi/aic7xxx/aicasm/Makefile
+++ b/drivers/scsi/aic7xxx/aicasm/Makefile
@@ -14,6 +14,8 @@ LIBS= -ldb
14clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) 14clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG)
15# Override default kernel CFLAGS. This is a userland app. 15# Override default kernel CFLAGS. This is a userland app.
16AICASM_CFLAGS:= -I/usr/include -I. 16AICASM_CFLAGS:= -I/usr/include -I.
17LEX= flex
18YACC= bison
17YFLAGS= -d 19YFLAGS= -d
18 20
19NOMAN= noman 21NOMAN= noman
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 2ee742d40c43..005043197527 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -24,7 +24,7 @@ config USB_ARCH_HAS_OHCI
24 default y if ARCH_S3C2410 24 default y if ARCH_S3C2410
25 default y if PXA27x 25 default y if PXA27x
26 default y if ARCH_EP93XX 26 default y if ARCH_EP93XX
27 default y if ARCH_AT91RM9200 27 default y if (ARCH_AT91RM9200 || ARCH_AT91SAM9261)
28 # PPC: 28 # PPC:
29 default y if STB03xxx 29 default y if STB03xxx
30 default y if PPC_MPC52xx 30 default y if PPC_MPC52xx
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index f7bdd94b3aa8..218621b9958e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -517,19 +517,19 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, unsig
517 517
518static struct usb_device *usbdev_lookup_minor(int minor) 518static struct usb_device *usbdev_lookup_minor(int minor)
519{ 519{
520 struct device *device; 520 struct class_device *class_dev;
521 struct usb_device *udev = NULL; 521 struct usb_device *dev = NULL;
522 522
523 down(&usb_device_class->sem); 523 down(&usb_device_class->sem);
524 list_for_each_entry(device, &usb_device_class->devices, node) { 524 list_for_each_entry(class_dev, &usb_device_class->children, node) {
525 if (device->devt == MKDEV(USB_DEVICE_MAJOR, minor)) { 525 if (class_dev->devt == MKDEV(USB_DEVICE_MAJOR, minor)) {
526 udev = device->platform_data; 526 dev = class_dev->class_data;
527 break; 527 break;
528 } 528 }
529 } 529 }
530 up(&usb_device_class->sem); 530 up(&usb_device_class->sem);
531 531
532 return udev; 532 return dev;
533}; 533};
534 534
535/* 535/*
@@ -1580,16 +1580,16 @@ static void usbdev_add(struct usb_device *dev)
1580{ 1580{
1581 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1); 1581 int minor = ((dev->bus->busnum-1) * 128) + (dev->devnum-1);
1582 1582
1583 dev->usbfs_dev = device_create(usb_device_class, &dev->dev, 1583 dev->class_dev = class_device_create(usb_device_class, NULL,
1584 MKDEV(USB_DEVICE_MAJOR, minor), 1584 MKDEV(USB_DEVICE_MAJOR, minor), &dev->dev,
1585 "usbdev%d.%d", dev->bus->busnum, dev->devnum); 1585 "usbdev%d.%d", dev->bus->busnum, dev->devnum);
1586 1586
1587 dev->usbfs_dev->platform_data = dev; 1587 dev->class_dev->class_data = dev;
1588} 1588}
1589 1589
1590static void usbdev_remove(struct usb_device *dev) 1590static void usbdev_remove(struct usb_device *dev)
1591{ 1591{
1592 device_unregister(dev->usbfs_dev); 1592 class_device_unregister(dev->class_dev);
1593} 1593}
1594 1594
1595static int usbdev_notify(struct notifier_block *self, unsigned long action, 1595static int usbdev_notify(struct notifier_block *self, unsigned long action,
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index abee0f5b6a66..8de4f8c99d61 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -194,13 +194,14 @@ int usb_register_dev(struct usb_interface *intf,
194 ++temp; 194 ++temp;
195 else 195 else
196 temp = name; 196 temp = name;
197 intf->usb_dev = device_create(usb_class->class, &intf->dev, 197 intf->class_dev = class_device_create(usb_class->class, NULL,
198 MKDEV(USB_MAJOR, minor), "%s", temp); 198 MKDEV(USB_MAJOR, minor),
199 if (IS_ERR(intf->usb_dev)) { 199 &intf->dev, "%s", temp);
200 if (IS_ERR(intf->class_dev)) {
200 spin_lock (&minor_lock); 201 spin_lock (&minor_lock);
201 usb_minors[intf->minor] = NULL; 202 usb_minors[intf->minor] = NULL;
202 spin_unlock (&minor_lock); 203 spin_unlock (&minor_lock);
203 retval = PTR_ERR(intf->usb_dev); 204 retval = PTR_ERR(intf->class_dev);
204 } 205 }
205exit: 206exit:
206 return retval; 207 return retval;
@@ -241,8 +242,8 @@ void usb_deregister_dev(struct usb_interface *intf,
241 spin_unlock (&minor_lock); 242 spin_unlock (&minor_lock);
242 243
243 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base); 244 snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
244 device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor)); 245 class_device_destroy(usb_class->class, MKDEV(USB_MAJOR, intf->minor));
245 intf->usb_dev = NULL; 246 intf->class_dev = NULL;
246 intf->minor = -1; 247 intf->minor = -1;
247 destroy_usb_class(); 248 destroy_usb_class();
248} 249}
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 363b2ad74ae6..1a32d96774b4 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -207,7 +207,7 @@ config USB_AT91
207 207
208config USB_GADGET_DUMMY_HCD 208config USB_GADGET_DUMMY_HCD
209 boolean "Dummy HCD (DEVELOPMENT)" 209 boolean "Dummy HCD (DEVELOPMENT)"
210 depends on USB && EXPERIMENTAL 210 depends on (USB=y || (USB=m && USB_GADGET=m)) && EXPERIMENTAL
211 select USB_GADGET_DUALSPEED 211 select USB_GADGET_DUALSPEED
212 help 212 help
213 This host controller driver emulates USB, looping all data transfer 213 This host controller driver emulates USB, looping all data transfer
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 1c459ff037ce..cfebca05ead5 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -57,19 +57,23 @@
57 57
58/* 58/*
59 * This controller is simple and PIO-only. It's used in many AT91-series 59 * This controller is simple and PIO-only. It's used in many AT91-series
60 * ARMv4T controllers, including the at91rm9200 (arm920T, with MMU), 60 * full speed USB controllers, including the at91rm9200 (arm920T, with MMU),
61 * at91sam9261 (arm926ejs, with MMU), and several no-mmu versions. 61 * at91sam926x (arm926ejs, with MMU), and several no-mmu versions.
62 * 62 *
63 * This driver expects the board has been wired with two GPIOs suppporting 63 * This driver expects the board has been wired with two GPIOs suppporting
64 * a VBUS sensing IRQ, and a D+ pullup. (They may be omitted, but the 64 * a VBUS sensing IRQ, and a D+ pullup. (They may be omitted, but the
65 * testing hasn't covered such cases.) The pullup is most important; it 65 * testing hasn't covered such cases.)
66 *
67 * The pullup is most important (so it's integrated on sam926x parts). It
66 * provides software control over whether the host enumerates the device. 68 * provides software control over whether the host enumerates the device.
69 *
67 * The VBUS sensing helps during enumeration, and allows both USB clocks 70 * The VBUS sensing helps during enumeration, and allows both USB clocks
68 * (and the transceiver) to stay gated off until they're necessary, saving 71 * (and the transceiver) to stay gated off until they're necessary, saving
69 * power. During USB suspend, the 48 MHz clock is gated off. 72 * power. During USB suspend, the 48 MHz clock is gated off in hardware;
73 * it may also be gated off by software during some Linux sleep states.
70 */ 74 */
71 75
72#define DRIVER_VERSION "8 March 2005" 76#define DRIVER_VERSION "3 May 2006"
73 77
74static const char driver_name [] = "at91_udc"; 78static const char driver_name [] = "at91_udc";
75static const char ep0name[] = "ep0"; 79static const char ep0name[] = "ep0";
@@ -316,9 +320,15 @@ static void done(struct at91_ep *ep, struct at91_request *req, int status)
316 * 320 *
317 * There are also state bits like FORCESTALL, EPEDS, DIR, and EPTYPE 321 * There are also state bits like FORCESTALL, EPEDS, DIR, and EPTYPE
318 * that shouldn't normally be changed. 322 * that shouldn't normally be changed.
323 *
324 * NOTE at91sam9260 docs mention synch between UDPCK and MCK clock domains,
325 * implying a need to wait for one write to complete (test relevant bits)
326 * before starting the next write. This shouldn't be an issue given how
327 * infrequently we write, except maybe for write-then-read idioms.
319 */ 328 */
320#define SET_FX (AT91_UDP_TXPKTRDY) 329#define SET_FX (AT91_UDP_TXPKTRDY)
321#define CLR_FX (RX_DATA_READY | AT91_UDP_RXSETUP | AT91_UDP_STALLSENT | AT91_UDP_TXCOMP) 330#define CLR_FX (RX_DATA_READY | AT91_UDP_RXSETUP \
331 | AT91_UDP_STALLSENT | AT91_UDP_TXCOMP)
322 332
323/* pull OUT packet data from the endpoint's fifo */ 333/* pull OUT packet data from the endpoint's fifo */
324static int read_fifo (struct at91_ep *ep, struct at91_request *req) 334static int read_fifo (struct at91_ep *ep, struct at91_request *req)
@@ -472,7 +482,8 @@ static void nuke(struct at91_ep *ep, int status)
472 482
473/*-------------------------------------------------------------------------*/ 483/*-------------------------------------------------------------------------*/
474 484
475static int at91_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) 485static int at91_ep_enable(struct usb_ep *_ep,
486 const struct usb_endpoint_descriptor *desc)
476{ 487{
477 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep); 488 struct at91_ep *ep = container_of(_ep, struct at91_ep, ep);
478 struct at91_udc *dev = ep->udc; 489 struct at91_udc *dev = ep->udc;
@@ -582,11 +593,12 @@ static int at91_ep_disable (struct usb_ep * _ep)
582 * interesting for request or buffer allocation. 593 * interesting for request or buffer allocation.
583 */ 594 */
584 595
585static struct usb_request *at91_ep_alloc_request (struct usb_ep *_ep, unsigned int gfp_flags) 596static struct usb_request *
597at91_ep_alloc_request(struct usb_ep *_ep, unsigned int gfp_flags)
586{ 598{
587 struct at91_request *req; 599 struct at91_request *req;
588 600
589 req = kcalloc(1, sizeof (struct at91_request), SLAB_KERNEL); 601 req = kcalloc(1, sizeof (struct at91_request), gfp_flags);
590 if (!req) 602 if (!req)
591 return NULL; 603 return NULL;
592 604
@@ -862,6 +874,7 @@ static void stop_activity(struct at91_udc *udc)
862 if (udc->gadget.speed == USB_SPEED_UNKNOWN) 874 if (udc->gadget.speed == USB_SPEED_UNKNOWN)
863 driver = NULL; 875 driver = NULL;
864 udc->gadget.speed = USB_SPEED_UNKNOWN; 876 udc->gadget.speed = USB_SPEED_UNKNOWN;
877 udc->suspended = 0;
865 878
866 for (i = 0; i < NUM_ENDPOINTS; i++) { 879 for (i = 0; i < NUM_ENDPOINTS; i++) {
867 struct at91_ep *ep = &udc->ep[i]; 880 struct at91_ep *ep = &udc->ep[i];
@@ -889,8 +902,8 @@ static void clk_off(struct at91_udc *udc)
889 return; 902 return;
890 udc->clocked = 0; 903 udc->clocked = 0;
891 udc->gadget.speed = USB_SPEED_UNKNOWN; 904 udc->gadget.speed = USB_SPEED_UNKNOWN;
892 clk_disable(udc->iclk);
893 clk_disable(udc->fclk); 905 clk_disable(udc->fclk);
906 clk_disable(udc->iclk);
894} 907}
895 908
896/* 909/*
@@ -911,9 +924,6 @@ static void pullup(struct at91_udc *udc, int is_on)
911 at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); 924 at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
912 at91_set_gpio_value(udc->board.pullup_pin, 0); 925 at91_set_gpio_value(udc->board.pullup_pin, 0);
913 clk_off(udc); 926 clk_off(udc);
914
915 // REVISIT: with transceiver disabled, will D- float
916 // so that a host would falsely detect a device?
917 } 927 }
918} 928}
919 929
@@ -1290,7 +1300,8 @@ static void handle_ep0(struct at91_udc *udc)
1290 if (udc->wait_for_addr_ack) { 1300 if (udc->wait_for_addr_ack) {
1291 u32 tmp; 1301 u32 tmp;
1292 1302
1293 at91_udp_write(AT91_UDP_FADDR, AT91_UDP_FEN | udc->addr); 1303 at91_udp_write(AT91_UDP_FADDR,
1304 AT91_UDP_FEN | udc->addr);
1294 tmp = at91_udp_read(AT91_UDP_GLB_STAT); 1305 tmp = at91_udp_read(AT91_UDP_GLB_STAT);
1295 tmp &= ~AT91_UDP_FADDEN; 1306 tmp &= ~AT91_UDP_FADDEN;
1296 if (udc->addr) 1307 if (udc->addr)
@@ -1361,9 +1372,10 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r)
1361 u32 rescans = 5; 1372 u32 rescans = 5;
1362 1373
1363 while (rescans--) { 1374 while (rescans--) {
1364 u32 status = at91_udp_read(AT91_UDP_ISR); 1375 u32 status;
1365 1376
1366 status &= at91_udp_read(AT91_UDP_IMR); 1377 status = at91_udp_read(AT91_UDP_ISR)
1378 & at91_udp_read(AT91_UDP_IMR);
1367 if (!status) 1379 if (!status)
1368 break; 1380 break;
1369 1381
@@ -1379,18 +1391,17 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r)
1379 stop_activity(udc); 1391 stop_activity(udc);
1380 1392
1381 /* enable ep0 */ 1393 /* enable ep0 */
1382 at91_udp_write(AT91_UDP_CSR(0), AT91_UDP_EPEDS | AT91_UDP_EPTYPE_CTRL); 1394 at91_udp_write(AT91_UDP_CSR(0),
1395 AT91_UDP_EPEDS | AT91_UDP_EPTYPE_CTRL);
1383 udc->gadget.speed = USB_SPEED_FULL; 1396 udc->gadget.speed = USB_SPEED_FULL;
1384 udc->suspended = 0; 1397 udc->suspended = 0;
1385 at91_udp_write(AT91_UDP_IER, AT91_UDP_EP(0)); 1398 at91_udp_write(AT91_UDP_IER, AT91_UDP_EP(0));
1386 1399
1387 /* 1400 /*
1388 * NOTE: this driver keeps clocks off unless the 1401 * NOTE: this driver keeps clocks off unless the
1389 * USB host is present. That saves power, and also 1402 * USB host is present. That saves power, but for
1390 * eliminates IRQs (reset, resume, suspend) that can 1403 * boards that don't support VBUS detection, both
1391 * otherwise flood from the controller. If your 1404 * clocks need to be active most of the time.
1392 * board doesn't support VBUS detection, suspend and
1393 * resume irq logic may need more attention...
1394 */ 1405 */
1395 1406
1396 /* host initiated suspend (3+ms bus idle) */ 1407 /* host initiated suspend (3+ms bus idle) */
@@ -1452,13 +1463,19 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc, struct pt_regs *r)
1452 1463
1453/*-------------------------------------------------------------------------*/ 1464/*-------------------------------------------------------------------------*/
1454 1465
1466static void nop_release(struct device *dev)
1467{
1468 /* nothing to free */
1469}
1470
1455static struct at91_udc controller = { 1471static struct at91_udc controller = {
1456 .gadget = { 1472 .gadget = {
1457 .ops = &at91_udc_ops, 1473 .ops = &at91_udc_ops,
1458 .ep0 = &controller.ep[0].ep, 1474 .ep0 = &controller.ep[0].ep,
1459 .name = driver_name, 1475 .name = driver_name,
1460 .dev = { 1476 .dev = {
1461 .bus_id = "gadget" 1477 .bus_id = "gadget",
1478 .release = nop_release,
1462 } 1479 }
1463 }, 1480 },
1464 .ep[0] = { 1481 .ep[0] = {
@@ -1468,7 +1485,8 @@ static struct at91_udc controller = {
1468 }, 1485 },
1469 .udc = &controller, 1486 .udc = &controller,
1470 .maxpacket = 8, 1487 .maxpacket = 8,
1471 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(0)), 1488 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1489 + AT91_UDP_CSR(0)),
1472 .int_mask = 1 << 0, 1490 .int_mask = 1 << 0,
1473 }, 1491 },
1474 .ep[1] = { 1492 .ep[1] = {
@@ -1479,7 +1497,8 @@ static struct at91_udc controller = {
1479 .udc = &controller, 1497 .udc = &controller,
1480 .is_pingpong = 1, 1498 .is_pingpong = 1,
1481 .maxpacket = 64, 1499 .maxpacket = 64,
1482 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(1)), 1500 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1501 + AT91_UDP_CSR(1)),
1483 .int_mask = 1 << 1, 1502 .int_mask = 1 << 1,
1484 }, 1503 },
1485 .ep[2] = { 1504 .ep[2] = {
@@ -1490,7 +1509,8 @@ static struct at91_udc controller = {
1490 .udc = &controller, 1509 .udc = &controller,
1491 .is_pingpong = 1, 1510 .is_pingpong = 1,
1492 .maxpacket = 64, 1511 .maxpacket = 64,
1493 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(2)), 1512 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1513 + AT91_UDP_CSR(2)),
1494 .int_mask = 1 << 2, 1514 .int_mask = 1 << 2,
1495 }, 1515 },
1496 .ep[3] = { 1516 .ep[3] = {
@@ -1501,7 +1521,8 @@ static struct at91_udc controller = {
1501 }, 1521 },
1502 .udc = &controller, 1522 .udc = &controller,
1503 .maxpacket = 8, 1523 .maxpacket = 8,
1504 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(3)), 1524 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1525 + AT91_UDP_CSR(3)),
1505 .int_mask = 1 << 3, 1526 .int_mask = 1 << 3,
1506 }, 1527 },
1507 .ep[4] = { 1528 .ep[4] = {
@@ -1512,7 +1533,8 @@ static struct at91_udc controller = {
1512 .udc = &controller, 1533 .udc = &controller,
1513 .is_pingpong = 1, 1534 .is_pingpong = 1,
1514 .maxpacket = 256, 1535 .maxpacket = 256,
1515 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(4)), 1536 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1537 + AT91_UDP_CSR(4)),
1516 .int_mask = 1 << 4, 1538 .int_mask = 1 << 4,
1517 }, 1539 },
1518 .ep[5] = { 1540 .ep[5] = {
@@ -1523,10 +1545,11 @@ static struct at91_udc controller = {
1523 .udc = &controller, 1545 .udc = &controller,
1524 .is_pingpong = 1, 1546 .is_pingpong = 1,
1525 .maxpacket = 256, 1547 .maxpacket = 256,
1526 .creg = (void __iomem *)(AT91_VA_BASE_UDP + AT91_UDP_CSR(5)), 1548 .creg = (void __iomem *)(AT91_VA_BASE_UDP
1549 + AT91_UDP_CSR(5)),
1527 .int_mask = 1 << 5, 1550 .int_mask = 1 << 5,
1528 }, 1551 },
1529 /* ep6 and ep7 are also reserved */ 1552 /* ep6 and ep7 are also reserved (custom silicon might use them) */
1530}; 1553};
1531 1554
1532static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r) 1555static irqreturn_t at91_vbus_irq(int irq, void *_udc, struct pt_regs *r)
@@ -1593,6 +1616,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
1593 1616
1594 local_irq_disable(); 1617 local_irq_disable();
1595 udc->enabled = 0; 1618 udc->enabled = 0;
1619 at91_udp_write(AT91_UDP_IDR, ~0);
1596 pullup(udc, 0); 1620 pullup(udc, 0);
1597 local_irq_enable(); 1621 local_irq_enable();
1598 1622
@@ -1624,6 +1648,16 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1624 return -ENODEV; 1648 return -ENODEV;
1625 } 1649 }
1626 1650
1651 if (pdev->num_resources != 2) {
1652 DBG("invalid num_resources");
1653 return -ENODEV;
1654 }
1655 if ((pdev->resource[0].flags != IORESOURCE_MEM)
1656 || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
1657 DBG("invalid resource type");
1658 return -ENODEV;
1659 }
1660
1627 if (!request_mem_region(AT91_BASE_UDP, SZ_16K, driver_name)) { 1661 if (!request_mem_region(AT91_BASE_UDP, SZ_16K, driver_name)) {
1628 DBG("someone's using UDC memory\n"); 1662 DBG("someone's using UDC memory\n");
1629 return -EBUSY; 1663 return -EBUSY;
@@ -1649,19 +1683,26 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1649 if (retval < 0) 1683 if (retval < 0)
1650 goto fail0; 1684 goto fail0;
1651 1685
1652 /* disable everything until there's a gadget driver and vbus */ 1686 /* don't do anything until we have both gadget driver and VBUS */
1653 pullup(udc, 0); 1687 clk_enable(udc->iclk);
1688 at91_udp_write(AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
1689 at91_udp_write(AT91_UDP_IDR, 0xffffffff);
1690 clk_disable(udc->iclk);
1654 1691
1655 /* request UDC and maybe VBUS irqs */ 1692 /* request UDC and maybe VBUS irqs */
1656 if (request_irq(AT91_ID_UDP, at91_udc_irq, IRQF_DISABLED, driver_name, udc)) { 1693 udc->udp_irq = platform_get_irq(pdev, 0);
1657 DBG("request irq %d failed\n", AT91_ID_UDP); 1694 if (request_irq(udc->udp_irq, at91_udc_irq,
1695 IRQF_DISABLED, driver_name, udc)) {
1696 DBG("request irq %d failed\n", udc->udp_irq);
1658 retval = -EBUSY; 1697 retval = -EBUSY;
1659 goto fail1; 1698 goto fail1;
1660 } 1699 }
1661 if (udc->board.vbus_pin > 0) { 1700 if (udc->board.vbus_pin > 0) {
1662 if (request_irq(udc->board.vbus_pin, at91_vbus_irq, IRQF_DISABLED, driver_name, udc)) { 1701 if (request_irq(udc->board.vbus_pin, at91_vbus_irq,
1663 DBG("request vbus irq %d failed\n", udc->board.vbus_pin); 1702 IRQF_DISABLED, driver_name, udc)) {
1664 free_irq(AT91_ID_UDP, udc); 1703 DBG("request vbus irq %d failed\n",
1704 udc->board.vbus_pin);
1705 free_irq(udc->udp_irq, udc);
1665 retval = -EBUSY; 1706 retval = -EBUSY;
1666 goto fail1; 1707 goto fail1;
1667 } 1708 }
@@ -1670,6 +1711,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1670 udc->vbus = 1; 1711 udc->vbus = 1;
1671 } 1712 }
1672 dev_set_drvdata(dev, udc); 1713 dev_set_drvdata(dev, udc);
1714 device_init_wakeup(dev, 1);
1673 create_debug_file(udc); 1715 create_debug_file(udc);
1674 1716
1675 INFO("%s version %s\n", driver_name, DRIVER_VERSION); 1717 INFO("%s version %s\n", driver_name, DRIVER_VERSION);
@@ -1678,14 +1720,14 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1678fail1: 1720fail1:
1679 device_unregister(&udc->gadget.dev); 1721 device_unregister(&udc->gadget.dev);
1680fail0: 1722fail0:
1681 release_mem_region(AT91_VA_BASE_UDP, SZ_16K); 1723 release_mem_region(AT91_BASE_UDP, SZ_16K);
1682 DBG("%s probe failed, %d\n", driver_name, retval); 1724 DBG("%s probe failed, %d\n", driver_name, retval);
1683 return retval; 1725 return retval;
1684} 1726}
1685 1727
1686static int __devexit at91udc_remove(struct platform_device *dev) 1728static int __devexit at91udc_remove(struct platform_device *pdev)
1687{ 1729{
1688 struct at91_udc *udc = platform_get_drvdata(dev); 1730 struct at91_udc *udc = platform_get_drvdata(pdev);
1689 1731
1690 DBG("remove\n"); 1732 DBG("remove\n");
1691 1733
@@ -1694,10 +1736,11 @@ static int __devexit at91udc_remove(struct platform_device *dev)
1694 if (udc->driver != 0) 1736 if (udc->driver != 0)
1695 usb_gadget_unregister_driver(udc->driver); 1737 usb_gadget_unregister_driver(udc->driver);
1696 1738
1739 device_init_wakeup(&pdev->dev, 0);
1697 remove_debug_file(udc); 1740 remove_debug_file(udc);
1698 if (udc->board.vbus_pin > 0) 1741 if (udc->board.vbus_pin > 0)
1699 free_irq(udc->board.vbus_pin, udc); 1742 free_irq(udc->board.vbus_pin, udc);
1700 free_irq(AT91_ID_UDP, udc); 1743 free_irq(udc->udp_irq, udc);
1701 device_unregister(&udc->gadget.dev); 1744 device_unregister(&udc->gadget.dev);
1702 release_mem_region(AT91_BASE_UDP, SZ_16K); 1745 release_mem_region(AT91_BASE_UDP, SZ_16K);
1703 1746
@@ -1708,31 +1751,36 @@ static int __devexit at91udc_remove(struct platform_device *dev)
1708} 1751}
1709 1752
1710#ifdef CONFIG_PM 1753#ifdef CONFIG_PM
1711static int at91udc_suspend(struct platform_device *dev, pm_message_t mesg) 1754static int at91udc_suspend(struct platform_device *pdev, pm_message_t mesg)
1712{ 1755{
1713 struct at91_udc *udc = platform_get_drvdata(dev); 1756 struct at91_udc *udc = platform_get_drvdata(pdev);
1757 int wake = udc->driver && device_may_wakeup(&pdev->dev);
1714 1758
1715 /* 1759 /* Unless we can act normally to the host (letting it wake us up
1716 * The "safe" suspend transitions are opportunistic ... e.g. when 1760 * whenever it has work for us) force disconnect. Wakeup requires
1717 * the USB link is suspended (48MHz clock autogated off), or when 1761 * PLLB for USB events (signaling for reset, wakeup, or incoming
1718 * it's disconnected (programmatically gated off, elsewhere). 1762 * tokens) and VBUS irqs (on systems which support them).
1719 * Then we can suspend, and the chip can enter slow clock mode.
1720 *
1721 * The problem case is some component (user mode?) suspending this
1722 * device while it's active, with the 48 MHz clock in use. There
1723 * are two basic approaches: (a) veto suspend levels involving slow
1724 * clock mode, (b) disconnect, so 48 MHz will no longer be in use
1725 * and we can enter slow clock mode. This uses (b) for now, since
1726 * it's simplest until AT91 PM exists and supports the other option.
1727 */ 1763 */
1728 if (udc->vbus && !udc->suspended) 1764 if ((!udc->suspended && udc->addr)
1765 || !wake
1766 || at91_suspend_entering_slow_clock()) {
1729 pullup(udc, 0); 1767 pullup(udc, 0);
1768 disable_irq_wake(udc->udp_irq);
1769 } else
1770 enable_irq_wake(udc->udp_irq);
1771
1772 if (udc->board.vbus_pin > 0) {
1773 if (wake)
1774 enable_irq_wake(udc->board.vbus_pin);
1775 else
1776 disable_irq_wake(udc->board.vbus_pin);
1777 }
1730 return 0; 1778 return 0;
1731} 1779}
1732 1780
1733static int at91udc_resume(struct platform_device *dev) 1781static int at91udc_resume(struct platform_device *pdev)
1734{ 1782{
1735 struct at91_udc *udc = platform_get_drvdata(dev); 1783 struct at91_udc *udc = platform_get_drvdata(pdev);
1736 1784
1737 /* maybe reconnect to host; if so, clocks on */ 1785 /* maybe reconnect to host; if so, clocks on */
1738 pullup(udc, 1); 1786 pullup(udc, 1);
@@ -1748,7 +1796,7 @@ static struct platform_driver at91_udc = {
1748 .remove = __devexit_p(at91udc_remove), 1796 .remove = __devexit_p(at91udc_remove),
1749 .shutdown = at91udc_shutdown, 1797 .shutdown = at91udc_shutdown,
1750 .suspend = at91udc_suspend, 1798 .suspend = at91udc_suspend,
1751 .resume = at91udc_resume, 1799 .resume = at91udc_resume,
1752 .driver = { 1800 .driver = {
1753 .name = (char *) driver_name, 1801 .name = (char *) driver_name,
1754 .owner = THIS_MODULE, 1802 .owner = THIS_MODULE,
@@ -1767,6 +1815,6 @@ static void __devexit udc_exit_module(void)
1767} 1815}
1768module_exit(udc_exit_module); 1816module_exit(udc_exit_module);
1769 1817
1770MODULE_DESCRIPTION("AT91RM9200 udc driver"); 1818MODULE_DESCRIPTION("AT91 udc driver");
1771MODULE_AUTHOR("Thomas Rathbone, David Brownell"); 1819MODULE_AUTHOR("Thomas Rathbone, David Brownell");
1772MODULE_LICENSE("GPL"); 1820MODULE_LICENSE("GPL");
diff --git a/drivers/usb/gadget/at91_udc.h b/drivers/usb/gadget/at91_udc.h
index 5a4799cedd19..882af42e86cc 100644
--- a/drivers/usb/gadget/at91_udc.h
+++ b/drivers/usb/gadget/at91_udc.h
@@ -141,6 +141,7 @@ struct at91_udc {
141 struct clk *iclk, *fclk; 141 struct clk *iclk, *fclk;
142 struct platform_device *pdev; 142 struct platform_device *pdev;
143 struct proc_dir_entry *pde; 143 struct proc_dir_entry *pde;
144 int udp_irq;
144}; 145};
145 146
146static inline struct at91_udc *to_udc(struct usb_gadget *g) 147static inline struct at91_udc *to_udc(struct usb_gadget *g)
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 4be47195bd38..7d1c22c34957 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -609,7 +609,8 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
609 if (!dum->driver) 609 if (!dum->driver)
610 return -ESHUTDOWN; 610 return -ESHUTDOWN;
611 611
612 spin_lock_irqsave (&dum->lock, flags); 612 local_irq_save (flags);
613 spin_lock (&dum->lock);
613 list_for_each_entry (req, &ep->queue, queue) { 614 list_for_each_entry (req, &ep->queue, queue) {
614 if (&req->req == _req) { 615 if (&req->req == _req) {
615 list_del_init (&req->queue); 616 list_del_init (&req->queue);
@@ -618,7 +619,7 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
618 break; 619 break;
619 } 620 }
620 } 621 }
621 spin_unlock_irqrestore (&dum->lock, flags); 622 spin_unlock (&dum->lock);
622 623
623 if (retval == 0) { 624 if (retval == 0) {
624 dev_dbg (udc_dev(dum), 625 dev_dbg (udc_dev(dum),
@@ -626,6 +627,7 @@ static int dummy_dequeue (struct usb_ep *_ep, struct usb_request *_req)
626 req, _ep->name, _req->length, _req->buf); 627 req, _ep->name, _req->length, _req->buf);
627 _req->complete (_ep, _req); 628 _req->complete (_ep, _req);
628 } 629 }
630 local_irq_restore (flags);
629 return retval; 631 return retval;
630} 632}
631 633
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 85b0b4ad4c16..d63177a8eaea 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -892,7 +892,7 @@ MODULE_LICENSE ("GPL");
892#define PCI_DRIVER ehci_pci_driver 892#define PCI_DRIVER ehci_pci_driver
893#endif 893#endif
894 894
895#ifdef CONFIG_PPC_83xx 895#ifdef CONFIG_MPC834x
896#include "ehci-fsl.c" 896#include "ehci-fsl.c"
897#define PLATFORM_DRIVER ehci_fsl_driver 897#define PLATFORM_DRIVER ehci_fsl_driver
898#endif 898#endif
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index cdbafb710000..85cc059705a6 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -4,7 +4,7 @@
4 * Copyright (C) 2004 SAN People (Pty) Ltd. 4 * Copyright (C) 2004 SAN People (Pty) Ltd.
5 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org> 5 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
6 * 6 *
7 * AT91RM9200 Bus Glue 7 * AT91 Bus Glue
8 * 8 *
9 * Based on fragments of 2.4 driver by Rick Bronson. 9 * Based on fragments of 2.4 driver by Rick Bronson.
10 * Based on ohci-omap.c 10 * Based on ohci-omap.c
@@ -19,12 +19,13 @@
19#include <asm/hardware.h> 19#include <asm/hardware.h>
20#include <asm/arch/board.h> 20#include <asm/arch/board.h>
21 21
22#ifndef CONFIG_ARCH_AT91RM9200 22#ifndef CONFIG_ARCH_AT91
23#error "CONFIG_ARCH_AT91RM9200 must be defined." 23#error "CONFIG_ARCH_AT91 must be defined."
24#endif 24#endif
25 25
26/* interface and function clocks */ 26/* interface and function clocks */
27static struct clk *iclk, *fclk; 27static struct clk *iclk, *fclk;
28static int clocked;
28 29
29extern int usb_disabled(void); 30extern int usb_disabled(void);
30 31
@@ -35,13 +36,14 @@ static void at91_start_hc(struct platform_device *pdev)
35 struct usb_hcd *hcd = platform_get_drvdata(pdev); 36 struct usb_hcd *hcd = platform_get_drvdata(pdev);
36 struct ohci_regs __iomem *regs = hcd->regs; 37 struct ohci_regs __iomem *regs = hcd->regs;
37 38
38 dev_dbg(&pdev->dev, "starting AT91RM9200 OHCI USB Controller\n"); 39 dev_dbg(&pdev->dev, "start\n");
39 40
40 /* 41 /*
41 * Start the USB clocks. 42 * Start the USB clocks.
42 */ 43 */
43 clk_enable(iclk); 44 clk_enable(iclk);
44 clk_enable(fclk); 45 clk_enable(fclk);
46 clocked = 1;
45 47
46 /* 48 /*
47 * The USB host controller must remain in reset. 49 * The USB host controller must remain in reset.
@@ -54,7 +56,7 @@ static void at91_stop_hc(struct platform_device *pdev)
54 struct usb_hcd *hcd = platform_get_drvdata(pdev); 56 struct usb_hcd *hcd = platform_get_drvdata(pdev);
55 struct ohci_regs __iomem *regs = hcd->regs; 57 struct ohci_regs __iomem *regs = hcd->regs;
56 58
57 dev_dbg(&pdev->dev, "stopping AT91RM9200 OHCI USB Controller\n"); 59 dev_dbg(&pdev->dev, "stop\n");
58 60
59 /* 61 /*
60 * Put the USB host controller into reset. 62 * Put the USB host controller into reset.
@@ -66,6 +68,7 @@ static void at91_stop_hc(struct platform_device *pdev)
66 */ 68 */
67 clk_disable(fclk); 69 clk_disable(fclk);
68 clk_disable(iclk); 70 clk_disable(iclk);
71 clocked = 0;
69} 72}
70 73
71 74
@@ -78,14 +81,15 @@ static int usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
78 81
79 82
80/** 83/**
81 * usb_hcd_at91_probe - initialize AT91RM9200-based HCDs 84 * usb_hcd_at91_probe - initialize AT91-based HCDs
82 * Context: !in_interrupt() 85 * Context: !in_interrupt()
83 * 86 *
84 * Allocates basic resources for this USB host controller, and 87 * Allocates basic resources for this USB host controller, and
85 * then invokes the start() method for the HCD associated with it 88 * then invokes the start() method for the HCD associated with it
86 * through the hotplug entry's driver_data. 89 * through the hotplug entry's driver_data.
87 */ 90 */
88int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *pdev) 91static int usb_hcd_at91_probe(const struct hc_driver *driver,
92 struct platform_device *pdev)
89{ 93{
90 int retval; 94 int retval;
91 struct usb_hcd *hcd = NULL; 95 struct usb_hcd *hcd = NULL;
@@ -95,12 +99,13 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *
95 return -ENODEV; 99 return -ENODEV;
96 } 100 }
97 101
98 if ((pdev->resource[0].flags != IORESOURCE_MEM) || (pdev->resource[1].flags != IORESOURCE_IRQ)) { 102 if ((pdev->resource[0].flags != IORESOURCE_MEM)
103 || (pdev->resource[1].flags != IORESOURCE_IRQ)) {
99 pr_debug("hcd probe: invalid resource type\n"); 104 pr_debug("hcd probe: invalid resource type\n");
100 return -ENODEV; 105 return -ENODEV;
101 } 106 }
102 107
103 hcd = usb_create_hcd(driver, &pdev->dev, "at91rm9200"); 108 hcd = usb_create_hcd(driver, &pdev->dev, "at91");
104 if (!hcd) 109 if (!hcd)
105 return -ENOMEM; 110 return -ENOMEM;
106 hcd->rsrc_start = pdev->resource[0].start; 111 hcd->rsrc_start = pdev->resource[0].start;
@@ -149,21 +154,23 @@ int usb_hcd_at91_probe (const struct hc_driver *driver, struct platform_device *
149/* may be called with controller, bus, and devices active */ 154/* may be called with controller, bus, and devices active */
150 155
151/** 156/**
152 * usb_hcd_at91_remove - shutdown processing for AT91RM9200-based HCDs 157 * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs
153 * @dev: USB Host Controller being removed 158 * @dev: USB Host Controller being removed
154 * Context: !in_interrupt() 159 * Context: !in_interrupt()
155 * 160 *
156 * Reverses the effect of usb_hcd_at91_probe(), first invoking 161 * Reverses the effect of usb_hcd_at91_probe(), first invoking
157 * the HCD's stop() method. It is always called from a thread 162 * the HCD's stop() method. It is always called from a thread
158 * context, normally "rmmod", "apmd", or something similar. 163 * context, "rmmod" or something similar.
159 * 164 *
160 */ 165 */
161static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pdev) 166static int usb_hcd_at91_remove(struct usb_hcd *hcd,
167 struct platform_device *pdev)
162{ 168{
163 usb_remove_hcd(hcd); 169 usb_remove_hcd(hcd);
164 at91_stop_hc(pdev); 170 at91_stop_hc(pdev);
165 iounmap(hcd->regs); 171 iounmap(hcd->regs);
166 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 172 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
173 disable_irq_wake(hcd->irq);
167 174
168 clk_put(fclk); 175 clk_put(fclk);
169 clk_put(iclk); 176 clk_put(iclk);
@@ -178,19 +185,21 @@ static int usb_hcd_at91_remove (struct usb_hcd *hcd, struct platform_device *pde
178static int __devinit 185static int __devinit
179ohci_at91_start (struct usb_hcd *hcd) 186ohci_at91_start (struct usb_hcd *hcd)
180{ 187{
181// struct at91_ohci_data *board = hcd->self.controller->platform_data; 188 struct at91_usbh_data *board = hcd->self.controller->platform_data;
182 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 189 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
190 struct usb_device *root = hcd->self.root_hub;
183 int ret; 191 int ret;
184 192
185 if ((ret = ohci_init(ohci)) < 0) 193 if ((ret = ohci_init(ohci)) < 0)
186 return ret; 194 return ret;
187 195
196 root->maxchild = board->ports;
197
188 if ((ret = ohci_run(ohci)) < 0) { 198 if ((ret = ohci_run(ohci)) < 0) {
189 err("can't start %s", hcd->self.bus_name); 199 err("can't start %s", hcd->self.bus_name);
190 ohci_stop(hcd); 200 ohci_stop(hcd);
191 return ret; 201 return ret;
192 } 202 }
193// hcd->self.root_hub->maxchild = board->ports;
194 return 0; 203 return 0;
195} 204}
196 205
@@ -198,7 +207,7 @@ ohci_at91_start (struct usb_hcd *hcd)
198 207
199static const struct hc_driver ohci_at91_hc_driver = { 208static const struct hc_driver ohci_at91_hc_driver = {
200 .description = hcd_name, 209 .description = hcd_name,
201 .product_desc = "AT91RM9200 OHCI", 210 .product_desc = "AT91 OHCI",
202 .hcd_priv_size = sizeof(struct ohci_hcd), 211 .hcd_priv_size = sizeof(struct ohci_hcd),
203 212
204 /* 213 /*
@@ -240,33 +249,54 @@ static const struct hc_driver ohci_at91_hc_driver = {
240 249
241/*-------------------------------------------------------------------------*/ 250/*-------------------------------------------------------------------------*/
242 251
243static int ohci_hcd_at91_drv_probe(struct platform_device *dev) 252static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
244{ 253{
245 return usb_hcd_at91_probe(&ohci_at91_hc_driver, dev); 254 device_init_wakeup(&pdev->dev, 1);
255 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
246} 256}
247 257
248static int ohci_hcd_at91_drv_remove(struct platform_device *dev) 258static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
249{ 259{
250 return usb_hcd_at91_remove(platform_get_drvdata(dev), dev); 260 device_init_wakeup(&pdev->dev, 0);
261 return usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev);
251} 262}
252 263
253#ifdef CONFIG_PM 264#ifdef CONFIG_PM
254 265
255/* REVISIT suspend/resume look "too" simple here */
256
257static int 266static int
258ohci_hcd_at91_drv_suspend(struct platform_device *dev, pm_message_t mesg) 267ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
259{ 268{
260 clk_disable(fclk); 269 struct usb_hcd *hcd = platform_get_drvdata(pdev);
261 clk_disable(iclk); 270 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
271
272 if (device_may_wakeup(&pdev->dev))
273 enable_irq_wake(hcd->irq);
274 else
275 disable_irq_wake(hcd->irq);
276
277 /*
278 * The integrated transceivers seem unable to notice disconnect,
279 * reconnect, or wakeup without the 48 MHz clock active. so for
280 * correctness, always discard connection state (using reset).
281 *
282 * REVISIT: some boards will be able to turn VBUS off...
283 */
284 if (at91_suspend_entering_slow_clock()) {
285 ohci_usb_reset (ohci);
286 clk_disable(fclk);
287 clk_disable(iclk);
288 clocked = 0;
289 }
262 290
263 return 0; 291 return 0;
264} 292}
265 293
266static int ohci_hcd_at91_drv_resume(struct platform_device *dev) 294static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
267{ 295{
268 clk_enable(iclk); 296 if (!clocked) {
269 clk_enable(fclk); 297 clk_enable(iclk);
298 clk_enable(fclk);
299 }
270 300
271 return 0; 301 return 0;
272} 302}
@@ -275,7 +305,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *dev)
275#define ohci_hcd_at91_drv_resume NULL 305#define ohci_hcd_at91_drv_resume NULL
276#endif 306#endif
277 307
278MODULE_ALIAS("at91rm9200-ohci"); 308MODULE_ALIAS("at91_ohci");
279 309
280static struct platform_driver ohci_hcd_at91_driver = { 310static struct platform_driver ohci_hcd_at91_driver = {
281 .probe = ohci_hcd_at91_drv_probe, 311 .probe = ohci_hcd_at91_drv_probe,
@@ -283,7 +313,7 @@ static struct platform_driver ohci_hcd_at91_driver = {
283 .suspend = ohci_hcd_at91_drv_suspend, 313 .suspend = ohci_hcd_at91_drv_suspend,
284 .resume = ohci_hcd_at91_drv_resume, 314 .resume = ohci_hcd_at91_drv_resume,
285 .driver = { 315 .driver = {
286 .name = "at91rm9200-ohci", 316 .name = "at91_ohci",
287 .owner = THIS_MODULE, 317 .owner = THIS_MODULE,
288 }, 318 },
289}; 319};
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index afef5ac35b4a..94d8cf4b36c1 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -913,7 +913,7 @@ MODULE_LICENSE ("GPL");
913#include "ohci-ppc-soc.c" 913#include "ohci-ppc-soc.c"
914#endif 914#endif
915 915
916#ifdef CONFIG_ARCH_AT91RM9200 916#if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261)
917#include "ohci-at91.c" 917#include "ohci-at91.c"
918#endif 918#endif
919 919
@@ -927,6 +927,7 @@ MODULE_LICENSE ("GPL");
927 || defined (CONFIG_SOC_AU1X00) \ 927 || defined (CONFIG_SOC_AU1X00) \
928 || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \ 928 || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \
929 || defined (CONFIG_ARCH_AT91RM9200) \ 929 || defined (CONFIG_ARCH_AT91RM9200) \
930 || defined (CONFIG_ARCH_AT91SAM9261) \
930 ) 931 )
931#error "missing bus glue for ohci-hcd" 932#error "missing bus glue for ohci-hcd"
932#endif 933#endif
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index c9d72ac0a1d7..66c3f61bc9d1 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -943,7 +943,9 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)
943 /* We received a short packet */ 943 /* We received a short packet */
944 if (urb->transfer_flags & URB_SHORT_NOT_OK) 944 if (urb->transfer_flags & URB_SHORT_NOT_OK)
945 ret = -EREMOTEIO; 945 ret = -EREMOTEIO;
946 else if (ctrlstat & TD_CTRL_SPD) 946
947 /* Fixup needed only if this isn't the URB's last TD */
948 else if (&td->list != urbp->td_list.prev)
947 ret = 1; 949 ret = 1;
948 } 950 }
949 951
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
index 05d2d6012eb2..df198cf76f52 100644
--- a/drivers/usb/input/ati_remote.c
+++ b/drivers/usb/input/ati_remote.c
@@ -152,9 +152,8 @@ static const char accel[] = { 1, 2, 4, 6, 9, 13, 20 };
152 * events. The hardware generates 5 events for the first keypress 152 * events. The hardware generates 5 events for the first keypress
153 * and we have to take this into account for an accurate repeat 153 * and we have to take this into account for an accurate repeat
154 * behaviour. 154 * behaviour.
155 * (HZ / 20) == 50 ms and works well for me.
156 */ 155 */
157#define FILTER_TIME (HZ / 20) 156#define FILTER_TIME 60 /* msec */
158 157
159struct ati_remote { 158struct ati_remote {
160 struct input_dev *idev; 159 struct input_dev *idev;
@@ -467,7 +466,7 @@ static void ati_remote_input_report(struct urb *urb, struct pt_regs *regs)
467 /* Filter duplicate events which happen "too close" together. */ 466 /* Filter duplicate events which happen "too close" together. */
468 if ((ati_remote->old_data[0] == data[1]) && 467 if ((ati_remote->old_data[0] == data[1]) &&
469 (ati_remote->old_data[1] == data[2]) && 468 (ati_remote->old_data[1] == data[2]) &&
470 time_before(jiffies, ati_remote->old_jiffies + FILTER_TIME)) { 469 time_before(jiffies, ati_remote->old_jiffies + msecs_to_jiffies(FILTER_TIME))) {
471 ati_remote->repeat_count++; 470 ati_remote->repeat_count++;
472 } else { 471 } else {
473 ati_remote->repeat_count = 0; 472 ati_remote->repeat_count = 0;
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index e091d327bd9e..a4062a6adbb8 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -12,8 +12,13 @@
12* the single I/O ports of the device. 12* the single I/O ports of the device.
13* 13*
14* Supported vendors: AK Modul-Bus Computer GmbH 14* Supported vendors: AK Modul-Bus Computer GmbH
15* Supported devices: CY7C63001A-PC (to be continued...) 15* (Firmware "Port-Chip")
16* Supported functions: Read/Write Ports (to be continued...) 16*
17* Supported devices: CY7C63001A-PC
18* CY7C63001C-PXC
19* CY7C63001C-SXC
20*
21* Supported functions: Read/Write Ports
17* 22*
18* 23*
19* This program is free software; you can redistribute it and/or 24* This program is free software; you can redistribute it and/or
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
index e5e6e4f3ef87..bd09232ce13c 100644
--- a/drivers/usb/net/rtl8150.c
+++ b/drivers/usb/net/rtl8150.c
@@ -175,6 +175,8 @@ static inline struct sk_buff *pull_skb(rtl8150_t *);
175static void rtl8150_disconnect(struct usb_interface *intf); 175static void rtl8150_disconnect(struct usb_interface *intf);
176static int rtl8150_probe(struct usb_interface *intf, 176static int rtl8150_probe(struct usb_interface *intf,
177 const struct usb_device_id *id); 177 const struct usb_device_id *id);
178static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message);
179static int rtl8150_resume(struct usb_interface *intf);
178 180
179static const char driver_name [] = "rtl8150"; 181static const char driver_name [] = "rtl8150";
180 182
@@ -183,6 +185,8 @@ static struct usb_driver rtl8150_driver = {
183 .probe = rtl8150_probe, 185 .probe = rtl8150_probe,
184 .disconnect = rtl8150_disconnect, 186 .disconnect = rtl8150_disconnect,
185 .id_table = rtl8150_table, 187 .id_table = rtl8150_table,
188 .suspend = rtl8150_suspend,
189 .resume = rtl8150_resume
186}; 190};
187 191
188/* 192/*
@@ -238,9 +242,11 @@ static int async_set_registers(rtl8150_t * dev, u16 indx, u16 size)
238 usb_fill_control_urb(dev->ctrl_urb, dev->udev, 242 usb_fill_control_urb(dev->ctrl_urb, dev->udev,
239 usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr, 243 usb_sndctrlpipe(dev->udev, 0), (char *) &dev->dr,
240 &dev->rx_creg, size, ctrl_callback, dev); 244 &dev->rx_creg, size, ctrl_callback, dev);
241 if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) 245 if ((ret = usb_submit_urb(dev->ctrl_urb, GFP_ATOMIC))) {
246 if (ret == -ENODEV)
247 netif_device_detach(dev->netdev);
242 err("control request submission failed: %d", ret); 248 err("control request submission failed: %d", ret);
243 else 249 } else
244 set_bit(RX_REG_SET, &dev->flags); 250 set_bit(RX_REG_SET, &dev->flags);
245 251
246 return ret; 252 return ret;
@@ -416,6 +422,7 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
416 struct sk_buff *skb; 422 struct sk_buff *skb;
417 struct net_device *netdev; 423 struct net_device *netdev;
418 u16 rx_stat; 424 u16 rx_stat;
425 int status;
419 426
420 dev = urb->context; 427 dev = urb->context;
421 if (!dev) 428 if (!dev)
@@ -465,7 +472,10 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
465goon: 472goon:
466 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 473 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
467 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 474 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
468 if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) { 475 status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
476 if (status == -ENODEV)
477 netif_device_detach(dev->netdev);
478 else if (status) {
469 set_bit(RX_URB_FAIL, &dev->flags); 479 set_bit(RX_URB_FAIL, &dev->flags);
470 goto resched; 480 goto resched;
471 } else { 481 } else {
@@ -481,6 +491,7 @@ static void rx_fixup(unsigned long data)
481{ 491{
482 rtl8150_t *dev; 492 rtl8150_t *dev;
483 struct sk_buff *skb; 493 struct sk_buff *skb;
494 int status;
484 495
485 dev = (rtl8150_t *)data; 496 dev = (rtl8150_t *)data;
486 497
@@ -499,10 +510,13 @@ static void rx_fixup(unsigned long data)
499 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 510 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
500 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 511 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
501try_again: 512try_again:
502 if (usb_submit_urb(dev->rx_urb, GFP_ATOMIC)) { 513 status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
514 if (status == -ENODEV) {
515 netif_device_detach(dev->netdev);
516 } else if (status) {
503 set_bit(RX_URB_FAIL, &dev->flags); 517 set_bit(RX_URB_FAIL, &dev->flags);
504 goto tlsched; 518 goto tlsched;
505 } else { 519 } else {
506 clear_bit(RX_URB_FAIL, &dev->flags); 520 clear_bit(RX_URB_FAIL, &dev->flags);
507 } 521 }
508 522
@@ -574,12 +588,43 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs)
574 588
575resubmit: 589resubmit:
576 status = usb_submit_urb (urb, SLAB_ATOMIC); 590 status = usb_submit_urb (urb, SLAB_ATOMIC);
577 if (status) 591 if (status == -ENODEV)
592 netif_device_detach(dev->netdev);
593 else if (status)
578 err ("can't resubmit intr, %s-%s/input0, status %d", 594 err ("can't resubmit intr, %s-%s/input0, status %d",
579 dev->udev->bus->bus_name, 595 dev->udev->bus->bus_name,
580 dev->udev->devpath, status); 596 dev->udev->devpath, status);
581} 597}
582 598
599static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message)
600{
601 rtl8150_t *dev = usb_get_intfdata(intf);
602
603 netif_device_detach(dev->netdev);
604
605 if (netif_running(dev->netdev)) {
606 usb_kill_urb(dev->rx_urb);
607 usb_kill_urb(dev->intr_urb);
608 }
609 return 0;
610}
611
612static int rtl8150_resume(struct usb_interface *intf)
613{
614 rtl8150_t *dev = usb_get_intfdata(intf);
615
616 netif_device_attach(dev->netdev);
617 if (netif_running(dev->netdev)) {
618 dev->rx_urb->status = 0;
619 dev->rx_urb->actual_length = 0;
620 read_bulk_callback(dev->rx_urb, NULL);
621
622 dev->intr_urb->status = 0;
623 dev->intr_urb->actual_length = 0;
624 intr_callback(dev->intr_urb, NULL);
625 }
626 return 0;
627}
583 628
584/* 629/*
585** 630**
@@ -690,9 +735,14 @@ static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev)
690 usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), 735 usb_fill_bulk_urb(dev->tx_urb, dev->udev, usb_sndbulkpipe(dev->udev, 2),
691 skb->data, count, write_bulk_callback, dev); 736 skb->data, count, write_bulk_callback, dev);
692 if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) { 737 if ((res = usb_submit_urb(dev->tx_urb, GFP_ATOMIC))) {
693 warn("failed tx_urb %d\n", res); 738 /* Can we get/handle EPIPE here? */
694 dev->stats.tx_errors++; 739 if (res == -ENODEV)
695 netif_start_queue(netdev); 740 netif_device_detach(dev->netdev);
741 else {
742 warn("failed tx_urb %d\n", res);
743 dev->stats.tx_errors++;
744 netif_start_queue(netdev);
745 }
696 } else { 746 } else {
697 dev->stats.tx_packets++; 747 dev->stats.tx_packets++;
698 dev->stats.tx_bytes += skb->len; 748 dev->stats.tx_bytes += skb->len;
@@ -729,16 +779,25 @@ static int rtl8150_open(struct net_device *netdev)
729 779
730 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 780 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
731 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 781 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
732 if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) 782 if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) {
783 if (res == -ENODEV)
784 netif_device_detach(dev->netdev);
733 warn("%s: rx_urb submit failed: %d", __FUNCTION__, res); 785 warn("%s: rx_urb submit failed: %d", __FUNCTION__, res);
786 return res;
787 }
734 usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3), 788 usb_fill_int_urb(dev->intr_urb, dev->udev, usb_rcvintpipe(dev->udev, 3),
735 dev->intr_buff, INTBUFSIZE, intr_callback, 789 dev->intr_buff, INTBUFSIZE, intr_callback,
736 dev, dev->intr_interval); 790 dev, dev->intr_interval);
737 if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) 791 if ((res = usb_submit_urb(dev->intr_urb, GFP_KERNEL))) {
792 if (res == -ENODEV)
793 netif_device_detach(dev->netdev);
738 warn("%s: intr_urb submit failed: %d", __FUNCTION__, res); 794 warn("%s: intr_urb submit failed: %d", __FUNCTION__, res);
739 netif_start_queue(netdev); 795 usb_kill_urb(dev->rx_urb);
796 return res;
797 }
740 enable_net_traffic(dev); 798 enable_net_traffic(dev);
741 set_carrier(netdev); 799 set_carrier(netdev);
800 netif_start_queue(netdev);
742 801
743 return res; 802 return res;
744} 803}
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index ac33bd47cfce..f5b9438c94f0 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -62,15 +62,6 @@ config USB_SERIAL_AIRPRIME
62 To compile this driver as a module, choose M here: the 62 To compile this driver as a module, choose M here: the
63 module will be called airprime. 63 module will be called airprime.
64 64
65config USB_SERIAL_ANYDATA
66 tristate "USB AnyData CDMA Wireless Driver"
67 depends on USB_SERIAL
68 help
69 Say Y here if you want to use a AnyData CDMA device.
70
71 To compile this driver as a module, choose M here: the
72 module will be called anydata.
73
74config USB_SERIAL_ARK3116 65config USB_SERIAL_ARK3116
75 tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)" 66 tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)"
76 depends on USB_SERIAL && EXPERIMENTAL 67 depends on USB_SERIAL && EXPERIMENTAL
@@ -502,15 +493,18 @@ config USB_SERIAL_XIRCOM
502 module will be called keyspan_pda. 493 module will be called keyspan_pda.
503 494
504config USB_SERIAL_OPTION 495config USB_SERIAL_OPTION
505 tristate "USB driver for GSM modems" 496 tristate "USB driver for GSM and CDMA modems"
506 depends on USB_SERIAL 497 depends on USB_SERIAL
507 help 498 help
508 Say Y here if you have an "Option" GSM PCMCIA card 499 Say Y here if you have a GSM or CDMA modem that's connected to USB.
509 (or an OEM version: branded Huawei, Audiovox, or Novatel). 500
501 This driver also supports several PCMCIA cards which have a
502 built-in OHCI-USB adapter and an internally-connected GSM modem.
503 The USB bus on these cards is not accessible externally.
510 504
511 These cards feature a built-in OHCI-USB adapter and an 505 Supported devices include (some of?) those made by:
512 internally-connected GSM modem. The USB bus is not 506 Option, Huawei, Audiovox, Sierra Wireless, Novatel Wireless, or
513 accessible externally. 507 Anydata.
514 508
515 To compile this driver as a module, choose M here: the 509 To compile this driver as a module, choose M here: the
516 module will be called option. 510 module will be called option.
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 35d4acc7f1d3..8efed2ce1ba3 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -12,7 +12,6 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o
12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) 12usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y)
13 13
14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o 14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o
15obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o
16obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o 15obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o
17obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o 16obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o
18obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o 17obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c
deleted file mode 100644
index 01843ef8c11e..000000000000
--- a/drivers/usb/serial/anydata.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 * AnyData CDMA Serial USB driver
3 *
4 * Copyright (C) 2005 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/tty.h>
14#include <linux/module.h>
15#include <linux/usb.h>
16#include <linux/usb/serial.h>
17
18static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */
20 { },
21};
22MODULE_DEVICE_TABLE(usb, id_table);
23
24/* if overridden by the user, then use their value for the size of the
25 * read and write urbs */
26static int buffer_size;
27static int debug;
28
29static struct usb_driver anydata_driver = {
30 .name = "anydata",
31 .probe = usb_serial_probe,
32 .disconnect = usb_serial_disconnect,
33 .id_table = id_table,
34 .no_dynamic_id = 1,
35};
36
37static int anydata_open(struct usb_serial_port *port, struct file *filp)
38{
39 char *buffer;
40 int result = 0;
41
42 dbg("%s - port %d", __FUNCTION__, port->number);
43
44 if (buffer_size) {
45 /* override the default buffer sizes */
46 buffer = kmalloc(buffer_size, GFP_KERNEL);
47 if (!buffer) {
48 dev_err(&port->dev, "%s - out of memory.\n",
49 __FUNCTION__);
50 return -ENOMEM;
51 }
52 kfree (port->read_urb->transfer_buffer);
53 port->read_urb->transfer_buffer = buffer;
54 port->read_urb->transfer_buffer_length = buffer_size;
55
56 buffer = kmalloc(buffer_size, GFP_KERNEL);
57 if (!buffer) {
58 dev_err(&port->dev, "%s - out of memory.\n",
59 __FUNCTION__);
60 return -ENOMEM;
61 }
62 kfree (port->write_urb->transfer_buffer);
63 port->write_urb->transfer_buffer = buffer;
64 port->write_urb->transfer_buffer_length = buffer_size;
65 port->bulk_out_size = buffer_size;
66 }
67
68 /* Start reading from the device */
69 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
70 usb_rcvbulkpipe(port->serial->dev,
71 port->bulk_in_endpointAddress),
72 port->read_urb->transfer_buffer,
73 port->read_urb->transfer_buffer_length,
74 usb_serial_generic_read_bulk_callback, port);
75 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
76 if (result)
77 dev_err(&port->dev,
78 "%s - failed submitting read urb, error %d\n",
79 __FUNCTION__, result);
80
81 return result;
82}
83
84static struct usb_serial_driver anydata_device = {
85 .driver = {
86 .owner = THIS_MODULE,
87 .name = "anydata",
88 },
89 .id_table = id_table,
90 .num_interrupt_in = NUM_DONT_CARE,
91 .num_bulk_in = NUM_DONT_CARE,
92 .num_bulk_out = NUM_DONT_CARE,
93 .num_ports = 1,
94 .open = anydata_open,
95};
96
97static int __init anydata_init(void)
98{
99 int retval;
100
101 retval = usb_serial_register(&anydata_device);
102 if (retval)
103 return retval;
104 retval = usb_register(&anydata_driver);
105 if (retval)
106 usb_serial_deregister(&anydata_device);
107 return retval;
108}
109
110static void __exit anydata_exit(void)
111{
112 usb_deregister(&anydata_driver);
113 usb_serial_deregister(&anydata_device);
114}
115
116module_init(anydata_init);
117module_exit(anydata_exit);
118MODULE_LICENSE("GPL");
119
120module_param(debug, bool, S_IRUGO | S_IWUSR);
121MODULE_PARM_DESC(debug, "Debug enabled or not");
122module_param(buffer_size, int, 0);
123MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers");
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index b458aedc5fb6..a20da8528a5f 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -337,6 +337,7 @@ static struct usb_device_id id_table_combined [] = {
337 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 337 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
338 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) }, 338 { USB_DEVICE(FTDI_VID, FTDI_PERLE_ULTRAPORT_PID) },
339 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) }, 339 { USB_DEVICE(FTDI_VID, FTDI_PIEGROUP_PID) },
340 { USB_DEVICE(FTDI_VID, FTDI_TNC_X_PID) },
340 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) }, 341 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2101_PID) },
341 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) }, 342 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2102_PID) },
342 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) }, 343 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2103_PID) },
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 04ef90fcb876..9f7343a45424 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -182,6 +182,10 @@
182/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */ 182/* http://home.earthlink.net/~jrhees/USBUIRT/index.htm */
183#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */ 183#define FTDI_USB_UIRT_PID 0xF850 /* Product Id */
184 184
185/* TNC-X USB-to-packet-radio adapter, versions prior to 3.0 (DLP module) */
186
187#define FTDI_TNC_X_PID 0xEBE0
188
185/* 189/*
186 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de). 190 * ELV USB devices submitted by Christian Abt of ELV (www.elv.de).
187 * All of these devices use FTDI's vendor ID (0x0403). 191 * All of these devices use FTDI's vendor ID (0x0403).
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 59c5d999009a..7e1bd5d6dfa0 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -250,6 +250,7 @@ static struct usb_device_id ipaq_id_table [] = {
250 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ 250 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */
251 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ 251 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
252 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ 252 { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */
253 { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */
253 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ 254 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */
254 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ 255 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */
255 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ 256 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f0530c1d7b7a..c856e6f40e22 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -9,40 +9,14 @@
9 9
10 Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org> 10 Portions copied from the Keyspan driver by Hugh Blemings <hugh@blemings.org>
11 11
12 History: 12 History: see the git log.
13
14 2005-05-19 v0.1 Initial version, based on incomplete docs
15 and analysis of misbehavior with the standard driver
16 2005-05-20 v0.2 Extended the input buffer to avoid losing
17 random 64-byte chunks of data
18 2005-05-21 v0.3 implemented chars_in_buffer()
19 turned on low_latency
20 simplified the code somewhat
21 2005-05-24 v0.4 option_write() sometimes deadlocked under heavy load
22 removed some dead code
23 added sponsor notice
24 coding style clean-up
25 2005-06-20 v0.4.1 add missing braces :-/
26 killed end-of-line whitespace
27 2005-07-15 v0.4.2 rename WLAN product to FUSION, add FUSION2
28 2005-09-10 v0.4.3 added HUAWEI E600 card and Audiovox AirCard
29 2005-09-20 v0.4.4 increased recv buffer size: the card sometimes
30 wants to send >2000 bytes.
31 2006-04-10 v0.5 fixed two array overrun errors :-/
32 2006-04-21 v0.5.1 added support for Sierra Wireless MC8755
33 2006-05-15 v0.6 re-enable multi-port support
34 2006-06-01 v0.6.1 add COBRA
35 2006-06-01 v0.6.2 add backwards-compatibility stuff
36 2006-06-01 v0.6.3 add Novatel Wireless
37 2006-06-01 v0.7 Option => GSM
38 2006-06-01 v0.7.1 add COBRA2
39 13
40 Work sponsored by: Sigos GmbH, Germany <info@sigos.de> 14 Work sponsored by: Sigos GmbH, Germany <info@sigos.de>
41 15
42 This driver exists because the "normal" serial driver doesn't work too well 16 This driver exists because the "normal" serial driver doesn't work too well
43 with GSM modems. Issues: 17 with GSM modems. Issues:
44 - data loss -- one single Receive URB is not nearly enough 18 - data loss -- one single Receive URB is not nearly enough
45 - nonstandard flow (Option devices) and multiplex (Sierra) control 19 - nonstandard flow (Option devices) control
46 - controlling the baud rate doesn't make sense 20 - controlling the baud rate doesn't make sense
47 21
48 This driver is named "option" because the most common device it's 22 This driver is named "option" because the most common device it's
@@ -96,8 +70,8 @@ static int option_send_setup(struct usb_serial_port *port);
96#define OPTION_VENDOR_ID 0x0AF0 70#define OPTION_VENDOR_ID 0x0AF0
97#define HUAWEI_VENDOR_ID 0x12D1 71#define HUAWEI_VENDOR_ID 0x12D1
98#define AUDIOVOX_VENDOR_ID 0x0F3D 72#define AUDIOVOX_VENDOR_ID 0x0F3D
99#define SIERRAWIRELESS_VENDOR_ID 0x1199
100#define NOVATELWIRELESS_VENDOR_ID 0x1410 73#define NOVATELWIRELESS_VENDOR_ID 0x1410
74#define ANYDATA_VENDOR_ID 0x16d5
101 75
102#define OPTION_PRODUCT_OLD 0x5000 76#define OPTION_PRODUCT_OLD 0x5000
103#define OPTION_PRODUCT_FUSION 0x6000 77#define OPTION_PRODUCT_FUSION 0x6000
@@ -106,8 +80,8 @@ static int option_send_setup(struct usb_serial_port *port);
106#define OPTION_PRODUCT_COBRA2 0x6600 80#define OPTION_PRODUCT_COBRA2 0x6600
107#define HUAWEI_PRODUCT_E600 0x1001 81#define HUAWEI_PRODUCT_E600 0x1001
108#define AUDIOVOX_PRODUCT_AIRCARD 0x0112 82#define AUDIOVOX_PRODUCT_AIRCARD 0x0112
109#define SIERRAWIRELESS_PRODUCT_MC8755 0x6802
110#define NOVATELWIRELESS_PRODUCT_U740 0x1400 83#define NOVATELWIRELESS_PRODUCT_U740 0x1400
84#define ANYDATA_PRODUCT_ID 0x6501
111 85
112static struct usb_device_id option_ids[] = { 86static struct usb_device_id option_ids[] = {
113 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) }, 87 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_OLD) },
@@ -117,8 +91,8 @@ static struct usb_device_id option_ids[] = {
117 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) }, 91 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COBRA2) },
118 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 92 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
119 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, 93 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) },
120 { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) },
121 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 94 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
95 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
122 { } /* Terminating entry */ 96 { } /* Terminating entry */
123}; 97};
124 98
@@ -131,10 +105,7 @@ static struct usb_device_id option_ids1[] = {
131 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 105 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
132 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) }, 106 { USB_DEVICE(AUDIOVOX_VENDOR_ID, AUDIOVOX_PRODUCT_AIRCARD) },
133 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, 107 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) },
134 { } /* Terminating entry */ 108 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) },
135};
136static struct usb_device_id option_ids3[] = {
137 { USB_DEVICE(SIERRAWIRELESS_VENDOR_ID, SIERRAWIRELESS_PRODUCT_MC8755) },
138 { } /* Terminating entry */ 109 { } /* Terminating entry */
139}; 110};
140 111
@@ -151,37 +122,11 @@ static struct usb_driver option_driver = {
151/* The card has three separate interfaces, which the serial driver 122/* The card has three separate interfaces, which the serial driver
152 * recognizes separately, thus num_port=1. 123 * recognizes separately, thus num_port=1.
153 */ 124 */
154static struct usb_serial_driver option_3port_device = {
155 .driver = {
156 .owner = THIS_MODULE,
157 .name = "option",
158 },
159 .description = "GSM modem (3-port)",
160 .id_table = option_ids3,
161 .num_interrupt_in = NUM_DONT_CARE,
162 .num_bulk_in = NUM_DONT_CARE,
163 .num_bulk_out = NUM_DONT_CARE,
164 .num_ports = 3,
165 .open = option_open,
166 .close = option_close,
167 .write = option_write,
168 .write_room = option_write_room,
169 .chars_in_buffer = option_chars_in_buffer,
170 .throttle = option_rx_throttle,
171 .unthrottle = option_rx_unthrottle,
172 .set_termios = option_set_termios,
173 .break_ctl = option_break_ctl,
174 .tiocmget = option_tiocmget,
175 .tiocmset = option_tiocmset,
176 .attach = option_startup,
177 .shutdown = option_shutdown,
178 .read_int_callback = option_instat_callback,
179};
180 125
181static struct usb_serial_driver option_1port_device = { 126static struct usb_serial_driver option_1port_device = {
182 .driver = { 127 .driver = {
183 .owner = THIS_MODULE, 128 .owner = THIS_MODULE,
184 .name = "option", 129 .name = "option1",
185 }, 130 },
186 .description = "GSM modem (1-port)", 131 .description = "GSM modem (1-port)",
187 .id_table = option_ids1, 132 .id_table = option_ids1,
@@ -245,9 +190,6 @@ static int __init option_init(void)
245 retval = usb_serial_register(&option_1port_device); 190 retval = usb_serial_register(&option_1port_device);
246 if (retval) 191 if (retval)
247 goto failed_1port_device_register; 192 goto failed_1port_device_register;
248 retval = usb_serial_register(&option_3port_device);
249 if (retval)
250 goto failed_3port_device_register;
251 retval = usb_register(&option_driver); 193 retval = usb_register(&option_driver);
252 if (retval) 194 if (retval)
253 goto failed_driver_register; 195 goto failed_driver_register;
@@ -257,8 +199,6 @@ static int __init option_init(void)
257 return 0; 199 return 0;
258 200
259failed_driver_register: 201failed_driver_register:
260 usb_serial_deregister (&option_3port_device);
261failed_3port_device_register:
262 usb_serial_deregister (&option_1port_device); 202 usb_serial_deregister (&option_1port_device);
263failed_1port_device_register: 203failed_1port_device_register:
264 return retval; 204 return retval;
@@ -267,7 +207,6 @@ failed_1port_device_register:
267static void __exit option_exit(void) 207static void __exit option_exit(void)
268{ 208{
269 usb_deregister (&option_driver); 209 usb_deregister (&option_driver);
270 usb_serial_deregister (&option_3port_device);
271 usb_serial_deregister (&option_1port_device); 210 usb_serial_deregister (&option_1port_device);
272} 211}
273 212
@@ -656,7 +595,6 @@ static void option_setup_urbs(struct usb_serial *serial)
656 595
657 dbg("%s", __FUNCTION__); 596 dbg("%s", __FUNCTION__);
658 597
659
660 for (i = 0; i < serial->num_ports; i++) { 598 for (i = 0; i < serial->num_ports; i++) {
661 port = serial->port[i]; 599 port = serial->port[i];
662 portdata = usb_get_serial_port_data(port); 600 portdata = usb_get_serial_port_data(port);
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 259db31b65c1..efbbc0adb89a 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -81,6 +81,7 @@ static struct usb_device_id id_table [] = {
81 { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) }, 81 { USB_DEVICE(SPEEDDRAGON_VENDOR_ID, SPEEDDRAGON_PRODUCT_ID) },
82 { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) }, 82 { USB_DEVICE(OTI_VENDOR_ID, OTI_PRODUCT_ID) },
83 { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) }, 83 { USB_DEVICE(DATAPILOT_U2_VENDOR_ID, DATAPILOT_U2_PRODUCT_ID) },
84 { USB_DEVICE(BELKIN_VENDOR_ID, BELKIN_PRODUCT_ID) },
84 { } /* Terminating entry */ 85 { } /* Terminating entry */
85}; 86};
86 87
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index d9c1e6e0b4b3..a692ac66ca6c 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -89,3 +89,7 @@
89/* DATAPILOT Universal-2 Phone Cable */ 89/* DATAPILOT Universal-2 Phone Cable */
90#define DATAPILOT_U2_VENDOR_ID 0x0731 90#define DATAPILOT_U2_VENDOR_ID 0x0731
91#define DATAPILOT_U2_PRODUCT_ID 0x2003 91#define DATAPILOT_U2_PRODUCT_ID 0x2003
92
93/* Belkin "F5U257" Serial Adapter */
94#define BELKIN_VENDOR_ID 0x050d
95#define BELKIN_PRODUCT_ID 0x0257
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index a5ca449f6e64..2793f9a912b4 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -145,6 +145,13 @@ UNUSUAL_DEV( 0x0420, 0x0001, 0x0100, 0x0100,
145 US_SC_DEVICE, US_PR_DEVICE, NULL, 145 US_SC_DEVICE, US_PR_DEVICE, NULL,
146 US_FL_IGNORE_RESIDUE ), 146 US_FL_IGNORE_RESIDUE ),
147 147
148/* Reported by Mario Rettig <mariorettig@web.de> */
149UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
150 "Nokia",
151 "Nokia 3250",
152 US_SC_DEVICE, US_PR_DEVICE, NULL,
153 US_FL_IGNORE_RESIDUE | US_FL_FIX_CAPACITY ),
154
148/* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and 155/* Reported by Sumedha Swamy <sumedhaswamy@gmail.com> and
149 * Einar Th. Einarsson <einarthered@gmail.com> */ 156 * Einar Th. Einarsson <einarthered@gmail.com> */
150UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100, 157UNUSUAL_DEV( 0x0421, 0x0444, 0x0100, 0x0100,
@@ -627,18 +634,6 @@ UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210,
627 "Digital Camera EX-20 DSC", 634 "Digital Camera EX-20 DSC",
628 US_SC_8070, US_PR_DEVICE, NULL, 0 ), 635 US_SC_8070, US_PR_DEVICE, NULL, 0 ),
629 636
630/* The entry was here before I took over, and had US_SC_RBC. It turns
631 * out that isn't needed. Additionally, Torsten Eriksson
632 * <Torsten.Eriksson@bergianska.se> is able to use his device fine
633 * without this entry at all - but I don't suspect that will be true
634 * for all users (the protocol is likely needed), so is staying at
635 * this time. - Phil Dibowitz <phil@ipom.com>
636 */
637UNUSUAL_DEV( 0x059f, 0xa601, 0x0200, 0x0200,
638 "LaCie",
639 "USB Hard Disk",
640 US_SC_DEVICE, US_PR_CB, NULL, 0 ),
641
642/* Submitted by Joel Bourquard <numlock@freesurf.ch> 637/* Submitted by Joel Bourquard <numlock@freesurf.ch>
643 * Some versions of this device need the SubClass and Protocol overrides 638 * Some versions of this device need the SubClass and Protocol overrides
644 * while others don't. 639 * while others don't.
@@ -1106,7 +1101,15 @@ UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
1106 "Optio S/S4", 1101 "Optio S/S4",
1107 US_SC_DEVICE, US_PR_DEVICE, NULL, 1102 US_SC_DEVICE, US_PR_DEVICE, NULL,
1108 US_FL_FIX_INQUIRY ), 1103 US_FL_FIX_INQUIRY ),
1109 1104
1105/* This is a virtual windows driver CD, which the zd1211rw driver automatically
1106 * converts into a WLAN device. */
1107UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
1108 "ZyXEL",
1109 "G-220F USB-WLAN Install",
1110 US_SC_DEVICE, US_PR_DEVICE, NULL,
1111 US_FL_IGNORE_DEVICE ),
1112
1110#ifdef CONFIG_USB_STORAGE_ISD200 1113#ifdef CONFIG_USB_STORAGE_ISD200
1111UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1114UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1112 "ATI", 1115 "ATI",
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 5ee19be52f65..8d7bdcb5924d 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -483,7 +483,7 @@ static struct us_unusual_dev *find_unusual(const struct usb_device_id *id)
483} 483}
484 484
485/* Get the unusual_devs entries and the string descriptors */ 485/* Get the unusual_devs entries and the string descriptors */
486static void get_device_info(struct us_data *us, const struct usb_device_id *id) 486static int get_device_info(struct us_data *us, const struct usb_device_id *id)
487{ 487{
488 struct usb_device *dev = us->pusb_dev; 488 struct usb_device *dev = us->pusb_dev;
489 struct usb_interface_descriptor *idesc = 489 struct usb_interface_descriptor *idesc =
@@ -500,6 +500,11 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
500 unusual_dev->useTransport; 500 unusual_dev->useTransport;
501 us->flags = USB_US_ORIG_FLAGS(id->driver_info); 501 us->flags = USB_US_ORIG_FLAGS(id->driver_info);
502 502
503 if (us->flags & US_FL_IGNORE_DEVICE) {
504 printk(KERN_INFO USB_STORAGE "device ignored\n");
505 return -ENODEV;
506 }
507
503 /* 508 /*
504 * This flag is only needed when we're in high-speed, so let's 509 * This flag is only needed when we're in high-speed, so let's
505 * disable it if we're in full-speed 510 * disable it if we're in full-speed
@@ -541,6 +546,8 @@ static void get_device_info(struct us_data *us, const struct usb_device_id *id)
541 msgs[msg], 546 msgs[msg],
542 UTS_RELEASE); 547 UTS_RELEASE);
543 } 548 }
549
550 return 0;
544} 551}
545 552
546/* Get the transport settings */ 553/* Get the transport settings */
@@ -969,7 +976,9 @@ static int storage_probe(struct usb_interface *intf,
969 * of the match from the usb_device_id table, so we can find the 976 * of the match from the usb_device_id table, so we can find the
970 * corresponding entry in the private table. 977 * corresponding entry in the private table.
971 */ 978 */
972 get_device_info(us, id); 979 result = get_device_info(us, id);
980 if (result)
981 goto BadDevice;
973 982
974 /* Get the transport, protocol, and pipe settings */ 983 /* Get the transport, protocol, and pipe settings */
975 result = get_transport(us); 984 result = get_transport(us);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 6533b0f39231..c40b9b8b1e7e 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -86,9 +86,11 @@ config FB_MACMODES
86 default n 86 default n
87 87
88config FB_BACKLIGHT 88config FB_BACKLIGHT
89 bool 89 bool
90 depends on FB 90 depends on FB
91 default n 91 select BACKLIGHT_LCD_SUPPORT
92 select BACKLIGHT_CLASS_DEVICE
93 default n
92 94
93config FB_MODE_HELPERS 95config FB_MODE_HELPERS
94 bool "Enable Video Mode Handling Helpers" 96 bool "Enable Video Mode Handling Helpers"
@@ -420,7 +422,7 @@ config FB_OF
420 422
421config FB_CONTROL 423config FB_CONTROL
422 bool "Apple \"control\" display support" 424 bool "Apple \"control\" display support"
423 depends on (FB = y) && PPC_PMAC 425 depends on (FB = y) && PPC_PMAC && PPC32
424 select FB_CFB_FILLRECT 426 select FB_CFB_FILLRECT
425 select FB_CFB_COPYAREA 427 select FB_CFB_COPYAREA
426 select FB_CFB_IMAGEBLIT 428 select FB_CFB_IMAGEBLIT
@@ -431,7 +433,7 @@ config FB_CONTROL
431 433
432config FB_PLATINUM 434config FB_PLATINUM
433 bool "Apple \"platinum\" display support" 435 bool "Apple \"platinum\" display support"
434 depends on (FB = y) && PPC_PMAC 436 depends on (FB = y) && PPC_PMAC && PPC32
435 select FB_CFB_FILLRECT 437 select FB_CFB_FILLRECT
436 select FB_CFB_COPYAREA 438 select FB_CFB_COPYAREA
437 select FB_CFB_IMAGEBLIT 439 select FB_CFB_IMAGEBLIT
@@ -442,7 +444,7 @@ config FB_PLATINUM
442 444
443config FB_VALKYRIE 445config FB_VALKYRIE
444 bool "Apple \"valkyrie\" display support" 446 bool "Apple \"valkyrie\" display support"
445 depends on (FB = y) && (MAC || PPC_PMAC) 447 depends on (FB = y) && (MAC || (PPC_PMAC && PPC32))
446 select FB_CFB_FILLRECT 448 select FB_CFB_FILLRECT
447 select FB_CFB_COPYAREA 449 select FB_CFB_COPYAREA
448 select FB_CFB_IMAGEBLIT 450 select FB_CFB_IMAGEBLIT
@@ -453,7 +455,7 @@ config FB_VALKYRIE
453 455
454config FB_CT65550 456config FB_CT65550
455 bool "Chips 65550 display support" 457 bool "Chips 65550 display support"
456 depends on (FB = y) && PPC 458 depends on (FB = y) && PPC32
457 select FB_CFB_FILLRECT 459 select FB_CFB_FILLRECT
458 select FB_CFB_COPYAREA 460 select FB_CFB_COPYAREA
459 select FB_CFB_IMAGEBLIT 461 select FB_CFB_IMAGEBLIT
@@ -721,10 +723,8 @@ config FB_NVIDIA_I2C
721 723
722config FB_NVIDIA_BACKLIGHT 724config FB_NVIDIA_BACKLIGHT
723 bool "Support for backlight control" 725 bool "Support for backlight control"
724 depends on FB_NVIDIA && PPC_PMAC 726 depends on FB_NVIDIA && PMAC_BACKLIGHT
725 select FB_BACKLIGHT 727 select FB_BACKLIGHT
726 select BACKLIGHT_LCD_SUPPORT
727 select BACKLIGHT_CLASS_DEVICE
728 default y 728 default y
729 help 729 help
730 Say Y here if you want to control the backlight of your display. 730 Say Y here if you want to control the backlight of your display.
@@ -769,10 +769,8 @@ config FB_RIVA_DEBUG
769 769
770config FB_RIVA_BACKLIGHT 770config FB_RIVA_BACKLIGHT
771 bool "Support for backlight control" 771 bool "Support for backlight control"
772 depends on FB_RIVA && PPC_PMAC 772 depends on FB_RIVA && PMAC_BACKLIGHT
773 select FB_BACKLIGHT 773 select FB_BACKLIGHT
774 select BACKLIGHT_LCD_SUPPORT
775 select BACKLIGHT_CLASS_DEVICE
776 default y 774 default y
777 help 775 help
778 Say Y here if you want to control the backlight of your display. 776 Say Y here if you want to control the backlight of your display.
@@ -1025,10 +1023,8 @@ config FB_RADEON_I2C
1025 1023
1026config FB_RADEON_BACKLIGHT 1024config FB_RADEON_BACKLIGHT
1027 bool "Support for backlight control" 1025 bool "Support for backlight control"
1028 depends on FB_RADEON && PPC_PMAC 1026 depends on FB_RADEON && PMAC_BACKLIGHT
1029 select FB_BACKLIGHT 1027 select FB_BACKLIGHT
1030 select BACKLIGHT_LCD_SUPPORT
1031 select BACKLIGHT_CLASS_DEVICE
1032 default y 1028 default y
1033 help 1029 help
1034 Say Y here if you want to control the backlight of your display. 1030 Say Y here if you want to control the backlight of your display.
@@ -1059,10 +1055,8 @@ config FB_ATY128
1059 1055
1060config FB_ATY128_BACKLIGHT 1056config FB_ATY128_BACKLIGHT
1061 bool "Support for backlight control" 1057 bool "Support for backlight control"
1062 depends on FB_ATY128 && PPC_PMAC 1058 depends on FB_ATY128 && PMAC_BACKLIGHT
1063 select FB_BACKLIGHT 1059 select FB_BACKLIGHT
1064 select BACKLIGHT_LCD_SUPPORT
1065 select BACKLIGHT_CLASS_DEVICE
1066 default y 1060 default y
1067 help 1061 help
1068 Say Y here if you want to control the backlight of your display. 1062 Say Y here if you want to control the backlight of your display.
@@ -1111,10 +1105,8 @@ config FB_ATY_GX
1111 1105
1112config FB_ATY_BACKLIGHT 1106config FB_ATY_BACKLIGHT
1113 bool "Support for backlight control" 1107 bool "Support for backlight control"
1114 depends on FB_ATY && PPC_PMAC 1108 depends on FB_ATY && PMAC_BACKLIGHT
1115 select FB_BACKLIGHT 1109 select FB_BACKLIGHT
1116 select BACKLIGHT_LCD_SUPPORT
1117 select BACKLIGHT_CLASS_DEVICE
1118 default y 1110 default y
1119 help 1111 help
1120 Say Y here if you want to control the backlight of your display. 1112 Say Y here if you want to control the backlight of your display.
@@ -1620,7 +1612,7 @@ if FB || SGI_NEWPORT_CONSOLE
1620 source "drivers/video/logo/Kconfig" 1612 source "drivers/video/logo/Kconfig"
1621endif 1613endif
1622 1614
1623if FB && SYSFS 1615if SYSFS
1624 source "drivers/video/backlight/Kconfig" 1616 source "drivers/video/backlight/Kconfig"
1625endif 1617endif
1626 1618
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 95563c9c6b9c..481c6c9695f8 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -4,6 +4,7 @@
4 4
5# Each configuration option enables a list of files. 5# Each configuration option enables a list of files.
6 6
7obj-y += fb_notify.o
7obj-$(CONFIG_FB) += fb.o 8obj-$(CONFIG_FB) += fb.o
8fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ 9fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
9 modedb.o fbcvt.o 10 modedb.o fbcvt.o
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index c64a717e2d4b..8b08121b390b 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -455,7 +455,10 @@ static void do_wait_for_fifo(u16 entries, struct aty128fb_par *par);
455static void wait_for_fifo(u16 entries, struct aty128fb_par *par); 455static void wait_for_fifo(u16 entries, struct aty128fb_par *par);
456static void wait_for_idle(struct aty128fb_par *par); 456static void wait_for_idle(struct aty128fb_par *par);
457static u32 depth_to_dst(u32 depth); 457static u32 depth_to_dst(u32 depth);
458
459#ifdef CONFIG_FB_ATY128_BACKLIGHT
458static void aty128_bl_set_power(struct fb_info *info, int power); 460static void aty128_bl_set_power(struct fb_info *info, int power);
461#endif
459 462
460#define BIOS_IN8(v) (readb(bios + (v))) 463#define BIOS_IN8(v) (readb(bios + (v)))
461#define BIOS_IN16(v) (readb(bios + (v)) | \ 464#define BIOS_IN16(v) (readb(bios + (v)) | \
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 1507d19f481f..053ff63365b7 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2812,7 +2812,7 @@ static int atyfb_blank(int blank, struct fb_info *info)
2812 if (par->lock_blank || par->asleep) 2812 if (par->lock_blank || par->asleep)
2813 return 0; 2813 return 0;
2814 2814
2815#ifdef CONFIG_PMAC_BACKLIGHT 2815#ifdef CONFIG_FB_ATY_BACKLIGHT
2816 if (machine_is(powermac) && blank > FB_BLANK_NORMAL) 2816 if (machine_is(powermac) && blank > FB_BLANK_NORMAL)
2817 aty_bl_set_power(info, FB_BLANK_POWERDOWN); 2817 aty_bl_set_power(info, FB_BLANK_POWERDOWN);
2818#elif defined(CONFIG_FB_ATY_GENERIC_LCD) 2818#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
@@ -2844,7 +2844,7 @@ static int atyfb_blank(int blank, struct fb_info *info)
2844 } 2844 }
2845 aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par); 2845 aty_st_le32(CRTC_GEN_CNTL, gen_cntl, par);
2846 2846
2847#ifdef CONFIG_PMAC_BACKLIGHT 2847#ifdef CONFIG_FB_ATY_BACKLIGHT
2848 if (machine_is(powermac) && blank <= FB_BLANK_NORMAL) 2848 if (machine_is(powermac) && blank <= FB_BLANK_NORMAL)
2849 aty_bl_set_power(info, FB_BLANK_UNBLANK); 2849 aty_bl_set_power(info, FB_BLANK_UNBLANK);
2850#elif defined(CONFIG_FB_ATY_GENERIC_LCD) 2850#elif defined(CONFIG_FB_ATY_GENERIC_LCD)
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c
index 8d85fc58142e..8e3400d5dd21 100644
--- a/drivers/video/aty/radeon_base.c
+++ b/drivers/video/aty/radeon_base.c
@@ -266,6 +266,8 @@ static int force_measure_pll = 0;
266#ifdef CONFIG_MTRR 266#ifdef CONFIG_MTRR
267static int nomtrr = 0; 267static int nomtrr = 0;
268#endif 268#endif
269static int force_sleep;
270static int ignore_devlist;
269 271
270/* 272/*
271 * prototypes 273 * prototypes
@@ -2327,9 +2329,9 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
2327 /* -2 is special: means ON on mobility chips and do not 2329 /* -2 is special: means ON on mobility chips and do not
2328 * change on others 2330 * change on others
2329 */ 2331 */
2330 radeonfb_pm_init(rinfo, rinfo->is_mobility ? 1 : -1); 2332 radeonfb_pm_init(rinfo, rinfo->is_mobility ? 1 : -1, ignore_devlist, force_sleep);
2331 } else 2333 } else
2332 radeonfb_pm_init(rinfo, default_dynclk); 2334 radeonfb_pm_init(rinfo, default_dynclk, ignore_devlist, force_sleep);
2333 2335
2334 pci_set_drvdata(pdev, info); 2336 pci_set_drvdata(pdev, info);
2335 2337
@@ -2477,6 +2479,12 @@ static int __init radeonfb_setup (char *options)
2477 force_measure_pll = 1; 2479 force_measure_pll = 1;
2478 } else if (!strncmp(this_opt, "ignore_edid", 11)) { 2480 } else if (!strncmp(this_opt, "ignore_edid", 11)) {
2479 ignore_edid = 1; 2481 ignore_edid = 1;
2482#if defined(CONFIG_PM) && defined(CONFIG_X86)
2483 } else if (!strncmp(this_opt, "force_sleep", 11)) {
2484 force_sleep = 1;
2485 } else if (!strncmp(this_opt, "ignore_devlist", 14)) {
2486 ignore_devlist = 1;
2487#endif
2480 } else 2488 } else
2481 mode_option = this_opt; 2489 mode_option = this_opt;
2482 } 2490 }
@@ -2532,3 +2540,9 @@ module_param(panel_yres, int, 0);
2532MODULE_PARM_DESC(panel_yres, "int: set panel yres"); 2540MODULE_PARM_DESC(panel_yres, "int: set panel yres");
2533module_param(mode_option, charp, 0); 2541module_param(mode_option, charp, 0);
2534MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" "); 2542MODULE_PARM_DESC(mode_option, "Specify resolution as \"<xres>x<yres>[-<bpp>][@<refresh>]\" ");
2543#if defined(CONFIG_PM) && defined(CONFIG_X86)
2544module_param(force_sleep, bool, 0);
2545MODULE_PARM_DESC(force_sleep, "bool: force D2 sleep mode on all hardware");
2546module_param(ignore_devlist, bool, 0);
2547MODULE_PARM_DESC(ignore_devlist, "bool: ignore workarounds for bugs in specific laptops");
2548#endif
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index c7091761cef4..f31e606a2ded 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -27,6 +27,99 @@
27 27
28#include "ati_ids.h" 28#include "ati_ids.h"
29 29
30static void radeon_reinitialize_M10(struct radeonfb_info *rinfo);
31
32/*
33 * Workarounds for bugs in PC laptops:
34 * - enable D2 sleep in some IBM Thinkpads
35 * - special case for Samsung P35
36 *
37 * Whitelist by subsystem vendor/device because
38 * its the subsystem vendor's fault!
39 */
40
41#if defined(CONFIG_PM) && defined(CONFIG_X86)
42struct radeon_device_id {
43 const char *ident; /* (arbitrary) Name */
44 const unsigned short subsystem_vendor; /* Subsystem Vendor ID */
45 const unsigned short subsystem_device; /* Subsystem Device ID */
46 const enum radeon_pm_mode pm_mode_modifier; /* modify pm_mode */
47 const reinit_function_ptr new_reinit_func; /* changed reinit_func */
48};
49
50#define BUGFIX(model, sv, sd, pm, fn) { \
51 .ident = model, \
52 .subsystem_vendor = sv, \
53 .subsystem_device = sd, \
54 .pm_mode_modifier = pm, \
55 .new_reinit_func = fn \
56}
57
58static struct radeon_device_id radeon_workaround_list[] = {
59 BUGFIX("IBM Thinkpad R32",
60 PCI_VENDOR_ID_IBM, 0x1905,
61 radeon_pm_d2, NULL),
62 BUGFIX("IBM Thinkpad R40",
63 PCI_VENDOR_ID_IBM, 0x0526,
64 radeon_pm_d2, NULL),
65 BUGFIX("IBM Thinkpad R40",
66 PCI_VENDOR_ID_IBM, 0x0527,
67 radeon_pm_d2, NULL),
68 BUGFIX("IBM Thinkpad R50/R51/T40/T41",
69 PCI_VENDOR_ID_IBM, 0x0531,
70 radeon_pm_d2, NULL),
71 BUGFIX("IBM Thinkpad R51/T40/T41/T42",
72 PCI_VENDOR_ID_IBM, 0x0530,
73 radeon_pm_d2, NULL),
74 BUGFIX("IBM Thinkpad T30",
75 PCI_VENDOR_ID_IBM, 0x0517,
76 radeon_pm_d2, NULL),
77 BUGFIX("IBM Thinkpad T40p",
78 PCI_VENDOR_ID_IBM, 0x054d,
79 radeon_pm_d2, NULL),
80 BUGFIX("IBM Thinkpad T42",
81 PCI_VENDOR_ID_IBM, 0x0550,
82 radeon_pm_d2, NULL),
83 BUGFIX("IBM Thinkpad X31/X32",
84 PCI_VENDOR_ID_IBM, 0x052f,
85 radeon_pm_d2, NULL),
86 BUGFIX("Samsung P35",
87 PCI_VENDOR_ID_SAMSUNG, 0xc00c,
88 radeon_pm_off, radeon_reinitialize_M10),
89 { .ident = NULL }
90};
91
92static int radeon_apply_workarounds(struct radeonfb_info *rinfo)
93{
94 struct radeon_device_id *id;
95
96 for (id = radeon_workaround_list; id->ident != NULL; id++ )
97 if ((id->subsystem_vendor == rinfo->pdev->subsystem_vendor ) &&
98 (id->subsystem_device == rinfo->pdev->subsystem_device )) {
99
100 /* we found a device that requires workaround */
101 printk(KERN_DEBUG "radeonfb: %s detected"
102 ", enabling workaround\n", id->ident);
103
104 rinfo->pm_mode |= id->pm_mode_modifier;
105
106 if (id->new_reinit_func != NULL)
107 rinfo->reinit_func = id->new_reinit_func;
108
109 return 1;
110 }
111 return 0; /* not found */
112}
113
114#else /* defined(CONFIG_PM) && defined(CONFIG_X86) */
115static inline int radeon_apply_workarounds(struct radeonfb_info *rinfo)
116{
117 return 0;
118}
119#endif /* defined(CONFIG_PM) && defined(CONFIG_X86) */
120
121
122
30static void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo) 123static void radeon_pm_disable_dynamic_mode(struct radeonfb_info *rinfo)
31{ 124{
32 u32 tmp; 125 u32 tmp;
@@ -852,18 +945,26 @@ static void radeon_pm_setup_for_suspend(struct radeonfb_info *rinfo)
852 /* because both INPLL and OUTPLL take the same lock, that's why. */ 945 /* because both INPLL and OUTPLL take the same lock, that's why. */
853 tmp = INPLL( pllMCLK_MISC) | MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND; 946 tmp = INPLL( pllMCLK_MISC) | MCLK_MISC__EN_MCLK_TRISTATE_IN_SUSPEND;
854 OUTPLL( pllMCLK_MISC, tmp); 947 OUTPLL( pllMCLK_MISC, tmp);
855
856 /* AGP PLL control */
857 if (rinfo->family <= CHIP_FAMILY_RV280) {
858 OUTREG(BUS_CNTL1, INREG(BUS_CNTL1) | BUS_CNTL1__AGPCLK_VALID);
859 948
860 OUTREG(BUS_CNTL1, 949 /* BUS_CNTL1__MOBILE_PLATORM_SEL setting is northbridge chipset
861 (INREG(BUS_CNTL1) & ~BUS_CNTL1__MOBILE_PLATFORM_SEL_MASK) 950 * and radeon chip dependent. Thus we only enable it on Mac for
862 | (2<<BUS_CNTL1__MOBILE_PLATFORM_SEL__SHIFT)); // 440BX 951 * now (until we get more info on how to compute the correct
863 } else { 952 * value for various X86 bridges).
864 OUTREG(BUS_CNTL1, INREG(BUS_CNTL1)); 953 */
865 OUTREG(BUS_CNTL1, (INREG(BUS_CNTL1) & ~0x4000) | 0x8000); 954#ifdef CONFIG_PPC_PMAC
955 if (machine_is(powermac)) {
956 /* AGP PLL control */
957 if (rinfo->family <= CHIP_FAMILY_RV280) {
958 OUTREG(BUS_CNTL1, INREG(BUS_CNTL1) | BUS_CNTL1__AGPCLK_VALID);
959 OUTREG(BUS_CNTL1,
960 (INREG(BUS_CNTL1) & ~BUS_CNTL1__MOBILE_PLATFORM_SEL_MASK)
961 | (2<<BUS_CNTL1__MOBILE_PLATFORM_SEL__SHIFT)); // 440BX
962 } else {
963 OUTREG(BUS_CNTL1, INREG(BUS_CNTL1));
964 OUTREG(BUS_CNTL1, (INREG(BUS_CNTL1) & ~0x4000) | 0x8000);
965 }
866 } 966 }
967#endif
867 968
868 OUTREG(CRTC_OFFSET_CNTL, (INREG(CRTC_OFFSET_CNTL) 969 OUTREG(CRTC_OFFSET_CNTL, (INREG(CRTC_OFFSET_CNTL)
869 & ~CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN)); 970 & ~CRTC_OFFSET_CNTL__CRTC_STEREO_SYNC_OUT_EN));
@@ -2713,7 +2814,7 @@ static void radeonfb_early_resume(void *data)
2713 2814
2714#endif /* CONFIG_PM */ 2815#endif /* CONFIG_PM */
2715 2816
2716void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) 2817void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep)
2717{ 2818{
2718 /* Find PM registers in config space if any*/ 2819 /* Find PM registers in config space if any*/
2719 rinfo->pm_reg = pci_find_capability(rinfo->pdev, PCI_CAP_ID_PM); 2820 rinfo->pm_reg = pci_find_capability(rinfo->pdev, PCI_CAP_ID_PM);
@@ -2729,22 +2830,13 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk)
2729 } 2830 }
2730 2831
2731#if defined(CONFIG_PM) 2832#if defined(CONFIG_PM)
2833#if defined(CONFIG_PPC_PMAC)
2732 /* Check if we can power manage on suspend/resume. We can do 2834 /* Check if we can power manage on suspend/resume. We can do
2733 * D2 on M6, M7 and M9, and we can resume from D3 cold a few other 2835 * D2 on M6, M7 and M9, and we can resume from D3 cold a few other
2734 * "Mac" cards, but that's all. We need more infos about what the 2836 * "Mac" cards, but that's all. We need more infos about what the
2735 * BIOS does tho. Right now, all this PM stuff is pmac-only for that 2837 * BIOS does tho. Right now, all this PM stuff is pmac-only for that
2736 * reason. --BenH 2838 * reason. --BenH
2737 */ 2839 */
2738 /* Special case for Samsung P35 laptops
2739 */
2740 if ((rinfo->pdev->vendor == PCI_VENDOR_ID_ATI) &&
2741 (rinfo->pdev->device == PCI_CHIP_RV350_NP) &&
2742 (rinfo->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG) &&
2743 (rinfo->pdev->subsystem_device == 0xc00c)) {
2744 rinfo->reinit_func = radeon_reinitialize_M10;
2745 rinfo->pm_mode |= radeon_pm_off;
2746 }
2747#if defined(CONFIG_PPC_PMAC)
2748 if (machine_is(powermac) && rinfo->of_node) { 2840 if (machine_is(powermac) && rinfo->of_node) {
2749 if (rinfo->is_mobility && rinfo->pm_reg && 2841 if (rinfo->is_mobility && rinfo->pm_reg &&
2750 rinfo->family <= CHIP_FAMILY_RV250) 2842 rinfo->family <= CHIP_FAMILY_RV250)
@@ -2790,6 +2882,18 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk)
2790 } 2882 }
2791#endif /* defined(CONFIG_PPC_PMAC) */ 2883#endif /* defined(CONFIG_PPC_PMAC) */
2792#endif /* defined(CONFIG_PM) */ 2884#endif /* defined(CONFIG_PM) */
2885
2886 if (ignore_devlist)
2887 printk(KERN_DEBUG
2888 "radeonfb: skipping test for device workarounds\n");
2889 else
2890 radeon_apply_workarounds(rinfo);
2891
2892 if (force_sleep) {
2893 printk(KERN_DEBUG
2894 "radeonfb: forcefully enabling D2 sleep mode\n");
2895 rinfo->pm_mode |= radeon_pm_d2;
2896 }
2793} 2897}
2794 2898
2795void radeonfb_pm_exit(struct radeonfb_info *rinfo) 2899void radeonfb_pm_exit(struct radeonfb_info *rinfo)
diff --git a/drivers/video/aty/radeonfb.h b/drivers/video/aty/radeonfb.h
index 38657b2d10eb..d5ff224a6258 100644
--- a/drivers/video/aty/radeonfb.h
+++ b/drivers/video/aty/radeonfb.h
@@ -273,6 +273,8 @@ enum radeon_pm_mode {
273 radeon_pm_off = 0x00000002, /* Can resume from D3 cold */ 273 radeon_pm_off = 0x00000002, /* Can resume from D3 cold */
274}; 274};
275 275
276typedef void (*reinit_function_ptr)(struct radeonfb_info *rinfo);
277
276struct radeonfb_info { 278struct radeonfb_info {
277 struct fb_info *info; 279 struct fb_info *info;
278 280
@@ -338,7 +340,7 @@ struct radeonfb_info {
338 int dynclk; 340 int dynclk;
339 int no_schedule; 341 int no_schedule;
340 enum radeon_pm_mode pm_mode; 342 enum radeon_pm_mode pm_mode;
341 void (*reinit_func)(struct radeonfb_info *rinfo); 343 reinit_function_ptr reinit_func;
342 344
343 /* Lock on register access */ 345 /* Lock on register access */
344 spinlock_t reg_lock; 346 spinlock_t reg_lock;
@@ -600,7 +602,7 @@ extern int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8
600/* PM Functions */ 602/* PM Functions */
601extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state); 603extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state);
602extern int radeonfb_pci_resume(struct pci_dev *pdev); 604extern int radeonfb_pci_resume(struct pci_dev *pdev);
603extern void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk); 605extern void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk, int ignore_devlist, int force_sleep);
604extern void radeonfb_pm_exit(struct radeonfb_info *rinfo); 606extern void radeonfb_pm_exit(struct radeonfb_info *rinfo);
605 607
606/* Monitor probe functions */ 608/* Monitor probe functions */
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 022f9d3473f5..02f15297a021 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -10,7 +10,7 @@ menuconfig BACKLIGHT_LCD_SUPPORT
10 10
11config BACKLIGHT_CLASS_DEVICE 11config BACKLIGHT_CLASS_DEVICE
12 tristate "Lowlevel Backlight controls" 12 tristate "Lowlevel Backlight controls"
13 depends on BACKLIGHT_LCD_SUPPORT && FB 13 depends on BACKLIGHT_LCD_SUPPORT
14 default m 14 default m
15 help 15 help
16 This framework adds support for low-level control of the LCD 16 This framework adds support for low-level control of the LCD
@@ -26,7 +26,7 @@ config BACKLIGHT_DEVICE
26 26
27config LCD_CLASS_DEVICE 27config LCD_CLASS_DEVICE
28 tristate "Lowlevel LCD controls" 28 tristate "Lowlevel LCD controls"
29 depends on BACKLIGHT_LCD_SUPPORT && FB 29 depends on BACKLIGHT_LCD_SUPPORT
30 default m 30 default m
31 help 31 help
32 This framework adds support for low-level control of LCD. 32 This framework adds support for low-level control of LCD.
diff --git a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
index 52ed12b12acc..eb4d03fa5391 100644
--- a/drivers/video/console/mdacon.c
+++ b/drivers/video/console/mdacon.c
@@ -197,7 +197,7 @@ static int __init mdacon_setup(char *str)
197__setup("mdacon=", mdacon_setup); 197__setup("mdacon=", mdacon_setup);
198#endif 198#endif
199 199
200static int __init mda_detect(void) 200static int mda_detect(void)
201{ 201{
202 int count=0; 202 int count=0;
203 u16 *p, p_save; 203 u16 *p, p_save;
@@ -282,7 +282,7 @@ static int __init mda_detect(void)
282 return 1; 282 return 1;
283} 283}
284 284
285static void __init mda_initialize(void) 285static void mda_initialize(void)
286{ 286{
287 write_mda_b(97, 0x00); /* horizontal total */ 287 write_mda_b(97, 0x00); /* horizontal total */
288 write_mda_b(80, 0x01); /* horizontal displayed */ 288 write_mda_b(80, 0x01); /* horizontal displayed */
diff --git a/drivers/video/fb_notify.c b/drivers/video/fb_notify.c
new file mode 100644
index 000000000000..8c020389e4fa
--- /dev/null
+++ b/drivers/video/fb_notify.c
@@ -0,0 +1,46 @@
1/*
2 * linux/drivers/video/fb_notify.c
3 *
4 * Copyright (C) 2006 Antonino Daplas <adaplas@pol.net>
5 *
6 * 2001 - Documented with DocBook
7 * - Brad Douglas <brad@neruo.com>
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file COPYING in the main directory of this archive
11 * for more details.
12 */
13#include <linux/fb.h>
14#include <linux/notifier.h>
15
16static BLOCKING_NOTIFIER_HEAD(fb_notifier_list);
17
18/**
19 * fb_register_client - register a client notifier
20 * @nb: notifier block to callback on events
21 */
22int fb_register_client(struct notifier_block *nb)
23{
24 return blocking_notifier_chain_register(&fb_notifier_list, nb);
25}
26EXPORT_SYMBOL(fb_register_client);
27
28/**
29 * fb_unregister_client - unregister a client notifier
30 * @nb: notifier block to callback on events
31 */
32int fb_unregister_client(struct notifier_block *nb)
33{
34 return blocking_notifier_chain_unregister(&fb_notifier_list, nb);
35}
36EXPORT_SYMBOL(fb_unregister_client);
37
38/**
39 * fb_notifier_call_chain - notify clients of fb_events
40 *
41 */
42int fb_notifier_call_chain(unsigned long val, void *v)
43{
44 return blocking_notifier_call_chain(&fb_notifier_list, val, v);
45}
46EXPORT_SYMBOL_GPL(fb_notifier_call_chain);
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 4fc9df426c1a..17961e3ecaa0 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -52,7 +52,6 @@
52 52
53#define FBPIXMAPSIZE (1024 * 8) 53#define FBPIXMAPSIZE (1024 * 8)
54 54
55static BLOCKING_NOTIFIER_HEAD(fb_notifier_list);
56struct fb_info *registered_fb[FB_MAX]; 55struct fb_info *registered_fb[FB_MAX];
57int num_registered_fb; 56int num_registered_fb;
58 57
@@ -791,8 +790,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
791 790
792 event.info = info; 791 event.info = info;
793 event.data = &mode1; 792 event.data = &mode1;
794 ret = blocking_notifier_call_chain(&fb_notifier_list, 793 ret = fb_notifier_call_chain(FB_EVENT_MODE_DELETE, &event);
795 FB_EVENT_MODE_DELETE, &event);
796 } 794 }
797 795
798 if (!ret) 796 if (!ret)
@@ -837,8 +835,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
837 835
838 info->flags &= ~FBINFO_MISC_USEREVENT; 836 info->flags &= ~FBINFO_MISC_USEREVENT;
839 event.info = info; 837 event.info = info;
840 blocking_notifier_call_chain(&fb_notifier_list, 838 fb_notifier_call_chain(evnt, &event);
841 evnt, &event);
842 } 839 }
843 } 840 }
844 } 841 }
@@ -861,8 +858,7 @@ fb_blank(struct fb_info *info, int blank)
861 858
862 event.info = info; 859 event.info = info;
863 event.data = &blank; 860 event.data = &blank;
864 blocking_notifier_call_chain(&fb_notifier_list, 861 fb_notifier_call_chain(FB_EVENT_BLANK, &event);
865 FB_EVENT_BLANK, &event);
866 } 862 }
867 863
868 return ret; 864 return ret;
@@ -933,8 +929,7 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
933 con2fb.framebuffer = -1; 929 con2fb.framebuffer = -1;
934 event.info = info; 930 event.info = info;
935 event.data = &con2fb; 931 event.data = &con2fb;
936 blocking_notifier_call_chain(&fb_notifier_list, 932 fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
937 FB_EVENT_GET_CONSOLE_MAP, &event);
938 return copy_to_user(argp, &con2fb, 933 return copy_to_user(argp, &con2fb,
939 sizeof(con2fb)) ? -EFAULT : 0; 934 sizeof(con2fb)) ? -EFAULT : 0;
940 case FBIOPUT_CON2FBMAP: 935 case FBIOPUT_CON2FBMAP:
@@ -952,9 +947,8 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
952 return -EINVAL; 947 return -EINVAL;
953 event.info = info; 948 event.info = info;
954 event.data = &con2fb; 949 event.data = &con2fb;
955 return blocking_notifier_call_chain(&fb_notifier_list, 950 return fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP,
956 FB_EVENT_SET_CONSOLE_MAP, 951 &event);
957 &event);
958 case FBIOBLANK: 952 case FBIOBLANK:
959 acquire_console_sem(); 953 acquire_console_sem();
960 info->flags |= FBINFO_MISC_USEREVENT; 954 info->flags |= FBINFO_MISC_USEREVENT;
@@ -1330,8 +1324,7 @@ register_framebuffer(struct fb_info *fb_info)
1330 registered_fb[i] = fb_info; 1324 registered_fb[i] = fb_info;
1331 1325
1332 event.info = fb_info; 1326 event.info = fb_info;
1333 blocking_notifier_call_chain(&fb_notifier_list, 1327 fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
1334 FB_EVENT_FB_REGISTERED, &event);
1335 return 0; 1328 return 0;
1336} 1329}
1337 1330
@@ -1365,30 +1358,11 @@ unregister_framebuffer(struct fb_info *fb_info)
1365 fb_cleanup_class_device(fb_info); 1358 fb_cleanup_class_device(fb_info);
1366 class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); 1359 class_device_destroy(fb_class, MKDEV(FB_MAJOR, i));
1367 event.info = fb_info; 1360 event.info = fb_info;
1368 blocking_notifier_call_chain(&fb_notifier_list, 1361 fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
1369 FB_EVENT_FB_UNREGISTERED, &event);
1370 return 0; 1362 return 0;
1371} 1363}
1372 1364
1373/** 1365/**
1374 * fb_register_client - register a client notifier
1375 * @nb: notifier block to callback on events
1376 */
1377int fb_register_client(struct notifier_block *nb)
1378{
1379 return blocking_notifier_chain_register(&fb_notifier_list, nb);
1380}
1381
1382/**
1383 * fb_unregister_client - unregister a client notifier
1384 * @nb: notifier block to callback on events
1385 */
1386int fb_unregister_client(struct notifier_block *nb)
1387{
1388 return blocking_notifier_chain_unregister(&fb_notifier_list, nb);
1389}
1390
1391/**
1392 * fb_set_suspend - low level driver signals suspend 1366 * fb_set_suspend - low level driver signals suspend
1393 * @info: framebuffer affected 1367 * @info: framebuffer affected
1394 * @state: 0 = resuming, !=0 = suspending 1368 * @state: 0 = resuming, !=0 = suspending
@@ -1403,13 +1377,11 @@ void fb_set_suspend(struct fb_info *info, int state)
1403 1377
1404 event.info = info; 1378 event.info = info;
1405 if (state) { 1379 if (state) {
1406 blocking_notifier_call_chain(&fb_notifier_list, 1380 fb_notifier_call_chain(FB_EVENT_SUSPEND, &event);
1407 FB_EVENT_SUSPEND, &event);
1408 info->state = FBINFO_STATE_SUSPENDED; 1381 info->state = FBINFO_STATE_SUSPENDED;
1409 } else { 1382 } else {
1410 info->state = FBINFO_STATE_RUNNING; 1383 info->state = FBINFO_STATE_RUNNING;
1411 blocking_notifier_call_chain(&fb_notifier_list, 1384 fb_notifier_call_chain(FB_EVENT_RESUME, &event);
1412 FB_EVENT_RESUME, &event);
1413 } 1385 }
1414} 1386}
1415 1387
@@ -1480,9 +1452,7 @@ int fb_new_modelist(struct fb_info *info)
1480 1452
1481 if (!list_empty(&info->modelist)) { 1453 if (!list_empty(&info->modelist)) {
1482 event.info = info; 1454 event.info = info;
1483 err = blocking_notifier_call_chain(&fb_notifier_list, 1455 err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
1484 FB_EVENT_NEW_MODELIST,
1485 &event);
1486 } 1456 }
1487 1457
1488 return err; 1458 return err;
@@ -1594,8 +1564,6 @@ EXPORT_SYMBOL(fb_blank);
1594EXPORT_SYMBOL(fb_pan_display); 1564EXPORT_SYMBOL(fb_pan_display);
1595EXPORT_SYMBOL(fb_get_buffer_offset); 1565EXPORT_SYMBOL(fb_get_buffer_offset);
1596EXPORT_SYMBOL(fb_set_suspend); 1566EXPORT_SYMBOL(fb_set_suspend);
1597EXPORT_SYMBOL(fb_register_client);
1598EXPORT_SYMBOL(fb_unregister_client);
1599EXPORT_SYMBOL(fb_get_options); 1567EXPORT_SYMBOL(fb_get_options);
1600 1568
1601MODULE_LICENSE("GPL"); 1569MODULE_LICENSE("GPL");
diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index 9f2066f0745a..d4f850117874 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -34,10 +34,6 @@
34#include "nv_proto.h" 34#include "nv_proto.h"
35#include "nv_dma.h" 35#include "nv_dma.h"
36 36
37#ifndef CONFIG_PCI /* sanity check */
38#error This driver requires PCI support.
39#endif
40
41#undef CONFIG_FB_NVIDIA_DEBUG 37#undef CONFIG_FB_NVIDIA_DEBUG
42#ifdef CONFIG_FB_NVIDIA_DEBUG 38#ifdef CONFIG_FB_NVIDIA_DEBUG
43#define NVTRACE printk 39#define NVTRACE printk
@@ -1303,20 +1299,19 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,
1303 1299
1304 nvidia_save_vga(par, &par->SavedReg); 1300 nvidia_save_vga(par, &par->SavedReg);
1305 1301
1302 pci_set_drvdata(pd, info);
1303 nvidia_bl_init(par);
1306 if (register_framebuffer(info) < 0) { 1304 if (register_framebuffer(info) < 0) {
1307 printk(KERN_ERR PFX "error registering nVidia framebuffer\n"); 1305 printk(KERN_ERR PFX "error registering nVidia framebuffer\n");
1308 goto err_out_iounmap_fb; 1306 goto err_out_iounmap_fb;
1309 } 1307 }
1310 1308
1311 pci_set_drvdata(pd, info);
1312 1309
1313 printk(KERN_INFO PFX 1310 printk(KERN_INFO PFX
1314 "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n", 1311 "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n",
1315 info->fix.id, 1312 info->fix.id,
1316 par->FbMapSize / (1024 * 1024), info->fix.smem_start); 1313 par->FbMapSize / (1024 * 1024), info->fix.smem_start);
1317 1314
1318 nvidia_bl_init(par);
1319
1320 NVTRACE_LEAVE(); 1315 NVTRACE_LEAVE();
1321 return 0; 1316 return 0;
1322 1317
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index ce5f3031b99b..0013311e0564 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -62,8 +62,6 @@ struct offb_par default_par;
62 * Interface used by the world 62 * Interface used by the world
63 */ 63 */
64 64
65int offb_init(void);
66
67static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 65static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
68 u_int transp, struct fb_info *info); 66 u_int transp, struct fb_info *info);
69static int offb_blank(int blank, struct fb_info *info); 67static int offb_blank(int blank, struct fb_info *info);
@@ -72,11 +70,6 @@ static int offb_blank(int blank, struct fb_info *info);
72extern boot_infos_t *boot_infos; 70extern boot_infos_t *boot_infos;
73#endif 71#endif
74 72
75static void offb_init_nodriver(struct device_node *);
76static void offb_init_fb(const char *name, const char *full_name,
77 int width, int height, int depth, int pitch,
78 unsigned long address, struct device_node *dp);
79
80static struct fb_ops offb_ops = { 73static struct fb_ops offb_ops = {
81 .owner = THIS_MODULE, 74 .owner = THIS_MODULE,
82 .fb_setcolreg = offb_setcolreg, 75 .fb_setcolreg = offb_setcolreg,
@@ -229,123 +222,17 @@ static int offb_blank(int blank, struct fb_info *info)
229 return 0; 222 return 0;
230} 223}
231 224
232 /*
233 * Initialisation
234 */
235 225
236int __init offb_init(void) 226static void __iomem *offb_map_reg(struct device_node *np, int index,
227 unsigned long offset, unsigned long size)
237{ 228{
238 struct device_node *dp = NULL, *boot_disp = NULL; 229 struct resource r;
239
240 if (fb_get_options("offb", NULL))
241 return -ENODEV;
242 230
243 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) { 231 if (of_address_to_resource(np, index, &r))
244 if (get_property(dp, "linux,opened", NULL) && 232 return 0;
245 get_property(dp, "linux,boot-display", NULL)) { 233 if ((r.start + offset + size) > r.end)
246 boot_disp = dp; 234 return 0;
247 offb_init_nodriver(dp); 235 return ioremap(r.start + offset, size);
248 }
249 }
250 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) {
251 if (get_property(dp, "linux,opened", NULL) &&
252 dp != boot_disp)
253 offb_init_nodriver(dp);
254 }
255
256 return 0;
257}
258
259
260static void __init offb_init_nodriver(struct device_node *dp)
261{
262 unsigned int len;
263 int i, width = 640, height = 480, depth = 8, pitch = 640;
264 unsigned int flags, rsize, addr_prop = 0;
265 unsigned long max_size = 0;
266 u64 rstart, address = OF_BAD_ADDR;
267 u32 *pp, *addrp, *up;
268 u64 asize;
269
270 pp = (u32 *)get_property(dp, "linux,bootx-depth", &len);
271 if (pp == NULL)
272 pp = (u32 *)get_property(dp, "depth", &len);
273 if (pp && len == sizeof(u32))
274 depth = *pp;
275
276 pp = (u32 *)get_property(dp, "linux,bootx-width", &len);
277 if (pp == NULL)
278 pp = (u32 *)get_property(dp, "width", &len);
279 if (pp && len == sizeof(u32))
280 width = *pp;
281
282 pp = (u32 *)get_property(dp, "linux,bootx-height", &len);
283 if (pp == NULL)
284 pp = (u32 *)get_property(dp, "height", &len);
285 if (pp && len == sizeof(u32))
286 height = *pp;
287
288 pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len);
289 if (pp == NULL)
290 pp = (u32 *)get_property(dp, "linebytes", &len);
291 if (pp && len == sizeof(u32))
292 pitch = *pp;
293 else
294 pitch = width * ((depth + 7) / 8);
295
296 rsize = (unsigned long)pitch * (unsigned long)height;
297
298 /* Ok, now we try to figure out the address of the framebuffer.
299 *
300 * Unfortunately, Open Firmware doesn't provide a standard way to do
301 * so. All we can do is a dodgy heuristic that happens to work in
302 * practice. On most machines, the "address" property contains what
303 * we need, though not on Matrox cards found in IBM machines. What I've
304 * found that appears to give good results is to go through the PCI
305 * ranges and pick one that is both big enough and if possible encloses
306 * the "address" property. If none match, we pick the biggest
307 */
308 up = (u32 *)get_property(dp, "linux,bootx-addr", &len);
309 if (up == NULL)
310 up = (u32 *)get_property(dp, "address", &len);
311 if (up && len == sizeof(u32))
312 addr_prop = *up;
313
314 for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags))
315 != NULL; i++) {
316 int match_addrp = 0;
317
318 if (!(flags & IORESOURCE_MEM))
319 continue;
320 if (asize < rsize)
321 continue;
322 rstart = of_translate_address(dp, addrp);
323 if (rstart == OF_BAD_ADDR)
324 continue;
325 if (addr_prop && (rstart <= addr_prop) &&
326 ((rstart + asize) >= (addr_prop + rsize)))
327 match_addrp = 1;
328 if (match_addrp) {
329 address = addr_prop;
330 break;
331 }
332 if (rsize > max_size) {
333 max_size = rsize;
334 address = OF_BAD_ADDR;
335 }
336
337 if (address == OF_BAD_ADDR)
338 address = rstart;
339 }
340 if (address == OF_BAD_ADDR && addr_prop)
341 address = (u64)addr_prop;
342 if (address != OF_BAD_ADDR) {
343 /* kludge for valkyrie */
344 if (strcmp(dp->name, "valkyrie") == 0)
345 address += 0x1000;
346 offb_init_fb(dp->name, dp->full_name, width, height, depth,
347 pitch, address, dp);
348 }
349} 236}
350 237
351static void __init offb_init_fb(const char *name, const char *full_name, 238static void __init offb_init_fb(const char *name, const char *full_name,
@@ -402,45 +289,39 @@ static void __init offb_init_fb(const char *name, const char *full_name,
402 289
403 par->cmap_type = cmap_unknown; 290 par->cmap_type = cmap_unknown;
404 if (depth == 8) { 291 if (depth == 8) {
405
406 /* Palette hacks disabled for now */ 292 /* Palette hacks disabled for now */
407#if 0
408 if (dp && !strncmp(name, "ATY,Rage128", 11)) { 293 if (dp && !strncmp(name, "ATY,Rage128", 11)) {
409 unsigned long regbase = dp->addrs[2].address; 294 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff);
410 par->cmap_adr = ioremap(regbase, 0x1FFF); 295 if (par->cmap_adr)
411 par->cmap_type = cmap_r128; 296 par->cmap_type = cmap_r128;
412 } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12) 297 } else if (dp && (!strncmp(name, "ATY,RageM3pA", 12)
413 || !strncmp(name, "ATY,RageM3p12A", 14))) { 298 || !strncmp(name, "ATY,RageM3p12A", 14))) {
414 unsigned long regbase = 299 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff);
415 dp->parent->addrs[2].address; 300 if (par->cmap_adr)
416 par->cmap_adr = ioremap(regbase, 0x1FFF); 301 par->cmap_type = cmap_M3A;
417 par->cmap_type = cmap_M3A;
418 } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) { 302 } else if (dp && !strncmp(name, "ATY,RageM3pB", 12)) {
419 unsigned long regbase = 303 par->cmap_adr = offb_map_reg(dp, 2, 0, 0x1fff);
420 dp->parent->addrs[2].address; 304 if (par->cmap_adr)
421 par->cmap_adr = ioremap(regbase, 0x1FFF); 305 par->cmap_type = cmap_M3B;
422 par->cmap_type = cmap_M3B;
423 } else if (dp && !strncmp(name, "ATY,Rage6", 9)) { 306 } else if (dp && !strncmp(name, "ATY,Rage6", 9)) {
424 unsigned long regbase = dp->addrs[1].address; 307 par->cmap_adr = offb_map_reg(dp, 1, 0, 0x1fff);
425 par->cmap_adr = ioremap(regbase, 0x1FFF); 308 if (par->cmap_adr)
426 par->cmap_type = cmap_radeon; 309 par->cmap_type = cmap_radeon;
427 } else if (!strncmp(name, "ATY,", 4)) { 310 } else if (!strncmp(name, "ATY,", 4)) {
428 unsigned long base = address & 0xff000000UL; 311 unsigned long base = address & 0xff000000UL;
429 par->cmap_adr = 312 par->cmap_adr =
430 ioremap(base + 0x7ff000, 0x1000) + 0xcc0; 313 ioremap(base + 0x7ff000, 0x1000) + 0xcc0;
431 par->cmap_data = par->cmap_adr + 1; 314 par->cmap_data = par->cmap_adr + 1;
432 par->cmap_type = cmap_m64; 315 par->cmap_type = cmap_m64;
433 } else if (device_is_compatible(dp, "pci1014,b7")) { 316 } else if (dp && device_is_compatible(dp, "pci1014,b7")) {
434 unsigned long regbase = dp->addrs[0].address; 317 par->cmap_adr = offb_map_reg(dp, 0, 0x6000, 0x1000);
435 par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); 318 if (par->cmap_adr)
436 par->cmap_type = cmap_gxt2000; 319 par->cmap_type = cmap_gxt2000;
437 } 320 }
438#endif 321 fix->visual = (par->cmap_type != cmap_unknown) ?
439 fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR 322 FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_STATIC_PSEUDOCOLOR;
440 : FB_VISUAL_STATIC_PSEUDOCOLOR;
441 } else 323 } else
442 fix->visual = /* par->cmap_adr ? FB_VISUAL_DIRECTCOLOR 324 fix->visual = FB_VISUAL_TRUECOLOR;
443 : */ FB_VISUAL_TRUECOLOR;
444 325
445 var->xoffset = var->yoffset = 0; 326 var->xoffset = var->yoffset = 0;
446 switch (depth) { 327 switch (depth) {
@@ -520,5 +401,139 @@ static void __init offb_init_fb(const char *name, const char *full_name,
520 info->node, full_name); 401 info->node, full_name);
521} 402}
522 403
404
405static void __init offb_init_nodriver(struct device_node *dp, int no_real_node)
406{
407 unsigned int len;
408 int i, width = 640, height = 480, depth = 8, pitch = 640;
409 unsigned int flags, rsize, addr_prop = 0;
410 unsigned long max_size = 0;
411 u64 rstart, address = OF_BAD_ADDR;
412 u32 *pp, *addrp, *up;
413 u64 asize;
414
415 pp = (u32 *)get_property(dp, "linux,bootx-depth", &len);
416 if (pp == NULL)
417 pp = (u32 *)get_property(dp, "depth", &len);
418 if (pp && len == sizeof(u32))
419 depth = *pp;
420
421 pp = (u32 *)get_property(dp, "linux,bootx-width", &len);
422 if (pp == NULL)
423 pp = (u32 *)get_property(dp, "width", &len);
424 if (pp && len == sizeof(u32))
425 width = *pp;
426
427 pp = (u32 *)get_property(dp, "linux,bootx-height", &len);
428 if (pp == NULL)
429 pp = (u32 *)get_property(dp, "height", &len);
430 if (pp && len == sizeof(u32))
431 height = *pp;
432
433 pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len);
434 if (pp == NULL)
435 pp = (u32 *)get_property(dp, "linebytes", &len);
436 if (pp && len == sizeof(u32))
437 pitch = *pp;
438 else
439 pitch = width * ((depth + 7) / 8);
440
441 rsize = (unsigned long)pitch * (unsigned long)height;
442
443 /* Ok, now we try to figure out the address of the framebuffer.
444 *
445 * Unfortunately, Open Firmware doesn't provide a standard way to do
446 * so. All we can do is a dodgy heuristic that happens to work in
447 * practice. On most machines, the "address" property contains what
448 * we need, though not on Matrox cards found in IBM machines. What I've
449 * found that appears to give good results is to go through the PCI
450 * ranges and pick one that is both big enough and if possible encloses
451 * the "address" property. If none match, we pick the biggest
452 */
453 up = (u32 *)get_property(dp, "linux,bootx-addr", &len);
454 if (up == NULL)
455 up = (u32 *)get_property(dp, "address", &len);
456 if (up && len == sizeof(u32))
457 addr_prop = *up;
458
459 /* Hack for when BootX is passing us */
460 if (no_real_node)
461 goto skip_addr;
462
463 for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags))
464 != NULL; i++) {
465 int match_addrp = 0;
466
467 if (!(flags & IORESOURCE_MEM))
468 continue;
469 if (asize < rsize)
470 continue;
471 rstart = of_translate_address(dp, addrp);
472 if (rstart == OF_BAD_ADDR)
473 continue;
474 if (addr_prop && (rstart <= addr_prop) &&
475 ((rstart + asize) >= (addr_prop + rsize)))
476 match_addrp = 1;
477 if (match_addrp) {
478 address = addr_prop;
479 break;
480 }
481 if (rsize > max_size) {
482 max_size = rsize;
483 address = OF_BAD_ADDR;
484 }
485
486 if (address == OF_BAD_ADDR)
487 address = rstart;
488 }
489 skip_addr:
490 if (address == OF_BAD_ADDR && addr_prop)
491 address = (u64)addr_prop;
492 if (address != OF_BAD_ADDR) {
493 /* kludge for valkyrie */
494 if (strcmp(dp->name, "valkyrie") == 0)
495 address += 0x1000;
496 offb_init_fb(no_real_node ? "bootx" : dp->name,
497 no_real_node ? "display" : dp->full_name,
498 width, height, depth, pitch, address,
499 no_real_node ? dp : NULL);
500 }
501}
502
503static int __init offb_init(void)
504{
505 struct device_node *dp = NULL, *boot_disp = NULL;
506
507 if (fb_get_options("offb", NULL))
508 return -ENODEV;
509
510 /* Check if we have a MacOS display without a node spec */
511 if (get_property(of_chosen, "linux,bootx-noscreen", NULL) != NULL) {
512 /* The old code tried to work out which node was the MacOS
513 * display based on the address. I'm dropping that since the
514 * lack of a node spec only happens with old BootX versions
515 * (users can update) and with this code, they'll still get
516 * a display (just not the palette hacks).
517 */
518 offb_init_nodriver(of_chosen, 1);
519 }
520
521 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) {
522 if (get_property(dp, "linux,opened", NULL) &&
523 get_property(dp, "linux,boot-display", NULL)) {
524 boot_disp = dp;
525 offb_init_nodriver(dp, 0);
526 }
527 }
528 for (dp = NULL; (dp = of_find_node_by_type(dp, "display"));) {
529 if (get_property(dp, "linux,opened", NULL) &&
530 dp != boot_disp)
531 offb_init_nodriver(dp, 0);
532 }
533
534 return 0;
535}
536
537
523module_init(offb_init); 538module_init(offb_init);
524MODULE_LICENSE("GPL"); 539MODULE_LICENSE("GPL");
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 33dddbae5420..76fc9d355eb7 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -2132,6 +2132,9 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
2132 2132
2133 fb_destroy_modedb(info->monspecs.modedb); 2133 fb_destroy_modedb(info->monspecs.modedb);
2134 info->monspecs.modedb = NULL; 2134 info->monspecs.modedb = NULL;
2135
2136 pci_set_drvdata(pd, info);
2137 riva_bl_init(info->par);
2135 ret = register_framebuffer(info); 2138 ret = register_framebuffer(info);
2136 if (ret < 0) { 2139 if (ret < 0) {
2137 printk(KERN_ERR PFX 2140 printk(KERN_ERR PFX
@@ -2139,8 +2142,6 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
2139 goto err_iounmap_screen_base; 2142 goto err_iounmap_screen_base;
2140 } 2143 }
2141 2144
2142 pci_set_drvdata(pd, info);
2143
2144 printk(KERN_INFO PFX 2145 printk(KERN_INFO PFX
2145 "PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n", 2146 "PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n",
2146 info->fix.id, 2147 info->fix.id,
@@ -2148,8 +2149,6 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
2148 info->fix.smem_len / (1024 * 1024), 2149 info->fix.smem_len / (1024 * 1024),
2149 info->fix.smem_start); 2150 info->fix.smem_start);
2150 2151
2151 riva_bl_init(info->par);
2152
2153 NVTRACE_LEAVE(); 2152 NVTRACE_LEAVE();
2154 return 0; 2153 return 0;
2155 2154
diff --git a/fs/9p/conv.c b/fs/9p/conv.c
index 1e898144eb7c..56d88c1a09c5 100644
--- a/fs/9p/conv.c
+++ b/fs/9p/conv.c
@@ -673,8 +673,10 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode,
673 struct cbuf *bufp = &buffer; 673 struct cbuf *bufp = &buffer;
674 674
675 size = 4 + 2 + strlen(name) + 4 + 1; /* fid[4] name[s] perm[4] mode[1] */ 675 size = 4 + 2 + strlen(name) + 4 + 1; /* fid[4] name[s] perm[4] mode[1] */
676 if (extended && extension!=NULL) 676 if (extended) {
677 size += 2 + strlen(extension); /* extension[s] */ 677 size += 2 + /* extension[s] */
678 (extension == NULL ? 0 : strlen(extension));
679 }
678 680
679 fc = v9fs_create_common(bufp, size, TCREATE); 681 fc = v9fs_create_common(bufp, size, TCREATE);
680 if (IS_ERR(fc)) 682 if (IS_ERR(fc))
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 2f580a197b8d..eae50c9d6dc4 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -434,11 +434,11 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
434 result = v9fs_t_remove(v9ses, fid, &fcall); 434 result = v9fs_t_remove(v9ses, fid, &fcall);
435 if (result < 0) { 435 if (result < 0) {
436 PRINT_FCALL_ERROR("remove fails", fcall); 436 PRINT_FCALL_ERROR("remove fails", fcall);
437 } else {
438 v9fs_put_idpool(fid, &v9ses->fidpool);
439 v9fs_fid_destroy(v9fid);
440 } 437 }
441 438
439 v9fs_put_idpool(fid, &v9ses->fidpool);
440 v9fs_fid_destroy(v9fid);
441
442 kfree(fcall); 442 kfree(fcall);
443 return result; 443 return result;
444} 444}
diff --git a/fs/buffer.c b/fs/buffer.c
index 3660dcb97591..71649ef9b658 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -470,13 +470,18 @@ out:
470 pass does the actual I/O. */ 470 pass does the actual I/O. */
471void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) 471void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers)
472{ 472{
473 struct address_space *mapping = bdev->bd_inode->i_mapping;
474
475 if (mapping->nrpages == 0)
476 return;
477
473 invalidate_bh_lrus(); 478 invalidate_bh_lrus();
474 /* 479 /*
475 * FIXME: what about destroy_dirty_buffers? 480 * FIXME: what about destroy_dirty_buffers?
476 * We really want to use invalidate_inode_pages2() for 481 * We really want to use invalidate_inode_pages2() for
477 * that, but not until that's cleaned up. 482 * that, but not until that's cleaned up.
478 */ 483 */
479 invalidate_inode_pages(bdev->bd_inode->i_mapping); 484 invalidate_inode_pages(mapping);
480} 485}
481 486
482/* 487/*
diff --git a/fs/coda/file.c b/fs/coda/file.c
index cc66c681bd11..dbfbcfa5b3c0 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -136,10 +136,8 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)
136 coda_vfs_stat.open++; 136 coda_vfs_stat.open++;
137 137
138 cfi = kmalloc(sizeof(struct coda_file_info), GFP_KERNEL); 138 cfi = kmalloc(sizeof(struct coda_file_info), GFP_KERNEL);
139 if (!cfi) { 139 if (!cfi)
140 unlock_kernel();
141 return -ENOMEM; 140 return -ENOMEM;
142 }
143 141
144 lock_kernel(); 142 lock_kernel();
145 143
diff --git a/fs/efs/symlink.c b/fs/efs/symlink.c
index e249cf733a6b..1d30d2ff440f 100644
--- a/fs/efs/symlink.c
+++ b/fs/efs/symlink.c
@@ -22,7 +22,7 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
22 22
23 err = -ENAMETOOLONG; 23 err = -ENAMETOOLONG;
24 if (size > 2 * EFS_BLOCKSIZE) 24 if (size > 2 * EFS_BLOCKSIZE)
25 goto fail; 25 goto fail_notlocked;
26 26
27 lock_kernel(); 27 lock_kernel();
28 /* read first 512 bytes of link target */ 28 /* read first 512 bytes of link target */
@@ -47,6 +47,7 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
47 return 0; 47 return 0;
48fail: 48fail:
49 unlock_kernel(); 49 unlock_kernel();
50fail_notlocked:
50 SetPageError(page); 51 SetPageError(page);
51 kunmap(page); 52 kunmap(page);
52 unlock_page(page); 53 unlock_page(page);
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index f804d5e9d60c..c5ee9f0691e3 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1158,7 +1158,7 @@ retry:
1158 ret = PTR_ERR(handle); 1158 ret = PTR_ERR(handle);
1159 goto out; 1159 goto out;
1160 } 1160 }
1161 if (test_opt(inode->i_sb, NOBH)) 1161 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
1162 ret = nobh_prepare_write(page, from, to, ext3_get_block); 1162 ret = nobh_prepare_write(page, from, to, ext3_get_block);
1163 else 1163 else
1164 ret = block_prepare_write(page, from, to, ext3_get_block); 1164 ret = block_prepare_write(page, from, to, ext3_get_block);
@@ -1244,7 +1244,7 @@ static int ext3_writeback_commit_write(struct file *file, struct page *page,
1244 if (new_i_size > EXT3_I(inode)->i_disksize) 1244 if (new_i_size > EXT3_I(inode)->i_disksize)
1245 EXT3_I(inode)->i_disksize = new_i_size; 1245 EXT3_I(inode)->i_disksize = new_i_size;
1246 1246
1247 if (test_opt(inode->i_sb, NOBH)) 1247 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
1248 ret = nobh_commit_write(file, page, from, to); 1248 ret = nobh_commit_write(file, page, from, to);
1249 else 1249 else
1250 ret = generic_commit_write(file, page, from, to); 1250 ret = generic_commit_write(file, page, from, to);
@@ -1494,7 +1494,7 @@ static int ext3_writeback_writepage(struct page *page,
1494 goto out_fail; 1494 goto out_fail;
1495 } 1495 }
1496 1496
1497 if (test_opt(inode->i_sb, NOBH)) 1497 if (test_opt(inode->i_sb, NOBH) && ext3_should_writeback_data(inode))
1498 ret = nobh_writepage(page, ext3_get_block, wbc); 1498 ret = nobh_writepage(page, ext3_get_block, wbc);
1499 else 1499 else
1500 ret = block_write_full_page(page, ext3_get_block, wbc); 1500 ret = block_write_full_page(page, ext3_get_block, wbc);
@@ -2402,14 +2402,15 @@ static ext3_fsblk_t ext3_get_inode_block(struct super_block *sb,
2402 struct buffer_head *bh; 2402 struct buffer_head *bh;
2403 struct ext3_group_desc * gdp; 2403 struct ext3_group_desc * gdp;
2404 2404
2405 2405 if (!ext3_valid_inum(sb, ino)) {
2406 if ((ino != EXT3_ROOT_INO && ino != EXT3_JOURNAL_INO && 2406 /*
2407 ino != EXT3_RESIZE_INO && ino < EXT3_FIRST_INO(sb)) || 2407 * This error is already checked for in namei.c unless we are
2408 ino > le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count)) { 2408 * looking at an NFS filehandle, in which case no error
2409 ext3_error(sb, "ext3_get_inode_block", 2409 * report is needed
2410 "bad inode number: %lu", ino); 2410 */
2411 return 0; 2411 return 0;
2412 } 2412 }
2413
2413 block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb); 2414 block_group = (ino - 1) / EXT3_INODES_PER_GROUP(sb);
2414 if (block_group >= EXT3_SB(sb)->s_groups_count) { 2415 if (block_group >= EXT3_SB(sb)->s_groups_count) {
2415 ext3_error(sb,"ext3_get_inode_block","group >= groups count"); 2416 ext3_error(sb,"ext3_get_inode_block","group >= groups count");
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index d9176dba3698..2aa7101b27cd 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1000,7 +1000,12 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str
1000 if (bh) { 1000 if (bh) {
1001 unsigned long ino = le32_to_cpu(de->inode); 1001 unsigned long ino = le32_to_cpu(de->inode);
1002 brelse (bh); 1002 brelse (bh);
1003 inode = iget(dir->i_sb, ino); 1003 if (!ext3_valid_inum(dir->i_sb, ino)) {
1004 ext3_error(dir->i_sb, "ext3_lookup",
1005 "bad inode number: %lu", ino);
1006 inode = NULL;
1007 } else
1008 inode = iget(dir->i_sb, ino);
1004 1009
1005 if (!inode) 1010 if (!inode)
1006 return ERR_PTR(-EACCES); 1011 return ERR_PTR(-EACCES);
@@ -1028,7 +1033,13 @@ struct dentry *ext3_get_parent(struct dentry *child)
1028 return ERR_PTR(-ENOENT); 1033 return ERR_PTR(-ENOENT);
1029 ino = le32_to_cpu(de->inode); 1034 ino = le32_to_cpu(de->inode);
1030 brelse(bh); 1035 brelse(bh);
1031 inode = iget(child->d_inode->i_sb, ino); 1036
1037 if (!ext3_valid_inum(child->d_inode->i_sb, ino)) {
1038 ext3_error(child->d_inode->i_sb, "ext3_get_parent",
1039 "bad inode number: %lu", ino);
1040 inode = NULL;
1041 } else
1042 inode = iget(child->d_inode->i_sb, ino);
1032 1043
1033 if (!inode) 1044 if (!inode)
1034 return ERR_PTR(-EACCES); 1045 return ERR_PTR(-EACCES);
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c
index 29cce456c7ce..43886fa00a2a 100644
--- a/fs/freevxfs/vxfs_lookup.c
+++ b/fs/freevxfs/vxfs_lookup.c
@@ -246,6 +246,8 @@ vxfs_readdir(struct file *fp, void *retp, filldir_t filler)
246 u_long page, npages, block, pblocks, nblocks, offset; 246 u_long page, npages, block, pblocks, nblocks, offset;
247 loff_t pos; 247 loff_t pos;
248 248
249 lock_kernel();
250
249 switch ((long)fp->f_pos) { 251 switch ((long)fp->f_pos) {
250 case 0: 252 case 0:
251 if (filler(retp, ".", 1, fp->f_pos, ip->i_ino, DT_DIR) < 0) 253 if (filler(retp, ".", 1, fp->f_pos, ip->i_ino, DT_DIR) < 0)
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index a3bce3a77253..46fe60b2da23 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -105,7 +105,7 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
105 105
106/* 106/*
107 * Add a connection to the control filesystem (if it exists). Caller 107 * Add a connection to the control filesystem (if it exists). Caller
108 * must host fuse_mutex 108 * must hold fuse_mutex
109 */ 109 */
110int fuse_ctl_add_conn(struct fuse_conn *fc) 110int fuse_ctl_add_conn(struct fuse_conn *fc)
111{ 111{
@@ -139,7 +139,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc)
139 139
140/* 140/*
141 * Remove a connection from the control filesystem (if it exists). 141 * Remove a connection from the control filesystem (if it exists).
142 * Caller must host fuse_mutex 142 * Caller must hold fuse_mutex
143 */ 143 */
144void fuse_ctl_remove_conn(struct fuse_conn *fc) 144void fuse_ctl_remove_conn(struct fuse_conn *fc)
145{ 145{
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 72a74cde6de8..409ce6a7cca4 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -14,6 +14,33 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/namei.h> 15#include <linux/namei.h>
16 16
17#if BITS_PER_LONG >= 64
18static inline void fuse_dentry_settime(struct dentry *entry, u64 time)
19{
20 entry->d_time = time;
21}
22
23static inline u64 fuse_dentry_time(struct dentry *entry)
24{
25 return entry->d_time;
26}
27#else
28/*
29 * On 32 bit archs store the high 32 bits of time in d_fsdata
30 */
31static void fuse_dentry_settime(struct dentry *entry, u64 time)
32{
33 entry->d_time = time;
34 entry->d_fsdata = (void *) (unsigned long) (time >> 32);
35}
36
37static u64 fuse_dentry_time(struct dentry *entry)
38{
39 return (u64) entry->d_time +
40 ((u64) (unsigned long) entry->d_fsdata << 32);
41}
42#endif
43
17/* 44/*
18 * FUSE caches dentries and attributes with separate timeout. The 45 * FUSE caches dentries and attributes with separate timeout. The
19 * time in jiffies until the dentry/attributes are valid is stored in 46 * time in jiffies until the dentry/attributes are valid is stored in
@@ -23,10 +50,13 @@
23/* 50/*
24 * Calculate the time in jiffies until a dentry/attributes are valid 51 * Calculate the time in jiffies until a dentry/attributes are valid
25 */ 52 */
26static unsigned long time_to_jiffies(unsigned long sec, unsigned long nsec) 53static u64 time_to_jiffies(unsigned long sec, unsigned long nsec)
27{ 54{
28 struct timespec ts = {sec, nsec}; 55 if (sec || nsec) {
29 return jiffies + timespec_to_jiffies(&ts); 56 struct timespec ts = {sec, nsec};
57 return get_jiffies_64() + timespec_to_jiffies(&ts);
58 } else
59 return 0;
30} 60}
31 61
32/* 62/*
@@ -35,7 +65,8 @@ static unsigned long time_to_jiffies(unsigned long sec, unsigned long nsec)
35 */ 65 */
36static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o) 66static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o)
37{ 67{
38 entry->d_time = time_to_jiffies(o->entry_valid, o->entry_valid_nsec); 68 fuse_dentry_settime(entry,
69 time_to_jiffies(o->entry_valid, o->entry_valid_nsec));
39 if (entry->d_inode) 70 if (entry->d_inode)
40 get_fuse_inode(entry->d_inode)->i_time = 71 get_fuse_inode(entry->d_inode)->i_time =
41 time_to_jiffies(o->attr_valid, o->attr_valid_nsec); 72 time_to_jiffies(o->attr_valid, o->attr_valid_nsec);
@@ -47,7 +78,7 @@ static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o)
47 */ 78 */
48void fuse_invalidate_attr(struct inode *inode) 79void fuse_invalidate_attr(struct inode *inode)
49{ 80{
50 get_fuse_inode(inode)->i_time = jiffies - 1; 81 get_fuse_inode(inode)->i_time = 0;
51} 82}
52 83
53/* 84/*
@@ -60,7 +91,7 @@ void fuse_invalidate_attr(struct inode *inode)
60 */ 91 */
61static void fuse_invalidate_entry_cache(struct dentry *entry) 92static void fuse_invalidate_entry_cache(struct dentry *entry)
62{ 93{
63 entry->d_time = jiffies - 1; 94 fuse_dentry_settime(entry, 0);
64} 95}
65 96
66/* 97/*
@@ -102,7 +133,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
102 133
103 if (inode && is_bad_inode(inode)) 134 if (inode && is_bad_inode(inode))
104 return 0; 135 return 0;
105 else if (time_after(jiffies, entry->d_time)) { 136 else if (fuse_dentry_time(entry) < get_jiffies_64()) {
106 int err; 137 int err;
107 struct fuse_entry_out outarg; 138 struct fuse_entry_out outarg;
108 struct fuse_conn *fc; 139 struct fuse_conn *fc;
@@ -666,7 +697,7 @@ static int fuse_revalidate(struct dentry *entry)
666 if (!fuse_allow_task(fc, current)) 697 if (!fuse_allow_task(fc, current))
667 return -EACCES; 698 return -EACCES;
668 if (get_node_id(inode) != FUSE_ROOT_ID && 699 if (get_node_id(inode) != FUSE_ROOT_ID &&
669 time_before_eq(jiffies, fi->i_time)) 700 fi->i_time >= get_jiffies_64())
670 return 0; 701 return 0;
671 702
672 return fuse_do_getattr(inode); 703 return fuse_do_getattr(inode);
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 0dbf96621841..69c7750d55b8 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -59,7 +59,7 @@ struct fuse_inode {
59 struct fuse_req *forget_req; 59 struct fuse_req *forget_req;
60 60
61 /** Time in jiffies until the file attributes are valid */ 61 /** Time in jiffies until the file attributes are valid */
62 unsigned long i_time; 62 u64 i_time;
63}; 63};
64 64
65/** FUSE specific file data */ 65/** FUSE specific file data */
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index dcaaabd3b9c4..7d25092262ae 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -51,7 +51,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
51 return NULL; 51 return NULL;
52 52
53 fi = get_fuse_inode(inode); 53 fi = get_fuse_inode(inode);
54 fi->i_time = jiffies - 1; 54 fi->i_time = 0;
55 fi->nodeid = 0; 55 fi->nodeid = 0;
56 fi->nlookup = 0; 56 fi->nlookup = 0;
57 fi->forget_req = fuse_request_alloc(); 57 fi->forget_req = fuse_request_alloc();
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index f2386442adee..017cb0f134d6 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -187,7 +187,7 @@ static struct inotify_kernel_event * kernel_event(s32 wd, u32 mask, u32 cookie,
187{ 187{
188 struct inotify_kernel_event *kevent; 188 struct inotify_kernel_event *kevent;
189 189
190 kevent = kmem_cache_alloc(event_cachep, GFP_KERNEL); 190 kevent = kmem_cache_alloc(event_cachep, GFP_NOFS);
191 if (unlikely(!kevent)) 191 if (unlikely(!kevent))
192 return NULL; 192 return NULL;
193 193
diff --git a/fs/namei.c b/fs/namei.c
index e01070d7bf58..55a131230f94 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -159,7 +159,7 @@ char * getname(const char __user * filename)
159#ifdef CONFIG_AUDITSYSCALL 159#ifdef CONFIG_AUDITSYSCALL
160void putname(const char *name) 160void putname(const char *name)
161{ 161{
162 if (unlikely(current->audit_context)) 162 if (unlikely(!audit_dummy_context()))
163 audit_putname(name); 163 audit_putname(name);
164 else 164 else
165 __putname(name); 165 __putname(name);
@@ -1125,7 +1125,7 @@ static int fastcall do_path_lookup(int dfd, const char *name,
1125 retval = link_path_walk(name, nd); 1125 retval = link_path_walk(name, nd);
1126out: 1126out:
1127 if (likely(retval == 0)) { 1127 if (likely(retval == 0)) {
1128 if (unlikely(current->audit_context && nd && nd->dentry && 1128 if (unlikely(!audit_dummy_context() && nd && nd->dentry &&
1129 nd->dentry->d_inode)) 1129 nd->dentry->d_inode))
1130 audit_inode(name, nd->dentry->d_inode); 1130 audit_inode(name, nd->dentry->d_inode);
1131 } 1131 }
@@ -1357,7 +1357,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
1357 return -ENOENT; 1357 return -ENOENT;
1358 1358
1359 BUG_ON(victim->d_parent->d_inode != dir); 1359 BUG_ON(victim->d_parent->d_inode != dir);
1360 audit_inode_child(victim->d_name.name, victim->d_inode, dir->i_ino); 1360 audit_inode_child(victim->d_name.name, victim->d_inode, dir);
1361 1361
1362 error = permission(dir,MAY_WRITE | MAY_EXEC, NULL); 1362 error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
1363 if (error) 1363 if (error)
@@ -1659,6 +1659,7 @@ do_last:
1659 * It already exists. 1659 * It already exists.
1660 */ 1660 */
1661 mutex_unlock(&dir->d_inode->i_mutex); 1661 mutex_unlock(&dir->d_inode->i_mutex);
1662 audit_inode_update(path.dentry->d_inode);
1662 1663
1663 error = -EEXIST; 1664 error = -EEXIST;
1664 if (flag & O_EXCL) 1665 if (flag & O_EXCL)
@@ -1669,6 +1670,7 @@ do_last:
1669 if (flag & O_NOFOLLOW) 1670 if (flag & O_NOFOLLOW)
1670 goto exit_dput; 1671 goto exit_dput;
1671 } 1672 }
1673
1672 error = -ENOENT; 1674 error = -ENOENT;
1673 if (!path.dentry->d_inode) 1675 if (!path.dentry->d_inode)
1674 goto exit_dput; 1676 goto exit_dput;
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index ecc439d2565f..501d83884530 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -187,6 +187,11 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
187 goto out; 187 goto out;
188 } 188 }
189 189
190 /* Set user creds for this exportpoint */
191 error = nfserrno(nfsd_setuser(rqstp, exp));
192 if (error)
193 goto out;
194
190 /* 195 /*
191 * Look up the dentry using the NFS file handle. 196 * Look up the dentry using the NFS file handle.
192 */ 197 */
@@ -241,16 +246,17 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
241 dprintk("nfsd: fh_verify - just checking\n"); 246 dprintk("nfsd: fh_verify - just checking\n");
242 dentry = fhp->fh_dentry; 247 dentry = fhp->fh_dentry;
243 exp = fhp->fh_export; 248 exp = fhp->fh_export;
249 /* Set user creds for this exportpoint; necessary even
250 * in the "just checking" case because this may be a
251 * filehandle that was created by fh_compose, and that
252 * is about to be used in another nfsv4 compound
253 * operation */
254 error = nfserrno(nfsd_setuser(rqstp, exp));
255 if (error)
256 goto out;
244 } 257 }
245 cache_get(&exp->h); 258 cache_get(&exp->h);
246 259
247 /* Set user creds for this exportpoint; necessary even in the "just
248 * checking" case because this may be a filehandle that was created by
249 * fh_compose, and that is about to be used in another nfsv4 compound
250 * operation */
251 error = nfserrno(nfsd_setuser(rqstp, exp));
252 if (error)
253 goto out;
254 260
255 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); 261 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type);
256 if (error) 262 if (error)
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig
index c9a478099281..e478f1941831 100644
--- a/fs/partitions/Kconfig
+++ b/fs/partitions/Kconfig
@@ -99,7 +99,7 @@ config IBM_PARTITION
99 99
100config MAC_PARTITION 100config MAC_PARTITION
101 bool "Macintosh partition map support" if PARTITION_ADVANCED 101 bool "Macintosh partition map support" if PARTITION_ADVANCED
102 default y if MAC 102 default y if (MAC || PPC_PMAC)
103 help 103 help
104 Say Y here if you would like to use hard disks under Linux which 104 Say Y here if you would like to use hard disks under Linux which
105 were partitioned on a Macintosh. 105 were partitioned on a Macintosh.
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index abd5f23a426d..d344b411e261 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -129,7 +129,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
129 struct inode * inode; 129 struct inode * inode;
130 130
131 if (l > sb->s_blocksize) 131 if (l > sb->s_blocksize)
132 goto out; 132 goto out_notlocked;
133 133
134 lock_kernel(); 134 lock_kernel();
135 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); 135 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
@@ -155,6 +155,7 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
155 err = ufs_add_nondir(dentry, inode); 155 err = ufs_add_nondir(dentry, inode);
156out: 156out:
157 unlock_kernel(); 157 unlock_kernel();
158out_notlocked:
158 return err; 159 return err;
159 160
160out_fail: 161out_fail:
diff --git a/include/asm-arm/arch-iop3xx/iop331-irqs.h b/include/asm-arm/arch-iop3xx/iop331-irqs.h
index 8ff73d487222..7135ad7e335e 100644
--- a/include/asm-arm/arch-iop3xx/iop331-irqs.h
+++ b/include/asm-arm/arch-iop3xx/iop331-irqs.h
@@ -91,7 +91,6 @@
91#define NR_IRQS NR_IOP331_IRQS 91#define NR_IRQS NR_IOP331_IRQS
92 92
93 93
94#if defined(CONFIG_ARCH_IQ80331)
95/* 94/*
96 * Interrupts available on the IQ80331 board 95 * Interrupts available on the IQ80331 board
97 */ 96 */
@@ -111,7 +110,6 @@
111#define IRQ_IQ80331_INTC IRQ_IOP331_XINT2 110#define IRQ_IQ80331_INTC IRQ_IOP331_XINT2
112#define IRQ_IQ80331_INTD IRQ_IOP331_XINT3 111#define IRQ_IQ80331_INTD IRQ_IOP331_XINT3
113 112
114#elif defined(CONFIG_MACH_IQ80332)
115/* 113/*
116 * Interrupts available on the IQ80332 board 114 * Interrupts available on the IQ80332 board
117 */ 115 */
@@ -131,6 +129,4 @@
131#define IRQ_IQ80332_INTC IRQ_IOP331_XINT2 129#define IRQ_IQ80332_INTC IRQ_IOP331_XINT2
132#define IRQ_IQ80332_INTD IRQ_IOP331_XINT3 130#define IRQ_IQ80332_INTD IRQ_IOP331_XINT3
133 131
134#endif
135
136#endif // _IOP331_IRQ_H_ 132#endif // _IOP331_IRQ_H_
diff --git a/include/asm-arm/arch-omap/clock.h b/include/asm-arm/arch-omap/clock.h
index 3c4eb9fbe48a..f83003f5287b 100644
--- a/include/asm-arm/arch-omap/clock.h
+++ b/include/asm-arm/arch-omap/clock.h
@@ -48,8 +48,6 @@ struct clk_functions {
48}; 48};
49 49
50extern unsigned int mpurate; 50extern unsigned int mpurate;
51extern struct list_head clocks;
52extern spinlock_t clockfw_lock;
53 51
54extern int clk_init(struct clk_functions * custom_clocks); 52extern int clk_init(struct clk_functions * custom_clocks);
55extern int clk_register(struct clk *clk); 53extern int clk_register(struct clk *clk);
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h
index 0730a20f6db8..8774d06689da 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -45,6 +45,7 @@ typedef u8 kprobe_opcode_t;
45#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 45#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
46#define ARCH_SUPPORTS_KRETPROBES 46#define ARCH_SUPPORTS_KRETPROBES
47#define ARCH_INACTIVE_KPROBE_COUNT 0 47#define ARCH_INACTIVE_KPROBE_COUNT 0
48#define flush_insn_slot(p) do { } while (0)
48 49
49void arch_remove_kprobe(struct kprobe *p); 50void arch_remove_kprobe(struct kprobe *p);
50void kretprobe_trampoline(void); 51void kretprobe_trampoline(void);
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 2418a787c405..938904910115 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -125,5 +125,6 @@ static inline void jprobe_return(void)
125} 125}
126extern void invalidate_stacked_regs(void); 126extern void invalidate_stacked_regs(void);
127extern void flush_register_stack(void); 127extern void flush_register_stack(void);
128extern void flush_insn_slot(struct kprobe *p);
128 129
129#endif /* _ASM_KPROBES_H */ 130#endif /* _ASM_KPROBES_H */
diff --git a/include/asm-powerpc/backlight.h b/include/asm-powerpc/backlight.h
index 58d4b6f8d827..8cf5c37c3817 100644
--- a/include/asm-powerpc/backlight.h
+++ b/include/asm-powerpc/backlight.h
@@ -30,8 +30,12 @@ static inline void pmac_backlight_key_down(void)
30 pmac_backlight_key(1); 30 pmac_backlight_key(1);
31} 31}
32 32
33extern void pmac_backlight_set_legacy_brightness_pmu(int brightness);
33extern int pmac_backlight_set_legacy_brightness(int brightness); 34extern int pmac_backlight_set_legacy_brightness(int brightness);
34extern int pmac_backlight_get_legacy_brightness(void); 35extern int pmac_backlight_get_legacy_brightness(void);
35 36
37extern void pmac_backlight_enable(void);
38extern void pmac_backlight_disable(void);
39
36#endif /* __KERNEL__ */ 40#endif /* __KERNEL__ */
37#endif 41#endif
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index 2d0af52c823d..34e1f89a5fa0 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -51,6 +51,7 @@ typedef unsigned int kprobe_opcode_t;
51 51
52#define ARCH_SUPPORTS_KRETPROBES 52#define ARCH_SUPPORTS_KRETPROBES
53#define ARCH_INACTIVE_KPROBE_COUNT 1 53#define ARCH_INACTIVE_KPROBE_COUNT 1
54#define flush_insn_slot(p) do { } while (0)
54 55
55void kretprobe_trampoline(void); 56void kretprobe_trampoline(void);
56extern void arch_remove_kprobe(struct kprobe *p); 57extern void arch_remove_kprobe(struct kprobe *p);
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h
index 15065af566c2..c9f5c34d318c 100644
--- a/include/asm-sparc64/kprobes.h
+++ b/include/asm-sparc64/kprobes.h
@@ -13,6 +13,7 @@ typedef u32 kprobe_opcode_t;
13#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 13#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
14#define arch_remove_kprobe(p) do {} while (0) 14#define arch_remove_kprobe(p) do {} while (0)
15#define ARCH_INACTIVE_KPROBE_COUNT 0 15#define ARCH_INACTIVE_KPROBE_COUNT 0
16#define flush_insn_slot(p) do { } while (0)
16 17
17/* Architecture specific copy of original instruction*/ 18/* Architecture specific copy of original instruction*/
18struct arch_specific_insn { 19struct arch_specific_insn {
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h
index fbfb50136edb..4e3919524240 100644
--- a/include/asm-x86_64/calgary.h
+++ b/include/asm-x86_64/calgary.h
@@ -60,9 +60,4 @@ static inline int calgary_iommu_init(void) { return 1; }
60static inline void detect_calgary(void) { return; } 60static inline void detect_calgary(void) { return; }
61#endif 61#endif
62 62
63static inline unsigned int bus_to_phb(unsigned char busno)
64{
65 return ((busno % 15 == 0) ? 0 : busno / 2 + 1);
66}
67
68#endif /* _ASM_X86_64_CALGARY_H */ 63#endif /* _ASM_X86_64_CALGARY_H */
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h
index d36febd9bb18..cf5317898fb0 100644
--- a/include/asm-x86_64/kprobes.h
+++ b/include/asm-x86_64/kprobes.h
@@ -47,6 +47,7 @@ typedef u8 kprobe_opcode_t;
47 47
48void kretprobe_trampoline(void); 48void kretprobe_trampoline(void);
49extern void arch_remove_kprobe(struct kprobe *p); 49extern void arch_remove_kprobe(struct kprobe *p);
50#define flush_insn_slot(p) do { } while (0)
50 51
51/* Architecture specific copy of original instruction*/ 52/* Architecture specific copy of original instruction*/
52struct arch_specific_insn { 53struct arch_specific_insn {
diff --git a/include/asm-x86_64/swiotlb.h b/include/asm-x86_64/swiotlb.h
index 5f9a01805821..ba94ab3d2673 100644
--- a/include/asm-x86_64/swiotlb.h
+++ b/include/asm-x86_64/swiotlb.h
@@ -42,6 +42,8 @@ extern void swiotlb_free_coherent (struct device *hwdev, size_t size,
42extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); 42extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
43extern void swiotlb_init(void); 43extern void swiotlb_init(void);
44 44
45extern int swiotlb_force;
46
45#ifdef CONFIG_SWIOTLB 47#ifdef CONFIG_SWIOTLB
46extern int swiotlb; 48extern int swiotlb;
47#else 49#else
diff --git a/include/linux/audit.h b/include/linux/audit.h
index b27d7debc5a1..64f9f9e56ac5 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -327,21 +327,31 @@ extern void __audit_getname(const char *name);
327extern void audit_putname(const char *name); 327extern void audit_putname(const char *name);
328extern void __audit_inode(const char *name, const struct inode *inode); 328extern void __audit_inode(const char *name, const struct inode *inode);
329extern void __audit_inode_child(const char *dname, const struct inode *inode, 329extern void __audit_inode_child(const char *dname, const struct inode *inode,
330 unsigned long pino); 330 const struct inode *parent);
331extern void __audit_inode_update(const struct inode *inode);
332static inline int audit_dummy_context(void)
333{
334 void *p = current->audit_context;
335 return !p || *(int *)p;
336}
331static inline void audit_getname(const char *name) 337static inline void audit_getname(const char *name)
332{ 338{
333 if (unlikely(current->audit_context)) 339 if (unlikely(!audit_dummy_context()))
334 __audit_getname(name); 340 __audit_getname(name);
335} 341}
336static inline void audit_inode(const char *name, const struct inode *inode) { 342static inline void audit_inode(const char *name, const struct inode *inode) {
337 if (unlikely(current->audit_context)) 343 if (unlikely(!audit_dummy_context()))
338 __audit_inode(name, inode); 344 __audit_inode(name, inode);
339} 345}
340static inline void audit_inode_child(const char *dname, 346static inline void audit_inode_child(const char *dname,
341 const struct inode *inode, 347 const struct inode *inode,
342 unsigned long pino) { 348 const struct inode *parent) {
343 if (unlikely(current->audit_context)) 349 if (unlikely(!audit_dummy_context()))
344 __audit_inode_child(dname, inode, pino); 350 __audit_inode_child(dname, inode, parent);
351}
352static inline void audit_inode_update(const struct inode *inode) {
353 if (unlikely(!audit_dummy_context()))
354 __audit_inode_update(inode);
345} 355}
346 356
347 /* Private API (for audit.c only) */ 357 /* Private API (for audit.c only) */
@@ -365,57 +375,61 @@ extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
365 375
366static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 376static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
367{ 377{
368 if (unlikely(current->audit_context)) 378 if (unlikely(!audit_dummy_context()))
369 return __audit_ipc_obj(ipcp); 379 return __audit_ipc_obj(ipcp);
370 return 0; 380 return 0;
371} 381}
372static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 382static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
373{ 383{
374 if (unlikely(current->audit_context)) 384 if (unlikely(!audit_dummy_context()))
375 return __audit_ipc_set_perm(qbytes, uid, gid, mode); 385 return __audit_ipc_set_perm(qbytes, uid, gid, mode);
376 return 0; 386 return 0;
377} 387}
378static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) 388static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
379{ 389{
380 if (unlikely(current->audit_context)) 390 if (unlikely(!audit_dummy_context()))
381 return __audit_mq_open(oflag, mode, u_attr); 391 return __audit_mq_open(oflag, mode, u_attr);
382 return 0; 392 return 0;
383} 393}
384static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) 394static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
385{ 395{
386 if (unlikely(current->audit_context)) 396 if (unlikely(!audit_dummy_context()))
387 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); 397 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
388 return 0; 398 return 0;
389} 399}
390static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) 400static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
391{ 401{
392 if (unlikely(current->audit_context)) 402 if (unlikely(!audit_dummy_context()))
393 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); 403 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
394 return 0; 404 return 0;
395} 405}
396static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) 406static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
397{ 407{
398 if (unlikely(current->audit_context)) 408 if (unlikely(!audit_dummy_context()))
399 return __audit_mq_notify(mqdes, u_notification); 409 return __audit_mq_notify(mqdes, u_notification);
400 return 0; 410 return 0;
401} 411}
402static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) 412static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
403{ 413{
404 if (unlikely(current->audit_context)) 414 if (unlikely(!audit_dummy_context()))
405 return __audit_mq_getsetattr(mqdes, mqstat); 415 return __audit_mq_getsetattr(mqdes, mqstat);
406 return 0; 416 return 0;
407} 417}
418extern int audit_n_rules;
408#else 419#else
409#define audit_alloc(t) ({ 0; }) 420#define audit_alloc(t) ({ 0; })
410#define audit_free(t) do { ; } while (0) 421#define audit_free(t) do { ; } while (0)
411#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 422#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
412#define audit_syscall_exit(f,r) do { ; } while (0) 423#define audit_syscall_exit(f,r) do { ; } while (0)
424#define audit_dummy_context() 1
413#define audit_getname(n) do { ; } while (0) 425#define audit_getname(n) do { ; } while (0)
414#define audit_putname(n) do { ; } while (0) 426#define audit_putname(n) do { ; } while (0)
415#define __audit_inode(n,i) do { ; } while (0) 427#define __audit_inode(n,i) do { ; } while (0)
416#define __audit_inode_child(d,i,p) do { ; } while (0) 428#define __audit_inode_child(d,i,p) do { ; } while (0)
429#define __audit_inode_update(i) do { ; } while (0)
417#define audit_inode(n,i) do { ; } while (0) 430#define audit_inode(n,i) do { ; } while (0)
418#define audit_inode_child(d,i,p) do { ; } while (0) 431#define audit_inode_child(d,i,p) do { ; } while (0)
432#define audit_inode_update(i) do { ; } while (0)
419#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 433#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
420#define audit_get_loginuid(c) ({ -1; }) 434#define audit_get_loginuid(c) ({ -1; })
421#define audit_ipc_obj(i) ({ 0; }) 435#define audit_ipc_obj(i) ({ 0; })
@@ -430,6 +444,7 @@ static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
430#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 444#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
431#define audit_mq_notify(d,n) ({ 0; }) 445#define audit_mq_notify(d,n) ({ 0; })
432#define audit_mq_getsetattr(d,s) ({ 0; }) 446#define audit_mq_getsetattr(d,s) ({ 0; })
447#define audit_n_rules 0
433#endif 448#endif
434 449
435#ifdef CONFIG_AUDIT 450#ifdef CONFIG_AUDIT
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index dbb7769009be..1c86d65bc4b9 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -57,7 +57,8 @@ struct proc_event {
57 PROC_EVENT_EXIT = 0x80000000 57 PROC_EVENT_EXIT = 0x80000000
58 } what; 58 } what;
59 __u32 cpu; 59 __u32 cpu;
60 struct timespec timestamp; 60 __u64 __attribute__((aligned(8))) timestamp_ns;
61 /* Number of nano seconds since system boot */
61 union { /* must be last field of proc_event struct */ 62 union { /* must be last field of proc_event struct */
62 struct { 63 struct {
63 __u32 err; 64 __u32 err;
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index 7e8b6011b8f3..11487b6e7127 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -55,7 +55,7 @@ static inline void delayacct_tsk_init(struct task_struct *tsk)
55{ 55{
56 /* reinitialize in case parent's non-null pointer was dup'ed*/ 56 /* reinitialize in case parent's non-null pointer was dup'ed*/
57 tsk->delays = NULL; 57 tsk->delays = NULL;
58 if (unlikely(delayacct_on)) 58 if (delayacct_on)
59 __delayacct_tsk_init(tsk); 59 __delayacct_tsk_init(tsk);
60} 60}
61 61
@@ -80,9 +80,7 @@ static inline void delayacct_blkio_end(void)
80static inline int delayacct_add_tsk(struct taskstats *d, 80static inline int delayacct_add_tsk(struct taskstats *d,
81 struct task_struct *tsk) 81 struct task_struct *tsk)
82{ 82{
83 if (likely(!delayacct_on)) 83 if (!delayacct_on || !tsk->delays)
84 return -EINVAL;
85 if (!tsk->delays)
86 return 0; 84 return 0;
87 return __delayacct_add_tsk(d, tsk); 85 return __delayacct_add_tsk(d, tsk);
88} 86}
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 5607e6457a65..9f9cce7bd86d 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -492,6 +492,15 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
492{ 492{
493 return container_of(inode, struct ext3_inode_info, vfs_inode); 493 return container_of(inode, struct ext3_inode_info, vfs_inode);
494} 494}
495
496static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
497{
498 return ino == EXT3_ROOT_INO ||
499 ino == EXT3_JOURNAL_INO ||
500 ino == EXT3_RESIZE_INO ||
501 (ino >= EXT3_FIRST_INO(sb) &&
502 ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
503}
495#else 504#else
496/* Assume that user mode programs are passing in an ext3fs superblock, not 505/* Assume that user mode programs are passing in an ext3fs superblock, not
497 * a kernel struct super_block. This will allow us to call the feature-test 506 * a kernel struct super_block. This will allow us to call the feature-test
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 405f44e44e5d..4ad0673b1995 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -524,7 +524,7 @@ struct fb_event {
524 524
525extern int fb_register_client(struct notifier_block *nb); 525extern int fb_register_client(struct notifier_block *nb);
526extern int fb_unregister_client(struct notifier_block *nb); 526extern int fb_unregister_client(struct notifier_block *nb);
527 527extern int fb_notifier_call_chain(unsigned long val, void *v);
528/* 528/*
529 * Pixmap structure definition 529 * Pixmap structure definition
530 * 530 *
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index cc5dec70c32c..d4f219ffaa5d 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -67,7 +67,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
67 if (source) { 67 if (source) {
68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); 68 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
69 } 69 }
70 audit_inode_child(new_name, source, new_dir->i_ino); 70 audit_inode_child(new_name, source, new_dir);
71} 71}
72 72
73/* 73/*
@@ -98,7 +98,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
98 inode_dir_notify(inode, DN_CREATE); 98 inode_dir_notify(inode, DN_CREATE);
99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 99 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
100 dentry->d_inode); 100 dentry->d_inode);
101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 101 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
102} 102}
103 103
104/* 104/*
@@ -109,7 +109,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
109 inode_dir_notify(inode, DN_CREATE); 109 inode_dir_notify(inode, DN_CREATE);
110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, 110 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0,
111 dentry->d_name.name, dentry->d_inode); 111 dentry->d_name.name, dentry->d_inode);
112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode->i_ino); 112 audit_inode_child(dentry->d_name.name, dentry->d_inode, inode);
113} 113}
114 114
115/* 115/*
diff --git a/include/linux/irq.h b/include/linux/irq.h
index b48eae32dc61..fbf6d901e9c2 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -47,8 +47,8 @@
47#define IRQ_WAITING 0x00200000 /* IRQ not yet seen - for autodetection */ 47#define IRQ_WAITING 0x00200000 /* IRQ not yet seen - for autodetection */
48#define IRQ_LEVEL 0x00400000 /* IRQ level triggered */ 48#define IRQ_LEVEL 0x00400000 /* IRQ level triggered */
49#define IRQ_MASKED 0x00800000 /* IRQ masked - shouldn't be seen again */ 49#define IRQ_MASKED 0x00800000 /* IRQ masked - shouldn't be seen again */
50#define IRQ_PER_CPU 0x01000000 /* IRQ is per CPU */
50#ifdef CONFIG_IRQ_PER_CPU 51#ifdef CONFIG_IRQ_PER_CPU
51# define IRQ_PER_CPU 0x01000000 /* IRQ is per CPU */
52# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 52# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
53#else 53#else
54# define CHECK_IRQ_PER_CPU(var) 0 54# define CHECK_IRQ_PER_CPU(var) 0
@@ -58,6 +58,7 @@
58#define IRQ_NOREQUEST 0x04000000 /* IRQ cannot be requested */ 58#define IRQ_NOREQUEST 0x04000000 /* IRQ cannot be requested */
59#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */ 59#define IRQ_NOAUTOEN 0x08000000 /* IRQ will not be enabled on request irq */
60#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */ 60#define IRQ_DELAYED_DISABLE 0x10000000 /* IRQ disable (masking) happens delayed. */
61#define IRQ_WAKEUP 0x20000000 /* IRQ triggers system wakeup */
61 62
62struct proc_dir_entry; 63struct proc_dir_entry;
63 64
@@ -124,6 +125,7 @@ struct irq_chip {
124 * @action: the irq action chain 125 * @action: the irq action chain
125 * @status: status information 126 * @status: status information
126 * @depth: disable-depth, for nested irq_disable() calls 127 * @depth: disable-depth, for nested irq_disable() calls
128 * @wake_depth: enable depth, for multiple set_irq_wake() callers
127 * @irq_count: stats field to detect stalled irqs 129 * @irq_count: stats field to detect stalled irqs
128 * @irqs_unhandled: stats field for spurious unhandled interrupts 130 * @irqs_unhandled: stats field for spurious unhandled interrupts
129 * @lock: locking for SMP 131 * @lock: locking for SMP
@@ -147,6 +149,7 @@ struct irq_desc {
147 unsigned int status; /* IRQ status */ 149 unsigned int status; /* IRQ status */
148 150
149 unsigned int depth; /* nested irq disables */ 151 unsigned int depth; /* nested irq disables */
152 unsigned int wake_depth; /* nested wake enables */
150 unsigned int irq_count; /* For detecting broken IRQs */ 153 unsigned int irq_count; /* For detecting broken IRQs */
151 unsigned int irqs_unhandled; 154 unsigned int irqs_unhandled;
152 spinlock_t lock; 155 spinlock_t lock;
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 043376920f51..329ebcffa106 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -47,8 +47,8 @@
47 * - (NOM / DEN) fits in (32 - LSH) bits. 47 * - (NOM / DEN) fits in (32 - LSH) bits.
48 * - (NOM % DEN) fits in (32 - LSH) bits. 48 * - (NOM % DEN) fits in (32 - LSH) bits.
49 */ 49 */
50#define SH_DIV(NOM,DEN,LSH) ( ((NOM / DEN) << LSH) \ 50#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \
51 + (((NOM % DEN) << LSH) + DEN / 2) / DEN) 51 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
52 52
53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 31f02ba036ce..10c13dc4665b 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -6,7 +6,6 @@
6 6
7#include <linux/netfilter.h> 7#include <linux/netfilter.h>
8#if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER) 8#if defined(__KERNEL__) && defined(CONFIG_BRIDGE_NETFILTER)
9#include <asm/atomic.h>
10#include <linux/if_ether.h> 9#include <linux/if_ether.h>
11#endif 10#endif
12 11
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 2ed807ddc08c..783177387ac6 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -231,7 +231,6 @@ extern struct pmu_battery_info pmu_batteries[PMU_MAX_BATTERIES];
231extern unsigned int pmu_power_flags; 231extern unsigned int pmu_power_flags;
232 232
233/* Backlight */ 233/* Backlight */
234extern int disable_kernel_backlight; 234extern void pmu_backlight_init(void);
235extern void pmu_backlight_init(struct device_node*);
236 235
237#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
diff --git a/include/linux/security.h b/include/linux/security.h
index f75303831d09..6bc2aad494ff 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1109,6 +1109,16 @@ struct swap_info_struct;
1109 * @name contains the name of the security module being unstacked. 1109 * @name contains the name of the security module being unstacked.
1110 * @ops contains a pointer to the struct security_operations of the module to unstack. 1110 * @ops contains a pointer to the struct security_operations of the module to unstack.
1111 * 1111 *
1112 * @secid_to_secctx:
1113 * Convert secid to security context.
1114 * @secid contains the security ID.
1115 * @secdata contains the pointer that stores the converted security context.
1116 *
1117 * @release_secctx:
1118 * Release the security context.
1119 * @secdata contains the security context.
1120 * @seclen contains the length of the security context.
1121 *
1112 * This is the main security structure. 1122 * This is the main security structure.
1113 */ 1123 */
1114struct security_operations { 1124struct security_operations {
@@ -1289,6 +1299,8 @@ struct security_operations {
1289 1299
1290 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1300 int (*getprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1291 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1301 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1302 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1303 void (*release_secctx)(char *secdata, u32 seclen);
1292 1304
1293#ifdef CONFIG_SECURITY_NETWORK 1305#ifdef CONFIG_SECURITY_NETWORK
1294 int (*unix_stream_connect) (struct socket * sock, 1306 int (*unix_stream_connect) (struct socket * sock,
@@ -1317,7 +1329,7 @@ struct security_operations {
1317 int (*socket_shutdown) (struct socket * sock, int how); 1329 int (*socket_shutdown) (struct socket * sock, int how);
1318 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb); 1330 int (*socket_sock_rcv_skb) (struct sock * sk, struct sk_buff * skb);
1319 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); 1331 int (*socket_getpeersec_stream) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len);
1320 int (*socket_getpeersec_dgram) (struct sk_buff *skb, char **secdata, u32 *seclen); 1332 int (*socket_getpeersec_dgram) (struct socket *sock, struct sk_buff *skb, u32 *secid);
1321 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); 1333 int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority);
1322 void (*sk_free_security) (struct sock *sk); 1334 void (*sk_free_security) (struct sock *sk);
1323 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); 1335 unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir);
@@ -2059,6 +2071,16 @@ static inline int security_netlink_recv(struct sk_buff * skb, int cap)
2059 return security_ops->netlink_recv(skb, cap); 2071 return security_ops->netlink_recv(skb, cap);
2060} 2072}
2061 2073
2074static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2075{
2076 return security_ops->secid_to_secctx(secid, secdata, seclen);
2077}
2078
2079static inline void security_release_secctx(char *secdata, u32 seclen)
2080{
2081 return security_ops->release_secctx(secdata, seclen);
2082}
2083
2062/* prototypes */ 2084/* prototypes */
2063extern int security_init (void); 2085extern int security_init (void);
2064extern int register_security (struct security_operations *ops); 2086extern int register_security (struct security_operations *ops);
@@ -2725,6 +2747,14 @@ static inline void securityfs_remove(struct dentry *dentry)
2725{ 2747{
2726} 2748}
2727 2749
2750static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2751{
2752 return -EOPNOTSUPP;
2753}
2754
2755static inline void security_release_secctx(char *secdata, u32 seclen)
2756{
2757}
2728#endif /* CONFIG_SECURITY */ 2758#endif /* CONFIG_SECURITY */
2729 2759
2730#ifdef CONFIG_SECURITY_NETWORK 2760#ifdef CONFIG_SECURITY_NETWORK
@@ -2840,10 +2870,9 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __
2840 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len); 2870 return security_ops->socket_getpeersec_stream(sock, optval, optlen, len);
2841} 2871}
2842 2872
2843static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 2873static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2844 u32 *seclen)
2845{ 2874{
2846 return security_ops->socket_getpeersec_dgram(skb, secdata, seclen); 2875 return security_ops->socket_getpeersec_dgram(sock, skb, secid);
2847} 2876}
2848 2877
2849static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) 2878static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority)
@@ -2968,8 +2997,7 @@ static inline int security_socket_getpeersec_stream(struct socket *sock, char __
2968 return -ENOPROTOOPT; 2997 return -ENOPROTOOPT;
2969} 2998}
2970 2999
2971static inline int security_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 3000static inline int security_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
2972 u32 *seclen)
2973{ 3001{
2974 return -ENOPROTOOPT; 3002 return -ENOPROTOOPT;
2975} 3003}
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4307e764ef0a..19c96d498e20 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -604,12 +604,17 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
604 return list_->qlen; 604 return list_->qlen;
605} 605}
606 606
607extern struct lock_class_key skb_queue_lock_key; 607/*
608 608 * This function creates a split out lock class for each invocation;
609 * this is needed for now since a whole lot of users of the skb-queue
610 * infrastructure in drivers have different locking usage (in hardirq)
611 * than the networking core (in softirq only). In the long run either the
612 * network layer or drivers should need annotation to consolidate the
613 * main types of usage into 3 classes.
614 */
609static inline void skb_queue_head_init(struct sk_buff_head *list) 615static inline void skb_queue_head_init(struct sk_buff_head *list)
610{ 616{
611 spin_lock_init(&list->lock); 617 spin_lock_init(&list->lock);
612 lockdep_set_class(&list->lock, &skb_queue_lock_key);
613 list->prev = list->next = (struct sk_buff *)list; 618 list->prev = list->next = (struct sk_buff *)list;
614 list->qlen = 0; 619 list->qlen = 0;
615} 620}
@@ -1104,6 +1109,28 @@ static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1104 return __dev_alloc_skb(length, GFP_ATOMIC); 1109 return __dev_alloc_skb(length, GFP_ATOMIC);
1105} 1110}
1106 1111
1112extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1113 unsigned int length, gfp_t gfp_mask);
1114
1115/**
1116 * netdev_alloc_skb - allocate an skbuff for rx on a specific device
1117 * @dev: network device to receive on
1118 * @length: length to allocate
1119 *
1120 * Allocate a new &sk_buff and assign it a usage count of one. The
1121 * buffer has unspecified headroom built in. Users should allocate
1122 * the headroom they think they need without accounting for the
1123 * built in space. The built in space is used for optimisations.
1124 *
1125 * %NULL is returned if there is no free memory. Although this function
1126 * allocates memory it can be called from an interrupt.
1127 */
1128static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1129 unsigned int length)
1130{
1131 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1132}
1133
1107/** 1134/**
1108 * skb_cow - copy header of skb when it is required 1135 * skb_cow - copy header of skb when it is required
1109 * @skb: buffer to cow 1136 * @skb: buffer to cow
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c944e8f06a4a..d2bd0c8e0154 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -103,8 +103,7 @@ enum usb_interface_condition {
103 * @condition: binding state of the interface: not bound, binding 103 * @condition: binding state of the interface: not bound, binding
104 * (in probe()), bound to a driver, or unbinding (in disconnect()) 104 * (in probe()), bound to a driver, or unbinding (in disconnect())
105 * @dev: driver model's view of this device 105 * @dev: driver model's view of this device
106 * @usb_dev: if an interface is bound to the USB major, this will point 106 * @class_dev: driver model's class view of this device.
107 * to the sysfs representation for that device.
108 * 107 *
109 * USB device drivers attach to interfaces on a physical device. Each 108 * USB device drivers attach to interfaces on a physical device. Each
110 * interface encapsulates a single high level function, such as feeding 109 * interface encapsulates a single high level function, such as feeding
@@ -144,7 +143,7 @@ struct usb_interface {
144 * bound to */ 143 * bound to */
145 enum usb_interface_condition condition; /* state of binding */ 144 enum usb_interface_condition condition; /* state of binding */
146 struct device dev; /* interface specific device info */ 145 struct device dev; /* interface specific device info */
147 struct device *usb_dev; /* pointer to the usb class's device, if any */ 146 struct class_device *class_dev;
148}; 147};
149#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 148#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
150#define interface_to_usbdev(intf) \ 149#define interface_to_usbdev(intf) \
@@ -361,7 +360,7 @@ struct usb_device {
361 char *serial; /* iSerialNumber string, if present */ 360 char *serial; /* iSerialNumber string, if present */
362 361
363 struct list_head filelist; 362 struct list_head filelist;
364 struct device *usbfs_dev; 363 struct class_device *class_dev;
365 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 364 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
366 365
367 /* 366 /*
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index f38f43f20fae..e7fc5fed5b98 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -44,7 +44,9 @@
44 US_FLAG(NO_WP_DETECT, 0x00000200) \ 44 US_FLAG(NO_WP_DETECT, 0x00000200) \
45 /* Don't check for write-protect */ \ 45 /* Don't check for write-protect */ \
46 US_FLAG(MAX_SECTORS_64, 0x00000400) \ 46 US_FLAG(MAX_SECTORS_64, 0x00000400) \
47 /* Sets max_sectors to 64 */ 47 /* Sets max_sectors to 64 */ \
48 US_FLAG(IGNORE_DEVICE, 0x00000800) \
49 /* Don't claim device */
48 50
49#define US_FLAG(name, value) US_FL_##name = value , 51#define US_FLAG(name, value) US_FL_##name = value ,
50enum { US_DO_ALL_FLAGS }; 52enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 41bc7e9603cd..518c7a32175e 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -12,10 +12,11 @@
12#ifndef __LINUX_VIDEODEV_H 12#ifndef __LINUX_VIDEODEV_H
13#define __LINUX_VIDEODEV_H 13#define __LINUX_VIDEODEV_H
14 14
15#define HAVE_V4L1 1
16
17#include <linux/videodev2.h> 15#include <linux/videodev2.h>
18 16
17#ifdef CONFIG_VIDEO_V4L1_COMPAT
18#define HAVE_V4L1 1
19
19struct video_capability 20struct video_capability
20{ 21{
21 char name[32]; 22 char name[32];
@@ -336,6 +337,8 @@ struct video_code
336#define VID_HARDWARE_SN9C102 38 337#define VID_HARDWARE_SN9C102 38
337#define VID_HARDWARE_ARV 39 338#define VID_HARDWARE_ARV 39
338 339
340#endif /* CONFIG_VIDEO_V4L1_COMPAT */
341
339#endif /* __LINUX_VIDEODEV_H */ 342#endif /* __LINUX_VIDEODEV_H */
340 343
341/* 344/*
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index a62673dad76e..b7146956a929 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -716,7 +716,7 @@ struct v4l2_ext_control
716 __s64 value64; 716 __s64 value64;
717 void *reserved; 717 void *reserved;
718 }; 718 };
719}; 719} __attribute__ ((packed));
720 720
721struct v4l2_ext_controls 721struct v4l2_ext_controls
722{ 722{
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 62dae1a8c441..f8665326ed9f 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -341,11 +341,14 @@ extern int video_usercopy(struct inode *inode, struct file *file,
341extern struct video_device* video_devdata(struct file*); 341extern struct video_device* video_devdata(struct file*);
342 342
343#define to_video_device(cd) container_of(cd, struct video_device, class_dev) 343#define to_video_device(cd) container_of(cd, struct video_device, class_dev)
344static inline void 344static inline int
345video_device_create_file(struct video_device *vfd, 345video_device_create_file(struct video_device *vfd,
346 struct class_device_attribute *attr) 346 struct class_device_attribute *attr)
347{ 347{
348 class_device_create_file(&vfd->class_dev, attr); 348 int ret = class_device_create_file(&vfd->class_dev, attr);
349 if (ret < 0)
350 printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
351 return ret;
349} 352}
350static inline void 353static inline void
351video_device_remove_file(struct video_device *vfd, 354video_device_remove_file(struct video_device *vfd,
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 2fec827c8801..c0398f5a8cb9 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -54,15 +54,13 @@ struct unix_skb_parms {
54 struct ucred creds; /* Skb credentials */ 54 struct ucred creds; /* Skb credentials */
55 struct scm_fp_list *fp; /* Passed files */ 55 struct scm_fp_list *fp; /* Passed files */
56#ifdef CONFIG_SECURITY_NETWORK 56#ifdef CONFIG_SECURITY_NETWORK
57 char *secdata; /* Security context */ 57 u32 secid; /* Security ID */
58 u32 seclen; /* Security length */
59#endif 58#endif
60}; 59};
61 60
62#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) 61#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
63#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 62#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
64#define UNIXSECDATA(skb) (&UNIXCB((skb)).secdata) 63#define UNIXSID(skb) (&UNIXCB((skb)).secid)
65#define UNIXSECLEN(skb) (&UNIXCB((skb)).seclen)
66 64
67#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) 65#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock)
68#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) 66#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index ab29dafb1a6a..96b0e66406ec 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -139,16 +139,22 @@ extern rwlock_t rt6_lock;
139/* 139/*
140 * Store a destination cache entry in a socket 140 * Store a destination cache entry in a socket
141 */ 141 */
142static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst, 142static inline void __ip6_dst_store(struct sock *sk, struct dst_entry *dst,
143 struct in6_addr *daddr) 143 struct in6_addr *daddr)
144{ 144{
145 struct ipv6_pinfo *np = inet6_sk(sk); 145 struct ipv6_pinfo *np = inet6_sk(sk);
146 struct rt6_info *rt = (struct rt6_info *) dst; 146 struct rt6_info *rt = (struct rt6_info *) dst;
147 147
148 write_lock(&sk->sk_dst_lock);
149 sk_setup_caps(sk, dst); 148 sk_setup_caps(sk, dst);
150 np->daddr_cache = daddr; 149 np->daddr_cache = daddr;
151 np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0; 150 np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
151}
152
153static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
154 struct in6_addr *daddr)
155{
156 write_lock(&sk->sk_dst_lock);
157 __ip6_dst_store(sk, dst, daddr);
152 write_unlock(&sk->sk_dst_lock); 158 write_unlock(&sk->sk_dst_lock);
153} 159}
154 160
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index a8fdf7970b37..ece7e8a84ffd 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -468,6 +468,9 @@ extern void ip6_flush_pending_frames(struct sock *sk);
468extern int ip6_dst_lookup(struct sock *sk, 468extern int ip6_dst_lookup(struct sock *sk,
469 struct dst_entry **dst, 469 struct dst_entry **dst,
470 struct flowi *fl); 470 struct flowi *fl);
471extern int ip6_sk_dst_lookup(struct sock *sk,
472 struct dst_entry **dst,
473 struct flowi *fl);
471 474
472/* 475/*
473 * skb processing functions 476 * skb processing functions
diff --git a/include/net/netdma.h b/include/net/netdma.h
index ceae5ee85c04..7f53cd1d8b1e 100644
--- a/include/net/netdma.h
+++ b/include/net/netdma.h
@@ -29,7 +29,7 @@ static inline struct dma_chan *get_softnet_dma(void)
29{ 29{
30 struct dma_chan *chan; 30 struct dma_chan *chan;
31 rcu_read_lock(); 31 rcu_read_lock();
32 chan = rcu_dereference(__get_cpu_var(softnet_data.net_dma)); 32 chan = rcu_dereference(__get_cpu_var(softnet_data).net_dma);
33 if (chan) 33 if (chan)
34 dma_chan_get(chan); 34 dma_chan_get(chan);
35 rcu_read_unlock(); 35 rcu_read_unlock();
diff --git a/include/net/netevent.h b/include/net/netevent.h
new file mode 100644
index 000000000000..e5d216241423
--- /dev/null
+++ b/include/net/netevent.h
@@ -0,0 +1,33 @@
1#ifndef _NET_EVENT_H
2#define _NET_EVENT_H
3
4/*
5 * Generic netevent notifiers
6 *
7 * Authors:
8 * Tom Tucker <tom@opengridcomputing.com>
9 * Steve Wise <swise@opengridcomputing.com>
10 *
11 * Changes:
12 */
13#ifdef __KERNEL__
14
15#include <net/dst.h>
16
17struct netevent_redirect {
18 struct dst_entry *old;
19 struct dst_entry *new;
20};
21
22enum netevent_notif_type {
23 NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */
24 NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */
25 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
26};
27
28extern int register_netevent_notifier(struct notifier_block *nb);
29extern int unregister_netevent_notifier(struct notifier_block *nb);
30extern int call_netevent_notifiers(unsigned long val, void *v);
31
32#endif
33#endif
diff --git a/include/net/scm.h b/include/net/scm.h
index 02daa097cdcd..5637d5e22d5f 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/limits.h> 4#include <linux/limits.h>
5#include <linux/net.h> 5#include <linux/net.h>
6#include <linux/security.h>
6 7
7/* Well, we should have at least one descriptor open 8/* Well, we should have at least one descriptor open
8 * to accept passed FDs 8) 9 * to accept passed FDs 8)
@@ -20,8 +21,7 @@ struct scm_cookie
20 struct ucred creds; /* Skb credentials */ 21 struct ucred creds; /* Skb credentials */
21 struct scm_fp_list *fp; /* Passed files */ 22 struct scm_fp_list *fp; /* Passed files */
22#ifdef CONFIG_SECURITY_NETWORK 23#ifdef CONFIG_SECURITY_NETWORK
23 char *secdata; /* Security context */ 24 u32 secid; /* Passed security ID */
24 u32 seclen; /* Security length */
25#endif 25#endif
26 unsigned long seq; /* Connection seqno */ 26 unsigned long seq; /* Connection seqno */
27}; 27};
@@ -32,6 +32,16 @@ extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie
32extern void __scm_destroy(struct scm_cookie *scm); 32extern void __scm_destroy(struct scm_cookie *scm);
33extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); 33extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl);
34 34
35#ifdef CONFIG_SECURITY_NETWORK
36static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
37{
38 security_socket_getpeersec_dgram(sock, NULL, &scm->secid);
39}
40#else
41static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
42{ }
43#endif /* CONFIG_SECURITY_NETWORK */
44
35static __inline__ void scm_destroy(struct scm_cookie *scm) 45static __inline__ void scm_destroy(struct scm_cookie *scm)
36{ 46{
37 if (scm && scm->fp) 47 if (scm && scm->fp)
@@ -47,6 +57,7 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
47 scm->creds.pid = p->tgid; 57 scm->creds.pid = p->tgid;
48 scm->fp = NULL; 58 scm->fp = NULL;
49 scm->seq = 0; 59 scm->seq = 0;
60 unix_get_peersec_dgram(sock, scm);
50 if (msg->msg_controllen <= 0) 61 if (msg->msg_controllen <= 0)
51 return 0; 62 return 0;
52 return __scm_send(sock, msg, scm); 63 return __scm_send(sock, msg, scm);
@@ -55,8 +66,18 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
55#ifdef CONFIG_SECURITY_NETWORK 66#ifdef CONFIG_SECURITY_NETWORK
56static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) 67static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
57{ 68{
58 if (test_bit(SOCK_PASSSEC, &sock->flags) && scm->secdata != NULL) 69 char *secdata;
59 put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, scm->seclen, scm->secdata); 70 u32 seclen;
71 int err;
72
73 if (test_bit(SOCK_PASSSEC, &sock->flags)) {
74 err = security_secid_to_secctx(scm->secid, &secdata, &seclen);
75
76 if (!err) {
77 put_cmsg(msg, SOL_SOCKET, SCM_SECURITY, seclen, secdata);
78 security_release_secctx(secdata, seclen);
79 }
80 }
60} 81}
61#else 82#else
62static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm) 83static inline void scm_passec(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0720bddff1e9..7a093d0aa0fe 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -914,6 +914,9 @@ static inline void tcp_set_state(struct sock *sk, int state)
914 914
915static inline void tcp_done(struct sock *sk) 915static inline void tcp_done(struct sock *sk)
916{ 916{
917 if(sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
918 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
919
917 tcp_set_state(sk, TCP_CLOSE); 920 tcp_set_state(sk, TCP_CLOSE);
918 tcp_clear_xmit_timers(sk); 921 tcp_clear_xmit_timers(sk);
919 922
diff --git a/ipc/msg.c b/ipc/msg.c
index cd92d342953e..2b4fccf8ea55 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * linux/ipc/msg.c 2 * linux/ipc/msg.c
3 * Copyright (C) 1992 Krishna Balasubramanian 3 * Copyright (C) 1992 Krishna Balasubramanian
4 * 4 *
5 * Removed all the remaining kerneld mess 5 * Removed all the remaining kerneld mess
6 * Catch the -EFAULT stuff properly 6 * Catch the -EFAULT stuff properly
@@ -41,22 +41,24 @@ int msg_ctlmax = MSGMAX;
41int msg_ctlmnb = MSGMNB; 41int msg_ctlmnb = MSGMNB;
42int msg_ctlmni = MSGMNI; 42int msg_ctlmni = MSGMNI;
43 43
44/* one msg_receiver structure for each sleeping receiver */ 44/*
45 * one msg_receiver structure for each sleeping receiver:
46 */
45struct msg_receiver { 47struct msg_receiver {
46 struct list_head r_list; 48 struct list_head r_list;
47 struct task_struct* r_tsk; 49 struct task_struct *r_tsk;
48 50
49 int r_mode; 51 int r_mode;
50 long r_msgtype; 52 long r_msgtype;
51 long r_maxsize; 53 long r_maxsize;
52 54
53 struct msg_msg* volatile r_msg; 55 volatile struct msg_msg *r_msg;
54}; 56};
55 57
56/* one msg_sender for each sleeping sender */ 58/* one msg_sender for each sleeping sender */
57struct msg_sender { 59struct msg_sender {
58 struct list_head list; 60 struct list_head list;
59 struct task_struct* tsk; 61 struct task_struct *tsk;
60}; 62};
61 63
62#define SEARCH_ANY 1 64#define SEARCH_ANY 1
@@ -64,45 +66,42 @@ struct msg_sender {
64#define SEARCH_NOTEQUAL 3 66#define SEARCH_NOTEQUAL 3
65#define SEARCH_LESSEQUAL 4 67#define SEARCH_LESSEQUAL 4
66 68
67static atomic_t msg_bytes = ATOMIC_INIT(0); 69static atomic_t msg_bytes = ATOMIC_INIT(0);
68static atomic_t msg_hdrs = ATOMIC_INIT(0); 70static atomic_t msg_hdrs = ATOMIC_INIT(0);
69 71
70static struct ipc_ids msg_ids; 72static struct ipc_ids msg_ids;
71 73
72#define msg_lock(id) ((struct msg_queue*)ipc_lock(&msg_ids,id)) 74#define msg_lock(id) ((struct msg_queue *)ipc_lock(&msg_ids, id))
73#define msg_unlock(msq) ipc_unlock(&(msq)->q_perm) 75#define msg_unlock(msq) ipc_unlock(&(msq)->q_perm)
74#define msg_rmid(id) ((struct msg_queue*)ipc_rmid(&msg_ids,id)) 76#define msg_rmid(id) ((struct msg_queue *)ipc_rmid(&msg_ids, id))
75#define msg_checkid(msq, msgid) \ 77#define msg_checkid(msq, msgid) ipc_checkid(&msg_ids, &msq->q_perm, msgid)
76 ipc_checkid(&msg_ids,&msq->q_perm,msgid) 78#define msg_buildid(id, seq) ipc_buildid(&msg_ids, id, seq)
77#define msg_buildid(id, seq) \
78 ipc_buildid(&msg_ids, id, seq)
79 79
80static void freeque (struct msg_queue *msq, int id); 80static void freeque(struct msg_queue *msq, int id);
81static int newque (key_t key, int msgflg); 81static int newque(key_t key, int msgflg);
82#ifdef CONFIG_PROC_FS 82#ifdef CONFIG_PROC_FS
83static int sysvipc_msg_proc_show(struct seq_file *s, void *it); 83static int sysvipc_msg_proc_show(struct seq_file *s, void *it);
84#endif 84#endif
85 85
86void __init msg_init (void) 86void __init msg_init(void)
87{ 87{
88 ipc_init_ids(&msg_ids,msg_ctlmni); 88 ipc_init_ids(&msg_ids, msg_ctlmni);
89 ipc_init_proc_interface("sysvipc/msg", 89 ipc_init_proc_interface("sysvipc/msg",
90 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n", 90 " key msqid perms cbytes qnum lspid lrpid uid gid cuid cgid stime rtime ctime\n",
91 &msg_ids, 91 &msg_ids,
92 sysvipc_msg_proc_show); 92 sysvipc_msg_proc_show);
93} 93}
94 94
95static int newque (key_t key, int msgflg) 95static int newque(key_t key, int msgflg)
96{ 96{
97 int id;
98 int retval;
99 struct msg_queue *msq; 97 struct msg_queue *msq;
98 int id, retval;
100 99
101 msq = ipc_rcu_alloc(sizeof(*msq)); 100 msq = ipc_rcu_alloc(sizeof(*msq));
102 if (!msq) 101 if (!msq)
103 return -ENOMEM; 102 return -ENOMEM;
104 103
105 msq->q_perm.mode = (msgflg & S_IRWXUGO); 104 msq->q_perm.mode = msgflg & S_IRWXUGO;
106 msq->q_perm.key = key; 105 msq->q_perm.key = key;
107 106
108 msq->q_perm.security = NULL; 107 msq->q_perm.security = NULL;
@@ -113,13 +112,13 @@ static int newque (key_t key, int msgflg)
113 } 112 }
114 113
115 id = ipc_addid(&msg_ids, &msq->q_perm, msg_ctlmni); 114 id = ipc_addid(&msg_ids, &msq->q_perm, msg_ctlmni);
116 if(id == -1) { 115 if (id == -1) {
117 security_msg_queue_free(msq); 116 security_msg_queue_free(msq);
118 ipc_rcu_putref(msq); 117 ipc_rcu_putref(msq);
119 return -ENOSPC; 118 return -ENOSPC;
120 } 119 }
121 120
122 msq->q_id = msg_buildid(id,msq->q_perm.seq); 121 msq->q_id = msg_buildid(id, msq->q_perm.seq);
123 msq->q_stime = msq->q_rtime = 0; 122 msq->q_stime = msq->q_rtime = 0;
124 msq->q_ctime = get_seconds(); 123 msq->q_ctime = get_seconds();
125 msq->q_cbytes = msq->q_qnum = 0; 124 msq->q_cbytes = msq->q_qnum = 0;
@@ -133,44 +132,44 @@ static int newque (key_t key, int msgflg)
133 return msq->q_id; 132 return msq->q_id;
134} 133}
135 134
136static inline void ss_add(struct msg_queue* msq, struct msg_sender* mss) 135static inline void ss_add(struct msg_queue *msq, struct msg_sender *mss)
137{ 136{
138 mss->tsk=current; 137 mss->tsk = current;
139 current->state=TASK_INTERRUPTIBLE; 138 current->state = TASK_INTERRUPTIBLE;
140 list_add_tail(&mss->list,&msq->q_senders); 139 list_add_tail(&mss->list, &msq->q_senders);
141} 140}
142 141
143static inline void ss_del(struct msg_sender* mss) 142static inline void ss_del(struct msg_sender *mss)
144{ 143{
145 if(mss->list.next != NULL) 144 if (mss->list.next != NULL)
146 list_del(&mss->list); 145 list_del(&mss->list);
147} 146}
148 147
149static void ss_wakeup(struct list_head* h, int kill) 148static void ss_wakeup(struct list_head *h, int kill)
150{ 149{
151 struct list_head *tmp; 150 struct list_head *tmp;
152 151
153 tmp = h->next; 152 tmp = h->next;
154 while (tmp != h) { 153 while (tmp != h) {
155 struct msg_sender* mss; 154 struct msg_sender *mss;
156 155
157 mss = list_entry(tmp,struct msg_sender,list); 156 mss = list_entry(tmp, struct msg_sender, list);
158 tmp = tmp->next; 157 tmp = tmp->next;
159 if(kill) 158 if (kill)
160 mss->list.next=NULL; 159 mss->list.next = NULL;
161 wake_up_process(mss->tsk); 160 wake_up_process(mss->tsk);
162 } 161 }
163} 162}
164 163
165static void expunge_all(struct msg_queue* msq, int res) 164static void expunge_all(struct msg_queue *msq, int res)
166{ 165{
167 struct list_head *tmp; 166 struct list_head *tmp;
168 167
169 tmp = msq->q_receivers.next; 168 tmp = msq->q_receivers.next;
170 while (tmp != &msq->q_receivers) { 169 while (tmp != &msq->q_receivers) {
171 struct msg_receiver* msr; 170 struct msg_receiver *msr;
172 171
173 msr = list_entry(tmp,struct msg_receiver,r_list); 172 msr = list_entry(tmp, struct msg_receiver, r_list);
174 tmp = tmp->next; 173 tmp = tmp->next;
175 msr->r_msg = NULL; 174 msr->r_msg = NULL;
176 wake_up_process(msr->r_tsk); 175 wake_up_process(msr->r_tsk);
@@ -178,26 +177,28 @@ static void expunge_all(struct msg_queue* msq, int res)
178 msr->r_msg = ERR_PTR(res); 177 msr->r_msg = ERR_PTR(res);
179 } 178 }
180} 179}
181/* 180
182 * freeque() wakes up waiters on the sender and receiver waiting queue, 181/*
183 * removes the message queue from message queue ID 182 * freeque() wakes up waiters on the sender and receiver waiting queue,
183 * removes the message queue from message queue ID
184 * array, and cleans up all the messages associated with this queue. 184 * array, and cleans up all the messages associated with this queue.
185 * 185 *
186 * msg_ids.mutex and the spinlock for this message queue is hold 186 * msg_ids.mutex and the spinlock for this message queue is hold
187 * before freeque() is called. msg_ids.mutex remains locked on exit. 187 * before freeque() is called. msg_ids.mutex remains locked on exit.
188 */ 188 */
189static void freeque (struct msg_queue *msq, int id) 189static void freeque(struct msg_queue *msq, int id)
190{ 190{
191 struct list_head *tmp; 191 struct list_head *tmp;
192 192
193 expunge_all(msq,-EIDRM); 193 expunge_all(msq, -EIDRM);
194 ss_wakeup(&msq->q_senders,1); 194 ss_wakeup(&msq->q_senders, 1);
195 msq = msg_rmid(id); 195 msq = msg_rmid(id);
196 msg_unlock(msq); 196 msg_unlock(msq);
197 197
198 tmp = msq->q_messages.next; 198 tmp = msq->q_messages.next;
199 while(tmp != &msq->q_messages) { 199 while (tmp != &msq->q_messages) {
200 struct msg_msg* msg = list_entry(tmp,struct msg_msg,m_list); 200 struct msg_msg *msg = list_entry(tmp, struct msg_msg, m_list);
201
201 tmp = tmp->next; 202 tmp = tmp->next;
202 atomic_dec(&msg_hdrs); 203 atomic_dec(&msg_hdrs);
203 free_msg(msg); 204 free_msg(msg);
@@ -207,10 +208,10 @@ static void freeque (struct msg_queue *msq, int id)
207 ipc_rcu_putref(msq); 208 ipc_rcu_putref(msq);
208} 209}
209 210
210asmlinkage long sys_msgget (key_t key, int msgflg) 211asmlinkage long sys_msgget(key_t key, int msgflg)
211{ 212{
212 int id, ret = -EPERM;
213 struct msg_queue *msq; 213 struct msg_queue *msq;
214 int id, ret = -EPERM;
214 215
215 mutex_lock(&msg_ids.mutex); 216 mutex_lock(&msg_ids.mutex);
216 if (key == IPC_PRIVATE) 217 if (key == IPC_PRIVATE)
@@ -224,31 +225,34 @@ asmlinkage long sys_msgget (key_t key, int msgflg)
224 ret = -EEXIST; 225 ret = -EEXIST;
225 } else { 226 } else {
226 msq = msg_lock(id); 227 msq = msg_lock(id);
227 BUG_ON(msq==NULL); 228 BUG_ON(msq == NULL);
228 if (ipcperms(&msq->q_perm, msgflg)) 229 if (ipcperms(&msq->q_perm, msgflg))
229 ret = -EACCES; 230 ret = -EACCES;
230 else { 231 else {
231 int qid = msg_buildid(id, msq->q_perm.seq); 232 int qid = msg_buildid(id, msq->q_perm.seq);
232 ret = security_msg_queue_associate(msq, msgflg); 233
234 ret = security_msg_queue_associate(msq, msgflg);
233 if (!ret) 235 if (!ret)
234 ret = qid; 236 ret = qid;
235 } 237 }
236 msg_unlock(msq); 238 msg_unlock(msq);
237 } 239 }
238 mutex_unlock(&msg_ids.mutex); 240 mutex_unlock(&msg_ids.mutex);
241
239 return ret; 242 return ret;
240} 243}
241 244
242static inline unsigned long copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version) 245static inline unsigned long
246copy_msqid_to_user(void __user *buf, struct msqid64_ds *in, int version)
243{ 247{
244 switch(version) { 248 switch(version) {
245 case IPC_64: 249 case IPC_64:
246 return copy_to_user (buf, in, sizeof(*in)); 250 return copy_to_user(buf, in, sizeof(*in));
247 case IPC_OLD: 251 case IPC_OLD:
248 { 252 {
249 struct msqid_ds out; 253 struct msqid_ds out;
250 254
251 memset(&out,0,sizeof(out)); 255 memset(&out, 0, sizeof(out));
252 256
253 ipc64_perm_to_ipc_perm(&in->msg_perm, &out.msg_perm); 257 ipc64_perm_to_ipc_perm(&in->msg_perm, &out.msg_perm);
254 258
@@ -256,18 +260,18 @@ static inline unsigned long copy_msqid_to_user(void __user *buf, struct msqid64_
256 out.msg_rtime = in->msg_rtime; 260 out.msg_rtime = in->msg_rtime;
257 out.msg_ctime = in->msg_ctime; 261 out.msg_ctime = in->msg_ctime;
258 262
259 if(in->msg_cbytes > USHRT_MAX) 263 if (in->msg_cbytes > USHRT_MAX)
260 out.msg_cbytes = USHRT_MAX; 264 out.msg_cbytes = USHRT_MAX;
261 else 265 else
262 out.msg_cbytes = in->msg_cbytes; 266 out.msg_cbytes = in->msg_cbytes;
263 out.msg_lcbytes = in->msg_cbytes; 267 out.msg_lcbytes = in->msg_cbytes;
264 268
265 if(in->msg_qnum > USHRT_MAX) 269 if (in->msg_qnum > USHRT_MAX)
266 out.msg_qnum = USHRT_MAX; 270 out.msg_qnum = USHRT_MAX;
267 else 271 else
268 out.msg_qnum = in->msg_qnum; 272 out.msg_qnum = in->msg_qnum;
269 273
270 if(in->msg_qbytes > USHRT_MAX) 274 if (in->msg_qbytes > USHRT_MAX)
271 out.msg_qbytes = USHRT_MAX; 275 out.msg_qbytes = USHRT_MAX;
272 else 276 else
273 out.msg_qbytes = in->msg_qbytes; 277 out.msg_qbytes = in->msg_qbytes;
@@ -276,8 +280,8 @@ static inline unsigned long copy_msqid_to_user(void __user *buf, struct msqid64_
276 out.msg_lspid = in->msg_lspid; 280 out.msg_lspid = in->msg_lspid;
277 out.msg_lrpid = in->msg_lrpid; 281 out.msg_lrpid = in->msg_lrpid;
278 282
279 return copy_to_user (buf, &out, sizeof(out)); 283 return copy_to_user(buf, &out, sizeof(out));
280 } 284 }
281 default: 285 default:
282 return -EINVAL; 286 return -EINVAL;
283 } 287 }
@@ -290,14 +294,15 @@ struct msq_setbuf {
290 mode_t mode; 294 mode_t mode;
291}; 295};
292 296
293static inline unsigned long copy_msqid_from_user(struct msq_setbuf *out, void __user *buf, int version) 297static inline unsigned long
298copy_msqid_from_user(struct msq_setbuf *out, void __user *buf, int version)
294{ 299{
295 switch(version) { 300 switch(version) {
296 case IPC_64: 301 case IPC_64:
297 { 302 {
298 struct msqid64_ds tbuf; 303 struct msqid64_ds tbuf;
299 304
300 if (copy_from_user (&tbuf, buf, sizeof (tbuf))) 305 if (copy_from_user(&tbuf, buf, sizeof(tbuf)))
301 return -EFAULT; 306 return -EFAULT;
302 307
303 out->qbytes = tbuf.msg_qbytes; 308 out->qbytes = tbuf.msg_qbytes;
@@ -306,60 +311,61 @@ static inline unsigned long copy_msqid_from_user(struct msq_setbuf *out, void __
306 out->mode = tbuf.msg_perm.mode; 311 out->mode = tbuf.msg_perm.mode;
307 312
308 return 0; 313 return 0;
309 } 314 }
310 case IPC_OLD: 315 case IPC_OLD:
311 { 316 {
312 struct msqid_ds tbuf_old; 317 struct msqid_ds tbuf_old;
313 318
314 if (copy_from_user (&tbuf_old, buf, sizeof (tbuf_old))) 319 if (copy_from_user(&tbuf_old, buf, sizeof(tbuf_old)))
315 return -EFAULT; 320 return -EFAULT;
316 321
317 out->uid = tbuf_old.msg_perm.uid; 322 out->uid = tbuf_old.msg_perm.uid;
318 out->gid = tbuf_old.msg_perm.gid; 323 out->gid = tbuf_old.msg_perm.gid;
319 out->mode = tbuf_old.msg_perm.mode; 324 out->mode = tbuf_old.msg_perm.mode;
320 325
321 if(tbuf_old.msg_qbytes == 0) 326 if (tbuf_old.msg_qbytes == 0)
322 out->qbytes = tbuf_old.msg_lqbytes; 327 out->qbytes = tbuf_old.msg_lqbytes;
323 else 328 else
324 out->qbytes = tbuf_old.msg_qbytes; 329 out->qbytes = tbuf_old.msg_qbytes;
325 330
326 return 0; 331 return 0;
327 } 332 }
328 default: 333 default:
329 return -EINVAL; 334 return -EINVAL;
330 } 335 }
331} 336}
332 337
333asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf) 338asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
334{ 339{
335 int err, version;
336 struct msg_queue *msq;
337 struct msq_setbuf setbuf;
338 struct kern_ipc_perm *ipcp; 340 struct kern_ipc_perm *ipcp;
339 341 struct msq_setbuf setbuf;
342 struct msg_queue *msq;
343 int err, version;
344
340 if (msqid < 0 || cmd < 0) 345 if (msqid < 0 || cmd < 0)
341 return -EINVAL; 346 return -EINVAL;
342 347
343 version = ipc_parse_version(&cmd); 348 version = ipc_parse_version(&cmd);
344 349
345 switch (cmd) { 350 switch (cmd) {
346 case IPC_INFO: 351 case IPC_INFO:
347 case MSG_INFO: 352 case MSG_INFO:
348 { 353 {
349 struct msginfo msginfo; 354 struct msginfo msginfo;
350 int max_id; 355 int max_id;
356
351 if (!buf) 357 if (!buf)
352 return -EFAULT; 358 return -EFAULT;
353 /* We must not return kernel stack data. 359 /*
360 * We must not return kernel stack data.
354 * due to padding, it's not enough 361 * due to padding, it's not enough
355 * to set all member fields. 362 * to set all member fields.
356 */ 363 */
357
358 err = security_msg_queue_msgctl(NULL, cmd); 364 err = security_msg_queue_msgctl(NULL, cmd);
359 if (err) 365 if (err)
360 return err; 366 return err;
361 367
362 memset(&msginfo,0,sizeof(msginfo)); 368 memset(&msginfo, 0, sizeof(msginfo));
363 msginfo.msgmni = msg_ctlmni; 369 msginfo.msgmni = msg_ctlmni;
364 msginfo.msgmax = msg_ctlmax; 370 msginfo.msgmax = msg_ctlmax;
365 msginfo.msgmnb = msg_ctlmnb; 371 msginfo.msgmnb = msg_ctlmnb;
@@ -377,36 +383,37 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf)
377 } 383 }
378 max_id = msg_ids.max_id; 384 max_id = msg_ids.max_id;
379 mutex_unlock(&msg_ids.mutex); 385 mutex_unlock(&msg_ids.mutex);
380 if (copy_to_user (buf, &msginfo, sizeof(struct msginfo))) 386 if (copy_to_user(buf, &msginfo, sizeof(struct msginfo)))
381 return -EFAULT; 387 return -EFAULT;
382 return (max_id < 0) ? 0: max_id; 388 return (max_id < 0) ? 0 : max_id;
383 } 389 }
384 case MSG_STAT: 390 case MSG_STAT:
385 case IPC_STAT: 391 case IPC_STAT:
386 { 392 {
387 struct msqid64_ds tbuf; 393 struct msqid64_ds tbuf;
388 int success_return; 394 int success_return;
395
389 if (!buf) 396 if (!buf)
390 return -EFAULT; 397 return -EFAULT;
391 if(cmd == MSG_STAT && msqid >= msg_ids.entries->size) 398 if (cmd == MSG_STAT && msqid >= msg_ids.entries->size)
392 return -EINVAL; 399 return -EINVAL;
393 400
394 memset(&tbuf,0,sizeof(tbuf)); 401 memset(&tbuf, 0, sizeof(tbuf));
395 402
396 msq = msg_lock(msqid); 403 msq = msg_lock(msqid);
397 if (msq == NULL) 404 if (msq == NULL)
398 return -EINVAL; 405 return -EINVAL;
399 406
400 if(cmd == MSG_STAT) { 407 if (cmd == MSG_STAT) {
401 success_return = msg_buildid(msqid, msq->q_perm.seq); 408 success_return = msg_buildid(msqid, msq->q_perm.seq);
402 } else { 409 } else {
403 err = -EIDRM; 410 err = -EIDRM;
404 if (msg_checkid(msq,msqid)) 411 if (msg_checkid(msq, msqid))
405 goto out_unlock; 412 goto out_unlock;
406 success_return = 0; 413 success_return = 0;
407 } 414 }
408 err = -EACCES; 415 err = -EACCES;
409 if (ipcperms (&msq->q_perm, S_IRUGO)) 416 if (ipcperms(&msq->q_perm, S_IRUGO))
410 goto out_unlock; 417 goto out_unlock;
411 418
412 err = security_msg_queue_msgctl(msq, cmd); 419 err = security_msg_queue_msgctl(msq, cmd);
@@ -430,7 +437,7 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf)
430 case IPC_SET: 437 case IPC_SET:
431 if (!buf) 438 if (!buf)
432 return -EFAULT; 439 return -EFAULT;
433 if (copy_msqid_from_user (&setbuf, buf, version)) 440 if (copy_msqid_from_user(&setbuf, buf, version))
434 return -EFAULT; 441 return -EFAULT;
435 break; 442 break;
436 case IPC_RMID: 443 case IPC_RMID:
@@ -441,12 +448,12 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf)
441 448
442 mutex_lock(&msg_ids.mutex); 449 mutex_lock(&msg_ids.mutex);
443 msq = msg_lock(msqid); 450 msq = msg_lock(msqid);
444 err=-EINVAL; 451 err = -EINVAL;
445 if (msq == NULL) 452 if (msq == NULL)
446 goto out_up; 453 goto out_up;
447 454
448 err = -EIDRM; 455 err = -EIDRM;
449 if (msg_checkid(msq,msqid)) 456 if (msg_checkid(msq, msqid))
450 goto out_unlock_up; 457 goto out_unlock_up;
451 ipcp = &msq->q_perm; 458 ipcp = &msq->q_perm;
452 459
@@ -454,15 +461,16 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf)
454 if (err) 461 if (err)
455 goto out_unlock_up; 462 goto out_unlock_up;
456 if (cmd==IPC_SET) { 463 if (cmd==IPC_SET) {
457 err = audit_ipc_set_perm(setbuf.qbytes, setbuf.uid, setbuf.gid, setbuf.mode); 464 err = audit_ipc_set_perm(setbuf.qbytes, setbuf.uid, setbuf.gid,
465 setbuf.mode);
458 if (err) 466 if (err)
459 goto out_unlock_up; 467 goto out_unlock_up;
460 } 468 }
461 469
462 err = -EPERM; 470 err = -EPERM;
463 if (current->euid != ipcp->cuid && 471 if (current->euid != ipcp->cuid &&
464 current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN)) 472 current->euid != ipcp->uid && !capable(CAP_SYS_ADMIN))
465 /* We _could_ check for CAP_CHOWN above, but we don't */ 473 /* We _could_ check for CAP_CHOWN above, but we don't */
466 goto out_unlock_up; 474 goto out_unlock_up;
467 475
468 err = security_msg_queue_msgctl(msq, cmd); 476 err = security_msg_queue_msgctl(msq, cmd);
@@ -480,22 +488,22 @@ asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds __user *buf)
480 488
481 ipcp->uid = setbuf.uid; 489 ipcp->uid = setbuf.uid;
482 ipcp->gid = setbuf.gid; 490 ipcp->gid = setbuf.gid;
483 ipcp->mode = (ipcp->mode & ~S_IRWXUGO) | 491 ipcp->mode = (ipcp->mode & ~S_IRWXUGO) |
484 (S_IRWXUGO & setbuf.mode); 492 (S_IRWXUGO & setbuf.mode);
485 msq->q_ctime = get_seconds(); 493 msq->q_ctime = get_seconds();
486 /* sleeping receivers might be excluded by 494 /* sleeping receivers might be excluded by
487 * stricter permissions. 495 * stricter permissions.
488 */ 496 */
489 expunge_all(msq,-EAGAIN); 497 expunge_all(msq, -EAGAIN);
490 /* sleeping senders might be able to send 498 /* sleeping senders might be able to send
491 * due to a larger queue size. 499 * due to a larger queue size.
492 */ 500 */
493 ss_wakeup(&msq->q_senders,0); 501 ss_wakeup(&msq->q_senders, 0);
494 msg_unlock(msq); 502 msg_unlock(msq);
495 break; 503 break;
496 } 504 }
497 case IPC_RMID: 505 case IPC_RMID:
498 freeque (msq, msqid); 506 freeque(msq, msqid);
499 break; 507 break;
500 } 508 }
501 err = 0; 509 err = 0;
@@ -510,41 +518,44 @@ out_unlock:
510 return err; 518 return err;
511} 519}
512 520
513static int testmsg(struct msg_msg* msg,long type,int mode) 521static int testmsg(struct msg_msg *msg, long type, int mode)
514{ 522{
515 switch(mode) 523 switch(mode)
516 { 524 {
517 case SEARCH_ANY: 525 case SEARCH_ANY:
518 return 1; 526 return 1;
519 case SEARCH_LESSEQUAL: 527 case SEARCH_LESSEQUAL:
520 if(msg->m_type <=type) 528 if (msg->m_type <=type)
521 return 1; 529 return 1;
522 break; 530 break;
523 case SEARCH_EQUAL: 531 case SEARCH_EQUAL:
524 if(msg->m_type == type) 532 if (msg->m_type == type)
525 return 1; 533 return 1;
526 break; 534 break;
527 case SEARCH_NOTEQUAL: 535 case SEARCH_NOTEQUAL:
528 if(msg->m_type != type) 536 if (msg->m_type != type)
529 return 1; 537 return 1;
530 break; 538 break;
531 } 539 }
532 return 0; 540 return 0;
533} 541}
534 542
535static inline int pipelined_send(struct msg_queue* msq, struct msg_msg* msg) 543static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
536{ 544{
537 struct list_head* tmp; 545 struct list_head *tmp;
538 546
539 tmp = msq->q_receivers.next; 547 tmp = msq->q_receivers.next;
540 while (tmp != &msq->q_receivers) { 548 while (tmp != &msq->q_receivers) {
541 struct msg_receiver* msr; 549 struct msg_receiver *msr;
542 msr = list_entry(tmp,struct msg_receiver,r_list); 550
551 msr = list_entry(tmp, struct msg_receiver, r_list);
543 tmp = tmp->next; 552 tmp = tmp->next;
544 if(testmsg(msg,msr->r_msgtype,msr->r_mode) && 553 if (testmsg(msg, msr->r_msgtype, msr->r_mode) &&
545 !security_msg_queue_msgrcv(msq, msg, msr->r_tsk, msr->r_msgtype, msr->r_mode)) { 554 !security_msg_queue_msgrcv(msq, msg, msr->r_tsk,
555 msr->r_msgtype, msr->r_mode)) {
556
546 list_del(&msr->r_list); 557 list_del(&msr->r_list);
547 if(msr->r_maxsize < msg->m_ts) { 558 if (msr->r_maxsize < msg->m_ts) {
548 msr->r_msg = NULL; 559 msr->r_msg = NULL;
549 wake_up_process(msr->r_tsk); 560 wake_up_process(msr->r_tsk);
550 smp_mb(); 561 smp_mb();
@@ -556,6 +567,7 @@ static inline int pipelined_send(struct msg_queue* msq, struct msg_msg* msg)
556 wake_up_process(msr->r_tsk); 567 wake_up_process(msr->r_tsk);
557 smp_mb(); 568 smp_mb();
558 msr->r_msg = msg; 569 msr->r_msg = msg;
570
559 return 1; 571 return 1;
560 } 572 }
561 } 573 }
@@ -563,40 +575,41 @@ static inline int pipelined_send(struct msg_queue* msq, struct msg_msg* msg)
563 return 0; 575 return 0;
564} 576}
565 577
566asmlinkage long sys_msgsnd (int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg) 578asmlinkage long
579sys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, int msgflg)
567{ 580{
568 struct msg_queue *msq; 581 struct msg_queue *msq;
569 struct msg_msg *msg; 582 struct msg_msg *msg;
570 long mtype; 583 long mtype;
571 int err; 584 int err;
572 585
573 if (msgsz > msg_ctlmax || (long) msgsz < 0 || msqid < 0) 586 if (msgsz > msg_ctlmax || (long) msgsz < 0 || msqid < 0)
574 return -EINVAL; 587 return -EINVAL;
575 if (get_user(mtype, &msgp->mtype)) 588 if (get_user(mtype, &msgp->mtype))
576 return -EFAULT; 589 return -EFAULT;
577 if (mtype < 1) 590 if (mtype < 1)
578 return -EINVAL; 591 return -EINVAL;
579 592
580 msg = load_msg(msgp->mtext, msgsz); 593 msg = load_msg(msgp->mtext, msgsz);
581 if(IS_ERR(msg)) 594 if (IS_ERR(msg))
582 return PTR_ERR(msg); 595 return PTR_ERR(msg);
583 596
584 msg->m_type = mtype; 597 msg->m_type = mtype;
585 msg->m_ts = msgsz; 598 msg->m_ts = msgsz;
586 599
587 msq = msg_lock(msqid); 600 msq = msg_lock(msqid);
588 err=-EINVAL; 601 err = -EINVAL;
589 if(msq==NULL) 602 if (msq == NULL)
590 goto out_free; 603 goto out_free;
591 604
592 err= -EIDRM; 605 err= -EIDRM;
593 if (msg_checkid(msq,msqid)) 606 if (msg_checkid(msq, msqid))
594 goto out_unlock_free; 607 goto out_unlock_free;
595 608
596 for (;;) { 609 for (;;) {
597 struct msg_sender s; 610 struct msg_sender s;
598 611
599 err=-EACCES; 612 err = -EACCES;
600 if (ipcperms(&msq->q_perm, S_IWUGO)) 613 if (ipcperms(&msq->q_perm, S_IWUGO))
601 goto out_unlock_free; 614 goto out_unlock_free;
602 615
@@ -604,14 +617,14 @@ asmlinkage long sys_msgsnd (int msqid, struct msgbuf __user *msgp, size_t msgsz,
604 if (err) 617 if (err)
605 goto out_unlock_free; 618 goto out_unlock_free;
606 619
607 if(msgsz + msq->q_cbytes <= msq->q_qbytes && 620 if (msgsz + msq->q_cbytes <= msq->q_qbytes &&
608 1 + msq->q_qnum <= msq->q_qbytes) { 621 1 + msq->q_qnum <= msq->q_qbytes) {
609 break; 622 break;
610 } 623 }
611 624
612 /* queue full, wait: */ 625 /* queue full, wait: */
613 if(msgflg&IPC_NOWAIT) { 626 if (msgflg & IPC_NOWAIT) {
614 err=-EAGAIN; 627 err = -EAGAIN;
615 goto out_unlock_free; 628 goto out_unlock_free;
616 } 629 }
617 ss_add(msq, &s); 630 ss_add(msq, &s);
@@ -626,9 +639,9 @@ asmlinkage long sys_msgsnd (int msqid, struct msgbuf __user *msgp, size_t msgsz,
626 goto out_unlock_free; 639 goto out_unlock_free;
627 } 640 }
628 ss_del(&s); 641 ss_del(&s);
629 642
630 if (signal_pending(current)) { 643 if (signal_pending(current)) {
631 err=-ERESTARTNOHAND; 644 err = -ERESTARTNOHAND;
632 goto out_unlock_free; 645 goto out_unlock_free;
633 } 646 }
634 } 647 }
@@ -636,47 +649,47 @@ asmlinkage long sys_msgsnd (int msqid, struct msgbuf __user *msgp, size_t msgsz,
636 msq->q_lspid = current->tgid; 649 msq->q_lspid = current->tgid;
637 msq->q_stime = get_seconds(); 650 msq->q_stime = get_seconds();
638 651
639 if(!pipelined_send(msq,msg)) { 652 if (!pipelined_send(msq, msg)) {
640 /* noone is waiting for this message, enqueue it */ 653 /* noone is waiting for this message, enqueue it */
641 list_add_tail(&msg->m_list,&msq->q_messages); 654 list_add_tail(&msg->m_list, &msq->q_messages);
642 msq->q_cbytes += msgsz; 655 msq->q_cbytes += msgsz;
643 msq->q_qnum++; 656 msq->q_qnum++;
644 atomic_add(msgsz,&msg_bytes); 657 atomic_add(msgsz, &msg_bytes);
645 atomic_inc(&msg_hdrs); 658 atomic_inc(&msg_hdrs);
646 } 659 }
647 660
648 err = 0; 661 err = 0;
649 msg = NULL; 662 msg = NULL;
650 663
651out_unlock_free: 664out_unlock_free:
652 msg_unlock(msq); 665 msg_unlock(msq);
653out_free: 666out_free:
654 if(msg!=NULL) 667 if (msg != NULL)
655 free_msg(msg); 668 free_msg(msg);
656 return err; 669 return err;
657} 670}
658 671
659static inline int convert_mode(long* msgtyp, int msgflg) 672static inline int convert_mode(long *msgtyp, int msgflg)
660{ 673{
661 /* 674 /*
662 * find message of correct type. 675 * find message of correct type.
663 * msgtyp = 0 => get first. 676 * msgtyp = 0 => get first.
664 * msgtyp > 0 => get first message of matching type. 677 * msgtyp > 0 => get first message of matching type.
665 * msgtyp < 0 => get message with least type must be < abs(msgtype). 678 * msgtyp < 0 => get message with least type must be < abs(msgtype).
666 */ 679 */
667 if(*msgtyp==0) 680 if (*msgtyp == 0)
668 return SEARCH_ANY; 681 return SEARCH_ANY;
669 if(*msgtyp<0) { 682 if (*msgtyp < 0) {
670 *msgtyp=-(*msgtyp); 683 *msgtyp = -*msgtyp;
671 return SEARCH_LESSEQUAL; 684 return SEARCH_LESSEQUAL;
672 } 685 }
673 if(msgflg & MSG_EXCEPT) 686 if (msgflg & MSG_EXCEPT)
674 return SEARCH_NOTEQUAL; 687 return SEARCH_NOTEQUAL;
675 return SEARCH_EQUAL; 688 return SEARCH_EQUAL;
676} 689}
677 690
678asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz, 691asmlinkage long sys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz,
679 long msgtyp, int msgflg) 692 long msgtyp, int msgflg)
680{ 693{
681 struct msg_queue *msq; 694 struct msg_queue *msq;
682 struct msg_msg *msg; 695 struct msg_msg *msg;
@@ -684,44 +697,51 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz,
684 697
685 if (msqid < 0 || (long) msgsz < 0) 698 if (msqid < 0 || (long) msgsz < 0)
686 return -EINVAL; 699 return -EINVAL;
687 mode = convert_mode(&msgtyp,msgflg); 700 mode = convert_mode(&msgtyp, msgflg);
688 701
689 msq = msg_lock(msqid); 702 msq = msg_lock(msqid);
690 if(msq==NULL) 703 if (msq == NULL)
691 return -EINVAL; 704 return -EINVAL;
692 705
693 msg = ERR_PTR(-EIDRM); 706 msg = ERR_PTR(-EIDRM);
694 if (msg_checkid(msq,msqid)) 707 if (msg_checkid(msq, msqid))
695 goto out_unlock; 708 goto out_unlock;
696 709
697 for (;;) { 710 for (;;) {
698 struct msg_receiver msr_d; 711 struct msg_receiver msr_d;
699 struct list_head* tmp; 712 struct list_head *tmp;
700 713
701 msg = ERR_PTR(-EACCES); 714 msg = ERR_PTR(-EACCES);
702 if (ipcperms (&msq->q_perm, S_IRUGO)) 715 if (ipcperms(&msq->q_perm, S_IRUGO))
703 goto out_unlock; 716 goto out_unlock;
704 717
705 msg = ERR_PTR(-EAGAIN); 718 msg = ERR_PTR(-EAGAIN);
706 tmp = msq->q_messages.next; 719 tmp = msq->q_messages.next;
707 while (tmp != &msq->q_messages) { 720 while (tmp != &msq->q_messages) {
708 struct msg_msg *walk_msg; 721 struct msg_msg *walk_msg;
709 walk_msg = list_entry(tmp,struct msg_msg,m_list); 722
710 if(testmsg(walk_msg,msgtyp,mode) && 723 walk_msg = list_entry(tmp, struct msg_msg, m_list);
711 !security_msg_queue_msgrcv(msq, walk_msg, current, msgtyp, mode)) { 724 if (testmsg(walk_msg, msgtyp, mode) &&
725 !security_msg_queue_msgrcv(msq, walk_msg, current,
726 msgtyp, mode)) {
727
712 msg = walk_msg; 728 msg = walk_msg;
713 if(mode == SEARCH_LESSEQUAL && walk_msg->m_type != 1) { 729 if (mode == SEARCH_LESSEQUAL &&
714 msg=walk_msg; 730 walk_msg->m_type != 1) {
715 msgtyp=walk_msg->m_type-1; 731 msg = walk_msg;
732 msgtyp = walk_msg->m_type - 1;
716 } else { 733 } else {
717 msg=walk_msg; 734 msg = walk_msg;
718 break; 735 break;
719 } 736 }
720 } 737 }
721 tmp = tmp->next; 738 tmp = tmp->next;
722 } 739 }
723 if(!IS_ERR(msg)) { 740 if (!IS_ERR(msg)) {
724 /* Found a suitable message. Unlink it from the queue. */ 741 /*
742 * Found a suitable message.
743 * Unlink it from the queue.
744 */
725 if ((msgsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) { 745 if ((msgsz < msg->m_ts) && !(msgflg & MSG_NOERROR)) {
726 msg = ERR_PTR(-E2BIG); 746 msg = ERR_PTR(-E2BIG);
727 goto out_unlock; 747 goto out_unlock;
@@ -731,9 +751,9 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz,
731 msq->q_rtime = get_seconds(); 751 msq->q_rtime = get_seconds();
732 msq->q_lrpid = current->tgid; 752 msq->q_lrpid = current->tgid;
733 msq->q_cbytes -= msg->m_ts; 753 msq->q_cbytes -= msg->m_ts;
734 atomic_sub(msg->m_ts,&msg_bytes); 754 atomic_sub(msg->m_ts, &msg_bytes);
735 atomic_dec(&msg_hdrs); 755 atomic_dec(&msg_hdrs);
736 ss_wakeup(&msq->q_senders,0); 756 ss_wakeup(&msq->q_senders, 0);
737 msg_unlock(msq); 757 msg_unlock(msq);
738 break; 758 break;
739 } 759 }
@@ -742,13 +762,13 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz,
742 msg = ERR_PTR(-ENOMSG); 762 msg = ERR_PTR(-ENOMSG);
743 goto out_unlock; 763 goto out_unlock;
744 } 764 }
745 list_add_tail(&msr_d.r_list,&msq->q_receivers); 765 list_add_tail(&msr_d.r_list, &msq->q_receivers);
746 msr_d.r_tsk = current; 766 msr_d.r_tsk = current;
747 msr_d.r_msgtype = msgtyp; 767 msr_d.r_msgtype = msgtyp;
748 msr_d.r_mode = mode; 768 msr_d.r_mode = mode;
749 if(msgflg & MSG_NOERROR) 769 if (msgflg & MSG_NOERROR)
750 msr_d.r_maxsize = INT_MAX; 770 msr_d.r_maxsize = INT_MAX;
751 else 771 else
752 msr_d.r_maxsize = msgsz; 772 msr_d.r_maxsize = msgsz;
753 msr_d.r_msg = ERR_PTR(-EAGAIN); 773 msr_d.r_msg = ERR_PTR(-EAGAIN);
754 current->state = TASK_INTERRUPTIBLE; 774 current->state = TASK_INTERRUPTIBLE;
@@ -773,17 +793,17 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz,
773 * wake_up_process(). There is a race with exit(), see 793 * wake_up_process(). There is a race with exit(), see
774 * ipc/mqueue.c for the details. 794 * ipc/mqueue.c for the details.
775 */ 795 */
776 msg = (struct msg_msg*) msr_d.r_msg; 796 msg = (struct msg_msg*)msr_d.r_msg;
777 while (msg == NULL) { 797 while (msg == NULL) {
778 cpu_relax(); 798 cpu_relax();
779 msg = (struct msg_msg*) msr_d.r_msg; 799 msg = (struct msg_msg *)msr_d.r_msg;
780 } 800 }
781 801
782 /* Lockless receive, part 3: 802 /* Lockless receive, part 3:
783 * If there is a message or an error then accept it without 803 * If there is a message or an error then accept it without
784 * locking. 804 * locking.
785 */ 805 */
786 if(msg != ERR_PTR(-EAGAIN)) { 806 if (msg != ERR_PTR(-EAGAIN)) {
787 rcu_read_unlock(); 807 rcu_read_unlock();
788 break; 808 break;
789 } 809 }
@@ -798,7 +818,7 @@ asmlinkage long sys_msgrcv (int msqid, struct msgbuf __user *msgp, size_t msgsz,
798 * Repeat test after acquiring the spinlock. 818 * Repeat test after acquiring the spinlock.
799 */ 819 */
800 msg = (struct msg_msg*)msr_d.r_msg; 820 msg = (struct msg_msg*)msr_d.r_msg;
801 if(msg != ERR_PTR(-EAGAIN)) 821 if (msg != ERR_PTR(-EAGAIN))
802 goto out_unlock; 822 goto out_unlock;
803 823
804 list_del(&msr_d.r_list); 824 list_del(&msr_d.r_list);
@@ -810,14 +830,15 @@ out_unlock:
810 } 830 }
811 } 831 }
812 if (IS_ERR(msg)) 832 if (IS_ERR(msg))
813 return PTR_ERR(msg); 833 return PTR_ERR(msg);
814 834
815 msgsz = (msgsz > msg->m_ts) ? msg->m_ts : msgsz; 835 msgsz = (msgsz > msg->m_ts) ? msg->m_ts : msgsz;
816 if (put_user (msg->m_type, &msgp->mtype) || 836 if (put_user (msg->m_type, &msgp->mtype) ||
817 store_msg(msgp->mtext, msg, msgsz)) { 837 store_msg(msgp->mtext, msg, msgsz)) {
818 msgsz = -EFAULT; 838 msgsz = -EFAULT;
819 } 839 }
820 free_msg(msg); 840 free_msg(msg);
841
821 return msgsz; 842 return msgsz;
822} 843}
823 844
@@ -827,20 +848,20 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
827 struct msg_queue *msq = it; 848 struct msg_queue *msq = it;
828 849
829 return seq_printf(s, 850 return seq_printf(s,
830 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n", 851 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
831 msq->q_perm.key, 852 msq->q_perm.key,
832 msq->q_id, 853 msq->q_id,
833 msq->q_perm.mode, 854 msq->q_perm.mode,
834 msq->q_cbytes, 855 msq->q_cbytes,
835 msq->q_qnum, 856 msq->q_qnum,
836 msq->q_lspid, 857 msq->q_lspid,
837 msq->q_lrpid, 858 msq->q_lrpid,
838 msq->q_perm.uid, 859 msq->q_perm.uid,
839 msq->q_perm.gid, 860 msq->q_perm.gid,
840 msq->q_perm.cuid, 861 msq->q_perm.cuid,
841 msq->q_perm.cgid, 862 msq->q_perm.cgid,
842 msq->q_stime, 863 msq->q_stime,
843 msq->q_rtime, 864 msq->q_rtime,
844 msq->q_ctime); 865 msq->q_ctime);
845} 866}
846#endif 867#endif
diff --git a/kernel/audit.c b/kernel/audit.c
index d417ca1db79b..0a36091ed712 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -690,9 +690,7 @@ static const struct inotify_operations audit_inotify_ops = {
690/* Initialize audit support at boot time. */ 690/* Initialize audit support at boot time. */
691static int __init audit_init(void) 691static int __init audit_init(void)
692{ 692{
693#ifdef CONFIG_AUDITSYSCALL
694 int i; 693 int i;
695#endif
696 694
697 printk(KERN_INFO "audit: initializing netlink socket (%s)\n", 695 printk(KERN_INFO "audit: initializing netlink socket (%s)\n",
698 audit_default ? "enabled" : "disabled"); 696 audit_default ? "enabled" : "disabled");
@@ -717,10 +715,10 @@ static int __init audit_init(void)
717 audit_ih = inotify_init(&audit_inotify_ops); 715 audit_ih = inotify_init(&audit_inotify_ops);
718 if (IS_ERR(audit_ih)) 716 if (IS_ERR(audit_ih))
719 audit_panic("cannot initialize inotify handle"); 717 audit_panic("cannot initialize inotify handle");
718#endif
720 719
721 for (i = 0; i < AUDIT_INODE_BUCKETS; i++) 720 for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
722 INIT_LIST_HEAD(&audit_inode_hash[i]); 721 INIT_LIST_HEAD(&audit_inode_hash[i]);
723#endif
724 722
725 return 0; 723 return 0;
726} 724}
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 5b4e16276ca0..6a9a5c5a4e7d 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -442,6 +442,7 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)
442 case AUDIT_EQUAL: 442 case AUDIT_EQUAL:
443 break; 443 break;
444 default: 444 default:
445 err = -EINVAL;
445 goto exit_free; 446 goto exit_free;
446 } 447 }
447 } 448 }
@@ -579,6 +580,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
579 case AUDIT_EQUAL: 580 case AUDIT_EQUAL:
580 break; 581 break;
581 default: 582 default:
583 err = -EINVAL;
582 goto exit_free; 584 goto exit_free;
583 } 585 }
584 } 586 }
@@ -1134,6 +1136,14 @@ static inline int audit_add_rule(struct audit_entry *entry,
1134 struct audit_watch *watch = entry->rule.watch; 1136 struct audit_watch *watch = entry->rule.watch;
1135 struct nameidata *ndp, *ndw; 1137 struct nameidata *ndp, *ndw;
1136 int h, err, putnd_needed = 0; 1138 int h, err, putnd_needed = 0;
1139#ifdef CONFIG_AUDITSYSCALL
1140 int dont_count = 0;
1141
1142 /* If either of these, don't count towards total */
1143 if (entry->rule.listnr == AUDIT_FILTER_USER ||
1144 entry->rule.listnr == AUDIT_FILTER_TYPE)
1145 dont_count = 1;
1146#endif
1137 1147
1138 if (inode_f) { 1148 if (inode_f) {
1139 h = audit_hash_ino(inode_f->val); 1149 h = audit_hash_ino(inode_f->val);
@@ -1174,6 +1184,10 @@ static inline int audit_add_rule(struct audit_entry *entry,
1174 } else { 1184 } else {
1175 list_add_tail_rcu(&entry->list, list); 1185 list_add_tail_rcu(&entry->list, list);
1176 } 1186 }
1187#ifdef CONFIG_AUDITSYSCALL
1188 if (!dont_count)
1189 audit_n_rules++;
1190#endif
1177 mutex_unlock(&audit_filter_mutex); 1191 mutex_unlock(&audit_filter_mutex);
1178 1192
1179 if (putnd_needed) 1193 if (putnd_needed)
@@ -1198,6 +1212,14 @@ static inline int audit_del_rule(struct audit_entry *entry,
1198 struct audit_watch *watch, *tmp_watch = entry->rule.watch; 1212 struct audit_watch *watch, *tmp_watch = entry->rule.watch;
1199 LIST_HEAD(inotify_list); 1213 LIST_HEAD(inotify_list);
1200 int h, ret = 0; 1214 int h, ret = 0;
1215#ifdef CONFIG_AUDITSYSCALL
1216 int dont_count = 0;
1217
1218 /* If either of these, don't count towards total */
1219 if (entry->rule.listnr == AUDIT_FILTER_USER ||
1220 entry->rule.listnr == AUDIT_FILTER_TYPE)
1221 dont_count = 1;
1222#endif
1201 1223
1202 if (inode_f) { 1224 if (inode_f) {
1203 h = audit_hash_ino(inode_f->val); 1225 h = audit_hash_ino(inode_f->val);
@@ -1235,6 +1257,10 @@ static inline int audit_del_rule(struct audit_entry *entry,
1235 list_del_rcu(&e->list); 1257 list_del_rcu(&e->list);
1236 call_rcu(&e->rcu, audit_free_rule_rcu); 1258 call_rcu(&e->rcu, audit_free_rule_rcu);
1237 1259
1260#ifdef CONFIG_AUDITSYSCALL
1261 if (!dont_count)
1262 audit_n_rules--;
1263#endif
1238 mutex_unlock(&audit_filter_mutex); 1264 mutex_unlock(&audit_filter_mutex);
1239 1265
1240 if (!list_empty(&inotify_list)) 1266 if (!list_empty(&inotify_list))
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ae40ac8c39e7..efc1b74bebf3 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -85,6 +85,9 @@ extern int audit_enabled;
85/* Indicates that audit should log the full pathname. */ 85/* Indicates that audit should log the full pathname. */
86#define AUDIT_NAME_FULL -1 86#define AUDIT_NAME_FULL -1
87 87
88/* number of audit rules */
89int audit_n_rules;
90
88/* When fs/namei.c:getname() is called, we store the pointer in name and 91/* When fs/namei.c:getname() is called, we store the pointer in name and
89 * we don't let putname() free it (instead we free all of the saved 92 * we don't let putname() free it (instead we free all of the saved
90 * pointers at syscall exit time). 93 * pointers at syscall exit time).
@@ -174,6 +177,7 @@ struct audit_aux_data_path {
174 177
175/* The per-task audit context. */ 178/* The per-task audit context. */
176struct audit_context { 179struct audit_context {
180 int dummy; /* must be the first element */
177 int in_syscall; /* 1 if task is in a syscall */ 181 int in_syscall; /* 1 if task is in a syscall */
178 enum audit_state state; 182 enum audit_state state;
179 unsigned int serial; /* serial number for record */ 183 unsigned int serial; /* serial number for record */
@@ -514,7 +518,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk,
514 context->return_valid = return_valid; 518 context->return_valid = return_valid;
515 context->return_code = return_code; 519 context->return_code = return_code;
516 520
517 if (context->in_syscall && !context->auditable) { 521 if (context->in_syscall && !context->dummy && !context->auditable) {
518 enum audit_state state; 522 enum audit_state state;
519 523
520 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]); 524 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]);
@@ -530,17 +534,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk,
530 } 534 }
531 535
532get_context: 536get_context:
533 context->pid = tsk->pid; 537
534 context->ppid = sys_getppid(); /* sic. tsk == current in all cases */
535 context->uid = tsk->uid;
536 context->gid = tsk->gid;
537 context->euid = tsk->euid;
538 context->suid = tsk->suid;
539 context->fsuid = tsk->fsuid;
540 context->egid = tsk->egid;
541 context->sgid = tsk->sgid;
542 context->fsgid = tsk->fsgid;
543 context->personality = tsk->personality;
544 tsk->audit_context = NULL; 538 tsk->audit_context = NULL;
545 return context; 539 return context;
546} 540}
@@ -749,6 +743,17 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
749 const char *tty; 743 const char *tty;
750 744
751 /* tsk == current */ 745 /* tsk == current */
746 context->pid = tsk->pid;
747 context->ppid = sys_getppid(); /* sic. tsk == current in all cases */
748 context->uid = tsk->uid;
749 context->gid = tsk->gid;
750 context->euid = tsk->euid;
751 context->suid = tsk->suid;
752 context->fsuid = tsk->fsuid;
753 context->egid = tsk->egid;
754 context->sgid = tsk->sgid;
755 context->fsgid = tsk->fsgid;
756 context->personality = tsk->personality;
752 757
753 ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL); 758 ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL);
754 if (!ab) 759 if (!ab)
@@ -1066,7 +1071,8 @@ void audit_syscall_entry(int arch, int major,
1066 context->argv[3] = a4; 1071 context->argv[3] = a4;
1067 1072
1068 state = context->state; 1073 state = context->state;
1069 if (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT) 1074 context->dummy = !audit_n_rules;
1075 if (!context->dummy && (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT))
1070 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]); 1076 state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]);
1071 if (likely(state == AUDIT_DISABLED)) 1077 if (likely(state == AUDIT_DISABLED))
1072 return; 1078 return;
@@ -1199,14 +1205,18 @@ void audit_putname(const char *name)
1199#endif 1205#endif
1200} 1206}
1201 1207
1202static void audit_inode_context(int idx, const struct inode *inode) 1208/* Copy inode data into an audit_names. */
1209static void audit_copy_inode(struct audit_names *name, const struct inode *inode)
1203{ 1210{
1204 struct audit_context *context = current->audit_context; 1211 name->ino = inode->i_ino;
1205 1212 name->dev = inode->i_sb->s_dev;
1206 selinux_get_inode_sid(inode, &context->names[idx].osid); 1213 name->mode = inode->i_mode;
1214 name->uid = inode->i_uid;
1215 name->gid = inode->i_gid;
1216 name->rdev = inode->i_rdev;
1217 selinux_get_inode_sid(inode, &name->osid);
1207} 1218}
1208 1219
1209
1210/** 1220/**
1211 * audit_inode - store the inode and device from a lookup 1221 * audit_inode - store the inode and device from a lookup
1212 * @name: name being audited 1222 * @name: name being audited
@@ -1240,20 +1250,14 @@ void __audit_inode(const char *name, const struct inode *inode)
1240 ++context->ino_count; 1250 ++context->ino_count;
1241#endif 1251#endif
1242 } 1252 }
1243 context->names[idx].ino = inode->i_ino; 1253 audit_copy_inode(&context->names[idx], inode);
1244 context->names[idx].dev = inode->i_sb->s_dev;
1245 context->names[idx].mode = inode->i_mode;
1246 context->names[idx].uid = inode->i_uid;
1247 context->names[idx].gid = inode->i_gid;
1248 context->names[idx].rdev = inode->i_rdev;
1249 audit_inode_context(idx, inode);
1250} 1254}
1251 1255
1252/** 1256/**
1253 * audit_inode_child - collect inode info for created/removed objects 1257 * audit_inode_child - collect inode info for created/removed objects
1254 * @dname: inode's dentry name 1258 * @dname: inode's dentry name
1255 * @inode: inode being audited 1259 * @inode: inode being audited
1256 * @pino: inode number of dentry parent 1260 * @parent: inode of dentry parent
1257 * 1261 *
1258 * For syscalls that create or remove filesystem objects, audit_inode 1262 * For syscalls that create or remove filesystem objects, audit_inode
1259 * can only collect information for the filesystem object's parent. 1263 * can only collect information for the filesystem object's parent.
@@ -1264,7 +1268,7 @@ void __audit_inode(const char *name, const struct inode *inode)
1264 * unsuccessful attempts. 1268 * unsuccessful attempts.
1265 */ 1269 */
1266void __audit_inode_child(const char *dname, const struct inode *inode, 1270void __audit_inode_child(const char *dname, const struct inode *inode,
1267 unsigned long pino) 1271 const struct inode *parent)
1268{ 1272{
1269 int idx; 1273 int idx;
1270 struct audit_context *context = current->audit_context; 1274 struct audit_context *context = current->audit_context;
@@ -1278,7 +1282,7 @@ void __audit_inode_child(const char *dname, const struct inode *inode,
1278 if (!dname) 1282 if (!dname)
1279 goto update_context; 1283 goto update_context;
1280 for (idx = 0; idx < context->name_count; idx++) 1284 for (idx = 0; idx < context->name_count; idx++)
1281 if (context->names[idx].ino == pino) { 1285 if (context->names[idx].ino == parent->i_ino) {
1282 const char *name = context->names[idx].name; 1286 const char *name = context->names[idx].name;
1283 1287
1284 if (!name) 1288 if (!name)
@@ -1302,16 +1306,47 @@ update_context:
1302 context->names[idx].name_len = AUDIT_NAME_FULL; 1306 context->names[idx].name_len = AUDIT_NAME_FULL;
1303 context->names[idx].name_put = 0; /* don't call __putname() */ 1307 context->names[idx].name_put = 0; /* don't call __putname() */
1304 1308
1305 if (inode) { 1309 if (!inode)
1306 context->names[idx].ino = inode->i_ino; 1310 context->names[idx].ino = (unsigned long)-1;
1307 context->names[idx].dev = inode->i_sb->s_dev; 1311 else
1308 context->names[idx].mode = inode->i_mode; 1312 audit_copy_inode(&context->names[idx], inode);
1309 context->names[idx].uid = inode->i_uid; 1313
1310 context->names[idx].gid = inode->i_gid; 1314 /* A parent was not found in audit_names, so copy the inode data for the
1311 context->names[idx].rdev = inode->i_rdev; 1315 * provided parent. */
1312 audit_inode_context(idx, inode); 1316 if (!found_name) {
1313 } else 1317 idx = context->name_count++;
1314 context->names[idx].ino = (unsigned long)-1; 1318#if AUDIT_DEBUG
1319 context->ino_count++;
1320#endif
1321 audit_copy_inode(&context->names[idx], parent);
1322 }
1323}
1324
1325/**
1326 * audit_inode_update - update inode info for last collected name
1327 * @inode: inode being audited
1328 *
1329 * When open() is called on an existing object with the O_CREAT flag, the inode
1330 * data audit initially collects is incorrect. This additional hook ensures
1331 * audit has the inode data for the actual object to be opened.
1332 */
1333void __audit_inode_update(const struct inode *inode)
1334{
1335 struct audit_context *context = current->audit_context;
1336 int idx;
1337
1338 if (!context->in_syscall || !inode)
1339 return;
1340
1341 if (context->name_count == 0) {
1342 context->name_count++;
1343#if AUDIT_DEBUG
1344 context->ino_count++;
1345#endif
1346 }
1347 idx = context->name_count - 1;
1348
1349 audit_copy_inode(&context->names[idx], inode);
1315} 1350}
1316 1351
1317/** 1352/**
@@ -1642,7 +1677,7 @@ int audit_bprm(struct linux_binprm *bprm)
1642 unsigned long p, next; 1677 unsigned long p, next;
1643 void *to; 1678 void *to;
1644 1679
1645 if (likely(!audit_enabled || !context)) 1680 if (likely(!audit_enabled || !context || context->dummy))
1646 return 0; 1681 return 0;
1647 1682
1648 ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p, 1683 ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p,
@@ -1680,7 +1715,7 @@ int audit_socketcall(int nargs, unsigned long *args)
1680 struct audit_aux_data_socketcall *ax; 1715 struct audit_aux_data_socketcall *ax;
1681 struct audit_context *context = current->audit_context; 1716 struct audit_context *context = current->audit_context;
1682 1717
1683 if (likely(!context)) 1718 if (likely(!context || context->dummy))
1684 return 0; 1719 return 0;
1685 1720
1686 ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL); 1721 ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL);
@@ -1708,7 +1743,7 @@ int audit_sockaddr(int len, void *a)
1708 struct audit_aux_data_sockaddr *ax; 1743 struct audit_aux_data_sockaddr *ax;
1709 struct audit_context *context = current->audit_context; 1744 struct audit_context *context = current->audit_context;
1710 1745
1711 if (likely(!context)) 1746 if (likely(!context || context->dummy))
1712 return 0; 1747 return 0;
1713 1748
1714 ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL); 1749 ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL);
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index f05392d64267..57ca3730205d 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -19,15 +19,15 @@
19#include <linux/sysctl.h> 19#include <linux/sysctl.h>
20#include <linux/delayacct.h> 20#include <linux/delayacct.h>
21 21
22int delayacct_on __read_mostly; /* Delay accounting turned on/off */ 22int delayacct_on __read_mostly = 1; /* Delay accounting turned on/off */
23kmem_cache_t *delayacct_cache; 23kmem_cache_t *delayacct_cache;
24 24
25static int __init delayacct_setup_enable(char *str) 25static int __init delayacct_setup_disable(char *str)
26{ 26{
27 delayacct_on = 1; 27 delayacct_on = 0;
28 return 1; 28 return 1;
29} 29}
30__setup("delayacct", delayacct_setup_enable); 30__setup("nodelayacct", delayacct_setup_disable);
31 31
32void delayacct_init(void) 32void delayacct_init(void)
33{ 33{
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index d17766d40dab..be989efc7856 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -835,7 +835,7 @@ static void migrate_hrtimers(int cpu)
835} 835}
836#endif /* CONFIG_HOTPLUG_CPU */ 836#endif /* CONFIG_HOTPLUG_CPU */
837 837
838static int __devinit hrtimer_cpu_notify(struct notifier_block *self, 838static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self,
839 unsigned long action, void *hcpu) 839 unsigned long action, void *hcpu)
840{ 840{
841 long cpu = (long)hcpu; 841 long cpu = (long)hcpu;
@@ -859,7 +859,7 @@ static int __devinit hrtimer_cpu_notify(struct notifier_block *self,
859 return NOTIFY_OK; 859 return NOTIFY_OK;
860} 860}
861 861
862static struct notifier_block __devinitdata hrtimers_nb = { 862static struct notifier_block __cpuinitdata hrtimers_nb = {
863 .notifier_call = hrtimer_cpu_notify, 863 .notifier_call = hrtimer_cpu_notify,
864}; 864};
865 865
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 4e461438e48b..92be519eff26 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -137,16 +137,40 @@ EXPORT_SYMBOL(enable_irq);
137 * @irq: interrupt to control 137 * @irq: interrupt to control
138 * @on: enable/disable power management wakeup 138 * @on: enable/disable power management wakeup
139 * 139 *
140 * Enable/disable power management wakeup mode 140 * Enable/disable power management wakeup mode, which is
141 * disabled by default. Enables and disables must match,
142 * just as they match for non-wakeup mode support.
143 *
144 * Wakeup mode lets this IRQ wake the system from sleep
145 * states like "suspend to RAM".
141 */ 146 */
142int set_irq_wake(unsigned int irq, unsigned int on) 147int set_irq_wake(unsigned int irq, unsigned int on)
143{ 148{
144 struct irq_desc *desc = irq_desc + irq; 149 struct irq_desc *desc = irq_desc + irq;
145 unsigned long flags; 150 unsigned long flags;
146 int ret = -ENXIO; 151 int ret = -ENXIO;
152 int (*set_wake)(unsigned, unsigned) = desc->chip->set_wake;
147 153
154 /* wakeup-capable irqs can be shared between drivers that
155 * don't need to have the same sleep mode behaviors.
156 */
148 spin_lock_irqsave(&desc->lock, flags); 157 spin_lock_irqsave(&desc->lock, flags);
149 if (desc->chip->set_wake) 158 if (on) {
159 if (desc->wake_depth++ == 0)
160 desc->status |= IRQ_WAKEUP;
161 else
162 set_wake = NULL;
163 } else {
164 if (desc->wake_depth == 0) {
165 printk(KERN_WARNING "Unbalanced IRQ %d "
166 "wake disable\n", irq);
167 WARN_ON(1);
168 } else if (--desc->wake_depth == 0)
169 desc->status &= ~IRQ_WAKEUP;
170 else
171 set_wake = NULL;
172 }
173 if (set_wake)
150 ret = desc->chip->set_wake(irq, on); 174 ret = desc->chip->set_wake(irq, on);
151 spin_unlock_irqrestore(&desc->lock, flags); 175 spin_unlock_irqrestore(&desc->lock, flags);
152 return ret; 176 return ret;
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 64aab081153b..3f57dfdc8f92 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -393,6 +393,7 @@ static int __kprobes add_new_kprobe(struct kprobe *old_p, struct kprobe *p)
393static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p) 393static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p)
394{ 394{
395 copy_kprobe(p, ap); 395 copy_kprobe(p, ap);
396 flush_insn_slot(ap);
396 ap->addr = p->addr; 397 ap->addr = p->addr;
397 ap->pre_handler = aggr_pre_handler; 398 ap->pre_handler = aggr_pre_handler;
398 ap->fault_handler = aggr_fault_handler; 399 ap->fault_handler = aggr_fault_handler;
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 759805c9859a..436ab35f6fa7 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -548,7 +548,7 @@ static void __devinit rcu_online_cpu(int cpu)
548 tasklet_init(&per_cpu(rcu_tasklet, cpu), rcu_process_callbacks, 0UL); 548 tasklet_init(&per_cpu(rcu_tasklet, cpu), rcu_process_callbacks, 0UL);
549} 549}
550 550
551static int __devinit rcu_cpu_notify(struct notifier_block *self, 551static int __cpuinit rcu_cpu_notify(struct notifier_block *self,
552 unsigned long action, void *hcpu) 552 unsigned long action, void *hcpu)
553{ 553{
554 long cpu = (long)hcpu; 554 long cpu = (long)hcpu;
@@ -565,7 +565,7 @@ static int __devinit rcu_cpu_notify(struct notifier_block *self,
565 return NOTIFY_OK; 565 return NOTIFY_OK;
566} 566}
567 567
568static struct notifier_block __devinitdata rcu_nb = { 568static struct notifier_block __cpuinitdata rcu_nb = {
569 .notifier_call = rcu_cpu_notify, 569 .notifier_call = rcu_cpu_notify,
570}; 570};
571 571
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index d2ef13b485e7..3e13a1e5856f 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -7,6 +7,8 @@
7 * Copyright (C) 2005-2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com> 7 * Copyright (C) 2005-2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com>
8 * Copyright (C) 2005 Kihon Technologies Inc., Steven Rostedt 8 * Copyright (C) 2005 Kihon Technologies Inc., Steven Rostedt
9 * Copyright (C) 2006 Esben Nielsen 9 * Copyright (C) 2006 Esben Nielsen
10 *
11 * See Documentation/rt-mutex-design.txt for details.
10 */ 12 */
11#include <linux/spinlock.h> 13#include <linux/spinlock.h>
12#include <linux/module.h> 14#include <linux/module.h>
diff --git a/kernel/sched.c b/kernel/sched.c
index b44b9a43b0fc..a2be2d055299 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4456,9 +4456,9 @@ asmlinkage long sys_sched_yield(void)
4456 return 0; 4456 return 0;
4457} 4457}
4458 4458
4459static inline int __resched_legal(void) 4459static inline int __resched_legal(int expected_preempt_count)
4460{ 4460{
4461 if (unlikely(preempt_count())) 4461 if (unlikely(preempt_count() != expected_preempt_count))
4462 return 0; 4462 return 0;
4463 if (unlikely(system_state != SYSTEM_RUNNING)) 4463 if (unlikely(system_state != SYSTEM_RUNNING))
4464 return 0; 4464 return 0;
@@ -4484,7 +4484,7 @@ static void __cond_resched(void)
4484 4484
4485int __sched cond_resched(void) 4485int __sched cond_resched(void)
4486{ 4486{
4487 if (need_resched() && __resched_legal()) { 4487 if (need_resched() && __resched_legal(0)) {
4488 __cond_resched(); 4488 __cond_resched();
4489 return 1; 4489 return 1;
4490 } 4490 }
@@ -4510,7 +4510,7 @@ int cond_resched_lock(spinlock_t *lock)
4510 ret = 1; 4510 ret = 1;
4511 spin_lock(lock); 4511 spin_lock(lock);
4512 } 4512 }
4513 if (need_resched() && __resched_legal()) { 4513 if (need_resched() && __resched_legal(1)) {
4514 spin_release(&lock->dep_map, 1, _THIS_IP_); 4514 spin_release(&lock->dep_map, 1, _THIS_IP_);
4515 _raw_spin_unlock(lock); 4515 _raw_spin_unlock(lock);
4516 preempt_enable_no_resched(); 4516 preempt_enable_no_resched();
@@ -4526,7 +4526,7 @@ int __sched cond_resched_softirq(void)
4526{ 4526{
4527 BUG_ON(!in_softirq()); 4527 BUG_ON(!in_softirq());
4528 4528
4529 if (need_resched() && __resched_legal()) { 4529 if (need_resched() && __resched_legal(0)) {
4530 raw_local_irq_disable(); 4530 raw_local_irq_disable();
4531 _local_bh_enable(); 4531 _local_bh_enable();
4532 raw_local_irq_enable(); 4532 raw_local_irq_enable();
@@ -6494,7 +6494,12 @@ static int build_sched_domains(const cpumask_t *cpu_map)
6494 for (i = 0; i < MAX_NUMNODES; i++) 6494 for (i = 0; i < MAX_NUMNODES; i++)
6495 init_numa_sched_groups_power(sched_group_nodes[i]); 6495 init_numa_sched_groups_power(sched_group_nodes[i]);
6496 6496
6497 init_numa_sched_groups_power(sched_group_allnodes); 6497 if (sched_group_allnodes) {
6498 int group = cpu_to_allnodes_group(first_cpu(*cpu_map));
6499 struct sched_group *sg = &sched_group_allnodes[group];
6500
6501 init_numa_sched_groups_power(sg);
6502 }
6498#endif 6503#endif
6499 6504
6500 /* Attach the domains */ 6505 /* Attach the domains */
@@ -6761,6 +6766,11 @@ void __init sched_init(void)
6761 } 6766 }
6762 6767
6763 set_load_weight(&init_task); 6768 set_load_weight(&init_task);
6769
6770#ifdef CONFIG_RT_MUTEXES
6771 plist_head_init(&init_task.pi_waiters, &init_task.pi_lock);
6772#endif
6773
6764 /* 6774 /*
6765 * The boot idle thread does lazy MMU switching as well: 6775 * The boot idle thread does lazy MMU switching as well:
6766 */ 6776 */
diff --git a/kernel/signal.c b/kernel/signal.c
index 7fe874d12fae..bfdb5686fa3e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -791,22 +791,31 @@ out:
791/* 791/*
792 * Force a signal that the process can't ignore: if necessary 792 * Force a signal that the process can't ignore: if necessary
793 * we unblock the signal and change any SIG_IGN to SIG_DFL. 793 * we unblock the signal and change any SIG_IGN to SIG_DFL.
794 *
795 * Note: If we unblock the signal, we always reset it to SIG_DFL,
796 * since we do not want to have a signal handler that was blocked
797 * be invoked when user space had explicitly blocked it.
798 *
799 * We don't want to have recursive SIGSEGV's etc, for example.
794 */ 800 */
795
796int 801int
797force_sig_info(int sig, struct siginfo *info, struct task_struct *t) 802force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
798{ 803{
799 unsigned long int flags; 804 unsigned long int flags;
800 int ret; 805 int ret, blocked, ignored;
806 struct k_sigaction *action;
801 807
802 spin_lock_irqsave(&t->sighand->siglock, flags); 808 spin_lock_irqsave(&t->sighand->siglock, flags);
803 if (t->sighand->action[sig-1].sa.sa_handler == SIG_IGN) { 809 action = &t->sighand->action[sig-1];
804 t->sighand->action[sig-1].sa.sa_handler = SIG_DFL; 810 ignored = action->sa.sa_handler == SIG_IGN;
805 } 811 blocked = sigismember(&t->blocked, sig);
806 if (sigismember(&t->blocked, sig)) { 812 if (blocked || ignored) {
807 sigdelset(&t->blocked, sig); 813 action->sa.sa_handler = SIG_DFL;
814 if (blocked) {
815 sigdelset(&t->blocked, sig);
816 recalc_sigpending_tsk(t);
817 }
808 } 818 }
809 recalc_sigpending_tsk(t);
810 ret = specific_send_sig_info(sig, info, t); 819 ret = specific_send_sig_info(sig, info, t);
811 spin_unlock_irqrestore(&t->sighand->siglock, flags); 820 spin_unlock_irqrestore(&t->sighand->siglock, flags);
812 821
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 0f08a84ae307..3789ca98197c 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -65,6 +65,7 @@ static inline void wakeup_softirqd(void)
65 * This one is for softirq.c-internal use, 65 * This one is for softirq.c-internal use,
66 * where hardirqs are disabled legitimately: 66 * where hardirqs are disabled legitimately:
67 */ 67 */
68#ifdef CONFIG_TRACE_IRQFLAGS
68static void __local_bh_disable(unsigned long ip) 69static void __local_bh_disable(unsigned long ip)
69{ 70{
70 unsigned long flags; 71 unsigned long flags;
@@ -80,6 +81,13 @@ static void __local_bh_disable(unsigned long ip)
80 trace_softirqs_off(ip); 81 trace_softirqs_off(ip);
81 raw_local_irq_restore(flags); 82 raw_local_irq_restore(flags);
82} 83}
84#else /* !CONFIG_TRACE_IRQFLAGS */
85static inline void __local_bh_disable(unsigned long ip)
86{
87 add_preempt_count(SOFTIRQ_OFFSET);
88 barrier();
89}
90#endif /* CONFIG_TRACE_IRQFLAGS */
83 91
84void local_bh_disable(void) 92void local_bh_disable(void)
85{ 93{
@@ -121,12 +129,16 @@ EXPORT_SYMBOL(_local_bh_enable);
121 129
122void local_bh_enable(void) 130void local_bh_enable(void)
123{ 131{
132#ifdef CONFIG_TRACE_IRQFLAGS
124 unsigned long flags; 133 unsigned long flags;
125 134
126 WARN_ON_ONCE(in_irq()); 135 WARN_ON_ONCE(in_irq());
136#endif
127 WARN_ON_ONCE(irqs_disabled()); 137 WARN_ON_ONCE(irqs_disabled());
128 138
139#ifdef CONFIG_TRACE_IRQFLAGS
129 local_irq_save(flags); 140 local_irq_save(flags);
141#endif
130 /* 142 /*
131 * Are softirqs going to be turned on now: 143 * Are softirqs going to be turned on now:
132 */ 144 */
@@ -142,18 +154,22 @@ void local_bh_enable(void)
142 do_softirq(); 154 do_softirq();
143 155
144 dec_preempt_count(); 156 dec_preempt_count();
157#ifdef CONFIG_TRACE_IRQFLAGS
145 local_irq_restore(flags); 158 local_irq_restore(flags);
159#endif
146 preempt_check_resched(); 160 preempt_check_resched();
147} 161}
148EXPORT_SYMBOL(local_bh_enable); 162EXPORT_SYMBOL(local_bh_enable);
149 163
150void local_bh_enable_ip(unsigned long ip) 164void local_bh_enable_ip(unsigned long ip)
151{ 165{
166#ifdef CONFIG_TRACE_IRQFLAGS
152 unsigned long flags; 167 unsigned long flags;
153 168
154 WARN_ON_ONCE(in_irq()); 169 WARN_ON_ONCE(in_irq());
155 170
156 local_irq_save(flags); 171 local_irq_save(flags);
172#endif
157 /* 173 /*
158 * Are softirqs going to be turned on now: 174 * Are softirqs going to be turned on now:
159 */ 175 */
@@ -169,7 +185,9 @@ void local_bh_enable_ip(unsigned long ip)
169 do_softirq(); 185 do_softirq();
170 186
171 dec_preempt_count(); 187 dec_preempt_count();
188#ifdef CONFIG_TRACE_IRQFLAGS
172 local_irq_restore(flags); 189 local_irq_restore(flags);
190#endif
173 preempt_check_resched(); 191 preempt_check_resched();
174} 192}
175EXPORT_SYMBOL(local_bh_enable_ip); 193EXPORT_SYMBOL(local_bh_enable_ip);
@@ -547,7 +565,7 @@ static void takeover_tasklets(unsigned int cpu)
547} 565}
548#endif /* CONFIG_HOTPLUG_CPU */ 566#endif /* CONFIG_HOTPLUG_CPU */
549 567
550static int __devinit cpu_callback(struct notifier_block *nfb, 568static int __cpuinit cpu_callback(struct notifier_block *nfb,
551 unsigned long action, 569 unsigned long action,
552 void *hcpu) 570 void *hcpu)
553{ 571{
@@ -587,7 +605,7 @@ static int __devinit cpu_callback(struct notifier_block *nfb,
587 return NOTIFY_OK; 605 return NOTIFY_OK;
588} 606}
589 607
590static struct notifier_block __devinitdata cpu_nfb = { 608static struct notifier_block __cpuinitdata cpu_nfb = {
591 .notifier_call = cpu_callback 609 .notifier_call = cpu_callback
592}; 610};
593 611
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index 6b76caa22981..03e6a2b0b787 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -104,7 +104,7 @@ static int watchdog(void * __bind_cpu)
104/* 104/*
105 * Create/destroy watchdog threads as CPUs come and go: 105 * Create/destroy watchdog threads as CPUs come and go:
106 */ 106 */
107static int __devinit 107static int __cpuinit
108cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 108cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
109{ 109{
110 int hotcpu = (unsigned long)hcpu; 110 int hotcpu = (unsigned long)hcpu;
@@ -142,7 +142,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
142 return NOTIFY_OK; 142 return NOTIFY_OK;
143} 143}
144 144
145static struct notifier_block __devinitdata cpu_nfb = { 145static struct notifier_block __cpuinitdata cpu_nfb = {
146 .notifier_call = cpu_callback 146 .notifier_call = cpu_callback
147}; 147};
148 148
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index f45179ce028e..e78187657330 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -121,46 +121,45 @@ static int send_reply(struct sk_buff *skb, pid_t pid)
121/* 121/*
122 * Send taskstats data in @skb to listeners registered for @cpu's exit data 122 * Send taskstats data in @skb to listeners registered for @cpu's exit data
123 */ 123 */
124static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu) 124static void send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
125{ 125{
126 struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); 126 struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data);
127 struct listener_list *listeners; 127 struct listener_list *listeners;
128 struct listener *s, *tmp; 128 struct listener *s, *tmp;
129 struct sk_buff *skb_next, *skb_cur = skb; 129 struct sk_buff *skb_next, *skb_cur = skb;
130 void *reply = genlmsg_data(genlhdr); 130 void *reply = genlmsg_data(genlhdr);
131 int rc, ret, delcount = 0; 131 int rc, delcount = 0;
132 132
133 rc = genlmsg_end(skb, reply); 133 rc = genlmsg_end(skb, reply);
134 if (rc < 0) { 134 if (rc < 0) {
135 nlmsg_free(skb); 135 nlmsg_free(skb);
136 return rc; 136 return;
137 } 137 }
138 138
139 rc = 0; 139 rc = 0;
140 listeners = &per_cpu(listener_array, cpu); 140 listeners = &per_cpu(listener_array, cpu);
141 down_read(&listeners->sem); 141 down_read(&listeners->sem);
142 list_for_each_entry_safe(s, tmp, &listeners->list, list) { 142 list_for_each_entry(s, &listeners->list, list) {
143 skb_next = NULL; 143 skb_next = NULL;
144 if (!list_is_last(&s->list, &listeners->list)) { 144 if (!list_is_last(&s->list, &listeners->list)) {
145 skb_next = skb_clone(skb_cur, GFP_KERNEL); 145 skb_next = skb_clone(skb_cur, GFP_KERNEL);
146 if (!skb_next) { 146 if (!skb_next)
147 nlmsg_free(skb_cur);
148 rc = -ENOMEM;
149 break; 147 break;
150 }
151 } 148 }
152 ret = genlmsg_unicast(skb_cur, s->pid); 149 rc = genlmsg_unicast(skb_cur, s->pid);
153 if (ret == -ECONNREFUSED) { 150 if (rc == -ECONNREFUSED) {
154 s->valid = 0; 151 s->valid = 0;
155 delcount++; 152 delcount++;
156 rc = ret;
157 } 153 }
158 skb_cur = skb_next; 154 skb_cur = skb_next;
159 } 155 }
160 up_read(&listeners->sem); 156 up_read(&listeners->sem);
161 157
158 if (skb_cur)
159 nlmsg_free(skb_cur);
160
162 if (!delcount) 161 if (!delcount)
163 return rc; 162 return;
164 163
165 /* Delete invalidated entries */ 164 /* Delete invalidated entries */
166 down_write(&listeners->sem); 165 down_write(&listeners->sem);
@@ -171,13 +170,12 @@ static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
171 } 170 }
172 } 171 }
173 up_write(&listeners->sem); 172 up_write(&listeners->sem);
174 return rc;
175} 173}
176 174
177static int fill_pid(pid_t pid, struct task_struct *pidtsk, 175static int fill_pid(pid_t pid, struct task_struct *pidtsk,
178 struct taskstats *stats) 176 struct taskstats *stats)
179{ 177{
180 int rc; 178 int rc = 0;
181 struct task_struct *tsk = pidtsk; 179 struct task_struct *tsk = pidtsk;
182 180
183 if (!pidtsk) { 181 if (!pidtsk) {
@@ -196,12 +194,10 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
196 * Each accounting subsystem adds calls to its functions to 194 * Each accounting subsystem adds calls to its functions to
197 * fill in relevant parts of struct taskstsats as follows 195 * fill in relevant parts of struct taskstsats as follows
198 * 196 *
199 * rc = per-task-foo(stats, tsk); 197 * per-task-foo(stats, tsk);
200 * if (rc)
201 * goto err;
202 */ 198 */
203 199
204 rc = delayacct_add_tsk(stats, tsk); 200 delayacct_add_tsk(stats, tsk);
205 stats->version = TASKSTATS_VERSION; 201 stats->version = TASKSTATS_VERSION;
206 202
207 /* Define err: label here if needed */ 203 /* Define err: label here if needed */
diff --git a/kernel/timer.c b/kernel/timer.c
index 05809c2e2fd6..b650f04888ed 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -84,7 +84,7 @@ typedef struct tvec_t_base_s tvec_base_t;
84 84
85tvec_base_t boot_tvec_bases; 85tvec_base_t boot_tvec_bases;
86EXPORT_SYMBOL(boot_tvec_bases); 86EXPORT_SYMBOL(boot_tvec_bases);
87static DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = { &boot_tvec_bases }; 87static DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = &boot_tvec_bases;
88 88
89static inline void set_running_timer(tvec_base_t *base, 89static inline void set_running_timer(tvec_base_t *base,
90 struct timer_list *timer) 90 struct timer_list *timer)
@@ -408,7 +408,7 @@ static int cascade(tvec_base_t *base, tvec_t *tv, int index)
408 * This function cascades all vectors and executes all expired timer 408 * This function cascades all vectors and executes all expired timer
409 * vectors. 409 * vectors.
410 */ 410 */
411#define INDEX(N) (base->timer_jiffies >> (TVR_BITS + N * TVN_BITS)) & TVN_MASK 411#define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK)
412 412
413static inline void __run_timers(tvec_base_t *base) 413static inline void __run_timers(tvec_base_t *base)
414{ 414{
@@ -1688,7 +1688,7 @@ static void __devinit migrate_timers(int cpu)
1688} 1688}
1689#endif /* CONFIG_HOTPLUG_CPU */ 1689#endif /* CONFIG_HOTPLUG_CPU */
1690 1690
1691static int __devinit timer_cpu_notify(struct notifier_block *self, 1691static int __cpuinit timer_cpu_notify(struct notifier_block *self,
1692 unsigned long action, void *hcpu) 1692 unsigned long action, void *hcpu)
1693{ 1693{
1694 long cpu = (long)hcpu; 1694 long cpu = (long)hcpu;
@@ -1708,7 +1708,7 @@ static int __devinit timer_cpu_notify(struct notifier_block *self,
1708 return NOTIFY_OK; 1708 return NOTIFY_OK;
1709} 1709}
1710 1710
1711static struct notifier_block __devinitdata timers_nb = { 1711static struct notifier_block __cpuinitdata timers_nb = {
1712 .notifier_call = timer_cpu_notify, 1712 .notifier_call = timer_cpu_notify,
1713}; 1713};
1714 1714
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index eebb1d839235..448e8f7b342d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -93,9 +93,12 @@ static void __queue_work(struct cpu_workqueue_struct *cwq,
93 spin_unlock_irqrestore(&cwq->lock, flags); 93 spin_unlock_irqrestore(&cwq->lock, flags);
94} 94}
95 95
96/* 96/**
97 * Queue work on a workqueue. Return non-zero if it was successfully 97 * queue_work - queue work on a workqueue
98 * added. 98 * @wq: workqueue to use
99 * @work: work to queue
100 *
101 * Returns non-zero if it was successfully added.
99 * 102 *
100 * We queue the work to the CPU it was submitted, but there is no 103 * We queue the work to the CPU it was submitted, but there is no
101 * guarantee that it will be processed by that CPU. 104 * guarantee that it will be processed by that CPU.
@@ -128,6 +131,14 @@ static void delayed_work_timer_fn(unsigned long __data)
128 __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work); 131 __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work);
129} 132}
130 133
134/**
135 * queue_delayed_work - queue work on a workqueue after delay
136 * @wq: workqueue to use
137 * @work: work to queue
138 * @delay: number of jiffies to wait before queueing
139 *
140 * Returns non-zero if it was successfully added.
141 */
131int fastcall queue_delayed_work(struct workqueue_struct *wq, 142int fastcall queue_delayed_work(struct workqueue_struct *wq,
132 struct work_struct *work, unsigned long delay) 143 struct work_struct *work, unsigned long delay)
133{ 144{
@@ -150,6 +161,15 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq,
150} 161}
151EXPORT_SYMBOL_GPL(queue_delayed_work); 162EXPORT_SYMBOL_GPL(queue_delayed_work);
152 163
164/**
165 * queue_delayed_work_on - queue work on specific CPU after delay
166 * @cpu: CPU number to execute work on
167 * @wq: workqueue to use
168 * @work: work to queue
169 * @delay: number of jiffies to wait before queueing
170 *
171 * Returns non-zero if it was successfully added.
172 */
153int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 173int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
154 struct work_struct *work, unsigned long delay) 174 struct work_struct *work, unsigned long delay)
155{ 175{
@@ -275,8 +295,9 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
275 } 295 }
276} 296}
277 297
278/* 298/**
279 * flush_workqueue - ensure that any scheduled work has run to completion. 299 * flush_workqueue - ensure that any scheduled work has run to completion.
300 * @wq: workqueue to flush
280 * 301 *
281 * Forces execution of the workqueue and blocks until its completion. 302 * Forces execution of the workqueue and blocks until its completion.
282 * This is typically used in driver shutdown handlers. 303 * This is typically used in driver shutdown handlers.
@@ -400,6 +421,12 @@ static void cleanup_workqueue_thread(struct workqueue_struct *wq, int cpu)
400 kthread_stop(p); 421 kthread_stop(p);
401} 422}
402 423
424/**
425 * destroy_workqueue - safely terminate a workqueue
426 * @wq: target workqueue
427 *
428 * Safely destroy a workqueue. All work currently pending will be done first.
429 */
403void destroy_workqueue(struct workqueue_struct *wq) 430void destroy_workqueue(struct workqueue_struct *wq)
404{ 431{
405 int cpu; 432 int cpu;
@@ -425,18 +452,41 @@ EXPORT_SYMBOL_GPL(destroy_workqueue);
425 452
426static struct workqueue_struct *keventd_wq; 453static struct workqueue_struct *keventd_wq;
427 454
455/**
456 * schedule_work - put work task in global workqueue
457 * @work: job to be done
458 *
459 * This puts a job in the kernel-global workqueue.
460 */
428int fastcall schedule_work(struct work_struct *work) 461int fastcall schedule_work(struct work_struct *work)
429{ 462{
430 return queue_work(keventd_wq, work); 463 return queue_work(keventd_wq, work);
431} 464}
432EXPORT_SYMBOL(schedule_work); 465EXPORT_SYMBOL(schedule_work);
433 466
467/**
468 * schedule_delayed_work - put work task in global workqueue after delay
469 * @work: job to be done
470 * @delay: number of jiffies to wait
471 *
472 * After waiting for a given time this puts a job in the kernel-global
473 * workqueue.
474 */
434int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay) 475int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay)
435{ 476{
436 return queue_delayed_work(keventd_wq, work, delay); 477 return queue_delayed_work(keventd_wq, work, delay);
437} 478}
438EXPORT_SYMBOL(schedule_delayed_work); 479EXPORT_SYMBOL(schedule_delayed_work);
439 480
481/**
482 * schedule_delayed_work_on - queue work in global workqueue on CPU after delay
483 * @cpu: cpu to use
484 * @work: job to be done
485 * @delay: number of jiffies to wait
486 *
487 * After waiting for a given time this puts a job in the kernel-global
488 * workqueue on the specified CPU.
489 */
440int schedule_delayed_work_on(int cpu, 490int schedule_delayed_work_on(int cpu,
441 struct work_struct *work, unsigned long delay) 491 struct work_struct *work, unsigned long delay)
442{ 492{
diff --git a/lib/zlib_inflate/inflate.c b/lib/zlib_inflate/inflate.c
index 7f922dccf1a5..fceb97c3aff7 100644
--- a/lib/zlib_inflate/inflate.c
+++ b/lib/zlib_inflate/inflate.c
@@ -347,7 +347,10 @@ int zlib_inflate(z_streamp strm, int flush)
347 static const unsigned short order[19] = /* permutation of code lengths */ 347 static const unsigned short order[19] = /* permutation of code lengths */
348 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; 348 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
349 349
350 if (strm == NULL || strm->state == NULL || strm->next_out == NULL || 350 /* Do not check for strm->next_out == NULL here as ppc zImage
351 inflates to strm->next_out = 0 */
352
353 if (strm == NULL || strm->state == NULL ||
351 (strm->next_in == NULL && strm->avail_in != 0)) 354 (strm->next_in == NULL && strm->avail_in != 0))
352 return Z_STREAM_ERROR; 355 return Z_STREAM_ERROR;
353 356
diff --git a/mm/filemap.c b/mm/filemap.c
index d087fc3d3281..b9a60c43b61a 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -849,8 +849,6 @@ static void shrink_readahead_size_eio(struct file *filp,
849 return; 849 return;
850 850
851 ra->ra_pages /= 4; 851 ra->ra_pages /= 4;
852 printk(KERN_WARNING "Reducing readahead size to %luK\n",
853 ra->ra_pages << (PAGE_CACHE_SHIFT - 10));
854} 852}
855 853
856/** 854/**
diff --git a/mm/slab.c b/mm/slab.c
index 0f20843beffd..21ba06035700 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1106,7 +1106,7 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
1106 1106
1107#endif 1107#endif
1108 1108
1109static int __devinit cpuup_callback(struct notifier_block *nfb, 1109static int __cpuinit cpuup_callback(struct notifier_block *nfb,
1110 unsigned long action, void *hcpu) 1110 unsigned long action, void *hcpu)
1111{ 1111{
1112 long cpu = (long)hcpu; 1112 long cpu = (long)hcpu;
@@ -3224,7 +3224,7 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags)
3224EXPORT_SYMBOL(kmem_cache_alloc); 3224EXPORT_SYMBOL(kmem_cache_alloc);
3225 3225
3226/** 3226/**
3227 * kmem_cache_alloc - Allocate an object. The memory is set to zero. 3227 * kmem_cache_zalloc - Allocate an object. The memory is set to zero.
3228 * @cache: The cache to allocate from. 3228 * @cache: The cache to allocate from.
3229 * @flags: See kmalloc(). 3229 * @flags: See kmalloc().
3230 * 3230 *
diff --git a/net/core/Makefile b/net/core/Makefile
index e9bd2467d5a9..2645ba428d48 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o iovec.o datagram.o stream.o scm.o \
7 7
8obj-$(CONFIG_SYSCTL) += sysctl_net_core.o 8obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
9 9
10obj-y += dev.o ethtool.o dev_mcast.o dst.o \ 10obj-y += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
11 neighbour.o rtnetlink.o utils.o link_watch.o filter.o 11 neighbour.o rtnetlink.o utils.o link_watch.o filter.o
12 12
13obj-$(CONFIG_XFRM) += flow.o 13obj-$(CONFIG_XFRM) += flow.o
diff --git a/net/core/dev.c b/net/core/dev.c
index 4d2b5167d7f5..d95e2626d944 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1166,11 +1166,6 @@ int skb_checksum_help(struct sk_buff *skb, int inward)
1166 goto out_set_summed; 1166 goto out_set_summed;
1167 1167
1168 if (unlikely(skb_shinfo(skb)->gso_size)) { 1168 if (unlikely(skb_shinfo(skb)->gso_size)) {
1169 static int warned;
1170
1171 WARN_ON(!warned);
1172 warned = 1;
1173
1174 /* Let GSO fix up the checksum. */ 1169 /* Let GSO fix up the checksum. */
1175 goto out_set_summed; 1170 goto out_set_summed;
1176 } 1171 }
@@ -1220,11 +1215,6 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
1220 __skb_pull(skb, skb->mac_len); 1215 __skb_pull(skb, skb->mac_len);
1221 1216
1222 if (unlikely(skb->ip_summed != CHECKSUM_HW)) { 1217 if (unlikely(skb->ip_summed != CHECKSUM_HW)) {
1223 static int warned;
1224
1225 WARN_ON(!warned);
1226 warned = 1;
1227
1228 if (skb_header_cloned(skb) && 1218 if (skb_header_cloned(skb) &&
1229 (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) 1219 (err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))
1230 return ERR_PTR(err); 1220 return ERR_PTR(err);
@@ -3429,12 +3419,9 @@ static void net_dma_rebalance(void)
3429 unsigned int cpu, i, n; 3419 unsigned int cpu, i, n;
3430 struct dma_chan *chan; 3420 struct dma_chan *chan;
3431 3421
3432 lock_cpu_hotplug();
3433
3434 if (net_dma_count == 0) { 3422 if (net_dma_count == 0) {
3435 for_each_online_cpu(cpu) 3423 for_each_online_cpu(cpu)
3436 rcu_assign_pointer(per_cpu(softnet_data.net_dma, cpu), NULL); 3424 rcu_assign_pointer(per_cpu(softnet_data, cpu).net_dma, NULL);
3437 unlock_cpu_hotplug();
3438 return; 3425 return;
3439 } 3426 }
3440 3427
@@ -3447,15 +3434,13 @@ static void net_dma_rebalance(void)
3447 + (i < (num_online_cpus() % net_dma_count) ? 1 : 0)); 3434 + (i < (num_online_cpus() % net_dma_count) ? 1 : 0));
3448 3435
3449 while(n) { 3436 while(n) {
3450 per_cpu(softnet_data.net_dma, cpu) = chan; 3437 per_cpu(softnet_data, cpu).net_dma = chan;
3451 cpu = next_cpu(cpu, cpu_online_map); 3438 cpu = next_cpu(cpu, cpu_online_map);
3452 n--; 3439 n--;
3453 } 3440 }
3454 i++; 3441 i++;
3455 } 3442 }
3456 rcu_read_unlock(); 3443 rcu_read_unlock();
3457
3458 unlock_cpu_hotplug();
3459} 3444}
3460 3445
3461/** 3446/**
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 7ad681f5e712..5130d2efdbbe 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -29,6 +29,7 @@
29#include <net/neighbour.h> 29#include <net/neighbour.h>
30#include <net/dst.h> 30#include <net/dst.h>
31#include <net/sock.h> 31#include <net/sock.h>
32#include <net/netevent.h>
32#include <linux/rtnetlink.h> 33#include <linux/rtnetlink.h>
33#include <linux/random.h> 34#include <linux/random.h>
34#include <linux/string.h> 35#include <linux/string.h>
@@ -754,6 +755,7 @@ static void neigh_timer_handler(unsigned long arg)
754 neigh->nud_state = NUD_STALE; 755 neigh->nud_state = NUD_STALE;
755 neigh->updated = jiffies; 756 neigh->updated = jiffies;
756 neigh_suspect(neigh); 757 neigh_suspect(neigh);
758 notify = 1;
757 } 759 }
758 } else if (state & NUD_DELAY) { 760 } else if (state & NUD_DELAY) {
759 if (time_before_eq(now, 761 if (time_before_eq(now,
@@ -762,6 +764,7 @@ static void neigh_timer_handler(unsigned long arg)
762 neigh->nud_state = NUD_REACHABLE; 764 neigh->nud_state = NUD_REACHABLE;
763 neigh->updated = jiffies; 765 neigh->updated = jiffies;
764 neigh_connect(neigh); 766 neigh_connect(neigh);
767 notify = 1;
765 next = neigh->confirmed + neigh->parms->reachable_time; 768 next = neigh->confirmed + neigh->parms->reachable_time;
766 } else { 769 } else {
767 NEIGH_PRINTK2("neigh %p is probed.\n", neigh); 770 NEIGH_PRINTK2("neigh %p is probed.\n", neigh);
@@ -819,6 +822,8 @@ static void neigh_timer_handler(unsigned long arg)
819out: 822out:
820 write_unlock(&neigh->lock); 823 write_unlock(&neigh->lock);
821 } 824 }
825 if (notify)
826 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
822 827
823#ifdef CONFIG_ARPD 828#ifdef CONFIG_ARPD
824 if (notify && neigh->parms->app_probes) 829 if (notify && neigh->parms->app_probes)
@@ -926,9 +931,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
926{ 931{
927 u8 old; 932 u8 old;
928 int err; 933 int err;
929#ifdef CONFIG_ARPD
930 int notify = 0; 934 int notify = 0;
931#endif
932 struct net_device *dev; 935 struct net_device *dev;
933 int update_isrouter = 0; 936 int update_isrouter = 0;
934 937
@@ -948,9 +951,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
948 neigh_suspect(neigh); 951 neigh_suspect(neigh);
949 neigh->nud_state = new; 952 neigh->nud_state = new;
950 err = 0; 953 err = 0;
951#ifdef CONFIG_ARPD
952 notify = old & NUD_VALID; 954 notify = old & NUD_VALID;
953#endif
954 goto out; 955 goto out;
955 } 956 }
956 957
@@ -1022,9 +1023,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1022 if (!(new & NUD_CONNECTED)) 1023 if (!(new & NUD_CONNECTED))
1023 neigh->confirmed = jiffies - 1024 neigh->confirmed = jiffies -
1024 (neigh->parms->base_reachable_time << 1); 1025 (neigh->parms->base_reachable_time << 1);
1025#ifdef CONFIG_ARPD
1026 notify = 1; 1026 notify = 1;
1027#endif
1028 } 1027 }
1029 if (new == old) 1028 if (new == old)
1030 goto out; 1029 goto out;
@@ -1056,6 +1055,9 @@ out:
1056 (neigh->flags & ~NTF_ROUTER); 1055 (neigh->flags & ~NTF_ROUTER);
1057 } 1056 }
1058 write_unlock_bh(&neigh->lock); 1057 write_unlock_bh(&neigh->lock);
1058
1059 if (notify)
1060 call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
1059#ifdef CONFIG_ARPD 1061#ifdef CONFIG_ARPD
1060 if (notify && neigh->parms->app_probes) 1062 if (notify && neigh->parms->app_probes)
1061 neigh_app_notify(neigh); 1063 neigh_app_notify(neigh);
diff --git a/net/core/netevent.c b/net/core/netevent.c
new file mode 100644
index 000000000000..35d02c38554e
--- /dev/null
+++ b/net/core/netevent.c
@@ -0,0 +1,69 @@
1/*
2 * Network event notifiers
3 *
4 * Authors:
5 * Tom Tucker <tom@opengridcomputing.com>
6 * Steve Wise <swise@opengridcomputing.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 * Fixes:
14 */
15
16#include <linux/rtnetlink.h>
17#include <linux/notifier.h>
18
19static ATOMIC_NOTIFIER_HEAD(netevent_notif_chain);
20
21/**
22 * register_netevent_notifier - register a netevent notifier block
23 * @nb: notifier
24 *
25 * Register a notifier to be called when a netevent occurs.
26 * The notifier passed is linked into the kernel structures and must
27 * not be reused until it has been unregistered. A negative errno code
28 * is returned on a failure.
29 */
30int register_netevent_notifier(struct notifier_block *nb)
31{
32 int err;
33
34 err = atomic_notifier_chain_register(&netevent_notif_chain, nb);
35 return err;
36}
37
38/**
39 * netevent_unregister_notifier - unregister a netevent notifier block
40 * @nb: notifier
41 *
42 * Unregister a notifier previously registered by
43 * register_neigh_notifier(). The notifier is unlinked into the
44 * kernel structures and may then be reused. A negative errno code
45 * is returned on a failure.
46 */
47
48int unregister_netevent_notifier(struct notifier_block *nb)
49{
50 return atomic_notifier_chain_unregister(&netevent_notif_chain, nb);
51}
52
53/**
54 * call_netevent_notifiers - call all netevent notifier blocks
55 * @val: value passed unmodified to notifier function
56 * @v: pointer passed unmodified to notifier function
57 *
58 * Call all neighbour notifier blocks. Parameters and return value
59 * are as for notifier_call_chain().
60 */
61
62int call_netevent_notifiers(unsigned long val, void *v)
63{
64 return atomic_notifier_call_chain(&netevent_notif_chain, val, v);
65}
66
67EXPORT_SYMBOL_GPL(register_netevent_notifier);
68EXPORT_SYMBOL_GPL(unregister_netevent_notifier);
69EXPORT_SYMBOL_GPL(call_netevent_notifiers);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 476aa3978504..022d8894c11d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -71,13 +71,6 @@ static kmem_cache_t *skbuff_head_cache __read_mostly;
71static kmem_cache_t *skbuff_fclone_cache __read_mostly; 71static kmem_cache_t *skbuff_fclone_cache __read_mostly;
72 72
73/* 73/*
74 * lockdep: lock class key used by skb_queue_head_init():
75 */
76struct lock_class_key skb_queue_lock_key;
77
78EXPORT_SYMBOL(skb_queue_lock_key);
79
80/*
81 * Keep out-of-line to prevent kernel bloat. 74 * Keep out-of-line to prevent kernel bloat.
82 * __builtin_return_address is not used because it is not always 75 * __builtin_return_address is not used because it is not always
83 * reliable. 76 * reliable.
@@ -256,6 +249,29 @@ nodata:
256 goto out; 249 goto out;
257} 250}
258 251
252/**
253 * __netdev_alloc_skb - allocate an skbuff for rx on a specific device
254 * @dev: network device to receive on
255 * @length: length to allocate
256 * @gfp_mask: get_free_pages mask, passed to alloc_skb
257 *
258 * Allocate a new &sk_buff and assign it a usage count of one. The
259 * buffer has unspecified headroom built in. Users should allocate
260 * the headroom they think they need without accounting for the
261 * built in space. The built in space is used for optimisations.
262 *
263 * %NULL is returned if there is no free memory.
264 */
265struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
266 unsigned int length, gfp_t gfp_mask)
267{
268 struct sk_buff *skb;
269
270 skb = alloc_skb(length + NET_SKB_PAD, gfp_mask);
271 if (likely(skb))
272 skb_reserve(skb, NET_SKB_PAD);
273 return skb;
274}
259 275
260static void skb_drop_list(struct sk_buff **listp) 276static void skb_drop_list(struct sk_buff **listp)
261{ 277{
@@ -846,7 +862,11 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
846 unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))) 862 unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC))))
847 return err; 863 return err;
848 864
849 for (i = 0; i < nfrags; i++) { 865 i = 0;
866 if (offset >= len)
867 goto drop_pages;
868
869 for (; i < nfrags; i++) {
850 int end = offset + skb_shinfo(skb)->frags[i].size; 870 int end = offset + skb_shinfo(skb)->frags[i].size;
851 871
852 if (end < len) { 872 if (end < len) {
@@ -854,9 +874,9 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
854 continue; 874 continue;
855 } 875 }
856 876
857 if (len > offset) 877 skb_shinfo(skb)->frags[i++].size = len - offset;
858 skb_shinfo(skb)->frags[i++].size = len - offset;
859 878
879drop_pages:
860 skb_shinfo(skb)->nr_frags = i; 880 skb_shinfo(skb)->nr_frags = i;
861 881
862 for (; i < nfrags; i++) 882 for (; i < nfrags; i++)
@@ -864,7 +884,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
864 884
865 if (skb_shinfo(skb)->frag_list) 885 if (skb_shinfo(skb)->frag_list)
866 skb_drop_fraglist(skb); 886 skb_drop_fraglist(skb);
867 break; 887 goto done;
868 } 888 }
869 889
870 for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp); 890 for (fragp = &skb_shinfo(skb)->frag_list; (frag = *fragp);
@@ -879,6 +899,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
879 return -ENOMEM; 899 return -ENOMEM;
880 900
881 nfrag->next = frag->next; 901 nfrag->next = frag->next;
902 kfree_skb(frag);
882 frag = nfrag; 903 frag = nfrag;
883 *fragp = frag; 904 *fragp = frag;
884 } 905 }
@@ -897,6 +918,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
897 break; 918 break;
898 } 919 }
899 920
921done:
900 if (len > skb_headlen(skb)) { 922 if (len > skb_headlen(skb)) {
901 skb->data_len -= skb->len - len; 923 skb->data_len -= skb->len - len;
902 skb->len = len; 924 skb->len = len;
@@ -2042,6 +2064,7 @@ EXPORT_SYMBOL(__kfree_skb);
2042EXPORT_SYMBOL(kfree_skb); 2064EXPORT_SYMBOL(kfree_skb);
2043EXPORT_SYMBOL(__pskb_pull_tail); 2065EXPORT_SYMBOL(__pskb_pull_tail);
2044EXPORT_SYMBOL(__alloc_skb); 2066EXPORT_SYMBOL(__alloc_skb);
2067EXPORT_SYMBOL(__netdev_alloc_skb);
2045EXPORT_SYMBOL(pskb_copy); 2068EXPORT_SYMBOL(pskb_copy);
2046EXPORT_SYMBOL(pskb_expand_head); 2069EXPORT_SYMBOL(pskb_expand_head);
2047EXPORT_SYMBOL(skb_checksum); 2070EXPORT_SYMBOL(skb_checksum);
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 9f3d4d7cd0bf..610c722ac27f 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -230,7 +230,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
230 ipv6_addr_copy(&np->saddr, saddr); 230 ipv6_addr_copy(&np->saddr, saddr);
231 inet->rcv_saddr = LOOPBACK4_IPV6; 231 inet->rcv_saddr = LOOPBACK4_IPV6;
232 232
233 ip6_dst_store(sk, dst, NULL); 233 __ip6_dst_store(sk, dst, NULL);
234 234
235 icsk->icsk_ext_hdr_len = 0; 235 icsk->icsk_ext_hdr_len = 0;
236 if (np->opt != NULL) 236 if (np->opt != NULL)
@@ -863,7 +863,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
863 * comment in that function for the gory details. -acme 863 * comment in that function for the gory details. -acme
864 */ 864 */
865 865
866 ip6_dst_store(newsk, dst, NULL); 866 __ip6_dst_store(newsk, dst, NULL);
867 newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM | 867 newsk->sk_route_caps = dst->dev->features & ~(NETIF_F_IP_CSUM |
868 NETIF_F_TSO); 868 NETIF_F_TSO);
869 newdp6 = (struct dccp6_sock *)newsk; 869 newdp6 = (struct dccp6_sock *)newsk;
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 1355614ec11b..743e9fcf7c5a 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -925,8 +925,13 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
925 for(dev_out = dev_base; dev_out; dev_out = dev_out->next) { 925 for(dev_out = dev_base; dev_out; dev_out = dev_out->next) {
926 if (!dev_out->dn_ptr) 926 if (!dev_out->dn_ptr)
927 continue; 927 continue;
928 if (dn_dev_islocal(dev_out, oldflp->fld_src)) 928 if (!dn_dev_islocal(dev_out, oldflp->fld_src))
929 break; 929 continue;
930 if ((dev_out->flags & IFF_LOOPBACK) &&
931 oldflp->fld_dst &&
932 !dn_dev_islocal(dev_out, oldflp->fld_dst))
933 continue;
934 break;
930 } 935 }
931 read_unlock(&dev_base_lock); 936 read_unlock(&dev_base_lock);
932 if (dev_out == NULL) 937 if (dev_out == NULL)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 7c9f9a6421b8..9bf307a29783 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -526,6 +526,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
526 526
527 err = output(skb); 527 err = output(skb);
528 528
529 if (!err)
530 IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
529 if (err || !frag) 531 if (err || !frag)
530 break; 532 break;
531 533
@@ -649,9 +651,6 @@ slow_path:
649 /* 651 /*
650 * Put this fragment into the sending queue. 652 * Put this fragment into the sending queue.
651 */ 653 */
652
653 IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
654
655 iph->tot_len = htons(len + hlen); 654 iph->tot_len = htons(len + hlen);
656 655
657 ip_send_check(iph); 656 ip_send_check(iph);
@@ -659,6 +658,8 @@ slow_path:
659 err = output(skb2); 658 err = output(skb2);
660 if (err) 659 if (err)
661 goto fail; 660 goto fail;
661
662 IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
662 } 663 }
663 kfree_skb(skb); 664 kfree_skb(skb);
664 IP_INC_STATS(IPSTATS_MIB_FRAGOKS); 665 IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index 84f43a3c9098..2d05c4133d3e 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -112,14 +112,19 @@ static void ip_cmsg_recv_retopts(struct msghdr *msg, struct sk_buff *skb)
112static void ip_cmsg_recv_security(struct msghdr *msg, struct sk_buff *skb) 112static void ip_cmsg_recv_security(struct msghdr *msg, struct sk_buff *skb)
113{ 113{
114 char *secdata; 114 char *secdata;
115 u32 seclen; 115 u32 seclen, secid;
116 int err; 116 int err;
117 117
118 err = security_socket_getpeersec_dgram(skb, &secdata, &seclen); 118 err = security_socket_getpeersec_dgram(NULL, skb, &secid);
119 if (err)
120 return;
121
122 err = security_secid_to_secctx(secid, &secdata, &seclen);
119 if (err) 123 if (err)
120 return; 124 return;
121 125
122 put_cmsg(msg, SOL_IP, SCM_SECURITY, seclen, secdata); 126 put_cmsg(msg, SOL_IP, SCM_SECURITY, seclen, secdata);
127 security_release_secctx(secdata, seclen);
123} 128}
124 129
125 130
diff --git a/net/ipv4/netfilter/ip_conntrack_sip.c b/net/ipv4/netfilter/ip_conntrack_sip.c
index fc87ce0da40d..4f222d6be009 100644
--- a/net/ipv4/netfilter/ip_conntrack_sip.c
+++ b/net/ipv4/netfilter/ip_conntrack_sip.c
@@ -442,7 +442,7 @@ static int __init init(void)
442 sip[i].tuple.src.u.udp.port = htons(ports[i]); 442 sip[i].tuple.src.u.udp.port = htons(ports[i]);
443 sip[i].mask.src.u.udp.port = 0xFFFF; 443 sip[i].mask.src.u.udp.port = 0xFFFF;
444 sip[i].mask.dst.protonum = 0xFF; 444 sip[i].mask.dst.protonum = 0xFF;
445 sip[i].max_expected = 1; 445 sip[i].max_expected = 2;
446 sip[i].timeout = 3 * 60; /* 3 minutes */ 446 sip[i].timeout = 3 * 60; /* 3 minutes */
447 sip[i].me = THIS_MODULE; 447 sip[i].me = THIS_MODULE;
448 sip[i].help = sip_help; 448 sip[i].help = sip_help;
diff --git a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c
index 92980ab8ce48..6b662449e825 100644
--- a/net/ipv4/netfilter/ipt_hashlimit.c
+++ b/net/ipv4/netfilter/ipt_hashlimit.c
@@ -508,6 +508,9 @@ hashlimit_checkentry(const char *tablename,
508 if (!r->cfg.expire) 508 if (!r->cfg.expire)
509 return 0; 509 return 0;
510 510
511 if (r->name[sizeof(r->name) - 1] != '\0')
512 return 0;
513
511 /* This is the best we've got: We cannot release and re-grab lock, 514 /* This is the best we've got: We cannot release and re-grab lock,
512 * since checkentry() is called before ip_tables.c grabs ipt_mutex. 515 * since checkentry() is called before ip_tables.c grabs ipt_mutex.
513 * We also cannot grab the hashtable spinlock, since htable_create will 516 * We also cannot grab the hashtable spinlock, since htable_create will
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 2dc6dbb28467..19bd49d69d9f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -104,6 +104,7 @@
104#include <net/icmp.h> 104#include <net/icmp.h>
105#include <net/xfrm.h> 105#include <net/xfrm.h>
106#include <net/ip_mp_alg.h> 106#include <net/ip_mp_alg.h>
107#include <net/netevent.h>
107#ifdef CONFIG_SYSCTL 108#ifdef CONFIG_SYSCTL
108#include <linux/sysctl.h> 109#include <linux/sysctl.h>
109#endif 110#endif
@@ -1125,6 +1126,7 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
1125 struct rtable *rth, **rthp; 1126 struct rtable *rth, **rthp;
1126 u32 skeys[2] = { saddr, 0 }; 1127 u32 skeys[2] = { saddr, 0 };
1127 int ikeys[2] = { dev->ifindex, 0 }; 1128 int ikeys[2] = { dev->ifindex, 0 };
1129 struct netevent_redirect netevent;
1128 1130
1129 if (!in_dev) 1131 if (!in_dev)
1130 return; 1132 return;
@@ -1216,6 +1218,11 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
1216 rt_drop(rt); 1218 rt_drop(rt);
1217 goto do_next; 1219 goto do_next;
1218 } 1220 }
1221
1222 netevent.old = &rth->u.dst;
1223 netevent.new = &rt->u.dst;
1224 call_netevent_notifiers(NETEVENT_REDIRECT,
1225 &netevent);
1219 1226
1220 rt_del(hash, rth); 1227 rt_del(hash, rth);
1221 if (!rt_intern_hash(hash, rt, &rt)) 1228 if (!rt_intern_hash(hash, rt, &rt))
@@ -1452,6 +1459,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
1452 } 1459 }
1453 dst->metrics[RTAX_MTU-1] = mtu; 1460 dst->metrics[RTAX_MTU-1] = mtu;
1454 dst_set_expires(dst, ip_rt_mtu_expires); 1461 dst_set_expires(dst, ip_rt_mtu_expires);
1462 call_netevent_notifiers(NETEVENT_PMTU_UPDATE, dst);
1455 } 1463 }
1456} 1464}
1457 1465
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index f6a2d9223d07..934396bb1376 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1132,7 +1132,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1132 tp->ucopy.dma_chan = NULL; 1132 tp->ucopy.dma_chan = NULL;
1133 preempt_disable(); 1133 preempt_disable();
1134 if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) && 1134 if ((len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
1135 !sysctl_tcp_low_latency && __get_cpu_var(softnet_data.net_dma)) { 1135 !sysctl_tcp_low_latency && __get_cpu_var(softnet_data).net_dma) {
1136 preempt_enable_no_resched(); 1136 preempt_enable_no_resched();
1137 tp->ucopy.pinned_list = dma_pin_iovec_pages(msg->msg_iov, len); 1137 tp->ucopy.pinned_list = dma_pin_iovec_pages(msg->msg_iov, len);
1138 } else 1138 } else
@@ -1659,7 +1659,8 @@ adjudge_to_death:
1659 const int tmo = tcp_fin_time(sk); 1659 const int tmo = tcp_fin_time(sk);
1660 1660
1661 if (tmo > TCP_TIMEWAIT_LEN) { 1661 if (tmo > TCP_TIMEWAIT_LEN) {
1662 inet_csk_reset_keepalive_timer(sk, tcp_fin_time(sk)); 1662 inet_csk_reset_keepalive_timer(sk,
1663 tmo - TCP_TIMEWAIT_LEN);
1663 } else { 1664 } else {
1664 tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); 1665 tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
1665 goto out; 1666 goto out;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index f6f39e814291..4b04c3edd4a9 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -438,7 +438,6 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
438 It can f.e. if SYNs crossed. 438 It can f.e. if SYNs crossed.
439 */ 439 */
440 if (!sock_owned_by_user(sk)) { 440 if (!sock_owned_by_user(sk)) {
441 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
442 sk->sk_err = err; 441 sk->sk_err = err;
443 442
444 sk->sk_error_report(sk); 443 sk->sk_error_report(sk);
@@ -874,7 +873,6 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
874drop_and_free: 873drop_and_free:
875 reqsk_free(req); 874 reqsk_free(req);
876drop: 875drop:
877 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
878 return 0; 876 return 0;
879} 877}
880 878
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 0ccb7cb22b15..624e2b2c7f53 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -589,8 +589,10 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
589 /* RFC793: "second check the RST bit" and 589 /* RFC793: "second check the RST bit" and
590 * "fourth, check the SYN bit" 590 * "fourth, check the SYN bit"
591 */ 591 */
592 if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) 592 if (flg & (TCP_FLAG_RST|TCP_FLAG_SYN)) {
593 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
593 goto embryonic_reset; 594 goto embryonic_reset;
595 }
594 596
595 /* ACK sequence verified above, just make sure ACK is 597 /* ACK sequence verified above, just make sure ACK is
596 * set. If ACK not set, just silently drop the packet. 598 * set. If ACK not set, just silently drop the packet.
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index d7d517a3a238..b3435324b573 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -114,7 +114,7 @@ static int tcpprobe_open(struct inode * inode, struct file * file)
114static ssize_t tcpprobe_read(struct file *file, char __user *buf, 114static ssize_t tcpprobe_read(struct file *file, char __user *buf,
115 size_t len, loff_t *ppos) 115 size_t len, loff_t *ppos)
116{ 116{
117 int error = 0, cnt; 117 int error = 0, cnt = 0;
118 unsigned char *tbuf; 118 unsigned char *tbuf;
119 119
120 if (!buf || len < 0) 120 if (!buf || len < 0)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2316a4315a18..8ea1e36bf8eb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1869,15 +1869,21 @@ err_exit:
1869/* 1869/*
1870 * Manual configuration of address on an interface 1870 * Manual configuration of address on an interface
1871 */ 1871 */
1872static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen) 1872static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen,
1873 __u32 prefered_lft, __u32 valid_lft)
1873{ 1874{
1874 struct inet6_ifaddr *ifp; 1875 struct inet6_ifaddr *ifp;
1875 struct inet6_dev *idev; 1876 struct inet6_dev *idev;
1876 struct net_device *dev; 1877 struct net_device *dev;
1878 __u8 ifa_flags = 0;
1877 int scope; 1879 int scope;
1878 1880
1879 ASSERT_RTNL(); 1881 ASSERT_RTNL();
1880 1882
1883 /* check the lifetime */
1884 if (!valid_lft || prefered_lft > valid_lft)
1885 return -EINVAL;
1886
1881 if ((dev = __dev_get_by_index(ifindex)) == NULL) 1887 if ((dev = __dev_get_by_index(ifindex)) == NULL)
1882 return -ENODEV; 1888 return -ENODEV;
1883 1889
@@ -1889,10 +1895,29 @@ static int inet6_addr_add(int ifindex, struct in6_addr *pfx, int plen)
1889 1895
1890 scope = ipv6_addr_scope(pfx); 1896 scope = ipv6_addr_scope(pfx);
1891 1897
1892 ifp = ipv6_add_addr(idev, pfx, plen, scope, IFA_F_PERMANENT); 1898 if (valid_lft == INFINITY_LIFE_TIME)
1899 ifa_flags |= IFA_F_PERMANENT;
1900 else if (valid_lft >= 0x7FFFFFFF/HZ)
1901 valid_lft = 0x7FFFFFFF/HZ;
1902
1903 if (prefered_lft == 0)
1904 ifa_flags |= IFA_F_DEPRECATED;
1905 else if ((prefered_lft >= 0x7FFFFFFF/HZ) &&
1906 (prefered_lft != INFINITY_LIFE_TIME))
1907 prefered_lft = 0x7FFFFFFF/HZ;
1908
1909 ifp = ipv6_add_addr(idev, pfx, plen, scope, ifa_flags);
1910
1893 if (!IS_ERR(ifp)) { 1911 if (!IS_ERR(ifp)) {
1912 spin_lock(&ifp->lock);
1913 ifp->valid_lft = valid_lft;
1914 ifp->prefered_lft = prefered_lft;
1915 ifp->tstamp = jiffies;
1916 spin_unlock(&ifp->lock);
1917
1894 addrconf_dad_start(ifp, 0); 1918 addrconf_dad_start(ifp, 0);
1895 in6_ifa_put(ifp); 1919 in6_ifa_put(ifp);
1920 addrconf_verify(0);
1896 return 0; 1921 return 0;
1897 } 1922 }
1898 1923
@@ -1945,7 +1970,8 @@ int addrconf_add_ifaddr(void __user *arg)
1945 return -EFAULT; 1970 return -EFAULT;
1946 1971
1947 rtnl_lock(); 1972 rtnl_lock();
1948 err = inet6_addr_add(ireq.ifr6_ifindex, &ireq.ifr6_addr, ireq.ifr6_prefixlen); 1973 err = inet6_addr_add(ireq.ifr6_ifindex, &ireq.ifr6_addr, ireq.ifr6_prefixlen,
1974 INFINITY_LIFE_TIME, INFINITY_LIFE_TIME);
1949 rtnl_unlock(); 1975 rtnl_unlock();
1950 return err; 1976 return err;
1951} 1977}
@@ -2771,12 +2797,16 @@ restart:
2771 ifp->idev->nd_parms->retrans_time / HZ; 2797 ifp->idev->nd_parms->retrans_time / HZ;
2772#endif 2798#endif
2773 2799
2774 if (age >= ifp->valid_lft) { 2800 if (ifp->valid_lft != INFINITY_LIFE_TIME &&
2801 age >= ifp->valid_lft) {
2775 spin_unlock(&ifp->lock); 2802 spin_unlock(&ifp->lock);
2776 in6_ifa_hold(ifp); 2803 in6_ifa_hold(ifp);
2777 read_unlock(&addrconf_hash_lock); 2804 read_unlock(&addrconf_hash_lock);
2778 ipv6_del_addr(ifp); 2805 ipv6_del_addr(ifp);
2779 goto restart; 2806 goto restart;
2807 } else if (ifp->prefered_lft == INFINITY_LIFE_TIME) {
2808 spin_unlock(&ifp->lock);
2809 continue;
2780 } else if (age >= ifp->prefered_lft) { 2810 } else if (age >= ifp->prefered_lft) {
2781 /* jiffies - ifp->tsamp > age >= ifp->prefered_lft */ 2811 /* jiffies - ifp->tsamp > age >= ifp->prefered_lft */
2782 int deprecate = 0; 2812 int deprecate = 0;
@@ -2853,7 +2883,8 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
2853 pfx = RTA_DATA(rta[IFA_ADDRESS-1]); 2883 pfx = RTA_DATA(rta[IFA_ADDRESS-1]);
2854 } 2884 }
2855 if (rta[IFA_LOCAL-1]) { 2885 if (rta[IFA_LOCAL-1]) {
2856 if (pfx && memcmp(pfx, RTA_DATA(rta[IFA_LOCAL-1]), sizeof(*pfx))) 2886 if (RTA_PAYLOAD(rta[IFA_LOCAL-1]) < sizeof(*pfx) ||
2887 (pfx && memcmp(pfx, RTA_DATA(rta[IFA_LOCAL-1]), sizeof(*pfx))))
2857 return -EINVAL; 2888 return -EINVAL;
2858 pfx = RTA_DATA(rta[IFA_LOCAL-1]); 2889 pfx = RTA_DATA(rta[IFA_LOCAL-1]);
2859 } 2890 }
@@ -2864,11 +2895,61 @@ inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
2864} 2895}
2865 2896
2866static int 2897static int
2898inet6_addr_modify(int ifindex, struct in6_addr *pfx,
2899 __u32 prefered_lft, __u32 valid_lft)
2900{
2901 struct inet6_ifaddr *ifp = NULL;
2902 struct net_device *dev;
2903 int ifa_flags = 0;
2904
2905 if ((dev = __dev_get_by_index(ifindex)) == NULL)
2906 return -ENODEV;
2907
2908 if (!(dev->flags&IFF_UP))
2909 return -ENETDOWN;
2910
2911 if (!valid_lft || (prefered_lft > valid_lft))
2912 return -EINVAL;
2913
2914 ifp = ipv6_get_ifaddr(pfx, dev, 1);
2915 if (ifp == NULL)
2916 return -ENOENT;
2917
2918 if (valid_lft == INFINITY_LIFE_TIME)
2919 ifa_flags = IFA_F_PERMANENT;
2920 else if (valid_lft >= 0x7FFFFFFF/HZ)
2921 valid_lft = 0x7FFFFFFF/HZ;
2922
2923 if (prefered_lft == 0)
2924 ifa_flags = IFA_F_DEPRECATED;
2925 else if ((prefered_lft >= 0x7FFFFFFF/HZ) &&
2926 (prefered_lft != INFINITY_LIFE_TIME))
2927 prefered_lft = 0x7FFFFFFF/HZ;
2928
2929 spin_lock_bh(&ifp->lock);
2930 ifp->flags = (ifp->flags & ~(IFA_F_DEPRECATED|IFA_F_PERMANENT)) | ifa_flags;
2931
2932 ifp->tstamp = jiffies;
2933 ifp->valid_lft = valid_lft;
2934 ifp->prefered_lft = prefered_lft;
2935
2936 spin_unlock_bh(&ifp->lock);
2937 if (!(ifp->flags&IFA_F_TENTATIVE))
2938 ipv6_ifa_notify(0, ifp);
2939 in6_ifa_put(ifp);
2940
2941 addrconf_verify(0);
2942
2943 return 0;
2944}
2945
2946static int
2867inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) 2947inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
2868{ 2948{
2869 struct rtattr **rta = arg; 2949 struct rtattr **rta = arg;
2870 struct ifaddrmsg *ifm = NLMSG_DATA(nlh); 2950 struct ifaddrmsg *ifm = NLMSG_DATA(nlh);
2871 struct in6_addr *pfx; 2951 struct in6_addr *pfx;
2952 __u32 valid_lft = INFINITY_LIFE_TIME, prefered_lft = INFINITY_LIFE_TIME;
2872 2953
2873 pfx = NULL; 2954 pfx = NULL;
2874 if (rta[IFA_ADDRESS-1]) { 2955 if (rta[IFA_ADDRESS-1]) {
@@ -2877,14 +2958,34 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
2877 pfx = RTA_DATA(rta[IFA_ADDRESS-1]); 2958 pfx = RTA_DATA(rta[IFA_ADDRESS-1]);
2878 } 2959 }
2879 if (rta[IFA_LOCAL-1]) { 2960 if (rta[IFA_LOCAL-1]) {
2880 if (pfx && memcmp(pfx, RTA_DATA(rta[IFA_LOCAL-1]), sizeof(*pfx))) 2961 if (RTA_PAYLOAD(rta[IFA_LOCAL-1]) < sizeof(*pfx) ||
2962 (pfx && memcmp(pfx, RTA_DATA(rta[IFA_LOCAL-1]), sizeof(*pfx))))
2881 return -EINVAL; 2963 return -EINVAL;
2882 pfx = RTA_DATA(rta[IFA_LOCAL-1]); 2964 pfx = RTA_DATA(rta[IFA_LOCAL-1]);
2883 } 2965 }
2884 if (pfx == NULL) 2966 if (pfx == NULL)
2885 return -EINVAL; 2967 return -EINVAL;
2886 2968
2887 return inet6_addr_add(ifm->ifa_index, pfx, ifm->ifa_prefixlen); 2969 if (rta[IFA_CACHEINFO-1]) {
2970 struct ifa_cacheinfo *ci;
2971 if (RTA_PAYLOAD(rta[IFA_CACHEINFO-1]) < sizeof(*ci))
2972 return -EINVAL;
2973 ci = RTA_DATA(rta[IFA_CACHEINFO-1]);
2974 valid_lft = ci->ifa_valid;
2975 prefered_lft = ci->ifa_prefered;
2976 }
2977
2978 if (nlh->nlmsg_flags & NLM_F_REPLACE) {
2979 int ret;
2980 ret = inet6_addr_modify(ifm->ifa_index, pfx,
2981 prefered_lft, valid_lft);
2982 if (ret == 0 || !(nlh->nlmsg_flags & NLM_F_CREATE))
2983 return ret;
2984 }
2985
2986 return inet6_addr_add(ifm->ifa_index, pfx, ifm->ifa_prefixlen,
2987 prefered_lft, valid_lft);
2988
2888} 2989}
2889 2990
2890/* Maximum length of ifa_cacheinfo attributes */ 2991/* Maximum length of ifa_cacheinfo attributes */
@@ -3121,6 +3222,62 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb)
3121 return inet6_dump_addr(skb, cb, type); 3222 return inet6_dump_addr(skb, cb, type);
3122} 3223}
3123 3224
3225static int inet6_rtm_getaddr(struct sk_buff *in_skb,
3226 struct nlmsghdr* nlh, void *arg)
3227{
3228 struct rtattr **rta = arg;
3229 struct ifaddrmsg *ifm = NLMSG_DATA(nlh);
3230 struct in6_addr *addr = NULL;
3231 struct net_device *dev = NULL;
3232 struct inet6_ifaddr *ifa;
3233 struct sk_buff *skb;
3234 int size = NLMSG_SPACE(sizeof(struct ifaddrmsg) + INET6_IFADDR_RTA_SPACE);
3235 int err;
3236
3237 if (rta[IFA_ADDRESS-1]) {
3238 if (RTA_PAYLOAD(rta[IFA_ADDRESS-1]) < sizeof(*addr))
3239 return -EINVAL;
3240 addr = RTA_DATA(rta[IFA_ADDRESS-1]);
3241 }
3242 if (rta[IFA_LOCAL-1]) {
3243 if (RTA_PAYLOAD(rta[IFA_LOCAL-1]) < sizeof(*addr) ||
3244 (addr && memcmp(addr, RTA_DATA(rta[IFA_LOCAL-1]), sizeof(*addr))))
3245 return -EINVAL;
3246 addr = RTA_DATA(rta[IFA_LOCAL-1]);
3247 }
3248 if (addr == NULL)
3249 return -EINVAL;
3250
3251 if (ifm->ifa_index)
3252 dev = __dev_get_by_index(ifm->ifa_index);
3253
3254 if ((ifa = ipv6_get_ifaddr(addr, dev, 1)) == NULL)
3255 return -EADDRNOTAVAIL;
3256
3257 if ((skb = alloc_skb(size, GFP_KERNEL)) == NULL) {
3258 err = -ENOBUFS;
3259 goto out;
3260 }
3261
3262 NETLINK_CB(skb).dst_pid = NETLINK_CB(in_skb).pid;
3263 err = inet6_fill_ifaddr(skb, ifa, NETLINK_CB(in_skb).pid,
3264 nlh->nlmsg_seq, RTM_NEWADDR, 0);
3265 if (err < 0) {
3266 err = -EMSGSIZE;
3267 goto out_free;
3268 }
3269
3270 err = netlink_unicast(rtnl, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT);
3271 if (err > 0)
3272 err = 0;
3273out:
3274 in6_ifa_put(ifa);
3275 return err;
3276out_free:
3277 kfree_skb(skb);
3278 goto out;
3279}
3280
3124static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) 3281static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
3125{ 3282{
3126 struct sk_buff *skb; 3283 struct sk_buff *skb;
@@ -3363,7 +3520,8 @@ static struct rtnetlink_link inet6_rtnetlink_table[RTM_NR_MSGTYPES] = {
3363 [RTM_GETLINK - RTM_BASE] = { .dumpit = inet6_dump_ifinfo, }, 3520 [RTM_GETLINK - RTM_BASE] = { .dumpit = inet6_dump_ifinfo, },
3364 [RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, }, 3521 [RTM_NEWADDR - RTM_BASE] = { .doit = inet6_rtm_newaddr, },
3365 [RTM_DELADDR - RTM_BASE] = { .doit = inet6_rtm_deladdr, }, 3522 [RTM_DELADDR - RTM_BASE] = { .doit = inet6_rtm_deladdr, },
3366 [RTM_GETADDR - RTM_BASE] = { .dumpit = inet6_dump_ifaddr, }, 3523 [RTM_GETADDR - RTM_BASE] = { .doit = inet6_rtm_getaddr,
3524 .dumpit = inet6_dump_ifaddr, },
3367 [RTM_GETMULTICAST - RTM_BASE] = { .dumpit = inet6_dump_ifmcaddr, }, 3525 [RTM_GETMULTICAST - RTM_BASE] = { .dumpit = inet6_dump_ifmcaddr, },
3368 [RTM_GETANYCAST - RTM_BASE] = { .dumpit = inet6_dump_ifacaddr, }, 3526 [RTM_GETANYCAST - RTM_BASE] = { .dumpit = inet6_dump_ifacaddr, },
3369 [RTM_NEWROUTE - RTM_BASE] = { .doit = inet6_rtm_newroute, }, 3527 [RTM_NEWROUTE - RTM_BASE] = { .doit = inet6_rtm_newroute, },
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 5a0ba58b86cc..ac85e9c532c2 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -658,7 +658,7 @@ int inet6_sk_rebuild_header(struct sock *sk)
658 return err; 658 return err;
659 } 659 }
660 660
661 ip6_dst_store(sk, dst, NULL); 661 __ip6_dst_store(sk, dst, NULL);
662 } 662 }
663 663
664 return 0; 664 return 0;
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index 5c950cc79d80..bf491077b822 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -185,7 +185,7 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
185 return err; 185 return err;
186 } 186 }
187 187
188 ip6_dst_store(sk, dst, NULL); 188 __ip6_dst_store(sk, dst, NULL);
189 } 189 }
190 190
191 skb->dst = dst_clone(dst); 191 skb->dst = dst_clone(dst);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 3bc74ce78800..69451af6abe7 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -356,6 +356,7 @@ int ip6_forward(struct sk_buff *skb)
356 skb->dev = dst->dev; 356 skb->dev = dst->dev;
357 icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, 357 icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
358 0, skb->dev); 358 0, skb->dev);
359 IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
359 360
360 kfree_skb(skb); 361 kfree_skb(skb);
361 return -ETIMEDOUT; 362 return -ETIMEDOUT;
@@ -595,6 +596,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
595 } 596 }
596 597
597 err = output(skb); 598 err = output(skb);
599 if(!err)
600 IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
601
598 if (err || !frag) 602 if (err || !frag)
599 break; 603 break;
600 604
@@ -706,12 +710,11 @@ slow_path:
706 /* 710 /*
707 * Put this fragment into the sending queue. 711 * Put this fragment into the sending queue.
708 */ 712 */
709
710 IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
711
712 err = output(frag); 713 err = output(frag);
713 if (err) 714 if (err)
714 goto fail; 715 goto fail;
716
717 IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
715 } 718 }
716 kfree_skb(skb); 719 kfree_skb(skb);
717 IP6_INC_STATS(IPSTATS_MIB_FRAGOKS); 720 IP6_INC_STATS(IPSTATS_MIB_FRAGOKS);
@@ -723,48 +726,51 @@ fail:
723 return err; 726 return err;
724} 727}
725 728
726int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl) 729static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
730 struct dst_entry *dst,
731 struct flowi *fl)
727{ 732{
728 int err = 0; 733 struct ipv6_pinfo *np = inet6_sk(sk);
734 struct rt6_info *rt = (struct rt6_info *)dst;
729 735
730 *dst = NULL; 736 if (!dst)
731 if (sk) { 737 goto out;
732 struct ipv6_pinfo *np = inet6_sk(sk); 738
733 739 /* Yes, checking route validity in not connected
734 *dst = sk_dst_check(sk, np->dst_cookie); 740 * case is not very simple. Take into account,
735 if (*dst) { 741 * that we do not support routing by source, TOS,
736 struct rt6_info *rt = (struct rt6_info*)*dst; 742 * and MSG_DONTROUTE --ANK (980726)
737 743 *
738 /* Yes, checking route validity in not connected 744 * 1. If route was host route, check that
739 * case is not very simple. Take into account, 745 * cached destination is current.
740 * that we do not support routing by source, TOS, 746 * If it is network route, we still may
741 * and MSG_DONTROUTE --ANK (980726) 747 * check its validity using saved pointer
742 * 748 * to the last used address: daddr_cache.
743 * 1. If route was host route, check that 749 * We do not want to save whole address now,
744 * cached destination is current. 750 * (because main consumer of this service
745 * If it is network route, we still may 751 * is tcp, which has not this problem),
746 * check its validity using saved pointer 752 * so that the last trick works only on connected
747 * to the last used address: daddr_cache. 753 * sockets.
748 * We do not want to save whole address now, 754 * 2. oif also should be the same.
749 * (because main consumer of this service 755 */
750 * is tcp, which has not this problem), 756 if (((rt->rt6i_dst.plen != 128 ||
751 * so that the last trick works only on connected 757 !ipv6_addr_equal(&fl->fl6_dst, &rt->rt6i_dst.addr))
752 * sockets. 758 && (np->daddr_cache == NULL ||
753 * 2. oif also should be the same. 759 !ipv6_addr_equal(&fl->fl6_dst, np->daddr_cache)))
754 */ 760 || (fl->oif && fl->oif != dst->dev->ifindex)) {
755 if (((rt->rt6i_dst.plen != 128 || 761 dst_release(dst);
756 !ipv6_addr_equal(&fl->fl6_dst, 762 dst = NULL;
757 &rt->rt6i_dst.addr))
758 && (np->daddr_cache == NULL ||
759 !ipv6_addr_equal(&fl->fl6_dst,
760 np->daddr_cache)))
761 || (fl->oif && fl->oif != (*dst)->dev->ifindex)) {
762 dst_release(*dst);
763 *dst = NULL;
764 }
765 }
766 } 763 }
767 764
765out:
766 return dst;
767}
768
769static int ip6_dst_lookup_tail(struct sock *sk,
770 struct dst_entry **dst, struct flowi *fl)
771{
772 int err;
773
768 if (*dst == NULL) 774 if (*dst == NULL)
769 *dst = ip6_route_output(sk, fl); 775 *dst = ip6_route_output(sk, fl);
770 776
@@ -773,7 +779,6 @@ int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
773 779
774 if (ipv6_addr_any(&fl->fl6_src)) { 780 if (ipv6_addr_any(&fl->fl6_src)) {
775 err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src); 781 err = ipv6_get_saddr(*dst, &fl->fl6_dst, &fl->fl6_src);
776
777 if (err) 782 if (err)
778 goto out_err_release; 783 goto out_err_release;
779 } 784 }
@@ -786,8 +791,48 @@ out_err_release:
786 return err; 791 return err;
787} 792}
788 793
794/**
795 * ip6_dst_lookup - perform route lookup on flow
796 * @sk: socket which provides route info
797 * @dst: pointer to dst_entry * for result
798 * @fl: flow to lookup
799 *
800 * This function performs a route lookup on the given flow.
801 *
802 * It returns zero on success, or a standard errno code on error.
803 */
804int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
805{
806 *dst = NULL;
807 return ip6_dst_lookup_tail(sk, dst, fl);
808}
789EXPORT_SYMBOL_GPL(ip6_dst_lookup); 809EXPORT_SYMBOL_GPL(ip6_dst_lookup);
790 810
811/**
812 * ip6_sk_dst_lookup - perform socket cached route lookup on flow
813 * @sk: socket which provides the dst cache and route info
814 * @dst: pointer to dst_entry * for result
815 * @fl: flow to lookup
816 *
817 * This function performs a route lookup on the given flow with the
818 * possibility of using the cached route in the socket if it is valid.
819 * It will take the socket dst lock when operating on the dst cache.
820 * As a result, this function can only be used in process context.
821 *
822 * It returns zero on success, or a standard errno code on error.
823 */
824int ip6_sk_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi *fl)
825{
826 *dst = NULL;
827 if (sk) {
828 *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie);
829 *dst = ip6_sk_dst_check(sk, *dst, fl);
830 }
831
832 return ip6_dst_lookup_tail(sk, dst, fl);
833}
834EXPORT_SYMBOL_GPL(ip6_sk_dst_lookup);
835
791static inline int ip6_ufo_append_data(struct sock *sk, 836static inline int ip6_ufo_append_data(struct sock *sk,
792 int getfrag(void *from, char *to, int offset, int len, 837 int getfrag(void *from, char *to, int offset, int len,
793 int odd, struct sk_buff *skb), 838 int odd, struct sk_buff *skb),
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 87c39c978cd0..4b163711f3a8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -53,6 +53,7 @@
53#include <linux/rtnetlink.h> 53#include <linux/rtnetlink.h>
54#include <net/dst.h> 54#include <net/dst.h>
55#include <net/xfrm.h> 55#include <net/xfrm.h>
56#include <net/netevent.h>
56 57
57#include <asm/uaccess.h> 58#include <asm/uaccess.h>
58 59
@@ -742,6 +743,7 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
742 dst->metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG; 743 dst->metrics[RTAX_FEATURES-1] |= RTAX_FEATURE_ALLFRAG;
743 } 744 }
744 dst->metrics[RTAX_MTU-1] = mtu; 745 dst->metrics[RTAX_MTU-1] = mtu;
746 call_netevent_notifiers(NETEVENT_PMTU_UPDATE, dst);
745 } 747 }
746} 748}
747 749
@@ -1155,6 +1157,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *saddr,
1155 struct rt6_info *rt, *nrt = NULL; 1157 struct rt6_info *rt, *nrt = NULL;
1156 int strict; 1158 int strict;
1157 struct fib6_node *fn; 1159 struct fib6_node *fn;
1160 struct netevent_redirect netevent;
1158 1161
1159 /* 1162 /*
1160 * Get the "current" route for this destination and 1163 * Get the "current" route for this destination and
@@ -1252,6 +1255,10 @@ restart:
1252 if (ip6_ins_rt(nrt, NULL, NULL, NULL)) 1255 if (ip6_ins_rt(nrt, NULL, NULL, NULL))
1253 goto out; 1256 goto out;
1254 1257
1258 netevent.old = &rt->u.dst;
1259 netevent.new = &nrt->u.dst;
1260 call_netevent_notifiers(NETEVENT_REDIRECT, &netevent);
1261
1255 if (rt->rt6i_flags&RTF_CACHE) { 1262 if (rt->rt6i_flags&RTF_CACHE) {
1256 ip6_del_rt(rt, NULL, NULL, NULL); 1263 ip6_del_rt(rt, NULL, NULL, NULL);
1257 return; 1264 return;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 923989d0520d..b843a650be71 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -270,7 +270,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
270 inet->rcv_saddr = LOOPBACK4_IPV6; 270 inet->rcv_saddr = LOOPBACK4_IPV6;
271 271
272 sk->sk_gso_type = SKB_GSO_TCPV6; 272 sk->sk_gso_type = SKB_GSO_TCPV6;
273 ip6_dst_store(sk, dst, NULL); 273 __ip6_dst_store(sk, dst, NULL);
274 274
275 icsk->icsk_ext_hdr_len = 0; 275 icsk->icsk_ext_hdr_len = 0;
276 if (np->opt) 276 if (np->opt)
@@ -427,7 +427,6 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
427 case TCP_SYN_RECV: /* Cannot happen. 427 case TCP_SYN_RECV: /* Cannot happen.
428 It can, it SYNs are crossed. --ANK */ 428 It can, it SYNs are crossed. --ANK */
429 if (!sock_owned_by_user(sk)) { 429 if (!sock_owned_by_user(sk)) {
430 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
431 sk->sk_err = err; 430 sk->sk_err = err;
432 sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */ 431 sk->sk_error_report(sk); /* Wake people up to see the error (see connect in sock.c) */
433 432
@@ -831,7 +830,6 @@ drop:
831 if (req) 830 if (req)
832 reqsk_free(req); 831 reqsk_free(req);
833 832
834 TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
835 return 0; /* don't send reset */ 833 return 0; /* don't send reset */
836} 834}
837 835
@@ -947,7 +945,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
947 */ 945 */
948 946
949 sk->sk_gso_type = SKB_GSO_TCPV6; 947 sk->sk_gso_type = SKB_GSO_TCPV6;
950 ip6_dst_store(newsk, dst, NULL); 948 __ip6_dst_store(newsk, dst, NULL);
951 949
952 newtcp6sk = (struct tcp6_sock *)newsk; 950 newtcp6sk = (struct tcp6_sock *)newsk;
953 inet_sk(newsk)->pinet6 = &newtcp6sk->inet6; 951 inet_sk(newsk)->pinet6 = &newtcp6sk->inet6;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index ccc57f434cd3..3d54f246411e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -782,7 +782,7 @@ do_udp_sendmsg:
782 connected = 0; 782 connected = 0;
783 } 783 }
784 784
785 err = ip6_dst_lookup(sk, &dst, fl); 785 err = ip6_sk_dst_lookup(sk, &dst, fl);
786 if (err) 786 if (err)
787 goto out; 787 goto out;
788 if (final_p) 788 if (final_p)
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 0eea60ea9ebc..c8c8b44a0f58 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -125,7 +125,7 @@ static int xfrm6_output_finish(struct sk_buff *skb)
125 if (!skb_is_gso(skb)) 125 if (!skb_is_gso(skb))
126 return xfrm6_output_finish2(skb); 126 return xfrm6_output_finish2(skb);
127 127
128 skb->protocol = htons(ETH_P_IP); 128 skb->protocol = htons(ETH_P_IPV6);
129 segs = skb_gso_segment(skb, 0); 129 segs = skb_gso_segment(skb, 0);
130 kfree_skb(skb); 130 kfree_skb(skb);
131 if (unlikely(IS_ERR(segs))) 131 if (unlikely(IS_ERR(segs)))
diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c
index c2ce9c4011cc..de9537ad9a7c 100644
--- a/net/netfilter/xt_SECMARK.c
+++ b/net/netfilter/xt_SECMARK.c
@@ -57,6 +57,8 @@ static int checkentry_selinux(struct xt_secmark_target_info *info)
57{ 57{
58 int err; 58 int err;
59 struct xt_secmark_target_selinux_info *sel = &info->u.sel; 59 struct xt_secmark_target_selinux_info *sel = &info->u.sel;
60
61 sel->selctx[SECMARK_SELCTX_MAX - 1] = '\0';
60 62
61 err = selinux_string_to_sid(sel->selctx, &sel->selsid); 63 err = selinux_string_to_sid(sel->selctx, &sel->selsid);
62 if (err) { 64 if (err) {
diff --git a/net/netfilter/xt_string.c b/net/netfilter/xt_string.c
index 0ebb6ac2c8c7..d8e3891b5f8b 100644
--- a/net/netfilter/xt_string.c
+++ b/net/netfilter/xt_string.c
@@ -55,7 +55,10 @@ static int checkentry(const char *tablename,
55 /* Damn, can't handle this case properly with iptables... */ 55 /* Damn, can't handle this case properly with iptables... */
56 if (conf->from_offset > conf->to_offset) 56 if (conf->from_offset > conf->to_offset)
57 return 0; 57 return 0;
58 58 if (conf->algo[XT_STRING_MAX_ALGO_NAME_SIZE - 1] != '\0')
59 return 0;
60 if (conf->patlen > XT_STRING_MAX_PATTERN_SIZE)
61 return 0;
59 ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen, 62 ts_conf = textsearch_prepare(conf->algo, conf->pattern, conf->patlen,
60 GFP_KERNEL, TS_AUTOLOAD); 63 GFP_KERNEL, TS_AUTOLOAD);
61 if (IS_ERR(ts_conf)) 64 if (IS_ERR(ts_conf))
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 6f2909279268..de6ec519272e 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -128,23 +128,17 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0);
128#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) 128#define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
129 129
130#ifdef CONFIG_SECURITY_NETWORK 130#ifdef CONFIG_SECURITY_NETWORK
131static void unix_get_peersec_dgram(struct sk_buff *skb) 131static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
132{ 132{
133 int err; 133 memcpy(UNIXSID(skb), &scm->secid, sizeof(u32));
134
135 err = security_socket_getpeersec_dgram(skb, UNIXSECDATA(skb),
136 UNIXSECLEN(skb));
137 if (err)
138 *(UNIXSECDATA(skb)) = NULL;
139} 134}
140 135
141static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) 136static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
142{ 137{
143 scm->secdata = *UNIXSECDATA(skb); 138 scm->secid = *UNIXSID(skb);
144 scm->seclen = *UNIXSECLEN(skb);
145} 139}
146#else 140#else
147static inline void unix_get_peersec_dgram(struct sk_buff *skb) 141static inline void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
148{ } 142{ }
149 143
150static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) 144static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
@@ -1322,8 +1316,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1322 memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred)); 1316 memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
1323 if (siocb->scm->fp) 1317 if (siocb->scm->fp)
1324 unix_attach_fds(siocb->scm, skb); 1318 unix_attach_fds(siocb->scm, skb);
1325 1319 unix_get_secdata(siocb->scm, skb);
1326 unix_get_peersec_dgram(skb);
1327 1320
1328 skb->h.raw = skb->data; 1321 skb->h.raw = skb->data;
1329 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); 1322 err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 2180c88cfe89..bb19c1561f1e 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -77,14 +77,20 @@ cc-option-align = $(subst -functions=0,,\
77 77
78# cc-version 78# cc-version
79# Usage gcc-ver := $(call cc-version, $(CC)) 79# Usage gcc-ver := $(call cc-version, $(CC))
80cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ 80cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
81 $(if $(1), $(1), $(CC)))
82 81
83# cc-ifversion 82# cc-ifversion
84# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) 83# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
85cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ 84cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
86 echo $(3); fi;) 85 echo $(3); fi;)
87 86
87# ld-option
88# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
89ld-option = $(shell if $(CC) $(1) \
90 -nostdlib -o ldtest$$$$.out -xc /dev/null \
91 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi; \
92 rm -f ldtest$$$$.out)
93
88### 94###
89# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= 95# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
90# Usage: 96# Usage:
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index a49550205dcc..0a64688c2b5d 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -40,7 +40,7 @@ include scripts/Kbuild.include
40include scripts/Makefile.lib 40include scripts/Makefile.lib
41 41
42kernelsymfile := $(objtree)/Module.symvers 42kernelsymfile := $(objtree)/Module.symvers
43modulesymfile := $(KBUILD_EXTMOD)/Modules.symvers 43modulesymfile := $(KBUILD_EXTMOD)/Module.symvers
44 44
45# Step 1), find all modules listed in $(MODVERDIR)/ 45# Step 1), find all modules listed in $(MODVERDIR)/
46__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 46__modules := $(sort $(shell grep -h '\.ko' /dev/null $(wildcard $(MODVERDIR)/*.mod)))
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2ee48c377b66..a69d8acbf274 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -357,7 +357,7 @@ int conf_read(const char *name)
357 for (e = prop->expr; e; e = e->left.expr) 357 for (e = prop->expr; e; e = e->left.expr)
358 if (e->right.sym->visible != no) 358 if (e->right.sym->visible != no)
359 flags &= e->right.sym->flags; 359 flags &= e->right.sym->flags;
360 sym->flags |= flags & SYMBOL_DEF_USER; 360 sym->flags &= flags | ~SYMBOL_DEF_USER;
361 } 361 }
362 362
363 sym_change_count += conf_warnings || conf_unsaved; 363 sym_change_count += conf_warnings || conf_unsaved;
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index f9460a6218de..c9ca0c23bd91 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1518,6 +1518,7 @@ sub dump_function($$) {
1518 $prototype =~ s/^asmlinkage +//; 1518 $prototype =~ s/^asmlinkage +//;
1519 $prototype =~ s/^inline +//; 1519 $prototype =~ s/^inline +//;
1520 $prototype =~ s/^__inline__ +//; 1520 $prototype =~ s/^__inline__ +//;
1521 $prototype =~ s/__devinit +//;
1521 $prototype =~ s/^#define +//; #ak added 1522 $prototype =~ s/^#define +//; #ak added
1522 $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//; 1523 $prototype =~ s/__attribute__ \(\([a-z,]*\)\)//;
1523 1524
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 37f67c23e11b..44312926b849 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -52,6 +52,23 @@ do { \
52 sprintf(str + strlen(str), "*"); \ 52 sprintf(str + strlen(str), "*"); \
53} while(0) 53} while(0)
54 54
55/**
56 * Check that sizeof(device_id type) are consistent with size of section
57 * in .o file. If in-consistent then userspace and kernel does not agree
58 * on actual size which is a bug.
59 **/
60static void device_id_size_check(const char *modname, const char *device_id,
61 unsigned long size, unsigned long id_size)
62{
63 if (size % id_size || size < id_size) {
64 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
65 "of the size of section __mod_%s_device_table=%lu.\n"
66 "Fix definition of struct %s_device_id "
67 "in mod_devicetable.h\n",
68 modname, device_id, id_size, device_id, size, device_id);
69 }
70}
71
55/* USB is special because the bcdDevice can be matched against a numeric range */ 72/* USB is special because the bcdDevice can be matched against a numeric range */
56/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipN" */ 73/* Looks like "usb:vNpNdNdcNdscNdpNicNiscNipN" */
57static void do_usb_entry(struct usb_device_id *id, 74static void do_usb_entry(struct usb_device_id *id,
@@ -152,10 +169,8 @@ static void do_usb_table(void *symval, unsigned long size,
152 unsigned int i; 169 unsigned int i;
153 const unsigned long id_size = sizeof(struct usb_device_id); 170 const unsigned long id_size = sizeof(struct usb_device_id);
154 171
155 if (size % id_size || size < id_size) { 172 device_id_size_check(mod->name, "usb", size, id_size);
156 warn("%s ids %lu bad size " 173
157 "(each on %lu)\n", mod->name, size, id_size);
158 }
159 /* Leave last one: it's the terminator. */ 174 /* Leave last one: it's the terminator. */
160 size -= id_size; 175 size -= id_size;
161 176
@@ -434,6 +449,7 @@ static inline int sym_is(const char *symbol, const char *name)
434 449
435static void do_table(void *symval, unsigned long size, 450static void do_table(void *symval, unsigned long size,
436 unsigned long id_size, 451 unsigned long id_size,
452 const char *device_id,
437 void *function, 453 void *function,
438 struct module *mod) 454 struct module *mod)
439{ 455{
@@ -441,10 +457,7 @@ static void do_table(void *symval, unsigned long size,
441 char alias[500]; 457 char alias[500];
442 int (*do_entry)(const char *, void *entry, char *alias) = function; 458 int (*do_entry)(const char *, void *entry, char *alias) = function;
443 459
444 if (size % id_size || size < id_size) { 460 device_id_size_check(mod->name, device_id, size, id_size);
445 warn("%s ids %lu bad size "
446 "(each on %lu)\n", mod->name, size, id_size);
447 }
448 /* Leave last one: it's the terminator. */ 461 /* Leave last one: it's the terminator. */
449 size -= id_size; 462 size -= id_size;
450 463
@@ -476,40 +489,51 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
476 + sym->st_value; 489 + sym->st_value;
477 490
478 if (sym_is(symname, "__mod_pci_device_table")) 491 if (sym_is(symname, "__mod_pci_device_table"))
479 do_table(symval, sym->st_size, sizeof(struct pci_device_id), 492 do_table(symval, sym->st_size,
493 sizeof(struct pci_device_id), "pci",
480 do_pci_entry, mod); 494 do_pci_entry, mod);
481 else if (sym_is(symname, "__mod_usb_device_table")) 495 else if (sym_is(symname, "__mod_usb_device_table"))
482 /* special case to handle bcdDevice ranges */ 496 /* special case to handle bcdDevice ranges */
483 do_usb_table(symval, sym->st_size, mod); 497 do_usb_table(symval, sym->st_size, mod);
484 else if (sym_is(symname, "__mod_ieee1394_device_table")) 498 else if (sym_is(symname, "__mod_ieee1394_device_table"))
485 do_table(symval, sym->st_size, sizeof(struct ieee1394_device_id), 499 do_table(symval, sym->st_size,
500 sizeof(struct ieee1394_device_id), "ieee1394",
486 do_ieee1394_entry, mod); 501 do_ieee1394_entry, mod);
487 else if (sym_is(symname, "__mod_ccw_device_table")) 502 else if (sym_is(symname, "__mod_ccw_device_table"))
488 do_table(symval, sym->st_size, sizeof(struct ccw_device_id), 503 do_table(symval, sym->st_size,
504 sizeof(struct ccw_device_id), "ccw",
489 do_ccw_entry, mod); 505 do_ccw_entry, mod);
490 else if (sym_is(symname, "__mod_serio_device_table")) 506 else if (sym_is(symname, "__mod_serio_device_table"))
491 do_table(symval, sym->st_size, sizeof(struct serio_device_id), 507 do_table(symval, sym->st_size,
508 sizeof(struct serio_device_id), "serio",
492 do_serio_entry, mod); 509 do_serio_entry, mod);
493 else if (sym_is(symname, "__mod_pnp_device_table")) 510 else if (sym_is(symname, "__mod_pnp_device_table"))
494 do_table(symval, sym->st_size, sizeof(struct pnp_device_id), 511 do_table(symval, sym->st_size,
512 sizeof(struct pnp_device_id), "pnp",
495 do_pnp_entry, mod); 513 do_pnp_entry, mod);
496 else if (sym_is(symname, "__mod_pnp_card_device_table")) 514 else if (sym_is(symname, "__mod_pnp_card_device_table"))
497 do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id), 515 do_table(symval, sym->st_size,
516 sizeof(struct pnp_card_device_id), "pnp_card",
498 do_pnp_card_entry, mod); 517 do_pnp_card_entry, mod);
499 else if (sym_is(symname, "__mod_pcmcia_device_table")) 518 else if (sym_is(symname, "__mod_pcmcia_device_table"))
500 do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id), 519 do_table(symval, sym->st_size,
520 sizeof(struct pcmcia_device_id), "pcmcia",
501 do_pcmcia_entry, mod); 521 do_pcmcia_entry, mod);
502 else if (sym_is(symname, "__mod_of_device_table")) 522 else if (sym_is(symname, "__mod_of_device_table"))
503 do_table(symval, sym->st_size, sizeof(struct of_device_id), 523 do_table(symval, sym->st_size,
524 sizeof(struct of_device_id), "of",
504 do_of_entry, mod); 525 do_of_entry, mod);
505 else if (sym_is(symname, "__mod_vio_device_table")) 526 else if (sym_is(symname, "__mod_vio_device_table"))
506 do_table(symval, sym->st_size, sizeof(struct vio_device_id), 527 do_table(symval, sym->st_size,
528 sizeof(struct vio_device_id), "vio",
507 do_vio_entry, mod); 529 do_vio_entry, mod);
508 else if (sym_is(symname, "__mod_i2c_device_table")) 530 else if (sym_is(symname, "__mod_i2c_device_table"))
509 do_table(symval, sym->st_size, sizeof(struct i2c_device_id), 531 do_table(symval, sym->st_size,
532 sizeof(struct i2c_device_id), "i2c",
510 do_i2c_entry, mod); 533 do_i2c_entry, mod);
511 else if (sym_is(symname, "__mod_input_device_table")) 534 else if (sym_is(symname, "__mod_input_device_table"))
512 do_table(symval, sym->st_size, sizeof(struct input_device_id), 535 do_table(symval, sym->st_size,
536 sizeof(struct input_device_id), "input",
513 do_input_entry, mod); 537 do_input_entry, mod);
514} 538}
515 539
diff --git a/security/dummy.c b/security/dummy.c
index bbbfda70e131..58c6d399c844 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -791,8 +791,7 @@ static int dummy_socket_getpeersec_stream(struct socket *sock, char __user *optv
791 return -ENOPROTOOPT; 791 return -ENOPROTOOPT;
792} 792}
793 793
794static int dummy_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, 794static int dummy_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
795 u32 *seclen)
796{ 795{
797 return -ENOPROTOOPT; 796 return -ENOPROTOOPT;
798} 797}
@@ -876,6 +875,15 @@ static int dummy_setprocattr(struct task_struct *p, char *name, void *value, siz
876 return -EINVAL; 875 return -EINVAL;
877} 876}
878 877
878static int dummy_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
879{
880 return -EOPNOTSUPP;
881}
882
883static void dummy_release_secctx(char *secdata, u32 seclen)
884{
885}
886
879#ifdef CONFIG_KEYS 887#ifdef CONFIG_KEYS
880static inline int dummy_key_alloc(struct key *key, struct task_struct *ctx, 888static inline int dummy_key_alloc(struct key *key, struct task_struct *ctx,
881 unsigned long flags) 889 unsigned long flags)
@@ -1028,6 +1036,8 @@ void security_fixup_ops (struct security_operations *ops)
1028 set_to_dummy_if_null(ops, d_instantiate); 1036 set_to_dummy_if_null(ops, d_instantiate);
1029 set_to_dummy_if_null(ops, getprocattr); 1037 set_to_dummy_if_null(ops, getprocattr);
1030 set_to_dummy_if_null(ops, setprocattr); 1038 set_to_dummy_if_null(ops, setprocattr);
1039 set_to_dummy_if_null(ops, secid_to_secctx);
1040 set_to_dummy_if_null(ops, release_secctx);
1031#ifdef CONFIG_SECURITY_NETWORK 1041#ifdef CONFIG_SECURITY_NETWORK
1032 set_to_dummy_if_null(ops, unix_stream_connect); 1042 set_to_dummy_if_null(ops, unix_stream_connect);
1033 set_to_dummy_if_null(ops, unix_may_send); 1043 set_to_dummy_if_null(ops, unix_may_send);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index a91c961ba38b..5d1b8c733199 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3524,25 +3524,21 @@ out:
3524 return err; 3524 return err;
3525} 3525}
3526 3526
3527static int selinux_socket_getpeersec_dgram(struct sk_buff *skb, char **secdata, u32 *seclen) 3527static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *skb, u32 *secid)
3528{ 3528{
3529 u32 peer_secid = SECSID_NULL;
3529 int err = 0; 3530 int err = 0;
3530 u32 peer_sid;
3531 3531
3532 if (skb->sk->sk_family == PF_UNIX) 3532 if (sock && (sock->sk->sk_family == PF_UNIX))
3533 selinux_get_inode_sid(SOCK_INODE(skb->sk->sk_socket), 3533 selinux_get_inode_sid(SOCK_INODE(sock), &peer_secid);
3534 &peer_sid); 3534 else if (skb)
3535 else 3535 peer_secid = selinux_socket_getpeer_dgram(skb);
3536 peer_sid = selinux_socket_getpeer_dgram(skb);
3537
3538 if (peer_sid == SECSID_NULL)
3539 return -EINVAL;
3540 3536
3541 err = security_sid_to_context(peer_sid, secdata, seclen); 3537 if (peer_secid == SECSID_NULL)
3542 if (err) 3538 err = -EINVAL;
3543 return err; 3539 *secid = peer_secid;
3544 3540
3545 return 0; 3541 return err;
3546} 3542}
3547 3543
3548static int selinux_sk_alloc_security(struct sock *sk, int family, gfp_t priority) 3544static int selinux_sk_alloc_security(struct sock *sk, int family, gfp_t priority)
@@ -4407,6 +4403,17 @@ static int selinux_setprocattr(struct task_struct *p,
4407 return size; 4403 return size;
4408} 4404}
4409 4405
4406static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
4407{
4408 return security_sid_to_context(secid, secdata, seclen);
4409}
4410
4411static void selinux_release_secctx(char *secdata, u32 seclen)
4412{
4413 if (secdata)
4414 kfree(secdata);
4415}
4416
4410#ifdef CONFIG_KEYS 4417#ifdef CONFIG_KEYS
4411 4418
4412static int selinux_key_alloc(struct key *k, struct task_struct *tsk, 4419static int selinux_key_alloc(struct key *k, struct task_struct *tsk,
@@ -4587,6 +4594,9 @@ static struct security_operations selinux_ops = {
4587 .getprocattr = selinux_getprocattr, 4594 .getprocattr = selinux_getprocattr,
4588 .setprocattr = selinux_setprocattr, 4595 .setprocattr = selinux_setprocattr,
4589 4596
4597 .secid_to_secctx = selinux_secid_to_secctx,
4598 .release_secctx = selinux_release_secctx,
4599
4590 .unix_stream_connect = selinux_socket_unix_stream_connect, 4600 .unix_stream_connect = selinux_socket_unix_stream_connect,
4591 .unix_may_send = selinux_socket_unix_may_send, 4601 .unix_may_send = selinux_socket_unix_may_send,
4592 4602
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 0111990ba837..f03960e697ce 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -644,10 +644,18 @@ void policydb_destroy(struct policydb *p)
644 kfree(lra); 644 kfree(lra);
645 645
646 for (rt = p->range_tr; rt; rt = rt -> next) { 646 for (rt = p->range_tr; rt; rt = rt -> next) {
647 kfree(lrt); 647 if (lrt) {
648 ebitmap_destroy(&lrt->range.level[0].cat);
649 ebitmap_destroy(&lrt->range.level[1].cat);
650 kfree(lrt);
651 }
648 lrt = rt; 652 lrt = rt;
649 } 653 }
650 kfree(lrt); 654 if (lrt) {
655 ebitmap_destroy(&lrt->range.level[0].cat);
656 ebitmap_destroy(&lrt->range.level[1].cat);
657 kfree(lrt);
658 }
651 659
652 if (p->type_attr_map) { 660 if (p->type_attr_map) {
653 for (i = 0; i < p->p_types.nprim; i++) 661 for (i = 0; i < p->p_types.nprim; i++)
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index d2e80e62ff0c..85e429884393 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -833,6 +833,8 @@ static int security_compute_sid(u32 ssid,
833 goto out; 833 goto out;
834 } 834 }
835 835
836 context_init(&newcontext);
837
836 POLICY_RDLOCK; 838 POLICY_RDLOCK;
837 839
838 scontext = sidtab_search(&sidtab, ssid); 840 scontext = sidtab_search(&sidtab, ssid);
@@ -850,8 +852,6 @@ static int security_compute_sid(u32 ssid,
850 goto out_unlock; 852 goto out_unlock;
851 } 853 }
852 854
853 context_init(&newcontext);
854
855 /* Set the user identity. */ 855 /* Set the user identity. */
856 switch (specified) { 856 switch (specified) {
857 case AVTAB_TRANSITION: 857 case AVTAB_TRANSITION: