aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/BUG-HUNTING24
-rw-r--r--Documentation/SubmitChecklist6
-rw-r--r--Documentation/SubmittingPatches39
-rw-r--r--Documentation/feature-removal-schedule.txt1
-rw-r--r--Documentation/hrtimer/timer_stats.txt7
-rw-r--r--Documentation/ia64/aliasing-test.c2
-rw-r--r--Documentation/kernel-parameters.txt42
-rw-r--r--Documentation/networking/xfrm_sysctl.txt4
-rw-r--r--Documentation/powerpc/booting-without-of.txt59
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt1
-rw-r--r--Documentation/thinkpad-acpi.txt25
-rw-r--r--Documentation/vm/slub.txt135
-rw-r--r--Documentation/watchdog/pcwd-watchdog.txt8
-rw-r--r--Documentation/watchdog/watchdog-api.txt236
-rw-r--r--Documentation/watchdog/watchdog.txt94
-rw-r--r--Documentation/watchdog/wdt.txt43
-rw-r--r--MAINTAINERS37
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Kconfig42
-rw-r--r--arch/alpha/boot/tools/mkbb.c2
-rw-r--r--arch/alpha/kernel/console.c70
-rw-r--r--arch/alpha/kernel/core_marvel.c43
-rw-r--r--arch/alpha/kernel/core_titan.c70
-rw-r--r--arch/alpha/kernel/core_tsunami.c24
-rw-r--r--arch/alpha/kernel/proto.h9
-rw-r--r--arch/alpha/kernel/sys_dp264.c11
-rw-r--r--arch/alpha/kernel/sys_marvel.c4
-rw-r--r--arch/alpha/kernel/sys_titan.c2
-rw-r--r--arch/arm/boot/compressed/head.S5
-rw-r--r--arch/arm/mach-at91/clock.c5
-rw-r--r--arch/arm/mach-at91/pm.c11
-rw-r--r--arch/arm/mm/alignment.c2
-rw-r--r--arch/arm/oprofile/op_model_mpcore.c2
-rw-r--r--arch/h8300/kernel/sys_h8300.c4
-rw-r--r--arch/h8300/kernel/traps.c2
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c5
-rw-r--r--arch/i386/kernel/microcode.c2
-rw-r--r--arch/i386/kernel/reboot.c8
-rw-r--r--arch/i386/kernel/smpboot.c5
-rw-r--r--arch/i386/kernel/vmi.c1
-rw-r--r--arch/i386/mm/fault.c5
-rw-r--r--arch/i386/oprofile/nmi_int.c12
-rw-r--r--arch/i386/pci/fixup.c11
-rw-r--r--arch/m68k/Kconfig13
-rw-r--r--arch/m68k/Makefile1
-rw-r--r--arch/m68k/kernel/Makefile3
-rw-r--r--arch/m68k/kernel/module.c31
-rw-r--r--arch/m68k/kernel/module.lds7
-rw-r--r--arch/m68k/kernel/setup.c37
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds5
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds5
-rw-r--r--arch/m68k/mac/debug.c2
-rw-r--r--arch/m68k/mm/init.c119
-rw-r--r--arch/m68k/mm/memory.c73
-rw-r--r--arch/m68k/mm/motorola.c104
-rw-r--r--arch/m68k/sun3/config.c2
-rw-r--r--arch/mips/Kconfig6
-rw-r--r--arch/mips/emma2rh/markeins/setup.c24
-rw-r--r--arch/mips/jmr3927/rbhma3100/kgdb_io.c2
-rw-r--r--arch/mips/kernel/linux32.c10
-rw-r--r--arch/mips/kernel/r4k_switch.S2
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/traps.c12
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c2
-rw-r--r--arch/mips/mips-boards/generic/display.c24
-rw-r--r--arch/mips/mips-boards/generic/time.c31
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c6
-rw-r--r--arch/mips/mips-boards/sead/sead_setup.c2
-rw-r--r--arch/mips/mm/dma-default.c5
-rw-r--r--arch/mips/pci/pci-ocelot.c14
-rw-r--r--arch/mips/qemu/q-irq.c2
-rw-r--r--arch/mips/sni/pcimt.c18
-rw-r--r--arch/mips/sni/setup.c33
-rw-r--r--arch/powerpc/Makefile1
-rw-r--r--arch/powerpc/boot/Makefile22
-rw-r--r--arch/powerpc/boot/crt0.S1
-rwxr-xr-xarch/powerpc/boot/wrapper4
-rw-r--r--arch/powerpc/kernel/irq.c6
-rw-r--r--arch/powerpc/kernel/of_platform.c2
-rw-r--r--arch/powerpc/kernel/prom.c11
-rw-r--r--arch/powerpc/kernel/ptrace.c2
-rw-r--r--arch/powerpc/platforms/cell/cbe_cpufreq.c33
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c4
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c57
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c62
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c161
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h2
-rw-r--r--arch/powerpc/platforms/celleb/Makefile2
-rw-r--r--arch/powerpc/platforms/pasemi/idle.c1
-rw-r--r--arch/powerpc/platforms/pasemi/iommu.c8
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c1
-rw-r--r--arch/powerpc/platforms/pseries/xics.c10
-rw-r--r--arch/ppc/syslib/ibm_ocp.c1
-rw-r--r--arch/s390/hypfs/hypfs_diag.c17
-rw-r--r--arch/s390/kernel/debug.c22
-rw-r--r--arch/s390/kernel/setup.c4
-rw-r--r--arch/s390/kernel/smp.c6
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sh/boards/se/73180/setup.c4
-rw-r--r--arch/sh/boards/superh/microdev/irq.c1
-rw-r--r--arch/sh/cchips/voyagergx/irq.c13
-rw-r--r--arch/sh/drivers/dma/dma-api.c1
-rw-r--r--arch/sh/kernel/cf-enabler.c6
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S3
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4-202.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c1
-rw-r--r--arch/sh/kernel/smp.c2
-rw-r--r--arch/sh/kernel/timers/timer.c5
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c1
-rw-r--r--arch/sh/mm/ioremap.c1
-rw-r--r--arch/sparc/lib/atomic32.c4
-rw-r--r--arch/sparc64/Kconfig9
-rw-r--r--arch/sparc64/kernel/Makefile4
-rw-r--r--arch/sparc64/kernel/entry.S94
-rw-r--r--arch/sparc64/kernel/mdesc.c53
-rw-r--r--arch/sparc64/kernel/pci_sabre.c17
-rw-r--r--arch/sparc64/kernel/prom.c59
-rw-r--r--arch/sparc64/kernel/sbus.c54
-rw-r--r--arch/sparc64/kernel/setup.c19
-rw-r--r--arch/sparc64/kernel/smp.c21
-rw-r--r--arch/sparc64/kernel/sysfs.c297
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S11
-rw-r--r--arch/x86_64/mm/fault.c6
-rw-r--r--arch/x86_64/mm/init.c6
-rw-r--r--crypto/cryptd.c4
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/numa.c2
-rw-r--r--drivers/acpi/osl.c118
-rw-r--r--drivers/acpi/tables/tbinstal.c8
-rw-r--r--drivers/acpi/thermal.c13
-rw-r--r--drivers/acpi/toshiba_acpi.c2
-rw-r--r--drivers/acpi/utilities/utcopy.c120
-rw-r--r--drivers/acpi/utilities/uteval.c28
-rw-r--r--drivers/acpi/utilities/utobject.c42
-rw-r--r--drivers/acpi/utilities/utxface.c4
-rw-r--r--drivers/ata/libata-core.c14
-rw-r--r--drivers/ata/pata_via.c12
-rw-r--r--drivers/atm/firestream.c15
-rw-r--r--drivers/auxdisplay/Kconfig4
-rw-r--r--drivers/auxdisplay/cfag12864bfb.c8
-rw-r--r--drivers/char/drm/drm_drawable.c41
-rw-r--r--drivers/char/drm/drm_pciids.h7
-rw-r--r--drivers/char/drm/i915_irq.c2
-rw-r--r--drivers/char/n_tty.c1
-rw-r--r--drivers/char/tty_io.c3
-rw-r--r--drivers/char/watchdog/Kconfig7
-rw-r--r--drivers/char/watchdog/Makefile1
-rw-r--r--drivers/char/watchdog/ixp2000_wdt.c2
-rw-r--r--drivers/char/watchdog/ks8695_wdt.c308
-rw-r--r--drivers/firewire/fw-card.c5
-rw-r--r--drivers/firewire/fw-cdev.c17
-rw-r--r--drivers/firewire/fw-device.h1
-rw-r--r--drivers/firewire/fw-ohci.c187
-rw-r--r--drivers/firewire/fw-sbp2.c53
-rw-r--r--drivers/ieee1394/nodemgr.c7
-rw-r--r--drivers/ieee1394/nodemgr.h1
-rw-r--r--drivers/ieee1394/sbp2.c31
-rw-r--r--drivers/infiniband/hw/amso1100/c2.c2
-rw-r--r--drivers/input/evdev.c2
-rw-r--r--drivers/input/joydev.c2
-rw-r--r--drivers/input/joystick/db9.c2
-rw-r--r--drivers/input/keyboard/pxa27x_keyboard.c6
-rw-r--r--drivers/input/mouse/Kconfig2
-rw-r--r--drivers/input/mousedev.c2
-rw-r--r--drivers/input/tsdev.c2
-rw-r--r--drivers/isdn/Kconfig9
-rw-r--r--drivers/isdn/hardware/eicon/diva_didd.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasfunc.c2
-rw-r--r--drivers/isdn/i4l/isdn_tty.c3
-rw-r--r--drivers/kvm/vmx.c2
-rw-r--r--drivers/macintosh/Kconfig2
-rw-r--r--drivers/mfd/ucb1x00-ts.c7
-rw-r--r--drivers/misc/thinkpad_acpi.c17
-rw-r--r--drivers/misc/thinkpad_acpi.h6
-rw-r--r--drivers/misc/tifm_7xx1.c2
-rw-r--r--drivers/mtd/Makefile3
-rw-r--r--drivers/mtd/devices/pmc551.c2
-rw-r--r--drivers/mtd/maps/uclinux.c5
-rw-r--r--drivers/mtd/mtdsuper.c232
-rw-r--r--drivers/mtd/nand/autcpu12.c2
-rw-r--r--drivers/mtd/nand/ppchameleonevb.c6
-rw-r--r--drivers/net/8139cp.c17
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/acenic.c21
-rw-r--r--drivers/net/acenic.h1
-rw-r--r--drivers/net/amd8111e.c13
-rw-r--r--drivers/net/amd8111e.h2
-rw-r--r--drivers/net/atl1/atl1_main.c33
-rw-r--r--drivers/net/bnx2.c75
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/cassini.c2
-rw-r--r--drivers/net/chelsio/cxgb2.c10
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c6
-rw-r--r--drivers/net/e1000/e1000_main.c11
-rw-r--r--drivers/net/fec_8xx/fec_main.c2
-rw-r--r--drivers/net/forcedeth.c8
-rw-r--r--drivers/net/gianfar.c16
-rw-r--r--drivers/net/hp100.c2
-rw-r--r--drivers/net/myri10ge/myri10ge.c1
-rw-r--r--drivers/net/netxen/netxen_nic_main.c2
-rw-r--r--drivers/net/ns83820.c12
-rwxr-xr-xdrivers/net/qla3xxx.c2
-rw-r--r--drivers/net/r8169.c11
-rw-r--r--drivers/net/s2io.c12
-rw-r--r--drivers/net/skfp/smt.c2
-rw-r--r--drivers/net/sky2.c31
-rw-r--r--drivers/net/smc91x.h5
-rw-r--r--drivers/net/spider_net.c40
-rw-r--r--drivers/net/tg3.c21
-rw-r--r--drivers/net/typhoon.c11
-rw-r--r--drivers/pci/msi.c12
-rw-r--r--drivers/pci/quirks.c20
-rw-r--r--drivers/pci/search.c3
-rw-r--r--drivers/pcmcia/at91_cf.c13
-rw-r--r--drivers/rtc/rtc-cmos.c13
-rw-r--r--drivers/s390/block/dasd_eer.c16
-rw-r--r--drivers/s390/char/raw3270.c10
-rw-r--r--drivers/s390/cio/device.c49
-rw-r--r--drivers/s390/cio/device_fsm.c6
-rw-r--r--drivers/sbus/char/flash.c1
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/NCR5380.c2
-rw-r--r--drivers/scsi/aacraid/linit.c22
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_core.c2
-rw-r--r--drivers/scsi/atari_NCR5380.c44
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/scsi_scan.c9
-rw-r--r--drivers/serial/amba-pl010.c4
-rw-r--r--drivers/spi/atmel_spi.c8
-rw-r--r--drivers/spi/spi.c2
-rw-r--r--drivers/spi/spi_imx.c3
-rw-r--r--drivers/video/Kconfig6
-rw-r--r--drivers/video/arkfb.c3
-rw-r--r--drivers/video/console/Makefile2
-rw-r--r--drivers/video/console/fbcon.h1
-rw-r--r--drivers/video/ffb.c4
-rw-r--r--drivers/video/neofb.c30
-rw-r--r--drivers/video/pm3fb.c2
-rw-r--r--drivers/video/skeletonfb.c31
-rw-r--r--drivers/video/sunxvr2500.c17
-rw-r--r--drivers/video/sunxvr500.c6
-rw-r--r--drivers/video/vt8623fb.c3
-rw-r--r--fs/afs/internal.h2
-rw-r--r--fs/ext4/balloc.c6
-rw-r--r--fs/ext4/extents.c148
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/ext4/namei.c4
-rw-r--r--fs/ext4/super.c2
-rw-r--r--fs/ioctl.c14
-rw-r--r--fs/jffs2/readinode.c22
-rw-r--r--fs/jffs2/super.c194
-rw-r--r--fs/jffs2/xattr.c6
-rw-r--r--fs/ntfs/inode.c2
-rw-r--r--fs/udf/inode.c12
-rw-r--r--fs/udf/super.c2
-rw-r--r--include/acpi/acpi_numa.h2
-rw-r--r--include/acpi/acpiosxf.h3
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/acutils.h2
-rw-r--r--include/asm-alpha/core_t2.h26
-rw-r--r--include/asm-alpha/core_titan.h7
-rw-r--r--include/asm-alpha/core_tsunami.h15
-rw-r--r--include/asm-alpha/core_wildfire.h2
-rw-r--r--include/asm-alpha/vga.h31
-rw-r--r--include/asm-arm/arch-at91/at91_shdwc.h4
-rw-r--r--include/asm-arm/arch-at91/at91_wdt.h2
-rw-r--r--include/asm-arm/arch-pxa/gpio.h3
-rw-r--r--include/asm-frv/system.h1
-rw-r--r--include/asm-generic/vmlinux.lds.h10
-rw-r--r--include/asm-h8300/processor.h2
-rw-r--r--include/asm-m68k/mmzone.h9
-rw-r--r--include/asm-m68k/module.h34
-rw-r--r--include/asm-m68k/motorola_pgtable.h10
-rw-r--r--include/asm-m68k/page.h77
-rw-r--r--include/asm-m68k/pgalloc.h3
-rw-r--r--include/asm-m68k/pgtable.h17
-rw-r--r--include/asm-m68k/sun3_pgtable.h4
-rw-r--r--include/asm-m68k/virtconvert.h49
-rw-r--r--include/asm-mips/asmmacro.h15
-rw-r--r--include/asm-mips/mips-boards/prom.h1
-rw-r--r--include/asm-mips/unistd.h1
-rw-r--r--include/asm-powerpc/pgalloc-64.h3
-rw-r--r--include/asm-powerpc/tlb.h9
-rw-r--r--include/asm-sh/cpu-sh4/freq.h3
-rw-r--r--include/asm-sh/dma.h1
-rw-r--r--include/asm-sh/io.h6
-rw-r--r--include/asm-sh/se73180.h11
-rw-r--r--include/asm-sh/smp.h2
-rw-r--r--include/asm-sh/spinlock.h8
-rw-r--r--include/asm-sh/spinlock_types.h4
-rw-r--r--include/asm-sparc64/cpudata.h2
-rw-r--r--include/asm-sparc64/dma-mapping.h83
-rw-r--r--include/asm-sparc64/hypervisor.h173
-rw-r--r--include/asm-sparc64/smp.h2
-rw-r--r--include/asm-sparc64/topology.h13
-rw-r--r--include/linux/Kbuild2
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/errno.h7
-rw-r--r--include/linux/ext4_fs.h33
-rw-r--r--include/linux/ext4_fs_extents.h5
-rw-r--r--include/linux/ext4_fs_i.h6
-rw-r--r--include/linux/fb.h1
-rw-r--r--include/linux/firewire-cdev.h14
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/inetdevice.h103
-rw-r--r--include/linux/ipv6.h3
-rw-r--r--include/linux/libata.h1
-rw-r--r--include/linux/mtd/super.h30
-rw-r--r--include/linux/netdevice.h27
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h20
-rw-r--r--include/linux/pci_ids.h6
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/net/af_unix.h8
-rw-r--r--include/net/fib_rules.h2
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ip_fib.h2
-rw-r--r--include/net/netlink.h12
-rw-r--r--include/net/sock.h2
-rw-r--r--include/net/tcp.h6
-rw-r--r--include/net/udp.h9
-rw-r--r--include/net/udplite.h2
-rw-r--r--include/net/xfrm.h7
-rw-r--r--include/sound/version.h4
-rw-r--r--kernel/futex_compat.c9
-rw-r--r--kernel/signal.c16
-rw-r--r--kernel/time/timer_stats.c44
-rw-r--r--lib/Kconfig.debug5
-rw-r--r--mm/memory_hotplug.c2
-rw-r--r--mm/page_alloc.c2
-rw-r--r--mm/slub.c22
-rw-r--r--mm/sparse.c11
-rw-r--r--net/8021q/vlan.c13
-rw-r--r--net/bridge/br_fdb.c14
-rw-r--r--net/bridge/br_stp.c3
-rw-r--r--net/bridge/br_stp_timer.c2
-rw-r--r--net/core/dev.c8
-rw-r--r--net/core/dst.c17
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/core/rtnetlink.c8
-rw-r--r--net/core/sock.c2
-rw-r--r--net/core/sysctl_net_core.c9
-rw-r--r--net/core/utils.c6
-rw-r--r--net/dccp/probe.c2
-rw-r--r--net/decnet/dn_dev.c2
-rw-r--r--net/decnet/dn_rules.c2
-rw-r--r--net/ipv4/arp.c11
-rw-r--r--net/ipv4/datagram.c6
-rw-r--r--net/ipv4/devinet.c409
-rw-r--r--net/ipv4/fib_frontend.c13
-rw-r--r--net/ipv4/fib_rules.c2
-rw-r--r--net/ipv4/icmp.c15
-rw-r--r--net/ipv4/igmp.c18
-rw-r--r--net/ipv4/inet_connection_sock.c4
-rw-r--r--net/ipv4/ip_output.c4
-rw-r--r--net/ipv4/ipmr.c23
-rw-r--r--net/ipv4/netfilter/ip_tables.c81
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c13
-rw-r--r--net/ipv4/proc.c2
-rw-r--r--net/ipv4/route.c14
-rw-r--r--net/ipv4/sysctl_net_ipv4.c6
-rw-r--r--net/ipv4/tcp.c8
-rw-r--r--net/ipv4/tcp_input.c4
-rw-r--r--net/ipv4/tcp_ipv4.c7
-rw-r--r--net/ipv4/tcp_probe.c5
-rw-r--r--net/ipv4/tcp_timer.c8
-rw-r--r--net/ipv4/udp.c246
-rw-r--r--net/ipv4/udp_impl.h6
-rw-r--r--net/ipv4/udplite.c7
-rw-r--r--net/ipv4/xfrm4_input.c6
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c2
-rw-r--r--net/ipv6/addrconf.c2
-rw-r--r--net/ipv6/ah6.c2
-rw-r--r--net/ipv6/fib6_rules.c2
-rw-r--r--net/ipv6/ip6_fib.c9
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c12
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c3
-rw-r--r--net/ipv6/route.c2
-rw-r--r--net/ipv6/udp.c21
-rw-r--r--net/ipv6/udp_impl.h2
-rw-r--r--net/ipv6/udplite.c2
-rw-r--r--net/ipv6/xfrm6_input.c6
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c1
-rw-r--r--net/key/af_key.c10
-rw-r--r--net/mac80211/ieee80211.c6
-rw-r--r--net/mac80211/ieee80211_sta.c4
-rw-r--r--net/netfilter/nf_conntrack_amanda.c12
-rw-r--r--net/netfilter/nf_conntrack_core.c26
-rw-r--r--net/netfilter/nf_conntrack_expect.c4
-rw-r--r--net/netfilter/nf_conntrack_helper.c2
-rw-r--r--net/netfilter/nf_conntrack_netlink.c34
-rw-r--r--net/netfilter/nf_conntrack_proto_gre.c2
-rw-r--r--net/netlabel/netlabel_cipso_v4.c2
-rw-r--r--net/netlabel/netlabel_mgmt.c2
-rw-r--r--net/netlabel/netlabel_unlabeled.c2
-rw-r--r--net/netlink/attr.c8
-rw-r--r--net/netlink/genetlink.c2
-rw-r--r--net/packet/af_packet.c56
-rw-r--r--net/sched/act_pedit.c3
-rw-r--r--net/sched/sch_atm.c1
-rw-r--r--net/sched/sch_cbq.c8
-rw-r--r--net/sched/sch_generic.c3
-rw-r--r--net/sctp/debug.c8
-rw-r--r--net/sctp/sm_statetable.c2
-rw-r--r--net/unix/af_unix.c140
-rw-r--r--net/wanrouter/wanmain.c2
-rw-r--r--net/xfrm/xfrm_policy.c66
-rw-r--r--net/xfrm/xfrm_state.c61
-rw-r--r--net/xfrm/xfrm_user.c9
-rwxr-xr-xscripts/checkpatch.pl595
-rw-r--r--sound/arm/sa11xx-uda1341.c2
-rw-r--r--sound/pci/ali5451/ali5451.c6
-rw-r--r--sound/pci/hda/hda_codec.c13
-rw-r--r--sound/pci/hda/hda_local.h2
-rw-r--r--sound/pci/hda/patch_conexant.c48
-rw-r--r--sound/pci/hda/patch_realtek.c5
-rw-r--r--sound/pci/hda/patch_si3054.c2
-rw-r--r--sound/pci/hda/patch_sigmatel.c64
-rw-r--r--sound/soc/s3c24xx/s3c24xx-pcm.c2
421 files changed, 5666 insertions, 3093 deletions
diff --git a/Documentation/BUG-HUNTING b/Documentation/BUG-HUNTING
index 65b97e1dbf70..35f5bd243336 100644
--- a/Documentation/BUG-HUNTING
+++ b/Documentation/BUG-HUNTING
@@ -191,6 +191,30 @@ e.g. crash dump output as shown by Dave Miller.
191> mov 0x8(%ebp), %ebx ! %ebx = skb->sk 191> mov 0x8(%ebp), %ebx ! %ebx = skb->sk
192> mov 0x13c(%ebx), %eax ! %eax = inet_sk(sk)->opt 192> mov 0x13c(%ebx), %eax ! %eax = inet_sk(sk)->opt
193 193
194In addition, you can use GDB to figure out the exact file and line
195number of the OOPS from the vmlinux file. If you have
196CONFIG_DEBUG_INFO enabled, you can simply copy the EIP value from the
197OOPS:
198
199 EIP: 0060:[<c021e50e>] Not tainted VLI
200
201And use GDB to translate that to human-readable form:
202
203 gdb vmlinux
204 (gdb) l *0xc021e50e
205
206If you don't have CONFIG_DEBUG_INFO enabled, you use the function
207offset from the OOPS:
208
209 EIP is at vt_ioctl+0xda8/0x1482
210
211And recompile the kernel with CONFIG_DEBUG_INFO enabled:
212
213 make vmlinux
214 gdb vmlinux
215 (gdb) p vt_ioctl
216 (gdb) l *(0x<address of vt_ioctl> + 0xda8)
217
194Another very useful option of the Kernel Hacking section in menuconfig is 218Another very useful option of the Kernel Hacking section in menuconfig is
195Debug memory allocations. This will help you see whether data has been 219Debug memory allocations. This will help you see whether data has been
196initialised and not set before use etc. To see the values that get assigned 220initialised and not set before use etc. To see the values that get assigned
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index 3af3e65cf43b..6ebffb57e3db 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -84,3 +84,9 @@ kernel patches.
8424: Avoid whitespace damage such as indenting with spaces or whitespace 8424: Avoid whitespace damage such as indenting with spaces or whitespace
85 at the end of lines. You can test this by feeding the patch to 85 at the end of lines. You can test this by feeding the patch to
86 "git apply --check --whitespace=error-all" 86 "git apply --check --whitespace=error-all"
87
8825: Check your patch for general style as detailed in
89 Documentation/CodingStyle. Check for trivial violations with the
90 patch style checker prior to submission (scripts/checkpatch.pl).
91 You should be able to justify all violations that remain in
92 your patch.
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index a417b25fb1aa..d91125ab6f49 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -118,7 +118,20 @@ then only post say 15 or so at a time and wait for review and integration.
118 118
119 119
120 120
1214) Select e-mail destination. 1214) Style check your changes.
122
123Check your patch for basic style violations, details of which can be
124found in Documentation/CodingStyle. Failure to do so simply wastes
125the reviewers time and will get your patch rejected, probabally
126without even being read.
127
128At a minimum you should check your patches with the patch style
129checker prior to submission (scripts/patchcheck.pl). You should
130be able to justify all violations that remain in your patch.
131
132
133
1345) Select e-mail destination.
122 135
123Look through the MAINTAINERS file and the source code, and determine 136Look through the MAINTAINERS file and the source code, and determine
124if your change applies to a specific subsystem of the kernel, with 137if your change applies to a specific subsystem of the kernel, with
@@ -146,7 +159,7 @@ discussed should the patch then be submitted to Linus.
146 159
147 160
148 161
1495) Select your CC (e-mail carbon copy) list. 1626) Select your CC (e-mail carbon copy) list.
150 163
151Unless you have a reason NOT to do so, CC linux-kernel@vger.kernel.org. 164Unless you have a reason NOT to do so, CC linux-kernel@vger.kernel.org.
152 165
@@ -187,8 +200,7 @@ URL: <http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/>
187 200
188 201
189 202
190 2037) No MIME, no links, no compression, no attachments. Just plain text.
1916) No MIME, no links, no compression, no attachments. Just plain text.
192 204
193Linus and other kernel developers need to be able to read and comment 205Linus and other kernel developers need to be able to read and comment
194on the changes you are submitting. It is important for a kernel 206on the changes you are submitting. It is important for a kernel
@@ -223,9 +235,9 @@ pref("mailnews.display.disable_format_flowed_support", true);
223 235
224 236
225 237
2267) E-mail size. 2388) E-mail size.
227 239
228When sending patches to Linus, always follow step #6. 240When sending patches to Linus, always follow step #7.
229 241
230Large changes are not appropriate for mailing lists, and some 242Large changes are not appropriate for mailing lists, and some
231maintainers. If your patch, uncompressed, exceeds 40 kB in size, 243maintainers. If your patch, uncompressed, exceeds 40 kB in size,
@@ -234,7 +246,7 @@ server, and provide instead a URL (link) pointing to your patch.
234 246
235 247
236 248
2378) Name your kernel version. 2499) Name your kernel version.
238 250
239It is important to note, either in the subject line or in the patch 251It is important to note, either in the subject line or in the patch
240description, the kernel version to which this patch applies. 252description, the kernel version to which this patch applies.
@@ -244,7 +256,7 @@ Linus will not apply it.
244 256
245 257
246 258
2479) Don't get discouraged. Re-submit. 25910) Don't get discouraged. Re-submit.
248 260
249After you have submitted your change, be patient and wait. If Linus 261After you have submitted your change, be patient and wait. If Linus
250likes your change and applies it, it will appear in the next version 262likes your change and applies it, it will appear in the next version
@@ -270,7 +282,7 @@ When in doubt, solicit comments on linux-kernel mailing list.
270 282
271 283
272 284
27310) Include PATCH in the subject 28511) Include PATCH in the subject
274 286
275Due to high e-mail traffic to Linus, and to linux-kernel, it is common 287Due to high e-mail traffic to Linus, and to linux-kernel, it is common
276convention to prefix your subject line with [PATCH]. This lets Linus 288convention to prefix your subject line with [PATCH]. This lets Linus
@@ -279,7 +291,7 @@ e-mail discussions.
279 291
280 292
281 293
28211) Sign your work 29412) Sign your work
283 295
284To improve tracking of who did what, especially with patches that can 296To improve tracking of who did what, especially with patches that can
285percolate to their final resting place in the kernel through several 297percolate to their final resting place in the kernel through several
@@ -328,7 +340,8 @@ now, but you can do this to mark internal company procedures or just
328point out some special detail about the sign-off. 340point out some special detail about the sign-off.
329 341
330 342
33112) The canonical patch format 343
34413) The canonical patch format
332 345
333The canonical patch subject line is: 346The canonical patch subject line is:
334 347
@@ -427,6 +440,10 @@ section Linus Computer Science 101.
427Nuff said. If your code deviates too much from this, it is likely 440Nuff said. If your code deviates too much from this, it is likely
428to be rejected without further review, and without comment. 441to be rejected without further review, and without comment.
429 442
443Check your patches with the patch style checker prior to submission
444(scripts/checkpatch.pl). You should be able to justify all
445violations that remain in your patch.
446
430 447
431 448
4322) #ifdefs are ugly 4492) #ifdefs are ugly
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 2d7ea85075ba..49ae1ea9e868 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -70,6 +70,7 @@ Who: David Miller <davem@davemloft.net>
70 70
71What: Video4Linux API 1 ioctls and video_decoder.h from Video devices. 71What: Video4Linux API 1 ioctls and video_decoder.h from Video devices.
72When: December 2006 72When: December 2006
73Files: include/linux/video_decoder.h
73Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6 74Why: V4L1 AP1 was replaced by V4L2 API. during migration from 2.4 to 2.6
74 series. The old API have lots of drawbacks and don't provide enough 75 series. The old API have lots of drawbacks and don't provide enough
75 means to work with all video and audio standards. The newer API is 76 means to work with all video and audio standards. The newer API is
diff --git a/Documentation/hrtimer/timer_stats.txt b/Documentation/hrtimer/timer_stats.txt
index 27f782e3593f..22b0814d0ad0 100644
--- a/Documentation/hrtimer/timer_stats.txt
+++ b/Documentation/hrtimer/timer_stats.txt
@@ -2,9 +2,10 @@ timer_stats - timer usage statistics
2------------------------------------ 2------------------------------------
3 3
4timer_stats is a debugging facility to make the timer (ab)usage in a Linux 4timer_stats is a debugging facility to make the timer (ab)usage in a Linux
5system visible to kernel and userspace developers. It is not intended for 5system visible to kernel and userspace developers. If enabled in the config
6production usage as it adds significant overhead to the (hr)timer code and the 6but not used it has almost zero runtime overhead, and a relatively small
7(hr)timer data structures. 7data structure overhead. Even if collection is enabled runtime all the
8locking is per-CPU and lookup is hashed.
8 9
9timer_stats should be used by kernel and userspace developers to verify that 10timer_stats should be used by kernel and userspace developers to verify that
10their code does not make unduly use of timers. This helps to avoid unnecessary 11their code does not make unduly use of timers. This helps to avoid unnecessary
diff --git a/Documentation/ia64/aliasing-test.c b/Documentation/ia64/aliasing-test.c
index 3153167b41c3..d485256ee1ce 100644
--- a/Documentation/ia64/aliasing-test.c
+++ b/Documentation/ia64/aliasing-test.c
@@ -197,7 +197,7 @@ skip:
197 return rc; 197 return rc;
198} 198}
199 199
200main() 200int main()
201{ 201{
202 int rc; 202 int rc;
203 203
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index aae2282600ca..5d0283cd3a81 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -170,7 +170,10 @@ and is between 256 and 4096 characters. It is defined in the file
170 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS 170 acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS
171 Format: To spoof as Windows 98: ="Microsoft Windows" 171 Format: To spoof as Windows 98: ="Microsoft Windows"
172 172
173 acpi_osi= [HW,ACPI] empty param disables _OSI 173 acpi_osi= [HW,ACPI] Modify list of supported OS interface strings
174 acpi_osi="string1" # add string1 -- only one string
175 acpi_osi="!string2" # remove built-in string2
176 acpi_osi= # disable all strings
174 177
175 acpi_serialize [HW,ACPI] force serialization of AML methods 178 acpi_serialize [HW,ACPI] force serialization of AML methods
176 179
@@ -1132,9 +1135,9 @@ and is between 256 and 4096 characters. It is defined in the file
1132 when set. 1135 when set.
1133 Format: <int> 1136 Format: <int>
1134 1137
1135 noaliencache [MM, NUMA] Disables the allcoation of alien caches in 1138 noaliencache [MM, NUMA, SLAB] Disables the allocation of alien
1136 the slab allocator. Saves per-node memory, but will 1139 caches in the slab allocator. Saves per-node memory,
1137 impact performance on real NUMA hardware. 1140 but will impact performance.
1138 1141
1139 noalign [KNL,ARM] 1142 noalign [KNL,ARM]
1140 1143
@@ -1613,6 +1616,37 @@ and is between 256 and 4096 characters. It is defined in the file
1613 1616
1614 slram= [HW,MTD] 1617 slram= [HW,MTD]
1615 1618
1619 slub_debug [MM, SLUB]
1620 Enabling slub_debug allows one to determine the culprit
1621 if slab objects become corrupted. Enabling slub_debug
1622 creates guard zones around objects and poisons objects
1623 when not in use. Also tracks the last alloc / free.
1624 For more information see Documentation/vm/slub.txt.
1625
1626 slub_max_order= [MM, SLUB]
1627 Determines the maximum allowed order for slabs. Setting
1628 this too high may cause fragmentation.
1629 For more information see Documentation/vm/slub.txt.
1630
1631 slub_min_objects= [MM, SLUB]
1632 The minimum objects per slab. SLUB will increase the
1633 slab order up to slub_max_order to generate a
1634 sufficiently big slab to satisfy the number of objects.
1635 The higher the number of objects the smaller the overhead
1636 of tracking slabs.
1637 For more information see Documentation/vm/slub.txt.
1638
1639 slub_min_order= [MM, SLUB]
1640 Determines the mininum page order for slabs. Must be
1641 lower than slub_max_order
1642 For more information see Documentation/vm/slub.txt.
1643
1644 slub_nomerge [MM, SLUB]
1645 Disable merging of slabs of similar size. May be
1646 necessary if there is some reason to distinguish
1647 allocs to different slabs.
1648 For more information see Documentation/vm/slub.txt.
1649
1616 smart2= [HW] 1650 smart2= [HW]
1617 Format: <io1>[,<io2>[,...,<io8>]] 1651 Format: <io1>[,<io2>[,...,<io8>]]
1618 1652
diff --git a/Documentation/networking/xfrm_sysctl.txt b/Documentation/networking/xfrm_sysctl.txt
new file mode 100644
index 000000000000..5bbd16792fe1
--- /dev/null
+++ b/Documentation/networking/xfrm_sysctl.txt
@@ -0,0 +1,4 @@
1/proc/sys/net/core/xfrm_* Variables:
2
3xfrm_acq_expires - INTEGER
4 default 30 - hard timeout in seconds for acquire requests
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index b49ce169a63a..d42d98107d49 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1,7 +1,6 @@
1 Booting the Linux/ppc kernel without Open Firmware 1 Booting the Linux/ppc kernel without Open Firmware
2 -------------------------------------------------- 2 --------------------------------------------------
3 3
4
5(c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>, 4(c) 2005 Benjamin Herrenschmidt <benh at kernel.crashing.org>,
6 IBM Corp. 5 IBM Corp.
7(c) 2005 Becky Bruce <becky.bruce at freescale.com>, 6(c) 2005 Becky Bruce <becky.bruce at freescale.com>,
@@ -9,6 +8,62 @@
9(c) 2006 MontaVista Software, Inc. 8(c) 2006 MontaVista Software, Inc.
10 Flash chip node definition 9 Flash chip node definition
11 10
11Table of Contents
12=================
13
14 I - Introduction
15 1) Entry point for arch/powerpc
16 2) Board support
17
18 II - The DT block format
19 1) Header
20 2) Device tree generalities
21 3) Device tree "structure" block
22 4) Device tree "strings" block
23
24 III - Required content of the device tree
25 1) Note about cells and address representation
26 2) Note about "compatible" properties
27 3) Note about "name" properties
28 4) Note about node and property names and character set
29 5) Required nodes and properties
30 a) The root node
31 b) The /cpus node
32 c) The /cpus/* nodes
33 d) the /memory node(s)
34 e) The /chosen node
35 f) the /soc<SOCname> node
36
37 IV - "dtc", the device tree compiler
38
39 V - Recommendations for a bootloader
40
41 VI - System-on-a-chip devices and nodes
42 1) Defining child nodes of an SOC
43 2) Representing devices without a current OF specification
44 a) MDIO IO device
45 c) PHY nodes
46 b) Gianfar-compatible ethernet nodes
47 d) Interrupt controllers
48 e) I2C
49 f) Freescale SOC USB controllers
50 g) Freescale SOC SEC Security Engines
51 h) Board Control and Status (BCSR)
52 i) Freescale QUICC Engine module (QE)
53 g) Flash chip nodes
54
55 VII - Specifying interrupt information for devices
56 1) interrupts property
57 2) interrupt-parent property
58 3) OpenPIC Interrupt Controllers
59 4) ISA Interrupt Controllers
60
61 Appendix A - Sample SOC node for MPC8540
62
63
64Revision Information
65====================
66
12 May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet. 67 May 18, 2005: Rev 0.1 - Initial draft, no chapter III yet.
13 68
14 May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or 69 May 19, 2005: Rev 0.2 - Add chapter III and bits & pieces here or
@@ -1687,7 +1742,7 @@ platforms are moved over to use the flattened-device-tree model.
1687 }; 1742 };
1688 }; 1743 };
1689 1744
1690 g) Flash chip nodes 1745 j) Flash chip nodes
1691 1746
1692 Flash chips (Memory Technology Devices) are often used for solid state 1747 Flash chips (Memory Technology Devices) are often used for solid state
1693 file systems on embedded devices. 1748 file systems on embedded devices.
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 57b878cc393c..355ff0a2bb7c 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -917,6 +917,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
917 ref Reference board, base config 917 ref Reference board, base config
918 m2-2 Some Gateway MX series laptops 918 m2-2 Some Gateway MX series laptops
919 m6 Some Gateway NX series laptops 919 m6 Some Gateway NX series laptops
920 pa6 Gateway NX860 series
920 921
921 STAC9227/9228/9229/927x 922 STAC9227/9228/9229/927x
922 ref Reference board 923 ref Reference board
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 2d4803359a04..9e6b94face4b 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -138,7 +138,7 @@ Hot keys
138-------- 138--------
139 139
140procfs: /proc/acpi/ibm/hotkey 140procfs: /proc/acpi/ibm/hotkey
141sysfs device attribute: hotkey/* 141sysfs device attribute: hotkey_*
142 142
143Without this driver, only the Fn-F4 key (sleep button) generates an 143Without this driver, only the Fn-F4 key (sleep button) generates an
144ACPI event. With the driver loaded, the hotkey feature enabled and the 144ACPI event. With the driver loaded, the hotkey feature enabled and the
@@ -196,10 +196,7 @@ The following commands can be written to the /proc/acpi/ibm/hotkey file:
196 196
197sysfs notes: 197sysfs notes:
198 198
199 The hot keys attributes are in a hotkey/ subdirectory off the 199 hotkey_bios_enabled:
200 thinkpad device.
201
202 bios_enabled:
203 Returns the status of the hot keys feature when 200 Returns the status of the hot keys feature when
204 thinkpad-acpi was loaded. Upon module unload, the hot 201 thinkpad-acpi was loaded. Upon module unload, the hot
205 key feature status will be restored to this value. 202 key feature status will be restored to this value.
@@ -207,19 +204,19 @@ sysfs notes:
207 0: hot keys were disabled 204 0: hot keys were disabled
208 1: hot keys were enabled 205 1: hot keys were enabled
209 206
210 bios_mask: 207 hotkey_bios_mask:
211 Returns the hot keys mask when thinkpad-acpi was loaded. 208 Returns the hot keys mask when thinkpad-acpi was loaded.
212 Upon module unload, the hot keys mask will be restored 209 Upon module unload, the hot keys mask will be restored
213 to this value. 210 to this value.
214 211
215 enable: 212 hotkey_enable:
216 Enables/disables the hot keys feature, and reports 213 Enables/disables the hot keys feature, and reports
217 current status of the hot keys feature. 214 current status of the hot keys feature.
218 215
219 0: disables the hot keys feature / feature disabled 216 0: disables the hot keys feature / feature disabled
220 1: enables the hot keys feature / feature enabled 217 1: enables the hot keys feature / feature enabled
221 218
222 mask: 219 hotkey_mask:
223 bit mask to enable ACPI event generation for each hot 220 bit mask to enable ACPI event generation for each hot
224 key (see above). Returns the current status of the hot 221 key (see above). Returns the current status of the hot
225 keys mask, and allows one to modify it. 222 keys mask, and allows one to modify it.
@@ -229,7 +226,7 @@ Bluetooth
229--------- 226---------
230 227
231procfs: /proc/acpi/ibm/bluetooth 228procfs: /proc/acpi/ibm/bluetooth
232sysfs device attribute: bluetooth/enable 229sysfs device attribute: bluetooth_enable
233 230
234This feature shows the presence and current state of a ThinkPad 231This feature shows the presence and current state of a ThinkPad
235Bluetooth device in the internal ThinkPad CDC slot. 232Bluetooth device in the internal ThinkPad CDC slot.
@@ -244,7 +241,7 @@ If Bluetooth is installed, the following commands can be used:
244Sysfs notes: 241Sysfs notes:
245 242
246 If the Bluetooth CDC card is installed, it can be enabled / 243 If the Bluetooth CDC card is installed, it can be enabled /
247 disabled through the "bluetooth/enable" thinkpad-acpi device 244 disabled through the "bluetooth_enable" thinkpad-acpi device
248 attribute, and its current status can also be queried. 245 attribute, and its current status can also be queried.
249 246
250 enable: 247 enable:
@@ -252,7 +249,7 @@ Sysfs notes:
252 1: enables Bluetooth / Bluetooth is enabled. 249 1: enables Bluetooth / Bluetooth is enabled.
253 250
254 Note: this interface will be probably be superseeded by the 251 Note: this interface will be probably be superseeded by the
255 generic rfkill class. 252 generic rfkill class, so it is NOT to be considered stable yet.
256 253
257Video output control -- /proc/acpi/ibm/video 254Video output control -- /proc/acpi/ibm/video
258-------------------------------------------- 255--------------------------------------------
@@ -898,7 +895,7 @@ EXPERIMENTAL: WAN
898----------------- 895-----------------
899 896
900procfs: /proc/acpi/ibm/wan 897procfs: /proc/acpi/ibm/wan
901sysfs device attribute: wwan/enable 898sysfs device attribute: wwan_enable
902 899
903This feature is marked EXPERIMENTAL because the implementation 900This feature is marked EXPERIMENTAL because the implementation
904directly accesses hardware registers and may not work as expected. USE 901directly accesses hardware registers and may not work as expected. USE
@@ -921,7 +918,7 @@ If the W-WAN card is installed, the following commands can be used:
921Sysfs notes: 918Sysfs notes:
922 919
923 If the W-WAN card is installed, it can be enabled / 920 If the W-WAN card is installed, it can be enabled /
924 disabled through the "wwan/enable" thinkpad-acpi device 921 disabled through the "wwan_enable" thinkpad-acpi device
925 attribute, and its current status can also be queried. 922 attribute, and its current status can also be queried.
926 923
927 enable: 924 enable:
@@ -929,7 +926,7 @@ Sysfs notes:
929 1: enables WWAN card / WWAN card is enabled. 926 1: enables WWAN card / WWAN card is enabled.
930 927
931 Note: this interface will be probably be superseeded by the 928 Note: this interface will be probably be superseeded by the
932 generic rfkill class. 929 generic rfkill class, so it is NOT to be considered stable yet.
933 930
934Multiple Commands, Module Parameters 931Multiple Commands, Module Parameters
935------------------------------------ 932------------------------------------
diff --git a/Documentation/vm/slub.txt b/Documentation/vm/slub.txt
index 727c8d81aeaf..1523320abd87 100644
--- a/Documentation/vm/slub.txt
+++ b/Documentation/vm/slub.txt
@@ -1,13 +1,9 @@
1Short users guide for SLUB 1Short users guide for SLUB
2-------------------------- 2--------------------------
3 3
4First of all slub should transparently replace SLAB. If you enable
5SLUB then everything should work the same (Note the word "should".
6There is likely not much value in that word at this point).
7
8The basic philosophy of SLUB is very different from SLAB. SLAB 4The basic philosophy of SLUB is very different from SLAB. SLAB
9requires rebuilding the kernel to activate debug options for all 5requires rebuilding the kernel to activate debug options for all
10SLABS. SLUB always includes full debugging but its off by default. 6slab caches. SLUB always includes full debugging but it is off by default.
11SLUB can enable debugging only for selected slabs in order to avoid 7SLUB can enable debugging only for selected slabs in order to avoid
12an impact on overall system performance which may make a bug more 8an impact on overall system performance which may make a bug more
13difficult to find. 9difficult to find.
@@ -76,13 +72,28 @@ of objects.
76Careful with tracing: It may spew out lots of information and never stop if 72Careful with tracing: It may spew out lots of information and never stop if
77used on the wrong slab. 73used on the wrong slab.
78 74
79SLAB Merging 75Slab merging
80------------ 76------------
81 77
82If no debugging is specified then SLUB may merge similar slabs together 78If no debug options are specified then SLUB may merge similar slabs together
83in order to reduce overhead and increase cache hotness of objects. 79in order to reduce overhead and increase cache hotness of objects.
84slabinfo -a displays which slabs were merged together. 80slabinfo -a displays which slabs were merged together.
85 81
82Slab validation
83---------------
84
85SLUB can validate all object if the kernel was booted with slub_debug. In
86order to do so you must have the slabinfo tool. Then you can do
87
88slabinfo -v
89
90which will test all objects. Output will be generated to the syslog.
91
92This also works in a more limited way if boot was without slab debug.
93In that case slabinfo -v simply tests all reachable objects. Usually
94these are in the cpu slabs and the partial slabs. Full slabs are not
95tracked by SLUB in a non debug situation.
96
86Getting more performance 97Getting more performance
87------------------------ 98------------------------
88 99
@@ -91,9 +102,9 @@ list_lock once in a while to deal with partial slabs. That overhead is
91governed by the order of the allocation for each slab. The allocations 102governed by the order of the allocation for each slab. The allocations
92can be influenced by kernel parameters: 103can be influenced by kernel parameters:
93 104
94slub_min_objects=x (default 8) 105slub_min_objects=x (default 4)
95slub_min_order=x (default 0) 106slub_min_order=x (default 0)
96slub_max_order=x (default 4) 107slub_max_order=x (default 1)
97 108
98slub_min_objects allows to specify how many objects must at least fit 109slub_min_objects allows to specify how many objects must at least fit
99into one slab in order for the allocation order to be acceptable. 110into one slab in order for the allocation order to be acceptable.
@@ -109,5 +120,107 @@ longer be checked. This is useful to avoid SLUB trying to generate
109super large order pages to fit slub_min_objects of a slab cache with 120super large order pages to fit slub_min_objects of a slab cache with
110large object sizes into one high order page. 121large object sizes into one high order page.
111 122
112 123SLUB Debug output
113Christoph Lameter, <clameter@sgi.com>, April 10, 2007 124-----------------
125
126Here is a sample of slub debug output:
127
128*** SLUB kmalloc-8: Redzone Active@0xc90f6d20 slab 0xc528c530 offset=3360 flags=0x400000c3 inuse=61 freelist=0xc90f6d58
129 Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ
130 Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005
131 Redzone 0xc90f6d28: 00 cc cc cc .
132FreePointer 0xc90f6d2c -> 0xc90f6d58
133Last alloc: get_modalias+0x61/0xf5 jiffies_ago=53 cpu=1 pid=554
134Filler 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
135 [<c010523d>] dump_trace+0x63/0x1eb
136 [<c01053df>] show_trace_log_lvl+0x1a/0x2f
137 [<c010601d>] show_trace+0x12/0x14
138 [<c0106035>] dump_stack+0x16/0x18
139 [<c017e0fa>] object_err+0x143/0x14b
140 [<c017e2cc>] check_object+0x66/0x234
141 [<c017eb43>] __slab_free+0x239/0x384
142 [<c017f446>] kfree+0xa6/0xc6
143 [<c02e2335>] get_modalias+0xb9/0xf5
144 [<c02e23b7>] dmi_dev_uevent+0x27/0x3c
145 [<c027866a>] dev_uevent+0x1ad/0x1da
146 [<c0205024>] kobject_uevent_env+0x20a/0x45b
147 [<c020527f>] kobject_uevent+0xa/0xf
148 [<c02779f1>] store_uevent+0x4f/0x58
149 [<c027758e>] dev_attr_store+0x29/0x2f
150 [<c01bec4f>] sysfs_write_file+0x16e/0x19c
151 [<c0183ba7>] vfs_write+0xd1/0x15a
152 [<c01841d7>] sys_write+0x3d/0x72
153 [<c0104112>] sysenter_past_esp+0x5f/0x99
154 [<b7f7b410>] 0xb7f7b410
155 =======================
156@@@ SLUB kmalloc-8: Restoring redzone (0xcc) from 0xc90f6d28-0xc90f6d2b
157
158
159
160If SLUB encounters a corrupted object then it will perform the following
161actions:
162
1631. Isolation and report of the issue
164
165This will be a message in the system log starting with
166
167*** SLUB <slab cache affected>: <What went wrong>@<object address>
168offset=<offset of object into slab> flags=<slabflags>
169inuse=<objects in use in this slab> freelist=<first free object in slab>
170
1712. Report on how the problem was dealt with in order to ensure the continued
172operation of the system.
173
174These are messages in the system log beginning with
175
176@@@ SLUB <slab cache affected>: <corrective action taken>
177
178
179In the above sample SLUB found that the Redzone of an active object has
180been overwritten. Here a string of 8 characters was written into a slab that
181has the length of 8 characters. However, a 8 character string needs a
182terminating 0. That zero has overwritten the first byte of the Redzone field.
183After reporting the details of the issue encountered the @@@ SLUB message
184tell us that SLUB has restored the redzone to its proper value and then
185system operations continue.
186
187Various types of lines can follow the @@@ SLUB line:
188
189Bytes b4 <address> : <bytes>
190 Show a few bytes before the object where the problem was detected.
191 Can be useful if the corruption does not stop with the start of the
192 object.
193
194Object <address> : <bytes>
195 The bytes of the object. If the object is inactive then the bytes
196 typically contain poisoning values. Any non-poison value shows a
197 corruption by a write after free.
198
199Redzone <address> : <bytes>
200 The redzone following the object. The redzone is used to detect
201 writes after the object. All bytes should always have the same
202 value. If there is any deviation then it is due to a write after
203 the object boundary.
204
205Freepointer
206 The pointer to the next free object in the slab. May become
207 corrupted if overwriting continues after the red zone.
208
209Last alloc:
210Last free:
211 Shows the address from which the object was allocated/freed last.
212 We note the pid, the time and the CPU that did so. This is usually
213 the most useful information to figure out where things went wrong.
214 Here get_modalias() did an kmalloc(8) instead of a kmalloc(9).
215
216Filler <address> : <bytes>
217 Unused data to fill up the space in order to get the next object
218 properly aligned. In the debug case we make sure that there are
219 at least 4 bytes of filler. This allow for the detection of writes
220 before the object.
221
222Following the filler will be a stackdump. That stackdump describes the
223location where the error was detected. The cause of the corruption is more
224likely to be found by looking at the information about the last alloc / free.
225
226Christoph Lameter, <clameter@sgi.com>, May 23, 2007
diff --git a/Documentation/watchdog/pcwd-watchdog.txt b/Documentation/watchdog/pcwd-watchdog.txt
index d9ee6336c1d4..4f68052395c0 100644
--- a/Documentation/watchdog/pcwd-watchdog.txt
+++ b/Documentation/watchdog/pcwd-watchdog.txt
@@ -1,3 +1,5 @@
1Last reviewed: 10/05/2007
2
1 Berkshire Products PC Watchdog Card 3 Berkshire Products PC Watchdog Card
2 Support for ISA Cards Revision A and C 4 Support for ISA Cards Revision A and C
3 Documentation and Driver by Ken Hollis <kenji@bitgate.com> 5 Documentation and Driver by Ken Hollis <kenji@bitgate.com>
@@ -14,8 +16,8 @@
14 16
15 The Watchdog Driver will automatically find your watchdog card, and will 17 The Watchdog Driver will automatically find your watchdog card, and will
16 attach a running driver for use with that card. After the watchdog 18 attach a running driver for use with that card. After the watchdog
17 drivers have initialized, you can then talk to the card using the PC 19 drivers have initialized, you can then talk to the card using a PC
18 Watchdog program, available from http://ftp.bitgate.com/pcwd/. 20 Watchdog program.
19 21
20 I suggest putting a "watchdog -d" before the beginning of an fsck, and 22 I suggest putting a "watchdog -d" before the beginning of an fsck, and
21 a "watchdog -e -t 1" immediately after the end of an fsck. (Remember 23 a "watchdog -e -t 1" immediately after the end of an fsck. (Remember
@@ -62,5 +64,3 @@
62 -- Ken Hollis 64 -- Ken Hollis
63 (kenji@bitgate.com) 65 (kenji@bitgate.com)
64 66
65(This documentation may be out of date. Check
66 http://ftp.bitgate.com/pcwd/ for the absolute latest additions.)
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt
index 8d16f6f3c4ec..bb7cb1d31ec7 100644
--- a/Documentation/watchdog/watchdog-api.txt
+++ b/Documentation/watchdog/watchdog-api.txt
@@ -1,3 +1,6 @@
1Last reviewed: 10/05/2007
2
3
1The Linux Watchdog driver API. 4The Linux Watchdog driver API.
2 5
3Copyright 2002 Christer Weingel <wingel@nano-system.com> 6Copyright 2002 Christer Weingel <wingel@nano-system.com>
@@ -22,7 +25,7 @@ the system. If userspace fails (RAM error, kernel bug, whatever), the
22notifications cease to occur, and the hardware watchdog will reset the 25notifications cease to occur, and the hardware watchdog will reset the
23system (causing a reboot) after the timeout occurs. 26system (causing a reboot) after the timeout occurs.
24 27
25The Linux watchdog API is a rather AD hoc construction and different 28The Linux watchdog API is a rather ad-hoc construction and different
26drivers implement different, and sometimes incompatible, parts of it. 29drivers implement different, and sometimes incompatible, parts of it.
27This file is an attempt to document the existing usage and allow 30This file is an attempt to document the existing usage and allow
28future driver writers to use it as a reference. 31future driver writers to use it as a reference.
@@ -46,14 +49,16 @@ some of the drivers support the configuration option "Disable watchdog
46shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when 49shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when
47compiling the kernel, there is no way of disabling the watchdog once 50compiling the kernel, there is no way of disabling the watchdog once
48it has been started. So, if the watchdog daemon crashes, the system 51it has been started. So, if the watchdog daemon crashes, the system
49will reboot after the timeout has passed. 52will reboot after the timeout has passed. Watchdog devices also usually
53support the nowayout module parameter so that this option can be controlled
54at runtime.
50 55
51Some other drivers will not disable the watchdog, unless a specific 56Drivers will not disable the watchdog, unless a specific magic character 'V'
52magic character 'V' has been sent /dev/watchdog just before closing 57has been sent /dev/watchdog just before closing the file. If the userspace
53the file. If the userspace daemon closes the file without sending 58daemon closes the file without sending this special character, the driver
54this special character, the driver will assume that the daemon (and 59will assume that the daemon (and userspace in general) died, and will stop
55userspace in general) died, and will stop pinging the watchdog without 60pinging the watchdog without disabling it first. This will then cause a
56disabling it first. This will then cause a reboot. 61reboot if the watchdog is not re-opened in sufficient time.
57 62
58The ioctl API: 63The ioctl API:
59 64
@@ -227,218 +232,3 @@ The following options are available:
227 232
228[FIXME -- better explanations] 233[FIXME -- better explanations]
229 234
230Implementations in the current drivers in the kernel tree:
231
232Here I have tried to summarize what the different drivers support and
233where they do strange things compared to the other drivers.
234
235acquirewdt.c -- Acquire Single Board Computer
236
237 This driver has a hardcoded timeout of 1 minute
238
239 Supports CONFIG_WATCHDOG_NOWAYOUT
240
241 GETSUPPORT returns KEEPALIVEPING. GETSTATUS will return 1 if
242 the device is open, 0 if not. [FIXME -- isn't this rather
243 silly? To be able to use the ioctl, the device must be open
244 and so GETSTATUS will always return 1].
245
246advantechwdt.c -- Advantech Single Board Computer
247
248 Timeout that defaults to 60 seconds, supports SETTIMEOUT.
249
250 Supports CONFIG_WATCHDOG_NOWAYOUT
251
252 GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT.
253 The GETSTATUS call returns if the device is open or not.
254 [FIXME -- silliness again?]
255
256booke_wdt.c -- PowerPC BookE Watchdog Timer
257
258 Timeout default varies according to frequency, supports
259 SETTIMEOUT
260
261 Watchdog cannot be turned off, CONFIG_WATCHDOG_NOWAYOUT
262 does not make sense
263
264 GETSUPPORT returns the watchdog_info struct, and
265 GETSTATUS returns the supported options. GETBOOTSTATUS
266 returns a 1 if the last reset was caused by the
267 watchdog and a 0 otherwise. This watchdog cannot be
268 disabled once it has been started. The wdt_period kernel
269 parameter selects which bit of the time base changing
270 from 0->1 will trigger the watchdog exception. Changing
271 the timeout from the ioctl calls will change the
272 wdt_period as defined above. Finally if you would like to
273 replace the default Watchdog Handler you can implement the
274 WatchdogHandler() function in your own code.
275
276eurotechwdt.c -- Eurotech CPU-1220/1410
277
278 The timeout can be set using the SETTIMEOUT ioctl and defaults
279 to 60 seconds.
280
281 Also has a module parameter "ev", event type which controls
282 what should happen on a timeout, the string "int" or anything
283 else that causes a reboot. [FIXME -- better description]
284
285 Supports CONFIG_WATCHDOG_NOWAYOUT
286
287 GETSUPPORT returns CARDRESET and WDIOF_SETTIMEOUT but
288 GETSTATUS is not supported and GETBOOTSTATUS just returns 0.
289
290i810-tco.c -- Intel 810 chipset
291
292 Also has support for a lot of other i8x0 stuff, but the
293 watchdog is one of the things.
294
295 The timeout is set using the module parameter "i810_margin",
296 which is in steps of 0.6 seconds where 2<i810_margin<64. The
297 driver supports the SETTIMEOUT ioctl.
298
299 Supports CONFIG_WATCHDOG_NOWAYOUT.
300
301 GETSUPPORT returns WDIOF_SETTIMEOUT. The GETSTATUS call
302 returns some kind of timer value which ist not compatible with
303 the other drivers. GETBOOT status returns some kind of
304 hardware specific boot status. [FIXME -- describe this]
305
306ib700wdt.c -- IB700 Single Board Computer
307
308 Default timeout of 30 seconds and the timeout is settable
309 using the SETTIMEOUT ioctl. Note that only a few timeout
310 values are supported.
311
312 Supports CONFIG_WATCHDOG_NOWAYOUT
313
314 GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT.
315 The GETSTATUS call returns if the device is open or not.
316 [FIXME -- silliness again?]
317
318machzwd.c -- MachZ ZF-Logic
319
320 Hardcoded timeout of 10 seconds
321
322 Has a module parameter "action" that controls what happens
323 when the timeout runs out which can be 0 = RESET (default),
324 1 = SMI, 2 = NMI, 3 = SCI.
325
326 Supports CONFIG_WATCHDOG_NOWAYOUT and the magic character
327 'V' close handling.
328
329 GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call
330 returns if the device is open or not. [FIXME -- silliness
331 again?]
332
333mixcomwd.c -- MixCom Watchdog
334
335 [FIXME -- I'm unable to tell what the timeout is]
336
337 Supports CONFIG_WATCHDOG_NOWAYOUT
338
339 GETSUPPORT returns WDIOF_KEEPALIVEPING, GETSTATUS returns if
340 the device is opened or not [FIXME -- I'm not really sure how
341 this works, there seems to be some magic connected to
342 CONFIG_WATCHDOG_NOWAYOUT]
343
344pcwd.c -- Berkshire PC Watchdog
345
346 Hardcoded timeout of 1.5 seconds
347
348 Supports CONFIG_WATCHDOG_NOWAYOUT
349
350 GETSUPPORT returns WDIOF_OVERHEAT|WDIOF_CARDRESET and both
351 GETSTATUS and GETBOOTSTATUS return something useful.
352
353 The SETOPTIONS call can be used to enable and disable the card
354 and to ask the driver to call panic if the system overheats.
355
356sbc60xxwdt.c -- 60xx Single Board Computer
357
358 Hardcoded timeout of 10 seconds
359
360 Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic
361 character 'V' close handling.
362
363 No bits set in GETSUPPORT
364
365scx200.c -- National SCx200 CPUs
366
367 Not in the kernel yet.
368
369 The timeout is set using a module parameter "margin" which
370 defaults to 60 seconds. The timeout can also be set using
371 SETTIMEOUT and read using GETTIMEOUT.
372
373 Supports a module parameter "nowayout" that is initialized
374 with the value of CONFIG_WATCHDOG_NOWAYOUT. Also supports the
375 magic character 'V' handling.
376
377shwdt.c -- SuperH 3/4 processors
378
379 [FIXME -- I'm unable to tell what the timeout is]
380
381 Supports CONFIG_WATCHDOG_NOWAYOUT
382
383 GETSUPPORT returns WDIOF_KEEPALIVEPING, and the GETSTATUS call
384 returns if the device is open or not. [FIXME -- silliness
385 again?]
386
387softdog.c -- Software watchdog
388
389 The timeout is set with the module parameter "soft_margin"
390 which defaults to 60 seconds, the timeout is also settable
391 using the SETTIMEOUT ioctl.
392
393 Supports CONFIG_WATCHDOG_NOWAYOUT
394
395 WDIOF_SETTIMEOUT bit set in GETSUPPORT
396
397w83877f_wdt.c -- W83877F Computer
398
399 Hardcoded timeout of 30 seconds
400
401 Does not support CONFIG_WATCHDOG_NOWAYOUT, but has the magic
402 character 'V' close handling.
403
404 No bits set in GETSUPPORT
405
406w83627hf_wdt.c -- w83627hf watchdog
407
408 Timeout that defaults to 60 seconds, supports SETTIMEOUT.
409
410 Supports CONFIG_WATCHDOG_NOWAYOUT
411
412 GETSUPPORT returns WDIOF_KEEPALIVEPING and WDIOF_SETTIMEOUT.
413 The GETSTATUS call returns if the device is open or not.
414
415wdt.c -- ICS WDT500/501 ISA and
416wdt_pci.c -- ICS WDT500/501 PCI
417
418 Default timeout of 60 seconds. The timeout is also settable
419 using the SETTIMEOUT ioctl.
420
421 Supports CONFIG_WATCHDOG_NOWAYOUT
422
423 GETSUPPORT returns with bits set depending on the actual
424 card. The WDT501 supports a lot of external monitoring, the
425 WDT500 much less.
426
427wdt285.c -- Footbridge watchdog
428
429 The timeout is set with the module parameter "soft_margin"
430 which defaults to 60 seconds. The timeout is also settable
431 using the SETTIMEOUT ioctl.
432
433 Does not support CONFIG_WATCHDOG_NOWAYOUT
434
435 WDIOF_SETTIMEOUT bit set in GETSUPPORT
436
437wdt977.c -- Netwinder W83977AF chip
438
439 Hardcoded timeout of 3 minutes
440
441 Supports CONFIG_WATCHDOG_NOWAYOUT
442
443 Does not support any ioctls at all.
444
diff --git a/Documentation/watchdog/watchdog.txt b/Documentation/watchdog/watchdog.txt
deleted file mode 100644
index 4b1ff69cc19a..000000000000
--- a/Documentation/watchdog/watchdog.txt
+++ /dev/null
@@ -1,94 +0,0 @@
1 Watchdog Timer Interfaces For The Linux Operating System
2
3 Alan Cox <alan@lxorguk.ukuu.org.uk>
4
5 Custom Linux Driver And Program Development
6
7
8The following watchdog drivers are currently implemented:
9
10 ICS WDT501-P
11 ICS WDT501-P (no fan tachometer)
12 ICS WDT500-P
13 Software Only
14 SA1100 Internal Watchdog
15 Berkshire Products PC Watchdog Revision A & C (by Ken Hollis)
16
17
18All six interfaces provide /dev/watchdog, which when open must be written
19to within a timeout or the machine will reboot. Each write delays the reboot
20time another timeout. In the case of the software watchdog the ability to
21reboot will depend on the state of the machines and interrupts. The hardware
22boards physically pull the machine down off their own onboard timers and
23will reboot from almost anything.
24
25A second temperature monitoring interface is available on the WDT501P cards
26and some Berkshire cards. This provides /dev/temperature. This is the machine
27internal temperature in degrees Fahrenheit. Each read returns a single byte
28giving the temperature.
29
30The third interface logs kernel messages on additional alert events.
31
32Both software and hardware watchdog drivers are available in the standard
33kernel. If you are using the software watchdog, you probably also want
34to use "panic=60" as a boot argument as well.
35
36The wdt card cannot be safely probed for. Instead you need to pass
37wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11".
38
39The SA1100 watchdog module can be configured with the "sa1100_margin"
40commandline argument which specifies timeout value in seconds.
41
42The i810 TCO watchdog modules can be configured with the "i810_margin"
43commandline argument which specifies the counter initial value. The counter
44is decremented every 0.6 seconds and default to 50 (30 seconds). Values can
45range between 3 and 63.
46
47The i810 TCO watchdog driver also implements the WDIOC_GETSTATUS and
48WDIOC_GETBOOTSTATUS ioctl()s. WDIOC_GETSTATUS returns the actual counter value
49and WDIOC_GETBOOTSTATUS returns the value of TCO2 Status Register (see Intel's
50documentation for the 82801AA and 82801AB datasheet).
51
52Features
53--------
54 WDT501P WDT500P Software Berkshire i810 TCO SA1100WD
55Reboot Timer X X X X X X
56External Reboot X X o o o X
57I/O Port Monitor o o o X o o
58Temperature X o o X o o
59Fan Speed X o o o o o
60Power Under X o o o o o
61Power Over X o o o o o
62Overheat X o o o o o
63
64The external event interfaces on the WDT boards are not currently supported.
65Minor numbers are however allocated for it.
66
67
68Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c
69
70
71Contact Information
72
73People keep asking about the WDT watchdog timer hardware: The phone contacts
74for Industrial Computer Source are:
75
76Industrial Computer Source
77http://www.indcompsrc.com
78ICS Advent, San Diego
796260 Sequence Dr.
80San Diego, CA 92121-4371
81Phone (858) 677-0877
82FAX: (858) 677-0895
83>
84ICS Advent Europe, UK
85Oving Road
86Chichester,
87West Sussex,
88PO19 4ET, UK
89Phone: 00.44.1243.533900
90
91
92and please mention Linux when enquiring.
93
94For full information about the PCWD cards see the pcwd-watchdog.txt document.
diff --git a/Documentation/watchdog/wdt.txt b/Documentation/watchdog/wdt.txt
new file mode 100644
index 000000000000..03fd756d976d
--- /dev/null
+++ b/Documentation/watchdog/wdt.txt
@@ -0,0 +1,43 @@
1Last Reviewed: 10/05/2007
2
3 WDT Watchdog Timer Interfaces For The Linux Operating System
4 Alan Cox <alan@lxorguk.ukuu.org.uk>
5
6 ICS WDT501-P
7 ICS WDT501-P (no fan tachometer)
8 ICS WDT500-P
9
10All the interfaces provide /dev/watchdog, which when open must be written
11to within a timeout or the machine will reboot. Each write delays the reboot
12time another timeout. In the case of the software watchdog the ability to
13reboot will depend on the state of the machines and interrupts. The hardware
14boards physically pull the machine down off their own onboard timers and
15will reboot from almost anything.
16
17A second temperature monitoring interface is available on the WDT501P cards
18This provides /dev/temperature. This is the machine internal temperature in
19degrees Fahrenheit. Each read returns a single byte giving the temperature.
20
21The third interface logs kernel messages on additional alert events.
22
23The wdt card cannot be safely probed for. Instead you need to pass
24wdt=ioaddr,irq as a boot parameter - eg "wdt=0x240,11".
25
26Features
27--------
28 WDT501P WDT500P
29Reboot Timer X X
30External Reboot X X
31I/O Port Monitor o o
32Temperature X o
33Fan Speed X o
34Power Under X o
35Power Over X o
36Overheat X o
37
38The external event interfaces on the WDT boards are not currently supported.
39Minor numbers are however allocated for it.
40
41
42Example Watchdog Driver: see Documentation/watchdog/src/watchdog-simple.c
43
diff --git a/MAINTAINERS b/MAINTAINERS
index 4cc17b993b6a..f3b5a391e074 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -30,8 +30,11 @@ trivial patch so apply some common sense.
30 job the maintainers (and especially Linus) do is to keep things 30 job the maintainers (and especially Linus) do is to keep things
31 looking the same. Sometimes this means that the clever hack in 31 looking the same. Sometimes this means that the clever hack in
32 your driver to get around a problem actually needs to become a 32 your driver to get around a problem actually needs to become a
33 generalized kernel feature ready for next time. See 33 generalized kernel feature ready for next time.
34 Documentation/CodingStyle for guidance here. 34
35 PLEASE check your patch with the automated style checker
36 (scripts/checkpatch.pl) to catch trival style violations.
37 See Documentation/CodingStyle for guidance here.
35 38
36 PLEASE try to include any credit lines you want added with the 39 PLEASE try to include any credit lines you want added with the
37 patch. It avoids people being missed off by mistake and makes 40 patch. It avoids people being missed off by mistake and makes
@@ -972,6 +975,15 @@ M: johannes@sipsolutions.net
972L: linux-wireless@vger.kernel.org 975L: linux-wireless@vger.kernel.org
973S: Maintained 976S: Maintained
974 977
978CHECKPATCH
979P: Andy Whitcroft
980M: apw@shadowen.org
981P: Randy Dunlap
982M: rdunlap@xenotime.net
983P: Joel Schopp
984M: jschopp@austin.ibm.com
985S: Supported
986
975COMMON INTERNET FILE SYSTEM (CIFS) 987COMMON INTERNET FILE SYSTEM (CIFS)
976P: Steve French 988P: Steve French
977M: sfrench@samba.org 989M: sfrench@samba.org
@@ -1475,6 +1487,13 @@ L: linux-usb-devel@lists.sourceforge.net
1475L: linuxppc-embedded@ozlabs.org 1487L: linuxppc-embedded@ozlabs.org
1476S: Maintained 1488S: Maintained
1477 1489
1490FREESCALE QUICC ENGINE UCC ETHERNET DRIVER
1491P: Li Yang
1492M: leoli@freescale.com
1493L: netdev@vger.kernel.org
1494L: linuxppc-embedded@ozlabs.org
1495S: Maintained
1496
1478FILE LOCKING (flock() and fcntl()/lockf()) 1497FILE LOCKING (flock() and fcntl()/lockf())
1479P: Matthew Wilcox 1498P: Matthew Wilcox
1480M: matthew@wil.cx 1499M: matthew@wil.cx
@@ -1486,6 +1505,14 @@ P: Alexander Viro
1486M: viro@zeniv.linux.org.uk 1505M: viro@zeniv.linux.org.uk
1487S: Maintained 1506S: Maintained
1488 1507
1508FIREWIRE SUBSYSTEM
1509P: Kristian Hoegsberg, Stefan Richter
1510M: krh@redhat.com, stefanr@s5r6.in-berlin.de
1511L: linux1394-devel@lists.sourceforge.net
1512W: http://www.linux1394.org/
1513T: git kernel.org:/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
1514S: Maintained
1515
1489FIRMWARE LOADER (request_firmware) 1516FIRMWARE LOADER (request_firmware)
1490L: linux-kernel@vger.kernel.org 1517L: linux-kernel@vger.kernel.org
1491S: Orphan 1518S: Orphan
@@ -2880,8 +2907,8 @@ W: ftp://ftp.kernel.org/pub/linux/kernel/people/rml/preempt-kernel
2880S: Supported 2907S: Supported
2881 2908
2882PRISM54 WIRELESS DRIVER 2909PRISM54 WIRELESS DRIVER
2883P: Prism54 Development Team 2910P: Luis R. Rodriguez
2884M: developers@islsm.org 2911M: mcgrof@gmail.com
2885L: linux-wireless@vger.kernel.org 2912L: linux-wireless@vger.kernel.org
2886W: http://prism54.org 2913W: http://prism54.org
2887S: Maintained 2914S: Maintained
@@ -3525,7 +3552,7 @@ S: Maintained
3525 3552
3526TULIP NETWORK DRIVER 3553TULIP NETWORK DRIVER
3527P: Valerie Henson 3554P: Valerie Henson
3528M: val_henson@linux.intel.com 3555M: val@nmt.edu
3529L: tulip-users@lists.sourceforge.net 3556L: tulip-users@lists.sourceforge.net
3530W: http://sourceforge.net/projects/tulip/ 3557W: http://sourceforge.net/projects/tulip/
3531S: Maintained 3558S: Maintained
diff --git a/Makefile b/Makefile
index 562a90902cf6..30d685b629a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 22 3SUBLEVEL = 22
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Jeff Thinks I Should Change This, But To What? 5NAME = Jeff Thinks I Should Change This, But To What?
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 770f717bd250..79c6e5a24456 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -83,22 +83,20 @@ choice
83 check out the Linux/Alpha FAQ, accessible on the WWW from 83 check out the Linux/Alpha FAQ, accessible on the WWW from
84 <http://www.alphalinux.org/>. In summary: 84 <http://www.alphalinux.org/>. In summary:
85 85
86 Alcor/Alpha-XLT AS 600 86 Alcor/Alpha-XLT AS 600, AS 500, XL-300, XL-366
87 Alpha-XL XL-233, XL-266 87 Alpha-XL XL-233, XL-266
88 AlphaBook1 Alpha laptop 88 AlphaBook1 Alpha laptop
89 Avanti AS 200, AS 205, AS 250, AS 255, AS 300, AS 400 89 Avanti AS 200, AS 205, AS 250, AS 255, AS 300, AS 400
90 Cabriolet AlphaPC64, AlphaPCI64 90 Cabriolet AlphaPC64, AlphaPCI64
91 DP264 DP264 91 DP264 DP264 / DS20 / ES40 / DS10 / DS10L
92 EB164 EB164 21164 evaluation board 92 EB164 EB164 21164 evaluation board
93 EB64+ EB64+ 21064 evaluation board 93 EB64+ EB64+ 21064 evaluation board
94 EB66 EB66 21066 evaluation board 94 EB66 EB66 21066 evaluation board
95 EB66+ EB66+ 21066 evaluation board 95 EB66+ EB66+ 21066 evaluation board
96 Jensen DECpc 150, DEC 2000 model 300, 96 Jensen DECpc 150, DEC 2000 models 300, 500
97 DEC 2000 model 500
98 LX164 AlphaPC164-LX 97 LX164 AlphaPC164-LX
99 Lynx AS 2100A 98 Lynx AS 2100A
100 Miata Personal Workstation 433a, 433au, 500a, 99 Miata Personal Workstation 433/500/600 a/au
101 500au, 600a, or 600au
102 Marvel AlphaServer ES47 / ES80 / GS1280 100 Marvel AlphaServer ES47 / ES80 / GS1280
103 Mikasa AS 1000 101 Mikasa AS 1000
104 Noname AXPpci33, UDB (Multia) 102 Noname AXPpci33, UDB (Multia)
@@ -108,9 +106,9 @@ choice
108 Ruffian RPX164-2, AlphaPC164-UX, AlphaPC164-BX 106 Ruffian RPX164-2, AlphaPC164-UX, AlphaPC164-BX
109 SX164 AlphaPC164-SX 107 SX164 AlphaPC164-SX
110 Sable AS 2000, AS 2100 108 Sable AS 2000, AS 2100
111 Shark DS 20L 109 Shark DS 20L
112 Takara Takara 110 Takara Takara (OEM)
113 Titan AlphaServer ES45 / DS25 111 Titan AlphaServer ES45 / DS25 / DS15
114 Wildfire AlphaServer GS 40/80/160/320 112 Wildfire AlphaServer GS 40/80/160/320
115 113
116 If you don't know what to do, choose "generic". 114 If you don't know what to do, choose "generic".
@@ -481,6 +479,15 @@ config ALPHA_BROKEN_IRQ_MASK
481 depends on ALPHA_GENERIC || ALPHA_PC164 479 depends on ALPHA_GENERIC || ALPHA_PC164
482 default y 480 default y
483 481
482config VGA_HOSE
483 bool
484 depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI
485 default y
486 help
487 Support VGA on an arbitrary hose; needed for several platforms
488 which always have multiple hoses, and whose consoles support it.
489
490
484config ALPHA_SRM 491config ALPHA_SRM
485 bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME 492 bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME
486 default y if ALPHA_JENSEN || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_DP264 || ALPHA_RAWHIDE || ALPHA_EIGER || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_SHARK || ALPHA_MARVEL 493 default y if ALPHA_JENSEN || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_DP264 || ALPHA_RAWHIDE || ALPHA_EIGER || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_SHARK || ALPHA_MARVEL
@@ -537,10 +544,14 @@ config HAVE_DEC_LOCK
537 default y 544 default y
538 545
539config NR_CPUS 546config NR_CPUS
540 int "Maximum number of CPUs (2-64)" 547 int "Maximum number of CPUs (2-32)"
541 range 2 64 548 range 2 32
542 depends on SMP 549 depends on SMP
543 default "64" 550 default "32" if ALPHA_GENERIC || ALPHA_MARVEL
551 default "4" if !ALPHA_GENERIC && !ALPHA_MARVEL
552 help
553 MARVEL support can handle a maximum of 32 CPUs, all the others
554 with working support have a maximum of 4 CPUs.
544 555
545config ARCH_DISCONTIGMEM_ENABLE 556config ARCH_DISCONTIGMEM_ENABLE
546 bool "Discontiguous Memory Support (EXPERIMENTAL)" 557 bool "Discontiguous Memory Support (EXPERIMENTAL)"
@@ -644,6 +655,13 @@ source "arch/alpha/oprofile/Kconfig"
644 655
645source "arch/alpha/Kconfig.debug" 656source "arch/alpha/Kconfig.debug"
646 657
658# DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig
659# but we also need it if VGA_HOSE is set
660config DUMMY_CONSOLE
661 bool
662 depends on VGA_HOSE
663 default y
664
647source "security/Kconfig" 665source "security/Kconfig"
648 666
649source "crypto/Kconfig" 667source "crypto/Kconfig"
diff --git a/arch/alpha/boot/tools/mkbb.c b/arch/alpha/boot/tools/mkbb.c
index 23c7190b047c..632a7fd6d7dc 100644
--- a/arch/alpha/boot/tools/mkbb.c
+++ b/arch/alpha/boot/tools/mkbb.c
@@ -81,7 +81,7 @@ typedef union __bootblock {
81#define bootblock_label __u1.__label 81#define bootblock_label __u1.__label
82#define bootblock_checksum __u2.__checksum 82#define bootblock_checksum __u2.__checksum
83 83
84main(int argc, char ** argv) 84int main(int argc, char ** argv)
85{ 85{
86 bootblock bootblock_from_disk; 86 bootblock bootblock_from_disk;
87 bootblock bootloader_image; 87 bootblock bootloader_image;
diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c
index f313b34939bb..da711e37fc97 100644
--- a/arch/alpha/kernel/console.c
+++ b/arch/alpha/kernel/console.c
@@ -9,16 +9,20 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/tty.h> 10#include <linux/tty.h>
11#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/vt.h>
12#include <asm/vga.h> 13#include <asm/vga.h>
13#include <asm/machvec.h> 14#include <asm/machvec.h>
14 15
16#include "pci_impl.h"
17
15#ifdef CONFIG_VGA_HOSE 18#ifdef CONFIG_VGA_HOSE
16 19
17/* 20struct pci_controller *pci_vga_hose;
18 * Externally-visible vga hose bases 21static struct resource alpha_vga = {
19 */ 22 .name = "alpha-vga+",
20unsigned long __vga_hose_io_base = 0; /* base for default hose */ 23 .start = 0x3C0,
21unsigned long __vga_hose_mem_base = 0; /* base for default hose */ 24 .end = 0x3DF
25};
22 26
23static struct pci_controller * __init 27static struct pci_controller * __init
24default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) 28default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2)
@@ -30,36 +34,58 @@ default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2)
30} 34}
31 35
32void __init 36void __init
33set_vga_hose(struct pci_controller *hose)
34{
35 if (hose) {
36 __vga_hose_io_base = hose->io_space->start;
37 __vga_hose_mem_base = hose->mem_space->start;
38 }
39}
40
41void __init
42locate_and_init_vga(void *(*sel_func)(void *, void *)) 37locate_and_init_vga(void *(*sel_func)(void *, void *))
43{ 38{
44 struct pci_controller *hose = NULL; 39 struct pci_controller *hose = NULL;
45 struct pci_dev *dev = NULL; 40 struct pci_dev *dev = NULL;
46 41
42 /* Default the select function */
47 if (!sel_func) sel_func = (void *)default_vga_hose_select; 43 if (!sel_func) sel_func = (void *)default_vga_hose_select;
48 44
45 /* Find the console VGA device */
49 for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) { 46 for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) {
50 if (!hose) hose = dev->sysdata; 47 if (!hose)
51 else hose = sel_func(hose, dev->sysdata); 48 hose = dev->sysdata;
49 else
50 hose = sel_func(hose, dev->sysdata);
52 } 51 }
53 52
54 /* Did we already inititialize the correct one? */ 53 /* Did we already initialize the correct one? Is there one? */
55 if (conswitchp == &vga_con && 54 if (!hose || (conswitchp == &vga_con && pci_vga_hose == hose))
56 __vga_hose_io_base == hose->io_space->start &&
57 __vga_hose_mem_base == hose->mem_space->start)
58 return; 55 return;
59 56
60 /* Set the VGA hose and init the new console */ 57 /* Create a new VGA ioport resource WRT the hose it is on. */
61 set_vga_hose(hose); 58 alpha_vga.start += hose->io_space->start;
59 alpha_vga.end += hose->io_space->start;
60 request_resource(hose->io_space, &alpha_vga);
61
62 /* Set the VGA hose and init the new console. */
63 pci_vga_hose = hose;
62 take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1); 64 take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1);
63} 65}
64 66
67void __init
68find_console_vga_hose(void)
69{
70 u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
71
72 if (pu64[7] == 3) { /* TERM_TYPE == graphics */
73 struct pci_controller *hose;
74 int h = (pu64[30] >> 24) & 0xff; /* console hose # */
75
76 /*
77 * Our hose numbering DOES match the console's, so find
78 * the right one...
79 */
80 for (hose = hose_head; hose; hose = hose->next) {
81 if (hose->index == h) break;
82 }
83
84 if (hose) {
85 printk("Console graphics on hose %d\n", h);
86 pci_vga_hose = hose;
87 }
88 }
89}
90
65#endif 91#endif
diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
index 7f6a98455e74..f10d2eddd2c3 100644
--- a/arch/alpha/kernel/core_marvel.c
+++ b/arch/alpha/kernel/core_marvel.c
@@ -25,6 +25,7 @@
25#include <asm/pgalloc.h> 25#include <asm/pgalloc.h>
26#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
27#include <asm/rtc.h> 27#include <asm/rtc.h>
28#include <asm/vga.h>
28 29
29#include "proto.h" 30#include "proto.h"
30#include "pci_impl.h" 31#include "pci_impl.h"
@@ -367,9 +368,8 @@ marvel_io7_present(gct6_node *node)
367} 368}
368 369
369static void __init 370static void __init
370marvel_init_vga_hose(void) 371marvel_find_console_vga_hose(void)
371{ 372{
372#ifdef CONFIG_VGA_HOSE
373 u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); 373 u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
374 374
375 if (pu64[7] == 3) { /* TERM_TYPE == graphics */ 375 if (pu64[7] == 3) { /* TERM_TYPE == graphics */
@@ -403,7 +403,6 @@ marvel_init_vga_hose(void)
403 pci_vga_hose = hose; 403 pci_vga_hose = hose;
404 } 404 }
405 } 405 }
406#endif /* CONFIG_VGA_HOSE */
407} 406}
408 407
409gct6_search_struct gct_wanted_node_list[] = { 408gct6_search_struct gct_wanted_node_list[] = {
@@ -459,7 +458,7 @@ marvel_init_arch(void)
459 marvel_init_io7(io7); 458 marvel_init_io7(io7);
460 459
461 /* Check for graphic console location (if any). */ 460 /* Check for graphic console location (if any). */
462 marvel_init_vga_hose(); 461 marvel_find_console_vga_hose();
463} 462}
464 463
465void 464void
@@ -684,9 +683,6 @@ __marvel_rtc_io(u8 b, unsigned long addr, int write)
684/* 683/*
685 * IO map support. 684 * IO map support.
686 */ 685 */
687
688#define __marvel_is_mem_vga(a) (((a) >= 0xa0000) && ((a) <= 0xc0000))
689
690void __iomem * 686void __iomem *
691marvel_ioremap(unsigned long addr, unsigned long size) 687marvel_ioremap(unsigned long addr, unsigned long size)
692{ 688{
@@ -698,13 +694,9 @@ marvel_ioremap(unsigned long addr, unsigned long size)
698 unsigned long pfn; 694 unsigned long pfn;
699 695
700 /* 696 /*
701 * Adjust the addr. 697 * Adjust the address.
702 */ 698 */
703#ifdef CONFIG_VGA_HOSE 699 FIXUP_MEMADDR_VGA(addr);
704 if (pci_vga_hose && __marvel_is_mem_vga(addr)) {
705 addr += pci_vga_hose->mem_space->start;
706 }
707#endif
708 700
709 /* 701 /*
710 * Find the hose. 702 * Find the hose.
@@ -781,7 +773,9 @@ marvel_ioremap(unsigned long addr, unsigned long size)
781 return (void __iomem *) vaddr; 773 return (void __iomem *) vaddr;
782 } 774 }
783 775
784 return NULL; 776 /* Assume it was already a reasonable address */
777 vaddr = baddr + hose->mem_space->start;
778 return (void __iomem *) vaddr;
785} 779}
786 780
787void 781void
@@ -803,21 +797,12 @@ marvel_is_mmio(const volatile void __iomem *xaddr)
803 return (addr & 0xFF000000UL) == 0; 797 return (addr & 0xFF000000UL) == 0;
804} 798}
805 799
806#define __marvel_is_port_vga(a) \
807 (((a) >= 0x3b0) && ((a) < 0x3e0) && ((a) != 0x3b3) && ((a) != 0x3d3))
808#define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) 800#define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64))
809#define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) 801#define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71))
810 802
811void __iomem *marvel_ioportmap (unsigned long addr) 803void __iomem *marvel_ioportmap (unsigned long addr)
812{ 804{
813 if (__marvel_is_port_rtc (addr) || __marvel_is_port_kbd(addr)) 805 FIXUP_IOADDR_VGA(addr);
814 ;
815#ifdef CONFIG_VGA_HOSE
816 else if (__marvel_is_port_vga (addr) && pci_vga_hose)
817 addr += pci_vga_hose->io_space->start;
818#endif
819 else
820 return NULL;
821 return (void __iomem *)addr; 806 return (void __iomem *)addr;
822} 807}
823 808
@@ -829,8 +814,14 @@ marvel_ioread8(void __iomem *xaddr)
829 return 0; 814 return 0;
830 else if (__marvel_is_port_rtc(addr)) 815 else if (__marvel_is_port_rtc(addr))
831 return __marvel_rtc_io(0, addr, 0); 816 return __marvel_rtc_io(0, addr, 0);
832 else 817 else if (marvel_is_ioaddr(addr))
833 return __kernel_ldbu(*(vucp)addr); 818 return __kernel_ldbu(*(vucp)addr);
819 else
820 /* this should catch other legacy addresses
821 that would normally fail on MARVEL,
822 because there really is nothing there...
823 */
824 return ~0;
834} 825}
835 826
836void 827void
@@ -841,7 +832,7 @@ marvel_iowrite8(u8 b, void __iomem *xaddr)
841 return; 832 return;
842 else if (__marvel_is_port_rtc(addr)) 833 else if (__marvel_is_port_rtc(addr))
843 __marvel_rtc_io(b, addr, 1); 834 __marvel_rtc_io(b, addr, 1);
844 else 835 else if (marvel_is_ioaddr(addr))
845 __kernel_stb(b, *(vucp)addr); 836 __kernel_stb(b, *(vucp)addr);
846} 837}
847 838
diff --git a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c
index 3662fef7db9a..819326627b96 100644
--- a/arch/alpha/kernel/core_titan.c
+++ b/arch/alpha/kernel/core_titan.c
@@ -21,6 +21,7 @@
21#include <asm/smp.h> 21#include <asm/smp.h>
22#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
23#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
24#include <asm/vga.h>
24 25
25#include "proto.h" 26#include "proto.h"
26#include "pci_impl.h" 27#include "pci_impl.h"
@@ -35,6 +36,11 @@ struct
35} saved_config[4] __attribute__((common)); 36} saved_config[4] __attribute__((common));
36 37
37/* 38/*
39 * Is PChip 1 present? No need to query it more than once.
40 */
41static int titan_pchip1_present;
42
43/*
38 * BIOS32-style PCI interface: 44 * BIOS32-style PCI interface:
39 */ 45 */
40 46
@@ -344,43 +350,17 @@ titan_init_one_pachip_port(titan_pachip_port *port, int index)
344static void __init 350static void __init
345titan_init_pachips(titan_pachip *pachip0, titan_pachip *pachip1) 351titan_init_pachips(titan_pachip *pachip0, titan_pachip *pachip1)
346{ 352{
347 int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; 353 titan_pchip1_present = TITAN_cchip->csc.csr & 1L<<14;
348 354
349 /* Init the ports in hose order... */ 355 /* Init the ports in hose order... */
350 titan_init_one_pachip_port(&pachip0->g_port, 0); /* hose 0 */ 356 titan_init_one_pachip_port(&pachip0->g_port, 0); /* hose 0 */
351 if (pchip1_present) 357 if (titan_pchip1_present)
352 titan_init_one_pachip_port(&pachip1->g_port, 1);/* hose 1 */ 358 titan_init_one_pachip_port(&pachip1->g_port, 1);/* hose 1 */
353 titan_init_one_pachip_port(&pachip0->a_port, 2); /* hose 2 */ 359 titan_init_one_pachip_port(&pachip0->a_port, 2); /* hose 2 */
354 if (pchip1_present) 360 if (titan_pchip1_present)
355 titan_init_one_pachip_port(&pachip1->a_port, 3);/* hose 3 */ 361 titan_init_one_pachip_port(&pachip1->a_port, 3);/* hose 3 */
356} 362}
357 363
358static void __init
359titan_init_vga_hose(void)
360{
361#ifdef CONFIG_VGA_HOSE
362 u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
363
364 if (pu64[7] == 3) { /* TERM_TYPE == graphics */
365 struct pci_controller *hose;
366 int h = (pu64[30] >> 24) & 0xff; /* console hose # */
367
368 /*
369 * Our hose numbering matches the console's, so just find
370 * the right one...
371 */
372 for (hose = hose_head; hose; hose = hose->next) {
373 if (hose->index == h) break;
374 }
375
376 if (hose) {
377 printk("Console graphics on hose %d\n", hose->index);
378 pci_vga_hose = hose;
379 }
380 }
381#endif /* CONFIG_VGA_HOSE */
382}
383
384void __init 364void __init
385titan_init_arch(void) 365titan_init_arch(void)
386{ 366{
@@ -406,6 +386,7 @@ titan_init_arch(void)
406 386
407 /* With multiple PCI busses, we play with I/O as physical addrs. */ 387 /* With multiple PCI busses, we play with I/O as physical addrs. */
408 ioport_resource.end = ~0UL; 388 ioport_resource.end = ~0UL;
389 iomem_resource.end = ~0UL;
409 390
410 /* PCI DMA Direct Mapping is 1GB at 2GB. */ 391 /* PCI DMA Direct Mapping is 1GB at 2GB. */
411 __direct_map_base = 0x80000000; 392 __direct_map_base = 0x80000000;
@@ -415,7 +396,7 @@ titan_init_arch(void)
415 titan_init_pachips(TITAN_pachip0, TITAN_pachip1); 396 titan_init_pachips(TITAN_pachip0, TITAN_pachip1);
416 397
417 /* Check for graphic console location (if any). */ 398 /* Check for graphic console location (if any). */
418 titan_init_vga_hose(); 399 find_console_vga_hose();
419} 400}
420 401
421static void 402static void
@@ -441,9 +422,7 @@ titan_kill_one_pachip_port(titan_pachip_port *port, int index)
441static void 422static void
442titan_kill_pachips(titan_pachip *pachip0, titan_pachip *pachip1) 423titan_kill_pachips(titan_pachip *pachip0, titan_pachip *pachip1)
443{ 424{
444 int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; 425 if (titan_pchip1_present) {
445
446 if (pchip1_present) {
447 titan_kill_one_pachip_port(&pachip1->g_port, 1); 426 titan_kill_one_pachip_port(&pachip1->g_port, 1);
448 titan_kill_one_pachip_port(&pachip1->a_port, 3); 427 titan_kill_one_pachip_port(&pachip1->a_port, 3);
449 } 428 }
@@ -463,6 +442,14 @@ titan_kill_arch(int mode)
463 */ 442 */
464 443
465void __iomem * 444void __iomem *
445titan_ioportmap(unsigned long addr)
446{
447 FIXUP_IOADDR_VGA(addr);
448 return (void __iomem *)(addr + TITAN_IO_BIAS);
449}
450
451
452void __iomem *
466titan_ioremap(unsigned long addr, unsigned long size) 453titan_ioremap(unsigned long addr, unsigned long size)
467{ 454{
468 int h = (addr & TITAN_HOSE_MASK) >> TITAN_HOSE_SHIFT; 455 int h = (addr & TITAN_HOSE_MASK) >> TITAN_HOSE_SHIFT;
@@ -475,14 +462,12 @@ titan_ioremap(unsigned long addr, unsigned long size)
475 unsigned long pfn; 462 unsigned long pfn;
476 463
477 /* 464 /*
478 * Adjust the addr. 465 * Adjust the address and hose, if necessary.
479 */ 466 */
480#ifdef CONFIG_VGA_HOSE 467 if (pci_vga_hose && __is_mem_vga(addr)) {
481 if (pci_vga_hose && __titan_is_mem_vga(addr)) {
482 h = pci_vga_hose->index; 468 h = pci_vga_hose->index;
483 addr += pci_vga_hose->mem_space->start; 469 addr += pci_vga_hose->mem_space->start;
484 } 470 }
485#endif
486 471
487 /* 472 /*
488 * Find the hose. 473 * Find the hose.
@@ -521,8 +506,10 @@ titan_ioremap(unsigned long addr, unsigned long size)
521 * Map it 506 * Map it
522 */ 507 */
523 area = get_vm_area(size, VM_IOREMAP); 508 area = get_vm_area(size, VM_IOREMAP);
524 if (!area) 509 if (!area) {
510 printk("ioremap failed... no vm_area...\n");
525 return NULL; 511 return NULL;
512 }
526 513
527 ptes = hose->sg_pci->ptes; 514 ptes = hose->sg_pci->ptes;
528 for (vaddr = (unsigned long)area->addr; 515 for (vaddr = (unsigned long)area->addr;
@@ -539,7 +526,7 @@ titan_ioremap(unsigned long addr, unsigned long size)
539 if (__alpha_remap_area_pages(vaddr, 526 if (__alpha_remap_area_pages(vaddr,
540 pfn << PAGE_SHIFT, 527 pfn << PAGE_SHIFT,
541 PAGE_SIZE, 0)) { 528 PAGE_SIZE, 0)) {
542 printk("FAILED to map...\n"); 529 printk("FAILED to remap_area_pages...\n");
543 vfree(area->addr); 530 vfree(area->addr);
544 return NULL; 531 return NULL;
545 } 532 }
@@ -551,7 +538,8 @@ titan_ioremap(unsigned long addr, unsigned long size)
551 return (void __iomem *) vaddr; 538 return (void __iomem *) vaddr;
552 } 539 }
553 540
554 return NULL; 541 /* Assume a legacy (read: VGA) address, and return appropriately. */
542 return (void __iomem *)(addr + TITAN_MEM_BIAS);
555} 543}
556 544
557void 545void
@@ -574,6 +562,7 @@ titan_is_mmio(const volatile void __iomem *xaddr)
574} 562}
575 563
576#ifndef CONFIG_ALPHA_GENERIC 564#ifndef CONFIG_ALPHA_GENERIC
565EXPORT_SYMBOL(titan_ioportmap);
577EXPORT_SYMBOL(titan_ioremap); 566EXPORT_SYMBOL(titan_ioremap);
578EXPORT_SYMBOL(titan_iounmap); 567EXPORT_SYMBOL(titan_iounmap);
579EXPORT_SYMBOL(titan_is_mmio); 568EXPORT_SYMBOL(titan_is_mmio);
@@ -750,6 +739,7 @@ titan_agp_info(void)
750 if (titan_query_agp(port)) 739 if (titan_query_agp(port))
751 hosenum = 2; 740 hosenum = 2;
752 if (hosenum < 0 && 741 if (hosenum < 0 &&
742 titan_pchip1_present &&
753 titan_query_agp(port = &TITAN_pachip1->a_port)) 743 titan_query_agp(port = &TITAN_pachip1->a_port))
754 hosenum = 3; 744 hosenum = 3;
755 745
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c
index ce623c6e55e1..ef91e09590d4 100644
--- a/arch/alpha/kernel/core_tsunami.c
+++ b/arch/alpha/kernel/core_tsunami.c
@@ -19,6 +19,7 @@
19 19
20#include <asm/ptrace.h> 20#include <asm/ptrace.h>
21#include <asm/smp.h> 21#include <asm/smp.h>
22#include <asm/vga.h>
22 23
23#include "proto.h" 24#include "proto.h"
24#include "pci_impl.h" 25#include "pci_impl.h"
@@ -349,6 +350,26 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index)
349 tsunami_pci_tbi(hose, 0, -1); 350 tsunami_pci_tbi(hose, 0, -1);
350} 351}
351 352
353
354void __iomem *
355tsunami_ioportmap(unsigned long addr)
356{
357 FIXUP_IOADDR_VGA(addr);
358 return (void __iomem *)(addr + TSUNAMI_IO_BIAS);
359}
360
361void __iomem *
362tsunami_ioremap(unsigned long addr, unsigned long size)
363{
364 FIXUP_MEMADDR_VGA(addr);
365 return (void __iomem *)(addr + TSUNAMI_MEM_BIAS);
366}
367
368#ifndef CONFIG_ALPHA_GENERIC
369EXPORT_SYMBOL(tsunami_ioportmap);
370EXPORT_SYMBOL(tsunami_ioremap);
371#endif
372
352void __init 373void __init
353tsunami_init_arch(void) 374tsunami_init_arch(void)
354{ 375{
@@ -393,6 +414,9 @@ tsunami_init_arch(void)
393 tsunami_init_one_pchip(TSUNAMI_pchip0, 0); 414 tsunami_init_one_pchip(TSUNAMI_pchip0, 0);
394 if (TSUNAMI_cchip->csc.csr & 1L<<14) 415 if (TSUNAMI_cchip->csc.csr & 1L<<14)
395 tsunami_init_one_pchip(TSUNAMI_pchip1, 1); 416 tsunami_init_one_pchip(TSUNAMI_pchip1, 1);
417
418 /* Check for graphic console location (if any). */
419 find_console_vga_hose();
396} 420}
397 421
398static void 422static void
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h
index 95912ecc65e1..708d5ca87782 100644
--- a/arch/alpha/kernel/proto.h
+++ b/arch/alpha/kernel/proto.h
@@ -108,6 +108,15 @@ extern int wildfire_cpuid_to_nid(int);
108extern unsigned long wildfire_node_mem_start(int); 108extern unsigned long wildfire_node_mem_start(int);
109extern unsigned long wildfire_node_mem_size(int); 109extern unsigned long wildfire_node_mem_size(int);
110 110
111/* console.c */
112#ifdef CONFIG_VGA_HOSE
113extern void find_console_vga_hose(void);
114extern void locate_and_init_vga(void *(*)(void *, void *));
115#else
116static inline void find_console_vga_hose(void) { }
117static inline void locate_and_init_vga(void *(*sel_func)(void *, void *)) { }
118#endif
119
111/* setup.c */ 120/* setup.c */
112extern unsigned long srm_hae; 121extern unsigned long srm_hae;
113extern int boot_cpuid; 122extern int boot_cpuid;
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index 85d2f933dd07..c71b0fd7a61f 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -543,6 +543,7 @@ dp264_init_pci(void)
543{ 543{
544 common_init_pci(); 544 common_init_pci();
545 SMC669_Init(0); 545 SMC669_Init(0);
546 locate_and_init_vga(NULL);
546} 547}
547 548
548static void __init 549static void __init
@@ -551,6 +552,14 @@ monet_init_pci(void)
551 common_init_pci(); 552 common_init_pci();
552 SMC669_Init(1); 553 SMC669_Init(1);
553 es1888_init(); 554 es1888_init();
555 locate_and_init_vga(NULL);
556}
557
558static void __init
559clipper_init_pci(void)
560{
561 common_init_pci();
562 locate_and_init_vga(NULL);
554} 563}
555 564
556static void __init 565static void __init
@@ -655,7 +664,7 @@ struct alpha_machine_vector clipper_mv __initmv = {
655 .init_arch = tsunami_init_arch, 664 .init_arch = tsunami_init_arch,
656 .init_irq = clipper_init_irq, 665 .init_irq = clipper_init_irq,
657 .init_rtc = common_init_rtc, 666 .init_rtc = common_init_rtc,
658 .init_pci = common_init_pci, 667 .init_pci = clipper_init_pci,
659 .kill_arch = tsunami_kill_arch, 668 .kill_arch = tsunami_kill_arch,
660 .pci_map_irq = clipper_map_irq, 669 .pci_map_irq = clipper_map_irq,
661 .pci_swizzle = common_swizzle, 670 .pci_swizzle = common_swizzle,
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index e349f03b830e..0bcb968cb60a 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -22,6 +22,7 @@
22#include <asm/core_marvel.h> 22#include <asm/core_marvel.h>
23#include <asm/hwrpb.h> 23#include <asm/hwrpb.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/vga.h>
25 26
26#include "proto.h" 27#include "proto.h"
27#include "err_impl.h" 28#include "err_impl.h"
@@ -412,10 +413,7 @@ marvel_init_pci(void)
412 413
413 pci_probe_only = 1; 414 pci_probe_only = 1;
414 common_init_pci(); 415 common_init_pci();
415
416#ifdef CONFIG_VGA_HOSE
417 locate_and_init_vga(NULL); 416 locate_and_init_vga(NULL);
418#endif
419 417
420 /* Clear any io7 errors. */ 418 /* Clear any io7 errors. */
421 for (io7 = NULL; (io7 = marvel_next_io7(io7)) != NULL; ) 419 for (io7 = NULL; (io7 = marvel_next_io7(io7)) != NULL; )
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index f009b7bc0943..1d3c1398c428 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -331,9 +331,7 @@ titan_init_pci(void)
331 pci_probe_only = 1; 331 pci_probe_only = 1;
332 common_init_pci(); 332 common_init_pci();
333 SMC669_Init(0); 333 SMC669_Init(0);
334#ifdef CONFIG_VGA_HOSE
335 locate_and_init_vga(NULL); 334 locate_and_init_vga(NULL);
336#endif
337} 335}
338 336
339 337
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 2568d311be21..23348e9561b9 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -247,7 +247,7 @@ not_relocated: mov r0, #0
247 mov r3, r7 247 mov r3, r7
248 bl decompress_kernel 248 bl decompress_kernel
249 249
250 add r0, r0, #127 250 add r0, r0, #127 + 128 @ alignment + stack
251 bic r0, r0, #127 @ align the kernel length 251 bic r0, r0, #127 @ align the kernel length
252/* 252/*
253 * r0 = decompressed kernel length 253 * r0 = decompressed kernel length
@@ -269,6 +269,7 @@ not_relocated: mov r0, #0
269 stmia r1!, {r9 - r14} 269 stmia r1!, {r9 - r14}
270 cmp r2, r3 270 cmp r2, r3
271 blo 1b 271 blo 1b
272 add sp, r1, #128 @ relocate the stack
272 273
273 bl cache_clean_flush 274 bl cache_clean_flush
274 add pc, r5, r0 @ call relocation code 275 add pc, r5, r0 @ call relocation code
@@ -476,6 +477,7 @@ __common_mmu_cache_on:
476 */ 477 */
477 .align 5 478 .align 5
478reloc_start: add r9, r5, r0 479reloc_start: add r9, r5, r0
480 sub r9, r9, #128 @ do not copy the stack
479 debug_reloc_start 481 debug_reloc_start
480 mov r1, r4 482 mov r1, r4
4811: 4831:
@@ -486,6 +488,7 @@ reloc_start: add r9, r5, r0
486 488
487 cmp r5, r9 489 cmp r5, r9
488 blo 1b 490 blo 1b
491 add sp, r1, #128 @ relocate the stack
489 debug_reloc_end 492 debug_reloc_end
490 493
491call_kernel: bl cache_clean_flush 494call_kernel: bl cache_clean_flush
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 06c9a0507d0d..848efb2a4ebf 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -364,19 +364,14 @@ static int at91_clk_show(struct seq_file *s, void *unused)
364{ 364{
365 u32 scsr, pcsr, sr; 365 u32 scsr, pcsr, sr;
366 struct clk *clk; 366 struct clk *clk;
367 unsigned i;
368 367
369 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR)); 368 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
370 seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR)); 369 seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR));
371
372 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR)); 370 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR));
373 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR)); 371 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
374 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR)); 372 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
375 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR)); 373 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
376
377 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR)); 374 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
378 for (i = 0; i < 4; i++)
379 seq_printf(s, "PCK%d = %8x\n", i, at91_sys_read(AT91_PMC_PCKR(i)));
380 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR)); 375 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
381 376
382 seq_printf(s, "\n"); 377 seq_printf(s, "\n");
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index ff8db29e989e..47ff676aca5f 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -76,12 +76,11 @@ static int at91_pm_verify_clocks(void)
76 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 76 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
77 return 0; 77 return 0;
78 } 78 }
79 } else if (cpu_is_at91sam9260()) { 79 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) {
80#warning "Check SAM9260 USB clocks" 80 if ((scsr & (AT91SAM926x_PMC_UHP | AT91SAM926x_PMC_UDP)) != 0) {
81 } else if (cpu_is_at91sam9261()) { 81 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
82#warning "Check SAM9261 USB clocks" 82 return 0;
83 } else if (cpu_is_at91sam9263()) { 83 }
84#warning "Check SAM9263 USB clocks"
85 } 84 }
86 85
87#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS 86#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 36440c899583..074b7cb07743 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -630,7 +630,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
630 630
631 fs = get_fs(); 631 fs = get_fs();
632 set_fs(KERNEL_DS); 632 set_fs(KERNEL_DS);
633 if thumb_mode(regs) { 633 if (thumb_mode(regs)) {
634 fault = __get_user(tinstr, (u16 *)(instrptr & ~1)); 634 fault = __get_user(tinstr, (u16 *)(instrptr & ~1));
635 if (!(fault)) 635 if (!(fault))
636 instr = thumb2arm(tinstr); 636 instr = thumb2arm(tinstr);
diff --git a/arch/arm/oprofile/op_model_mpcore.c b/arch/arm/oprofile/op_model_mpcore.c
index 7791da791f5f..75bae067922d 100644
--- a/arch/arm/oprofile/op_model_mpcore.c
+++ b/arch/arm/oprofile/op_model_mpcore.c
@@ -200,8 +200,10 @@ static int em_call_function(int (*fn)(void))
200 data.fn = fn; 200 data.fn = fn;
201 data.ret = 0; 201 data.ret = 0;
202 202
203 preempt_disable();
203 smp_call_function(em_func, &data, 1, 1); 204 smp_call_function(em_func, &data, 1, 1);
204 em_func(&data); 205 em_func(&data);
206 preempt_enable();
205 207
206 return data.ret; 208 return data.ret;
207} 209}
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 11ba75a05220..de7688cfd573 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -288,9 +288,9 @@ asmlinkage void syscall_print(void *dummy,...)
288int kernel_execve(const char *filename, char *const argv[], char *const envp[]) 288int kernel_execve(const char *filename, char *const argv[], char *const envp[])
289{ 289{
290 register long res __asm__("er0"); 290 register long res __asm__("er0");
291 register char *const *_c __asm__("er3") = envp;
292 register char *const *_b __asm__("er2") = argv;
291 register const char * _a __asm__("er1") = filename; 293 register const char * _a __asm__("er1") = filename;
292 register void *_b __asm__("er2") = argv;
293 register void *_c __asm__("er3") = envp;
294 __asm__ __volatile__ ("mov.l %1,er0\n\t" 294 __asm__ __volatile__ ("mov.l %1,er0\n\t"
295 "trapa #0\n\t" 295 "trapa #0\n\t"
296 : "=r" (res) 296 : "=r" (res)
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
index 300e3279ca5a..f97183011c2c 100644
--- a/arch/h8300/kernel/traps.c
+++ b/arch/h8300/kernel/traps.c
@@ -136,7 +136,7 @@ void show_stack(struct task_struct *task, unsigned long *esp)
136 printk("\nCall Trace:"); 136 printk("\nCall Trace:");
137 i = 0; 137 i = 0;
138 stack = esp; 138 stack = esp;
139 while (((unsigned long)stack & (THREAD_SIZE - 1)) == 0) { 139 while (((unsigned long)stack & (THREAD_SIZE - 1)) != 0) {
140 addr = *stack++; 140 addr = *stack++;
141 /* 141 /*
142 * If the address is either in the text segment of the 142 * If the address is either in the text segment of the
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 1cf466df330a..7202b98aac4f 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -734,10 +734,13 @@ void mtrr_ap_init(void)
734 */ 734 */
735void mtrr_save_state(void) 735void mtrr_save_state(void)
736{ 736{
737 if (smp_processor_id() == 0) 737 int cpu = get_cpu();
738
739 if (cpu == 0)
738 mtrr_save_fixed_ranges(NULL); 740 mtrr_save_fixed_ranges(NULL);
739 else 741 else
740 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1); 742 smp_call_function_single(0, mtrr_save_fixed_ranges, NULL, 1, 1);
743 put_cpu();
741} 744}
742 745
743static int __init mtrr_init_finialize(void) 746static int __init mtrr_init_finialize(void)
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 83f825f2e2d7..d865d041bea1 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -478,7 +478,7 @@ static int __init microcode_dev_init (void)
478 return 0; 478 return 0;
479} 479}
480 480
481static void __exit microcode_dev_exit (void) 481static void microcode_dev_exit (void)
482{ 482{
483 misc_deregister(&microcode_dev); 483 misc_deregister(&microcode_dev);
484} 484}
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c
index 50dfc65319cd..5513f8d5b5be 100644
--- a/arch/i386/kernel/reboot.c
+++ b/arch/i386/kernel/reboot.c
@@ -89,6 +89,14 @@ static int __init set_bios_reboot(struct dmi_system_id *d)
89} 89}
90 90
91static struct dmi_system_id __initdata reboot_dmi_table[] = { 91static struct dmi_system_id __initdata reboot_dmi_table[] = {
92 { /* Handle problems with rebooting on Dell E520's */
93 .callback = set_bios_reboot,
94 .ident = "Dell E520",
95 .matches = {
96 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
97 DMI_MATCH(DMI_PRODUCT_NAME, "Dell DM061"),
98 },
99 },
92 { /* Handle problems with rebooting on Dell 1300's */ 100 { /* Handle problems with rebooting on Dell 1300's */
93 .callback = set_bios_reboot, 101 .callback = set_bios_reboot,
94 .ident = "Dell PowerEdge 1300", 102 .ident = "Dell PowerEdge 1300",
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 08f07a74a9d3..88baed1e7e83 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -943,10 +943,9 @@ exit:
943 943
944static void smp_tune_scheduling(void) 944static void smp_tune_scheduling(void)
945{ 945{
946 unsigned long cachesize; /* kB */
947
948 if (cpu_khz) { 946 if (cpu_khz) {
949 cachesize = boot_cpu_data.x86_cache_size; 947 /* cache size in kB */
948 long cachesize = boot_cpu_data.x86_cache_size;
950 949
951 if (cachesize > 0) 950 if (cachesize > 0)
952 max_cache_size = cachesize * 1024; 951 max_cache_size = cachesize * 1024;
diff --git a/arch/i386/kernel/vmi.c b/arch/i386/kernel/vmi.c
index c8726c424b35..c12720d7cbc5 100644
--- a/arch/i386/kernel/vmi.c
+++ b/arch/i386/kernel/vmi.c
@@ -27,6 +27,7 @@
27#include <linux/bootmem.h> 27#include <linux/bootmem.h>
28#include <linux/mm.h> 28#include <linux/mm.h>
29#include <linux/highmem.h> 29#include <linux/highmem.h>
30#include <linux/sched.h>
30#include <asm/vmi.h> 31#include <asm/vmi.h>
31#include <asm/io.h> 32#include <asm/io.h>
32#include <asm/fixmap.h> 33#include <asm/fixmap.h>
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 29d7d61543a1..1ecb3e43b523 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -458,6 +458,11 @@ bad_area:
458bad_area_nosemaphore: 458bad_area_nosemaphore:
459 /* User mode accesses just cause a SIGSEGV */ 459 /* User mode accesses just cause a SIGSEGV */
460 if (error_code & 4) { 460 if (error_code & 4) {
461 /*
462 * It's possible to have interrupts off here.
463 */
464 local_irq_enable();
465
461 /* 466 /*
462 * Valid to do another page fault here because this one came 467 * Valid to do another page fault here because this one came
463 * from user space. 468 * from user space.
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index a7c0783b269a..11b7a51566a8 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -154,7 +154,7 @@ static int allocate_msrs(void)
154 size_t counters_size = sizeof(struct op_msr) * model->num_counters; 154 size_t counters_size = sizeof(struct op_msr) * model->num_counters;
155 155
156 int i; 156 int i;
157 for_each_online_cpu(i) { 157 for_each_possible_cpu(i) {
158 cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL); 158 cpu_msrs[i].counters = kmalloc(counters_size, GFP_KERNEL);
159 if (!cpu_msrs[i].counters) { 159 if (!cpu_msrs[i].counters) {
160 success = 0; 160 success = 0;
@@ -211,8 +211,14 @@ static int nmi_setup(void)
211 /* Assume saved/restored counters are the same on all CPUs */ 211 /* Assume saved/restored counters are the same on all CPUs */
212 model->fill_in_addresses(&cpu_msrs[0]); 212 model->fill_in_addresses(&cpu_msrs[0]);
213 for_each_possible_cpu (cpu) { 213 for_each_possible_cpu (cpu) {
214 if (cpu != 0) 214 if (cpu != 0) {
215 cpu_msrs[cpu] = cpu_msrs[0]; 215 memcpy(cpu_msrs[cpu].counters, cpu_msrs[0].counters,
216 sizeof(struct op_msr) * model->num_counters);
217
218 memcpy(cpu_msrs[cpu].controls, cpu_msrs[0].controls,
219 sizeof(struct op_msr) * model->num_controls);
220 }
221
216 } 222 }
217 on_each_cpu(nmi_save_registers, NULL, 0, 1); 223 on_each_cpu(nmi_save_registers, NULL, 0, 1);
218 on_each_cpu(nmi_cpu_setup, NULL, 0, 1); 224 on_each_cpu(nmi_cpu_setup, NULL, 0, 1);
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index b62eafb997bc..b95b42950ed4 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -436,3 +436,14 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
436 pci_early_fixup_cyrix_5530); 436 pci_early_fixup_cyrix_5530);
437DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, 437DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
438 pci_early_fixup_cyrix_5530); 438 pci_early_fixup_cyrix_5530);
439
440/*
441 * Siemens Nixdorf AG FSC Multiprocessor Interrupt Controller:
442 * prevent update of the BAR0, which doesn't look like a normal BAR.
443 */
444static void __devinit pci_siemens_interrupt_controller(struct pci_dev *dev)
445{
446 dev->resource[0].flags |= IORESOURCE_PCI_FIXED;
447}
448DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SIEMENS, 0x0015,
449 pci_siemens_interrupt_controller);
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index b8536c7c0877..85cdd23b0447 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -355,8 +355,9 @@ config RMW_INSNS
355 adventurous. 355 adventurous.
356 356
357config SINGLE_MEMORY_CHUNK 357config SINGLE_MEMORY_CHUNK
358 bool "Use one physical chunk of memory only" 358 bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
359 depends on ADVANCED && !SUN3 359 default y if SUN3
360 select NEED_MULTIPLE_NODES
360 help 361 help
361 Ignore all but the first contiguous chunk of physical memory for VM 362 Ignore all but the first contiguous chunk of physical memory for VM
362 purposes. This will save a few bytes kernel size and may speed up 363 purposes. This will save a few bytes kernel size and may speed up
@@ -377,6 +378,14 @@ config 060_WRITETHROUGH
377 is hardwired on. The 53c710 SCSI driver is known to suffer from 378 is hardwired on. The 53c710 SCSI driver is known to suffer from
378 this problem. 379 this problem.
379 380
381config ARCH_DISCONTIGMEM_ENABLE
382 def_bool !SINGLE_MEMORY_CHUNK
383
384config NODES_SHIFT
385 int
386 default "3"
387 depends on !SINGLE_MEMORY_CHUNK
388
380source "mm/Kconfig" 389source "mm/Kconfig"
381 390
382endmenu 391endmenu
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index c20831a7e1a9..aa383a5ea7ac 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -19,6 +19,7 @@ COMPILE_ARCH = $(shell uname -m)
19# override top level makefile 19# override top level makefile
20AS += -m68020 20AS += -m68020
21LDFLAGS := -m m68kelf 21LDFLAGS := -m m68kelf
22LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
22ifneq ($(COMPILE_ARCH),$(ARCH)) 23ifneq ($(COMPILE_ARCH),$(ARCH))
23 # prefix for cross-compiling binaries 24 # prefix for cross-compiling binaries
24 CROSS_COMPILE = m68k-linux-gnu- 25 CROSS_COMPILE = m68k-linux-gnu-
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index 0b68ab8d63d1..a806208c7fb5 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -9,13 +9,12 @@ else
9endif 9endif
10extra-y += vmlinux.lds 10extra-y += vmlinux.lds
11 11
12obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o \ 12obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
13 sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o 13 sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o devres.o
14 14
15devres-y = ../../../kernel/irq/devres.o 15devres-y = ../../../kernel/irq/devres.o
16 16
17obj-$(CONFIG_PCI) += bios32.o 17obj-$(CONFIG_PCI) += bios32.o
18obj-$(CONFIG_MODULES) += module.o
19obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo 18obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
20 19
21EXTRA_AFLAGS := -traditional 20EXTRA_AFLAGS := -traditional
diff --git a/arch/m68k/kernel/module.c b/arch/m68k/kernel/module.c
index 3b1a2ff61ddc..774862bc6977 100644
--- a/arch/m68k/kernel/module.c
+++ b/arch/m68k/kernel/module.c
@@ -1,3 +1,9 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
4 * for more details.
5 */
6
1#include <linux/moduleloader.h> 7#include <linux/moduleloader.h>
2#include <linux/elf.h> 8#include <linux/elf.h>
3#include <linux/vmalloc.h> 9#include <linux/vmalloc.h>
@@ -11,6 +17,8 @@
11#define DEBUGP(fmt...) 17#define DEBUGP(fmt...)
12#endif 18#endif
13 19
20#ifdef CONFIG_MODULES
21
14void *module_alloc(unsigned long size) 22void *module_alloc(unsigned long size)
15{ 23{
16 if (size == 0) 24 if (size == 0)
@@ -118,11 +126,32 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
118 126
119int module_finalize(const Elf_Ehdr *hdr, 127int module_finalize(const Elf_Ehdr *hdr,
120 const Elf_Shdr *sechdrs, 128 const Elf_Shdr *sechdrs,
121 struct module *me) 129 struct module *mod)
122{ 130{
131 module_fixup(mod, mod->arch.fixup_start, mod->arch.fixup_end);
132
123 return 0; 133 return 0;
124} 134}
125 135
126void module_arch_cleanup(struct module *mod) 136void module_arch_cleanup(struct module *mod)
127{ 137{
128} 138}
139
140#endif /* CONFIG_MODULES */
141
142void module_fixup(struct module *mod, struct m68k_fixup_info *start,
143 struct m68k_fixup_info *end)
144{
145 struct m68k_fixup_info *fixup;
146
147 for (fixup = start; fixup < end; fixup++) {
148 switch (fixup->type) {
149 case m68k_fixup_memoffset:
150 *(u32 *)fixup->addr = m68k_memoffset;
151 break;
152 case m68k_fixup_vnode_shift:
153 *(u16 *)fixup->addr += m68k_virt_to_node_shift;
154 break;
155 }
156 }
157}
diff --git a/arch/m68k/kernel/module.lds b/arch/m68k/kernel/module.lds
new file mode 100644
index 000000000000..fda94fa38243
--- /dev/null
+++ b/arch/m68k/kernel/module.lds
@@ -0,0 +1,7 @@
1SECTIONS {
2 .m68k_fixup : {
3 __start_fixup = .;
4 *(.m68k_fixup)
5 __stop_fixup = .;
6 }
7}
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 610319356691..215c7bd43924 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -60,14 +60,12 @@ extern unsigned long availmem;
60int m68k_num_memory; 60int m68k_num_memory;
61int m68k_realnum_memory; 61int m68k_realnum_memory;
62EXPORT_SYMBOL(m68k_realnum_memory); 62EXPORT_SYMBOL(m68k_realnum_memory);
63#ifdef CONFIG_SINGLE_MEMORY_CHUNK
64unsigned long m68k_memoffset; 63unsigned long m68k_memoffset;
65EXPORT_SYMBOL(m68k_memoffset); 64EXPORT_SYMBOL(m68k_memoffset);
66#endif
67struct mem_info m68k_memory[NUM_MEMINFO]; 65struct mem_info m68k_memory[NUM_MEMINFO];
68EXPORT_SYMBOL(m68k_memory); 66EXPORT_SYMBOL(m68k_memory);
69 67
70static struct mem_info m68k_ramdisk; 68struct mem_info m68k_ramdisk;
71 69
72static char m68k_command_line[CL_SIZE]; 70static char m68k_command_line[CL_SIZE];
73 71
@@ -208,9 +206,6 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
208void __init setup_arch(char **cmdline_p) 206void __init setup_arch(char **cmdline_p)
209{ 207{
210 extern int _etext, _edata, _end; 208 extern int _etext, _edata, _end;
211#ifndef CONFIG_SUN3
212 unsigned long endmem, startmem;
213#endif
214 int i; 209 int i;
215 210
216 /* The bootinfo is located right after the kernel bss */ 211 /* The bootinfo is located right after the kernel bss */
@@ -320,30 +315,16 @@ void __init setup_arch(char **cmdline_p)
320 panic("No configuration setup"); 315 panic("No configuration setup");
321 } 316 }
322 317
323#ifndef CONFIG_SUN3 318 paging_init();
324 startmem= m68k_memory[0].addr;
325 endmem = startmem + m68k_memory[0].size;
326 high_memory = (void *)PAGE_OFFSET;
327 for (i = 0; i < m68k_num_memory; i++) {
328 m68k_memory[i].size &= MASK_256K;
329 if (m68k_memory[i].addr < startmem)
330 startmem = m68k_memory[i].addr;
331 if (m68k_memory[i].addr+m68k_memory[i].size > endmem)
332 endmem = m68k_memory[i].addr+m68k_memory[i].size;
333 high_memory += m68k_memory[i].size;
334 }
335
336 availmem += init_bootmem_node(NODE_DATA(0), availmem >> PAGE_SHIFT,
337 startmem >> PAGE_SHIFT, endmem >> PAGE_SHIFT);
338
339 for (i = 0; i < m68k_num_memory; i++)
340 free_bootmem(m68k_memory[i].addr, m68k_memory[i].size);
341
342 reserve_bootmem(m68k_memory[0].addr, availmem - m68k_memory[0].addr);
343 319
320#ifndef CONFIG_SUN3
321 for (i = 1; i < m68k_num_memory; i++)
322 free_bootmem_node(NODE_DATA(i), m68k_memory[i].addr,
323 m68k_memory[i].size);
344#ifdef CONFIG_BLK_DEV_INITRD 324#ifdef CONFIG_BLK_DEV_INITRD
345 if (m68k_ramdisk.size) { 325 if (m68k_ramdisk.size) {
346 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); 326 reserve_bootmem_node(__virt_to_node(phys_to_virt(m68k_ramdisk.addr)),
327 m68k_ramdisk.addr, m68k_ramdisk.size);
347 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 328 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
348 initrd_end = initrd_start + m68k_ramdisk.size; 329 initrd_end = initrd_start + m68k_ramdisk.size;
349 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 330 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
@@ -362,8 +343,6 @@ void __init setup_arch(char **cmdline_p)
362 343
363#endif /* !CONFIG_SUN3 */ 344#endif /* !CONFIG_SUN3 */
364 345
365 paging_init();
366
367/* set ISA defs early as possible */ 346/* set ISA defs early as possible */
368#if defined(CONFIG_ISA) && defined(MULTI_ISA) 347#if defined(CONFIG_ISA) && defined(MULTI_ISA)
369#if defined(CONFIG_Q40) 348#if defined(CONFIG_Q40)
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 78f139226a1b..40f02b128f22 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -60,6 +60,11 @@ SECTIONS
60 __con_initcall_start = .; 60 __con_initcall_start = .;
61 .con_initcall.init : { *(.con_initcall.init) } 61 .con_initcall.init : { *(.con_initcall.init) }
62 __con_initcall_end = .; 62 __con_initcall_end = .;
63 .m68k_fixup : {
64 __start_fixup = .;
65 *(.m68k_fixup)
66 __stop_fixup = .;
67 }
63 SECURITY_INIT 68 SECURITY_INIT
64#ifdef CONFIG_BLK_DEV_INITRD 69#ifdef CONFIG_BLK_DEV_INITRD
65 . = ALIGN(8192); 70 . = ALIGN(8192);
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index c8999b2db23b..f06425b6d206 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -54,6 +54,11 @@ __init_begin = .;
54 __con_initcall_start = .; 54 __con_initcall_start = .;
55 .con_initcall.init : { *(.con_initcall.init) } 55 .con_initcall.init : { *(.con_initcall.init) }
56 __con_initcall_end = .; 56 __con_initcall_end = .;
57 .m68k_fixup : {
58 __start_fixup = .;
59 *(.m68k_fixup)
60 __stop_fixup = .;
61 }
57 SECURITY_INIT 62 SECURITY_INIT
58#ifdef CONFIG_BLK_DEV_INITRD 63#ifdef CONFIG_BLK_DEV_INITRD
59 . = ALIGN(8192); 64 . = ALIGN(8192);
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index 7a5bed5bdc57..e8a57138b4a6 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -71,7 +71,7 @@ void mac_debugging_short(int pos, short num)
71 71
72 /* calculate current offset */ 72 /* calculate current offset */
73 pengoffset = (unsigned char *)mac_videobase + 73 pengoffset = (unsigned char *)mac_videobase +
74 (150+line*2) * mac_rowbytes) + 80 * peng; 74 (150+line*2) * mac_rowbytes + 80 * peng;
75 75
76 pptr = pengoffset; 76 pptr = pengoffset;
77 77
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index ab90213e5c54..f1de19e1dde6 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -7,6 +7,7 @@
7 * to motorola.c and sun3mmu.c 7 * to motorola.c and sun3mmu.c
8 */ 8 */
9 9
10#include <linux/module.h>
10#include <linux/signal.h> 11#include <linux/signal.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
@@ -31,6 +32,37 @@
31 32
32DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 33DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
33 34
35static bootmem_data_t __initdata bootmem_data[MAX_NUMNODES];
36
37pg_data_t pg_data_map[MAX_NUMNODES];
38EXPORT_SYMBOL(pg_data_map);
39
40int m68k_virt_to_node_shift;
41
42#ifndef CONFIG_SINGLE_MEMORY_CHUNK
43pg_data_t *pg_data_table[65];
44EXPORT_SYMBOL(pg_data_table);
45#endif
46
47void m68k_setup_node(int node)
48{
49#ifndef CONFIG_SINGLE_MEMORY_CHUNK
50 struct mem_info *info = m68k_memory + node;
51 int i, end;
52
53 i = (unsigned long)phys_to_virt(info->addr) >> __virt_to_node_shift();
54 end = (unsigned long)phys_to_virt(info->addr + info->size - 1) >> __virt_to_node_shift();
55 for (; i <= end; i++) {
56 if (pg_data_table[i])
57 printk("overlap at %u for chunk %u\n", i, node);
58 pg_data_table[i] = pg_data_map + node;
59 }
60#endif
61 pg_data_map[node].bdata = bootmem_data + node;
62 node_set_online(node);
63}
64
65
34/* 66/*
35 * ZERO_PAGE is a special page that is used for zero-initialized 67 * ZERO_PAGE is a special page that is used for zero-initialized
36 * data and COW. 68 * data and COW.
@@ -40,52 +72,51 @@ void *empty_zero_page;
40 72
41void show_mem(void) 73void show_mem(void)
42{ 74{
43 unsigned long i; 75 pg_data_t *pgdat;
44 int free = 0, total = 0, reserved = 0, shared = 0; 76 int free = 0, total = 0, reserved = 0, shared = 0;
45 int cached = 0; 77 int cached = 0;
46 78 int i;
47 printk("\nMem-info:\n"); 79
48 show_free_areas(); 80 printk("\nMem-info:\n");
49 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 81 show_free_areas();
50 i = max_mapnr; 82 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
51 while (i-- > 0) { 83 for_each_online_pgdat(pgdat) {
52 total++; 84 for (i = 0; i < pgdat->node_spanned_pages; i++) {
53 if (PageReserved(mem_map+i)) 85 struct page *page = pgdat->node_mem_map + i;
54 reserved++; 86 total++;
55 else if (PageSwapCache(mem_map+i)) 87 if (PageReserved(page))
56 cached++; 88 reserved++;
57 else if (!page_count(mem_map+i)) 89 else if (PageSwapCache(page))
58 free++; 90 cached++;
59 else 91 else if (!page_count(page))
60 shared += page_count(mem_map+i) - 1; 92 free++;
61 } 93 else
62 printk("%d pages of RAM\n",total); 94 shared += page_count(page) - 1;
63 printk("%d free pages\n",free); 95 }
64 printk("%d reserved pages\n",reserved); 96 }
65 printk("%d pages shared\n",shared); 97 printk("%d pages of RAM\n",total);
66 printk("%d pages swap cached\n",cached); 98 printk("%d free pages\n",free);
99 printk("%d reserved pages\n",reserved);
100 printk("%d pages shared\n",shared);
101 printk("%d pages swap cached\n",cached);
67} 102}
68 103
69extern void init_pointer_table(unsigned long ptable); 104extern void init_pointer_table(unsigned long ptable);
70 105
71/* References to section boundaries */ 106/* References to section boundaries */
72 107
73extern char _text, _etext, _edata, __bss_start, _end; 108extern char _text[], _etext[];
74extern char __init_begin, __init_end; 109extern char __init_begin[], __init_end[];
75 110
76extern pmd_t *zero_pgtable; 111extern pmd_t *zero_pgtable;
77 112
78void __init mem_init(void) 113void __init mem_init(void)
79{ 114{
115 pg_data_t *pgdat;
80 int codepages = 0; 116 int codepages = 0;
81 int datapages = 0; 117 int datapages = 0;
82 int initpages = 0; 118 int initpages = 0;
83 unsigned long tmp;
84#ifndef CONFIG_SUN3
85 int i; 119 int i;
86#endif
87
88 max_mapnr = num_physpages = (((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT);
89 120
90#ifdef CONFIG_ATARI 121#ifdef CONFIG_ATARI
91 if (MACH_IS_ATARI) 122 if (MACH_IS_ATARI)
@@ -93,19 +124,25 @@ void __init mem_init(void)
93#endif 124#endif
94 125
95 /* this will put all memory onto the freelists */ 126 /* this will put all memory onto the freelists */
96 totalram_pages = free_all_bootmem(); 127 totalram_pages = num_physpages = 0;
97 128 for_each_online_pgdat(pgdat) {
98 for (tmp = PAGE_OFFSET ; tmp < (unsigned long)high_memory; tmp += PAGE_SIZE) { 129 num_physpages += pgdat->node_present_pages;
99 if (PageReserved(virt_to_page(tmp))) { 130
100 if (tmp >= (unsigned long)&_text 131 totalram_pages += free_all_bootmem_node(pgdat);
101 && tmp < (unsigned long)&_etext) 132 for (i = 0; i < pgdat->node_spanned_pages; i++) {
133 struct page *page = pgdat->node_mem_map + i;
134 char *addr = page_to_virt(page);
135
136 if (!PageReserved(page))
137 continue;
138 if (addr >= _text &&
139 addr < _etext)
102 codepages++; 140 codepages++;
103 else if (tmp >= (unsigned long) &__init_begin 141 else if (addr >= __init_begin &&
104 && tmp < (unsigned long) &__init_end) 142 addr < __init_end)
105 initpages++; 143 initpages++;
106 else 144 else
107 datapages++; 145 datapages++;
108 continue;
109 } 146 }
110 } 147 }
111 148
@@ -124,7 +161,7 @@ void __init mem_init(void)
124 161
125 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n", 162 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
126 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), 163 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
127 max_mapnr << (PAGE_SHIFT-10), 164 totalram_pages << (PAGE_SHIFT-10),
128 codepages << (PAGE_SHIFT-10), 165 codepages << (PAGE_SHIFT-10),
129 datapages << (PAGE_SHIFT-10), 166 datapages << (PAGE_SHIFT-10),
130 initpages << (PAGE_SHIFT-10)); 167 initpages << (PAGE_SHIFT-10));
diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c
index 13c0b4ad01eb..b7473525b431 100644
--- a/arch/m68k/mm/memory.c
+++ b/arch/m68k/mm/memory.c
@@ -127,67 +127,6 @@ int free_pointer_table (pmd_t *ptable)
127 return 0; 127 return 0;
128} 128}
129 129
130#ifdef DEBUG_INVALID_PTOV
131int mm_inv_cnt = 5;
132#endif
133
134#ifndef CONFIG_SINGLE_MEMORY_CHUNK
135/*
136 * The following two routines map from a physical address to a kernel
137 * virtual address and vice versa.
138 */
139unsigned long mm_vtop(unsigned long vaddr)
140{
141 int i=0;
142 unsigned long voff = (unsigned long)vaddr - PAGE_OFFSET;
143
144 do {
145 if (voff < m68k_memory[i].size) {
146#ifdef DEBUGPV
147 printk ("VTOP(%p)=%lx\n", vaddr,
148 m68k_memory[i].addr + voff);
149#endif
150 return m68k_memory[i].addr + voff;
151 }
152 voff -= m68k_memory[i].size;
153 } while (++i < m68k_num_memory);
154
155 /* As a special case allow `__pa(high_memory)'. */
156 if (voff == 0)
157 return m68k_memory[i-1].addr + m68k_memory[i-1].size;
158
159 return -1;
160}
161EXPORT_SYMBOL(mm_vtop);
162
163unsigned long mm_ptov (unsigned long paddr)
164{
165 int i = 0;
166 unsigned long poff, voff = PAGE_OFFSET;
167
168 do {
169 poff = paddr - m68k_memory[i].addr;
170 if (poff < m68k_memory[i].size) {
171#ifdef DEBUGPV
172 printk ("PTOV(%lx)=%lx\n", paddr, poff + voff);
173#endif
174 return poff + voff;
175 }
176 voff += m68k_memory[i].size;
177 } while (++i < m68k_num_memory);
178
179#ifdef DEBUG_INVALID_PTOV
180 if (mm_inv_cnt > 0) {
181 mm_inv_cnt--;
182 printk("Invalid use of phys_to_virt(0x%lx) at 0x%p!\n",
183 paddr, __builtin_return_address(0));
184 }
185#endif
186 return -1;
187}
188EXPORT_SYMBOL(mm_ptov);
189#endif
190
191/* invalidate page in both caches */ 130/* invalidate page in both caches */
192static inline void clear040(unsigned long paddr) 131static inline void clear040(unsigned long paddr)
193{ 132{
@@ -354,15 +293,3 @@ void cache_push (unsigned long paddr, int len)
354} 293}
355EXPORT_SYMBOL(cache_push); 294EXPORT_SYMBOL(cache_push);
356 295
357#ifndef CONFIG_SINGLE_MEMORY_CHUNK
358int mm_end_of_chunk (unsigned long addr, int len)
359{
360 int i;
361
362 for (i = 0; i < m68k_num_memory; i++)
363 if (m68k_memory[i].addr + m68k_memory[i].size == addr + len)
364 return 1;
365 return 0;
366}
367EXPORT_SYMBOL(mm_end_of_chunk);
368#endif
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index afcccdc6ad45..7d571a2b44dd 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -43,6 +43,11 @@ unsigned long mm_cachebits;
43EXPORT_SYMBOL(mm_cachebits); 43EXPORT_SYMBOL(mm_cachebits);
44#endif 44#endif
45 45
46/* size of memory already mapped in head.S */
47#define INIT_MAPPED_SIZE (4UL<<20)
48
49extern unsigned long availmem;
50
46static pte_t * __init kernel_page_table(void) 51static pte_t * __init kernel_page_table(void)
47{ 52{
48 pte_t *ptablep; 53 pte_t *ptablep;
@@ -98,19 +103,20 @@ static pmd_t * __init kernel_ptr_table(void)
98 return last_pgtable; 103 return last_pgtable;
99} 104}
100 105
101static unsigned long __init 106static void __init map_node(int node)
102map_chunk (unsigned long addr, long size)
103{ 107{
104#define PTRTREESIZE (256*1024) 108#define PTRTREESIZE (256*1024)
105#define ROOTTREESIZE (32*1024*1024) 109#define ROOTTREESIZE (32*1024*1024)
106 static unsigned long virtaddr = PAGE_OFFSET; 110 unsigned long physaddr, virtaddr, size;
107 unsigned long physaddr;
108 pgd_t *pgd_dir; 111 pgd_t *pgd_dir;
109 pmd_t *pmd_dir; 112 pmd_t *pmd_dir;
110 pte_t *pte_dir; 113 pte_t *pte_dir;
111 114
112 physaddr = (addr | m68k_supervisor_cachemode | 115 size = m68k_memory[node].size;
113 _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); 116 physaddr = m68k_memory[node].addr;
117 virtaddr = (unsigned long)phys_to_virt(physaddr);
118 physaddr |= m68k_supervisor_cachemode |
119 _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY;
114 if (CPU_IS_040_OR_060) 120 if (CPU_IS_040_OR_060)
115 physaddr |= _PAGE_GLOBAL040; 121 physaddr |= _PAGE_GLOBAL040;
116 122
@@ -190,8 +196,6 @@ map_chunk (unsigned long addr, long size)
190#ifdef DEBUG 196#ifdef DEBUG
191 printk("\n"); 197 printk("\n");
192#endif 198#endif
193
194 return virtaddr;
195} 199}
196 200
197/* 201/*
@@ -200,15 +204,16 @@ map_chunk (unsigned long addr, long size)
200 */ 204 */
201void __init paging_init(void) 205void __init paging_init(void)
202{ 206{
203 int chunk;
204 unsigned long mem_avail = 0;
205 unsigned long zones_size[MAX_NR_ZONES] = { 0, }; 207 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
208 unsigned long min_addr, max_addr;
209 unsigned long addr, size, end;
210 int i;
206 211
207#ifdef DEBUG 212#ifdef DEBUG
208 { 213 {
209 extern unsigned long availmem; 214 extern unsigned long availmem;
210 printk ("start of paging_init (%p, %lx, %lx, %lx)\n", 215 printk ("start of paging_init (%p, %lx)\n",
211 kernel_pg_dir, availmem, start_mem, end_mem); 216 kernel_pg_dir, availmem);
212 } 217 }
213#endif 218#endif
214 219
@@ -222,24 +227,62 @@ void __init paging_init(void)
222 pgprot_val(protection_map[i]) |= _PAGE_CACHE040; 227 pgprot_val(protection_map[i]) |= _PAGE_CACHE040;
223 } 228 }
224 229
230 min_addr = m68k_memory[0].addr;
231 max_addr = min_addr + m68k_memory[0].size;
232 for (i = 1; i < m68k_num_memory;) {
233 if (m68k_memory[i].addr < min_addr) {
234 printk("Ignoring memory chunk at 0x%lx:0x%lx before the first chunk\n",
235 m68k_memory[i].addr, m68k_memory[i].size);
236 printk("Fix your bootloader or use a memfile to make use of this area!\n");
237 m68k_num_memory--;
238 memmove(m68k_memory + i, m68k_memory + i + 1,
239 (m68k_num_memory - i) * sizeof(struct mem_info));
240 continue;
241 }
242 addr = m68k_memory[i].addr + m68k_memory[i].size;
243 if (addr > max_addr)
244 max_addr = addr;
245 i++;
246 }
247 m68k_memoffset = min_addr - PAGE_OFFSET;
248 m68k_virt_to_node_shift = fls(max_addr - min_addr - 1) - 6;
249
250 module_fixup(NULL, __start_fixup, __stop_fixup);
251 flush_icache();
252
253 high_memory = phys_to_virt(max_addr);
254
255 min_low_pfn = availmem >> PAGE_SHIFT;
256 max_low_pfn = max_addr >> PAGE_SHIFT;
257
258 for (i = 0; i < m68k_num_memory; i++) {
259 addr = m68k_memory[i].addr;
260 end = addr + m68k_memory[i].size;
261 m68k_setup_node(i);
262 availmem = PAGE_ALIGN(availmem);
263 availmem += init_bootmem_node(NODE_DATA(i),
264 availmem >> PAGE_SHIFT,
265 addr >> PAGE_SHIFT,
266 end >> PAGE_SHIFT);
267 }
268
225 /* 269 /*
226 * Map the physical memory available into the kernel virtual 270 * Map the physical memory available into the kernel virtual
227 * address space. It may allocate some memory for page 271 * address space. First initialize the bootmem allocator with
228 * tables and thus modify availmem. 272 * the memory we already mapped, so map_node() has something
273 * to allocate.
229 */ 274 */
275 addr = m68k_memory[0].addr;
276 size = m68k_memory[0].size;
277 free_bootmem_node(NODE_DATA(0), availmem, min(INIT_MAPPED_SIZE, size) - (availmem - addr));
278 map_node(0);
279 if (size > INIT_MAPPED_SIZE)
280 free_bootmem_node(NODE_DATA(0), addr + INIT_MAPPED_SIZE, size - INIT_MAPPED_SIZE);
230 281
231 for (chunk = 0; chunk < m68k_num_memory; chunk++) { 282 for (i = 1; i < m68k_num_memory; i++)
232 mem_avail = map_chunk (m68k_memory[chunk].addr, 283 map_node(i);
233 m68k_memory[chunk].size);
234
235 }
236 284
237 flush_tlb_all(); 285 flush_tlb_all();
238#ifdef DEBUG
239 printk ("memory available is %ldKB\n", mem_avail >> 10);
240 printk ("start_mem is %#lx\nvirtual_end is %#lx\n",
241 start_mem, end_mem);
242#endif
243 286
244 /* 287 /*
245 * initialize the bad page table and bad page to point 288 * initialize the bad page table and bad page to point
@@ -256,14 +299,11 @@ void __init paging_init(void)
256#ifdef DEBUG 299#ifdef DEBUG
257 printk ("before free_area_init\n"); 300 printk ("before free_area_init\n");
258#endif 301#endif
259 zones_size[ZONE_DMA] = (mach_max_dma_address < (unsigned long)high_memory ? 302 for (i = 0; i < m68k_num_memory; i++) {
260 (mach_max_dma_address+1) : (unsigned long)high_memory); 303 zones_size[ZONE_DMA] = m68k_memory[i].size >> PAGE_SHIFT;
261 zones_size[ZONE_NORMAL] = (unsigned long)high_memory - zones_size[0]; 304 free_area_init_node(i, pg_data_map + i, zones_size,
262 305 m68k_memory[i].addr >> PAGE_SHIFT, NULL);
263 zones_size[ZONE_DMA] = (zones_size[ZONE_DMA] - PAGE_OFFSET) >> PAGE_SHIFT; 306 }
264 zones_size[ZONE_NORMAL] >>= PAGE_SHIFT;
265
266 free_area_init(zones_size);
267} 307}
268 308
269extern char __init_begin, __init_end; 309extern char __init_begin, __init_end;
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 4851b8437a87..c0fbd278fbb1 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -21,6 +21,7 @@
21#include <asm/contregs.h> 21#include <asm/contregs.h>
22#include <asm/movs.h> 22#include <asm/movs.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/pgalloc.h>
24#include <asm/sun3-head.h> 25#include <asm/sun3-head.h>
25#include <asm/sun3mmu.h> 26#include <asm/sun3mmu.h>
26#include <asm/rtc.h> 27#include <asm/rtc.h>
@@ -127,6 +128,7 @@ void __init sun3_bootmem_alloc(unsigned long memory_start, unsigned long memory_
127 high_memory = (void *)memory_end; 128 high_memory = (void *)memory_end;
128 availmem = memory_start; 129 availmem = memory_start;
129 130
131 m68k_setup_node(0);
130 availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages); 132 availmem += init_bootmem_node(NODE_DATA(0), start_page, 0, num_pages);
131 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK; 133 availmem = (availmem + (PAGE_SIZE-1)) & PAGE_MASK;
132 134
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 0f09412e1b7f..9528ee90640a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -747,9 +747,9 @@ config EARLY_PRINTK
747 to print messages very early in the bootup process. 747 to print messages very early in the bootup process.
748 748
749 This is useful for kernel debugging when your machine crashes very 749 This is useful for kernel debugging when your machine crashes very
750 early before the console code is initialized. For normal operation 750 early before the console code is initialized. For normal operation,
751 it is not recommended because it looks on some machines ugly and 751 it is not recommended because it looks ugly on some machines and
752 oesn't cooperate with an X server. You should normally N here, 752 doesn't cooperate with an X server. You should normally say N here,
753 unless you want to debug such a crash. 753 unless you want to debug such a crash.
754 754
755config SYS_HAS_EARLY_PRINTK 755config SYS_HAS_EARLY_PRINTK
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index b29a44739230..2f060e1ed36c 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -115,30 +115,6 @@ extern void markeins_irq_setup(void);
115 115
116static void inline __init markeins_sio_setup(void) 116static void inline __init markeins_sio_setup(void)
117{ 117{
118#ifdef CONFIG_KGDB_8250
119 struct uart_port emma_port;
120
121 memset(&emma_port, 0, sizeof(emma_port));
122
123 emma_port.flags =
124 UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
125 emma_port.iotype = UPIO_MEM;
126 emma_port.regshift = 4; /* I/O addresses are every 8 bytes */
127 emma_port.uartclk = 18544000; /* Clock rate of the chip */
128
129 emma_port.line = 0;
130 emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3);
131 emma_port.membase = (u8*)emma_port.mapbase;
132 early_serial_setup(&emma_port);
133
134 emma_port.line = 1;
135 emma_port.mapbase = KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3);
136 emma_port.membase = (u8*)emma_port.mapbase;
137 early_serial_setup(&emma_port);
138
139 emma_port.irq = EMMA2RH_IRQ_PFUR1;
140 kgdb8250_add_port(1, &emma_port);
141#endif
142} 118}
143 119
144void __init plat_mem_setup(void) 120void __init plat_mem_setup(void)
diff --git a/arch/mips/jmr3927/rbhma3100/kgdb_io.c b/arch/mips/jmr3927/rbhma3100/kgdb_io.c
index 2604f2c9a96e..342579cfdc01 100644
--- a/arch/mips/jmr3927/rbhma3100/kgdb_io.c
+++ b/arch/mips/jmr3927/rbhma3100/kgdb_io.c
@@ -36,7 +36,7 @@
36#define TIMEOUT 0xffffff 36#define TIMEOUT 0xffffff
37 37
38static int remoteDebugInitialized = 0; 38static int remoteDebugInitialized = 0;
39static void debugInit(int baud) 39static void debugInit(int baud);
40 40
41int putDebugChar(unsigned char c) 41int putDebugChar(unsigned char c)
42{ 42{
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 37849edd0645..06e04da211d5 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -556,6 +556,16 @@ asmlinkage long sys32_sync_file_range(int fd, int __pad,
556 flags); 556 flags);
557} 557}
558 558
559asmlinkage long sys32_fadvise64_64(int fd, int __pad,
560 unsigned long a2, unsigned long a3,
561 unsigned long a4, unsigned long a5,
562 int flags)
563{
564 return sys_fadvise64_64(fd,
565 merge_64(a2, a3), merge_64(a4, a5),
566 flags);
567}
568
559save_static_function(sys32_clone); 569save_static_function(sys32_clone);
560__attribute_used__ noinline static int 570__attribute_used__ noinline static int
561_sys32_clone(nabi_no_regargs struct pt_regs regs) 571_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S
index cc566cf12246..06729596812f 100644
--- a/arch/mips/kernel/r4k_switch.S
+++ b/arch/mips/kernel/r4k_switch.S
@@ -174,7 +174,7 @@ LEAF(_init_fpu)
174 or t0, t1 174 or t0, t1
175 mtc0 t0, CP0_STATUS 175 mtc0 t0, CP0_STATUS
176#endif /* CONFIG_MIPS_MT_SMTC */ 176#endif /* CONFIG_MIPS_MT_SMTC */
177 fpu_enable_hazard 177 enable_fpu_hazard
178 178
179 li t1, FPU_DEFAULT 179 li t1, FPU_DEFAULT
180 ctc1 t1, fcr31 180 ctc1 t1, fcr31
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 6eac28337423..1631035ffc24 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -299,7 +299,7 @@ EXPORT(sysn32_call_table)
299 PTR sys_ni_syscall /* res. for afs_syscall */ 299 PTR sys_ni_syscall /* res. for afs_syscall */
300 PTR sys_ni_syscall /* res. for security */ 300 PTR sys_ni_syscall /* res. for security */
301 PTR sys_gettid 301 PTR sys_gettid
302 PTR sys32_readahead 302 PTR sys_readahead
303 PTR sys_setxattr /* 6180 */ 303 PTR sys_setxattr /* 6180 */
304 PTR sys_lsetxattr 304 PTR sys_lsetxattr
305 PTR sys_fsetxattr 305 PTR sys_fsetxattr
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 7e74b412a782..2aa99426ac1c 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -459,7 +459,7 @@ sys_call_table:
459 PTR sys_remap_file_pages 459 PTR sys_remap_file_pages
460 PTR sys_set_tid_address 460 PTR sys_set_tid_address
461 PTR sys_restart_syscall 461 PTR sys_restart_syscall
462 PTR sys_fadvise64_64 462 PTR sys32_fadvise64_64
463 PTR compat_sys_statfs64 /* 4255 */ 463 PTR compat_sys_statfs64 /* 4255 */
464 PTR compat_sys_fstatfs64 464 PTR compat_sys_fstatfs64
465 PTR compat_sys_timer_create 465 PTR compat_sys_timer_create
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 200de027f354..3f58b6ac1358 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -927,12 +927,6 @@ asmlinkage void do_reserved(struct pt_regs *regs)
927 (regs->cp0_cause & 0x7f) >> 2); 927 (regs->cp0_cause & 0x7f) >> 2);
928} 928}
929 929
930static asmlinkage void do_default_vi(void)
931{
932 show_regs(get_irq_regs());
933 panic("Caught unexpected vectored interrupt.");
934}
935
936/* 930/*
937 * Some MIPS CPUs can enable/disable for cache parity detection, but do 931 * Some MIPS CPUs can enable/disable for cache parity detection, but do
938 * it different ways. 932 * it different ways.
@@ -1128,6 +1122,12 @@ void mips_srs_free(int set)
1128 clear_bit(set, &sr->sr_allocated); 1122 clear_bit(set, &sr->sr_allocated);
1129} 1123}
1130 1124
1125static asmlinkage void do_default_vi(void)
1126{
1127 show_regs(get_irq_regs());
1128 panic("Caught unexpected vectored interrupt.");
1129}
1130
1131static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) 1131static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1132{ 1132{
1133 unsigned long handler; 1133 unsigned long handler;
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 0c6b0ce15028..1cc6ebbedfdd 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -48,6 +48,8 @@ const char *get_system_type(void)
48 return "MIPS Atlas"; 48 return "MIPS Atlas";
49} 49}
50 50
51const char display_string[] = " LINUX ON ATLAS ";
52
51void __init plat_mem_setup(void) 53void __init plat_mem_setup(void)
52{ 54{
53 mips_pcibios_init(); 55 mips_pcibios_init();
diff --git a/arch/mips/mips-boards/generic/display.c b/arch/mips/mips-boards/generic/display.c
index 548dbe5ce7c8..5d600054090a 100644
--- a/arch/mips/mips-boards/generic/display.c
+++ b/arch/mips/mips-boards/generic/display.c
@@ -19,9 +19,14 @@
19 */ 19 */
20 20
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include <linux/timer.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/mips-boards/generic.h> 24#include <asm/mips-boards/generic.h>
24 25
26extern const char display_string[];
27static unsigned int display_count;
28static unsigned int max_display_count;
29
25void mips_display_message(const char *str) 30void mips_display_message(const char *str)
26{ 31{
27 static unsigned int __iomem *display = NULL; 32 static unsigned int __iomem *display = NULL;
@@ -37,3 +42,22 @@ void mips_display_message(const char *str)
37 writel(' ', display + i); 42 writel(' ', display + i);
38 } 43 }
39} 44}
45
46static void scroll_display_message(unsigned long data);
47static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
48
49static void scroll_display_message(unsigned long data)
50{
51 mips_display_message(&display_string[display_count++]);
52 if (display_count == max_display_count)
53 display_count = 0;
54
55 mod_timer(&mips_scroll_timer, jiffies + HZ);
56}
57
58void mips_scroll_message(void)
59{
60 del_timer_sync(&mips_scroll_timer);
61 max_display_count = strlen(display_string) + 1 - 8;
62 mod_timer(&mips_scroll_timer, jiffies + 1);
63}
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index df2a2bd3aa5d..37735bfc3afd 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -53,37 +53,11 @@
53 53
54unsigned long cpu_khz; 54unsigned long cpu_khz;
55 55
56#if defined(CONFIG_MIPS_ATLAS)
57static char display_string[] = " LINUX ON ATLAS ";
58#endif
59#if defined(CONFIG_MIPS_MALTA)
60#if defined(CONFIG_MIPS_MT_SMTC)
61static char display_string[] = " SMTC LINUX ON MALTA ";
62#else
63static char display_string[] = " LINUX ON MALTA ";
64#endif /* CONFIG_MIPS_MT_SMTC */
65#endif
66#if defined(CONFIG_MIPS_SEAD)
67static char display_string[] = " LINUX ON SEAD ";
68#endif
69static unsigned int display_count;
70#define MAX_DISPLAY_COUNT (sizeof(display_string) - 8)
71
72#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR) 56#define CPUCTR_IMASKBIT (0x100 << MIPSCPU_INT_CPUCTR)
73 57
74static unsigned int timer_tick_count;
75static int mips_cpu_timer_irq; 58static int mips_cpu_timer_irq;
76extern void smtc_timer_broadcast(int); 59extern void smtc_timer_broadcast(int);
77 60
78static inline void scroll_display_message(void)
79{
80 if ((timer_tick_count++ % HZ) == 0) {
81 mips_display_message(&display_string[display_count++]);
82 if (display_count == MAX_DISPLAY_COUNT)
83 display_count = 0;
84 }
85}
86
87static void mips_timer_dispatch(void) 61static void mips_timer_dispatch(void)
88{ 62{
89 do_IRQ(mips_cpu_timer_irq); 63 do_IRQ(mips_cpu_timer_irq);
@@ -143,7 +117,6 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
143 if (cpu_data[cpu].vpe_id == 0) { 117 if (cpu_data[cpu].vpe_id == 0) {
144 timer_interrupt(irq, NULL); 118 timer_interrupt(irq, NULL);
145 smtc_timer_broadcast(cpu_data[cpu].vpe_id); 119 smtc_timer_broadcast(cpu_data[cpu].vpe_id);
146 scroll_display_message();
147 } else { 120 } else {
148 write_c0_compare(read_c0_count() + 121 write_c0_compare(read_c0_count() +
149 (mips_hpt_frequency/HZ)); 122 (mips_hpt_frequency/HZ));
@@ -167,8 +140,6 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
167 /* we keep interrupt disabled all the time */ 140 /* we keep interrupt disabled all the time */
168 if (!r2 || (read_c0_cause() & (1 << 30))) 141 if (!r2 || (read_c0_cause() & (1 << 30)))
169 timer_interrupt(irq, NULL); 142 timer_interrupt(irq, NULL);
170
171 scroll_display_message();
172 } else { 143 } else {
173 /* Everyone else needs to reset the timer int here as 144 /* Everyone else needs to reset the timer int here as
174 ll_local_timer_interrupt doesn't */ 145 ll_local_timer_interrupt doesn't */
@@ -262,6 +233,8 @@ void __init mips_time_init(void)
262 (est_freq%1000000)*100/1000000); 233 (est_freq%1000000)*100/1000000);
263 234
264 cpu_khz = est_freq / 1000; 235 cpu_khz = est_freq / 1000;
236
237 mips_scroll_message();
265} 238}
266 239
267void __init plat_timer_setup(struct irqaction *irq) 240void __init plat_timer_setup(struct irqaction *irq)
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index 7873932532a1..c14b7bf89950 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -56,6 +56,12 @@ const char *get_system_type(void)
56 return "MIPS Malta"; 56 return "MIPS Malta";
57} 57}
58 58
59#if defined(CONFIG_MIPS_MT_SMTC)
60const char display_string[] = " SMTC LINUX ON MALTA ";
61#else
62const char display_string[] = " LINUX ON MALTA ";
63#endif /* CONFIG_MIPS_MT_SMTC */
64
59#ifdef CONFIG_BLK_DEV_FD 65#ifdef CONFIG_BLK_DEV_FD
60void __init fd_activate(void) 66void __init fd_activate(void)
61{ 67{
diff --git a/arch/mips/mips-boards/sead/sead_setup.c b/arch/mips/mips-boards/sead/sead_setup.c
index a189dec7c7bc..811aba100605 100644
--- a/arch/mips/mips-boards/sead/sead_setup.c
+++ b/arch/mips/mips-boards/sead/sead_setup.c
@@ -43,6 +43,8 @@ const char *get_system_type(void)
43 return "MIPS SEAD"; 43 return "MIPS SEAD";
44} 44}
45 45
46const char display_string[] = " LINUX ON SEAD ";
47
46void __init plat_mem_setup(void) 48void __init plat_mem_setup(void)
47{ 49{
48 ioport_resource.end = 0x7fffffff; 50 ioport_resource.end = 0x7fffffff;
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index f0eb29917d9a..76903c727647 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -168,8 +168,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
168 addr = (unsigned long) page_address(sg->page); 168 addr = (unsigned long) page_address(sg->page);
169 if (!plat_device_is_coherent(dev) && addr) 169 if (!plat_device_is_coherent(dev) && addr)
170 __dma_sync(addr + sg->offset, sg->length, direction); 170 __dma_sync(addr + sg->offset, sg->length, direction);
171 sg->dma_address = plat_map_dma_mem_page(dev, sg->page) + 171 sg->dma_address = plat_map_dma_mem(dev,
172 sg->offset; 172 (void *)(addr + sg->offset),
173 sg->length);
173 } 174 }
174 175
175 return nents; 176 return nents;
diff --git a/arch/mips/pci/pci-ocelot.c b/arch/mips/pci/pci-ocelot.c
index 7f94f26d35ae..1421d34535ef 100644
--- a/arch/mips/pci/pci-ocelot.c
+++ b/arch/mips/pci/pci-ocelot.c
@@ -71,19 +71,19 @@ static inline void pci0WriteConfigReg(unsigned int offset, unsigned int data)
71} 71}
72 72
73static struct resource ocelot_mem_resource = { 73static struct resource ocelot_mem_resource = {
74 start = GT_PCI_MEM_BASE; 74 .start = GT_PCI_MEM_BASE,
75 end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1; 75 .end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1,
76}; 76};
77 77
78static struct resource ocelot_io_resource = { 78static struct resource ocelot_io_resource = {
79 start = GT_PCI_IO_BASE; 79 .start = GT_PCI_IO_BASE,
80 end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1; 80 .end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1,
81}; 81};
82 82
83static struct pci_controller ocelot_pci_controller = { 83static struct pci_controller ocelot_pci_controller = {
84 .pci_ops = gt64xxx_pci0_ops; 84 .pci_ops = gt64xxx_pci0_ops,
85 .mem_resource = &ocelot_mem_resource; 85 .mem_resource = &ocelot_mem_resource,
86 .io_resource = &ocelot_io_resource; 86 .io_resource = &ocelot_io_resource,
87}; 87};
88 88
89static int __init ocelot_pcibios_init(void) 89static int __init ocelot_pcibios_init(void)
diff --git a/arch/mips/qemu/q-irq.c b/arch/mips/qemu/q-irq.c
index f5ea2fe10f14..89891e984b3b 100644
--- a/arch/mips/qemu/q-irq.c
+++ b/arch/mips/qemu/q-irq.c
@@ -7,8 +7,6 @@
7#include <asm/system.h> 7#include <asm/system.h>
8#include <asm/time.h> 8#include <asm/time.h>
9 9
10extern asmlinkage void qemu_handle_int(void);
11
12asmlinkage void plat_irq_dispatch(void) 10asmlinkage void plat_irq_dispatch(void)
13{ 11{
14 unsigned int pending = read_c0_status() & read_c0_cause(); 12 unsigned int pending = read_c0_status() & read_c0_cause();
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 9ee208daa8b1..97b234361b4d 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -6,7 +6,7 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 9 * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
@@ -131,6 +131,19 @@ static struct resource pcimt_io_resources[] = {
131 } 131 }
132}; 132};
133 133
134static struct resource pcimt_mem_resources[] = {
135 {
136 /*
137 * this region should only be 4 bytes long,
138 * but it's 16MB on all RM300C I've checked
139 */
140 .start = 0x1a000000,
141 .end = 0x1affffff,
142 .name = "PCI INT ACK",
143 .flags = IORESOURCE_BUSY
144 }
145};
146
134static struct resource sni_mem_resource = { 147static struct resource sni_mem_resource = {
135 .start = 0x18000000UL, 148 .start = 0x18000000UL,
136 .end = 0x1fbfffffUL, 149 .end = 0x1fbfffffUL,
@@ -145,6 +158,9 @@ static void __init sni_pcimt_resource_init(void)
145 /* request I/O space for devices used on all i[345]86 PCs */ 158 /* request I/O space for devices used on all i[345]86 PCs */
146 for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++) 159 for (i = 0; i < ARRAY_SIZE(pcimt_io_resources); i++)
147 request_resource(&sni_io_resource, pcimt_io_resources + i); 160 request_resource(&sni_io_resource, pcimt_io_resources + i);
161 /* request MEM space for devices used on all i[345]86 PCs */
162 for (i = 0; i < ARRAY_SIZE(pcimt_mem_resources); i++)
163 request_resource(&sni_mem_resource, pcimt_mem_resources + i);
148} 164}
149 165
150extern struct pci_ops sni_pcimt_ops; 166extern struct pci_ops sni_pcimt_ops;
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 68d7cf609b4f..4fedfbda0c79 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -6,7 +6,7 @@
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 9 * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */ 10 */
11#include <linux/eisa.h> 11#include <linux/eisa.h>
12#include <linux/init.h> 12#include <linux/init.h>
@@ -92,3 +92,34 @@ void __init plat_mem_setup(void)
92 92
93 sni_display_setup(); 93 sni_display_setup();
94} 94}
95
96#if CONFIG_PCI
97
98#include <linux/pci.h>
99#include <video/vga.h>
100#include <video/cirrus.h>
101
102static void __devinit quirk_cirrus_ram_size(struct pci_dev *dev)
103{
104 u16 cmd;
105
106 /*
107 * firmware doesn't set the ram size correct, so we
108 * need to do it here, otherwise we get screen corruption
109 * on older Cirrus chips
110 */
111 pci_read_config_word (dev, PCI_COMMAND, &cmd);
112 if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY))
113 == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) {
114 vga_wseq (NULL, CL_SEQR6, 0x12); /* unlock all extension registers */
115 vga_wseq (NULL, CL_SEQRF, 0x18);
116 }
117}
118
119DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8,
120 quirk_cirrus_ram_size);
121DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436,
122 quirk_cirrus_ram_size);
123DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446,
124 quirk_cirrus_ram_size);
125#endif
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6238b5875fd1..fbafd965dcd2 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -142,7 +142,6 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
142 142
143# Default to zImage, override when needed 143# Default to zImage, override when needed
144defaultimage-y := zImage 144defaultimage-y := zImage
145defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
146defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage 145defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage
147KBUILD_IMAGE := $(defaultimage-y) 146KBUILD_IMAGE := $(defaultimage-y)
148all: $(KBUILD_IMAGE) 147all: $(KBUILD_IMAGE)
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 83788986b93b..ff2701949ee1 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -11,20 +11,18 @@
11# bootloader and increase compatibility with OpenFirmware. 11# bootloader and increase compatibility with OpenFirmware.
12# 12#
13# To this end we need to define BOOTCC, etc, as the tools 13# To this end we need to define BOOTCC, etc, as the tools
14# needed to build the 32 bit image. These are normally HOSTCC, 14# needed to build the 32 bit image. That's normally the same
15# but may be a third compiler if, for example, you are cross 15# compiler for the rest of the kernel, with the -m32 flag added.
16# compiling from an intel box. Once the 64bit ppc gcc is
17# stable it will probably simply be a compiler switch to
18# compile for 32bit mode.
19# To make it easier to setup a cross compiler, 16# To make it easier to setup a cross compiler,
20# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE 17# CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
21# in the toplevel makefile. 18# in the toplevel makefile.
22 19
23all: $(obj)/zImage 20all: $(obj)/zImage
24 21
25HOSTCC := gcc 22BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
26BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ 23 -fno-strict-aliasing -Os -msoft-float -pipe \
27 $(shell $(CROSS32CC) -print-file-name=include) -fPIC 24 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
25 -isystem $(shell $(CROSS32CC) -print-file-name=include)
28BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 26BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
29 27
30ifeq ($(call cc-option-yn, -fstack-protector),y) 28ifeq ($(call cc-option-yn, -fstack-protector),y)
@@ -33,8 +31,8 @@ endif
33 31
34BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) 32BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj)
35 33
36$(obj)/44x.o: BOOTCFLAGS += -Wa,-mbooke 34$(obj)/44x.o: BOOTCFLAGS += -mcpu=440
37$(obj)/ebony.o: BOOTCFLAGS += -Wa,-mbooke 35$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
38 36
39zlib := inffast.c inflate.c inftrees.c 37zlib := inffast.c inflate.c inftrees.c
40zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h 38zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
@@ -136,6 +134,7 @@ image-$(CONFIG_PPC_EFIKA) += zImage.chrp
136image-$(CONFIG_PPC_PMAC) += zImage.pmac 134image-$(CONFIG_PPC_PMAC) += zImage.pmac
137image-$(CONFIG_PPC_HOLLY) += zImage.holly-elf 135image-$(CONFIG_PPC_HOLLY) += zImage.holly-elf
138image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800 136image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800
137image-$(CONFIG_PPC_ISERIES) += zImage.iseries
139image-$(CONFIG_DEFAULT_UIMAGE) += uImage 138image-$(CONFIG_DEFAULT_UIMAGE) += uImage
140 139
141ifneq ($(CONFIG_DEVICE_TREE),"") 140ifneq ($(CONFIG_DEVICE_TREE),"")
@@ -185,6 +184,9 @@ $(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
185$(obj)/zImage.%: vmlinux $(wrapperbits) 184$(obj)/zImage.%: vmlinux $(wrapperbits)
186 $(call if_changed,wrap,$*) 185 $(call if_changed,wrap,$*)
187 186
187$(obj)/zImage.iseries: vmlinux
188 $(STRIP) -s -R .comment $< -o $@
189
188$(obj)/zImage.ps3: vmlinux 190$(obj)/zImage.ps3: vmlinux
189 $(STRIP) -s -R .comment $< -o $@ 191 $(STRIP) -s -R .comment $< -o $@
190 192
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 5a4215c4b014..f1c4dfc635be 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -13,6 +13,7 @@
13 13
14 .text 14 .text
15 /* a procedure descriptor used when booting this as a COFF file */ 15 /* a procedure descriptor used when booting this as a COFF file */
16 .globl _zimage_start_opd
16_zimage_start_opd: 17_zimage_start_opd:
17 .long _zimage_start, 0, 0, 0 18 .long _zimage_start, 0, 0, 0
18 19
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 2ed8b8b3f0ec..da77adc73078 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -129,7 +129,7 @@ case "$platform" in
129pmac|pseries|chrp) 129pmac|pseries|chrp)
130 platformo=$object/of.o 130 platformo=$object/of.o
131 ;; 131 ;;
132pmaccoff) 132coff)
133 platformo=$object/of.o 133 platformo=$object/of.o
134 lds=$object/zImage.coff.lds 134 lds=$object/zImage.coff.lds
135 ;; 135 ;;
@@ -220,7 +220,7 @@ case "$platform" in
220pseries|chrp) 220pseries|chrp)
221 $object/addnote "$ofile" 221 $object/addnote "$ofile"
222 ;; 222 ;;
223pmaccoff) 223coff)
224 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile" 224 ${CROSS}objcopy -O aixcoff-rs6000 --set-start "$entry" "$ofile"
225 $object/hack-coff "$ofile" 225 $object/hack-coff "$ofile"
226 ;; 226 ;;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 068377a2a8dc..42c8ed6ed528 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -489,7 +489,7 @@ struct irq_host *irq_alloc_host(unsigned int revmap_type,
489 case IRQ_HOST_MAP_LINEAR: 489 case IRQ_HOST_MAP_LINEAR:
490 rmap = (unsigned int *)(host + 1); 490 rmap = (unsigned int *)(host + 1);
491 for (i = 0; i < revmap_arg; i++) 491 for (i = 0; i < revmap_arg; i++)
492 rmap[i] = IRQ_NONE; 492 rmap[i] = NO_IRQ;
493 host->revmap_data.linear.size = revmap_arg; 493 host->revmap_data.linear.size = revmap_arg;
494 smp_wmb(); 494 smp_wmb();
495 host->revmap_data.linear.revmap = rmap; 495 host->revmap_data.linear.revmap = rmap;
@@ -614,7 +614,7 @@ unsigned int irq_create_mapping(struct irq_host *host,
614 * host->ops->map() to update the flags 614 * host->ops->map() to update the flags
615 */ 615 */
616 virq = irq_find_mapping(host, hwirq); 616 virq = irq_find_mapping(host, hwirq);
617 if (virq != IRQ_NONE) { 617 if (virq != NO_IRQ) {
618 if (host->ops->remap) 618 if (host->ops->remap)
619 host->ops->remap(host, virq, hwirq); 619 host->ops->remap(host, virq, hwirq);
620 pr_debug("irq: -> existing mapping on virq %d\n", virq); 620 pr_debug("irq: -> existing mapping on virq %d\n", virq);
@@ -741,7 +741,7 @@ void irq_dispose_mapping(unsigned int virq)
741 switch(host->revmap_type) { 741 switch(host->revmap_type) {
742 case IRQ_HOST_MAP_LINEAR: 742 case IRQ_HOST_MAP_LINEAR:
743 if (hwirq < host->revmap_data.linear.size) 743 if (hwirq < host->revmap_data.linear.size)
744 host->revmap_data.linear.revmap[hwirq] = IRQ_NONE; 744 host->revmap_data.linear.revmap[hwirq] = NO_IRQ;
745 break; 745 break;
746 case IRQ_HOST_MAP_TREE: 746 case IRQ_HOST_MAP_TREE:
747 /* Check if radix tree allocated yet */ 747 /* Check if radix tree allocated yet */
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index d501c23e5159..d454f61c9c7c 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -433,7 +433,7 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
433 * Note also that we don't do ISA, this will also be fixed with a 433 * Note also that we don't do ISA, this will also be fixed with a
434 * more massive rework. 434 * more massive rework.
435 */ 435 */
436 pci_setup_phb_io(phb, 0); 436 pci_setup_phb_io(phb, pci_io_base == 0);
437 437
438 /* Init pci_dn data structures */ 438 /* Init pci_dn data structures */
439 pci_devs_phb_init_dynamic(phb); 439 pci_devs_phb_init_dynamic(phb);
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 066a6a7a25b8..af42ddab3ab4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -1171,11 +1171,12 @@ EXPORT_SYMBOL(of_find_node_by_name);
1171 1171
1172/** 1172/**
1173 * of_find_node_by_type - Find a node by its "device_type" property 1173 * of_find_node_by_type - Find a node by its "device_type" property
1174 * @from: The node to start searching from or NULL, the node 1174 * @from: The node to start searching from, or NULL to start searching
1175 * you pass will not be searched, only the next one 1175 * the entire device tree. The node you pass will not be
1176 * will; typically, you pass what the previous call 1176 * searched, only the next one will; typically, you pass
1177 * returned. of_node_put() will be called on it 1177 * what the previous call returned. of_node_put() will be
1178 * @name: The type string to match against 1178 * called on from for you.
1179 * @type: The type string to match against
1179 * 1180 *
1180 * Returns a node pointer with refcount incremented, use 1181 * Returns a node pointer with refcount incremented, use
1181 * of_node_put() on it when done. 1182 * of_node_put() on it when done.
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index f4f391cdd8f5..bf76562167c3 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -218,6 +218,7 @@ set_single_step(struct task_struct *task)
218 regs->msr |= MSR_SE; 218 regs->msr |= MSR_SE;
219#endif 219#endif
220 } 220 }
221 set_tsk_thread_flag(task, TIF_SINGLESTEP);
221} 222}
222 223
223static inline void 224static inline void
@@ -233,6 +234,7 @@ clear_single_step(struct task_struct *task)
233 regs->msr &= ~MSR_SE; 234 regs->msr &= ~MSR_SE;
234#endif 235#endif
235 } 236 }
237 clear_tsk_thread_flag(task, TIF_SINGLESTEP);
236} 238}
237#endif /* CONFIG_PPC32 */ 239#endif /* CONFIG_PPC32 */
238 240
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c
index f9ac3fe3be97..ac445998d831 100644
--- a/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -67,6 +67,7 @@ static u64 MIC_Slow_Next_Timer_table[] = {
67 0x00003FC000000000ull, 67 0x00003FC000000000ull,
68}; 68};
69 69
70static unsigned int pmi_frequency_limit = 0;
70/* 71/*
71 * hardware specific functions 72 * hardware specific functions
72 */ 73 */
@@ -164,7 +165,6 @@ static int set_pmode(int cpu, unsigned int slow_mode) {
164 165
165static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg) 166static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
166{ 167{
167 struct cpufreq_policy policy;
168 u8 cpu; 168 u8 cpu;
169 u8 cbe_pmode_new; 169 u8 cbe_pmode_new;
170 170
@@ -173,15 +173,27 @@ static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg)
173 cpu = cbe_node_to_cpu(pmi_msg.data1); 173 cpu = cbe_node_to_cpu(pmi_msg.data1);
174 cbe_pmode_new = pmi_msg.data2; 174 cbe_pmode_new = pmi_msg.data2;
175 175
176 cpufreq_get_policy(&policy, cpu); 176 pmi_frequency_limit = cbe_freqs[cbe_pmode_new].frequency;
177 177
178 policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency); 178 pr_debug("cbe_handle_pmi: max freq=%d\n", pmi_frequency_limit);
179 policy.min = min(policy.min, policy.max); 179}
180
181static int pmi_notifier(struct notifier_block *nb,
182 unsigned long event, void *data)
183{
184 struct cpufreq_policy *policy = data;
180 185
181 pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max); 186 if (event != CPUFREQ_INCOMPATIBLE)
182 cpufreq_set_policy(&policy); 187 return 0;
188
189 cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit);
190 return 0;
183} 191}
184 192
193static struct notifier_block pmi_notifier_block = {
194 .notifier_call = pmi_notifier,
195};
196
185static struct pmi_handler cbe_pmi_handler = { 197static struct pmi_handler cbe_pmi_handler = {
186 .type = PMI_TYPE_FREQ_CHANGE, 198 .type = PMI_TYPE_FREQ_CHANGE,
187 .handle_pmi_message = cbe_cpufreq_handle_pmi, 199 .handle_pmi_message = cbe_cpufreq_handle_pmi,
@@ -238,12 +250,21 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
238 250
239 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); 251 cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
240 252
253 if (pmi_dev) {
254 /* frequency might get limited later, initialize limit with max_freq */
255 pmi_frequency_limit = max_freq;
256 cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
257 }
258
241 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ 259 /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
242 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); 260 return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
243} 261}
244 262
245static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) 263static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
246{ 264{
265 if (pmi_dev)
266 cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER);
267
247 cpufreq_frequency_table_put_attr(policy->cpu); 268 cpufreq_frequency_table_put_attr(policy->cpu);
248 return 0; 269 return 0;
249} 270}
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 8654749e317b..7c51cb54bca1 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -39,7 +39,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
39 if (spu_init_csa(&ctx->csa)) 39 if (spu_init_csa(&ctx->csa))
40 goto out_free; 40 goto out_free;
41 spin_lock_init(&ctx->mmio_lock); 41 spin_lock_init(&ctx->mmio_lock);
42 spin_lock_init(&ctx->mapping_lock); 42 mutex_init(&ctx->mapping_lock);
43 kref_init(&ctx->kref); 43 kref_init(&ctx->kref);
44 mutex_init(&ctx->state_mutex); 44 mutex_init(&ctx->state_mutex);
45 mutex_init(&ctx->run_mutex); 45 mutex_init(&ctx->run_mutex);
@@ -103,6 +103,7 @@ void spu_forget(struct spu_context *ctx)
103 103
104void spu_unmap_mappings(struct spu_context *ctx) 104void spu_unmap_mappings(struct spu_context *ctx)
105{ 105{
106 mutex_lock(&ctx->mapping_lock);
106 if (ctx->local_store) 107 if (ctx->local_store)
107 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1); 108 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
108 if (ctx->mfc) 109 if (ctx->mfc)
@@ -117,6 +118,7 @@ void spu_unmap_mappings(struct spu_context *ctx)
117 unmap_mapping_range(ctx->mss, 0, 0x1000, 1); 118 unmap_mapping_range(ctx->mss, 0, 0x1000, 1);
118 if (ctx->psmap) 119 if (ctx->psmap)
119 unmap_mapping_range(ctx->psmap, 0, 0x20000, 1); 120 unmap_mapping_range(ctx->psmap, 0, 0x20000, 1);
121 mutex_unlock(&ctx->mapping_lock);
120} 122}
121 123
122/** 124/**
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 45614c73c784..b1e7e2f8a2e9 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -45,11 +45,11 @@ spufs_mem_open(struct inode *inode, struct file *file)
45 struct spufs_inode_info *i = SPUFS_I(inode); 45 struct spufs_inode_info *i = SPUFS_I(inode);
46 struct spu_context *ctx = i->i_ctx; 46 struct spu_context *ctx = i->i_ctx;
47 47
48 spin_lock(&ctx->mapping_lock); 48 mutex_lock(&ctx->mapping_lock);
49 file->private_data = ctx; 49 file->private_data = ctx;
50 if (!i->i_openers++) 50 if (!i->i_openers++)
51 ctx->local_store = inode->i_mapping; 51 ctx->local_store = inode->i_mapping;
52 spin_unlock(&ctx->mapping_lock); 52 mutex_unlock(&ctx->mapping_lock);
53 return 0; 53 return 0;
54} 54}
55 55
@@ -59,10 +59,10 @@ spufs_mem_release(struct inode *inode, struct file *file)
59 struct spufs_inode_info *i = SPUFS_I(inode); 59 struct spufs_inode_info *i = SPUFS_I(inode);
60 struct spu_context *ctx = i->i_ctx; 60 struct spu_context *ctx = i->i_ctx;
61 61
62 spin_lock(&ctx->mapping_lock); 62 mutex_lock(&ctx->mapping_lock);
63 if (!--i->i_openers) 63 if (!--i->i_openers)
64 ctx->local_store = NULL; 64 ctx->local_store = NULL;
65 spin_unlock(&ctx->mapping_lock); 65 mutex_unlock(&ctx->mapping_lock);
66 return 0; 66 return 0;
67} 67}
68 68
@@ -217,6 +217,7 @@ unsigned long spufs_get_unmapped_area(struct file *file, unsigned long addr,
217 217
218static const struct file_operations spufs_mem_fops = { 218static const struct file_operations spufs_mem_fops = {
219 .open = spufs_mem_open, 219 .open = spufs_mem_open,
220 .release = spufs_mem_release,
220 .read = spufs_mem_read, 221 .read = spufs_mem_read,
221 .write = spufs_mem_write, 222 .write = spufs_mem_write,
222 .llseek = generic_file_llseek, 223 .llseek = generic_file_llseek,
@@ -309,11 +310,11 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
309 struct spufs_inode_info *i = SPUFS_I(inode); 310 struct spufs_inode_info *i = SPUFS_I(inode);
310 struct spu_context *ctx = i->i_ctx; 311 struct spu_context *ctx = i->i_ctx;
311 312
312 spin_lock(&ctx->mapping_lock); 313 mutex_lock(&ctx->mapping_lock);
313 file->private_data = ctx; 314 file->private_data = ctx;
314 if (!i->i_openers++) 315 if (!i->i_openers++)
315 ctx->cntl = inode->i_mapping; 316 ctx->cntl = inode->i_mapping;
316 spin_unlock(&ctx->mapping_lock); 317 mutex_unlock(&ctx->mapping_lock);
317 return simple_attr_open(inode, file, spufs_cntl_get, 318 return simple_attr_open(inode, file, spufs_cntl_get,
318 spufs_cntl_set, "0x%08lx"); 319 spufs_cntl_set, "0x%08lx");
319} 320}
@@ -326,10 +327,10 @@ spufs_cntl_release(struct inode *inode, struct file *file)
326 327
327 simple_attr_close(inode, file); 328 simple_attr_close(inode, file);
328 329
329 spin_lock(&ctx->mapping_lock); 330 mutex_lock(&ctx->mapping_lock);
330 if (!--i->i_openers) 331 if (!--i->i_openers)
331 ctx->cntl = NULL; 332 ctx->cntl = NULL;
332 spin_unlock(&ctx->mapping_lock); 333 mutex_unlock(&ctx->mapping_lock);
333 return 0; 334 return 0;
334} 335}
335 336
@@ -812,11 +813,11 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
812 struct spufs_inode_info *i = SPUFS_I(inode); 813 struct spufs_inode_info *i = SPUFS_I(inode);
813 struct spu_context *ctx = i->i_ctx; 814 struct spu_context *ctx = i->i_ctx;
814 815
815 spin_lock(&ctx->mapping_lock); 816 mutex_lock(&ctx->mapping_lock);
816 file->private_data = ctx; 817 file->private_data = ctx;
817 if (!i->i_openers++) 818 if (!i->i_openers++)
818 ctx->signal1 = inode->i_mapping; 819 ctx->signal1 = inode->i_mapping;
819 spin_unlock(&ctx->mapping_lock); 820 mutex_unlock(&ctx->mapping_lock);
820 return nonseekable_open(inode, file); 821 return nonseekable_open(inode, file);
821} 822}
822 823
@@ -826,10 +827,10 @@ spufs_signal1_release(struct inode *inode, struct file *file)
826 struct spufs_inode_info *i = SPUFS_I(inode); 827 struct spufs_inode_info *i = SPUFS_I(inode);
827 struct spu_context *ctx = i->i_ctx; 828 struct spu_context *ctx = i->i_ctx;
828 829
829 spin_lock(&ctx->mapping_lock); 830 mutex_lock(&ctx->mapping_lock);
830 if (!--i->i_openers) 831 if (!--i->i_openers)
831 ctx->signal1 = NULL; 832 ctx->signal1 = NULL;
832 spin_unlock(&ctx->mapping_lock); 833 mutex_unlock(&ctx->mapping_lock);
833 return 0; 834 return 0;
834} 835}
835 836
@@ -936,11 +937,11 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
936 struct spufs_inode_info *i = SPUFS_I(inode); 937 struct spufs_inode_info *i = SPUFS_I(inode);
937 struct spu_context *ctx = i->i_ctx; 938 struct spu_context *ctx = i->i_ctx;
938 939
939 spin_lock(&ctx->mapping_lock); 940 mutex_lock(&ctx->mapping_lock);
940 file->private_data = ctx; 941 file->private_data = ctx;
941 if (!i->i_openers++) 942 if (!i->i_openers++)
942 ctx->signal2 = inode->i_mapping; 943 ctx->signal2 = inode->i_mapping;
943 spin_unlock(&ctx->mapping_lock); 944 mutex_unlock(&ctx->mapping_lock);
944 return nonseekable_open(inode, file); 945 return nonseekable_open(inode, file);
945} 946}
946 947
@@ -950,10 +951,10 @@ spufs_signal2_release(struct inode *inode, struct file *file)
950 struct spufs_inode_info *i = SPUFS_I(inode); 951 struct spufs_inode_info *i = SPUFS_I(inode);
951 struct spu_context *ctx = i->i_ctx; 952 struct spu_context *ctx = i->i_ctx;
952 953
953 spin_lock(&ctx->mapping_lock); 954 mutex_lock(&ctx->mapping_lock);
954 if (!--i->i_openers) 955 if (!--i->i_openers)
955 ctx->signal2 = NULL; 956 ctx->signal2 = NULL;
956 spin_unlock(&ctx->mapping_lock); 957 mutex_unlock(&ctx->mapping_lock);
957 return 0; 958 return 0;
958} 959}
959 960
@@ -1154,10 +1155,10 @@ static int spufs_mss_open(struct inode *inode, struct file *file)
1154 1155
1155 file->private_data = i->i_ctx; 1156 file->private_data = i->i_ctx;
1156 1157
1157 spin_lock(&ctx->mapping_lock); 1158 mutex_lock(&ctx->mapping_lock);
1158 if (!i->i_openers++) 1159 if (!i->i_openers++)
1159 ctx->mss = inode->i_mapping; 1160 ctx->mss = inode->i_mapping;
1160 spin_unlock(&ctx->mapping_lock); 1161 mutex_unlock(&ctx->mapping_lock);
1161 return nonseekable_open(inode, file); 1162 return nonseekable_open(inode, file);
1162} 1163}
1163 1164
@@ -1167,10 +1168,10 @@ spufs_mss_release(struct inode *inode, struct file *file)
1167 struct spufs_inode_info *i = SPUFS_I(inode); 1168 struct spufs_inode_info *i = SPUFS_I(inode);
1168 struct spu_context *ctx = i->i_ctx; 1169 struct spu_context *ctx = i->i_ctx;
1169 1170
1170 spin_lock(&ctx->mapping_lock); 1171 mutex_lock(&ctx->mapping_lock);
1171 if (!--i->i_openers) 1172 if (!--i->i_openers)
1172 ctx->mss = NULL; 1173 ctx->mss = NULL;
1173 spin_unlock(&ctx->mapping_lock); 1174 mutex_unlock(&ctx->mapping_lock);
1174 return 0; 1175 return 0;
1175} 1176}
1176 1177
@@ -1211,11 +1212,11 @@ static int spufs_psmap_open(struct inode *inode, struct file *file)
1211 struct spufs_inode_info *i = SPUFS_I(inode); 1212 struct spufs_inode_info *i = SPUFS_I(inode);
1212 struct spu_context *ctx = i->i_ctx; 1213 struct spu_context *ctx = i->i_ctx;
1213 1214
1214 spin_lock(&ctx->mapping_lock); 1215 mutex_lock(&ctx->mapping_lock);
1215 file->private_data = i->i_ctx; 1216 file->private_data = i->i_ctx;
1216 if (!i->i_openers++) 1217 if (!i->i_openers++)
1217 ctx->psmap = inode->i_mapping; 1218 ctx->psmap = inode->i_mapping;
1218 spin_unlock(&ctx->mapping_lock); 1219 mutex_unlock(&ctx->mapping_lock);
1219 return nonseekable_open(inode, file); 1220 return nonseekable_open(inode, file);
1220} 1221}
1221 1222
@@ -1225,10 +1226,10 @@ spufs_psmap_release(struct inode *inode, struct file *file)
1225 struct spufs_inode_info *i = SPUFS_I(inode); 1226 struct spufs_inode_info *i = SPUFS_I(inode);
1226 struct spu_context *ctx = i->i_ctx; 1227 struct spu_context *ctx = i->i_ctx;
1227 1228
1228 spin_lock(&ctx->mapping_lock); 1229 mutex_lock(&ctx->mapping_lock);
1229 if (!--i->i_openers) 1230 if (!--i->i_openers)
1230 ctx->psmap = NULL; 1231 ctx->psmap = NULL;
1231 spin_unlock(&ctx->mapping_lock); 1232 mutex_unlock(&ctx->mapping_lock);
1232 return 0; 1233 return 0;
1233} 1234}
1234 1235
@@ -1281,11 +1282,11 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
1281 if (atomic_read(&inode->i_count) != 1) 1282 if (atomic_read(&inode->i_count) != 1)
1282 return -EBUSY; 1283 return -EBUSY;
1283 1284
1284 spin_lock(&ctx->mapping_lock); 1285 mutex_lock(&ctx->mapping_lock);
1285 file->private_data = ctx; 1286 file->private_data = ctx;
1286 if (!i->i_openers++) 1287 if (!i->i_openers++)
1287 ctx->mfc = inode->i_mapping; 1288 ctx->mfc = inode->i_mapping;
1288 spin_unlock(&ctx->mapping_lock); 1289 mutex_unlock(&ctx->mapping_lock);
1289 return nonseekable_open(inode, file); 1290 return nonseekable_open(inode, file);
1290} 1291}
1291 1292
@@ -1295,10 +1296,10 @@ spufs_mfc_release(struct inode *inode, struct file *file)
1295 struct spufs_inode_info *i = SPUFS_I(inode); 1296 struct spufs_inode_info *i = SPUFS_I(inode);
1296 struct spu_context *ctx = i->i_ctx; 1297 struct spu_context *ctx = i->i_ctx;
1297 1298
1298 spin_lock(&ctx->mapping_lock); 1299 mutex_lock(&ctx->mapping_lock);
1299 if (!--i->i_openers) 1300 if (!--i->i_openers)
1300 ctx->mfc = NULL; 1301 ctx->mfc = NULL;
1301 spin_unlock(&ctx->mapping_lock); 1302 mutex_unlock(&ctx->mapping_lock);
1302 return 0; 1303 return 0;
1303} 1304}
1304 1305
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 7150730e2ff1..9807206e0219 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -177,7 +177,7 @@ static int spufs_rmdir(struct inode *parent, struct dentry *dir)
177static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files, 177static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
178 int mode, struct spu_context *ctx) 178 int mode, struct spu_context *ctx)
179{ 179{
180 struct dentry *dentry; 180 struct dentry *dentry, *tmp;
181 int ret; 181 int ret;
182 182
183 while (files->name && files->name[0]) { 183 while (files->name && files->name[0]) {
@@ -193,7 +193,20 @@ static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
193 } 193 }
194 return 0; 194 return 0;
195out: 195out:
196 spufs_prune_dir(dir); 196 /*
197 * remove all children from dir. dir->inode is not set so don't
198 * just simply use spufs_prune_dir() and panic afterwards :)
199 * dput() looks like it will do the right thing:
200 * - dec parent's ref counter
201 * - remove child from parent's child list
202 * - free child's inode if possible
203 * - free child
204 */
205 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
206 dput(dentry);
207 }
208
209 shrink_dcache_parent(dir);
197 return ret; 210 return ret;
198} 211}
199 212
@@ -274,6 +287,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags,
274 goto out; 287 goto out;
275 288
276out_free_ctx: 289out_free_ctx:
290 spu_forget(ctx);
277 put_spu_context(ctx); 291 put_spu_context(ctx);
278out_iput: 292out_iput:
279 iput(inode); 293 iput(inode);
@@ -349,37 +363,6 @@ out:
349 return ret; 363 return ret;
350} 364}
351 365
352static int spufs_rmgang(struct inode *root, struct dentry *dir)
353{
354 /* FIXME: this fails if the dir is not empty,
355 which causes a leak of gangs. */
356 return simple_rmdir(root, dir);
357}
358
359static int spufs_gang_close(struct inode *inode, struct file *file)
360{
361 struct inode *parent;
362 struct dentry *dir;
363 int ret;
364
365 dir = file->f_path.dentry;
366 parent = dir->d_parent->d_inode;
367
368 ret = spufs_rmgang(parent, dir);
369 WARN_ON(ret);
370
371 return dcache_dir_close(inode, file);
372}
373
374const struct file_operations spufs_gang_fops = {
375 .open = dcache_dir_open,
376 .release = spufs_gang_close,
377 .llseek = dcache_dir_lseek,
378 .read = generic_read_dir,
379 .readdir = dcache_readdir,
380 .fsync = simple_sync_file,
381};
382
383static int 366static int
384spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode) 367spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
385{ 368{
@@ -407,7 +390,6 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode)
407 inode->i_fop = &simple_dir_operations; 390 inode->i_fop = &simple_dir_operations;
408 391
409 d_instantiate(dentry, inode); 392 d_instantiate(dentry, inode);
410 dget(dentry);
411 dir->i_nlink++; 393 dir->i_nlink++;
412 dentry->d_inode->i_nlink++; 394 dentry->d_inode->i_nlink++;
413 return ret; 395 return ret;
@@ -437,7 +419,7 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
437 goto out; 419 goto out;
438 } 420 }
439 421
440 filp->f_op = &spufs_gang_fops; 422 filp->f_op = &simple_dir_operations;
441 fd_install(ret, filp); 423 fd_install(ret, filp);
442out: 424out:
443 return ret; 425 return ret;
@@ -458,8 +440,10 @@ static int spufs_create_gang(struct inode *inode,
458 * in error path of *_open(). 440 * in error path of *_open().
459 */ 441 */
460 ret = spufs_gang_open(dget(dentry), mntget(mnt)); 442 ret = spufs_gang_open(dget(dentry), mntget(mnt));
461 if (ret < 0) 443 if (ret < 0) {
462 WARN_ON(spufs_rmgang(inode, dentry)); 444 int err = simple_rmdir(inode, dentry);
445 WARN_ON(err);
446 }
463 447
464out: 448out:
465 mutex_unlock(&inode->i_mutex); 449 mutex_unlock(&inode->i_mutex);
@@ -600,6 +584,10 @@ spufs_create_root(struct super_block *sb, void *data)
600 struct inode *inode; 584 struct inode *inode;
601 int ret; 585 int ret;
602 586
587 ret = -ENODEV;
588 if (!spu_management_ops)
589 goto out;
590
603 ret = -ENOMEM; 591 ret = -ENOMEM;
604 inode = spufs_new_inode(sb, S_IFDIR | 0775); 592 inode = spufs_new_inode(sb, S_IFDIR | 0775);
605 if (!inode) 593 if (!inode)
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index b6ecb30e7d58..3b831e07f1ed 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -93,43 +93,6 @@ void spu_stop_tick(struct spu_context *ctx)
93 } 93 }
94} 94}
95 95
96void spu_sched_tick(struct work_struct *work)
97{
98 struct spu_context *ctx =
99 container_of(work, struct spu_context, sched_work.work);
100 struct spu *spu;
101 int preempted = 0;
102
103 /*
104 * If this context is being stopped avoid rescheduling from the
105 * scheduler tick because we would block on the state_mutex.
106 * The caller will yield the spu later on anyway.
107 */
108 if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
109 return;
110
111 mutex_lock(&ctx->state_mutex);
112 spu = ctx->spu;
113 if (spu) {
114 int best = sched_find_first_bit(spu_prio->bitmap);
115 if (best <= ctx->prio) {
116 spu_deactivate(ctx);
117 preempted = 1;
118 }
119 }
120 mutex_unlock(&ctx->state_mutex);
121
122 if (preempted) {
123 /*
124 * We need to break out of the wait loop in spu_run manually
125 * to ensure this context gets put on the runqueue again
126 * ASAP.
127 */
128 wake_up(&ctx->stop_wq);
129 } else
130 spu_start_tick(ctx);
131}
132
133/** 96/**
134 * spu_add_to_active_list - add spu to active list 97 * spu_add_to_active_list - add spu to active list
135 * @spu: spu to add to the active list 98 * @spu: spu to add to the active list
@@ -273,34 +236,6 @@ static void spu_prio_wait(struct spu_context *ctx)
273 remove_wait_queue(&ctx->stop_wq, &wait); 236 remove_wait_queue(&ctx->stop_wq, &wait);
274} 237}
275 238
276/**
277 * spu_reschedule - try to find a runnable context for a spu
278 * @spu: spu available
279 *
280 * This function is called whenever a spu becomes idle. It looks for the
281 * most suitable runnable spu context and schedules it for execution.
282 */
283static void spu_reschedule(struct spu *spu)
284{
285 int best;
286
287 spu_free(spu);
288
289 spin_lock(&spu_prio->runq_lock);
290 best = sched_find_first_bit(spu_prio->bitmap);
291 if (best < MAX_PRIO) {
292 struct list_head *rq = &spu_prio->runq[best];
293 struct spu_context *ctx;
294
295 BUG_ON(list_empty(rq));
296
297 ctx = list_entry(rq->next, struct spu_context, rq);
298 __spu_del_from_rq(ctx);
299 wake_up(&ctx->stop_wq);
300 }
301 spin_unlock(&spu_prio->runq_lock);
302}
303
304static struct spu *spu_get_idle(struct spu_context *ctx) 239static struct spu *spu_get_idle(struct spu_context *ctx)
305{ 240{
306 struct spu *spu = NULL; 241 struct spu *spu = NULL;
@@ -429,6 +364,51 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
429} 364}
430 365
431/** 366/**
367 * grab_runnable_context - try to find a runnable context
368 *
369 * Remove the highest priority context on the runqueue and return it
370 * to the caller. Returns %NULL if no runnable context was found.
371 */
372static struct spu_context *grab_runnable_context(int prio)
373{
374 struct spu_context *ctx = NULL;
375 int best;
376
377 spin_lock(&spu_prio->runq_lock);
378 best = sched_find_first_bit(spu_prio->bitmap);
379 if (best < prio) {
380 struct list_head *rq = &spu_prio->runq[best];
381
382 BUG_ON(list_empty(rq));
383
384 ctx = list_entry(rq->next, struct spu_context, rq);
385 __spu_del_from_rq(ctx);
386 }
387 spin_unlock(&spu_prio->runq_lock);
388
389 return ctx;
390}
391
392static int __spu_deactivate(struct spu_context *ctx, int force, int max_prio)
393{
394 struct spu *spu = ctx->spu;
395 struct spu_context *new = NULL;
396
397 if (spu) {
398 new = grab_runnable_context(max_prio);
399 if (new || force) {
400 spu_unbind_context(spu, ctx);
401 spu_free(spu);
402 if (new)
403 wake_up(&new->stop_wq);
404 }
405
406 }
407
408 return new != NULL;
409}
410
411/**
432 * spu_deactivate - unbind a context from it's physical spu 412 * spu_deactivate - unbind a context from it's physical spu
433 * @ctx: spu context to unbind 413 * @ctx: spu context to unbind
434 * 414 *
@@ -437,12 +417,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags)
437 */ 417 */
438void spu_deactivate(struct spu_context *ctx) 418void spu_deactivate(struct spu_context *ctx)
439{ 419{
440 struct spu *spu = ctx->spu; 420 __spu_deactivate(ctx, 1, MAX_PRIO);
441
442 if (spu) {
443 spu_unbind_context(spu, ctx);
444 spu_reschedule(spu);
445 }
446} 421}
447 422
448/** 423/**
@@ -455,21 +430,43 @@ void spu_deactivate(struct spu_context *ctx)
455 */ 430 */
456void spu_yield(struct spu_context *ctx) 431void spu_yield(struct spu_context *ctx)
457{ 432{
458 struct spu *spu; 433 if (!(ctx->flags & SPU_CREATE_NOSCHED)) {
459 434 mutex_lock(&ctx->state_mutex);
460 if (mutex_trylock(&ctx->state_mutex)) { 435 __spu_deactivate(ctx, 0, MAX_PRIO);
461 if ((spu = ctx->spu) != NULL) {
462 int best = sched_find_first_bit(spu_prio->bitmap);
463 if (best < MAX_PRIO) {
464 pr_debug("%s: yielding SPU %d NODE %d\n",
465 __FUNCTION__, spu->number, spu->node);
466 spu_deactivate(ctx);
467 }
468 }
469 mutex_unlock(&ctx->state_mutex); 436 mutex_unlock(&ctx->state_mutex);
470 } 437 }
471} 438}
472 439
440void spu_sched_tick(struct work_struct *work)
441{
442 struct spu_context *ctx =
443 container_of(work, struct spu_context, sched_work.work);
444 int preempted;
445
446 /*
447 * If this context is being stopped avoid rescheduling from the
448 * scheduler tick because we would block on the state_mutex.
449 * The caller will yield the spu later on anyway.
450 */
451 if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags))
452 return;
453
454 mutex_lock(&ctx->state_mutex);
455 preempted = __spu_deactivate(ctx, 0, ctx->prio + 1);
456 mutex_unlock(&ctx->state_mutex);
457
458 if (preempted) {
459 /*
460 * We need to break out of the wait loop in spu_run manually
461 * to ensure this context gets put on the runqueue again
462 * ASAP.
463 */
464 wake_up(&ctx->stop_wq);
465 } else {
466 spu_start_tick(ctx);
467 }
468}
469
473int __init spu_sched_init(void) 470int __init spu_sched_init(void)
474{ 471{
475 int i; 472 int i;
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 0a947fd7de57..47617e8014a5 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -55,7 +55,7 @@ struct spu_context {
55 struct address_space *signal2; /* 'signal2' area mappings. */ 55 struct address_space *signal2; /* 'signal2' area mappings. */
56 struct address_space *mss; /* 'mss' area mappings. */ 56 struct address_space *mss; /* 'mss' area mappings. */
57 struct address_space *psmap; /* 'psmap' area mappings. */ 57 struct address_space *psmap; /* 'psmap' area mappings. */
58 spinlock_t mapping_lock; 58 struct mutex mapping_lock;
59 u64 object_id; /* user space pointer for oprofile */ 59 u64 object_id; /* user space pointer for oprofile */
60 60
61 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 61 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
diff --git a/arch/powerpc/platforms/celleb/Makefile b/arch/powerpc/platforms/celleb/Makefile
index f4f82520dc4f..5240046d8671 100644
--- a/arch/powerpc/platforms/celleb/Makefile
+++ b/arch/powerpc/platforms/celleb/Makefile
@@ -4,5 +4,5 @@ obj-y += interrupt.o iommu.o setup.o \
4 4
5obj-$(CONFIG_SMP) += smp.o 5obj-$(CONFIG_SMP) += smp.o
6obj-$(CONFIG_PPC_UDBG_BEAT) += udbg_beat.o 6obj-$(CONFIG_PPC_UDBG_BEAT) += udbg_beat.o
7obj-$(CONFIG_HAS_TXX9_SERIAL) += scc_sio.o 7obj-$(CONFIG_SERIAL_TXX9) += scc_sio.o
8obj-$(CONFIG_SPU_BASE) += spu_priv1.o 8obj-$(CONFIG_SPU_BASE) += spu_priv1.o
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c
index 03cd45d8fefa..3c962d5757be 100644
--- a/arch/powerpc/platforms/pasemi/idle.c
+++ b/arch/powerpc/platforms/pasemi/idle.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/machdep.h> 27#include <asm/machdep.h>
28#include <asm/reg.h> 28#include <asm/reg.h>
29#include <asm/smp.h>
29 30
30#include "pasemi.h" 31#include "pasemi.h"
31 32
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c
index 95fa6a7d15ee..f33b21b9f5d4 100644
--- a/arch/powerpc/platforms/pasemi/iommu.c
+++ b/arch/powerpc/platforms/pasemi/iommu.c
@@ -31,8 +31,6 @@
31#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT) 31#define IOBMAP_PAGE_SIZE (1 << IOBMAP_PAGE_SHIFT)
32#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1) 32#define IOBMAP_PAGE_MASK (IOBMAP_PAGE_SIZE - 1)
33 33
34#define IOBMAP_PAGE_FACTOR (PAGE_SHIFT - IOBMAP_PAGE_SHIFT)
35
36#define IOB_BASE 0xe0000000 34#define IOB_BASE 0xe0000000
37#define IOB_SIZE 0x3000 35#define IOB_SIZE 0x3000
38/* Configuration registers */ 36/* Configuration registers */
@@ -97,9 +95,6 @@ static void iobmap_build(struct iommu_table *tbl, long index,
97 95
98 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT; 96 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
99 97
100 npages <<= IOBMAP_PAGE_FACTOR;
101 index <<= IOBMAP_PAGE_FACTOR;
102
103 ip = ((u32 *)tbl->it_base) + index; 98 ip = ((u32 *)tbl->it_base) + index;
104 99
105 while (npages--) { 100 while (npages--) {
@@ -125,9 +120,6 @@ static void iobmap_free(struct iommu_table *tbl, long index,
125 120
126 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT; 121 bus_addr = (tbl->it_offset + index) << PAGE_SHIFT;
127 122
128 npages <<= IOBMAP_PAGE_FACTOR;
129 index <<= IOBMAP_PAGE_FACTOR;
130
131 ip = ((u32 *)tbl->it_base) + index; 123 ip = ((u32 *)tbl->it_base) + index;
132 124
133 while (npages--) { 125 while (npages--) {
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 9da82c266ba9..ec9030dbb5f1 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -25,6 +25,7 @@
25#include <asm/machdep.h> 25#include <asm/machdep.h>
26#include <asm/udbg.h> 26#include <asm/udbg.h>
27#include <asm/lv1call.h> 27#include <asm/lv1call.h>
28#include <asm/smp.h>
28 29
29#include "platform.h" 30#include "platform.h"
30 31
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index b854e7f1001c..f1df942072bb 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -752,6 +752,7 @@ skip_gserver_check:
752void xics_request_IPIs(void) 752void xics_request_IPIs(void)
753{ 753{
754 unsigned int ipi; 754 unsigned int ipi;
755 int rc;
755 756
756 ipi = irq_create_mapping(xics_host, XICS_IPI); 757 ipi = irq_create_mapping(xics_host, XICS_IPI);
757 BUG_ON(ipi == NO_IRQ); 758 BUG_ON(ipi == NO_IRQ);
@@ -762,11 +763,12 @@ void xics_request_IPIs(void)
762 */ 763 */
763 set_irq_handler(ipi, handle_percpu_irq); 764 set_irq_handler(ipi, handle_percpu_irq);
764 if (firmware_has_feature(FW_FEATURE_LPAR)) 765 if (firmware_has_feature(FW_FEATURE_LPAR))
765 request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED, 766 rc = request_irq(ipi, xics_ipi_action_lpar, IRQF_DISABLED,
766 "IPI", NULL); 767 "IPI", NULL);
767 else 768 else
768 request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED, 769 rc = request_irq(ipi, xics_ipi_action_direct, IRQF_DISABLED,
769 "IPI", NULL); 770 "IPI", NULL);
771 BUG_ON(rc);
770} 772}
771#endif /* CONFIG_SMP */ 773#endif /* CONFIG_SMP */
772 774
diff --git a/arch/ppc/syslib/ibm_ocp.c b/arch/ppc/syslib/ibm_ocp.c
index 3f6e55c79181..2ee176610e7c 100644
--- a/arch/ppc/syslib/ibm_ocp.c
+++ b/arch/ppc/syslib/ibm_ocp.c
@@ -1,4 +1,5 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <asm/ibm4xx.h>
2#include <asm/ocp.h> 3#include <asm/ocp.h>
3 4
4struct ocp_sys_info_data ocp_sys_info = { 5struct ocp_sys_info_data ocp_sys_info = {
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 2782cf9da5b4..b9a1ce1f28e4 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -481,9 +481,17 @@ out:
481 481
482/* Diagnose 224 functions */ 482/* Diagnose 224 functions */
483 483
484static void diag224(void *ptr) 484static int diag224(void *ptr)
485{ 485{
486 asm volatile("diag %0,%1,0x224" : :"d" (0), "d"(ptr) : "memory"); 486 int rc = -ENOTSUPP;
487
488 asm volatile(
489 " diag %1,%2,0x224\n"
490 "0: lhi %0,0x0\n"
491 "1:\n"
492 EX_TABLE(0b,1b)
493 : "+d" (rc) :"d" (0), "d" (ptr) : "memory");
494 return rc;
487} 495}
488 496
489static int diag224_get_name_table(void) 497static int diag224_get_name_table(void)
@@ -492,7 +500,10 @@ static int diag224_get_name_table(void)
492 diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA); 500 diag224_cpu_names = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
493 if (!diag224_cpu_names) 501 if (!diag224_cpu_names)
494 return -ENOMEM; 502 return -ENOMEM;
495 diag224(diag224_cpu_names); 503 if (diag224(diag224_cpu_names)) {
504 kfree(diag224_cpu_names);
505 return -ENOTSUPP;
506 }
496 EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16); 507 EBCASC(diag224_cpu_names + 16, (*diag224_cpu_names + 1) * 16);
497 return 0; 508 return 0;
498} 509}
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index dca6eaf82c80..1b2f5ce45320 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -163,7 +163,7 @@ unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION;
163 163
164static debug_info_t *debug_area_first = NULL; 164static debug_info_t *debug_area_first = NULL;
165static debug_info_t *debug_area_last = NULL; 165static debug_info_t *debug_area_last = NULL;
166static DECLARE_MUTEX(debug_lock); 166static DEFINE_MUTEX(debug_mutex);
167 167
168static int initialized; 168static int initialized;
169 169
@@ -576,7 +576,7 @@ debug_input(struct file *file, const char __user *user_buf, size_t length,
576 int rc = 0; 576 int rc = 0;
577 file_private_info_t *p_info; 577 file_private_info_t *p_info;
578 578
579 down(&debug_lock); 579 mutex_lock(&debug_mutex);
580 p_info = ((file_private_info_t *) file->private_data); 580 p_info = ((file_private_info_t *) file->private_data);
581 if (p_info->view->input_proc) 581 if (p_info->view->input_proc)
582 rc = p_info->view->input_proc(p_info->debug_info_org, 582 rc = p_info->view->input_proc(p_info->debug_info_org,
@@ -584,7 +584,7 @@ debug_input(struct file *file, const char __user *user_buf, size_t length,
584 length, offset); 584 length, offset);
585 else 585 else
586 rc = -EPERM; 586 rc = -EPERM;
587 up(&debug_lock); 587 mutex_unlock(&debug_mutex);
588 return rc; /* number of input characters */ 588 return rc; /* number of input characters */
589} 589}
590 590
@@ -602,7 +602,7 @@ debug_open(struct inode *inode, struct file *file)
602 file_private_info_t *p_info; 602 file_private_info_t *p_info;
603 debug_info_t *debug_info, *debug_info_snapshot; 603 debug_info_t *debug_info, *debug_info_snapshot;
604 604
605 down(&debug_lock); 605 mutex_lock(&debug_mutex);
606 debug_info = file->f_path.dentry->d_inode->i_private; 606 debug_info = file->f_path.dentry->d_inode->i_private;
607 /* find debug view */ 607 /* find debug view */
608 for (i = 0; i < DEBUG_MAX_VIEWS; i++) { 608 for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
@@ -653,7 +653,7 @@ found:
653 file->private_data = p_info; 653 file->private_data = p_info;
654 debug_info_get(debug_info); 654 debug_info_get(debug_info);
655out: 655out:
656 up(&debug_lock); 656 mutex_unlock(&debug_mutex);
657 return rc; 657 return rc;
658} 658}
659 659
@@ -688,7 +688,7 @@ debug_register (char *name, int pages_per_area, int nr_areas, int buf_size)
688 688
689 if (!initialized) 689 if (!initialized)
690 BUG(); 690 BUG();
691 down(&debug_lock); 691 mutex_lock(&debug_mutex);
692 692
693 /* create new debug_info */ 693 /* create new debug_info */
694 694
@@ -702,7 +702,7 @@ out:
702 if (!rc){ 702 if (!rc){
703 printk(KERN_ERR "debug: debug_register failed for %s\n",name); 703 printk(KERN_ERR "debug: debug_register failed for %s\n",name);
704 } 704 }
705 up(&debug_lock); 705 mutex_unlock(&debug_mutex);
706 return rc; 706 return rc;
707} 707}
708 708
@@ -716,9 +716,9 @@ debug_unregister(debug_info_t * id)
716{ 716{
717 if (!id) 717 if (!id)
718 goto out; 718 goto out;
719 down(&debug_lock); 719 mutex_lock(&debug_mutex);
720 debug_info_put(id); 720 debug_info_put(id);
721 up(&debug_lock); 721 mutex_unlock(&debug_mutex);
722 722
723out: 723out:
724 return; 724 return;
@@ -1054,11 +1054,11 @@ __init debug_init(void)
1054 int rc = 0; 1054 int rc = 0;
1055 1055
1056 s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table); 1056 s390dbf_sysctl_header = register_sysctl_table(s390dbf_dir_table);
1057 down(&debug_lock); 1057 mutex_lock(&debug_mutex);
1058 debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL); 1058 debug_debugfs_root_entry = debugfs_create_dir(DEBUG_DIR_ROOT,NULL);
1059 printk(KERN_INFO "debug: Initialization complete\n"); 1059 printk(KERN_INFO "debug: Initialization complete\n");
1060 initialized = 1; 1060 initialized = 1;
1061 up(&debug_lock); 1061 mutex_unlock(&debug_mutex);
1062 1062
1063 return rc; 1063 return rc;
1064} 1064}
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 6bfb0889eb10..51d6309e7f3b 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -102,7 +102,7 @@ static struct resource data_resource = {
102/* 102/*
103 * cpu_init() initializes state that is per-CPU. 103 * cpu_init() initializes state that is per-CPU.
104 */ 104 */
105void __devinit cpu_init (void) 105void __cpuinit cpu_init(void)
106{ 106{
107 int addr = hard_smp_processor_id(); 107 int addr = hard_smp_processor_id();
108 108
@@ -915,7 +915,7 @@ setup_arch(char **cmdline_p)
915 setup_zfcpdump(console_devno); 915 setup_zfcpdump(console_devno);
916} 916}
917 917
918void print_cpu_info(struct cpuinfo_S390 *cpuinfo) 918void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo)
919{ 919{
920 printk("cpu %d " 920 printk("cpu %d "
921#ifdef CONFIG_SMP 921#ifdef CONFIG_SMP
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 09f028a3266b..8ff2feaf9b00 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -492,7 +492,7 @@ static unsigned int __init smp_count_cpus(void)
492/* 492/*
493 * Activate a secondary processor. 493 * Activate a secondary processor.
494 */ 494 */
495int __devinit start_secondary(void *cpuvoid) 495int __cpuinit start_secondary(void *cpuvoid)
496{ 496{
497 /* Setup the cpu */ 497 /* Setup the cpu */
498 cpu_init(); 498 cpu_init();
@@ -741,7 +741,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
741 smp_create_idle(cpu); 741 smp_create_idle(cpu);
742} 742}
743 743
744void __devinit smp_prepare_boot_cpu(void) 744void __init smp_prepare_boot_cpu(void)
745{ 745{
746 BUG_ON(smp_processor_id() != 0); 746 BUG_ON(smp_processor_id() != 0);
747 747
@@ -750,7 +750,7 @@ void __devinit smp_prepare_boot_cpu(void)
750 current_set[0] = current; 750 current_set[0] = current;
751} 751}
752 752
753void smp_cpus_done(unsigned int max_cpus) 753void __init smp_cpus_done(unsigned int max_cpus)
754{ 754{
755 cpu_present_map = cpu_possible_map; 755 cpu_present_map = cpu_possible_map;
756} 756}
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 7b1122417050..883b03b040c4 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -39,7 +39,7 @@ cflags-$(CONFIG_CPU_SH2A) := -m2a $(call cc-option,-m2a-nofpu,)
39cflags-$(CONFIG_CPU_SH3) := -m3 39cflags-$(CONFIG_CPU_SH3) := -m3
40cflags-$(CONFIG_CPU_SH4) := -m4 \ 40cflags-$(CONFIG_CPU_SH4) := -m4 \
41 $(call cc-option,-mno-implicit-fp,-m4-nofpu) 41 $(call cc-option,-mno-implicit-fp,-m4-nofpu)
42cflags-$(CONFIG_CPU_SH4A) := -m4a $(call cc-option,-m4a-nofpu,) 42cflags-$(CONFIG_CPU_SH4A) := $(call cc-option,-m4a,) $(call cc-option,-m4a-nofpu,)
43 43
44cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb 44cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
45cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml 45cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c
index 911ce1cdbd7f..e143017c8975 100644
--- a/arch/sh/boards/se/73180/setup.c
+++ b/arch/sh/boards/se/73180/setup.c
@@ -38,8 +38,8 @@ static struct platform_device *se73180_devices[] __initdata = {
38 38
39static int __init se73180_devices_setup(void) 39static int __init se73180_devices_setup(void)
40{ 40{
41 return platform_add_devices(sh7343se_platform_devices, 41 return platform_add_devices(se73180_devices,
42 ARRAY_SIZE(sh7343se_platform_devices)); 42 ARRAY_SIZE(se73180_devices));
43} 43}
44__initcall(se73180_devices_setup); 44__initcall(se73180_devices_setup);
45 45
diff --git a/arch/sh/boards/superh/microdev/irq.c b/arch/sh/boards/superh/microdev/irq.c
index cc1cb04fa618..4d335077a3ff 100644
--- a/arch/sh/boards/superh/microdev/irq.c
+++ b/arch/sh/boards/superh/microdev/irq.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h>
14#include <asm/system.h> 15#include <asm/system.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/microdev.h> 17#include <asm/microdev.h>
diff --git a/arch/sh/cchips/voyagergx/irq.c b/arch/sh/cchips/voyagergx/irq.c
index 70f12907647f..d70e5c8461b5 100644
--- a/arch/sh/cchips/voyagergx/irq.c
+++ b/arch/sh/cchips/voyagergx/irq.c
@@ -28,7 +28,7 @@ static void disable_voyagergx_irq(unsigned int irq)
28 unsigned long val; 28 unsigned long val;
29 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE); 29 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
30 30
31 pr_debug("disable_voyagergx_irq(%d): mask=%x\n", irq, mask); 31 pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
32 val = readl((void __iomem *)VOYAGER_INT_MASK); 32 val = readl((void __iomem *)VOYAGER_INT_MASK);
33 val &= ~mask; 33 val &= ~mask;
34 writel(val, (void __iomem *)VOYAGER_INT_MASK); 34 writel(val, (void __iomem *)VOYAGER_INT_MASK);
@@ -39,7 +39,7 @@ static void enable_voyagergx_irq(unsigned int irq)
39 unsigned long val; 39 unsigned long val;
40 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE); 40 unsigned long mask = 1 << (irq - VOYAGER_IRQ_BASE);
41 41
42 pr_debug("disable_voyagergx_irq(%d): mask=%x\n", irq, mask); 42 pr_debug("disable_voyagergx_irq(%d): mask=%lx\n", irq, mask);
43 val = readl((void __iomem *)VOYAGER_INT_MASK); 43 val = readl((void __iomem *)VOYAGER_INT_MASK);
44 val |= mask; 44 val |= mask;
45 writel(val, (void __iomem *)VOYAGER_INT_MASK); 45 writel(val, (void __iomem *)VOYAGER_INT_MASK);
@@ -125,11 +125,12 @@ int voyagergx_irq_demux(int irq)
125 i = 17; 125 i = 17;
126 else 126 else
127 printk("Unexpected IRQ irq = %d status = 0x%08lx\n", irq, val); 127 printk("Unexpected IRQ irq = %d status = 0x%08lx\n", irq, val);
128 pr_debug("voyagergx_irq_demux %d \n", i); 128 pr_debug("voyagergx_irq_demux %ld \n", i);
129 if (i < VOYAGER_IRQ_NUM) { 129 if (i < VOYAGER_IRQ_NUM) {
130 irq = VOYAGER_IRQ_BASE + i; 130 irq = VOYAGER_IRQ_BASE + i;
131 if (voyagergx_demux[i].func != 0) 131 if (voyagergx_demux[i].func != 0)
132 irq = voyagergx_demux[i].func(irq, voyagergx_demux[i].dev); 132 irq = voyagergx_demux[i].func(irq,
133 voyagergx_demux[i].dev);
133 } 134 }
134 } 135 }
135 return irq; 136 return irq;
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 8057a27a1bc6..cf8e11994330 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -16,6 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/sched.h>
19#include <asm/dma.h> 20#include <asm/dma.h>
20 21
21DEFINE_SPINLOCK(dma_spin_lock); 22DEFINE_SPINLOCK(dma_spin_lock);
diff --git a/arch/sh/kernel/cf-enabler.c b/arch/sh/kernel/cf-enabler.c
index 849a9e191391..ebc73b85094a 100644
--- a/arch/sh/kernel/cf-enabler.c
+++ b/arch/sh/kernel/cf-enabler.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/vmalloc.h> 14#include <linux/vmalloc.h>
15#include <linux/interrupt.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
17 18
@@ -149,6 +150,11 @@ static int __init cf_init_se(void)
149 ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200); 150 ctrl_outb(0x42, PA_MRSHPC_MW2 + 0x200);
150 return 0; 151 return 0;
151} 152}
153#else
154static int __init cf_init_se(void)
155{
156 return -1;
157}
152#endif 158#endif
153 159
154int __init cf_init(void) 160int __init cf_init(void)
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 832c0b4a1e6c..b0b59d4a33ca 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -320,6 +320,9 @@ skip_restore:
320 320
321 .align 2 321 .align 2
3225: .long 0x00001000 ! DSP 3225: .long 0x00001000 ! DSP
323#ifdef CONFIG_KGDB_NMI
3246: .long in_nmi
325#endif
3237: .long 0x30000000 3267: .long 0x30000000
324 327
325! common exception handler 328! common exception handler
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
index fcb2c41bc34e..a33429463e96 100644
--- a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
@@ -111,7 +111,7 @@ static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate)
111 return 0; 111 return 0;
112} 112}
113 113
114static int shoc_clk_set_rate(struct clk *clk, unsigned long rate) 114static int shoc_clk_set_rate(struct clk *clk, unsigned long rate, int algo_id)
115{ 115{
116 unsigned long frqcr3; 116 unsigned long frqcr3;
117 unsigned int tmp; 117 unsigned int tmp;
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 8cd04904c77a..fab2eb07196b 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -12,6 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/smp.h>
15#include <asm/processor.h> 16#include <asm/processor.h>
16#include <asm/cache.h> 17#include <asm/cache.h>
17 18
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index dbebaddcfe39..283e1425ced5 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -10,6 +10,8 @@
10 * Free Software Foundation; either version 2 of the License, or (at your 10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
12 */ 12 */
13
14#include <linux/err.h>
13#include <linux/cache.h> 15#include <linux/cache.h>
14#include <linux/cpumask.h> 16#include <linux/cpumask.h>
15#include <linux/delay.h> 17#include <linux/delay.h>
diff --git a/arch/sh/kernel/timers/timer.c b/arch/sh/kernel/timers/timer.c
index a6bcc913d25e..4e7e747d1b69 100644
--- a/arch/sh/kernel/timers/timer.c
+++ b/arch/sh/kernel/timers/timer.c
@@ -13,7 +13,7 @@
13#include <linux/string.h> 13#include <linux/string.h>
14#include <asm/timer.h> 14#include <asm/timer.h>
15 15
16static struct sys_timer *sys_timers[] __initdata = { 16static struct sys_timer *sys_timers[] = {
17#ifdef CONFIG_SH_TMU 17#ifdef CONFIG_SH_TMU
18 &tmu_timer, 18 &tmu_timer,
19#endif 19#endif
@@ -26,7 +26,7 @@ static struct sys_timer *sys_timers[] __initdata = {
26 NULL, 26 NULL,
27}; 27};
28 28
29static char timer_override[10] __initdata; 29static char timer_override[10];
30static int __init timer_setup(char *str) 30static int __init timer_setup(char *str)
31{ 31{
32 if (str) 32 if (str)
@@ -53,4 +53,3 @@ struct sys_timer *get_sys_timer(void)
53 53
54 return NULL; 54 return NULL;
55} 55}
56
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index e146bafcd14f..2aa9438361bc 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -17,6 +17,7 @@
17#include <linux/gfp.h> 17#include <linux/gfp.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/elf.h> 19#include <linux/elf.h>
20#include <linux/sched.h>
20 21
21/* 22/*
22 * Should the kernel map a VDSO page into processes and pass its 23 * Should the kernel map a VDSO page into processes and pass its
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index be03d74e99cb..0c7b7e33abdc 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -22,6 +22,7 @@
22#include <asm/addrspace.h> 22#include <asm/addrspace.h>
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24#include <asm/tlbflush.h> 24#include <asm/tlbflush.h>
25#include <asm/mmu.h>
25 26
26/* 27/*
27 * Remap an arbitrary physical address space into the kernel virtual 28 * Remap an arbitrary physical address space into the kernel virtual
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index 617d29832e19..cbddeb38ffda 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -124,10 +124,10 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
124 unsigned long flags; 124 unsigned long flags;
125 u32 prev; 125 u32 prev;
126 126
127 spin_lock_irqsave(ATOMIC_HASH(addr), flags); 127 spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
128 if ((prev = *ptr) == old) 128 if ((prev = *ptr) == old)
129 *ptr = new; 129 *ptr = new;
130 spin_unlock_irqrestore(ATOMIC_HASH(addr), flags); 130 spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
131 131
132 return (unsigned long)prev; 132 return (unsigned long)prev;
133} 133}
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index bd00f89eed1e..89a1b469b93d 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -396,6 +396,15 @@ config SCHED_SMT
396 when dealing with UltraSPARC cpus at a cost of slightly increased 396 when dealing with UltraSPARC cpus at a cost of slightly increased
397 overhead in some places. If unsure say N here. 397 overhead in some places. If unsure say N here.
398 398
399config SCHED_MC
400 bool "Multi-core scheduler support"
401 depends on SMP
402 default y
403 help
404 Multi-core scheduler support improves the CPU scheduler's decision
405 making when dealing with multi-core CPU chips at a cost of slightly
406 increased overhead in some places. If unsure say N here.
407
399source "kernel/Kconfig.preempt" 408source "kernel/Kconfig.preempt"
400 409
401config CMDLINE_BOOL 410config CMDLINE_BOOL
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index d8d19093d12f..f964bf28d21a 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.70 2002/02/09 19:49:30 davem Exp $ 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
@@ -8,7 +8,7 @@ EXTRA_CFLAGS := -Werror
8extra-y := head.o init_task.o vmlinux.lds 8extra-y := head.o init_task.o vmlinux.lds
9 9
10obj-y := process.o setup.o cpu.o idprom.o \ 10obj-y := process.o setup.o cpu.o idprom.o \
11 traps.o auxio.o una_asm.o \ 11 traps.o auxio.o una_asm.o sysfs.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o pci.o starfire.o semaphore.o \ 13 unaligned.o central.o pci.o starfire.o semaphore.o \
14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \ 14 power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 8f10dda0f5c0..7d1a11822a1e 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -2498,3 +2498,97 @@ sun4v_vintr_set_target:
2498 retl 2498 retl
2499 nop 2499 nop
2500 .size sun4v_vintr_set_target, .-sun4v_vintr_set_target 2500 .size sun4v_vintr_set_target, .-sun4v_vintr_set_target
2501
2502 /* %o0: NCS sub-function
2503 * %o1: sub-function arg real-address
2504 * %o2: sub-function arg size
2505 *
2506 * returns %o0: status
2507 */
2508 .globl sun4v_ncs_request
2509 .type sun4v_ncs_request,#function
2510sun4v_ncs_request:
2511 mov HV_FAST_NCS_REQUEST, %o5
2512 ta HV_FAST_TRAP
2513 retl
2514 nop
2515 .size sun4v_ncs_request, .-sun4v_ncs_request
2516
2517 .globl sun4v_svc_send
2518 .type sun4v_svc_send,#function
2519sun4v_svc_send:
2520 save %sp, -192, %sp
2521 mov %i0, %o0
2522 mov %i1, %o1
2523 mov %i2, %o2
2524 mov HV_FAST_SVC_SEND, %o5
2525 ta HV_FAST_TRAP
2526 stx %o1, [%i3]
2527 ret
2528 restore
2529 .size sun4v_svc_send, .-sun4v_svc_send
2530
2531 .globl sun4v_svc_recv
2532 .type sun4v_svc_recv,#function
2533sun4v_svc_recv:
2534 save %sp, -192, %sp
2535 mov %i0, %o0
2536 mov %i1, %o1
2537 mov %i2, %o2
2538 mov HV_FAST_SVC_RECV, %o5
2539 ta HV_FAST_TRAP
2540 stx %o1, [%i3]
2541 ret
2542 restore
2543 .size sun4v_svc_recv, .-sun4v_svc_recv
2544
2545 .globl sun4v_svc_getstatus
2546 .type sun4v_svc_getstatus,#function
2547sun4v_svc_getstatus:
2548 mov HV_FAST_SVC_GETSTATUS, %o5
2549 mov %o1, %o4
2550 ta HV_FAST_TRAP
2551 stx %o1, [%o4]
2552 retl
2553 nop
2554 .size sun4v_svc_getstatus, .-sun4v_svc_getstatus
2555
2556 .globl sun4v_svc_setstatus
2557 .type sun4v_svc_setstatus,#function
2558sun4v_svc_setstatus:
2559 mov HV_FAST_SVC_SETSTATUS, %o5
2560 ta HV_FAST_TRAP
2561 retl
2562 nop
2563 .size sun4v_svc_setstatus, .-sun4v_svc_setstatus
2564
2565 .globl sun4v_svc_clrstatus
2566 .type sun4v_svc_clrstatus,#function
2567sun4v_svc_clrstatus:
2568 mov HV_FAST_SVC_CLRSTATUS, %o5
2569 ta HV_FAST_TRAP
2570 retl
2571 nop
2572 .size sun4v_svc_clrstatus, .-sun4v_svc_clrstatus
2573
2574 .globl sun4v_mmustat_conf
2575 .type sun4v_mmustat_conf,#function
2576sun4v_mmustat_conf:
2577 mov %o1, %o4
2578 mov HV_FAST_MMUSTAT_CONF, %o5
2579 ta HV_FAST_TRAP
2580 stx %o1, [%o4]
2581 retl
2582 nop
2583 .size sun4v_mmustat_conf, .-sun4v_mmustat_conf
2584
2585 .globl sun4v_mmustat_info
2586 .type sun4v_mmustat_info,#function
2587sun4v_mmustat_info:
2588 mov %o0, %o4
2589 mov HV_FAST_MMUSTAT_INFO, %o5
2590 ta HV_FAST_TRAP
2591 stx %o1, [%o4]
2592 retl
2593 nop
2594 .size sun4v_mmustat_info, .-sun4v_mmustat_info
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 9246c2cf9574..f0e16045fb16 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -473,6 +473,53 @@ static void __init set_core_ids(void)
473 } 473 }
474} 474}
475 475
476static void __init mark_proc_ids(struct mdesc_node *mp, int proc_id)
477{
478 int i;
479
480 for (i = 0; i < mp->num_arcs; i++) {
481 struct mdesc_node *t = mp->arcs[i].arc;
482 const u64 *id;
483
484 if (strcmp(mp->arcs[i].name, "back"))
485 continue;
486
487 if (strcmp(t->name, "cpu"))
488 continue;
489
490 id = md_get_property(t, "id", NULL);
491 if (*id < NR_CPUS)
492 cpu_data(*id).proc_id = proc_id;
493 }
494}
495
496static void __init __set_proc_ids(const char *exec_unit_name)
497{
498 struct mdesc_node *mp;
499 int idx;
500
501 idx = 0;
502 md_for_each_node_by_name(mp, exec_unit_name) {
503 const char *type;
504 int len;
505
506 type = md_get_property(mp, "type", &len);
507 if (!find_in_proplist(type, "int", len) &&
508 !find_in_proplist(type, "integer", len))
509 continue;
510
511 mark_proc_ids(mp, idx);
512
513 idx++;
514 }
515}
516
517static void __init set_proc_ids(void)
518{
519 __set_proc_ids("exec_unit");
520 __set_proc_ids("exec-unit");
521}
522
476static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def) 523static void __init get_one_mondo_bits(const u64 *p, unsigned int *mask, unsigned char def)
477{ 524{
478 u64 val; 525 u64 val;
@@ -574,9 +621,15 @@ static void __init mdesc_fill_in_cpu_data(void)
574#endif 621#endif
575 622
576 c->core_id = 0; 623 c->core_id = 0;
624 c->proc_id = -1;
577 } 625 }
578 626
627#ifdef CONFIG_SMP
628 sparc64_multi_core = 1;
629#endif
630
579 set_core_ids(); 631 set_core_ids();
632 set_proc_ids();
580 633
581 smp_fill_in_sib_core_maps(); 634 smp_fill_in_sib_core_maps();
582} 635}
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 323d6c278518..22e1be5c7489 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -636,13 +636,18 @@ static void apb_init(struct pci_bus *sabre_bus)
636static void sabre_scan_bus(struct pci_pbm_info *pbm) 636static void sabre_scan_bus(struct pci_pbm_info *pbm)
637{ 637{
638 static int once; 638 static int once;
639 struct pci_bus *pbus;
640 639
641 /* The APB bridge speaks to the Sabre host PCI bridge 640 /* The APB bridge speaks to the Sabre host PCI bridge
642 * at 66Mhz, but the front side of APB runs at 33Mhz 641 * at 66Mhz, but the front side of APB runs at 33Mhz
643 * for both segments. 642 * for both segments.
643 *
644 * Hummingbird systems do not use APB, so they run
645 * at 66MHZ.
644 */ 646 */
645 pbm->is_66mhz_capable = 0; 647 if (hummingbird_p)
648 pbm->is_66mhz_capable = 1;
649 else
650 pbm->is_66mhz_capable = 0;
646 651
647 /* This driver has not been verified to handle 652 /* This driver has not been verified to handle
648 * multiple SABREs yet, so trap this. 653 * multiple SABREs yet, so trap this.
@@ -656,13 +661,13 @@ static void sabre_scan_bus(struct pci_pbm_info *pbm)
656 } 661 }
657 once++; 662 once++;
658 663
659 pbus = pci_scan_one_pbm(pbm); 664 pbm->pci_bus = pci_scan_one_pbm(pbm);
660 if (!pbus) 665 if (!pbm->pci_bus)
661 return; 666 return;
662 667
663 sabre_root_bus = pbus; 668 sabre_root_bus = pbm->pci_bus;
664 669
665 apb_init(pbus); 670 apb_init(pbm->pci_bus);
666 671
667 sabre_register_error_handlers(pbm); 672 sabre_register_error_handlers(pbm);
668} 673}
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index dad4b3ba705f..61036b346664 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -933,29 +933,29 @@ static void __init fire_irq_trans_init(struct device_node *dp)
933 * This should conform to both Sunfire/Wildfire server and Fusion 933 * This should conform to both Sunfire/Wildfire server and Fusion
934 * desktop designs. 934 * desktop designs.
935 */ 935 */
936#define SYSIO_IMAP_SLOT0 0x2c04UL 936#define SYSIO_IMAP_SLOT0 0x2c00UL
937#define SYSIO_IMAP_SLOT1 0x2c0cUL 937#define SYSIO_IMAP_SLOT1 0x2c08UL
938#define SYSIO_IMAP_SLOT2 0x2c14UL 938#define SYSIO_IMAP_SLOT2 0x2c10UL
939#define SYSIO_IMAP_SLOT3 0x2c1cUL 939#define SYSIO_IMAP_SLOT3 0x2c18UL
940#define SYSIO_IMAP_SCSI 0x3004UL 940#define SYSIO_IMAP_SCSI 0x3000UL
941#define SYSIO_IMAP_ETH 0x300cUL 941#define SYSIO_IMAP_ETH 0x3008UL
942#define SYSIO_IMAP_BPP 0x3014UL 942#define SYSIO_IMAP_BPP 0x3010UL
943#define SYSIO_IMAP_AUDIO 0x301cUL 943#define SYSIO_IMAP_AUDIO 0x3018UL
944#define SYSIO_IMAP_PFAIL 0x3024UL 944#define SYSIO_IMAP_PFAIL 0x3020UL
945#define SYSIO_IMAP_KMS 0x302cUL 945#define SYSIO_IMAP_KMS 0x3028UL
946#define SYSIO_IMAP_FLPY 0x3034UL 946#define SYSIO_IMAP_FLPY 0x3030UL
947#define SYSIO_IMAP_SHW 0x303cUL 947#define SYSIO_IMAP_SHW 0x3038UL
948#define SYSIO_IMAP_KBD 0x3044UL 948#define SYSIO_IMAP_KBD 0x3040UL
949#define SYSIO_IMAP_MS 0x304cUL 949#define SYSIO_IMAP_MS 0x3048UL
950#define SYSIO_IMAP_SER 0x3054UL 950#define SYSIO_IMAP_SER 0x3050UL
951#define SYSIO_IMAP_TIM0 0x3064UL 951#define SYSIO_IMAP_TIM0 0x3060UL
952#define SYSIO_IMAP_TIM1 0x306cUL 952#define SYSIO_IMAP_TIM1 0x3068UL
953#define SYSIO_IMAP_UE 0x3074UL 953#define SYSIO_IMAP_UE 0x3070UL
954#define SYSIO_IMAP_CE 0x307cUL 954#define SYSIO_IMAP_CE 0x3078UL
955#define SYSIO_IMAP_SBERR 0x3084UL 955#define SYSIO_IMAP_SBERR 0x3080UL
956#define SYSIO_IMAP_PMGMT 0x308cUL 956#define SYSIO_IMAP_PMGMT 0x3088UL
957#define SYSIO_IMAP_GFX 0x3094UL 957#define SYSIO_IMAP_GFX 0x3090UL
958#define SYSIO_IMAP_EUPA 0x309cUL 958#define SYSIO_IMAP_EUPA 0x3098UL
959 959
960#define bogon ((unsigned long) -1) 960#define bogon ((unsigned long) -1)
961static unsigned long sysio_irq_offsets[] = { 961static unsigned long sysio_irq_offsets[] = {
@@ -1006,10 +1006,10 @@ static unsigned long sysio_irq_offsets[] = {
1006 * Interrupt Clear register pointer, SYSIO specific version. 1006 * Interrupt Clear register pointer, SYSIO specific version.
1007 */ 1007 */
1008#define SYSIO_ICLR_UNUSED0 0x3400UL 1008#define SYSIO_ICLR_UNUSED0 0x3400UL
1009#define SYSIO_ICLR_SLOT0 0x340cUL 1009#define SYSIO_ICLR_SLOT0 0x3408UL
1010#define SYSIO_ICLR_SLOT1 0x344cUL 1010#define SYSIO_ICLR_SLOT1 0x3448UL
1011#define SYSIO_ICLR_SLOT2 0x348cUL 1011#define SYSIO_ICLR_SLOT2 0x3488UL
1012#define SYSIO_ICLR_SLOT3 0x34ccUL 1012#define SYSIO_ICLR_SLOT3 0x34c8UL
1013static unsigned long sysio_imap_to_iclr(unsigned long imap) 1013static unsigned long sysio_imap_to_iclr(unsigned long imap)
1014{ 1014{
1015 unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0; 1015 unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0;
@@ -1781,6 +1781,10 @@ static void __init of_fill_in_cpu_data(void)
1781 } 1781 }
1782 1782
1783 cpu_data(cpuid).core_id = portid + 1; 1783 cpu_data(cpuid).core_id = portid + 1;
1784 cpu_data(cpuid).proc_id = portid;
1785#ifdef CONFIG_SMP
1786 sparc64_multi_core = 1;
1787#endif
1784 } else { 1788 } else {
1785 cpu_data(cpuid).dcache_size = 1789 cpu_data(cpuid).dcache_size =
1786 of_getintprop_default(dp, "dcache-size", 16 * 1024); 1790 of_getintprop_default(dp, "dcache-size", 16 * 1024);
@@ -1799,6 +1803,7 @@ static void __init of_fill_in_cpu_data(void)
1799 of_getintprop_default(dp, "ecache-line-size", 64); 1803 of_getintprop_default(dp, "ecache-line-size", 64);
1800 1804
1801 cpu_data(cpuid).core_id = 0; 1805 cpu_data(cpuid).core_id = 0;
1806 cpu_data(cpuid).proc_id = -1;
1802 } 1807 }
1803 1808
1804#ifdef CONFIG_SMP 1809#ifdef CONFIG_SMP
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c
index 91f6e2a74ad5..a1fd9bcc0b87 100644
--- a/arch/sparc64/kernel/sbus.c
+++ b/arch/sparc64/kernel/sbus.c
@@ -629,29 +629,29 @@ void sbus_set_sbus64(struct sbus_dev *sdev, int bursts)
629 * This should conform to both Sunfire/Wildfire server and Fusion 629 * This should conform to both Sunfire/Wildfire server and Fusion
630 * desktop designs. 630 * desktop designs.
631 */ 631 */
632#define SYSIO_IMAP_SLOT0 0x2c04UL 632#define SYSIO_IMAP_SLOT0 0x2c00UL
633#define SYSIO_IMAP_SLOT1 0x2c0cUL 633#define SYSIO_IMAP_SLOT1 0x2c08UL
634#define SYSIO_IMAP_SLOT2 0x2c14UL 634#define SYSIO_IMAP_SLOT2 0x2c10UL
635#define SYSIO_IMAP_SLOT3 0x2c1cUL 635#define SYSIO_IMAP_SLOT3 0x2c18UL
636#define SYSIO_IMAP_SCSI 0x3004UL 636#define SYSIO_IMAP_SCSI 0x3000UL
637#define SYSIO_IMAP_ETH 0x300cUL 637#define SYSIO_IMAP_ETH 0x3008UL
638#define SYSIO_IMAP_BPP 0x3014UL 638#define SYSIO_IMAP_BPP 0x3010UL
639#define SYSIO_IMAP_AUDIO 0x301cUL 639#define SYSIO_IMAP_AUDIO 0x3018UL
640#define SYSIO_IMAP_PFAIL 0x3024UL 640#define SYSIO_IMAP_PFAIL 0x3020UL
641#define SYSIO_IMAP_KMS 0x302cUL 641#define SYSIO_IMAP_KMS 0x3028UL
642#define SYSIO_IMAP_FLPY 0x3034UL 642#define SYSIO_IMAP_FLPY 0x3030UL
643#define SYSIO_IMAP_SHW 0x303cUL 643#define SYSIO_IMAP_SHW 0x3038UL
644#define SYSIO_IMAP_KBD 0x3044UL 644#define SYSIO_IMAP_KBD 0x3040UL
645#define SYSIO_IMAP_MS 0x304cUL 645#define SYSIO_IMAP_MS 0x3048UL
646#define SYSIO_IMAP_SER 0x3054UL 646#define SYSIO_IMAP_SER 0x3050UL
647#define SYSIO_IMAP_TIM0 0x3064UL 647#define SYSIO_IMAP_TIM0 0x3060UL
648#define SYSIO_IMAP_TIM1 0x306cUL 648#define SYSIO_IMAP_TIM1 0x3068UL
649#define SYSIO_IMAP_UE 0x3074UL 649#define SYSIO_IMAP_UE 0x3070UL
650#define SYSIO_IMAP_CE 0x307cUL 650#define SYSIO_IMAP_CE 0x3078UL
651#define SYSIO_IMAP_SBERR 0x3084UL 651#define SYSIO_IMAP_SBERR 0x3080UL
652#define SYSIO_IMAP_PMGMT 0x308cUL 652#define SYSIO_IMAP_PMGMT 0x3088UL
653#define SYSIO_IMAP_GFX 0x3094UL 653#define SYSIO_IMAP_GFX 0x3090UL
654#define SYSIO_IMAP_EUPA 0x309cUL 654#define SYSIO_IMAP_EUPA 0x3098UL
655 655
656#define bogon ((unsigned long) -1) 656#define bogon ((unsigned long) -1)
657static unsigned long sysio_irq_offsets[] = { 657static unsigned long sysio_irq_offsets[] = {
@@ -700,10 +700,10 @@ static unsigned long sysio_irq_offsets[] = {
700 * Interrupt Clear register pointer, SYSIO specific version. 700 * Interrupt Clear register pointer, SYSIO specific version.
701 */ 701 */
702#define SYSIO_ICLR_UNUSED0 0x3400UL 702#define SYSIO_ICLR_UNUSED0 0x3400UL
703#define SYSIO_ICLR_SLOT0 0x340cUL 703#define SYSIO_ICLR_SLOT0 0x3408UL
704#define SYSIO_ICLR_SLOT1 0x344cUL 704#define SYSIO_ICLR_SLOT1 0x3448UL
705#define SYSIO_ICLR_SLOT2 0x348cUL 705#define SYSIO_ICLR_SLOT2 0x3488UL
706#define SYSIO_ICLR_SLOT3 0x34ccUL 706#define SYSIO_ICLR_SLOT3 0x34c8UL
707static unsigned long sysio_imap_to_iclr(unsigned long imap) 707static unsigned long sysio_imap_to_iclr(unsigned long imap)
708{ 708{
709 unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0; 709 unsigned long diff = SYSIO_ICLR_UNUSED0 - SYSIO_IMAP_SLOT0;
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index de9b4c13f1c7..7490cc670a53 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -513,22 +513,3 @@ void sun_do_break(void)
513 513
514int serial_console = -1; 514int serial_console = -1;
515int stop_a_enabled = 1; 515int stop_a_enabled = 1;
516
517static int __init topology_init(void)
518{
519 int i, err;
520
521 err = -ENOMEM;
522
523 for_each_possible_cpu(i) {
524 struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
525 if (p) {
526 register_cpu(p, i);
527 err = 0;
528 }
529 }
530
531 return err;
532}
533
534subsys_initcall(topology_init);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index c550bba3490a..4dcd7d0b60f2 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -44,6 +44,8 @@
44 44
45extern void calibrate_delay(void); 45extern void calibrate_delay(void);
46 46
47int sparc64_multi_core __read_mostly;
48
47/* Please don't make this stuff initdata!!! --DaveM */ 49/* Please don't make this stuff initdata!!! --DaveM */
48unsigned char boot_cpu_id; 50unsigned char boot_cpu_id;
49 51
@@ -51,6 +53,8 @@ cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
51cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE; 53cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE;
52cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly = 54cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly =
53 { [0 ... NR_CPUS-1] = CPU_MASK_NONE }; 55 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
56cpumask_t cpu_core_map[NR_CPUS] __read_mostly =
57 { [0 ... NR_CPUS-1] = CPU_MASK_NONE };
54static cpumask_t smp_commenced_mask; 58static cpumask_t smp_commenced_mask;
55static cpumask_t cpu_callout_map; 59static cpumask_t cpu_callout_map;
56 60
@@ -1217,13 +1221,28 @@ void __devinit smp_fill_in_sib_core_maps(void)
1217 unsigned int j; 1221 unsigned int j;
1218 1222
1219 if (cpu_data(i).core_id == 0) { 1223 if (cpu_data(i).core_id == 0) {
1220 cpu_set(i, cpu_sibling_map[i]); 1224 cpu_set(i, cpu_core_map[i]);
1221 continue; 1225 continue;
1222 } 1226 }
1223 1227
1224 for_each_possible_cpu(j) { 1228 for_each_possible_cpu(j) {
1225 if (cpu_data(i).core_id == 1229 if (cpu_data(i).core_id ==
1226 cpu_data(j).core_id) 1230 cpu_data(j).core_id)
1231 cpu_set(j, cpu_core_map[i]);
1232 }
1233 }
1234
1235 for_each_possible_cpu(i) {
1236 unsigned int j;
1237
1238 if (cpu_data(i).proc_id == -1) {
1239 cpu_set(i, cpu_sibling_map[i]);
1240 continue;
1241 }
1242
1243 for_each_possible_cpu(j) {
1244 if (cpu_data(i).proc_id ==
1245 cpu_data(j).proc_id)
1227 cpu_set(j, cpu_sibling_map[i]); 1246 cpu_set(j, cpu_sibling_map[i]);
1228 } 1247 }
1229 } 1248 }
diff --git a/arch/sparc64/kernel/sysfs.c b/arch/sparc64/kernel/sysfs.c
new file mode 100644
index 000000000000..cdb1477af89f
--- /dev/null
+++ b/arch/sparc64/kernel/sysfs.c
@@ -0,0 +1,297 @@
1/* sysfs.c: Toplogy sysfs support code for sparc64.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5#include <linux/sysdev.h>
6#include <linux/cpu.h>
7#include <linux/smp.h>
8#include <linux/percpu.h>
9#include <linux/init.h>
10
11#include <asm/hypervisor.h>
12#include <asm/spitfire.h>
13
14static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64)));
15
16#define SHOW_MMUSTAT_ULONG(NAME) \
17static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
18{ \
19 struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \
20 return sprintf(buf, "%lu\n", p->NAME); \
21} \
22static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL)
23
24SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte);
25SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte);
26SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_64k_tte);
27SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_64k_tte);
28SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_4mb_tte);
29SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_4mb_tte);
30SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_256mb_tte);
31SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_256mb_tte);
32SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_8k_tte);
33SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_8k_tte);
34SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_64k_tte);
35SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_64k_tte);
36SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_4mb_tte);
37SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_4mb_tte);
38SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctxnon0_256mb_tte);
39SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctxnon0_256mb_tte);
40SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_8k_tte);
41SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_8k_tte);
42SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_64k_tte);
43SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_64k_tte);
44SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_4mb_tte);
45SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_4mb_tte);
46SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctx0_256mb_tte);
47SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctx0_256mb_tte);
48SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_8k_tte);
49SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_8k_tte);
50SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_64k_tte);
51SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_64k_tte);
52SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_4mb_tte);
53SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_4mb_tte);
54SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0_256mb_tte);
55SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte);
56
57static struct attribute *mmu_stat_attrs[] = {
58 &attr_immu_tsb_hits_ctx0_8k_tte.attr,
59 &attr_immu_tsb_ticks_ctx0_8k_tte.attr,
60 &attr_immu_tsb_hits_ctx0_64k_tte.attr,
61 &attr_immu_tsb_ticks_ctx0_64k_tte.attr,
62 &attr_immu_tsb_hits_ctx0_4mb_tte.attr,
63 &attr_immu_tsb_ticks_ctx0_4mb_tte.attr,
64 &attr_immu_tsb_hits_ctx0_256mb_tte.attr,
65 &attr_immu_tsb_ticks_ctx0_256mb_tte.attr,
66 &attr_immu_tsb_hits_ctxnon0_8k_tte.attr,
67 &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr,
68 &attr_immu_tsb_hits_ctxnon0_64k_tte.attr,
69 &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr,
70 &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr,
71 &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr,
72 &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr,
73 &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr,
74 &attr_dmmu_tsb_hits_ctx0_8k_tte.attr,
75 &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr,
76 &attr_dmmu_tsb_hits_ctx0_64k_tte.attr,
77 &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr,
78 &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr,
79 &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr,
80 &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr,
81 &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr,
82 &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr,
83 &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr,
84 &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr,
85 &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr,
86 &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr,
87 &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr,
88 &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr,
89 &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr,
90 NULL,
91};
92
93static struct attribute_group mmu_stat_group = {
94 .attrs = mmu_stat_attrs,
95 .name = "mmu_stats",
96};
97
98/* XXX convert to rusty's on_one_cpu */
99static unsigned long run_on_cpu(unsigned long cpu,
100 unsigned long (*func)(unsigned long),
101 unsigned long arg)
102{
103 cpumask_t old_affinity = current->cpus_allowed;
104 unsigned long ret;
105
106 /* should return -EINVAL to userspace */
107 if (set_cpus_allowed(current, cpumask_of_cpu(cpu)))
108 return 0;
109
110 ret = func(arg);
111
112 set_cpus_allowed(current, old_affinity);
113
114 return ret;
115}
116
117static unsigned long read_mmustat_enable(unsigned long junk)
118{
119 unsigned long ra = 0;
120
121 sun4v_mmustat_info(&ra);
122
123 return ra != 0;
124}
125
126static unsigned long write_mmustat_enable(unsigned long val)
127{
128 unsigned long ra, orig_ra;
129
130 if (val)
131 ra = __pa(&per_cpu(mmu_stats, smp_processor_id()));
132 else
133 ra = 0UL;
134
135 return sun4v_mmustat_conf(ra, &orig_ra);
136}
137
138static ssize_t show_mmustat_enable(struct sys_device *s, char *buf)
139{
140 unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0);
141 return sprintf(buf, "%lx\n", val);
142}
143
144static ssize_t store_mmustat_enable(struct sys_device *s, const char *buf, size_t count)
145{
146 unsigned long val, err;
147 int ret = sscanf(buf, "%ld", &val);
148
149 if (ret != 1)
150 return -EINVAL;
151
152 err = run_on_cpu(s->id, write_mmustat_enable, val);
153 if (err)
154 return -EIO;
155
156 return count;
157}
158
159static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable);
160
161static int mmu_stats_supported;
162
163static int register_mmu_stats(struct sys_device *s)
164{
165 if (!mmu_stats_supported)
166 return 0;
167 sysdev_create_file(s, &attr_mmustat_enable);
168 return sysfs_create_group(&s->kobj, &mmu_stat_group);
169}
170
171#ifdef CONFIG_HOTPLUG_CPU
172static void unregister_mmu_stats(struct sys_device *s)
173{
174 if (!mmu_stats_supported)
175 return;
176 sysfs_remove_group(&s->kobj, &mmu_stat_group);
177 sysdev_remove_file(s, &attr_mmustat_enable);
178}
179#endif
180
181#define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \
182static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
183{ \
184 cpuinfo_sparc *c = &cpu_data(dev->id); \
185 return sprintf(buf, "%lu\n", c->MEMBER); \
186}
187
188#define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \
189static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
190{ \
191 cpuinfo_sparc *c = &cpu_data(dev->id); \
192 return sprintf(buf, "%u\n", c->MEMBER); \
193}
194
195SHOW_CPUDATA_ULONG_NAME(clock_tick, clock_tick);
196SHOW_CPUDATA_ULONG_NAME(udelay_val, udelay_val);
197SHOW_CPUDATA_UINT_NAME(l1_dcache_size, dcache_size);
198SHOW_CPUDATA_UINT_NAME(l1_dcache_line_size, dcache_line_size);
199SHOW_CPUDATA_UINT_NAME(l1_icache_size, icache_size);
200SHOW_CPUDATA_UINT_NAME(l1_icache_line_size, icache_line_size);
201SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size);
202SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size);
203
204static struct sysdev_attribute cpu_core_attrs[] = {
205 _SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL),
206 _SYSDEV_ATTR(udelay_val, 0444, show_udelay_val, NULL),
207 _SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL),
208 _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL),
209 _SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL),
210 _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL),
211 _SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL),
212 _SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL),
213};
214
215static DEFINE_PER_CPU(struct cpu, cpu_devices);
216
217static void register_cpu_online(unsigned int cpu)
218{
219 struct cpu *c = &per_cpu(cpu_devices, cpu);
220 struct sys_device *s = &c->sysdev;
221 int i;
222
223 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
224 sysdev_create_file(s, &cpu_core_attrs[i]);
225
226 register_mmu_stats(s);
227}
228
229#ifdef CONFIG_HOTPLUG_CPU
230static void unregister_cpu_online(unsigned int cpu)
231{
232 struct cpu *c = &per_cpu(cpu_devices, cpu);
233 struct sys_device *s = &c->sysdev;
234 int i;
235
236 unregister_mmu_stats(s);
237 for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++)
238 sysdev_remove_file(s, &cpu_core_attrs[i]);
239}
240#endif
241
242static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
243 unsigned long action, void *hcpu)
244{
245 unsigned int cpu = (unsigned int)(long)hcpu;
246
247 switch (action) {
248 case CPU_ONLINE:
249 case CPU_ONLINE_FROZEN:
250 register_cpu_online(cpu);
251 break;
252#ifdef CONFIG_HOTPLUG_CPU
253 case CPU_DEAD:
254 case CPU_DEAD_FROZEN:
255 unregister_cpu_online(cpu);
256 break;
257#endif
258 }
259 return NOTIFY_OK;
260}
261
262static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
263 .notifier_call = sysfs_cpu_notify,
264};
265
266static void __init check_mmu_stats(void)
267{
268 unsigned long dummy1, err;
269
270 if (tlb_type != hypervisor)
271 return;
272
273 err = sun4v_mmustat_info(&dummy1);
274 if (!err)
275 mmu_stats_supported = 1;
276}
277
278static int __init topology_init(void)
279{
280 int cpu;
281
282 check_mmu_stats();
283
284 register_cpu_notifier(&sysfs_cpu_nb);
285
286 for_each_possible_cpu(cpu) {
287 struct cpu *c = &per_cpu(cpu_devices, cpu);
288
289 register_cpu(c, cpu);
290 if (cpu_online(cpu))
291 register_cpu_online(cpu);
292 }
293
294 return 0;
295}
296
297subsys_initcall(topology_init);
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index fb648de18a8d..3ad10f3027e4 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -1,5 +1,6 @@
1/* ld script to make UltraLinux kernel */ 1/* ld script to make UltraLinux kernel */
2 2
3#include <asm/page.h>
3#include <asm-generic/vmlinux.lds.h> 4#include <asm-generic/vmlinux.lds.h>
4 5
5OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc") 6OUTPUT_FORMAT("elf64-sparc", "elf64-sparc", "elf64-sparc")
@@ -23,7 +24,7 @@ SECTIONS
23 _etext = .; 24 _etext = .;
24 PROVIDE (etext = .); 25 PROVIDE (etext = .);
25 26
26 RODATA 27 RO_DATA(PAGE_SIZE)
27 28
28 .data : 29 .data :
29 { 30 {
@@ -44,7 +45,7 @@ SECTIONS
44 __ex_table : { *(__ex_table) } 45 __ex_table : { *(__ex_table) }
45 __stop___ex_table = .; 46 __stop___ex_table = .;
46 47
47 . = ALIGN(8192); 48 . = ALIGN(PAGE_SIZE);
48 __init_begin = .; 49 __init_begin = .;
49 .init.text : { 50 .init.text : {
50 _sinittext = .; 51 _sinittext = .;
@@ -83,17 +84,17 @@ SECTIONS
83 __sun4v_2insn_patch_end = .; 84 __sun4v_2insn_patch_end = .;
84 85
85#ifdef CONFIG_BLK_DEV_INITRD 86#ifdef CONFIG_BLK_DEV_INITRD
86 . = ALIGN(8192); 87 . = ALIGN(PAGE_SIZE);
87 __initramfs_start = .; 88 __initramfs_start = .;
88 .init.ramfs : { *(.init.ramfs) } 89 .init.ramfs : { *(.init.ramfs) }
89 __initramfs_end = .; 90 __initramfs_end = .;
90#endif 91#endif
91 92
92 . = ALIGN(8192); 93 . = ALIGN(PAGE_SIZE);
93 __per_cpu_start = .; 94 __per_cpu_start = .;
94 .data.percpu : { *(.data.percpu) } 95 .data.percpu : { *(.data.percpu) }
95 __per_cpu_end = .; 96 __per_cpu_end = .;
96 . = ALIGN(8192); 97 . = ALIGN(PAGE_SIZE);
97 __init_end = .; 98 __init_end = .;
98 __bss_start = .; 99 __bss_start = .;
99 .sbss : { *(.sbss) *(.scommon) } 100 .sbss : { *(.sbss) *(.scommon) }
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index bfb62a13d7ee..635e58d443d7 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -476,6 +476,12 @@ bad_area:
476bad_area_nosemaphore: 476bad_area_nosemaphore:
477 /* User mode accesses just cause a SIGSEGV */ 477 /* User mode accesses just cause a SIGSEGV */
478 if (error_code & PF_USER) { 478 if (error_code & PF_USER) {
479
480 /*
481 * It's possible to have interrupts off here.
482 */
483 local_irq_enable();
484
479 if (is_prefetch(regs, address, error_code)) 485 if (is_prefetch(regs, address, error_code))
480 return; 486 return;
481 487
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 1336da8bdee1..1ad5111aec38 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -761,3 +761,9 @@ int in_gate_area_no_task(unsigned long addr)
761{ 761{
762 return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END); 762 return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
763} 763}
764
765void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
766{
767 return __alloc_bootmem_core(pgdat->bdata, size,
768 SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
769}
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 3ff4e1f0f032..ac6dce2e7596 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -298,7 +298,7 @@ static inline int cryptd_create_thread(struct cryptd_state *state,
298 mutex_init(&state->mutex); 298 mutex_init(&state->mutex);
299 crypto_init_queue(&state->queue, CRYPTD_MAX_QLEN); 299 crypto_init_queue(&state->queue, CRYPTD_MAX_QLEN);
300 300
301 state->task = kthread_create(fn, state, name); 301 state->task = kthread_run(fn, state, name);
302 if (IS_ERR(state->task)) 302 if (IS_ERR(state->task))
303 return PTR_ERR(state->task); 303 return PTR_ERR(state->task);
304 304
@@ -316,6 +316,8 @@ static int cryptd_thread(void *data)
316 struct cryptd_state *state = data; 316 struct cryptd_state *state = data;
317 int stop; 317 int stop;
318 318
319 current->flags |= PF_NOFREEZE;
320
319 do { 321 do {
320 struct crypto_async_request *req, *backlog; 322 struct crypto_async_request *req, *backlog;
321 323
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index b770deab968c..6d7d4157e049 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1357,7 +1357,7 @@ static struct backlight_ops asus_backlight_data = {
1357 .update_status = set_brightness_status, 1357 .update_status = set_brightness_status,
1358}; 1358};
1359 1359
1360static void __exit asus_acpi_exit(void) 1360static void asus_acpi_exit(void)
1361{ 1361{
1362 if (asus_backlight_device) 1362 if (asus_backlight_device)
1363 backlight_device_unregister(asus_backlight_device); 1363 backlight_device_unregister(asus_backlight_device);
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index a2efae8a4c4e..0c9f15c54e8c 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -59,7 +59,7 @@ int node_to_pxm(int node)
59 return node_to_pxm_map[node]; 59 return node_to_pxm_map[node];
60} 60}
61 61
62int __cpuinit acpi_map_pxm_to_node(int pxm) 62int acpi_map_pxm_to_node(int pxm)
63{ 63{
64 int node = pxm_to_node_map[pxm]; 64 int node = pxm_to_node_map[pxm];
65 65
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index b998340e23d4..58ceb18ec997 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -33,6 +33,7 @@
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/kmod.h> 34#include <linux/kmod.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
36#include <linux/dmi.h>
36#include <linux/workqueue.h> 37#include <linux/workqueue.h>
37#include <linux/nmi.h> 38#include <linux/nmi.h>
38#include <linux/acpi.h> 39#include <linux/acpi.h>
@@ -73,6 +74,21 @@ static void *acpi_irq_context;
73static struct workqueue_struct *kacpid_wq; 74static struct workqueue_struct *kacpid_wq;
74static struct workqueue_struct *kacpi_notify_wq; 75static struct workqueue_struct *kacpi_notify_wq;
75 76
77#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
78static char osi_additional_string[OSI_STRING_LENGTH_MAX];
79
80#define OSI_LINUX_ENABLED
81#ifdef OSI_LINUX_ENABLED
82int osi_linux = 1; /* enable _OSI(Linux) by default */
83#else
84int osi_linux; /* disable _OSI(Linux) by default */
85#endif
86
87
88#ifdef CONFIG_DMI
89static struct __initdata dmi_system_id acpi_osl_dmi_table[];
90#endif
91
76static void __init acpi_request_region (struct acpi_generic_address *addr, 92static void __init acpi_request_region (struct acpi_generic_address *addr,
77 unsigned int length, char *desc) 93 unsigned int length, char *desc)
78{ 94{
@@ -121,8 +137,9 @@ static int __init acpi_reserve_resources(void)
121} 137}
122device_initcall(acpi_reserve_resources); 138device_initcall(acpi_reserve_resources);
123 139
124acpi_status acpi_os_initialize(void) 140acpi_status __init acpi_os_initialize(void)
125{ 141{
142 dmi_check_system(acpi_osl_dmi_table);
126 return AE_OK; 143 return AE_OK;
127} 144}
128 145
@@ -960,20 +977,38 @@ static int __init acpi_os_name_setup(char *str)
960 977
961__setup("acpi_os_name=", acpi_os_name_setup); 978__setup("acpi_os_name=", acpi_os_name_setup);
962 979
980static void enable_osi_linux(int enable) {
981
982 if (osi_linux != enable)
983 printk(KERN_INFO PREFIX "%sabled _OSI(Linux)\n",
984 enable ? "En": "Dis");
985
986 osi_linux = enable;
987 return;
988}
989
963/* 990/*
964 * _OSI control 991 * Modify the list of "OS Interfaces" reported to BIOS via _OSI
992 *
965 * empty string disables _OSI 993 * empty string disables _OSI
966 * TBD additional string adds to _OSI 994 * string starting with '!' disables that string
995 * otherwise string is added to list, augmenting built-in strings
967 */ 996 */
968static int __init acpi_osi_setup(char *str) 997static int __init acpi_osi_setup(char *str)
969{ 998{
970 if (str == NULL || *str == '\0') { 999 if (str == NULL || *str == '\0') {
971 printk(KERN_INFO PREFIX "_OSI method disabled\n"); 1000 printk(KERN_INFO PREFIX "_OSI method disabled\n");
972 acpi_gbl_create_osi_method = FALSE; 1001 acpi_gbl_create_osi_method = FALSE;
973 } else { 1002 } else if (*str == '!') {
974 /* TBD */ 1003 if (acpi_osi_invalidate(++str) == AE_OK)
975 printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", 1004 printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str);
976 str); 1005 } else if (!strcmp("!Linux", str)) {
1006 enable_osi_linux(0);
1007 } else if (!strcmp("Linux", str)) {
1008 enable_osi_linux(1);
1009 } else if (*osi_additional_string == '\0') {
1010 strncpy(osi_additional_string, str, OSI_STRING_LENGTH_MAX);
1011 printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str);
977 } 1012 }
978 1013
979 return 1; 1014 return 1;
@@ -1143,11 +1178,28 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
1143acpi_status 1178acpi_status
1144acpi_os_validate_interface (char *interface) 1179acpi_os_validate_interface (char *interface)
1145{ 1180{
1146 1181 if (!strncmp(osi_additional_string, interface, OSI_STRING_LENGTH_MAX))
1147 return AE_SUPPORT; 1182 return AE_OK;
1183 if (!strcmp("Linux", interface)) {
1184 printk(KERN_WARNING PREFIX
1185 "System BIOS is requesting _OSI(Linux)\n");
1186#ifdef OSI_LINUX_ENABLED
1187 printk(KERN_WARNING PREFIX
1188 "Please test with \"acpi_osi=!Linux\"\n"
1189 "Please send dmidecode "
1190 "to linux-acpi@vger.kernel.org\n");
1191#else
1192 printk(KERN_WARNING PREFIX
1193 "If \"acpi_osi=Linux\" works better,\n"
1194 "Please send dmidecode "
1195 "to linux-acpi@vger.kernel.org\n");
1196#endif
1197 if(osi_linux)
1198 return AE_OK;
1199 }
1200 return AE_SUPPORT;
1148} 1201}
1149 1202
1150
1151/****************************************************************************** 1203/******************************************************************************
1152 * 1204 *
1153 * FUNCTION: acpi_os_validate_address 1205 * FUNCTION: acpi_os_validate_address
@@ -1174,5 +1226,51 @@ acpi_os_validate_address (
1174 return AE_OK; 1226 return AE_OK;
1175} 1227}
1176 1228
1229#ifdef CONFIG_DMI
1230#ifdef OSI_LINUX_ENABLED
1231static int dmi_osi_not_linux(struct dmi_system_id *d)
1232{
1233 printk(KERN_NOTICE "%s detected: requires not _OSI(Linux)\n", d->ident);
1234 enable_osi_linux(0);
1235 return 0;
1236}
1237#else
1238static int dmi_osi_linux(struct dmi_system_id *d)
1239{
1240 printk(KERN_NOTICE "%s detected: requires _OSI(Linux)\n", d->ident);
1241 enable_osi_linux(1);
1242 return 0;
1243}
1244#endif
1245
1246static struct dmi_system_id acpi_osl_dmi_table[] __initdata = {
1247#ifdef OSI_LINUX_ENABLED
1248 /*
1249 * Boxes that need NOT _OSI(Linux)
1250 */
1251 {
1252 .callback = dmi_osi_not_linux,
1253 .ident = "Toshiba Satellite P100",
1254 .matches = {
1255 DMI_MATCH(DMI_BOARD_VENDOR, "TOSHIBA"),
1256 DMI_MATCH(DMI_BOARD_NAME, "Satellite P100"),
1257 },
1258 },
1259#else
1260 /*
1261 * Boxes that need _OSI(Linux)
1262 */
1263 {
1264 .callback = dmi_osi_linux,
1265 .ident = "Intel Napa CRB",
1266 .matches = {
1267 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
1268 DMI_MATCH(DMI_BOARD_NAME, "MPAD-MSAE Customer Reference Boards"),
1269 },
1270 },
1271#endif
1272 {}
1273};
1274#endif /* CONFIG_DMI */
1177 1275
1178#endif 1276#endif
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c
index 0e7b121a99ce..3bc0c67a9283 100644
--- a/drivers/acpi/tables/tbinstal.c
+++ b/drivers/acpi/tables/tbinstal.c
@@ -123,14 +123,14 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc,
123 } 123 }
124 } 124 }
125 125
126 /* The table must be either an SSDT or a PSDT */ 126 /* The table must be either an SSDT or a PSDT or an OEMx */
127 127
128 if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) 128 if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT))
129 && 129 &&
130 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))) 130 (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT))
131 { 131 && (strncmp(table_desc->pointer->signature, "OEM", 3))) {
132 ACPI_ERROR((AE_INFO, 132 ACPI_ERROR((AE_INFO,
133 "Table has invalid signature [%4.4s], must be SSDT or PSDT", 133 "Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx",
134 table_desc->pointer->signature)); 134 table_desc->pointer->signature));
135 return_ACPI_STATUS(AE_BAD_SIGNATURE); 135 return_ACPI_STATUS(AE_BAD_SIGNATURE);
136 } 136 }
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 1ada017d01ef..194ecfe8b360 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -827,6 +827,7 @@ static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
827static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) 827static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
828{ 828{
829 struct acpi_thermal *tz = seq->private; 829 struct acpi_thermal *tz = seq->private;
830 struct acpi_device *device;
830 int i = 0; 831 int i = 0;
831 int j = 0; 832 int j = 0;
832 833
@@ -849,9 +850,8 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
849 tz->trips.passive.tc1, tz->trips.passive.tc2, 850 tz->trips.passive.tc1, tz->trips.passive.tc2,
850 tz->trips.passive.tsp); 851 tz->trips.passive.tsp);
851 for (j = 0; j < tz->trips.passive.devices.count; j++) { 852 for (j = 0; j < tz->trips.passive.devices.count; j++) {
852 853 acpi_bus_get_device(tz->trips.passive.devices.handles[j], &device);
853 seq_printf(seq, "0x%p ", 854 seq_printf(seq, "%4.4s ", acpi_device_bid(device));
854 tz->trips.passive.devices.handles[j]);
855 } 855 }
856 seq_puts(seq, "\n"); 856 seq_puts(seq, "\n");
857 } 857 }
@@ -862,9 +862,10 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
862 seq_printf(seq, "active[%d]: %ld C: devices=", 862 seq_printf(seq, "active[%d]: %ld C: devices=",
863 i, 863 i,
864 KELVIN_TO_CELSIUS(tz->trips.active[i].temperature)); 864 KELVIN_TO_CELSIUS(tz->trips.active[i].temperature));
865 for (j = 0; j < tz->trips.active[i].devices.count; j++) 865 for (j = 0; j < tz->trips.active[i].devices.count; j++){
866 seq_printf(seq, "0x%p ", 866 acpi_bus_get_device(tz->trips.active[i].devices.handles[j], &device);
867 tz->trips.active[i].devices.handles[j]); 867 seq_printf(seq, "%4.4s ", acpi_device_bid(device));
868 }
868 seq_puts(seq, "\n"); 869 seq_puts(seq, "\n");
869 } 870 }
870 871
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 3906d47b9783..1cfbecb0ac10 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -538,7 +538,7 @@ static struct backlight_ops toshiba_backlight_data = {
538 .update_status = set_lcd_status, 538 .update_status = set_lcd_status,
539}; 539};
540 540
541static void __exit toshiba_acpi_exit(void) 541static void toshiba_acpi_exit(void)
542{ 542{
543 if (toshiba_backlight_device) 543 if (toshiba_backlight_device)
544 backlight_device_unregister(toshiba_backlight_device); 544 backlight_device_unregister(toshiba_backlight_device);
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 4c1e00874dff..879eaa10d3ae 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -68,6 +68,10 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *user_obj,
68 union acpi_operand_object **return_obj); 68 union acpi_operand_object **return_obj);
69 69
70static acpi_status 70static acpi_status
71acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
72 union acpi_operand_object **internal_object);
73
74static acpi_status
71acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, 75acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
72 union acpi_operand_object *dest_desc); 76 union acpi_operand_object *dest_desc);
73 77
@@ -518,77 +522,73 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
518 return_ACPI_STATUS(AE_NO_MEMORY); 522 return_ACPI_STATUS(AE_NO_MEMORY);
519} 523}
520 524
521#ifdef ACPI_FUTURE_IMPLEMENTATION
522/* Code to convert packages that are parameters to control methods */
523
524/******************************************************************************* 525/*******************************************************************************
525 * 526 *
526 * FUNCTION: acpi_ut_copy_epackage_to_ipackage 527 * FUNCTION: acpi_ut_copy_epackage_to_ipackage
527 * 528 *
528 * PARAMETERS: *internal_object - Pointer to the object we are returning 529 * PARAMETERS: external_object - The external object to be converted
529 * *Buffer - Where the object is returned 530 * internal_object - Where the internal object is returned
530 * *space_used - Where the length of the object is returned
531 * 531 *
532 * RETURN: Status 532 * RETURN: Status
533 * 533 *
534 * DESCRIPTION: This function is called to place a package object in a user 534 * DESCRIPTION: Copy an external package object to an internal package.
535 * buffer. A package object by definition contains other objects. 535 * Handles nested packages.
536 *
537 * The buffer is assumed to have sufficient space for the object.
538 * The caller must have verified the buffer length needed using the
539 * acpi_ut_get_object_size function before calling this function.
540 * 536 *
541 ******************************************************************************/ 537 ******************************************************************************/
542 538
543static acpi_status 539static acpi_status
544acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, 540acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object,
545 u8 * buffer, u32 * space_used) 541 union acpi_operand_object **internal_object)
546{ 542{
547 u8 *free_space; 543 acpi_status status = AE_OK;
548 union acpi_object *external_object; 544 union acpi_operand_object *package_object;
549 u32 length = 0; 545 union acpi_operand_object **package_elements;
550 u32 this_index; 546 acpi_native_uint i;
551 u32 object_space = 0;
552 union acpi_operand_object *this_internal_obj;
553 union acpi_object *this_external_obj;
554 547
555 ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); 548 ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage);
556 549
557 /* 550 /* Create the package object */
558 * First package at head of the buffer
559 */
560 external_object = (union acpi_object *)buffer;
561 551
562 /* 552 package_object =
563 * Free space begins right after the first package 553 acpi_ut_create_package_object(external_object->package.count);
564 */ 554 if (!package_object) {
565 free_space = buffer + sizeof(union acpi_object); 555 return_ACPI_STATUS(AE_NO_MEMORY);
556 }
566 557
567 external_object->type = ACPI_GET_OBJECT_TYPE(internal_object); 558 package_elements = package_object->package.elements;
568 external_object->package.count = internal_object->package.count;
569 external_object->package.elements = (union acpi_object *)free_space;
570 559
571 /* 560 /*
572 * Build an array of ACPI_OBJECTS in the buffer 561 * Recursive implementation. Probably ok, since nested external packages
573 * and move the free space past it 562 * as parameters should be very rare.
574 */ 563 */
575 free_space += 564 for (i = 0; i < external_object->package.count; i++) {
576 external_object->package.count * sizeof(union acpi_object); 565 status =
566 acpi_ut_copy_eobject_to_iobject(&external_object->package.
567 elements[i],
568 &package_elements[i]);
569 if (ACPI_FAILURE(status)) {
577 570
578 /* Call walk_package */ 571 /* Truncate package and delete it */
579 572
580} 573 package_object->package.count = i;
574 package_elements[i] = NULL;
575 acpi_ut_remove_reference(package_object);
576 return_ACPI_STATUS(status);
577 }
578 }
581 579
582#endif /* Future implementation */ 580 *internal_object = package_object;
581 return_ACPI_STATUS(status);
582}
583 583
584/******************************************************************************* 584/*******************************************************************************
585 * 585 *
586 * FUNCTION: acpi_ut_copy_eobject_to_iobject 586 * FUNCTION: acpi_ut_copy_eobject_to_iobject
587 * 587 *
588 * PARAMETERS: *internal_object - The external object to be converted 588 * PARAMETERS: external_object - The external object to be converted
589 * *buffer_ptr - Where the internal object is returned 589 * internal_object - Where the internal object is returned
590 * 590 *
591 * RETURN: Status - the status of the call 591 * RETURN: Status - the status of the call
592 * 592 *
593 * DESCRIPTION: Converts an external object to an internal object. 593 * DESCRIPTION: Converts an external object to an internal object.
594 * 594 *
@@ -603,16 +603,10 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
603 ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); 603 ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject);
604 604
605 if (external_object->type == ACPI_TYPE_PACKAGE) { 605 if (external_object->type == ACPI_TYPE_PACKAGE) {
606 /* 606 status =
607 * Packages as external input to control methods are not supported, 607 acpi_ut_copy_epackage_to_ipackage(external_object,
608 */ 608 internal_object);
609 ACPI_ERROR((AE_INFO, 609 } else {
610 "Packages as parameters not implemented!"));
611
612 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
613 }
614
615 else {
616 /* 610 /*
617 * Build a simple object (no nested objects) 611 * Build a simple object (no nested objects)
618 */ 612 */
@@ -803,33 +797,19 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type,
803 * Create and build the package object 797 * Create and build the package object
804 */ 798 */
805 target_object = 799 target_object =
806 acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); 800 acpi_ut_create_package_object(source_object->package.count);
807 if (!target_object) { 801 if (!target_object) {
808 return (AE_NO_MEMORY); 802 return (AE_NO_MEMORY);
809 } 803 }
810 804
811 target_object->package.count = source_object->package.count;
812 target_object->common.flags = source_object->common.flags; 805 target_object->common.flags = source_object->common.flags;
813 806
814 /* 807 /* Pass the new package object back to the package walk routine */
815 * Create the object array
816 */
817 target_object->package.elements =
818 ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.
819 count + 1) * sizeof(void *));
820 if (!target_object->package.elements) {
821 status = AE_NO_MEMORY;
822 goto error_exit;
823 }
824 808
825 /*
826 * Pass the new package object back to the package walk routine
827 */
828 state->pkg.this_target_obj = target_object; 809 state->pkg.this_target_obj = target_object;
829 810
830 /* 811 /* Store the object pointer in the parent package object */
831 * Store the object pointer in the parent package object 812
832 */
833 *this_target_ptr = target_object; 813 *this_target_ptr = target_object;
834 break; 814 break;
835 815
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 13d5879cd98b..8ec6f8e48138 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -59,10 +59,9 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc,
59/* 59/*
60 * Strings supported by the _OSI predefined (internal) method. 60 * Strings supported by the _OSI predefined (internal) method.
61 */ 61 */
62static const char *acpi_interfaces_supported[] = { 62static char *acpi_interfaces_supported[] = {
63 /* Operating System Vendor Strings */ 63 /* Operating System Vendor Strings */
64 64
65 "Linux",
66 "Windows 2000", 65 "Windows 2000",
67 "Windows 2001", 66 "Windows 2001",
68 "Windows 2001 SP0", 67 "Windows 2001 SP0",
@@ -158,6 +157,31 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
158 157
159/******************************************************************************* 158/*******************************************************************************
160 * 159 *
160 * FUNCTION: acpi_osi_invalidate
161 *
162 * PARAMETERS: interface_string
163 *
164 * RETURN: Status
165 *
166 * DESCRIPTION: invalidate string in pre-defiend _OSI string list
167 *
168 ******************************************************************************/
169
170acpi_status acpi_osi_invalidate(char *interface)
171{
172 int i;
173
174 for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) {
175 if (!ACPI_STRCMP(interface, acpi_interfaces_supported[i])) {
176 *acpi_interfaces_supported[i] = '\0';
177 return AE_OK;
178 }
179 }
180 return AE_NOT_FOUND;
181}
182
183/*******************************************************************************
184 *
161 * FUNCTION: acpi_ut_evaluate_object 185 * FUNCTION: acpi_ut_evaluate_object
162 * 186 *
163 * PARAMETERS: prefix_node - Starting node 187 * PARAMETERS: prefix_node - Starting node
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 4696124759e1..db0b9bac7945 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -146,6 +146,48 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name,
146 146
147/******************************************************************************* 147/*******************************************************************************
148 * 148 *
149 * FUNCTION: acpi_ut_create_package_object
150 *
151 * PARAMETERS: Count - Number of package elements
152 *
153 * RETURN: Pointer to a new Package object, null on failure
154 *
155 * DESCRIPTION: Create a fully initialized package object
156 *
157 ******************************************************************************/
158
159union acpi_operand_object *acpi_ut_create_package_object(u32 count)
160{
161 union acpi_operand_object *package_desc;
162 union acpi_operand_object **package_elements;
163
164 ACPI_FUNCTION_TRACE_U32(ut_create_package_object, count);
165
166 /* Create a new Package object */
167
168 package_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
169 if (!package_desc) {
170 return_PTR(NULL);
171 }
172
173 /*
174 * Create the element array. Count+1 allows the array to be null
175 * terminated.
176 */
177 package_elements = ACPI_ALLOCATE_ZEROED((acpi_size)
178 (count + 1) * sizeof(void *));
179 if (!package_elements) {
180 ACPI_FREE(package_desc);
181 return_PTR(NULL);
182 }
183
184 package_desc->package.count = count;
185 package_desc->package.elements = package_elements;
186 return_PTR(package_desc);
187}
188
189/*******************************************************************************
190 *
149 * FUNCTION: acpi_ut_create_buffer_object 191 * FUNCTION: acpi_ut_create_buffer_object
150 * 192 *
151 * PARAMETERS: buffer_size - Size of buffer to be created 193 * PARAMETERS: buffer_size - Size of buffer to be created
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index e9a57806cd34..2d496918b3cd 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -61,7 +61,7 @@ ACPI_MODULE_NAME("utxface")
61 * called, so any early initialization belongs here. 61 * called, so any early initialization belongs here.
62 * 62 *
63 ******************************************************************************/ 63 ******************************************************************************/
64acpi_status acpi_initialize_subsystem(void) 64acpi_status __init acpi_initialize_subsystem(void)
65{ 65{
66 acpi_status status; 66 acpi_status status;
67 67
@@ -108,8 +108,6 @@ acpi_status acpi_initialize_subsystem(void)
108 return_ACPI_STATUS(status); 108 return_ACPI_STATUS(status);
109} 109}
110 110
111ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem)
112
113/******************************************************************************* 111/*******************************************************************************
114 * 112 *
115 * FUNCTION: acpi_enable_subsystem 113 * FUNCTION: acpi_enable_subsystem
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3ca9c610c110..4733f009c7c9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3783,6 +3783,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3783 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, 3783 { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ },
3784 /* NCQ is broken */ 3784 /* NCQ is broken */
3785 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ }, 3785 { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ },
3786 { "Maxtor 6B200M0", "BANC1B10", ATA_HORKAGE_NONCQ },
3786 /* NCQ hard hangs device under heavier load, needs hard power cycle */ 3787 /* NCQ hard hangs device under heavier load, needs hard power cycle */
3787 { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ }, 3788 { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ },
3788 /* Blacklist entries taken from Silicon Image 3124/3132 3789 /* Blacklist entries taken from Silicon Image 3124/3132
@@ -3932,10 +3933,13 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev)
3932 /* set up set-features taskfile */ 3933 /* set up set-features taskfile */
3933 DPRINTK("set features - xfer mode\n"); 3934 DPRINTK("set features - xfer mode\n");
3934 3935
3936 /* Some controllers and ATAPI devices show flaky interrupt
3937 * behavior after setting xfer mode. Use polling instead.
3938 */
3935 ata_tf_init(dev, &tf); 3939 ata_tf_init(dev, &tf);
3936 tf.command = ATA_CMD_SET_FEATURES; 3940 tf.command = ATA_CMD_SET_FEATURES;
3937 tf.feature = SETFEATURES_XFER; 3941 tf.feature = SETFEATURES_XFER;
3938 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 3942 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
3939 tf.protocol = ATA_PROT_NODATA; 3943 tf.protocol = ATA_PROT_NODATA;
3940 tf.nsect = dev->xfer_mode; 3944 tf.nsect = dev->xfer_mode;
3941 3945
@@ -5413,14 +5417,6 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
5413 } 5417 }
5414 } 5418 }
5415 5419
5416 /* Some controllers show flaky interrupt behavior after
5417 * setting xfer mode. Use polling instead.
5418 */
5419 if (unlikely(qc->tf.command == ATA_CMD_SET_FEATURES &&
5420 qc->tf.feature == SETFEATURES_XFER) &&
5421 (ap->flags & ATA_FLAG_SETXFER_POLLING))
5422 qc->tf.flags |= ATA_TFLAG_POLLING;
5423
5424 /* select the device */ 5420 /* select the device */
5425 ata_dev_select(ap, qc->dev->devno, 1, 0); 5421 ata_dev_select(ap, qc->dev->devno, 1, 0);
5426 5422
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index a8462f1e890b..63eca299c62b 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -452,7 +452,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
452 /* Early VIA without UDMA support */ 452 /* Early VIA without UDMA support */
453 static const struct ata_port_info via_mwdma_info = { 453 static const struct ata_port_info via_mwdma_info = {
454 .sht = &via_sht, 454 .sht = &via_sht,
455 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 455 .flags = ATA_FLAG_SLAVE_POSS,
456 .pio_mask = 0x1f, 456 .pio_mask = 0x1f,
457 .mwdma_mask = 0x07, 457 .mwdma_mask = 0x07,
458 .port_ops = &via_port_ops 458 .port_ops = &via_port_ops
@@ -460,7 +460,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
460 /* Ditto with IRQ masking required */ 460 /* Ditto with IRQ masking required */
461 static const struct ata_port_info via_mwdma_info_borked = { 461 static const struct ata_port_info via_mwdma_info_borked = {
462 .sht = &via_sht, 462 .sht = &via_sht,
463 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 463 .flags = ATA_FLAG_SLAVE_POSS,
464 .pio_mask = 0x1f, 464 .pio_mask = 0x1f,
465 .mwdma_mask = 0x07, 465 .mwdma_mask = 0x07,
466 .port_ops = &via_port_ops_noirq, 466 .port_ops = &via_port_ops_noirq,
@@ -468,7 +468,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
468 /* VIA UDMA 33 devices (and borked 66) */ 468 /* VIA UDMA 33 devices (and borked 66) */
469 static const struct ata_port_info via_udma33_info = { 469 static const struct ata_port_info via_udma33_info = {
470 .sht = &via_sht, 470 .sht = &via_sht,
471 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 471 .flags = ATA_FLAG_SLAVE_POSS,
472 .pio_mask = 0x1f, 472 .pio_mask = 0x1f,
473 .mwdma_mask = 0x07, 473 .mwdma_mask = 0x07,
474 .udma_mask = 0x7, 474 .udma_mask = 0x7,
@@ -477,7 +477,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
477 /* VIA UDMA 66 devices */ 477 /* VIA UDMA 66 devices */
478 static const struct ata_port_info via_udma66_info = { 478 static const struct ata_port_info via_udma66_info = {
479 .sht = &via_sht, 479 .sht = &via_sht,
480 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 480 .flags = ATA_FLAG_SLAVE_POSS,
481 .pio_mask = 0x1f, 481 .pio_mask = 0x1f,
482 .mwdma_mask = 0x07, 482 .mwdma_mask = 0x07,
483 .udma_mask = 0x1f, 483 .udma_mask = 0x1f,
@@ -486,7 +486,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
486 /* VIA UDMA 100 devices */ 486 /* VIA UDMA 100 devices */
487 static const struct ata_port_info via_udma100_info = { 487 static const struct ata_port_info via_udma100_info = {
488 .sht = &via_sht, 488 .sht = &via_sht,
489 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 489 .flags = ATA_FLAG_SLAVE_POSS,
490 .pio_mask = 0x1f, 490 .pio_mask = 0x1f,
491 .mwdma_mask = 0x07, 491 .mwdma_mask = 0x07,
492 .udma_mask = 0x3f, 492 .udma_mask = 0x3f,
@@ -495,7 +495,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
495 /* UDMA133 with bad AST (All current 133) */ 495 /* UDMA133 with bad AST (All current 133) */
496 static const struct ata_port_info via_udma133_info = { 496 static const struct ata_port_info via_udma133_info = {
497 .sht = &via_sht, 497 .sht = &via_sht,
498 .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SETXFER_POLLING, 498 .flags = ATA_FLAG_SLAVE_POSS,
499 .pio_mask = 0x1f, 499 .pio_mask = 0x1f,
500 .mwdma_mask = 0x07, 500 .mwdma_mask = 0x07,
501 .udma_mask = 0x7f, /* FIXME: should check north bridge */ 501 .udma_mask = 0x7f, /* FIXME: should check north bridge */
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 9c67df5ccfa4..7f6d02ce1b5f 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1475,6 +1475,7 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
1475 struct FS_BPENTRY *qe, *ne; 1475 struct FS_BPENTRY *qe, *ne;
1476 struct sk_buff *skb; 1476 struct sk_buff *skb;
1477 int n = 0; 1477 int n = 0;
1478 u32 qe_tmp;
1478 1479
1479 fs_dprintk (FS_DEBUG_QUEUE, "Topping off queue at %x (%d-%d/%d)\n", 1480 fs_dprintk (FS_DEBUG_QUEUE, "Topping off queue at %x (%d-%d/%d)\n",
1480 fp->offset, read_fs (dev, FP_CNT (fp->offset)), fp->n, 1481 fp->offset, read_fs (dev, FP_CNT (fp->offset)), fp->n,
@@ -1502,10 +1503,16 @@ static void top_off_fp (struct fs_dev *dev, struct freepool *fp,
1502 ne->skb = skb; 1503 ne->skb = skb;
1503 ne->fp = fp; 1504 ne->fp = fp;
1504 1505
1505 qe = (struct FS_BPENTRY *) (read_fs (dev, FP_EA(fp->offset))); 1506 /*
1506 fs_dprintk (FS_DEBUG_QUEUE, "link at %p\n", qe); 1507 * FIXME: following code encodes and decodes
1507 if (qe) { 1508 * machine pointers (could be 64-bit) into a
1508 qe = bus_to_virt ((long) qe); 1509 * 32-bit register.
1510 */
1511
1512 qe_tmp = read_fs (dev, FP_EA(fp->offset));
1513 fs_dprintk (FS_DEBUG_QUEUE, "link at %x\n", qe_tmp);
1514 if (qe_tmp) {
1515 qe = bus_to_virt ((long) qe_tmp);
1509 qe->next = virt_to_bus(ne); 1516 qe->next = virt_to_bus(ne);
1510 qe->flags &= ~FP_FLAGS_EPI; 1517 qe->flags &= ~FP_FLAGS_EPI;
1511 } else 1518 } else
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index 2e18a63ead36..ea4fe3e48f33 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -68,6 +68,10 @@ config CFAG12864B
68 depends on X86 68 depends on X86
69 depends on FB 69 depends on FB
70 depends on KS0108 70 depends on KS0108
71 select FB_SYS_FILLRECT
72 select FB_SYS_COPYAREA
73 select FB_SYS_IMAGEBLIT
74 select FB_SYS_FOPS
71 default n 75 default n
72 ---help--- 76 ---help---
73 If you have a Crystalfontz 128x64 2-color LCD, cfag12864b Series, 77 If you have a Crystalfontz 128x64 2-color LCD, cfag12864b Series,
diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c
index 66fafbb1d087..307c190699e0 100644
--- a/drivers/auxdisplay/cfag12864bfb.c
+++ b/drivers/auxdisplay/cfag12864bfb.c
@@ -73,9 +73,11 @@ static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
73 73
74static struct fb_ops cfag12864bfb_ops = { 74static struct fb_ops cfag12864bfb_ops = {
75 .owner = THIS_MODULE, 75 .owner = THIS_MODULE,
76 .fb_fillrect = cfb_fillrect, 76 .fb_read = fb_sys_read,
77 .fb_copyarea = cfb_copyarea, 77 .fb_write = fb_sys_write,
78 .fb_imageblit = cfb_imageblit, 78 .fb_fillrect = sys_fillrect,
79 .fb_copyarea = sys_copyarea,
80 .fb_imageblit = sys_imageblit,
79 .fb_mmap = cfag12864bfb_mmap, 81 .fb_mmap = cfag12864bfb_mmap,
80}; 82};
81 83
diff --git a/drivers/char/drm/drm_drawable.c b/drivers/char/drm/drm_drawable.c
index de37d5f74563..b33313be2547 100644
--- a/drivers/char/drm/drm_drawable.c
+++ b/drivers/char/drm/drm_drawable.c
@@ -172,38 +172,49 @@ int drm_rmdraw(DRM_IOCTL_ARGS)
172 172
173 bitfield_length = idx + 1; 173 bitfield_length = idx + 1;
174 174
175 if (idx != id / (8 * sizeof(*bitfield))) 175 bitfield = NULL;
176 bitfield = drm_alloc(bitfield_length *
177 sizeof(*bitfield), DRM_MEM_BUFS);
178 176
179 if (!bitfield && bitfield_length) { 177 if (bitfield_length) {
180 bitfield = dev->drw_bitfield; 178 if (bitfield_length != dev->drw_bitfield_length)
181 bitfield_length = dev->drw_bitfield_length; 179 bitfield = drm_alloc(bitfield_length *
180 sizeof(*bitfield),
181 DRM_MEM_BUFS);
182
183 if (!bitfield) {
184 bitfield = dev->drw_bitfield;
185 bitfield_length = dev->drw_bitfield_length;
186 }
182 } 187 }
183 } 188 }
184 189
185 if (bitfield != dev->drw_bitfield) { 190 if (bitfield != dev->drw_bitfield) {
186 info_length = 8 * sizeof(*bitfield) * bitfield_length; 191 info_length = 8 * sizeof(*bitfield) * bitfield_length;
187 192
188 info = drm_alloc(info_length * sizeof(*info), DRM_MEM_BUFS); 193 if (info_length) {
194 info = drm_alloc(info_length * sizeof(*info),
195 DRM_MEM_BUFS);
189 196
190 if (!info && info_length) { 197 if (!info) {
191 info = dev->drw_info; 198 info = dev->drw_info;
192 info_length = dev->drw_info_length; 199 info_length = dev->drw_info_length;
193 } 200 }
201 } else
202 info = NULL;
194 203
195 spin_lock_irqsave(&dev->drw_lock, irqflags); 204 spin_lock_irqsave(&dev->drw_lock, irqflags);
196 205
197 memcpy(bitfield, dev->drw_bitfield, bitfield_length * 206 if (bitfield)
198 sizeof(*bitfield)); 207 memcpy(bitfield, dev->drw_bitfield, bitfield_length *
208 sizeof(*bitfield));
199 drm_free(dev->drw_bitfield, sizeof(*bitfield) * 209 drm_free(dev->drw_bitfield, sizeof(*bitfield) *
200 dev->drw_bitfield_length, DRM_MEM_BUFS); 210 dev->drw_bitfield_length, DRM_MEM_BUFS);
201 dev->drw_bitfield = bitfield; 211 dev->drw_bitfield = bitfield;
202 dev->drw_bitfield_length = bitfield_length; 212 dev->drw_bitfield_length = bitfield_length;
203 213
204 if (info != dev->drw_info) { 214 if (info != dev->drw_info) {
205 memcpy(info, dev->drw_info, info_length * 215 if (info)
206 sizeof(*info)); 216 memcpy(info, dev->drw_info, info_length *
217 sizeof(*info));
207 drm_free(dev->drw_info, sizeof(*info) * 218 drm_free(dev->drw_info, sizeof(*info) *
208 dev->drw_info_length, DRM_MEM_BUFS); 219 dev->drw_info_length, DRM_MEM_BUFS);
209 dev->drw_info = info; 220 dev->drw_info = info;
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index 31cdde83713b..177ccc07f968 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -102,13 +102,20 @@
102 {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 102 {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
103 {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \ 103 {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP}, \
104 {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \ 104 {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY}, \
105 {0x1002, 0x5954, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
105 {0x1002, 0x5955, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \ 106 {0x1002, 0x5955, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
107 {0x1002, 0x5974, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
108 {0x1002, 0x5975, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
106 {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 109 {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
107 {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 110 {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
108 {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 111 {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
109 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 112 {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
110 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \ 113 {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
111 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \ 114 {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
115 {0x1002, 0x5a41, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
116 {0x1002, 0x5a42, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
117 {0x1002, 0x5a61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
118 {0x1002, 0x5a62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS400|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_IS_IGPGART}, \
112 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 119 {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
113 {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 120 {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
114 {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \ 121 {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|RADEON_NEW_MEMMAP}, \
diff --git a/drivers/char/drm/i915_irq.c b/drivers/char/drm/i915_irq.c
index 78c1ae28f17c..b92062a239f1 100644
--- a/drivers/char/drm/i915_irq.c
+++ b/drivers/char/drm/i915_irq.c
@@ -582,7 +582,7 @@ void i915_driver_irq_postinstall(drm_device_t * dev)
582{ 582{
583 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 583 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
584 584
585 dev_priv->swaps_lock = SPIN_LOCK_UNLOCKED; 585 spin_lock_init(&dev_priv->swaps_lock);
586 INIT_LIST_HEAD(&dev_priv->vbl_swaps.head); 586 INIT_LIST_HEAD(&dev_priv->vbl_swaps.head);
587 dev_priv->swaps_pending = 0; 587 dev_priv->swaps_pending = 0;
588 588
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index b3d4ccc33a47..154f42203b05 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1191,6 +1191,7 @@ static int job_control(struct tty_struct *tty, struct file *file)
1191 is_current_pgrp_orphaned()) 1191 is_current_pgrp_orphaned())
1192 return -EIO; 1192 return -EIO;
1193 kill_pgrp(task_pgrp(current), SIGTTIN, 1); 1193 kill_pgrp(task_pgrp(current), SIGTTIN, 1);
1194 set_thread_flag(TIF_SIGPENDING);
1194 return -ERESTARTSYS; 1195 return -ERESTARTSYS;
1195 } 1196 }
1196 } 1197 }
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 75d2a46e106f..3752edc30c36 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1148,7 +1148,8 @@ int tty_check_change(struct tty_struct * tty)
1148 return 0; 1148 return 0;
1149 if (is_current_pgrp_orphaned()) 1149 if (is_current_pgrp_orphaned())
1150 return -EIO; 1150 return -EIO;
1151 (void) kill_pgrp(task_pgrp(current), SIGTTOU, 1); 1151 kill_pgrp(task_pgrp(current), SIGTTOU, 1);
1152 set_thread_flag(TIF_SIGPENDING);
1152 return -ERESTARTSYS; 1153 return -ERESTARTSYS;
1153} 1154}
1154 1155
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index 1cad32c62ed3..53f5538c0c05 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -115,6 +115,13 @@ config IXP4XX_WATCHDOG
115 115
116 Say N if you are unsure. 116 Say N if you are unsure.
117 117
118config KS8695_WATCHDOG
119 tristate "KS8695 watchdog"
120 depends on ARCH_KS8695
121 help
122 Watchdog timer embedded into KS8695 processor. This will reboot your
123 system when the timeout is reached.
124
118config S3C2410_WATCHDOG 125config S3C2410_WATCHDOG
119 tristate "S3C2410 Watchdog" 126 tristate "S3C2410 Watchdog"
120 depends on ARCH_S3C2410 127 depends on ARCH_S3C2410
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
index 8bfc00cc7c2b..d90f649038c2 100644
--- a/drivers/char/watchdog/Makefile
+++ b/drivers/char/watchdog/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
29obj-$(CONFIG_977_WATCHDOG) += wdt977.o 29obj-$(CONFIG_977_WATCHDOG) += wdt977.o
30obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o 30obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o
31obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o 31obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
32obj-$(CONFIG_KS8695_WATCHDOG) += ks8695_wdt.o
32obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o 33obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o
33obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o 34obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
34obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o 35obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/char/watchdog/ixp2000_wdt.c
index fd955dbd588c..dc7548dcaf35 100644
--- a/drivers/char/watchdog/ixp2000_wdt.c
+++ b/drivers/char/watchdog/ixp2000_wdt.c
@@ -205,7 +205,7 @@ static void __exit ixp2000_wdt_exit(void)
205module_init(ixp2000_wdt_init); 205module_init(ixp2000_wdt_init);
206module_exit(ixp2000_wdt_exit); 206module_exit(ixp2000_wdt_exit);
207 207
208MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net">); 208MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
209MODULE_DESCRIPTION("IXP2000 Network Processor Watchdog"); 209MODULE_DESCRIPTION("IXP2000 Network Processor Watchdog");
210 210
211module_param(heartbeat, int, 0); 211module_param(heartbeat, int, 0);
diff --git a/drivers/char/watchdog/ks8695_wdt.c b/drivers/char/watchdog/ks8695_wdt.c
new file mode 100644
index 000000000000..7150fb945eaf
--- /dev/null
+++ b/drivers/char/watchdog/ks8695_wdt.c
@@ -0,0 +1,308 @@
1/*
2 * Watchdog driver for Kendin/Micrel KS8695.
3 *
4 * (C) 2007 Andrew Victor
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/errno.h>
12#include <linux/fs.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/miscdevice.h>
16#include <linux/module.h>
17#include <linux/moduleparam.h>
18#include <linux/platform_device.h>
19#include <linux/types.h>
20#include <linux/watchdog.h>
21#include <asm/bitops.h>
22#include <asm/io.h>
23#include <asm/uaccess.h>
24#include <asm/arch/regs-timer.h>
25
26
27#define WDT_DEFAULT_TIME 5 /* seconds */
28#define WDT_MAX_TIME 171 /* seconds */
29
30static int wdt_time = WDT_DEFAULT_TIME;
31static int nowayout = WATCHDOG_NOWAYOUT;
32
33module_param(wdt_time, int, 0);
34MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
35
36#ifdef CONFIG_WATCHDOG_NOWAYOUT
37module_param(nowayout, int, 0);
38MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
39#endif
40
41
42static unsigned long ks8695wdt_busy;
43
44/* ......................................................................... */
45
46/*
47 * Disable the watchdog.
48 */
49static void inline ks8695_wdt_stop(void)
50{
51 unsigned long tmcon;
52
53 /* disable timer0 */
54 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
55 __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
56}
57
58/*
59 * Enable and reset the watchdog.
60 */
61static void inline ks8695_wdt_start(void)
62{
63 unsigned long tmcon;
64 unsigned long tval = wdt_time * CLOCK_TICK_RATE;
65
66 /* disable timer0 */
67 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
68 __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
69
70 /* program timer0 */
71 __raw_writel(tval | T0TC_WATCHDOG, KS8695_TMR_VA + KS8695_T0TC);
72
73 /* re-enable timer0 */
74 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
75 __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
76}
77
78/*
79 * Reload the watchdog timer. (ie, pat the watchdog)
80 */
81static void inline ks8695_wdt_reload(void)
82{
83 unsigned long tmcon;
84
85 /* disable, then re-enable timer0 */
86 tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
87 __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
88 __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
89}
90
91/*
92 * Change the watchdog time interval.
93 */
94static int ks8695_wdt_settimeout(int new_time)
95{
96 /*
97 * All counting occurs at SLOW_CLOCK / 128 = 0.256 Hz
98 *
99 * Since WDV is a 16-bit counter, the maximum period is
100 * 65536 / 0.256 = 256 seconds.
101 */
102 if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
103 return -EINVAL;
104
105 /* Set new watchdog time. It will be used when ks8695_wdt_start() is called. */
106 wdt_time = new_time;
107 return 0;
108}
109
110/* ......................................................................... */
111
112/*
113 * Watchdog device is opened, and watchdog starts running.
114 */
115static int ks8695_wdt_open(struct inode *inode, struct file *file)
116{
117 if (test_and_set_bit(0, &ks8695wdt_busy))
118 return -EBUSY;
119
120 ks8695_wdt_start();
121 return nonseekable_open(inode, file);
122}
123
124/*
125 * Close the watchdog device.
126 * If CONFIG_WATCHDOG_NOWAYOUT is NOT defined then the watchdog is also
127 * disabled.
128 */
129static int ks8695_wdt_close(struct inode *inode, struct file *file)
130{
131 if (!nowayout)
132 ks8695_wdt_stop(); /* Disable the watchdog when file is closed */
133
134 clear_bit(0, &ks8695wdt_busy);
135 return 0;
136}
137
138static struct watchdog_info ks8695_wdt_info = {
139 .identity = "ks8695 watchdog",
140 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
141};
142
143/*
144 * Handle commands from user-space.
145 */
146static int ks8695_wdt_ioctl(struct inode *inode, struct file *file,
147 unsigned int cmd, unsigned long arg)
148{
149 void __user *argp = (void __user *)arg;
150 int __user *p = argp;
151 int new_value;
152
153 switch(cmd) {
154 case WDIOC_KEEPALIVE:
155 ks8695_wdt_reload(); /* pat the watchdog */
156 return 0;
157
158 case WDIOC_GETSUPPORT:
159 return copy_to_user(argp, &ks8695_wdt_info, sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
160
161 case WDIOC_SETTIMEOUT:
162 if (get_user(new_value, p))
163 return -EFAULT;
164
165 if (ks8695_wdt_settimeout(new_value))
166 return -EINVAL;
167
168 /* Enable new time value */
169 ks8695_wdt_start();
170
171 /* Return current value */
172 return put_user(wdt_time, p);
173
174 case WDIOC_GETTIMEOUT:
175 return put_user(wdt_time, p);
176
177 case WDIOC_GETSTATUS:
178 case WDIOC_GETBOOTSTATUS:
179 return put_user(0, p);
180
181 case WDIOC_SETOPTIONS:
182 if (get_user(new_value, p))
183 return -EFAULT;
184
185 if (new_value & WDIOS_DISABLECARD)
186 ks8695_wdt_stop();
187 if (new_value & WDIOS_ENABLECARD)
188 ks8695_wdt_start();
189 return 0;
190
191 default:
192 return -ENOTTY;
193 }
194}
195
196/*
197 * Pat the watchdog whenever device is written to.
198 */
199static ssize_t ks8695_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
200{
201 ks8695_wdt_reload(); /* pat the watchdog */
202 return len;
203}
204
205/* ......................................................................... */
206
207static const struct file_operations ks8695wdt_fops = {
208 .owner = THIS_MODULE,
209 .llseek = no_llseek,
210 .ioctl = ks8695_wdt_ioctl,
211 .open = ks8695_wdt_open,
212 .release = ks8695_wdt_close,
213 .write = ks8695_wdt_write,
214};
215
216static struct miscdevice ks8695wdt_miscdev = {
217 .minor = WATCHDOG_MINOR,
218 .name = "watchdog",
219 .fops = &ks8695wdt_fops,
220};
221
222static int __init ks8695wdt_probe(struct platform_device *pdev)
223{
224 int res;
225
226 if (ks8695wdt_miscdev.parent)
227 return -EBUSY;
228 ks8695wdt_miscdev.parent = &pdev->dev;
229
230 res = misc_register(&ks8695wdt_miscdev);
231 if (res)
232 return res;
233
234 printk("KS8695 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
235 return 0;
236}
237
238static int __exit ks8695wdt_remove(struct platform_device *pdev)
239{
240 int res;
241
242 res = misc_deregister(&ks8695wdt_miscdev);
243 if (!res)
244 ks8695wdt_miscdev.parent = NULL;
245
246 return res;
247}
248
249static void ks8695wdt_shutdown(struct platform_device *pdev)
250{
251 ks8695_wdt_stop();
252}
253
254#ifdef CONFIG_PM
255
256static int ks8695wdt_suspend(struct platform_device *pdev, pm_message_t message)
257{
258 ks8695_wdt_stop();
259 return 0;
260}
261
262static int ks8695wdt_resume(struct platform_device *pdev)
263{
264 if (ks8695wdt_busy)
265 ks8695_wdt_start();
266 return 0;
267}
268
269#else
270#define ks8695wdt_suspend NULL
271#define ks8695wdt_resume NULL
272#endif
273
274static struct platform_driver ks8695wdt_driver = {
275 .probe = ks8695wdt_probe,
276 .remove = __exit_p(ks8695wdt_remove),
277 .shutdown = ks8695wdt_shutdown,
278 .suspend = ks8695wdt_suspend,
279 .resume = ks8695wdt_resume,
280 .driver = {
281 .name = "ks8695_wdt",
282 .owner = THIS_MODULE,
283 },
284};
285
286static int __init ks8695_wdt_init(void)
287{
288 /* Check that the heartbeat value is within range; if not reset to the default */
289 if (ks8695_wdt_settimeout(wdt_time)) {
290 ks8695_wdt_settimeout(WDT_DEFAULT_TIME);
291 pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n", wdt_time, WDT_MAX_TIME);
292 }
293
294 return platform_driver_register(&ks8695wdt_driver);
295}
296
297static void __exit ks8695_wdt_exit(void)
298{
299 platform_driver_unregister(&ks8695wdt_driver);
300}
301
302module_init(ks8695_wdt_init);
303module_exit(ks8695_wdt_exit);
304
305MODULE_AUTHOR("Andrew Victor");
306MODULE_DESCRIPTION("Watchdog driver for KS8695");
307MODULE_LICENSE("GPL");
308MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/firewire/fw-card.c b/drivers/firewire/fw-card.c
index 636151a64add..9eb1edacd825 100644
--- a/drivers/firewire/fw-card.c
+++ b/drivers/firewire/fw-card.c
@@ -407,11 +407,6 @@ fw_card_add(struct fw_card *card,
407 card->link_speed = link_speed; 407 card->link_speed = link_speed;
408 card->guid = guid; 408 card->guid = guid;
409 409
410 /* Activate link_on bit and contender bit in our self ID packets.*/
411 if (card->driver->update_phy_reg(card, 4, 0,
412 PHY_LINK_ACTIVE | PHY_CONTENDER) < 0)
413 return -EIO;
414
415 /* 410 /*
416 * The subsystem grabs a reference when the card is added and 411 * The subsystem grabs a reference when the card is added and
417 * drops it when the driver calls fw_core_remove_card. 412 * drops it when the driver calls fw_core_remove_card.
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 3ab3585d3601..5d402d63799f 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -677,12 +677,21 @@ static int ioctl_create_iso_context(struct client *client, void *buffer)
677 return 0; 677 return 0;
678} 678}
679 679
680/* Macros for decoding the iso packet control header. */
681#define GET_PAYLOAD_LENGTH(v) ((v) & 0xffff)
682#define GET_INTERRUPT(v) (((v) >> 16) & 0x01)
683#define GET_SKIP(v) (((v) >> 17) & 0x01)
684#define GET_TAG(v) (((v) >> 18) & 0x02)
685#define GET_SY(v) (((v) >> 20) & 0x04)
686#define GET_HEADER_LENGTH(v) (((v) >> 24) & 0xff)
687
680static int ioctl_queue_iso(struct client *client, void *buffer) 688static int ioctl_queue_iso(struct client *client, void *buffer)
681{ 689{
682 struct fw_cdev_queue_iso *request = buffer; 690 struct fw_cdev_queue_iso *request = buffer;
683 struct fw_cdev_iso_packet __user *p, *end, *next; 691 struct fw_cdev_iso_packet __user *p, *end, *next;
684 struct fw_iso_context *ctx = client->iso_context; 692 struct fw_iso_context *ctx = client->iso_context;
685 unsigned long payload, buffer_end, header_length; 693 unsigned long payload, buffer_end, header_length;
694 u32 control;
686 int count; 695 int count;
687 struct { 696 struct {
688 struct fw_iso_packet packet; 697 struct fw_iso_packet packet;
@@ -717,8 +726,14 @@ static int ioctl_queue_iso(struct client *client, void *buffer)
717 end = (void __user *)p + request->size; 726 end = (void __user *)p + request->size;
718 count = 0; 727 count = 0;
719 while (p < end) { 728 while (p < end) {
720 if (__copy_from_user(&u.packet, p, sizeof(*p))) 729 if (get_user(control, &p->control))
721 return -EFAULT; 730 return -EFAULT;
731 u.packet.payload_length = GET_PAYLOAD_LENGTH(control);
732 u.packet.interrupt = GET_INTERRUPT(control);
733 u.packet.skip = GET_SKIP(control);
734 u.packet.tag = GET_TAG(control);
735 u.packet.sy = GET_SY(control);
736 u.packet.header_length = GET_HEADER_LENGTH(control);
722 737
723 if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) { 738 if (ctx->type == FW_ISO_CONTEXT_TRANSMIT) {
724 header_length = u.packet.header_length; 739 header_length = u.packet.header_length;
diff --git a/drivers/firewire/fw-device.h b/drivers/firewire/fw-device.h
index 0ba9d64ccf4c..af1723eae4ba 100644
--- a/drivers/firewire/fw-device.h
+++ b/drivers/firewire/fw-device.h
@@ -99,6 +99,7 @@ fw_unit(struct device *dev)
99#define CSR_DEPENDENT_INFO 0x14 99#define CSR_DEPENDENT_INFO 0x14
100#define CSR_MODEL 0x17 100#define CSR_MODEL 0x17
101#define CSR_INSTANCE 0x18 101#define CSR_INSTANCE 0x18
102#define CSR_DIRECTORY_ID 0x20
102 103
103#define SBP2_COMMAND_SET_SPECIFIER 0x38 104#define SBP2_COMMAND_SET_SPECIFIER 0x38
104#define SBP2_COMMAND_SET 0x39 105#define SBP2_COMMAND_SET 0x39
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 2e4cfa57126d..0d08bf9b78c2 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -417,12 +417,21 @@ ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 regs)
417 ctx->current_buffer = ab.next; 417 ctx->current_buffer = ab.next;
418 ctx->pointer = ctx->current_buffer->data; 418 ctx->pointer = ctx->current_buffer->data;
419 419
420 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), 420 return 0;
421 le32_to_cpu(ab.descriptor.branch_address)); 421}
422
423static void ar_context_run(struct ar_context *ctx)
424{
425 struct ar_buffer *ab = ctx->current_buffer;
426 dma_addr_t ab_bus;
427 size_t offset;
428
429 offset = offsetof(struct ar_buffer, data);
430 ab_bus = ab->descriptor.data_address - offset;
431
432 reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab_bus | 1);
422 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); 433 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN);
423 flush_writes(ctx->ohci); 434 flush_writes(ctx->ohci);
424
425 return 0;
426} 435}
427 436
428static void context_tasklet(unsigned long data) 437static void context_tasklet(unsigned long data)
@@ -1039,11 +1048,78 @@ static irqreturn_t irq_handler(int irq, void *data)
1039 return IRQ_HANDLED; 1048 return IRQ_HANDLED;
1040} 1049}
1041 1050
1051static int software_reset(struct fw_ohci *ohci)
1052{
1053 int i;
1054
1055 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset);
1056
1057 for (i = 0; i < OHCI_LOOP_COUNT; i++) {
1058 if ((reg_read(ohci, OHCI1394_HCControlSet) &
1059 OHCI1394_HCControl_softReset) == 0)
1060 return 0;
1061 msleep(1);
1062 }
1063
1064 return -EBUSY;
1065}
1066
1042static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length) 1067static int ohci_enable(struct fw_card *card, u32 *config_rom, size_t length)
1043{ 1068{
1044 struct fw_ohci *ohci = fw_ohci(card); 1069 struct fw_ohci *ohci = fw_ohci(card);
1045 struct pci_dev *dev = to_pci_dev(card->device); 1070 struct pci_dev *dev = to_pci_dev(card->device);
1046 1071
1072 if (software_reset(ohci)) {
1073 fw_error("Failed to reset ohci card.\n");
1074 return -EBUSY;
1075 }
1076
1077 /*
1078 * Now enable LPS, which we need in order to start accessing
1079 * most of the registers. In fact, on some cards (ALI M5251),
1080 * accessing registers in the SClk domain without LPS enabled
1081 * will lock up the machine. Wait 50msec to make sure we have
1082 * full link enabled.
1083 */
1084 reg_write(ohci, OHCI1394_HCControlSet,
1085 OHCI1394_HCControl_LPS |
1086 OHCI1394_HCControl_postedWriteEnable);
1087 flush_writes(ohci);
1088 msleep(50);
1089
1090 reg_write(ohci, OHCI1394_HCControlClear,
1091 OHCI1394_HCControl_noByteSwapData);
1092
1093 reg_write(ohci, OHCI1394_LinkControlSet,
1094 OHCI1394_LinkControl_rcvSelfID |
1095 OHCI1394_LinkControl_cycleTimerEnable |
1096 OHCI1394_LinkControl_cycleMaster);
1097
1098 reg_write(ohci, OHCI1394_ATRetries,
1099 OHCI1394_MAX_AT_REQ_RETRIES |
1100 (OHCI1394_MAX_AT_RESP_RETRIES << 4) |
1101 (OHCI1394_MAX_PHYS_RESP_RETRIES << 8));
1102
1103 ar_context_run(&ohci->ar_request_ctx);
1104 ar_context_run(&ohci->ar_response_ctx);
1105
1106 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->self_id_bus);
1107 reg_write(ohci, OHCI1394_PhyUpperBound, 0x00010000);
1108 reg_write(ohci, OHCI1394_IntEventClear, ~0);
1109 reg_write(ohci, OHCI1394_IntMaskClear, ~0);
1110 reg_write(ohci, OHCI1394_IntMaskSet,
1111 OHCI1394_selfIDComplete |
1112 OHCI1394_RQPkt | OHCI1394_RSPkt |
1113 OHCI1394_reqTxComplete | OHCI1394_respTxComplete |
1114 OHCI1394_isochRx | OHCI1394_isochTx |
1115 OHCI1394_masterIntEnable |
1116 OHCI1394_cycle64Seconds);
1117
1118 /* Activate link_on bit and contender bit in our self ID packets.*/
1119 if (ohci_update_phy_reg(card, 4, 0,
1120 PHY_LINK_ACTIVE | PHY_CONTENDER) < 0)
1121 return -EIO;
1122
1047 /* 1123 /*
1048 * When the link is not yet enabled, the atomic config rom 1124 * When the link is not yet enabled, the atomic config rom
1049 * update mechanism described below in ohci_set_config_rom() 1125 * update mechanism described below in ohci_set_config_rom()
@@ -1701,22 +1777,6 @@ static const struct fw_card_driver ohci_driver = {
1701 .stop_iso = ohci_stop_iso, 1777 .stop_iso = ohci_stop_iso,
1702}; 1778};
1703 1779
1704static int software_reset(struct fw_ohci *ohci)
1705{
1706 int i;
1707
1708 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset);
1709
1710 for (i = 0; i < OHCI_LOOP_COUNT; i++) {
1711 if ((reg_read(ohci, OHCI1394_HCControlSet) &
1712 OHCI1394_HCControl_softReset) == 0)
1713 return 0;
1714 msleep(1);
1715 }
1716
1717 return -EBUSY;
1718}
1719
1720static int __devinit 1780static int __devinit
1721pci_probe(struct pci_dev *dev, const struct pci_device_id *ent) 1781pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1722{ 1782{
@@ -1762,33 +1822,6 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1762 goto fail_iomem; 1822 goto fail_iomem;
1763 } 1823 }
1764 1824
1765 if (software_reset(ohci)) {
1766 fw_error("Failed to reset ohci card.\n");
1767 err = -EBUSY;
1768 goto fail_registers;
1769 }
1770
1771 /*
1772 * Now enable LPS, which we need in order to start accessing
1773 * most of the registers. In fact, on some cards (ALI M5251),
1774 * accessing registers in the SClk domain without LPS enabled
1775 * will lock up the machine. Wait 50msec to make sure we have
1776 * full link enabled.
1777 */
1778 reg_write(ohci, OHCI1394_HCControlSet,
1779 OHCI1394_HCControl_LPS |
1780 OHCI1394_HCControl_postedWriteEnable);
1781 flush_writes(ohci);
1782 msleep(50);
1783
1784 reg_write(ohci, OHCI1394_HCControlClear,
1785 OHCI1394_HCControl_noByteSwapData);
1786
1787 reg_write(ohci, OHCI1394_LinkControlSet,
1788 OHCI1394_LinkControl_rcvSelfID |
1789 OHCI1394_LinkControl_cycleTimerEnable |
1790 OHCI1394_LinkControl_cycleMaster);
1791
1792 ar_context_init(&ohci->ar_request_ctx, ohci, 1825 ar_context_init(&ohci->ar_request_ctx, ohci,
1793 OHCI1394_AsReqRcvContextControlSet); 1826 OHCI1394_AsReqRcvContextControlSet);
1794 1827
@@ -1801,11 +1834,6 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1801 context_init(&ohci->at_response_ctx, ohci, AT_BUFFER_SIZE, 1834 context_init(&ohci->at_response_ctx, ohci, AT_BUFFER_SIZE,
1802 OHCI1394_AsRspTrContextControlSet, handle_at_packet); 1835 OHCI1394_AsRspTrContextControlSet, handle_at_packet);
1803 1836
1804 reg_write(ohci, OHCI1394_ATRetries,
1805 OHCI1394_MAX_AT_REQ_RETRIES |
1806 (OHCI1394_MAX_AT_RESP_RETRIES << 4) |
1807 (OHCI1394_MAX_PHYS_RESP_RETRIES << 8));
1808
1809 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, ~0); 1837 reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, ~0);
1810 ohci->it_context_mask = reg_read(ohci, OHCI1394_IsoRecvIntMaskSet); 1838 ohci->it_context_mask = reg_read(ohci, OHCI1394_IsoRecvIntMaskSet);
1811 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0); 1839 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0);
@@ -1835,18 +1863,6 @@ pci_probe(struct pci_dev *dev, const struct pci_device_id *ent)
1835 goto fail_registers; 1863 goto fail_registers;
1836 } 1864 }
1837 1865
1838 reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->self_id_bus);
1839 reg_write(ohci, OHCI1394_PhyUpperBound, 0x00010000);
1840 reg_write(ohci, OHCI1394_IntEventClear, ~0);
1841 reg_write(ohci, OHCI1394_IntMaskClear, ~0);
1842 reg_write(ohci, OHCI1394_IntMaskSet,
1843 OHCI1394_selfIDComplete |
1844 OHCI1394_RQPkt | OHCI1394_RSPkt |
1845 OHCI1394_reqTxComplete | OHCI1394_respTxComplete |
1846 OHCI1394_isochRx | OHCI1394_isochTx |
1847 OHCI1394_masterIntEnable |
1848 OHCI1394_cycle64Seconds);
1849
1850 bus_options = reg_read(ohci, OHCI1394_BusOptions); 1866 bus_options = reg_read(ohci, OHCI1394_BusOptions);
1851 max_receive = (bus_options >> 12) & 0xf; 1867 max_receive = (bus_options >> 12) & 0xf;
1852 link_speed = bus_options & 0x7; 1868 link_speed = bus_options & 0x7;
@@ -1908,6 +1924,45 @@ static void pci_remove(struct pci_dev *dev)
1908 fw_notify("Removed fw-ohci device.\n"); 1924 fw_notify("Removed fw-ohci device.\n");
1909} 1925}
1910 1926
1927#ifdef CONFIG_PM
1928static int pci_suspend(struct pci_dev *pdev, pm_message_t state)
1929{
1930 struct fw_ohci *ohci = pci_get_drvdata(pdev);
1931 int err;
1932
1933 software_reset(ohci);
1934 free_irq(pdev->irq, ohci);
1935 err = pci_save_state(pdev);
1936 if (err) {
1937 fw_error("pci_save_state failed with %d", err);
1938 return err;
1939 }
1940 err = pci_set_power_state(pdev, pci_choose_state(pdev, state));
1941 if (err) {
1942 fw_error("pci_set_power_state failed with %d", err);
1943 return err;
1944 }
1945
1946 return 0;
1947}
1948
1949static int pci_resume(struct pci_dev *pdev)
1950{
1951 struct fw_ohci *ohci = pci_get_drvdata(pdev);
1952 int err;
1953
1954 pci_set_power_state(pdev, PCI_D0);
1955 pci_restore_state(pdev);
1956 err = pci_enable_device(pdev);
1957 if (err) {
1958 fw_error("pci_enable_device failed with %d", err);
1959 return err;
1960 }
1961
1962 return ohci_enable(&ohci->card, ohci->config_rom, CONFIG_ROM_SIZE);
1963}
1964#endif
1965
1911static struct pci_device_id pci_table[] = { 1966static struct pci_device_id pci_table[] = {
1912 { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_FIREWIRE_OHCI, ~0) }, 1967 { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_FIREWIRE_OHCI, ~0) },
1913 { } 1968 { }
@@ -1920,6 +1975,10 @@ static struct pci_driver fw_ohci_pci_driver = {
1920 .id_table = pci_table, 1975 .id_table = pci_table,
1921 .probe = pci_probe, 1976 .probe = pci_probe,
1922 .remove = pci_remove, 1977 .remove = pci_remove,
1978#ifdef CONFIG_PM
1979 .resume = pci_resume,
1980 .suspend = pci_suspend,
1981#endif
1923}; 1982};
1924 1983
1925MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); 1984MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 68300414e5f4..a98d3915e26f 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -1108,6 +1108,58 @@ static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
1108 return SUCCESS; 1108 return SUCCESS;
1109} 1109}
1110 1110
1111/*
1112 * Format of /sys/bus/scsi/devices/.../ieee1394_id:
1113 * u64 EUI-64 : u24 directory_ID : u16 LUN (all printed in hexadecimal)
1114 *
1115 * This is the concatenation of target port identifier and logical unit
1116 * identifier as per SAM-2...SAM-4 annex A.
1117 */
1118static ssize_t
1119sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr,
1120 char *buf)
1121{
1122 struct scsi_device *sdev = to_scsi_device(dev);
1123 struct sbp2_device *sd;
1124 struct fw_unit *unit;
1125 struct fw_device *device;
1126 u32 directory_id;
1127 struct fw_csr_iterator ci;
1128 int key, value, lun;
1129
1130 if (!sdev)
1131 return 0;
1132 sd = (struct sbp2_device *)sdev->host->hostdata;
1133 unit = sd->unit;
1134 device = fw_device(unit->device.parent);
1135
1136 /* implicit directory ID */
1137 directory_id = ((unit->directory - device->config_rom) * 4
1138 + CSR_CONFIG_ROM) & 0xffffff;
1139
1140 /* explicit directory ID, overrides implicit ID if present */
1141 fw_csr_iterator_init(&ci, unit->directory);
1142 while (fw_csr_iterator_next(&ci, &key, &value))
1143 if (key == CSR_DIRECTORY_ID) {
1144 directory_id = value;
1145 break;
1146 }
1147
1148 /* FIXME: Make this work for multi-lun devices. */
1149 lun = 0;
1150
1151 return sprintf(buf, "%08x%08x:%06x:%04x\n",
1152 device->config_rom[3], device->config_rom[4],
1153 directory_id, lun);
1154}
1155
1156static DEVICE_ATTR(ieee1394_id, S_IRUGO, sbp2_sysfs_ieee1394_id_show, NULL);
1157
1158static struct device_attribute *sbp2_scsi_sysfs_attrs[] = {
1159 &dev_attr_ieee1394_id,
1160 NULL
1161};
1162
1111static struct scsi_host_template scsi_driver_template = { 1163static struct scsi_host_template scsi_driver_template = {
1112 .module = THIS_MODULE, 1164 .module = THIS_MODULE,
1113 .name = "SBP-2 IEEE-1394", 1165 .name = "SBP-2 IEEE-1394",
@@ -1121,6 +1173,7 @@ static struct scsi_host_template scsi_driver_template = {
1121 .use_clustering = ENABLE_CLUSTERING, 1173 .use_clustering = ENABLE_CLUSTERING,
1122 .cmd_per_lun = 1, 1174 .cmd_per_lun = 1,
1123 .can_queue = 1, 1175 .can_queue = 1,
1176 .sdev_attrs = sbp2_scsi_sysfs_attrs,
1124}; 1177};
1125 1178
1126MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); 1179MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 835937e38529..81b3864d2ba7 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -976,7 +976,8 @@ static struct unit_directory *nodemgr_process_unit_directory
976 976
977 ud->ne = ne; 977 ud->ne = ne;
978 ud->ignore_driver = ignore_drivers; 978 ud->ignore_driver = ignore_drivers;
979 ud->address = ud_kv->offset + CSR1212_CONFIG_ROM_SPACE_BASE; 979 ud->address = ud_kv->offset + CSR1212_REGISTER_SPACE_BASE;
980 ud->directory_id = ud->address & 0xffffff;
980 ud->ud_kv = ud_kv; 981 ud->ud_kv = ud_kv;
981 ud->id = (*id)++; 982 ud->id = (*id)++;
982 983
@@ -1085,6 +1086,10 @@ static struct unit_directory *nodemgr_process_unit_directory
1085 1086
1086 break; 1087 break;
1087 1088
1089 case CSR1212_KV_ID_DIRECTORY_ID:
1090 ud->directory_id = kv->value.immediate;
1091 break;
1092
1088 default: 1093 default:
1089 break; 1094 break;
1090 } 1095 }
diff --git a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h
index e7ac683c72c7..4530b29d941c 100644
--- a/drivers/ieee1394/nodemgr.h
+++ b/drivers/ieee1394/nodemgr.h
@@ -75,6 +75,7 @@ struct unit_directory {
75 struct csr1212_keyval *model_name_kv; 75 struct csr1212_keyval *model_name_kv;
76 quadlet_t specifier_id; 76 quadlet_t specifier_id;
77 quadlet_t version; 77 quadlet_t version;
78 quadlet_t directory_id;
78 79
79 unsigned int id; 80 unsigned int id;
80 81
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 875eadd5e8f5..3f873cc7e247 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -194,6 +194,27 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0"
194 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) 194 ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE)
195 ", or a combination)"); 195 ", or a combination)");
196 196
197/*
198 * This influences the format of the sysfs attribute
199 * /sys/bus/scsi/devices/.../ieee1394_id.
200 *
201 * The default format is like in older kernels: %016Lx:%d:%d
202 * It contains the target's EUI-64, a number given to the logical unit by
203 * the ieee1394 driver's nodemgr (starting at 0), and the LUN.
204 *
205 * The long format is: %016Lx:%06x:%04x
206 * It contains the target's EUI-64, the unit directory's directory_ID as per
207 * IEEE 1212 clause 7.7.19, and the LUN. This format comes closest to the
208 * format of SBP(-3) target port and logical unit identifier as per SAM (SCSI
209 * Architecture Model) rev.2 to 4 annex A. Therefore and because it is
210 * independent of the implementation of the ieee1394 nodemgr, the longer format
211 * is recommended for future use.
212 */
213static int sbp2_long_sysfs_ieee1394_id;
214module_param_named(long_ieee1394_id, sbp2_long_sysfs_ieee1394_id, bool, 0644);
215MODULE_PARM_DESC(long_ieee1394_id, "8+3+2 bytes format of ieee1394_id in sysfs "
216 "(default = backwards-compatible = N, SAM-conforming = Y)");
217
197 218
198#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args) 219#define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args)
199#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) 220#define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args)
@@ -2100,8 +2121,14 @@ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev,
2100 if (!(lu = (struct sbp2_lu *)sdev->host->hostdata[0])) 2121 if (!(lu = (struct sbp2_lu *)sdev->host->hostdata[0]))
2101 return 0; 2122 return 0;
2102 2123
2103 return sprintf(buf, "%016Lx:%d:%d\n", (unsigned long long)lu->ne->guid, 2124 if (sbp2_long_sysfs_ieee1394_id)
2104 lu->ud->id, ORB_SET_LUN(lu->lun)); 2125 return sprintf(buf, "%016Lx:%06x:%04x\n",
2126 (unsigned long long)lu->ne->guid,
2127 lu->ud->directory_id, ORB_SET_LUN(lu->lun));
2128 else
2129 return sprintf(buf, "%016Lx:%d:%d\n",
2130 (unsigned long long)lu->ne->guid,
2131 lu->ud->id, ORB_SET_LUN(lu->lun));
2105} 2132}
2106 2133
2107MODULE_AUTHOR("Ben Collins <bcollins@debian.org>"); 2134MODULE_AUTHOR("Ben Collins <bcollins@debian.org>");
diff --git a/drivers/infiniband/hw/amso1100/c2.c b/drivers/infiniband/hw/amso1100/c2.c
index 58bc272bd407..0aecea67f3e6 100644
--- a/drivers/infiniband/hw/amso1100/c2.c
+++ b/drivers/infiniband/hw/amso1100/c2.c
@@ -672,7 +672,7 @@ static int c2_up(struct net_device *netdev)
672 * rdma interface. 672 * rdma interface.
673 */ 673 */
674 in_dev = in_dev_get(netdev); 674 in_dev = in_dev_get(netdev);
675 in_dev->cnf.arp_ignore = 1; 675 IN_DEV_CONF_SET(in_dev, ARP_IGNORE, 1);
676 in_dev_put(in_dev); 676 in_dev_put(in_dev);
677 677
678 return 0; 678 return 0;
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index b234729706be..be6b93c20f60 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -699,9 +699,9 @@ static void evdev_disconnect(struct input_handle *handle)
699 if (evdev->open) { 699 if (evdev->open) {
700 input_flush_device(handle, NULL); 700 input_flush_device(handle, NULL);
701 input_close_device(handle); 701 input_close_device(handle);
702 wake_up_interruptible(&evdev->wait);
703 list_for_each_entry(client, &evdev->client_list, node) 702 list_for_each_entry(client, &evdev->client_list, node)
704 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 703 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
704 wake_up_interruptible(&evdev->wait);
705 } else 705 } else
706 evdev_free(evdev); 706 evdev_free(evdev);
707} 707}
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 06f0541b24da..10e3b7bc925f 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -594,9 +594,9 @@ static void joydev_disconnect(struct input_handle *handle)
594 594
595 if (joydev->open) { 595 if (joydev->open) {
596 input_close_device(handle); 596 input_close_device(handle);
597 wake_up_interruptible(&joydev->wait);
598 list_for_each_entry(client, &joydev->client_list, node) 597 list_for_each_entry(client, &joydev->client_list, node)
599 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 598 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
599 wake_up_interruptible(&joydev->wait);
600 } else 600 } else
601 joydev_free(joydev); 601 joydev_free(joydev);
602} 602}
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index 86ad1027e12a..b069ee18e353 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -54,7 +54,7 @@ static struct db9_config db9_cfg[DB9_MAX_PORTS] __initdata;
54 54
55module_param_array_named(dev, db9_cfg[0].args, int, &db9_cfg[0].nargs, 0); 55module_param_array_named(dev, db9_cfg[0].args, int, &db9_cfg[0].nargs, 0);
56MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)"); 56MODULE_PARM_DESC(dev, "Describes first attached device (<parport#>,<type>)");
57module_param_array_named(dev2, db9_cfg[1].args, int, &db9_cfg[0].nargs, 0); 57module_param_array_named(dev2, db9_cfg[1].args, int, &db9_cfg[1].nargs, 0);
58MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)"); 58MODULE_PARM_DESC(dev2, "Describes second attached device (<parport#>,<type>)");
59module_param_array_named(dev3, db9_cfg[2].args, int, &db9_cfg[2].nargs, 0); 59module_param_array_named(dev3, db9_cfg[2].args, int, &db9_cfg[2].nargs, 0);
60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)"); 60MODULE_PARM_DESC(dev3, "Describes third attached device (<parport#>,<type>)");
diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c
index 06eaf766d9d2..f9e82c9ca421 100644
--- a/drivers/input/keyboard/pxa27x_keyboard.c
+++ b/drivers/input/keyboard/pxa27x_keyboard.c
@@ -104,7 +104,7 @@ static int pxakbd_open(struct input_dev *dev)
104 KPREC = 0x7F; 104 KPREC = 0x7F;
105 105
106 /* Enable unit clock */ 106 /* Enable unit clock */
107 pxa_set_cken(CKEN19_KEYPAD, 1); 107 pxa_set_cken(CKEN_KEYPAD, 1);
108 108
109 return 0; 109 return 0;
110} 110}
@@ -112,7 +112,7 @@ static int pxakbd_open(struct input_dev *dev)
112static void pxakbd_close(struct input_dev *dev) 112static void pxakbd_close(struct input_dev *dev)
113{ 113{
114 /* Disable clock unit */ 114 /* Disable clock unit */
115 pxa_set_cken(CKEN19_KEYPAD, 0); 115 pxa_set_cken(CKEN_KEYPAD, 0);
116} 116}
117 117
118#ifdef CONFIG_PM 118#ifdef CONFIG_PM
@@ -185,7 +185,7 @@ static int __devinit pxakbd_probe(struct platform_device *pdev)
185 DRIVER_NAME, pdev); 185 DRIVER_NAME, pdev);
186 if (error) { 186 if (error) {
187 printk(KERN_ERR "Cannot request keypad IRQ\n"); 187 printk(KERN_ERR "Cannot request keypad IRQ\n");
188 pxa_set_cken(CKEN19_KEYPAD, 0); 188 pxa_set_cken(CKEN_KEYPAD, 0);
189 goto err_free_dev; 189 goto err_free_dev;
190 } 190 }
191 191
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index eb0167e9f0cb..50e06e8dd05d 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -48,7 +48,7 @@ config MOUSE_PS2_ALPS
48 If unsure, say Y. 48 If unsure, say Y.
49 49
50config MOUSE_PS2_LOGIPS2PP 50config MOUSE_PS2_LOGIPS2PP
51 bool "Logictech PS/2++ mouse protocol extension" if EMBEDDED 51 bool "Logitech PS/2++ mouse protocol extension" if EMBEDDED
52 default y 52 default y
53 depends on MOUSE_PS2 53 depends on MOUSE_PS2
54 help 54 help
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 8675f9509393..3f4866d8d18c 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -766,9 +766,9 @@ static void mousedev_disconnect(struct input_handle *handle)
766 766
767 if (mousedev->open) { 767 if (mousedev->open) {
768 input_close_device(handle); 768 input_close_device(handle);
769 wake_up_interruptible(&mousedev->wait);
770 list_for_each_entry(client, &mousedev->client_list, node) 769 list_for_each_entry(client, &mousedev->client_list, node)
771 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 770 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
771 wake_up_interruptible(&mousedev->wait);
772 } else 772 } else
773 mousedev_free(mousedev); 773 mousedev_free(mousedev);
774} 774}
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index 8238b13874c2..2db364898e15 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -476,9 +476,9 @@ static void tsdev_disconnect(struct input_handle *handle)
476 476
477 if (tsdev->open) { 477 if (tsdev->open) {
478 input_close_device(handle); 478 input_close_device(handle);
479 wake_up_interruptible(&tsdev->wait);
480 list_for_each_entry(client, &tsdev->client_list, node) 479 list_for_each_entry(client, &tsdev->client_list, node)
481 kill_fasync(&client->fasync, SIGIO, POLL_HUP); 480 kill_fasync(&client->fasync, SIGIO, POLL_HUP);
481 wake_up_interruptible(&tsdev->wait);
482 } else 482 } else
483 tsdev_free(tsdev); 483 tsdev_free(tsdev);
484} 484}
diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index d42fe89cddf6..3e088c42b222 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -26,9 +26,9 @@ menu "Old ISDN4Linux"
26 depends on NET && ISDN 26 depends on NET && ISDN
27 27
28config ISDN_I4L 28config ISDN_I4L
29 tristate "Old ISDN4Linux (obsolete)" 29 tristate "Old ISDN4Linux (deprecated)"
30 ---help--- 30 ---help---
31 This driver allows you to use an ISDN-card for networking 31 This driver allows you to use an ISDN adapter for networking
32 connections and as dialin/out device. The isdn-tty's have a built 32 connections and as dialin/out device. The isdn-tty's have a built
33 in AT-compatible modem emulator. Network devices support autodial, 33 in AT-compatible modem emulator. Network devices support autodial,
34 channel-bundling, callback and caller-authentication without having 34 channel-bundling, callback and caller-authentication without having
@@ -39,8 +39,9 @@ config ISDN_I4L
39 39
40 ISDN support in the linux kernel is moving towards a new API, 40 ISDN support in the linux kernel is moving towards a new API,
41 called CAPI (Common ISDN Application Programming Interface). 41 called CAPI (Common ISDN Application Programming Interface).
42 Therefore the old ISDN4Linux layer is becoming obsolete. It is 42 Therefore the old ISDN4Linux layer will eventually become obsolete.
43 still usable, though, if you select this option. 43 It is still available, though, for use with adapters that are not
44 supported by the new CAPI subsystem yet.
44 45
45if ISDN_I4L 46if ISDN_I4L
46source "drivers/isdn/i4l/Kconfig" 47source "drivers/isdn/i4l/Kconfig"
diff --git a/drivers/isdn/hardware/eicon/diva_didd.c b/drivers/isdn/hardware/eicon/diva_didd.c
index 14298b8c835f..d755d904e62c 100644
--- a/drivers/isdn/hardware/eicon/diva_didd.c
+++ b/drivers/isdn/hardware/eicon/diva_didd.c
@@ -99,7 +99,7 @@ static int DIVA_INIT_FUNCTION create_proc(void)
99 return (0); 99 return (0);
100} 100}
101 101
102static void DIVA_EXIT_FUNCTION remove_proc(void) 102static void remove_proc(void)
103{ 103{
104 remove_proc_entry(DRIVERLNAME, proc_net_eicon); 104 remove_proc_entry(DRIVERLNAME, proc_net_eicon);
105 remove_proc_entry("net/eicon", NULL); 105 remove_proc_entry("net/eicon", NULL);
diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
index df61e510a28b..46fc21a3f8ff 100644
--- a/drivers/isdn/hardware/eicon/divasfunc.c
+++ b/drivers/isdn/hardware/eicon/divasfunc.c
@@ -231,7 +231,7 @@ int DIVA_INIT_FUNCTION divasfunc_init(int dbgmask)
231/* 231/*
232 * exit 232 * exit
233 */ 233 */
234void DIVA_EXIT_FUNCTION divasfunc_exit(void) 234void divasfunc_exit(void)
235{ 235{
236 divasa_xdi_driver_unload(); 236 divasa_xdi_driver_unload();
237 disconnect_didd(); 237 disconnect_didd();
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index ea5f30d4a5a2..4e5f87c1e714 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -2693,8 +2693,9 @@ isdn_tty_getdial(char *p, char *q,int cnt)
2693 int limit = ISDN_MSNLEN - 1; /* MUST match the size of interface var to avoid 2693 int limit = ISDN_MSNLEN - 1; /* MUST match the size of interface var to avoid
2694 buffer overflow */ 2694 buffer overflow */
2695 2695
2696 while (strchr(" 0123456789,#.*WPTS-", *p) && *p && --cnt>0) { 2696 while (strchr(" 0123456789,#.*WPTSR-", *p) && *p && --cnt>0) {
2697 if ((*p >= '0' && *p <= '9') || ((*p == 'S') && first) || 2697 if ((*p >= '0' && *p <= '9') || ((*p == 'S') && first) ||
2698 ((*p == 'R') && first) ||
2698 (*p == '*') || (*p == '#')) { 2699 (*p == '*') || (*p == '#')) {
2699 *q++ = *p; 2700 *q++ = *p;
2700 limit--; 2701 limit--;
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index e6e4d240b2a6..184238e2ece4 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -639,7 +639,7 @@ static void free_vmcs(struct vmcs *vmcs)
639 free_pages((unsigned long)vmcs, vmcs_descriptor.order); 639 free_pages((unsigned long)vmcs, vmcs_descriptor.order);
640} 640}
641 641
642static __exit void free_kvm_area(void) 642static void free_kvm_area(void)
643{ 643{
644 int cpu; 644 int cpu;
645 645
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index f44c94abd883..ee699a7d6214 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -114,7 +114,7 @@ config PMAC_SMU
114config PMAC_APM_EMU 114config PMAC_APM_EMU
115 tristate "APM emulation" 115 tristate "APM emulation"
116 select APM_EMULATION 116 select APM_EMULATION
117 depends on ADB_PMU && PM 117 depends on ADB_PMU && PM && PPC32
118 118
119config PMAC_MEDIABAY 119config PMAC_MEDIABAY
120 bool "Support PowerBook hotswap media bay" 120 bool "Support PowerBook hotswap media bay"
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index 7772bd1d92b4..38e815a2e871 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -291,7 +291,7 @@ static void ucb1x00_ts_irq(int idx, void *id)
291 291
292static int ucb1x00_ts_open(struct input_dev *idev) 292static int ucb1x00_ts_open(struct input_dev *idev)
293{ 293{
294 struct ucb1x00_ts *ts = idev->private; 294 struct ucb1x00_ts *ts = input_get_drvdata(idev);
295 int ret = 0; 295 int ret = 0;
296 296
297 BUG_ON(ts->rtask); 297 BUG_ON(ts->rtask);
@@ -328,7 +328,7 @@ static int ucb1x00_ts_open(struct input_dev *idev)
328 */ 328 */
329static void ucb1x00_ts_close(struct input_dev *idev) 329static void ucb1x00_ts_close(struct input_dev *idev)
330{ 330{
331 struct ucb1x00_ts *ts = idev->private; 331 struct ucb1x00_ts *ts = input_get_drvdata(idev);
332 332
333 if (ts->rtask) 333 if (ts->rtask)
334 kthread_stop(ts->rtask); 334 kthread_stop(ts->rtask);
@@ -380,7 +380,6 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
380 ts->idev = idev; 380 ts->idev = idev;
381 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 381 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
382 382
383 idev->private = ts;
384 idev->name = "Touchscreen panel"; 383 idev->name = "Touchscreen panel";
385 idev->id.product = ts->ucb->id; 384 idev->id.product = ts->ucb->id;
386 idev->open = ucb1x00_ts_open; 385 idev->open = ucb1x00_ts_open;
@@ -391,6 +390,8 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
391 __set_bit(ABS_Y, idev->absbit); 390 __set_bit(ABS_Y, idev->absbit);
392 __set_bit(ABS_PRESSURE, idev->absbit); 391 __set_bit(ABS_PRESSURE, idev->absbit);
393 392
393 input_set_drvdata(idev, ts);
394
394 err = input_register_device(idev); 395 err = input_register_device(idev);
395 if (err) 396 if (err)
396 goto fail; 397 goto fail;
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 6c36a55cb3d1..95c0b96e83f2 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -740,7 +740,7 @@ static ssize_t hotkey_enable_store(struct device *dev,
740} 740}
741 741
742static struct device_attribute dev_attr_hotkey_enable = 742static struct device_attribute dev_attr_hotkey_enable =
743 __ATTR(enable, S_IWUSR | S_IRUGO, 743 __ATTR(hotkey_enable, S_IWUSR | S_IRUGO,
744 hotkey_enable_show, hotkey_enable_store); 744 hotkey_enable_show, hotkey_enable_store);
745 745
746/* sysfs hotkey mask --------------------------------------------------- */ 746/* sysfs hotkey mask --------------------------------------------------- */
@@ -775,7 +775,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
775} 775}
776 776
777static struct device_attribute dev_attr_hotkey_mask = 777static struct device_attribute dev_attr_hotkey_mask =
778 __ATTR(mask, S_IWUSR | S_IRUGO, 778 __ATTR(hotkey_mask, S_IWUSR | S_IRUGO,
779 hotkey_mask_show, hotkey_mask_store); 779 hotkey_mask_show, hotkey_mask_store);
780 780
781/* sysfs hotkey bios_enabled ------------------------------------------- */ 781/* sysfs hotkey bios_enabled ------------------------------------------- */
@@ -787,7 +787,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
787} 787}
788 788
789static struct device_attribute dev_attr_hotkey_bios_enabled = 789static struct device_attribute dev_attr_hotkey_bios_enabled =
790 __ATTR(bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL); 790 __ATTR(hotkey_bios_enabled, S_IRUGO, hotkey_bios_enabled_show, NULL);
791 791
792/* sysfs hotkey bios_mask ---------------------------------------------- */ 792/* sysfs hotkey bios_mask ---------------------------------------------- */
793static ssize_t hotkey_bios_mask_show(struct device *dev, 793static ssize_t hotkey_bios_mask_show(struct device *dev,
@@ -798,7 +798,7 @@ static ssize_t hotkey_bios_mask_show(struct device *dev,
798} 798}
799 799
800static struct device_attribute dev_attr_hotkey_bios_mask = 800static struct device_attribute dev_attr_hotkey_bios_mask =
801 __ATTR(bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL); 801 __ATTR(hotkey_bios_mask, S_IRUGO, hotkey_bios_mask_show, NULL);
802 802
803/* --------------------------------------------------------------------- */ 803/* --------------------------------------------------------------------- */
804 804
@@ -824,8 +824,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
824 str_supported(tp_features.hotkey)); 824 str_supported(tp_features.hotkey));
825 825
826 if (tp_features.hotkey) { 826 if (tp_features.hotkey) {
827 hotkey_dev_attributes = create_attr_set(4, 827 hotkey_dev_attributes = create_attr_set(4, NULL);
828 TPACPI_HOTKEY_SYSFS_GROUP);
829 if (!hotkey_dev_attributes) 828 if (!hotkey_dev_attributes)
830 return -ENOMEM; 829 return -ENOMEM;
831 res = add_to_attr_set(hotkey_dev_attributes, 830 res = add_to_attr_set(hotkey_dev_attributes,
@@ -1050,7 +1049,7 @@ static ssize_t bluetooth_enable_store(struct device *dev,
1050} 1049}
1051 1050
1052static struct device_attribute dev_attr_bluetooth_enable = 1051static struct device_attribute dev_attr_bluetooth_enable =
1053 __ATTR(enable, S_IWUSR | S_IRUGO, 1052 __ATTR(bluetooth_enable, S_IWUSR | S_IRUGO,
1054 bluetooth_enable_show, bluetooth_enable_store); 1053 bluetooth_enable_show, bluetooth_enable_store);
1055 1054
1056/* --------------------------------------------------------------------- */ 1055/* --------------------------------------------------------------------- */
@@ -1061,7 +1060,6 @@ static struct attribute *bluetooth_attributes[] = {
1061}; 1060};
1062 1061
1063static const struct attribute_group bluetooth_attr_group = { 1062static const struct attribute_group bluetooth_attr_group = {
1064 .name = TPACPI_BLUETH_SYSFS_GROUP,
1065 .attrs = bluetooth_attributes, 1063 .attrs = bluetooth_attributes,
1066}; 1064};
1067 1065
@@ -1215,7 +1213,7 @@ static ssize_t wan_enable_store(struct device *dev,
1215} 1213}
1216 1214
1217static struct device_attribute dev_attr_wan_enable = 1215static struct device_attribute dev_attr_wan_enable =
1218 __ATTR(enable, S_IWUSR | S_IRUGO, 1216 __ATTR(wwan_enable, S_IWUSR | S_IRUGO,
1219 wan_enable_show, wan_enable_store); 1217 wan_enable_show, wan_enable_store);
1220 1218
1221/* --------------------------------------------------------------------- */ 1219/* --------------------------------------------------------------------- */
@@ -1226,7 +1224,6 @@ static struct attribute *wan_attributes[] = {
1226}; 1224};
1227 1225
1228static const struct attribute_group wan_attr_group = { 1226static const struct attribute_group wan_attr_group = {
1229 .name = TPACPI_WAN_SYSFS_GROUP,
1230 .attrs = wan_attributes, 1227 .attrs = wan_attributes,
1231}; 1228};
1232 1229
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index 440145a02617..72d62f2dabb9 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -278,8 +278,6 @@ static int beep_write(char *buf);
278 * Bluetooth subdriver 278 * Bluetooth subdriver
279 */ 279 */
280 280
281#define TPACPI_BLUETH_SYSFS_GROUP "bluetooth"
282
283enum { 281enum {
284 /* ACPI GBDC/SBDC bits */ 282 /* ACPI GBDC/SBDC bits */
285 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */ 283 TP_ACPI_BLUETOOTH_HWPRESENT = 0x01, /* Bluetooth hw available */
@@ -416,8 +414,6 @@ static int fan_write_cmd_watchdog(const char *cmd, int *rc);
416 * Hotkey subdriver 414 * Hotkey subdriver
417 */ 415 */
418 416
419#define TPACPI_HOTKEY_SYSFS_GROUP "hotkey"
420
421static int hotkey_orig_status; 417static int hotkey_orig_status;
422static int hotkey_orig_mask; 418static int hotkey_orig_mask;
423 419
@@ -553,8 +549,6 @@ static int volume_write(char *buf);
553 * Wan subdriver 549 * Wan subdriver
554 */ 550 */
555 551
556#define TPACPI_WAN_SYSFS_GROUP "wwan"
557
558enum { 552enum {
559 /* ACPI GWAN/SWAN bits */ 553 /* ACPI GWAN/SWAN bits */
560 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */ 554 TP_ACPI_WANCARD_HWPRESENT = 0x01, /* Wan hw available */
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index c08ad8f823d2..2d1b3df95c5b 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -343,7 +343,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
343 if (!fm->addr) 343 if (!fm->addr)
344 goto err_out_free; 344 goto err_out_free;
345 345
346 rc = request_irq(dev->irq, tifm_7xx1_isr, SA_SHIRQ, DRIVER_NAME, fm); 346 rc = request_irq(dev->irq, tifm_7xx1_isr, IRQF_SHARED, DRIVER_NAME, fm);
347 if (rc) 347 if (rc)
348 goto err_out_unmap; 348 goto err_out_unmap;
349 349
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 92055405cb30..451adcc52b3c 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -1,10 +1,9 @@
1# 1#
2# Makefile for the memory technology device drivers. 2# Makefile for the memory technology device drivers.
3# 3#
4# $Id: Makefile.common,v 1.7 2005/07/11 10:39:27 gleixner Exp $
5 4
6# Core functionality. 5# Core functionality.
7mtd-y := mtdcore.o 6mtd-y := mtdcore.o mtdsuper.o
8mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o 7mtd-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
9obj-$(CONFIG_MTD) += $(mtd-y) 8obj-$(CONFIG_MTD) += $(mtd-y)
10 9
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
index a4873ab84e6b..e8f686f7a357 100644
--- a/drivers/mtd/devices/pmc551.c
+++ b/drivers/mtd/devices/pmc551.c
@@ -650,7 +650,7 @@ MODULE_DESCRIPTION(PMC551_VERSION);
650 */ 650 */
651static int msize = 0; 651static int msize = 0;
652#if defined(CONFIG_MTD_PMC551_APERTURE_SIZE) 652#if defined(CONFIG_MTD_PMC551_APERTURE_SIZE)
653static int asize = CONFIG_MTD_PMC551_APERTURE_SIZE 653static int asize = CONFIG_MTD_PMC551_APERTURE_SIZE;
654#else 654#else
655static int asize = 0; 655static int asize = 0;
656#endif 656#endif
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 389fea28b9a6..14ffb1a9302a 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/major.h> 18#include <linux/major.h>
19#include <linux/root_dev.h>
20#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h> 20#include <linux/mtd/map.h>
22#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
@@ -89,10 +88,6 @@ int __init uclinux_mtd_init(void)
89 uclinux_ram_mtdinfo = mtd; 88 uclinux_ram_mtdinfo = mtd;
90 add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS); 89 add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS);
91 90
92 printk("uclinux[mtd]: set %s to be root filesystem\n",
93 uclinux_romfs[0].name);
94 ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0);
95
96 return(0); 91 return(0);
97} 92}
98 93
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
new file mode 100644
index 000000000000..aca331971201
--- /dev/null
+++ b/drivers/mtd/mtdsuper.c
@@ -0,0 +1,232 @@
1/* MTD-based superblock management
2 *
3 * Copyright © 2001-2007 Red Hat, Inc. All Rights Reserved.
4 * Written by: David Howells <dhowells@redhat.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/mtd/super.h>
14#include <linux/namei.h>
15#include <linux/ctype.h>
16
17/*
18 * compare superblocks to see if they're equivalent
19 * - they are if the underlying MTD device is the same
20 */
21static int get_sb_mtd_compare(struct super_block *sb, void *_mtd)
22{
23 struct mtd_info *mtd = _mtd;
24
25 if (sb->s_mtd == mtd) {
26 DEBUG(2, "MTDSB: Match on device %d (\"%s\")\n",
27 mtd->index, mtd->name);
28 return 1;
29 }
30
31 DEBUG(2, "MTDSB: No match, device %d (\"%s\"), device %d (\"%s\")\n",
32 sb->s_mtd->index, sb->s_mtd->name, mtd->index, mtd->name);
33 return 0;
34}
35
36/*
37 * mark the superblock by the MTD device it is using
38 * - set the device number to be the correct MTD block device for pesuperstence
39 * of NFS exports
40 */
41static int get_sb_mtd_set(struct super_block *sb, void *_mtd)
42{
43 struct mtd_info *mtd = _mtd;
44
45 sb->s_mtd = mtd;
46 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
47 return 0;
48}
49
50/*
51 * get a superblock on an MTD-backed filesystem
52 */
53static int get_sb_mtd_aux(struct file_system_type *fs_type, int flags,
54 const char *dev_name, void *data,
55 struct mtd_info *mtd,
56 int (*fill_super)(struct super_block *, void *, int),
57 struct vfsmount *mnt)
58{
59 struct super_block *sb;
60 int ret;
61
62 sb = sget(fs_type, get_sb_mtd_compare, get_sb_mtd_set, mtd);
63 if (IS_ERR(sb))
64 goto out_error;
65
66 if (sb->s_root)
67 goto already_mounted;
68
69 /* fresh new superblock */
70 DEBUG(1, "MTDSB: New superblock for device %d (\"%s\")\n",
71 mtd->index, mtd->name);
72
73 ret = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
74 if (ret < 0) {
75 up_write(&sb->s_umount);
76 deactivate_super(sb);
77 return ret;
78 }
79
80 /* go */
81 sb->s_flags |= MS_ACTIVE;
82 return simple_set_mnt(mnt, sb);
83
84 /* new mountpoint for an already mounted superblock */
85already_mounted:
86 DEBUG(1, "MTDSB: Device %d (\"%s\") is already mounted\n",
87 mtd->index, mtd->name);
88 ret = simple_set_mnt(mnt, sb);
89 goto out_put;
90
91out_error:
92 ret = PTR_ERR(sb);
93out_put:
94 put_mtd_device(mtd);
95 return ret;
96}
97
98/*
99 * get a superblock on an MTD-backed filesystem by MTD device number
100 */
101static int get_sb_mtd_nr(struct file_system_type *fs_type, int flags,
102 const char *dev_name, void *data, int mtdnr,
103 int (*fill_super)(struct super_block *, void *, int),
104 struct vfsmount *mnt)
105{
106 struct mtd_info *mtd;
107
108 mtd = get_mtd_device(NULL, mtdnr);
109 if (IS_ERR(mtd)) {
110 DEBUG(0, "MTDSB: Device #%u doesn't appear to exist\n", mtdnr);
111 return PTR_ERR(mtd);
112 }
113
114 return get_sb_mtd_aux(fs_type, flags, dev_name, data, mtd, fill_super,
115 mnt);
116}
117
118/*
119 * set up an MTD-based superblock
120 */
121int get_sb_mtd(struct file_system_type *fs_type, int flags,
122 const char *dev_name, void *data,
123 int (*fill_super)(struct super_block *, void *, int),
124 struct vfsmount *mnt)
125{
126 struct nameidata nd;
127 int mtdnr, ret;
128
129 if (!dev_name)
130 return -EINVAL;
131
132 DEBUG(2, "MTDSB: dev_name \"%s\"\n", dev_name);
133
134 /* the preferred way of mounting in future; especially when
135 * CONFIG_BLOCK=n - we specify the underlying MTD device by number or
136 * by name, so that we don't require block device support to be present
137 * in the kernel. */
138 if (dev_name[0] == 'm' && dev_name[1] == 't' && dev_name[2] == 'd') {
139 if (dev_name[3] == ':') {
140 struct mtd_info *mtd;
141
142 /* mount by MTD device name */
143 DEBUG(1, "MTDSB: mtd:%%s, name \"%s\"\n",
144 dev_name + 4);
145
146 for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
147 mtd = get_mtd_device(NULL, mtdnr);
148 if (!IS_ERR(mtd)) {
149 if (!strcmp(mtd->name, dev_name + 4))
150 return get_sb_mtd_aux(
151 fs_type, flags,
152 dev_name, data, mtd,
153 fill_super, mnt);
154
155 put_mtd_device(mtd);
156 }
157 }
158
159 printk(KERN_NOTICE "MTD:"
160 " MTD device with name \"%s\" not found.\n",
161 dev_name + 4);
162
163 } else if (isdigit(dev_name[3])) {
164 /* mount by MTD device number name */
165 char *endptr;
166
167 mtdnr = simple_strtoul(dev_name + 3, &endptr, 0);
168 if (!*endptr) {
169 /* It was a valid number */
170 DEBUG(1, "MTDSB: mtd%%d, mtdnr %d\n",
171 mtdnr);
172 return get_sb_mtd_nr(fs_type, flags,
173 dev_name, data,
174 mtdnr, fill_super, mnt);
175 }
176 }
177 }
178
179 /* try the old way - the hack where we allowed users to mount
180 * /dev/mtdblock$(n) but didn't actually _use_ the blockdev
181 */
182 ret = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
183
184 DEBUG(1, "MTDSB: path_lookup() returned %d, inode %p\n",
185 ret, nd.dentry ? nd.dentry->d_inode : NULL);
186
187 if (ret)
188 return ret;
189
190 ret = -EINVAL;
191
192 if (!S_ISBLK(nd.dentry->d_inode->i_mode))
193 goto out;
194
195 if (nd.mnt->mnt_flags & MNT_NODEV) {
196 ret = -EACCES;
197 goto out;
198 }
199
200 if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR)
201 goto not_an_MTD_device;
202
203 mtdnr = iminor(nd.dentry->d_inode);
204 path_release(&nd);
205
206 return get_sb_mtd_nr(fs_type, flags, dev_name, data, mtdnr, fill_super,
207 mnt);
208
209not_an_MTD_device:
210 if (!(flags & MS_SILENT))
211 printk(KERN_NOTICE
212 "MTD: Attempt to mount non-MTD device \"%s\"\n",
213 dev_name);
214out:
215 path_release(&nd);
216 return ret;
217
218}
219
220EXPORT_SYMBOL_GPL(get_sb_mtd);
221
222/*
223 * destroy an MTD-based superblock
224 */
225void kill_mtd_super(struct super_block *sb)
226{
227 generic_shutdown_super(sb);
228 put_mtd_device(sb->s_mtd);
229 sb->s_mtd = NULL;
230}
231
232EXPORT_SYMBOL_GPL(kill_mtd_super);
diff --git a/drivers/mtd/nand/autcpu12.c b/drivers/mtd/nand/autcpu12.c
index fe94ae9ae1f2..e3744eb8eccb 100644
--- a/drivers/mtd/nand/autcpu12.c
+++ b/drivers/mtd/nand/autcpu12.c
@@ -101,7 +101,7 @@ static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd,
101 struct nand_chip *chip = mtd->priv; 101 struct nand_chip *chip = mtd->priv;
102 102
103 if (ctrl & NAND_CTRL_CHANGE) { 103 if (ctrl & NAND_CTRL_CHANGE) {
104 void __iomem *addr 104 void __iomem *addr;
105 unsigned char bits; 105 unsigned char bits;
106 106
107 addr = CS89712_VIRT_BASE + AUTCPU12_SMC_PORT_OFFSET; 107 addr = CS89712_VIRT_BASE + AUTCPU12_SMC_PORT_OFFSET;
diff --git a/drivers/mtd/nand/ppchameleonevb.c b/drivers/mtd/nand/ppchameleonevb.c
index eb7d4d443deb..082073acf20f 100644
--- a/drivers/mtd/nand/ppchameleonevb.c
+++ b/drivers/mtd/nand/ppchameleonevb.c
@@ -81,7 +81,7 @@ __setup("ppchameleonevb_fio_pbase=", ppchameleonevb_fio_pbase);
81 */ 81 */
82static struct mtd_partition partition_info_hi[] = { 82static struct mtd_partition partition_info_hi[] = {
83 { .name = "PPChameleon HI Nand Flash", 83 { .name = "PPChameleon HI Nand Flash",
84 offset = 0, 84 .offset = 0,
85 .size = 128 * 1024 * 1024 85 .size = 128 * 1024 * 1024
86 } 86 }
87}; 87};
@@ -424,9 +424,9 @@ static void __exit ppchameleonevb_cleanup(void)
424 424
425 /* Release iomaps */ 425 /* Release iomaps */
426 this = (struct nand_chip *) &ppchameleon_mtd[1]; 426 this = (struct nand_chip *) &ppchameleon_mtd[1];
427 iounmap((void *) this->IO_ADDR_R; 427 iounmap((void *) this->IO_ADDR_R);
428 this = (struct nand_chip *) &ppchameleonevb_mtd[1]; 428 this = (struct nand_chip *) &ppchameleonevb_mtd[1];
429 iounmap((void *) this->IO_ADDR_R; 429 iounmap((void *) this->IO_ADDR_R);
430 430
431 /* Free the MTD device structure */ 431 /* Free the MTD device structure */
432 kfree (ppchameleon_mtd); 432 kfree (ppchameleon_mtd);
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index e8c9f27817b0..a804965e6542 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -435,20 +435,12 @@ static void cp_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
435 435
436 spin_lock_irqsave(&cp->lock, flags); 436 spin_lock_irqsave(&cp->lock, flags);
437 cp->vlgrp = grp; 437 cp->vlgrp = grp;
438 cp->cpcmd |= RxVlanOn; 438 if (grp)
439 cpw16(CpCmd, cp->cpcmd); 439 cp->cpcmd |= RxVlanOn;
440 spin_unlock_irqrestore(&cp->lock, flags); 440 else
441} 441 cp->cpcmd &= ~RxVlanOn;
442
443static void cp_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
444{
445 struct cp_private *cp = netdev_priv(dev);
446 unsigned long flags;
447 442
448 spin_lock_irqsave(&cp->lock, flags);
449 cp->cpcmd &= ~RxVlanOn;
450 cpw16(CpCmd, cp->cpcmd); 443 cpw16(CpCmd, cp->cpcmd);
451 vlan_group_set_device(cp->vlgrp, vid, NULL);
452 spin_unlock_irqrestore(&cp->lock, flags); 444 spin_unlock_irqrestore(&cp->lock, flags);
453} 445}
454#endif /* CP_VLAN_TAG_USED */ 446#endif /* CP_VLAN_TAG_USED */
@@ -1944,7 +1936,6 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1944#if CP_VLAN_TAG_USED 1936#if CP_VLAN_TAG_USED
1945 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1937 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1946 dev->vlan_rx_register = cp_vlan_rx_register; 1938 dev->vlan_rx_register = cp_vlan_rx_register;
1947 dev->vlan_rx_kill_vid = cp_vlan_rx_kill_vid;
1948#endif 1939#endif
1949 1940
1950 if (pci_using_dac) 1941 if (pci_using_dac)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 1798a9f9fb25..7d57f4a25dc1 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2280,6 +2280,7 @@ config GFAR_NAPI
2280config UCC_GETH 2280config UCC_GETH
2281 tristate "Freescale QE Gigabit Ethernet" 2281 tristate "Freescale QE Gigabit Ethernet"
2282 depends on QUICC_ENGINE 2282 depends on QUICC_ENGINE
2283 select PHYLIB
2283 help 2284 help
2284 This driver supports the Gigabit Ethernet mode of the QUICC Engine, 2285 This driver supports the Gigabit Ethernet mode of the QUICC Engine,
2285 which is available on some Freescale SOCs. 2286 which is available on some Freescale SOCs.
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 7122b7ba8d61..04382f979c99 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -480,12 +480,10 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev,
480#if ACENIC_DO_VLAN 480#if ACENIC_DO_VLAN
481 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 481 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
482 dev->vlan_rx_register = ace_vlan_rx_register; 482 dev->vlan_rx_register = ace_vlan_rx_register;
483 dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid;
484#endif 483#endif
485 if (1) { 484
486 dev->tx_timeout = &ace_watchdog; 485 dev->tx_timeout = &ace_watchdog;
487 dev->watchdog_timeo = 5*HZ; 486 dev->watchdog_timeo = 5*HZ;
488 }
489 487
490 dev->open = &ace_open; 488 dev->open = &ace_open;
491 dev->stop = &ace_close; 489 dev->stop = &ace_close;
@@ -2283,19 +2281,6 @@ static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2283 ace_unmask_irq(dev); 2281 ace_unmask_irq(dev);
2284 local_irq_restore(flags); 2282 local_irq_restore(flags);
2285} 2283}
2286
2287
2288static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2289{
2290 struct ace_private *ap = netdev_priv(dev);
2291 unsigned long flags;
2292
2293 local_irq_save(flags);
2294 ace_mask_irq(dev);
2295 vlan_group_set_device(ap->vlgrp, vid, NULL);
2296 ace_unmask_irq(dev);
2297 local_irq_restore(flags);
2298}
2299#endif /* ACENIC_DO_VLAN */ 2284#endif /* ACENIC_DO_VLAN */
2300 2285
2301 2286
diff --git a/drivers/net/acenic.h b/drivers/net/acenic.h
index 8ca8534d70bf..60ed1837fa8f 100644
--- a/drivers/net/acenic.h
+++ b/drivers/net/acenic.h
@@ -787,7 +787,6 @@ static struct net_device_stats *ace_get_stats(struct net_device *dev);
787static int read_eeprom_byte(struct net_device *dev, unsigned long offset); 787static int read_eeprom_byte(struct net_device *dev, unsigned long offset);
788#if ACENIC_DO_VLAN 788#if ACENIC_DO_VLAN
789static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp); 789static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp);
790static void ace_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid);
791#endif 790#endif
792 791
793#endif /* _ACENIC_H_ */ 792#endif /* _ACENIC_H_ */
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 675fe918421b..a61b2f89fc33 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -155,7 +155,7 @@ This function will write into PHY registers.
155*/ 155*/
156static int amd8111e_write_phy(struct amd8111e_priv* lp,int phy_id, int reg, u32 val) 156static int amd8111e_write_phy(struct amd8111e_priv* lp,int phy_id, int reg, u32 val)
157{ 157{
158 unsigned int repeat = REPEAT_CNT 158 unsigned int repeat = REPEAT_CNT;
159 void __iomem *mmio = lp->mmio; 159 void __iomem *mmio = lp->mmio;
160 unsigned int reg_val; 160 unsigned int reg_val;
161 161
@@ -1728,15 +1728,8 @@ static void amd8111e_vlan_rx_register(struct net_device *dev, struct vlan_group
1728 lp->vlgrp = grp; 1728 lp->vlgrp = grp;
1729 spin_unlock_irq(&lp->lock); 1729 spin_unlock_irq(&lp->lock);
1730} 1730}
1731
1732static void amd8111e_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1733{
1734 struct amd8111e_priv *lp = netdev_priv(dev);
1735 spin_lock_irq(&lp->lock);
1736 vlan_group_set_device(lp->vlgrp, vid, NULL);
1737 spin_unlock_irq(&lp->lock);
1738}
1739#endif 1731#endif
1732
1740static int amd8111e_enable_magicpkt(struct amd8111e_priv* lp) 1733static int amd8111e_enable_magicpkt(struct amd8111e_priv* lp)
1741{ 1734{
1742 writel( VAL1|MPPLBA, lp->mmio + CMD3); 1735 writel( VAL1|MPPLBA, lp->mmio + CMD3);
@@ -1996,7 +1989,6 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
1996#if AMD8111E_VLAN_TAG_USED 1989#if AMD8111E_VLAN_TAG_USED
1997 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ; 1990 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX ;
1998 dev->vlan_rx_register =amd8111e_vlan_rx_register; 1991 dev->vlan_rx_register =amd8111e_vlan_rx_register;
1999 dev->vlan_rx_kill_vid = amd8111e_vlan_rx_kill_vid;
2000#endif 1992#endif
2001 1993
2002 lp = netdev_priv(dev); 1994 lp = netdev_priv(dev);
@@ -2049,7 +2041,6 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
2049#if AMD8111E_VLAN_TAG_USED 2041#if AMD8111E_VLAN_TAG_USED
2050 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2042 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2051 dev->vlan_rx_register =amd8111e_vlan_rx_register; 2043 dev->vlan_rx_register =amd8111e_vlan_rx_register;
2052 dev->vlan_rx_kill_vid = amd8111e_vlan_rx_kill_vid;
2053#endif 2044#endif
2054 /* Probe the external PHY */ 2045 /* Probe the external PHY */
2055 amd8111e_probe_ext_phy(dev); 2046 amd8111e_probe_ext_phy(dev);
diff --git a/drivers/net/amd8111e.h b/drivers/net/amd8111e.h
index 2007510c4eb6..e65080a5994a 100644
--- a/drivers/net/amd8111e.h
+++ b/drivers/net/amd8111e.h
@@ -615,7 +615,7 @@ typedef enum {
615#define SSTATE 2 615#define SSTATE 2
616 616
617/* Assume contoller gets data 10 times the maximum processing time */ 617/* Assume contoller gets data 10 times the maximum processing time */
618#define REPEAT_CNT 10; 618#define REPEAT_CNT 10
619 619
620/* amd8111e decriptor flag definitions */ 620/* amd8111e decriptor flag definitions */
621typedef enum { 621typedef enum {
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 78cf00ff3d38..6862c11ff864 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1229,39 +1229,9 @@ static void atl1_vlan_rx_register(struct net_device *netdev,
1229 spin_unlock_irqrestore(&adapter->lock, flags); 1229 spin_unlock_irqrestore(&adapter->lock, flags);
1230} 1230}
1231 1231
1232/* FIXME: justify or remove -- CHS */
1233static void atl1_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
1234{
1235 /* We don't do Vlan filtering */
1236 return;
1237}
1238
1239/* FIXME: this looks wrong too -- CHS */
1240static void atl1_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
1241{
1242 struct atl1_adapter *adapter = netdev_priv(netdev);
1243 unsigned long flags;
1244
1245 spin_lock_irqsave(&adapter->lock, flags);
1246 /* atl1_irq_disable(adapter); */
1247 vlan_group_set_device(adapter->vlgrp, vid, NULL);
1248 /* atl1_irq_enable(adapter); */
1249 spin_unlock_irqrestore(&adapter->lock, flags);
1250 /* We don't do Vlan filtering */
1251 return;
1252}
1253
1254static void atl1_restore_vlan(struct atl1_adapter *adapter) 1232static void atl1_restore_vlan(struct atl1_adapter *adapter)
1255{ 1233{
1256 atl1_vlan_rx_register(adapter->netdev, adapter->vlgrp); 1234 atl1_vlan_rx_register(adapter->netdev, adapter->vlgrp);
1257 if (adapter->vlgrp) {
1258 u16 vid;
1259 for (vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
1260 if (!vlan_group_get_device(adapter->vlgrp, vid))
1261 continue;
1262 atl1_vlan_rx_add_vid(adapter->netdev, vid);
1263 }
1264 }
1265} 1235}
1266 1236
1267static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring) 1237static u16 tpd_avail(struct atl1_tpd_ring *tpd_ring)
@@ -2203,8 +2173,7 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
2203 netdev->poll_controller = atl1_poll_controller; 2173 netdev->poll_controller = atl1_poll_controller;
2204#endif 2174#endif
2205 netdev->vlan_rx_register = atl1_vlan_rx_register; 2175 netdev->vlan_rx_register = atl1_vlan_rx_register;
2206 netdev->vlan_rx_add_vid = atl1_vlan_rx_add_vid; 2176
2207 netdev->vlan_rx_kill_vid = atl1_vlan_rx_kill_vid;
2208 netdev->ethtool_ops = &atl1_ethtool_ops; 2177 netdev->ethtool_ops = &atl1_ethtool_ops;
2209 adapter->bd_number = cards_found; 2178 adapter->bd_number = cards_found;
2210 adapter->pci_using_64 = pci_using_64; 2179 adapter->pci_using_64 = pci_using_64;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 88b33c6ddda8..ce3ed67a878e 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -54,8 +54,8 @@
54 54
55#define DRV_MODULE_NAME "bnx2" 55#define DRV_MODULE_NAME "bnx2"
56#define PFX DRV_MODULE_NAME ": " 56#define PFX DRV_MODULE_NAME ": "
57#define DRV_MODULE_VERSION "1.5.10" 57#define DRV_MODULE_VERSION "1.5.11"
58#define DRV_MODULE_RELDATE "May 1, 2007" 58#define DRV_MODULE_RELDATE "June 4, 2007"
59 59
60#define RUN_AT(x) (jiffies + (x)) 60#define RUN_AT(x) (jiffies + (x))
61 61
@@ -1778,6 +1778,15 @@ bnx2_init_5709_context(struct bnx2 *bp)
1778 val = BNX2_CTX_COMMAND_ENABLED | BNX2_CTX_COMMAND_MEM_INIT | (1 << 12); 1778 val = BNX2_CTX_COMMAND_ENABLED | BNX2_CTX_COMMAND_MEM_INIT | (1 << 12);
1779 val |= (BCM_PAGE_BITS - 8) << 16; 1779 val |= (BCM_PAGE_BITS - 8) << 16;
1780 REG_WR(bp, BNX2_CTX_COMMAND, val); 1780 REG_WR(bp, BNX2_CTX_COMMAND, val);
1781 for (i = 0; i < 10; i++) {
1782 val = REG_RD(bp, BNX2_CTX_COMMAND);
1783 if (!(val & BNX2_CTX_COMMAND_MEM_INIT))
1784 break;
1785 udelay(2);
1786 }
1787 if (val & BNX2_CTX_COMMAND_MEM_INIT)
1788 return -EBUSY;
1789
1781 for (i = 0; i < bp->ctx_pages; i++) { 1790 for (i = 0; i < bp->ctx_pages; i++) {
1782 int j; 1791 int j;
1783 1792
@@ -1811,6 +1820,7 @@ bnx2_init_context(struct bnx2 *bp)
1811 vcid = 96; 1820 vcid = 96;
1812 while (vcid) { 1821 while (vcid) {
1813 u32 vcid_addr, pcid_addr, offset; 1822 u32 vcid_addr, pcid_addr, offset;
1823 int i;
1814 1824
1815 vcid--; 1825 vcid--;
1816 1826
@@ -1831,16 +1841,20 @@ bnx2_init_context(struct bnx2 *bp)
1831 pcid_addr = vcid_addr; 1841 pcid_addr = vcid_addr;
1832 } 1842 }
1833 1843
1834 REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00); 1844 for (i = 0; i < (CTX_SIZE / PHY_CTX_SIZE); i++) {
1835 REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); 1845 vcid_addr += (i << PHY_CTX_SHIFT);
1846 pcid_addr += (i << PHY_CTX_SHIFT);
1836 1847
1837 /* Zero out the context. */ 1848 REG_WR(bp, BNX2_CTX_VIRT_ADDR, 0x00);
1838 for (offset = 0; offset < PHY_CTX_SIZE; offset += 4) { 1849 REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
1839 CTX_WR(bp, 0x00, offset, 0); 1850
1840 } 1851 /* Zero out the context. */
1852 for (offset = 0; offset < PHY_CTX_SIZE; offset += 4)
1853 CTX_WR(bp, 0x00, offset, 0);
1841 1854
1842 REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr); 1855 REG_WR(bp, BNX2_CTX_VIRT_ADDR, vcid_addr);
1843 REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr); 1856 REG_WR(bp, BNX2_CTX_PAGE_TBL, pcid_addr);
1857 }
1844 } 1858 }
1845} 1859}
1846 1860
@@ -3691,9 +3705,11 @@ bnx2_init_chip(struct bnx2 *bp)
3691 3705
3692 /* Initialize context mapping and zero out the quick contexts. The 3706 /* Initialize context mapping and zero out the quick contexts. The
3693 * context block must have already been enabled. */ 3707 * context block must have already been enabled. */
3694 if (CHIP_NUM(bp) == CHIP_NUM_5709) 3708 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
3695 bnx2_init_5709_context(bp); 3709 rc = bnx2_init_5709_context(bp);
3696 else 3710 if (rc)
3711 return rc;
3712 } else
3697 bnx2_init_context(bp); 3713 bnx2_init_context(bp);
3698 3714
3699 if ((rc = bnx2_init_cpus(bp)) != 0) 3715 if ((rc = bnx2_init_cpus(bp)) != 0)
@@ -3772,7 +3788,10 @@ bnx2_init_chip(struct bnx2 *bp)
3772 REG_WR(bp, BNX2_HC_CMD_TICKS, 3788 REG_WR(bp, BNX2_HC_CMD_TICKS,
3773 (bp->cmd_ticks_int << 16) | bp->cmd_ticks); 3789 (bp->cmd_ticks_int << 16) | bp->cmd_ticks);
3774 3790
3775 REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00); 3791 if (CHIP_NUM(bp) == CHIP_NUM_5708)
3792 REG_WR(bp, BNX2_HC_STATS_TICKS, 0);
3793 else
3794 REG_WR(bp, BNX2_HC_STATS_TICKS, bp->stats_ticks & 0xffff00);
3776 REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */ 3795 REG_WR(bp, BNX2_HC_STAT_COLLECT_TICKS, 0xbb8); /* 3ms */
3777 3796
3778 if (CHIP_ID(bp) == CHIP_ID_5706_A1) 3797 if (CHIP_ID(bp) == CHIP_ID_5706_A1)
@@ -3799,6 +3818,11 @@ bnx2_init_chip(struct bnx2 *bp)
3799 /* Initialize the receive filter. */ 3818 /* Initialize the receive filter. */
3800 bnx2_set_rx_mode(bp->dev); 3819 bnx2_set_rx_mode(bp->dev);
3801 3820
3821 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
3822 val = REG_RD(bp, BNX2_MISC_NEW_CORE_CTL);
3823 val |= BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE;
3824 REG_WR(bp, BNX2_MISC_NEW_CORE_CTL, val);
3825 }
3802 rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET, 3826 rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET,
3803 0); 3827 0);
3804 3828
@@ -4620,6 +4644,11 @@ bnx2_timer(unsigned long data)
4620 4644
4621 bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT); 4645 bp->stats_blk->stat_FwRxDrop = REG_RD_IND(bp, BNX2_FW_RX_DROP_COUNT);
4622 4646
4647 /* workaround occasional corrupted counters */
4648 if (CHIP_NUM(bp) == CHIP_NUM_5708 && bp->stats_ticks)
4649 REG_WR(bp, BNX2_HC_COMMAND, bp->hc_cmd |
4650 BNX2_HC_COMMAND_STATS_NOW);
4651
4623 if (bp->phy_flags & PHY_SERDES_FLAG) { 4652 if (bp->phy_flags & PHY_SERDES_FLAG) {
4624 if (CHIP_NUM(bp) == CHIP_NUM_5706) 4653 if (CHIP_NUM(bp) == CHIP_NUM_5706)
4625 bnx2_5706_serdes_timer(bp); 4654 bnx2_5706_serdes_timer(bp);
@@ -4786,19 +4815,6 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
4786 4815
4787 bnx2_netif_start(bp); 4816 bnx2_netif_start(bp);
4788} 4817}
4789
4790/* Called with rtnl_lock */
4791static void
4792bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
4793{
4794 struct bnx2 *bp = netdev_priv(dev);
4795
4796 bnx2_netif_stop(bp);
4797 vlan_group_set_device(bp->vlgrp, vid, NULL);
4798 bnx2_set_rx_mode(dev);
4799
4800 bnx2_netif_start(bp);
4801}
4802#endif 4818#endif
4803 4819
4804/* Called with netif_tx_lock. 4820/* Called with netif_tx_lock.
@@ -5430,6 +5446,10 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
5430 0xff; 5446 0xff;
5431 5447
5432 bp->stats_ticks = coal->stats_block_coalesce_usecs; 5448 bp->stats_ticks = coal->stats_block_coalesce_usecs;
5449 if (CHIP_NUM(bp) == CHIP_NUM_5708) {
5450 if (bp->stats_ticks != 0 && bp->stats_ticks != USEC_PER_SEC)
5451 bp->stats_ticks = USEC_PER_SEC;
5452 }
5433 if (bp->stats_ticks > 0xffff00) bp->stats_ticks = 0xffff00; 5453 if (bp->stats_ticks > 0xffff00) bp->stats_ticks = 0xffff00;
5434 bp->stats_ticks &= 0xffff00; 5454 bp->stats_ticks &= 0xffff00;
5435 5455
@@ -6453,7 +6473,6 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
6453 dev->watchdog_timeo = TX_TIMEOUT; 6473 dev->watchdog_timeo = TX_TIMEOUT;
6454#ifdef BCM_VLAN 6474#ifdef BCM_VLAN
6455 dev->vlan_rx_register = bnx2_vlan_rx_register; 6475 dev->vlan_rx_register = bnx2_vlan_rx_register;
6456 dev->vlan_rx_kill_vid = bnx2_vlan_rx_kill_vid;
6457#endif 6476#endif
6458 dev->poll = bnx2_poll; 6477 dev->poll = bnx2_poll;
6459 dev->ethtool_ops = &bnx2_ethtool_ops; 6478 dev->ethtool_ops = &bnx2_ethtool_ops;
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index bd6288d6350f..49a5de253b17 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -1373,6 +1373,7 @@ struct l2_fhdr {
1373#define BNX2_MISC_NEW_CORE_CTL 0x000008c8 1373#define BNX2_MISC_NEW_CORE_CTL 0x000008c8
1374#define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_SUCCESS (1L<<0) 1374#define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_SUCCESS (1L<<0)
1375#define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_REQ (1L<<1) 1375#define BNX2_MISC_NEW_CORE_CTL_LINK_HOLDOFF_REQ (1L<<1)
1376#define BNX2_MISC_NEW_CORE_CTL_DMA_ENABLE (1L<<16)
1376#define BNX2_MISC_NEW_CORE_CTL_RESERVED_CMN (0x3fffL<<2) 1377#define BNX2_MISC_NEW_CORE_CTL_RESERVED_CMN (0x3fffL<<2)
1377#define BNX2_MISC_NEW_CORE_CTL_RESERVED_TC (0xffffL<<16) 1378#define BNX2_MISC_NEW_CORE_CTL_RESERVED_TC (0xffffL<<16)
1378 1379
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 9fe3a38883ee..59b9943b077d 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4920,7 +4920,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
4920 pci_cmd |= PCI_COMMAND_PARITY; 4920 pci_cmd |= PCI_COMMAND_PARITY;
4921 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); 4921 pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
4922 if (pci_set_mwi(pdev)) 4922 if (pci_set_mwi(pdev))
4923 printk(KERN_WARNING PFX "Could enable MWI for %s\n", 4923 printk(KERN_WARNING PFX "Could not enable MWI for %s\n",
4924 pci_name(pdev)); 4924 pci_name(pdev));
4925 4925
4926 /* 4926 /*
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 125c9b105869..231ce43b97cf 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -883,15 +883,6 @@ static void vlan_rx_register(struct net_device *dev,
883 t1_set_vlan_accel(adapter, grp != NULL); 883 t1_set_vlan_accel(adapter, grp != NULL);
884 spin_unlock_irq(&adapter->async_lock); 884 spin_unlock_irq(&adapter->async_lock);
885} 885}
886
887static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
888{
889 struct adapter *adapter = dev->priv;
890
891 spin_lock_irq(&adapter->async_lock);
892 vlan_group_set_device(adapter->vlan_grp, vid, NULL);
893 spin_unlock_irq(&adapter->async_lock);
894}
895#endif 886#endif
896 887
897#ifdef CONFIG_NET_POLL_CONTROLLER 888#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1099,7 +1090,6 @@ static int __devinit init_one(struct pci_dev *pdev,
1099 netdev->features |= 1090 netdev->features |=
1100 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1091 NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1101 netdev->vlan_rx_register = vlan_rx_register; 1092 netdev->vlan_rx_register = vlan_rx_register;
1102 netdev->vlan_rx_kill_vid = vlan_rx_kill_vid;
1103#endif 1093#endif
1104 1094
1105 /* T204: disable TSO */ 1095 /* T204: disable TSO */
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 67b4b219d927..1b20f4060e2d 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -2067,11 +2067,6 @@ static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
2067 t3_synchronize_rx(adapter, pi); 2067 t3_synchronize_rx(adapter, pi);
2068} 2068}
2069 2069
2070static void vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
2071{
2072 /* nothing */
2073}
2074
2075#ifdef CONFIG_NET_POLL_CONTROLLER 2070#ifdef CONFIG_NET_POLL_CONTROLLER
2076static void cxgb_netpoll(struct net_device *dev) 2071static void cxgb_netpoll(struct net_device *dev)
2077{ 2072{
@@ -2409,7 +2404,6 @@ static int __devinit init_one(struct pci_dev *pdev,
2409 2404
2410 netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2405 netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2411 netdev->vlan_rx_register = vlan_rx_register; 2406 netdev->vlan_rx_register = vlan_rx_register;
2412 netdev->vlan_rx_kill_vid = vlan_rx_kill_vid;
2413 2407
2414 netdev->open = cxgb_open; 2408 netdev->open = cxgb_open;
2415 netdev->stop = cxgb_close; 2409 netdev->stop = cxgb_close;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 9ec35b7a8207..cf8af928a69c 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1142,13 +1142,16 @@ e1000_probe(struct pci_dev *pdev,
1142 !e1000_check_mng_mode(&adapter->hw)) 1142 !e1000_check_mng_mode(&adapter->hw))
1143 e1000_get_hw_control(adapter); 1143 e1000_get_hw_control(adapter);
1144 1144
1145 strcpy(netdev->name, "eth%d");
1146 if ((err = register_netdev(netdev)))
1147 goto err_register;
1148
1149 /* tell the stack to leave us alone until e1000_open() is called */ 1145 /* tell the stack to leave us alone until e1000_open() is called */
1150 netif_carrier_off(netdev); 1146 netif_carrier_off(netdev);
1151 netif_stop_queue(netdev); 1147 netif_stop_queue(netdev);
1148#ifdef CONFIG_E1000_NAPI
1149 netif_poll_disable(netdev);
1150#endif
1151
1152 strcpy(netdev->name, "eth%d");
1153 if ((err = register_netdev(netdev)))
1154 goto err_register;
1152 1155
1153 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n"); 1156 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
1154 1157
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c
index 88efe9731bab..e5502af5b8e2 100644
--- a/drivers/net/fec_8xx/fec_main.c
+++ b/drivers/net/fec_8xx/fec_main.c
@@ -550,7 +550,7 @@ static int fec_enet_rx_common(struct net_device *dev, int *budget)
550 skbn = dev_alloc_skb(pkt_len + 2); 550 skbn = dev_alloc_skb(pkt_len + 2);
551 if (skbn != NULL) { 551 if (skbn != NULL) {
552 skb_reserve(skbn, 2); /* align IP header */ 552 skb_reserve(skbn, 2); /* align IP header */
553 skb_copy_from_linear_data(skb 553 skb_copy_from_linear_data(skb,
554 skbn->data, 554 skbn->data,
555 pkt_len); 555 pkt_len);
556 /* swap */ 556 /* swap */
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 4154fd000746..32788ca40d25 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -4605,12 +4605,7 @@ static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
4605 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl); 4605 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
4606 4606
4607 spin_unlock_irq(&np->lock); 4607 spin_unlock_irq(&np->lock);
4608}; 4608}
4609
4610static void nv_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
4611{
4612 /* nothing to do */
4613};
4614 4609
4615/* The mgmt unit and driver use a semaphore to access the phy during init */ 4610/* The mgmt unit and driver use a semaphore to access the phy during init */
4616static int nv_mgmt_acquire_sema(struct net_device *dev) 4611static int nv_mgmt_acquire_sema(struct net_device *dev)
@@ -4956,7 +4951,6 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
4956 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE; 4951 np->vlanctl_bits = NVREG_VLANCONTROL_ENABLE;
4957 dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX; 4952 dev->features |= NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX;
4958 dev->vlan_rx_register = nv_vlan_rx_register; 4953 dev->vlan_rx_register = nv_vlan_rx_register;
4959 dev->vlan_rx_kill_vid = nv_vlan_rx_kill_vid;
4960 } 4954 }
4961 4955
4962 np->msi_flags = 0; 4956 np->msi_flags = 0;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index f5b3cba23fc5..6822bf14267b 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -140,7 +140,6 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
140static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length); 140static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length);
141static void gfar_vlan_rx_register(struct net_device *netdev, 141static void gfar_vlan_rx_register(struct net_device *netdev,
142 struct vlan_group *grp); 142 struct vlan_group *grp);
143static void gfar_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
144void gfar_halt(struct net_device *dev); 143void gfar_halt(struct net_device *dev);
145void gfar_start(struct net_device *dev); 144void gfar_start(struct net_device *dev);
146static void gfar_clear_exact_match(struct net_device *dev); 145static void gfar_clear_exact_match(struct net_device *dev);
@@ -284,7 +283,6 @@ static int gfar_probe(struct platform_device *pdev)
284 283
285 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) { 284 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
286 dev->vlan_rx_register = gfar_vlan_rx_register; 285 dev->vlan_rx_register = gfar_vlan_rx_register;
287 dev->vlan_rx_kill_vid = gfar_vlan_rx_kill_vid;
288 286
289 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 287 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
290 288
@@ -1133,20 +1131,6 @@ static void gfar_vlan_rx_register(struct net_device *dev,
1133 spin_unlock_irqrestore(&priv->rxlock, flags); 1131 spin_unlock_irqrestore(&priv->rxlock, flags);
1134} 1132}
1135 1133
1136
1137static void gfar_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
1138{
1139 struct gfar_private *priv = netdev_priv(dev);
1140 unsigned long flags;
1141
1142 spin_lock_irqsave(&priv->rxlock, flags);
1143
1144 vlan_group_set_device(priv->vlgrp, vid, NULL);
1145
1146 spin_unlock_irqrestore(&priv->rxlock, flags);
1147}
1148
1149
1150static int gfar_change_mtu(struct net_device *dev, int new_mtu) 1134static int gfar_change_mtu(struct net_device *dev, int new_mtu)
1151{ 1135{
1152 int tempsize, tempval; 1136 int tempsize, tempval;
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 8118a6750b61..8caa591c5649 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -3005,7 +3005,7 @@ static int __init hp100_isa_init(void)
3005 return cards > 0 ? 0 : -ENODEV; 3005 return cards > 0 ? 0 : -ENODEV;
3006} 3006}
3007 3007
3008static void __exit hp100_isa_cleanup(void) 3008static void hp100_isa_cleanup(void)
3009{ 3009{
3010 int i; 3010 int i;
3011 3011
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 5d14be7405a3..b53b7ad999bc 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1472,6 +1472,7 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
1472 .set_sg = ethtool_op_set_sg, 1472 .set_sg = ethtool_op_set_sg,
1473 .get_tso = ethtool_op_get_tso, 1473 .get_tso = ethtool_op_get_tso,
1474 .set_tso = ethtool_op_set_tso, 1474 .set_tso = ethtool_op_set_tso,
1475 .get_link = ethtool_op_get_link,
1475 .get_strings = myri10ge_get_strings, 1476 .get_strings = myri10ge_get_strings,
1476 .get_stats_count = myri10ge_get_stats_count, 1477 .get_stats_count = myri10ge_get_stats_count,
1477 .get_ethtool_stats = myri10ge_get_ethtool_stats, 1478 .get_ethtool_stats = myri10ge_get_ethtool_stats,
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 2c5c6d20e6e9..c61181f23bd5 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -654,8 +654,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
654 if (adapter->portnum == 0) 654 if (adapter->portnum == 0)
655 netxen_free_adapter_offload(adapter); 655 netxen_free_adapter_offload(adapter);
656 656
657 if (adapter->irq)
658 free_irq(adapter->irq, adapter);
659 if(adapter->portnum == 0) { 657 if(adapter->portnum == 0) {
660 /* leave the hw in the same state as reboot */ 658 /* leave the hw in the same state as reboot */
661 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); 659 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 3439f8c649f9..717d8e9b9833 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -506,17 +506,6 @@ static void ns83820_vlan_rx_register(struct net_device *ndev, struct vlan_group
506 spin_unlock(&dev->tx_lock); 506 spin_unlock(&dev->tx_lock);
507 spin_unlock_irq(&dev->misc_lock); 507 spin_unlock_irq(&dev->misc_lock);
508} 508}
509
510static void ns83820_vlan_rx_kill_vid(struct net_device *ndev, unsigned short vid)
511{
512 struct ns83820 *dev = PRIV(ndev);
513
514 spin_lock_irq(&dev->misc_lock);
515 spin_lock(&dev->tx_lock);
516 vlan_group_set_device(dev->vlgrp, vid, NULL);
517 spin_unlock(&dev->tx_lock);
518 spin_unlock_irq(&dev->misc_lock);
519}
520#endif 509#endif
521 510
522/* Packet Receiver 511/* Packet Receiver
@@ -2083,7 +2072,6 @@ static int __devinit ns83820_init_one(struct pci_dev *pci_dev, const struct pci_
2083 /* We also support hardware vlan acceleration */ 2072 /* We also support hardware vlan acceleration */
2084 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 2073 ndev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
2085 ndev->vlan_rx_register = ns83820_vlan_rx_register; 2074 ndev->vlan_rx_register = ns83820_vlan_rx_register;
2086 ndev->vlan_rx_kill_vid = ns83820_vlan_rx_kill_vid;
2087#endif 2075#endif
2088 2076
2089 if (using_dac) { 2077 if (using_dac) {
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index d8766c0e8255..585be044ebbb 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -4044,7 +4044,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev,
4044 if (pci_using_dac) 4044 if (pci_using_dac)
4045 ndev->features |= NETIF_F_HIGHDMA; 4045 ndev->features |= NETIF_F_HIGHDMA;
4046 if (qdev->device_id == QL3032_DEVICE_ID) 4046 if (qdev->device_id == QL3032_DEVICE_ID)
4047 ndev->features |= (NETIF_F_HW_CSUM | NETIF_F_SG); 4047 ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
4048 4048
4049 qdev->mem_map_registers = 4049 qdev->mem_map_registers =
4050 ioremap_nocache(pci_resource_start(pdev, 1), 4050 ioremap_nocache(pci_resource_start(pdev, 1),
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 45876a854f00..5ec7752caa48 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -886,16 +886,6 @@ static void rtl8169_vlan_rx_register(struct net_device *dev,
886 spin_unlock_irqrestore(&tp->lock, flags); 886 spin_unlock_irqrestore(&tp->lock, flags);
887} 887}
888 888
889static void rtl8169_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
890{
891 struct rtl8169_private *tp = netdev_priv(dev);
892 unsigned long flags;
893
894 spin_lock_irqsave(&tp->lock, flags);
895 vlan_group_set_device(tp->vlgrp, vid, NULL);
896 spin_unlock_irqrestore(&tp->lock, flags);
897}
898
899static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc, 889static int rtl8169_rx_vlan_skb(struct rtl8169_private *tp, struct RxDesc *desc,
900 struct sk_buff *skb) 890 struct sk_buff *skb)
901{ 891{
@@ -1671,7 +1661,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1671#ifdef CONFIG_R8169_VLAN 1661#ifdef CONFIG_R8169_VLAN
1672 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 1662 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
1673 dev->vlan_rx_register = rtl8169_vlan_rx_register; 1663 dev->vlan_rx_register = rtl8169_vlan_rx_register;
1674 dev->vlan_rx_kill_vid = rtl8169_vlan_rx_kill_vid;
1675#endif 1664#endif
1676 1665
1677#ifdef CONFIG_NET_POLL_CONTROLLER 1666#ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index e3e6d410d72c..c6ba3dee8ae0 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -340,17 +340,6 @@ static void s2io_vlan_rx_register(struct net_device *dev,
340/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */ 340/* A flag indicating whether 'RX_PA_CFG_STRIP_VLAN_TAG' bit is set or not */
341static int vlan_strip_flag; 341static int vlan_strip_flag;
342 342
343/* Unregister the vlan */
344static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
345{
346 struct s2io_nic *nic = dev->priv;
347 unsigned long flags;
348
349 spin_lock_irqsave(&nic->tx_lock, flags);
350 vlan_group_set_device(nic->vlgrp, vid, NULL);
351 spin_unlock_irqrestore(&nic->tx_lock, flags);
352}
353
354/* 343/*
355 * Constants to be programmed into the Xena's registers, to configure 344 * Constants to be programmed into the Xena's registers, to configure
356 * the XAUI. 345 * the XAUI.
@@ -7412,7 +7401,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
7412 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); 7401 SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
7413 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 7402 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
7414 dev->vlan_rx_register = s2io_vlan_rx_register; 7403 dev->vlan_rx_register = s2io_vlan_rx_register;
7415 dev->vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid;
7416 7404
7417 /* 7405 /*
7418 * will use eth_mac_addr() for dev->set_mac_address 7406 * will use eth_mac_addr() for dev->set_mac_address
diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c
index fe847800acdc..75afc1f07ba0 100644
--- a/drivers/net/skfp/smt.c
+++ b/drivers/net/skfp/smt.c
@@ -1748,7 +1748,7 @@ char *addr_to_string(struct fddi_addr *addr)
1748#endif 1748#endif
1749 1749
1750#ifdef AM29K 1750#ifdef AM29K
1751smt_ifconfig(int argc, char *argv[]) 1751int smt_ifconfig(int argc, char *argv[])
1752{ 1752{
1753 if (argc >= 2 && !strcmp(argv[0],"opt_bypass") && 1753 if (argc >= 2 && !strcmp(argv[0],"opt_bypass") &&
1754 !strcmp(argv[1],"yes")) { 1754 !strcmp(argv[1],"yes")) {
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index adfbe81693a6..fe01b961b597 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1049,26 +1049,22 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
1049 u16 port = sky2->port; 1049 u16 port = sky2->port;
1050 1050
1051 netif_tx_lock_bh(dev); 1051 netif_tx_lock_bh(dev);
1052 netif_poll_disable(sky2->hw->dev[0]);
1052 1053
1053 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_ON);
1054 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_ON);
1055 sky2->vlgrp = grp; 1054 sky2->vlgrp = grp;
1055 if (grp) {
1056 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1057 RX_VLAN_STRIP_ON);
1058 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1059 TX_VLAN_TAG_ON);
1060 } else {
1061 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
1062 RX_VLAN_STRIP_OFF);
1063 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
1064 TX_VLAN_TAG_OFF);
1065 }
1056 1066
1057 netif_tx_unlock_bh(dev); 1067 netif_poll_enable(sky2->hw->dev[0]);
1058}
1059
1060static void sky2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
1061{
1062 struct sky2_port *sky2 = netdev_priv(dev);
1063 struct sky2_hw *hw = sky2->hw;
1064 u16 port = sky2->port;
1065
1066 netif_tx_lock_bh(dev);
1067
1068 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), RX_VLAN_STRIP_OFF);
1069 sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_VLAN_TAG_OFF);
1070 vlan_group_set_device(sky2->vlgrp, vid, NULL);
1071
1072 netif_tx_unlock_bh(dev); 1068 netif_tx_unlock_bh(dev);
1073} 1069}
1074#endif 1070#endif
@@ -3484,7 +3480,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3484#ifdef SKY2_VLAN_TAG_USED 3480#ifdef SKY2_VLAN_TAG_USED
3485 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 3481 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
3486 dev->vlan_rx_register = sky2_vlan_rx_register; 3482 dev->vlan_rx_register = sky2_vlan_rx_register;
3487 dev->vlan_rx_kill_vid = sky2_vlan_rx_kill_vid;
3488#endif 3483#endif
3489 3484
3490 /* read the mac address */ 3485 /* read the mac address */
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 111f23d05764..506bffcbc6dc 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -281,17 +281,14 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
281 281
282#elif defined(CONFIG_SUPERH) 282#elif defined(CONFIG_SUPERH)
283 283
284#if defined(CONFIG_SH_7780_SOLUTION_ENGINE) || defined(CONFIG_SH_7722_SOLUTION_ENGINE) 284#ifdef CONFIG_SOLUTION_ENGINE
285#define SMC_CAN_USE_8BIT 0 285#define SMC_CAN_USE_8BIT 0
286#define SMC_CAN_USE_16BIT 1 286#define SMC_CAN_USE_16BIT 1
287#define SMC_CAN_USE_32BIT 0 287#define SMC_CAN_USE_32BIT 0
288#define SMC_IO_SHIFT 0 288#define SMC_IO_SHIFT 0
289#define SMC_NOWAIT 1 289#define SMC_NOWAIT 1
290 290
291#define SMC_inb(a, r) (inw((a) + ((r)&~1)) >> (8*(r%2)))&0xff
292#define SMC_inw(a, r) inw((a) + (r)) 291#define SMC_inw(a, r) inw((a) + (r))
293#define SMC_outb(v, a, r) outw(((inw((a)+((r)&~1))*(0xff<<8*(r%2)))) | ((v)<<(8*(r&2)))), (a) + ((r)&~1))
294
295#define SMC_outw(v, a, r) outw(v, (a) + (r)) 292#define SMC_outw(v, a, r) outw(v, (a) + (r))
296#define SMC_insw(a, r, p, l) insw((a) + (r), p, l) 293#define SMC_insw(a, r, p, l) insw((a) + (r), p, l)
297#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) 294#define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l)
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index ef84d7c757a0..b47ad1df2e0c 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1191,43 +1191,6 @@ spider_net_poll(struct net_device *netdev, int *budget)
1191} 1191}
1192 1192
1193/** 1193/**
1194 * spider_net_vlan_rx_reg - initializes VLAN structures in the driver and card
1195 * @netdev: interface device structure
1196 * @grp: vlan_group structure that is registered (NULL on destroying interface)
1197 */
1198static void
1199spider_net_vlan_rx_reg(struct net_device *netdev, struct vlan_group *grp)
1200{
1201 /* further enhancement... yet to do */
1202 return;
1203}
1204
1205/**
1206 * spider_net_vlan_rx_add - adds VLAN id to the card filter
1207 * @netdev: interface device structure
1208 * @vid: VLAN id to add
1209 */
1210static void
1211spider_net_vlan_rx_add(struct net_device *netdev, uint16_t vid)
1212{
1213 /* further enhancement... yet to do */
1214 /* add vid to card's VLAN filter table */
1215 return;
1216}
1217
1218/**
1219 * spider_net_vlan_rx_kill - removes VLAN id to the card filter
1220 * @netdev: interface device structure
1221 * @vid: VLAN id to remove
1222 */
1223static void
1224spider_net_vlan_rx_kill(struct net_device *netdev, uint16_t vid)
1225{
1226 /* further enhancement... yet to do */
1227 /* remove vid from card's VLAN filter table */
1228}
1229
1230/**
1231 * spider_net_get_stats - get interface statistics 1194 * spider_net_get_stats - get interface statistics
1232 * @netdev: interface device structure 1195 * @netdev: interface device structure
1233 * 1196 *
@@ -2177,9 +2140,6 @@ spider_net_setup_netdev_ops(struct net_device *netdev)
2177 netdev->poll = &spider_net_poll; 2140 netdev->poll = &spider_net_poll;
2178 netdev->weight = SPIDER_NET_NAPI_WEIGHT; 2141 netdev->weight = SPIDER_NET_NAPI_WEIGHT;
2179 /* HW VLAN */ 2142 /* HW VLAN */
2180 netdev->vlan_rx_register = &spider_net_vlan_rx_reg;
2181 netdev->vlan_rx_add_vid = &spider_net_vlan_rx_add;
2182 netdev->vlan_rx_kill_vid = &spider_net_vlan_rx_kill;
2183#ifdef CONFIG_NET_POLL_CONTROLLER 2143#ifdef CONFIG_NET_POLL_CONTROLLER
2184 /* poll controller */ 2144 /* poll controller */
2185 netdev->poll_controller = &spider_net_poll_controller; 2145 netdev->poll_controller = &spider_net_poll_controller;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 923b9c725cc3..2f3184184ad9 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.76" 67#define DRV_MODULE_VERSION "3.77"
68#define DRV_MODULE_RELDATE "May 5, 2007" 68#define DRV_MODULE_RELDATE "May 31, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -9121,21 +9121,6 @@ static void tg3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
9121 if (netif_running(dev)) 9121 if (netif_running(dev))
9122 tg3_netif_start(tp); 9122 tg3_netif_start(tp);
9123} 9123}
9124
9125static void tg3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
9126{
9127 struct tg3 *tp = netdev_priv(dev);
9128
9129 if (netif_running(dev))
9130 tg3_netif_stop(tp);
9131
9132 tg3_full_lock(tp, 0);
9133 vlan_group_set_device(tp->vlgrp, vid, NULL);
9134 tg3_full_unlock(tp);
9135
9136 if (netif_running(dev))
9137 tg3_netif_start(tp);
9138}
9139#endif 9124#endif
9140 9125
9141static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec) 9126static int tg3_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
@@ -10976,6 +10961,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
10976 * upon subsystem IDs. 10961 * upon subsystem IDs.
10977 */ 10962 */
10978 if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL && 10963 if (tp->pdev->subsystem_vendor == PCI_VENDOR_ID_DELL &&
10964 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701 &&
10979 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) { 10965 !(tp->tg3_flags2 & TG3_FLG2_PHY_SERDES)) {
10980 tp->tg3_flags |= (TG3_FLAG_USE_MI_INTERRUPT | 10966 tp->tg3_flags |= (TG3_FLAG_USE_MI_INTERRUPT |
10981 TG3_FLAG_USE_LINKCHG_REG); 10967 TG3_FLAG_USE_LINKCHG_REG);
@@ -11778,7 +11764,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11778#if TG3_VLAN_TAG_USED 11764#if TG3_VLAN_TAG_USED
11779 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; 11765 dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
11780 dev->vlan_rx_register = tg3_vlan_rx_register; 11766 dev->vlan_rx_register = tg3_vlan_rx_register;
11781 dev->vlan_rx_kill_vid = tg3_vlan_rx_kill_vid;
11782#endif 11767#endif
11783 11768
11784 tp = netdev_priv(dev); 11769 tp = netdev_priv(dev);
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index f72573594121..15b2fb8aa492 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -741,15 +741,6 @@ typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
741 spin_unlock_bh(&tp->state_lock); 741 spin_unlock_bh(&tp->state_lock);
742} 742}
743 743
744static void
745typhoon_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
746{
747 struct typhoon *tp = netdev_priv(dev);
748 spin_lock_bh(&tp->state_lock);
749 vlan_group_set_device(tp->vlgrp, vid, NULL);
750 spin_unlock_bh(&tp->state_lock);
751}
752
753static inline void 744static inline void
754typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing, 745typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
755 u32 ring_dma) 746 u32 ring_dma)
@@ -2542,7 +2533,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2542 dev->get_stats = typhoon_get_stats; 2533 dev->get_stats = typhoon_get_stats;
2543 dev->set_mac_address = typhoon_set_mac_address; 2534 dev->set_mac_address = typhoon_set_mac_address;
2544 dev->vlan_rx_register = typhoon_vlan_rx_register; 2535 dev->vlan_rx_register = typhoon_vlan_rx_register;
2545 dev->vlan_rx_kill_vid = typhoon_vlan_rx_kill_vid; 2536
2546 SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops); 2537 SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops);
2547 2538
2548 /* We can handle scatter gather, up to 16 entries, and 2539 /* We can handle scatter gather, up to 16 entries, and
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d9cbd586ae4b..be1df85e5e2d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -15,10 +15,10 @@
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
17#include <linux/msi.h> 17#include <linux/msi.h>
18#include <linux/smp.h>
18 19
19#include <asm/errno.h> 20#include <asm/errno.h>
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/smp.h>
22 22
23#include "pci.h" 23#include "pci.h"
24#include "msi.h" 24#include "msi.h"
@@ -333,7 +333,7 @@ static int msi_capability_init(struct pci_dev *dev)
333 msi_mask_bits_reg(pos, is_64bit_address(control)), 333 msi_mask_bits_reg(pos, is_64bit_address(control)),
334 maskbits); 334 maskbits);
335 } 335 }
336 list_add(&entry->list, &dev->msi_list); 336 list_add_tail(&entry->list, &dev->msi_list);
337 337
338 /* Configure MSI capability structure */ 338 /* Configure MSI capability structure */
339 ret = arch_setup_msi_irqs(dev, 1, PCI_CAP_ID_MSI); 339 ret = arch_setup_msi_irqs(dev, 1, PCI_CAP_ID_MSI);
@@ -404,7 +404,7 @@ static int msix_capability_init(struct pci_dev *dev,
404 entry->dev = dev; 404 entry->dev = dev;
405 entry->mask_base = base; 405 entry->mask_base = base;
406 406
407 list_add(&entry->list, &dev->msi_list); 407 list_add_tail(&entry->list, &dev->msi_list);
408 } 408 }
409 409
410 ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX); 410 ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
@@ -558,12 +558,12 @@ static int msi_free_irqs(struct pci_dev* dev)
558 558
559 list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { 559 list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) {
560 if (entry->msi_attrib.type == PCI_CAP_ID_MSIX) { 560 if (entry->msi_attrib.type == PCI_CAP_ID_MSIX) {
561 if (list_is_last(&entry->list, &dev->msi_list))
562 iounmap(entry->mask_base);
563
564 writel(1, entry->mask_base + entry->msi_attrib.entry_nr 561 writel(1, entry->mask_base + entry->msi_attrib.entry_nr
565 * PCI_MSIX_ENTRY_SIZE 562 * PCI_MSIX_ENTRY_SIZE
566 + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); 563 + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
564
565 if (list_is_last(&entry->list, &dev->msi_list))
566 iounmap(entry->mask_base);
567 } 567 }
568 list_del(&entry->list); 568 list_del(&entry->list);
569 kfree(entry); 569 kfree(entry);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 6ccc2e95930a..01d8f8a8843c 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1625,18 +1625,22 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_CK804_PCIE,
1625 quirk_nvidia_ck804_pcie_aer_ext_cap); 1625 quirk_nvidia_ck804_pcie_aer_ext_cap);
1626 1626
1627#ifdef CONFIG_PCI_MSI 1627#ifdef CONFIG_PCI_MSI
1628/* The Serverworks PCI-X chipset does not support MSI. We cannot easily rely 1628/* Some chipsets do not support MSI. We cannot easily rely on setting
1629 * on setting PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually 1629 * PCI_BUS_FLAGS_NO_MSI in its bus flags because there are actually
1630 * some other busses controlled by the chipset even if Linux is not aware of it. 1630 * some other busses controlled by the chipset even if Linux is not
1631 * Instead of setting the flag on all busses in the machine, simply disable MSI 1631 * aware of it. Instead of setting the flag on all busses in the
1632 * globally. 1632 * machine, simply disable MSI globally.
1633 */ 1633 */
1634static void __init quirk_svw_msi(struct pci_dev *dev) 1634static void __init quirk_disable_all_msi(struct pci_dev *dev)
1635{ 1635{
1636 pci_no_msi(); 1636 pci_no_msi();
1637 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n"); 1637 printk(KERN_WARNING "PCI: MSI quirk detected. MSI deactivated.\n");
1638} 1638}
1639DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_svw_msi); 1639DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCNB_LE, quirk_disable_all_msi);
1640DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi);
1641DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1642DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1643DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1640 1644
1641/* Disable MSI on chipsets that are known to not support it */ 1645/* Disable MSI on chipsets that are known to not support it */
1642static void __devinit quirk_disable_msi(struct pci_dev *dev) 1646static void __devinit quirk_disable_msi(struct pci_dev *dev)
@@ -1649,8 +1653,6 @@ static void __devinit quirk_disable_msi(struct pci_dev *dev)
1649 } 1653 }
1650} 1654}
1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi); 1655DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8131_BRIDGE, quirk_disable_msi);
1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_msi);
1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_msi);
1654 1656
1655/* Go through the list of Hypertransport capabilities and 1657/* Go through the list of Hypertransport capabilities and
1656 * return 1 if a HT MSI capability is found and enabled */ 1658 * return 1 if a HT MSI capability is found and enabled */
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index b137a27472c7..c13232435dc0 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -403,10 +403,11 @@ const struct pci_device_id *pci_find_present(const struct pci_device_id *ids)
403 while (ids->vendor || ids->subvendor || ids->class_mask) { 403 while (ids->vendor || ids->subvendor || ids->class_mask) {
404 list_for_each_entry(dev, &pci_devices, global_list) { 404 list_for_each_entry(dev, &pci_devices, global_list) {
405 if ((found = pci_match_one_device(ids, dev)) != NULL) 405 if ((found = pci_match_one_device(ids, dev)) != NULL)
406 break; 406 goto exit;
407 } 407 }
408 ids++; 408 ids++;
409 } 409 }
410exit:
410 up_read(&pci_bus_sem); 411 up_read(&pci_bus_sem);
411 return found; 412 return found;
412} 413}
diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
index 948efc775a78..eb6abd3f9221 100644
--- a/drivers/pcmcia/at91_cf.c
+++ b/drivers/pcmcia/at91_cf.c
@@ -336,16 +336,21 @@ static int at91_cf_suspend(struct platform_device *pdev, pm_message_t mesg)
336 enable_irq_wake(board->det_pin); 336 enable_irq_wake(board->det_pin);
337 if (board->irq_pin) 337 if (board->irq_pin)
338 enable_irq_wake(board->irq_pin); 338 enable_irq_wake(board->irq_pin);
339 } else {
340 disable_irq_wake(board->det_pin);
341 if (board->irq_pin)
342 disable_irq_wake(board->irq_pin);
343 } 339 }
344 return 0; 340 return 0;
345} 341}
346 342
347static int at91_cf_resume(struct platform_device *pdev) 343static int at91_cf_resume(struct platform_device *pdev)
348{ 344{
345 struct at91_cf_socket *cf = platform_get_drvdata(pdev);
346 struct at91_cf_data *board = cf->board;
347
348 if (device_may_wakeup(&pdev->dev)) {
349 disable_irq_wake(board->det_pin);
350 if (board->irq_pin)
351 disable_irq_wake(board->irq_pin);
352 }
353
349 pcmcia_socket_dev_resume(&pdev->dev); 354 pcmcia_socket_dev_resume(&pdev->dev);
350 return 0; 355 return 0;
351} 356}
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 6085261aa2c1..e24ea82dc35b 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -641,9 +641,16 @@ cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
641 * drivers can't provide shutdown() methods to disable IRQs. 641 * drivers can't provide shutdown() methods to disable IRQs.
642 * Or better yet, fix PNP to allow those methods... 642 * Or better yet, fix PNP to allow those methods...
643 */ 643 */
644 return cmos_do_probe(&pnp->dev, 644 if (pnp_port_start(pnp,0) == 0x70 && !pnp_irq_valid(pnp,0))
645 &pnp->res.port_resource[0], 645 /* Some machines contain a PNP entry for the RTC, but
646 pnp->res.irq_resource[0].start); 646 * don't define the IRQ. It should always be safe to
647 * hardcode it in these cases
648 */
649 return cmos_do_probe(&pnp->dev, &pnp->res.port_resource[0], 8);
650 else
651 return cmos_do_probe(&pnp->dev,
652 &pnp->res.port_resource[0],
653 pnp->res.irq_resource[0].start);
647} 654}
648 655
649static void __exit cmos_pnp_remove(struct pnp_dev *pnp) 656static void __exit cmos_pnp_remove(struct pnp_dev *pnp)
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c
index a1dc8c466ec9..0c081a664ee8 100644
--- a/drivers/s390/block/dasd_eer.c
+++ b/drivers/s390/block/dasd_eer.c
@@ -14,9 +14,9 @@
14#include <linux/moduleparam.h> 14#include <linux/moduleparam.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/poll.h> 16#include <linux/poll.h>
17#include <linux/mutex.h>
17 18
18#include <asm/uaccess.h> 19#include <asm/uaccess.h>
19#include <asm/semaphore.h>
20#include <asm/atomic.h> 20#include <asm/atomic.h>
21#include <asm/ebcdic.h> 21#include <asm/ebcdic.h>
22 22
@@ -514,7 +514,7 @@ void dasd_eer_disable(struct dasd_device *device)
514 * to transfer in a readbuffer, which is protected by the readbuffer_mutex. 514 * to transfer in a readbuffer, which is protected by the readbuffer_mutex.
515 */ 515 */
516static char readbuffer[PAGE_SIZE]; 516static char readbuffer[PAGE_SIZE];
517static DECLARE_MUTEX(readbuffer_mutex); 517static DEFINE_MUTEX(readbuffer_mutex);
518 518
519static int dasd_eer_open(struct inode *inp, struct file *filp) 519static int dasd_eer_open(struct inode *inp, struct file *filp)
520{ 520{
@@ -579,7 +579,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
579 struct eerbuffer *eerb; 579 struct eerbuffer *eerb;
580 580
581 eerb = (struct eerbuffer *) filp->private_data; 581 eerb = (struct eerbuffer *) filp->private_data;
582 if (down_interruptible(&readbuffer_mutex)) 582 if (mutex_lock_interruptible(&readbuffer_mutex))
583 return -ERESTARTSYS; 583 return -ERESTARTSYS;
584 584
585 spin_lock_irqsave(&bufferlock, flags); 585 spin_lock_irqsave(&bufferlock, flags);
@@ -588,7 +588,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
588 /* has been deleted */ 588 /* has been deleted */
589 eerb->residual = 0; 589 eerb->residual = 0;
590 spin_unlock_irqrestore(&bufferlock, flags); 590 spin_unlock_irqrestore(&bufferlock, flags);
591 up(&readbuffer_mutex); 591 mutex_unlock(&readbuffer_mutex);
592 return -EIO; 592 return -EIO;
593 } else if (eerb->residual > 0) { 593 } else if (eerb->residual > 0) {
594 /* OK we still have a second half of a record to deliver */ 594 /* OK we still have a second half of a record to deliver */
@@ -602,7 +602,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
602 if (!tc) { 602 if (!tc) {
603 /* no data available */ 603 /* no data available */
604 spin_unlock_irqrestore(&bufferlock, flags); 604 spin_unlock_irqrestore(&bufferlock, flags);
605 up(&readbuffer_mutex); 605 mutex_unlock(&readbuffer_mutex);
606 if (filp->f_flags & O_NONBLOCK) 606 if (filp->f_flags & O_NONBLOCK)
607 return -EAGAIN; 607 return -EAGAIN;
608 rc = wait_event_interruptible( 608 rc = wait_event_interruptible(
@@ -610,7 +610,7 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
610 eerb->head != eerb->tail); 610 eerb->head != eerb->tail);
611 if (rc) 611 if (rc)
612 return rc; 612 return rc;
613 if (down_interruptible(&readbuffer_mutex)) 613 if (mutex_lock_interruptible(&readbuffer_mutex))
614 return -ERESTARTSYS; 614 return -ERESTARTSYS;
615 spin_lock_irqsave(&bufferlock, flags); 615 spin_lock_irqsave(&bufferlock, flags);
616 } 616 }
@@ -626,11 +626,11 @@ static ssize_t dasd_eer_read(struct file *filp, char __user *buf,
626 spin_unlock_irqrestore(&bufferlock, flags); 626 spin_unlock_irqrestore(&bufferlock, flags);
627 627
628 if (copy_to_user(buf, readbuffer, effective_count)) { 628 if (copy_to_user(buf, readbuffer, effective_count)) {
629 up(&readbuffer_mutex); 629 mutex_unlock(&readbuffer_mutex);
630 return -EFAULT; 630 return -EFAULT;
631 } 631 }
632 632
633 up(&readbuffer_mutex); 633 mutex_unlock(&readbuffer_mutex);
634 return effective_count; 634 return effective_count;
635} 635}
636 636
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index f6ef90ee3e7d..743944ad61ec 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -487,7 +487,7 @@ struct raw3270_ua { /* Query Reply structure for Usable Area */
487} __attribute__ ((packed)); 487} __attribute__ ((packed));
488 488
489static struct diag210 raw3270_init_diag210; 489static struct diag210 raw3270_init_diag210;
490static DECLARE_MUTEX(raw3270_init_sem); 490static DEFINE_MUTEX(raw3270_init_mutex);
491 491
492static int 492static int
493raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq, 493raw3270_init_irq(struct raw3270_view *view, struct raw3270_request *rq,
@@ -713,7 +713,7 @@ raw3270_size_device(struct raw3270 *rp)
713{ 713{
714 int rc; 714 int rc;
715 715
716 down(&raw3270_init_sem); 716 mutex_lock(&raw3270_init_mutex);
717 rp->view = &raw3270_init_view; 717 rp->view = &raw3270_init_view;
718 raw3270_init_view.dev = rp; 718 raw3270_init_view.dev = rp;
719 if (MACHINE_IS_VM) 719 if (MACHINE_IS_VM)
@@ -722,7 +722,7 @@ raw3270_size_device(struct raw3270 *rp)
722 rc = __raw3270_size_device(rp); 722 rc = __raw3270_size_device(rp);
723 raw3270_init_view.dev = NULL; 723 raw3270_init_view.dev = NULL;
724 rp->view = NULL; 724 rp->view = NULL;
725 up(&raw3270_init_sem); 725 mutex_unlock(&raw3270_init_mutex);
726 if (rc == 0) { /* Found something. */ 726 if (rc == 0) { /* Found something. */
727 /* Try to find a model. */ 727 /* Try to find a model. */
728 rp->model = 0; 728 rp->model = 0;
@@ -749,7 +749,7 @@ raw3270_reset_device(struct raw3270 *rp)
749{ 749{
750 int rc; 750 int rc;
751 751
752 down(&raw3270_init_sem); 752 mutex_lock(&raw3270_init_mutex);
753 memset(&rp->init_request, 0, sizeof(rp->init_request)); 753 memset(&rp->init_request, 0, sizeof(rp->init_request));
754 memset(&rp->init_data, 0, sizeof(rp->init_data)); 754 memset(&rp->init_data, 0, sizeof(rp->init_data));
755 /* Store reset data stream to init_data/init_request */ 755 /* Store reset data stream to init_data/init_request */
@@ -764,7 +764,7 @@ raw3270_reset_device(struct raw3270 *rp)
764 rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); 764 rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request);
765 raw3270_init_view.dev = NULL; 765 raw3270_init_view.dev = NULL;
766 rp->view = NULL; 766 rp->view = NULL;
767 up(&raw3270_init_sem); 767 mutex_unlock(&raw3270_init_mutex);
768 return rc; 768 return rc;
769} 769}
770 770
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index a8b373f69cf0..6b264bdb5bfb 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -296,30 +296,57 @@ static void ccw_device_unregister(struct ccw_device *cdev)
296 device_del(&cdev->dev); 296 device_del(&cdev->dev);
297} 297}
298 298
299static void ccw_device_remove_orphan_cb(struct device *dev)
300{
301 struct ccw_device *cdev = to_ccwdev(dev);
302
303 ccw_device_unregister(cdev);
304 put_device(&cdev->dev);
305}
306
307static void ccw_device_remove_sch_cb(struct device *dev)
308{
309 struct subchannel *sch;
310
311 sch = to_subchannel(dev);
312 css_sch_device_unregister(sch);
313 /* Reset intparm to zeroes. */
314 sch->schib.pmcw.intparm = 0;
315 cio_modify(sch);
316 put_device(&sch->dev);
317}
318
299static void 319static void
300ccw_device_remove_disconnected(struct ccw_device *cdev) 320ccw_device_remove_disconnected(struct ccw_device *cdev)
301{ 321{
302 struct subchannel *sch;
303 unsigned long flags; 322 unsigned long flags;
323 int rc;
324
304 /* 325 /*
305 * Forced offline in disconnected state means 326 * Forced offline in disconnected state means
306 * 'throw away device'. 327 * 'throw away device'.
307 */ 328 */
308 if (ccw_device_is_orphan(cdev)) { 329 if (ccw_device_is_orphan(cdev)) {
309 /* Deregister ccw device. */ 330 /*
331 * Deregister ccw device.
332 * Unfortunately, we cannot do this directly from the
333 * attribute method.
334 */
310 spin_lock_irqsave(cdev->ccwlock, flags); 335 spin_lock_irqsave(cdev->ccwlock, flags);
311 cdev->private->state = DEV_STATE_NOT_OPER; 336 cdev->private->state = DEV_STATE_NOT_OPER;
312 spin_unlock_irqrestore(cdev->ccwlock, flags); 337 spin_unlock_irqrestore(cdev->ccwlock, flags);
313 ccw_device_unregister(cdev); 338 rc = device_schedule_callback(&cdev->dev,
314 put_device(&cdev->dev); 339 ccw_device_remove_orphan_cb);
315 return ; 340 if (rc)
341 dev_info(&cdev->dev, "Couldn't unregister orphan\n");
342 return;
316 } 343 }
317 sch = to_subchannel(cdev->dev.parent); 344 /* Deregister subchannel, which will kill the ccw device. */
318 css_sch_device_unregister(sch); 345 rc = device_schedule_callback(cdev->dev.parent,
319 /* Reset intparm to zeroes. */ 346 ccw_device_remove_sch_cb);
320 sch->schib.pmcw.intparm = 0; 347 if (rc)
321 cio_modify(sch); 348 dev_info(&cdev->dev,
322 put_device(&sch->dev); 349 "Couldn't unregister disconnected device\n");
323} 350}
324 351
325int 352int
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index 898ec3b2bebb..6bba80929577 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -688,6 +688,12 @@ ccw_device_disband_done(struct ccw_device *cdev, int err)
688 ccw_device_done(cdev, DEV_STATE_BOXED); 688 ccw_device_done(cdev, DEV_STATE_BOXED);
689 break; 689 break;
690 default: 690 default:
691 cdev->private->flags.donotify = 0;
692 if (get_device(&cdev->dev)) {
693 PREPARE_WORK(&cdev->private->kick_work,
694 ccw_device_call_sch_unregister);
695 queue_work(ccw_device_work, &cdev->private->kick_work);
696 }
691 ccw_device_done(cdev, DEV_STATE_NOT_OPER); 697 ccw_device_done(cdev, DEV_STATE_NOT_OPER);
692 break; 698 break;
693 } 699 }
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 262f01e68592..44e039865aa9 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/smp_lock.h> 15#include <linux/smp_lock.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/mm.h>
17 18
18#include <asm/system.h> 19#include <asm/system.h>
19#include <asm/uaccess.h> 20#include <asm/uaccess.h>
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 572034ceb143..2b2f5c12019b 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1532,6 +1532,7 @@ source "drivers/scsi/arm/Kconfig"
1532config JAZZ_ESP 1532config JAZZ_ESP
1533 bool "MIPS JAZZ FAS216 SCSI support" 1533 bool "MIPS JAZZ FAS216 SCSI support"
1534 depends on MACH_JAZZ && SCSI 1534 depends on MACH_JAZZ && SCSI
1535 select SCSI_SPI_ATTRS
1535 help 1536 help
1536 This is the driver for the onboard SCSI host adapter of MIPS Magnum 1537 This is the driver for the onboard SCSI host adapter of MIPS Magnum
1537 4000, Acer PICA, Olivetti M700-10 and a few other identical OEM 1538 4000, Acer PICA, Olivetti M700-10 and a few other identical OEM
@@ -1756,6 +1757,7 @@ config SUN3X_ESP
1756config SCSI_SUNESP 1757config SCSI_SUNESP
1757 tristate "Sparc ESP Scsi Driver" 1758 tristate "Sparc ESP Scsi Driver"
1758 depends on SBUS && SCSI 1759 depends on SBUS && SCSI
1760 select SCSI_SPI_ATTRS
1759 help 1761 help
1760 This is the driver for the Sun ESP SCSI host adapter. The ESP 1762 This is the driver for the Sun ESP SCSI host adapter. The ESP
1761 chipset is present in most SPARC SBUS-based computers. 1763 chipset is present in most SPARC SBUS-based computers.
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index bb3cb3360541..88ea5a1fb606 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -2625,7 +2625,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
2625#ifdef REAL_DMA 2625#ifdef REAL_DMA
2626static void NCR5380_dma_complete(NCR5380_instance * instance) { 2626static void NCR5380_dma_complete(NCR5380_instance * instance) {
2627 NCR5380_local_declare(); 2627 NCR5380_local_declare();
2628 struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata * instance->hostdata); 2628 struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
2629 int transferred; 2629 int transferred;
2630 NCR5380_setup(instance); 2630 NCR5380_setup(instance);
2631 2631
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 350ea7feb61d..5c487ff096c7 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -863,6 +863,14 @@ static struct scsi_host_template aac_driver_template = {
863 .emulated = 1, 863 .emulated = 1,
864}; 864};
865 865
866static void __aac_shutdown(struct aac_dev * aac)
867{
868 kthread_stop(aac->thread);
869 aac_send_shutdown(aac);
870 aac_adapter_disable_int(aac);
871 free_irq(aac->pdev->irq, aac);
872}
873
866static int __devinit aac_probe_one(struct pci_dev *pdev, 874static int __devinit aac_probe_one(struct pci_dev *pdev,
867 const struct pci_device_id *id) 875 const struct pci_device_id *id)
868{ 876{
@@ -1015,10 +1023,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
1015 return 0; 1023 return 0;
1016 1024
1017 out_deinit: 1025 out_deinit:
1018 kthread_stop(aac->thread); 1026 __aac_shutdown(aac);
1019 aac_send_shutdown(aac);
1020 aac_adapter_disable_int(aac);
1021 free_irq(pdev->irq, aac);
1022 out_unmap: 1027 out_unmap:
1023 aac_fib_map_free(aac); 1028 aac_fib_map_free(aac);
1024 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); 1029 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys);
@@ -1038,7 +1043,8 @@ static void aac_shutdown(struct pci_dev *dev)
1038{ 1043{
1039 struct Scsi_Host *shost = pci_get_drvdata(dev); 1044 struct Scsi_Host *shost = pci_get_drvdata(dev);
1040 struct aac_dev *aac = (struct aac_dev *)shost->hostdata; 1045 struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
1041 aac_send_shutdown(aac); 1046 scsi_block_requests(shost);
1047 __aac_shutdown(aac);
1042} 1048}
1043 1049
1044static void __devexit aac_remove_one(struct pci_dev *pdev) 1050static void __devexit aac_remove_one(struct pci_dev *pdev)
@@ -1048,16 +1054,12 @@ static void __devexit aac_remove_one(struct pci_dev *pdev)
1048 1054
1049 scsi_remove_host(shost); 1055 scsi_remove_host(shost);
1050 1056
1051 kthread_stop(aac->thread); 1057 __aac_shutdown(aac);
1052
1053 aac_send_shutdown(aac);
1054 aac_adapter_disable_int(aac);
1055 aac_fib_map_free(aac); 1058 aac_fib_map_free(aac);
1056 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, 1059 pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr,
1057 aac->comm_phys); 1060 aac->comm_phys);
1058 kfree(aac->queues); 1061 kfree(aac->queues);
1059 1062
1060 free_irq(pdev->irq, aac);
1061 aac_adapter_ioremap(aac, 0); 1063 aac_adapter_ioremap(aac, 0);
1062 1064
1063 kfree(aac->fibs); 1065 kfree(aac->fibs);
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c
index 9ddc6e4a74b0..05f692bd0adc 100644
--- a/drivers/scsi/aic7xxx/aic79xx_core.c
+++ b/drivers/scsi/aic7xxx/aic79xx_core.c
@@ -5180,7 +5180,7 @@ ahd_handle_devreset(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
5180 cur_lun = lun; 5180 cur_lun = lun;
5181 max_lun = lun; 5181 max_lun = lun;
5182 } 5182 }
5183 for (cur_lun <= max_lun; cur_lun++) { 5183 for (;cur_lun <= max_lun; cur_lun++) {
5184 struct ahd_tmode_lstate* lstate; 5184 struct ahd_tmode_lstate* lstate;
5185 5185
5186 lstate = tstate->enabled_luns[cur_lun]; 5186 lstate = tstate->enabled_luns[cur_lun];
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index eff846ae0aff..03dbe60c264a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -894,45 +894,6 @@ static int NCR5380_init(struct Scsi_Host *instance, int flags)
894} 894}
895 895
896/* 896/*
897 * our own old-style timeout update
898 */
899/*
900 * The strategy is to cause the timer code to call scsi_times_out()
901 * when the soonest timeout is pending.
902 * The arguments are used when we are queueing a new command, because
903 * we do not want to subtract the time used from this time, but when we
904 * set the timer, we want to take this value into account.
905 */
906
907int atari_scsi_update_timeout(Scsi_Cmnd * SCset, int timeout)
908{
909 int rtn;
910
911 /*
912 * We are using the new error handling code to actually register/deregister
913 * timers for timeout.
914 */
915
916 if (!timer_pending(&SCset->eh_timeout))
917 rtn = 0;
918 else
919 rtn = SCset->eh_timeout.expires - jiffies;
920
921 if (timeout == 0) {
922 del_timer(&SCset->eh_timeout);
923 SCset->eh_timeout.data = (unsigned long)NULL;
924 SCset->eh_timeout.expires = 0;
925 } else {
926 if (SCset->eh_timeout.data != (unsigned long)NULL)
927 del_timer(&SCset->eh_timeout);
928 SCset->eh_timeout.data = (unsigned long)SCset;
929 SCset->eh_timeout.expires = jiffies + timeout;
930 add_timer(&SCset->eh_timeout);
931 }
932 return rtn;
933}
934
935/*
936 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd, 897 * Function : int NCR5380_queue_command (Scsi_Cmnd *cmd,
937 * void (*done)(Scsi_Cmnd *)) 898 * void (*done)(Scsi_Cmnd *))
938 * 899 *
@@ -956,7 +917,6 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
956 Scsi_Cmnd *tmp; 917 Scsi_Cmnd *tmp;
957 int oldto; 918 int oldto;
958 unsigned long flags; 919 unsigned long flags;
959 // extern int update_timeout(Scsi_Cmnd * SCset, int timeout);
960 920
961#if (NDEBUG & NDEBUG_NO_WRITE) 921#if (NDEBUG & NDEBUG_NO_WRITE)
962 switch (cmd->cmnd[0]) { 922 switch (cmd->cmnd[0]) {
@@ -1029,9 +989,9 @@ static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
1029 * alter queues and touch the lock. 989 * alter queues and touch the lock.
1030 */ 990 */
1031 if (!IS_A_TT()) { 991 if (!IS_A_TT()) {
1032 oldto = atari_scsi_update_timeout(cmd, 0); 992 /* perhaps stop command timer here */
1033 falcon_get_lock(); 993 falcon_get_lock();
1034 atari_scsi_update_timeout(cmd, oldto); 994 /* perhaps restart command timer here */
1035 } 995 }
1036 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { 996 if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
1037 LIST(cmd, hostdata->issue_queue); 997 LIST(cmd, hostdata->issue_queue);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index dd076da86a46..b98136adaaae 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2590,7 +2590,7 @@ qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
2590 return 0; 2590 return 0;
2591 if (msleep_interruptible(step)) 2591 if (msleep_interruptible(step))
2592 break; 2592 break;
2593 } while (--iterations >= 0); 2593 } while (--iterations > 0);
2594 2594
2595 return -ETIMEDOUT; 2595 return -ETIMEDOUT;
2596} 2596}
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a67f315244d7..662577fbe7a8 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -184,6 +184,15 @@ int scsi_complete_async_scans(void)
184/* Only exported for the benefit of scsi_wait_scan */ 184/* Only exported for the benefit of scsi_wait_scan */
185EXPORT_SYMBOL_GPL(scsi_complete_async_scans); 185EXPORT_SYMBOL_GPL(scsi_complete_async_scans);
186 186
187#ifndef MODULE
188/*
189 * For async scanning we need to wait for all the scans to complete before
190 * trying to mount the root fs. Otherwise non-modular drivers may not be ready
191 * yet.
192 */
193late_initcall(scsi_complete_async_scans);
194#endif
195
187/** 196/**
188 * scsi_unlock_floptical - unlock device via a special MODE SENSE command 197 * scsi_unlock_floptical - unlock device via a special MODE SENSE command
189 * @sdev: scsi device to send command to 198 * @sdev: scsi device to send command to
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c
index 00d1255e4c12..e88da72f8304 100644
--- a/drivers/serial/amba-pl010.c
+++ b/drivers/serial/amba-pl010.c
@@ -167,9 +167,9 @@ static void pl010_rx_chars(struct uart_amba_port *uap)
167 ignore_char: 167 ignore_char:
168 status = readb(uap->port.membase + UART01x_FR); 168 status = readb(uap->port.membase + UART01x_FR);
169 } 169 }
170 spin_unlock(&port->lock); 170 spin_unlock(&uap->port.lock);
171 tty_flip_buffer_push(tty); 171 tty_flip_buffer_push(tty);
172 spin_lock(&port->lock); 172 spin_lock(&uap->port.lock);
173} 173}
174 174
175static void pl010_tx_chars(struct uart_amba_port *uap) 175static void pl010_tx_chars(struct uart_amba_port *uap)
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 1d8a2f6bb8eb..8b2601de3630 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -113,16 +113,16 @@ static void atmel_spi_next_xfer(struct spi_master *master,
113 113
114 len = as->remaining_bytes; 114 len = as->remaining_bytes;
115 115
116 tx_dma = xfer->tx_dma; 116 tx_dma = xfer->tx_dma + xfer->len - len;
117 rx_dma = xfer->rx_dma; 117 rx_dma = xfer->rx_dma + xfer->len - len;
118 118
119 /* use scratch buffer only when rx or tx data is unspecified */ 119 /* use scratch buffer only when rx or tx data is unspecified */
120 if (rx_dma == INVALID_DMA_ADDRESS) { 120 if (!xfer->rx_buf) {
121 rx_dma = as->buffer_dma; 121 rx_dma = as->buffer_dma;
122 if (len > BUFFER_SIZE) 122 if (len > BUFFER_SIZE)
123 len = BUFFER_SIZE; 123 len = BUFFER_SIZE;
124 } 124 }
125 if (tx_dma == INVALID_DMA_ADDRESS) { 125 if (!xfer->tx_buf) {
126 tx_dma = as->buffer_dma; 126 tx_dma = as->buffer_dma;
127 if (len > BUFFER_SIZE) 127 if (len > BUFFER_SIZE)
128 len = BUFFER_SIZE; 128 len = BUFFER_SIZE;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c3219b29b5ac..4831edbae2d5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -411,7 +411,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
411 */ 411 */
412int spi_register_master(struct spi_master *master) 412int spi_register_master(struct spi_master *master)
413{ 413{
414 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); 414 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<15) - 1);
415 struct device *dev = master->cdev.dev; 415 struct device *dev = master->cdev.dev;
416 int status = -ENODEV; 416 int status = -ENODEV;
417 int dynamic = 0; 417 int dynamic = 0;
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 51daa212c6b7..656be4a5094a 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -121,7 +121,7 @@
121 32.768 KHz Clock */ 121 32.768 KHz Clock */
122 122
123/* SPI DMA Register Bit Fields & Masks */ 123/* SPI DMA Register Bit Fields & Masks */
124#define SPI_DMA_RHDMA (0xF << 4) /* RXFIFO Half Status */ 124#define SPI_DMA_RHDMA (0x1 << 4) /* RXFIFO Half Status */
125#define SPI_DMA_RFDMA (0x1 << 5) /* RXFIFO Full Status */ 125#define SPI_DMA_RFDMA (0x1 << 5) /* RXFIFO Full Status */
126#define SPI_DMA_TEDMA (0x1 << 6) /* TXFIFO Empty Status */ 126#define SPI_DMA_TEDMA (0x1 << 6) /* TXFIFO Empty Status */
127#define SPI_DMA_THDMA (0x1 << 7) /* TXFIFO Half Status */ 127#define SPI_DMA_THDMA (0x1 << 7) /* TXFIFO Half Status */
@@ -1355,6 +1355,7 @@ static int setup(struct spi_device *spi)
1355 spi->bits_per_word, 1355 spi->bits_per_word,
1356 spi_speed_hz(SPI_CONTROL_DATARATE_MIN), 1356 spi_speed_hz(SPI_CONTROL_DATARATE_MIN),
1357 spi->max_speed_hz); 1357 spi->max_speed_hz);
1358 return status;
1358 1359
1359err_first_setup: 1360err_first_setup:
1360 kfree(chip); 1361 kfree(chip);
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 6e1f1ea21b38..403dac787ebf 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -755,7 +755,7 @@ config FB_LEO
755 755
756config FB_IGA 756config FB_IGA
757 bool "IGA 168x display support" 757 bool "IGA 168x display support"
758 depends on FB && SPARC32 758 depends on (FB = y) && SPARC32
759 select FB_CFB_FILLRECT 759 select FB_CFB_FILLRECT
760 select FB_CFB_COPYAREA 760 select FB_CFB_COPYAREA
761 select FB_CFB_IMAGEBLIT 761 select FB_CFB_IMAGEBLIT
@@ -765,7 +765,7 @@ config FB_IGA
765 765
766config FB_XVR500 766config FB_XVR500
767 bool "Sun XVR-500 3DLABS Wildcat support" 767 bool "Sun XVR-500 3DLABS Wildcat support"
768 depends on FB && PCI && SPARC64 768 depends on (FB = y) && PCI && SPARC64
769 select FB_CFB_FILLRECT 769 select FB_CFB_FILLRECT
770 select FB_CFB_COPYAREA 770 select FB_CFB_COPYAREA
771 select FB_CFB_IMAGEBLIT 771 select FB_CFB_IMAGEBLIT
@@ -778,7 +778,7 @@ config FB_XVR500
778 778
779config FB_XVR2500 779config FB_XVR2500
780 bool "Sun XVR-2500 3DLABS Wildcat support" 780 bool "Sun XVR-2500 3DLABS Wildcat support"
781 depends on FB && PCI && SPARC64 781 depends on (FB = y) && PCI && SPARC64
782 select FB_CFB_FILLRECT 782 select FB_CFB_FILLRECT
783 select FB_CFB_COPYAREA 783 select FB_CFB_COPYAREA
784 select FB_CFB_IMAGEBLIT 784 select FB_CFB_IMAGEBLIT
diff --git a/drivers/video/arkfb.c b/drivers/video/arkfb.c
index ba6fede5c466..8a1b07c74394 100644
--- a/drivers/video/arkfb.c
+++ b/drivers/video/arkfb.c
@@ -1055,9 +1055,10 @@ err_enable_device:
1055static void __devexit ark_pci_remove(struct pci_dev *dev) 1055static void __devexit ark_pci_remove(struct pci_dev *dev)
1056{ 1056{
1057 struct fb_info *info = pci_get_drvdata(dev); 1057 struct fb_info *info = pci_get_drvdata(dev);
1058 struct arkfb_info *par = info->par;
1059 1058
1060 if (info) { 1059 if (info) {
1060 struct arkfb_info *par = info->par;
1061
1061#ifdef CONFIG_MTRR 1062#ifdef CONFIG_MTRR
1062 if (par->mtrr_reg >= 0) { 1063 if (par->mtrr_reg >= 0) {
1063 mtrr_del(par->mtrr_reg, 0, 0); 1064 mtrr_del(par->mtrr_reg, 0, 0);
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 9b26dda18a38..ac46cc3f6a2a 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -47,7 +47,7 @@ targets := promcon_tbl.c
47quiet_cmd_conmakehash = CNMKHSH $@ 47quiet_cmd_conmakehash = CNMKHSH $@
48 cmd_conmakehash = scripts/conmakehash $< | \ 48 cmd_conmakehash = scripts/conmakehash $< | \
49 sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \ 49 sed -e '/\#include <[^>]*>/p' -e 's/types/init/' \
50 -e 's/dfont\(_uni.*\]\)/promfont\1 __initdata/' > $@ 50 -e 's/dfont\(_uni.*\]\)/promfont\1 /' > $@
51 51
52$(obj)/promcon_tbl.c: $(src)/prom.uni 52$(obj)/promcon_tbl.c: $(src)/prom.uni
53 $(call cmd,conmakehash) 53 $(call cmd,conmakehash)
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index 71f24e00fcd0..8e6ef4bc7a5c 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -176,7 +176,6 @@ extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
176#endif 176#endif
177extern void fbcon_set_bitops(struct fbcon_ops *ops); 177extern void fbcon_set_bitops(struct fbcon_ops *ops);
178extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor); 178extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
179extern struct class *fb_class;
180 179
181#define FBCON_ATTRIBUTE_UNDERLINE 1 180#define FBCON_ATTRIBUTE_UNDERLINE 1
182#define FBCON_ATTRIBUTE_REVERSE 2 181#define FBCON_ATTRIBUTE_REVERSE 2
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 1d4e8354b561..3f6c98fad437 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -656,7 +656,7 @@ static int ffb_setcolreg(unsigned regno,
656{ 656{
657 u32 value; 657 u32 value;
658 658
659 if (regno >= 256) 659 if (regno >= 16)
660 return 1; 660 return 1;
661 661
662 red >>= 8; 662 red >>= 8;
@@ -903,7 +903,7 @@ ffb_init_fix(struct fb_info *info)
903struct all_info { 903struct all_info {
904 struct fb_info info; 904 struct fb_info info;
905 struct ffb_par par; 905 struct ffb_par par;
906 u32 pseudo_palette[256]; 906 u32 pseudo_palette[16];
907}; 907};
908 908
909static int ffb_init_one(struct of_device *op) 909static int ffb_init_one(struct of_device *op)
diff --git a/drivers/video/neofb.c b/drivers/video/neofb.c
index bd30aba242d0..731d7a5c5aa2 100644
--- a/drivers/video/neofb.c
+++ b/drivers/video/neofb.c
@@ -1286,34 +1286,36 @@ static int neofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
1286 if (regno >= fb->cmap.len || regno > 255) 1286 if (regno >= fb->cmap.len || regno > 255)
1287 return -EINVAL; 1287 return -EINVAL;
1288 1288
1289 switch (fb->var.bits_per_pixel) { 1289 if (fb->var.bits_per_pixel <= 8) {
1290 case 8:
1291 outb(regno, 0x3c8); 1290 outb(regno, 0x3c8);
1292 1291
1293 outb(red >> 10, 0x3c9); 1292 outb(red >> 10, 0x3c9);
1294 outb(green >> 10, 0x3c9); 1293 outb(green >> 10, 0x3c9);
1295 outb(blue >> 10, 0x3c9); 1294 outb(blue >> 10, 0x3c9);
1296 break; 1295 } else if (regno < 16) {
1297 case 16: 1296 switch (fb->var.bits_per_pixel) {
1298 ((u32 *) fb->pseudo_palette)[regno] = 1297 case 16:
1298 ((u32 *) fb->pseudo_palette)[regno] =
1299 ((red & 0xf800)) | ((green & 0xfc00) >> 5) | 1299 ((red & 0xf800)) | ((green & 0xfc00) >> 5) |
1300 ((blue & 0xf800) >> 11); 1300 ((blue & 0xf800) >> 11);
1301 break; 1301 break;
1302 case 24: 1302 case 24:
1303 ((u32 *) fb->pseudo_palette)[regno] = 1303 ((u32 *) fb->pseudo_palette)[regno] =
1304 ((red & 0xff00) << 8) | ((green & 0xff00)) | 1304 ((red & 0xff00) << 8) | ((green & 0xff00)) |
1305 ((blue & 0xff00) >> 8); 1305 ((blue & 0xff00) >> 8);
1306 break; 1306 break;
1307#ifdef NO_32BIT_SUPPORT_YET 1307#ifdef NO_32BIT_SUPPORT_YET
1308 case 32: 1308 case 32:
1309 ((u32 *) fb->pseudo_palette)[regno] = 1309 ((u32 *) fb->pseudo_palette)[regno] =
1310 ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) | 1310 ((transp & 0xff00) << 16) | ((red & 0xff00) << 8) |
1311 ((green & 0xff00)) | ((blue & 0xff00) >> 8); 1311 ((green & 0xff00)) | ((blue & 0xff00) >> 8);
1312 break; 1312 break;
1313#endif 1313#endif
1314 default: 1314 default:
1315 return 1; 1315 return 1;
1316 }
1316 } 1317 }
1318
1317 return 0; 1319 return 0;
1318} 1320}
1319 1321
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c
index 616a0c08e30c..b52e883f0a52 100644
--- a/drivers/video/pm3fb.c
+++ b/drivers/video/pm3fb.c
@@ -498,7 +498,7 @@ static int pm3fb_set_par(struct fb_info *info)
498 else 498 else
499 par->video |= PM3VideoControl_LINE_DOUBLE_OFF; 499 par->video |= PM3VideoControl_LINE_DOUBLE_OFF;
500 500
501 if (info->var.activate == FB_ACTIVATE_NOW) 501 if ((info->var.activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
502 par->video |= PM3VideoControl_ENABLE; 502 par->video |= PM3VideoControl_ENABLE;
503 else { 503 else {
504 par->video |= PM3VideoControl_DISABLE; 504 par->video |= PM3VideoControl_DISABLE;
diff --git a/drivers/video/skeletonfb.c b/drivers/video/skeletonfb.c
index 836a612af977..64779e70408f 100644
--- a/drivers/video/skeletonfb.c
+++ b/drivers/video/skeletonfb.c
@@ -132,7 +132,6 @@ static struct fb_info info;
132static struct xxx_par __initdata current_par; 132static struct xxx_par __initdata current_par;
133 133
134int xxxfb_init(void); 134int xxxfb_init(void);
135int xxxfb_setup(char*);
136 135
137/** 136/**
138 * xxxfb_open - Optional function. Called when the framebuffer is 137 * xxxfb_open - Optional function. Called when the framebuffer is
@@ -975,6 +974,21 @@ static struct platform_device xxxfb_device = {
975 .name = "xxxfb", 974 .name = "xxxfb",
976}; 975};
977 976
977#ifndef MODULE
978 /*
979 * Setup
980 */
981
982/*
983 * Only necessary if your driver takes special options,
984 * otherwise we fall back on the generic fb_setup().
985 */
986int __init xxxfb_setup(char *options)
987{
988 /* Parse user speficied options (`video=xxxfb:') */
989}
990#endif /* MODULE */
991
978static int __init xxxfb_init(void) 992static int __init xxxfb_init(void)
979{ 993{
980 int ret; 994 int ret;
@@ -1006,21 +1020,6 @@ static void __exit xxxfb_exit(void)
1006} 1020}
1007#endif /* CONFIG_PCI */ 1021#endif /* CONFIG_PCI */
1008 1022
1009#ifdef MODULE
1010 /*
1011 * Setup
1012 */
1013
1014/*
1015 * Only necessary if your driver takes special options,
1016 * otherwise we fall back on the generic fb_setup().
1017 */
1018int __init xxxfb_setup(char *options)
1019{
1020 /* Parse user speficied options (`video=xxxfb:') */
1021}
1022#endif /* MODULE */
1023
1024/* ------------------------------------------------------------------------- */ 1023/* ------------------------------------------------------------------------- */
1025 1024
1026 1025
diff --git a/drivers/video/sunxvr2500.c b/drivers/video/sunxvr2500.c
index 4316c7fe8e21..c3869a96ab58 100644
--- a/drivers/video/sunxvr2500.c
+++ b/drivers/video/sunxvr2500.c
@@ -28,7 +28,7 @@ struct s3d_info {
28 unsigned int depth; 28 unsigned int depth;
29 unsigned int fb_size; 29 unsigned int fb_size;
30 30
31 u32 pseudo_palette[256]; 31 u32 pseudo_palette[16];
32}; 32};
33 33
34static int __devinit s3d_get_props(struct s3d_info *sp) 34static int __devinit s3d_get_props(struct s3d_info *sp)
@@ -52,15 +52,14 @@ static int s3d_setcolreg(unsigned regno,
52{ 52{
53 u32 value; 53 u32 value;
54 54
55 if (regno >= 256) 55 if (regno < 16) {
56 return 1; 56 red >>= 8;
57 green >>= 8;
58 blue >>= 8;
57 59
58 red >>= 8; 60 value = (blue << 24) | (green << 16) | (red << 8);
59 green >>= 8; 61 ((u32 *)info->pseudo_palette)[regno] = value;
60 blue >>= 8; 62 }
61
62 value = (blue << 24) | (green << 16) | (red << 8);
63 ((u32 *)info->pseudo_palette)[regno] = value;
64 63
65 return 0; 64 return 0;
66} 65}
diff --git a/drivers/video/sunxvr500.c b/drivers/video/sunxvr500.c
index 08880a62bfa3..71bf3f1f00bc 100644
--- a/drivers/video/sunxvr500.c
+++ b/drivers/video/sunxvr500.c
@@ -50,7 +50,7 @@ struct e3d_info {
50 u32 fb8_0_off; 50 u32 fb8_0_off;
51 u32 fb8_1_off; 51 u32 fb8_1_off;
52 52
53 u32 pseudo_palette[256]; 53 u32 pseudo_palette[16];
54}; 54};
55 55
56static int __devinit e3d_get_props(struct e3d_info *ep) 56static int __devinit e3d_get_props(struct e3d_info *ep)
@@ -126,7 +126,9 @@ static int e3d_setcolreg(unsigned regno,
126 blue_8 = blue >> 8; 126 blue_8 = blue >> 8;
127 127
128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8); 128 value = (blue_8 << 24) | (green_8 << 16) | (red_8 << 8);
129 ((u32 *)info->pseudo_palette)[regno] = value; 129
130 if (info->fix.visual == FB_VISUAL_TRUECOLOR && regno < 16)
131 ((u32 *)info->pseudo_palette)[regno] = value;
130 132
131 133
132 red_10 = red >> 6; 134 red_10 = red >> 6;
diff --git a/drivers/video/vt8623fb.c b/drivers/video/vt8623fb.c
index 5e9755e464a1..30c0b948852b 100644
--- a/drivers/video/vt8623fb.c
+++ b/drivers/video/vt8623fb.c
@@ -778,9 +778,10 @@ err_enable_device:
778static void __devexit vt8623_pci_remove(struct pci_dev *dev) 778static void __devexit vt8623_pci_remove(struct pci_dev *dev)
779{ 779{
780 struct fb_info *info = pci_get_drvdata(dev); 780 struct fb_info *info = pci_get_drvdata(dev);
781 struct vt8623fb_info *par = info->par;
782 781
783 if (info) { 782 if (info) {
783 struct vt8623fb_info *par = info->par;
784
784#ifdef CONFIG_MTRR 785#ifdef CONFIG_MTRR
785 if (par->mtrr_reg >= 0) { 786 if (par->mtrr_reg >= 0) {
786 mtrr_del(par->mtrr_reg, 0, 0); 787 mtrr_del(par->mtrr_reg, 0, 0);
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 2dac3ad2c44b..2c55dd94a1de 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -17,6 +17,8 @@
17#include <linux/rxrpc.h> 17#include <linux/rxrpc.h>
18#include <linux/key.h> 18#include <linux/key.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/sched.h>
21
20#include "afs.h" 22#include "afs.h"
21#include "afs_vl.h" 23#include "afs_vl.h"
22 24
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 8a23483ca8d0..3b64bb16c727 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -30,15 +30,15 @@
30void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, 30void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
31 unsigned long *blockgrpp, ext4_grpblk_t *offsetp) 31 unsigned long *blockgrpp, ext4_grpblk_t *offsetp)
32{ 32{
33 struct ext4_super_block *es = EXT4_SB(sb)->s_es; 33 struct ext4_super_block *es = EXT4_SB(sb)->s_es;
34 ext4_grpblk_t offset; 34 ext4_grpblk_t offset;
35 35
36 blocknr = blocknr - le32_to_cpu(es->s_first_data_block); 36 blocknr = blocknr - le32_to_cpu(es->s_first_data_block);
37 offset = do_div(blocknr, EXT4_BLOCKS_PER_GROUP(sb)); 37 offset = do_div(blocknr, EXT4_BLOCKS_PER_GROUP(sb));
38 if (offsetp) 38 if (offsetp)
39 *offsetp = offset; 39 *offsetp = offset;
40 if (blockgrpp) 40 if (blockgrpp)
41 *blockgrpp = blocknr; 41 *blockgrpp = blocknr;
42 42
43} 43}
44 44
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index a0f0c04e79b2..b9ce24129070 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -374,7 +374,7 @@ ext4_ext_binsearch_idx(struct inode *inode, struct ext4_ext_path *path, int bloc
374 le32_to_cpu(ix[-1].ei_block)); 374 le32_to_cpu(ix[-1].ei_block));
375 } 375 }
376 BUG_ON(k && le32_to_cpu(ix->ei_block) 376 BUG_ON(k && le32_to_cpu(ix->ei_block)
377 <= le32_to_cpu(ix[-1].ei_block)); 377 <= le32_to_cpu(ix[-1].ei_block));
378 if (block < le32_to_cpu(ix->ei_block)) 378 if (block < le32_to_cpu(ix->ei_block))
379 break; 379 break;
380 chix = ix; 380 chix = ix;
@@ -423,8 +423,8 @@ ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, int block)
423 423
424 path->p_ext = l - 1; 424 path->p_ext = l - 1;
425 ext_debug(" -> %d:%llu:%d ", 425 ext_debug(" -> %d:%llu:%d ",
426 le32_to_cpu(path->p_ext->ee_block), 426 le32_to_cpu(path->p_ext->ee_block),
427 ext_pblock(path->p_ext), 427 ext_pblock(path->p_ext),
428 le16_to_cpu(path->p_ext->ee_len)); 428 le16_to_cpu(path->p_ext->ee_len));
429 429
430#ifdef CHECK_BINSEARCH 430#ifdef CHECK_BINSEARCH
@@ -435,7 +435,7 @@ ext4_ext_binsearch(struct inode *inode, struct ext4_ext_path *path, int block)
435 chex = ex = EXT_FIRST_EXTENT(eh); 435 chex = ex = EXT_FIRST_EXTENT(eh);
436 for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ex++) { 436 for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ex++) {
437 BUG_ON(k && le32_to_cpu(ex->ee_block) 437 BUG_ON(k && le32_to_cpu(ex->ee_block)
438 <= le32_to_cpu(ex[-1].ee_block)); 438 <= le32_to_cpu(ex[-1].ee_block));
439 if (block < le32_to_cpu(ex->ee_block)) 439 if (block < le32_to_cpu(ex->ee_block))
440 break; 440 break;
441 chex = ex; 441 chex = ex;
@@ -577,7 +577,7 @@ static int ext4_ext_insert_index(handle_t *handle, struct inode *inode,
577 curp->p_hdr->eh_entries = cpu_to_le16(le16_to_cpu(curp->p_hdr->eh_entries)+1); 577 curp->p_hdr->eh_entries = cpu_to_le16(le16_to_cpu(curp->p_hdr->eh_entries)+1);
578 578
579 BUG_ON(le16_to_cpu(curp->p_hdr->eh_entries) 579 BUG_ON(le16_to_cpu(curp->p_hdr->eh_entries)
580 > le16_to_cpu(curp->p_hdr->eh_max)); 580 > le16_to_cpu(curp->p_hdr->eh_max));
581 BUG_ON(ix > EXT_LAST_INDEX(curp->p_hdr)); 581 BUG_ON(ix > EXT_LAST_INDEX(curp->p_hdr));
582 582
583 err = ext4_ext_dirty(handle, inode, curp); 583 err = ext4_ext_dirty(handle, inode, curp);
@@ -621,12 +621,12 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
621 border = path[depth].p_ext[1].ee_block; 621 border = path[depth].p_ext[1].ee_block;
622 ext_debug("leaf will be split." 622 ext_debug("leaf will be split."
623 " next leaf starts at %d\n", 623 " next leaf starts at %d\n",
624 le32_to_cpu(border)); 624 le32_to_cpu(border));
625 } else { 625 } else {
626 border = newext->ee_block; 626 border = newext->ee_block;
627 ext_debug("leaf will be added." 627 ext_debug("leaf will be added."
628 " next leaf starts at %d\n", 628 " next leaf starts at %d\n",
629 le32_to_cpu(border)); 629 le32_to_cpu(border));
630 } 630 }
631 631
632 /* 632 /*
@@ -684,9 +684,9 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
684 while (path[depth].p_ext <= 684 while (path[depth].p_ext <=
685 EXT_MAX_EXTENT(path[depth].p_hdr)) { 685 EXT_MAX_EXTENT(path[depth].p_hdr)) {
686 ext_debug("move %d:%llu:%d in new leaf %llu\n", 686 ext_debug("move %d:%llu:%d in new leaf %llu\n",
687 le32_to_cpu(path[depth].p_ext->ee_block), 687 le32_to_cpu(path[depth].p_ext->ee_block),
688 ext_pblock(path[depth].p_ext), 688 ext_pblock(path[depth].p_ext),
689 le16_to_cpu(path[depth].p_ext->ee_len), 689 le16_to_cpu(path[depth].p_ext->ee_len),
690 newblock); 690 newblock);
691 /*memmove(ex++, path[depth].p_ext++, 691 /*memmove(ex++, path[depth].p_ext++,
692 sizeof(struct ext4_extent)); 692 sizeof(struct ext4_extent));
@@ -765,9 +765,9 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
765 EXT_LAST_INDEX(path[i].p_hdr)); 765 EXT_LAST_INDEX(path[i].p_hdr));
766 while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) { 766 while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) {
767 ext_debug("%d: move %d:%d in new index %llu\n", i, 767 ext_debug("%d: move %d:%d in new index %llu\n", i,
768 le32_to_cpu(path[i].p_idx->ei_block), 768 le32_to_cpu(path[i].p_idx->ei_block),
769 idx_pblock(path[i].p_idx), 769 idx_pblock(path[i].p_idx),
770 newblock); 770 newblock);
771 /*memmove(++fidx, path[i].p_idx++, 771 /*memmove(++fidx, path[i].p_idx++,
772 sizeof(struct ext4_extent_idx)); 772 sizeof(struct ext4_extent_idx));
773 neh->eh_entries++; 773 neh->eh_entries++;
@@ -1128,6 +1128,55 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1,
1128} 1128}
1129 1129
1130/* 1130/*
1131 * check if a portion of the "newext" extent overlaps with an
1132 * existing extent.
1133 *
1134 * If there is an overlap discovered, it updates the length of the newext
1135 * such that there will be no overlap, and then returns 1.
1136 * If there is no overlap found, it returns 0.
1137 */
1138unsigned int ext4_ext_check_overlap(struct inode *inode,
1139 struct ext4_extent *newext,
1140 struct ext4_ext_path *path)
1141{
1142 unsigned long b1, b2;
1143 unsigned int depth, len1;
1144 unsigned int ret = 0;
1145
1146 b1 = le32_to_cpu(newext->ee_block);
1147 len1 = le16_to_cpu(newext->ee_len);
1148 depth = ext_depth(inode);
1149 if (!path[depth].p_ext)
1150 goto out;
1151 b2 = le32_to_cpu(path[depth].p_ext->ee_block);
1152
1153 /*
1154 * get the next allocated block if the extent in the path
1155 * is before the requested block(s)
1156 */
1157 if (b2 < b1) {
1158 b2 = ext4_ext_next_allocated_block(path);
1159 if (b2 == EXT_MAX_BLOCK)
1160 goto out;
1161 }
1162
1163 /* check for wrap through zero */
1164 if (b1 + len1 < b1) {
1165 len1 = EXT_MAX_BLOCK - b1;
1166 newext->ee_len = cpu_to_le16(len1);
1167 ret = 1;
1168 }
1169
1170 /* check for overlap */
1171 if (b1 + len1 > b2) {
1172 newext->ee_len = cpu_to_le16(b2 - b1);
1173 ret = 1;
1174 }
1175out:
1176 return ret;
1177}
1178
1179/*
1131 * ext4_ext_insert_extent: 1180 * ext4_ext_insert_extent:
1132 * tries to merge requsted extent into the existing extent or 1181 * tries to merge requsted extent into the existing extent or
1133 * inserts requested extent as new one into the tree, 1182 * inserts requested extent as new one into the tree,
@@ -1212,12 +1261,12 @@ has_space:
1212 if (!nearex) { 1261 if (!nearex) {
1213 /* there is no extent in this leaf, create first one */ 1262 /* there is no extent in this leaf, create first one */
1214 ext_debug("first extent in the leaf: %d:%llu:%d\n", 1263 ext_debug("first extent in the leaf: %d:%llu:%d\n",
1215 le32_to_cpu(newext->ee_block), 1264 le32_to_cpu(newext->ee_block),
1216 ext_pblock(newext), 1265 ext_pblock(newext),
1217 le16_to_cpu(newext->ee_len)); 1266 le16_to_cpu(newext->ee_len));
1218 path[depth].p_ext = EXT_FIRST_EXTENT(eh); 1267 path[depth].p_ext = EXT_FIRST_EXTENT(eh);
1219 } else if (le32_to_cpu(newext->ee_block) 1268 } else if (le32_to_cpu(newext->ee_block)
1220 > le32_to_cpu(nearex->ee_block)) { 1269 > le32_to_cpu(nearex->ee_block)) {
1221/* BUG_ON(newext->ee_block == nearex->ee_block); */ 1270/* BUG_ON(newext->ee_block == nearex->ee_block); */
1222 if (nearex != EXT_LAST_EXTENT(eh)) { 1271 if (nearex != EXT_LAST_EXTENT(eh)) {
1223 len = EXT_MAX_EXTENT(eh) - nearex; 1272 len = EXT_MAX_EXTENT(eh) - nearex;
@@ -1225,9 +1274,9 @@ has_space:
1225 len = len < 0 ? 0 : len; 1274 len = len < 0 ? 0 : len;
1226 ext_debug("insert %d:%llu:%d after: nearest 0x%p, " 1275 ext_debug("insert %d:%llu:%d after: nearest 0x%p, "
1227 "move %d from 0x%p to 0x%p\n", 1276 "move %d from 0x%p to 0x%p\n",
1228 le32_to_cpu(newext->ee_block), 1277 le32_to_cpu(newext->ee_block),
1229 ext_pblock(newext), 1278 ext_pblock(newext),
1230 le16_to_cpu(newext->ee_len), 1279 le16_to_cpu(newext->ee_len),
1231 nearex, len, nearex + 1, nearex + 2); 1280 nearex, len, nearex + 1, nearex + 2);
1232 memmove(nearex + 2, nearex + 1, len); 1281 memmove(nearex + 2, nearex + 1, len);
1233 } 1282 }
@@ -1358,9 +1407,9 @@ int ext4_ext_walk_space(struct inode *inode, unsigned long block,
1358 cbex.ec_start = 0; 1407 cbex.ec_start = 0;
1359 cbex.ec_type = EXT4_EXT_CACHE_GAP; 1408 cbex.ec_type = EXT4_EXT_CACHE_GAP;
1360 } else { 1409 } else {
1361 cbex.ec_block = le32_to_cpu(ex->ee_block); 1410 cbex.ec_block = le32_to_cpu(ex->ee_block);
1362 cbex.ec_len = le16_to_cpu(ex->ee_len); 1411 cbex.ec_len = le16_to_cpu(ex->ee_len);
1363 cbex.ec_start = ext_pblock(ex); 1412 cbex.ec_start = ext_pblock(ex);
1364 cbex.ec_type = EXT4_EXT_CACHE_EXTENT; 1413 cbex.ec_type = EXT4_EXT_CACHE_EXTENT;
1365 } 1414 }
1366 1415
@@ -1431,16 +1480,16 @@ ext4_ext_put_gap_in_cache(struct inode *inode, struct ext4_ext_path *path,
1431 len = le32_to_cpu(ex->ee_block) - block; 1480 len = le32_to_cpu(ex->ee_block) - block;
1432 ext_debug("cache gap(before): %lu [%lu:%lu]", 1481 ext_debug("cache gap(before): %lu [%lu:%lu]",
1433 (unsigned long) block, 1482 (unsigned long) block,
1434 (unsigned long) le32_to_cpu(ex->ee_block), 1483 (unsigned long) le32_to_cpu(ex->ee_block),
1435 (unsigned long) le16_to_cpu(ex->ee_len)); 1484 (unsigned long) le16_to_cpu(ex->ee_len));
1436 } else if (block >= le32_to_cpu(ex->ee_block) 1485 } else if (block >= le32_to_cpu(ex->ee_block)
1437 + le16_to_cpu(ex->ee_len)) { 1486 + le16_to_cpu(ex->ee_len)) {
1438 lblock = le32_to_cpu(ex->ee_block) 1487 lblock = le32_to_cpu(ex->ee_block)
1439 + le16_to_cpu(ex->ee_len); 1488 + le16_to_cpu(ex->ee_len);
1440 len = ext4_ext_next_allocated_block(path); 1489 len = ext4_ext_next_allocated_block(path);
1441 ext_debug("cache gap(after): [%lu:%lu] %lu", 1490 ext_debug("cache gap(after): [%lu:%lu] %lu",
1442 (unsigned long) le32_to_cpu(ex->ee_block), 1491 (unsigned long) le32_to_cpu(ex->ee_block),
1443 (unsigned long) le16_to_cpu(ex->ee_len), 1492 (unsigned long) le16_to_cpu(ex->ee_len),
1444 (unsigned long) block); 1493 (unsigned long) block);
1445 BUG_ON(len == lblock); 1494 BUG_ON(len == lblock);
1446 len = len - lblock; 1495 len = len - lblock;
@@ -1468,9 +1517,9 @@ ext4_ext_in_cache(struct inode *inode, unsigned long block,
1468 BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP && 1517 BUG_ON(cex->ec_type != EXT4_EXT_CACHE_GAP &&
1469 cex->ec_type != EXT4_EXT_CACHE_EXTENT); 1518 cex->ec_type != EXT4_EXT_CACHE_EXTENT);
1470 if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) { 1519 if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) {
1471 ex->ee_block = cpu_to_le32(cex->ec_block); 1520 ex->ee_block = cpu_to_le32(cex->ec_block);
1472 ext4_ext_store_pblock(ex, cex->ec_start); 1521 ext4_ext_store_pblock(ex, cex->ec_start);
1473 ex->ee_len = cpu_to_le16(cex->ec_len); 1522 ex->ee_len = cpu_to_le16(cex->ec_len);
1474 ext_debug("%lu cached by %lu:%lu:%llu\n", 1523 ext_debug("%lu cached by %lu:%lu:%llu\n",
1475 (unsigned long) block, 1524 (unsigned long) block,
1476 (unsigned long) cex->ec_block, 1525 (unsigned long) cex->ec_block,
@@ -1956,9 +2005,9 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1956 /* we should allocate requested block */ 2005 /* we should allocate requested block */
1957 } else if (goal == EXT4_EXT_CACHE_EXTENT) { 2006 } else if (goal == EXT4_EXT_CACHE_EXTENT) {
1958 /* block is already allocated */ 2007 /* block is already allocated */
1959 newblock = iblock 2008 newblock = iblock
1960 - le32_to_cpu(newex.ee_block) 2009 - le32_to_cpu(newex.ee_block)
1961 + ext_pblock(&newex); 2010 + ext_pblock(&newex);
1962 /* number of remaining blocks in the extent */ 2011 /* number of remaining blocks in the extent */
1963 allocated = le16_to_cpu(newex.ee_len) - 2012 allocated = le16_to_cpu(newex.ee_len) -
1964 (iblock - le32_to_cpu(newex.ee_block)); 2013 (iblock - le32_to_cpu(newex.ee_block));
@@ -1987,7 +2036,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1987 2036
1988 ex = path[depth].p_ext; 2037 ex = path[depth].p_ext;
1989 if (ex) { 2038 if (ex) {
1990 unsigned long ee_block = le32_to_cpu(ex->ee_block); 2039 unsigned long ee_block = le32_to_cpu(ex->ee_block);
1991 ext4_fsblk_t ee_start = ext_pblock(ex); 2040 ext4_fsblk_t ee_start = ext_pblock(ex);
1992 unsigned short ee_len = le16_to_cpu(ex->ee_len); 2041 unsigned short ee_len = le16_to_cpu(ex->ee_len);
1993 2042
@@ -2000,7 +2049,7 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2000 if (ee_len > EXT_MAX_LEN) 2049 if (ee_len > EXT_MAX_LEN)
2001 goto out2; 2050 goto out2;
2002 /* if found extent covers block, simply return it */ 2051 /* if found extent covers block, simply return it */
2003 if (iblock >= ee_block && iblock < ee_block + ee_len) { 2052 if (iblock >= ee_block && iblock < ee_block + ee_len) {
2004 newblock = iblock - ee_block + ee_start; 2053 newblock = iblock - ee_block + ee_start;
2005 /* number of remaining blocks in the extent */ 2054 /* number of remaining blocks in the extent */
2006 allocated = ee_len - (iblock - ee_block); 2055 allocated = ee_len - (iblock - ee_block);
@@ -2031,7 +2080,15 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2031 2080
2032 /* allocate new block */ 2081 /* allocate new block */
2033 goal = ext4_ext_find_goal(inode, path, iblock); 2082 goal = ext4_ext_find_goal(inode, path, iblock);
2034 allocated = max_blocks; 2083
2084 /* Check if we can really insert (iblock)::(iblock+max_blocks) extent */
2085 newex.ee_block = cpu_to_le32(iblock);
2086 newex.ee_len = cpu_to_le16(max_blocks);
2087 err = ext4_ext_check_overlap(inode, &newex, path);
2088 if (err)
2089 allocated = le16_to_cpu(newex.ee_len);
2090 else
2091 allocated = max_blocks;
2035 newblock = ext4_new_blocks(handle, inode, goal, &allocated, &err); 2092 newblock = ext4_new_blocks(handle, inode, goal, &allocated, &err);
2036 if (!newblock) 2093 if (!newblock)
2037 goto out2; 2094 goto out2;
@@ -2039,12 +2096,15 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
2039 goal, newblock, allocated); 2096 goal, newblock, allocated);
2040 2097
2041 /* try to insert new extent into found leaf and return */ 2098 /* try to insert new extent into found leaf and return */
2042 newex.ee_block = cpu_to_le32(iblock);
2043 ext4_ext_store_pblock(&newex, newblock); 2099 ext4_ext_store_pblock(&newex, newblock);
2044 newex.ee_len = cpu_to_le16(allocated); 2100 newex.ee_len = cpu_to_le16(allocated);
2045 err = ext4_ext_insert_extent(handle, inode, path, &newex); 2101 err = ext4_ext_insert_extent(handle, inode, path, &newex);
2046 if (err) 2102 if (err) {
2103 /* free data blocks we just allocated */
2104 ext4_free_blocks(handle, inode, ext_pblock(&newex),
2105 le16_to_cpu(newex.ee_len));
2047 goto out2; 2106 goto out2;
2107 }
2048 2108
2049 if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize) 2109 if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize)
2050 EXT4_I(inode)->i_disksize = inode->i_size; 2110 EXT4_I(inode)->i_disksize = inode->i_size;
@@ -2157,11 +2217,3 @@ int ext4_ext_writepage_trans_blocks(struct inode *inode, int num)
2157 2217
2158 return needed; 2218 return needed;
2159} 2219}
2160
2161EXPORT_SYMBOL(ext4_mark_inode_dirty);
2162EXPORT_SYMBOL(ext4_ext_invalidate_cache);
2163EXPORT_SYMBOL(ext4_ext_insert_extent);
2164EXPORT_SYMBOL(ext4_ext_walk_space);
2165EXPORT_SYMBOL(ext4_ext_find_goal);
2166EXPORT_SYMBOL(ext4_ext_calc_credits_for_insert);
2167
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index b34182b6ee4d..0bcf62a750ff 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -255,8 +255,8 @@ static int verify_chain(Indirect *from, Indirect *to)
255 * @inode: inode in question (we are only interested in its superblock) 255 * @inode: inode in question (we are only interested in its superblock)
256 * @i_block: block number to be parsed 256 * @i_block: block number to be parsed
257 * @offsets: array to store the offsets in 257 * @offsets: array to store the offsets in
258 * @boundary: set this non-zero if the referred-to block is likely to be 258 * @boundary: set this non-zero if the referred-to block is likely to be
259 * followed (on disk) by an indirect block. 259 * followed (on disk) by an indirect block.
260 * 260 *
261 * To store the locations of file's data ext4 uses a data structure common 261 * To store the locations of file's data ext4 uses a data structure common
262 * for UNIX filesystems - tree of pointers anchored in the inode, with 262 * for UNIX filesystems - tree of pointers anchored in the inode, with
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 4ec57be5baf5..2811e5720ad0 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -46,7 +46,7 @@
46 */ 46 */
47#define NAMEI_RA_CHUNKS 2 47#define NAMEI_RA_CHUNKS 2
48#define NAMEI_RA_BLOCKS 4 48#define NAMEI_RA_BLOCKS 4
49#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS) 49#define NAMEI_RA_SIZE (NAMEI_RA_CHUNKS * NAMEI_RA_BLOCKS)
50#define NAMEI_RA_INDEX(c,b) (((c) * NAMEI_RA_BLOCKS) + (b)) 50#define NAMEI_RA_INDEX(c,b) (((c) * NAMEI_RA_BLOCKS) + (b))
51 51
52static struct buffer_head *ext4_append(handle_t *handle, 52static struct buffer_head *ext4_append(handle_t *handle,
@@ -241,7 +241,7 @@ static inline unsigned dx_node_limit (struct inode *dir)
241static void dx_show_index (char * label, struct dx_entry *entries) 241static void dx_show_index (char * label, struct dx_entry *entries)
242{ 242{
243 int i, n = dx_get_count (entries); 243 int i, n = dx_get_count (entries);
244 printk("%s index ", label); 244 printk("%s index ", label);
245 for (i = 0; i < n; i++) { 245 for (i = 0; i < n; i++) {
246 printk("%x->%u ", i? dx_get_hash(entries + i) : 246 printk("%x->%u ", i? dx_get_hash(entries + i) :
247 0, dx_get_block(entries + i)); 247 0, dx_get_block(entries + i));
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index cb9afdd0e26e..175b68c60968 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1985,7 +1985,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
1985 1985
1986 if (bd_claim(bdev, sb)) { 1986 if (bd_claim(bdev, sb)) {
1987 printk(KERN_ERR 1987 printk(KERN_ERR
1988 "EXT4: failed to claim external journal device.\n"); 1988 "EXT4: failed to claim external journal device.\n");
1989 blkdev_put(bdev); 1989 blkdev_put(bdev);
1990 return NULL; 1990 return NULL;
1991 } 1991 }
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 479c1038ed4a..8c90cbc903fa 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -12,6 +12,7 @@
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/security.h> 13#include <linux/security.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/kallsyms.h>
15 16
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
17#include <asm/ioctls.h> 18#include <asm/ioctls.h>
@@ -20,6 +21,7 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
20 unsigned long arg) 21 unsigned long arg)
21{ 22{
22 int error = -ENOTTY; 23 int error = -ENOTTY;
24 void *f;
23 25
24 if (!filp->f_op) 26 if (!filp->f_op)
25 goto out; 27 goto out;
@@ -29,10 +31,16 @@ static long do_ioctl(struct file *filp, unsigned int cmd,
29 if (error == -ENOIOCTLCMD) 31 if (error == -ENOIOCTLCMD)
30 error = -EINVAL; 32 error = -EINVAL;
31 goto out; 33 goto out;
32 } else if (filp->f_op->ioctl) { 34 } else if ((f = filp->f_op->ioctl)) {
33 lock_kernel(); 35 lock_kernel();
34 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, 36 if (!filp->f_op->ioctl) {
35 filp, cmd, arg); 37 printk("%s: ioctl %p disappeared\n", __FUNCTION__, f);
38 print_symbol("symbol: %s\n", (unsigned long)f);
39 dump_stack();
40 } else {
41 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode,
42 filp, cmd, arg);
43 }
36 unlock_kernel(); 44 unlock_kernel();
37 } 45 }
38 46
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 4884d5edfe65..12e83f67eee4 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -229,9 +229,16 @@ static int jffs2_add_tn_to_tree(struct jffs2_sb_info *c,
229 check anyway. */ 229 check anyway. */
230 if (!tn->fn->size) { 230 if (!tn->fn->size) {
231 if (rii->mdata_tn) { 231 if (rii->mdata_tn) {
232 /* We had a candidate mdata node already */ 232 if (rii->mdata_tn->version < tn->version) {
233 dbg_readinode("kill old mdata with ver %d\n", rii->mdata_tn->version); 233 /* We had a candidate mdata node already */
234 jffs2_kill_tn(c, rii->mdata_tn); 234 dbg_readinode("kill old mdata with ver %d\n", rii->mdata_tn->version);
235 jffs2_kill_tn(c, rii->mdata_tn);
236 } else {
237 dbg_readinode("kill new mdata with ver %d (older than existing %d\n",
238 tn->version, rii->mdata_tn->version);
239 jffs2_kill_tn(c, tn);
240 return 0;
241 }
235 } 242 }
236 rii->mdata_tn = tn; 243 rii->mdata_tn = tn;
237 dbg_readinode("keep new mdata with ver %d\n", tn->version); 244 dbg_readinode("keep new mdata with ver %d\n", tn->version);
@@ -1044,7 +1051,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1044 1051
1045 case JFFS2_NODETYPE_DIRENT: 1052 case JFFS2_NODETYPE_DIRENT:
1046 1053
1047 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent)) { 1054 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_dirent) &&
1055 len < sizeof(struct jffs2_raw_dirent)) {
1048 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf); 1056 err = read_more(c, ref, sizeof(struct jffs2_raw_dirent), &len, buf);
1049 if (unlikely(err)) 1057 if (unlikely(err))
1050 goto free_out; 1058 goto free_out;
@@ -1058,7 +1066,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1058 1066
1059 case JFFS2_NODETYPE_INODE: 1067 case JFFS2_NODETYPE_INODE:
1060 1068
1061 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode)) { 1069 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_raw_inode) &&
1070 len < sizeof(struct jffs2_raw_inode)) {
1062 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf); 1071 err = read_more(c, ref, sizeof(struct jffs2_raw_inode), &len, buf);
1063 if (unlikely(err)) 1072 if (unlikely(err))
1064 goto free_out; 1073 goto free_out;
@@ -1071,7 +1080,8 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf
1071 break; 1080 break;
1072 1081
1073 default: 1082 default:
1074 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node)) { 1083 if (JFFS2_MIN_NODE_HEADER < sizeof(struct jffs2_unknown_node) &&
1084 len < sizeof(struct jffs2_unknown_node)) {
1075 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf); 1085 err = read_more(c, ref, sizeof(struct jffs2_unknown_node), &len, buf);
1076 if (unlikely(err)) 1086 if (unlikely(err))
1077 goto free_out; 1087 goto free_out;
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 6488af43bc9b..e220d3bd610d 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -19,7 +19,7 @@
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <linux/jffs2.h> 20#include <linux/jffs2.h>
21#include <linux/pagemap.h> 21#include <linux/pagemap.h>
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/super.h>
23#include <linux/ctype.h> 23#include <linux/ctype.h>
24#include <linux/namei.h> 24#include <linux/namei.h>
25#include "compr.h" 25#include "compr.h"
@@ -75,69 +75,27 @@ static const struct super_operations jffs2_super_operations =
75 .sync_fs = jffs2_sync_fs, 75 .sync_fs = jffs2_sync_fs,
76}; 76};
77 77
78static int jffs2_sb_compare(struct super_block *sb, void *data) 78/*
79{ 79 * fill in the superblock
80 struct jffs2_sb_info *p = data; 80 */
81 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 81static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
82
83 /* The superblocks are considered to be equivalent if the underlying MTD
84 device is the same one */
85 if (c->mtd == p->mtd) {
86 D1(printk(KERN_DEBUG "jffs2_sb_compare: match on device %d (\"%s\")\n", p->mtd->index, p->mtd->name));
87 return 1;
88 } else {
89 D1(printk(KERN_DEBUG "jffs2_sb_compare: No match, device %d (\"%s\"), device %d (\"%s\")\n",
90 c->mtd->index, c->mtd->name, p->mtd->index, p->mtd->name));
91 return 0;
92 }
93}
94
95static int jffs2_sb_set(struct super_block *sb, void *data)
96{
97 struct jffs2_sb_info *p = data;
98
99 /* For persistence of NFS exports etc. we use the same s_dev
100 each time we mount the device, don't just use an anonymous
101 device */
102 sb->s_fs_info = p;
103 p->os_priv = sb;
104 sb->s_dev = MKDEV(MTD_BLOCK_MAJOR, p->mtd->index);
105
106 return 0;
107}
108
109static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
110 int flags, const char *dev_name,
111 void *data, struct mtd_info *mtd,
112 struct vfsmount *mnt)
113{ 82{
114 struct super_block *sb;
115 struct jffs2_sb_info *c; 83 struct jffs2_sb_info *c;
116 int ret; 84
85 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd():"
86 " New superblock for device %d (\"%s\")\n",
87 sb->s_mtd->index, sb->s_mtd->name));
117 88
118 c = kzalloc(sizeof(*c), GFP_KERNEL); 89 c = kzalloc(sizeof(*c), GFP_KERNEL);
119 if (!c) 90 if (!c)
120 return -ENOMEM; 91 return -ENOMEM;
121 c->mtd = mtd;
122
123 sb = sget(fs_type, jffs2_sb_compare, jffs2_sb_set, c);
124
125 if (IS_ERR(sb))
126 goto out_error;
127
128 if (sb->s_root) {
129 /* New mountpoint for JFFS2 which is already mounted */
130 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): Device %d (\"%s\") is already mounted\n",
131 mtd->index, mtd->name));
132 ret = simple_set_mnt(mnt, sb);
133 goto out_put;
134 }
135 92
136 D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): New superblock for device %d (\"%s\")\n", 93 c->mtd = sb->s_mtd;
137 mtd->index, mtd->name)); 94 c->os_priv = sb;
95 sb->s_fs_info = c;
138 96
139 /* Initialize JFFS2 superblock locks, the further initialization will be 97 /* Initialize JFFS2 superblock locks, the further initialization will
140 * done later */ 98 * be done later */
141 init_MUTEX(&c->alloc_sem); 99 init_MUTEX(&c->alloc_sem);
142 init_MUTEX(&c->erase_free_sem); 100 init_MUTEX(&c->erase_free_sem);
143 init_waitqueue_head(&c->erase_wait); 101 init_waitqueue_head(&c->erase_wait);
@@ -146,133 +104,20 @@ static int jffs2_get_sb_mtd(struct file_system_type *fs_type,
146 spin_lock_init(&c->inocache_lock); 104 spin_lock_init(&c->inocache_lock);
147 105
148 sb->s_op = &jffs2_super_operations; 106 sb->s_op = &jffs2_super_operations;
149 sb->s_flags = flags | MS_NOATIME; 107 sb->s_flags = sb->s_flags | MS_NOATIME;
150 sb->s_xattr = jffs2_xattr_handlers; 108 sb->s_xattr = jffs2_xattr_handlers;
151#ifdef CONFIG_JFFS2_FS_POSIX_ACL 109#ifdef CONFIG_JFFS2_FS_POSIX_ACL
152 sb->s_flags |= MS_POSIXACL; 110 sb->s_flags |= MS_POSIXACL;
153#endif 111#endif
154 ret = jffs2_do_fill_super(sb, data, flags & MS_SILENT ? 1 : 0); 112 return jffs2_do_fill_super(sb, data, silent);
155
156 if (ret) {
157 /* Failure case... */
158 up_write(&sb->s_umount);
159 deactivate_super(sb);
160 return ret;
161 }
162
163 sb->s_flags |= MS_ACTIVE;
164 return simple_set_mnt(mnt, sb);
165
166out_error:
167 ret = PTR_ERR(sb);
168 out_put:
169 kfree(c);
170 put_mtd_device(mtd);
171
172 return ret;
173}
174
175static int jffs2_get_sb_mtdnr(struct file_system_type *fs_type,
176 int flags, const char *dev_name,
177 void *data, int mtdnr,
178 struct vfsmount *mnt)
179{
180 struct mtd_info *mtd;
181
182 mtd = get_mtd_device(NULL, mtdnr);
183 if (IS_ERR(mtd)) {
184 D1(printk(KERN_DEBUG "jffs2: MTD device #%u doesn't appear to exist\n", mtdnr));
185 return PTR_ERR(mtd);
186 }
187
188 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
189} 113}
190 114
191static int jffs2_get_sb(struct file_system_type *fs_type, 115static int jffs2_get_sb(struct file_system_type *fs_type,
192 int flags, const char *dev_name, 116 int flags, const char *dev_name,
193 void *data, struct vfsmount *mnt) 117 void *data, struct vfsmount *mnt)
194{ 118{
195 int err; 119 return get_sb_mtd(fs_type, flags, dev_name, data, jffs2_fill_super,
196 struct nameidata nd; 120 mnt);
197 int mtdnr;
198
199 if (!dev_name)
200 return -EINVAL;
201
202 D1(printk(KERN_DEBUG "jffs2_get_sb(): dev_name \"%s\"\n", dev_name));
203
204 /* The preferred way of mounting in future; especially when
205 CONFIG_BLK_DEV is implemented - we specify the underlying
206 MTD device by number or by name, so that we don't require
207 block device support to be present in the kernel. */
208
209 /* FIXME: How to do the root fs this way? */
210
211 if (dev_name[0] == 'm' && dev_name[1] == 't' && dev_name[2] == 'd') {
212 /* Probably mounting without the blkdev crap */
213 if (dev_name[3] == ':') {
214 struct mtd_info *mtd;
215
216 /* Mount by MTD device name */
217 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd:%%s, name \"%s\"\n", dev_name+4));
218 for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
219 mtd = get_mtd_device(NULL, mtdnr);
220 if (!IS_ERR(mtd)) {
221 if (!strcmp(mtd->name, dev_name+4))
222 return jffs2_get_sb_mtd(fs_type, flags, dev_name, data, mtd, mnt);
223 put_mtd_device(mtd);
224 }
225 }
226 printk(KERN_NOTICE "jffs2_get_sb(): MTD device with name \"%s\" not found.\n", dev_name+4);
227 } else if (isdigit(dev_name[3])) {
228 /* Mount by MTD device number name */
229 char *endptr;
230
231 mtdnr = simple_strtoul(dev_name+3, &endptr, 0);
232 if (!*endptr) {
233 /* It was a valid number */
234 D1(printk(KERN_DEBUG "jffs2_get_sb(): mtd%%d, mtdnr %d\n", mtdnr));
235 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt);
236 }
237 }
238 }
239
240 /* Try the old way - the hack where we allowed users to mount
241 /dev/mtdblock$(n) but didn't actually _use_ the blkdev */
242
243 err = path_lookup(dev_name, LOOKUP_FOLLOW, &nd);
244
245 D1(printk(KERN_DEBUG "jffs2_get_sb(): path_lookup() returned %d, inode %p\n",
246 err, nd.dentry->d_inode));
247
248 if (err)
249 return err;
250
251 err = -EINVAL;
252
253 if (!S_ISBLK(nd.dentry->d_inode->i_mode))
254 goto out;
255
256 if (nd.mnt->mnt_flags & MNT_NODEV) {
257 err = -EACCES;
258 goto out;
259 }
260
261 if (imajor(nd.dentry->d_inode) != MTD_BLOCK_MAJOR) {
262 if (!(flags & MS_SILENT))
263 printk(KERN_NOTICE "Attempt to mount non-MTD device \"%s\" as JFFS2\n",
264 dev_name);
265 goto out;
266 }
267
268 mtdnr = iminor(nd.dentry->d_inode);
269 path_release(&nd);
270
271 return jffs2_get_sb_mtdnr(fs_type, flags, dev_name, data, mtdnr, mnt);
272
273out:
274 path_release(&nd);
275 return err;
276} 121}
277 122
278static void jffs2_put_super (struct super_block *sb) 123static void jffs2_put_super (struct super_block *sb)
@@ -307,8 +152,7 @@ static void jffs2_kill_sb(struct super_block *sb)
307 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb); 152 struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
308 if (!(sb->s_flags & MS_RDONLY)) 153 if (!(sb->s_flags & MS_RDONLY))
309 jffs2_stop_garbage_collect_thread(c); 154 jffs2_stop_garbage_collect_thread(c);
310 generic_shutdown_super(sb); 155 kill_mtd_super(sb);
311 put_mtd_device(c->mtd);
312 kfree(c); 156 kfree(c);
313} 157}
314 158
diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c
index 78fc08893a6c..e48665984cb3 100644
--- a/fs/jffs2/xattr.c
+++ b/fs/jffs2/xattr.c
@@ -754,6 +754,10 @@ void jffs2_clear_xattr_subsystem(struct jffs2_sb_info *c)
754 list_del(&xd->xindex); 754 list_del(&xd->xindex);
755 jffs2_free_xattr_datum(xd); 755 jffs2_free_xattr_datum(xd);
756 } 756 }
757 list_for_each_entry_safe(xd, _xd, &c->xattr_unchecked, xindex) {
758 list_del(&xd->xindex);
759 jffs2_free_xattr_datum(xd);
760 }
757} 761}
758 762
759#define XREF_TMPHASH_SIZE (128) 763#define XREF_TMPHASH_SIZE (128)
@@ -825,7 +829,7 @@ void jffs2_build_xattr_subsystem(struct jffs2_sb_info *c)
825 ref->xd and ref->ic are not valid yet. */ 829 ref->xd and ref->ic are not valid yet. */
826 xd = jffs2_find_xattr_datum(c, ref->xid); 830 xd = jffs2_find_xattr_datum(c, ref->xid);
827 ic = jffs2_get_ino_cache(c, ref->ino); 831 ic = jffs2_get_ino_cache(c, ref->ino);
828 if (!xd || !ic) { 832 if (!xd || !ic || !ic->nlink) {
829 dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n", 833 dbg_xattr("xref(ino=%u, xid=%u, xseqno=%u) is orphan.\n",
830 ref->ino, ref->xid, ref->xseqno); 834 ref->ino, ref->xid, ref->xseqno);
831 ref->xseqno |= XREF_DELETE_MARKER; 835 ref->xseqno |= XREF_DELETE_MARKER;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 074791ce4ab2..b532a730cec2 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -140,7 +140,7 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na)
140 if (!ni->name) 140 if (!ni->name)
141 return -ENOMEM; 141 return -ENOMEM;
142 memcpy(ni->name, na->name, i); 142 memcpy(ni->name, na->name, i);
143 ni->name[i] = 0; 143 ni->name[na->name_len] = 0;
144 } 144 }
145 return 0; 145 return 0;
146} 146}
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index c8461551e108..1f0129405cf4 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -460,8 +460,8 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
460 kernel_long_ad laarr[EXTENT_MERGE_SIZE]; 460 kernel_long_ad laarr[EXTENT_MERGE_SIZE];
461 struct extent_position prev_epos, cur_epos, next_epos; 461 struct extent_position prev_epos, cur_epos, next_epos;
462 int count = 0, startnum = 0, endnum = 0; 462 int count = 0, startnum = 0, endnum = 0;
463 uint32_t elen = 0; 463 uint32_t elen = 0, tmpelen;
464 kernel_lb_addr eloc; 464 kernel_lb_addr eloc, tmpeloc;
465 int c = 1; 465 int c = 1;
466 loff_t lbcount = 0, b_off = 0; 466 loff_t lbcount = 0, b_off = 0;
467 uint32_t newblocknum, newblock; 467 uint32_t newblocknum, newblock;
@@ -520,8 +520,12 @@ static struct buffer_head * inode_getblk(struct inode * inode, sector_t block,
520 520
521 b_off -= lbcount; 521 b_off -= lbcount;
522 offset = b_off >> inode->i_sb->s_blocksize_bits; 522 offset = b_off >> inode->i_sb->s_blocksize_bits;
523 /* Move into indirect extent if we are at a pointer to it */ 523 /*
524 udf_next_aext(inode, &prev_epos, &eloc, &elen, 0); 524 * Move prev_epos and cur_epos into indirect extent if we are at
525 * the pointer to it
526 */
527 udf_next_aext(inode, &prev_epos, &tmpeloc, &tmpelen, 0);
528 udf_next_aext(inode, &cur_epos, &tmpeloc, &tmpelen, 0);
525 529
526 /* if the extent is allocated and recorded, return the block 530 /* if the extent is allocated and recorded, return the block
527 if the extent is not a multiple of the blocksize, round up */ 531 if the extent is not a multiple of the blocksize, round up */
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 3a743d854c17..6658afb41cc7 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1351,7 +1351,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1351 1351
1352 for (i=0; i<UDF_SB_NUMPARTS(sb); i++) 1352 for (i=0; i<UDF_SB_NUMPARTS(sb); i++)
1353 { 1353 {
1354 switch UDF_SB_PARTTYPE(sb, i) 1354 switch (UDF_SB_PARTTYPE(sb, i))
1355 { 1355 {
1356 case UDF_VIRTUAL_MAP15: 1356 case UDF_VIRTUAL_MAP15:
1357 case UDF_VIRTUAL_MAP20: 1357 case UDF_VIRTUAL_MAP20:
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index b62cd36ff324..e2fcee2b340d 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -13,7 +13,7 @@
13 13
14extern int pxm_to_node(int); 14extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern int __cpuinit acpi_map_pxm_to_node(int); 16extern int acpi_map_pxm_to_node(int);
17extern void __cpuinit acpi_unmap_pxm_to_node(int); 17extern void __cpuinit acpi_unmap_pxm_to_node(int);
18 18
19#endif /* CONFIG_ACPI_NUMA */ 19#endif /* CONFIG_ACPI_NUMA */
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5e07db0d46e9..ca882b8e7d10 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -78,7 +78,7 @@ struct acpi_signal_fatal_info {
78/* 78/*
79 * OSL Initialization and shutdown primitives 79 * OSL Initialization and shutdown primitives
80 */ 80 */
81acpi_status acpi_os_initialize(void); 81acpi_status __initdata acpi_os_initialize(void);
82 82
83acpi_status acpi_os_terminate(void); 83acpi_status acpi_os_terminate(void);
84 84
@@ -236,6 +236,7 @@ acpi_os_derive_pci_id(acpi_handle rhandle,
236 * Miscellaneous 236 * Miscellaneous
237 */ 237 */
238acpi_status acpi_os_validate_interface(char *interface); 238acpi_status acpi_os_validate_interface(char *interface);
239acpi_status acpi_osi_invalidate(char* interface);
239 240
240acpi_status 241acpi_status
241acpi_os_validate_address(u8 space_id, 242acpi_os_validate_address(u8 space_id,
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e08f7df85a4f..b5cca5daa348 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -55,7 +55,7 @@ acpi_status
55acpi_initialize_tables(struct acpi_table_desc *initial_storage, 55acpi_initialize_tables(struct acpi_table_desc *initial_storage,
56 u32 initial_table_count, u8 allow_resize); 56 u32 initial_table_count, u8 allow_resize);
57 57
58acpi_status acpi_initialize_subsystem(void); 58acpi_status __init acpi_initialize_subsystem(void);
59 59
60acpi_status acpi_enable_subsystem(u32 flags); 60acpi_status acpi_enable_subsystem(u32 flags);
61 61
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index 15a838862cd4..a87ef1c8d46b 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -390,6 +390,8 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object);
390 390
391u8 acpi_ut_valid_internal_object(void *object); 391u8 acpi_ut_valid_internal_object(void *object);
392 392
393union acpi_operand_object *acpi_ut_create_package_object(u32 count);
394
393union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size); 395union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
394 396
395union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size); 397union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h
index 457c34b6eb09..90e6b5d6c214 100644
--- a/include/asm-alpha/core_t2.h
+++ b/include/asm-alpha/core_t2.h
@@ -437,9 +437,15 @@ static inline void t2_outl(u32 b, unsigned long addr)
437 437
438static DEFINE_SPINLOCK(t2_hae_lock); 438static DEFINE_SPINLOCK(t2_hae_lock);
439 439
440/*
441 * NOTE: take T2_DENSE_MEM off in each readX/writeX routine, since
442 * they may be called directly, rather than through the
443 * ioreadNN/iowriteNN routines.
444 */
445
440__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr) 446__EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
441{ 447{
442 unsigned long addr = (unsigned long) xaddr; 448 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
443 unsigned long result, msb; 449 unsigned long result, msb;
444 unsigned long flags; 450 unsigned long flags;
445 spin_lock_irqsave(&t2_hae_lock, flags); 451 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -453,7 +459,7 @@ __EXTERN_INLINE u8 t2_readb(const volatile void __iomem *xaddr)
453 459
454__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr) 460__EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
455{ 461{
456 unsigned long addr = (unsigned long) xaddr; 462 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
457 unsigned long result, msb; 463 unsigned long result, msb;
458 unsigned long flags; 464 unsigned long flags;
459 spin_lock_irqsave(&t2_hae_lock, flags); 465 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -471,7 +477,7 @@ __EXTERN_INLINE u16 t2_readw(const volatile void __iomem *xaddr)
471 */ 477 */
472__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr) 478__EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
473{ 479{
474 unsigned long addr = (unsigned long) xaddr; 480 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
475 unsigned long result, msb; 481 unsigned long result, msb;
476 unsigned long flags; 482 unsigned long flags;
477 spin_lock_irqsave(&t2_hae_lock, flags); 483 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -485,7 +491,7 @@ __EXTERN_INLINE u32 t2_readl(const volatile void __iomem *xaddr)
485 491
486__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr) 492__EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
487{ 493{
488 unsigned long addr = (unsigned long) xaddr; 494 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
489 unsigned long r0, r1, work, msb; 495 unsigned long r0, r1, work, msb;
490 unsigned long flags; 496 unsigned long flags;
491 spin_lock_irqsave(&t2_hae_lock, flags); 497 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -501,7 +507,7 @@ __EXTERN_INLINE u64 t2_readq(const volatile void __iomem *xaddr)
501 507
502__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr) 508__EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
503{ 509{
504 unsigned long addr = (unsigned long) xaddr; 510 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
505 unsigned long msb, w; 511 unsigned long msb, w;
506 unsigned long flags; 512 unsigned long flags;
507 spin_lock_irqsave(&t2_hae_lock, flags); 513 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -515,7 +521,7 @@ __EXTERN_INLINE void t2_writeb(u8 b, volatile void __iomem *xaddr)
515 521
516__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr) 522__EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
517{ 523{
518 unsigned long addr = (unsigned long) xaddr; 524 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
519 unsigned long msb, w; 525 unsigned long msb, w;
520 unsigned long flags; 526 unsigned long flags;
521 spin_lock_irqsave(&t2_hae_lock, flags); 527 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -533,7 +539,7 @@ __EXTERN_INLINE void t2_writew(u16 b, volatile void __iomem *xaddr)
533 */ 539 */
534__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr) 540__EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
535{ 541{
536 unsigned long addr = (unsigned long) xaddr; 542 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
537 unsigned long msb; 543 unsigned long msb;
538 unsigned long flags; 544 unsigned long flags;
539 spin_lock_irqsave(&t2_hae_lock, flags); 545 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -546,7 +552,7 @@ __EXTERN_INLINE void t2_writel(u32 b, volatile void __iomem *xaddr)
546 552
547__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr) 553__EXTERN_INLINE void t2_writeq(u64 b, volatile void __iomem *xaddr)
548{ 554{
549 unsigned long addr = (unsigned long) xaddr; 555 unsigned long addr = (unsigned long) xaddr - T2_DENSE_MEM;
550 unsigned long msb, work; 556 unsigned long msb, work;
551 unsigned long flags; 557 unsigned long flags;
552 spin_lock_irqsave(&t2_hae_lock, flags); 558 spin_lock_irqsave(&t2_hae_lock, flags);
@@ -587,14 +593,14 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
587__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \ 593__EXTERN_INLINE unsigned int t2_ioread##NS(void __iomem *xaddr) \
588{ \ 594{ \
589 if (t2_is_mmio(xaddr)) \ 595 if (t2_is_mmio(xaddr)) \
590 return t2_read##OS(xaddr - T2_DENSE_MEM); \ 596 return t2_read##OS(xaddr); \
591 else \ 597 else \
592 return t2_in##OS((unsigned long)xaddr - T2_IO); \ 598 return t2_in##OS((unsigned long)xaddr - T2_IO); \
593} \ 599} \
594__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \ 600__EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr) \
595{ \ 601{ \
596 if (t2_is_mmio(xaddr)) \ 602 if (t2_is_mmio(xaddr)) \
597 t2_write##OS(b, xaddr - T2_DENSE_MEM); \ 603 t2_write##OS(b, xaddr); \
598 else \ 604 else \
599 t2_out##OS(b, (unsigned long)xaddr - T2_IO); \ 605 t2_out##OS(b, (unsigned long)xaddr - T2_IO); \
600} 606}
diff --git a/include/asm-alpha/core_titan.h b/include/asm-alpha/core_titan.h
index a64ccbff7d98..a17f6f33b68e 100644
--- a/include/asm-alpha/core_titan.h
+++ b/include/asm-alpha/core_titan.h
@@ -380,12 +380,7 @@ struct el_PRIVATEER_envdata_mcheck {
380/* 380/*
381 * Memory functions. all accesses are done through linear space. 381 * Memory functions. all accesses are done through linear space.
382 */ 382 */
383 383extern void __iomem *titan_ioportmap(unsigned long addr);
384__EXTERN_INLINE void __iomem *titan_ioportmap(unsigned long addr)
385{
386 return (void __iomem *)(addr + TITAN_IO_BIAS);
387}
388
389extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size); 384extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size);
390extern void titan_iounmap(volatile void __iomem *addr); 385extern void titan_iounmap(volatile void __iomem *addr);
391 386
diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h
index 44e635d2c571..58d4fe48742c 100644
--- a/include/asm-alpha/core_tsunami.h
+++ b/include/asm-alpha/core_tsunami.h
@@ -2,6 +2,7 @@
2#define __ALPHA_TSUNAMI__H__ 2#define __ALPHA_TSUNAMI__H__
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/pci.h>
5#include <asm/compiler.h> 6#include <asm/compiler.h>
6 7
7/* 8/*
@@ -302,18 +303,8 @@ struct el_TSUNAMI_sysdata_mcheck {
302/* 303/*
303 * Memory functions. all accesses are done through linear space. 304 * Memory functions. all accesses are done through linear space.
304 */ 305 */
305 306extern void __iomem *tsunami_ioportmap(unsigned long addr);
306__EXTERN_INLINE void __iomem *tsunami_ioportmap(unsigned long addr) 307extern void __iomem *tsunami_ioremap(unsigned long addr, unsigned long size);
307{
308 return (void __iomem *)(addr + TSUNAMI_IO_BIAS);
309}
310
311__EXTERN_INLINE void __iomem *tsunami_ioremap(unsigned long addr,
312 unsigned long size)
313{
314 return (void __iomem *)(addr + TSUNAMI_MEM_BIAS);
315}
316
317__EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr) 308__EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
318{ 309{
319 return addr >= TSUNAMI_BASE; 310 return addr >= TSUNAMI_BASE;
diff --git a/include/asm-alpha/core_wildfire.h b/include/asm-alpha/core_wildfire.h
index 12af803d445a..cd562f544ba2 100644
--- a/include/asm-alpha/core_wildfire.h
+++ b/include/asm-alpha/core_wildfire.h
@@ -295,7 +295,7 @@ __EXTERN_INLINE int wildfire_is_ioaddr(unsigned long addr)
295 295
296__EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr) 296__EXTERN_INLINE int wildfire_is_mmio(const volatile void __iomem *xaddr)
297{ 297{
298 unsigned long addr = (unsigned long)addr; 298 unsigned long addr = (unsigned long)xaddr;
299 return (addr & 0x100000000UL) == 0; 299 return (addr & 0x100000000UL) == 0;
300} 300}
301 301
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h
index ed06f59b544d..e8df1e7aae6b 100644
--- a/include/asm-alpha/vga.h
+++ b/include/asm-alpha/vga.h
@@ -46,6 +46,37 @@ extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count);
46#define vga_readb(a) readb((u8 __iomem *)(a)) 46#define vga_readb(a) readb((u8 __iomem *)(a))
47#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) 47#define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a))
48 48
49#ifdef CONFIG_VGA_HOSE
50#include <linux/ioport.h>
51#include <linux/pci.h>
52
53extern struct pci_controller *pci_vga_hose;
54
55# define __is_port_vga(a) \
56 (((a) >= 0x3b0) && ((a) < 0x3e0) && \
57 ((a) != 0x3b3) && ((a) != 0x3d3))
58
59# define __is_mem_vga(a) \
60 (((a) >= 0xa0000) && ((a) <= 0xc0000))
61
62# define FIXUP_IOADDR_VGA(a) do { \
63 if (pci_vga_hose && __is_port_vga(a)) \
64 (a) += pci_vga_hose->io_space->start; \
65 } while(0)
66
67# define FIXUP_MEMADDR_VGA(a) do { \
68 if (pci_vga_hose && __is_mem_vga(a)) \
69 (a) += pci_vga_hose->mem_space->start; \
70 } while(0)
71
72#else /* CONFIG_VGA_HOSE */
73# define pci_vga_hose 0
74# define __is_port_vga(a) 0
75# define __is_mem_vga(a) 0
76# define FIXUP_IOADDR_VGA(a)
77# define FIXUP_MEMADDR_VGA(a)
78#endif /* CONFIG_VGA_HOSE */
79
49#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s)) 80#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s))
50 81
51#endif 82#endif
diff --git a/include/asm-arm/arch-at91/at91_shdwc.h b/include/asm-arm/arch-at91/at91_shdwc.h
index 795fcc266228..01b433de2272 100644
--- a/include/asm-arm/arch-at91/at91_shdwc.h
+++ b/include/asm-arm/arch-at91/at91_shdwc.h
@@ -14,8 +14,8 @@
14#define AT91_SHDWC_H 14#define AT91_SHDWC_H
15 15
16#define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */ 16#define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */
17#define AT91_SHDW_SHDW (1 << 0) /* Processor Reset */ 17#define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */
18#define AT91_SHDW_KEY (0xff << 24) /* KEY Password */ 18#define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */
19 19
20#define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */ 20#define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */
21#define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */ 21#define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */
diff --git a/include/asm-arm/arch-at91/at91_wdt.h b/include/asm-arm/arch-at91/at91_wdt.h
index 7251a344c740..1014e9bf181f 100644
--- a/include/asm-arm/arch-at91/at91_wdt.h
+++ b/include/asm-arm/arch-at91/at91_wdt.h
@@ -15,7 +15,7 @@
15 15
16#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */ 16#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */
17#define AT91_WDT_WDRSTT (1 << 0) /* Restart */ 17#define AT91_WDT_WDRSTT (1 << 0) /* Restart */
18#define AT91_WDT_KEY (0xff << 24) /* KEY Password */ 18#define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */
19 19
20#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */ 20#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */
21#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ 21#define AT91_WDT_WDV (0xfff << 0) /* Counter Value */
diff --git a/include/asm-arm/arch-pxa/gpio.h b/include/asm-arm/arch-pxa/gpio.h
index aeba24347f8e..9e99241f3edf 100644
--- a/include/asm-arm/arch-pxa/gpio.h
+++ b/include/asm-arm/arch-pxa/gpio.h
@@ -45,7 +45,8 @@ static inline int gpio_direction_input(unsigned gpio)
45 45
46static inline int gpio_direction_output(unsigned gpio, int value) 46static inline int gpio_direction_output(unsigned gpio, int value)
47{ 47{
48 return pxa_gpio_mode(gpio | GPIO_OUT | (value ? 0 : GPIO_DFLT_LOW)); 48 return pxa_gpio_mode(gpio | GPIO_OUT |
49 (value ? GPIO_DFLT_HIGH : GPIO_DFLT_LOW));
49} 50}
50 51
51static inline int __gpio_get_value(unsigned gpio) 52static inline int __gpio_get_value(unsigned gpio)
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index be303b3eef40..6931af525da3 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -12,6 +12,7 @@
12#ifndef _ASM_SYSTEM_H 12#ifndef _ASM_SYSTEM_H
13#define _ASM_SYSTEM_H 13#define _ASM_SYSTEM_H
14 14
15#include <linux/types.h>
15#include <linux/linkage.h> 16#include <linux/linkage.h>
16 17
17struct thread_struct; 18struct thread_struct;
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 8307b1bb337a..84155eb67f1d 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -14,8 +14,8 @@
14 *(.data) \ 14 *(.data) \
15 *(.data.init.refok) 15 *(.data.init.refok)
16 16
17#define RODATA \ 17#define RO_DATA(align) \
18 . = ALIGN(4096); \ 18 . = ALIGN((align)); \
19 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 19 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
20 VMLINUX_SYMBOL(__start_rodata) = .; \ 20 VMLINUX_SYMBOL(__start_rodata) = .; \
21 *(.rodata) *(.rodata.*) \ 21 *(.rodata) *(.rodata.*) \
@@ -135,7 +135,11 @@
135 VMLINUX_SYMBOL(__end_rodata) = .; \ 135 VMLINUX_SYMBOL(__end_rodata) = .; \
136 } \ 136 } \
137 \ 137 \
138 . = ALIGN(4096); 138 . = ALIGN((align));
139
140/* RODATA provided for backward compatibility.
141 * All archs are supposed to use RO_DATA() */
142#define RODATA RO_DATA(4096)
139 143
140#define SECURITY_INIT \ 144#define SECURITY_INIT \
141 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ 145 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
diff --git a/include/asm-h8300/processor.h b/include/asm-h8300/processor.h
index 99b664aa2083..49fc886a6232 100644
--- a/include/asm-h8300/processor.h
+++ b/include/asm-h8300/processor.h
@@ -78,7 +78,7 @@ struct thread_struct {
78do { \ 78do { \
79 set_fs(USER_DS); /* reads from user space */ \ 79 set_fs(USER_DS); /* reads from user space */ \
80 (_regs)->pc = (_pc); \ 80 (_regs)->pc = (_pc); \
81 (_regs)->ccr &= 0x00; /* clear kernel flag */ \ 81 (_regs)->ccr = 0x00; /* clear all flags */ \
82 (_regs)->er5 = current->mm->start_data; /* GOT base */ \ 82 (_regs)->er5 = current->mm->start_data; /* GOT base */ \
83 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \ 83 wrusp((unsigned long)(_usp) - sizeof(unsigned long)*3); \
84} while(0) 84} while(0)
diff --git a/include/asm-m68k/mmzone.h b/include/asm-m68k/mmzone.h
new file mode 100644
index 000000000000..e1f1ec7b7006
--- /dev/null
+++ b/include/asm-m68k/mmzone.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_M68K_MMZONE_H_
2#define _ASM_M68K_MMZONE_H_
3
4extern pg_data_t pg_data_map[];
5
6#define NODE_DATA(nid) (&pg_data_map[nid])
7#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
8
9#endif /* _ASM_M68K_MMZONE_H_ */
diff --git a/include/asm-m68k/module.h b/include/asm-m68k/module.h
index c6d75af2d8d3..382d20a6fc18 100644
--- a/include/asm-m68k/module.h
+++ b/include/asm-m68k/module.h
@@ -1,7 +1,39 @@
1#ifndef _ASM_M68K_MODULE_H 1#ifndef _ASM_M68K_MODULE_H
2#define _ASM_M68K_MODULE_H 2#define _ASM_M68K_MODULE_H
3struct mod_arch_specific { }; 3
4struct mod_arch_specific {
5 struct m68k_fixup_info *fixup_start, *fixup_end;
6};
7
8#define MODULE_ARCH_INIT { \
9 .fixup_start = __start_fixup, \
10 .fixup_end = __stop_fixup, \
11}
12
4#define Elf_Shdr Elf32_Shdr 13#define Elf_Shdr Elf32_Shdr
5#define Elf_Sym Elf32_Sym 14#define Elf_Sym Elf32_Sym
6#define Elf_Ehdr Elf32_Ehdr 15#define Elf_Ehdr Elf32_Ehdr
16
17
18enum m68k_fixup_type {
19 m68k_fixup_memoffset,
20 m68k_fixup_vnode_shift,
21};
22
23struct m68k_fixup_info {
24 enum m68k_fixup_type type;
25 void *addr;
26};
27
28#define m68k_fixup(type, addr) \
29 " .section \".m68k_fixup\",\"aw\"\n" \
30 " .long " #type "," #addr "\n" \
31 " .previous\n"
32
33extern struct m68k_fixup_info __start_fixup[], __stop_fixup[];
34
35struct module;
36extern void module_fixup(struct module *mod, struct m68k_fixup_info *start,
37 struct m68k_fixup_info *end);
38
7#endif /* _ASM_M68K_MODULE_H */ 39#endif /* _ASM_M68K_MODULE_H */
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
index 61e4406ed96a..b5b78c01eb6c 100644
--- a/include/asm-m68k/motorola_pgtable.h
+++ b/include/asm-m68k/motorola_pgtable.h
@@ -130,7 +130,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
130#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE)) 130#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE))
131#define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; }) 131#define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; })
132 132
133#define pte_page(pte) (mem_map + ((unsigned long)(__va(pte_val(pte)) - PAGE_OFFSET) >> PAGE_SHIFT)) 133#define pte_page(pte) virt_to_page(__va(pte_val(pte)))
134#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 134#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
135#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 135#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
136 136
@@ -143,7 +143,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
143 while (--__i >= 0) \ 143 while (--__i >= 0) \
144 *__ptr++ = 0; \ 144 *__ptr++ = 0; \
145}) 145})
146#define pmd_page(pmd) (mem_map + ((unsigned long)(__va(pmd_val(pmd)) - PAGE_OFFSET) >> PAGE_SHIFT)) 146#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd)))
147 147
148 148
149#define pgd_none(pgd) (!pgd_val(pgd)) 149#define pgd_none(pgd) (!pgd_val(pgd))
@@ -223,10 +223,10 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address)
223 return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); 223 return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
224} 224}
225 225
226#define pte_offset_map(pmdp,address) ((pte_t *)kmap(pmd_page(*pmdp)) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 226#define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
227#define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address) 227#define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address)
228#define pte_unmap(pte) kunmap(pte) 228#define pte_unmap(pte) ((void)0)
229#define pte_unmap_nested(pte) kunmap(pte) 229#define pte_unmap_nested(pte) ((void)0)
230 230
231/* 231/*
232 * Allocate and free page tables. The xxx_kernel() versions are 232 * Allocate and free page tables. The xxx_kernel() versions are
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index fcc165ddd09e..9e6d0d6debdb 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -27,6 +27,8 @@
27 27
28#ifndef __ASSEMBLY__ 28#ifndef __ASSEMBLY__
29 29
30#include <asm/module.h>
31
30#define get_user_page(vaddr) __get_free_page(GFP_KERNEL) 32#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
31#define free_user_page(page, addr) free_page(addr) 33#define free_user_page(page, addr) free_page(addr)
32 34
@@ -114,18 +116,33 @@ typedef struct { unsigned long pgprot; } pgprot_t;
114 116
115#ifndef __ASSEMBLY__ 117#ifndef __ASSEMBLY__
116 118
119extern unsigned long m68k_memoffset;
120
117#ifndef CONFIG_SUN3 121#ifndef CONFIG_SUN3
118 122
119#define WANT_PAGE_VIRTUAL 123#define WANT_PAGE_VIRTUAL
120#ifdef CONFIG_SINGLE_MEMORY_CHUNK
121extern unsigned long m68k_memoffset;
122 124
123#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset) 125static inline unsigned long ___pa(void *vaddr)
124#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset)) 126{
125#else 127 unsigned long paddr;
126#define __pa(vaddr) virt_to_phys((void *)(vaddr)) 128 asm (
127#define __va(paddr) phys_to_virt((unsigned long)(paddr)) 129 "1: addl #0,%0\n"
128#endif 130 m68k_fixup(%c2, 1b+2)
131 : "=r" (paddr)
132 : "0" (vaddr), "i" (m68k_fixup_memoffset));
133 return paddr;
134}
135#define __pa(vaddr) ___pa((void *)(vaddr))
136static inline void *__va(unsigned long paddr)
137{
138 void *vaddr;
139 asm (
140 "1: subl #0,%0\n"
141 m68k_fixup(%c2, 1b+2)
142 : "=r" (vaddr)
143 : "0" (paddr), "i" (m68k_fixup_memoffset));
144 return vaddr;
145}
129 146
130#else /* !CONFIG_SUN3 */ 147#else /* !CONFIG_SUN3 */
131/* This #define is a horrible hack to suppress lots of warnings. --m */ 148/* This #define is a horrible hack to suppress lots of warnings. --m */
@@ -161,11 +178,47 @@ static inline void *__va(unsigned long x)
161#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 178#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
162#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 179#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
163 180
164#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) 181extern int m68k_virt_to_node_shift;
165#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) 182
183#ifdef CONFIG_SINGLE_MEMORY_CHUNK
184#define __virt_to_node(addr) (&pg_data_map[0])
185#else
186extern struct pglist_data *pg_data_table[];
187
188static inline __attribute_const__ int __virt_to_node_shift(void)
189{
190 int shift;
191
192 asm (
193 "1: moveq #0,%0\n"
194 m68k_fixup(%c1, 1b)
195 : "=d" (shift)
196 : "i" (m68k_fixup_vnode_shift));
197 return shift;
198}
199
200#define __virt_to_node(addr) (pg_data_table[(unsigned long)(addr) >> __virt_to_node_shift()])
201#endif
166 202
167#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) 203#define virt_to_page(addr) ({ \
168#define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) 204 pfn_to_page(virt_to_pfn(addr)); \
205})
206#define page_to_virt(page) ({ \
207 pfn_to_virt(page_to_pfn(page)); \
208})
209
210#define pfn_to_page(pfn) ({ \
211 unsigned long __pfn = (pfn); \
212 struct pglist_data *pgdat; \
213 pgdat = __virt_to_node((unsigned long)pfn_to_virt(__pfn)); \
214 pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \
215})
216#define page_to_pfn(_page) ({ \
217 struct page *__p = (_page); \
218 struct pglist_data *pgdat; \
219 pgdat = &pg_data_map[page_to_nid(__p)]; \
220 ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \
221})
169 222
170#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) 223#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
171#define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) 224#define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
diff --git a/include/asm-m68k/pgalloc.h b/include/asm-m68k/pgalloc.h
index a9cfb4b99d88..4cb1a57ab763 100644
--- a/include/asm-m68k/pgalloc.h
+++ b/include/asm-m68k/pgalloc.h
@@ -8,11 +8,12 @@
8#include <asm/virtconvert.h> 8#include <asm/virtconvert.h>
9 9
10 10
11
12#ifdef CONFIG_SUN3 11#ifdef CONFIG_SUN3
13#include <asm/sun3_pgalloc.h> 12#include <asm/sun3_pgalloc.h>
14#else 13#else
15#include <asm/motorola_pgalloc.h> 14#include <asm/motorola_pgalloc.h>
16#endif 15#endif
17 16
17extern void m68k_setup_node(int node);
18
18#endif /* M68K_PGALLOC_H */ 19#endif /* M68K_PGALLOC_H */
diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h
index 555b87a1f7e3..778a4c538eb2 100644
--- a/include/asm-m68k/pgtable.h
+++ b/include/asm-m68k/pgtable.h
@@ -107,22 +107,7 @@ extern void *empty_zero_page;
107/* 64-bit machines, beware! SRB. */ 107/* 64-bit machines, beware! SRB. */
108#define SIZEOF_PTR_LOG2 2 108#define SIZEOF_PTR_LOG2 2
109 109
110/* 110#define mm_end_of_chunk(addr, len) 0
111 * Check if the addr/len goes up to the end of a physical
112 * memory chunk. Used for DMA functions.
113 */
114#ifdef CONFIG_SINGLE_MEMORY_CHUNK
115/*
116 * It makes no sense to consider whether we cross a memory boundary if
117 * we support just one physical chunk of memory.
118 */
119static inline int mm_end_of_chunk(unsigned long addr, int len)
120{
121 return 0;
122}
123#else
124int mm_end_of_chunk (unsigned long addr, int len);
125#endif
126 111
127extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); 112extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
128 113
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h
index 5156a28a18d8..b9e62c1e7ae3 100644
--- a/include/asm-m68k/sun3_pgtable.h
+++ b/include/asm-m68k/sun3_pgtable.h
@@ -132,8 +132,8 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p
132#define pfn_pte(pfn, pgprot) \ 132#define pfn_pte(pfn, pgprot) \
133({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) 133({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; })
134 134
135#define pte_page(pte) (mem_map+((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)) 135#define pte_page(pte) virt_to_page(__pte_page(pte))
136#define pmd_page(pmd) (mem_map+((__pmd_page(pmd) - PAGE_OFFSET) >> PAGE_SHIFT)) 136#define pmd_page(pmd) virt_to_page(__pmd_page(pmd))
137 137
138 138
139static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } 139static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); }
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index 83a87c9b1a16..dea32fbc7e51 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -8,56 +8,35 @@
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/mmzone.h>
11#include <asm/setup.h> 12#include <asm/setup.h>
12#include <asm/page.h> 13#include <asm/page.h>
13 14
14#ifdef CONFIG_AMIGA
15#include <asm/amigahw.h>
16#endif
17
18/* 15/*
19 * Change virtual addresses to physical addresses and vv. 16 * Change virtual addresses to physical addresses and vv.
20 */ 17 */
21#ifndef CONFIG_SUN3
22extern unsigned long mm_vtop(unsigned long addr) __attribute_const__;
23extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
24#else
25static inline unsigned long mm_vtop(unsigned long vaddr)
26{
27 return __pa(vaddr);
28}
29
30static inline unsigned long mm_ptov(unsigned long paddr)
31{
32 return (unsigned long)__va(paddr);
33}
34#endif
35
36#ifdef CONFIG_SINGLE_MEMORY_CHUNK
37static inline unsigned long virt_to_phys(void *vaddr)
38{
39 return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr;
40}
41
42static inline void * phys_to_virt(unsigned long paddr)
43{
44 return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET);
45}
46#else
47static inline unsigned long virt_to_phys(void *address) 18static inline unsigned long virt_to_phys(void *address)
48{ 19{
49 return mm_vtop((unsigned long)address); 20 return __pa(address);
50} 21}
51 22
52static inline void *phys_to_virt(unsigned long address) 23static inline void *phys_to_virt(unsigned long address)
53{ 24{
54 return (void *) mm_ptov(address); 25 return __va(address);
55} 26}
56#endif
57 27
58/* Permanent address of a page. */ 28/* Permanent address of a page. */
59#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) 29#ifdef CONFIG_SINGLE_MEMORY_CHUNK
60#define page_to_phys(page) virt_to_phys((void *)__page_address(page)) 30#define page_to_phys(page) \
31 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
32#else
33#define page_to_phys(_page) ({ \
34 struct page *__page = _page; \
35 struct pglist_data *pgdat; \
36 pgdat = pg_data_table[page_to_nid(__page)]; \
37 page_to_pfn(__page) << PAGE_SHIFT; \
38})
39#endif
61 40
62/* 41/*
63 * IO bus memory addresses are 1:1 with the physical address, 42 * IO bus memory addresses are 1:1 with the physical address,
diff --git a/include/asm-mips/asmmacro.h b/include/asm-mips/asmmacro.h
index 92e62ef711ed..c5f20df780e9 100644
--- a/include/asm-mips/asmmacro.h
+++ b/include/asm-mips/asmmacro.h
@@ -52,21 +52,6 @@
52 .endm 52 .endm
53#endif /* CONFIG_MIPS_MT_SMTC */ 53#endif /* CONFIG_MIPS_MT_SMTC */
54 54
55#ifdef CONFIG_CPU_SB1
56 .macro fpu_enable_hazard
57 .set push
58 .set noreorder
59 .set mips2
60 SSNOP
61 bnezl $0, .+4
62 SSNOP
63 .set pop
64 .endm
65#else
66 .macro fpu_enable_hazard
67 .endm
68#endif
69
70/* 55/*
71 * Temporary until all gas have MT ASE support 56 * Temporary until all gas have MT ASE support
72 */ 57 */
diff --git a/include/asm-mips/mips-boards/prom.h b/include/asm-mips/mips-boards/prom.h
index daaf9f98fc63..a9db576a9768 100644
--- a/include/asm-mips/mips-boards/prom.h
+++ b/include/asm-mips/mips-boards/prom.h
@@ -33,6 +33,7 @@ extern void prom_meminit(void);
33extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem); 33extern void prom_fixup_mem_map(unsigned long start_mem, unsigned long end_mem);
34extern void mips_display_message(const char *str); 34extern void mips_display_message(const char *str);
35extern void mips_display_word(unsigned int num); 35extern void mips_display_word(unsigned int num);
36extern void mips_scroll_message(void);
36extern int get_ethernet_addr(char *ethernet_addr); 37extern int get_ethernet_addr(char *ethernet_addr);
37 38
38/* Memory descriptor management. */ 39/* Memory descriptor management. */
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index 2f1087b3a202..91c306fcfb72 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -949,7 +949,6 @@
949#define __ARCH_WANT_SYS_UTIME 949#define __ARCH_WANT_SYS_UTIME
950#define __ARCH_WANT_SYS_WAITPID 950#define __ARCH_WANT_SYS_WAITPID
951#define __ARCH_WANT_SYS_SOCKETCALL 951#define __ARCH_WANT_SYS_SOCKETCALL
952#define __ARCH_WANT_SYS_FADVISE64
953#define __ARCH_WANT_SYS_GETPGRP 952#define __ARCH_WANT_SYS_GETPGRP
954#define __ARCH_WANT_SYS_LLSEEK 953#define __ARCH_WANT_SYS_LLSEEK
955#define __ARCH_WANT_SYS_NICE 954#define __ARCH_WANT_SYS_NICE
diff --git a/include/asm-powerpc/pgalloc-64.h b/include/asm-powerpc/pgalloc-64.h
index d9a3a8ca58a1..94d0294341d6 100644
--- a/include/asm-powerpc/pgalloc-64.h
+++ b/include/asm-powerpc/pgalloc-64.h
@@ -90,7 +90,8 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
90static inline struct page *pte_alloc_one(struct mm_struct *mm, 90static inline struct page *pte_alloc_one(struct mm_struct *mm,
91 unsigned long address) 91 unsigned long address)
92{ 92{
93 return virt_to_page(pte_alloc_one_kernel(mm, address)); 93 pte_t *pte = pte_alloc_one_kernel(mm, address);
94 return pte ? virt_to_page(pte) : NULL;
94} 95}
95 96
96static inline void pte_free_kernel(pte_t *pte) 97static inline void pte_free_kernel(pte_t *pte)
diff --git a/include/asm-powerpc/tlb.h b/include/asm-powerpc/tlb.h
index 0a17682663d8..66714042e438 100644
--- a/include/asm-powerpc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -38,6 +38,15 @@ extern void pte_free_finish(void);
38 38
39static inline void tlb_flush(struct mmu_gather *tlb) 39static inline void tlb_flush(struct mmu_gather *tlb)
40{ 40{
41 struct ppc64_tlb_batch *tlbbatch = &__get_cpu_var(ppc64_tlb_batch);
42
43 /* If there's a TLB batch pending, then we must flush it because the
44 * pages are going to be freed and we really don't want to have a CPU
45 * access a freed page because it has a stale TLB
46 */
47 if (tlbbatch->index)
48 __flush_tlb_pending(tlbbatch);
49
41 pte_free_finish(); 50 pte_free_finish();
42} 51}
43 52
diff --git a/include/asm-sh/cpu-sh4/freq.h b/include/asm-sh/cpu-sh4/freq.h
index 86564e7a26ae..39f41fcd509d 100644
--- a/include/asm-sh/cpu-sh4/freq.h
+++ b/include/asm-sh/cpu-sh4/freq.h
@@ -24,6 +24,9 @@
24#define FRQMR1 0xffc80014 24#define FRQMR1 0xffc80014
25#else 25#else
26#define FRQCR 0xffc00000 26#define FRQCR 0xffc00000
27#define FRQCR_PSTBY 0x0200
28#define FRQCR_PLLEN 0x0400
29#define FRQCR_CKOEN 0x0800
27#endif 30#endif
28#define MIN_DIVISOR_NR 0 31#define MIN_DIVISOR_NR 0
29#define MAX_DIVISOR_NR 3 32#define MAX_DIVISOR_NR 3
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index faf3051cd429..6034d4a29e73 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/sched.h>
16#include <linux/sysdev.h> 17#include <linux/sysdev.h>
17#include <asm/cpu/dma.h> 18#include <asm/cpu/dma.h>
18 19
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index a0e55b09e4fd..aa80930ce8e4 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -116,13 +116,13 @@ void __raw_readsl(unsigned long addr, void *data, int longlen);
116 * redefined by userlevel programs. 116 * redefined by userlevel programs.
117 */ 117 */
118#ifdef __readb 118#ifdef __readb
119# define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; }) 119# define readb(a) ({ unsigned int r_ = __raw_readb(a); mb(); r_; })
120#endif 120#endif
121#ifdef __raw_readw 121#ifdef __raw_readw
122# define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; }) 122# define readw(a) ({ unsigned int r_ = __raw_readw(a); mb(); r_; })
123#endif 123#endif
124#ifdef __raw_readl 124#ifdef __raw_readl
125# define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; }) 125# define readl(a) ({ unsigned int r_ = __raw_readl(a); mb(); r_; })
126#endif 126#endif
127 127
128#ifdef __raw_writeb 128#ifdef __raw_writeb
diff --git a/include/asm-sh/se73180.h b/include/asm-sh/se73180.h
index 3a4acb3e38a1..907c062b4c9a 100644
--- a/include/asm-sh/se73180.h
+++ b/include/asm-sh/se73180.h
@@ -1,9 +1,7 @@
1#ifndef __ASM_SH_HITACHI_SE73180_H 1#ifndef __ASM_SH_SE73180_H
2#define __ASM_SH_HITACHI_SE73180_H 2#define __ASM_SH_SE73180_H
3 3
4/* 4/*
5 * include/asm-sh/se/se73180.h
6 *
7 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp> 5 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
8 * 6 *
9 * SH-Mobile SolutionEngine 73180 support 7 * SH-Mobile SolutionEngine 73180 support
@@ -62,4 +60,7 @@
62#define __IO_PREFIX sh73180se 60#define __IO_PREFIX sh73180se
63#include <asm/io_generic.h> 61#include <asm/io_generic.h>
64 62
65#endif /* __ASM_SH_HITACHI_SE73180_H */ 63/* arch/sh/boards/se/73180/irq.c */
64int shmse_irq_demux(int irq);
65
66#endif /* __ASM_SH_SE73180_H */
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h
index 71ecddf70db3..caa7b93f1bce 100644
--- a/include/asm-sh/smp.h
+++ b/include/asm-sh/smp.h
@@ -15,7 +15,7 @@
15 15
16#ifdef CONFIG_SMP 16#ifdef CONFIG_SMP
17 17
18#include <asm/spinlock.h> 18#include <linux/spinlock.h>
19#include <asm/atomic.h> 19#include <asm/atomic.h>
20#include <asm/current.h> 20#include <asm/current.h>
21 21
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index 2586eef07d57..92f6e2008b2e 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -11,6 +11,7 @@
11#define __ASM_SH_SPINLOCK_H 11#define __ASM_SH_SPINLOCK_H
12 12
13#include <asm/atomic.h> 13#include <asm/atomic.h>
14#include <asm/spinlock_types.h>
14 15
15/* 16/*
16 * Your basic SMP spinlocks, allowing only a single CPU anywhere 17 * Your basic SMP spinlocks, allowing only a single CPU anywhere
@@ -42,7 +43,7 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
42 43
43static inline void __raw_spin_unlock(raw_spinlock_t *lock) 44static inline void __raw_spin_unlock(raw_spinlock_t *lock)
44{ 45{
45 assert_spin_locked(lock); 46 //assert_spin_locked(lock);
46 47
47 lock->lock = 0; 48 lock->lock = 0;
48} 49}
@@ -88,6 +89,11 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
88 __raw_spin_unlock(&rw->lock); 89 __raw_spin_unlock(&rw->lock);
89} 90}
90 91
92static inline int __raw_write_can_lock(raw_rwlock_t *rw)
93{
94 return (atomic_read(&rw->counter) == RW_LOCK_BIAS);
95}
96
91static inline int __raw_read_trylock(raw_rwlock_t *lock) 97static inline int __raw_read_trylock(raw_rwlock_t *lock)
92{ 98{
93 atomic_t *count = (atomic_t*)lock; 99 atomic_t *count = (atomic_t*)lock;
diff --git a/include/asm-sh/spinlock_types.h b/include/asm-sh/spinlock_types.h
index 8c41b6c3aac8..5c58134f2c4e 100644
--- a/include/asm-sh/spinlock_types.h
+++ b/include/asm-sh/spinlock_types.h
@@ -9,7 +9,9 @@ typedef struct {
9 volatile unsigned long lock; 9 volatile unsigned long lock;
10} raw_spinlock_t; 10} raw_spinlock_t;
11 11
12#define __SPIN_LOCK_UNLOCKED { 0 } 12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13
14#include <asm/atomic.h>
13 15
14typedef struct { 16typedef struct {
15 raw_spinlock_t lock; 17 raw_spinlock_t lock;
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 03c385de7619..445026fbec35 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -31,7 +31,7 @@ typedef struct {
31 unsigned int ecache_size; 31 unsigned int ecache_size;
32 unsigned int ecache_line_size; 32 unsigned int ecache_line_size;
33 int core_id; 33 int core_id;
34 unsigned int __pad3; 34 int proc_id;
35} cpuinfo_sparc; 35} cpuinfo_sparc;
36 36
37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data); 37DECLARE_PER_CPU(cpuinfo_sparc, __cpu_data);
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 9329429fb7f6..4e21c2f3065c 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -162,6 +162,22 @@ dma_mapping_error(dma_addr_t dma_addr)
162#else 162#else
163 163
164struct device; 164struct device;
165struct page;
166struct scatterlist;
167
168static inline int
169dma_supported(struct device *dev, u64 mask)
170{
171 BUG();
172 return 0;
173}
174
175static inline int
176dma_set_mask(struct device *dev, u64 dma_mask)
177{
178 BUG();
179 return 0;
180}
165 181
166static inline void *dma_alloc_coherent(struct device *dev, size_t size, 182static inline void *dma_alloc_coherent(struct device *dev, size_t size,
167 dma_addr_t *dma_handle, gfp_t flag) 183 dma_addr_t *dma_handle, gfp_t flag)
@@ -176,6 +192,52 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
176 BUG(); 192 BUG();
177} 193}
178 194
195static inline dma_addr_t
196dma_map_single(struct device *dev, void *cpu_addr, size_t size,
197 enum dma_data_direction direction)
198{
199 BUG();
200 return 0;
201}
202
203static inline void
204dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
205 enum dma_data_direction direction)
206{
207 BUG();
208}
209
210static inline dma_addr_t
211dma_map_page(struct device *dev, struct page *page,
212 unsigned long offset, size_t size,
213 enum dma_data_direction direction)
214{
215 BUG();
216 return 0;
217}
218
219static inline void
220dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
221 enum dma_data_direction direction)
222{
223 BUG();
224}
225
226static inline int
227dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
228 enum dma_data_direction direction)
229{
230 BUG();
231 return 0;
232}
233
234static inline void
235dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
236 enum dma_data_direction direction)
237{
238 BUG();
239}
240
179static inline void 241static inline void
180dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size, 242dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
181 enum dma_data_direction direction) 243 enum dma_data_direction direction)
@@ -190,6 +252,27 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t siz
190 BUG(); 252 BUG();
191} 253}
192 254
255static inline void
256dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
257 enum dma_data_direction direction)
258{
259 BUG();
260}
261
262static inline void
263dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
264 enum dma_data_direction direction)
265{
266 BUG();
267}
268
269static inline int
270dma_mapping_error(dma_addr_t dma_addr)
271{
272 BUG();
273 return 0;
274}
275
193#endif /* PCI */ 276#endif /* PCI */
194 277
195 278
diff --git a/include/asm-sparc64/hypervisor.h b/include/asm-sparc64/hypervisor.h
index 5cdb1ff04838..5c2f9d4b9f06 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -1097,6 +1097,80 @@ extern unsigned long sun4v_mach_set_soft_state(unsigned long soft_state,
1097 */ 1097 */
1098#define HV_FAST_MACH_GET_SOFT_STATE 0x71 1098#define HV_FAST_MACH_GET_SOFT_STATE 0x71
1099 1099
1100/* svc_send()
1101 * TRAP: HV_FAST_TRAP
1102 * FUNCTION: HV_FAST_SVC_SEND
1103 * ARG0: service ID
1104 * ARG1: buffer real address
1105 * ARG2: buffer size
1106 * RET0: STATUS
1107 * RET1: sent_bytes
1108 *
1109 * Be careful, all output registers are clobbered by this operation,
1110 * so for example it is not possible to save away a value in %o4
1111 * across the trap.
1112 */
1113#define HV_FAST_SVC_SEND 0x80
1114
1115/* svc_recv()
1116 * TRAP: HV_FAST_TRAP
1117 * FUNCTION: HV_FAST_SVC_RECV
1118 * ARG0: service ID
1119 * ARG1: buffer real address
1120 * ARG2: buffer size
1121 * RET0: STATUS
1122 * RET1: recv_bytes
1123 *
1124 * Be careful, all output registers are clobbered by this operation,
1125 * so for example it is not possible to save away a value in %o4
1126 * across the trap.
1127 */
1128#define HV_FAST_SVC_RECV 0x81
1129
1130/* svc_getstatus()
1131 * TRAP: HV_FAST_TRAP
1132 * FUNCTION: HV_FAST_SVC_GETSTATUS
1133 * ARG0: service ID
1134 * RET0: STATUS
1135 * RET1: status bits
1136 */
1137#define HV_FAST_SVC_GETSTATUS 0x82
1138
1139/* svc_setstatus()
1140 * TRAP: HV_FAST_TRAP
1141 * FUNCTION: HV_FAST_SVC_SETSTATUS
1142 * ARG0: service ID
1143 * ARG1: bits to set
1144 * RET0: STATUS
1145 */
1146#define HV_FAST_SVC_SETSTATUS 0x83
1147
1148/* svc_clrstatus()
1149 * TRAP: HV_FAST_TRAP
1150 * FUNCTION: HV_FAST_SVC_CLRSTATUS
1151 * ARG0: service ID
1152 * ARG1: bits to clear
1153 * RET0: STATUS
1154 */
1155#define HV_FAST_SVC_CLRSTATUS 0x84
1156
1157#ifndef __ASSEMBLY__
1158extern unsigned long sun4v_svc_send(unsigned long svc_id,
1159 unsigned long buffer,
1160 unsigned long buffer_size,
1161 unsigned long *sent_bytes);
1162extern unsigned long sun4v_svc_recv(unsigned long svc_id,
1163 unsigned long buffer,
1164 unsigned long buffer_size,
1165 unsigned long *recv_bytes);
1166extern unsigned long sun4v_svc_getstatus(unsigned long svc_id,
1167 unsigned long *status_bits);
1168extern unsigned long sun4v_svc_setstatus(unsigned long svc_id,
1169 unsigned long status_bits);
1170extern unsigned long sun4v_svc_clrstatus(unsigned long svc_id,
1171 unsigned long status_bits);
1172#endif
1173
1100/* Trap trace services. 1174/* Trap trace services.
1101 * 1175 *
1102 * The hypervisor provides a trap tracing capability for privileged 1176 * The hypervisor provides a trap tracing capability for privileged
@@ -2724,6 +2798,105 @@ struct hv_mmu_statistics {
2724 */ 2798 */
2725#define HV_FAST_MMUSTAT_INFO 0x103 2799#define HV_FAST_MMUSTAT_INFO 0x103
2726 2800
2801#ifndef __ASSEMBLY__
2802extern unsigned long sun4v_mmustat_conf(unsigned long ra, unsigned long *orig_ra);
2803extern unsigned long sun4v_mmustat_info(unsigned long *ra);
2804#endif
2805
2806/* NCS crypto services */
2807
2808/* ncs_request() sub-function numbers */
2809#define HV_NCS_QCONF 0x01
2810#define HV_NCS_QTAIL_UPDATE 0x02
2811
2812#ifndef __ASSEMBLY__
2813struct hv_ncs_queue_entry {
2814 /* MAU Control Register */
2815 unsigned long mau_control;
2816#define MAU_CONTROL_INV_PARITY 0x0000000000002000
2817#define MAU_CONTROL_STRAND 0x0000000000001800
2818#define MAU_CONTROL_BUSY 0x0000000000000400
2819#define MAU_CONTROL_INT 0x0000000000000200
2820#define MAU_CONTROL_OP 0x00000000000001c0
2821#define MAU_CONTROL_OP_SHIFT 6
2822#define MAU_OP_LOAD_MA_MEMORY 0x0
2823#define MAU_OP_STORE_MA_MEMORY 0x1
2824#define MAU_OP_MODULAR_MULT 0x2
2825#define MAU_OP_MODULAR_REDUCE 0x3
2826#define MAU_OP_MODULAR_EXP_LOOP 0x4
2827#define MAU_CONTROL_LEN 0x000000000000003f
2828#define MAU_CONTROL_LEN_SHIFT 0
2829
2830 /* Real address of bytes to load or store bytes
2831 * into/out-of the MAU.
2832 */
2833 unsigned long mau_mpa;
2834
2835 /* Modular Arithmetic MA Offset Register. */
2836 unsigned long mau_ma;
2837
2838 /* Modular Arithmetic N Prime Register. */
2839 unsigned long mau_np;
2840};
2841
2842struct hv_ncs_qconf_arg {
2843 unsigned long mid; /* MAU ID, 1 per core on Niagara */
2844 unsigned long base; /* Real address base of queue */
2845 unsigned long end; /* Real address end of queue */
2846 unsigned long num_ents; /* Number of entries in queue */
2847};
2848
2849struct hv_ncs_qtail_update_arg {
2850 unsigned long mid; /* MAU ID, 1 per core on Niagara */
2851 unsigned long tail; /* New tail index to use */
2852 unsigned long syncflag; /* only SYNCFLAG_SYNC is implemented */
2853#define HV_NCS_SYNCFLAG_SYNC 0x00
2854#define HV_NCS_SYNCFLAG_ASYNC 0x01
2855};
2856#endif
2857
2858/* ncs_request()
2859 * TRAP: HV_FAST_TRAP
2860 * FUNCTION: HV_FAST_NCS_REQUEST
2861 * ARG0: NCS sub-function
2862 * ARG1: sub-function argument real address
2863 * ARG2: size in bytes of sub-function argument
2864 * RET0: status
2865 *
2866 * The MAU chip of the Niagara processor is not directly accessible
2867 * to privileged code, instead it is programmed indirectly via this
2868 * hypervisor API.
2869 *
2870 * The interfaces defines a queue of MAU operations to perform.
2871 * Privileged code registers a queue with the hypervisor by invoking
2872 * this HVAPI with the HV_NCS_QCONF sub-function, which defines the
2873 * base, end, and number of entries of the queue. Each queue entry
2874 * contains a MAU register struct block.
2875 *
2876 * The privileged code then proceeds to add entries to the queue and
2877 * then invoke the HV_NCS_QTAIL_UPDATE sub-function. Since only
2878 * synchronous operations are supported by the current hypervisor,
2879 * HV_NCS_QTAIL_UPDATE will run all the pending queue entries to
2880 * completion and return HV_EOK, or return an error code.
2881 *
2882 * The real address of the sub-function argument must be aligned on at
2883 * least an 8-byte boundary.
2884 *
2885 * The tail argument of HV_NCS_QTAIL_UPDATE is an index, not a byte
2886 * offset, into the queue and must be less than or equal the 'num_ents'
2887 * argument given in the HV_NCS_QCONF call.
2888 */
2889#define HV_FAST_NCS_REQUEST 0x110
2890
2891#ifndef __ASSEMBLY__
2892extern unsigned long sun4v_ncs_request(unsigned long request,
2893 unsigned long arg_ra,
2894 unsigned long arg_size);
2895#endif
2896
2897#define HV_FAST_FIRE_GET_PERFREG 0x120
2898#define HV_FAST_FIRE_SET_PERFREG 0x121
2899
2727/* Function numbers for HV_CORE_TRAP. */ 2900/* Function numbers for HV_CORE_TRAP. */
2728#define HV_CORE_SET_VER 0x00 2901#define HV_CORE_SET_VER 0x00
2729#define HV_CORE_PUTCHAR 0x01 2902#define HV_CORE_PUTCHAR 0x01
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index f76e1492add5..4fb8c4bfb848 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -33,6 +33,8 @@ extern cpumask_t phys_cpu_present_map;
33#define cpu_possible_map phys_cpu_present_map 33#define cpu_possible_map phys_cpu_present_map
34 34
35extern cpumask_t cpu_sibling_map[NR_CPUS]; 35extern cpumask_t cpu_sibling_map[NR_CPUS];
36extern cpumask_t cpu_core_map[NR_CPUS];
37extern int sparc64_multi_core;
36 38
37/* 39/*
38 * General functions that each host system must provide. 40 * General functions that each host system must provide.
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h
index e0d450d600ec..290ac75f385b 100644
--- a/include/asm-sparc64/topology.h
+++ b/include/asm-sparc64/topology.h
@@ -1,12 +1,17 @@
1#ifndef _ASM_SPARC64_TOPOLOGY_H 1#ifndef _ASM_SPARC64_TOPOLOGY_H
2#define _ASM_SPARC64_TOPOLOGY_H 2#define _ASM_SPARC64_TOPOLOGY_H
3 3
4#include <asm/spitfire.h> 4#ifdef CONFIG_SMP
5#define smt_capable() (tlb_type == hypervisor) 5#define topology_physical_package_id(cpu) (cpu_data(cpu).proc_id)
6#define topology_core_id(cpu) (cpu_data(cpu).core_id)
7#define topology_core_siblings(cpu) (cpu_core_map[cpu])
8#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
9#define mc_capable() (sparc64_multi_core)
10#define smt_capable() (sparc64_multi_core)
11#endif /* CONFIG_SMP */
6 12
7#include <asm-generic/topology.h> 13#include <asm-generic/topology.h>
8 14
9#define topology_core_id(cpu) (cpu_data(cpu).core_id) 15#define cpu_coregroup_map(cpu) (cpu_core_map[cpu])
10#define topology_thread_siblings(cpu) (cpu_sibling_map[cpu])
11 16
12#endif /* _ASM_SPARC64_TOPOLOGY_H */ 17#endif /* _ASM_SPARC64_TOPOLOGY_H */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e1013156c25e..f317c270d4bf 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -62,6 +62,8 @@ header-y += fadvise.h
62header-y += fd.h 62header-y += fd.h
63header-y += fdreg.h 63header-y += fdreg.h
64header-y += fib_rules.h 64header-y += fib_rules.h
65header-y += firewire-cdev.h
66header-y += firewire-constants.h
65header-y += fuse.h 67header-y += fuse.h
66header-y += genetlink.h 68header-y += genetlink.h
67header-y += gen_stats.h 69header-y += gen_stats.h
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 0365ec9fc0c9..c83534ee1e79 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -59,6 +59,7 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
59 unsigned long align, 59 unsigned long align,
60 unsigned long goal, 60 unsigned long goal,
61 unsigned long limit); 61 unsigned long limit);
62extern void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size);
62 63
63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 64#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
64extern void reserve_bootmem(unsigned long addr, unsigned long size); 65extern void reserve_bootmem(unsigned long addr, unsigned long size);
diff --git a/include/linux/errno.h b/include/linux/errno.h
index d90b80f9b28c..46685832ed99 100644
--- a/include/linux/errno.h
+++ b/include/linux/errno.h
@@ -5,7 +5,12 @@
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7 7
8/* Should never be seen by user programs */ 8/*
9 * These should never be seen by user programs. To return one of ERESTART*
10 * codes, signal_pending() MUST be set. Note that ptrace can observe these
11 * at syscall exit tracing, but they will never be left for the debugged user
12 * process to see.
13 */
9#define ERESTARTSYS 512 14#define ERESTARTSYS 512
10#define ERESTARTNOINTR 513 15#define ERESTARTNOINTR 513
11#define ERESTARTNOHAND 514 /* restart if no handler.. */ 16#define ERESTARTNOHAND 514 /* restart if no handler.. */
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 54c576d414c3..de1f9f78625a 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -32,9 +32,9 @@
32/* 32/*
33 * Define EXT4_RESERVATION to reserve data blocks for expanding files 33 * Define EXT4_RESERVATION to reserve data blocks for expanding files
34 */ 34 */
35#define EXT4_DEFAULT_RESERVE_BLOCKS 8 35#define EXT4_DEFAULT_RESERVE_BLOCKS 8
36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ 36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37#define EXT4_MAX_RESERVE_BLOCKS 1027 37#define EXT4_MAX_RESERVE_BLOCKS 1027
38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0 38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0
39/* 39/*
40 * Always enable hashed directories 40 * Always enable hashed directories
@@ -204,12 +204,12 @@ struct ext4_group_desc
204 204
205/* Used to pass group descriptor data when online resize is done */ 205/* Used to pass group descriptor data when online resize is done */
206struct ext4_new_group_input { 206struct ext4_new_group_input {
207 __u32 group; /* Group number for this data */ 207 __u32 group; /* Group number for this data */
208 __u64 block_bitmap; /* Absolute block number of block bitmap */ 208 __u64 block_bitmap; /* Absolute block number of block bitmap */
209 __u64 inode_bitmap; /* Absolute block number of inode bitmap */ 209 __u64 inode_bitmap; /* Absolute block number of inode bitmap */
210 __u64 inode_table; /* Absolute block number of inode table start */ 210 __u64 inode_table; /* Absolute block number of inode table start */
211 __u32 blocks_count; /* Total number of blocks in this group */ 211 __u32 blocks_count; /* Total number of blocks in this group */
212 __u16 reserved_blocks; /* Number of reserved blocks in this group */ 212 __u16 reserved_blocks; /* Number of reserved blocks in this group */
213 __u16 unused; 213 __u16 unused;
214}; 214};
215 215
@@ -310,7 +310,7 @@ struct ext4_inode {
310 __u8 l_i_frag; /* Fragment number */ 310 __u8 l_i_frag; /* Fragment number */
311 __u8 l_i_fsize; /* Fragment size */ 311 __u8 l_i_fsize; /* Fragment size */
312 __le16 l_i_file_acl_high; 312 __le16 l_i_file_acl_high;
313 __le16 l_i_uid_high; /* these 2 fields */ 313 __le16 l_i_uid_high; /* these 2 fields */
314 __le16 l_i_gid_high; /* were reserved2[0] */ 314 __le16 l_i_gid_high; /* were reserved2[0] */
315 __u32 l_i_reserved2; 315 __u32 l_i_reserved2;
316 } linux2; 316 } linux2;
@@ -513,7 +513,14 @@ struct ext4_super_block {
513/*150*/ __le32 s_blocks_count_hi; /* Blocks count */ 513/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
514 __le32 s_r_blocks_count_hi; /* Reserved blocks count */ 514 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
515 __le32 s_free_blocks_count_hi; /* Free blocks count */ 515 __le32 s_free_blocks_count_hi; /* Free blocks count */
516 __u32 s_reserved[169]; /* Padding to the end of the block */ 516 __u16 s_min_extra_isize; /* All inodes have at least # bytes */
517 __u16 s_want_extra_isize; /* New inodes should reserve # bytes */
518 __u32 s_flags; /* Miscellaneous flags */
519 __u16 s_raid_stride; /* RAID stride */
520 __u16 s_mmp_interval; /* # seconds to wait in MMP checking */
521 __u64 s_mmp_block; /* Block for multi-mount protection */
522 __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
523 __u32 s_reserved[163]; /* Padding to the end of the block */
517}; 524};
518 525
519#ifdef __KERNEL__ 526#ifdef __KERNEL__
@@ -780,9 +787,9 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
780 * Ok, these declarations are also in <linux/kernel.h> but none of the 787 * Ok, these declarations are also in <linux/kernel.h> but none of the
781 * ext4 source programs needs to include it so they are duplicated here. 788 * ext4 source programs needs to include it so they are duplicated here.
782 */ 789 */
783# define NORET_TYPE /**/ 790# define NORET_TYPE /**/
784# define ATTRIB_NORET __attribute__((noreturn)) 791# define ATTRIB_NORET __attribute__((noreturn))
785# define NORET_AND noreturn, 792# define NORET_AND noreturn,
786 793
787/* balloc.c */ 794/* balloc.c */
788extern unsigned int ext4_block_group(struct super_block *sb, 795extern unsigned int ext4_block_group(struct super_block *sb,
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index 7eb1d73fc5d1..acfe59740b03 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -151,8 +151,8 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
151 ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \ 151 ((struct ext4_extent_idx *) (((char *) (__hdr__)) + \
152 sizeof(struct ext4_extent_header))) 152 sizeof(struct ext4_extent_header)))
153#define EXT_HAS_FREE_INDEX(__path__) \ 153#define EXT_HAS_FREE_INDEX(__path__) \
154 (le16_to_cpu((__path__)->p_hdr->eh_entries) \ 154 (le16_to_cpu((__path__)->p_hdr->eh_entries) \
155 < le16_to_cpu((__path__)->p_hdr->eh_max)) 155 < le16_to_cpu((__path__)->p_hdr->eh_max))
156#define EXT_LAST_EXTENT(__hdr__) \ 156#define EXT_LAST_EXTENT(__hdr__) \
157 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1) 157 (EXT_FIRST_EXTENT((__hdr__)) + le16_to_cpu((__hdr__)->eh_entries) - 1)
158#define EXT_LAST_INDEX(__hdr__) \ 158#define EXT_LAST_INDEX(__hdr__) \
@@ -190,6 +190,7 @@ ext4_ext_invalidate_cache(struct inode *inode)
190 190
191extern int ext4_extent_tree_init(handle_t *, struct inode *); 191extern int ext4_extent_tree_init(handle_t *, struct inode *);
192extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 192extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
193extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
193extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); 194extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
194extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); 195extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *);
195extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *); 196extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *);
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index d5b177e5b395..9de494406995 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -41,14 +41,14 @@ struct ext4_reserve_window_node {
41 41
42struct ext4_block_alloc_info { 42struct ext4_block_alloc_info {
43 /* information about reservation window */ 43 /* information about reservation window */
44 struct ext4_reserve_window_node rsv_window_node; 44 struct ext4_reserve_window_node rsv_window_node;
45 /* 45 /*
46 * was i_next_alloc_block in ext4_inode_info 46 * was i_next_alloc_block in ext4_inode_info
47 * is the logical (file-relative) number of the 47 * is the logical (file-relative) number of the
48 * most-recently-allocated block in this file. 48 * most-recently-allocated block in this file.
49 * We use this for detecting linearly ascending allocation requests. 49 * We use this for detecting linearly ascending allocation requests.
50 */ 50 */
51 __u32 last_alloc_logical_block; 51 __u32 last_alloc_logical_block;
52 /* 52 /*
53 * Was i_next_alloc_goal in ext4_inode_info 53 * Was i_next_alloc_goal in ext4_inode_info
54 * is the *physical* companion to i_next_alloc_block. 54 * is the *physical* companion to i_next_alloc_block.
@@ -56,7 +56,7 @@ struct ext4_block_alloc_info {
56 * allocated to this file. This give us the goal (target) for the next 56 * allocated to this file. This give us the goal (target) for the next
57 * allocation when we detect linearly ascending requests. 57 * allocation when we detect linearly ascending requests.
58 */ 58 */
59 ext4_fsblk_t last_alloc_physical_block; 59 ext4_fsblk_t last_alloc_physical_block;
60}; 60};
61 61
62#define rsv_start rsv_window._rsv_start 62#define rsv_start rsv_window._rsv_start
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c654d0e9ce33..66226824ab68 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -942,6 +942,7 @@ extern int fb_new_modelist(struct fb_info *info);
942 942
943extern struct fb_info *registered_fb[FB_MAX]; 943extern struct fb_info *registered_fb[FB_MAX];
944extern int num_registered_fb; 944extern int num_registered_fb;
945extern struct class *fb_class;
945 946
946static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, 947static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
947 u8 *src, u32 s_pitch, u32 height) 948 u8 *src, u32 s_pitch, u32 height)
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index d4455eb2ae35..efbe1fda1a22 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -198,13 +198,15 @@ struct fw_cdev_create_iso_context {
198 __u32 handle; 198 __u32 handle;
199}; 199};
200 200
201#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
202#define FW_CDEV_ISO_INTERRUPT (1 << 16)
203#define FW_CDEV_ISO_SKIP (1 << 17)
204#define FW_CDEV_ISO_TAG(v) ((v) << 18)
205#define FW_CDEV_ISO_SY(v) ((v) << 20)
206#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24)
207
201struct fw_cdev_iso_packet { 208struct fw_cdev_iso_packet {
202 __u16 payload_length; /* Length of indirect payload. */ 209 __u32 control;
203 __u32 interrupt : 1; /* Generate interrupt on this packet */
204 __u32 skip : 1; /* Set to not send packet at all. */
205 __u32 tag : 2;
206 __u32 sy : 4;
207 __u32 header_length : 8; /* Length of immediate header. */
208 __u32 header[0]; 210 __u32 header[0];
209}; 211};
210 212
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7cf0c54a46a7..b3ae77cccbb6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -938,6 +938,7 @@ struct super_block {
938 struct list_head s_files; 938 struct list_head s_files;
939 939
940 struct block_device *s_bdev; 940 struct block_device *s_bdev;
941 struct mtd_info *s_mtd;
941 struct list_head s_instances; 942 struct list_head s_instances;
942 struct quota_info s_dquot; /* Diskquota specific options */ 943 struct quota_info s_dquot; /* Diskquota specific options */
943 944
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index c0f7aec331c2..ae04901aa09a 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/bitmap.h>
6#include <linux/if.h> 7#include <linux/if.h>
7#include <linux/netdevice.h> 8#include <linux/netdevice.h>
8#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
@@ -10,28 +11,9 @@
10 11
11struct ipv4_devconf 12struct ipv4_devconf
12{ 13{
13 int accept_redirects;
14 int send_redirects;
15 int secure_redirects;
16 int shared_media;
17 int accept_source_route;
18 int rp_filter;
19 int proxy_arp;
20 int bootp_relay;
21 int log_martians;
22 int forwarding;
23 int mc_forwarding;
24 int tag;
25 int arp_filter;
26 int arp_announce;
27 int arp_ignore;
28 int arp_accept;
29 int medium_id;
30 int no_xfrm;
31 int no_policy;
32 int force_igmp_version;
33 int promote_secondaries;
34 void *sysctl; 14 void *sysctl;
15 int data[__NET_IPV4_CONF_MAX - 1];
16 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1);
35}; 17};
36 18
37extern struct ipv4_devconf ipv4_devconf; 19extern struct ipv4_devconf ipv4_devconf;
@@ -60,30 +42,70 @@ struct in_device
60 struct rcu_head rcu_head; 42 struct rcu_head rcu_head;
61}; 43};
62 44
63#define IN_DEV_FORWARD(in_dev) ((in_dev)->cnf.forwarding) 45#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
64#define IN_DEV_MFORWARD(in_dev) (ipv4_devconf.mc_forwarding && (in_dev)->cnf.mc_forwarding) 46#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr)
65#define IN_DEV_RPFILTER(in_dev) (ipv4_devconf.rp_filter && (in_dev)->cnf.rp_filter) 47
66#define IN_DEV_SOURCE_ROUTE(in_dev) (ipv4_devconf.accept_source_route && (in_dev)->cnf.accept_source_route) 48static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
67#define IN_DEV_BOOTP_RELAY(in_dev) (ipv4_devconf.bootp_relay && (in_dev)->cnf.bootp_relay) 49{
68 50 index--;
69#define IN_DEV_LOG_MARTIANS(in_dev) (ipv4_devconf.log_martians || (in_dev)->cnf.log_martians) 51 return in_dev->cnf.data[index];
70#define IN_DEV_PROXY_ARP(in_dev) (ipv4_devconf.proxy_arp || (in_dev)->cnf.proxy_arp) 52}
71#define IN_DEV_SHARED_MEDIA(in_dev) (ipv4_devconf.shared_media || (in_dev)->cnf.shared_media) 53
72#define IN_DEV_TX_REDIRECTS(in_dev) (ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects) 54static inline void ipv4_devconf_set(struct in_device *in_dev, int index,
73#define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects) 55 int val)
74#define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag) 56{
75#define IN_DEV_MEDIUM_ID(in_dev) ((in_dev)->cnf.medium_id) 57 index--;
76#define IN_DEV_PROMOTE_SECONDARIES(in_dev) (ipv4_devconf.promote_secondaries || (in_dev)->cnf.promote_secondaries) 58 set_bit(index, in_dev->cnf.state);
59 in_dev->cnf.data[index] = val;
60}
61
62static inline void ipv4_devconf_setall(struct in_device *in_dev)
63{
64 bitmap_fill(in_dev->cnf.state, __NET_IPV4_CONF_MAX - 1);
65}
66
67#define IN_DEV_CONF_GET(in_dev, attr) \
68 ipv4_devconf_get((in_dev), NET_IPV4_CONF_ ## attr)
69#define IN_DEV_CONF_SET(in_dev, attr, val) \
70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
71
72#define IN_DEV_ANDCONF(in_dev, attr) \
73 (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr))
74#define IN_DEV_ORCONF(in_dev, attr) \
75 (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr))
76#define IN_DEV_MAXCONF(in_dev, attr) \
77 (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr)))
78
79#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
80#define IN_DEV_MFORWARD(in_dev) (IPV4_DEVCONF_ALL(MC_FORWARDING) && \
81 IPV4_DEVCONF((in_dev)->cnf, \
82 MC_FORWARDING))
83#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER)
84#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
85 ACCEPT_SOURCE_ROUTE)
86#define IN_DEV_BOOTP_RELAY(in_dev) IN_DEV_ANDCONF((in_dev), BOOTP_RELAY)
87
88#define IN_DEV_LOG_MARTIANS(in_dev) IN_DEV_ORCONF((in_dev), LOG_MARTIANS)
89#define IN_DEV_PROXY_ARP(in_dev) IN_DEV_ORCONF((in_dev), PROXY_ARP)
90#define IN_DEV_SHARED_MEDIA(in_dev) IN_DEV_ORCONF((in_dev), SHARED_MEDIA)
91#define IN_DEV_TX_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), SEND_REDIRECTS)
92#define IN_DEV_SEC_REDIRECTS(in_dev) IN_DEV_ORCONF((in_dev), \
93 SECURE_REDIRECTS)
94#define IN_DEV_IDTAG(in_dev) IN_DEV_CONF_GET(in_dev, TAG)
95#define IN_DEV_MEDIUM_ID(in_dev) IN_DEV_CONF_GET(in_dev, MEDIUM_ID)
96#define IN_DEV_PROMOTE_SECONDARIES(in_dev) \
97 IN_DEV_ORCONF((in_dev), \
98 PROMOTE_SECONDARIES)
77 99
78#define IN_DEV_RX_REDIRECTS(in_dev) \ 100#define IN_DEV_RX_REDIRECTS(in_dev) \
79 ((IN_DEV_FORWARD(in_dev) && \ 101 ((IN_DEV_FORWARD(in_dev) && \
80 (ipv4_devconf.accept_redirects && (in_dev)->cnf.accept_redirects)) \ 102 IN_DEV_ANDCONF((in_dev), ACCEPT_REDIRECTS)) \
81 || (!IN_DEV_FORWARD(in_dev) && \ 103 || (!IN_DEV_FORWARD(in_dev) && \
82 (ipv4_devconf.accept_redirects || (in_dev)->cnf.accept_redirects))) 104 IN_DEV_ORCONF((in_dev), ACCEPT_REDIRECTS)))
83 105
84#define IN_DEV_ARPFILTER(in_dev) (ipv4_devconf.arp_filter || (in_dev)->cnf.arp_filter) 106#define IN_DEV_ARPFILTER(in_dev) IN_DEV_ORCONF((in_dev), ARPFILTER)
85#define IN_DEV_ARP_ANNOUNCE(in_dev) (max(ipv4_devconf.arp_announce, (in_dev)->cnf.arp_announce)) 107#define IN_DEV_ARP_ANNOUNCE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
86#define IN_DEV_ARP_IGNORE(in_dev) (max(ipv4_devconf.arp_ignore, (in_dev)->cnf.arp_ignore)) 108#define IN_DEV_ARP_IGNORE(in_dev) IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
87 109
88struct in_ifaddr 110struct in_ifaddr
89{ 111{
@@ -108,7 +130,6 @@ extern struct net_device *ip_dev_find(__be32 addr);
108extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 130extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
109extern int devinet_ioctl(unsigned int cmd, void __user *); 131extern int devinet_ioctl(unsigned int cmd, void __user *);
110extern void devinet_init(void); 132extern void devinet_init(void);
111extern struct in_device *inetdev_init(struct net_device *dev);
112extern struct in_device *inetdev_by_index(int); 133extern struct in_device *inetdev_by_index(int);
113extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 134extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
114extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope); 135extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 09ea01a8a99c..648bd1f0912d 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -209,9 +209,8 @@ enum {
209 DEVCONF_RTR_PROBE_INTERVAL, 209 DEVCONF_RTR_PROBE_INTERVAL,
210 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, 210 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
211 DEVCONF_PROXY_NDP, 211 DEVCONF_PROXY_NDP,
212 __DEVCONF_OPTIMISTIC_DAD,
213 DEVCONF_ACCEPT_SOURCE_ROUTE,
214 DEVCONF_OPTIMISTIC_DAD, 212 DEVCONF_OPTIMISTIC_DAD,
213 DEVCONF_ACCEPT_SOURCE_ROUTE,
215 DEVCONF_MAX 214 DEVCONF_MAX
216}; 215};
217 216
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 85f7b1bd1482..a6a3113120a4 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -171,7 +171,6 @@ enum {
171 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H 171 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
172 * Register FIS clearing BSY */ 172 * Register FIS clearing BSY */
173 ATA_FLAG_DEBUGMSG = (1 << 13), 173 ATA_FLAG_DEBUGMSG = (1 << 13),
174 ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
175 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 174 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
176 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 175 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
177 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 176 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
diff --git a/include/linux/mtd/super.h b/include/linux/mtd/super.h
new file mode 100644
index 000000000000..4016dd6fe336
--- /dev/null
+++ b/include/linux/mtd/super.h
@@ -0,0 +1,30 @@
1/* MTD-based superblock handling
2 *
3 * Copyright © 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef __MTD_SUPER_H__
13#define __MTD_SUPER_H__
14
15#ifdef __KERNEL__
16
17#include <linux/mtd/mtd.h>
18#include <linux/fs.h>
19#include <linux/mount.h>
20
21extern int get_sb_mtd(struct file_system_type *fs_type, int flags,
22 const char *dev_name, void *data,
23 int (*fill_super)(struct super_block *, void *, int),
24 struct vfsmount *mnt);
25extern void kill_mtd_super(struct super_block *sb);
26
27
28#endif /* __KERNEL__ */
29
30#endif /* __MTD_SUPER_H__ */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index f671cd2f133f..3a70f553b28f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -910,6 +910,17 @@ static inline int netif_rx_reschedule(struct net_device *dev, int undo)
910 return 0; 910 return 0;
911} 911}
912 912
913/* same as netif_rx_complete, except that local_irq_save(flags)
914 * has already been issued
915 */
916static inline void __netif_rx_complete(struct net_device *dev)
917{
918 BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state));
919 list_del(&dev->poll_list);
920 smp_mb__before_clear_bit();
921 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
922}
923
913/* Remove interface from poll list: it must be in the poll list 924/* Remove interface from poll list: it must be in the poll list
914 * on current cpu. This primitive is called by dev->poll(), when 925 * on current cpu. This primitive is called by dev->poll(), when
915 * it completes the work. The device cannot be out of poll list at this 926 * it completes the work. The device cannot be out of poll list at this
@@ -920,10 +931,7 @@ static inline void netif_rx_complete(struct net_device *dev)
920 unsigned long flags; 931 unsigned long flags;
921 932
922 local_irq_save(flags); 933 local_irq_save(flags);
923 BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); 934 __netif_rx_complete(dev);
924 list_del(&dev->poll_list);
925 smp_mb__before_clear_bit();
926 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
927 local_irq_restore(flags); 935 local_irq_restore(flags);
928} 936}
929 937
@@ -940,17 +948,6 @@ static inline void netif_poll_enable(struct net_device *dev)
940 clear_bit(__LINK_STATE_RX_SCHED, &dev->state); 948 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
941} 949}
942 950
943/* same as netif_rx_complete, except that local_irq_save(flags)
944 * has already been issued
945 */
946static inline void __netif_rx_complete(struct net_device *dev)
947{
948 BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state));
949 list_del(&dev->poll_list);
950 smp_mb__before_clear_bit();
951 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
952}
953
954static inline void netif_tx_lock(struct net_device *dev) 951static inline void netif_tx_lock(struct net_device *dev)
955{ 952{
956 spin_lock(&dev->_xmit_lock); 953 spin_lock(&dev->_xmit_lock);
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index 2f46dd728ee1..e992cd6b28f5 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -264,6 +264,26 @@ ipt_get_target(struct ipt_entry *e)
264 __ret; \ 264 __ret; \
265}) 265})
266 266
267/* fn returns 0 to continue iteration */
268#define IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
269({ \
270 unsigned int __i, __n; \
271 int __ret = 0; \
272 struct ipt_entry *__entry; \
273 \
274 for (__i = 0, __n = 0; __i < (size); \
275 __i += __entry->next_offset, __n++) { \
276 __entry = (void *)(entries) + __i; \
277 if (__n < n) \
278 continue; \
279 \
280 __ret = fn(__entry , ## args); \
281 if (__ret != 0) \
282 break; \
283 } \
284 __ret; \
285})
286
267/* 287/*
268 * Main firewall chains definitions and global var's definitions. 288 * Main firewall chains definitions and global var's definitions.
269 */ 289 */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 4712e269d8d3..6a115cffea34 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1292,6 +1292,7 @@
1292#define PCI_DEVICE_ID_VIA_P4M890 0x0327 1292#define PCI_DEVICE_ID_VIA_P4M890 0x0327
1293#define PCI_DEVICE_ID_VIA_VT3324 0x0324 1293#define PCI_DEVICE_ID_VIA_VT3324 0x0324
1294#define PCI_DEVICE_ID_VIA_VT3336 0x0336 1294#define PCI_DEVICE_ID_VIA_VT3336 0x0336
1295#define PCI_DEVICE_ID_VIA_VT3351 0x0351
1295#define PCI_DEVICE_ID_VIA_8371_0 0x0391 1296#define PCI_DEVICE_ID_VIA_8371_0 0x0391
1296#define PCI_DEVICE_ID_VIA_8501_0 0x0501 1297#define PCI_DEVICE_ID_VIA_8501_0 0x0501
1297#define PCI_DEVICE_ID_VIA_82C561 0x0561 1298#define PCI_DEVICE_ID_VIA_82C561 0x0561
@@ -1437,6 +1438,7 @@
1437#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1438#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1438#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1439#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1439#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1440#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1441#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX 0x0104
1440#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132 1442#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1441#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1443#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1442#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1444#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
@@ -2267,11 +2269,11 @@
2267#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e 2269#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e
2268#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 2270#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850
2269#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910 2271#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910
2270#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2911 2272#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2917
2271#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912 2273#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912
2272#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913 2274#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913
2273#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 2275#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
2274#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2915 2276#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919
2275#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 2277#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2276#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2278#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2277#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2279#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 7c1ffbab7865..a8a6ea809da0 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -63,7 +63,7 @@ enum rfkill_state {
63 * This structure represents a RF switch located on a network device. 63 * This structure represents a RF switch located on a network device.
64 */ 64 */
65struct rfkill { 65struct rfkill {
66 char *name; 66 const char *name;
67 enum rfkill_type type; 67 enum rfkill_type type;
68 68
69 enum rfkill_state state; 69 enum rfkill_state state;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a3ac4c896831..7f2c99d66e9d 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -152,6 +152,7 @@
152#include <linux/sched.h> 152#include <linux/sched.h>
153#include <linux/tty.h> 153#include <linux/tty.h>
154#include <linux/mutex.h> 154#include <linux/mutex.h>
155#include <linux/sysrq.h>
155 156
156struct uart_port; 157struct uart_port;
157struct uart_info; 158struct uart_info;
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index c0398f5a8cb9..65f49fd7deff 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -62,13 +62,11 @@ struct unix_skb_parms {
62#define UNIXCREDS(skb) (&UNIXCB((skb)).creds) 62#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
63#define UNIXSID(skb) (&UNIXCB((skb)).secid) 63#define UNIXSID(skb) (&UNIXCB((skb)).secid)
64 64
65#define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) 65#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
66#define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) 66#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
67#define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) 67#define unix_state_lock_nested(s) \
68#define unix_state_wlock_nested(s) \
69 spin_lock_nested(&unix_sk(s)->lock, \ 68 spin_lock_nested(&unix_sk(s)->lock, \
70 SINGLE_DEPTH_NESTING) 69 SINGLE_DEPTH_NESTING)
71#define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock)
72 70
73#ifdef __KERNEL__ 71#ifdef __KERNEL__
74/* The AF_UNIX socket */ 72/* The AF_UNIX socket */
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index ed3a8872c6ca..83e41dd15ccd 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -64,7 +64,7 @@ struct fib_rules_ops
64 void (*flush_cache)(void); 64 void (*flush_cache)(void);
65 65
66 int nlgroup; 66 int nlgroup;
67 struct nla_policy *policy; 67 const struct nla_policy *policy;
68 struct list_head *rules_list; 68 struct list_head *rules_list;
69 struct module *owner; 69 struct module *owner;
70}; 70};
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index adff4c898d50..b6eaca122db8 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -60,7 +60,7 @@ struct genl_ops
60{ 60{
61 u8 cmd; 61 u8 cmd;
62 unsigned int flags; 62 unsigned int flags;
63 struct nla_policy *policy; 63 const struct nla_policy *policy;
64 int (*doit)(struct sk_buff *skb, 64 int (*doit)(struct sk_buff *skb,
65 struct genl_info *info); 65 struct genl_info *info);
66 int (*dumpit)(struct sk_buff *skb, 66 int (*dumpit)(struct sk_buff *skb,
diff --git a/include/net/ip.h b/include/net/ip.h
index bb207db03675..abf2820a1125 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -143,6 +143,7 @@ struct ip_reply_arg {
143 __wsum csum; 143 __wsum csum;
144 int csumoffset; /* u16 offset of csum in iov[0].iov_base */ 144 int csumoffset; /* u16 offset of csum in iov[0].iov_base */
145 /* -1 if not needed */ 145 /* -1 if not needed */
146 int bound_dev_if;
146}; 147};
147 148
148void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, 149void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 5a4a0366c24f..69252cbe05b0 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -213,7 +213,7 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
213#endif /* CONFIG_IP_MULTIPLE_TABLES */ 213#endif /* CONFIG_IP_MULTIPLE_TABLES */
214 214
215/* Exported by fib_frontend.c */ 215/* Exported by fib_frontend.c */
216extern struct nla_policy rtm_ipv4_policy[]; 216extern const struct nla_policy rtm_ipv4_policy[];
217extern void ip_fib_init(void); 217extern void ip_fib_init(void);
218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
219 struct net_device *dev, __be32 *spec_dst, u32 *itag); 219 struct net_device *dev, __be32 *spec_dst, u32 *itag);
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 0bf325c29aff..7b510a9edb91 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -222,10 +222,10 @@ extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
222 gfp_t flags); 222 gfp_t flags);
223 223
224extern int nla_validate(struct nlattr *head, int len, int maxtype, 224extern int nla_validate(struct nlattr *head, int len, int maxtype,
225 struct nla_policy *policy); 225 const struct nla_policy *policy);
226extern int nla_parse(struct nlattr *tb[], int maxtype, 226extern int nla_parse(struct nlattr *tb[], int maxtype,
227 struct nlattr *head, int len, 227 struct nlattr *head, int len,
228 struct nla_policy *policy); 228 const struct nla_policy *policy);
229extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype); 229extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
230extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 230extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
231 size_t dstsize); 231 size_t dstsize);
@@ -360,7 +360,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
360 */ 360 */
361static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen, 361static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen,
362 struct nlattr *tb[], int maxtype, 362 struct nlattr *tb[], int maxtype,
363 struct nla_policy *policy) 363 const struct nla_policy *policy)
364{ 364{
365 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 365 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
366 return -EINVAL; 366 return -EINVAL;
@@ -392,7 +392,7 @@ static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh,
392 * @policy: validation policy 392 * @policy: validation policy
393 */ 393 */
394static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype, 394static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
395 struct nla_policy *policy) 395 const struct nla_policy *policy)
396{ 396{
397 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) 397 if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
398 return -EINVAL; 398 return -EINVAL;
@@ -729,7 +729,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
729 */ 729 */
730static inline int nla_parse_nested(struct nlattr *tb[], int maxtype, 730static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
731 struct nlattr *nla, 731 struct nlattr *nla,
732 struct nla_policy *policy) 732 const struct nla_policy *policy)
733{ 733{
734 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); 734 return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
735} 735}
@@ -990,7 +990,7 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
990 * Returns 0 on success or a negative error code. 990 * Returns 0 on success or a negative error code.
991 */ 991 */
992static inline int nla_validate_nested(struct nlattr *start, int maxtype, 992static inline int nla_validate_nested(struct nlattr *start, int maxtype,
993 struct nla_policy *policy) 993 const struct nla_policy *policy)
994{ 994{
995 return nla_validate(nla_data(start), nla_len(start), maxtype, policy); 995 return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
996} 996}
diff --git a/include/net/sock.h b/include/net/sock.h
index 689b886038da..dfeb8b13024f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -218,13 +218,13 @@ struct sock {
218 atomic_t sk_rmem_alloc; 218 atomic_t sk_rmem_alloc;
219 atomic_t sk_wmem_alloc; 219 atomic_t sk_wmem_alloc;
220 atomic_t sk_omem_alloc; 220 atomic_t sk_omem_alloc;
221 int sk_sndbuf;
221 struct sk_buff_head sk_receive_queue; 222 struct sk_buff_head sk_receive_queue;
222 struct sk_buff_head sk_write_queue; 223 struct sk_buff_head sk_write_queue;
223 struct sk_buff_head sk_async_wait_queue; 224 struct sk_buff_head sk_async_wait_queue;
224 int sk_wmem_queued; 225 int sk_wmem_queued;
225 int sk_forward_alloc; 226 int sk_forward_alloc;
226 gfp_t sk_allocation; 227 gfp_t sk_allocation;
227 int sk_sndbuf;
228 int sk_route_caps; 228 int sk_route_caps;
229 int sk_gso_type; 229 int sk_gso_type;
230 int sk_rcvlowat; 230 int sk_rcvlowat;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e22b4f0305a3..a8af9ae00177 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -254,6 +254,12 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
254 return seq3 - seq2 >= seq1 - seq2; 254 return seq3 - seq2 >= seq1 - seq2;
255} 255}
256 256
257static inline int tcp_too_many_orphans(struct sock *sk, int num)
258{
259 return (num > sysctl_tcp_max_orphans) ||
260 (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
261 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]);
262}
257 263
258extern struct proto tcp_prot; 264extern struct proto tcp_prot;
259 265
diff --git a/include/net/udp.h b/include/net/udp.h
index 496f89d45c8b..98755ebaf163 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -119,16 +119,9 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
119} 119}
120 120
121 121
122struct udp_get_port_ops {
123 int (*saddr_cmp)(const struct sock *sk1, const struct sock *sk2);
124 int (*saddr_any)(const struct sock *sk);
125 unsigned int (*hash_port_and_rcv_saddr)(__u16 port,
126 const struct sock *sk);
127};
128
129/* net/ipv4/udp.c */ 122/* net/ipv4/udp.c */
130extern int udp_get_port(struct sock *sk, unsigned short snum, 123extern int udp_get_port(struct sock *sk, unsigned short snum,
131 const struct udp_get_port_ops *ops); 124 int (*saddr_cmp)(const struct sock *, const struct sock *));
132extern void udp_err(struct sk_buff *, u32); 125extern void udp_err(struct sk_buff *, u32);
133 126
134extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 127extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 50b4b424d1ca..635b0eafca95 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -120,5 +120,5 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
120 120
121extern void udplite4_register(void); 121extern void udplite4_register(void);
122extern int udplite_get_port(struct sock *sk, unsigned short snum, 122extern int udplite_get_port(struct sock *sk, unsigned short snum,
123 const struct udp_get_port_ops *ops); 123 int (*scmp)(const struct sock *, const struct sock *));
124#endif /* _UDPLITE_H */ 124#endif /* _UDPLITE_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 39ef925d39dd..311f25af5e1a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -237,7 +237,6 @@ extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
237extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 237extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
238extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); 238extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c);
239extern void km_state_notify(struct xfrm_state *x, struct km_event *c); 239extern void km_state_notify(struct xfrm_state *x, struct km_event *c);
240#define XFRM_ACQ_EXPIRES 30
241 240
242struct xfrm_tmpl; 241struct xfrm_tmpl;
243extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 242extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
@@ -965,7 +964,7 @@ struct xfrmk_spdinfo {
965 964
966extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 965extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
967extern int xfrm_state_delete(struct xfrm_state *x); 966extern int xfrm_state_delete(struct xfrm_state *x);
968extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 967extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
969extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); 968extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
970extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); 969extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
971extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); 970extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
@@ -1021,13 +1020,13 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
1021 struct xfrm_sec_ctx *ctx, int delete, 1020 struct xfrm_sec_ctx *ctx, int delete,
1022 int *err); 1021 int *err);
1023struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err); 1022struct xfrm_policy *xfrm_policy_byid(u8, int dir, u32 id, int delete, int *err);
1024void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 1023int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
1025u32 xfrm_get_acqseq(void); 1024u32 xfrm_get_acqseq(void);
1026void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi); 1025void xfrm_alloc_spi(struct xfrm_state *x, __be32 minspi, __be32 maxspi);
1027struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 1026struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
1028 xfrm_address_t *daddr, xfrm_address_t *saddr, 1027 xfrm_address_t *daddr, xfrm_address_t *saddr,
1029 int create, unsigned short family); 1028 int create, unsigned short family);
1030extern void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); 1029extern int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info);
1031extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1030extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1032extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, 1031extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst,
1033 struct flowi *fl, int family, int strict); 1032 struct flowi *fl, int family, int strict);
diff --git a/include/sound/version.h b/include/sound/version.h
index 50ee4fd420fa..8e5b2f0f5946 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.14rc4" 2#define CONFIG_SND_VERSION "1.0.14"
3#define CONFIG_SND_DATE " (Wed May 16 09:45:46 2007 UTC)" 3#define CONFIG_SND_DATE " (Thu May 31 09:03:25 2007 UTC)"
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 338a9b489fbc..27478948b318 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -144,20 +144,21 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
144 struct timespec ts; 144 struct timespec ts;
145 ktime_t t, *tp = NULL; 145 ktime_t t, *tp = NULL;
146 int val2 = 0; 146 int val2 = 0;
147 int cmd = op & FUTEX_CMD_MASK;
147 148
148 if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) { 149 if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI)) {
149 if (get_compat_timespec(&ts, utime)) 150 if (get_compat_timespec(&ts, utime))
150 return -EFAULT; 151 return -EFAULT;
151 if (!timespec_valid(&ts)) 152 if (!timespec_valid(&ts))
152 return -EINVAL; 153 return -EINVAL;
153 154
154 t = timespec_to_ktime(ts); 155 t = timespec_to_ktime(ts);
155 if (op == FUTEX_WAIT) 156 if (cmd == FUTEX_WAIT)
156 t = ktime_add(ktime_get(), t); 157 t = ktime_add(ktime_get(), t);
157 tp = &t; 158 tp = &t;
158 } 159 }
159 if (op == FUTEX_REQUEUE || op == FUTEX_CMP_REQUEUE 160 if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE
160 || op == FUTEX_CMP_REQUEUE_PI) 161 || cmd == FUTEX_CMP_REQUEUE_PI)
161 val2 = (int) (unsigned long) utime; 162 val2 = (int) (unsigned long) utime;
162 163
163 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3); 164 return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
diff --git a/kernel/signal.c b/kernel/signal.c
index acdfc0549c6f..fe590e00db8d 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -105,7 +105,11 @@ static int recalc_sigpending_tsk(struct task_struct *t)
105 set_tsk_thread_flag(t, TIF_SIGPENDING); 105 set_tsk_thread_flag(t, TIF_SIGPENDING);
106 return 1; 106 return 1;
107 } 107 }
108 clear_tsk_thread_flag(t, TIF_SIGPENDING); 108 /*
109 * We must never clear the flag in another thread, or in current
110 * when it's possible the current syscall is returning -ERESTART*.
111 * So we don't clear it here, and only callers who know they should do.
112 */
109 return 0; 113 return 0;
110} 114}
111 115
@@ -121,7 +125,9 @@ void recalc_sigpending_and_wake(struct task_struct *t)
121 125
122void recalc_sigpending(void) 126void recalc_sigpending(void)
123{ 127{
124 recalc_sigpending_tsk(current); 128 if (!recalc_sigpending_tsk(current))
129 clear_thread_flag(TIF_SIGPENDING);
130
125} 131}
126 132
127/* Given the mask, find the first available signal that should be serviced. */ 133/* Given the mask, find the first available signal that should be serviced. */
@@ -385,7 +391,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
385 } 391 }
386 } 392 }
387 } 393 }
388 recalc_sigpending_tsk(tsk); 394 if (likely(tsk == current))
395 recalc_sigpending();
389 if (signr && unlikely(sig_kernel_stop(signr))) { 396 if (signr && unlikely(sig_kernel_stop(signr))) {
390 /* 397 /*
391 * Set a marker that we have dequeued a stop signal. Our 398 * Set a marker that we have dequeued a stop signal. Our
@@ -1580,8 +1587,9 @@ static void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info)
1580 /* 1587 /*
1581 * Queued signals ignored us while we were stopped for tracing. 1588 * Queued signals ignored us while we were stopped for tracing.
1582 * So check for any that we should take before resuming user mode. 1589 * So check for any that we should take before resuming user mode.
1590 * This sets TIF_SIGPENDING, but never clears it.
1583 */ 1591 */
1584 recalc_sigpending(); 1592 recalc_sigpending_tsk(current);
1585} 1593}
1586 1594
1587void ptrace_notify(int exit_code) 1595void ptrace_notify(int exit_code)
diff --git a/kernel/time/timer_stats.c b/kernel/time/timer_stats.c
index 868f1bceb07f..321693724ad7 100644
--- a/kernel/time/timer_stats.c
+++ b/kernel/time/timer_stats.c
@@ -117,21 +117,6 @@ static struct entry entries[MAX_ENTRIES];
117 117
118static atomic_t overflow_count; 118static atomic_t overflow_count;
119 119
120static void reset_entries(void)
121{
122 nr_entries = 0;
123 memset(entries, 0, sizeof(entries));
124 atomic_set(&overflow_count, 0);
125}
126
127static struct entry *alloc_entry(void)
128{
129 if (nr_entries >= MAX_ENTRIES)
130 return NULL;
131
132 return entries + nr_entries++;
133}
134
135/* 120/*
136 * The entries are in a hash-table, for fast lookup: 121 * The entries are in a hash-table, for fast lookup:
137 */ 122 */
@@ -149,6 +134,22 @@ static struct entry *alloc_entry(void)
149 134
150static struct entry *tstat_hash_table[TSTAT_HASH_SIZE] __read_mostly; 135static struct entry *tstat_hash_table[TSTAT_HASH_SIZE] __read_mostly;
151 136
137static void reset_entries(void)
138{
139 nr_entries = 0;
140 memset(entries, 0, sizeof(entries));
141 memset(tstat_hash_table, 0, sizeof(tstat_hash_table));
142 atomic_set(&overflow_count, 0);
143}
144
145static struct entry *alloc_entry(void)
146{
147 if (nr_entries >= MAX_ENTRIES)
148 return NULL;
149
150 return entries + nr_entries++;
151}
152
152static int match_entries(struct entry *entry1, struct entry *entry2) 153static int match_entries(struct entry *entry1, struct entry *entry2)
153{ 154{
154 return entry1->timer == entry2->timer && 155 return entry1->timer == entry2->timer &&
@@ -202,12 +203,15 @@ static struct entry *tstat_lookup(struct entry *entry, char *comm)
202 if (curr) { 203 if (curr) {
203 *curr = *entry; 204 *curr = *entry;
204 curr->count = 0; 205 curr->count = 0;
206 curr->next = NULL;
205 memcpy(curr->comm, comm, TASK_COMM_LEN); 207 memcpy(curr->comm, comm, TASK_COMM_LEN);
208
209 smp_mb(); /* Ensure that curr is initialized before insert */
210
206 if (prev) 211 if (prev)
207 prev->next = curr; 212 prev->next = curr;
208 else 213 else
209 *head = curr; 214 *head = curr;
210 curr->next = NULL;
211 } 215 }
212 out_unlock: 216 out_unlock:
213 spin_unlock(&table_lock); 217 spin_unlock(&table_lock);
@@ -232,10 +236,15 @@ void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
232 /* 236 /*
233 * It doesnt matter which lock we take: 237 * It doesnt matter which lock we take:
234 */ 238 */
235 spinlock_t *lock = &per_cpu(lookup_lock, raw_smp_processor_id()); 239 spinlock_t *lock;
236 struct entry *entry, input; 240 struct entry *entry, input;
237 unsigned long flags; 241 unsigned long flags;
238 242
243 if (likely(!active))
244 return;
245
246 lock = &per_cpu(lookup_lock, raw_smp_processor_id());
247
239 input.timer = timer; 248 input.timer = timer;
240 input.start_func = startf; 249 input.start_func = startf;
241 input.expire_func = timerf; 250 input.expire_func = timerf;
@@ -360,6 +369,7 @@ static ssize_t tstats_write(struct file *file, const char __user *buf,
360 if (!active) { 369 if (!active) {
361 reset_entries(); 370 reset_entries();
362 time_start = ktime_get(); 371 time_start = ktime_get();
372 smp_mb();
363 active = 1; 373 active = 1;
364 } 374 }
365 break; 375 break;
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 1ba77ca7d165..da95e10cfd70 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -126,7 +126,10 @@ config TIMER_STATS
126 reprogrammed. The statistics can be read from /proc/timer_stats. 126 reprogrammed. The statistics can be read from /proc/timer_stats.
127 The statistics collection is started by writing 1 to /proc/timer_stats, 127 The statistics collection is started by writing 1 to /proc/timer_stats,
128 writing 0 stops it. This feature is useful to collect information 128 writing 0 stops it. This feature is useful to collect information
129 about timer usage patterns in kernel and userspace. 129 about timer usage patterns in kernel and userspace. This feature
130 is lightweight if enabled in the kernel config but not activated
131 (it defaults to deactivated on bootup and will only be activated
132 if some application like powertop activates it explicitly).
130 133
131config DEBUG_SLAB 134config DEBUG_SLAB
132 bool "Debug slab memory allocations" 135 bool "Debug slab memory allocations"
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 84279127fcd3..df9d554bea30 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -65,7 +65,7 @@ static int __add_zone(struct zone *zone, unsigned long phys_start_pfn)
65 int zone_type; 65 int zone_type;
66 66
67 zone_type = zone - pgdat->node_zones; 67 zone_type = zone - pgdat->node_zones;
68 if (!populated_zone(zone)) { 68 if (!zone->wait_table) {
69 int ret = 0; 69 int ret = 0;
70 ret = init_currently_empty_zone(zone, phys_start_pfn, 70 ret = init_currently_empty_zone(zone, phys_start_pfn,
71 nr_pages, MEMMAP_HOTPLUG); 71 nr_pages, MEMMAP_HOTPLUG);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d8970623c566..bd8e33582d25 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2689,7 +2689,7 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
2689 map = alloc_bootmem_node(pgdat, size); 2689 map = alloc_bootmem_node(pgdat, size);
2690 pgdat->node_mem_map = map + (pgdat->node_start_pfn - start); 2690 pgdat->node_mem_map = map + (pgdat->node_start_pfn - start);
2691 } 2691 }
2692#ifdef CONFIG_FLATMEM 2692#ifndef CONFIG_NEED_MULTIPLE_NODES
2693 /* 2693 /*
2694 * With no DISCONTIG, the global mem_map is just set as node 0's 2694 * With no DISCONTIG, the global mem_map is just set as node 0's
2695 */ 2695 */
diff --git a/mm/slub.c b/mm/slub.c
index 3e5aefcb4075..51663a3c3c24 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2435,6 +2435,7 @@ void __init kmem_cache_init(void)
2435 */ 2435 */
2436 create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", 2436 create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node",
2437 sizeof(struct kmem_cache_node), GFP_KERNEL); 2437 sizeof(struct kmem_cache_node), GFP_KERNEL);
2438 kmalloc_caches[0].refcount = -1;
2438#endif 2439#endif
2439 2440
2440 /* Able to allocate the per node structures */ 2441 /* Able to allocate the per node structures */
@@ -2482,6 +2483,12 @@ static int slab_unmergeable(struct kmem_cache *s)
2482 if (s->ctor) 2483 if (s->ctor)
2483 return 1; 2484 return 1;
2484 2485
2486 /*
2487 * We may have set a slab to be unmergeable during bootstrap.
2488 */
2489 if (s->refcount < 0)
2490 return 1;
2491
2485 return 0; 2492 return 0;
2486} 2493}
2487 2494
@@ -2601,6 +2608,19 @@ static void for_all_slabs(void (*func)(struct kmem_cache *, int), int cpu)
2601} 2608}
2602 2609
2603/* 2610/*
2611 * Version of __flush_cpu_slab for the case that interrupts
2612 * are enabled.
2613 */
2614static void cpu_slab_flush(struct kmem_cache *s, int cpu)
2615{
2616 unsigned long flags;
2617
2618 local_irq_save(flags);
2619 __flush_cpu_slab(s, cpu);
2620 local_irq_restore(flags);
2621}
2622
2623/*
2604 * Use the cpu notifier to insure that the cpu slabs are flushed when 2624 * Use the cpu notifier to insure that the cpu slabs are flushed when
2605 * necessary. 2625 * necessary.
2606 */ 2626 */
@@ -2614,7 +2634,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb,
2614 case CPU_UP_CANCELED_FROZEN: 2634 case CPU_UP_CANCELED_FROZEN:
2615 case CPU_DEAD: 2635 case CPU_DEAD:
2616 case CPU_DEAD_FROZEN: 2636 case CPU_DEAD_FROZEN:
2617 for_all_slabs(__flush_cpu_slab, cpu); 2637 for_all_slabs(cpu_slab_flush, cpu);
2618 break; 2638 break;
2619 default: 2639 default:
2620 break; 2640 break;
diff --git a/mm/sparse.c b/mm/sparse.c
index 1302f8348d51..545e4d3afcdf 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -209,6 +209,12 @@ static int __meminit sparse_init_one_section(struct mem_section *ms,
209 return 1; 209 return 1;
210} 210}
211 211
212__attribute__((weak))
213void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
214{
215 return NULL;
216}
217
212static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) 218static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
213{ 219{
214 struct page *map; 220 struct page *map;
@@ -219,6 +225,11 @@ static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
219 if (map) 225 if (map)
220 return map; 226 return map;
221 227
228 map = alloc_bootmem_high_node(NODE_DATA(nid),
229 sizeof(struct page) * PAGES_PER_SECTION);
230 if (map)
231 return map;
232
222 map = alloc_bootmem_node(NODE_DATA(nid), 233 map = alloc_bootmem_node(NODE_DATA(nid),
223 sizeof(struct page) * PAGES_PER_SECTION); 234 sizeof(struct page) * PAGES_PER_SECTION);
224 if (map) 235 if (map)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index bd93c45778d4..de78c9dd713b 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -240,10 +240,8 @@ static int unregister_vlan_dev(struct net_device *real_dev,
240 * interlock with HW accelerating devices or SW vlan 240 * interlock with HW accelerating devices or SW vlan
241 * input packet processing. 241 * input packet processing.
242 */ 242 */
243 if (real_dev->features & 243 if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
244 (NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER)) {
245 real_dev->vlan_rx_kill_vid(real_dev, vlan_id); 244 real_dev->vlan_rx_kill_vid(real_dev, vlan_id);
246 }
247 245
248 vlan_group_set_device(grp, vlan_id, NULL); 246 vlan_group_set_device(grp, vlan_id, NULL);
249 synchronize_net(); 247 synchronize_net();
@@ -409,16 +407,14 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
409 } 407 }
410 408
411 if ((real_dev->features & NETIF_F_HW_VLAN_RX) && 409 if ((real_dev->features & NETIF_F_HW_VLAN_RX) &&
412 (real_dev->vlan_rx_register == NULL || 410 !real_dev->vlan_rx_register) {
413 real_dev->vlan_rx_kill_vid == NULL)) {
414 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", 411 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
415 __FUNCTION__, real_dev->name); 412 __FUNCTION__, real_dev->name);
416 goto out_put_dev; 413 goto out_put_dev;
417 } 414 }
418 415
419 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && 416 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
420 (real_dev->vlan_rx_add_vid == NULL || 417 (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) {
421 real_dev->vlan_rx_kill_vid == NULL)) {
422 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n", 418 printk(VLAN_DBG "%s: Device %s has buggy VLAN hw accel.\n",
423 __FUNCTION__, real_dev->name); 419 __FUNCTION__, real_dev->name);
424 goto out_put_dev; 420 goto out_put_dev;
@@ -740,8 +736,7 @@ static int vlan_ioctl_handler(void __user *arg)
740 case SET_VLAN_NAME_TYPE_CMD: 736 case SET_VLAN_NAME_TYPE_CMD:
741 if (!capable(CAP_NET_ADMIN)) 737 if (!capable(CAP_NET_ADMIN))
742 return -EPERM; 738 return -EPERM;
743 if ((args.u.name_type >= 0) && 739 if (args.u.name_type < VLAN_NAME_TYPE_HIGHEST) {
744 (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
745 vlan_name_type = args.u.name_type; 740 vlan_name_type = args.u.name_type;
746 err = 0; 741 err = 0;
747 } else { 742 } else {
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 91b017016d5b..3fc697293819 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -121,6 +121,7 @@ void br_fdb_cleanup(unsigned long _data)
121{ 121{
122 struct net_bridge *br = (struct net_bridge *)_data; 122 struct net_bridge *br = (struct net_bridge *)_data;
123 unsigned long delay = hold_time(br); 123 unsigned long delay = hold_time(br);
124 unsigned long next_timer = jiffies + br->forward_delay;
124 int i; 125 int i;
125 126
126 spin_lock_bh(&br->hash_lock); 127 spin_lock_bh(&br->hash_lock);
@@ -129,14 +130,21 @@ void br_fdb_cleanup(unsigned long _data)
129 struct hlist_node *h, *n; 130 struct hlist_node *h, *n;
130 131
131 hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { 132 hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) {
132 if (!f->is_static && 133 unsigned long this_timer;
133 time_before_eq(f->ageing_timer + delay, jiffies)) 134 if (f->is_static)
135 continue;
136 this_timer = f->ageing_timer + delay;
137 if (time_before_eq(this_timer, jiffies))
134 fdb_delete(f); 138 fdb_delete(f);
139 else if (this_timer < next_timer)
140 next_timer = this_timer;
135 } 141 }
136 } 142 }
137 spin_unlock_bh(&br->hash_lock); 143 spin_unlock_bh(&br->hash_lock);
138 144
139 mod_timer(&br->gc_timer, jiffies + HZ/10); 145 /* Add HZ/4 to ensure we round the jiffies upwards to be after the next
146 * timer, otherwise we might round down and will have no-op run. */
147 mod_timer(&br->gc_timer, round_jiffies(next_timer + HZ/4));
140} 148}
141 149
142/* Completely flush all dynamic entries in forwarding database.*/ 150/* Completely flush all dynamic entries in forwarding database.*/
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 0e035d6162cc..e38034aa56f5 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -178,7 +178,8 @@ void br_transmit_config(struct net_bridge_port *p)
178 br_send_config_bpdu(p, &bpdu); 178 br_send_config_bpdu(p, &bpdu);
179 p->topology_change_ack = 0; 179 p->topology_change_ack = 0;
180 p->config_pending = 0; 180 p->config_pending = 0;
181 mod_timer(&p->hold_timer, jiffies + BR_HOLD_TIME); 181 mod_timer(&p->hold_timer,
182 round_jiffies(jiffies + BR_HOLD_TIME));
182 } 183 }
183} 184}
184 185
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index 24e0ca4a3131..77f5255e6915 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -42,7 +42,7 @@ static void br_hello_timer_expired(unsigned long arg)
42 if (br->dev->flags & IFF_UP) { 42 if (br->dev->flags & IFF_UP) {
43 br_config_bpdu_generation(br); 43 br_config_bpdu_generation(br);
44 44
45 mod_timer(&br->hello_timer, jiffies + br->hello_time); 45 mod_timer(&br->hello_timer, round_jiffies(jiffies + br->hello_time));
46 } 46 }
47 spin_unlock(&br->lock); 47 spin_unlock(&br->lock);
48} 48}
diff --git a/net/core/dev.c b/net/core/dev.c
index 5a7f20f78574..26090621ea6b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2577,7 +2577,7 @@ unsigned dev_get_flags(const struct net_device *dev)
2577 2577
2578int dev_change_flags(struct net_device *dev, unsigned flags) 2578int dev_change_flags(struct net_device *dev, unsigned flags)
2579{ 2579{
2580 int ret; 2580 int ret, changes;
2581 int old_flags = dev->flags; 2581 int old_flags = dev->flags;
2582 2582
2583 /* 2583 /*
@@ -2632,8 +2632,10 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
2632 dev_set_allmulti(dev, inc); 2632 dev_set_allmulti(dev, inc);
2633 } 2633 }
2634 2634
2635 if (old_flags ^ dev->flags) 2635 /* Exclude state transition flags, already notified */
2636 rtmsg_ifinfo(RTM_NEWLINK, dev, old_flags ^ dev->flags); 2636 changes = (old_flags ^ dev->flags) & ~(IFF_UP | IFF_RUNNING);
2637 if (changes)
2638 rtmsg_ifinfo(RTM_NEWLINK, dev, changes);
2637 2639
2638 return ret; 2640 return ret;
2639} 2641}
diff --git a/net/core/dst.c b/net/core/dst.c
index 764bccb3d992..c6a05879d58c 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -111,13 +111,7 @@ out:
111 spin_unlock(&dst_lock); 111 spin_unlock(&dst_lock);
112} 112}
113 113
114static int dst_discard_in(struct sk_buff *skb) 114static int dst_discard(struct sk_buff *skb)
115{
116 kfree_skb(skb);
117 return 0;
118}
119
120static int dst_discard_out(struct sk_buff *skb)
121{ 115{
122 kfree_skb(skb); 116 kfree_skb(skb);
123 return 0; 117 return 0;
@@ -138,8 +132,7 @@ void * dst_alloc(struct dst_ops * ops)
138 dst->ops = ops; 132 dst->ops = ops;
139 dst->lastuse = jiffies; 133 dst->lastuse = jiffies;
140 dst->path = dst; 134 dst->path = dst;
141 dst->input = dst_discard_in; 135 dst->input = dst->output = dst_discard;
142 dst->output = dst_discard_out;
143#if RT_CACHE_DEBUG >= 2 136#if RT_CACHE_DEBUG >= 2
144 atomic_inc(&dst_total); 137 atomic_inc(&dst_total);
145#endif 138#endif
@@ -153,8 +146,7 @@ static void ___dst_free(struct dst_entry * dst)
153 protocol module is unloaded. 146 protocol module is unloaded.
154 */ 147 */
155 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) { 148 if (dst->dev == NULL || !(dst->dev->flags&IFF_UP)) {
156 dst->input = dst_discard_in; 149 dst->input = dst->output = dst_discard;
157 dst->output = dst_discard_out;
158 } 150 }
159 dst->obsolete = 2; 151 dst->obsolete = 2;
160} 152}
@@ -242,8 +234,7 @@ static inline void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
242 return; 234 return;
243 235
244 if (!unregister) { 236 if (!unregister) {
245 dst->input = dst_discard_in; 237 dst->input = dst->output = dst_discard;
246 dst->output = dst_discard_out;
247 } else { 238 } else {
248 dst->dev = &loopback_dev; 239 dst->dev = &loopback_dev;
249 dev_hold(&loopback_dev); 240 dev_hold(&loopback_dev);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 6f3bb73053c2..9df26a07f067 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1761,7 +1761,7 @@ static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
1761 return NULL; 1761 return NULL;
1762} 1762}
1763 1763
1764static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = { 1764static const struct nla_policy nl_neightbl_policy[NDTA_MAX+1] = {
1765 [NDTA_NAME] = { .type = NLA_STRING }, 1765 [NDTA_NAME] = { .type = NLA_STRING },
1766 [NDTA_THRESH1] = { .type = NLA_U32 }, 1766 [NDTA_THRESH1] = { .type = NLA_U32 },
1767 [NDTA_THRESH2] = { .type = NLA_U32 }, 1767 [NDTA_THRESH2] = { .type = NLA_U32 },
@@ -1770,7 +1770,7 @@ static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = {
1770 [NDTA_PARMS] = { .type = NLA_NESTED }, 1770 [NDTA_PARMS] = { .type = NLA_NESTED },
1771}; 1771};
1772 1772
1773static struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] __read_mostly = { 1773static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {
1774 [NDTPA_IFINDEX] = { .type = NLA_U32 }, 1774 [NDTPA_IFINDEX] = { .type = NLA_U32 },
1775 [NDTPA_QUEUE_LEN] = { .type = NLA_U32 }, 1775 [NDTPA_QUEUE_LEN] = { .type = NLA_U32 },
1776 [NDTPA_PROXY_QLEN] = { .type = NLA_U32 }, 1776 [NDTPA_PROXY_QLEN] = { .type = NLA_U32 },
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 27da9cdec6a8..02e8bf084277 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -551,7 +551,7 @@ cont:
551 return skb->len; 551 return skb->len;
552} 552}
553 553
554static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = { 554static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
555 [IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 }, 555 [IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 },
556 [IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) }, 556 [IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) },
557 [IFLA_MTU] = { .type = NLA_U32 }, 557 [IFLA_MTU] = { .type = NLA_U32 },
@@ -580,7 +580,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
580 580
581 err = -EINVAL; 581 err = -EINVAL;
582 ifm = nlmsg_data(nlh); 582 ifm = nlmsg_data(nlh);
583 if (ifm->ifi_index >= 0) 583 if (ifm->ifi_index > 0)
584 dev = dev_get_by_index(ifm->ifi_index); 584 dev = dev_get_by_index(ifm->ifi_index);
585 else if (tb[IFLA_IFNAME]) 585 else if (tb[IFLA_IFNAME])
586 dev = dev_get_by_name(ifname); 586 dev = dev_get_by_name(ifname);
@@ -672,7 +672,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
672 * name provided implies that a name change has been 672 * name provided implies that a name change has been
673 * requested. 673 * requested.
674 */ 674 */
675 if (ifm->ifi_index >= 0 && ifname[0]) { 675 if (ifm->ifi_index > 0 && ifname[0]) {
676 err = dev_change_name(dev, ifname); 676 err = dev_change_name(dev, ifname);
677 if (err < 0) 677 if (err < 0)
678 goto errout_dev; 678 goto errout_dev;
@@ -740,7 +740,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
740 return err; 740 return err;
741 741
742 ifm = nlmsg_data(nlh); 742 ifm = nlmsg_data(nlh);
743 if (ifm->ifi_index >= 0) { 743 if (ifm->ifi_index > 0) {
744 dev = dev_get_by_index(ifm->ifi_index); 744 dev = dev_get_by_index(ifm->ifi_index);
745 if (dev == NULL) 745 if (dev == NULL)
746 return -ENODEV; 746 return -ENODEV;
diff --git a/net/core/sock.c b/net/core/sock.c
index 7e51d3a5e4f6..c14ce0198d25 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -998,7 +998,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst)
998 __sk_dst_set(sk, dst); 998 __sk_dst_set(sk, dst);
999 sk->sk_route_caps = dst->dev->features; 999 sk->sk_route_caps = dst->dev->features;
1000 if (sk->sk_route_caps & NETIF_F_GSO) 1000 if (sk->sk_route_caps & NETIF_F_GSO)
1001 sk->sk_route_caps |= NETIF_F_GSO_MASK; 1001 sk->sk_route_caps |= NETIF_F_GSO_SOFTWARE;
1002 if (sk_can_gso(sk)) { 1002 if (sk_can_gso(sk)) {
1003 if (dst->header_len) 1003 if (dst->header_len)
1004 sk->sk_route_caps &= ~NETIF_F_GSO_MASK; 1004 sk->sk_route_caps &= ~NETIF_F_GSO_MASK;
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index f34aca041a25..6d5ea9762040 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -25,6 +25,7 @@ extern int sysctl_core_destroy_delay;
25extern u32 sysctl_xfrm_aevent_etime; 25extern u32 sysctl_xfrm_aevent_etime;
26extern u32 sysctl_xfrm_aevent_rseqth; 26extern u32 sysctl_xfrm_aevent_rseqth;
27extern int sysctl_xfrm_larval_drop; 27extern int sysctl_xfrm_larval_drop;
28extern u32 sysctl_xfrm_acq_expires;
28#endif 29#endif
29 30
30ctl_table core_table[] = { 31ctl_table core_table[] = {
@@ -127,6 +128,14 @@ ctl_table core_table[] = {
127 .mode = 0644, 128 .mode = 0644,
128 .proc_handler = &proc_dointvec 129 .proc_handler = &proc_dointvec
129 }, 130 },
131 {
132 .ctl_name = CTL_UNNUMBERED,
133 .procname = "xfrm_acq_expires",
134 .data = &sysctl_xfrm_acq_expires,
135 .maxlen = sizeof(int),
136 .mode = 0644,
137 .proc_handler = &proc_dointvec
138 },
130#endif /* CONFIG_XFRM */ 139#endif /* CONFIG_XFRM */
131#endif /* CONFIG_NET */ 140#endif /* CONFIG_NET */
132 { 141 {
diff --git a/net/core/utils.c b/net/core/utils.c
index adecfd281ae9..2030bb8c2d30 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -139,16 +139,16 @@ int in4_pton(const char *src, int srclen,
139 while(1) { 139 while(1) {
140 int c; 140 int c;
141 c = xdigit2bin(srclen > 0 ? *s : '\0', delim); 141 c = xdigit2bin(srclen > 0 ? *s : '\0', delim);
142 if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM))) { 142 if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK))) {
143 goto out; 143 goto out;
144 } 144 }
145 if (c & (IN6PTON_DOT | IN6PTON_DELIM)) { 145 if (c & (IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK)) {
146 if (w == 0) 146 if (w == 0)
147 goto out; 147 goto out;
148 *d++ = w & 0xff; 148 *d++ = w & 0xff;
149 w = 0; 149 w = 0;
150 i++; 150 i++;
151 if (c & IN6PTON_DELIM) { 151 if (c & (IN6PTON_DELIM | IN6PTON_COLON_MASK)) {
152 if (i != 4) 152 if (i != 4)
153 goto out; 153 goto out;
154 break; 154 break;
diff --git a/net/dccp/probe.c b/net/dccp/probe.c
index 1f5e3ba62065..43a3adb027e7 100644
--- a/net/dccp/probe.c
+++ b/net/dccp/probe.c
@@ -128,7 +128,7 @@ static ssize_t dccpprobe_read(struct file *file, char __user *buf,
128 int error = 0, cnt = 0; 128 int error = 0, cnt = 0;
129 unsigned char *tbuf; 129 unsigned char *tbuf;
130 130
131 if (!buf || len < 0) 131 if (!buf)
132 return -EINVAL; 132 return -EINVAL;
133 133
134 if (len == 0) 134 if (len == 0)
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 764a56a13e38..ab41c1879fd4 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -638,7 +638,7 @@ static struct dn_dev *dn_dev_by_index(int ifindex)
638 return dn_dev; 638 return dn_dev;
639} 639}
640 640
641static struct nla_policy dn_ifa_policy[IFA_MAX+1] __read_mostly = { 641static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {
642 [IFA_ADDRESS] = { .type = NLA_U16 }, 642 [IFA_ADDRESS] = { .type = NLA_U16 },
643 [IFA_LOCAL] = { .type = NLA_U16 }, 643 [IFA_LOCAL] = { .type = NLA_U16 },
644 [IFA_LABEL] = { .type = NLA_STRING, 644 [IFA_LABEL] = { .type = NLA_STRING,
diff --git a/net/decnet/dn_rules.c b/net/decnet/dn_rules.c
index 17a1932216d6..84ff3dd37070 100644
--- a/net/decnet/dn_rules.c
+++ b/net/decnet/dn_rules.c
@@ -108,7 +108,7 @@ errout:
108 return err; 108 return err;
109} 109}
110 110
111static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = { 111static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
112 FRA_GENERIC_POLICY, 112 FRA_GENERIC_POLICY,
113}; 113};
114 114
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 7110779a0244..e00767e8ebd9 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -877,7 +877,7 @@ static int arp_process(struct sk_buff *skb)
877 877
878 n = __neigh_lookup(&arp_tbl, &sip, dev, 0); 878 n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
879 879
880 if (ipv4_devconf.arp_accept) { 880 if (IPV4_DEVCONF_ALL(ARP_ACCEPT)) {
881 /* Unsolicited ARP is not accepted by default. 881 /* Unsolicited ARP is not accepted by default.
882 It is possible, that this option should be enabled for some 882 It is possible, that this option should be enabled for some
883 devices (strip is candidate) 883 devices (strip is candidate)
@@ -987,11 +987,11 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev)
987 return 0; 987 return 0;
988 } 988 }
989 if (dev == NULL) { 989 if (dev == NULL) {
990 ipv4_devconf.proxy_arp = 1; 990 IPV4_DEVCONF_ALL(PROXY_ARP) = 1;
991 return 0; 991 return 0;
992 } 992 }
993 if (__in_dev_get_rtnl(dev)) { 993 if (__in_dev_get_rtnl(dev)) {
994 __in_dev_get_rtnl(dev)->cnf.proxy_arp = 1; 994 IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, 1);
995 return 0; 995 return 0;
996 } 996 }
997 return -ENXIO; 997 return -ENXIO;
@@ -1093,11 +1093,12 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
1093 return pneigh_delete(&arp_tbl, &ip, dev); 1093 return pneigh_delete(&arp_tbl, &ip, dev);
1094 if (mask == 0) { 1094 if (mask == 0) {
1095 if (dev == NULL) { 1095 if (dev == NULL) {
1096 ipv4_devconf.proxy_arp = 0; 1096 IPV4_DEVCONF_ALL(PROXY_ARP) = 0;
1097 return 0; 1097 return 0;
1098 } 1098 }
1099 if (__in_dev_get_rtnl(dev)) { 1099 if (__in_dev_get_rtnl(dev)) {
1100 __in_dev_get_rtnl(dev)->cnf.proxy_arp = 0; 1100 IN_DEV_CONF_SET(__in_dev_get_rtnl(dev),
1101 PROXY_ARP, 0);
1101 return 0; 1102 return 0;
1102 } 1103 }
1103 return -ENXIO; 1104 return -ENXIO;
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
index dd02a45d0f67..0301dd468cf4 100644
--- a/net/ipv4/datagram.c
+++ b/net/ipv4/datagram.c
@@ -50,8 +50,12 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
50 RT_CONN_FLAGS(sk), oif, 50 RT_CONN_FLAGS(sk), oif,
51 sk->sk_protocol, 51 sk->sk_protocol,
52 inet->sport, usin->sin_port, sk, 1); 52 inet->sport, usin->sin_port, sk, 1);
53 if (err) 53 if (err) {
54 if (err == -ENETUNREACH)
55 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
54 return err; 56 return err;
57 }
58
55 if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) { 59 if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) {
56 ip_rt_put(rt); 60 ip_rt_put(rt);
57 return -EACCES; 61 return -EACCES;
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7f95e6e9beeb..fa97b96a3d89 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -64,21 +64,27 @@
64#include <net/rtnetlink.h> 64#include <net/rtnetlink.h>
65 65
66struct ipv4_devconf ipv4_devconf = { 66struct ipv4_devconf ipv4_devconf = {
67 .accept_redirects = 1, 67 .data = {
68 .send_redirects = 1, 68 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1,
69 .secure_redirects = 1, 69 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1,
70 .shared_media = 1, 70 [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1,
71 [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1,
72 },
71}; 73};
72 74
73static struct ipv4_devconf ipv4_devconf_dflt = { 75static struct ipv4_devconf ipv4_devconf_dflt = {
74 .accept_redirects = 1, 76 .data = {
75 .send_redirects = 1, 77 [NET_IPV4_CONF_ACCEPT_REDIRECTS - 1] = 1,
76 .secure_redirects = 1, 78 [NET_IPV4_CONF_SEND_REDIRECTS - 1] = 1,
77 .shared_media = 1, 79 [NET_IPV4_CONF_SECURE_REDIRECTS - 1] = 1,
78 .accept_source_route = 1, 80 [NET_IPV4_CONF_SHARED_MEDIA - 1] = 1,
81 [NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE - 1] = 1,
82 },
79}; 83};
80 84
81static struct nla_policy ifa_ipv4_policy[IFA_MAX+1] __read_mostly = { 85#define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr)
86
87static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
82 [IFA_LOCAL] = { .type = NLA_U32 }, 88 [IFA_LOCAL] = { .type = NLA_U32 },
83 [IFA_ADDRESS] = { .type = NLA_U32 }, 89 [IFA_ADDRESS] = { .type = NLA_U32 },
84 [IFA_BROADCAST] = { .type = NLA_U32 }, 90 [IFA_BROADCAST] = { .type = NLA_U32 },
@@ -141,7 +147,7 @@ void in_dev_finish_destroy(struct in_device *idev)
141 } 147 }
142} 148}
143 149
144struct in_device *inetdev_init(struct net_device *dev) 150static struct in_device *inetdev_init(struct net_device *dev)
145{ 151{
146 struct in_device *in_dev; 152 struct in_device *in_dev;
147 153
@@ -399,12 +405,10 @@ static int inet_set_ifa(struct net_device *dev, struct in_ifaddr *ifa)
399 ASSERT_RTNL(); 405 ASSERT_RTNL();
400 406
401 if (!in_dev) { 407 if (!in_dev) {
402 in_dev = inetdev_init(dev); 408 inet_free_ifa(ifa);
403 if (!in_dev) { 409 return -ENOBUFS;
404 inet_free_ifa(ifa);
405 return -ENOBUFS;
406 }
407 } 410 }
411 ipv4_devconf_setall(in_dev);
408 if (ifa->ifa_dev != in_dev) { 412 if (ifa->ifa_dev != in_dev) {
409 BUG_TRAP(!ifa->ifa_dev); 413 BUG_TRAP(!ifa->ifa_dev);
410 in_dev_hold(in_dev); 414 in_dev_hold(in_dev);
@@ -514,13 +518,12 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
514 518
515 in_dev = __in_dev_get_rtnl(dev); 519 in_dev = __in_dev_get_rtnl(dev);
516 if (in_dev == NULL) { 520 if (in_dev == NULL) {
517 in_dev = inetdev_init(dev); 521 err = -ENOBUFS;
518 if (in_dev == NULL) { 522 goto errout;
519 err = -ENOBUFS;
520 goto errout;
521 }
522 } 523 }
523 524
525 ipv4_devconf_setall(in_dev);
526
524 ifa = inet_alloc_ifa(); 527 ifa = inet_alloc_ifa();
525 if (ifa == NULL) { 528 if (ifa == NULL) {
526 /* 529 /*
@@ -1057,11 +1060,12 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
1057 if (!in_dev) { 1060 if (!in_dev) {
1058 if (event == NETDEV_REGISTER) { 1061 if (event == NETDEV_REGISTER) {
1059 in_dev = inetdev_init(dev); 1062 in_dev = inetdev_init(dev);
1060 if (!in_dev)
1061 panic("devinet: Failed to create loopback\n");
1062 if (dev == &loopback_dev) { 1063 if (dev == &loopback_dev) {
1063 in_dev->cnf.no_xfrm = 1; 1064 if (!in_dev)
1064 in_dev->cnf.no_policy = 1; 1065 panic("devinet: "
1066 "Failed to create loopback\n");
1067 IN_DEV_CONF_SET(in_dev, NOXFRM, 1);
1068 IN_DEV_CONF_SET(in_dev, NOPOLICY, 1);
1065 } 1069 }
1066 } 1070 }
1067 goto out; 1071 goto out;
@@ -1237,13 +1241,98 @@ errout:
1237 1241
1238#ifdef CONFIG_SYSCTL 1242#ifdef CONFIG_SYSCTL
1239 1243
1244static void devinet_copy_dflt_conf(int i)
1245{
1246 struct net_device *dev;
1247
1248 read_lock(&dev_base_lock);
1249 for_each_netdev(dev) {
1250 struct in_device *in_dev;
1251 rcu_read_lock();
1252 in_dev = __in_dev_get_rcu(dev);
1253 if (in_dev && !test_bit(i, in_dev->cnf.state))
1254 in_dev->cnf.data[i] = ipv4_devconf_dflt.data[i];
1255 rcu_read_unlock();
1256 }
1257 read_unlock(&dev_base_lock);
1258}
1259
1260static int devinet_conf_proc(ctl_table *ctl, int write,
1261 struct file* filp, void __user *buffer,
1262 size_t *lenp, loff_t *ppos)
1263{
1264 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
1265
1266 if (write) {
1267 struct ipv4_devconf *cnf = ctl->extra1;
1268 int i = (int *)ctl->data - cnf->data;
1269
1270 set_bit(i, cnf->state);
1271
1272 if (cnf == &ipv4_devconf_dflt)
1273 devinet_copy_dflt_conf(i);
1274 }
1275
1276 return ret;
1277}
1278
1279static int devinet_conf_sysctl(ctl_table *table, int __user *name, int nlen,
1280 void __user *oldval, size_t __user *oldlenp,
1281 void __user *newval, size_t newlen)
1282{
1283 struct ipv4_devconf *cnf;
1284 int *valp = table->data;
1285 int new;
1286 int i;
1287
1288 if (!newval || !newlen)
1289 return 0;
1290
1291 if (newlen != sizeof(int))
1292 return -EINVAL;
1293
1294 if (get_user(new, (int __user *)newval))
1295 return -EFAULT;
1296
1297 if (new == *valp)
1298 return 0;
1299
1300 if (oldval && oldlenp) {
1301 size_t len;
1302
1303 if (get_user(len, oldlenp))
1304 return -EFAULT;
1305
1306 if (len) {
1307 if (len > table->maxlen)
1308 len = table->maxlen;
1309 if (copy_to_user(oldval, valp, len))
1310 return -EFAULT;
1311 if (put_user(len, oldlenp))
1312 return -EFAULT;
1313 }
1314 }
1315
1316 *valp = new;
1317
1318 cnf = table->extra1;
1319 i = (int *)table->data - cnf->data;
1320
1321 set_bit(i, cnf->state);
1322
1323 if (cnf == &ipv4_devconf_dflt)
1324 devinet_copy_dflt_conf(i);
1325
1326 return 1;
1327}
1328
1240void inet_forward_change(void) 1329void inet_forward_change(void)
1241{ 1330{
1242 struct net_device *dev; 1331 struct net_device *dev;
1243 int on = ipv4_devconf.forwarding; 1332 int on = IPV4_DEVCONF_ALL(FORWARDING);
1244 1333
1245 ipv4_devconf.accept_redirects = !on; 1334 IPV4_DEVCONF_ALL(ACCEPT_REDIRECTS) = !on;
1246 ipv4_devconf_dflt.forwarding = on; 1335 IPV4_DEVCONF_DFLT(FORWARDING) = on;
1247 1336
1248 read_lock(&dev_base_lock); 1337 read_lock(&dev_base_lock);
1249 for_each_netdev(dev) { 1338 for_each_netdev(dev) {
@@ -1251,7 +1340,7 @@ void inet_forward_change(void)
1251 rcu_read_lock(); 1340 rcu_read_lock();
1252 in_dev = __in_dev_get_rcu(dev); 1341 in_dev = __in_dev_get_rcu(dev);
1253 if (in_dev) 1342 if (in_dev)
1254 in_dev->cnf.forwarding = on; 1343 IN_DEV_CONF_SET(in_dev, FORWARDING, on);
1255 rcu_read_unlock(); 1344 rcu_read_unlock();
1256 } 1345 }
1257 read_unlock(&dev_base_lock); 1346 read_unlock(&dev_base_lock);
@@ -1268,9 +1357,9 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
1268 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 1357 int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
1269 1358
1270 if (write && *valp != val) { 1359 if (write && *valp != val) {
1271 if (valp == &ipv4_devconf.forwarding) 1360 if (valp == &IPV4_DEVCONF_ALL(FORWARDING))
1272 inet_forward_change(); 1361 inet_forward_change();
1273 else if (valp != &ipv4_devconf_dflt.forwarding) 1362 else if (valp != &IPV4_DEVCONF_DFLT(FORWARDING))
1274 rt_cache_flush(0); 1363 rt_cache_flush(0);
1275 } 1364 }
1276 1365
@@ -1295,42 +1384,43 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
1295 void __user *oldval, size_t __user *oldlenp, 1384 void __user *oldval, size_t __user *oldlenp,
1296 void __user *newval, size_t newlen) 1385 void __user *newval, size_t newlen)
1297{ 1386{
1298 int *valp = table->data; 1387 int ret = devinet_conf_sysctl(table, name, nlen, oldval, oldlenp,
1299 int new; 1388 newval, newlen);
1300 1389
1301 if (!newval || !newlen) 1390 if (ret == 1)
1302 return 0; 1391 rt_cache_flush(0);
1303 1392
1304 if (newlen != sizeof(int)) 1393 return ret;
1305 return -EINVAL; 1394}
1306 1395
1307 if (get_user(new, (int __user *)newval))
1308 return -EFAULT;
1309 1396
1310 if (new == *valp) 1397#define DEVINET_SYSCTL_ENTRY(attr, name, mval, proc, sysctl) \
1311 return 0; 1398 { \
1399 .ctl_name = NET_IPV4_CONF_ ## attr, \
1400 .procname = name, \
1401 .data = ipv4_devconf.data + \
1402 NET_IPV4_CONF_ ## attr - 1, \
1403 .maxlen = sizeof(int), \
1404 .mode = mval, \
1405 .proc_handler = proc, \
1406 .strategy = sysctl, \
1407 .extra1 = &ipv4_devconf, \
1408 }
1312 1409
1313 if (oldval && oldlenp) { 1410#define DEVINET_SYSCTL_RW_ENTRY(attr, name) \
1314 size_t len; 1411 DEVINET_SYSCTL_ENTRY(attr, name, 0644, devinet_conf_proc, \
1412 devinet_conf_sysctl)
1315 1413
1316 if (get_user(len, oldlenp)) 1414#define DEVINET_SYSCTL_RO_ENTRY(attr, name) \
1317 return -EFAULT; 1415 DEVINET_SYSCTL_ENTRY(attr, name, 0444, devinet_conf_proc, \
1416 devinet_conf_sysctl)
1318 1417
1319 if (len) { 1418#define DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, proc, sysctl) \
1320 if (len > table->maxlen) 1419 DEVINET_SYSCTL_ENTRY(attr, name, 0644, proc, sysctl)
1321 len = table->maxlen;
1322 if (copy_to_user(oldval, valp, len))
1323 return -EFAULT;
1324 if (put_user(len, oldlenp))
1325 return -EFAULT;
1326 }
1327 }
1328
1329 *valp = new;
1330 rt_cache_flush(0);
1331 return 1;
1332}
1333 1420
1421#define DEVINET_SYSCTL_FLUSHING_ENTRY(attr, name) \
1422 DEVINET_SYSCTL_COMPLEX_ENTRY(attr, name, ipv4_doint_and_flush, \
1423 ipv4_doint_and_flush_strategy)
1334 1424
1335static struct devinet_sysctl_table { 1425static struct devinet_sysctl_table {
1336 struct ctl_table_header *sysctl_header; 1426 struct ctl_table_header *sysctl_header;
@@ -1341,178 +1431,34 @@ static struct devinet_sysctl_table {
1341 ctl_table devinet_root_dir[2]; 1431 ctl_table devinet_root_dir[2];
1342} devinet_sysctl = { 1432} devinet_sysctl = {
1343 .devinet_vars = { 1433 .devinet_vars = {
1344 { 1434 DEVINET_SYSCTL_COMPLEX_ENTRY(FORWARDING, "forwarding",
1345 .ctl_name = NET_IPV4_CONF_FORWARDING, 1435 devinet_sysctl_forward,
1346 .procname = "forwarding", 1436 devinet_conf_sysctl),
1347 .data = &ipv4_devconf.forwarding, 1437 DEVINET_SYSCTL_RO_ENTRY(MC_FORWARDING, "mc_forwarding"),
1348 .maxlen = sizeof(int), 1438
1349 .mode = 0644, 1439 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_REDIRECTS, "accept_redirects"),
1350 .proc_handler = &devinet_sysctl_forward, 1440 DEVINET_SYSCTL_RW_ENTRY(SECURE_REDIRECTS, "secure_redirects"),
1351 }, 1441 DEVINET_SYSCTL_RW_ENTRY(SHARED_MEDIA, "shared_media"),
1352 { 1442 DEVINET_SYSCTL_RW_ENTRY(RP_FILTER, "rp_filter"),
1353 .ctl_name = NET_IPV4_CONF_MC_FORWARDING, 1443 DEVINET_SYSCTL_RW_ENTRY(SEND_REDIRECTS, "send_redirects"),
1354 .procname = "mc_forwarding", 1444 DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE,
1355 .data = &ipv4_devconf.mc_forwarding, 1445 "accept_source_route"),
1356 .maxlen = sizeof(int), 1446 DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"),
1357 .mode = 0444, 1447 DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"),
1358 .proc_handler = &proc_dointvec, 1448 DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"),
1359 }, 1449 DEVINET_SYSCTL_RW_ENTRY(LOG_MARTIANS, "log_martians"),
1360 { 1450 DEVINET_SYSCTL_RW_ENTRY(TAG, "tag"),
1361 .ctl_name = NET_IPV4_CONF_ACCEPT_REDIRECTS, 1451 DEVINET_SYSCTL_RW_ENTRY(ARPFILTER, "arp_filter"),
1362 .procname = "accept_redirects", 1452 DEVINET_SYSCTL_RW_ENTRY(ARP_ANNOUNCE, "arp_announce"),
1363 .data = &ipv4_devconf.accept_redirects, 1453 DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"),
1364 .maxlen = sizeof(int), 1454 DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"),
1365 .mode = 0644, 1455
1366 .proc_handler = &proc_dointvec, 1456 DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"),
1367 }, 1457 DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"),
1368 { 1458 DEVINET_SYSCTL_FLUSHING_ENTRY(FORCE_IGMP_VERSION,
1369 .ctl_name = NET_IPV4_CONF_SECURE_REDIRECTS, 1459 "force_igmp_version"),
1370 .procname = "secure_redirects", 1460 DEVINET_SYSCTL_FLUSHING_ENTRY(PROMOTE_SECONDARIES,
1371 .data = &ipv4_devconf.secure_redirects, 1461 "promote_secondaries"),
1372 .maxlen = sizeof(int),
1373 .mode = 0644,
1374 .proc_handler = &proc_dointvec,
1375 },
1376 {
1377 .ctl_name = NET_IPV4_CONF_SHARED_MEDIA,
1378 .procname = "shared_media",
1379 .data = &ipv4_devconf.shared_media,
1380 .maxlen = sizeof(int),
1381 .mode = 0644,
1382 .proc_handler = &proc_dointvec,
1383 },
1384 {
1385 .ctl_name = NET_IPV4_CONF_RP_FILTER,
1386 .procname = "rp_filter",
1387 .data = &ipv4_devconf.rp_filter,
1388 .maxlen = sizeof(int),
1389 .mode = 0644,
1390 .proc_handler = &proc_dointvec,
1391 },
1392 {
1393 .ctl_name = NET_IPV4_CONF_SEND_REDIRECTS,
1394 .procname = "send_redirects",
1395 .data = &ipv4_devconf.send_redirects,
1396 .maxlen = sizeof(int),
1397 .mode = 0644,
1398 .proc_handler = &proc_dointvec,
1399 },
1400 {
1401 .ctl_name = NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE,
1402 .procname = "accept_source_route",
1403 .data = &ipv4_devconf.accept_source_route,
1404 .maxlen = sizeof(int),
1405 .mode = 0644,
1406 .proc_handler = &proc_dointvec,
1407 },
1408 {
1409 .ctl_name = NET_IPV4_CONF_PROXY_ARP,
1410 .procname = "proxy_arp",
1411 .data = &ipv4_devconf.proxy_arp,
1412 .maxlen = sizeof(int),
1413 .mode = 0644,
1414 .proc_handler = &proc_dointvec,
1415 },
1416 {
1417 .ctl_name = NET_IPV4_CONF_MEDIUM_ID,
1418 .procname = "medium_id",
1419 .data = &ipv4_devconf.medium_id,
1420 .maxlen = sizeof(int),
1421 .mode = 0644,
1422 .proc_handler = &proc_dointvec,
1423 },
1424 {
1425 .ctl_name = NET_IPV4_CONF_BOOTP_RELAY,
1426 .procname = "bootp_relay",
1427 .data = &ipv4_devconf.bootp_relay,
1428 .maxlen = sizeof(int),
1429 .mode = 0644,
1430 .proc_handler = &proc_dointvec,
1431 },
1432 {
1433 .ctl_name = NET_IPV4_CONF_LOG_MARTIANS,
1434 .procname = "log_martians",
1435 .data = &ipv4_devconf.log_martians,
1436 .maxlen = sizeof(int),
1437 .mode = 0644,
1438 .proc_handler = &proc_dointvec,
1439 },
1440 {
1441 .ctl_name = NET_IPV4_CONF_TAG,
1442 .procname = "tag",
1443 .data = &ipv4_devconf.tag,
1444 .maxlen = sizeof(int),
1445 .mode = 0644,
1446 .proc_handler = &proc_dointvec,
1447 },
1448 {
1449 .ctl_name = NET_IPV4_CONF_ARPFILTER,
1450 .procname = "arp_filter",
1451 .data = &ipv4_devconf.arp_filter,
1452 .maxlen = sizeof(int),
1453 .mode = 0644,
1454 .proc_handler = &proc_dointvec,
1455 },
1456 {
1457 .ctl_name = NET_IPV4_CONF_ARP_ANNOUNCE,
1458 .procname = "arp_announce",
1459 .data = &ipv4_devconf.arp_announce,
1460 .maxlen = sizeof(int),
1461 .mode = 0644,
1462 .proc_handler = &proc_dointvec,
1463 },
1464 {
1465 .ctl_name = NET_IPV4_CONF_ARP_IGNORE,
1466 .procname = "arp_ignore",
1467 .data = &ipv4_devconf.arp_ignore,
1468 .maxlen = sizeof(int),
1469 .mode = 0644,
1470 .proc_handler = &proc_dointvec,
1471 },
1472 {
1473 .ctl_name = NET_IPV4_CONF_ARP_ACCEPT,
1474 .procname = "arp_accept",
1475 .data = &ipv4_devconf.arp_accept,
1476 .maxlen = sizeof(int),
1477 .mode = 0644,
1478 .proc_handler = &proc_dointvec,
1479 },
1480 {
1481 .ctl_name = NET_IPV4_CONF_NOXFRM,
1482 .procname = "disable_xfrm",
1483 .data = &ipv4_devconf.no_xfrm,
1484 .maxlen = sizeof(int),
1485 .mode = 0644,
1486 .proc_handler = &ipv4_doint_and_flush,
1487 .strategy = &ipv4_doint_and_flush_strategy,
1488 },
1489 {
1490 .ctl_name = NET_IPV4_CONF_NOPOLICY,
1491 .procname = "disable_policy",
1492 .data = &ipv4_devconf.no_policy,
1493 .maxlen = sizeof(int),
1494 .mode = 0644,
1495 .proc_handler = &ipv4_doint_and_flush,
1496 .strategy = &ipv4_doint_and_flush_strategy,
1497 },
1498 {
1499 .ctl_name = NET_IPV4_CONF_FORCE_IGMP_VERSION,
1500 .procname = "force_igmp_version",
1501 .data = &ipv4_devconf.force_igmp_version,
1502 .maxlen = sizeof(int),
1503 .mode = 0644,
1504 .proc_handler = &ipv4_doint_and_flush,
1505 .strategy = &ipv4_doint_and_flush_strategy,
1506 },
1507 {
1508 .ctl_name = NET_IPV4_CONF_PROMOTE_SECONDARIES,
1509 .procname = "promote_secondaries",
1510 .data = &ipv4_devconf.promote_secondaries,
1511 .maxlen = sizeof(int),
1512 .mode = 0644,
1513 .proc_handler = &ipv4_doint_and_flush,
1514 .strategy = &ipv4_doint_and_flush_strategy,
1515 },
1516 }, 1462 },
1517 .devinet_dev = { 1463 .devinet_dev = {
1518 { 1464 {
@@ -1561,6 +1507,7 @@ static void devinet_sysctl_register(struct in_device *in_dev,
1561 return; 1507 return;
1562 for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { 1508 for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
1563 t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; 1509 t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
1510 t->devinet_vars[i].extra1 = p;
1564 } 1511 }
1565 1512
1566 if (dev) { 1513 if (dev) {
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 837f2957fa83..311d633f7f39 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -250,8 +250,6 @@ e_inval:
250 return -EINVAL; 250 return -EINVAL;
251} 251}
252 252
253#ifndef CONFIG_IP_NOSIOCRT
254
255static inline __be32 sk_extract_addr(struct sockaddr *addr) 253static inline __be32 sk_extract_addr(struct sockaddr *addr)
256{ 254{
257 return ((struct sockaddr_in *) addr)->sin_addr.s_addr; 255 return ((struct sockaddr_in *) addr)->sin_addr.s_addr;
@@ -443,16 +441,7 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
443 return -EINVAL; 441 return -EINVAL;
444} 442}
445 443
446#else 444const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = {
447
448int ip_rt_ioctl(unsigned int cmd, void *arg)
449{
450 return -EINVAL;
451}
452
453#endif
454
455struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = {
456 [RTA_DST] = { .type = NLA_U32 }, 445 [RTA_DST] = { .type = NLA_U32 },
457 [RTA_SRC] = { .type = NLA_U32 }, 446 [RTA_SRC] = { .type = NLA_U32 },
458 [RTA_IIF] = { .type = NLA_U32 }, 447 [RTA_IIF] = { .type = NLA_U32 },
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 33083ad52e9f..2a947840210e 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -169,7 +169,7 @@ static struct fib_table *fib_empty_table(void)
169 return NULL; 169 return NULL;
170} 170}
171 171
172static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = { 172static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = {
173 FRA_GENERIC_POLICY, 173 FRA_GENERIC_POLICY,
174 [FRA_FLOW] = { .type = NLA_U32 }, 174 [FRA_FLOW] = { .type = NLA_U32 },
175}; 175};
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index e238b17f554c..02a899bec196 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -514,12 +514,15 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
514 514
515 saddr = iph->daddr; 515 saddr = iph->daddr;
516 if (!(rt->rt_flags & RTCF_LOCAL)) { 516 if (!(rt->rt_flags & RTCF_LOCAL)) {
517 /* This is broken, skb_in->dev points to the outgoing device 517 struct net_device *dev = NULL;
518 * after the packet passes through ip_output(). 518
519 */ 519 if (rt->fl.iif && sysctl_icmp_errors_use_inbound_ifaddr)
520 if (skb_in->dev && sysctl_icmp_errors_use_inbound_ifaddr) 520 dev = dev_get_by_index(rt->fl.iif);
521 saddr = inet_select_addr(skb_in->dev, 0, RT_SCOPE_LINK); 521
522 else 522 if (dev) {
523 saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
524 dev_put(dev);
525 } else
523 saddr = 0; 526 saddr = 0;
524 } 527 }
525 528
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index f4dd47453108..a646409c2d06 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -128,14 +128,16 @@
128 * contradict to specs provided this delay is small enough. 128 * contradict to specs provided this delay is small enough.
129 */ 129 */
130 130
131#define IGMP_V1_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 1 || \ 131#define IGMP_V1_SEEN(in_dev) \
132 (in_dev)->cnf.force_igmp_version == 1 || \ 132 (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 1 || \
133 ((in_dev)->mr_v1_seen && \ 133 IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \
134 time_before(jiffies, (in_dev)->mr_v1_seen))) 134 ((in_dev)->mr_v1_seen && \
135#define IGMP_V2_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 2 || \ 135 time_before(jiffies, (in_dev)->mr_v1_seen)))
136 (in_dev)->cnf.force_igmp_version == 2 || \ 136#define IGMP_V2_SEEN(in_dev) \
137 ((in_dev)->mr_v2_seen && \ 137 (IPV4_DEVCONF_ALL(FORCE_IGMP_VERSION) == 2 || \
138 time_before(jiffies, (in_dev)->mr_v2_seen))) 138 IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \
139 ((in_dev)->mr_v2_seen && \
140 time_before(jiffies, (in_dev)->mr_v2_seen)))
139 141
140static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im); 142static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im);
141static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr); 143static void igmpv3_del_delrec(struct in_device *in_dev, __be32 multiaddr);
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 43fb1600f1f0..fbe7714f21d0 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -31,10 +31,8 @@ EXPORT_SYMBOL(inet_csk_timer_bug_msg);
31 31
32/* 32/*
33 * This array holds the first and last local port number. 33 * This array holds the first and last local port number.
34 * For high-usage systems, use sysctl to change this to
35 * 32768-61000
36 */ 34 */
37int sysctl_local_port_range[2] = { 1024, 4999 }; 35int sysctl_local_port_range[2] = { 32768, 61000 };
38 36
39int inet_csk_bind_conflict(const struct sock *sk, 37int inet_csk_bind_conflict(const struct sock *sk,
40 const struct inet_bind_bucket *tb) 38 const struct inet_bind_bucket *tb)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index d6427d918512..34ea4547ebbe 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1352,7 +1352,8 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
1352 } 1352 }
1353 1353
1354 { 1354 {
1355 struct flowi fl = { .nl_u = { .ip4_u = 1355 struct flowi fl = { .oif = arg->bound_dev_if,
1356 .nl_u = { .ip4_u =
1356 { .daddr = daddr, 1357 { .daddr = daddr,
1357 .saddr = rt->rt_spec_dst, 1358 .saddr = rt->rt_spec_dst,
1358 .tos = RT_TOS(ip_hdr(skb)->tos) } }, 1359 .tos = RT_TOS(ip_hdr(skb)->tos) } },
@@ -1376,6 +1377,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
1376 inet->tos = ip_hdr(skb)->tos; 1377 inet->tos = ip_hdr(skb)->tos;
1377 sk->sk_priority = skb->priority; 1378 sk->sk_priority = skb->priority;
1378 sk->sk_protocol = ip_hdr(skb)->protocol; 1379 sk->sk_protocol = ip_hdr(skb)->protocol;
1380 sk->sk_bound_dev_if = arg->bound_dev_if;
1379 ip_append_data(sk, ip_reply_glue_bits, arg->iov->iov_base, len, 0, 1381 ip_append_data(sk, ip_reply_glue_bits, arg->iov->iov_base, len, 0,
1380 &ipc, rt, MSG_DONTWAIT); 1382 &ipc, rt, MSG_DONTWAIT);
1381 if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) { 1383 if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) {
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 0ebae413ae87..d96582acdf69 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -152,9 +152,11 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
152 dev->flags |= IFF_MULTICAST; 152 dev->flags |= IFF_MULTICAST;
153 153
154 in_dev = __in_dev_get_rtnl(dev); 154 in_dev = __in_dev_get_rtnl(dev);
155 if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL) 155 if (in_dev == NULL)
156 goto failure; 156 goto failure;
157 in_dev->cnf.rp_filter = 0; 157
158 ipv4_devconf_setall(in_dev);
159 IPV4_DEVCONF(in_dev->cnf, RP_FILTER) = 0;
158 160
159 if (dev_open(dev)) 161 if (dev_open(dev))
160 goto failure; 162 goto failure;
@@ -218,10 +220,15 @@ static struct net_device *ipmr_reg_vif(void)
218 } 220 }
219 dev->iflink = 0; 221 dev->iflink = 0;
220 222
221 if ((in_dev = inetdev_init(dev)) == NULL) 223 rcu_read_lock();
224 if ((in_dev = __in_dev_get_rcu(dev)) == NULL) {
225 rcu_read_unlock();
222 goto failure; 226 goto failure;
227 }
223 228
224 in_dev->cnf.rp_filter = 0; 229 ipv4_devconf_setall(in_dev);
230 IPV4_DEVCONF(in_dev->cnf, RP_FILTER) = 0;
231 rcu_read_unlock();
225 232
226 if (dev_open(dev)) 233 if (dev_open(dev))
227 goto failure; 234 goto failure;
@@ -281,7 +288,7 @@ static int vif_delete(int vifi)
281 dev_set_allmulti(dev, -1); 288 dev_set_allmulti(dev, -1);
282 289
283 if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) { 290 if ((in_dev = __in_dev_get_rtnl(dev)) != NULL) {
284 in_dev->cnf.mc_forwarding--; 291 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)--;
285 ip_rt_multicast_event(in_dev); 292 ip_rt_multicast_event(in_dev);
286 } 293 }
287 294
@@ -426,7 +433,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
426 433
427 if ((in_dev = __in_dev_get_rtnl(dev)) == NULL) 434 if ((in_dev = __in_dev_get_rtnl(dev)) == NULL)
428 return -EADDRNOTAVAIL; 435 return -EADDRNOTAVAIL;
429 in_dev->cnf.mc_forwarding++; 436 IPV4_DEVCONF(in_dev->cnf, MC_FORWARDING)++;
430 dev_set_allmulti(dev, +1); 437 dev_set_allmulti(dev, +1);
431 ip_rt_multicast_event(in_dev); 438 ip_rt_multicast_event(in_dev);
432 439
@@ -841,7 +848,7 @@ static void mrtsock_destruct(struct sock *sk)
841{ 848{
842 rtnl_lock(); 849 rtnl_lock();
843 if (sk == mroute_socket) { 850 if (sk == mroute_socket) {
844 ipv4_devconf.mc_forwarding--; 851 IPV4_DEVCONF_ALL(MC_FORWARDING)--;
845 852
846 write_lock_bh(&mrt_lock); 853 write_lock_bh(&mrt_lock);
847 mroute_socket=NULL; 854 mroute_socket=NULL;
@@ -890,7 +897,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
890 mroute_socket=sk; 897 mroute_socket=sk;
891 write_unlock_bh(&mrt_lock); 898 write_unlock_bh(&mrt_lock);
892 899
893 ipv4_devconf.mc_forwarding++; 900 IPV4_DEVCONF_ALL(MC_FORWARDING)++;
894 } 901 }
895 rtnl_unlock(); 902 rtnl_unlock();
896 return ret; 903 return ret;
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index e3f83bf160d9..9bacf1a03630 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -499,7 +499,8 @@ check_entry(struct ipt_entry *e, const char *name)
499} 499}
500 500
501static inline int check_match(struct ipt_entry_match *m, const char *name, 501static inline int check_match(struct ipt_entry_match *m, const char *name,
502 const struct ipt_ip *ip, unsigned int hookmask) 502 const struct ipt_ip *ip, unsigned int hookmask,
503 unsigned int *i)
503{ 504{
504 struct xt_match *match; 505 struct xt_match *match;
505 int ret; 506 int ret;
@@ -515,6 +516,8 @@ static inline int check_match(struct ipt_entry_match *m, const char *name,
515 m->u.kernel.match->name); 516 m->u.kernel.match->name);
516 ret = -EINVAL; 517 ret = -EINVAL;
517 } 518 }
519 if (!ret)
520 (*i)++;
518 return ret; 521 return ret;
519} 522}
520 523
@@ -537,11 +540,10 @@ find_check_match(struct ipt_entry_match *m,
537 } 540 }
538 m->u.kernel.match = match; 541 m->u.kernel.match = match;
539 542
540 ret = check_match(m, name, ip, hookmask); 543 ret = check_match(m, name, ip, hookmask, i);
541 if (ret) 544 if (ret)
542 goto err; 545 goto err;
543 546
544 (*i)++;
545 return 0; 547 return 0;
546err: 548err:
547 module_put(m->u.kernel.match->me); 549 module_put(m->u.kernel.match->me);
@@ -1425,7 +1427,7 @@ out:
1425} 1427}
1426 1428
1427static inline int 1429static inline int
1428compat_check_calc_match(struct ipt_entry_match *m, 1430compat_find_calc_match(struct ipt_entry_match *m,
1429 const char *name, 1431 const char *name,
1430 const struct ipt_ip *ip, 1432 const struct ipt_ip *ip,
1431 unsigned int hookmask, 1433 unsigned int hookmask,
@@ -1449,6 +1451,31 @@ compat_check_calc_match(struct ipt_entry_match *m,
1449} 1451}
1450 1452
1451static inline int 1453static inline int
1454compat_release_match(struct ipt_entry_match *m, unsigned int *i)
1455{
1456 if (i && (*i)-- == 0)
1457 return 1;
1458
1459 module_put(m->u.kernel.match->me);
1460 return 0;
1461}
1462
1463static inline int
1464compat_release_entry(struct ipt_entry *e, unsigned int *i)
1465{
1466 struct ipt_entry_target *t;
1467
1468 if (i && (*i)-- == 0)
1469 return 1;
1470
1471 /* Cleanup all matches */
1472 IPT_MATCH_ITERATE(e, compat_release_match, NULL);
1473 t = ipt_get_target(e);
1474 module_put(t->u.kernel.target->me);
1475 return 0;
1476}
1477
1478static inline int
1452check_compat_entry_size_and_hooks(struct ipt_entry *e, 1479check_compat_entry_size_and_hooks(struct ipt_entry *e,
1453 struct xt_table_info *newinfo, 1480 struct xt_table_info *newinfo,
1454 unsigned int *size, 1481 unsigned int *size,
@@ -1485,10 +1512,10 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
1485 off = 0; 1512 off = 0;
1486 entry_offset = (void *)e - (void *)base; 1513 entry_offset = (void *)e - (void *)base;
1487 j = 0; 1514 j = 0;
1488 ret = IPT_MATCH_ITERATE(e, compat_check_calc_match, name, &e->ip, 1515 ret = IPT_MATCH_ITERATE(e, compat_find_calc_match, name, &e->ip,
1489 e->comefrom, &off, &j); 1516 e->comefrom, &off, &j);
1490 if (ret != 0) 1517 if (ret != 0)
1491 goto cleanup_matches; 1518 goto release_matches;
1492 1519
1493 t = ipt_get_target(e); 1520 t = ipt_get_target(e);
1494 target = try_then_request_module(xt_find_target(AF_INET, 1521 target = try_then_request_module(xt_find_target(AF_INET,
@@ -1499,7 +1526,7 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
1499 duprintf("check_compat_entry_size_and_hooks: `%s' not found\n", 1526 duprintf("check_compat_entry_size_and_hooks: `%s' not found\n",
1500 t->u.user.name); 1527 t->u.user.name);
1501 ret = target ? PTR_ERR(target) : -ENOENT; 1528 ret = target ? PTR_ERR(target) : -ENOENT;
1502 goto cleanup_matches; 1529 goto release_matches;
1503 } 1530 }
1504 t->u.kernel.target = target; 1531 t->u.kernel.target = target;
1505 1532
@@ -1526,8 +1553,8 @@ check_compat_entry_size_and_hooks(struct ipt_entry *e,
1526 1553
1527out: 1554out:
1528 module_put(t->u.kernel.target->me); 1555 module_put(t->u.kernel.target->me);
1529cleanup_matches: 1556release_matches:
1530 IPT_MATCH_ITERATE(e, cleanup_match, &j); 1557 IPT_MATCH_ITERATE(e, compat_release_match, &j);
1531 return ret; 1558 return ret;
1532} 1559}
1533 1560
@@ -1574,15 +1601,26 @@ static int compat_copy_entry_from_user(struct ipt_entry *e, void **dstptr,
1574 return ret; 1601 return ret;
1575} 1602}
1576 1603
1577static inline int compat_check_entry(struct ipt_entry *e, const char *name) 1604static inline int compat_check_entry(struct ipt_entry *e, const char *name,
1605 unsigned int *i)
1578{ 1606{
1579 int ret; 1607 int j, ret;
1580 1608
1581 ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip, e->comefrom); 1609 j = 0;
1610 ret = IPT_MATCH_ITERATE(e, check_match, name, &e->ip, e->comefrom, &j);
1582 if (ret) 1611 if (ret)
1583 return ret; 1612 goto cleanup_matches;
1613
1614 ret = check_target(e, name);
1615 if (ret)
1616 goto cleanup_matches;
1584 1617
1585 return check_target(e, name); 1618 (*i)++;
1619 return 0;
1620
1621 cleanup_matches:
1622 IPT_MATCH_ITERATE(e, cleanup_match, &j);
1623 return ret;
1586} 1624}
1587 1625
1588static int 1626static int
@@ -1673,10 +1711,17 @@ translate_compat_table(const char *name,
1673 if (!mark_source_chains(newinfo, valid_hooks, entry1)) 1711 if (!mark_source_chains(newinfo, valid_hooks, entry1))
1674 goto free_newinfo; 1712 goto free_newinfo;
1675 1713
1714 i = 0;
1676 ret = IPT_ENTRY_ITERATE(entry1, newinfo->size, compat_check_entry, 1715 ret = IPT_ENTRY_ITERATE(entry1, newinfo->size, compat_check_entry,
1677 name); 1716 name, &i);
1678 if (ret) 1717 if (ret) {
1679 goto free_newinfo; 1718 j -= i;
1719 IPT_ENTRY_ITERATE_CONTINUE(entry1, newinfo->size, i,
1720 compat_release_entry, &j);
1721 IPT_ENTRY_ITERATE(entry1, newinfo->size, cleanup_entry, &i);
1722 xt_free_table_info(newinfo);
1723 return ret;
1724 }
1680 1725
1681 /* And one copy for every other CPU */ 1726 /* And one copy for every other CPU */
1682 for_each_possible_cpu(i) 1727 for_each_possible_cpu(i)
@@ -1691,7 +1736,7 @@ translate_compat_table(const char *name,
1691free_newinfo: 1736free_newinfo:
1692 xt_free_table_info(newinfo); 1737 xt_free_table_info(newinfo);
1693out: 1738out:
1694 IPT_ENTRY_ITERATE(entry0, total_size, cleanup_entry, &j); 1739 IPT_ENTRY_ITERATE(entry0, total_size, compat_release_entry, &j);
1695 return ret; 1740 return ret;
1696out_unlock: 1741out_unlock:
1697 compat_flush_offsets(); 1742 compat_flush_offsets();
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index fd62a41d69cc..6dc72a815f77 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -133,6 +133,7 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
133 struct nf_conn *ct; 133 struct nf_conn *ct;
134 enum ip_conntrack_info ctinfo; 134 enum ip_conntrack_info ctinfo;
135 struct nf_conn_help *help; 135 struct nf_conn_help *help;
136 struct nf_conntrack_helper *helper;
136 137
137 /* This is where we call the helper: as the packet goes out. */ 138 /* This is where we call the helper: as the packet goes out. */
138 ct = nf_ct_get(*pskb, &ctinfo); 139 ct = nf_ct_get(*pskb, &ctinfo);
@@ -140,12 +141,14 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
140 return NF_ACCEPT; 141 return NF_ACCEPT;
141 142
142 help = nfct_help(ct); 143 help = nfct_help(ct);
143 if (!help || !help->helper) 144 if (!help)
144 return NF_ACCEPT; 145 return NF_ACCEPT;
145 146 /* rcu_read_lock()ed by nf_hook_slow */
146 return help->helper->help(pskb, 147 helper = rcu_dereference(help->helper);
147 skb_network_offset(*pskb) + ip_hdrlen(*pskb), 148 if (!helper)
148 ct, ctinfo); 149 return NF_ACCEPT;
150 return helper->help(pskb, skb_network_offset(*pskb) + ip_hdrlen(*pskb),
151 ct, ctinfo);
149} 152}
150 153
151static unsigned int ipv4_conntrack_defrag(unsigned int hooknum, 154static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index cdbc6c135849..3b690cf2a4ee 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -260,7 +260,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
260 seq_printf(seq, " %s", snmp4_ipstats_list[i].name); 260 seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
261 261
262 seq_printf(seq, "\nIp: %d %d", 262 seq_printf(seq, "\nIp: %d %d",
263 ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl); 263 IPV4_DEVCONF_ALL(FORWARDING) ? 1 : 2, sysctl_ip_default_ttl);
264 264
265 for (i = 0; snmp4_ipstats_list[i].name != NULL; i++) 265 for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
266 seq_printf(seq, " %lu", 266 seq_printf(seq, " %lu",
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8603cfb271f2..29ca63e81ced 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1636,7 +1636,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1636 1636
1637 atomic_set(&rth->u.dst.__refcnt, 1); 1637 atomic_set(&rth->u.dst.__refcnt, 1);
1638 rth->u.dst.flags= DST_HOST; 1638 rth->u.dst.flags= DST_HOST;
1639 if (in_dev->cnf.no_policy) 1639 if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
1640 rth->u.dst.flags |= DST_NOPOLICY; 1640 rth->u.dst.flags |= DST_NOPOLICY;
1641 rth->fl.fl4_dst = daddr; 1641 rth->fl.fl4_dst = daddr;
1642 rth->rt_dst = daddr; 1642 rth->rt_dst = daddr;
@@ -1778,9 +1778,9 @@ static inline int __mkroute_input(struct sk_buff *skb,
1778 if (res->fi->fib_nhs > 1) 1778 if (res->fi->fib_nhs > 1)
1779 rth->u.dst.flags |= DST_BALANCED; 1779 rth->u.dst.flags |= DST_BALANCED;
1780#endif 1780#endif
1781 if (in_dev->cnf.no_policy) 1781 if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
1782 rth->u.dst.flags |= DST_NOPOLICY; 1782 rth->u.dst.flags |= DST_NOPOLICY;
1783 if (out_dev->cnf.no_xfrm) 1783 if (IN_DEV_CONF_GET(out_dev, NOXFRM))
1784 rth->u.dst.flags |= DST_NOXFRM; 1784 rth->u.dst.flags |= DST_NOXFRM;
1785 rth->fl.fl4_dst = daddr; 1785 rth->fl.fl4_dst = daddr;
1786 rth->rt_dst = daddr; 1786 rth->rt_dst = daddr;
@@ -2021,7 +2021,7 @@ local_input:
2021 2021
2022 atomic_set(&rth->u.dst.__refcnt, 1); 2022 atomic_set(&rth->u.dst.__refcnt, 1);
2023 rth->u.dst.flags= DST_HOST; 2023 rth->u.dst.flags= DST_HOST;
2024 if (in_dev->cnf.no_policy) 2024 if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
2025 rth->u.dst.flags |= DST_NOPOLICY; 2025 rth->u.dst.flags |= DST_NOPOLICY;
2026 rth->fl.fl4_dst = daddr; 2026 rth->fl.fl4_dst = daddr;
2027 rth->rt_dst = daddr; 2027 rth->rt_dst = daddr;
@@ -2218,9 +2218,9 @@ static inline int __mkroute_output(struct rtable **result,
2218 rth->u.dst.flags |= DST_BALANCED; 2218 rth->u.dst.flags |= DST_BALANCED;
2219 } 2219 }
2220#endif 2220#endif
2221 if (in_dev->cnf.no_xfrm) 2221 if (IN_DEV_CONF_GET(in_dev, NOXFRM))
2222 rth->u.dst.flags |= DST_NOXFRM; 2222 rth->u.dst.flags |= DST_NOXFRM;
2223 if (in_dev->cnf.no_policy) 2223 if (IN_DEV_CONF_GET(in_dev, NOPOLICY))
2224 rth->u.dst.flags |= DST_NOPOLICY; 2224 rth->u.dst.flags |= DST_NOPOLICY;
2225 2225
2226 rth->fl.fl4_dst = oldflp->fl4_dst; 2226 rth->fl.fl4_dst = oldflp->fl4_dst;
@@ -2759,7 +2759,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
2759 __be32 dst = rt->rt_dst; 2759 __be32 dst = rt->rt_dst;
2760 2760
2761 if (MULTICAST(dst) && !LOCAL_MCAST(dst) && 2761 if (MULTICAST(dst) && !LOCAL_MCAST(dst) &&
2762 ipv4_devconf.mc_forwarding) { 2762 IPV4_DEVCONF_ALL(MC_FORWARDING)) {
2763 int err = ipmr_get_route(skb, r, nowait); 2763 int err = ipmr_get_route(skb, r, nowait);
2764 if (err <= 0) { 2764 if (err <= 0) {
2765 if (!nowait) { 2765 if (!nowait) {
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 6817d6485df5..53ef0f4bbdaa 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -37,12 +37,12 @@ static
37int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp, 37int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
38 void __user *buffer, size_t *lenp, loff_t *ppos) 38 void __user *buffer, size_t *lenp, loff_t *ppos)
39{ 39{
40 int val = ipv4_devconf.forwarding; 40 int val = IPV4_DEVCONF_ALL(FORWARDING);
41 int ret; 41 int ret;
42 42
43 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 43 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
44 44
45 if (write && ipv4_devconf.forwarding != val) 45 if (write && IPV4_DEVCONF_ALL(FORWARDING) != val)
46 inet_forward_change(); 46 inet_forward_change();
47 47
48 return ret; 48 return ret;
@@ -222,7 +222,7 @@ ctl_table ipv4_table[] = {
222 { 222 {
223 .ctl_name = NET_IPV4_FORWARD, 223 .ctl_name = NET_IPV4_FORWARD,
224 .procname = "ip_forward", 224 .procname = "ip_forward",
225 .data = &ipv4_devconf.forwarding, 225 .data = &IPV4_DEVCONF_ALL(FORWARDING),
226 .maxlen = sizeof(int), 226 .maxlen = sizeof(int),
227 .mode = 0644, 227 .mode = 0644,
228 .proc_handler = &ipv4_sysctl_forward, 228 .proc_handler = &ipv4_sysctl_forward,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bd4c295f5d79..cd3c7e95de9e 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1674,9 +1674,8 @@ adjudge_to_death:
1674 } 1674 }
1675 if (sk->sk_state != TCP_CLOSE) { 1675 if (sk->sk_state != TCP_CLOSE) {
1676 sk_stream_mem_reclaim(sk); 1676 sk_stream_mem_reclaim(sk);
1677 if (atomic_read(sk->sk_prot->orphan_count) > sysctl_tcp_max_orphans || 1677 if (tcp_too_many_orphans(sk,
1678 (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && 1678 atomic_read(sk->sk_prot->orphan_count))) {
1679 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
1680 if (net_ratelimit()) 1679 if (net_ratelimit())
1681 printk(KERN_INFO "TCP: too many of orphaned " 1680 printk(KERN_INFO "TCP: too many of orphaned "
1682 "sockets\n"); 1681 "sockets\n");
@@ -2465,13 +2464,10 @@ void __init tcp_init(void)
2465 order++) 2464 order++)
2466 ; 2465 ;
2467 if (order >= 4) { 2466 if (order >= 4) {
2468 sysctl_local_port_range[0] = 32768;
2469 sysctl_local_port_range[1] = 61000;
2470 tcp_death_row.sysctl_max_tw_buckets = 180000; 2467 tcp_death_row.sysctl_max_tw_buckets = 180000;
2471 sysctl_tcp_max_orphans = 4096 << (order - 4); 2468 sysctl_tcp_max_orphans = 4096 << (order - 4);
2472 sysctl_max_syn_backlog = 1024; 2469 sysctl_max_syn_backlog = 1024;
2473 } else if (order < 3) { 2470 } else if (order < 3) {
2474 sysctl_local_port_range[0] = 1024 * (3 - order);
2475 tcp_death_row.sysctl_max_tw_buckets >>= (3 - order); 2471 tcp_death_row.sysctl_max_tw_buckets >>= (3 - order);
2476 sysctl_tcp_max_orphans >>= (3 - order); 2472 sysctl_tcp_max_orphans >>= (3 - order);
2477 sysctl_max_syn_backlog = 128; 2473 sysctl_max_syn_backlog = 128;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 38cb25b48bf3..74683d81c3f1 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2407,8 +2407,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2407 struct sk_buff *skb; 2407 struct sk_buff *skb;
2408 __u32 now = tcp_time_stamp; 2408 __u32 now = tcp_time_stamp;
2409 int acked = 0; 2409 int acked = 0;
2410 int prior_packets = tp->packets_out;
2410 __s32 seq_rtt = -1; 2411 __s32 seq_rtt = -1;
2411 u32 pkts_acked = 0;
2412 ktime_t last_ackt = ktime_set(0,0); 2412 ktime_t last_ackt = ktime_set(0,0);
2413 2413
2414 while ((skb = tcp_write_queue_head(sk)) && 2414 while ((skb = tcp_write_queue_head(sk)) &&
@@ -2437,7 +2437,6 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2437 */ 2437 */
2438 if (!(scb->flags & TCPCB_FLAG_SYN)) { 2438 if (!(scb->flags & TCPCB_FLAG_SYN)) {
2439 acked |= FLAG_DATA_ACKED; 2439 acked |= FLAG_DATA_ACKED;
2440 ++pkts_acked;
2441 } else { 2440 } else {
2442 acked |= FLAG_SYN_ACKED; 2441 acked |= FLAG_SYN_ACKED;
2443 tp->retrans_stamp = 0; 2442 tp->retrans_stamp = 0;
@@ -2481,6 +2480,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
2481 } 2480 }
2482 2481
2483 if (acked&FLAG_ACKED) { 2482 if (acked&FLAG_ACKED) {
2483 u32 pkts_acked = prior_packets - tp->packets_out;
2484 const struct tcp_congestion_ops *ca_ops 2484 const struct tcp_congestion_ops *ca_ops
2485 = inet_csk(sk)->icsk_ca_ops; 2485 = inet_csk(sk)->icsk_ca_ops;
2486 2486
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 5a3e7f839fc5..97e294e82679 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -192,8 +192,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
192 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if, 192 RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
193 IPPROTO_TCP, 193 IPPROTO_TCP,
194 inet->sport, usin->sin_port, sk, 1); 194 inet->sport, usin->sin_port, sk, 1);
195 if (tmp < 0) 195 if (tmp < 0) {
196 if (tmp == -ENETUNREACH)
197 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
196 return tmp; 198 return tmp;
199 }
197 200
198 if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) { 201 if (rt->rt_flags & (RTCF_MULTICAST | RTCF_BROADCAST)) {
199 ip_rt_put(rt); 202 ip_rt_put(rt);
@@ -702,6 +705,8 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
702 ip_hdr(skb)->saddr, /* XXX */ 705 ip_hdr(skb)->saddr, /* XXX */
703 arg.iov[0].iov_len, IPPROTO_TCP, 0); 706 arg.iov[0].iov_len, IPPROTO_TCP, 0);
704 arg.csumoffset = offsetof(struct tcphdr, check) / 2; 707 arg.csumoffset = offsetof(struct tcphdr, check) / 2;
708 if (twsk)
709 arg.bound_dev_if = twsk->tw_sk.tw_bound_dev_if;
705 710
706 ip_send_reply(tcp_socket->sk, skb, &arg, arg.iov[0].iov_len); 711 ip_send_reply(tcp_socket->sk, skb, &arg, arg.iov[0].iov_len);
707 712
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index 3938d5dbdf20..d9323dfff826 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -63,6 +63,9 @@ struct {
63 * FIXME: causes an extra copy 63 * FIXME: causes an extra copy
64 */ 64 */
65static void printl(const char *fmt, ...) 65static void printl(const char *fmt, ...)
66 __attribute__ ((format (printf, 1, 2)));
67
68static void printl(const char *fmt, ...)
66{ 69{
67 va_list args; 70 va_list args;
68 int len; 71 int len;
@@ -95,7 +98,7 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
95 /* Only update if port matches */ 98 /* Only update if port matches */
96 if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port) 99 if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port)
97 && (full || tp->snd_cwnd != tcpw.lastcwnd)) { 100 && (full || tp->snd_cwnd != tcpw.lastcwnd)) {
98 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u\n", 101 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u %u\n",
99 NIPQUAD(inet->saddr), ntohs(inet->sport), 102 NIPQUAD(inet->saddr), ntohs(inet->sport),
100 NIPQUAD(inet->daddr), ntohs(inet->dport), 103 NIPQUAD(inet->daddr), ntohs(inet->dport),
101 skb->len, tp->snd_nxt, tp->snd_una, 104 skb->len, tp->snd_nxt, tp->snd_una,
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 2ca97b20929d..e9b151b3a598 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -78,9 +78,7 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset)
78 if (sk->sk_err_soft) 78 if (sk->sk_err_soft)
79 orphans <<= 1; 79 orphans <<= 1;
80 80
81 if (orphans >= sysctl_tcp_max_orphans || 81 if (tcp_too_many_orphans(sk, orphans)) {
82 (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
83 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
84 if (net_ratelimit()) 82 if (net_ratelimit())
85 printk(KERN_INFO "Out of socket memory\n"); 83 printk(KERN_INFO "Out of socket memory\n");
86 84
@@ -294,9 +292,9 @@ static void tcp_retransmit_timer(struct sock *sk)
294 * we cannot allow such beasts to hang infinitely. 292 * we cannot allow such beasts to hang infinitely.
295 */ 293 */
296#ifdef TCP_DEBUG 294#ifdef TCP_DEBUG
297 if (net_ratelimit()) { 295 if (1) {
298 struct inet_sock *inet = inet_sk(sk); 296 struct inet_sock *inet = inet_sk(sk);
299 printk(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n", 297 LIMIT_NETDEBUG(KERN_DEBUG "TCP: Treason uncloaked! Peer %u.%u.%u.%u:%u/%u shrinks window %u:%u. Repaired.\n",
300 NIPQUAD(inet->daddr), ntohs(inet->dport), 298 NIPQUAD(inet->daddr), ntohs(inet->dport),
301 inet->num, tp->snd_una, tp->snd_nxt); 299 inet->num, tp->snd_una, tp->snd_nxt);
302 } 300 }
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 4c7e95fa090d..facb7e29304e 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -114,36 +114,14 @@ DEFINE_RWLOCK(udp_hash_lock);
114 114
115static int udp_port_rover; 115static int udp_port_rover;
116 116
117/* 117static inline int __udp_lib_lport_inuse(__u16 num, struct hlist_head udptable[])
118 * Note about this hash function :
119 * Typical use is probably daddr = 0, only dport is going to vary hash
120 */
121static inline unsigned int udp_hash_port(__u16 port)
122{
123 return port;
124}
125
126static inline int __udp_lib_port_inuse(unsigned int hash, int port,
127 const struct sock *this_sk,
128 struct hlist_head udptable[],
129 const struct udp_get_port_ops *ops)
130{ 118{
131 struct sock *sk; 119 struct sock *sk;
132 struct hlist_node *node; 120 struct hlist_node *node;
133 struct inet_sock *inet;
134 121
135 sk_for_each(sk, node, &udptable[hash & (UDP_HTABLE_SIZE - 1)]) { 122 sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)])
136 if (sk->sk_hash != hash) 123 if (sk->sk_hash == num)
137 continue;
138 inet = inet_sk(sk);
139 if (inet->num != port)
140 continue;
141 if (this_sk) {
142 if (ops->saddr_cmp(sk, this_sk))
143 return 1;
144 } else if (ops->saddr_any(sk))
145 return 1; 124 return 1;
146 }
147 return 0; 125 return 0;
148} 126}
149 127
@@ -154,16 +132,16 @@ static inline int __udp_lib_port_inuse(unsigned int hash, int port,
154 * @snum: port number to look up 132 * @snum: port number to look up
155 * @udptable: hash list table, must be of UDP_HTABLE_SIZE 133 * @udptable: hash list table, must be of UDP_HTABLE_SIZE
156 * @port_rover: pointer to record of last unallocated port 134 * @port_rover: pointer to record of last unallocated port
157 * @ops: AF-dependent address operations 135 * @saddr_comp: AF-dependent comparison of bound local IP addresses
158 */ 136 */
159int __udp_lib_get_port(struct sock *sk, unsigned short snum, 137int __udp_lib_get_port(struct sock *sk, unsigned short snum,
160 struct hlist_head udptable[], int *port_rover, 138 struct hlist_head udptable[], int *port_rover,
161 const struct udp_get_port_ops *ops) 139 int (*saddr_comp)(const struct sock *sk1,
140 const struct sock *sk2 ) )
162{ 141{
163 struct hlist_node *node; 142 struct hlist_node *node;
164 struct hlist_head *head; 143 struct hlist_head *head;
165 struct sock *sk2; 144 struct sock *sk2;
166 unsigned int hash;
167 int error = 1; 145 int error = 1;
168 146
169 write_lock_bh(&udp_hash_lock); 147 write_lock_bh(&udp_hash_lock);
@@ -178,8 +156,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
178 for (i = 0; i < UDP_HTABLE_SIZE; i++, result++) { 156 for (i = 0; i < UDP_HTABLE_SIZE; i++, result++) {
179 int size; 157 int size;
180 158
181 hash = ops->hash_port_and_rcv_saddr(result, sk); 159 head = &udptable[result & (UDP_HTABLE_SIZE - 1)];
182 head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
183 if (hlist_empty(head)) { 160 if (hlist_empty(head)) {
184 if (result > sysctl_local_port_range[1]) 161 if (result > sysctl_local_port_range[1])
185 result = sysctl_local_port_range[0] + 162 result = sysctl_local_port_range[0] +
@@ -204,16 +181,7 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
204 result = sysctl_local_port_range[0] 181 result = sysctl_local_port_range[0]
205 + ((result - sysctl_local_port_range[0]) & 182 + ((result - sysctl_local_port_range[0]) &
206 (UDP_HTABLE_SIZE - 1)); 183 (UDP_HTABLE_SIZE - 1));
207 hash = udp_hash_port(result); 184 if (! __udp_lib_lport_inuse(result, udptable))
208 if (__udp_lib_port_inuse(hash, result,
209 NULL, udptable, ops))
210 continue;
211 if (ops->saddr_any(sk))
212 break;
213
214 hash = ops->hash_port_and_rcv_saddr(result, sk);
215 if (! __udp_lib_port_inuse(hash, result,
216 sk, udptable, ops))
217 break; 185 break;
218 } 186 }
219 if (i >= (1 << 16) / UDP_HTABLE_SIZE) 187 if (i >= (1 << 16) / UDP_HTABLE_SIZE)
@@ -221,40 +189,21 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
221gotit: 189gotit:
222 *port_rover = snum = result; 190 *port_rover = snum = result;
223 } else { 191 } else {
224 hash = udp_hash_port(snum); 192 head = &udptable[snum & (UDP_HTABLE_SIZE - 1)];
225 head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
226 193
227 sk_for_each(sk2, node, head) 194 sk_for_each(sk2, node, head)
228 if (sk2->sk_hash == hash && 195 if (sk2->sk_hash == snum &&
229 sk2 != sk && 196 sk2 != sk &&
230 inet_sk(sk2)->num == snum && 197 (!sk2->sk_reuse || !sk->sk_reuse) &&
231 (!sk2->sk_reuse || !sk->sk_reuse) && 198 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
232 (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if || 199 || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
233 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && 200 (*saddr_comp)(sk, sk2) )
234 ops->saddr_cmp(sk, sk2))
235 goto fail; 201 goto fail;
236
237 if (!ops->saddr_any(sk)) {
238 hash = ops->hash_port_and_rcv_saddr(snum, sk);
239 head = &udptable[hash & (UDP_HTABLE_SIZE - 1)];
240
241 sk_for_each(sk2, node, head)
242 if (sk2->sk_hash == hash &&
243 sk2 != sk &&
244 inet_sk(sk2)->num == snum &&
245 (!sk2->sk_reuse || !sk->sk_reuse) &&
246 (!sk2->sk_bound_dev_if ||
247 !sk->sk_bound_dev_if ||
248 sk2->sk_bound_dev_if ==
249 sk->sk_bound_dev_if) &&
250 ops->saddr_cmp(sk, sk2))
251 goto fail;
252 }
253 } 202 }
254 inet_sk(sk)->num = snum; 203 inet_sk(sk)->num = snum;
255 sk->sk_hash = hash; 204 sk->sk_hash = snum;
256 if (sk_unhashed(sk)) { 205 if (sk_unhashed(sk)) {
257 head = &udptable[hash & (UDP_HTABLE_SIZE - 1)]; 206 head = &udptable[snum & (UDP_HTABLE_SIZE - 1)];
258 sk_add_node(sk, head); 207 sk_add_node(sk, head);
259 sock_prot_inc_use(sk->sk_prot); 208 sock_prot_inc_use(sk->sk_prot);
260 } 209 }
@@ -265,12 +214,12 @@ fail:
265} 214}
266 215
267int udp_get_port(struct sock *sk, unsigned short snum, 216int udp_get_port(struct sock *sk, unsigned short snum,
268 const struct udp_get_port_ops *ops) 217 int (*scmp)(const struct sock *, const struct sock *))
269{ 218{
270 return __udp_lib_get_port(sk, snum, udp_hash, &udp_port_rover, ops); 219 return __udp_lib_get_port(sk, snum, udp_hash, &udp_port_rover, scmp);
271} 220}
272 221
273static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2) 222int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
274{ 223{
275 struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2); 224 struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
276 225
@@ -279,33 +228,9 @@ static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
279 inet1->rcv_saddr == inet2->rcv_saddr )); 228 inet1->rcv_saddr == inet2->rcv_saddr ));
280} 229}
281 230
282static int ipv4_rcv_saddr_any(const struct sock *sk)
283{
284 return !inet_sk(sk)->rcv_saddr;
285}
286
287static inline unsigned int ipv4_hash_port_and_addr(__u16 port, __be32 addr)
288{
289 addr ^= addr >> 16;
290 addr ^= addr >> 8;
291 return port ^ addr;
292}
293
294static unsigned int ipv4_hash_port_and_rcv_saddr(__u16 port,
295 const struct sock *sk)
296{
297 return ipv4_hash_port_and_addr(port, inet_sk(sk)->rcv_saddr);
298}
299
300const struct udp_get_port_ops udp_ipv4_ops = {
301 .saddr_cmp = ipv4_rcv_saddr_equal,
302 .saddr_any = ipv4_rcv_saddr_any,
303 .hash_port_and_rcv_saddr = ipv4_hash_port_and_rcv_saddr,
304};
305
306static inline int udp_v4_get_port(struct sock *sk, unsigned short snum) 231static inline int udp_v4_get_port(struct sock *sk, unsigned short snum)
307{ 232{
308 return udp_get_port(sk, snum, &udp_ipv4_ops); 233 return udp_get_port(sk, snum, ipv4_rcv_saddr_equal);
309} 234}
310 235
311/* UDP is nearly always wildcards out the wazoo, it makes no sense to try 236/* UDP is nearly always wildcards out the wazoo, it makes no sense to try
@@ -317,77 +242,63 @@ static struct sock *__udp4_lib_lookup(__be32 saddr, __be16 sport,
317{ 242{
318 struct sock *sk, *result = NULL; 243 struct sock *sk, *result = NULL;
319 struct hlist_node *node; 244 struct hlist_node *node;
320 unsigned int hash, hashwild; 245 unsigned short hnum = ntohs(dport);
321 int score, best = -1, hport = ntohs(dport); 246 int badness = -1;
322
323 hash = ipv4_hash_port_and_addr(hport, daddr);
324 hashwild = udp_hash_port(hport);
325 247
326 read_lock(&udp_hash_lock); 248 read_lock(&udp_hash_lock);
327 249 sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
328lookup:
329
330 sk_for_each(sk, node, &udptable[hash & (UDP_HTABLE_SIZE - 1)]) {
331 struct inet_sock *inet = inet_sk(sk); 250 struct inet_sock *inet = inet_sk(sk);
332 251
333 if (sk->sk_hash != hash || ipv6_only_sock(sk) || 252 if (sk->sk_hash == hnum && !ipv6_only_sock(sk)) {
334 inet->num != hport) 253 int score = (sk->sk_family == PF_INET ? 1 : 0);
335 continue; 254 if (inet->rcv_saddr) {
336 255 if (inet->rcv_saddr != daddr)
337 score = (sk->sk_family == PF_INET ? 1 : 0); 256 continue;
338 if (inet->rcv_saddr) { 257 score+=2;
339 if (inet->rcv_saddr != daddr) 258 }
340 continue; 259 if (inet->daddr) {
341 score+=2; 260 if (inet->daddr != saddr)
342 } 261 continue;
343 if (inet->daddr) { 262 score+=2;
344 if (inet->daddr != saddr) 263 }
345 continue; 264 if (inet->dport) {
346 score+=2; 265 if (inet->dport != sport)
347 } 266 continue;
348 if (inet->dport) { 267 score+=2;
349 if (inet->dport != sport) 268 }
350 continue; 269 if (sk->sk_bound_dev_if) {
351 score+=2; 270 if (sk->sk_bound_dev_if != dif)
352 } 271 continue;
353 if (sk->sk_bound_dev_if) { 272 score+=2;
354 if (sk->sk_bound_dev_if != dif) 273 }
355 continue; 274 if (score == 9) {
356 score+=2; 275 result = sk;
357 } 276 break;
358 if (score == 9) { 277 } else if (score > badness) {
359 result = sk; 278 result = sk;
360 goto found; 279 badness = score;
361 } else if (score > best) { 280 }
362 result = sk;
363 best = score;
364 } 281 }
365 } 282 }
366
367 if (hash != hashwild) {
368 hash = hashwild;
369 goto lookup;
370 }
371found:
372 if (result) 283 if (result)
373 sock_hold(result); 284 sock_hold(result);
374 read_unlock(&udp_hash_lock); 285 read_unlock(&udp_hash_lock);
375 return result; 286 return result;
376} 287}
377 288
378static inline struct sock *udp_v4_mcast_next(struct sock *sk, unsigned int hnum, 289static inline struct sock *udp_v4_mcast_next(struct sock *sk,
379 int hport, __be32 loc_addr, 290 __be16 loc_port, __be32 loc_addr,
380 __be16 rmt_port, __be32 rmt_addr, 291 __be16 rmt_port, __be32 rmt_addr,
381 int dif) 292 int dif)
382{ 293{
383 struct hlist_node *node; 294 struct hlist_node *node;
384 struct sock *s = sk; 295 struct sock *s = sk;
296 unsigned short hnum = ntohs(loc_port);
385 297
386 sk_for_each_from(s, node) { 298 sk_for_each_from(s, node) {
387 struct inet_sock *inet = inet_sk(s); 299 struct inet_sock *inet = inet_sk(s);
388 300
389 if (s->sk_hash != hnum || 301 if (s->sk_hash != hnum ||
390 inet->num != hport ||
391 (inet->daddr && inet->daddr != rmt_addr) || 302 (inet->daddr && inet->daddr != rmt_addr) ||
392 (inet->dport != rmt_port && inet->dport) || 303 (inet->dport != rmt_port && inet->dport) ||
393 (inet->rcv_saddr && inet->rcv_saddr != loc_addr) || 304 (inet->rcv_saddr && inet->rcv_saddr != loc_addr) ||
@@ -722,8 +633,11 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
722 .dport = dport } } }; 633 .dport = dport } } };
723 security_sk_classify_flow(sk, &fl); 634 security_sk_classify_flow(sk, &fl);
724 err = ip_route_output_flow(&rt, &fl, sk, 1); 635 err = ip_route_output_flow(&rt, &fl, sk, 1);
725 if (err) 636 if (err) {
637 if (err == -ENETUNREACH)
638 IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
726 goto out; 639 goto out;
640 }
727 641
728 err = -EACCES; 642 err = -EACCES;
729 if ((rt->rt_flags & RTCF_BROADCAST) && 643 if ((rt->rt_flags & RTCF_BROADCAST) &&
@@ -1218,45 +1132,29 @@ static int __udp4_lib_mcast_deliver(struct sk_buff *skb,
1218 __be32 saddr, __be32 daddr, 1132 __be32 saddr, __be32 daddr,
1219 struct hlist_head udptable[]) 1133 struct hlist_head udptable[])
1220{ 1134{
1221 struct sock *sk, *skw, *sknext; 1135 struct sock *sk;
1222 int dif; 1136 int dif;
1223 int hport = ntohs(uh->dest);
1224 unsigned int hash = ipv4_hash_port_and_addr(hport, daddr);
1225 unsigned int hashwild = udp_hash_port(hport);
1226
1227 dif = skb->dev->ifindex;
1228 1137
1229 read_lock(&udp_hash_lock); 1138 read_lock(&udp_hash_lock);
1230 1139 sk = sk_head(&udptable[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]);
1231 sk = sk_head(&udptable[hash & (UDP_HTABLE_SIZE - 1)]); 1140 dif = skb->dev->ifindex;
1232 skw = sk_head(&udptable[hashwild & (UDP_HTABLE_SIZE - 1)]); 1141 sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
1233
1234 sk = udp_v4_mcast_next(sk, hash, hport, daddr, uh->source, saddr, dif);
1235 if (!sk) {
1236 hash = hashwild;
1237 sk = udp_v4_mcast_next(skw, hash, hport, daddr, uh->source,
1238 saddr, dif);
1239 }
1240 if (sk) { 1142 if (sk) {
1143 struct sock *sknext = NULL;
1144
1241 do { 1145 do {
1242 struct sk_buff *skb1 = skb; 1146 struct sk_buff *skb1 = skb;
1243 sknext = udp_v4_mcast_next(sk_next(sk), hash, hport, 1147
1244 daddr, uh->source, saddr, dif); 1148 sknext = udp_v4_mcast_next(sk_next(sk), uh->dest, daddr,
1245 if (!sknext && hash != hashwild) { 1149 uh->source, saddr, dif);
1246 hash = hashwild;
1247 sknext = udp_v4_mcast_next(skw, hash, hport,
1248 daddr, uh->source, saddr, dif);
1249 }
1250 if (sknext) 1150 if (sknext)
1251 skb1 = skb_clone(skb, GFP_ATOMIC); 1151 skb1 = skb_clone(skb, GFP_ATOMIC);
1252 1152
1253 if (skb1) { 1153 if (skb1) {
1254 int ret = udp_queue_rcv_skb(sk, skb1); 1154 int ret = udp_queue_rcv_skb(sk, skb1);
1255 if (ret > 0) 1155 if (ret > 0)
1256 /* 1156 /* we should probably re-process instead
1257 * we should probably re-process 1157 * of dropping packets here. */
1258 * instead of dropping packets here.
1259 */
1260 kfree_skb(skb1); 1158 kfree_skb(skb1);
1261 } 1159 }
1262 sk = sknext; 1160 sk = sknext;
@@ -1343,7 +1241,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1343 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); 1241 return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
1344 1242
1345 sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest, 1243 sk = __udp4_lib_lookup(saddr, uh->source, daddr, uh->dest,
1346 skb->dev->ifindex, udptable); 1244 skb->dev->ifindex, udptable );
1347 1245
1348 if (sk != NULL) { 1246 if (sk != NULL) {
1349 int ret = udp_queue_rcv_skb(sk, skb); 1247 int ret = udp_queue_rcv_skb(sk, skb);
diff --git a/net/ipv4/udp_impl.h b/net/ipv4/udp_impl.h
index 06d94195e644..820a477cfaa6 100644
--- a/net/ipv4/udp_impl.h
+++ b/net/ipv4/udp_impl.h
@@ -5,14 +5,14 @@
5#include <net/protocol.h> 5#include <net/protocol.h>
6#include <net/inet_common.h> 6#include <net/inet_common.h>
7 7
8extern const struct udp_get_port_ops udp_ipv4_ops;
9
10extern int __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int ); 8extern int __udp4_lib_rcv(struct sk_buff *, struct hlist_head [], int );
11extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []); 9extern void __udp4_lib_err(struct sk_buff *, u32, struct hlist_head []);
12 10
13extern int __udp_lib_get_port(struct sock *sk, unsigned short snum, 11extern int __udp_lib_get_port(struct sock *sk, unsigned short snum,
14 struct hlist_head udptable[], int *port_rover, 12 struct hlist_head udptable[], int *port_rover,
15 const struct udp_get_port_ops *ops); 13 int (*)(const struct sock*,const struct sock*));
14extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *);
15
16 16
17extern int udp_setsockopt(struct sock *sk, int level, int optname, 17extern int udp_setsockopt(struct sock *sk, int level, int optname,
18 char __user *optval, int optlen); 18 char __user *optval, int optlen);
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index 3653b32dce2d..f34fd686a8f1 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -19,15 +19,14 @@ struct hlist_head udplite_hash[UDP_HTABLE_SIZE];
19static int udplite_port_rover; 19static int udplite_port_rover;
20 20
21int udplite_get_port(struct sock *sk, unsigned short p, 21int udplite_get_port(struct sock *sk, unsigned short p,
22 const struct udp_get_port_ops *ops) 22 int (*c)(const struct sock *, const struct sock *))
23{ 23{
24 return __udp_lib_get_port(sk, p, udplite_hash, 24 return __udp_lib_get_port(sk, p, udplite_hash, &udplite_port_rover, c);
25 &udplite_port_rover, ops);
26} 25}
27 26
28static int udplite_v4_get_port(struct sock *sk, unsigned short snum) 27static int udplite_v4_get_port(struct sock *sk, unsigned short snum)
29{ 28{
30 return udplite_get_port(sk, snum, &udp_ipv4_ops); 29 return udplite_get_port(sk, snum, ipv4_rcv_saddr_equal);
31} 30}
32 31
33static int udplite_rcv(struct sk_buff *skb) 32static int udplite_rcv(struct sk_buff *skb)
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 5ceca951d73f..fa1902dc81b8 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -139,10 +139,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
139 nf_reset(skb); 139 nf_reset(skb);
140 140
141 if (decaps) { 141 if (decaps) {
142 if (!(skb->dev->flags&IFF_LOOPBACK)) { 142 dst_release(skb->dst);
143 dst_release(skb->dst); 143 skb->dst = NULL;
144 skb->dst = NULL;
145 }
146 netif_rx(skb); 144 netif_rx(skb);
147 return 0; 145 return 0;
148 } else { 146 } else {
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index a2f2e6a5ec5d..9963700e74c1 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -85,6 +85,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
85 top_iph->saddr = x->props.saddr.a4; 85 top_iph->saddr = x->props.saddr.a4;
86 top_iph->daddr = x->id.daddr.a4; 86 top_iph->daddr = x->id.daddr.a4;
87 87
88 skb->protocol = htons(ETH_P_IP);
89
88 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); 90 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
89 return 0; 91 return 0;
90} 92}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 329de679ac38..5a5f8bd4597a 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2990,7 +2990,7 @@ static struct in6_addr *extract_addr(struct nlattr *addr, struct nlattr *local)
2990 return pfx; 2990 return pfx;
2991} 2991}
2992 2992
2993static struct nla_policy ifa_ipv6_policy[IFA_MAX+1] __read_mostly = { 2993static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {
2994 [IFA_ADDRESS] = { .len = sizeof(struct in6_addr) }, 2994 [IFA_ADDRESS] = { .len = sizeof(struct in6_addr) },
2995 [IFA_LOCAL] = { .len = sizeof(struct in6_addr) }, 2995 [IFA_LOCAL] = { .len = sizeof(struct in6_addr) },
2996 [IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) }, 2996 [IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) },
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index b696c8401200..128f94c79c64 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -247,7 +247,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
247 memcpy(tmp_base, top_iph, sizeof(tmp_base)); 247 memcpy(tmp_base, top_iph, sizeof(tmp_base));
248 248
249 tmp_ext = NULL; 249 tmp_ext = NULL;
250 extlen = skb_transport_offset(skb) + sizeof(struct ipv6hdr); 250 extlen = skb_transport_offset(skb) - sizeof(struct ipv6hdr);
251 if (extlen) { 251 if (extlen) {
252 extlen += sizeof(*tmp_ext); 252 extlen += sizeof(*tmp_ext);
253 tmp_ext = kmalloc(extlen, GFP_ATOMIC); 253 tmp_ext = kmalloc(extlen, GFP_ATOMIC);
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index fc3882c90604..53b3998a486c 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -157,7 +157,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
157 return 1; 157 return 1;
158} 158}
159 159
160static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = { 160static const struct nla_policy fib6_rule_policy[FRA_MAX+1] = {
161 FRA_GENERIC_POLICY, 161 FRA_GENERIC_POLICY,
162}; 162};
163 163
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index ca08ee88d07f..662a7d9681fd 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -619,14 +619,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
619 619
620 ins = &fn->leaf; 620 ins = &fn->leaf;
621 621
622 if (fn->fn_flags&RTN_TL_ROOT &&
623 fn->leaf == &ip6_null_entry &&
624 !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){
625 fn->leaf = rt;
626 rt->u.dst.rt6_next = NULL;
627 goto out;
628 }
629
630 for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) { 622 for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) {
631 /* 623 /*
632 * Search for duplicates 624 * Search for duplicates
@@ -666,7 +658,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
666 * insert node 658 * insert node
667 */ 659 */
668 660
669out:
670 rt->u.dst.rt6_next = iter; 661 rt->u.dst.rt6_next = iter;
671 *ins = rt; 662 *ins = rt;
672 rt->rt6i_node = fn; 663 rt->rt6i_node = fn;
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 6d2a08205111..1b1797f1f33d 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -160,6 +160,7 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
160{ 160{
161 struct nf_conn *ct; 161 struct nf_conn *ct;
162 struct nf_conn_help *help; 162 struct nf_conn_help *help;
163 struct nf_conntrack_helper *helper;
163 enum ip_conntrack_info ctinfo; 164 enum ip_conntrack_info ctinfo;
164 unsigned int ret, protoff; 165 unsigned int ret, protoff;
165 unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data; 166 unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
@@ -172,18 +173,21 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
172 goto out; 173 goto out;
173 174
174 help = nfct_help(ct); 175 help = nfct_help(ct);
175 if (!help || !help->helper) 176 if (!help)
177 goto out;
178 /* rcu_read_lock()ed by nf_hook_slow */
179 helper = rcu_dereference(help->helper);
180 if (!helper)
176 goto out; 181 goto out;
177 182
178 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum, 183 protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
179 (*pskb)->len - extoff); 184 (*pskb)->len - extoff);
180 if (protoff < 0 || protoff > (*pskb)->len || 185 if (protoff > (*pskb)->len || pnum == NEXTHDR_FRAGMENT) {
181 pnum == NEXTHDR_FRAGMENT) {
182 DEBUGP("proto header not found\n"); 186 DEBUGP("proto header not found\n");
183 return NF_ACCEPT; 187 return NF_ACCEPT;
184 } 188 }
185 189
186 ret = help->helper->help(pskb, protoff, ct, ctinfo); 190 ret = helper->help(pskb, protoff, ct, ctinfo);
187 if (ret != NF_ACCEPT) 191 if (ret != NF_ACCEPT)
188 return ret; 192 return ret;
189out: 193out:
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 0be790d250f9..8814b95b2326 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -168,8 +168,7 @@ icmpv6_error_message(struct sk_buff *skb,
168 skb->len - inip6off 168 skb->len - inip6off
169 - sizeof(struct ipv6hdr)); 169 - sizeof(struct ipv6hdr));
170 170
171 if ((inprotoff < 0) || (inprotoff > skb->len) || 171 if ((inprotoff > skb->len) || (inprotonum == NEXTHDR_FRAGMENT)) {
172 (inprotonum == NEXTHDR_FRAGMENT)) {
173 DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n"); 172 DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n");
174 return -NF_ACCEPT; 173 return -NF_ACCEPT;
175 } 174 }
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1324b06796c0..fe8d9837f9f8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1999,7 +1999,7 @@ void rt6_mtu_change(struct net_device *dev, unsigned mtu)
1999 fib6_clean_all(rt6_mtu_change_route, 0, &arg); 1999 fib6_clean_all(rt6_mtu_change_route, 0, &arg);
2000} 2000}
2001 2001
2002static struct nla_policy rtm_ipv6_policy[RTA_MAX+1] __read_mostly = { 2002static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
2003 [RTA_GATEWAY] = { .len = sizeof(struct in6_addr) }, 2003 [RTA_GATEWAY] = { .len = sizeof(struct in6_addr) },
2004 [RTA_OIF] = { .type = NLA_U32 }, 2004 [RTA_OIF] = { .type = NLA_U32 },
2005 [RTA_IIF] = { .type = NLA_U32 }, 2005 [RTA_IIF] = { .type = NLA_U32 },
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index d1fbddd172e7..4210951edb6e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -52,28 +52,9 @@
52 52
53DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; 53DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly;
54 54
55static int ipv6_rcv_saddr_any(const struct sock *sk)
56{
57 struct ipv6_pinfo *np = inet6_sk(sk);
58
59 return ipv6_addr_any(&np->rcv_saddr);
60}
61
62static unsigned int ipv6_hash_port_and_rcv_saddr(__u16 port,
63 const struct sock *sk)
64{
65 return port;
66}
67
68const struct udp_get_port_ops udp_ipv6_ops = {
69 .saddr_cmp = ipv6_rcv_saddr_equal,
70 .saddr_any = ipv6_rcv_saddr_any,
71 .hash_port_and_rcv_saddr = ipv6_hash_port_and_rcv_saddr,
72};
73
74static inline int udp_v6_get_port(struct sock *sk, unsigned short snum) 55static inline int udp_v6_get_port(struct sock *sk, unsigned short snum)
75{ 56{
76 return udp_get_port(sk, snum, &udp_ipv6_ops); 57 return udp_get_port(sk, snum, ipv6_rcv_saddr_equal);
77} 58}
78 59
79static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport, 60static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index 36b0c11a28a3..6e252f318f7c 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -6,8 +6,6 @@
6#include <net/addrconf.h> 6#include <net/addrconf.h>
7#include <net/inet_common.h> 7#include <net/inet_common.h>
8 8
9extern const struct udp_get_port_ops udp_ipv6_ops;
10
11extern int __udp6_lib_rcv(struct sk_buff **, struct hlist_head [], int ); 9extern int __udp6_lib_rcv(struct sk_buff **, struct hlist_head [], int );
12extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, 10extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *,
13 int , int , int , __be32 , struct hlist_head []); 11 int , int , int , __be32 , struct hlist_head []);
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index c40a51362f89..f54016a55004 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -37,7 +37,7 @@ static struct inet6_protocol udplitev6_protocol = {
37 37
38static int udplite_v6_get_port(struct sock *sk, unsigned short snum) 38static int udplite_v6_get_port(struct sock *sk, unsigned short snum)
39{ 39{
40 return udplite_get_port(sk, snum, &udp_ipv6_ops); 40 return udplite_get_port(sk, snum, ipv6_rcv_saddr_equal);
41} 41}
42 42
43struct proto udplitev6_prot = { 43struct proto udplitev6_prot = {
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index d7ed8aa56ec1..c858537cec4b 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -104,10 +104,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
104 nf_reset(skb); 104 nf_reset(skb);
105 105
106 if (decaps) { 106 if (decaps) {
107 if (!(skb->dev->flags&IFF_LOOPBACK)) { 107 dst_release(skb->dst);
108 dst_release(skb->dst); 108 skb->dst = NULL;
109 skb->dst = NULL;
110 }
111 netif_rx(skb); 109 netif_rx(skb);
112 return -1; 110 return -1;
113 } else { 111 } else {
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index a6c0cdf46ad6..9fc95bc6509f 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -80,6 +80,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
80 top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT); 80 top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT);
81 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); 81 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
82 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); 82 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
83 skb->protocol = htons(ETH_P_IPV6);
83 return 0; 84 return 0;
84} 85}
85 86
diff --git a/net/key/af_key.c b/net/key/af_key.c
index d302ddae580c..0f8304b0246b 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1682,6 +1682,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
1682 unsigned proto; 1682 unsigned proto;
1683 struct km_event c; 1683 struct km_event c;
1684 struct xfrm_audit audit_info; 1684 struct xfrm_audit audit_info;
1685 int err;
1685 1686
1686 proto = pfkey_satype2proto(hdr->sadb_msg_satype); 1687 proto = pfkey_satype2proto(hdr->sadb_msg_satype);
1687 if (proto == 0) 1688 if (proto == 0)
@@ -1689,7 +1690,9 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
1689 1690
1690 audit_info.loginuid = audit_get_loginuid(current->audit_context); 1691 audit_info.loginuid = audit_get_loginuid(current->audit_context);
1691 audit_info.secid = 0; 1692 audit_info.secid = 0;
1692 xfrm_state_flush(proto, &audit_info); 1693 err = xfrm_state_flush(proto, &audit_info);
1694 if (err)
1695 return err;
1693 c.data.proto = proto; 1696 c.data.proto = proto;
1694 c.seq = hdr->sadb_msg_seq; 1697 c.seq = hdr->sadb_msg_seq;
1695 c.pid = hdr->sadb_msg_pid; 1698 c.pid = hdr->sadb_msg_pid;
@@ -2683,10 +2686,13 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2683{ 2686{
2684 struct km_event c; 2687 struct km_event c;
2685 struct xfrm_audit audit_info; 2688 struct xfrm_audit audit_info;
2689 int err;
2686 2690
2687 audit_info.loginuid = audit_get_loginuid(current->audit_context); 2691 audit_info.loginuid = audit_get_loginuid(current->audit_context);
2688 audit_info.secid = 0; 2692 audit_info.secid = 0;
2689 xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info); 2693 err = xfrm_policy_flush(XFRM_POLICY_TYPE_MAIN, &audit_info);
2694 if (err)
2695 return err;
2690 c.data.type = XFRM_POLICY_TYPE_MAIN; 2696 c.data.type = XFRM_POLICY_TYPE_MAIN;
2691 c.event = XFRM_MSG_FLUSHPOLICY; 2697 c.event = XFRM_MSG_FLUSHPOLICY;
2692 c.pid = hdr->sadb_msg_pid; 2698 c.pid = hdr->sadb_msg_pid;
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 6e36df67f8d5..4e84f24fd439 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -2474,6 +2474,8 @@ static int ieee80211_open(struct net_device *dev)
2474 if (sdata->type == IEEE80211_IF_TYPE_STA && 2474 if (sdata->type == IEEE80211_IF_TYPE_STA &&
2475 !local->user_space_mlme) 2475 !local->user_space_mlme)
2476 netif_carrier_off(dev); 2476 netif_carrier_off(dev);
2477 else
2478 netif_carrier_on(dev);
2477 2479
2478 netif_start_queue(dev); 2480 netif_start_queue(dev);
2479 return 0; 2481 return 0;
@@ -3278,8 +3280,10 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
3278 return TXRX_DROP; 3280 return TXRX_DROP;
3279 } 3281 }
3280 } 3282 }
3281 while ((skb = __skb_dequeue(&entry->skb_list))) 3283 while ((skb = __skb_dequeue(&entry->skb_list))) {
3282 memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len); 3284 memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len);
3285 dev_kfree_skb(skb);
3286 }
3283 3287
3284 /* Complete frame has been reassembled - process it now */ 3288 /* Complete frame has been reassembled - process it now */
3285 rx->fragmented = 1; 3289 rx->fragmented = 1;
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 3e07e9d6fa42..9f30ae4c2ab3 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -1155,6 +1155,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1155 if (status_code != WLAN_STATUS_SUCCESS) { 1155 if (status_code != WLAN_STATUS_SUCCESS) {
1156 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", 1156 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
1157 dev->name, status_code); 1157 dev->name, status_code);
1158 if (status_code == WLAN_STATUS_REASSOC_NO_ASSOC)
1159 ifsta->prev_bssid_set = 0;
1158 return; 1160 return;
1159 } 1161 }
1160 1162
@@ -2995,7 +2997,7 @@ struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
2995{ 2997{
2996 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2998 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2997 struct sta_info *sta; 2999 struct sta_info *sta;
2998 struct ieee80211_sub_if_data *sdata = NULL; 3000 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2999 3001
3000 /* TODO: Could consider removing the least recently used entry and 3002 /* TODO: Could consider removing the least recently used entry and
3001 * allow new one to be added. */ 3003 * allow new one to be added. */
diff --git a/net/netfilter/nf_conntrack_amanda.c b/net/netfilter/nf_conntrack_amanda.c
index b8869eab7650..0568f2e86b59 100644
--- a/net/netfilter/nf_conntrack_amanda.c
+++ b/net/netfilter/nf_conntrack_amanda.c
@@ -208,13 +208,14 @@ static int __init nf_conntrack_amanda_init(void)
208{ 208{
209 int ret, i; 209 int ret, i;
210 210
211 ret = -ENOMEM;
212 for (i = 0; i < ARRAY_SIZE(search); i++) { 211 for (i = 0; i < ARRAY_SIZE(search); i++) {
213 search[i].ts = textsearch_prepare(ts_algo, search[i].string, 212 search[i].ts = textsearch_prepare(ts_algo, search[i].string,
214 search[i].len, 213 search[i].len,
215 GFP_KERNEL, TS_AUTOLOAD); 214 GFP_KERNEL, TS_AUTOLOAD);
216 if (search[i].ts == NULL) 215 if (IS_ERR(search[i].ts)) {
216 ret = PTR_ERR(search[i].ts);
217 goto err1; 217 goto err1;
218 }
218 } 219 }
219 ret = nf_conntrack_helper_register(&amanda_helper[0]); 220 ret = nf_conntrack_helper_register(&amanda_helper[0]);
220 if (ret < 0) 221 if (ret < 0)
@@ -227,10 +228,9 @@ static int __init nf_conntrack_amanda_init(void)
227err2: 228err2:
228 nf_conntrack_helper_unregister(&amanda_helper[0]); 229 nf_conntrack_helper_unregister(&amanda_helper[0]);
229err1: 230err1:
230 for (; i >= 0; i--) { 231 while (--i >= 0)
231 if (search[i].ts) 232 textsearch_destroy(search[i].ts);
232 textsearch_destroy(search[i].ts); 233
233 }
234 return ret; 234 return ret;
235} 235}
236 236
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 483e927a9ca4..7a15e30356f2 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -350,9 +350,15 @@ static void death_by_timeout(unsigned long ul_conntrack)
350{ 350{
351 struct nf_conn *ct = (void *)ul_conntrack; 351 struct nf_conn *ct = (void *)ul_conntrack;
352 struct nf_conn_help *help = nfct_help(ct); 352 struct nf_conn_help *help = nfct_help(ct);
353 struct nf_conntrack_helper *helper;
353 354
354 if (help && help->helper && help->helper->destroy) 355 if (help) {
355 help->helper->destroy(ct); 356 rcu_read_lock();
357 helper = rcu_dereference(help->helper);
358 if (helper && helper->destroy)
359 helper->destroy(ct);
360 rcu_read_unlock();
361 }
356 362
357 write_lock_bh(&nf_conntrack_lock); 363 write_lock_bh(&nf_conntrack_lock);
358 /* Inside lock so preempt is disabled on module removal path. 364 /* Inside lock so preempt is disabled on module removal path.
@@ -661,6 +667,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
661 unsigned int dataoff) 667 unsigned int dataoff)
662{ 668{
663 struct nf_conn *conntrack; 669 struct nf_conn *conntrack;
670 struct nf_conn_help *help;
664 struct nf_conntrack_tuple repl_tuple; 671 struct nf_conntrack_tuple repl_tuple;
665 struct nf_conntrack_expect *exp; 672 struct nf_conntrack_expect *exp;
666 u_int32_t features = 0; 673 u_int32_t features = 0;
@@ -691,6 +698,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
691 write_lock_bh(&nf_conntrack_lock); 698 write_lock_bh(&nf_conntrack_lock);
692 exp = find_expectation(tuple); 699 exp = find_expectation(tuple);
693 700
701 help = nfct_help(conntrack);
694 if (exp) { 702 if (exp) {
695 DEBUGP("conntrack: expectation arrives ct=%p exp=%p\n", 703 DEBUGP("conntrack: expectation arrives ct=%p exp=%p\n",
696 conntrack, exp); 704 conntrack, exp);
@@ -698,7 +706,7 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
698 __set_bit(IPS_EXPECTED_BIT, &conntrack->status); 706 __set_bit(IPS_EXPECTED_BIT, &conntrack->status);
699 conntrack->master = exp->master; 707 conntrack->master = exp->master;
700 if (exp->helper) 708 if (exp->helper)
701 nfct_help(conntrack)->helper = exp->helper; 709 rcu_assign_pointer(help->helper, exp->helper);
702#ifdef CONFIG_NF_CONNTRACK_MARK 710#ifdef CONFIG_NF_CONNTRACK_MARK
703 conntrack->mark = exp->master->mark; 711 conntrack->mark = exp->master->mark;
704#endif 712#endif
@@ -708,10 +716,11 @@ init_conntrack(const struct nf_conntrack_tuple *tuple,
708 nf_conntrack_get(&conntrack->master->ct_general); 716 nf_conntrack_get(&conntrack->master->ct_general);
709 NF_CT_STAT_INC(expect_new); 717 NF_CT_STAT_INC(expect_new);
710 } else { 718 } else {
711 struct nf_conn_help *help = nfct_help(conntrack); 719 if (help) {
712 720 /* not in hash table yet, so not strictly necessary */
713 if (help) 721 rcu_assign_pointer(help->helper,
714 help->helper = __nf_ct_helper_find(&repl_tuple); 722 __nf_ct_helper_find(&repl_tuple));
723 }
715 NF_CT_STAT_INC(new); 724 NF_CT_STAT_INC(new);
716 } 725 }
717 726
@@ -893,7 +902,8 @@ void nf_conntrack_alter_reply(struct nf_conn *ct,
893 helper = __nf_ct_helper_find(newreply); 902 helper = __nf_ct_helper_find(newreply);
894 if (helper) 903 if (helper)
895 memset(&help->help, 0, sizeof(help->help)); 904 memset(&help->help, 0, sizeof(help->help));
896 help->helper = helper; 905 /* not in hash table yet, so not strictly necessary */
906 rcu_assign_pointer(help->helper, helper);
897 } 907 }
898 write_unlock_bh(&nf_conntrack_lock); 908 write_unlock_bh(&nf_conntrack_lock);
899} 909}
diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index 117cbfdb910c..504fb6c083f9 100644
--- a/net/netfilter/nf_conntrack_expect.c
+++ b/net/netfilter/nf_conntrack_expect.c
@@ -337,6 +337,10 @@ int nf_conntrack_expect_related(struct nf_conntrack_expect *expect)
337 NF_CT_ASSERT(master_help); 337 NF_CT_ASSERT(master_help);
338 338
339 write_lock_bh(&nf_conntrack_lock); 339 write_lock_bh(&nf_conntrack_lock);
340 if (!master_help->helper) {
341 ret = -ESHUTDOWN;
342 goto out;
343 }
340 list_for_each_entry(i, &nf_conntrack_expect_list, list) { 344 list_for_each_entry(i, &nf_conntrack_expect_list, list) {
341 if (expect_matches(i, expect)) { 345 if (expect_matches(i, expect)) {
342 /* Refresh timer: if it's dying, ignore.. */ 346 /* Refresh timer: if it's dying, ignore.. */
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 0743be4434b0..f868b7fbd9b4 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -93,7 +93,7 @@ static inline int unhelp(struct nf_conntrack_tuple_hash *i,
93 93
94 if (help && help->helper == me) { 94 if (help && help->helper == me) {
95 nf_conntrack_event(IPCT_HELPER, ct); 95 nf_conntrack_event(IPCT_HELPER, ct);
96 help->helper = NULL; 96 rcu_assign_pointer(help->helper, NULL);
97 } 97 }
98 return 0; 98 return 0;
99} 99}
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index d6d39e241327..3f73327794ab 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -171,21 +171,29 @@ ctnetlink_dump_helpinfo(struct sk_buff *skb, const struct nf_conn *ct)
171{ 171{
172 struct nfattr *nest_helper; 172 struct nfattr *nest_helper;
173 const struct nf_conn_help *help = nfct_help(ct); 173 const struct nf_conn_help *help = nfct_help(ct);
174 struct nf_conntrack_helper *helper;
174 175
175 if (!help || !help->helper) 176 if (!help)
176 return 0; 177 return 0;
177 178
179 rcu_read_lock();
180 helper = rcu_dereference(help->helper);
181 if (!helper)
182 goto out;
183
178 nest_helper = NFA_NEST(skb, CTA_HELP); 184 nest_helper = NFA_NEST(skb, CTA_HELP);
179 NFA_PUT(skb, CTA_HELP_NAME, strlen(help->helper->name), help->helper->name); 185 NFA_PUT(skb, CTA_HELP_NAME, strlen(helper->name), helper->name);
180 186
181 if (help->helper->to_nfattr) 187 if (helper->to_nfattr)
182 help->helper->to_nfattr(skb, ct); 188 helper->to_nfattr(skb, ct);
183 189
184 NFA_NEST_END(skb, nest_helper); 190 NFA_NEST_END(skb, nest_helper);
185 191out:
192 rcu_read_unlock();
186 return 0; 193 return 0;
187 194
188nfattr_failure: 195nfattr_failure:
196 rcu_read_unlock();
189 return -1; 197 return -1;
190} 198}
191 199
@@ -842,7 +850,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
842 if (help && help->helper) { 850 if (help && help->helper) {
843 /* we had a helper before ... */ 851 /* we had a helper before ... */
844 nf_ct_remove_expectations(ct); 852 nf_ct_remove_expectations(ct);
845 help->helper = NULL; 853 rcu_assign_pointer(help->helper, NULL);
846 } 854 }
847 855
848 return 0; 856 return 0;
@@ -866,7 +874,7 @@ ctnetlink_change_helper(struct nf_conn *ct, struct nfattr *cda[])
866 874
867 /* need to zero data of old helper */ 875 /* need to zero data of old helper */
868 memset(&help->help, 0, sizeof(help->help)); 876 memset(&help->help, 0, sizeof(help->help));
869 help->helper = helper; 877 rcu_assign_pointer(help->helper, helper);
870 878
871 return 0; 879 return 0;
872} 880}
@@ -950,6 +958,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
950 struct nf_conn *ct; 958 struct nf_conn *ct;
951 int err = -EINVAL; 959 int err = -EINVAL;
952 struct nf_conn_help *help; 960 struct nf_conn_help *help;
961 struct nf_conntrack_helper *helper = NULL;
953 962
954 ct = nf_conntrack_alloc(otuple, rtuple); 963 ct = nf_conntrack_alloc(otuple, rtuple);
955 if (ct == NULL || IS_ERR(ct)) 964 if (ct == NULL || IS_ERR(ct))
@@ -980,14 +989,17 @@ ctnetlink_create_conntrack(struct nfattr *cda[],
980#endif 989#endif
981 990
982 help = nfct_help(ct); 991 help = nfct_help(ct);
983 if (help) 992 if (help) {
984 help->helper = nf_ct_helper_find_get(rtuple); 993 helper = nf_ct_helper_find_get(rtuple);
994 /* not in hash table yet so not strictly necessary */
995 rcu_assign_pointer(help->helper, helper);
996 }
985 997
986 add_timer(&ct->timeout); 998 add_timer(&ct->timeout);
987 nf_conntrack_hash_insert(ct); 999 nf_conntrack_hash_insert(ct);
988 1000
989 if (help && help->helper) 1001 if (helper)
990 nf_ct_helper_put(help->helper); 1002 nf_ct_helper_put(helper);
991 1003
992 return 0; 1004 return 0;
993 1005
diff --git a/net/netfilter/nf_conntrack_proto_gre.c b/net/netfilter/nf_conntrack_proto_gre.c
index 5434472420fe..339c397d1b5f 100644
--- a/net/netfilter/nf_conntrack_proto_gre.c
+++ b/net/netfilter/nf_conntrack_proto_gre.c
@@ -100,7 +100,6 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
100 struct nf_conn_help *help = nfct_help(ct); 100 struct nf_conn_help *help = nfct_help(ct);
101 struct nf_ct_gre_keymap **kmp, *km; 101 struct nf_ct_gre_keymap **kmp, *km;
102 102
103 BUG_ON(strcmp(help->helper->name, "pptp"));
104 kmp = &help->help.ct_pptp_info.keymap[dir]; 103 kmp = &help->help.ct_pptp_info.keymap[dir];
105 if (*kmp) { 104 if (*kmp) {
106 /* check whether it's a retransmission */ 105 /* check whether it's a retransmission */
@@ -137,7 +136,6 @@ void nf_ct_gre_keymap_destroy(struct nf_conn *ct)
137 enum ip_conntrack_dir dir; 136 enum ip_conntrack_dir dir;
138 137
139 DEBUGP("entering for ct %p\n", ct); 138 DEBUGP("entering for ct %p\n", ct);
140 BUG_ON(strcmp(help->helper->name, "pptp"));
141 139
142 write_lock_bh(&nf_ct_gre_lock); 140 write_lock_bh(&nf_ct_gre_lock);
143 for (dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++) { 141 for (dir = IP_CT_DIR_ORIGINAL; dir < IP_CT_DIR_MAX; dir++) {
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index 07e47dbcb0a9..24b660f16ce3 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -59,7 +59,7 @@ static struct genl_family netlbl_cipsov4_gnl_family = {
59}; 59};
60 60
61/* NetLabel Netlink attribute policy */ 61/* NetLabel Netlink attribute policy */
62static struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = { 62static const struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = {
63 [NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 }, 63 [NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 },
64 [NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 }, 64 [NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 },
65 [NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 }, 65 [NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 },
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index e8c80f33f3d7..e00fc219c72b 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -59,7 +59,7 @@ static struct genl_family netlbl_mgmt_gnl_family = {
59}; 59};
60 60
61/* NetLabel Netlink attribute policy */ 61/* NetLabel Netlink attribute policy */
62static struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = { 62static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
63 [NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING }, 63 [NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING },
64 [NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 }, 64 [NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 },
65 [NLBL_MGMT_A_VERSION] = { .type = NLA_U32 }, 65 [NLBL_MGMT_A_VERSION] = { .type = NLA_U32 },
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index b931edee4b8b..5c303c68af1d 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -61,7 +61,7 @@ static struct genl_family netlbl_unlabel_gnl_family = {
61}; 61};
62 62
63/* NetLabel Netlink attribute policy */ 63/* NetLabel Netlink attribute policy */
64static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = { 64static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
65 [NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 }, 65 [NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 },
66}; 66};
67 67
diff --git a/net/netlink/attr.c b/net/netlink/attr.c
index df5f820a4c32..c591212793ee 100644
--- a/net/netlink/attr.c
+++ b/net/netlink/attr.c
@@ -24,9 +24,9 @@ static u16 nla_attr_minlen[NLA_TYPE_MAX+1] __read_mostly = {
24}; 24};
25 25
26static int validate_nla(struct nlattr *nla, int maxtype, 26static int validate_nla(struct nlattr *nla, int maxtype,
27 struct nla_policy *policy) 27 const struct nla_policy *policy)
28{ 28{
29 struct nla_policy *pt; 29 const struct nla_policy *pt;
30 int minlen = 0, attrlen = nla_len(nla); 30 int minlen = 0, attrlen = nla_len(nla);
31 31
32 if (nla->nla_type <= 0 || nla->nla_type > maxtype) 32 if (nla->nla_type <= 0 || nla->nla_type > maxtype)
@@ -99,7 +99,7 @@ static int validate_nla(struct nlattr *nla, int maxtype,
99 * Returns 0 on success or a negative error code. 99 * Returns 0 on success or a negative error code.
100 */ 100 */
101int nla_validate(struct nlattr *head, int len, int maxtype, 101int nla_validate(struct nlattr *head, int len, int maxtype,
102 struct nla_policy *policy) 102 const struct nla_policy *policy)
103{ 103{
104 struct nlattr *nla; 104 struct nlattr *nla;
105 int rem, err; 105 int rem, err;
@@ -130,7 +130,7 @@ errout:
130 * Returns 0 on success or a negative error code. 130 * Returns 0 on success or a negative error code.
131 */ 131 */
132int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len, 132int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
133 struct nla_policy *policy) 133 const struct nla_policy *policy)
134{ 134{
135 struct nlattr *nla; 135 struct nlattr *nla;
136 int rem, err; 136 int rem, err;
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 6e31234a4196..b9ab62f938d0 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -472,7 +472,7 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
472 return skb; 472 return skb;
473} 473}
474 474
475static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = { 475static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = {
476 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 }, 476 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
477 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING, 477 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
478 .len = GENL_NAMSIZ - 1 }, 478 .len = GENL_NAMSIZ - 1 },
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 02e401cd683f..f8b83014ccca 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -83,22 +83,6 @@
83#include <net/inet_common.h> 83#include <net/inet_common.h>
84#endif 84#endif
85 85
86#define CONFIG_SOCK_PACKET 1
87
88/*
89 Proposed replacement for SIOC{ADD,DEL}MULTI and
90 IFF_PROMISC, IFF_ALLMULTI flags.
91
92 It is more expensive, but I believe,
93 it is really correct solution: reentereble, safe and fault tolerant.
94
95 IFF_PROMISC/IFF_ALLMULTI/SIOC{ADD/DEL}MULTI are faked by keeping
96 reference count and global flag, so that real status is
97 (gflag|(count != 0)), so that we can use obsolete faulty interface
98 not harming clever users.
99 */
100#define CONFIG_PACKET_MULTICAST 1
101
102/* 86/*
103 Assumptions: 87 Assumptions:
104 - if device has no dev->hard_header routine, it adds and removes ll header 88 - if device has no dev->hard_header routine, it adds and removes ll header
@@ -159,7 +143,6 @@ static atomic_t packet_socks_nr;
159 143
160/* Private packet socket structures. */ 144/* Private packet socket structures. */
161 145
162#ifdef CONFIG_PACKET_MULTICAST
163struct packet_mclist 146struct packet_mclist
164{ 147{
165 struct packet_mclist *next; 148 struct packet_mclist *next;
@@ -179,7 +162,7 @@ struct packet_mreq_max
179 unsigned short mr_alen; 162 unsigned short mr_alen;
180 unsigned char mr_address[MAX_ADDR_LEN]; 163 unsigned char mr_address[MAX_ADDR_LEN];
181}; 164};
182#endif 165
183#ifdef CONFIG_PACKET_MMAP 166#ifdef CONFIG_PACKET_MMAP
184static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing); 167static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing);
185#endif 168#endif
@@ -205,9 +188,7 @@ struct packet_sock {
205 origdev:1; 188 origdev:1;
206 int ifindex; /* bound device */ 189 int ifindex; /* bound device */
207 __be16 num; 190 __be16 num;
208#ifdef CONFIG_PACKET_MULTICAST
209 struct packet_mclist *mclist; 191 struct packet_mclist *mclist;
210#endif
211#ifdef CONFIG_PACKET_MMAP 192#ifdef CONFIG_PACKET_MMAP
212 atomic_t mapped; 193 atomic_t mapped;
213 unsigned int pg_vec_order; 194 unsigned int pg_vec_order;
@@ -263,7 +244,6 @@ static void packet_sock_destruct(struct sock *sk)
263 244
264static const struct proto_ops packet_ops; 245static const struct proto_ops packet_ops;
265 246
266#ifdef CONFIG_SOCK_PACKET
267static const struct proto_ops packet_ops_spkt; 247static const struct proto_ops packet_ops_spkt;
268 248
269static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) 249static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
@@ -435,7 +415,6 @@ out_unlock:
435 dev_put(dev); 415 dev_put(dev);
436 return err; 416 return err;
437} 417}
438#endif
439 418
440static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, 419static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk,
441 unsigned int res) 420 unsigned int res)
@@ -851,9 +830,7 @@ static int packet_release(struct socket *sock)
851 __sock_put(sk); 830 __sock_put(sk);
852 } 831 }
853 832
854#ifdef CONFIG_PACKET_MULTICAST
855 packet_flush_mclist(sk); 833 packet_flush_mclist(sk);
856#endif
857 834
858#ifdef CONFIG_PACKET_MMAP 835#ifdef CONFIG_PACKET_MMAP
859 if (po->pg_vec) { 836 if (po->pg_vec) {
@@ -936,8 +913,6 @@ out_unlock:
936 * Bind a packet socket to a device 913 * Bind a packet socket to a device
937 */ 914 */
938 915
939#ifdef CONFIG_SOCK_PACKET
940
941static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) 916static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len)
942{ 917{
943 struct sock *sk=sock->sk; 918 struct sock *sk=sock->sk;
@@ -960,7 +935,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add
960 } 935 }
961 return err; 936 return err;
962} 937}
963#endif
964 938
965static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 939static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
966{ 940{
@@ -1012,11 +986,8 @@ static int packet_create(struct socket *sock, int protocol)
1012 986
1013 if (!capable(CAP_NET_RAW)) 987 if (!capable(CAP_NET_RAW))
1014 return -EPERM; 988 return -EPERM;
1015 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW 989 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW &&
1016#ifdef CONFIG_SOCK_PACKET 990 sock->type != SOCK_PACKET)
1017 && sock->type != SOCK_PACKET
1018#endif
1019 )
1020 return -ESOCKTNOSUPPORT; 991 return -ESOCKTNOSUPPORT;
1021 992
1022 sock->state = SS_UNCONNECTED; 993 sock->state = SS_UNCONNECTED;
@@ -1027,10 +998,9 @@ static int packet_create(struct socket *sock, int protocol)
1027 goto out; 998 goto out;
1028 999
1029 sock->ops = &packet_ops; 1000 sock->ops = &packet_ops;
1030#ifdef CONFIG_SOCK_PACKET
1031 if (sock->type == SOCK_PACKET) 1001 if (sock->type == SOCK_PACKET)
1032 sock->ops = &packet_ops_spkt; 1002 sock->ops = &packet_ops_spkt;
1033#endif 1003
1034 sock_init_data(sock, sk); 1004 sock_init_data(sock, sk);
1035 1005
1036 po = pkt_sk(sk); 1006 po = pkt_sk(sk);
@@ -1046,10 +1016,10 @@ static int packet_create(struct socket *sock, int protocol)
1046 1016
1047 spin_lock_init(&po->bind_lock); 1017 spin_lock_init(&po->bind_lock);
1048 po->prot_hook.func = packet_rcv; 1018 po->prot_hook.func = packet_rcv;
1049#ifdef CONFIG_SOCK_PACKET 1019
1050 if (sock->type == SOCK_PACKET) 1020 if (sock->type == SOCK_PACKET)
1051 po->prot_hook.func = packet_rcv_spkt; 1021 po->prot_hook.func = packet_rcv_spkt;
1052#endif 1022
1053 po->prot_hook.af_packet_priv = sk; 1023 po->prot_hook.af_packet_priv = sk;
1054 1024
1055 if (proto) { 1025 if (proto) {
@@ -1169,7 +1139,6 @@ out:
1169 return err; 1139 return err;
1170} 1140}
1171 1141
1172#ifdef CONFIG_SOCK_PACKET
1173static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, 1142static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
1174 int *uaddr_len, int peer) 1143 int *uaddr_len, int peer)
1175{ 1144{
@@ -1190,7 +1159,6 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
1190 1159
1191 return 0; 1160 return 0;
1192} 1161}
1193#endif
1194 1162
1195static int packet_getname(struct socket *sock, struct sockaddr *uaddr, 1163static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
1196 int *uaddr_len, int peer) 1164 int *uaddr_len, int peer)
@@ -1221,7 +1189,6 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
1221 return 0; 1189 return 0;
1222} 1190}
1223 1191
1224#ifdef CONFIG_PACKET_MULTICAST
1225static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what) 1192static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what)
1226{ 1193{
1227 switch (i->type) { 1194 switch (i->type) {
@@ -1349,7 +1316,6 @@ static void packet_flush_mclist(struct sock *sk)
1349 } 1316 }
1350 rtnl_unlock(); 1317 rtnl_unlock();
1351} 1318}
1352#endif
1353 1319
1354static int 1320static int
1355packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 1321packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
@@ -1362,7 +1328,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1362 return -ENOPROTOOPT; 1328 return -ENOPROTOOPT;
1363 1329
1364 switch(optname) { 1330 switch(optname) {
1365#ifdef CONFIG_PACKET_MULTICAST
1366 case PACKET_ADD_MEMBERSHIP: 1331 case PACKET_ADD_MEMBERSHIP:
1367 case PACKET_DROP_MEMBERSHIP: 1332 case PACKET_DROP_MEMBERSHIP:
1368 { 1333 {
@@ -1383,7 +1348,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1383 ret = packet_mc_drop(sk, &mreq); 1348 ret = packet_mc_drop(sk, &mreq);
1384 return ret; 1349 return ret;
1385 } 1350 }
1386#endif 1351
1387#ifdef CONFIG_PACKET_MMAP 1352#ifdef CONFIG_PACKET_MMAP
1388 case PACKET_RX_RING: 1353 case PACKET_RX_RING:
1389 { 1354 {
@@ -1506,11 +1471,10 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
1506 1471
1507 switch (msg) { 1472 switch (msg) {
1508 case NETDEV_UNREGISTER: 1473 case NETDEV_UNREGISTER:
1509#ifdef CONFIG_PACKET_MULTICAST
1510 if (po->mclist) 1474 if (po->mclist)
1511 packet_dev_mclist(dev, po->mclist, -1); 1475 packet_dev_mclist(dev, po->mclist, -1);
1512 // fallthrough 1476 /* fallthrough */
1513#endif 1477
1514 case NETDEV_DOWN: 1478 case NETDEV_DOWN:
1515 if (dev->ifindex == po->ifindex) { 1479 if (dev->ifindex == po->ifindex) {
1516 spin_lock(&po->bind_lock); 1480 spin_lock(&po->bind_lock);
@@ -1856,7 +1820,6 @@ out:
1856#endif 1820#endif
1857 1821
1858 1822
1859#ifdef CONFIG_SOCK_PACKET
1860static const struct proto_ops packet_ops_spkt = { 1823static const struct proto_ops packet_ops_spkt = {
1861 .family = PF_PACKET, 1824 .family = PF_PACKET,
1862 .owner = THIS_MODULE, 1825 .owner = THIS_MODULE,
@@ -1877,7 +1840,6 @@ static const struct proto_ops packet_ops_spkt = {
1877 .mmap = sock_no_mmap, 1840 .mmap = sock_no_mmap,
1878 .sendpage = sock_no_sendpage, 1841 .sendpage = sock_no_sendpage,
1879}; 1842};
1880#endif
1881 1843
1882static const struct proto_ops packet_ops = { 1844static const struct proto_ops packet_ops = {
1883 .family = PF_PACKET, 1845 .family = PF_PACKET,
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 45b3cda86a21..6f8684b5617e 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -164,8 +164,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
164 printk("offset must be on 32 bit boundaries\n"); 164 printk("offset must be on 32 bit boundaries\n");
165 goto bad; 165 goto bad;
166 } 166 }
167 if (skb->len < 0 || 167 if (offset > 0 && offset > skb->len) {
168 (offset > 0 && offset > skb->len)) {
169 printk("offset %d cant exceed pkt length %d\n", 168 printk("offset %d cant exceed pkt length %d\n",
170 offset, skb->len); 169 offset, skb->len);
171 goto bad; 170 goto bad;
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index be7d299acd73..d1c383fca82c 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -599,6 +599,7 @@ static void atm_tc_destroy(struct Qdisc *sch)
599 /* races ? */ 599 /* races ? */
600 while ((flow = p->flows)) { 600 while ((flow = p->flows)) {
601 tcf_destroy_chain(flow->filter_list); 601 tcf_destroy_chain(flow->filter_list);
602 flow->filter_list = NULL;
602 if (flow->ref > 1) 603 if (flow->ref > 1)
603 printk(KERN_ERR "atm_destroy: %p->ref = %d\n",flow, 604 printk(KERN_ERR "atm_destroy: %p->ref = %d\n",flow,
604 flow->ref); 605 flow->ref);
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index a294542cb8e4..ee2d5967d109 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1748,10 +1748,12 @@ cbq_destroy(struct Qdisc* sch)
1748 * classes from root to leafs which means that filters can still 1748 * classes from root to leafs which means that filters can still
1749 * be bound to classes which have been destroyed already. --TGR '04 1749 * be bound to classes which have been destroyed already. --TGR '04
1750 */ 1750 */
1751 for (h = 0; h < 16; h++) 1751 for (h = 0; h < 16; h++) {
1752 for (cl = q->classes[h]; cl; cl = cl->next) 1752 for (cl = q->classes[h]; cl; cl = cl->next) {
1753 tcf_destroy_chain(cl->filter_list); 1753 tcf_destroy_chain(cl->filter_list);
1754 1754 cl->filter_list = NULL;
1755 }
1756 }
1755 for (h = 0; h < 16; h++) { 1757 for (h = 0; h < 16; h++) {
1756 struct cbq_class *next; 1758 struct cbq_class *next;
1757 1759
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index cbefe225581e..f4d34480a093 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -224,7 +224,8 @@ void __netdev_watchdog_up(struct net_device *dev)
224 if (dev->tx_timeout) { 224 if (dev->tx_timeout) {
225 if (dev->watchdog_timeo <= 0) 225 if (dev->watchdog_timeo <= 0)
226 dev->watchdog_timeo = 5*HZ; 226 dev->watchdog_timeo = 5*HZ;
227 if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo)) 227 if (!mod_timer(&dev->watchdog_timer,
228 round_jiffies(jiffies + dev->watchdog_timeo)))
228 dev_hold(dev); 229 dev_hold(dev);
229 } 230 }
230} 231}
diff --git a/net/sctp/debug.c b/net/sctp/debug.c
index e8c0f7435d7f..80f70aa53386 100644
--- a/net/sctp/debug.c
+++ b/net/sctp/debug.c
@@ -77,8 +77,6 @@ static const char *sctp_cid_tbl[SCTP_NUM_BASE_CHUNK_TYPES] = {
77/* Lookup "chunk type" debug name. */ 77/* Lookup "chunk type" debug name. */
78const char *sctp_cname(const sctp_subtype_t cid) 78const char *sctp_cname(const sctp_subtype_t cid)
79{ 79{
80 if (cid.chunk < 0)
81 return "illegal chunk id";
82 if (cid.chunk <= SCTP_CID_BASE_MAX) 80 if (cid.chunk <= SCTP_CID_BASE_MAX)
83 return sctp_cid_tbl[cid.chunk]; 81 return sctp_cid_tbl[cid.chunk];
84 82
@@ -146,8 +144,6 @@ static const char *sctp_primitive_tbl[SCTP_NUM_PRIMITIVE_TYPES] = {
146/* Lookup primitive debug name. */ 144/* Lookup primitive debug name. */
147const char *sctp_pname(const sctp_subtype_t id) 145const char *sctp_pname(const sctp_subtype_t id)
148{ 146{
149 if (id.primitive < 0)
150 return "illegal primitive";
151 if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX) 147 if (id.primitive <= SCTP_EVENT_PRIMITIVE_MAX)
152 return sctp_primitive_tbl[id.primitive]; 148 return sctp_primitive_tbl[id.primitive];
153 return "unknown_primitive"; 149 return "unknown_primitive";
@@ -161,8 +157,6 @@ static const char *sctp_other_tbl[] = {
161/* Lookup "other" debug name. */ 157/* Lookup "other" debug name. */
162const char *sctp_oname(const sctp_subtype_t id) 158const char *sctp_oname(const sctp_subtype_t id)
163{ 159{
164 if (id.other < 0)
165 return "illegal 'other' event";
166 if (id.other <= SCTP_EVENT_OTHER_MAX) 160 if (id.other <= SCTP_EVENT_OTHER_MAX)
167 return sctp_other_tbl[id.other]; 161 return sctp_other_tbl[id.other];
168 return "unknown 'other' event"; 162 return "unknown 'other' event";
@@ -184,8 +178,6 @@ static const char *sctp_timer_tbl[] = {
184/* Lookup timer debug name. */ 178/* Lookup timer debug name. */
185const char *sctp_tname(const sctp_subtype_t id) 179const char *sctp_tname(const sctp_subtype_t id)
186{ 180{
187 if (id.timeout < 0)
188 return "illegal 'timer' event";
189 if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX) 181 if (id.timeout <= SCTP_EVENT_TIMEOUT_MAX)
190 return sctp_timer_tbl[id.timeout]; 182 return sctp_timer_tbl[id.timeout];
191 return "unknown_timer"; 183 return "unknown_timer";
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 523071c7902f..70a91ece3c49 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -960,7 +960,7 @@ static const sctp_sm_table_entry_t *sctp_chunk_event_lookup(sctp_cid_t cid,
960 if (state > SCTP_STATE_MAX) 960 if (state > SCTP_STATE_MAX)
961 return &bug; 961 return &bug;
962 962
963 if (cid >= 0 && cid <= SCTP_CID_BASE_MAX) 963 if (cid <= SCTP_CID_BASE_MAX)
964 return &chunk_event_table[cid][state]; 964 return &chunk_event_table[cid][state];
965 965
966 if (sctp_prsctp_enable) { 966 if (sctp_prsctp_enable) {
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fc12ba51c1fc..d70fa30d4294 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -174,11 +174,11 @@ static struct sock *unix_peer_get(struct sock *s)
174{ 174{
175 struct sock *peer; 175 struct sock *peer;
176 176
177 unix_state_rlock(s); 177 unix_state_lock(s);
178 peer = unix_peer(s); 178 peer = unix_peer(s);
179 if (peer) 179 if (peer)
180 sock_hold(peer); 180 sock_hold(peer);
181 unix_state_runlock(s); 181 unix_state_unlock(s);
182 return peer; 182 return peer;
183} 183}
184 184
@@ -369,7 +369,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
369 unix_remove_socket(sk); 369 unix_remove_socket(sk);
370 370
371 /* Clear state */ 371 /* Clear state */
372 unix_state_wlock(sk); 372 unix_state_lock(sk);
373 sock_orphan(sk); 373 sock_orphan(sk);
374 sk->sk_shutdown = SHUTDOWN_MASK; 374 sk->sk_shutdown = SHUTDOWN_MASK;
375 dentry = u->dentry; 375 dentry = u->dentry;
@@ -378,7 +378,7 @@ static int unix_release_sock (struct sock *sk, int embrion)
378 u->mnt = NULL; 378 u->mnt = NULL;
379 state = sk->sk_state; 379 state = sk->sk_state;
380 sk->sk_state = TCP_CLOSE; 380 sk->sk_state = TCP_CLOSE;
381 unix_state_wunlock(sk); 381 unix_state_unlock(sk);
382 382
383 wake_up_interruptible_all(&u->peer_wait); 383 wake_up_interruptible_all(&u->peer_wait);
384 384
@@ -386,12 +386,12 @@ static int unix_release_sock (struct sock *sk, int embrion)
386 386
387 if (skpair!=NULL) { 387 if (skpair!=NULL) {
388 if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) { 388 if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
389 unix_state_wlock(skpair); 389 unix_state_lock(skpair);
390 /* No more writes */ 390 /* No more writes */
391 skpair->sk_shutdown = SHUTDOWN_MASK; 391 skpair->sk_shutdown = SHUTDOWN_MASK;
392 if (!skb_queue_empty(&sk->sk_receive_queue) || embrion) 392 if (!skb_queue_empty(&sk->sk_receive_queue) || embrion)
393 skpair->sk_err = ECONNRESET; 393 skpair->sk_err = ECONNRESET;
394 unix_state_wunlock(skpair); 394 unix_state_unlock(skpair);
395 skpair->sk_state_change(skpair); 395 skpair->sk_state_change(skpair);
396 read_lock(&skpair->sk_callback_lock); 396 read_lock(&skpair->sk_callback_lock);
397 sk_wake_async(skpair,1,POLL_HUP); 397 sk_wake_async(skpair,1,POLL_HUP);
@@ -448,7 +448,7 @@ static int unix_listen(struct socket *sock, int backlog)
448 err = -EINVAL; 448 err = -EINVAL;
449 if (!u->addr) 449 if (!u->addr)
450 goto out; /* No listens on an unbound socket */ 450 goto out; /* No listens on an unbound socket */
451 unix_state_wlock(sk); 451 unix_state_lock(sk);
452 if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN) 452 if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
453 goto out_unlock; 453 goto out_unlock;
454 if (backlog > sk->sk_max_ack_backlog) 454 if (backlog > sk->sk_max_ack_backlog)
@@ -462,7 +462,7 @@ static int unix_listen(struct socket *sock, int backlog)
462 err = 0; 462 err = 0;
463 463
464out_unlock: 464out_unlock:
465 unix_state_wunlock(sk); 465 unix_state_unlock(sk);
466out: 466out:
467 return err; 467 return err;
468} 468}
@@ -858,6 +858,31 @@ out_mknod_parent:
858 goto out_up; 858 goto out_up;
859} 859}
860 860
861static void unix_state_double_lock(struct sock *sk1, struct sock *sk2)
862{
863 if (unlikely(sk1 == sk2) || !sk2) {
864 unix_state_lock(sk1);
865 return;
866 }
867 if (sk1 < sk2) {
868 unix_state_lock(sk1);
869 unix_state_lock_nested(sk2);
870 } else {
871 unix_state_lock(sk2);
872 unix_state_lock_nested(sk1);
873 }
874}
875
876static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
877{
878 if (unlikely(sk1 == sk2) || !sk2) {
879 unix_state_unlock(sk1);
880 return;
881 }
882 unix_state_unlock(sk1);
883 unix_state_unlock(sk2);
884}
885
861static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, 886static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
862 int alen, int flags) 887 int alen, int flags)
863{ 888{
@@ -877,11 +902,19 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
877 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0) 902 !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0)
878 goto out; 903 goto out;
879 904
905restart:
880 other=unix_find_other(sunaddr, alen, sock->type, hash, &err); 906 other=unix_find_other(sunaddr, alen, sock->type, hash, &err);
881 if (!other) 907 if (!other)
882 goto out; 908 goto out;
883 909
884 unix_state_wlock(sk); 910 unix_state_double_lock(sk, other);
911
912 /* Apparently VFS overslept socket death. Retry. */
913 if (sock_flag(other, SOCK_DEAD)) {
914 unix_state_double_unlock(sk, other);
915 sock_put(other);
916 goto restart;
917 }
885 918
886 err = -EPERM; 919 err = -EPERM;
887 if (!unix_may_send(sk, other)) 920 if (!unix_may_send(sk, other))
@@ -896,7 +929,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
896 * 1003.1g breaking connected state with AF_UNSPEC 929 * 1003.1g breaking connected state with AF_UNSPEC
897 */ 930 */
898 other = NULL; 931 other = NULL;
899 unix_state_wlock(sk); 932 unix_state_double_lock(sk, other);
900 } 933 }
901 934
902 /* 935 /*
@@ -905,19 +938,19 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
905 if (unix_peer(sk)) { 938 if (unix_peer(sk)) {
906 struct sock *old_peer = unix_peer(sk); 939 struct sock *old_peer = unix_peer(sk);
907 unix_peer(sk)=other; 940 unix_peer(sk)=other;
908 unix_state_wunlock(sk); 941 unix_state_double_unlock(sk, other);
909 942
910 if (other != old_peer) 943 if (other != old_peer)
911 unix_dgram_disconnected(sk, old_peer); 944 unix_dgram_disconnected(sk, old_peer);
912 sock_put(old_peer); 945 sock_put(old_peer);
913 } else { 946 } else {
914 unix_peer(sk)=other; 947 unix_peer(sk)=other;
915 unix_state_wunlock(sk); 948 unix_state_double_unlock(sk, other);
916 } 949 }
917 return 0; 950 return 0;
918 951
919out_unlock: 952out_unlock:
920 unix_state_wunlock(sk); 953 unix_state_double_unlock(sk, other);
921 sock_put(other); 954 sock_put(other);
922out: 955out:
923 return err; 956 return err;
@@ -936,7 +969,7 @@ static long unix_wait_for_peer(struct sock *other, long timeo)
936 (skb_queue_len(&other->sk_receive_queue) > 969 (skb_queue_len(&other->sk_receive_queue) >
937 other->sk_max_ack_backlog); 970 other->sk_max_ack_backlog);
938 971
939 unix_state_runlock(other); 972 unix_state_unlock(other);
940 973
941 if (sched) 974 if (sched)
942 timeo = schedule_timeout(timeo); 975 timeo = schedule_timeout(timeo);
@@ -994,11 +1027,11 @@ restart:
994 goto out; 1027 goto out;
995 1028
996 /* Latch state of peer */ 1029 /* Latch state of peer */
997 unix_state_rlock(other); 1030 unix_state_lock(other);
998 1031
999 /* Apparently VFS overslept socket death. Retry. */ 1032 /* Apparently VFS overslept socket death. Retry. */
1000 if (sock_flag(other, SOCK_DEAD)) { 1033 if (sock_flag(other, SOCK_DEAD)) {
1001 unix_state_runlock(other); 1034 unix_state_unlock(other);
1002 sock_put(other); 1035 sock_put(other);
1003 goto restart; 1036 goto restart;
1004 } 1037 }
@@ -1048,18 +1081,18 @@ restart:
1048 goto out_unlock; 1081 goto out_unlock;
1049 } 1082 }
1050 1083
1051 unix_state_wlock_nested(sk); 1084 unix_state_lock_nested(sk);
1052 1085
1053 if (sk->sk_state != st) { 1086 if (sk->sk_state != st) {
1054 unix_state_wunlock(sk); 1087 unix_state_unlock(sk);
1055 unix_state_runlock(other); 1088 unix_state_unlock(other);
1056 sock_put(other); 1089 sock_put(other);
1057 goto restart; 1090 goto restart;
1058 } 1091 }
1059 1092
1060 err = security_unix_stream_connect(sock, other->sk_socket, newsk); 1093 err = security_unix_stream_connect(sock, other->sk_socket, newsk);
1061 if (err) { 1094 if (err) {
1062 unix_state_wunlock(sk); 1095 unix_state_unlock(sk);
1063 goto out_unlock; 1096 goto out_unlock;
1064 } 1097 }
1065 1098
@@ -1096,7 +1129,7 @@ restart:
1096 smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */ 1129 smp_mb__after_atomic_inc(); /* sock_hold() does an atomic_inc() */
1097 unix_peer(sk) = newsk; 1130 unix_peer(sk) = newsk;
1098 1131
1099 unix_state_wunlock(sk); 1132 unix_state_unlock(sk);
1100 1133
1101 /* take ten and and send info to listening sock */ 1134 /* take ten and and send info to listening sock */
1102 spin_lock(&other->sk_receive_queue.lock); 1135 spin_lock(&other->sk_receive_queue.lock);
@@ -1105,14 +1138,14 @@ restart:
1105 * is installed to listening socket. */ 1138 * is installed to listening socket. */
1106 atomic_inc(&newu->inflight); 1139 atomic_inc(&newu->inflight);
1107 spin_unlock(&other->sk_receive_queue.lock); 1140 spin_unlock(&other->sk_receive_queue.lock);
1108 unix_state_runlock(other); 1141 unix_state_unlock(other);
1109 other->sk_data_ready(other, 0); 1142 other->sk_data_ready(other, 0);
1110 sock_put(other); 1143 sock_put(other);
1111 return 0; 1144 return 0;
1112 1145
1113out_unlock: 1146out_unlock:
1114 if (other) 1147 if (other)
1115 unix_state_runlock(other); 1148 unix_state_unlock(other);
1116 1149
1117out: 1150out:
1118 if (skb) 1151 if (skb)
@@ -1178,10 +1211,10 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags)
1178 wake_up_interruptible(&unix_sk(sk)->peer_wait); 1211 wake_up_interruptible(&unix_sk(sk)->peer_wait);
1179 1212
1180 /* attach accepted sock to socket */ 1213 /* attach accepted sock to socket */
1181 unix_state_wlock(tsk); 1214 unix_state_lock(tsk);
1182 newsock->state = SS_CONNECTED; 1215 newsock->state = SS_CONNECTED;
1183 sock_graft(tsk, newsock); 1216 sock_graft(tsk, newsock);
1184 unix_state_wunlock(tsk); 1217 unix_state_unlock(tsk);
1185 return 0; 1218 return 0;
1186 1219
1187out: 1220out:
@@ -1208,7 +1241,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
1208 } 1241 }
1209 1242
1210 u = unix_sk(sk); 1243 u = unix_sk(sk);
1211 unix_state_rlock(sk); 1244 unix_state_lock(sk);
1212 if (!u->addr) { 1245 if (!u->addr) {
1213 sunaddr->sun_family = AF_UNIX; 1246 sunaddr->sun_family = AF_UNIX;
1214 sunaddr->sun_path[0] = 0; 1247 sunaddr->sun_path[0] = 0;
@@ -1219,7 +1252,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
1219 *uaddr_len = addr->len; 1252 *uaddr_len = addr->len;
1220 memcpy(sunaddr, addr->name, *uaddr_len); 1253 memcpy(sunaddr, addr->name, *uaddr_len);
1221 } 1254 }
1222 unix_state_runlock(sk); 1255 unix_state_unlock(sk);
1223 sock_put(sk); 1256 sock_put(sk);
1224out: 1257out:
1225 return err; 1258 return err;
@@ -1337,7 +1370,7 @@ restart:
1337 goto out_free; 1370 goto out_free;
1338 } 1371 }
1339 1372
1340 unix_state_rlock(other); 1373 unix_state_lock(other);
1341 err = -EPERM; 1374 err = -EPERM;
1342 if (!unix_may_send(sk, other)) 1375 if (!unix_may_send(sk, other))
1343 goto out_unlock; 1376 goto out_unlock;
@@ -1347,20 +1380,20 @@ restart:
1347 * Check with 1003.1g - what should 1380 * Check with 1003.1g - what should
1348 * datagram error 1381 * datagram error
1349 */ 1382 */
1350 unix_state_runlock(other); 1383 unix_state_unlock(other);
1351 sock_put(other); 1384 sock_put(other);
1352 1385
1353 err = 0; 1386 err = 0;
1354 unix_state_wlock(sk); 1387 unix_state_lock(sk);
1355 if (unix_peer(sk) == other) { 1388 if (unix_peer(sk) == other) {
1356 unix_peer(sk)=NULL; 1389 unix_peer(sk)=NULL;
1357 unix_state_wunlock(sk); 1390 unix_state_unlock(sk);
1358 1391
1359 unix_dgram_disconnected(sk, other); 1392 unix_dgram_disconnected(sk, other);
1360 sock_put(other); 1393 sock_put(other);
1361 err = -ECONNREFUSED; 1394 err = -ECONNREFUSED;
1362 } else { 1395 } else {
1363 unix_state_wunlock(sk); 1396 unix_state_unlock(sk);
1364 } 1397 }
1365 1398
1366 other = NULL; 1399 other = NULL;
@@ -1397,14 +1430,14 @@ restart:
1397 } 1430 }
1398 1431
1399 skb_queue_tail(&other->sk_receive_queue, skb); 1432 skb_queue_tail(&other->sk_receive_queue, skb);
1400 unix_state_runlock(other); 1433 unix_state_unlock(other);
1401 other->sk_data_ready(other, len); 1434 other->sk_data_ready(other, len);
1402 sock_put(other); 1435 sock_put(other);
1403 scm_destroy(siocb->scm); 1436 scm_destroy(siocb->scm);
1404 return len; 1437 return len;
1405 1438
1406out_unlock: 1439out_unlock:
1407 unix_state_runlock(other); 1440 unix_state_unlock(other);
1408out_free: 1441out_free:
1409 kfree_skb(skb); 1442 kfree_skb(skb);
1410out: 1443out:
@@ -1494,14 +1527,14 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1494 goto out_err; 1527 goto out_err;
1495 } 1528 }
1496 1529
1497 unix_state_rlock(other); 1530 unix_state_lock(other);
1498 1531
1499 if (sock_flag(other, SOCK_DEAD) || 1532 if (sock_flag(other, SOCK_DEAD) ||
1500 (other->sk_shutdown & RCV_SHUTDOWN)) 1533 (other->sk_shutdown & RCV_SHUTDOWN))
1501 goto pipe_err_free; 1534 goto pipe_err_free;
1502 1535
1503 skb_queue_tail(&other->sk_receive_queue, skb); 1536 skb_queue_tail(&other->sk_receive_queue, skb);
1504 unix_state_runlock(other); 1537 unix_state_unlock(other);
1505 other->sk_data_ready(other, size); 1538 other->sk_data_ready(other, size);
1506 sent+=size; 1539 sent+=size;
1507 } 1540 }
@@ -1512,7 +1545,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
1512 return sent; 1545 return sent;
1513 1546
1514pipe_err_free: 1547pipe_err_free:
1515 unix_state_runlock(other); 1548 unix_state_unlock(other);
1516 kfree_skb(skb); 1549 kfree_skb(skb);
1517pipe_err: 1550pipe_err:
1518 if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL)) 1551 if (sent==0 && !(msg->msg_flags&MSG_NOSIGNAL))
@@ -1641,7 +1674,7 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
1641{ 1674{
1642 DEFINE_WAIT(wait); 1675 DEFINE_WAIT(wait);
1643 1676
1644 unix_state_rlock(sk); 1677 unix_state_lock(sk);
1645 1678
1646 for (;;) { 1679 for (;;) {
1647 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); 1680 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
@@ -1654,14 +1687,14 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
1654 break; 1687 break;
1655 1688
1656 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); 1689 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1657 unix_state_runlock(sk); 1690 unix_state_unlock(sk);
1658 timeo = schedule_timeout(timeo); 1691 timeo = schedule_timeout(timeo);
1659 unix_state_rlock(sk); 1692 unix_state_lock(sk);
1660 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); 1693 clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1661 } 1694 }
1662 1695
1663 finish_wait(sk->sk_sleep, &wait); 1696 finish_wait(sk->sk_sleep, &wait);
1664 unix_state_runlock(sk); 1697 unix_state_unlock(sk);
1665 return timeo; 1698 return timeo;
1666} 1699}
1667 1700
@@ -1711,20 +1744,23 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1711 int chunk; 1744 int chunk;
1712 struct sk_buff *skb; 1745 struct sk_buff *skb;
1713 1746
1747 unix_state_lock(sk);
1714 skb = skb_dequeue(&sk->sk_receive_queue); 1748 skb = skb_dequeue(&sk->sk_receive_queue);
1715 if (skb==NULL) 1749 if (skb==NULL)
1716 { 1750 {
1717 if (copied >= target) 1751 if (copied >= target)
1718 break; 1752 goto unlock;
1719 1753
1720 /* 1754 /*
1721 * POSIX 1003.1g mandates this order. 1755 * POSIX 1003.1g mandates this order.
1722 */ 1756 */
1723 1757
1724 if ((err = sock_error(sk)) != 0) 1758 if ((err = sock_error(sk)) != 0)
1725 break; 1759 goto unlock;
1726 if (sk->sk_shutdown & RCV_SHUTDOWN) 1760 if (sk->sk_shutdown & RCV_SHUTDOWN)
1727 break; 1761 goto unlock;
1762
1763 unix_state_unlock(sk);
1728 err = -EAGAIN; 1764 err = -EAGAIN;
1729 if (!timeo) 1765 if (!timeo)
1730 break; 1766 break;
@@ -1738,7 +1774,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1738 } 1774 }
1739 mutex_lock(&u->readlock); 1775 mutex_lock(&u->readlock);
1740 continue; 1776 continue;
1777 unlock:
1778 unix_state_unlock(sk);
1779 break;
1741 } 1780 }
1781 unix_state_unlock(sk);
1742 1782
1743 if (check_creds) { 1783 if (check_creds) {
1744 /* Never glue messages from different writers */ 1784 /* Never glue messages from different writers */
@@ -1816,12 +1856,12 @@ static int unix_shutdown(struct socket *sock, int mode)
1816 mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN); 1856 mode = (mode+1)&(RCV_SHUTDOWN|SEND_SHUTDOWN);
1817 1857
1818 if (mode) { 1858 if (mode) {
1819 unix_state_wlock(sk); 1859 unix_state_lock(sk);
1820 sk->sk_shutdown |= mode; 1860 sk->sk_shutdown |= mode;
1821 other=unix_peer(sk); 1861 other=unix_peer(sk);
1822 if (other) 1862 if (other)
1823 sock_hold(other); 1863 sock_hold(other);
1824 unix_state_wunlock(sk); 1864 unix_state_unlock(sk);
1825 sk->sk_state_change(sk); 1865 sk->sk_state_change(sk);
1826 1866
1827 if (other && 1867 if (other &&
@@ -1833,9 +1873,9 @@ static int unix_shutdown(struct socket *sock, int mode)
1833 peer_mode |= SEND_SHUTDOWN; 1873 peer_mode |= SEND_SHUTDOWN;
1834 if (mode&SEND_SHUTDOWN) 1874 if (mode&SEND_SHUTDOWN)
1835 peer_mode |= RCV_SHUTDOWN; 1875 peer_mode |= RCV_SHUTDOWN;
1836 unix_state_wlock(other); 1876 unix_state_lock(other);
1837 other->sk_shutdown |= peer_mode; 1877 other->sk_shutdown |= peer_mode;
1838 unix_state_wunlock(other); 1878 unix_state_unlock(other);
1839 other->sk_state_change(other); 1879 other->sk_state_change(other);
1840 read_lock(&other->sk_callback_lock); 1880 read_lock(&other->sk_callback_lock);
1841 if (peer_mode == SHUTDOWN_MASK) 1881 if (peer_mode == SHUTDOWN_MASK)
@@ -1973,7 +2013,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
1973 else { 2013 else {
1974 struct sock *s = v; 2014 struct sock *s = v;
1975 struct unix_sock *u = unix_sk(s); 2015 struct unix_sock *u = unix_sk(s);
1976 unix_state_rlock(s); 2016 unix_state_lock(s);
1977 2017
1978 seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu", 2018 seq_printf(seq, "%p: %08X %08X %08X %04X %02X %5lu",
1979 s, 2019 s,
@@ -2001,7 +2041,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
2001 for ( ; i < len; i++) 2041 for ( ; i < len; i++)
2002 seq_putc(seq, u->addr->name->sun_path[i]); 2042 seq_putc(seq, u->addr->name->sun_path[i]);
2003 } 2043 }
2004 unix_state_runlock(s); 2044 unix_state_unlock(s);
2005 seq_putc(seq, '\n'); 2045 seq_putc(seq, '\n');
2006 } 2046 }
2007 2047
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index 7a19e0ede289..849cc06bd914 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -454,7 +454,7 @@ static int wanrouter_device_setup(struct wan_device *wandev,
454 } 454 }
455 455
456 if (conf->data_size && conf->data) { 456 if (conf->data_size && conf->data) {
457 if (conf->data_size > 128000 || conf->data_size < 0) { 457 if (conf->data_size > 128000) {
458 printk(KERN_INFO 458 printk(KERN_INFO
459 "%s: ERROR, Invalid firmware data size %i !\n", 459 "%s: ERROR, Invalid firmware data size %i !\n",
460 wandev->name, conf->data_size); 460 wandev->name, conf->data_size);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b8bab89616a0..157bfbd250ba 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -26,10 +26,11 @@
26#include <net/xfrm.h> 26#include <net/xfrm.h>
27#include <net/ip.h> 27#include <net/ip.h>
28#include <linux/audit.h> 28#include <linux/audit.h>
29#include <linux/cache.h>
29 30
30#include "xfrm_hash.h" 31#include "xfrm_hash.h"
31 32
32int sysctl_xfrm_larval_drop; 33int sysctl_xfrm_larval_drop __read_mostly;
33 34
34DEFINE_MUTEX(xfrm_cfg_mutex); 35DEFINE_MUTEX(xfrm_cfg_mutex);
35EXPORT_SYMBOL(xfrm_cfg_mutex); 36EXPORT_SYMBOL(xfrm_cfg_mutex);
@@ -833,11 +834,67 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete,
833} 834}
834EXPORT_SYMBOL(xfrm_policy_byid); 835EXPORT_SYMBOL(xfrm_policy_byid);
835 836
836void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info) 837#ifdef CONFIG_SECURITY_NETWORK_XFRM
838static inline int
839xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
837{ 840{
838 int dir; 841 int dir, err = 0;
842
843 for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
844 struct xfrm_policy *pol;
845 struct hlist_node *entry;
846 int i;
847
848 hlist_for_each_entry(pol, entry,
849 &xfrm_policy_inexact[dir], bydst) {
850 if (pol->type != type)
851 continue;
852 err = security_xfrm_policy_delete(pol);
853 if (err) {
854 xfrm_audit_log(audit_info->loginuid,
855 audit_info->secid,
856 AUDIT_MAC_IPSEC_DELSPD, 0,
857 pol, NULL);
858 return err;
859 }
860 }
861 for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) {
862 hlist_for_each_entry(pol, entry,
863 xfrm_policy_bydst[dir].table + i,
864 bydst) {
865 if (pol->type != type)
866 continue;
867 err = security_xfrm_policy_delete(pol);
868 if (err) {
869 xfrm_audit_log(audit_info->loginuid,
870 audit_info->secid,
871 AUDIT_MAC_IPSEC_DELSPD,
872 0, pol, NULL);
873 return err;
874 }
875 }
876 }
877 }
878 return err;
879}
880#else
881static inline int
882xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
883{
884 return 0;
885}
886#endif
887
888int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info)
889{
890 int dir, err = 0;
839 891
840 write_lock_bh(&xfrm_policy_lock); 892 write_lock_bh(&xfrm_policy_lock);
893
894 err = xfrm_policy_flush_secctx_check(type, audit_info);
895 if (err)
896 goto out;
897
841 for (dir = 0; dir < XFRM_POLICY_MAX; dir++) { 898 for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
842 struct xfrm_policy *pol; 899 struct xfrm_policy *pol;
843 struct hlist_node *entry; 900 struct hlist_node *entry;
@@ -890,7 +947,9 @@ void xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info)
890 xfrm_policy_count[dir] -= killed; 947 xfrm_policy_count[dir] -= killed;
891 } 948 }
892 atomic_inc(&flow_cache_genid); 949 atomic_inc(&flow_cache_genid);
950out:
893 write_unlock_bh(&xfrm_policy_lock); 951 write_unlock_bh(&xfrm_policy_lock);
952 return err;
894} 953}
895EXPORT_SYMBOL(xfrm_policy_flush); 954EXPORT_SYMBOL(xfrm_policy_flush);
896 955
@@ -2582,4 +2641,3 @@ restore_state:
2582} 2641}
2583EXPORT_SYMBOL(xfrm_migrate); 2642EXPORT_SYMBOL(xfrm_migrate);
2584#endif 2643#endif
2585
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 9955ff4da0a2..85f3f43a6cca 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -21,18 +21,21 @@
21#include <linux/cache.h> 21#include <linux/cache.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <linux/audit.h> 23#include <linux/audit.h>
24#include <linux/cache.h>
24 25
25#include "xfrm_hash.h" 26#include "xfrm_hash.h"
26 27
27struct sock *xfrm_nl; 28struct sock *xfrm_nl;
28EXPORT_SYMBOL(xfrm_nl); 29EXPORT_SYMBOL(xfrm_nl);
29 30
30u32 sysctl_xfrm_aevent_etime = XFRM_AE_ETIME; 31u32 sysctl_xfrm_aevent_etime __read_mostly = XFRM_AE_ETIME;
31EXPORT_SYMBOL(sysctl_xfrm_aevent_etime); 32EXPORT_SYMBOL(sysctl_xfrm_aevent_etime);
32 33
33u32 sysctl_xfrm_aevent_rseqth = XFRM_AE_SEQT_SIZE; 34u32 sysctl_xfrm_aevent_rseqth __read_mostly = XFRM_AE_SEQT_SIZE;
34EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth); 35EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth);
35 36
37u32 sysctl_xfrm_acq_expires __read_mostly = 30;
38
36/* Each xfrm_state may be linked to two tables: 39/* Each xfrm_state may be linked to two tables:
37 40
38 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl) 41 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl)
@@ -388,12 +391,48 @@ int xfrm_state_delete(struct xfrm_state *x)
388} 391}
389EXPORT_SYMBOL(xfrm_state_delete); 392EXPORT_SYMBOL(xfrm_state_delete);
390 393
391void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info) 394#ifdef CONFIG_SECURITY_NETWORK_XFRM
395static inline int
396xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
392{ 397{
393 int i; 398 int i, err = 0;
394 int err = 0; 399
400 for (i = 0; i <= xfrm_state_hmask; i++) {
401 struct hlist_node *entry;
402 struct xfrm_state *x;
403
404 hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
405 if (xfrm_id_proto_match(x->id.proto, proto) &&
406 (err = security_xfrm_state_delete(x)) != 0) {
407 xfrm_audit_log(audit_info->loginuid,
408 audit_info->secid,
409 AUDIT_MAC_IPSEC_DELSA,
410 0, NULL, x);
411
412 return err;
413 }
414 }
415 }
416
417 return err;
418}
419#else
420static inline int
421xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
422{
423 return 0;
424}
425#endif
426
427int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info)
428{
429 int i, err = 0;
395 430
396 spin_lock_bh(&xfrm_state_lock); 431 spin_lock_bh(&xfrm_state_lock);
432 err = xfrm_state_flush_secctx_check(proto, audit_info);
433 if (err)
434 goto out;
435
397 for (i = 0; i <= xfrm_state_hmask; i++) { 436 for (i = 0; i <= xfrm_state_hmask; i++) {
398 struct hlist_node *entry; 437 struct hlist_node *entry;
399 struct xfrm_state *x; 438 struct xfrm_state *x;
@@ -416,8 +455,12 @@ restart:
416 } 455 }
417 } 456 }
418 } 457 }
458 err = 0;
459
460out:
419 spin_unlock_bh(&xfrm_state_lock); 461 spin_unlock_bh(&xfrm_state_lock);
420 wake_up(&km_waitq); 462 wake_up(&km_waitq);
463 return err;
421} 464}
422EXPORT_SYMBOL(xfrm_state_flush); 465EXPORT_SYMBOL(xfrm_state_flush);
423 466
@@ -622,8 +665,8 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
622 h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family); 665 h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family);
623 hlist_add_head(&x->byspi, xfrm_state_byspi+h); 666 hlist_add_head(&x->byspi, xfrm_state_byspi+h);
624 } 667 }
625 x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; 668 x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
626 x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; 669 x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
627 add_timer(&x->timer); 670 add_timer(&x->timer);
628 xfrm_state_num++; 671 xfrm_state_num++;
629 xfrm_hash_grow_check(x->bydst.next != NULL); 672 xfrm_hash_grow_check(x->bydst.next != NULL);
@@ -772,9 +815,9 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re
772 x->props.family = family; 815 x->props.family = family;
773 x->props.mode = mode; 816 x->props.mode = mode;
774 x->props.reqid = reqid; 817 x->props.reqid = reqid;
775 x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; 818 x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
776 xfrm_state_hold(x); 819 xfrm_state_hold(x);
777 x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; 820 x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
778 add_timer(&x->timer); 821 add_timer(&x->timer);
779 hlist_add_head(&x->bydst, xfrm_state_bydst+h); 822 hlist_add_head(&x->bydst, xfrm_state_bydst+h);
780 h = xfrm_src_hash(daddr, saddr, family); 823 h = xfrm_src_hash(daddr, saddr, family);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b14c7e590c31..c06883bf620e 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1418,10 +1418,13 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
1418 struct km_event c; 1418 struct km_event c;
1419 struct xfrm_usersa_flush *p = NLMSG_DATA(nlh); 1419 struct xfrm_usersa_flush *p = NLMSG_DATA(nlh);
1420 struct xfrm_audit audit_info; 1420 struct xfrm_audit audit_info;
1421 int err;
1421 1422
1422 audit_info.loginuid = NETLINK_CB(skb).loginuid; 1423 audit_info.loginuid = NETLINK_CB(skb).loginuid;
1423 audit_info.secid = NETLINK_CB(skb).sid; 1424 audit_info.secid = NETLINK_CB(skb).sid;
1424 xfrm_state_flush(p->proto, &audit_info); 1425 err = xfrm_state_flush(p->proto, &audit_info);
1426 if (err)
1427 return err;
1425 c.data.proto = p->proto; 1428 c.data.proto = p->proto;
1426 c.event = nlh->nlmsg_type; 1429 c.event = nlh->nlmsg_type;
1427 c.seq = nlh->nlmsg_seq; 1430 c.seq = nlh->nlmsg_seq;
@@ -1582,7 +1585,9 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1582 1585
1583 audit_info.loginuid = NETLINK_CB(skb).loginuid; 1586 audit_info.loginuid = NETLINK_CB(skb).loginuid;
1584 audit_info.secid = NETLINK_CB(skb).sid; 1587 audit_info.secid = NETLINK_CB(skb).sid;
1585 xfrm_policy_flush(type, &audit_info); 1588 err = xfrm_policy_flush(type, &audit_info);
1589 if (err)
1590 return err;
1586 c.data.type = type; 1591 c.data.type = type;
1587 c.event = nlh->nlmsg_type; 1592 c.event = nlh->nlmsg_type;
1588 c.seq = nlh->nlmsg_seq; 1593 c.seq = nlh->nlmsg_seq;
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
new file mode 100755
index 000000000000..e216d49624b7
--- /dev/null
+++ b/scripts/checkpatch.pl
@@ -0,0 +1,595 @@
1#!/usr/bin/perl -w
2# (c) 2001, Dave Jones. <davej@codemonkey.org.uk> (the file handling bit)
3# (c) 2005, Joel Scohpp <jschopp@austin.ibm.com> (the ugly bit)
4# (c) 2007, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite, etc)
5# Licensed under the terms of the GNU GPL License version 2
6
7use strict;
8
9my $P = $0;
10
11my $V = '0.01';
12
13use Getopt::Long qw(:config no_auto_abbrev);
14
15my $quiet = 0;
16my $tree = 1;
17my $chk_signoff = 1;
18my $chk_patch = 1;
19GetOptions(
20 'q|quiet' => \$quiet,
21 'tree!' => \$tree,
22 'signoff!' => \$chk_signoff,
23 'patch!' => \$chk_patch,
24) or exit;
25
26my $exit = 0;
27
28if ($#ARGV < 0) {
29 print "usage: patchstylecheckemail.pl [options] patchfile\n";
30 print "version: $V\n";
31 print "options: -q => quiet\n";
32 print " --no-tree => run without a kernel tree\n";
33 exit(1);
34}
35
36if ($tree && !top_of_kernel_tree()) {
37 print "Must be run from the top-level dir. of a kernel tree\n";
38 exit(2);
39}
40
41my @deprecated = ();
42my $removal = 'Documentation/feature-removal-schedule.txt';
43if ($tree && -f $removal) {
44 open(REMOVE, "<$removal") || die "$P: $removal: open failed - $!\n";
45 while (<REMOVE>) {
46 if (/^Files:\s+(.*\S)/) {
47 for my $file (split(/[, ]+/, $1)) {
48 if ($file =~ m@include/(.*)@) {
49 push(@deprecated, $1);
50 }
51 }
52 }
53 }
54}
55
56my @lines = ();
57while (<>) {
58 chomp;
59 push(@lines, $_);
60 if (eof(ARGV)) {
61 if (!process($ARGV, @lines)) {
62 $exit = 1;
63 }
64 @lines = ();
65 }
66}
67
68exit($exit);
69
70sub top_of_kernel_tree {
71 if ((-f "COPYING") && (-f "CREDITS") && (-f "Kbuild") &&
72 (-f "MAINTAINERS") && (-f "Makefile") && (-f "README") &&
73 (-d "Documentation") && (-d "arch") && (-d "include") &&
74 (-d "drivers") && (-d "fs") && (-d "init") && (-d "ipc") &&
75 (-d "kernel") && (-d "lib") && (-d "scripts")) {
76 return 1;
77 }
78 return 0;
79}
80
81sub expand_tabs {
82 my ($str) = @_;
83
84 my $res = '';
85 my $n = 0;
86 for my $c (split(//, $str)) {
87 if ($c eq "\t") {
88 $res .= ' ';
89 $n++;
90 for (; ($n % 8) != 0; $n++) {
91 $res .= ' ';
92 }
93 next;
94 }
95 $res .= $c;
96 $n++;
97 }
98
99 return $res;
100}
101
102sub cat_vet {
103 my ($vet) = @_;
104
105 $vet =~ s/\t/^I/;
106 $vet =~ s/$/\$/;
107
108 return $vet;
109}
110
111sub process {
112 my $filename = shift;
113 my @lines = @_;
114
115 my $linenr=0;
116 my $prevline="";
117 my $stashline="";
118
119 my $lineforcounting='';
120 my $indent;
121 my $previndent=0;
122 my $stashindent=0;
123
124 my $clean = 1;
125 my $signoff = 0;
126 my $is_patch = 0;
127
128 # Trace the real file/line as we go.
129 my $realfile = '';
130 my $realline = 0;
131 my $realcnt = 0;
132 my $here = '';
133 my $in_comment = 0;
134 my $first_line = 0;
135
136 foreach my $line (@lines) {
137 $linenr++;
138
139#extract the filename as it passes
140 if ($line=~/^\+\+\+\s+(\S+)/) {
141 $realfile=$1;
142 $in_comment = 0;
143 next;
144 }
145#extract the line range in the file after the patch is applied
146 if ($line=~/^\@\@ -\d+,\d+ \+(\d+)(,(\d+))? \@\@/) {
147 $is_patch = 1;
148 $first_line = 1;
149 $in_comment = 0;
150 $realline=$1-1;
151 if (defined $2) {
152 $realcnt=$3+1;
153 } else {
154 $realcnt=1+1;
155 }
156 next;
157 }
158
159#track the line number as we move through the hunk
160 if ($line=~/^[ \+]/) {
161 $realline++;
162 $realcnt-- if ($realcnt != 0);
163
164 # track any sort of multi-line comment. Obviously if
165 # the added text or context do not include the whole
166 # comment we will not see it. Such is life.
167 #
168 # Guestimate if this is a continuing comment. If this
169 # is the start of a diff block and this line starts
170 # ' *' then it is very likely a comment.
171 if ($first_line and $line =~ m@^.\s*\*@) {
172 $in_comment = 1;
173 }
174 if ($line =~ m@/\*@) {
175 $in_comment = 1;
176 }
177 if ($line =~ m@\*/@) {
178 $in_comment = 0;
179 }
180
181 $lineforcounting = $line;
182 $lineforcounting =~ s/^\+//;
183 $lineforcounting = expand_tabs($lineforcounting);
184
185 my ($white) = ($lineforcounting =~ /^(\s*)/);
186 $indent = length($white);
187
188 # Track the previous line.
189 ($prevline, $stashline) = ($stashline, $line);
190 ($previndent, $stashindent) = ($stashindent, $indent);
191 $first_line = 0;
192 }
193
194#make up the handle for any error we report on this line
195 $here = "PATCH: $ARGV:$linenr:";
196 $here .= "\nFILE: $realfile:$realline:" if ($realcnt != 0);
197
198 my $herecurr = "$here\n$line\n\n";
199 my $hereprev = "$here\n$prevline\n$line\n\n";
200
201#check the patch for a signoff:
202 if ($line =~ /^\s*Signed-off-by:\s/) {
203 $signoff++;
204
205 } elsif ($line =~ /^\s*signed-off-by:/i) {
206 if (!($line =~ /^\s*Signed-off-by:/)) {
207 print "use Signed-off-by:\n";
208 print "$herecurr";
209 $clean = 0;
210 }
211 if ($line =~ /^\s*signed-off-by:\S/i) {
212 print "need space after Signed-off-by:\n";
213 print "$herecurr";
214 $clean = 0;
215 }
216 }
217
218#ignore lines not being added
219 if ($line=~/^[^\+]/) {next;}
220
221# check we are in a valid source file *.[hcsS] if not then ignore this hunk
222 next if ($realfile !~ /\.[hcsS]$/);
223
224#trailing whitespace
225 if ($line=~/\S\s+$/) {
226 my $herevet = "$here\n" . cat_vet($line) . "\n\n";
227 print "trailing whitespace\n";
228 print "$herevet";
229 $clean = 0;
230 }
231#80 column limit
232 if (!($prevline=~/\/\*\*/) && length($lineforcounting) > 80) {
233 print "line over 80 characters\n";
234 print "$herecurr";
235 $clean = 0;
236 }
237
238# check we are in a valid source file *.[hc] if not then ignore this hunk
239 next if ($realfile !~ /\.[hc]$/);
240
241# at the beginning of a line any tabs must come first and anything
242# more than 8 must use tabs.
243 if ($line=~/^\+\s* \t\s*\S/ or $line=~/^\+\s* \s*/) {
244 my $herevet = "$here\n" . cat_vet($line) . "\n\n";
245 print "use tabs not spaces\n";
246 print "$herevet";
247 $clean = 0;
248 }
249
250 #
251 # The rest of our checks refer specifically to C style
252 # only apply those _outside_ comments.
253 #
254 next if ($in_comment);
255
256# no C99 // comments
257 if ($line =~ m@//@ and !($line =~ m@\".*//.*\"@)) {
258 print "do not use C99 // comments\n";
259 print "$herecurr";
260 $clean = 0;
261 }
262
263 # Remove comments from the line before processing.
264 $line =~ s@/\*.*\*/@@g;
265 $line =~ s@/\*.*@@;
266 $line =~ s@.*\*/@@;
267 $line =~ s@//.*@@;
268
269#EXPORT_SYMBOL should immediately follow its function closing }.
270 if (($line =~ /EXPORT_SYMBOL.*\(.*\)/) ||
271 ($line =~ /EXPORT_UNUSED_SYMBOL.*\(.*\)/)) {
272 if (($prevline !~ /^}/) &&
273 ($prevline !~ /^\+}/) &&
274 ($prevline !~ /^ }/)) {
275 print "EXPORT_SYMBOL(func); should immediately follow its function\n";
276 print "$herecurr";
277 $clean = 0;
278 }
279 }
280
281 # check for static initialisers.
282 if ($line=~/\s*static\s.*=\s+(0|NULL);/) {
283 print "do not initialise statics to 0 or NULL\n";
284 print "$herecurr";
285 $clean = 0;
286 }
287
288 # check for new typedefs.
289 if ($line=~/\s*typedef\s/) {
290 print "do not add new typedefs\n";
291 print "$herecurr";
292 $clean = 0;
293 }
294
295# * goes on variable not on type
296 if ($line=~/[A-Za-z\d_]+\* [A-Za-z\d_]+/) {
297 print "\"foo* bar\" should be \"foo *bar\"\n";
298 print "$herecurr";
299 $clean = 0;
300 }
301
302# # no BUG() or BUG_ON()
303# if ($line =~ /\b(BUG|BUG_ON)\b/) {
304# print "Try to use WARN_ON & Recovery code rather than BUG() or BUG_ON()\n";
305# print "$herecurr";
306# $clean = 0;
307# }
308
309# printk should use KERN_* levels
310 if ($line =~ /\bprintk\((?!KERN_)/) {
311 print "printk() should include KERN_ facility level\n";
312 print "$herecurr";
313 $clean = 0;
314 }
315
316#function brace can't be on same line, except for #defines of do while, or if closed on same line
317 if (($line=~/[A-Za-z\d_]+\**\s+\**[A-Za-z\d_]+\(.*\).* {/) and
318 !($line=~/\#define.*do\s{/) and !($line=~/}/)) {
319 print "braces following function declarations go on the next line\n";
320 print "$herecurr";
321 $clean = 0;
322 }
323 my $opline = $line;
324 $opline =~ s/^.//;
325 if (!($line=~/\#\s*include/)) {
326 # Check operator spacing.
327 my @elements = split(/(<<=|>>=|<=|>=|==|!=|\+=|-=|\*=|\/=|%=|\^=|\|=|&=|->|<<|>>|<|>|=|!|~|&&|\|\||,|\^|\+\+|--|;|&|\||\+|-|\*|\/\/|\/)/, $opline);
328 for (my $n = 0; $n < $#elements; $n += 2) {
329 # $wN says we have white-space before or after
330 # $sN says we have a separator before or after
331 # $oN says we have another operator before or after
332 my $w1 = $elements[$n] =~ /\s$/;
333 my $s1 = $elements[$n] =~ /(\[|\(|\s)$/;
334 my $o1 = $elements[$n] eq '';
335 my $op = $elements[$n + 1];
336 my $w2 = 1;
337 my $s2 = 1;
338 my $o2 = 0;
339 # If we have something after the operator handle it.
340 if (defined $elements[$n + 2]) {
341 $w2 = $elements[$n + 2] =~ /^\s/;
342 $s2 = $elements[$n + 2] =~ /^(\s|\)|\]|;)/;
343 $o2 = $elements[$n + 2] eq '';
344 }
345
346 # Generate the context.
347 my $at = "here: ";
348 for (my $m = $n; $m >= 0; $m--) {
349 if ($elements[$m] ne '') {
350 $at .= $elements[$m];
351 last;
352 }
353 }
354 $at .= $op;
355 for (my $m = $n + 2; defined $elements[$m]; $m++) {
356 if ($elements[$m] ne '') {
357 $at .= $elements[$m];
358 last;
359 }
360 }
361
362 ##print "<$s1:$op:$s2> <$elements[$n]:$elements[$n + 1]:$elements[$n + 2]>\n";
363 # Skip things apparently in quotes.
364 next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/);
365
366 # We need ; as an operator. // is a comment.
367 if ($op eq ';' or $op eq '//') {
368
369 # -> should have no spaces
370 } elsif ($op eq '->') {
371 if ($s1 or $s2) {
372 print "no spaces around that '$op' $at\n";
373 print "$herecurr";
374 $clean = 0;
375 }
376
377 # , must have a space on the right.
378 } elsif ($op eq ',') {
379 if (!$s2) {
380 print "need space after that '$op' $at\n";
381 print "$herecurr";
382 $clean = 0;
383 }
384
385 # unary ! and unary ~ are allowed no space on the right
386 } elsif ($op eq '!' or $op eq '~') {
387 if (!$s1 && !$o1) {
388 print "need space before that '$op' $at\n";
389 print "$herecurr";
390 $clean = 0;
391 }
392 if ($s2) {
393 print "no space after that '$op' $at\n";
394 print "$herecurr";
395 $clean = 0;
396 }
397
398 # unary ++ and unary -- are allowed no space on one side.
399 } elsif ($op eq '++' or $op eq '--') {
400 if (($s1 && $s2) || ((!$s1 && !$o1) && (!$s2 && !$o2))) {
401 print "need space one side of that '$op' $at\n";
402 print "$herecurr";
403 $clean = 0;
404 }
405
406 # & is both unary and binary
407 # unary:
408 # a &b
409 # binary (consistent spacing):
410 # a&b OK
411 # a & b OK
412 #
413 # boiling down to: if there is a space on the right then there
414 # should be one on the left.
415 #
416 # - is the same
417 #
418 # * is the same only adding:
419 # type:
420 # (foo *)
421 # (foo **)
422 #
423 } elsif ($op eq '&' or $op eq '-' or $op eq '*') {
424 if ($w2 and !$w1) {
425 print "need space before that '$op' $at\n";
426 print "$herecurr";
427 $clean = 0;
428 }
429
430 # << and >> may either have or not have spaces both sides
431 } elsif ($op eq '<<' or $op eq '>>' or $op eq '+' or $op eq '/' or
432 $op eq '^' or $op eq '|')
433 {
434 if ($s1 != $s2) {
435 print "need consistent spacing around '$op' $at\n";
436 print "$herecurr";
437 $clean = 0;
438 }
439
440 # All the others need spaces both sides.
441 } elsif (!$s1 or !$s2) {
442 print "need spaces around that '$op' $at\n";
443 print "$herecurr";
444 $clean = 0;
445 }
446 }
447 }
448
449#need space before brace following if, while, etc
450 if ($line=~/\(.*\){/) {
451 print "need a space before the brace\n";
452 print "$herecurr";
453 $clean = 0;
454 }
455
456#goto labels aren't indented, allow a single space however
457 if ($line=~/^.\s+[A-Za-z\d_]+:/ and
458 !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
459 print "labels should not be indented\n";
460 print "$herecurr";
461 $clean = 0;
462 }
463
464# Need a space before open parenthesis after if, while etc
465 if ($line=~/(if|while|for|switch)\(/) {
466 print "need a space before the open parenthesis\n";
467 print "$herecurr";
468 $clean = 0;
469 }
470
471# Check for illegal assignment in if conditional.
472 if ($line=~/(if|while)\s*\(.*[^<>!=]=[^=].*\)/) {
473 print "do not use assignment in if condition\n";
474 print "$herecurr";
475 $clean = 0;
476 }
477
478 # Check for }<nl>else {, these must be at the same
479 # indent level to be relevant to each other.
480 if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ and
481 $previndent == $indent) {
482 print "else should follow close brace\n";
483 print "$hereprev";
484 $clean = 0;
485 }
486
487 # Check for switch () {<nl>case, these must be at the
488 # same indent. We will only catch the first one, as our
489 # context is very small but people tend to be consistent
490 # so we will catch them out more often than not.
491 if ($prevline=~/\s*switch\s*\(.*\)/ and $line=~/\s*case\s+/
492 and $previndent != $indent) {
493 print "switch and case should be at the same indent\n";
494 print "$hereprev";
495 $clean = 0;
496 }
497
498#studly caps, commented out until figure out how to distinguish between use of existing and adding new
499# if (($line=~/[\w_][a-z\d]+[A-Z]/) and !($line=~/print/)) {
500# print "No studly caps, use _\n";
501# print "$herecurr";
502# $clean = 0;
503# }
504
505#no spaces allowed after \ in define
506 if ($line=~/\#define.*\\\s$/) {
507 print("Whitepspace after \\ makes next lines useless\n");
508 print "$herecurr";
509 $clean = 0;
510 }
511
512#warn if <asm/foo.h> is #included and <linux/foo.h> is available.
513 if ($tree && $line =~ qr|\s*\#\s*include\s*\<asm\/(.*)\.h\>|) {
514 my $checkfile = "include/linux/$1.h";
515 if (-f $checkfile) {
516 print "Use #include <linux/$1.h> instead of <asm/$1.h>\n";
517 print $herecurr;
518 $clean = 0;
519 }
520 }
521
522#if/while/etc brace do not go on next line, unless #defining a do while loop, or if that brace on the next line is for something else
523 if ($prevline=~/(if|while|for|switch)\s*\(/) {
524 my @opened = $prevline=~/\(/g;
525 my @closed = $prevline=~/\)/g;
526 my $nr_line = $linenr;
527 my $remaining = $realcnt;
528 my $next_line = $line;
529 my $extra_lines = 0;
530 my $display_segment = $prevline;
531
532 while ($remaining > 0 && scalar @opened > scalar @closed) {
533 $prevline .= $next_line;
534 $display_segment .= "\n" . $next_line;
535 $next_line = $lines[$nr_line];
536 $nr_line++;
537 $remaining--;
538
539 @opened = $prevline=~/\(/g;
540 @closed = $prevline=~/\)/g;
541 }
542
543 if (($prevline=~/(if|while|for|switch)\s*\(.*\)\s*$/) and ($next_line=~/{/) and
544 !($next_line=~/(if|while|for)/) and !($next_line=~/\#define.*do.*while/)) {
545 print "That { should be on the previous line\n";
546 print "$display_segment\n$next_line\n\n";
547 $clean = 0;
548 }
549 }
550
551#multiline macros should be enclosed in a do while loop
552 if (($prevline=~/\#define.*\\/) and !($prevline=~/do\s+{/) and
553 !($prevline=~/\(\{/) and ($line=~/;\s*\\/) and
554 !($line=~/do.*{/) and !($line=~/\(\{/)) {
555 print "Macros with multiple statements should be enclosed in a do - while loop\n";
556 print "$hereprev";
557 $clean = 0;
558 }
559
560# don't include deprecated include files
561 for my $inc (@deprecated) {
562 if ($line =~ m@\#\s*include\s*\<$inc>@) {
563 print "Don't use <$inc>: see Documentation/feature-removal-schedule.txt\n";
564 print "$herecurr";
565 $clean = 0;
566 }
567 }
568
569# don't use kernel_thread()
570 if ($line =~ /\bkernel_thread\b/) {
571 print "Don't use kernel_thread(), use kthread(): see Documentation/feature-removal-schedule.txt\n";
572 print "$herecurr";
573 $clean = 0;
574 }
575 }
576
577 if ($chk_patch && !$is_patch) {
578 $clean = 0;
579 print "Does not appear to be a unified-diff format patch\n";
580 }
581 if ($is_patch && $chk_signoff && $signoff == 0) {
582 $clean = 0;
583 print "Missing Signed-off-by: line(s)\n";
584 }
585
586 if ($clean == 1 && $quiet == 0) {
587 print "Your patch has no obvious style problems and is ready for submission.\n"
588 }
589 if ($clean == 0 && $quiet == 0) {
590 print "Your patch has style problems, please review. If any of these errors\n";
591 print "are false positives report them to the maintainer, see\n";
592 print "CHECKPATCH in MAINTAINERS.\n";
593 }
594 return $clean;
595}
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
index c7e1b2646193..e7ed868fa7c0 100644
--- a/sound/arm/sa11xx-uda1341.c
+++ b/sound/arm/sa11xx-uda1341.c
@@ -987,7 +987,7 @@ static int __init sa11xx_uda1341_init(void)
987 if (platform_get_drvdata(device)) 987 if (platform_get_drvdata(device))
988 return 0; 988 return 0;
989 platform_device_unregister(device); 989 platform_device_unregister(device);
990 err = -ENODEV 990 err = -ENODEV;
991 } else 991 } else
992 err = PTR_ERR(device); 992 err = PTR_ERR(device);
993 platform_driver_unregister(&sa11xx_uda1341_driver); 993 platform_driver_unregister(&sa11xx_uda1341_driver);
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index e1ed59549c50..cb59f994c68f 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1250,7 +1250,7 @@ static int snd_ali_playback_hw_params(struct snd_pcm_substream *substream,
1250 evoice->substream = substream; 1250 evoice->substream = substream;
1251 } 1251 }
1252 } else { 1252 } else {
1253 if (!evoice) { 1253 if (evoice) {
1254 snd_ali_free_voice(codec, evoice); 1254 snd_ali_free_voice(codec, evoice);
1255 pvoice->extra = evoice = NULL; 1255 pvoice->extra = evoice = NULL;
1256 } 1256 }
@@ -1267,7 +1267,7 @@ static int snd_ali_playback_hw_free(struct snd_pcm_substream *substream)
1267 struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL; 1267 struct snd_ali_voice *evoice = pvoice ? pvoice->extra : NULL;
1268 1268
1269 snd_pcm_lib_free_pages(substream); 1269 snd_pcm_lib_free_pages(substream);
1270 if (!evoice) { 1270 if (evoice) {
1271 snd_ali_free_voice(codec, evoice); 1271 snd_ali_free_voice(codec, evoice);
1272 pvoice->extra = NULL; 1272 pvoice->extra = NULL;
1273 } 1273 }
@@ -1356,7 +1356,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1356 VOL, 1356 VOL,
1357 CTRL, 1357 CTRL,
1358 EC); 1358 EC);
1359 if (!evoice) { 1359 if (evoice) {
1360 evoice->count = pvoice->count; 1360 evoice->count = pvoice->count;
1361 evoice->eso = pvoice->count << 1; 1361 evoice->eso = pvoice->count << 1;
1362 ESO = evoice->eso - 1; 1362 ESO = evoice->eso - 1;
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 8e89d56b6400..f87f8f088956 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -713,6 +713,19 @@ static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
713 return info->amp_caps; 713 return info->amp_caps;
714} 714}
715 715
716int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
717 unsigned int caps)
718{
719 struct hda_amp_info *info;
720
721 info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0));
722 if (!info)
723 return -EINVAL;
724 info->amp_caps = caps;
725 info->status |= INFO_AMP_CAPS;
726 return 0;
727}
728
716/* 729/*
717 * read the current volume to info 730 * read the current volume to info
718 * if the cache exists, read the cache value. 731 * if the cache exists, read the cache value.
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index be12b8814c39..f91ea5ec9f6d 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
277 return codec->wcaps[nid - codec->start_nid]; 277 return codec->wcaps[nid - codec->start_nid];
278} 278}
279 279
280int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
281 unsigned int caps);
280 282
281#endif /* __SOUND_HDA_LOCAL_H */ 283#endif /* __SOUND_HDA_LOCAL_H */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a5a4b2bddf20..bef214bcdddf 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -705,6 +705,17 @@ static struct snd_kcontrol_new cxt5045_test_mixer[] = {
705 .get = conexant_mux_enum_get, 705 .get = conexant_mux_enum_get,
706 .put = conexant_mux_enum_put, 706 .put = conexant_mux_enum_put,
707 }, 707 },
708 /* Audio input controls */
709 HDA_CODEC_VOLUME("Input-1 Volume", 0x1a, 0x0, HDA_INPUT),
710 HDA_CODEC_MUTE("Input-1 Switch", 0x1a, 0x0, HDA_INPUT),
711 HDA_CODEC_VOLUME("Input-2 Volume", 0x1a, 0x1, HDA_INPUT),
712 HDA_CODEC_MUTE("Input-2 Switch", 0x1a, 0x1, HDA_INPUT),
713 HDA_CODEC_VOLUME("Input-3 Volume", 0x1a, 0x2, HDA_INPUT),
714 HDA_CODEC_MUTE("Input-3 Switch", 0x1a, 0x2, HDA_INPUT),
715 HDA_CODEC_VOLUME("Input-4 Volume", 0x1a, 0x3, HDA_INPUT),
716 HDA_CODEC_MUTE("Input-4 Switch", 0x1a, 0x3, HDA_INPUT),
717 HDA_CODEC_VOLUME("Input-5 Volume", 0x1a, 0x4, HDA_INPUT),
718 HDA_CODEC_MUTE("Input-5 Switch", 0x1a, 0x4, HDA_INPUT),
708 { } /* end */ 719 { } /* end */
709}; 720};
710 721
@@ -947,6 +958,23 @@ static void cxt5047_hp_automute(struct hda_codec *codec)
947 snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); 958 snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits);
948} 959}
949 960
961/* mute internal speaker if HP is plugged */
962static void cxt5047_hp2_automute(struct hda_codec *codec)
963{
964 struct conexant_spec *spec = codec->spec;
965 unsigned int bits;
966
967 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0,
968 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
969
970 bits = spec->hp_present ? 0x80 : 0;
971 snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits);
972 snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits);
973 /* Mute/Unmute PCM 2 for good measure - some systems need this */
974 snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits);
975 snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits);
976}
977
950/* toggle input of built-in and mic jack appropriately */ 978/* toggle input of built-in and mic jack appropriately */
951static void cxt5047_hp_automic(struct hda_codec *codec) 979static void cxt5047_hp_automic(struct hda_codec *codec)
952{ 980{
@@ -985,6 +1013,21 @@ static void cxt5047_hp_unsol_event(struct hda_codec *codec,
985 } 1013 }
986} 1014}
987 1015
1016/* unsolicited event for HP jack sensing - non-EAPD systems */
1017static void cxt5047_hp2_unsol_event(struct hda_codec *codec,
1018 unsigned int res)
1019{
1020 res >>= 26;
1021 switch (res) {
1022 case CONEXANT_HP_EVENT:
1023 cxt5047_hp2_automute(codec);
1024 break;
1025 case CONEXANT_MIC_EVENT:
1026 cxt5047_hp_automic(codec);
1027 break;
1028 }
1029}
1030
988static struct snd_kcontrol_new cxt5047_mixers[] = { 1031static struct snd_kcontrol_new cxt5047_mixers[] = {
989 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), 1032 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT),
990 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), 1033 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT),
@@ -1300,19 +1343,20 @@ static int patch_cxt5047(struct hda_codec *codec)
1300 spec->channel_mode = cxt5047_modes, 1343 spec->channel_mode = cxt5047_modes,
1301 1344
1302 codec->patch_ops = conexant_patch_ops; 1345 codec->patch_ops = conexant_patch_ops;
1303 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
1304 1346
1305 board_config = snd_hda_check_board_config(codec, CXT5047_MODELS, 1347 board_config = snd_hda_check_board_config(codec, CXT5047_MODELS,
1306 cxt5047_models, 1348 cxt5047_models,
1307 cxt5047_cfg_tbl); 1349 cxt5047_cfg_tbl);
1308 switch (board_config) { 1350 switch (board_config) {
1309 case CXT5047_LAPTOP: 1351 case CXT5047_LAPTOP:
1352 codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event;
1310 break; 1353 break;
1311 case CXT5047_LAPTOP_HP: 1354 case CXT5047_LAPTOP_HP:
1312 spec->input_mux = &cxt5047_hp_capture_source; 1355 spec->input_mux = &cxt5047_hp_capture_source;
1313 spec->num_init_verbs = 2; 1356 spec->num_init_verbs = 2;
1314 spec->init_verbs[1] = cxt5047_hp_init_verbs; 1357 spec->init_verbs[1] = cxt5047_hp_init_verbs;
1315 spec->mixers[0] = cxt5047_hp_mixers; 1358 spec->mixers[0] = cxt5047_hp_mixers;
1359 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
1316 codec->patch_ops.init = cxt5047_hp_init; 1360 codec->patch_ops.init = cxt5047_hp_init;
1317 break; 1361 break;
1318 case CXT5047_LAPTOP_EAPD: 1362 case CXT5047_LAPTOP_EAPD:
@@ -1320,12 +1364,14 @@ static int patch_cxt5047(struct hda_codec *codec)
1320 spec->num_init_verbs = 2; 1364 spec->num_init_verbs = 2;
1321 spec->init_verbs[1] = cxt5047_toshiba_init_verbs; 1365 spec->init_verbs[1] = cxt5047_toshiba_init_verbs;
1322 spec->mixers[0] = cxt5047_toshiba_mixers; 1366 spec->mixers[0] = cxt5047_toshiba_mixers;
1367 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
1323 break; 1368 break;
1324#ifdef CONFIG_SND_DEBUG 1369#ifdef CONFIG_SND_DEBUG
1325 case CXT5047_TEST: 1370 case CXT5047_TEST:
1326 spec->input_mux = &cxt5047_test_capture_source; 1371 spec->input_mux = &cxt5047_test_capture_source;
1327 spec->mixers[0] = cxt5047_test_mixer; 1372 spec->mixers[0] = cxt5047_test_mixer;
1328 spec->init_verbs[0] = cxt5047_test_init_verbs; 1373 spec->init_verbs[0] = cxt5047_test_init_verbs;
1374 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event;
1329#endif 1375#endif
1330 } 1376 }
1331 return 0; 1377 return 0;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 34ac63469532..4776de93928b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6379,8 +6379,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
6379 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), 6379 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
6380 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), 6380 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
6381 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 6381 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
6382 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
6382 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), 6383 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
6383 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 6384 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
6385 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
6384 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), 6386 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
6385 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), 6387 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
6386 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), 6388 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
@@ -6391,6 +6393,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
6391 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), 6393 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
6392 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), 6394 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
6393 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), 6395 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER),
6396 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
6394 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 6397 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
6395 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 6398 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
6396 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 6399 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
@@ -8765,7 +8768,6 @@ static struct snd_pci_quirk alc861_cfg_tbl[] = {
8765 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), 8768 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
8766 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), 8769 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
8767 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), 8770 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
8768 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660_3ST),
8769 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), 8771 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
8770 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), 8772 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA),
8771 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), 8773 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
@@ -9473,6 +9475,7 @@ static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
9473static struct snd_pci_quirk alc861vd_cfg_tbl[] = { 9475static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
9474 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), 9476 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
9475 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), 9477 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
9478 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST),
9476 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), 9479 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
9477 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), 9480 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
9478 9481
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index 6fcda9bcf0cf..43f537ef40bf 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -304,6 +304,8 @@ struct hda_codec_preset snd_hda_preset_si3054[] = {
304 { .id = 0x10573055, .name = "Si3054", .patch = patch_si3054 }, 304 { .id = 0x10573055, .name = "Si3054", .patch = patch_si3054 },
305 { .id = 0x10573057, .name = "Si3054", .patch = patch_si3054 }, 305 { .id = 0x10573057, .name = "Si3054", .patch = patch_si3054 },
306 { .id = 0x10573155, .name = "Si3054", .patch = patch_si3054 }, 306 { .id = 0x10573155, .name = "Si3054", .patch = patch_si3054 },
307 /* Asus A8J Modem (SM56) */
308 { .id = 0x15433155, .name = "Si3054", .patch = patch_si3054 },
307 {} 309 {}
308}; 310};
309 311
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a6a0a80edc3b..e3964fc4c405 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -51,6 +51,7 @@ enum {
51 STAC_925x_REF, 51 STAC_925x_REF,
52 STAC_M2_2, 52 STAC_M2_2,
53 STAC_MA6, 53 STAC_MA6,
54 STAC_PA6,
54 STAC_925x_MODELS 55 STAC_925x_MODELS
55}; 56};
56 57
@@ -152,6 +153,10 @@ static hda_nid_t stac925x_dac_nids[1] = {
152 0x02, 153 0x02,
153}; 154};
154 155
156static hda_nid_t stac925x_dmic_nids[1] = {
157 0x15,
158};
159
155static hda_nid_t stac922x_adc_nids[2] = { 160static hda_nid_t stac922x_adc_nids[2] = {
156 0x06, 0x07, 161 0x06, 0x07,
157}; 162};
@@ -469,6 +474,14 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = {
469 "Dell Precision M90", STAC_REF), 474 "Dell Precision M90", STAC_REF),
470 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, 475 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
471 "unknown Dell", STAC_REF), 476 "unknown Dell", STAC_REF),
477 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
478 "Dell Inspiron 640m", STAC_REF),
479 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
480 "Dell Inspiron 1501", STAC_REF),
481
482 /* Panasonic */
483 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_REF),
484
472 {} /* terminator */ 485 {} /* terminator */
473}; 486};
474 487
@@ -482,29 +495,38 @@ static unsigned int stac925x_MA6_pin_configs[8] = {
482 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, 495 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e,
483}; 496};
484 497
498static unsigned int stac925x_PA6_pin_configs[8] = {
499 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021,
500 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e,
501};
502
485static unsigned int stac925xM2_2_pin_configs[8] = { 503static unsigned int stac925xM2_2_pin_configs[8] = {
486 0x40c003f3, 0x424503f2, 0x041800f4, 0x02a19020, 504 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020,
487 0x50a103F0, 0x90100210, 0x400003f1, 0x9033032e, 505 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e,
488}; 506};
489 507
490static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 508static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = {
491 [STAC_REF] = ref925x_pin_configs, 509 [STAC_REF] = ref925x_pin_configs,
492 [STAC_M2_2] = stac925xM2_2_pin_configs, 510 [STAC_M2_2] = stac925xM2_2_pin_configs,
493 [STAC_MA6] = stac925x_MA6_pin_configs, 511 [STAC_MA6] = stac925x_MA6_pin_configs,
512 [STAC_PA6] = stac925x_PA6_pin_configs,
494}; 513};
495 514
496static const char *stac925x_models[STAC_925x_MODELS] = { 515static const char *stac925x_models[STAC_925x_MODELS] = {
497 [STAC_REF] = "ref", 516 [STAC_REF] = "ref",
498 [STAC_M2_2] = "m2-2", 517 [STAC_M2_2] = "m2-2",
499 [STAC_MA6] = "m6", 518 [STAC_MA6] = "m6",
519 [STAC_PA6] = "pa6",
500}; 520};
501 521
502static struct snd_pci_quirk stac925x_cfg_tbl[] = { 522static struct snd_pci_quirk stac925x_cfg_tbl[] = {
503 /* SigmaTel reference board */ 523 /* SigmaTel reference board */
504 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), 524 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
525 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
505 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), 526 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF),
506 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), 527 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF),
507 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), 528 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6),
529 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6),
508 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), 530 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2),
509 {} /* terminator */ 531 {} /* terminator */
510}; 532};
@@ -1742,6 +1764,21 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid,
1742 unsigned int pin_ctl = snd_hda_codec_read(codec, nid, 1764 unsigned int pin_ctl = snd_hda_codec_read(codec, nid,
1743 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); 1765 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00);
1744 1766
1767 if (pin_ctl & AC_PINCTL_IN_EN) {
1768 /*
1769 * we need to check the current set-up direction of
1770 * shared input pins since they can be switched via
1771 * "xxx as Output" mixer switch
1772 */
1773 struct sigmatel_spec *spec = codec->spec;
1774 struct auto_pin_cfg *cfg = &spec->autocfg;
1775 if ((nid == cfg->input_pins[AUTO_PIN_LINE] &&
1776 spec->line_switch) ||
1777 (nid == cfg->input_pins[AUTO_PIN_MIC] &&
1778 spec->mic_switch))
1779 return;
1780 }
1781
1745 /* if setting pin direction bits, clear the current 1782 /* if setting pin direction bits, clear the current
1746 direction bits first */ 1783 direction bits first */
1747 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) 1784 if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))
@@ -1911,7 +1948,8 @@ static int patch_stac925x(struct hda_codec *codec)
1911 stac925x_cfg_tbl); 1948 stac925x_cfg_tbl);
1912 again: 1949 again:
1913 if (spec->board_config < 0) { 1950 if (spec->board_config < 0) {
1914 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x, using BIOS defaults\n"); 1951 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
1952 "using BIOS defaults\n");
1915 err = stac92xx_save_bios_config_regs(codec); 1953 err = stac92xx_save_bios_config_regs(codec);
1916 if (err < 0) { 1954 if (err < 0) {
1917 stac92xx_free(codec); 1955 stac92xx_free(codec);
@@ -1929,7 +1967,18 @@ static int patch_stac925x(struct hda_codec *codec)
1929 spec->adc_nids = stac925x_adc_nids; 1967 spec->adc_nids = stac925x_adc_nids;
1930 spec->mux_nids = stac925x_mux_nids; 1968 spec->mux_nids = stac925x_mux_nids;
1931 spec->num_muxes = 1; 1969 spec->num_muxes = 1;
1932 spec->num_dmics = 0; 1970 switch (codec->vendor_id) {
1971 case 0x83847632: /* STAC9202 */
1972 case 0x83847633: /* STAC9202D */
1973 case 0x83847636: /* STAC9251 */
1974 case 0x83847637: /* STAC9251D */
1975 spec->num_dmics = 1;
1976 spec->dmic_nids = stac925x_dmic_nids;
1977 break;
1978 default:
1979 spec->num_dmics = 0;
1980 break;
1981 }
1933 1982
1934 spec->init = stac925x_core_init; 1983 spec->init = stac925x_core_init;
1935 spec->mixer = stac925x_mixer; 1984 spec->mixer = stac925x_mixer;
@@ -2110,6 +2159,13 @@ static int patch_stac927x(struct hda_codec *codec)
2110 2159
2111 codec->patch_ops = stac92xx_patch_ops; 2160 codec->patch_ops = stac92xx_patch_ops;
2112 2161
2162 /* Fix Mux capture level; max to 2 */
2163 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
2164 (0 << AC_AMPCAP_OFFSET_SHIFT) |
2165 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
2166 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2167 (0 << AC_AMPCAP_MUTE_SHIFT));
2168
2113 return 0; 2169 return 0;
2114} 2170}
2115 2171
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index 21dc6974d6a3..bfbdc3cbd43b 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -337,6 +337,8 @@ static int s3c24xx_pcm_open(struct snd_pcm_substream *substream)
337 if (prtd == NULL) 337 if (prtd == NULL)
338 return -ENOMEM; 338 return -ENOMEM;
339 339
340 spin_lock_init(&prtd->lock);
341
340 runtime->private_data = prtd; 342 runtime->private_data = prtd;
341 return 0; 343 return 0;
342} 344}