aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt21
-rw-r--r--Documentation/local_ops.txt23
-rw-r--r--Documentation/networking/driver.txt5
-rw-r--r--Documentation/networking/wavelan.txt4
-rw-r--r--Documentation/nfsroot.txt6
-rw-r--r--Documentation/watchdog/watchdog-api.txt38
-rw-r--r--MAINTAINERS56
-rw-r--r--Makefile6
-rw-r--r--arch/.gitignore2
-rw-r--r--arch/alpha/math-emu/math.c2
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/Kconfig.instrumentation52
-rw-r--r--arch/arm/mach-at91/board-ek.c9
-rw-r--r--arch/arm/mach-omap1/board-fsample.c14
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c4
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c14
-rw-r--r--arch/arm/mach-pxa/pxa25x.c13
-rw-r--r--arch/arm/mach-pxa/sleep.S6
-rw-r--r--arch/arm/vfp/vfp.h2
-rw-r--r--arch/arm/vfp/vfpdouble.c14
-rw-r--r--arch/blackfin/Kconfig4
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c131
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c1
-rw-r--r--arch/cris/arch-v10/kernel/signal.c251
-rw-r--r--arch/cris/arch-v10/kernel/time.c1
-rw-r--r--arch/cris/arch-v10/vmlinux.lds.S33
-rw-r--r--arch/ia64/kernel/unaligned.c11
-rw-r--r--arch/ia64/sn/kernel/xp_nofault.S10
-rw-r--r--arch/mips/Kconfig6
-rw-r--r--arch/mips/au1000/common/pci.c8
-rw-r--r--arch/mips/cobalt/console.c5
-rw-r--r--arch/mips/kernel/head.S3
-rw-r--r--arch/mips/kernel/setup.c7
-rw-r--r--arch/mips/kernel/time.c4
-rw-r--r--arch/mips/lasat/image/Makefile6
-rw-r--r--arch/mips/mips-boards/generic/memory.c2
-rw-r--r--arch/mips/mips-boards/generic/reset.c10
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c2
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/pci/fixup-cobalt.c2
-rw-r--r--arch/mips/pci/ops-au1000.c53
-rw-r--r--arch/mips/pci/ops-mace.c7
-rw-r--r--arch/mips/pci/pci-ip32.c4
-rw-r--r--arch/mips/philips/pnx8550/common/time.c109
-rw-r--r--arch/mips/sgi-ip32/ip32-irq.c1
-rw-r--r--arch/mips/sgi-ip32/ip32-platform.c20
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c4
-rw-r--r--arch/powerpc/boot/flatdevtree_env.h2
-rw-r--r--arch/powerpc/kernel/iommu.c17
-rw-r--r--arch/powerpc/kernel/prom_init.c39
-rw-r--r--arch/powerpc/mm/slb.c2
-rw-r--r--arch/powerpc/platforms/cell/Kconfig5
-rw-r--r--arch/powerpc/platforms/cell/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/spu_notify.c67
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c14
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c16
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c26
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c1
-rw-r--r--arch/powerpc/platforms/ps3/os-area.c40
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c2
-rw-r--r--arch/sparc/kernel/ptrace.c2
-rw-r--r--arch/sparc/kernel/time.c9
-rw-r--r--arch/sparc64/kernel/ktlb.S6
-rw-r--r--arch/sparc64/kernel/pci.c16
-rw-r--r--arch/sparc64/kernel/pci_schizo.c2
-rw-r--r--arch/sparc64/kernel/sun4v_tlb_miss.S2
-rw-r--r--arch/sparc64/kernel/traps.c4
-rw-r--r--arch/um/drivers/harddog_user.c4
-rw-r--r--arch/x86/kernel/apm_32.c10
-rw-r--r--arch/x86/kernel/head_32.S2
-rw-r--r--arch/x86/kernel/hpet.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c12
-rw-r--r--arch/x86/kernel/mfgpt_32.c15
-rw-r--r--arch/x86/kernel/nmi_32.c9
-rw-r--r--arch/x86/kernel/process_32.c11
-rw-r--r--arch/x86/kernel/process_64.c11
-rw-r--r--arch/x86/kernel/smpboot_64.c4
-rw-r--r--arch/x86/kernel/traps_32.c1
-rw-r--r--arch/x86/kernel/traps_64.c1
-rw-r--r--arch/x86/mm/init_32.c9
-rw-r--r--arch/x86/oprofile/nmi_int.c2
-rw-r--r--block/blktrace.c81
-rw-r--r--drivers/acpi/Kconfig9
-rw-r--r--drivers/acpi/ac.c16
-rw-r--r--drivers/acpi/battery.c31
-rw-r--r--drivers/acpi/bus.c7
-rw-r--r--drivers/acpi/ec.c14
-rw-r--r--drivers/acpi/events/evregion.c8
-rw-r--r--drivers/acpi/pci_irq.c9
-rw-r--r--drivers/acpi/processor_idle.c4
-rw-r--r--drivers/acpi/sbs.c23
-rw-r--r--drivers/acpi/scan.c6
-rw-r--r--drivers/ata/ata_piix.c51
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-eh.c24
-rw-r--r--drivers/ata/libata-pmp.c12
-rw-r--r--drivers/ata/libata-scsi.c5
-rw-r--r--drivers/ata/libata-sff.c7
-rw-r--r--drivers/ata/pata_bf54x.c3
-rw-r--r--drivers/ata/pata_ixp4xx_cf.c3
-rw-r--r--drivers/ata/pata_legacy.c8
-rw-r--r--drivers/ata/pata_pdc202xx_old.c34
-rw-r--r--drivers/ata/pata_qdi.c8
-rw-r--r--drivers/ata/pata_winbond.c8
-rw-r--r--drivers/ata/sata_qstor.c2
-rw-r--r--drivers/ata/sata_sil24.c42
-rw-r--r--drivers/atm/firestream.c4
-rw-r--r--drivers/atm/idt77105.c2
-rw-r--r--drivers/atm/nicstar.c19
-rw-r--r--drivers/atm/suni.c2
-rw-r--r--drivers/block/cciss.c2
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/bluetooth/hci_ll.c23
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/tpm/tpm.c12
-rw-r--r--drivers/char/tty_ioctl.c21
-rw-r--r--drivers/connector/cn_queue.c2
-rw-r--r--drivers/connector/connector.c2
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c4
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c5
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c4
-rw-r--r--drivers/crypto/padlock-aes.c53
-rw-r--r--drivers/firmware/dmi-id.c19
-rw-r--r--drivers/hwmon/it87.c32
-rw-r--r--drivers/hwmon/w83627ehf.c36
-rw-r--r--drivers/i2c/busses/i2c-at91.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c2
-rw-r--r--drivers/i2c/busses/i2c-powermac.c2
-rw-r--r--drivers/i2c/busses/i2c-sibyte.c7
-rw-r--r--drivers/i2c/i2c-dev.c2
-rw-r--r--drivers/ide/ide-acpi.c38
-rw-r--r--drivers/ide/ide-cd.c66
-rw-r--r--drivers/ide/ide-cd.h3
-rw-r--r--drivers/ide/ide-iops.c6
-rw-r--r--drivers/ide/pci/cmd64x.c4
-rw-r--r--drivers/ide/pci/cs5535.c2
-rw-r--r--drivers/ide/pci/trm290.c29
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c44
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c2
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c1
-rw-r--r--drivers/input/gameport/gameport.c2
-rw-r--r--drivers/input/input.c8
-rw-r--r--drivers/input/keyboard/Kconfig12
-rw-r--r--drivers/input/keyboard/jornada680_kbd.c40
-rw-r--r--drivers/input/keyboard/spitzkbd.c1
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/input/mouse/lifebook.c7
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mousedev.c9
-rw-r--r--drivers/input/touchscreen/Kconfig8
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c55
-rw-r--r--drivers/isdn/i4l/isdn_common.c3
-rw-r--r--drivers/isdn/i4l/isdn_tty.c7
-rw-r--r--drivers/leds/led-class.c8
-rw-r--r--drivers/leds/led-core.c4
-rw-r--r--drivers/leds/led-triggers.c8
-rw-r--r--drivers/leds/leds-locomo.c2
-rw-r--r--drivers/leds/leds.h3
-rw-r--r--drivers/lguest/Kconfig7
-rw-r--r--drivers/macintosh/adbhid.c3
-rw-r--r--drivers/md/raid5.c6
-rw-r--r--drivers/media/dvb/ttpci/av7110.c10
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c4
-rw-r--r--drivers/media/video/cx23885/Kconfig1
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c3
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c7
-rw-r--r--drivers/net/3c509.c4
-rw-r--r--drivers/net/3c515.c60
-rw-r--r--drivers/net/Kconfig26
-rw-r--r--drivers/net/atl1/atl1_main.c8
-rw-r--r--drivers/net/bonding/bond_alb.c23
-rw-r--r--drivers/net/bonding/bond_main.c64
-rw-r--r--drivers/net/bonding/bond_sysfs.c66
-rw-r--r--drivers/net/bonding/bonding.h4
-rw-r--r--drivers/net/cassini.c139
-rw-r--r--drivers/net/cassini.h18
-rw-r--r--drivers/net/cpmac.c2
-rw-r--r--drivers/net/dl2k.c266
-rw-r--r--drivers/net/dl2k.h163
-rw-r--r--drivers/net/e100.c7
-rw-r--r--drivers/net/e1000/e1000_main.c16
-rw-r--r--drivers/net/e1000e/netdev.c14
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/fec_8xx/fec_main.c5
-rw-r--r--drivers/net/fec_mpc52xx.c5
-rw-r--r--drivers/net/forcedeth.c6
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c14
-rw-r--r--drivers/net/ipg.c36
-rw-r--r--drivers/net/ixgb/ixgb_main.c16
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c17
-rw-r--r--drivers/net/ixp2000/ixpdev.c2
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--drivers/net/macb.c25
-rw-r--r--drivers/net/macvlan.c7
-rw-r--r--drivers/net/meth.c10
-rw-r--r--drivers/net/myri10ge/myri10ge.c2
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/netx-eth.c4
-rw-r--r--drivers/net/netxen/netxen_nic.h69
-rw-r--r--drivers/net/netxen/netxen_nic_init.c20
-rw-r--r--drivers/net/netxen/netxen_nic_main.c72
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c8
-rw-r--r--drivers/net/niu.c264
-rw-r--r--drivers/net/niu.h33
-rw-r--r--drivers/net/pcmcia/3c574_cs.c41
-rw-r--r--drivers/net/pcmcia/3c589_cs.c9
-rw-r--r--drivers/net/pcnet32.c5
-rw-r--r--drivers/net/qla3xxx.c7
-rw-r--r--drivers/net/r8169.c8
-rw-r--r--drivers/net/rrunner.c49
-rw-r--r--drivers/net/rrunner.h2
-rw-r--r--drivers/net/s2io.c20
-rw-r--r--drivers/net/sky2.c27
-rw-r--r--drivers/net/sky2.h4
-rw-r--r--drivers/net/tc35815.c2
-rw-r--r--drivers/net/tg3.c98
-rw-r--r--drivers/net/tokenring/3c359.c90
-rw-r--r--drivers/net/tokenring/3c359.h38
-rw-r--r--drivers/net/tulip/de4x5.c127
-rw-r--r--drivers/net/tulip/interrupt.c8
-rw-r--r--drivers/net/tulip/tulip_core.c3
-rw-r--r--drivers/net/tulip/xircom_cb.c54
-rw-r--r--drivers/net/tun.c2
-rw-r--r--drivers/net/typhoon.c45
-rw-r--r--drivers/net/typhoon.h15
-rw-r--r--drivers/net/usb/asix.c235
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/mcs7830.c4
-rw-r--r--drivers/net/veth.c16
-rw-r--r--drivers/net/wan/cycx_x25.c12
-rw-r--r--drivers/net/wan/dscc4.c94
-rw-r--r--drivers/net/wan/lmc/lmc_media.c12
-rw-r--r--drivers/net/wan/sbni.h12
-rw-r--r--drivers/net/wireless/Kconfig53
-rw-r--r--drivers/net/wireless/b43/b43.h2
-rw-r--r--drivers/net/wireless/b43/main.h20
-rw-r--r--drivers/net/wireless/b43/rfkill.c11
-rw-r--r--drivers/net/wireless/b43/xmit.c27
-rw-r--r--drivers/net/wireless/b43/xmit.h65
-rw-r--r--drivers/net/wireless/hostap/hostap_plx.c6
-rw-r--r--drivers/net/wireless/ipw2200.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c18
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00pci.c20
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c28
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c12
-rw-r--r--drivers/net/wireless/rtl8187_dev.c2
-rw-r--r--drivers/net/xen-netfront.c5
-rw-r--r--drivers/net/yellowfin.c25
-rw-r--r--drivers/pci/probe.c18
-rw-r--r--drivers/pci/quirks.c6
-rw-r--r--drivers/pcmcia/pxa2xx_lubbock.c2
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c16
-rw-r--r--drivers/ps3/ps3-vuart.c1
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/advansys.c2
-rw-r--r--drivers/scsi/qla1280.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c4
-rw-r--r--drivers/scsi/scsi_lib.c2
-rw-r--r--drivers/scsi/scsi_priv.h3
-rw-r--r--drivers/scsi/scsi_sysfs.c17
-rw-r--r--drivers/scsi/scsi_transport_srp.c3
-rw-r--r--drivers/serial/suncore.c2
-rw-r--r--drivers/spi/spi_bitbang.c5
-rw-r--r--drivers/ssb/scan.c11
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c2
-rw-r--r--drivers/usb/serial/cp2101.c1
-rw-r--r--drivers/usb/serial/keyspan.c2
-rw-r--r--drivers/usb/serial/pl2303.c7
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/video/atmel_lcdfb.c2
-rw-r--r--drivers/video/modedb.c4
-rw-r--r--drivers/video/ps3fb.c24
-rw-r--r--drivers/video/s3c2410fb.c4
-rw-r--r--drivers/video/uvesafb.c4
-rw-r--r--drivers/w1/slaves/w1_therm.c4
-rw-r--r--drivers/w1/w1.c6
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--fs/Kconfig4
-rw-r--r--fs/binfmt_elf.c4
-rw-r--r--fs/compat_ioctl.c8
-rw-r--r--fs/dquot.c32
-rw-r--r--fs/ecryptfs/crypto.c9
-rw-r--r--fs/ecryptfs/inode.c20
-rw-r--r--fs/ecryptfs/main.c5
-rw-r--r--fs/ecryptfs/messaging.c1
-rw-r--r--fs/ecryptfs/super.c1
-rw-r--r--fs/fat/fatent.c28
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--fs/hfs/bfind.c12
-rw-r--r--fs/hfs/brec.c15
-rw-r--r--fs/hfs/btree.c20
-rw-r--r--fs/hfs/hfs.h5
-rw-r--r--fs/jbd/transaction.c2
-rw-r--r--fs/namei.c4
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4proc.c34
-rw-r--r--fs/nfs/nfs4renewd.c2
-rw-r--r--fs/nfs/nfs4state.c5
-rw-r--r--fs/nfs/super.c12
-rw-r--r--fs/nfsd/nfs3xdr.c5
-rw-r--r--fs/nfsd/nfsxdr.c5
-rw-r--r--fs/proc/array.c4
-rw-r--r--fs/proc/base.c20
-rw-r--r--fs/proc/internal.h2
-rw-r--r--fs/proc/proc_misc.c4
-rw-r--r--fs/proc/task_mmu.c3
-rw-r--r--fs/proc/task_nommu.c4
-rw-r--r--fs/sysfs/dir.c8
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c16
-rw-r--r--include/asm-arm/arch-pxa/hardware.h24
-rw-r--r--include/asm-arm/system.h13
-rw-r--r--include/asm-cris/page.h7
-rw-r--r--include/asm-cris/unistd.h1
-rw-r--r--include/asm-generic/tlb.h3
-rw-r--r--include/asm-ia64/sn/xpc.h6
-rw-r--r--include/asm-mips/cacheops.h2
-rw-r--r--include/asm-mips/smtc_ipi.h6
-rw-r--r--include/asm-powerpc/spu.h4
-rw-r--r--include/asm-sh/cacheflush.h6
-rw-r--r--include/asm-sh/uaccess.h42
-rw-r--r--include/asm-sparc64/dma-mapping.h12
-rw-r--r--include/asm-sparc64/pci.h4
-rw-r--r--include/asm-x86/byteorder.h4
-rw-r--r--include/asm-x86/msr.h78
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/cpu.h4
-rw-r--r--include/linux/cpumask.h2
-rw-r--r--include/linux/i2c-id.h4
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/netdevice.h18
-rw-r--r--include/linux/pci_ids.h2
-rw-r--r--include/linux/pm.h9
-rw-r--r--include/linux/pm_legacy.h6
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/ptrace.h1
-rw-r--r--include/linux/quicklist.h8
-rw-r--r--include/linux/scatterlist.h4
-rw-r--r--include/linux/sched.h13
-rw-r--r--include/linux/slab.h5
-rw-r--r--include/linux/slab_def.h3
-rw-r--r--include/linux/tc_act/Kbuild1
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/veth.h (renamed from include/net/veth.h)0
-rw-r--r--include/linux/workqueue.h14
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/ip6_tunnel.h2
-rw-r--r--include/net/irda/discovery.h2
-rw-r--r--include/net/netfilter/nf_conntrack.h1
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/sock.h2
-rw-r--r--include/net/xfrm.h7
-rw-r--r--init/Kconfig6
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/futex.c51
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/kexec.c1
-rw-r--r--kernel/kmod.c13
-rw-r--r--kernel/lockdep.c12
-rw-r--r--kernel/module.c29
-rw-r--r--kernel/params.c10
-rw-r--r--kernel/power/main.c3
-rw-r--r--kernel/power/pm.c4
-rw-r--r--kernel/printk.c2
-rw-r--r--kernel/ptrace.c6
-rw-r--r--kernel/rcupdate.c2
-rw-r--r--kernel/sched.c10
-rw-r--r--kernel/sched_debug.c8
-rw-r--r--kernel/timer.c4
-rw-r--r--kernel/workqueue.c5
-rw-r--r--lib/proportions.c37
-rw-r--r--mm/filemap_xip.c9
-rw-r--r--mm/hugetlb.c13
-rw-r--r--mm/memory.c8
-rw-r--r--mm/page-writeback.c9
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/quicklist.c12
-rw-r--r--mm/slab.c2
-rw-r--r--mm/slub.c116
-rw-r--r--net/802/tr.c2
-rw-r--r--net/8021q/vlan.c7
-rw-r--r--net/atm/mpc.c7
-rw-r--r--net/ax25/af_ax25.c51
-rw-r--r--net/ax25/ax25_in.c2
-rw-r--r--net/bluetooth/hci_conn.c10
-rw-r--r--net/bluetooth/hci_sysfs.c1
-rw-r--r--net/bluetooth/rfcomm/tty.c22
-rw-r--r--net/bridge/br_netfilter.c45
-rw-r--r--net/compat.c2
-rw-r--r--net/core/dev.c10
-rw-r--r--net/core/rtnetlink.c5
-rw-r--r--net/core/scm.c2
-rw-r--r--net/core/skbuff.c11
-rw-r--r--net/dccp/ackvec.h2
-rw-r--r--net/dccp/ccids/ccid3.c2
-rw-r--r--net/decnet/dn_route.c6
-rw-r--r--net/ipv4/arp.c3
-rw-r--r--net/ipv4/devinet.c2
-rw-r--r--net/ipv4/fib_frontend.c9
-rw-r--r--net/ipv4/fib_hash.c23
-rw-r--r--net/ipv4/fib_trie.c3
-rw-r--r--net/ipv4/icmp.c1
-rw-r--r--net/ipv4/inet_lro.c16
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ipconfig.c27
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c3
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c2
-rw-r--r--net/ipv4/raw.c4
-rw-r--r--net/ipv4/route.c14
-rw-r--r--net/ipv4/tcp_input.c19
-rw-r--r--net/ipv6/datagram.c6
-rw-r--r--net/ipv6/icmp.c2
-rw-r--r--net/ipv6/inet6_hashtables.c2
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/netfilter/ip6t_eui64.c2
-rw-r--r--net/ipv6/proc.c4
-rw-r--r--net/ipv6/route.c11
-rw-r--r--net/irda/af_irda.c32
-rw-r--r--net/irda/ircomm/ircomm_param.c2
-rw-r--r--net/irda/irlan/irlan_eth.c2
-rw-r--r--net/irda/irlap_frame.c2
-rw-r--r--net/irda/parameters.c12
-rw-r--r--net/irda/wrapper.c2
-rw-r--r--net/key/af_key.c30
-rw-r--r--net/mac80211/ieee80211.c1
-rw-r--r--net/mac80211/ieee80211_ioctl.c6
-rw-r--r--net/mac80211/ieee80211_rate.c2
-rw-r--r--net/mac80211/ieee80211_sta.c8
-rw-r--r--net/mac80211/rx.c13
-rw-r--r--net/mac80211/sta_info.c7
-rw-r--r--net/netfilter/nf_conntrack_core.c5
-rw-r--r--net/netfilter/nf_conntrack_sip.c4
-rw-r--r--net/netfilter/xt_helper.c4
-rw-r--r--net/netlabel/netlabel_mgmt.c2
-rw-r--r--net/netrom/nr_dev.c2
-rw-r--r--net/rfkill/rfkill.c5
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sctp/sm_make_chunk.c14
-rw-r--r--net/sctp/sm_statefuns.c22
-rw-r--r--net/sctp/ulpevent.c2
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c2
-rw-r--r--net/x25/x25_forward.c5
-rw-r--r--net/xfrm/xfrm_policy.c4
-rw-r--r--net/xfrm/xfrm_state.c6
-rw-r--r--net/xfrm/xfrm_user.c17
-rw-r--r--scripts/kconfig/conf.c3
-rw-r--r--security/commoncap.c13
-rw-r--r--security/selinux/netlabel.c7
-rw-r--r--security/selinux/ss/services.c2
-rw-r--r--sound/core/oss/mixer_oss.c101
-rw-r--r--sound/oss/Kconfig4
-rw-r--r--sound/oss/msnd.h4
459 files changed, 4199 insertions, 3005 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 2fc1fb896afc..db122df5e77d 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -527,29 +527,30 @@ and is between 256 and 4096 characters. It is defined in the file
527 Format: <area>[,<node>] 527 Format: <area>[,<node>]
528 See also Documentation/networking/decnet.txt. 528 See also Documentation/networking/decnet.txt.
529 529
530 default_blu= [VT] 530 vt.default_blu= [VT]
531 Format: <blue0>,<blue1>,<blue2>,...,<blue15> 531 Format: <blue0>,<blue1>,<blue2>,...,<blue15>
532 Change the default blue palette of the console. 532 Change the default blue palette of the console.
533 This is a 16-member array composed of values 533 This is a 16-member array composed of values
534 ranging from 0-255. 534 ranging from 0-255.
535 535
536 default_grn= [VT] 536 vt.default_grn= [VT]
537 Format: <green0>,<green1>,<green2>,...,<green15> 537 Format: <green0>,<green1>,<green2>,...,<green15>
538 Change the default green palette of the console. 538 Change the default green palette of the console.
539 This is a 16-member array composed of values 539 This is a 16-member array composed of values
540 ranging from 0-255. 540 ranging from 0-255.
541 541
542 default_red= [VT] 542 vt.default_red= [VT]
543 Format: <red0>,<red1>,<red2>,...,<red15> 543 Format: <red0>,<red1>,<red2>,...,<red15>
544 Change the default red palette of the console. 544 Change the default red palette of the console.
545 This is a 16-member array composed of values 545 This is a 16-member array composed of values
546 ranging from 0-255. 546 ranging from 0-255.
547 547
548 default_utf8= [VT] 548 vt.default_utf8=
549 [VT]
549 Format=<0|1> 550 Format=<0|1>
550 Set system-wide default UTF-8 mode for all tty's. 551 Set system-wide default UTF-8 mode for all tty's.
551 Default is 0 and by setting to 1, it enables UTF-8 552 Default is 1, i.e. UTF-8 mode is enabled for all
552 mode for all newly opened or allocated terminals. 553 newly opened terminals.
553 554
554 dhash_entries= [KNL] 555 dhash_entries= [KNL]
555 Set number of hash buckets for dentry cache. 556 Set number of hash buckets for dentry cache.
@@ -883,6 +884,14 @@ and is between 256 and 4096 characters. It is defined in the file
883 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in 884 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in
884 C2 power state. 885 C2 power state.
885 886
887 libata.dma= [LIBATA] DMA control
888 libata.dma=0 Disable all PATA and SATA DMA
889 libata.dma=1 PATA and SATA Disk DMA only
890 libata.dma=2 ATAPI (CDROM) DMA only
891 libata.dma=4 Compact Flash DMA only
892 Combinations also work, so libata.dma=3 enables DMA
893 for disks and CDROMs, but not CFs.
894
886 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 895 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume
887 when set. 896 when set.
888 Format: <int> 897 Format: <int>
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt
index 1a45f11e645e..4269a1105b37 100644
--- a/Documentation/local_ops.txt
+++ b/Documentation/local_ops.txt
@@ -68,29 +68,6 @@ typedef struct { atomic_long_t a; } local_t;
68 variable can be read when reading some _other_ cpu's variables. 68 variable can be read when reading some _other_ cpu's variables.
69 69
70 70
71* Rules to follow when using local atomic operations
72
73- Variables touched by local ops must be per cpu variables.
74- _Only_ the CPU owner of these variables must write to them.
75- This CPU can use local ops from any context (process, irq, softirq, nmi, ...)
76 to update its local_t variables.
77- Preemption (or interrupts) must be disabled when using local ops in
78 process context to make sure the process won't be migrated to a
79 different CPU between getting the per-cpu variable and doing the
80 actual local op.
81- When using local ops in interrupt context, no special care must be
82 taken on a mainline kernel, since they will run on the local CPU with
83 preemption already disabled. I suggest, however, to explicitly
84 disable preemption anyway to make sure it will still work correctly on
85 -rt kernels.
86- Reading the local cpu variable will provide the current copy of the
87 variable.
88- Reads of these variables can be done from any CPU, because updates to
89 "long", aligned, variables are always atomic. Since no memory
90 synchronization is done by the writer CPU, an outdated copy of the
91 variable can be read when reading some _other_ cpu's variables.
92
93
94* How to use local atomic operations 71* How to use local atomic operations
95 72
96#include <linux/percpu.h> 73#include <linux/percpu.h>
diff --git a/Documentation/networking/driver.txt b/Documentation/networking/driver.txt
index 4f7da5a2bf4f..ea72d2e66ca8 100644
--- a/Documentation/networking/driver.txt
+++ b/Documentation/networking/driver.txt
@@ -61,7 +61,10 @@ Transmit path guidelines:
612) Do not forget to update netdev->trans_start to jiffies after 612) Do not forget to update netdev->trans_start to jiffies after
62 each new tx packet is given to the hardware. 62 each new tx packet is given to the hardware.
63 63
643) Do not forget that once you return 0 from your hard_start_xmit 643) A hard_start_xmit method must not modify the shared parts of a
65 cloned SKB.
66
674) Do not forget that once you return 0 from your hard_start_xmit
65 method, it is your driver's responsibility to free up the SKB 68 method, it is your driver's responsibility to free up the SKB
66 and in some finite amount of time. 69 and in some finite amount of time.
67 70
diff --git a/Documentation/networking/wavelan.txt b/Documentation/networking/wavelan.txt
index c1acf5eb3712..afa6e521c685 100644
--- a/Documentation/networking/wavelan.txt
+++ b/Documentation/networking/wavelan.txt
@@ -12,8 +12,8 @@ and many Linux driver to support it.
12"wavelan" driver (old ISA Wavelan) 12"wavelan" driver (old ISA Wavelan)
13---------------- 13----------------
14 o Config : Network device -> Wireless LAN -> AT&T WaveLAN 14 o Config : Network device -> Wireless LAN -> AT&T WaveLAN
15 o Location : .../drivers/net/wavelan* 15 o Location : .../drivers/net/wireless/wavelan*
16 o in-line doc : .../drivers/net/wavelan.p.h 16 o in-line doc : .../drivers/net/wireless/wavelan.p.h
17 o on-line doc : 17 o on-line doc :
18 http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html 18 http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Wavelan.html
19 19
diff --git a/Documentation/nfsroot.txt b/Documentation/nfsroot.txt
index 9b956a969362..31b329172343 100644
--- a/Documentation/nfsroot.txt
+++ b/Documentation/nfsroot.txt
@@ -97,10 +97,6 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
97 autoconfiguration will take place. The most common way to use this 97 autoconfiguration will take place. The most common way to use this
98 is "ip=dhcp". 98 is "ip=dhcp".
99 99
100 Note that "ip=off" is not the same thing as "ip=::::::off", because in
101 the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP
102 are compiled in the kernel.
103
104 <client-ip> IP address of the client. 100 <client-ip> IP address of the client.
105 101
106 Default: Determined using autoconfiguration. 102 Default: Determined using autoconfiguration.
@@ -149,7 +145,9 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
149 this option. 145 this option.
150 146
151 off or none: don't use autoconfiguration 147 off or none: don't use autoconfiguration
148 (do static IP assignment instead)
152 on or any: use any protocol available in the kernel 149 on or any: use any protocol available in the kernel
150 (default)
153 dhcp: use DHCP 151 dhcp: use DHCP
154 bootp: use BOOTP 152 bootp: use BOOTP
155 rarp: use RARP 153 rarp: use RARP
diff --git a/Documentation/watchdog/watchdog-api.txt b/Documentation/watchdog/watchdog-api.txt
index bb7cb1d31ec7..4cc4ba9d7150 100644
--- a/Documentation/watchdog/watchdog-api.txt
+++ b/Documentation/watchdog/watchdog-api.txt
@@ -42,23 +42,27 @@ like this source file: see Documentation/watchdog/src/watchdog-simple.c
42A more advanced driver could for example check that a HTTP server is 42A more advanced driver could for example check that a HTTP server is
43still responding before doing the write call to ping the watchdog. 43still responding before doing the write call to ping the watchdog.
44 44
45When the device is closed, the watchdog is disabled. This is not 45When the device is closed, the watchdog is disabled, unless the "Magic
46always such a good idea, since if there is a bug in the watchdog 46Close" feature is supported (see below). This is not always such a
47daemon and it crashes the system will not reboot. Because of this, 47good idea, since if there is a bug in the watchdog daemon and it
48some of the drivers support the configuration option "Disable watchdog 48crashes the system will not reboot. Because of this, some of the
49shutdown on close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when 49drivers support the configuration option "Disable watchdog shutdown on
50compiling the kernel, there is no way of disabling the watchdog once 50close", CONFIG_WATCHDOG_NOWAYOUT. If it is set to Y when compiling
51it has been started. So, if the watchdog daemon crashes, the system 51the kernel, there is no way of disabling the watchdog once it has been
52will reboot after the timeout has passed. Watchdog devices also usually 52started. So, if the watchdog daemon crashes, the system will reboot
53support the nowayout module parameter so that this option can be controlled 53after the timeout has passed. Watchdog devices also usually support
54at runtime. 54the nowayout module parameter so that this option can be controlled at
55 55runtime.
56Drivers will not disable the watchdog, unless a specific magic character 'V' 56
57has been sent /dev/watchdog just before closing the file. If the userspace 57Magic Close feature:
58daemon closes the file without sending this special character, the driver 58
59will assume that the daemon (and userspace in general) died, and will stop 59If a driver supports "Magic Close", the driver will not disable the
60pinging the watchdog without disabling it first. This will then cause a 60watchdog unless a specific magic character 'V' has been sent to
61reboot if the watchdog is not re-opened in sufficient time. 61/dev/watchdog just before closing the file. If the userspace daemon
62closes the file without sending this special character, the driver
63will assume that the daemon (and userspace in general) died, and will
64stop pinging the watchdog without disabling it first. This will then
65cause a reboot if the watchdog is not re-opened in sufficient time.
62 66
63The ioctl API: 67The ioctl API:
64 68
diff --git a/MAINTAINERS b/MAINTAINERS
index 3c7db6222f86..2340cfb1e25d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -665,12 +665,18 @@ S: Maintained
665 665
666ATMEL AT91 MCI DRIVER 666ATMEL AT91 MCI DRIVER
667P: Nicolas Ferre 667P: Nicolas Ferre
668M: nicolas.ferre@rfo.atmel.com 668M: nicolas.ferre@atmel.com
669L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 669L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
670W: http://www.atmel.com/products/AT91/ 670W: http://www.atmel.com/products/AT91/
671W: http://www.at91.com/ 671W: http://www.at91.com/
672S: Maintained 672S: Maintained
673 673
674ATMEL LCDFB DRIVER
675P: Nicolas Ferre
676M: nicolas.ferre@atmel.com
677L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
678S: Maintained
679
674ATMEL MACB ETHERNET DRIVER 680ATMEL MACB ETHERNET DRIVER
675P: Haavard Skinnemoen 681P: Haavard Skinnemoen
676M: hskinnemoen@atmel.com 682M: hskinnemoen@atmel.com
@@ -1870,8 +1876,10 @@ T: quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
1870S: Maintained 1876S: Maintained
1871 1877
1872IDE/ATAPI CDROM DRIVER 1878IDE/ATAPI CDROM DRIVER
1879P: Borislav Petkov
1880M: bbpetkov@yahoo.de
1873L: linux-ide@vger.kernel.org 1881L: linux-ide@vger.kernel.org
1874S: Unmaintained 1882S: Maintained
1875 1883
1876IDE/ATAPI FLOPPY DRIVERS 1884IDE/ATAPI FLOPPY DRIVERS
1877P: Paul Bristow 1885P: Paul Bristow
@@ -1917,7 +1925,7 @@ INFINIBAND SUBSYSTEM
1917P: Roland Dreier 1925P: Roland Dreier
1918M: rolandd@cisco.com 1926M: rolandd@cisco.com
1919P: Sean Hefty 1927P: Sean Hefty
1920M: mshefty@ichips.intel.com 1928M: sean.hefty@intel.com
1921P: Hal Rosenstock 1929P: Hal Rosenstock
1922M: hal.rosenstock@gmail.com 1930M: hal.rosenstock@gmail.com
1923L: general@lists.openfabrics.org 1931L: general@lists.openfabrics.org
@@ -1982,29 +1990,27 @@ L: netdev@vger.kernel.org
1982S: Maintained 1990S: Maintained
1983 1991
1984INTEL PRO/100 ETHERNET SUPPORT 1992INTEL PRO/100 ETHERNET SUPPORT
1985P: John Ronciak 1993P: Auke Kok
1986M: john.ronciak@intel.com 1994M: auke-jan.h.kok@intel.com
1987P: Jesse Brandeburg 1995P: Jesse Brandeburg
1988M: jesse.brandeburg@intel.com 1996M: jesse.brandeburg@intel.com
1989P: Jeff Kirsher 1997P: Jeff Kirsher
1990M: jeffrey.t.kirsher@intel.com 1998M: jeffrey.t.kirsher@intel.com
1991P: Auke Kok 1999P: John Ronciak
1992M: auke-jan.h.kok@intel.com 2000M: john.ronciak@intel.com
1993L: e1000-devel@lists.sourceforge.net 2001L: e1000-devel@lists.sourceforge.net
1994W: http://sourceforge.net/projects/e1000/ 2002W: http://sourceforge.net/projects/e1000/
1995S: Supported 2003S: Supported
1996 2004
1997INTEL PRO/1000 GIGABIT ETHERNET SUPPORT 2005INTEL PRO/1000 GIGABIT ETHERNET SUPPORT
1998P: Jeb Cramer 2006P: Auke Kok
1999M: cramerj@intel.com 2007M: auke-jan.h.kok@intel.com
2000P: John Ronciak
2001M: john.ronciak@intel.com
2002P: Jesse Brandeburg 2008P: Jesse Brandeburg
2003M: jesse.brandeburg@intel.com 2009M: jesse.brandeburg@intel.com
2004P: Jeff Kirsher 2010P: Jeff Kirsher
2005M: jeffrey.t.kirsher@intel.com 2011M: jeffrey.t.kirsher@intel.com
2006P: Auke Kok 2012P: John Ronciak
2007M: auke-jan.h.kok@intel.com 2013M: john.ronciak@intel.com
2008L: e1000-devel@lists.sourceforge.net 2014L: e1000-devel@lists.sourceforge.net
2009W: http://sourceforge.net/projects/e1000/ 2015W: http://sourceforge.net/projects/e1000/
2010S: Supported 2016S: Supported
@@ -2029,7 +2035,7 @@ P: James Ketrenos
2029M: jketreno@linux.intel.com 2035M: jketreno@linux.intel.com
2030L: linux-wireless@vger.kernel.org 2036L: linux-wireless@vger.kernel.org
2031L: ipw2100-devel@lists.sourceforge.net 2037L: ipw2100-devel@lists.sourceforge.net
2032L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel 2038W: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
2033W: http://ipw2100.sourceforge.net 2039W: http://ipw2100.sourceforge.net
2034S: Supported 2040S: Supported
2035 2041
@@ -2040,7 +2046,7 @@ P: James Ketrenos
2040M: jketreno@linux.intel.com 2046M: jketreno@linux.intel.com
2041L: linux-wireless@vger.kernel.org 2047L: linux-wireless@vger.kernel.org
2042L: ipw2100-devel@lists.sourceforge.net 2048L: ipw2100-devel@lists.sourceforge.net
2043L: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel 2049W: http://lists.sourceforge.net/mailman/listinfo/ipw2100-devel
2044W: http://ipw2200.sourceforge.net 2050W: http://ipw2200.sourceforge.net
2045S: Supported 2051S: Supported
2046 2052
@@ -2597,7 +2603,7 @@ S: Maintained
2597MSI LAPTOP SUPPORT 2603MSI LAPTOP SUPPORT
2598P: Lennart Poettering 2604P: Lennart Poettering
2599M: mzxreary@0pointer.de 2605M: mzxreary@0pointer.de
2600L: https://tango.0pointer.de/mailman/listinfo/s270-linux 2606W: https://tango.0pointer.de/mailman/listinfo/s270-linux
2601W: http://0pointer.de/lennart/tchibo.html 2607W: http://0pointer.de/lennart/tchibo.html
2602S: Maintained 2608S: Maintained
2603 2609
@@ -2739,8 +2745,8 @@ T: git kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git
2739S: Maintained 2745S: Maintained
2740 2746
2741NETXEN (1/10) GbE SUPPORT 2747NETXEN (1/10) GbE SUPPORT
2742P: Amit S. Kale 2748P: Dhananjay Phadke
2743M: amitkale@netxen.com 2749M: dhananjay@netxen.com
2744L: netdev@vger.kernel.org 2750L: netdev@vger.kernel.org
2745W: http://www.netxen.com 2751W: http://www.netxen.com
2746S: Supported 2752S: Supported
@@ -3611,8 +3617,10 @@ L: linux-kernel@vger.kernel.org ?
3611S: Supported 3617S: Supported
3612 3618
3613SPIDERNET NETWORK DRIVER for CELL 3619SPIDERNET NETWORK DRIVER for CELL
3614P: Linas Vepstas 3620P: Ishizaki Kou
3615M: linas@austin.ibm.com 3621M: kou.ishizaki@toshiba.co.jp
3622P: Jens Osterkamp
3623M: jens@de.ibm.com
3616L: netdev@vger.kernel.org 3624L: netdev@vger.kernel.org
3617S: Supported 3625S: Supported
3618 3626
@@ -4054,6 +4062,14 @@ L: user-mode-linux-user@lists.sourceforge.net
4054W: http://user-mode-linux.sourceforge.net 4062W: http://user-mode-linux.sourceforge.net
4055S: Maintained 4063S: Maintained
4056 4064
4065USERSPACE I/O (UIO)
4066P: Hans J. Koch
4067M: hjk@linutronix.de
4068P: Greg Kroah-Hartman
4069M: gregkh@suse.de
4070L: linux-kernel@vger.kernel.org
4071S: Maintained
4072
4057FAT/VFAT/MSDOS FILESYSTEM: 4073FAT/VFAT/MSDOS FILESYSTEM:
4058P: OGAWA Hirofumi 4074P: OGAWA Hirofumi
4059M: hirofumi@mail.parknet.co.jp 4075M: hirofumi@mail.parknet.co.jp
diff --git a/Makefile b/Makefile
index fbb8dfc063d3..ce641ebee25a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 24 3SUBLEVEL = 24
4EXTRAVERSION = -rc6 4EXTRAVERSION = -rc8
5NAME = Arr Matey! A Hairy Bilge Rat! 5NAME = Arr Matey! A Hairy Bilge Rat!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -12,7 +12,7 @@ NAME = Arr Matey! A Hairy Bilge Rat!
12 12
13# Do not: 13# Do not:
14# o use make's built-in rules and variables 14# o use make's built-in rules and variables
15# (this increases performance and avoid hard-to-debug behavour); 15# (this increases performance and avoids hard-to-debug behaviour);
16# o print "Entering directory ..."; 16# o print "Entering directory ...";
17MAKEFLAGS += -rR --no-print-directory 17MAKEFLAGS += -rR --no-print-directory
18 18
@@ -1329,7 +1329,7 @@ else
1329ALLINCLUDE_ARCHS := $(SRCARCH) 1329ALLINCLUDE_ARCHS := $(SRCARCH)
1330endif 1330endif
1331else 1331else
1332#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behavour. 1332#Allow user to specify only ALLSOURCE_PATHS on the command line, keeping existing behaviour.
1333ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) 1333ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS)
1334endif 1334endif
1335 1335
diff --git a/arch/.gitignore b/arch/.gitignore
new file mode 100644
index 000000000000..741468920320
--- /dev/null
+++ b/arch/.gitignore
@@ -0,0 +1,2 @@
1i386
2x86_64
diff --git a/arch/alpha/math-emu/math.c b/arch/alpha/math-emu/math.c
index ae79dd970b02..58c2669a1dd4 100644
--- a/arch/alpha/math-emu/math.c
+++ b/arch/alpha/math-emu/math.c
@@ -225,7 +225,7 @@ alpha_fp_emul (unsigned long pc)
225 FP_UNPACK_SP(SB, &vb); 225 FP_UNPACK_SP(SB, &vb);
226 DR_c = DB_c; 226 DR_c = DB_c;
227 DR_s = DB_s; 227 DR_s = DB_s;
228 DR_e = DB_e; 228 DR_e = DB_e + (1024 - 128);
229 DR_f = SB_f << (52 - 23); 229 DR_f = SB_f << (52 - 23);
230 goto pack_d; 230 goto pack_d;
231 } 231 }
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c4de2d4664d7..a04f507e7f2c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1072,11 +1072,13 @@ source "drivers/rtc/Kconfig"
1072 1072
1073source "drivers/dma/Kconfig" 1073source "drivers/dma/Kconfig"
1074 1074
1075source "drivers/dca/Kconfig"
1076
1075endmenu 1077endmenu
1076 1078
1077source "fs/Kconfig" 1079source "fs/Kconfig"
1078 1080
1079source "kernel/Kconfig.instrumentation" 1081source "arch/arm/Kconfig.instrumentation"
1080 1082
1081source "arch/arm/Kconfig.debug" 1083source "arch/arm/Kconfig.debug"
1082 1084
diff --git a/arch/arm/Kconfig.instrumentation b/arch/arm/Kconfig.instrumentation
new file mode 100644
index 000000000000..63b8c6d5606a
--- /dev/null
+++ b/arch/arm/Kconfig.instrumentation
@@ -0,0 +1,52 @@
1menuconfig INSTRUMENTATION
2 bool "Instrumentation Support"
3 default y
4 ---help---
5 Say Y here to get to see options related to performance measurement,
6 system-wide debugging, and testing. This option alone does not add any
7 kernel code.
8
9 If you say N, all options in this submenu will be skipped and
10 disabled. If you're trying to debug the kernel itself, go see the
11 Kernel Hacking menu.
12
13if INSTRUMENTATION
14
15config PROFILING
16 bool "Profiling support (EXPERIMENTAL)"
17 help
18 Say Y here to enable the extended profiling support mechanisms used
19 by profilers such as OProfile.
20
21config OPROFILE
22 tristate "OProfile system profiling (EXPERIMENTAL)"
23 depends on PROFILING && !UML
24 help
25 OProfile is a profiling system capable of profiling the
26 whole system, include the kernel, kernel modules, libraries,
27 and applications.
28
29 If unsure, say N.
30
31config OPROFILE_ARMV6
32 bool
33 depends on OPROFILE && CPU_V6 && !SMP
34 default y
35 select OPROFILE_ARM11_CORE
36
37config OPROFILE_MPCORE
38 bool
39 depends on OPROFILE && CPU_V6 && SMP
40 default y
41 select OPROFILE_ARM11_CORE
42
43config OPROFILE_ARM11_CORE
44 bool
45
46config MARKERS
47 bool "Activate markers"
48 help
49 Place an empty function call at each marker site. Can be
50 dynamically changed for a probe function.
51
52endif # INSTRUMENTATION
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index d05b1b2be9fb..53a5ef9e72ee 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -109,6 +109,15 @@ static struct spi_board_info ek_spi_devices[] = {
109#endif 109#endif
110}; 110};
111 111
112static struct i2c_board_info __initdata ek_i2c_devices[] = {
113 {
114 I2C_BOARD_INFO("ics1523", 0x26),
115 },
116 {
117 I2C_BOARD_INFO("dac3550", 0x4d),
118 }
119};
120
112#define EK_FLASH_BASE AT91_CHIPSELECT_0 121#define EK_FLASH_BASE AT91_CHIPSELECT_0
113#define EK_FLASH_SIZE 0x200000 122#define EK_FLASH_SIZE 0x200000
114 123
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index f65baa95986e..d5f6ea14fc7b 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -40,31 +40,29 @@ static int fsample_keymap[] = {
40 KEY(0,1,KEY_RIGHT), 40 KEY(0,1,KEY_RIGHT),
41 KEY(0,2,KEY_LEFT), 41 KEY(0,2,KEY_LEFT),
42 KEY(0,3,KEY_DOWN), 42 KEY(0,3,KEY_DOWN),
43 KEY(0,4,KEY_CENTER), 43 KEY(0,4,KEY_ENTER),
44 KEY(0,5,KEY_0_5), 44 KEY(1,0,KEY_F10),
45 KEY(1,0,KEY_SOFT2),
46 KEY(1,1,KEY_SEND), 45 KEY(1,1,KEY_SEND),
47 KEY(1,2,KEY_END), 46 KEY(1,2,KEY_END),
48 KEY(1,3,KEY_VOLUMEDOWN), 47 KEY(1,3,KEY_VOLUMEDOWN),
49 KEY(1,4,KEY_VOLUMEUP), 48 KEY(1,4,KEY_VOLUMEUP),
50 KEY(1,5,KEY_RECORD), 49 KEY(1,5,KEY_RECORD),
51 KEY(2,0,KEY_SOFT1), 50 KEY(2,0,KEY_F9),
52 KEY(2,1,KEY_3), 51 KEY(2,1,KEY_3),
53 KEY(2,2,KEY_6), 52 KEY(2,2,KEY_6),
54 KEY(2,3,KEY_9), 53 KEY(2,3,KEY_9),
55 KEY(2,4,KEY_SHARP), 54 KEY(2,4,KEY_KPDOT),
56 KEY(2,5,KEY_2_5),
57 KEY(3,0,KEY_BACK), 55 KEY(3,0,KEY_BACK),
58 KEY(3,1,KEY_2), 56 KEY(3,1,KEY_2),
59 KEY(3,2,KEY_5), 57 KEY(3,2,KEY_5),
60 KEY(3,3,KEY_8), 58 KEY(3,3,KEY_8),
61 KEY(3,4,KEY_0), 59 KEY(3,4,KEY_0),
62 KEY(3,5,KEY_HEADSETHOOK), 60 KEY(3,5,KEY_KPSLASH),
63 KEY(4,0,KEY_HOME), 61 KEY(4,0,KEY_HOME),
64 KEY(4,1,KEY_1), 62 KEY(4,1,KEY_1),
65 KEY(4,2,KEY_4), 63 KEY(4,2,KEY_4),
66 KEY(4,3,KEY_7), 64 KEY(4,3,KEY_7),
67 KEY(4,4,KEY_STAR), 65 KEY(4,4,KEY_KPASTERISK),
68 KEY(4,5,KEY_POWER), 66 KEY(4,5,KEY_POWER),
69 0 67 0
70}; 68};
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 22db19a53647..182a98a9df4c 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -36,8 +36,6 @@
36#include <asm/arch/omapfb.h> 36#include <asm/arch/omapfb.h>
37#include <asm/arch/lcd_mipid.h> 37#include <asm/arch/lcd_mipid.h>
38 38
39#include "../plat-omap/dsp/dsp_common.h"
40
41#define ADS7846_PENDOWN_GPIO 15 39#define ADS7846_PENDOWN_GPIO 15
42 40
43static void __init omap_nokia770_init_irq(void) 41static void __init omap_nokia770_init_irq(void)
@@ -318,6 +316,8 @@ static __init int omap_dsp_init(void)
318 out: 316 out:
319 return ret; 317 return ret;
320} 318}
319#else
320#define omap_dsp_init() do {} while (0)
321#endif /* CONFIG_OMAP_DSP */ 321#endif /* CONFIG_OMAP_DSP */
322 322
323static void __init omap_nokia770_init(void) 323static void __init omap_nokia770_init(void)
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 1d5c8d509722..e44437e10eef 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -39,31 +39,29 @@ static int p2_keymap[] = {
39 KEY(0,1,KEY_RIGHT), 39 KEY(0,1,KEY_RIGHT),
40 KEY(0,2,KEY_LEFT), 40 KEY(0,2,KEY_LEFT),
41 KEY(0,3,KEY_DOWN), 41 KEY(0,3,KEY_DOWN),
42 KEY(0,4,KEY_CENTER), 42 KEY(0,4,KEY_ENTER),
43 KEY(0,5,KEY_0_5), 43 KEY(1,0,KEY_F10),
44 KEY(1,0,KEY_SOFT2),
45 KEY(1,1,KEY_SEND), 44 KEY(1,1,KEY_SEND),
46 KEY(1,2,KEY_END), 45 KEY(1,2,KEY_END),
47 KEY(1,3,KEY_VOLUMEDOWN), 46 KEY(1,3,KEY_VOLUMEDOWN),
48 KEY(1,4,KEY_VOLUMEUP), 47 KEY(1,4,KEY_VOLUMEUP),
49 KEY(1,5,KEY_RECORD), 48 KEY(1,5,KEY_RECORD),
50 KEY(2,0,KEY_SOFT1), 49 KEY(2,0,KEY_F9),
51 KEY(2,1,KEY_3), 50 KEY(2,1,KEY_3),
52 KEY(2,2,KEY_6), 51 KEY(2,2,KEY_6),
53 KEY(2,3,KEY_9), 52 KEY(2,3,KEY_9),
54 KEY(2,4,KEY_SHARP), 53 KEY(2,4,KEY_KPDOT),
55 KEY(2,5,KEY_2_5),
56 KEY(3,0,KEY_BACK), 54 KEY(3,0,KEY_BACK),
57 KEY(3,1,KEY_2), 55 KEY(3,1,KEY_2),
58 KEY(3,2,KEY_5), 56 KEY(3,2,KEY_5),
59 KEY(3,3,KEY_8), 57 KEY(3,3,KEY_8),
60 KEY(3,4,KEY_0), 58 KEY(3,4,KEY_0),
61 KEY(3,5,KEY_HEADSETHOOK), 59 KEY(3,5,KEY_KPSLASH),
62 KEY(4,0,KEY_HOME), 60 KEY(4,0,KEY_HOME),
63 KEY(4,1,KEY_1), 61 KEY(4,1,KEY_1),
64 KEY(4,2,KEY_4), 62 KEY(4,2,KEY_4),
65 KEY(4,3,KEY_7), 63 KEY(4,3,KEY_7),
66 KEY(4,4,KEY_STAR), 64 KEY(4,4,KEY_KPASTERISK),
67 KEY(4,5,KEY_POWER), 65 KEY(4,5,KEY_POWER),
68 0 66 0
69}; 67};
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index dcd81f8d0833..9732d5d9466b 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -178,13 +178,19 @@ static void pxa25x_cpu_pm_save(unsigned long *sleep_save)
178 SAVE(GAFR1_L); SAVE(GAFR1_U); 178 SAVE(GAFR1_L); SAVE(GAFR1_U);
179 SAVE(GAFR2_L); SAVE(GAFR2_U); 179 SAVE(GAFR2_L); SAVE(GAFR2_U);
180 180
181 SAVE(ICMR); 181 SAVE(ICMR); ICMR = 0;
182 SAVE(CKEN); 182 SAVE(CKEN);
183 SAVE(PSTR); 183 SAVE(PSTR);
184
185 /* Clear GPIO transition detect bits */
186 GEDR0 = GEDR0; GEDR1 = GEDR1; GEDR2 = GEDR2;
184} 187}
185 188
186static void pxa25x_cpu_pm_restore(unsigned long *sleep_save) 189static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
187{ 190{
191 /* ensure not to come back here if it wasn't intended */
192 PSPR = 0;
193
188 /* restore registers */ 194 /* restore registers */
189 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2); 195 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
190 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2); 196 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
@@ -195,7 +201,12 @@ static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
195 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2); 201 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
196 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2); 202 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2);
197 203
204 PSSR = PSSR_RDH | PSSR_PH;
205
198 RESTORE(CKEN); 206 RESTORE(CKEN);
207
208 ICLR = 0;
209 ICCR = 1;
199 RESTORE(ICMR); 210 RESTORE(ICMR);
200 RESTORE(PSTR); 211 RESTORE(PSTR);
201} 212}
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index aff71fec618a..d0447723b73a 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -43,11 +43,11 @@ pxa_cpu_save_cp:
43pxa_cpu_save_sp: 43pxa_cpu_save_sp:
44 @ preserve phys address of stack 44 @ preserve phys address of stack
45 mov r0, sp 45 mov r0, sp
46 mov r2, lr 46 str lr, [sp, #-4]!
47 bl sleep_phys_sp 47 bl sleep_phys_sp
48 ldr r1, =sleep_save_sp 48 ldr r1, =sleep_save_sp
49 str r0, [r1] 49 str r0, [r1]
50 mov pc, r2 50 ldr pc, [sp], #4
51 51
52/* 52/*
53 * pxa27x_cpu_suspend() 53 * pxa27x_cpu_suspend()
@@ -270,5 +270,3 @@ resume_after_mmu:
270 mar acc0, r2, r3 270 mar acc0, r2, r3
271#endif 271#endif
272 ldmfd sp!, {r4 - r12, pc} @ return to caller 272 ldmfd sp!, {r4 - r12, pc} @ return to caller
273
274
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index 54a2ad6d9ca2..791d0238c68f 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -361,10 +361,12 @@ u32 vfp_estimate_sqrt_significand(u32 exponent, u32 significand);
361 * OP_SCALAR - this operation always operates in scalar mode 361 * OP_SCALAR - this operation always operates in scalar mode
362 * OP_SD - the instruction exceptionally writes to a single precision result. 362 * OP_SD - the instruction exceptionally writes to a single precision result.
363 * OP_DD - the instruction exceptionally writes to a double precision result. 363 * OP_DD - the instruction exceptionally writes to a double precision result.
364 * OP_SM - the instruction exceptionally reads from a single precision operand.
364 */ 365 */
365#define OP_SCALAR (1 << 0) 366#define OP_SCALAR (1 << 0)
366#define OP_SD (1 << 1) 367#define OP_SD (1 << 1)
367#define OP_DD (1 << 1) 368#define OP_DD (1 << 1)
369#define OP_SM (1 << 2)
368 370
369struct op { 371struct op {
370 u32 (* const fn)(int dd, int dn, int dm, u32 fpscr); 372 u32 (* const fn)(int dd, int dn, int dm, u32 fpscr);
diff --git a/arch/arm/vfp/vfpdouble.c b/arch/arm/vfp/vfpdouble.c
index 190a09ad18eb..6cac43bd1d86 100644
--- a/arch/arm/vfp/vfpdouble.c
+++ b/arch/arm/vfp/vfpdouble.c
@@ -668,8 +668,8 @@ static struct op fops_ext[32] = {
668 [FEXT_TO_IDX(FEXT_FCMPZ)] = { vfp_double_fcmpz, OP_SCALAR }, 668 [FEXT_TO_IDX(FEXT_FCMPZ)] = { vfp_double_fcmpz, OP_SCALAR },
669 [FEXT_TO_IDX(FEXT_FCMPEZ)] = { vfp_double_fcmpez, OP_SCALAR }, 669 [FEXT_TO_IDX(FEXT_FCMPEZ)] = { vfp_double_fcmpez, OP_SCALAR },
670 [FEXT_TO_IDX(FEXT_FCVT)] = { vfp_double_fcvts, OP_SCALAR|OP_SD }, 670 [FEXT_TO_IDX(FEXT_FCVT)] = { vfp_double_fcvts, OP_SCALAR|OP_SD },
671 [FEXT_TO_IDX(FEXT_FUITO)] = { vfp_double_fuito, OP_SCALAR }, 671 [FEXT_TO_IDX(FEXT_FUITO)] = { vfp_double_fuito, OP_SCALAR|OP_SM },
672 [FEXT_TO_IDX(FEXT_FSITO)] = { vfp_double_fsito, OP_SCALAR }, 672 [FEXT_TO_IDX(FEXT_FSITO)] = { vfp_double_fsito, OP_SCALAR|OP_SM },
673 [FEXT_TO_IDX(FEXT_FTOUI)] = { vfp_double_ftoui, OP_SCALAR|OP_SD }, 673 [FEXT_TO_IDX(FEXT_FTOUI)] = { vfp_double_ftoui, OP_SCALAR|OP_SD },
674 [FEXT_TO_IDX(FEXT_FTOUIZ)] = { vfp_double_ftouiz, OP_SCALAR|OP_SD }, 674 [FEXT_TO_IDX(FEXT_FTOUIZ)] = { vfp_double_ftouiz, OP_SCALAR|OP_SD },
675 [FEXT_TO_IDX(FEXT_FTOSI)] = { vfp_double_ftosi, OP_SCALAR|OP_SD }, 675 [FEXT_TO_IDX(FEXT_FTOSI)] = { vfp_double_ftosi, OP_SCALAR|OP_SD },
@@ -1128,7 +1128,7 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1128 u32 exceptions = 0; 1128 u32 exceptions = 0;
1129 unsigned int dest; 1129 unsigned int dest;
1130 unsigned int dn = vfp_get_dn(inst); 1130 unsigned int dn = vfp_get_dn(inst);
1131 unsigned int dm = vfp_get_dm(inst); 1131 unsigned int dm;
1132 unsigned int vecitr, veclen, vecstride; 1132 unsigned int vecitr, veclen, vecstride;
1133 struct op *fop; 1133 struct op *fop;
1134 1134
@@ -1146,6 +1146,14 @@ u32 vfp_double_cpdo(u32 inst, u32 fpscr)
1146 dest = vfp_get_dd(inst); 1146 dest = vfp_get_dd(inst);
1147 1147
1148 /* 1148 /*
1149 * f[us]ito takes a sN operand, not a dN operand.
1150 */
1151 if (fop->flags & OP_SM)
1152 dm = vfp_get_sm(inst);
1153 else
1154 dm = vfp_get_dm(inst);
1155
1156 /*
1149 * If destination bank is zero, vector length is always '1'. 1157 * If destination bank is zero, vector length is always '1'.
1150 * ARM DDI0100F C5.1.3, C5.3.2. 1158 * ARM DDI0100F C5.1.3, C5.3.2.
1151 */ 1159 */
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 2a3a7ea5958c..25232ba08119 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -65,6 +65,10 @@ config GENERIC_CALIBRATE_DELAY
65 bool 65 bool
66 default y 66 default y
67 67
68config HARDWARE_PM
69 def_bool y
70 depends on OPROFILE
71
68source "init/Kconfig" 72source "init/Kconfig"
69source "kernel/Kconfig.preempt" 73source "kernel/Kconfig.preempt"
70 74
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index 88eff7f54ea6..1d1936a18133 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -6,136 +6,9 @@
6*! 6*!
7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init 7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
8*! 8*!
9*! $Log: ds1302.c,v $
10*! Revision 1.18 2005/01/24 09:11:26 mikaelam
11*! Minor changes to get DS1302 RTC chip driver to work
12*!
13*! Revision 1.17 2005/01/05 06:11:22 starvik
14*! No need to do local_irq_disable after local_irq_save.
15*!
16*! Revision 1.16 2004/12/13 12:21:52 starvik
17*! Added I/O and DMA allocators from Linux 2.4
18*!
19*! Revision 1.14 2004/08/24 06:48:43 starvik
20*! Whitespace cleanup
21*!
22*! Revision 1.13 2004/05/28 09:26:59 starvik
23*! Modified I2C initialization to work in 2.6.
24*!
25*! Revision 1.12 2004/05/14 07:58:03 starvik
26*! Merge of changes from 2.4
27*!
28*! Revision 1.10 2004/02/04 09:25:12 starvik
29*! Merge of Linux 2.6.2
30*!
31*! Revision 1.9 2003/07/04 08:27:37 starvik
32*! Merge of Linux 2.5.74
33*!
34*! Revision 1.8 2003/04/09 05:20:47 starvik
35*! Merge of Linux 2.5.67
36*!
37*! Revision 1.6 2003/01/09 14:42:51 starvik
38*! Merge of Linux 2.5.55
39*!
40*! Revision 1.4 2002/12/11 13:13:57 starvik
41*! Added arch/ to v10 specific includes
42*! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
43*!
44*! Revision 1.3 2002/11/20 11:56:10 starvik
45*! Merge of Linux 2.5.48
46*!
47*! Revision 1.2 2002/11/18 13:16:06 starvik
48*! Linux 2.5 port of latest 2.4 drivers
49*!
50*! Revision 1.15 2002/10/11 16:14:33 johana
51*! Added CONFIG_ETRAX_DS1302_TRICKLE_CHARGE and initial setting of the
52*! trcklecharge register.
53*!
54*! Revision 1.14 2002/10/10 12:15:38 magnusmn
55*! Added support for having the RST signal on bit g0
56*!
57*! Revision 1.13 2002/05/29 15:16:08 johana
58*! Removed unused variables.
59*!
60*! Revision 1.12 2002/04/10 15:35:25 johana
61*! Moved probe function closer to init function and marked it __init.
62*!
63*! Revision 1.11 2001/06/14 12:35:52 jonashg
64*! The ATA hack is back. It is unfortunately the only way to set g27 to output.
65*!
66*! Revision 1.9 2001/06/14 10:00:14 jonashg
67*! No need for tempudelay to be inline anymore (had to adjust the usec to
68*! loops conversion because of this to make it slow enough to be a udelay).
69*!
70*! Revision 1.8 2001/06/14 08:06:32 jonashg
71*! Made tempudelay delay usecs (well, just a tad more).
72*!
73*! Revision 1.7 2001/06/13 14:18:11 jonashg
74*! Only allow processes with SYS_TIME capability to set time and charge.
75*!
76*! Revision 1.6 2001/06/12 15:22:07 jonashg
77*! * Made init function __init.
78*! * Parameter to out_byte() is unsigned char.
79*! * The magic number 42 has got a name.
80*! * Removed comment about /proc (nothing is exported there).
81*!
82*! Revision 1.5 2001/06/12 14:35:13 jonashg
83*! Gave the module a name and added it to printk's.
84*!
85*! Revision 1.4 2001/05/31 14:53:40 jonashg
86*! Made tempudelay() inline so that the watchdog doesn't reset (see
87*! function comment).
88*!
89*! Revision 1.3 2001/03/26 16:03:06 bjornw
90*! Needs linux/config.h
91*!
92*! Revision 1.2 2001/03/20 19:42:00 bjornw
93*! Use the ETRAX prefix on the DS1302 options
94*!
95*! Revision 1.1 2001/03/20 09:13:50 magnusmn
96*! Linux 2.4 port
97*!
98*! Revision 1.10 2000/07/05 15:38:23 bjornw
99*! Dont update kernel time when a RTC_SET_TIME is done
100*!
101*! Revision 1.9 2000/03/02 15:42:59 macce
102*! * Hack to make RTC work on all 2100/2400
103*!
104*! Revision 1.8 2000/02/23 16:59:18 torbjore
105*! added setup of R_GEN_CONFIG when RTC is connected to the generic port.
106*!
107*! Revision 1.7 2000/01/17 15:51:43 johana
108*! Added RTC_SET_CHARGE ioctl to enable trickle charger.
109*!
110*! Revision 1.6 1999/10/27 13:19:47 bjornw
111*! Added update_xtime_from_cmos which reads back the updated RTC into the kernel.
112*! /dev/rtc calls it now.
113*!
114*! Revision 1.5 1999/10/27 12:39:37 bjornw
115*! Disabled superuser check. Anyone can now set the time.
116*!
117*! Revision 1.4 1999/09/02 13:27:46 pkj
118*! Added shadow for R_PORT_PB_CONFIG.
119*! Renamed port_g_shadow to port_g_data_shadow.
120*!
121*! Revision 1.3 1999/09/02 08:28:06 pkj
122*! Made it possible to select either port PB or the generic port for the RST
123*! signal line to the DS1302 RTC.
124*! Also make sure the RST bit is configured as output on Port PB (if used).
125*!
126*! Revision 1.2 1999/09/01 14:47:20 bjornw
127*! Added support for /dev/rtc operations with ioctl RD_TIME and SET_TIME to read
128*! and set the date. Register as major 121.
129*!
130*! Revision 1.1 1999/09/01 09:45:29 bjornw
131*! Implemented a DS1302 RTC driver.
132*!
133*!
134*! --------------------------------------------------------------------------- 9*! ---------------------------------------------------------------------------
135*! 10*!
136*! (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004 Axis Communications AB, LUND, SWEDEN 11*! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN
137*!
138*! $Id: ds1302.c,v 1.18 2005/01/24 09:11:26 mikaelam Exp $
139*! 12*!
140*!***************************************************************************/ 13*!***************************************************************************/
141 14
@@ -156,6 +29,8 @@
156#include <asm/rtc.h> 29#include <asm/rtc.h>
157#include <asm/arch/io_interface_mux.h> 30#include <asm/arch/io_interface_mux.h>
158 31
32#include "i2c.h"
33
159#define RTC_MAJOR_NR 121 /* local major, change later */ 34#define RTC_MAJOR_NR 121 /* local major, change later */
160 35
161static const char ds1302_name[] = "ds1302"; 36static const char ds1302_name[] = "ds1302";
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
index 3a9114e89edf..f3b327d4ed9c 100644
--- a/arch/cris/arch-v10/kernel/io_interface_mux.c
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -392,6 +392,7 @@ int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id
392 if (((interfaces[ioif].gpio_g_in & gpio_in_pins) != interfaces[ioif].gpio_g_in) || 392 if (((interfaces[ioif].gpio_g_in & gpio_in_pins) != interfaces[ioif].gpio_g_in) ||
393 ((interfaces[ioif].gpio_g_out & gpio_out_pins) != interfaces[ioif].gpio_g_out) || 393 ((interfaces[ioif].gpio_g_out & gpio_out_pins) != interfaces[ioif].gpio_g_out) ||
394 ((interfaces[ioif].gpio_b & gpio_pb_pins) != interfaces[ioif].gpio_b)) { 394 ((interfaces[ioif].gpio_b & gpio_pb_pins) != interfaces[ioif].gpio_b)) {
395 local_irq_restore(flags);
395 printk(KERN_CRIT "cris_request_io_interface: Could not get required pins for interface %u\n", 396 printk(KERN_CRIT "cris_request_io_interface: Could not get required pins for interface %u\n",
396 ioif); 397 ioif);
397 return -EBUSY; 398 return -EBUSY;
diff --git a/arch/cris/arch-v10/kernel/signal.c b/arch/cris/arch-v10/kernel/signal.c
index 41d4a5f93284..b6be705c2a3e 100644
--- a/arch/cris/arch-v10/kernel/signal.c
+++ b/arch/cris/arch-v10/kernel/signal.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Ideas also taken from arch/arm. 8 * Ideas also taken from arch/arm.
9 * 9 *
10 * Copyright (C) 2000, 2001 Axis Communications AB 10 * Copyright (C) 2000-2007 Axis Communications AB
11 * 11 *
12 * Authors: Bjorn Wesen (bjornw@axis.com) 12 * Authors: Bjorn Wesen (bjornw@axis.com)
13 * 13 *
@@ -40,84 +40,30 @@
40 */ 40 */
41#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->irp -= 2; 41#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->irp -= 2;
42 42
43int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs); 43void do_signal(int canrestart, struct pt_regs *regs);
44 44
45/* 45/*
46 * Atomically swap in the new signal mask, and wait for a signal. Define 46 * Atomically swap in the new signal mask, and wait for a signal. Define
47 * dummy arguments to be able to reach the regs argument. (Note that this 47 * dummy arguments to be able to reach the regs argument. (Note that this
48 * arrangement relies on old_sigset_t occupying one register.) 48 * arrangement relies on old_sigset_t occupying one register.)
49 */ 49 */
50int 50int sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof,
51sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, 51 long srp, struct pt_regs *regs)
52 long srp, struct pt_regs *regs)
53{ 52{
54 sigset_t saveset;
55
56 mask &= _BLOCKABLE; 53 mask &= _BLOCKABLE;
57 spin_lock_irq(&current->sighand->siglock); 54 spin_lock_irq(&current->sighand->siglock);
58 saveset = current->blocked; 55 current->saved_sigmask = current->blocked;
59 siginitset(&current->blocked, mask); 56 siginitset(&current->blocked, mask);
60 recalc_sigpending(); 57 recalc_sigpending();
61 spin_unlock_irq(&current->sighand->siglock); 58 spin_unlock_irq(&current->sighand->siglock);
62 59 current->state = TASK_INTERRUPTIBLE;
63 regs->r10 = -EINTR; 60 schedule();
64 while (1) { 61 set_thread_flag(TIF_RESTORE_SIGMASK);
65 current->state = TASK_INTERRUPTIBLE; 62 return -ERESTARTNOHAND;
66 schedule();
67 if (do_signal(0, &saveset, regs))
68 /* We will get here twice: once to call the signal
69 handler, then again to return from the
70 sigsuspend system call. When calling the
71 signal handler, R10 holds the signal number as
72 set through do_signal. The sigsuspend call
73 will return with the restored value set above;
74 always -EINTR. */
75 return regs->r10;
76 }
77} 63}
78 64
79/* Define dummy arguments to be able to reach the regs argument. (Note that 65int sys_sigaction(int sig, const struct old_sigaction __user *act,
80 * this arrangement relies on size_t occupying one register.) 66 struct old_sigaction *oact)
81 */
82int
83sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, long r12, long r13,
84 long mof, long srp, struct pt_regs *regs)
85{
86 sigset_t saveset, newset;
87
88 /* XXX: Don't preclude handling different sized sigset_t's. */
89 if (sigsetsize != sizeof(sigset_t))
90 return -EINVAL;
91
92 if (copy_from_user(&newset, unewset, sizeof(newset)))
93 return -EFAULT;
94 sigdelsetmask(&newset, ~_BLOCKABLE);
95
96 spin_lock_irq(&current->sighand->siglock);
97 saveset = current->blocked;
98 current->blocked = newset;
99 recalc_sigpending();
100 spin_unlock_irq(&current->sighand->siglock);
101
102 regs->r10 = -EINTR;
103 while (1) {
104 current->state = TASK_INTERRUPTIBLE;
105 schedule();
106 if (do_signal(0, &saveset, regs))
107 /* We will get here twice: once to call the signal
108 handler, then again to return from the
109 sigsuspend system call. When calling the
110 signal handler, R10 holds the signal number as
111 set through do_signal. The sigsuspend call
112 will return with the restored value set above;
113 always -EINTR. */
114 return regs->r10;
115 }
116}
117
118int
119sys_sigaction(int sig, const struct old_sigaction __user *act,
120 struct old_sigaction *oact)
121{ 67{
122 struct k_sigaction new_ka, old_ka; 68 struct k_sigaction new_ka, old_ka;
123 int ret; 69 int ret;
@@ -147,8 +93,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
147 return ret; 93 return ret;
148} 94}
149 95
150int 96int sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
151sys_sigaltstack(const stack_t *uss, stack_t __user *uoss)
152{ 97{
153 return do_sigaltstack(uss, uoss, rdusp()); 98 return do_sigaltstack(uss, uoss, rdusp());
154} 99}
@@ -205,7 +150,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
205 150
206 /* TODO: the other ports use regs->orig_XX to disable syscall checks 151 /* TODO: the other ports use regs->orig_XX to disable syscall checks
207 * after this completes, but we don't use that mechanism. maybe we can 152 * after this completes, but we don't use that mechanism. maybe we can
208 * use it now ? 153 * use it now ?
209 */ 154 */
210 155
211 return err; 156 return err;
@@ -216,7 +161,7 @@ badframe:
216 161
217/* Define dummy arguments to be able to reach the regs argument. */ 162/* Define dummy arguments to be able to reach the regs argument. */
218 163
219asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof, 164asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
220 long srp, struct pt_regs *regs) 165 long srp, struct pt_regs *regs)
221{ 166{
222 struct sigframe __user *frame = (struct sigframe *)rdusp(); 167 struct sigframe __user *frame = (struct sigframe *)rdusp();
@@ -243,7 +188,7 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
243 current->blocked = set; 188 current->blocked = set;
244 recalc_sigpending(); 189 recalc_sigpending();
245 spin_unlock_irq(&current->sighand->siglock); 190 spin_unlock_irq(&current->sighand->siglock);
246 191
247 if (restore_sigcontext(regs, &frame->sc)) 192 if (restore_sigcontext(regs, &frame->sc))
248 goto badframe; 193 goto badframe;
249 194
@@ -254,11 +199,11 @@ asmlinkage int sys_sigreturn(long r10, long r11, long r12, long r13, long mof,
254badframe: 199badframe:
255 force_sig(SIGSEGV, current); 200 force_sig(SIGSEGV, current);
256 return 0; 201 return 0;
257} 202}
258 203
259/* Define dummy arguments to be able to reach the regs argument. */ 204/* Define dummy arguments to be able to reach the regs argument. */
260 205
261asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13, 206asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
262 long mof, long srp, struct pt_regs *regs) 207 long mof, long srp, struct pt_regs *regs)
263{ 208{
264 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp(); 209 struct rt_sigframe __user *frame = (struct rt_sigframe *)rdusp();
@@ -282,7 +227,7 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
282 current->blocked = set; 227 current->blocked = set;
283 recalc_sigpending(); 228 recalc_sigpending();
284 spin_unlock_irq(&current->sighand->siglock); 229 spin_unlock_irq(&current->sighand->siglock);
285 230
286 if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) 231 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
287 goto badframe; 232 goto badframe;
288 233
@@ -294,14 +239,14 @@ asmlinkage int sys_rt_sigreturn(long r10, long r11, long r12, long r13,
294badframe: 239badframe:
295 force_sig(SIGSEGV, current); 240 force_sig(SIGSEGV, current);
296 return 0; 241 return 0;
297} 242}
298 243
299/* 244/*
300 * Set up a signal frame. 245 * Set up a signal frame.
301 */ 246 */
302 247
303static int 248static int setup_sigcontext(struct sigcontext __user *sc,
304setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask) 249 struct pt_regs *regs, unsigned long mask)
305{ 250{
306 int err = 0; 251 int err = 0;
307 unsigned long usp = rdusp(); 252 unsigned long usp = rdusp();
@@ -324,10 +269,11 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
324 return err; 269 return err;
325} 270}
326 271
327/* figure out where we want to put the new signal frame - usually on the stack */ 272/* Figure out where we want to put the new signal frame
273 * - usually on the stack. */
328 274
329static inline void __user * 275static inline void __user *
330get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size) 276get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
331{ 277{
332 unsigned long sp = rdusp(); 278 unsigned long sp = rdusp();
333 279
@@ -345,15 +291,15 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
345} 291}
346 292
347/* grab and setup a signal frame. 293/* grab and setup a signal frame.
348 * 294 *
349 * basically we stack a lot of state info, and arrange for the 295 * basically we stack a lot of state info, and arrange for the
350 * user-mode program to return to the kernel using either a 296 * user-mode program to return to the kernel using either a
351 * trampoline which performs the syscall sigreturn, or a provided 297 * trampoline which performs the syscall sigreturn, or a provided
352 * user-mode trampoline. 298 * user-mode trampoline.
353 */ 299 */
354 300
355static void setup_frame(int sig, struct k_sigaction *ka, 301static int setup_frame(int sig, struct k_sigaction *ka,
356 sigset_t *set, struct pt_regs * regs) 302 sigset_t *set, struct pt_regs *regs)
357{ 303{
358 struct sigframe __user *frame; 304 struct sigframe __user *frame;
359 unsigned long return_ip; 305 unsigned long return_ip;
@@ -401,14 +347,15 @@ static void setup_frame(int sig, struct k_sigaction *ka,
401 347
402 wrusp((unsigned long)frame); 348 wrusp((unsigned long)frame);
403 349
404 return; 350 return 0;
405 351
406give_sigsegv: 352give_sigsegv:
407 force_sigsegv(sig, current); 353 force_sigsegv(sig, current);
354 return -EFAULT;
408} 355}
409 356
410static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 357static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
411 sigset_t *set, struct pt_regs * regs) 358 sigset_t *set, struct pt_regs *regs)
412{ 359{
413 struct rt_sigframe __user *frame; 360 struct rt_sigframe __user *frame;
414 unsigned long return_ip; 361 unsigned long return_ip;
@@ -443,9 +390,10 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
443 /* trampoline - the desired return ip is the retcode itself */ 390 /* trampoline - the desired return ip is the retcode itself */
444 return_ip = (unsigned long)&frame->retcode; 391 return_ip = (unsigned long)&frame->retcode;
445 /* This is movu.w __NR_rt_sigreturn, r9; break 13; */ 392 /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
446 err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0)); 393 err |= __put_user(0x9c5f, (short __user *)(frame->retcode+0));
447 err |= __put_user(__NR_rt_sigreturn, (short __user*)(frame->retcode+2)); 394 err |= __put_user(__NR_rt_sigreturn,
448 err |= __put_user(0xe93d, (short __user*)(frame->retcode+4)); 395 (short __user *)(frame->retcode+2));
396 err |= __put_user(0xe93d, (short __user *)(frame->retcode+4));
449 } 397 }
450 398
451 if (err) 399 if (err)
@@ -455,73 +403,81 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
455 403
456 /* Set up registers for signal handler */ 404 /* Set up registers for signal handler */
457 405
458 regs->irp = (unsigned long) ka->sa.sa_handler; /* what we enter NOW */ 406 /* What we enter NOW */
459 regs->srp = return_ip; /* what we enter LATER */ 407 regs->irp = (unsigned long) ka->sa.sa_handler;
460 regs->r10 = sig; /* first argument is signo */ 408 /* What we enter LATER */
461 regs->r11 = (unsigned long) &frame->info; /* second argument is (siginfo_t *) */ 409 regs->srp = return_ip;
462 regs->r12 = 0; /* third argument is unused */ 410 /* First argument is signo */
463 411 regs->r10 = sig;
464 /* actually move the usp to reflect the stacked frame */ 412 /* Second argument is (siginfo_t *) */
465 413 regs->r11 = (unsigned long)&frame->info;
414 /* Third argument is unused */
415 regs->r12 = 0;
416
417 /* Actually move the usp to reflect the stacked frame */
466 wrusp((unsigned long)frame); 418 wrusp((unsigned long)frame);
467 419
468 return; 420 return 0;
469 421
470give_sigsegv: 422give_sigsegv:
471 force_sigsegv(sig, current); 423 force_sigsegv(sig, current);
424 return -EFAULT;
472} 425}
473 426
474/* 427/*
475 * OK, we're invoking a handler 428 * OK, we're invoking a handler
476 */ 429 */
477 430
478static inline void 431static inline int handle_signal(int canrestart, unsigned long sig,
479handle_signal(int canrestart, unsigned long sig, 432 siginfo_t *info, struct k_sigaction *ka,
480 siginfo_t *info, struct k_sigaction *ka, 433 sigset_t *oldset, struct pt_regs *regs)
481 sigset_t *oldset, struct pt_regs * regs)
482{ 434{
435 int ret;
436
483 /* Are we from a system call? */ 437 /* Are we from a system call? */
484 if (canrestart) { 438 if (canrestart) {
485 /* If so, check system call restarting.. */ 439 /* If so, check system call restarting.. */
486 switch (regs->r10) { 440 switch (regs->r10) {
487 case -ERESTART_RESTARTBLOCK: 441 case -ERESTART_RESTARTBLOCK:
488 case -ERESTARTNOHAND: 442 case -ERESTARTNOHAND:
489 /* ERESTARTNOHAND means that the syscall should only be 443 /* ERESTARTNOHAND means that the syscall should
490 restarted if there was no handler for the signal, and since 444 * only be restarted if there was no handler for
491 we only get here if there is a handler, we don't restart */ 445 * the signal, and since we only get here if there
446 * is a handler, we don't restart */
447 regs->r10 = -EINTR;
448 break;
449 case -ERESTARTSYS:
450 /* ERESTARTSYS means to restart the syscall if
451 * there is no handler or the handler was
452 * registered with SA_RESTART */
453 if (!(ka->sa.sa_flags & SA_RESTART)) {
492 regs->r10 = -EINTR; 454 regs->r10 = -EINTR;
493 break; 455 break;
494 456 }
495 case -ERESTARTSYS: 457 /* fallthrough */
496 /* ERESTARTSYS means to restart the syscall if there is no 458 case -ERESTARTNOINTR:
497 handler or the handler was registered with SA_RESTART */ 459 /* ERESTARTNOINTR means that the syscall should
498 if (!(ka->sa.sa_flags & SA_RESTART)) { 460 * be called again after the signal handler returns. */
499 regs->r10 = -EINTR; 461 RESTART_CRIS_SYS(regs);
500 break;
501 }
502 /* fallthrough */
503 case -ERESTARTNOINTR:
504 /* ERESTARTNOINTR means that the syscall should be called again
505 after the signal handler returns. */
506 RESTART_CRIS_SYS(regs);
507 } 462 }
508 } 463 }
509 464
510 /* Set up the stack frame */ 465 /* Set up the stack frame */
511 if (ka->sa.sa_flags & SA_SIGINFO) 466 if (ka->sa.sa_flags & SA_SIGINFO)
512 setup_rt_frame(sig, ka, info, oldset, regs); 467 ret = setup_rt_frame(sig, ka, info, oldset, regs);
513 else 468 else
514 setup_frame(sig, ka, oldset, regs); 469 ret = setup_frame(sig, ka, oldset, regs);
515 470
516 if (ka->sa.sa_flags & SA_ONESHOT) 471 if (ret == 0) {
517 ka->sa.sa_handler = SIG_DFL; 472 spin_lock_irq(&current->sighand->siglock);
518 473 sigorsets(&current->blocked, &current->blocked,
519 spin_lock_irq(&current->sighand->siglock); 474 &ka->sa.sa_mask);
520 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 475 if (!(ka->sa.sa_flags & SA_NODEFER))
521 if (!(ka->sa.sa_flags & SA_NODEFER)) 476 sigaddset(&current->blocked, sig);
522 sigaddset(&current->blocked,sig); 477 recalc_sigpending();
523 recalc_sigpending(); 478 spin_unlock_irq(&current->sighand->siglock);
524 spin_unlock_irq(&current->sighand->siglock); 479 }
480 return ret;
525} 481}
526 482
527/* 483/*
@@ -536,11 +492,12 @@ handle_signal(int canrestart, unsigned long sig,
536 * mode below. 492 * mode below.
537 */ 493 */
538 494
539int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs) 495void do_signal(int canrestart, struct pt_regs *regs)
540{ 496{
541 siginfo_t info; 497 siginfo_t info;
542 int signr; 498 int signr;
543 struct k_sigaction ka; 499 struct k_sigaction ka;
500 sigset_t *oldset;
544 501
545 /* 502 /*
546 * We want the common case to go fast, which 503 * We want the common case to go fast, which
@@ -549,16 +506,26 @@ int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
549 * if so. 506 * if so.
550 */ 507 */
551 if (!user_mode(regs)) 508 if (!user_mode(regs))
552 return 1; 509 return;
553 510
554 if (!oldset) 511 if (test_thread_flag(TIF_RESTORE_SIGMASK))
512 oldset = &current->saved_sigmask;
513 else
555 oldset = &current->blocked; 514 oldset = &current->blocked;
556 515
557 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 516 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
558 if (signr > 0) { 517 if (signr > 0) {
559 /* Whee! Actually deliver the signal. */ 518 /* Whee! Actually deliver the signal. */
560 handle_signal(canrestart, signr, &info, &ka, oldset, regs); 519 if (handle_signal(canrestart, signr, &info, &ka,
561 return 1; 520 oldset, regs)) {
521 /* a signal was successfully delivered; the saved
522 * sigmask will have been stored in the signal frame,
523 * and will be restored by sigreturn, so we can simply
524 * clear the TIF_RESTORE_SIGMASK flag */
525 if (test_thread_flag(TIF_RESTORE_SIGMASK))
526 clear_thread_flag(TIF_RESTORE_SIGMASK);
527 }
528 return;
562 } 529 }
563 530
564 /* Did we come from a system call? */ 531 /* Did we come from a system call? */
@@ -569,10 +536,16 @@ int do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
569 regs->r10 == -ERESTARTNOINTR) { 536 regs->r10 == -ERESTARTNOINTR) {
570 RESTART_CRIS_SYS(regs); 537 RESTART_CRIS_SYS(regs);
571 } 538 }
572 if (regs->r10 == -ERESTART_RESTARTBLOCK){ 539 if (regs->r10 == -ERESTART_RESTARTBLOCK) {
573 regs->r10 = __NR_restart_syscall; 540 regs->r10 = __NR_restart_syscall;
574 regs->irp -= 2; 541 regs->irp -= 2;
575 } 542 }
576 } 543 }
577 return 0; 544
545 /* if there's no signal to deliver, we just put the saved sigmask
546 * back */
547 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
548 clear_thread_flag(TIF_RESTORE_SIGMASK);
549 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
550 }
578} 551}
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 5976f6199c47..9310a7b476e9 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -13,6 +13,7 @@
13#include <linux/swap.h> 13#include <linux/swap.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/vmstat.h>
16#include <asm/arch/svinto.h> 17#include <asm/arch/svinto.h>
17#include <asm/types.h> 18#include <asm/types.h>
18#include <asm/signal.h> 19#include <asm/signal.h>
diff --git a/arch/cris/arch-v10/vmlinux.lds.S b/arch/cris/arch-v10/vmlinux.lds.S
index 9859d49d088b..97a7876ed681 100644
--- a/arch/cris/arch-v10/vmlinux.lds.S
+++ b/arch/cris/arch-v10/vmlinux.lds.S
@@ -9,7 +9,8 @@
9 */ 9 */
10 10
11#include <asm-generic/vmlinux.lds.h> 11#include <asm-generic/vmlinux.lds.h>
12 12#include <asm/page.h>
13
13jiffies = jiffies_64; 14jiffies = jiffies_64;
14SECTIONS 15SECTIONS
15{ 16{
@@ -23,7 +24,7 @@ SECTIONS
23 _stext = .; 24 _stext = .;
24 __stext = .; 25 __stext = .;
25 .text : { 26 .text : {
26 *(.text) 27 TEXT_TEXT
27 SCHED_TEXT 28 SCHED_TEXT
28 LOCK_TEXT 29 LOCK_TEXT
29 *(.fixup) 30 *(.fixup)
@@ -49,10 +50,10 @@ SECTIONS
49 __edata = . ; /* End of data section */ 50 __edata = . ; /* End of data section */
50 _edata = . ; 51 _edata = . ;
51 52
52 . = ALIGN(8192); /* init_task and stack, must be aligned */ 53 . = ALIGN(PAGE_SIZE); /* init_task and stack, must be aligned */
53 .data.init_task : { *(.data.init_task) } 54 .data.init_task : { *(.data.init_task) }
54 55
55 . = ALIGN(8192); /* Init code and data */ 56 . = ALIGN(PAGE_SIZE); /* Init code and data */
56 __init_begin = .; 57 __init_begin = .;
57 .init.text : { 58 .init.text : {
58 _sinittext = .; 59 _sinittext = .;
@@ -66,13 +67,7 @@ SECTIONS
66 __setup_end = .; 67 __setup_end = .;
67 .initcall.init : { 68 .initcall.init : {
68 __initcall_start = .; 69 __initcall_start = .;
69 *(.initcall1.init); 70 INITCALLS
70 *(.initcall2.init);
71 *(.initcall3.init);
72 *(.initcall4.init);
73 *(.initcall5.init);
74 *(.initcall6.init);
75 *(.initcall7.init);
76 __initcall_end = .; 71 __initcall_end = .;
77 } 72 }
78 73
@@ -88,16 +83,18 @@ SECTIONS
88 __initramfs_start = .; 83 __initramfs_start = .;
89 *(.init.ramfs) 84 *(.init.ramfs)
90 __initramfs_end = .; 85 __initramfs_end = .;
91 /* We fill to the next page, so we can discard all init
92 pages without needing to consider what payload might be
93 appended to the kernel image. */
94 FILL (0);
95 . = ALIGN (8192);
96 } 86 }
97#endif 87#endif
98
99 __vmlinux_end = .; /* last address of the physical file */ 88 __vmlinux_end = .; /* last address of the physical file */
100 __init_end = .; 89
90 /*
91 * We fill to the next page, so we can discard all init
92 * pages without needing to consider what payload might be
93 * appended to the kernel image.
94 */
95 . = ALIGN(PAGE_SIZE);
96
97 __init_end = .;
101 98
102 __data_end = . ; /* Move to _edata ? */ 99 __data_end = . ; /* Move to _edata ? */
103 __bss_start = .; /* BSS */ 100 __bss_start = .; /* BSS */
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 2173de9fe917..f6a1aeb742b3 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -1488,16 +1488,19 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1488 case LDFA_OP: 1488 case LDFA_OP:
1489 case LDFCCLR_OP: 1489 case LDFCCLR_OP:
1490 case LDFCNC_OP: 1490 case LDFCNC_OP:
1491 case LDF_IMM_OP:
1492 case LDFA_IMM_OP:
1493 case LDFCCLR_IMM_OP:
1494 case LDFCNC_IMM_OP:
1495 if (u.insn.x) 1491 if (u.insn.x)
1496 ret = emulate_load_floatpair(ifa, u.insn, regs); 1492 ret = emulate_load_floatpair(ifa, u.insn, regs);
1497 else 1493 else
1498 ret = emulate_load_float(ifa, u.insn, regs); 1494 ret = emulate_load_float(ifa, u.insn, regs);
1499 break; 1495 break;
1500 1496
1497 case LDF_IMM_OP:
1498 case LDFA_IMM_OP:
1499 case LDFCCLR_IMM_OP:
1500 case LDFCNC_IMM_OP:
1501 ret = emulate_load_float(ifa, u.insn, regs);
1502 break;
1503
1501 case STF_OP: 1504 case STF_OP:
1502 case STF_IMM_OP: 1505 case STF_IMM_OP:
1503 ret = emulate_store_float(ifa, u.insn, regs); 1506 ret = emulate_store_float(ifa, u.insn, regs);
diff --git a/arch/ia64/sn/kernel/xp_nofault.S b/arch/ia64/sn/kernel/xp_nofault.S
index 54e8973b6e99..98e7c7dbfdd8 100644
--- a/arch/ia64/sn/kernel/xp_nofault.S
+++ b/arch/ia64/sn/kernel/xp_nofault.S
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -14,6 +14,11 @@
14 * PIO read fails, the MCA handler will force the error to look 14 * PIO read fails, the MCA handler will force the error to look
15 * corrected and vector to the xp_error_PIOR which will return an error. 15 * corrected and vector to the xp_error_PIOR which will return an error.
16 * 16 *
17 * The definition of "consumption" and the time it takes for an MCA
18 * to surface is processor implementation specific. This code
19 * is sufficient on Itanium through the Montvale processor family.
20 * It may need to be adjusted for future processor implementations.
21 *
17 * extern int xp_nofault_PIOR(void *remote_register); 22 * extern int xp_nofault_PIOR(void *remote_register);
18 */ 23 */
19 24
@@ -22,11 +27,10 @@ xp_nofault_PIOR:
22 mov r8=r0 // Stage a success return value 27 mov r8=r0 // Stage a success return value
23 ld8.acq r9=[r32];; // PIO Read the specified register 28 ld8.acq r9=[r32];; // PIO Read the specified register
24 adds r9=1,r9;; // Add to force consumption 29 adds r9=1,r9;; // Add to force consumption
25 or r9=r9,r9;; // Or to force consumption 30 srlz.i;; // Allow time for MCA to surface
26 br.ret.sptk.many b0;; // Return success 31 br.ret.sptk.many b0;; // Return success
27 32
28 .global xp_error_PIOR 33 .global xp_error_PIOR
29xp_error_PIOR: 34xp_error_PIOR:
30 mov r8=1 // Return value of 1 35 mov r8=1 // Return value of 1
31 br.ret.sptk.many b0;; // Return failure 36 br.ret.sptk.many b0;; // Return failure
32
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index c6fc405a6c8e..b22c043b6ef8 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -59,6 +59,8 @@ config BCM47XX
59 select SYS_SUPPORTS_LITTLE_ENDIAN 59 select SYS_SUPPORTS_LITTLE_ENDIAN
60 select SSB 60 select SSB
61 select SSB_DRIVER_MIPS 61 select SSB_DRIVER_MIPS
62 select SSB_DRIVER_EXTIF
63 select SSB_PCICORE_HOSTMODE if PCI
62 select GENERIC_GPIO 64 select GENERIC_GPIO
63 select SYS_HAS_EARLY_PRINTK 65 select SYS_HAS_EARLY_PRINTK
64 select CFE 66 select CFE
@@ -992,8 +994,6 @@ config BOOT_ELF64
992 994
993menu "CPU selection" 995menu "CPU selection"
994 996
995source "kernel/time/Kconfig"
996
997choice 997choice
998 prompt "CPU type" 998 prompt "CPU type"
999 default CPU_R4X00 999 default CPU_R4X00
@@ -1768,6 +1768,8 @@ config NR_CPUS
1768 performance should round up your number of processors to the next 1768 performance should round up your number of processors to the next
1769 power of two. 1769 power of two.
1770 1770
1771source "kernel/time/Kconfig"
1772
1771# 1773#
1772# Timer Interrupt Frequency Configuration 1774# Timer Interrupt Frequency Configuration
1773# 1775#
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 6fa70a36a250..ce771487567d 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 pci support. 3 * Alchemy/AMD Au1x00 PCI support.
4 * 4 *
5 * Copyright 2001,2002,2003 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com 7 * ppopov@mvista.com or source@mvista.com
8 * 8 *
@@ -66,6 +66,8 @@ static unsigned long virt_io_addr;
66 66
67static int __init au1x_pci_setup(void) 67static int __init au1x_pci_setup(void)
68{ 68{
69 extern void au1x_pci_cfg_init(void);
70
69#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550) 71#if defined(CONFIG_SOC_AU1500) || defined(CONFIG_SOC_AU1550)
70 virt_io_addr = (unsigned long)ioremap(Au1500_PCI_IO_START, 72 virt_io_addr = (unsigned long)ioremap(Au1500_PCI_IO_START,
71 Au1500_PCI_IO_END - Au1500_PCI_IO_START + 1); 73 Au1500_PCI_IO_END - Au1500_PCI_IO_START + 1);
@@ -94,6 +96,8 @@ static int __init au1x_pci_setup(void)
94 set_io_port_base(virt_io_addr); 96 set_io_port_base(virt_io_addr);
95#endif 97#endif
96 98
99 au1x_pci_cfg_init();
100
97 register_pci_controller(&au1x_controller); 101 register_pci_controller(&au1x_controller);
98 return 0; 102 return 0;
99} 103}
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
index db330e811025..d1ba701c9dd1 100644
--- a/arch/mips/cobalt/console.c
+++ b/arch/mips/cobalt/console.c
@@ -4,10 +4,15 @@
4#include <linux/io.h> 4#include <linux/io.h>
5#include <linux/serial_reg.h> 5#include <linux/serial_reg.h>
6 6
7#include <cobalt.h>
8
7#define UART_BASE ((void __iomem *)CKSEG1ADDR(0x1c800000)) 9#define UART_BASE ((void __iomem *)CKSEG1ADDR(0x1c800000))
8 10
9void prom_putchar(char c) 11void prom_putchar(char c)
10{ 12{
13 if (cobalt_board_id <= COBALT_BRD_ID_QUBE1)
14 return;
15
11 while (!(readb(UART_BASE + UART_LSR) & UART_LSR_THRE)) 16 while (!(readb(UART_BASE + UART_LSR) & UART_LSR_THRE))
12 ; 17 ;
13 18
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 236768731063..50be56c9e9ef 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -136,7 +136,8 @@ EXPORT(_stext)
136 * kernel load address. This is needed because this platform does 136 * kernel load address. This is needed because this platform does
137 * not have a ELF loader yet. 137 * not have a ELF loader yet.
138 */ 138 */
139 __INIT 139FEXPORT(__kernel_entry)
140 j kernel_entry
140#endif 141#endif
141 142
142 __INIT_REFOK 143 __INIT_REFOK
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 7f6ddcb5d485..f8a535afce39 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -269,7 +269,7 @@ static void __init bootmem_init(void)
269 269
270static void __init bootmem_init(void) 270static void __init bootmem_init(void)
271{ 271{
272 unsigned long init_begin, reserved_end; 272 unsigned long reserved_end;
273 unsigned long mapstart = ~0UL; 273 unsigned long mapstart = ~0UL;
274 unsigned long bootmap_size; 274 unsigned long bootmap_size;
275 int i; 275 int i;
@@ -344,7 +344,6 @@ static void __init bootmem_init(void)
344 min_low_pfn, max_low_pfn); 344 min_low_pfn, max_low_pfn);
345 345
346 346
347 init_begin = PFN_UP(__pa_symbol(&__init_begin));
348 for (i = 0; i < boot_mem_map.nr_map; i++) { 347 for (i = 0; i < boot_mem_map.nr_map; i++) {
349 unsigned long start, end; 348 unsigned long start, end;
350 349
@@ -352,8 +351,8 @@ static void __init bootmem_init(void)
352 end = PFN_DOWN(boot_mem_map.map[i].addr 351 end = PFN_DOWN(boot_mem_map.map[i].addr
353 + boot_mem_map.map[i].size); 352 + boot_mem_map.map[i].size);
354 353
355 if (start <= init_begin) 354 if (start <= min_low_pfn)
356 start = init_begin; 355 start = min_low_pfn;
357 if (start >= end) 356 if (start >= end)
358 continue; 357 continue;
359 358
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 1ecfbb7eba6c..2995be1ab3ca 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -147,9 +147,9 @@ static __init int cpu_has_mfc0_count_bug(void)
147 return 1; 147 return 1;
148 148
149 /* 149 /*
150 * I don't have erratas for newer R4400 so be paranoid. 150 * we assume newer revisions are ok
151 */ 151 */
152 return 1; 152 return 0;
153 } 153 }
154 154
155 return 0; 155 return 0;
diff --git a/arch/mips/lasat/image/Makefile b/arch/mips/lasat/image/Makefile
index 5332449ec040..460626b6d62f 100644
--- a/arch/mips/lasat/image/Makefile
+++ b/arch/mips/lasat/image/Makefile
@@ -12,11 +12,11 @@ endif
12 12
13MKLASATIMG = mklasatimg 13MKLASATIMG = mklasatimg
14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200 14MKLASATIMG_ARCH = mq2,mqpro,sp100,sp200
15KERNEL_IMAGE = $(TOPDIR)/vmlinux 15KERNEL_IMAGE = vmlinux
16KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ ) 16KERNEL_START = $(shell $(NM) $(KERNEL_IMAGE) | grep " _text" | cut -f1 -d\ )
17KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ ) 17KERNEL_ENTRY = $(shell $(NM) $(KERNEL_IMAGE) | grep kernel_entry | cut -f1 -d\ )
18 18
19LDSCRIPT= -L$(obj) -Tromscript.normal 19LDSCRIPT= -L$(srctree)/$(src) -Tromscript.normal
20 20
21HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \ 21HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
22 -D_kernel_entry=0x$(KERNEL_ENTRY) \ 22 -D_kernel_entry=0x$(KERNEL_ENTRY) \
@@ -24,7 +24,7 @@ HEAD_DEFINES := -D_kernel_start=0x$(KERNEL_START) \
24 -D TIMESTAMP=$(shell date +%s) 24 -D TIMESTAMP=$(shell date +%s)
25 25
26$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE) 26$(obj)/head.o: $(obj)/head.S $(KERNEL_IMAGE)
27 $(CC) -fno-pic $(HEAD_DEFINES) -I$(TOPDIR)/include -c -o $@ $< 27 $(CC) -fno-pic $(HEAD_DEFINES) $(LINUXINCLUDE) -c -o $@ $<
28 28
29OBJECTS = head.o kImage.o 29OBJECTS = head.o kImage.o
30 30
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index 2c5c27c8e86d..dc272c188233 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -169,7 +169,6 @@ void __init prom_meminit(void)
169 169
170void __init prom_free_prom_memory(void) 170void __init prom_free_prom_memory(void)
171{ 171{
172#if 0 /* for now ... */
173 unsigned long addr; 172 unsigned long addr;
174 int i; 173 int i;
175 174
@@ -181,5 +180,4 @@ void __init prom_free_prom_memory(void)
181 free_init_pages("prom memory", 180 free_init_pages("prom memory",
182 addr, addr + boot_mem_map.map[i].size); 181 addr, addr + boot_mem_map.map[i].size);
183 } 182 }
184#endif
185} 183}
diff --git a/arch/mips/mips-boards/generic/reset.c b/arch/mips/mips-boards/generic/reset.c
index 7a1bb51f81ee..583d468d98a9 100644
--- a/arch/mips/mips-boards/generic/reset.c
+++ b/arch/mips/mips-boards/generic/reset.c
@@ -39,16 +39,18 @@ static void atlas_machine_power_off(void);
39 39
40static void mips_machine_restart(char *command) 40static void mips_machine_restart(char *command)
41{ 41{
42 unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); 42 unsigned int __iomem *softres_reg =
43 ioremap(SOFTRES_REG, sizeof(unsigned int));
43 44
44 writew(GORESET, softres_reg); 45 __raw_writel(GORESET, softres_reg);
45} 46}
46 47
47static void mips_machine_halt(void) 48static void mips_machine_halt(void)
48{ 49{
49 unsigned int __iomem *softres_reg = ioremap(SOFTRES_REG, sizeof(unsigned int)); 50 unsigned int __iomem *softres_reg =
51 ioremap(SOFTRES_REG, sizeof(unsigned int));
50 52
51 writew(GORESET, softres_reg); 53 __raw_writel(GORESET, softres_reg);
52} 54}
53 55
54#if defined(CONFIG_MIPS_ATLAS) 56#if defined(CONFIG_MIPS_ATLAS)
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index 9a2636e56243..bc43a5c2224d 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -149,7 +149,7 @@ void __init plat_mem_setup(void)
149 /* Check PCI clock */ 149 /* Check PCI clock */
150 { 150 {
151 unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int)); 151 unsigned int __iomem *jmpr_p = (unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
152 int jmpr = (readw(jmpr_p) >> 2) & 0x07; 152 int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
153 static const int pciclocks[] __initdata = { 153 static const int pciclocks[] __initdata = {
154 33, 20, 25, 30, 12, 16, 37, 10 154 33, 20, 25, 30, 12, 16, 37, 10
155 }; 155 };
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index ae76795685cc..810535dd091b 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -45,7 +45,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp)
45 /* ignore region specifiers */ 45 /* ignore region specifiers */
46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM); 46 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
47 47
48#ifdef CONFIG_ZONE_DMA32 48#ifdef CONFIG_ZONE_DMA
49 if (dev == NULL) 49 if (dev == NULL)
50 gfp |= __GFP_DMA; 50 gfp |= __GFP_DMA;
51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24)) 51 else if (dev->coherent_dma_mask < DMA_BIT_MASK(24))
diff --git a/arch/mips/pci/fixup-cobalt.c b/arch/mips/pci/fixup-cobalt.c
index f7df1142912b..9553b14002dd 100644
--- a/arch/mips/pci/fixup-cobalt.c
+++ b/arch/mips/pci/fixup-cobalt.c
@@ -177,7 +177,7 @@ static char irq_tab_raq2[] __initdata = {
177 177
178int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 178int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
179{ 179{
180 if (cobalt_board_id < COBALT_BRD_ID_QUBE2) 180 if (cobalt_board_id <= COBALT_BRD_ID_QUBE1)
181 return irq_tab_qube1[slot]; 181 return irq_tab_qube1[slot];
182 182
183 if (cobalt_board_id == COBALT_BRD_ID_RAQ2) 183 if (cobalt_board_id == COBALT_BRD_ID_RAQ2)
diff --git a/arch/mips/pci/ops-au1000.c b/arch/mips/pci/ops-au1000.c
index 6b29904acf45..1314bd58f036 100644
--- a/arch/mips/pci/ops-au1000.c
+++ b/arch/mips/pci/ops-au1000.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * BRIEF MODULE DESCRIPTION 2 * BRIEF MODULE DESCRIPTION
3 * Alchemy/AMD Au1x00 pci support. 3 * Alchemy/AMD Au1x00 PCI support.
4 * 4 *
5 * Copyright 2001,2002,2003 MontaVista Software Inc. 5 * Copyright 2001-2003, 2007 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc. 6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com 7 * ppopov@mvista.com or source@mvista.com
8 * 8 *
@@ -69,10 +69,27 @@ void mod_wired_entry(int entry, unsigned long entrylo0,
69 write_c0_pagemask(old_pagemask); 69 write_c0_pagemask(old_pagemask);
70} 70}
71 71
72struct vm_struct *pci_cfg_vm; 72static struct vm_struct *pci_cfg_vm;
73static int pci_cfg_wired_entry; 73static int pci_cfg_wired_entry;
74static int first_cfg = 1; 74static unsigned long last_entryLo0, last_entryLo1;
75unsigned long last_entryLo0, last_entryLo1; 75
76/*
77 * We can't ioremap the entire pci config space because it's too large.
78 * Nor can we call ioremap dynamically because some device drivers use
79 * the PCI config routines from within interrupt handlers and that
80 * becomes a problem in get_vm_area(). We use one wired TLB to handle
81 * all config accesses for all busses.
82 */
83void __init au1x_pci_cfg_init(void)
84{
85 /* Reserve a wired entry for PCI config accesses */
86 pci_cfg_vm = get_vm_area(0x2000, VM_IOREMAP);
87 if (!pci_cfg_vm)
88 panic(KERN_ERR "PCI unable to get vm area\n");
89 pci_cfg_wired_entry = read_c0_wired();
90 add_wired_entry(0, 0, (unsigned long)pci_cfg_vm->addr, PM_4K);
91 last_entryLo0 = last_entryLo1 = 0xffffffff;
92}
76 93
77static int config_access(unsigned char access_type, struct pci_bus *bus, 94static int config_access(unsigned char access_type, struct pci_bus *bus,
78 unsigned int dev_fn, unsigned char where, 95 unsigned int dev_fn, unsigned char where,
@@ -97,27 +114,6 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
97 Au1500_PCI_STATCMD); 114 Au1500_PCI_STATCMD);
98 au_sync_udelay(1); 115 au_sync_udelay(1);
99 116
100 /*
101 * We can't ioremap the entire pci config space because it's
102 * too large. Nor can we call ioremap dynamically because some
103 * device drivers use the pci config routines from within
104 * interrupt handlers and that becomes a problem in get_vm_area().
105 * We use one wired tlb to handle all config accesses for all
106 * busses. To improve performance, if the current device
107 * is the same as the last device accessed, we don't touch the
108 * tlb.
109 */
110 if (first_cfg) {
111 /* reserve a wired entry for pci config accesses */
112 first_cfg = 0;
113 pci_cfg_vm = get_vm_area(0x2000, VM_IOREMAP);
114 if (!pci_cfg_vm)
115 panic(KERN_ERR "PCI unable to get vm area\n");
116 pci_cfg_wired_entry = read_c0_wired();
117 add_wired_entry(0, 0, (unsigned long)pci_cfg_vm->addr, PM_4K);
118 last_entryLo0 = last_entryLo1 = 0xffffffff;
119 }
120
121 /* Allow board vendors to implement their own off-chip idsel. 117 /* Allow board vendors to implement their own off-chip idsel.
122 * If it doesn't succeed, may as well bail out at this point. 118 * If it doesn't succeed, may as well bail out at this point.
123 */ 119 */
@@ -144,9 +140,12 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
144 /* page boundary */ 140 /* page boundary */
145 cfg_base = cfg_base & PAGE_MASK; 141 cfg_base = cfg_base & PAGE_MASK;
146 142
143 /*
144 * To improve performance, if the current device is the same as
145 * the last device accessed, we don't touch the TLB.
146 */
147 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7; 147 entryLo0 = (6 << 26) | (cfg_base >> 6) | (2 << 3) | 7;
148 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7; 148 entryLo1 = (6 << 26) | (cfg_base >> 6) | (0x1000 >> 6) | (2 << 3) | 7;
149
150 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) { 149 if ((entryLo0 != last_entryLo0) || (entryLo1 != last_entryLo1)) {
151 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1, 150 mod_wired_entry(pci_cfg_wired_entry, entryLo0, entryLo1,
152 (unsigned long)pci_cfg_vm->addr, PM_4K); 151 (unsigned long)pci_cfg_vm->addr, PM_4K);
diff --git a/arch/mips/pci/ops-mace.c b/arch/mips/pci/ops-mace.c
index fe5451449304..e95881897ec9 100644
--- a/arch/mips/pci/ops-mace.c
+++ b/arch/mips/pci/ops-mace.c
@@ -42,6 +42,10 @@ static int
42mace_pci_read_config(struct pci_bus *bus, unsigned int devfn, 42mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
43 int reg, int size, u32 *val) 43 int reg, int size, u32 *val)
44{ 44{
45 u32 control = mace->pci.control;
46
47 /* disable master aborts interrupts during config read */
48 mace->pci.control = control & ~MACEPCI_CONTROL_MAR_INT;
45 mace->pci.config_addr = mkaddr(bus, devfn, reg); 49 mace->pci.config_addr = mkaddr(bus, devfn, reg);
46 switch (size) { 50 switch (size) {
47 case 1: 51 case 1:
@@ -54,6 +58,9 @@ mace_pci_read_config(struct pci_bus *bus, unsigned int devfn,
54 *val = mace->pci.config_data.l; 58 *val = mace->pci.config_data.l;
55 break; 59 break;
56 } 60 }
61 /* ack possible master abort */
62 mace->pci.error &= ~MACEPCI_ERROR_MASTER_ABORT;
63 mace->pci.control = control;
57 64
58 DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val); 65 DPRINTK("read%d: reg=%08x,val=%02x\n", size * 8, reg, *val);
59 66
diff --git a/arch/mips/pci/pci-ip32.c b/arch/mips/pci/pci-ip32.c
index 618ea7dbc474..532b561b4442 100644
--- a/arch/mips/pci/pci-ip32.c
+++ b/arch/mips/pci/pci-ip32.c
@@ -119,6 +119,7 @@ static struct pci_controller mace_pci_controller = {
119 .iommu = 0, 119 .iommu = 0,
120 .mem_offset = MACE_PCI_MEM_OFFSET, 120 .mem_offset = MACE_PCI_MEM_OFFSET,
121 .io_offset = 0, 121 .io_offset = 0,
122 .io_map_base = CKSEG1ADDR(MACEPCI_LOW_IO),
122}; 123};
123 124
124static int __init mace_init(void) 125static int __init mace_init(void)
@@ -135,7 +136,8 @@ static int __init mace_init(void)
135 BUG_ON(request_irq(MACE_PCI_BRIDGE_IRQ, macepci_error, 0, 136 BUG_ON(request_irq(MACE_PCI_BRIDGE_IRQ, macepci_error, 0,
136 "MACE PCI error", NULL)); 137 "MACE PCI error", NULL));
137 138
138 iomem_resource = mace_pci_mem_resource; 139 /* extend memory resources */
140 iomem_resource.end = mace_pci_mem_resource.end;
139 ioport_resource = mace_pci_io_resource; 141 ioport_resource = mace_pci_io_resource;
140 142
141 register_pci_controller(&mace_pci_controller); 143 register_pci_controller(&mace_pci_controller);
diff --git a/arch/mips/philips/pnx8550/common/time.c b/arch/mips/philips/pnx8550/common/time.c
index e818fd0f1584..6d494e0de3d9 100644
--- a/arch/mips/philips/pnx8550/common/time.c
+++ b/arch/mips/philips/pnx8550/common/time.c
@@ -22,7 +22,6 @@
22#include <linux/kernel_stat.h> 22#include <linux/kernel_stat.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/module.h>
26 25
27#include <asm/bootinfo.h> 26#include <asm/bootinfo.h>
28#include <asm/cpu.h> 27#include <asm/cpu.h>
@@ -41,11 +40,60 @@ static cycle_t hpt_read(void)
41 return read_c0_count2(); 40 return read_c0_count2();
42} 41}
43 42
43static struct clocksource pnx_clocksource = {
44 .name = "pnx8xxx",
45 .rating = 200,
46 .read = hpt_read,
47 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
48};
49
44static void timer_ack(void) 50static void timer_ack(void)
45{ 51{
46 write_c0_compare(cpj); 52 write_c0_compare(cpj);
47} 53}
48 54
55static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id)
56{
57 struct clock_event_device *c = dev_id;
58
59 /* clear MATCH, signal the event */
60 c->event_handler(c);
61
62 return IRQ_HANDLED;
63}
64
65static struct irqaction pnx8xxx_timer_irq = {
66 .handler = pnx8xxx_timer_interrupt,
67 .flags = IRQF_DISABLED | IRQF_PERCPU,
68 .name = "pnx8xxx_timer",
69};
70
71static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
72{
73 /* Timer 2 clear interrupt */
74 write_c0_compare2(-1);
75 return IRQ_HANDLED;
76}
77
78static struct irqaction monotonic_irqaction = {
79 .handler = monotonic_interrupt,
80 .flags = IRQF_DISABLED,
81 .name = "Monotonic timer",
82};
83
84static int pnx8xxx_set_next_event(unsigned long delta,
85 struct clock_event_device *evt)
86{
87 write_c0_compare(delta);
88 return 0;
89}
90
91static struct clock_event_device pnx8xxx_clockevent = {
92 .name = "pnx8xxx_clockevent",
93 .features = CLOCK_EVT_FEAT_ONESHOT,
94 .set_next_event = pnx8xxx_set_next_event,
95};
96
49/* 97/*
50 * plat_time_init() - it does the following things: 98 * plat_time_init() - it does the following things:
51 * 99 *
@@ -58,11 +106,34 @@ static void timer_ack(void)
58 106
59__init void plat_time_init(void) 107__init void plat_time_init(void)
60{ 108{
109 unsigned int configPR;
61 unsigned int n; 110 unsigned int n;
62 unsigned int m; 111 unsigned int m;
63 unsigned int p; 112 unsigned int p;
64 unsigned int pow2p; 113 unsigned int pow2p;
65 114
115 clockevents_register_device(&pnx8xxx_clockevent);
116 clocksource_register(&pnx_clocksource);
117
118 setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq);
119 setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
120
121 /* Timer 1 start */
122 configPR = read_c0_config7();
123 configPR &= ~0x00000008;
124 write_c0_config7(configPR);
125
126 /* Timer 2 start */
127 configPR = read_c0_config7();
128 configPR &= ~0x00000010;
129 write_c0_config7(configPR);
130
131 /* Timer 3 stop */
132 configPR = read_c0_config7();
133 configPR |= 0x00000020;
134 write_c0_config7(configPR);
135
136
66 /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */ 137 /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */
67 /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1: FIXME) */ 138 /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1: FIXME) */
68 139
@@ -87,42 +158,6 @@ __init void plat_time_init(void)
87 write_c0_count2(0); 158 write_c0_count2(0);
88 write_c0_compare2(0xffffffff); 159 write_c0_compare2(0xffffffff);
89 160
90 clocksource_mips.read = hpt_read;
91 mips_timer_ack = timer_ack;
92}
93
94static irqreturn_t monotonic_interrupt(int irq, void *dev_id)
95{
96 /* Timer 2 clear interrupt */
97 write_c0_compare2(-1);
98 return IRQ_HANDLED;
99} 161}
100 162
101static struct irqaction monotonic_irqaction = {
102 .handler = monotonic_interrupt,
103 .flags = IRQF_DISABLED,
104 .name = "Monotonic timer",
105};
106 163
107void __init plat_timer_setup(struct irqaction *irq)
108{
109 int configPR;
110
111 setup_irq(PNX8550_INT_TIMER1, irq);
112 setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction);
113
114 /* Timer 1 start */
115 configPR = read_c0_config7();
116 configPR &= ~0x00000008;
117 write_c0_config7(configPR);
118
119 /* Timer 2 start */
120 configPR = read_c0_config7();
121 configPR &= ~0x00000010;
122 write_c0_config7(configPR);
123
124 /* Timer 3 stop */
125 configPR = read_c0_config7();
126 configPR |= 0x00000020;
127 write_c0_config7(configPR);
128}
diff --git a/arch/mips/sgi-ip32/ip32-irq.c b/arch/mips/sgi-ip32/ip32-irq.c
index cab7cc22ab67..b0ea0e43ba48 100644
--- a/arch/mips/sgi-ip32/ip32-irq.c
+++ b/arch/mips/sgi-ip32/ip32-irq.c
@@ -426,7 +426,6 @@ static void ip32_irq0(void)
426 426
427 crime_int = crime->istat & crime_mask; 427 crime_int = crime->istat & crime_mask;
428 irq = MACE_VID_IN1_IRQ + __ffs(crime_int); 428 irq = MACE_VID_IN1_IRQ + __ffs(crime_int);
429 crime_int = 1 << irq;
430 429
431 if (crime_int & CRIME_MACEISA_INT_MASK) { 430 if (crime_int & CRIME_MACEISA_INT_MASK) {
432 unsigned long mace_int = mace->perif.ctrl.istat; 431 unsigned long mace_int = mace->perif.ctrl.istat;
diff --git a/arch/mips/sgi-ip32/ip32-platform.c b/arch/mips/sgi-ip32/ip32-platform.c
index 77febd68fcd4..89a71f49b692 100644
--- a/arch/mips/sgi-ip32/ip32-platform.c
+++ b/arch/mips/sgi-ip32/ip32-platform.c
@@ -13,21 +13,22 @@
13#include <asm/ip32/mace.h> 13#include <asm/ip32/mace.h>
14#include <asm/ip32/ip32_ints.h> 14#include <asm/ip32/ip32_ints.h>
15 15
16/* 16#define MACEISA_SERIAL1_OFFS offsetof(struct sgi_mace, isa.serial1)
17 * .iobase isn't a constant (in the sense of C) so we fill it in at runtime. 17#define MACEISA_SERIAL2_OFFS offsetof(struct sgi_mace, isa.serial2)
18 */ 18
19#define MACE_PORT(int) \ 19#define MACE_PORT(offset,_irq) \
20{ \ 20{ \
21 .irq = int, \ 21 .mapbase = MACE_BASE + offset, \
22 .irq = _irq, \
22 .uartclk = 1843200, \ 23 .uartclk = 1843200, \
23 .iotype = UPIO_MEM, \ 24 .iotype = UPIO_MEM, \
24 .flags = UPF_SKIP_TEST, \ 25 .flags = UPF_SKIP_TEST|UPF_IOREMAP, \
25 .regshift = 8, \ 26 .regshift = 8, \
26} 27}
27 28
28static struct plat_serial8250_port uart8250_data[] = { 29static struct plat_serial8250_port uart8250_data[] = {
29 MACE_PORT(MACEISA_SERIAL1_IRQ), 30 MACE_PORT(MACEISA_SERIAL1_OFFS, MACEISA_SERIAL1_IRQ),
30 MACE_PORT(MACEISA_SERIAL2_IRQ), 31 MACE_PORT(MACEISA_SERIAL2_OFFS, MACEISA_SERIAL2_IRQ),
31 { }, 32 { },
32}; 33};
33 34
@@ -41,9 +42,6 @@ static struct platform_device uart8250_device = {
41 42
42static int __init uart8250_init(void) 43static int __init uart8250_init(void)
43{ 44{
44 uart8250_data[0].membase = (void __iomem *) &mace->isa.serial1;
45 uart8250_data[1].membase = (void __iomem *) &mace->isa.serial2;
46
47 return platform_device_register(&uart8250_device); 45 return platform_device_register(&uart8250_device);
48} 46}
49 47
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 4a8152375efe..632e5d201353 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -598,8 +598,8 @@ static int __init rbtx4938_ethaddr_init(void)
598 printk(KERN_WARNING "seeprom: bad checksum.\n"); 598 printk(KERN_WARNING "seeprom: bad checksum.\n");
599 } 599 }
600 for (i = 0; i < 2; i++) { 600 for (i = 0; i < 2; i++) {
601 unsigned int slot = TX4938_PCIC_IDSEL_AD_TO_SLOT(31 - i); 601 unsigned int id =
602 unsigned int id = (1 << 8) | PCI_DEVFN(slot, 0); /* bus 1 */ 602 TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
603 struct platform_device *pdev; 603 struct platform_device *pdev;
604 if (!(tx4938_ccfgptr->pcfg & 604 if (!(tx4938_ccfgptr->pcfg &
605 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL))) 605 (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
diff --git a/arch/powerpc/boot/flatdevtree_env.h b/arch/powerpc/boot/flatdevtree_env.h
index ad0420da8921..66e0ebb1a364 100644
--- a/arch/powerpc/boot/flatdevtree_env.h
+++ b/arch/powerpc/boot/flatdevtree_env.h
@@ -2,7 +2,7 @@
2 * This file adds the header file glue so that the shared files 2 * This file adds the header file glue so that the shared files
3 * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper. 3 * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper.
4 * 4 *
5 * strncmp & strchr copied from <file:lib/strings.c> 5 * strncmp & strchr copied from <file:lib/string.c>
6 * Copyright (C) 1991, 1992 Linus Torvalds 6 * Copyright (C) 1991, 1992 Linus Torvalds
7 * 7 *
8 * Maintained by: Mark A. Greer <mgreer@mvista.com> 8 * Maintained by: Mark A. Greer <mgreer@mvista.com>
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index 47c3fe55242f..a3c406aca664 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -278,6 +278,7 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
278 unsigned long flags; 278 unsigned long flags;
279 struct scatterlist *s, *outs, *segstart; 279 struct scatterlist *s, *outs, *segstart;
280 int outcount, incount, i; 280 int outcount, incount, i;
281 unsigned int align;
281 unsigned long handle; 282 unsigned long handle;
282 283
283 BUG_ON(direction == DMA_NONE); 284 BUG_ON(direction == DMA_NONE);
@@ -309,7 +310,12 @@ int iommu_map_sg(struct iommu_table *tbl, struct scatterlist *sglist,
309 /* Allocate iommu entries for that segment */ 310 /* Allocate iommu entries for that segment */
310 vaddr = (unsigned long) sg_virt(s); 311 vaddr = (unsigned long) sg_virt(s);
311 npages = iommu_num_pages(vaddr, slen); 312 npages = iommu_num_pages(vaddr, slen);
312 entry = iommu_range_alloc(tbl, npages, &handle, mask >> IOMMU_PAGE_SHIFT, 0); 313 align = 0;
314 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && slen >= PAGE_SIZE &&
315 (vaddr & ~PAGE_MASK) == 0)
316 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
317 entry = iommu_range_alloc(tbl, npages, &handle,
318 mask >> IOMMU_PAGE_SHIFT, align);
313 319
314 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen); 320 DBG(" - vaddr: %lx, size: %lx\n", vaddr, slen);
315 321
@@ -570,7 +576,7 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
570{ 576{
571 dma_addr_t dma_handle = DMA_ERROR_CODE; 577 dma_addr_t dma_handle = DMA_ERROR_CODE;
572 unsigned long uaddr; 578 unsigned long uaddr;
573 unsigned int npages; 579 unsigned int npages, align;
574 580
575 BUG_ON(direction == DMA_NONE); 581 BUG_ON(direction == DMA_NONE);
576 582
@@ -578,8 +584,13 @@ dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
578 npages = iommu_num_pages(uaddr, size); 584 npages = iommu_num_pages(uaddr, size);
579 585
580 if (tbl) { 586 if (tbl) {
587 align = 0;
588 if (IOMMU_PAGE_SHIFT < PAGE_SHIFT && size >= PAGE_SIZE &&
589 ((unsigned long)vaddr & ~PAGE_MASK) == 0)
590 align = PAGE_SHIFT - IOMMU_PAGE_SHIFT;
591
581 dma_handle = iommu_alloc(tbl, vaddr, npages, direction, 592 dma_handle = iommu_alloc(tbl, vaddr, npages, direction,
582 mask >> IOMMU_PAGE_SHIFT, 0); 593 mask >> IOMMU_PAGE_SHIFT, align);
583 if (dma_handle == DMA_ERROR_CODE) { 594 if (dma_handle == DMA_ERROR_CODE) {
584 if (printk_ratelimit()) { 595 if (printk_ratelimit()) {
585 printk(KERN_INFO "iommu_alloc failed, " 596 printk(KERN_INFO "iommu_alloc failed, "
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 1add6efdb315..5d89a21dd0d6 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -2216,6 +2216,45 @@ static void __init fixup_device_tree_efika(void)
2216 prom_printf("fixup_device_tree_efika: ", 2216 prom_printf("fixup_device_tree_efika: ",
2217 "skipped entry %x - setprop error\n", i); 2217 "skipped entry %x - setprop error\n", i);
2218 } 2218 }
2219
2220 /* Make sure ethernet mdio bus node exists */
2221 node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio"));
2222 if (!PHANDLE_VALID(node)) {
2223 prom_printf("Adding Ethernet MDIO node\n");
2224 call_prom("interpret", 1, 1,
2225 " s\" /builtin\" find-device"
2226 " new-device"
2227 " 1 encode-int s\" #address-cells\" property"
2228 " 0 encode-int s\" #size-cells\" property"
2229 " s\" mdio\" 2dup device-name device-type"
2230 " s\" mpc5200b-fec-phy\" encode-string"
2231 " s\" compatible\" property"
2232 " 0xf0003000 0x400 reg"
2233 " 0x2 encode-int"
2234 " 0x5 encode-int encode+"
2235 " 0x3 encode-int encode+"
2236 " s\" interrupts\" property"
2237 " finish-device");
2238 };
2239
2240 /* Make sure ethernet phy device node exist */
2241 node = call_prom("finddevice", 1, 1, ADDR("/builtin/mdio/ethernet-phy"));
2242 if (!PHANDLE_VALID(node)) {
2243 prom_printf("Adding Ethernet PHY node\n");
2244 call_prom("interpret", 1, 1,
2245 " s\" /builtin/mdio\" find-device"
2246 " new-device"
2247 " s\" ethernet-phy\" device-name"
2248 " 0x10 encode-int s\" reg\" property"
2249 " my-self"
2250 " ihandle>phandle"
2251 " finish-device"
2252 " s\" /builtin/ethernet\" find-device"
2253 " encode-int"
2254 " s\" phy-handle\" property"
2255 " device-end");
2256 }
2257
2219} 2258}
2220#else 2259#else
2221#define fixup_device_tree_efika() 2260#define fixup_device_tree_efika()
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 3cf0802cd2b6..47b06bad24ad 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -295,6 +295,8 @@ void slb_initialize(void)
295 295
296 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1); 296 create_shadowed_slbe(VMALLOC_START, mmu_kernel_ssize, vflags, 1);
297 297
298 slb_shadow_clear(2);
299
298 /* We don't bolt the stack for the time being - we're in boot, 300 /* We don't bolt the stack for the time being - we're in boot,
299 * so the stack is in the bolted segment. By the time it goes 301 * so the stack is in the bolted segment. By the time it goes
300 * elsewhere, we'll call _switch() which will bolt in the new 302 * elsewhere, we'll call _switch() which will bolt in the new
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index e1e2f6a43019..3a963b4a9be0 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -88,3 +88,8 @@ config CBE_CPUFREQ_PMI
88 but also at lower core voltage. 88 but also at lower core voltage.
89 89
90endmenu 90endmenu
91
92config OPROFILE_CELL
93 def_bool y
94 depends on PPC_CELL_NATIVE && (OPROFILE = m || OPROFILE = y)
95
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 3cd565a04d0a..c89964c6fb1f 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -19,6 +19,7 @@ spu-manage-$(CONFIG_PPC_CELLEB) += spu_manage.o
19spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o 19spu-manage-$(CONFIG_PPC_CELL_NATIVE) += spu_manage.o
20 20
21obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \ 21obj-$(CONFIG_SPU_BASE) += spu_callbacks.o spu_base.o \
22 spu_notify.o \
22 spu_syscalls.o spu_fault.o \ 23 spu_syscalls.o spu_fault.o \
23 $(spu-priv1-y) \ 24 $(spu-priv1-y) \
24 $(spu-manage-y) \ 25 $(spu-manage-y) \
diff --git a/arch/powerpc/platforms/cell/spu_notify.c b/arch/powerpc/platforms/cell/spu_notify.c
new file mode 100644
index 000000000000..34d156959f39
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_notify.c
@@ -0,0 +1,67 @@
1/*
2 * Move OProfile dependencies from spufs module to the kernel so it
3 * can run on non-cell PPC.
4 *
5 * Copyright (C) IBM 2005
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#undef DEBUG
23
24#include <linux/module.h>
25#include <asm/spu.h>
26#include "spufs/spufs.h"
27
28static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier);
29
30void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
31{
32 blocking_notifier_call_chain(&spu_switch_notifier,
33 ctx ? ctx->object_id : 0, spu);
34}
35EXPORT_SYMBOL_GPL(spu_switch_notify);
36
37int spu_switch_event_register(struct notifier_block *n)
38{
39 int ret;
40 ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
41 if (!ret)
42 notify_spus_active();
43 return ret;
44}
45EXPORT_SYMBOL_GPL(spu_switch_event_register);
46
47int spu_switch_event_unregister(struct notifier_block *n)
48{
49 return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
50}
51EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
52
53void spu_set_profile_private_kref(struct spu_context *ctx,
54 struct kref *prof_info_kref,
55 void (* prof_info_release) (struct kref *kref))
56{
57 ctx->prof_priv_kref = prof_info_kref;
58 ctx->prof_priv_release = prof_info_release;
59}
60EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
61
62void *spu_get_profile_private_kref(struct spu_context *ctx)
63{
64 return ctx->prof_priv_kref;
65}
66EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
67
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index a9438b719fe8..75530d99eda6 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -145,6 +145,20 @@ int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset)
145 return ret; 145 return ret;
146} 146}
147 147
148void notify_spus_active(void)
149{
150 struct spufs_calls *calls;
151
152 calls = spufs_calls_get();
153 if (!calls)
154 return;
155
156 calls->notify_spus_active();
157 spufs_calls_put(calls);
158
159 return;
160}
161
148int register_spu_syscalls(struct spufs_calls *calls) 162int register_spu_syscalls(struct spufs_calls *calls)
149{ 163{
150 if (spufs_calls) 164 if (spufs_calls)
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 237e152d31dc..133995ed5cc7 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -177,19 +177,3 @@ void spu_release_saved(struct spu_context *ctx)
177 spu_release(ctx); 177 spu_release(ctx);
178} 178}
179 179
180void spu_set_profile_private_kref(struct spu_context *ctx,
181 struct kref *prof_info_kref,
182 void ( * prof_info_release) (struct kref *kref))
183{
184 ctx->prof_priv_kref = prof_info_kref;
185 ctx->prof_priv_release = prof_info_release;
186}
187EXPORT_SYMBOL_GPL(spu_set_profile_private_kref);
188
189void *spu_get_profile_private_kref(struct spu_context *ctx)
190{
191 return ctx->prof_priv_kref;
192}
193EXPORT_SYMBOL_GPL(spu_get_profile_private_kref);
194
195
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 8c8af11b35b4..00d914232af1 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -182,15 +182,7 @@ static int node_allowed(struct spu_context *ctx, int node)
182 return rval; 182 return rval;
183} 183}
184 184
185static BLOCKING_NOTIFIER_HEAD(spu_switch_notifier); 185void do_notify_spus_active(void)
186
187void spu_switch_notify(struct spu *spu, struct spu_context *ctx)
188{
189 blocking_notifier_call_chain(&spu_switch_notifier,
190 ctx ? ctx->object_id : 0, spu);
191}
192
193static void notify_spus_active(void)
194{ 186{
195 int node; 187 int node;
196 188
@@ -217,22 +209,6 @@ static void notify_spus_active(void)
217 } 209 }
218} 210}
219 211
220int spu_switch_event_register(struct notifier_block * n)
221{
222 int ret;
223 ret = blocking_notifier_chain_register(&spu_switch_notifier, n);
224 if (!ret)
225 notify_spus_active();
226 return ret;
227}
228EXPORT_SYMBOL_GPL(spu_switch_event_register);
229
230int spu_switch_event_unregister(struct notifier_block * n)
231{
232 return blocking_notifier_chain_unregister(&spu_switch_notifier, n);
233}
234EXPORT_SYMBOL_GPL(spu_switch_event_unregister);
235
236/** 212/**
237 * spu_bind_context - bind spu context to physical spu 213 * spu_bind_context - bind spu context to physical spu
238 * @spu: physical spu to bind to 214 * @spu: physical spu to bind to
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
index 2c34f7170190..430404413178 100644
--- a/arch/powerpc/platforms/cell/spufs/syscalls.c
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -86,5 +86,6 @@ struct spufs_calls spufs_calls = {
86 .spu_run = do_spu_run, 86 .spu_run = do_spu_run,
87 .coredump_extra_notes_size = spufs_coredump_extra_notes_size, 87 .coredump_extra_notes_size = spufs_coredump_extra_notes_size,
88 .coredump_extra_notes_write = spufs_coredump_extra_notes_write, 88 .coredump_extra_notes_write = spufs_coredump_extra_notes_write,
89 .notify_spus_active = do_notify_spus_active,
89 .owner = THIS_MODULE, 90 .owner = THIS_MODULE,
90}; 91};
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index 766685ab26f8..b9ea09d9d2fb 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -23,6 +23,7 @@
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/syscalls.h> 25#include <linux/syscalls.h>
26#include <linux/ctype.h>
26 27
27#include <asm/lmb.h> 28#include <asm/lmb.h>
28 29
@@ -37,6 +38,8 @@ enum os_area_ldr_format {
37 HEADER_LDR_FORMAT_GZIP = 1, 38 HEADER_LDR_FORMAT_GZIP = 1,
38}; 39};
39 40
41#define OS_AREA_HEADER_MAGIC_NUM "cell_ext_os_area"
42
40/** 43/**
41 * struct os_area_header - os area header segment. 44 * struct os_area_header - os area header segment.
42 * @magic_num: Always 'cell_ext_os_area'. 45 * @magic_num: Always 'cell_ext_os_area'.
@@ -114,13 +117,11 @@ struct os_area_params {
114 u8 _reserved_5[8]; 117 u8 _reserved_5[8];
115}; 118};
116 119
117enum { 120#define OS_AREA_DB_MAGIC_NUM "-db-"
118 OS_AREA_DB_MAGIC_NUM = 0x2d64622dU,
119};
120 121
121/** 122/**
122 * struct os_area_db - Shared flash memory database. 123 * struct os_area_db - Shared flash memory database.
123 * @magic_num: Always '-db-' = 0x2d64622d. 124 * @magic_num: Always '-db-'.
124 * @version: os_area_db format version number. 125 * @version: os_area_db format version number.
125 * @index_64: byte offset of the database id index for 64 bit variables. 126 * @index_64: byte offset of the database id index for 64 bit variables.
126 * @count_64: number of usable 64 bit index entries 127 * @count_64: number of usable 64 bit index entries
@@ -135,7 +136,7 @@ enum {
135 */ 136 */
136 137
137struct os_area_db { 138struct os_area_db {
138 u32 magic_num; 139 u8 magic_num[4];
139 u16 version; 140 u16 version;
140 u16 _reserved_1; 141 u16 _reserved_1;
141 u16 index_64; 142 u16 index_64;
@@ -265,12 +266,26 @@ static void __init os_area_get_property(struct device_node *node,
265 prop->name); 266 prop->name);
266} 267}
267 268
269static void dump_field(char *s, const u8 *field, int size_of_field)
270{
271#if defined(DEBUG)
272 int i;
273
274 for (i = 0; i < size_of_field; i++)
275 s[i] = isprint(field[i]) ? field[i] : '.';
276 s[i] = 0;
277#endif
278}
279
268#define dump_header(_a) _dump_header(_a, __func__, __LINE__) 280#define dump_header(_a) _dump_header(_a, __func__, __LINE__)
269static void _dump_header(const struct os_area_header *h, const char *func, 281static void _dump_header(const struct os_area_header *h, const char *func,
270 int line) 282 int line)
271{ 283{
284 char str[sizeof(h->magic_num) + 1];
285
286 dump_field(str, h->magic_num, sizeof(h->magic_num));
272 pr_debug("%s:%d: h.magic_num: '%s'\n", func, line, 287 pr_debug("%s:%d: h.magic_num: '%s'\n", func, line,
273 h->magic_num); 288 str);
274 pr_debug("%s:%d: h.hdr_version: %u\n", func, line, 289 pr_debug("%s:%d: h.hdr_version: %u\n", func, line,
275 h->hdr_version); 290 h->hdr_version);
276 pr_debug("%s:%d: h.db_area_offset: %u\n", func, line, 291 pr_debug("%s:%d: h.db_area_offset: %u\n", func, line,
@@ -311,7 +326,8 @@ static void _dump_params(const struct os_area_params *p, const char *func,
311 326
312static int verify_header(const struct os_area_header *header) 327static int verify_header(const struct os_area_header *header)
313{ 328{
314 if (memcmp(header->magic_num, "cell_ext_os_area", 16)) { 329 if (memcmp(header->magic_num, OS_AREA_HEADER_MAGIC_NUM,
330 sizeof(header->magic_num))) {
315 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); 331 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
316 return -1; 332 return -1;
317 } 333 }
@@ -331,7 +347,8 @@ static int verify_header(const struct os_area_header *header)
331 347
332static int db_verify(const struct os_area_db *db) 348static int db_verify(const struct os_area_db *db)
333{ 349{
334 if (db->magic_num != OS_AREA_DB_MAGIC_NUM) { 350 if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM,
351 sizeof(db->magic_num))) {
335 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__); 352 pr_debug("%s:%d magic_num failed\n", __func__, __LINE__);
336 return -1; 353 return -1;
337 } 354 }
@@ -484,8 +501,11 @@ static int db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff)
484static void _dump_db(const struct os_area_db *db, const char *func, 501static void _dump_db(const struct os_area_db *db, const char *func,
485 int line) 502 int line)
486{ 503{
504 char str[sizeof(db->magic_num) + 1];
505
506 dump_field(str, db->magic_num, sizeof(db->magic_num));
487 pr_debug("%s:%d: db.magic_num: '%s'\n", func, line, 507 pr_debug("%s:%d: db.magic_num: '%s'\n", func, line,
488 (const char*)&db->magic_num); 508 str);
489 pr_debug("%s:%d: db.version: %u\n", func, line, 509 pr_debug("%s:%d: db.version: %u\n", func, line,
490 db->version); 510 db->version);
491 pr_debug("%s:%d: db.index_64: %u\n", func, line, 511 pr_debug("%s:%d: db.index_64: %u\n", func, line,
@@ -516,7 +536,7 @@ static void os_area_db_init(struct os_area_db *db)
516 536
517 memset(db, 0, sizeof(struct os_area_db)); 537 memset(db, 0, sizeof(struct os_area_db));
518 538
519 db->magic_num = OS_AREA_DB_MAGIC_NUM; 539 memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num));
520 db->version = 1; 540 db->version = 1;
521 db->index_64 = HEADER_SIZE; 541 db->index_64 = HEADER_SIZE;
522 db->count_64 = VALUES_64_COUNT; 542 db->count_64 = VALUES_64_COUNT;
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index fc48b96c81bf..412e6b42986f 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -29,6 +29,7 @@
29#include <asm/vdso_datapage.h> 29#include <asm/vdso_datapage.h>
30#include <asm/pSeries_reconfig.h> 30#include <asm/pSeries_reconfig.h>
31#include "xics.h" 31#include "xics.h"
32#include "plpar_wrappers.h"
32 33
33/* This version can't take the spinlock, because it never returns */ 34/* This version can't take the spinlock, because it never returns */
34static struct rtas_args rtas_stop_self_args = { 35static struct rtas_args rtas_stop_self_args = {
@@ -58,6 +59,7 @@ static void pseries_mach_cpu_die(void)
58 local_irq_disable(); 59 local_irq_disable();
59 idle_task_exit(); 60 idle_task_exit();
60 xics_teardown_cpu(0); 61 xics_teardown_cpu(0);
62 unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow()));
61 rtas_stop_self(); 63 rtas_stop_self();
62 /* Should never get here... */ 64 /* Should never get here... */
63 BUG(); 65 BUG();
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index fe562db475e9..7452269bba2a 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -5,7 +5,7 @@
5 * Based upon code written by Ross Biro, Linus Torvalds, Bob Manson, 5 * Based upon code written by Ross Biro, Linus Torvalds, Bob Manson,
6 * and David Mosberger. 6 * and David Mosberger.
7 * 7 *
8 * Added Linux support -miguel (weird, eh?, the orignal code was meant 8 * Added Linux support -miguel (weird, eh?, the original code was meant
9 * to emulate SunOS). 9 * to emulate SunOS).
10 */ 10 */
11 11
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 45cb7c5286d7..00b393c3a4a0 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -436,7 +436,14 @@ void __init time_init(void)
436 436
437static inline unsigned long do_gettimeoffset(void) 437static inline unsigned long do_gettimeoffset(void)
438{ 438{
439 return (*master_l10_counter >> 10) & 0x1fffff; 439 unsigned long val = *master_l10_counter;
440 unsigned long usec = (val >> 10) & 0x1fffff;
441
442 /* Limit hit? */
443 if (val & 0x80000000)
444 usec += 1000000 / HZ;
445
446 return usec;
440} 447}
441 448
442/* Ok, my cute asm atomicity trick doesn't work anymore. 449/* Ok, my cute asm atomicity trick doesn't work anymore.
diff --git a/arch/sparc64/kernel/ktlb.S b/arch/sparc64/kernel/ktlb.S
index 964527d2ffa0..cef8defcd7a9 100644
--- a/arch/sparc64/kernel/ktlb.S
+++ b/arch/sparc64/kernel/ktlb.S
@@ -1,6 +1,6 @@
1/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling. 1/* arch/sparc64/kernel/ktlb.S: Kernel mapping TLB miss handling.
2 * 2 *
3 * Copyright (C) 1995, 1997, 2005 David S. Miller <davem@davemloft.net> 3 * Copyright (C) 1995, 1997, 2005, 2008 David S. Miller <davem@davemloft.net>
4 * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de) 4 * Copyright (C) 1996 Eddie C. Dost (ecd@brainaid.de)
5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx) 5 * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
6 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 6 * Copyright (C) 1996,98,99 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -226,6 +226,7 @@ kvmap_dtlb_load:
226 ba,pt %xcc, sun4v_dtlb_load 226 ba,pt %xcc, sun4v_dtlb_load
227 mov %g5, %g3 227 mov %g5, %g3
228 228
229#ifdef CONFIG_SPARSEMEM_VMEMMAP
229kvmap_vmemmap: 230kvmap_vmemmap:
230 sub %g4, %g5, %g5 231 sub %g4, %g5, %g5
231 srlx %g5, 22, %g5 232 srlx %g5, 22, %g5
@@ -234,6 +235,7 @@ kvmap_vmemmap:
234 or %g1, %lo(vmemmap_table), %g1 235 or %g1, %lo(vmemmap_table), %g1
235 ba,pt %xcc, kvmap_dtlb_load 236 ba,pt %xcc, kvmap_dtlb_load
236 ldx [%g1 + %g5], %g5 237 ldx [%g1 + %g5], %g5
238#endif
237 239
238kvmap_dtlb_nonlinear: 240kvmap_dtlb_nonlinear:
239 /* Catch kernel NULL pointer derefs. */ 241 /* Catch kernel NULL pointer derefs. */
@@ -242,12 +244,14 @@ kvmap_dtlb_nonlinear:
242 bleu,pn %xcc, kvmap_dtlb_longpath 244 bleu,pn %xcc, kvmap_dtlb_longpath
243 nop 245 nop
244 246
247#ifdef CONFIG_SPARSEMEM_VMEMMAP
245 /* Do not use the TSB for vmemmap. */ 248 /* Do not use the TSB for vmemmap. */
246 mov (VMEMMAP_BASE >> 24), %g5 249 mov (VMEMMAP_BASE >> 24), %g5
247 sllx %g5, 24, %g5 250 sllx %g5, 24, %g5
248 cmp %g4,%g5 251 cmp %g4,%g5
249 bgeu,pn %xcc, kvmap_vmemmap 252 bgeu,pn %xcc, kvmap_vmemmap
250 nop 253 nop
254#endif
251 255
252 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load) 256 KERN_TSB_LOOKUP_TL1(%g4, %g6, %g5, %g1, %g2, %g3, kvmap_dtlb_load)
253 257
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 63b3ebc0c3c2..a61c38fe75ea 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -1275,4 +1275,20 @@ int pci_dma_supported(struct pci_dev *pdev, u64 device_mask)
1275 return (device_mask & dma_addr_mask) == dma_addr_mask; 1275 return (device_mask & dma_addr_mask) == dma_addr_mask;
1276} 1276}
1277 1277
1278void pci_resource_to_user(const struct pci_dev *pdev, int bar,
1279 const struct resource *rp, resource_size_t *start,
1280 resource_size_t *end)
1281{
1282 struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller;
1283 unsigned long offset;
1284
1285 if (rp->flags & IORESOURCE_IO)
1286 offset = pbm->io_space.start;
1287 else
1288 offset = pbm->mem_space.start;
1289
1290 *start = rp->start - offset;
1291 *end = rp->end - offset;
1292}
1293
1278#endif /* !(CONFIG_PCI) */ 1294#endif /* !(CONFIG_PCI) */
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index 9546ba9f5dee..e752e75cce83 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -850,7 +850,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
850/* How the Tomatillo IRQs are routed around is pure guesswork here. 850/* How the Tomatillo IRQs are routed around is pure guesswork here.
851 * 851 *
852 * All the Tomatillo devices I see in prtconf dumps seem to have only 852 * All the Tomatillo devices I see in prtconf dumps seem to have only
853 * a single PCI bus unit attached to it. It would seem they are seperate 853 * a single PCI bus unit attached to it. It would seem they are separate
854 * devices because their PortID (ie. JBUS ID) values are all different 854 * devices because their PortID (ie. JBUS ID) values are all different
855 * and thus the registers are mapped to totally different locations. 855 * and thus the registers are mapped to totally different locations.
856 * 856 *
diff --git a/arch/sparc64/kernel/sun4v_tlb_miss.S b/arch/sparc64/kernel/sun4v_tlb_miss.S
index 9871dbb1ab42..fd9430562e0b 100644
--- a/arch/sparc64/kernel/sun4v_tlb_miss.S
+++ b/arch/sparc64/kernel/sun4v_tlb_miss.S
@@ -215,6 +215,7 @@ sun4v_itlb_error:
215 215
2161: ba,pt %xcc, etrap 2161: ba,pt %xcc, etrap
2172: or %g7, %lo(2b), %g7 2172: or %g7, %lo(2b), %g7
218 mov %l4, %o1
218 call sun4v_itlb_error_report 219 call sun4v_itlb_error_report
219 add %sp, PTREGS_OFF, %o0 220 add %sp, PTREGS_OFF, %o0
220 221
@@ -241,6 +242,7 @@ sun4v_dtlb_error:
241 242
2421: ba,pt %xcc, etrap 2431: ba,pt %xcc, etrap
2432: or %g7, %lo(2b), %g7 2442: or %g7, %lo(2b), %g7
245 mov %l4, %o1
244 call sun4v_dtlb_error_report 246 call sun4v_dtlb_error_report
245 add %sp, PTREGS_OFF, %o0 247 add %sp, PTREGS_OFF, %o0
246 248
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 04998388259f..2b6abf633343 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1950,6 +1950,8 @@ void sun4v_itlb_error_report(struct pt_regs *regs, int tl)
1950 printk(KERN_EMERG "SUN4V-ITLB: Error at TPC[%lx], tl %d\n", 1950 printk(KERN_EMERG "SUN4V-ITLB: Error at TPC[%lx], tl %d\n",
1951 regs->tpc, tl); 1951 regs->tpc, tl);
1952 print_symbol(KERN_EMERG "SUN4V-ITLB: TPC<%s>\n", regs->tpc); 1952 print_symbol(KERN_EMERG "SUN4V-ITLB: TPC<%s>\n", regs->tpc);
1953 printk(KERN_EMERG "SUN4V-ITLB: O7[%lx]\n", regs->u_regs[UREG_I7]);
1954 print_symbol(KERN_EMERG "SUN4V-ITLB: O7<%s>\n", regs->u_regs[UREG_I7]);
1953 printk(KERN_EMERG "SUN4V-ITLB: vaddr[%lx] ctx[%lx] " 1955 printk(KERN_EMERG "SUN4V-ITLB: vaddr[%lx] ctx[%lx] "
1954 "pte[%lx] error[%lx]\n", 1956 "pte[%lx] error[%lx]\n",
1955 sun4v_err_itlb_vaddr, sun4v_err_itlb_ctx, 1957 sun4v_err_itlb_vaddr, sun4v_err_itlb_ctx,
@@ -1971,6 +1973,8 @@ void sun4v_dtlb_error_report(struct pt_regs *regs, int tl)
1971 printk(KERN_EMERG "SUN4V-DTLB: Error at TPC[%lx], tl %d\n", 1973 printk(KERN_EMERG "SUN4V-DTLB: Error at TPC[%lx], tl %d\n",
1972 regs->tpc, tl); 1974 regs->tpc, tl);
1973 print_symbol(KERN_EMERG "SUN4V-DTLB: TPC<%s>\n", regs->tpc); 1975 print_symbol(KERN_EMERG "SUN4V-DTLB: TPC<%s>\n", regs->tpc);
1976 printk(KERN_EMERG "SUN4V-DTLB: O7[%lx]\n", regs->u_regs[UREG_I7]);
1977 print_symbol(KERN_EMERG "SUN4V-DTLB: O7<%s>\n", regs->u_regs[UREG_I7]);
1974 printk(KERN_EMERG "SUN4V-DTLB: vaddr[%lx] ctx[%lx] " 1978 printk(KERN_EMERG "SUN4V-DTLB: vaddr[%lx] ctx[%lx] "
1975 "pte[%lx] error[%lx]\n", 1979 "pte[%lx] error[%lx]\n",
1976 sun4v_err_dtlb_vaddr, sun4v_err_dtlb_ctx, 1980 sun4v_err_dtlb_vaddr, sun4v_err_dtlb_ctx,
diff --git a/arch/um/drivers/harddog_user.c b/arch/um/drivers/harddog_user.c
index b56f8e0196a9..448ba59207a1 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
@@ -79,14 +79,14 @@ int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock)
79 n = read(in_fds[0], &c, sizeof(c)); 79 n = read(in_fds[0], &c, sizeof(c));
80 if (n == 0) { 80 if (n == 0) {
81 printk("harddog_open - EOF on watchdog pipe\n"); 81 printk("harddog_open - EOF on watchdog pipe\n");
82 helper_wait(pid); 82 helper_wait(pid, 1, NULL);
83 err = -EIO; 83 err = -EIO;
84 goto out_close_out; 84 goto out_close_out;
85 } 85 }
86 else if (n < 0) { 86 else if (n < 0) {
87 printk("harddog_open - read of watchdog pipe failed, " 87 printk("harddog_open - read of watchdog pipe failed, "
88 "err = %d\n", errno); 88 "err = %d\n", errno);
89 helper_wait(pid); 89 helper_wait(pid, 1, NULL);
90 err = n; 90 err = n;
91 goto out_close_out; 91 goto out_close_out;
92 } 92 }
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 17089a041028..af045ca0f653 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -2256,14 +2256,12 @@ static int __init apm_init(void)
2256 apm_info.disabled = 1; 2256 apm_info.disabled = 1;
2257 return -ENODEV; 2257 return -ENODEV;
2258 } 2258 }
2259 if (PM_IS_ACTIVE()) { 2259 if (pm_flags & PM_ACPI) {
2260 printk(KERN_NOTICE "apm: overridden by ACPI.\n"); 2260 printk(KERN_NOTICE "apm: overridden by ACPI.\n");
2261 apm_info.disabled = 1; 2261 apm_info.disabled = 1;
2262 return -ENODEV; 2262 return -ENODEV;
2263 } 2263 }
2264#ifdef CONFIG_PM_LEGACY 2264 pm_flags |= PM_APM;
2265 pm_active = 1;
2266#endif
2267 2265
2268 /* 2266 /*
2269 * Set up a segment that references the real mode segment 0x40 2267 * Set up a segment that references the real mode segment 0x40
@@ -2366,9 +2364,7 @@ static void __exit apm_exit(void)
2366 kthread_stop(kapmd_task); 2364 kthread_stop(kapmd_task);
2367 kapmd_task = NULL; 2365 kapmd_task = NULL;
2368 } 2366 }
2369#ifdef CONFIG_PM_LEGACY 2367 pm_flags &= ~PM_APM;
2370 pm_active = 0;
2371#endif
2372} 2368}
2373 2369
2374module_init(apm_init); 2370module_init(apm_init);
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index ac0637a6d71c..fbad51fce672 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -196,7 +196,7 @@ default_entry:
196 /* Do an early initialization of the fixmap area */ 196 /* Do an early initialization of the fixmap area */
197 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx 197 movl $(swapper_pg_dir - __PAGE_OFFSET), %edx
198 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax 198 movl $(swapper_pg_pmd - __PAGE_OFFSET), %eax
199 addl $0x007, %eax /* 0x007 = PRESENT+RW+USER */ 199 addl $0x67, %eax /* 0x67 == _PAGE_TABLE */
200 movl %eax, 4092(%edx) 200 movl %eax, 4092(%edx)
201 201
202 xorl %ebx,%ebx /* This is the boot CPU (BSP) */ 202 xorl %ebx,%ebx /* This is the boot CPU (BSP) */
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 4a86ffd67ec5..2f99ee206b95 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -657,7 +657,7 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
657 hpet_pie_count = 0; 657 hpet_pie_count = 0;
658 } 658 }
659 659
660 if (hpet_rtc_flags & RTC_PIE && 660 if (hpet_rtc_flags & RTC_AIE &&
661 (curr_time.tm_sec == hpet_alarm_time.tm_sec) && 661 (curr_time.tm_sec == hpet_alarm_time.tm_sec) &&
662 (curr_time.tm_min == hpet_alarm_time.tm_min) && 662 (curr_time.tm_min == hpet_alarm_time.tm_min) &&
663 (curr_time.tm_hour == hpet_alarm_time.tm_hour)) 663 (curr_time.tm_hour == hpet_alarm_time.tm_hour))
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index c3a565bba106..a6b1490e00c4 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -2169,14 +2169,10 @@ static inline void __init check_timer(void)
2169{ 2169{
2170 int apic1, pin1, apic2, pin2; 2170 int apic1, pin1, apic2, pin2;
2171 int vector; 2171 int vector;
2172 unsigned int ver;
2173 unsigned long flags; 2172 unsigned long flags;
2174 2173
2175 local_irq_save(flags); 2174 local_irq_save(flags);
2176 2175
2177 ver = apic_read(APIC_LVR);
2178 ver = GET_APIC_VERSION(ver);
2179
2180 /* 2176 /*
2181 * get/set the timer IRQ vector: 2177 * get/set the timer IRQ vector:
2182 */ 2178 */
@@ -2189,15 +2185,11 @@ static inline void __init check_timer(void)
2189 * mode for the 8259A whenever interrupts are routed 2185 * mode for the 8259A whenever interrupts are routed
2190 * through I/O APICs. Also IRQ0 has to be enabled in 2186 * through I/O APICs. Also IRQ0 has to be enabled in
2191 * the 8259A which implies the virtual wire has to be 2187 * the 8259A which implies the virtual wire has to be
2192 * disabled in the local APIC. Finally timer interrupts 2188 * disabled in the local APIC.
2193 * need to be acknowledged manually in the 8259A for
2194 * timer_interrupt() and for the i82489DX when using
2195 * the NMI watchdog.
2196 */ 2189 */
2197 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 2190 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
2198 init_8259A(1); 2191 init_8259A(1);
2199 timer_ack = !cpu_has_tsc; 2192 timer_ack = 1;
2200 timer_ack |= (nmi_watchdog == NMI_IO_APIC && !APIC_INTEGRATED(ver));
2201 if (timer_over_8254 > 0) 2193 if (timer_over_8254 > 0)
2202 enable_8259A_irq(0); 2194 enable_8259A_irq(0);
2203 2195
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index 0ab680f2d9db..3960ab7e1497 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -278,12 +278,12 @@ static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt)
278 278
279static irqreturn_t mfgpt_tick(int irq, void *dev_id) 279static irqreturn_t mfgpt_tick(int irq, void *dev_id)
280{ 280{
281 /* Turn off the clock (and clear the event) */
282 mfgpt_disable_timer(mfgpt_event_clock);
283
281 if (mfgpt_tick_mode == CLOCK_EVT_MODE_SHUTDOWN) 284 if (mfgpt_tick_mode == CLOCK_EVT_MODE_SHUTDOWN)
282 return IRQ_HANDLED; 285 return IRQ_HANDLED;
283 286
284 /* Turn off the clock */
285 mfgpt_disable_timer(mfgpt_event_clock);
286
287 /* Clear the counter */ 287 /* Clear the counter */
288 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0); 288 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_COUNTER, 0);
289 289
@@ -319,10 +319,6 @@ static int __init mfgpt_timer_setup(void)
319 } 319 }
320 320
321 mfgpt_event_clock = timer; 321 mfgpt_event_clock = timer;
322 /* Set the clock scale and enable the event mode for CMP2 */
323 val = MFGPT_SCALE | (3 << 8);
324
325 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
326 322
327 /* Set up the IRQ on the MFGPT side */ 323 /* Set up the IRQ on the MFGPT side */
328 if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) { 324 if (geode_mfgpt_setup_irq(mfgpt_event_clock, MFGPT_CMP2, irq)) {
@@ -339,6 +335,11 @@ static int __init mfgpt_timer_setup(void)
339 goto err; 335 goto err;
340 } 336 }
341 337
338 /* Set the clock scale and enable the event mode for CMP2 */
339 val = MFGPT_SCALE | (3 << 8);
340
341 geode_mfgpt_write(mfgpt_event_clock, MFGPT_REG_SETUP, val);
342
342 /* Set up the clock event */ 343 /* Set up the clock event */
343 mfgpt_clockevent.mult = div_sc(MFGPT_HZ, NSEC_PER_SEC, 32); 344 mfgpt_clockevent.mult = div_sc(MFGPT_HZ, NSEC_PER_SEC, 32);
344 mfgpt_clockevent.min_delta_ns = clockevent_delta2ns(0xF, 345 mfgpt_clockevent.min_delta_ns = clockevent_delta2ns(0xF,
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 80ca72e5ac29..852db2906921 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -25,7 +25,6 @@
25 25
26#include <asm/smp.h> 26#include <asm/smp.h>
27#include <asm/nmi.h> 27#include <asm/nmi.h>
28#include <asm/timer.h>
29 28
30#include "mach_traps.h" 29#include "mach_traps.h"
31 30
@@ -84,7 +83,7 @@ static int __init check_nmi_watchdog(void)
84 83
85 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL); 84 prev_nmi_count = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
86 if (!prev_nmi_count) 85 if (!prev_nmi_count)
87 goto error; 86 return -1;
88 87
89 printk(KERN_INFO "Testing NMI watchdog ... "); 88 printk(KERN_INFO "Testing NMI watchdog ... ");
90 89
@@ -119,7 +118,7 @@ static int __init check_nmi_watchdog(void)
119 if (!atomic_read(&nmi_active)) { 118 if (!atomic_read(&nmi_active)) {
120 kfree(prev_nmi_count); 119 kfree(prev_nmi_count);
121 atomic_set(&nmi_active, -1); 120 atomic_set(&nmi_active, -1);
122 goto error; 121 return -1;
123 } 122 }
124 printk("OK.\n"); 123 printk("OK.\n");
125 124
@@ -130,10 +129,6 @@ static int __init check_nmi_watchdog(void)
130 129
131 kfree(prev_nmi_count); 130 kfree(prev_nmi_count);
132 return 0; 131 return 0;
133error:
134 timer_ack = !cpu_has_tsc;
135
136 return -1;
137} 132}
138/* This needs to happen later in boot so counters are working */ 133/* This needs to happen later in boot so counters are working */
139late_initcall(check_nmi_watchdog); 134late_initcall(check_nmi_watchdog);
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 9663c2a74830..46d391d49de8 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -204,6 +204,10 @@ void cpu_idle(void)
204 } 204 }
205} 205}
206 206
207static void do_nothing(void *unused)
208{
209}
210
207void cpu_idle_wait(void) 211void cpu_idle_wait(void)
208{ 212{
209 unsigned int cpu, this_cpu = get_cpu(); 213 unsigned int cpu, this_cpu = get_cpu();
@@ -228,6 +232,13 @@ void cpu_idle_wait(void)
228 cpu_clear(cpu, map); 232 cpu_clear(cpu, map);
229 } 233 }
230 cpus_and(map, map, cpu_online_map); 234 cpus_and(map, map, cpu_online_map);
235 /*
236 * We waited 1 sec, if a CPU still did not call idle
237 * it may be because it is in idle and not waking up
238 * because it has nothing to do.
239 * Give all the remaining CPUS a kick.
240 */
241 smp_call_function_mask(map, do_nothing, 0, 0);
231 } while (!cpus_empty(map)); 242 } while (!cpus_empty(map));
232 243
233 set_cpus_allowed(current, tmp); 244 set_cpus_allowed(current, tmp);
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 6309b275cb9c..ab79e1dfa023 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -135,6 +135,10 @@ static void poll_idle (void)
135 cpu_relax(); 135 cpu_relax();
136} 136}
137 137
138static void do_nothing(void *unused)
139{
140}
141
138void cpu_idle_wait(void) 142void cpu_idle_wait(void)
139{ 143{
140 unsigned int cpu, this_cpu = get_cpu(); 144 unsigned int cpu, this_cpu = get_cpu();
@@ -160,6 +164,13 @@ void cpu_idle_wait(void)
160 cpu_clear(cpu, map); 164 cpu_clear(cpu, map);
161 } 165 }
162 cpus_and(map, map, cpu_online_map); 166 cpus_and(map, map, cpu_online_map);
167 /*
168 * We waited 1 sec, if a CPU still did not call idle
169 * it may be because it is in idle and not waking up
170 * because it has nothing to do.
171 * Give all the remaining CPUS a kick.
172 */
173 smp_call_function_mask(map, do_nothing, 0, 0);
163 } while (!cpus_empty(map)); 174 } while (!cpus_empty(map));
164 175
165 set_cpus_allowed(current, tmp); 176 set_cpus_allowed(current, tmp);
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 594889521da1..aaf4e1291217 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -141,8 +141,8 @@ static void __cpuinit smp_store_cpu_info(int id)
141 struct cpuinfo_x86 *c = &cpu_data(id); 141 struct cpuinfo_x86 *c = &cpu_data(id);
142 142
143 *c = boot_cpu_data; 143 *c = boot_cpu_data;
144 identify_cpu(c);
145 c->cpu_index = id; 144 c->cpu_index = id;
145 identify_cpu(c);
146 print_cpu_info(c); 146 print_cpu_info(c);
147} 147}
148 148
@@ -526,7 +526,7 @@ struct create_idle {
526 int cpu; 526 int cpu;
527}; 527};
528 528
529void do_fork_idle(struct work_struct *work) 529static void __cpuinit do_fork_idle(struct work_struct *work)
530{ 530{
531 struct create_idle *c_idle = 531 struct create_idle *c_idle =
532 container_of(work, struct create_idle, work); 532 container_of(work, struct create_idle, work);
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index c88bbffcaa03..02d1e1e58e81 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -541,6 +541,7 @@ fastcall void do_##name(struct pt_regs * regs, long error_code) \
541 info.si_errno = 0; \ 541 info.si_errno = 0; \
542 info.si_code = sicode; \ 542 info.si_code = sicode; \
543 info.si_addr = (void __user *)siaddr; \ 543 info.si_addr = (void __user *)siaddr; \
544 trace_hardirqs_fixup(); \
544 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 545 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
545 == NOTIFY_STOP) \ 546 == NOTIFY_STOP) \
546 return; \ 547 return; \
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index d11525ad81b4..cc68b92316cd 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -635,6 +635,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
635 info.si_errno = 0; \ 635 info.si_errno = 0; \
636 info.si_code = sicode; \ 636 info.si_code = sicode; \
637 info.si_addr = (void __user *)siaddr; \ 637 info.si_addr = (void __user *)siaddr; \
638 trace_hardirqs_fixup(); \
638 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 639 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
639 == NOTIFY_STOP) \ 640 == NOTIFY_STOP) \
640 return; \ 641 return; \
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index c7d19471261d..3c76d194fd2c 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -321,8 +321,13 @@ extern void set_highmem_pages_init(int);
321static void __init set_highmem_pages_init(int bad_ppro) 321static void __init set_highmem_pages_init(int bad_ppro)
322{ 322{
323 int pfn; 323 int pfn;
324 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) 324 for (pfn = highstart_pfn; pfn < highend_pfn; pfn++) {
325 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); 325 /*
326 * Holes under sparsemem might not have no mem_map[]:
327 */
328 if (pfn_valid(pfn))
329 add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro);
330 }
326 totalram_pages += totalhigh_pages; 331 totalram_pages += totalhigh_pages;
327} 332}
328#endif /* CONFIG_FLATMEM */ 333#endif /* CONFIG_FLATMEM */
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 2d0eeac7251f..944bbcdd2b8d 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -380,7 +380,7 @@ static int __init ppro_init(char ** cpu_type)
380 380
381 if (cpu_model == 14) 381 if (cpu_model == 14)
382 *cpu_type = "i386/core"; 382 *cpu_type = "i386/core";
383 else if (cpu_model == 15) 383 else if (cpu_model == 15 || cpu_model == 23)
384 *cpu_type = "i386/core_2"; 384 *cpu_type = "i386/core_2";
385 else if (cpu_model > 0xd) 385 else if (cpu_model > 0xd)
386 return 0; 386 return 0;
diff --git a/block/blktrace.c b/block/blktrace.c
index 498a0a54a6aa..9b4da4ae3c7d 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -25,7 +25,6 @@
25#include <linux/time.h> 25#include <linux/time.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27 27
28static DEFINE_PER_CPU(unsigned long long, blk_trace_cpu_offset) = { 0, };
29static unsigned int blktrace_seq __read_mostly = 1; 28static unsigned int blktrace_seq __read_mostly = 1;
30 29
31/* 30/*
@@ -41,7 +40,7 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action,
41 const int cpu = smp_processor_id(); 40 const int cpu = smp_processor_id();
42 41
43 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; 42 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
44 t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); 43 t->time = ktime_to_ns(ktime_get());
45 t->device = bt->dev; 44 t->device = bt->dev;
46 t->action = action; 45 t->action = action;
47 t->pid = pid; 46 t->pid = pid;
@@ -159,7 +158,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
159 158
160 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION; 159 t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
161 t->sequence = ++(*sequence); 160 t->sequence = ++(*sequence);
162 t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu); 161 t->time = ktime_to_ns(ktime_get());
163 t->sector = sector; 162 t->sector = sector;
164 t->bytes = bytes; 163 t->bytes = bytes;
165 t->action = what; 164 t->action = what;
@@ -179,7 +178,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
179EXPORT_SYMBOL_GPL(__blk_add_trace); 178EXPORT_SYMBOL_GPL(__blk_add_trace);
180 179
181static struct dentry *blk_tree_root; 180static struct dentry *blk_tree_root;
182static struct mutex blk_tree_mutex; 181static DEFINE_MUTEX(blk_tree_mutex);
183static unsigned int root_users; 182static unsigned int root_users;
184 183
185static inline void blk_remove_root(void) 184static inline void blk_remove_root(void)
@@ -505,77 +504,3 @@ void blk_trace_shutdown(struct request_queue *q)
505 blk_trace_remove(q); 504 blk_trace_remove(q);
506 } 505 }
507} 506}
508
509/*
510 * Average offset over two calls to cpu_clock() with a gettimeofday()
511 * in the middle
512 */
513static void blk_check_time(unsigned long long *t, int this_cpu)
514{
515 unsigned long long a, b;
516 struct timeval tv;
517
518 a = cpu_clock(this_cpu);
519 do_gettimeofday(&tv);
520 b = cpu_clock(this_cpu);
521
522 *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
523 *t -= (a + b) / 2;
524}
525
526/*
527 * calibrate our inter-CPU timings
528 */
529static void blk_trace_check_cpu_time(void *data)
530{
531 unsigned long long *t;
532 int this_cpu = get_cpu();
533
534 t = &per_cpu(blk_trace_cpu_offset, this_cpu);
535
536 /*
537 * Just call it twice, hopefully the second call will be cache hot
538 * and a little more precise
539 */
540 blk_check_time(t, this_cpu);
541 blk_check_time(t, this_cpu);
542
543 put_cpu();
544}
545
546static void blk_trace_set_ht_offsets(void)
547{
548#if defined(CONFIG_SCHED_SMT)
549 int cpu, i;
550
551 /*
552 * now make sure HT siblings have the same time offset
553 */
554 preempt_disable();
555 for_each_online_cpu(cpu) {
556 unsigned long long *cpu_off, *sibling_off;
557
558 for_each_cpu_mask(i, per_cpu(cpu_sibling_map, cpu)) {
559 if (i == cpu)
560 continue;
561
562 cpu_off = &per_cpu(blk_trace_cpu_offset, cpu);
563 sibling_off = &per_cpu(blk_trace_cpu_offset, i);
564 *sibling_off = *cpu_off;
565 }
566 }
567 preempt_enable();
568#endif
569}
570
571static __init int blk_trace_init(void)
572{
573 mutex_init(&blk_tree_mutex);
574 on_each_cpu(blk_trace_check_cpu_time, NULL, 1, 1);
575 blk_trace_set_ht_offsets();
576
577 return 0;
578}
579
580module_init(blk_trace_init);
581
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index b9f923ef173d..ccf6ea95f68c 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -82,6 +82,12 @@ config ACPI_PROCFS_POWER
82 and functions, which do not yet exist in /sys 82 and functions, which do not yet exist in /sys
83 83
84 Say N to delete power /proc/acpi/ folders that have moved to /sys/ 84 Say N to delete power /proc/acpi/ folders that have moved to /sys/
85config ACPI_SYSFS_POWER
86 bool "Future power /sys interface"
87 select POWER_SUPPLY
88 default y
89 ---help---
90 Say N to disable power /sys interface
85config ACPI_PROC_EVENT 91config ACPI_PROC_EVENT
86 bool "Deprecated /proc/acpi/event support" 92 bool "Deprecated /proc/acpi/event support"
87 depends on PROC_FS 93 depends on PROC_FS
@@ -103,7 +109,6 @@ config ACPI_PROC_EVENT
103config ACPI_AC 109config ACPI_AC
104 tristate "AC Adapter" 110 tristate "AC Adapter"
105 depends on X86 111 depends on X86
106 select POWER_SUPPLY
107 default y 112 default y
108 help 113 help
109 This driver adds support for the AC Adapter object, which indicates 114 This driver adds support for the AC Adapter object, which indicates
@@ -113,7 +118,6 @@ config ACPI_AC
113config ACPI_BATTERY 118config ACPI_BATTERY
114 tristate "Battery" 119 tristate "Battery"
115 depends on X86 120 depends on X86
116 select POWER_SUPPLY
117 default y 121 default y
118 help 122 help
119 This driver adds support for battery information through 123 This driver adds support for battery information through
@@ -368,7 +372,6 @@ config ACPI_HOTPLUG_MEMORY
368config ACPI_SBS 372config ACPI_SBS
369 tristate "Smart Battery System" 373 tristate "Smart Battery System"
370 depends on X86 374 depends on X86
371 select POWER_SUPPLY
372 help 375 help
373 This driver adds support for the Smart Battery System, another 376 This driver adds support for the Smart Battery System, another
374 type of access to battery information, found on some laptops. 377 type of access to battery information, found on some laptops.
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 76ed4f52bebd..76b9bea98b6d 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -31,7 +31,9 @@
31#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
33#endif 33#endif
34#ifdef CONFIG_ACPI_SYSFS_POWER
34#include <linux/power_supply.h> 35#include <linux/power_supply.h>
36#endif
35#include <acpi/acpi_bus.h> 37#include <acpi/acpi_bus.h>
36#include <acpi/acpi_drivers.h> 38#include <acpi/acpi_drivers.h>
37 39
@@ -79,7 +81,9 @@ static struct acpi_driver acpi_ac_driver = {
79}; 81};
80 82
81struct acpi_ac { 83struct acpi_ac {
84#ifdef CONFIG_ACPI_SYSFS_POWER
82 struct power_supply charger; 85 struct power_supply charger;
86#endif
83 struct acpi_device * device; 87 struct acpi_device * device;
84 unsigned long state; 88 unsigned long state;
85}; 89};
@@ -94,7 +98,7 @@ static const struct file_operations acpi_ac_fops = {
94 .release = single_release, 98 .release = single_release,
95}; 99};
96#endif 100#endif
97 101#ifdef CONFIG_ACPI_SYSFS_POWER
98static int get_ac_property(struct power_supply *psy, 102static int get_ac_property(struct power_supply *psy,
99 enum power_supply_property psp, 103 enum power_supply_property psp,
100 union power_supply_propval *val) 104 union power_supply_propval *val)
@@ -113,7 +117,7 @@ static int get_ac_property(struct power_supply *psy,
113static enum power_supply_property ac_props[] = { 117static enum power_supply_property ac_props[] = {
114 POWER_SUPPLY_PROP_ONLINE, 118 POWER_SUPPLY_PROP_ONLINE,
115}; 119};
116 120#endif
117/* -------------------------------------------------------------------------- 121/* --------------------------------------------------------------------------
118 AC Adapter Management 122 AC Adapter Management
119 -------------------------------------------------------------------------- */ 123 -------------------------------------------------------------------------- */
@@ -241,7 +245,9 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
241 acpi_bus_generate_netlink_event(device->pnp.device_class, 245 acpi_bus_generate_netlink_event(device->pnp.device_class,
242 device->dev.bus_id, event, 246 device->dev.bus_id, event,
243 (u32) ac->state); 247 (u32) ac->state);
248#ifdef CONFIG_ACPI_SYSFS_POWER
244 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 249 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
250#endif
245 break; 251 break;
246 default: 252 default:
247 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 253 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -280,12 +286,14 @@ static int acpi_ac_add(struct acpi_device *device)
280#endif 286#endif
281 if (result) 287 if (result)
282 goto end; 288 goto end;
289#ifdef CONFIG_ACPI_SYSFS_POWER
283 ac->charger.name = acpi_device_bid(device); 290 ac->charger.name = acpi_device_bid(device);
284 ac->charger.type = POWER_SUPPLY_TYPE_MAINS; 291 ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
285 ac->charger.properties = ac_props; 292 ac->charger.properties = ac_props;
286 ac->charger.num_properties = ARRAY_SIZE(ac_props); 293 ac->charger.num_properties = ARRAY_SIZE(ac_props);
287 ac->charger.get_property = get_ac_property; 294 ac->charger.get_property = get_ac_property;
288 power_supply_register(&ac->device->dev, &ac->charger); 295 power_supply_register(&ac->device->dev, &ac->charger);
296#endif
289 status = acpi_install_notify_handler(device->handle, 297 status = acpi_install_notify_handler(device->handle,
290 ACPI_ALL_NOTIFY, acpi_ac_notify, 298 ACPI_ALL_NOTIFY, acpi_ac_notify,
291 ac); 299 ac);
@@ -319,8 +327,10 @@ static int acpi_ac_resume(struct acpi_device *device)
319 old_state = ac->state; 327 old_state = ac->state;
320 if (acpi_ac_get_state(ac)) 328 if (acpi_ac_get_state(ac))
321 return 0; 329 return 0;
330#ifdef CONFIG_ACPI_SYSFS_POWER
322 if (old_state != ac->state) 331 if (old_state != ac->state)
323 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 332 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
333#endif
324 return 0; 334 return 0;
325} 335}
326 336
@@ -337,8 +347,10 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
337 347
338 status = acpi_remove_notify_handler(device->handle, 348 status = acpi_remove_notify_handler(device->handle,
339 ACPI_ALL_NOTIFY, acpi_ac_notify); 349 ACPI_ALL_NOTIFY, acpi_ac_notify);
350#ifdef CONFIG_ACPI_SYSFS_POWER
340 if (ac->charger.dev) 351 if (ac->charger.dev)
341 power_supply_unregister(&ac->charger); 352 power_supply_unregister(&ac->charger);
353#endif
342#ifdef CONFIG_ACPI_PROCFS_POWER 354#ifdef CONFIG_ACPI_PROCFS_POWER
343 acpi_ac_remove_fs(device); 355 acpi_ac_remove_fs(device);
344#endif 356#endif
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 8f7505d304b5..c4a769d1ba85 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -40,7 +40,9 @@
40#include <acpi/acpi_bus.h> 40#include <acpi/acpi_bus.h>
41#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
42 42
43#ifdef CONFIG_ACPI_SYSFS_POWER
43#include <linux/power_supply.h> 44#include <linux/power_supply.h>
45#endif
44 46
45#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 47#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
46 48
@@ -86,7 +88,9 @@ MODULE_DEVICE_TABLE(acpi, battery_device_ids);
86 88
87struct acpi_battery { 89struct acpi_battery {
88 struct mutex lock; 90 struct mutex lock;
91#ifdef CONFIG_ACPI_SYSFS_POWER
89 struct power_supply bat; 92 struct power_supply bat;
93#endif
90 struct acpi_device *device; 94 struct acpi_device *device;
91 unsigned long update_time; 95 unsigned long update_time;
92 int current_now; 96 int current_now;
@@ -117,6 +121,7 @@ inline int acpi_battery_present(struct acpi_battery *battery)
117 return battery->device->status.battery_present; 121 return battery->device->status.battery_present;
118} 122}
119 123
124#ifdef CONFIG_ACPI_SYSFS_POWER
120static int acpi_battery_technology(struct acpi_battery *battery) 125static int acpi_battery_technology(struct acpi_battery *battery)
121{ 126{
122 if (!strcasecmp("NiCd", battery->type)) 127 if (!strcasecmp("NiCd", battery->type))
@@ -222,6 +227,7 @@ static enum power_supply_property energy_battery_props[] = {
222 POWER_SUPPLY_PROP_MODEL_NAME, 227 POWER_SUPPLY_PROP_MODEL_NAME,
223 POWER_SUPPLY_PROP_MANUFACTURER, 228 POWER_SUPPLY_PROP_MANUFACTURER,
224}; 229};
230#endif
225 231
226#ifdef CONFIG_ACPI_PROCFS_POWER 232#ifdef CONFIG_ACPI_PROCFS_POWER
227inline char *acpi_battery_units(struct acpi_battery *battery) 233inline char *acpi_battery_units(struct acpi_battery *battery)
@@ -398,6 +404,7 @@ static int acpi_battery_init_alarm(struct acpi_battery *battery)
398 return acpi_battery_set_alarm(battery); 404 return acpi_battery_set_alarm(battery);
399} 405}
400 406
407#ifdef CONFIG_ACPI_SYSFS_POWER
401static ssize_t acpi_battery_alarm_show(struct device *dev, 408static ssize_t acpi_battery_alarm_show(struct device *dev,
402 struct device_attribute *attr, 409 struct device_attribute *attr,
403 char *buf) 410 char *buf)
@@ -429,11 +436,6 @@ static int sysfs_add_battery(struct acpi_battery *battery)
429{ 436{
430 int result; 437 int result;
431 438
432 battery->update_time = 0;
433 result = acpi_battery_get_info(battery);
434 acpi_battery_init_alarm(battery);
435 if (result)
436 return result;
437 if (battery->power_unit) { 439 if (battery->power_unit) {
438 battery->bat.properties = charge_battery_props; 440 battery->bat.properties = charge_battery_props;
439 battery->bat.num_properties = 441 battery->bat.num_properties =
@@ -462,18 +464,31 @@ static void sysfs_remove_battery(struct acpi_battery *battery)
462 power_supply_unregister(&battery->bat); 464 power_supply_unregister(&battery->bat);
463 battery->bat.dev = NULL; 465 battery->bat.dev = NULL;
464} 466}
467#endif
465 468
466static int acpi_battery_update(struct acpi_battery *battery) 469static int acpi_battery_update(struct acpi_battery *battery)
467{ 470{
468 int result = acpi_battery_get_status(battery); 471 int result;
472 result = acpi_battery_get_status(battery);
469 if (result) 473 if (result)
470 return result; 474 return result;
475#ifdef CONFIG_ACPI_SYSFS_POWER
471 if (!acpi_battery_present(battery)) { 476 if (!acpi_battery_present(battery)) {
472 sysfs_remove_battery(battery); 477 sysfs_remove_battery(battery);
478 battery->update_time = 0;
473 return 0; 479 return 0;
474 } 480 }
481#endif
482 if (!battery->update_time) {
483 result = acpi_battery_get_info(battery);
484 if (result)
485 return result;
486 acpi_battery_init_alarm(battery);
487 }
488#ifdef CONFIG_ACPI_SYSFS_POWER
475 if (!battery->bat.dev) 489 if (!battery->bat.dev)
476 sysfs_add_battery(battery); 490 sysfs_add_battery(battery);
491#endif
477 return acpi_battery_get_state(battery); 492 return acpi_battery_get_state(battery);
478} 493}
479 494
@@ -767,9 +782,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
767 acpi_bus_generate_netlink_event(device->pnp.device_class, 782 acpi_bus_generate_netlink_event(device->pnp.device_class,
768 device->dev.bus_id, event, 783 device->dev.bus_id, event,
769 acpi_battery_present(battery)); 784 acpi_battery_present(battery));
785#ifdef CONFIG_ACPI_SYSFS_POWER
770 /* acpi_batter_update could remove power_supply object */ 786 /* acpi_batter_update could remove power_supply object */
771 if (battery->bat.dev) 787 if (battery->bat.dev)
772 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); 788 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
789#endif
773} 790}
774 791
775static int acpi_battery_add(struct acpi_device *device) 792static int acpi_battery_add(struct acpi_device *device)
@@ -828,7 +845,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
828#ifdef CONFIG_ACPI_PROCFS_POWER 845#ifdef CONFIG_ACPI_PROCFS_POWER
829 acpi_battery_remove_fs(device); 846 acpi_battery_remove_fs(device);
830#endif 847#endif
848#ifdef CONFIG_ACPI_SYSFS_POWER
831 sysfs_remove_battery(battery); 849 sysfs_remove_battery(battery);
850#endif
832 mutex_destroy(&battery->lock); 851 mutex_destroy(&battery->lock);
833 kfree(battery); 852 kfree(battery);
834 return 0; 853 return 0;
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 49d432d0a12c..d7a115c362d1 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -29,7 +29,6 @@
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/pm.h> 31#include <linux/pm.h>
32#include <linux/pm_legacy.h>
33#include <linux/device.h> 32#include <linux/device.h>
34#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
35#ifdef CONFIG_X86 34#ifdef CONFIG_X86
@@ -764,16 +763,14 @@ static int __init acpi_init(void)
764 result = acpi_bus_init(); 763 result = acpi_bus_init();
765 764
766 if (!result) { 765 if (!result) {
767#ifdef CONFIG_PM_LEGACY 766 if (!(pm_flags & PM_APM))
768 if (!PM_IS_ACTIVE()) 767 pm_flags |= PM_ACPI;
769 pm_active = 1;
770 else { 768 else {
771 printk(KERN_INFO PREFIX 769 printk(KERN_INFO PREFIX
772 "APM is already active, exiting\n"); 770 "APM is already active, exiting\n");
773 disable_acpi(); 771 disable_acpi();
774 result = -ENODEV; 772 result = -ENODEV;
775 } 773 }
776#endif
777 } else 774 } else
778 disable_acpi(); 775 disable_acpi();
779 776
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d411017f8c06..97dc16155a55 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -892,6 +892,17 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
892 return 0; 892 return 0;
893} 893}
894 894
895int __init acpi_boot_ec_enable(void)
896{
897 if (!boot_ec || boot_ec->handlers_installed)
898 return 0;
899 if (!ec_install_handlers(boot_ec)) {
900 first_ec = boot_ec;
901 return 0;
902 }
903 return -EFAULT;
904}
905
895int __init acpi_ec_ecdt_probe(void) 906int __init acpi_ec_ecdt_probe(void)
896{ 907{
897 int ret; 908 int ret;
@@ -924,9 +935,10 @@ int __init acpi_ec_ecdt_probe(void)
924 goto error; 935 goto error;
925 /* We really need to limit this workaround, the only ASUS, 936 /* We really need to limit this workaround, the only ASUS,
926 * which needs it, has fake EC._INI method, so use it as flag. 937 * which needs it, has fake EC._INI method, so use it as flag.
938 * Keep boot_ec struct as it will be needed soon.
927 */ 939 */
928 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) 940 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
929 goto error; 941 return -ENODEV;
930 } 942 }
931 943
932 ret = ec_install_handlers(boot_ec); 944 ret = ec_install_handlers(boot_ec);
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index e99f0c435a47..58ad09725dd2 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -344,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
344 * setup will potentially execute control methods 344 * setup will potentially execute control methods
345 * (e.g., _REG method for this region) 345 * (e.g., _REG method for this region)
346 */ 346 */
347 acpi_ex_relinquish_interpreter(); 347 acpi_ex_exit_interpreter();
348 348
349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE, 349 status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
350 handler_desc->address_space.context, 350 handler_desc->address_space.context,
@@ -352,7 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
352 352
353 /* Re-enter the interpreter */ 353 /* Re-enter the interpreter */
354 354
355 acpi_ex_reacquire_interpreter(); 355 acpi_ex_enter_interpreter();
356 356
357 /* Check for failure of the Region Setup */ 357 /* Check for failure of the Region Setup */
358 358
@@ -405,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
405 * exit the interpreter because the handler *might* block -- we don't 405 * exit the interpreter because the handler *might* block -- we don't
406 * know what it will do, so we can't hold the lock on the intepreter. 406 * know what it will do, so we can't hold the lock on the intepreter.
407 */ 407 */
408 acpi_ex_relinquish_interpreter(); 408 acpi_ex_exit_interpreter();
409 } 409 }
410 410
411 /* Call the handler */ 411 /* Call the handler */
@@ -426,7 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
426 * We just returned from a non-default handler, we must re-enter the 426 * We just returned from a non-default handler, we must re-enter the
427 * interpreter 427 * interpreter
428 */ 428 */
429 acpi_ex_reacquire_interpreter(); 429 acpi_ex_enter_interpreter();
430 } 430 }
431 431
432 return_ACPI_STATUS(status); 432 return_ACPI_STATUS(status);
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index dd3186abe07a..62010c2481b3 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -429,6 +429,15 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
429 &polarity, &link, 429 &polarity, &link,
430 acpi_pci_allocate_irq); 430 acpi_pci_allocate_irq);
431 431
432 if (irq < 0) {
433 /*
434 * IDE legacy mode controller IRQs are magic. Why do compat
435 * extensions always make such a nasty mess.
436 */
437 if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE &&
438 (dev->class & 0x05) == 0)
439 return 0;
440 }
432 /* 441 /*
433 * No IRQ known to the ACPI subsystem - maybe the BIOS / 442 * No IRQ known to the ACPI subsystem - maybe the BIOS /
434 * driver reported one, then use it. Exit in any case. 443 * driver reported one, then use it. Exit in any case.
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2fe34cc73c13..2235f4e02d26 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -76,7 +76,11 @@ static void (*pm_idle_save) (void) __read_mostly;
76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000)) 76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
77 77
78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER; 78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
79#ifdef CONFIG_CPU_IDLE
79module_param(max_cstate, uint, 0000); 80module_param(max_cstate, uint, 0000);
81#else
82module_param(max_cstate, uint, 0644);
83#endif
80static unsigned int nocst __read_mostly; 84static unsigned int nocst __read_mostly;
81module_param(nocst, uint, 0000); 85module_param(nocst, uint, 0000);
82 86
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 22cb95b349e4..f136c7d3b3c2 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -40,7 +40,9 @@
40#include <linux/jiffies.h> 40#include <linux/jiffies.h>
41#include <linux/delay.h> 41#include <linux/delay.h>
42 42
43#ifdef CONFIG_ACPI_SYSFS_POWER
43#include <linux/power_supply.h> 44#include <linux/power_supply.h>
45#endif
44 46
45#include "sbshc.h" 47#include "sbshc.h"
46 48
@@ -80,7 +82,9 @@ static const struct acpi_device_id sbs_device_ids[] = {
80MODULE_DEVICE_TABLE(acpi, sbs_device_ids); 82MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
81 83
82struct acpi_battery { 84struct acpi_battery {
85#ifdef CONFIG_ACPI_SYSFS_POWER
83 struct power_supply bat; 86 struct power_supply bat;
87#endif
84 struct acpi_sbs *sbs; 88 struct acpi_sbs *sbs;
85#ifdef CONFIG_ACPI_PROCFS_POWER 89#ifdef CONFIG_ACPI_PROCFS_POWER
86 struct proc_dir_entry *proc_entry; 90 struct proc_dir_entry *proc_entry;
@@ -113,7 +117,9 @@ struct acpi_battery {
113#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); 117#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
114 118
115struct acpi_sbs { 119struct acpi_sbs {
120#ifdef CONFIG_ACPI_SYSFS_POWER
116 struct power_supply charger; 121 struct power_supply charger;
122#endif
117 struct acpi_device *device; 123 struct acpi_device *device;
118 struct acpi_smb_hc *hc; 124 struct acpi_smb_hc *hc;
119 struct mutex lock; 125 struct mutex lock;
@@ -157,6 +163,7 @@ static inline int acpi_battery_scale(struct acpi_battery *battery)
157 acpi_battery_ipscale(battery); 163 acpi_battery_ipscale(battery);
158} 164}
159 165
166#ifdef CONFIG_ACPI_SYSFS_POWER
160static int sbs_get_ac_property(struct power_supply *psy, 167static int sbs_get_ac_property(struct power_supply *psy,
161 enum power_supply_property psp, 168 enum power_supply_property psp,
162 union power_supply_propval *val) 169 union power_supply_propval *val)
@@ -294,6 +301,7 @@ static enum power_supply_property sbs_energy_battery_props[] = {
294 POWER_SUPPLY_PROP_MODEL_NAME, 301 POWER_SUPPLY_PROP_MODEL_NAME,
295 POWER_SUPPLY_PROP_MANUFACTURER, 302 POWER_SUPPLY_PROP_MANUFACTURER,
296}; 303};
304#endif
297 305
298/* -------------------------------------------------------------------------- 306/* --------------------------------------------------------------------------
299 Smart Battery System Management 307 Smart Battery System Management
@@ -429,6 +437,7 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)
429 return result; 437 return result;
430} 438}
431 439
440#ifdef CONFIG_ACPI_SYSFS_POWER
432static ssize_t acpi_battery_alarm_show(struct device *dev, 441static ssize_t acpi_battery_alarm_show(struct device *dev,
433 struct device_attribute *attr, 442 struct device_attribute *attr,
434 char *buf) 443 char *buf)
@@ -458,6 +467,7 @@ static struct device_attribute alarm_attr = {
458 .show = acpi_battery_alarm_show, 467 .show = acpi_battery_alarm_show,
459 .store = acpi_battery_alarm_store, 468 .store = acpi_battery_alarm_store,
460}; 469};
470#endif
461 471
462/* -------------------------------------------------------------------------- 472/* --------------------------------------------------------------------------
463 FS Interface (/proc/acpi) 473 FS Interface (/proc/acpi)
@@ -793,6 +803,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
793 &acpi_battery_state_fops, &acpi_battery_alarm_fops, 803 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
794 battery); 804 battery);
795#endif 805#endif
806#ifdef CONFIG_ACPI_SYSFS_POWER
796 battery->bat.name = battery->name; 807 battery->bat.name = battery->name;
797 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY; 808 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
798 if (!acpi_battery_mode(battery)) { 809 if (!acpi_battery_mode(battery)) {
@@ -813,6 +824,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
813 goto end; 824 goto end;
814 battery->have_sysfs_alarm = 1; 825 battery->have_sysfs_alarm = 1;
815 end: 826 end:
827#endif
816 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 828 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
817 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 829 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
818 battery->name, sbs->battery->present ? "present" : "absent"); 830 battery->name, sbs->battery->present ? "present" : "absent");
@@ -822,12 +834,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id)
822static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 834static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
823{ 835{
824 struct acpi_battery *battery = &sbs->battery[id]; 836 struct acpi_battery *battery = &sbs->battery[id];
825 837#ifdef CONFIG_ACPI_SYSFS_POWER
826 if (battery->bat.dev) { 838 if (battery->bat.dev) {
827 if (battery->have_sysfs_alarm) 839 if (battery->have_sysfs_alarm)
828 device_remove_file(battery->bat.dev, &alarm_attr); 840 device_remove_file(battery->bat.dev, &alarm_attr);
829 power_supply_unregister(&battery->bat); 841 power_supply_unregister(&battery->bat);
830 } 842 }
843#endif
831#ifdef CONFIG_ACPI_PROCFS_POWER 844#ifdef CONFIG_ACPI_PROCFS_POWER
832 if (battery->proc_entry) 845 if (battery->proc_entry)
833 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); 846 acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir);
@@ -848,12 +861,14 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
848 if (result) 861 if (result)
849 goto end; 862 goto end;
850#endif 863#endif
864#ifdef CONFIG_ACPI_SYSFS_POWER
851 sbs->charger.name = "sbs-charger"; 865 sbs->charger.name = "sbs-charger";
852 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS; 866 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
853 sbs->charger.properties = sbs_ac_props; 867 sbs->charger.properties = sbs_ac_props;
854 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props); 868 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
855 sbs->charger.get_property = sbs_get_ac_property; 869 sbs->charger.get_property = sbs_get_ac_property;
856 power_supply_register(&sbs->device->dev, &sbs->charger); 870 power_supply_register(&sbs->device->dev, &sbs->charger);
871#endif
857 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", 872 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
858 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 873 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
859 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line"); 874 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
@@ -863,8 +878,10 @@ static int acpi_charger_add(struct acpi_sbs *sbs)
863 878
864static void acpi_charger_remove(struct acpi_sbs *sbs) 879static void acpi_charger_remove(struct acpi_sbs *sbs)
865{ 880{
881#ifdef CONFIG_ACPI_SYSFS_POWER
866 if (sbs->charger.dev) 882 if (sbs->charger.dev)
867 power_supply_unregister(&sbs->charger); 883 power_supply_unregister(&sbs->charger);
884#endif
868#ifdef CONFIG_ACPI_PROCFS_POWER 885#ifdef CONFIG_ACPI_PROCFS_POWER
869 if (sbs->charger_entry) 886 if (sbs->charger_entry)
870 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); 887 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
@@ -885,7 +902,9 @@ void acpi_sbs_callback(void *context)
885 ACPI_SBS_NOTIFY_STATUS, 902 ACPI_SBS_NOTIFY_STATUS,
886 sbs->charger_present); 903 sbs->charger_present);
887#endif 904#endif
905#ifdef CONFIG_ACPI_SYSFS_POWER
888 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE); 906 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
907#endif
889 } 908 }
890 if (sbs->manager_present) { 909 if (sbs->manager_present) {
891 for (id = 0; id < MAX_SBS_BAT; ++id) { 910 for (id = 0; id < MAX_SBS_BAT; ++id) {
@@ -902,7 +921,9 @@ void acpi_sbs_callback(void *context)
902 ACPI_SBS_NOTIFY_STATUS, 921 ACPI_SBS_NOTIFY_STATUS,
903 bat->present); 922 bat->present);
904#endif 923#endif
924#ifdef CONFIG_ACPI_SYSFS_POWER
905 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE); 925 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
926#endif
906 } 927 }
907 } 928 }
908} 929}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5b4d462117cf..cbfe9ae7a9e5 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1449,6 +1449,8 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1449 return result; 1449 return result;
1450} 1450}
1451 1451
1452int __init acpi_boot_ec_enable(void);
1453
1452static int __init acpi_scan_init(void) 1454static int __init acpi_scan_init(void)
1453{ 1455{
1454 int result; 1456 int result;
@@ -1480,6 +1482,10 @@ static int __init acpi_scan_init(void)
1480 * Enumerate devices in the ACPI namespace. 1482 * Enumerate devices in the ACPI namespace.
1481 */ 1483 */
1482 result = acpi_bus_scan_fixed(acpi_root); 1484 result = acpi_bus_scan_fixed(acpi_root);
1485
1486 /* EC region might be needed at bus_scan, so enable it now */
1487 acpi_boot_ec_enable();
1488
1483 if (!result) 1489 if (!result)
1484 result = acpi_bus_scan(acpi_root, &ops); 1490 result = acpi_bus_scan(acpi_root, &ops);
1485 1491
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index bb62a588f489..b406b39b878e 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -132,6 +132,7 @@ enum {
132 ich8_2port_sata, 132 ich8_2port_sata,
133 ich8m_apple_sata_ahci, /* locks up on second port enable */ 133 ich8m_apple_sata_ahci, /* locks up on second port enable */
134 tolapai_sata_ahci, 134 tolapai_sata_ahci,
135 piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */
135 136
136 /* constants for mapping table */ 137 /* constants for mapping table */
137 P0 = 0, /* port 0 */ 138 P0 = 0, /* port 0 */
@@ -165,6 +166,7 @@ static void piix_set_piomode(struct ata_port *ap, struct ata_device *adev);
165static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev); 166static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
166static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); 167static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev);
167static int ich_pata_cable_detect(struct ata_port *ap); 168static int ich_pata_cable_detect(struct ata_port *ap);
169static u8 piix_vmw_bmdma_status(struct ata_port *ap);
168#ifdef CONFIG_PM 170#ifdef CONFIG_PM
169static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 171static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
170static int piix_pci_device_resume(struct pci_dev *pdev); 172static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -175,6 +177,8 @@ static unsigned int in_module_init = 1;
175static const struct pci_device_id piix_pci_tbl[] = { 177static const struct pci_device_id piix_pci_tbl[] = {
176 /* Intel PIIX3 for the 430HX etc */ 178 /* Intel PIIX3 for the 430HX etc */
177 { 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma }, 179 { 0x8086, 0x7010, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_mwdma },
180 /* VMware ICH4 */
181 { 0x8086, 0x7111, 0x15ad, 0x1976, 0, 0, piix_pata_vmw },
178 /* Intel PIIX4 for the 430TX/440BX/MX chipset: UDMA 33 */ 182 /* Intel PIIX4 for the 430TX/440BX/MX chipset: UDMA 33 */
179 /* Also PIIX4E (fn3 rev 2) and PIIX4M (fn3 rev 3) */ 183 /* Also PIIX4E (fn3 rev 2) and PIIX4M (fn3 rev 3) */
180 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_33 }, 184 { 0x8086, 0x7111, PCI_ANY_ID, PCI_ANY_ID, 0, 0, piix_pata_33 },
@@ -383,6 +387,38 @@ static const struct ata_port_operations piix_sata_ops = {
383 .port_start = ata_port_start, 387 .port_start = ata_port_start,
384}; 388};
385 389
390static const struct ata_port_operations piix_vmw_ops = {
391 .set_piomode = piix_set_piomode,
392 .set_dmamode = piix_set_dmamode,
393 .mode_filter = ata_pci_default_filter,
394
395 .tf_load = ata_tf_load,
396 .tf_read = ata_tf_read,
397 .check_status = ata_check_status,
398 .exec_command = ata_exec_command,
399 .dev_select = ata_std_dev_select,
400
401 .bmdma_setup = ata_bmdma_setup,
402 .bmdma_start = ata_bmdma_start,
403 .bmdma_stop = ata_bmdma_stop,
404 .bmdma_status = piix_vmw_bmdma_status,
405 .qc_prep = ata_qc_prep,
406 .qc_issue = ata_qc_issue_prot,
407 .data_xfer = ata_data_xfer,
408
409 .freeze = ata_bmdma_freeze,
410 .thaw = ata_bmdma_thaw,
411 .error_handler = piix_pata_error_handler,
412 .post_internal_cmd = ata_bmdma_post_internal_cmd,
413 .cable_detect = ata_cable_40wire,
414
415 .irq_handler = ata_interrupt,
416 .irq_clear = ata_bmdma_irq_clear,
417 .irq_on = ata_irq_on,
418
419 .port_start = ata_port_start,
420};
421
386static const struct piix_map_db ich5_map_db = { 422static const struct piix_map_db ich5_map_db = {
387 .mask = 0x7, 423 .mask = 0x7,
388 .port_enable = 0x3, 424 .port_enable = 0x3,
@@ -623,6 +659,16 @@ static struct ata_port_info piix_port_info[] = {
623 .port_ops = &piix_sata_ops, 659 .port_ops = &piix_sata_ops,
624 }, 660 },
625 661
662 [piix_pata_vmw] =
663 {
664 .sht = &piix_sht,
665 .flags = PIIX_PATA_FLAGS,
666 .pio_mask = 0x1f, /* pio0-4 */
667 .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */
668 .udma_mask = ATA_UDMA_MASK_40C,
669 .port_ops = &piix_vmw_ops,
670 },
671
626}; 672};
627 673
628static struct pci_bits piix_enable_bits[] = { 674static struct pci_bits piix_enable_bits[] = {
@@ -1135,6 +1181,11 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
1135} 1181}
1136#endif 1182#endif
1137 1183
1184static u8 piix_vmw_bmdma_status(struct ata_port *ap)
1185{
1186 return ata_bmdma_status(ap) & ~ATA_DMA_ERR;
1187}
1188
1138#define AHCI_PCI_BAR 5 1189#define AHCI_PCI_BAR 5
1139#define AHCI_GLOBAL_CTL 0x04 1190#define AHCI_GLOBAL_CTL 0x04
1140#define AHCI_ENABLE (1 << 31) 1191#define AHCI_ENABLE (1 << 31)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4753a1831dbc..6380726f7538 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -6998,7 +6998,9 @@ int ata_host_start(struct ata_host *host)
6998 rc = ap->ops->port_start(ap); 6998 rc = ap->ops->port_start(ap);
6999 if (rc) { 6999 if (rc) {
7000 if (rc != -ENODEV) 7000 if (rc != -ENODEV)
7001 dev_printk(KERN_ERR, host->dev, "failed to start port %d (errno=%d)\n", i, rc); 7001 dev_printk(KERN_ERR, host->dev,
7002 "failed to start port %d "
7003 "(errno=%d)\n", i, rc);
7002 goto err_out; 7004 goto err_out;
7003 } 7005 }
7004 } 7006 }
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index f0124a8d3134..21a81cd148e4 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1733,11 +1733,15 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK; 1733 ehc->i.action &= ~ATA_EH_PERDEV_MASK;
1734 } 1734 }
1735 1735
1736 /* consider speeding down */ 1736 /* propagate timeout to host link */
1737 if ((all_err_mask & AC_ERR_TIMEOUT) && !ata_is_host_link(link))
1738 ap->link.eh_context.i.err_mask |= AC_ERR_TIMEOUT;
1739
1740 /* record error and consider speeding down */
1737 dev = ehc->i.dev; 1741 dev = ehc->i.dev;
1738 if (!dev && ata_link_max_devices(link) == 1 && 1742 if (!dev && ((ata_link_max_devices(link) == 1 &&
1739 ata_dev_enabled(link->device)) 1743 ata_dev_enabled(link->device))))
1740 dev = link->device; 1744 dev = link->device;
1741 1745
1742 if (dev) 1746 if (dev)
1743 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask); 1747 ehc->i.action |= ata_eh_speed_down(dev, is_io, all_err_mask);
@@ -1759,8 +1763,14 @@ void ata_eh_autopsy(struct ata_port *ap)
1759{ 1763{
1760 struct ata_link *link; 1764 struct ata_link *link;
1761 1765
1762 __ata_port_for_each_link(link, ap) 1766 ata_port_for_each_link(link, ap)
1763 ata_eh_link_autopsy(link); 1767 ata_eh_link_autopsy(link);
1768
1769 /* Autopsy of fanout ports can affect host link autopsy.
1770 * Perform host link autopsy last.
1771 */
1772 if (ap->nr_pmp_links)
1773 ata_eh_link_autopsy(&ap->link);
1764} 1774}
1765 1775
1766/** 1776/**
@@ -2157,13 +2167,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
2157 if (ata_link_offline(link)) 2167 if (ata_link_offline(link))
2158 continue; 2168 continue;
2159 2169
2160 /* apply class override and convert UNKNOWN to NONE */ 2170 /* apply class override */
2161 if (lflags & ATA_LFLAG_ASSUME_ATA) 2171 if (lflags & ATA_LFLAG_ASSUME_ATA)
2162 classes[dev->devno] = ATA_DEV_ATA; 2172 classes[dev->devno] = ATA_DEV_ATA;
2163 else if (lflags & ATA_LFLAG_ASSUME_SEMB) 2173 else if (lflags & ATA_LFLAG_ASSUME_SEMB)
2164 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */ 2174 classes[dev->devno] = ATA_DEV_SEMB_UNSUP; /* not yet */
2165 else if (classes[dev->devno] == ATA_DEV_UNKNOWN)
2166 classes[dev->devno] = ATA_DEV_NONE;
2167 } 2175 }
2168 2176
2169 /* record current link speed */ 2177 /* record current link speed */
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
index c0c4dbcde091..caef2bbd4a8a 100644
--- a/drivers/ata/libata-pmp.c
+++ b/drivers/ata/libata-pmp.c
@@ -495,14 +495,12 @@ static void sata_pmp_quirks(struct ata_port *ap)
495 /* SError.N need a kick in the ass to get working */ 495 /* SError.N need a kick in the ass to get working */
496 link->flags |= ATA_LFLAG_HRST_TO_RESUME; 496 link->flags |= ATA_LFLAG_HRST_TO_RESUME;
497 497
498 /* class code report is unreliable */ 498 /* Class code report is unreliable and SRST
499 if (link->pmp < 5) 499 * times out under certain configurations.
500 link->flags |= ATA_LFLAG_ASSUME_ATA; 500 * Config device can be at port 0 or 5 and
501 501 * locks up on SRST.
502 /* The config device, which can be either at
503 * port 0 or 5, locks up on SRST.
504 */ 502 */
505 if (link->pmp == 0 || link->pmp == 5) 503 if (link->pmp <= 5)
506 link->flags |= ATA_LFLAG_NO_SRST | 504 link->flags |= ATA_LFLAG_NO_SRST |
507 ATA_LFLAG_ASSUME_ATA; 505 ATA_LFLAG_ASSUME_ATA;
508 506
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a883bb03d4c7..14daf4848f09 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -841,6 +841,9 @@ static void ata_scsi_dev_config(struct scsi_device *sdev,
841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1); 841 blk_queue_max_hw_segments(q, q->max_hw_segments - 1);
842 } 842 }
843 843
844 if (dev->class == ATA_DEV_ATA)
845 sdev->manage_start_stop = 1;
846
844 if (dev->flags & ATA_DFLAG_AN) 847 if (dev->flags & ATA_DFLAG_AN)
845 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); 848 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
846 849
@@ -872,8 +875,6 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
872 875
873 ata_scsi_sdev_config(sdev); 876 ata_scsi_sdev_config(sdev);
874 877
875 sdev->manage_start_stop = 1;
876
877 if (dev) 878 if (dev)
878 ata_scsi_dev_config(sdev, dev); 879 ata_scsi_dev_config(sdev, dev);
879 880
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 48acc09dab96..b7ac80b4b1fb 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -806,7 +806,10 @@ int ata_pci_init_one(struct pci_dev *pdev,
806 if (rc) 806 if (rc)
807 goto err_out; 807 goto err_out;
808 808
809 if (!legacy_mode) { 809 if (!legacy_mode && pdev->irq) {
810 /* We may have no IRQ assigned in which case we can poll. This
811 shouldn't happen on a sane system but robustness is cheap
812 in this case */
810 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler, 813 rc = devm_request_irq(dev, pdev->irq, pi->port_ops->irq_handler,
811 IRQF_SHARED, DRV_NAME, host); 814 IRQF_SHARED, DRV_NAME, host);
812 if (rc) 815 if (rc)
@@ -814,7 +817,7 @@ int ata_pci_init_one(struct pci_dev *pdev,
814 817
815 ata_port_desc(host->ports[0], "irq %d", pdev->irq); 818 ata_port_desc(host->ports[0], "irq %d", pdev->irq);
816 ata_port_desc(host->ports[1], "irq %d", pdev->irq); 819 ata_port_desc(host->ports[1], "irq %d", pdev->irq);
817 } else { 820 } else if (legacy_mode) {
818 if (!ata_port_is_dummy(host->ports[0])) { 821 if (!ata_port_is_dummy(host->ports[0])) {
819 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), 822 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
820 pi->port_ops->irq_handler, 823 pi->port_ops->irq_handler,
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 088a41f4e656..7842cc487359 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1509,7 +1509,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1509 if (res == NULL) 1509 if (res == NULL)
1510 return -EINVAL; 1510 return -EINVAL;
1511 1511
1512 while (bfin_port_info[board_idx].udma_mask>0 && udma_fsclk[udma_mode] > fsclk) { 1512 while (bfin_port_info[board_idx].udma_mask > 0 &&
1513 udma_fsclk[udma_mode] > fsclk) {
1513 udma_mode--; 1514 udma_mode--;
1514 bfin_port_info[board_idx].udma_mask >>= 1; 1515 bfin_port_info[board_idx].udma_mask >>= 1;
1515 } 1516 }
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c
index fcd532afbf2e..120b5bfa7ce6 100644
--- a/drivers/ata/pata_ixp4xx_cf.c
+++ b/drivers/ata/pata_ixp4xx_cf.c
@@ -130,10 +130,11 @@ static struct ata_port_operations ixp4xx_port_ops = {
130 .port_start = ata_port_start, 130 .port_start = ata_port_start,
131}; 131};
132 132
133static void ixp4xx_setup_port(struct ata_ioports *ioaddr, 133static void ixp4xx_setup_port(struct ata_port *ap,
134 struct ixp4xx_pata_data *data, 134 struct ixp4xx_pata_data *data,
135 unsigned long raw_cs0, unsigned long raw_cs1) 135 unsigned long raw_cs0, unsigned long raw_cs1)
136{ 136{
137 struct ata_ioports *ioaddr = &ap->ioaddr;
137 unsigned long raw_cmd = raw_cs0; 138 unsigned long raw_cmd = raw_cs0;
138 unsigned long raw_ctl = raw_cs1 + 0x06; 139 unsigned long raw_ctl = raw_cs1 + 0x06;
139 140
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index 7bed8d806381..17159b5e1e43 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -271,14 +271,12 @@ static void pdc_data_xfer_vlb(struct ata_device *adev, unsigned char *buf, unsig
271 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 271 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
272 272
273 if (unlikely(slop)) { 273 if (unlikely(slop)) {
274 u32 pad; 274 __le32 pad = 0;
275 if (write_data) { 275 if (write_data) {
276 memcpy(&pad, buf + buflen - slop, slop); 276 memcpy(&pad, buf + buflen - slop, slop);
277 pad = le32_to_cpu(pad); 277 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
278 iowrite32(pad, ap->ioaddr.data_addr);
279 } else { 278 } else {
280 pad = ioread32(ap->ioaddr.data_addr); 279 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
281 pad = cpu_to_le16(pad);
282 memcpy(buf + buflen - slop, &pad, slop); 280 memcpy(buf + buflen - slop, &pad, slop);
283 } 281 }
284 } 282 }
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c
index bc7c2d5d8d5e..6c9689b59b06 100644
--- a/drivers/ata/pata_pdc202xx_old.c
+++ b/drivers/ata/pata_pdc202xx_old.c
@@ -215,8 +215,8 @@ static void pdc2026x_bmdma_stop(struct ata_queued_cmd *qc)
215 /* Flip back to 33Mhz for PIO */ 215 /* Flip back to 33Mhz for PIO */
216 if (adev->dma_mode >= XFER_UDMA_2) 216 if (adev->dma_mode >= XFER_UDMA_2)
217 iowrite8(ioread8(clock) & ~sel66, clock); 217 iowrite8(ioread8(clock) & ~sel66, clock);
218
219 ata_bmdma_stop(qc); 218 ata_bmdma_stop(qc);
219 pdc202xx_set_piomode(ap, adev);
220} 220}
221 221
222/** 222/**
@@ -233,6 +233,35 @@ static void pdc2026x_dev_config(struct ata_device *adev)
233 adev->max_sectors = 256; 233 adev->max_sectors = 256;
234} 234}
235 235
236static int pdc2026x_port_start(struct ata_port *ap)
237{
238 void __iomem *bmdma = ap->ioaddr.bmdma_addr;
239 if (bmdma) {
240 /* Enable burst mode */
241 u8 burst = ioread8(bmdma + 0x1f);
242 iowrite8(burst | 0x01, bmdma + 0x1f);
243 }
244 return ata_sff_port_start(ap);
245}
246
247/**
248 * pdc2026x_check_atapi_dma - Check whether ATAPI DMA can be supported for this command
249 * @qc: Metadata associated with taskfile to check
250 *
251 * Just say no - not supported on older Promise.
252 *
253 * LOCKING:
254 * None (inherited from caller).
255 *
256 * RETURNS: 0 when ATAPI DMA can be used
257 * 1 otherwise
258 */
259
260static int pdc2026x_check_atapi_dma(struct ata_queued_cmd *qc)
261{
262 return 1;
263}
264
236static struct scsi_host_template pdc202xx_sht = { 265static struct scsi_host_template pdc202xx_sht = {
237 .module = THIS_MODULE, 266 .module = THIS_MODULE,
238 .name = DRV_NAME, 267 .name = DRV_NAME,
@@ -300,6 +329,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
300 .post_internal_cmd = ata_bmdma_post_internal_cmd, 329 .post_internal_cmd = ata_bmdma_post_internal_cmd,
301 .cable_detect = pdc2026x_cable_detect, 330 .cable_detect = pdc2026x_cable_detect,
302 331
332 .check_atapi_dma= pdc2026x_check_atapi_dma,
303 .bmdma_setup = ata_bmdma_setup, 333 .bmdma_setup = ata_bmdma_setup,
304 .bmdma_start = pdc2026x_bmdma_start, 334 .bmdma_start = pdc2026x_bmdma_start,
305 .bmdma_stop = pdc2026x_bmdma_stop, 335 .bmdma_stop = pdc2026x_bmdma_stop,
@@ -313,7 +343,7 @@ static struct ata_port_operations pdc2026x_port_ops = {
313 .irq_clear = ata_bmdma_irq_clear, 343 .irq_clear = ata_bmdma_irq_clear,
314 .irq_on = ata_irq_on, 344 .irq_on = ata_irq_on,
315 345
316 .port_start = ata_sff_port_start, 346 .port_start = pdc2026x_port_start,
317}; 347};
318 348
319static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 349static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ata/pata_qdi.c b/drivers/ata/pata_qdi.c
index 7d4c696c4cb6..a4c0e502cb42 100644
--- a/drivers/ata/pata_qdi.c
+++ b/drivers/ata/pata_qdi.c
@@ -136,14 +136,12 @@ static void qdi_data_xfer(struct ata_device *adev, unsigned char *buf, unsigned
136 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 136 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
137 137
138 if (unlikely(slop)) { 138 if (unlikely(slop)) {
139 u32 pad; 139 __le32 pad = 0;
140 if (write_data) { 140 if (write_data) {
141 memcpy(&pad, buf + buflen - slop, slop); 141 memcpy(&pad, buf + buflen - slop, slop);
142 pad = le32_to_cpu(pad); 142 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
143 iowrite32(pad, ap->ioaddr.data_addr);
144 } else { 143 } else {
145 pad = ioread32(ap->ioaddr.data_addr); 144 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
146 pad = cpu_to_le32(pad);
147 memcpy(buf + buflen - slop, &pad, slop); 145 memcpy(buf + buflen - slop, &pad, slop);
148 } 146 }
149 } 147 }
diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 311cdb3a5566..7116a9e7a8b2 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -104,14 +104,12 @@ static void winbond_data_xfer(struct ata_device *adev, unsigned char *buf, unsig
104 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2); 104 ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
105 105
106 if (unlikely(slop)) { 106 if (unlikely(slop)) {
107 u32 pad; 107 __le32 pad = 0;
108 if (write_data) { 108 if (write_data) {
109 memcpy(&pad, buf + buflen - slop, slop); 109 memcpy(&pad, buf + buflen - slop, slop);
110 pad = le32_to_cpu(pad); 110 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
111 iowrite32(pad, ap->ioaddr.data_addr);
112 } else { 111 } else {
113 pad = ioread32(ap->ioaddr.data_addr); 112 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
114 pad = cpu_to_le16(pad);
115 memcpy(buf + buflen - slop, &pad, slop); 113 memcpy(buf + buflen - slop, &pad, slop);
116 } 114 }
117 } 115 }
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 2f1de6ec044c..c68b241805fd 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -270,7 +270,7 @@ static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
270static void qs_error_handler(struct ata_port *ap) 270static void qs_error_handler(struct ata_port *ap)
271{ 271{
272 qs_enter_reg_mode(ap); 272 qs_enter_reg_mode(ap);
273 ata_do_eh(ap, qs_prereset, ata_std_softreset, NULL, 273 ata_do_eh(ap, qs_prereset, NULL, sata_std_hardreset,
274 ata_std_postreset); 274 ata_std_postreset);
275} 275}
276 276
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 96fd5260446d..864c1c1b8511 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -301,7 +301,7 @@ static struct sil24_cerr_info {
301 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET, 301 [PORT_CERR_PKT_PROT] = { AC_ERR_HSM, ATA_EH_SOFTRESET,
302 "invalid data directon for ATAPI CDB" }, 302 "invalid data directon for ATAPI CDB" },
303 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET, 303 [PORT_CERR_SGT_BOUNDARY] = { AC_ERR_SYSTEM, ATA_EH_SOFTRESET,
304 "SGT no on qword boundary" }, 304 "SGT not on qword boundary" },
305 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, 305 [PORT_CERR_SGT_TGTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
306 "PCI target abort while fetching SGT" }, 306 "PCI target abort while fetching SGT" },
307 [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET, 307 [PORT_CERR_SGT_MSTABRT] = { AC_ERR_HOST_BUS, ATA_EH_SOFTRESET,
@@ -832,16 +832,31 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
832 struct ata_link *link = qc->dev->link; 832 struct ata_link *link = qc->dev->link;
833 struct ata_port *ap = link->ap; 833 struct ata_port *ap = link->ap;
834 u8 prot = qc->tf.protocol; 834 u8 prot = qc->tf.protocol;
835 int is_atapi = (prot == ATA_PROT_ATAPI || 835
836 prot == ATA_PROT_ATAPI_NODATA || 836 /*
837 prot == ATA_PROT_ATAPI_DMA); 837 * There is a bug in the chip:
838 838 * Port LRAM Causes the PRB/SGT Data to be Corrupted
839 /* ATAPI commands completing with CHECK_SENSE cause various 839 * If the host issues a read request for LRAM and SActive registers
840 * weird problems if other commands are active. PMP DMA CS 840 * while active commands are available in the port, PRB/SGT data in
841 * errata doesn't cover all and HSM violation occurs even with 841 * the LRAM can become corrupted. This issue applies only when
842 * only one other device active. Always run an ATAPI command 842 * reading from, but not writing to, the LRAM.
843 * by itself. 843 *
844 */ 844 * Therefore, reading LRAM when there is no particular error [and
845 * other commands may be outstanding] is prohibited.
846 *
847 * To avoid this bug there are two situations where a command must run
848 * exclusive of any other commands on the port:
849 *
850 * - ATAPI commands which check the sense data
851 * - Passthrough ATA commands which always have ATA_QCFLAG_RESULT_TF
852 * set.
853 *
854 */
855 int is_excl = (prot == ATA_PROT_ATAPI ||
856 prot == ATA_PROT_ATAPI_NODATA ||
857 prot == ATA_PROT_ATAPI_DMA ||
858 (qc->flags & ATA_QCFLAG_RESULT_TF));
859
845 if (unlikely(ap->excl_link)) { 860 if (unlikely(ap->excl_link)) {
846 if (link == ap->excl_link) { 861 if (link == ap->excl_link) {
847 if (ap->nr_active_links) 862 if (ap->nr_active_links)
@@ -849,7 +864,7 @@ static int sil24_qc_defer(struct ata_queued_cmd *qc)
849 qc->flags |= ATA_QCFLAG_CLEAR_EXCL; 864 qc->flags |= ATA_QCFLAG_CLEAR_EXCL;
850 } else 865 } else
851 return ATA_DEFER_PORT; 866 return ATA_DEFER_PORT;
852 } else if (unlikely(is_atapi)) { 867 } else if (unlikely(is_excl)) {
853 ap->excl_link = link; 868 ap->excl_link = link;
854 if (ap->nr_active_links) 869 if (ap->nr_active_links)
855 return ATA_DEFER_PORT; 870 return ATA_DEFER_PORT;
@@ -1079,10 +1094,13 @@ static void sil24_error_intr(struct ata_port *ap)
1079 if (ci && ci->desc) { 1094 if (ci && ci->desc) {
1080 err_mask |= ci->err_mask; 1095 err_mask |= ci->err_mask;
1081 action |= ci->action; 1096 action |= ci->action;
1097 if (action & ATA_EH_RESET_MASK)
1098 freeze = 1;
1082 ata_ehi_push_desc(ehi, "%s", ci->desc); 1099 ata_ehi_push_desc(ehi, "%s", ci->desc);
1083 } else { 1100 } else {
1084 err_mask |= AC_ERR_OTHER; 1101 err_mask |= AC_ERR_OTHER;
1085 action |= ATA_EH_SOFTRESET; 1102 action |= ATA_EH_SOFTRESET;
1103 freeze = 1;
1086 ata_ehi_push_desc(ehi, "unknown command error %d", 1104 ata_ehi_push_desc(ehi, "unknown command error %d",
1087 cerr); 1105 cerr);
1088 } 1106 }
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index f8f7139c07c1..c662d686154a 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -171,8 +171,8 @@ static char *res_strings[] = {
171 "packet purged", 171 "packet purged",
172 "packet ageing timeout", 172 "packet ageing timeout",
173 "channel ageing timeout", 173 "channel ageing timeout",
174 "calculated lenght error", 174 "calculated length error",
175 "programmed lenght limit error", 175 "programmed length limit error",
176 "aal5 crc32 error", 176 "aal5 crc32 error",
177 "oam transp or transpc crc10 error", 177 "oam transp or transpc crc10 error",
178 "reserved 25", 178 "reserved 25",
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 0bd657f5dd2a..84672dc57f7a 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -357,7 +357,7 @@ static const struct atmphy_ops idt77105_ops = {
357}; 357};
358 358
359 359
360int __devinit idt77105_init(struct atm_dev *dev) 360int idt77105_init(struct atm_dev *dev)
361{ 361{
362 dev->phy = &idt77105_ops; 362 dev->phy = &idt77105_ops;
363 return 0; 363 return 0;
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
index 14ced85b3f54..0c205b000e8b 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -625,14 +625,6 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
625 if (mac[i] == NULL) 625 if (mac[i] == NULL)
626 nicstar_init_eprom(card->membase); 626 nicstar_init_eprom(card->membase);
627 627
628 if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
629 {
630 printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
631 error = 9;
632 ns_init_card_error(card, error);
633 return error;
634 }
635
636 /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */ 628 /* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */
637 writel(0x00000000, card->membase + VPM); 629 writel(0x00000000, card->membase + VPM);
638 630
@@ -858,8 +850,6 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
858 card->iovpool.count++; 850 card->iovpool.count++;
859 } 851 }
860 852
861 card->intcnt = 0;
862
863 /* Configure NICStAR */ 853 /* Configure NICStAR */
864 if (card->rct_size == 4096) 854 if (card->rct_size == 4096)
865 ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES; 855 ns_cfg_rctsize = NS_CFG_RCTSIZE_4096_ENTRIES;
@@ -868,6 +858,15 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev)
868 858
869 card->efbie = 1; 859 card->efbie = 1;
870 860
861 card->intcnt = 0;
862 if (request_irq(pcidev->irq, &ns_irq_handler, IRQF_DISABLED | IRQF_SHARED, "nicstar", card) != 0)
863 {
864 printk("nicstar%d: can't allocate IRQ %d.\n", i, pcidev->irq);
865 error = 9;
866 ns_init_card_error(card, error);
867 return error;
868 }
869
871 /* Register device */ 870 /* Register device */
872 card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL); 871 card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL);
873 if (card->atmdev == NULL) 872 if (card->atmdev == NULL)
diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
index f04f39c00833..b1d063cc4fbe 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -289,7 +289,7 @@ static const struct atmphy_ops suni_ops = {
289}; 289};
290 290
291 291
292int __devinit suni_init(struct atm_dev *dev) 292int suni_init(struct atm_dev *dev)
293{ 293{
294 unsigned char mri; 294 unsigned char mri;
295 295
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 7d704968765f..509b6490413b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2927,7 +2927,7 @@ default_int_mode:
2927 return; 2927 return;
2928} 2928}
2929 2929
2930static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) 2930static int __devinit cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev)
2931{ 2931{
2932 ushort subsystem_vendor_id, subsystem_device_id, command; 2932 ushort subsystem_vendor_id, subsystem_device_id, command;
2933 __u32 board_id, scratchpad = 0; 2933 __u32 board_id, scratchpad = 0;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 56e23042728a..b8af22e610df 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -610,7 +610,7 @@ static int loop_thread(void *data)
610static int loop_switch(struct loop_device *lo, struct file *file) 610static int loop_switch(struct loop_device *lo, struct file *file)
611{ 611{
612 struct switch_request w; 612 struct switch_request w;
613 struct bio *bio = bio_alloc(GFP_KERNEL, 1); 613 struct bio *bio = bio_alloc(GFP_KERNEL, 0);
614 if (!bio) 614 if (!bio)
615 return -ENOMEM; 615 return -ENOMEM;
616 init_completion(&w.wait); 616 init_completion(&w.wait);
diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c
index 8c3e62a17b4a..b91d45a41b2f 100644
--- a/drivers/bluetooth/hci_ll.c
+++ b/drivers/bluetooth/hci_ll.c
@@ -204,6 +204,19 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
204 spin_lock_irqsave(&ll->hcill_lock, flags); 204 spin_lock_irqsave(&ll->hcill_lock, flags);
205 205
206 switch (ll->hcill_state) { 206 switch (ll->hcill_state) {
207 case HCILL_ASLEEP_TO_AWAKE:
208 /*
209 * This state means that both the host and the BRF chip
210 * have simultaneously sent a wake-up-indication packet.
211 * Traditionaly, in this case, receiving a wake-up-indication
212 * was enough and an additional wake-up-ack wasn't needed.
213 * This has changed with the BRF6350, which does require an
214 * explicit wake-up-ack. Other BRF versions, which do not
215 * require an explicit ack here, do accept it, thus it is
216 * perfectly safe to always send one.
217 */
218 BT_DBG("dual wake-up-indication");
219 /* deliberate fall-through - do not add break */
207 case HCILL_ASLEEP: 220 case HCILL_ASLEEP:
208 /* acknowledge device wake up */ 221 /* acknowledge device wake up */
209 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) { 222 if (send_hcill_cmd(HCILL_WAKE_UP_ACK, hu) < 0) {
@@ -211,16 +224,8 @@ static void ll_device_want_to_wakeup(struct hci_uart *hu)
211 goto out; 224 goto out;
212 } 225 }
213 break; 226 break;
214 case HCILL_ASLEEP_TO_AWAKE:
215 /*
216 * this state means that a wake-up-indication
217 * is already on its way to the device,
218 * and will serve as the required wake-up-ack
219 */
220 BT_DBG("dual wake-up-indication");
221 break;
222 default: 227 default:
223 /* any other state are illegal */ 228 /* any other state is illegal */
224 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state); 229 BT_ERR("received HCILL_WAKE_UP_IND in state %ld", ll->hcill_state);
225 break; 230 break;
226 } 231 }
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index ef1ed5d70125..2e3a0d4bc4c2 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -137,7 +137,7 @@ config CYCLADES
137 your Linux box, for instance in order to become a dial-in server. 137 your Linux box, for instance in order to become a dial-in server.
138 138
139 For information about the Cyclades-Z card, read 139 For information about the Cyclades-Z card, read
140 <file:drivers/char/README.cycladesZ>. 140 <file:Documentation/README.cycladesZ>.
141 141
142 To compile this driver as a module, choose M here: the 142 To compile this driver as a module, choose M here: the
143 module will be called cyclades. 143 module will be called cyclades.
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 39564b76d4a3..c88424a0c89b 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1046,12 +1046,6 @@ void tpm_remove_hardware(struct device *dev)
1046} 1046}
1047EXPORT_SYMBOL_GPL(tpm_remove_hardware); 1047EXPORT_SYMBOL_GPL(tpm_remove_hardware);
1048 1048
1049static u8 savestate[] = {
1050 0, 193, /* TPM_TAG_RQU_COMMAND */
1051 0, 0, 0, 10, /* blob length (in bytes) */
1052 0, 0, 0, 152 /* TPM_ORD_SaveState */
1053};
1054
1055/* 1049/*
1056 * We are about to suspend. Save the TPM state 1050 * We are about to suspend. Save the TPM state
1057 * so that it can be restored. 1051 * so that it can be restored.
@@ -1059,6 +1053,12 @@ static u8 savestate[] = {
1059int tpm_pm_suspend(struct device *dev, pm_message_t pm_state) 1053int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
1060{ 1054{
1061 struct tpm_chip *chip = dev_get_drvdata(dev); 1055 struct tpm_chip *chip = dev_get_drvdata(dev);
1056 u8 savestate[] = {
1057 0, 193, /* TPM_TAG_RQU_COMMAND */
1058 0, 0, 0, 10, /* blob length (in bytes) */
1059 0, 0, 0, 152 /* TPM_ORD_SaveState */
1060 };
1061
1062 if (chip == NULL) 1062 if (chip == NULL)
1063 return -ENODEV; 1063 return -ENODEV;
1064 1064
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 1bdd2bf4f37d..d4b6d64e858b 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -62,7 +62,7 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout)
62 if (!timeout) 62 if (!timeout)
63 timeout = MAX_SCHEDULE_TIMEOUT; 63 timeout = MAX_SCHEDULE_TIMEOUT;
64 if (wait_event_interruptible_timeout(tty->write_wait, 64 if (wait_event_interruptible_timeout(tty->write_wait,
65 !tty->driver->chars_in_buffer(tty), timeout)) 65 !tty->driver->chars_in_buffer(tty), timeout) < 0)
66 return; 66 return;
67 if (tty->driver->wait_until_sent) 67 if (tty->driver->wait_until_sent)
68 tty->driver->wait_until_sent(tty, timeout); 68 tty->driver->wait_until_sent(tty, timeout);
@@ -365,6 +365,25 @@ void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old)
365EXPORT_SYMBOL(tty_termios_copy_hw); 365EXPORT_SYMBOL(tty_termios_copy_hw);
366 366
367/** 367/**
368 * tty_termios_hw_change - check for setting change
369 * @a: termios
370 * @b: termios to compare
371 *
372 * Check if any of the bits that affect a dumb device have changed
373 * between the two termios structures, or a speed change is needed.
374 */
375
376int tty_termios_hw_change(struct ktermios *a, struct ktermios *b)
377{
378 if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed)
379 return 1;
380 if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL))
381 return 1;
382 return 0;
383}
384EXPORT_SYMBOL(tty_termios_hw_change);
385
386/**
368 * change_termios - update termios values 387 * change_termios - update termios values
369 * @tty: tty to update 388 * @tty: tty to update
370 * @new_termios: desired new value 389 * @new_termios: desired new value
diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 296f51002b55..12ceed54ab18 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -99,8 +99,8 @@ int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id
99 spin_unlock_bh(&dev->queue_lock); 99 spin_unlock_bh(&dev->queue_lock);
100 100
101 if (found) { 101 if (found) {
102 atomic_dec(&dev->refcnt);
103 cn_queue_free_callback(cbq); 102 cn_queue_free_callback(cbq);
103 atomic_dec(&dev->refcnt);
104 return -EINVAL; 104 return -EINVAL;
105 } 105 }
106 106
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 6883fcb79ad3..bf9716b75513 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -145,6 +145,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
145 if (queue_work(dev->cbdev->cn_queue, 145 if (queue_work(dev->cbdev->cn_queue,
146 &__cbq->work)) 146 &__cbq->work))
147 err = 0; 147 err = 0;
148 else
149 err = -EINVAL;
148 } else { 150 } else {
149 struct cn_callback_data *d; 151 struct cn_callback_data *d;
150 152
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 1bba99747f5b..5d3a04ba6ad2 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -603,5 +603,9 @@ MODULE_DESCRIPTION ("'cpufreq_conservative' - A dynamic cpufreq governor for "
603 "optimised for use in a battery environment"); 603 "optimised for use in a battery environment");
604MODULE_LICENSE ("GPL"); 604MODULE_LICENSE ("GPL");
605 605
606#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE
607fs_initcall(cpufreq_gov_dbs_init);
608#else
606module_init(cpufreq_gov_dbs_init); 609module_init(cpufreq_gov_dbs_init);
610#endif
607module_exit(cpufreq_gov_dbs_exit); 611module_exit(cpufreq_gov_dbs_exit);
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 369f44595150..d2af20dda382 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -610,6 +610,9 @@ MODULE_DESCRIPTION("'cpufreq_ondemand' - A dynamic cpufreq governor for "
610 "Low Latency Frequency Transition capable processors"); 610 "Low Latency Frequency Transition capable processors");
611MODULE_LICENSE("GPL"); 611MODULE_LICENSE("GPL");
612 612
613#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND
614fs_initcall(cpufreq_gov_dbs_init);
615#else
613module_init(cpufreq_gov_dbs_init); 616module_init(cpufreq_gov_dbs_init);
617#endif
614module_exit(cpufreq_gov_dbs_exit); 618module_exit(cpufreq_gov_dbs_exit);
615
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 51bedab6c808..f8cdde4bf6cd 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -231,5 +231,9 @@ MODULE_AUTHOR ("Dominik Brodowski <linux@brodo.de>, Russell King <rmk@arm.linux.
231MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'"); 231MODULE_DESCRIPTION ("CPUfreq policy governor 'userspace'");
232MODULE_LICENSE ("GPL"); 232MODULE_LICENSE ("GPL");
233 233
234#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE
234fs_initcall(cpufreq_gov_userspace_init); 235fs_initcall(cpufreq_gov_userspace_init);
236#else
237module_init(cpufreq_gov_userspace_init);
238#endif
235module_exit(cpufreq_gov_userspace_exit); 239module_exit(cpufreq_gov_userspace_exit);
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index abbcff0762b1..5f7e71810489 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -419,13 +419,58 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
419/* ====== Encryption/decryption routines ====== */ 419/* ====== Encryption/decryption routines ====== */
420 420
421/* These are the real call to PadLock. */ 421/* These are the real call to PadLock. */
422static inline void padlock_xcrypt(const u8 *input, u8 *output, void *key,
423 void *control_word)
424{
425 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
426 : "+S"(input), "+D"(output)
427 : "d"(control_word), "b"(key), "c"(1));
428}
429
430static void aes_crypt_copy(const u8 *in, u8 *out, u32 *key, struct cword *cword)
431{
432 u8 buf[AES_BLOCK_SIZE * 2 + PADLOCK_ALIGNMENT - 1];
433 u8 *tmp = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT);
434
435 memcpy(tmp, in, AES_BLOCK_SIZE);
436 padlock_xcrypt(tmp, out, key, cword);
437}
438
439static inline void aes_crypt(const u8 *in, u8 *out, u32 *key,
440 struct cword *cword)
441{
442 asm volatile ("pushfl; popfl");
443
444 /* padlock_xcrypt requires at least two blocks of data. */
445 if (unlikely(!(((unsigned long)in ^ (PAGE_SIZE - AES_BLOCK_SIZE)) &
446 (PAGE_SIZE - 1)))) {
447 aes_crypt_copy(in, out, key, cword);
448 return;
449 }
450
451 padlock_xcrypt(in, out, key, cword);
452}
453
422static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key, 454static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
423 void *control_word, u32 count) 455 void *control_word, u32 count)
424{ 456{
457 if (count == 1) {
458 aes_crypt(input, output, key, control_word);
459 return;
460 }
461
425 asm volatile ("pushfl; popfl"); /* enforce key reload. */ 462 asm volatile ("pushfl; popfl"); /* enforce key reload. */
426 asm volatile (".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */ 463 asm volatile ("test $1, %%cl;"
464 "je 1f;"
465 "lea -1(%%ecx), %%eax;"
466 "mov $1, %%ecx;"
467 ".byte 0xf3,0x0f,0xa7,0xc8;" /* rep xcryptecb */
468 "mov %%eax, %%ecx;"
469 "1:"
470 ".byte 0xf3,0x0f,0xa7,0xc8" /* rep xcryptecb */
427 : "+S"(input), "+D"(output) 471 : "+S"(input), "+D"(output)
428 : "d"(control_word), "b"(key), "c"(count)); 472 : "d"(control_word), "b"(key), "c"(count)
473 : "ax");
429} 474}
430 475
431static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, 476static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
@@ -443,13 +488,13 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
443static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) 488static void aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
444{ 489{
445 struct aes_ctx *ctx = aes_ctx(tfm); 490 struct aes_ctx *ctx = aes_ctx(tfm);
446 padlock_xcrypt_ecb(in, out, ctx->E, &ctx->cword.encrypt, 1); 491 aes_crypt(in, out, ctx->E, &ctx->cword.encrypt);
447} 492}
448 493
449static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) 494static void aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
450{ 495{
451 struct aes_ctx *ctx = aes_ctx(tfm); 496 struct aes_ctx *ctx = aes_ctx(tfm);
452 padlock_xcrypt_ecb(in, out, ctx->D, &ctx->cword.decrypt, 1); 497 aes_crypt(in, out, ctx->D, &ctx->cword.decrypt);
453} 498}
454 499
455static struct crypto_alg aes_alg = { 500static struct crypto_alg aes_alg = {
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index b6e1eb77d148..bc132d8f79cb 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -175,12 +175,11 @@ static struct device *dmi_dev;
175 175
176extern int dmi_available; 176extern int dmi_available;
177 177
178static int __init dmi_id_init(void) 178/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
179 dmi_id_init! */
180static void __init dmi_id_init_attr_table(void)
179{ 181{
180 int ret, i; 182 int i;
181
182 if (!dmi_available)
183 return -ENODEV;
184 183
185 /* Not necessarily all DMI fields are available on all 184 /* Not necessarily all DMI fields are available on all
186 * systems, hence let's built an attribute table of just 185 * systems, hence let's built an attribute table of just
@@ -205,6 +204,16 @@ static int __init dmi_id_init(void)
205 ADD_DMI_ATTR(chassis_serial, DMI_CHASSIS_SERIAL); 204 ADD_DMI_ATTR(chassis_serial, DMI_CHASSIS_SERIAL);
206 ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG); 205 ADD_DMI_ATTR(chassis_asset_tag, DMI_CHASSIS_ASSET_TAG);
207 sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr; 206 sys_dmi_attributes[i++] = &sys_dmi_modalias_attr.attr;
207}
208
209static int __init dmi_id_init(void)
210{
211 int ret;
212
213 if (!dmi_available)
214 return -ENODEV;
215
216 dmi_id_init_attr_table();
208 217
209 ret = class_register(&dmi_class); 218 ret = class_register(&dmi_class);
210 if (ret) 219 if (ret)
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 6a182e14cf58..ad6c8a319903 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -2,6 +2,14 @@
2 it87.c - Part of lm_sensors, Linux kernel modules for hardware 2 it87.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring. 3 monitoring.
4 4
5 The IT8705F is an LPC-based Super I/O part that contains UARTs, a
6 parallel port, an IR port, a MIDI port, a floppy controller, etc., in
7 addition to an Environment Controller (Enhanced Hardware Monitor and
8 Fan Controller)
9
10 This driver supports only the Environment Controller in the IT8705F and
11 similar parts. The other devices are supported by different drivers.
12
5 Supports: IT8705F Super I/O chip w/LPC interface 13 Supports: IT8705F Super I/O chip w/LPC interface
6 IT8712F Super I/O chip w/LPC interface 14 IT8712F Super I/O chip w/LPC interface
7 IT8716F Super I/O chip w/LPC interface 15 IT8716F Super I/O chip w/LPC interface
@@ -118,9 +126,15 @@ static int fix_pwm_polarity;
118/* Length of ISA address segment */ 126/* Length of ISA address segment */
119#define IT87_EXTENT 8 127#define IT87_EXTENT 8
120 128
121/* Where are the ISA address/data registers relative to the base address */ 129/* Length of ISA address segment for Environmental Controller */
122#define IT87_ADDR_REG_OFFSET 5 130#define IT87_EC_EXTENT 2
123#define IT87_DATA_REG_OFFSET 6 131
132/* Offset of EC registers from ISA base address */
133#define IT87_EC_OFFSET 5
134
135/* Where are the ISA address/data registers relative to the EC base address */
136#define IT87_ADDR_REG_OFFSET 0
137#define IT87_DATA_REG_OFFSET 1
124 138
125/*----- The IT87 registers -----*/ 139/*----- The IT87 registers -----*/
126 140
@@ -968,10 +982,10 @@ static int __devinit it87_probe(struct platform_device *pdev)
968 }; 982 };
969 983
970 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 984 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
971 if (!request_region(res->start, IT87_EXTENT, DRVNAME)) { 985 if (!request_region(res->start, IT87_EC_EXTENT, DRVNAME)) {
972 dev_err(dev, "Failed to request region 0x%lx-0x%lx\n", 986 dev_err(dev, "Failed to request region 0x%lx-0x%lx\n",
973 (unsigned long)res->start, 987 (unsigned long)res->start,
974 (unsigned long)(res->start + IT87_EXTENT - 1)); 988 (unsigned long)(res->start + IT87_EC_EXTENT - 1));
975 err = -EBUSY; 989 err = -EBUSY;
976 goto ERROR0; 990 goto ERROR0;
977 } 991 }
@@ -1124,7 +1138,7 @@ ERROR2:
1124 platform_set_drvdata(pdev, NULL); 1138 platform_set_drvdata(pdev, NULL);
1125 kfree(data); 1139 kfree(data);
1126ERROR1: 1140ERROR1:
1127 release_region(res->start, IT87_EXTENT); 1141 release_region(res->start, IT87_EC_EXTENT);
1128ERROR0: 1142ERROR0:
1129 return err; 1143 return err;
1130} 1144}
@@ -1137,7 +1151,7 @@ static int __devexit it87_remove(struct platform_device *pdev)
1137 sysfs_remove_group(&pdev->dev.kobj, &it87_group); 1151 sysfs_remove_group(&pdev->dev.kobj, &it87_group);
1138 sysfs_remove_group(&pdev->dev.kobj, &it87_group_opt); 1152 sysfs_remove_group(&pdev->dev.kobj, &it87_group_opt);
1139 1153
1140 release_region(data->addr, IT87_EXTENT); 1154 release_region(data->addr, IT87_EC_EXTENT);
1141 platform_set_drvdata(pdev, NULL); 1155 platform_set_drvdata(pdev, NULL);
1142 kfree(data); 1156 kfree(data);
1143 1157
@@ -1402,8 +1416,8 @@ static int __init it87_device_add(unsigned short address,
1402 const struct it87_sio_data *sio_data) 1416 const struct it87_sio_data *sio_data)
1403{ 1417{
1404 struct resource res = { 1418 struct resource res = {
1405 .start = address , 1419 .start = address + IT87_EC_OFFSET,
1406 .end = address + IT87_EXTENT - 1, 1420 .end = address + IT87_EC_OFFSET + IT87_EC_EXTENT - 1,
1407 .name = DRVNAME, 1421 .name = DRVNAME,
1408 .flags = IORESOURCE_IO, 1422 .flags = IORESOURCE_IO,
1409 }; 1423 };
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index b15c6a998b72..d5aa25ce5dbd 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -1276,23 +1276,31 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1276 1276
1277 data->vrm = vid_which_vrm(); 1277 data->vrm = vid_which_vrm();
1278 superio_enter(sio_data->sioreg); 1278 superio_enter(sio_data->sioreg);
1279 /* Set VID input sensibility if needed. In theory the BIOS should
1280 have set it, but in practice it's not always the case. */
1281 en_vrm10 = superio_inb(sio_data->sioreg, SIO_REG_EN_VRM10);
1282 if ((en_vrm10 & 0x08) && data->vrm != 100) {
1283 dev_warn(dev, "Setting VID input voltage to TTL\n");
1284 superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
1285 en_vrm10 & ~0x08);
1286 } else if (!(en_vrm10 & 0x08) && data->vrm == 100) {
1287 dev_warn(dev, "Setting VID input voltage to VRM10\n");
1288 superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
1289 en_vrm10 | 0x08);
1290 }
1291 /* Read VID value */ 1279 /* Read VID value */
1292 superio_select(sio_data->sioreg, W83627EHF_LD_HWM); 1280 superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
1293 if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) 1281 if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) {
1282 /* Set VID input sensibility if needed. In theory the BIOS
1283 should have set it, but in practice it's not always the
1284 case. We only do it for the W83627EHF/EHG because the
1285 W83627DHG is more complex in this respect. */
1286 if (sio_data->kind == w83627ehf) {
1287 en_vrm10 = superio_inb(sio_data->sioreg,
1288 SIO_REG_EN_VRM10);
1289 if ((en_vrm10 & 0x08) && data->vrm == 90) {
1290 dev_warn(dev, "Setting VID input voltage to "
1291 "TTL\n");
1292 superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
1293 en_vrm10 & ~0x08);
1294 } else if (!(en_vrm10 & 0x08) && data->vrm == 100) {
1295 dev_warn(dev, "Setting VID input voltage to "
1296 "VRM10\n");
1297 superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
1298 en_vrm10 | 0x08);
1299 }
1300 }
1301
1294 data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA) & 0x3f; 1302 data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA) & 0x3f;
1295 else { 1303 } else {
1296 dev_info(dev, "VID pins in output mode, CPU VID not " 1304 dev_info(dev, "VID pins in output mode, CPU VID not "
1297 "available\n"); 1305 "available\n");
1298 data->vid = 0x3f; 1306 data->vid = 0x3f;
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 9c8b6d5eaec9..c09b036913bd 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -135,7 +135,7 @@ static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
135 * Generic i2c master transfer entrypoint. 135 * Generic i2c master transfer entrypoint.
136 * 136 *
137 * Note: We do not use Atmel's feature of storing the "internal device address". 137 * Note: We do not use Atmel's feature of storing the "internal device address".
138 * Instead the "internal device address" has to be written using a seperate 138 * Instead the "internal device address" has to be written using a separate
139 * i2c message. 139 * i2c message.
140 * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html 140 * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
141 */ 141 */
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index cb55cf2ba1e9..f2552b19ea60 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -619,13 +619,13 @@ omap_i2c_probe(struct platform_device *pdev)
619err_free_irq: 619err_free_irq:
620 free_irq(dev->irq, dev); 620 free_irq(dev->irq, dev);
621err_unuse_clocks: 621err_unuse_clocks:
622 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
622 omap_i2c_disable_clocks(dev); 623 omap_i2c_disable_clocks(dev);
623 omap_i2c_put_clocks(dev); 624 omap_i2c_put_clocks(dev);
624err_free_mem: 625err_free_mem:
625 platform_set_drvdata(pdev, NULL); 626 platform_set_drvdata(pdev, NULL);
626 kfree(dev); 627 kfree(dev);
627err_release_region: 628err_release_region:
628 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
629 release_mem_region(mem->start, (mem->end - mem->start) + 1); 629 release_mem_region(mem->start, (mem->end - mem->start) + 1);
630 630
631 return r; 631 return r;
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 0ab4f2627c26..7813127649a1 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -94,7 +94,7 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap,
94 break; 94 break;
95 95
96 /* Note that these are broken vs. the expected smbus API where 96 /* Note that these are broken vs. the expected smbus API where
97 * on reads, the lenght is actually returned from the function, 97 * on reads, the length is actually returned from the function,
98 * but I think the current API makes no sense and I don't want 98 * but I think the current API makes no sense and I don't want
99 * any driver that I haven't verified for correctness to go 99 * any driver that I haven't verified for correctness to go
100 * anywhere near a pmac i2c bus anyway ... 100 * anywhere near a pmac i2c bus anyway ...
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c
index 0ca599d3b402..503a134ec803 100644
--- a/drivers/i2c/busses/i2c-sibyte.c
+++ b/drivers/i2c/busses/i2c-sibyte.c
@@ -200,11 +200,14 @@ static struct i2c_adapter sibyte_board_adapter[2] = {
200 200
201static int __init i2c_sibyte_init(void) 201static int __init i2c_sibyte_init(void)
202{ 202{
203 printk("i2c-swarm.o: i2c SMBus adapter module for SiByte board\n"); 203 pr_info("i2c-sibyte: i2c SMBus adapter module for SiByte board\n");
204 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0) 204 if (i2c_sibyte_add_bus(&sibyte_board_adapter[0], K_SMB_FREQ_100KHZ) < 0)
205 return -ENODEV; 205 return -ENODEV;
206 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1], K_SMB_FREQ_400KHZ) < 0) 206 if (i2c_sibyte_add_bus(&sibyte_board_adapter[1],
207 K_SMB_FREQ_400KHZ) < 0) {
208 i2c_del_adapter(&sibyte_board_adapter[0]);
207 return -ENODEV; 209 return -ENODEV;
210 }
208 return 0; 211 return 0;
209} 212}
210 213
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index c21ae20ae362..df540d5dfaf4 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -184,7 +184,7 @@ static ssize_t i2cdev_write (struct file *file, const char __user *buf, size_t c
184 184
185/* This address checking function differs from the one in i2c-core 185/* This address checking function differs from the one in i2c-core
186 in that it considers an address with a registered device, but no 186 in that it considers an address with a registered device, but no
187 bounded driver, as NOT busy. */ 187 bound driver, as NOT busy. */
188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr) 188static int i2cdev_check_addr(struct i2c_adapter *adapter, unsigned int addr)
189{ 189{
190 struct list_head *item; 190 struct list_head *item;
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 89df48fdc69d..899d56536e80 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -16,6 +16,7 @@
16#include <acpi/acpi.h> 16#include <acpi/acpi.h>
17#include <linux/ide.h> 17#include <linux/ide.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/dmi.h>
19 20
20#include <acpi/acpi_bus.h> 21#include <acpi/acpi_bus.h>
21#include <acpi/acnames.h> 22#include <acpi/acnames.h>
@@ -65,6 +66,39 @@ extern int ide_noacpi;
65extern int ide_noacpitfs; 66extern int ide_noacpitfs;
66extern int ide_noacpionboot; 67extern int ide_noacpionboot;
67 68
69static bool ide_noacpi_psx;
70static int no_acpi_psx(const struct dmi_system_id *id)
71{
72 ide_noacpi_psx = true;
73 printk(KERN_NOTICE"%s detected - disable ACPI _PSx.\n", id->ident);
74 return 0;
75}
76
77static const struct dmi_system_id ide_acpi_dmi_table[] = {
78 /* Bug 9673. */
79 /* We should check if this is because ACPI NVS isn't save/restored. */
80 {
81 .callback = no_acpi_psx,
82 .ident = "HP nx9005",
83 .matches = {
84 DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies Ltd."),
85 DMI_MATCH(DMI_BIOS_VERSION, "KAM1.60")
86 },
87 },
88
89 { } /* terminate list */
90};
91
92static int ide_acpi_blacklist(void)
93{
94 static int done;
95 if (done)
96 return 0;
97 done = 1;
98 dmi_check_system(ide_acpi_dmi_table);
99 return 0;
100}
101
68/** 102/**
69 * ide_get_dev_handle - finds acpi_handle and PCI device.function 103 * ide_get_dev_handle - finds acpi_handle and PCI device.function
70 * @dev: device to locate 104 * @dev: device to locate
@@ -623,7 +657,7 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on)
623{ 657{
624 int unit; 658 int unit;
625 659
626 if (ide_noacpi) 660 if (ide_noacpi || ide_noacpi_psx)
627 return; 661 return;
628 662
629 DEBPRINT("ENTER:\n"); 663 DEBPRINT("ENTER:\n");
@@ -668,6 +702,8 @@ void ide_acpi_init(ide_hwif_t *hwif)
668 struct ide_acpi_drive_link *master; 702 struct ide_acpi_drive_link *master;
669 struct ide_acpi_drive_link *slave; 703 struct ide_acpi_drive_link *slave;
670 704
705 ide_acpi_blacklist();
706
671 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL); 707 hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
672 if (!hwif->acpidata) 708 if (!hwif->acpidata)
673 return; 709 return;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 92ac658dac33..c7d77f0ad892 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
1068 return 0; 1068 return 0;
1069 else if (ireason == 0) { 1069 else if (ireason == 0) {
1070 /* Whoops... The drive is expecting to receive data from us! */ 1070 /* Whoops... The drive is expecting to receive data from us! */
1071 printk(KERN_ERR "%s: read_intr: Drive wants to transfer data the " 1071 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
1072 "wrong way!\n", drive->name); 1072 drive->name, __FUNCTION__);
1073 1073
1074 /* Throw some data at the drive so it doesn't hang 1074 /* Throw some data at the drive so it doesn't hang
1075 and quit this request. */ 1075 and quit this request. */
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
1086 return 0; 1086 return 0;
1087 } else { 1087 } else {
1088 /* Drive wants a command packet, or invalid ireason... */ 1088 /* Drive wants a command packet, or invalid ireason... */
1089 printk(KERN_ERR "%s: read_intr: bad interrupt reason %x\n", drive->name, 1089 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
1090 ireason); 1090 drive->name, __FUNCTION__, ireason);
1091 } 1091 }
1092 1092
1093 cdrom_end_request(drive, 0); 1093 cdrom_end_request(drive, 0);
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
1112 */ 1112 */
1113 if (dma) { 1113 if (dma) {
1114 info->dma = 0; 1114 info->dma = 0;
1115 if ((dma_error = HWIF(drive)->ide_dma_end(drive))) 1115 dma_error = HWIF(drive)->ide_dma_end(drive);
1116 if (dma_error) {
1117 printk(KERN_ERR "%s: DMA read error\n", drive->name);
1116 ide_dma_off(drive); 1118 ide_dma_off(drive);
1119 }
1117 } 1120 }
1118 1121
1119 if (cdrom_decode_status(drive, 0, &stat)) 1122 if (cdrom_decode_status(drive, 0, &stat))
@@ -1443,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1443 return ide_stopped; 1446 return ide_stopped;
1444 1447
1445 /* Read the interrupt reason and the transfer length. */ 1448 /* Read the interrupt reason and the transfer length. */
1446 ireason = HWIF(drive)->INB(IDE_IREASON_REG); 1449 ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
1447 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); 1450 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG);
1448 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); 1451 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
1449 1452
@@ -1484,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1484 if (thislen > len) thislen = len; 1487 if (thislen > len) thislen = len;
1485 1488
1486 /* The drive wants to be written to. */ 1489 /* The drive wants to be written to. */
1487 if ((ireason & 3) == 0) { 1490 if (ireason == 0) {
1488 if (!rq->data) { 1491 if (!rq->data) {
1489 blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); 1492 blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
1490 goto confused; 1493 goto confused;
@@ -1506,9 +1509,9 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1506 } 1509 }
1507 1510
1508 /* Same drill for reading. */ 1511 /* Same drill for reading. */
1509 else if ((ireason & 3) == 2) { 1512 else if (ireason == 2) {
1510 if (!rq->data) { 1513 if (!rq->data) {
1511 blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); 1514 blk_dump_rq_flags(rq, "cdrom_pc_intr, read");
1512 goto confused; 1515 goto confused;
1513 } 1516 }
1514 /* Transfer the data. */ 1517 /* Transfer the data. */
@@ -1632,8 +1635,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1632 return 0; 1635 return 0;
1633 else if (ireason == 2) { 1636 else if (ireason == 2) {
1634 /* Whoops... The drive wants to send data. */ 1637 /* Whoops... The drive wants to send data. */
1635 printk(KERN_ERR "%s: write_intr: wrong transfer direction!\n", 1638 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
1636 drive->name); 1639 drive->name, __FUNCTION__);
1637 1640
1638 while (len > 0) { 1641 while (len > 0) {
1639 int dum = 0; 1642 int dum = 0;
@@ -1642,8 +1645,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1642 } 1645 }
1643 } else { 1646 } else {
1644 /* Drive wants a command packet, or invalid ireason... */ 1647 /* Drive wants a command packet, or invalid ireason... */
1645 printk(KERN_ERR "%s: write_intr: bad interrupt reason %x\n", 1648 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
1646 drive->name, ireason); 1649 drive->name, __FUNCTION__, ireason);
1647 } 1650 }
1648 1651
1649 cdrom_end_request(drive, 0); 1652 cdrom_end_request(drive, 0);
@@ -1805,8 +1808,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1805 /* Check for errors. */ 1808 /* Check for errors. */
1806 if (dma) { 1809 if (dma) {
1807 info->dma = 0; 1810 info->dma = 0;
1808 if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { 1811 dma_error = HWIF(drive)->ide_dma_end(drive);
1809 printk(KERN_ERR "ide-cd: write dma error\n"); 1812 if (dma_error) {
1813 printk(KERN_ERR "%s: DMA write error\n", drive->name);
1810 ide_dma_off(drive); 1814 ide_dma_off(drive);
1811 } 1815 }
1812 } 1816 }
@@ -1826,7 +1830,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1826 } 1830 }
1827 1831
1828 /* Read the interrupt reason and the transfer length. */ 1832 /* Read the interrupt reason and the transfer length. */
1829 ireason = HWIF(drive)->INB(IDE_IREASON_REG); 1833 ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
1830 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); 1834 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG);
1831 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); 1835 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
1832 1836
@@ -1839,8 +1843,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1839 */ 1843 */
1840 uptodate = 1; 1844 uptodate = 1;
1841 if (rq->current_nr_sectors > 0) { 1845 if (rq->current_nr_sectors > 0) {
1842 printk(KERN_ERR "%s: write_intr: data underrun (%d blocks)\n", 1846 printk(KERN_ERR "%s: %s: data underrun (%d blocks)\n",
1843 drive->name, rq->current_nr_sectors); 1847 drive->name, __FUNCTION__,
1848 rq->current_nr_sectors);
1844 uptodate = 0; 1849 uptodate = 0;
1845 } 1850 }
1846 cdrom_end_request(drive, uptodate); 1851 cdrom_end_request(drive, uptodate);
@@ -1860,7 +1865,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1860 int this_transfer; 1865 int this_transfer;
1861 1866
1862 if (!rq->current_nr_sectors) { 1867 if (!rq->current_nr_sectors) {
1863 printk(KERN_ERR "ide-cd: write_intr: oops\n"); 1868 printk(KERN_ERR "%s: %s: confused, missing data\n",
1869 drive->name, __FUNCTION__);
1864 break; 1870 break;
1865 } 1871 }
1866 1872
@@ -2688,14 +2694,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
2688 if (!drive->id->model[0] && 2694 if (!drive->id->model[0] &&
2689 !strncmp(drive->id->fw_rev, "241N", 4)) { 2695 !strncmp(drive->id->fw_rev, "241N", 4)) {
2690 CDROM_STATE_FLAGS(drive)->current_speed = 2696 CDROM_STATE_FLAGS(drive)->current_speed =
2691 (((unsigned int)cap->curspeed) + (176/2)) / 176; 2697 (le16_to_cpu(cap->curspeed) + (176/2)) / 176;
2692 CDROM_CONFIG_FLAGS(drive)->max_speed = 2698 CDROM_CONFIG_FLAGS(drive)->max_speed =
2693 (((unsigned int)cap->maxspeed) + (176/2)) / 176; 2699 (le16_to_cpu(cap->maxspeed) + (176/2)) / 176;
2694 } else { 2700 } else {
2695 CDROM_STATE_FLAGS(drive)->current_speed = 2701 CDROM_STATE_FLAGS(drive)->current_speed =
2696 (ntohs(cap->curspeed) + (176/2)) / 176; 2702 (be16_to_cpu(cap->curspeed) + (176/2)) / 176;
2697 CDROM_CONFIG_FLAGS(drive)->max_speed = 2703 CDROM_CONFIG_FLAGS(drive)->max_speed =
2698 (ntohs(cap->maxspeed) + (176/2)) / 176; 2704 (be16_to_cpu(cap->maxspeed) + (176/2)) / 176;
2699 } 2705 }
2700} 2706}
2701 2707
@@ -2909,6 +2915,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
2909 if (!CDROM_CONFIG_FLAGS(drive)->ram) 2915 if (!CDROM_CONFIG_FLAGS(drive)->ram)
2910 devinfo->mask |= CDC_RAM; 2916 devinfo->mask |= CDC_RAM;
2911 2917
2918 if (CDROM_CONFIG_FLAGS(drive)->no_speed_select)
2919 devinfo->mask |= CDC_SELECT_SPEED;
2920
2912 devinfo->disk = info->disk; 2921 devinfo->disk = info->disk;
2913 return register_cdrom(devinfo); 2922 return register_cdrom(devinfo);
2914} 2923}
@@ -3161,7 +3170,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
3161 CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; 3170 CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
3162 /* the 3231 model does not support the SET_CD_SPEED command */ 3171 /* the 3231 model does not support the SET_CD_SPEED command */
3163 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) 3172 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
3164 cdi->mask |= CDC_SELECT_SPEED; 3173 CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1;
3165 3174
3166#if ! STANDARD_ATAPI 3175#if ! STANDARD_ATAPI
3167 /* by default Sanyo 3 CD changer support is turned off and 3176 /* by default Sanyo 3 CD changer support is turned off and
@@ -3504,15 +3513,8 @@ static int ide_cd_probe(ide_drive_t *drive)
3504 g->driverfs_dev = &drive->gendev; 3513 g->driverfs_dev = &drive->gendev;
3505 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; 3514 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
3506 if (ide_cdrom_setup(drive)) { 3515 if (ide_cdrom_setup(drive)) {
3507 struct cdrom_device_info *devinfo = &info->devinfo;
3508 ide_proc_unregister_driver(drive, &ide_cdrom_driver); 3516 ide_proc_unregister_driver(drive, &ide_cdrom_driver);
3509 kfree(info->buffer); 3517 ide_cd_release(&info->kref);
3510 kfree(info->toc);
3511 kfree(info->changer_info);
3512 if (devinfo->handle == drive && unregister_cdrom(devinfo))
3513 printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
3514 kfree(info);
3515 drive->driver_data = NULL;
3516 goto failed; 3518 goto failed;
3517 } 3519 }
3518 3520
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 228b29c5d2e4..1b302fe2724d 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -91,7 +91,8 @@ struct ide_cd_config_flags {
91 __u8 close_tray : 1; /* can close the tray */ 91 __u8 close_tray : 1; /* can close the tray */
92 __u8 writing : 1; /* pseudo write in progress */ 92 __u8 writing : 1; /* pseudo write in progress */
93 __u8 mo_drive : 1; /* drive is an MO device */ 93 __u8 mo_drive : 1; /* drive is an MO device */
94 __u8 reserved : 2; 94 __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */
95 __u8 reserved : 1;
95 byte max_speed; /* Max speed of the drive */ 96 byte max_speed; /* Max speed of the drive */
96}; 97};
97#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) 98#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index cef405ddaf0e..bb9693dabe41 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -612,12 +612,12 @@ u8 eighty_ninty_three (ide_drive_t *drive)
612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n", 612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
613 drive->name); 613 drive->name);
614 614
615 if (ide_dev_is_sata(id) && !ivb)
616 return 1;
617
615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb) 618 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
616 goto no_80w; 619 goto no_80w;
617 620
618 if (ide_dev_is_sata(id))
619 return 1;
620
621 /* 621 /*
622 * FIXME: 622 * FIXME:
623 * - force bit13 (80c cable present) check also for !ivb devices 623 * - force bit13 (80c cable present) check also for !ivb devices
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 51fca441c294..bc553337b1be 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cmd64x.c Version 1.51 Nov 8, 2007 2 * linux/drivers/ide/pci/cmd64x.c Version 1.52 Dec 24, 2007
3 * 3 *
4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
5 * Due to massive hardware bugs, UltraDMA is only supported 5 * Due to massive hardware bugs, UltraDMA is only supported
@@ -564,6 +564,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
564 .init_chipset = init_chipset_cmd64x, 564 .init_chipset = init_chipset_cmd64x,
565 .init_hwif = init_hwif_cmd64x, 565 .init_hwif = init_hwif_cmd64x,
566 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 566 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
567 .chipset = ide_cmd646,
567 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 568 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
568 .pio_mask = ATA_PIO5, 569 .pio_mask = ATA_PIO5,
569 .mwdma_mask = ATA_MWDMA2, 570 .mwdma_mask = ATA_MWDMA2,
@@ -573,7 +574,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
573 .init_chipset = init_chipset_cmd64x, 574 .init_chipset = init_chipset_cmd64x,
574 .init_hwif = init_hwif_cmd64x, 575 .init_hwif = init_hwif_cmd64x,
575 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 576 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
576 .chipset = ide_cmd646,
577 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 577 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
578 .pio_mask = ATA_PIO5, 578 .pio_mask = ATA_PIO5,
579 .mwdma_mask = ATA_MWDMA2, 579 .mwdma_mask = ATA_MWDMA2,
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 9094916e3780..ddcbeba671e1 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -49,7 +49,7 @@
49#define ATAC_BM0_PRD 0x04 49#define ATAC_BM0_PRD 0x04
50#define CS5535_CABLE_DETECT 0x48 50#define CS5535_CABLE_DETECT 0x48
51 51
52/* Format I PIO settings. We seperate out cmd and data for safer timings */ 52/* Format I PIO settings. We separate out cmd and data for safer timings */
53 53
54static unsigned int cs5535_pio_cmd_timings[5] = 54static unsigned int cs5535_pio_cmd_timings[5] =
55{ 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 }; 55{ 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 };
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 0895e753a35d..0151d7fdfb8a 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * linux/drivers/ide/pci/trm290.c Version 1.02 Mar. 18, 2000 2 * linux/drivers/ide/pci/trm290.c Version 1.05 Dec. 26, 2007
3 * 3 *
4 * Copyright (c) 1997-1998 Mark Lord 4 * Copyright (c) 1997-1998 Mark Lord
5 * Copyright (c) 2007 MontaVista Software, Inc. <source@mvista.com>
5 * May be copied or modified under the terms of the GNU General Public License 6 * May be copied or modified under the terms of the GNU General Public License
6 * 7 *
7 * June 22, 2004 - get rid of check_region 8 * June 22, 2004 - get rid of check_region
@@ -177,7 +178,7 @@ static void trm290_selectproc (ide_drive_t *drive)
177 trm290_prepare_drive(drive, drive->using_dma); 178 trm290_prepare_drive(drive, drive->using_dma);
178} 179}
179 180
180static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) 181static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command)
181{ 182{
182 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */ 183 BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */
183 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); 184 ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
@@ -185,7 +186,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
185 outb(command, IDE_COMMAND_REG); 186 outb(command, IDE_COMMAND_REG);
186} 187}
187 188
188static int trm290_ide_dma_setup(ide_drive_t *drive) 189static int trm290_dma_setup(ide_drive_t *drive)
189{ 190{
190 ide_hwif_t *hwif = drive->hwif; 191 ide_hwif_t *hwif = drive->hwif;
191 struct request *rq = hwif->hwgroup->rq; 192 struct request *rq = hwif->hwgroup->rq;
@@ -215,7 +216,7 @@ static int trm290_ide_dma_setup(ide_drive_t *drive)
215 return 0; 216 return 0;
216} 217}
217 218
218static void trm290_ide_dma_start(ide_drive_t *drive) 219static void trm290_dma_start(ide_drive_t *drive)
219{ 220{
220} 221}
221 222
@@ -240,6 +241,14 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive)
240 return (status == 0x00ff); 241 return (status == 0x00ff);
241} 242}
242 243
244static void trm290_dma_host_on(ide_drive_t *drive)
245{
246}
247
248static void trm290_dma_host_off(ide_drive_t *drive)
249{
250}
251
243static void __devinit init_hwif_trm290(ide_hwif_t *hwif) 252static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
244{ 253{
245 unsigned int cfgbase = 0; 254 unsigned int cfgbase = 0;
@@ -280,11 +289,13 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
280 289
281 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3); 290 ide_setup_dma(hwif, (hwif->config_data + 4) ^ (hwif->channel ? 0x0080 : 0x0000), 3);
282 291
283 hwif->dma_setup = &trm290_ide_dma_setup; 292 hwif->dma_host_off = &trm290_dma_host_off;
284 hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd; 293 hwif->dma_host_on = &trm290_dma_host_on;
285 hwif->dma_start = &trm290_ide_dma_start; 294 hwif->dma_setup = &trm290_dma_setup;
286 hwif->ide_dma_end = &trm290_ide_dma_end; 295 hwif->dma_exec_cmd = &trm290_dma_exec_cmd;
287 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; 296 hwif->dma_start = &trm290_dma_start;
297 hwif->ide_dma_end = &trm290_ide_dma_end;
298 hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq;
288 299
289 hwif->selectproc = &trm290_selectproc; 300 hwif->selectproc = &trm290_selectproc;
290#if 1 301#if 1
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 16a2a938b520..b3df6f3c705e 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -455,6 +455,28 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
455 } 455 }
456 } 456 }
457 457
458 /*
459 * The opcode is in the low byte when its in network order
460 * (top byte when in host order).
461 */
462 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
463 if (qp->ibqp.qp_num > 1 &&
464 opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
465 if (header_in_data) {
466 wc.imm_data = *(__be32 *) data;
467 data += sizeof(__be32);
468 } else
469 wc.imm_data = ohdr->u.ud.imm_data;
470 wc.wc_flags = IB_WC_WITH_IMM;
471 hdrsize += sizeof(u32);
472 } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
473 wc.imm_data = 0;
474 wc.wc_flags = 0;
475 } else {
476 dev->n_pkt_drops++;
477 goto bail;
478 }
479
458 /* Get the number of bytes the message was padded by. */ 480 /* Get the number of bytes the message was padded by. */
459 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; 481 pad = (be32_to_cpu(ohdr->bth[0]) >> 20) & 3;
460 if (unlikely(tlen < (hdrsize + pad + 4))) { 482 if (unlikely(tlen < (hdrsize + pad + 4))) {
@@ -482,28 +504,6 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
482 wc.byte_len = tlen + sizeof(struct ib_grh); 504 wc.byte_len = tlen + sizeof(struct ib_grh);
483 505
484 /* 506 /*
485 * The opcode is in the low byte when its in network order
486 * (top byte when in host order).
487 */
488 opcode = be32_to_cpu(ohdr->bth[0]) >> 24;
489 if (qp->ibqp.qp_num > 1 &&
490 opcode == IB_OPCODE_UD_SEND_ONLY_WITH_IMMEDIATE) {
491 if (header_in_data) {
492 wc.imm_data = *(__be32 *) data;
493 data += sizeof(__be32);
494 } else
495 wc.imm_data = ohdr->u.ud.imm_data;
496 wc.wc_flags = IB_WC_WITH_IMM;
497 hdrsize += sizeof(u32);
498 } else if (opcode == IB_OPCODE_UD_SEND_ONLY) {
499 wc.imm_data = 0;
500 wc.wc_flags = 0;
501 } else {
502 dev->n_pkt_drops++;
503 goto bail;
504 }
505
506 /*
507 * Get the next work request entry to find where to put the data. 507 * Get the next work request entry to find where to put the data.
508 */ 508 */
509 if (qp->r_reuse_sge) 509 if (qp->r_reuse_sge)
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 8bf44daf45ec..9d32c49cc651 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -430,7 +430,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
430 wc->dlid_path_bits = (be32_to_cpu(cqe->g_mlpath_rqpn) >> 24) & 0x7f; 430 wc->dlid_path_bits = (be32_to_cpu(cqe->g_mlpath_rqpn) >> 24) & 0x7f;
431 wc->wc_flags |= be32_to_cpu(cqe->g_mlpath_rqpn) & 0x80000000 ? 431 wc->wc_flags |= be32_to_cpu(cqe->g_mlpath_rqpn) & 0x80000000 ?
432 IB_WC_GRH : 0; 432 IB_WC_GRH : 0;
433 wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) >> 16; 433 wc->pkey_index = be32_to_cpu(cqe->immed_rss_invalid) & 0x7f;
434 } 434 }
435 435
436 return 0; 436 return 0;
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 950228fb009f..bdb6f8517401 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2053,6 +2053,7 @@ static void srp_remove_one(struct ib_device *device)
2053 2053
2054 list_for_each_entry_safe(target, tmp_target, 2054 list_for_each_entry_safe(target, tmp_target,
2055 &host->target_list, list) { 2055 &host->target_list, list) {
2056 srp_remove_host(target->scsi_host);
2056 scsi_remove_host(target->scsi_host); 2057 scsi_remove_host(target->scsi_host);
2057 srp_disconnect_target(target); 2058 srp_disconnect_target(target);
2058 ib_destroy_cm_id(target->cm_id); 2059 ib_destroy_cm_id(target->cm_id);
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index bfc6061f1554..1dc2ac9f3d1c 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -38,8 +38,6 @@ EXPORT_SYMBOL(gameport_unregister_driver);
38EXPORT_SYMBOL(gameport_open); 38EXPORT_SYMBOL(gameport_open);
39EXPORT_SYMBOL(gameport_close); 39EXPORT_SYMBOL(gameport_close);
40EXPORT_SYMBOL(gameport_rescan); 40EXPORT_SYMBOL(gameport_rescan);
41EXPORT_SYMBOL(gameport_cooked_read);
42EXPORT_SYMBOL(gameport_set_name);
43EXPORT_SYMBOL(gameport_set_phys); 41EXPORT_SYMBOL(gameport_set_phys);
44EXPORT_SYMBOL(gameport_start_polling); 42EXPORT_SYMBOL(gameport_start_polling);
45EXPORT_SYMBOL(gameport_stop_polling); 43EXPORT_SYMBOL(gameport_stop_polling);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 307c7b5c2b33..a0be978501ff 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -235,6 +235,10 @@ static void input_handle_event(struct input_dev *dev,
235 if (value >= 0) 235 if (value >= 0)
236 disposition = INPUT_PASS_TO_ALL; 236 disposition = INPUT_PASS_TO_ALL;
237 break; 237 break;
238
239 case EV_PWR:
240 disposition = INPUT_PASS_TO_ALL;
241 break;
238 } 242 }
239 243
240 if (type != EV_SYN) 244 if (type != EV_SYN)
@@ -1266,6 +1270,10 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
1266 __set_bit(code, dev->ffbit); 1270 __set_bit(code, dev->ffbit);
1267 break; 1271 break;
1268 1272
1273 case EV_PWR:
1274 /* do nothing */
1275 break;
1276
1269 default: 1277 default:
1270 printk(KERN_ERR 1278 printk(KERN_ERR
1271 "input_set_capability: unknown type %u (code %u)\n", 1279 "input_set_capability: unknown type %u (code %u)\n",
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index dfa6592c10f6..086d58c0ccbe 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -209,22 +209,22 @@ config KEYBOARD_HIL
209 to your machine, so normally you should say Y here. 209 to your machine, so normally you should say Y here.
210 210
211config KEYBOARD_HP6XX 211config KEYBOARD_HP6XX
212 tristate "HP Jornada 6XX Keyboard support" 212 tristate "HP Jornada 6xx keyboard"
213 depends on SH_HP6XX 213 depends on SH_HP6XX
214 select INPUT_POLLDEV 214 select INPUT_POLLDEV
215 help 215 help
216 This adds support for the onboard keyboard found on 216 Say Y here if you have a HP Jornada 620/660/680/690 and want to
217 HP Jornada 620/660/680/690. 217 support the built-in keyboard.
218 218
219 To compile this driver as a module, choose M here: the 219 To compile this driver as a module, choose M here: the
220 module will be called jornada680_kbd. 220 module will be called jornada680_kbd.
221 221
222config KEYBOARD_HP7XX 222config KEYBOARD_HP7XX
223 tristate "HP Jornada 7XX Keyboard Driver" 223 tristate "HP Jornada 7xx keyboard"
224 depends on SA1100_JORNADA720_SSP && SA1100_SSP 224 depends on SA1100_JORNADA720_SSP && SA1100_SSP
225 help 225 help
226 Say Y here to add support for the HP Jornada 7xx (710/720/728) 226 Say Y here if you have a HP Jornada 710/720/728 and want to
227 onboard keyboard. 227 support the built-in keyboard.
228 228
229 To compile this driver as a module, choose M here: the 229 To compile this driver as a module, choose M here: the
230 module will be called jornada720_kbd. 230 module will be called jornada720_kbd.
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c
index bec1cf483723..a23633a2e1b4 100644
--- a/drivers/input/keyboard/jornada680_kbd.c
+++ b/drivers/input/keyboard/jornada680_kbd.c
@@ -16,14 +16,14 @@
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18
19#include <linux/input.h>
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h>
23#include <linux/input-polldev.h> 21#include <linux/input-polldev.h>
22#include <linux/interrupt.h>
24#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/kernel.h>
25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
26#include <linux/interrupt.h>
27 27
28#include <asm/delay.h> 28#include <asm/delay.h>
29#include <asm/io.h> 29#include <asm/io.h>
@@ -43,22 +43,22 @@
43#define PLDR 0xa4000134 43#define PLDR 0xa4000134
44 44
45static const unsigned short jornada_scancodes[] = { 45static const unsigned short jornada_scancodes[] = {
46/* PTD1 */ KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, 0, 0, 0, /* 1 -> 8 */ 46/* PTD1 */ KEY_CAPSLOCK, KEY_MACRO, KEY_LEFTCTRL, 0, KEY_ESC, KEY_KP5, 0, 0, /* 1 -> 8 */
47 KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F2, KEY_F4, KEY_F5, /* 9 -> 16 */ 47 KEY_F1, KEY_F2, KEY_F3, KEY_F8, KEY_F7, KEY_F6, KEY_F4, KEY_F5, /* 9 -> 16 */
48/* PTD5 */ KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0, /* 17 -> 24 */ 48/* PTD5 */ KEY_SLASH, KEY_APOSTROPHE, KEY_ENTER, 0, KEY_Z, 0, 0, 0, /* 17 -> 24 */
49 KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N, /* 25 -> 32 */ 49 KEY_X, KEY_C, KEY_V, KEY_DOT, KEY_COMMA, KEY_M, KEY_B, KEY_N, /* 25 -> 32 */
50/* PTD7 */ KEY_KP2, KEY_KP6, 0, 0, 0, 0, 0, 0, /* 33 -> 40 */ 50/* PTD7 */ KEY_KP2, KEY_KP6, KEY_KP3, 0, 0, 0, 0, 0, /* 33 -> 40 */
51 0, 0, 0, KEY_KP4, 0, 0, KEY_LEFTALT, KEY_HANJA, /* 41 -> 48 */ 51 KEY_F10, KEY_RO, KEY_F9, KEY_KP4, KEY_NUMLOCK, KEY_SCROLLLOCK, KEY_LEFTALT, KEY_HANJA, /* 41 -> 48 */
52/* PTE0 */ 0, 0, 0, 0, KEY_FINANCE, 0, 0, 0, /* 49 -> 56 */ 52/* PTE0 */ KEY_KATAKANA, KEY_KP0, KEY_GRAVE, 0, KEY_FINANCE, 0, 0, 0, /* 49 -> 56 */
53 KEY_LEFTCTRL, 0, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /* 57 -> 64 */ 53 KEY_KPMINUS, KEY_HIRAGANA, KEY_SPACE, KEY_KPDOT, KEY_VOLUMEUP, 249, 0, 0, /* 57 -> 64 */
54/* PTE1 */ KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0,/* 65 -> 72 */ 54/* PTE1 */ KEY_SEMICOLON, KEY_RIGHTBRACE, KEY_BACKSLASH, 0, KEY_A, 0, 0, 0, /* 65 -> 72 */
55 KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H, /* 73 -> 80 */ 55 KEY_S, KEY_D, KEY_F, KEY_L, KEY_K, KEY_J, KEY_G, KEY_H, /* 73 -> 80 */
56/* PTE3 */ KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0,0, /* 81 -> 88 */ 56/* PTE3 */ KEY_KP8, KEY_LEFTMETA, KEY_RIGHTSHIFT, 0, KEY_TAB, 0, 0, 0, /* 81 -> 88 */
57 0, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 89 -> 96 */ 57 0, KEY_LEFTSHIFT, KEY_KP7, KEY_KP9, KEY_KP1, KEY_F11, KEY_KPPLUS, KEY_KPASTERISK, /* 89 -> 96 */
58/* PTE6 */ KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0, /* 97 -> 104 */ 58/* PTE6 */ KEY_P, KEY_LEFTBRACE, KEY_BACKSPACE, 0, KEY_Q, 0, 0, 0, /* 97 -> 104 */
59 KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_R, /* 105 -> 112 */ 59 KEY_W, KEY_E, KEY_R, KEY_O, KEY_I, KEY_U, KEY_T, KEY_Y, /* 105 -> 112 */
60/* PTE7 */ KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0, /* 113 -> 120 */ 60/* PTE7 */ KEY_0, KEY_MINUS, KEY_EQUAL, 0, KEY_1, 0, 0, 0, /* 113 -> 120 */
61 KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6, /* 121 -> 128 */ 61 KEY_2, KEY_3, KEY_4, KEY_9, KEY_8, KEY_7, KEY_5, KEY_6, /* 121 -> 128 */
62/* **** */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62/* **** */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 0, 0, 0, 0, 0 63 0, 0, 0, 0, 0
64}; 64};
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 410d78a774d0..1d59a2dc3c17 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -391,6 +391,7 @@ static int __init spitzkbd_probe(struct platform_device *dev)
391 for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++) 391 for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
392 set_bit(spitzkbd->keycode[i], input_dev->keybit); 392 set_bit(spitzkbd->keycode[i], input_dev->keybit);
393 clear_bit(0, input_dev->keybit); 393 clear_bit(0, input_dev->keybit);
394 set_bit(KEY_SUSPEND, input_dev->keybit);
394 set_bit(SW_LID, input_dev->swbit); 395 set_bit(SW_LID, input_dev->swbit);
395 set_bit(SW_TABLET_MODE, input_dev->swbit); 396 set_bit(SW_TABLET_MODE, input_dev->swbit);
396 set_bit(SW_HEADPHONE_INSERT, input_dev->swbit); 397 set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 2b5ed119c9a9..b346a3b418ea 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -54,7 +54,7 @@ static const struct alps_model_info alps_model_data[] = {
54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */ 54 { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, 55 { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ 56 { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
57 { { 0x73, 0x02, 0x50 }, 0xcf, 0xff, ALPS_FW_BK_1 } /* Dell Vostro 1400 */ 57 { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 } /* Dell Vostro 1400 */
58}; 58};
59 59
60/* 60/*
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 9ec57d80186e..df81b0aaa9f8 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -225,8 +225,13 @@ static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolu
225 225
226static void lifebook_disconnect(struct psmouse *psmouse) 226static void lifebook_disconnect(struct psmouse *psmouse)
227{ 227{
228 struct lifebook_data *priv = psmouse->private;
229
228 psmouse_reset(psmouse); 230 psmouse_reset(psmouse);
229 kfree(psmouse->private); 231 if (priv) {
232 input_unregister_device(priv->dev2);
233 kfree(priv);
234 }
230 psmouse->private = NULL; 235 psmouse->private = NULL;
231} 236}
232 237
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 21a9c0b69a1f..b8628252e10c 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1247,6 +1247,8 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
1247 err_pt_deactivate: 1247 err_pt_deactivate:
1248 if (parent && parent->pt_deactivate) 1248 if (parent && parent->pt_deactivate)
1249 parent->pt_deactivate(parent); 1249 parent->pt_deactivate(parent);
1250 input_unregister_device(psmouse->dev);
1251 input_dev = NULL; /* so we don't try to free it below */
1250 err_protocol_disconnect: 1252 err_protocol_disconnect:
1251 if (psmouse->disconnect) 1253 if (psmouse->disconnect)
1252 psmouse->disconnect(psmouse); 1254 psmouse->disconnect(psmouse);
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 78c3ea75da2a..be83516c776c 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -1029,6 +1029,15 @@ static const struct input_device_id mousedev_ids[] = {
1029 BIT_MASK(ABS_PRESSURE) | 1029 BIT_MASK(ABS_PRESSURE) |
1030 BIT_MASK(ABS_TOOL_WIDTH) }, 1030 BIT_MASK(ABS_TOOL_WIDTH) },
1031 }, /* A touchpad */ 1031 }, /* A touchpad */
1032 {
1033 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
1034 INPUT_DEVICE_ID_MATCH_KEYBIT |
1035 INPUT_DEVICE_ID_MATCH_ABSBIT,
1036 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_SYN) },
1037 .keybit = { [BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) },
1038 .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) },
1039 }, /* Mouse-like device with absolute X and Y but ordinary
1040 clicks, like hp ILO2 High Performance mouse */
1032 1041
1033 { }, /* Terminating entry */ 1042 { }, /* Terminating entry */
1034}; 1043};
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index fa8442b6241c..90e8e92dfe47 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -115,19 +115,17 @@ config TOUCHSCREEN_MK712
115 module will be called mk712. 115 module will be called mk712.
116 116
117config TOUCHSCREEN_HP600 117config TOUCHSCREEN_HP600
118 tristate "HP Jornada 680/690 touchscreen" 118 tristate "HP Jornada 6xx touchscreen"
119 depends on SH_HP6XX && SH_ADC 119 depends on SH_HP6XX && SH_ADC
120 help 120 help
121 Say Y here if you have a HP Jornada 680 or 690 and want to 121 Say Y here if you have a HP Jornada 620/660/680/690 and want to
122 support the built-in touchscreen. 122 support the built-in touchscreen.
123 123
124 If unsure, say N.
125
126 To compile this driver as a module, choose M here: the 124 To compile this driver as a module, choose M here: the
127 module will be called hp680_ts_input. 125 module will be called hp680_ts_input.
128 126
129config TOUCHSCREEN_HP7XX 127config TOUCHSCREEN_HP7XX
130 tristate "HP Jornada 710/720/728 touchscreen" 128 tristate "HP Jornada 7xx touchscreen"
131 depends on SA1100_JORNADA720_SSP 129 depends on SA1100_JORNADA720_SSP
132 help 130 help
133 Say Y here if you have a HP Jornada 710/720/728 and want 131 Say Y here if you have a HP Jornada 710/720/728 and want
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 19055e7381f8..63f9664a066f 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -11,6 +11,7 @@
11 * - DMC TSC-10/25 11 * - DMC TSC-10/25
12 * - IRTOUCHSYSTEMS/UNITOP 12 * - IRTOUCHSYSTEMS/UNITOP
13 * - IdealTEK URTC1000 13 * - IdealTEK URTC1000
14 * - General Touch
14 * - GoTop Super_Q2/GogoPen/PenPower tablets 15 * - GoTop Super_Q2/GogoPen/PenPower tablets
15 * 16 *
16 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch> 17 * Copyright (C) 2004-2007 by Daniel Ritz <daniel.ritz@gmx.ch>
@@ -50,7 +51,7 @@
50#include <linux/usb/input.h> 51#include <linux/usb/input.h>
51 52
52 53
53#define DRIVER_VERSION "v0.5" 54#define DRIVER_VERSION "v0.6"
54#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>" 55#define DRIVER_AUTHOR "Daniel Ritz <daniel.ritz@gmx.ch>"
55#define DRIVER_DESC "USB Touchscreen Driver" 56#define DRIVER_DESC "USB Touchscreen Driver"
56 57
@@ -65,17 +66,21 @@ struct usbtouch_device_info {
65 int min_yc, max_yc; 66 int min_yc, max_yc;
66 int min_press, max_press; 67 int min_press, max_press;
67 int rept_size; 68 int rept_size;
68 int flags;
69 69
70 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len); 70 void (*process_pkt) (struct usbtouch_usb *usbtouch, unsigned char *pkt, int len);
71
72 /*
73 * used to get the packet len. possible return values:
74 * > 0: packet len
75 * = 0: skip one byte
76 * < 0: -return value more bytes needed
77 */
71 int (*get_pkt_len) (unsigned char *pkt, int len); 78 int (*get_pkt_len) (unsigned char *pkt, int len);
79
72 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt); 80 int (*read_data) (struct usbtouch_usb *usbtouch, unsigned char *pkt);
73 int (*init) (struct usbtouch_usb *usbtouch); 81 int (*init) (struct usbtouch_usb *usbtouch);
74}; 82};
75 83
76#define USBTOUCH_FLG_BUFFER 0x01
77
78
79/* a usbtouch device */ 84/* a usbtouch device */
80struct usbtouch_usb { 85struct usbtouch_usb {
81 unsigned char *data; 86 unsigned char *data;
@@ -94,15 +99,6 @@ struct usbtouch_usb {
94}; 99};
95 100
96 101
97#if defined(CONFIG_TOUCHSCREEN_USB_EGALAX) || defined(CONFIG_TOUCHSCREEN_USB_ETURBO) || defined(CONFIG_TOUCHSCREEN_USB_IDEALTEK)
98#define MULTI_PACKET
99#endif
100
101#ifdef MULTI_PACKET
102static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
103 unsigned char *pkt, int len);
104#endif
105
106/* device types */ 102/* device types */
107enum { 103enum {
108 DEVTPYE_DUMMY = -1, 104 DEVTPYE_DUMMY = -1,
@@ -186,6 +182,10 @@ static struct usb_device_id usbtouch_devices[] = {
186 182
187#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 183#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
188 184
185#ifndef MULTI_PACKET
186#define MULTI_PACKET
187#endif
188
189#define EGALAX_PKT_TYPE_MASK 0xFE 189#define EGALAX_PKT_TYPE_MASK 0xFE
190#define EGALAX_PKT_TYPE_REPT 0x80 190#define EGALAX_PKT_TYPE_REPT 0x80
191#define EGALAX_PKT_TYPE_DIAG 0x0A 191#define EGALAX_PKT_TYPE_DIAG 0x0A
@@ -323,6 +323,9 @@ static int itm_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
323 * eTurboTouch part 323 * eTurboTouch part
324 */ 324 */
325#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO 325#ifdef CONFIG_TOUCHSCREEN_USB_ETURBO
326#ifndef MULTI_PACKET
327#define MULTI_PACKET
328#endif
326static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt) 329static int eturbo_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
327{ 330{
328 unsigned int shift; 331 unsigned int shift;
@@ -461,6 +464,9 @@ static int irtouch_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
461 * IdealTEK URTC1000 Part 464 * IdealTEK URTC1000 Part
462 */ 465 */
463#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK 466#ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
467#ifndef MULTI_PACKET
468#define MULTI_PACKET
469#endif
464static int idealtek_get_pkt_len(unsigned char *buf, int len) 470static int idealtek_get_pkt_len(unsigned char *buf, int len)
465{ 471{
466 if (buf[0] & 0x80) 472 if (buf[0] & 0x80)
@@ -525,6 +531,11 @@ static int gotop_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
525/***************************************************************************** 531/*****************************************************************************
526 * the different device descriptors 532 * the different device descriptors
527 */ 533 */
534#ifdef MULTI_PACKET
535static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
536 unsigned char *pkt, int len);
537#endif
538
528static struct usbtouch_device_info usbtouch_dev_info[] = { 539static struct usbtouch_device_info usbtouch_dev_info[] = {
529#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 540#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
530 [DEVTYPE_EGALAX] = { 541 [DEVTYPE_EGALAX] = {
@@ -533,7 +544,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
533 .min_yc = 0x0, 544 .min_yc = 0x0,
534 .max_yc = 0x07ff, 545 .max_yc = 0x07ff,
535 .rept_size = 16, 546 .rept_size = 16,
536 .flags = USBTOUCH_FLG_BUFFER,
537 .process_pkt = usbtouch_process_multi, 547 .process_pkt = usbtouch_process_multi,
538 .get_pkt_len = egalax_get_pkt_len, 548 .get_pkt_len = egalax_get_pkt_len,
539 .read_data = egalax_read_data, 549 .read_data = egalax_read_data,
@@ -582,7 +592,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
582 .min_yc = 0x0, 592 .min_yc = 0x0,
583 .max_yc = 0x07ff, 593 .max_yc = 0x07ff,
584 .rept_size = 8, 594 .rept_size = 8,
585 .flags = USBTOUCH_FLG_BUFFER,
586 .process_pkt = usbtouch_process_multi, 595 .process_pkt = usbtouch_process_multi,
587 .get_pkt_len = eturbo_get_pkt_len, 596 .get_pkt_len = eturbo_get_pkt_len,
588 .read_data = eturbo_read_data, 597 .read_data = eturbo_read_data,
@@ -630,7 +639,6 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
630 .min_yc = 0x0, 639 .min_yc = 0x0,
631 .max_yc = 0x0fff, 640 .max_yc = 0x0fff,
632 .rept_size = 8, 641 .rept_size = 8,
633 .flags = USBTOUCH_FLG_BUFFER,
634 .process_pkt = usbtouch_process_multi, 642 .process_pkt = usbtouch_process_multi,
635 .get_pkt_len = idealtek_get_pkt_len, 643 .get_pkt_len = idealtek_get_pkt_len,
636 .read_data = idealtek_read_data, 644 .read_data = idealtek_read_data,
@@ -738,11 +746,14 @@ static void usbtouch_process_multi(struct usbtouch_usb *usbtouch,
738 pos = 0; 746 pos = 0;
739 while (pos < buf_len) { 747 while (pos < buf_len) {
740 /* get packet len */ 748 /* get packet len */
741 pkt_len = usbtouch->type->get_pkt_len(buffer + pos, len); 749 pkt_len = usbtouch->type->get_pkt_len(buffer + pos,
750 buf_len - pos);
742 751
743 /* unknown packet: drop everything */ 752 /* unknown packet: skip one byte */
744 if (unlikely(!pkt_len)) 753 if (unlikely(!pkt_len)) {
745 goto out_flush_buf; 754 pos++;
755 continue;
756 }
746 757
747 /* full packet: process */ 758 /* full packet: process */
748 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) { 759 if (likely((pkt_len > 0) && (pkt_len <= buf_len - pos))) {
@@ -857,7 +868,7 @@ static int usbtouch_probe(struct usb_interface *intf,
857 if (!usbtouch->data) 868 if (!usbtouch->data)
858 goto out_free; 869 goto out_free;
859 870
860 if (type->flags & USBTOUCH_FLG_BUFFER) { 871 if (type->get_pkt_len) {
861 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL); 872 usbtouch->buffer = kmalloc(type->rept_size, GFP_KERNEL);
862 if (!usbtouch->buffer) 873 if (!usbtouch->buffer)
863 goto out_free_buffers; 874 goto out_free_buffers;
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index d6952959d72a..9cef6fcf587b 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -914,6 +914,9 @@ isdn_readbchan_tty(int di, int channel, struct tty_struct *tty, int cisco_hack)
914 dflag = 0; 914 dflag = 0;
915 count_pull = count_put = 0; 915 count_pull = count_put = 0;
916 while ((count_pull < skb->len) && (len > 0)) { 916 while ((count_pull < skb->len) && (len > 0)) {
917 /* push every character but the last to the tty buffer directly */
918 if ( count_put )
919 tty_insert_flip_char(tty, last, TTY_NORMAL);
917 len--; 920 len--;
918 if (dev->drv[di]->DLEflag & DLEmask) { 921 if (dev->drv[di]->DLEflag & DLEmask) {
919 last = DLE; 922 last = DLE;
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 4e5f87c1e714..9cb6e5021adb 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -85,6 +85,8 @@ isdn_tty_try_read(modem_info * info, struct sk_buff *skb)
85 tty_insert_flip_char(tty, DLE, 0); 85 tty_insert_flip_char(tty, DLE, 0);
86 tty_insert_flip_char(tty, *dp++, 0); 86 tty_insert_flip_char(tty, *dp++, 0);
87 } 87 }
88 if (*dp == DLE)
89 tty_insert_flip_char(tty, DLE, 0);
88 last = *dp; 90 last = *dp;
89 } else { 91 } else {
90#endif 92#endif
@@ -2645,7 +2647,12 @@ isdn_tty_modem_result(int code, modem_info * info)
2645 if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) { 2647 if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
2646 return; 2648 return;
2647 } 2649 }
2650#ifdef CONFIG_ISDN_AUDIO
2651 if ( !info->vonline )
2652 tty_ldisc_flush(info->tty);
2653#else
2648 tty_ldisc_flush(info->tty); 2654 tty_ldisc_flush(info->tty);
2655#endif
2649 if ((info->flags & ISDN_ASYNC_CHECK_CD) && 2656 if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
2650 (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) && 2657 (!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
2651 (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) { 2658 (info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index ba8b04b03b9f..64c66b3769c9 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -106,9 +106,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)
106 goto err_out; 106 goto err_out;
107 107
108 /* add to the list of leds */ 108 /* add to the list of leds */
109 write_lock(&leds_list_lock); 109 down_write(&leds_list_lock);
110 list_add_tail(&led_cdev->node, &leds_list); 110 list_add_tail(&led_cdev->node, &leds_list);
111 write_unlock(&leds_list_lock); 111 up_write(&leds_list_lock);
112 112
113#ifdef CONFIG_LEDS_TRIGGERS 113#ifdef CONFIG_LEDS_TRIGGERS
114 init_rwsem(&led_cdev->trigger_lock); 114 init_rwsem(&led_cdev->trigger_lock);
@@ -155,9 +155,9 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
155 155
156 device_unregister(led_cdev->dev); 156 device_unregister(led_cdev->dev);
157 157
158 write_lock(&leds_list_lock); 158 down_write(&leds_list_lock);
159 list_del(&led_cdev->node); 159 list_del(&led_cdev->node);
160 write_unlock(&leds_list_lock); 160 up_write(&leds_list_lock);
161} 161}
162EXPORT_SYMBOL_GPL(led_classdev_unregister); 162EXPORT_SYMBOL_GPL(led_classdev_unregister);
163 163
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 9b015f9af351..5d1ca10524b6 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -14,11 +14,11 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/spinlock.h> 17#include <linux/rwsem.h>
18#include <linux/leds.h> 18#include <linux/leds.h>
19#include "leds.h" 19#include "leds.h"
20 20
21DEFINE_RWLOCK(leds_list_lock); 21DECLARE_RWSEM(leds_list_lock);
22LIST_HEAD(leds_list); 22LIST_HEAD(leds_list);
23 23
24EXPORT_SYMBOL_GPL(leds_list); 24EXPORT_SYMBOL_GPL(leds_list);
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 0bdb786210b1..13c9026d68af 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -169,7 +169,7 @@ int led_trigger_register(struct led_trigger *trigger)
169 up_write(&triggers_list_lock); 169 up_write(&triggers_list_lock);
170 170
171 /* Register with any LEDs that have this as a default trigger */ 171 /* Register with any LEDs that have this as a default trigger */
172 read_lock(&leds_list_lock); 172 down_read(&leds_list_lock);
173 list_for_each_entry(led_cdev, &leds_list, node) { 173 list_for_each_entry(led_cdev, &leds_list, node) {
174 down_write(&led_cdev->trigger_lock); 174 down_write(&led_cdev->trigger_lock);
175 if (!led_cdev->trigger && led_cdev->default_trigger && 175 if (!led_cdev->trigger && led_cdev->default_trigger &&
@@ -177,7 +177,7 @@ int led_trigger_register(struct led_trigger *trigger)
177 led_trigger_set(led_cdev, trigger); 177 led_trigger_set(led_cdev, trigger);
178 up_write(&led_cdev->trigger_lock); 178 up_write(&led_cdev->trigger_lock);
179 } 179 }
180 read_unlock(&leds_list_lock); 180 up_read(&leds_list_lock);
181 181
182 return 0; 182 return 0;
183} 183}
@@ -212,14 +212,14 @@ void led_trigger_unregister(struct led_trigger *trigger)
212 up_write(&triggers_list_lock); 212 up_write(&triggers_list_lock);
213 213
214 /* Remove anyone actively using this trigger */ 214 /* Remove anyone actively using this trigger */
215 read_lock(&leds_list_lock); 215 down_read(&leds_list_lock);
216 list_for_each_entry(led_cdev, &leds_list, node) { 216 list_for_each_entry(led_cdev, &leds_list, node) {
217 down_write(&led_cdev->trigger_lock); 217 down_write(&led_cdev->trigger_lock);
218 if (led_cdev->trigger == trigger) 218 if (led_cdev->trigger == trigger)
219 led_trigger_set(led_cdev, NULL); 219 led_trigger_set(led_cdev, NULL);
220 up_write(&led_cdev->trigger_lock); 220 up_write(&led_cdev->trigger_lock);
221 } 221 }
222 read_unlock(&leds_list_lock); 222 up_read(&leds_list_lock);
223} 223}
224 224
225void led_trigger_unregister_simple(struct led_trigger *trigger) 225void led_trigger_unregister_simple(struct led_trigger *trigger)
diff --git a/drivers/leds/leds-locomo.c b/drivers/leds/leds-locomo.c
index bfac499f3258..2207335e9212 100644
--- a/drivers/leds/leds-locomo.c
+++ b/drivers/leds/leds-locomo.c
@@ -19,7 +19,7 @@
19static void locomoled_brightness_set(struct led_classdev *led_cdev, 19static void locomoled_brightness_set(struct led_classdev *led_cdev,
20 enum led_brightness value, int offset) 20 enum led_brightness value, int offset)
21{ 21{
22 struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev); 22 struct locomo_dev *locomo_dev = LOCOMO_DEV(led_cdev->dev->parent);
23 unsigned long flags; 23 unsigned long flags;
24 24
25 local_irq_save(flags); 25 local_irq_save(flags);
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index f2f3884fe063..12b6fe93b135 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -14,6 +14,7 @@
14#define __LEDS_H_INCLUDED 14#define __LEDS_H_INCLUDED
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/rwsem.h>
17#include <linux/leds.h> 18#include <linux/leds.h>
18 19
19static inline void led_set_brightness(struct led_classdev *led_cdev, 20static inline void led_set_brightness(struct led_classdev *led_cdev,
@@ -26,7 +27,7 @@ static inline void led_set_brightness(struct led_classdev *led_cdev,
26 led_cdev->brightness_set(led_cdev, value); 27 led_cdev->brightness_set(led_cdev, value);
27} 28}
28 29
29extern rwlock_t leds_list_lock; 30extern struct rw_semaphore leds_list_lock;
30extern struct list_head leds_list; 31extern struct list_head leds_list;
31 32
32#ifdef CONFIG_LEDS_TRIGGERS 33#ifdef CONFIG_LEDS_TRIGGERS
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 7eb9ecff8f4a..6b8dbb9ba73b 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -10,10 +10,3 @@ config LGUEST
10 not "rustyvisor". See Documentation/lguest/lguest.txt. 10 not "rustyvisor". See Documentation/lguest/lguest.txt.
11 11
12 If unsure, say N. If curious, say M. If masochistic, say Y. 12 If unsure, say N. If curious, say M. If masochistic, say Y.
13
14config LGUEST_GUEST
15 bool
16 help
17 The guest needs code built-in, even if the host has lguest
18 support as a module. The drivers are tiny, so we build them
19 in too.
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 883da72b5368..ef4c117ea35f 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -322,8 +322,9 @@ adbhid_input_keycode(int id, int scancode, int repeat)
322 input_sync(ahid->input); 322 input_sync(ahid->input);
323 input_report_key(ahid->input, KEY_CAPSLOCK, 0); 323 input_report_key(ahid->input, KEY_CAPSLOCK, 0);
324 input_sync(ahid->input); 324 input_sync(ahid->input);
325 return;
325 } 326 }
326 return; 327 break;
327#ifdef CONFIG_PPC_PMAC 328#ifdef CONFIG_PPC_PMAC
328 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */ 329 case ADB_KEY_POWER_OLD: /* Power key on PBook 3400 needs remapping */
329 switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO, 330 switch(pmac_call_feature(PMAC_FTR_GET_MB_INFO,
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index a5aad8cad843..e8c8157b02fc 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2865,7 +2865,8 @@ static void handle_stripe5(struct stripe_head *sh)
2865 md_done_sync(conf->mddev, STRIPE_SECTORS, 1); 2865 md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
2866 } 2866 }
2867 2867
2868 if (s.expanding && s.locked == 0) 2868 if (s.expanding && s.locked == 0 &&
2869 !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending))
2869 handle_stripe_expansion(conf, sh, NULL); 2870 handle_stripe_expansion(conf, sh, NULL);
2870 2871
2871 if (sh->ops.count) 2872 if (sh->ops.count)
@@ -3067,7 +3068,8 @@ static void handle_stripe6(struct stripe_head *sh, struct page *tmp_page)
3067 md_done_sync(conf->mddev, STRIPE_SECTORS, 1); 3068 md_done_sync(conf->mddev, STRIPE_SECTORS, 1);
3068 } 3069 }
3069 3070
3070 if (s.expanding && s.locked == 0) 3071 if (s.expanding && s.locked == 0 &&
3072 !test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending))
3071 handle_stripe_expansion(conf, sh, &r6s); 3073 handle_stripe_expansion(conf, sh, &r6s);
3072 3074
3073 spin_unlock(&sh->lock); 3075 spin_unlock(&sh->lock);
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c
index 8b8144f77a73..0d36c155695b 100644
--- a/drivers/media/dvb/ttpci/av7110.c
+++ b/drivers/media/dvb/ttpci/av7110.c
@@ -2800,12 +2800,12 @@ static void av7110_irq(struct saa7146_dev* dev, u32 *isr)
2800} 2800}
2801 2801
2802 2802
2803static struct saa7146_extension av7110_extension; 2803static struct saa7146_extension av7110_extension_driver;
2804 2804
2805#define MAKE_AV7110_INFO(x_var,x_name) \ 2805#define MAKE_AV7110_INFO(x_var,x_name) \
2806static struct saa7146_pci_extension_data x_var = { \ 2806static struct saa7146_pci_extension_data x_var = { \
2807 .ext_priv = x_name, \ 2807 .ext_priv = x_name, \
2808 .ext = &av7110_extension } 2808 .ext = &av7110_extension_driver }
2809 2809
2810MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C"); 2810MAKE_AV7110_INFO(tts_1_X_fsc,"Technotrend/Hauppauge WinTV DVB-S rev1.X or Fujitsu Siemens DVB-C");
2811MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X"); 2811MAKE_AV7110_INFO(ttt_1_X, "Technotrend/Hauppauge WinTV DVB-T rev1.X");
@@ -2843,7 +2843,7 @@ static struct pci_device_id pci_tbl[] = {
2843MODULE_DEVICE_TABLE(pci, pci_tbl); 2843MODULE_DEVICE_TABLE(pci, pci_tbl);
2844 2844
2845 2845
2846static struct saa7146_extension av7110_extension = { 2846static struct saa7146_extension av7110_extension_driver = {
2847 .name = "dvb", 2847 .name = "dvb",
2848 .flags = SAA7146_USE_I2C_IRQ, 2848 .flags = SAA7146_USE_I2C_IRQ,
2849 2849
@@ -2860,14 +2860,14 @@ static struct saa7146_extension av7110_extension = {
2860static int __init av7110_init(void) 2860static int __init av7110_init(void)
2861{ 2861{
2862 int retval; 2862 int retval;
2863 retval = saa7146_register_extension(&av7110_extension); 2863 retval = saa7146_register_extension(&av7110_extension_driver);
2864 return retval; 2864 return retval;
2865} 2865}
2866 2866
2867 2867
2868static void __exit av7110_exit(void) 2868static void __exit av7110_exit(void)
2869{ 2869{
2870 saa7146_unregister_extension(&av7110_extension); 2870 saa7146_unregister_extension(&av7110_extension_driver);
2871} 2871}
2872 2872
2873module_init(av7110_init); 2873module_init(av7110_init);
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index c02d92deacd2..581a3c955739 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3063,11 +3063,10 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
3063 struct video_mbuf *mbuf = arg; 3063 struct video_mbuf *mbuf = arg;
3064 unsigned int i; 3064 unsigned int i;
3065 3065
3066 mutex_lock(&fh->cap.lock);
3067 retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize, 3066 retval = videobuf_mmap_setup(&fh->cap,gbuffers,gbufsize,
3068 V4L2_MEMORY_MMAP); 3067 V4L2_MEMORY_MMAP);
3069 if (retval < 0) 3068 if (retval < 0)
3070 goto fh_unlock_and_return; 3069 return retval;
3071 3070
3072 gbuffers = retval; 3071 gbuffers = retval;
3073 memset(mbuf,0,sizeof(*mbuf)); 3072 memset(mbuf,0,sizeof(*mbuf));
@@ -3075,7 +3074,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
3075 mbuf->size = gbuffers * gbufsize; 3074 mbuf->size = gbuffers * gbufsize;
3076 for (i = 0; i < gbuffers; i++) 3075 for (i = 0; i < gbuffers; i++)
3077 mbuf->offsets[i] = i * gbufsize; 3076 mbuf->offsets[i] = i * gbufsize;
3078 mutex_unlock(&fh->cap.lock);
3079 return 0; 3077 return 0;
3080 } 3078 }
3081 case VIDIOCMCAPTURE: 3079 case VIDIOCMCAPTURE:
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig
index d8b1ccb44913..081ee6e1536f 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -10,6 +10,7 @@ config VIDEO_CX23885
10 select VIDEOBUF_DVB 10 select VIDEOBUF_DVB
11 select DVB_TUNER_MT2131 if !DVB_FE_CUSTOMISE 11 select DVB_TUNER_MT2131 if !DVB_FE_CUSTOMISE
12 select DVB_S5H1409 if !DVB_FE_CUSTOMISE 12 select DVB_S5H1409 if !DVB_FE_CUSTOMISE
13 select DVB_LGDT330X if !DVB_FE_CUSTOMISE
13 select DVB_PLL if !DVB_FE_CUSTOMISE 14 select DVB_PLL if !DVB_FE_CUSTOMISE
14 ---help--- 15 ---help---
15 This is a video4linux driver for Conexant 23885 based 16 This is a video4linux driver for Conexant 23885 based
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 77b27dc750b1..36e54f78aa2a 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -541,7 +541,7 @@ static const struct i2c_algo_bit_data ivtv_i2c_algo_template = {
541 .setscl = ivtv_setscl_old, 541 .setscl = ivtv_setscl_old,
542 .getsda = ivtv_getsda_old, 542 .getsda = ivtv_getsda_old,
543 .getscl = ivtv_getscl_old, 543 .getscl = ivtv_getscl_old,
544 .udelay = 5, 544 .udelay = 10,
545 .timeout = 200, 545 .timeout = 200,
546}; 546};
547 547
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 4fd187ac9d70..4f0a9157ecb1 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1202,9 +1202,8 @@ static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
1202 1202
1203static int saa7134_resume(struct pci_dev *pci_dev) 1203static int saa7134_resume(struct pci_dev *pci_dev)
1204{ 1204{
1205
1206 struct saa7134_dev *dev = pci_get_drvdata(pci_dev); 1205 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1207 unsigned int flags; 1206 unsigned long flags;
1208 1207
1209 pci_restore_state(pci_dev); 1208 pci_restore_state(pci_dev);
1210 pci_set_power_state(pci_dev, PCI_D0); 1209 pci_set_power_state(pci_dev, PCI_D0);
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index a9eb1c516247..1707f98c322c 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1504,9 +1504,12 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1504 int ret, wbufsize, word_gap, words; 1504 int ret, wbufsize, word_gap, words;
1505 const struct kvec *vec; 1505 const struct kvec *vec;
1506 unsigned long vec_seek; 1506 unsigned long vec_seek;
1507 unsigned long initial_adr;
1508 int initial_len = len;
1507 1509
1508 wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize; 1510 wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
1509 adr += chip->start; 1511 adr += chip->start;
1512 initial_adr = adr;
1510 cmd_adr = adr & ~(wbufsize-1); 1513 cmd_adr = adr & ~(wbufsize-1);
1511 1514
1512 /* Let's determine this according to the interleave only once */ 1515 /* Let's determine this according to the interleave only once */
@@ -1519,7 +1522,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1519 return ret; 1522 return ret;
1520 } 1523 }
1521 1524
1522 XIP_INVAL_CACHED_RANGE(map, adr, len); 1525 XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
1523 ENABLE_VPP(map); 1526 ENABLE_VPP(map);
1524 xip_disable(map, chip, cmd_adr); 1527 xip_disable(map, chip, cmd_adr);
1525 1528
@@ -1610,7 +1613,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
1610 chip->state = FL_WRITING; 1613 chip->state = FL_WRITING;
1611 1614
1612 ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, 1615 ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
1613 adr, len, 1616 initial_adr, initial_len,
1614 chip->buffer_write_time); 1617 chip->buffer_write_time);
1615 if (ret) { 1618 if (ret) {
1616 map_write(map, CMD(0x70), cmd_adr); 1619 map_write(map, CMD(0x70), cmd_adr);
diff --git a/drivers/net/3c509.c b/drivers/net/3c509.c
index edda6e10ebe5..8fafac987e0b 100644
--- a/drivers/net/3c509.c
+++ b/drivers/net/3c509.c
@@ -385,6 +385,7 @@ static int __init el3_probe(int card_idx)
385#if defined(__ISAPNP__) 385#if defined(__ISAPNP__)
386 static int pnp_cards; 386 static int pnp_cards;
387 struct pnp_dev *idev = NULL; 387 struct pnp_dev *idev = NULL;
388 int pnp_found = 0;
388 389
389 if (nopnp == 1) 390 if (nopnp == 1)
390 goto no_pnp; 391 goto no_pnp;
@@ -430,6 +431,7 @@ __again:
430 pnp_cards++; 431 pnp_cards++;
431 432
432 netdev_boot_setup_check(dev); 433 netdev_boot_setup_check(dev);
434 pnp_found = 1;
433 goto found; 435 goto found;
434 } 436 }
435 } 437 }
@@ -560,6 +562,8 @@ no_pnp:
560 lp = netdev_priv(dev); 562 lp = netdev_priv(dev);
561#if defined(__ISAPNP__) 563#if defined(__ISAPNP__)
562 lp->dev = &idev->dev; 564 lp->dev = &idev->dev;
565 if (pnp_found)
566 lp->type = EL3_PNP;
563#endif 567#endif
564 err = el3_common_init(dev); 568 err = el3_common_init(dev);
565 569
diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
index 275e7510ebaf..684bab781015 100644
--- a/drivers/net/3c515.c
+++ b/drivers/net/3c515.c
@@ -243,14 +243,16 @@ enum eeprom_offset {
243enum Window3 { /* Window 3: MAC/config bits. */ 243enum Window3 { /* Window 3: MAC/config bits. */
244 Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8, 244 Wn3_Config = 0, Wn3_MAC_Ctrl = 6, Wn3_Options = 8,
245}; 245};
246union wn3_config { 246enum wn3_config {
247 int i; 247 Ram_size = 7,
248 struct w3_config_fields { 248 Ram_width = 8,
249 unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; 249 Ram_speed = 0x30,
250 int pad8:8; 250 Rom_size = 0xc0,
251 unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; 251 Ram_split_shift = 16,
252 int pad24:7; 252 Ram_split = 3 << Ram_split_shift,
253 } u; 253 Xcvr_shift = 20,
254 Xcvr = 7 << Xcvr_shift,
255 Autoselect = 0x1000000,
254}; 256};
255 257
256enum Window4 { 258enum Window4 {
@@ -614,7 +616,7 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
614 /* Read the station address from the EEPROM. */ 616 /* Read the station address from the EEPROM. */
615 EL3WINDOW(0); 617 EL3WINDOW(0);
616 for (i = 0; i < 0x18; i++) { 618 for (i = 0; i < 0x18; i++) {
617 short *phys_addr = (short *) dev->dev_addr; 619 __be16 *phys_addr = (__be16 *) dev->dev_addr;
618 int timer; 620 int timer;
619 outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd); 621 outw(EEPROM_Read + i, ioaddr + Wn0EepromCmd);
620 /* Pause for at least 162 us. for the read to take place. */ 622 /* Pause for at least 162 us. for the read to take place. */
@@ -646,22 +648,22 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
646 648
647 { 649 {
648 char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" }; 650 char *ram_split[] = { "5:3", "3:1", "1:1", "3:5" };
649 union wn3_config config; 651 __u32 config;
650 EL3WINDOW(3); 652 EL3WINDOW(3);
651 vp->available_media = inw(ioaddr + Wn3_Options); 653 vp->available_media = inw(ioaddr + Wn3_Options);
652 config.i = inl(ioaddr + Wn3_Config); 654 config = inl(ioaddr + Wn3_Config);
653 if (corkscrew_debug > 1) 655 if (corkscrew_debug > 1)
654 printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n", 656 printk(KERN_INFO " Internal config register is %4.4x, transceivers %#x.\n",
655 config.i, inw(ioaddr + Wn3_Options)); 657 config, inw(ioaddr + Wn3_Options));
656 printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n", 658 printk(KERN_INFO " %dK %s-wide RAM %s Rx:Tx split, %s%s interface.\n",
657 8 << config.u.ram_size, 659 8 << config & Ram_size,
658 config.u.ram_width ? "word" : "byte", 660 config & Ram_width ? "word" : "byte",
659 ram_split[config.u.ram_split], 661 ram_split[(config & Ram_split) >> Ram_split_shift],
660 config.u.autoselect ? "autoselect/" : "", 662 config & Autoselect ? "autoselect/" : "",
661 media_tbl[config.u.xcvr].name); 663 media_tbl[(config & Xcvr) >> Xcvr_shift].name);
662 dev->if_port = config.u.xcvr; 664 vp->default_media = (config & Xcvr) >> Xcvr_shift;
663 vp->default_media = config.u.xcvr; 665 vp->autoselect = config & Autoselect ? 1 : 0;
664 vp->autoselect = config.u.autoselect; 666 dev->if_port = vp->default_media;
665 } 667 }
666 if (vp->media_override != 7) { 668 if (vp->media_override != 7) {
667 printk(KERN_INFO " Media override to transceiver type %d (%s).\n", 669 printk(KERN_INFO " Media override to transceiver type %d (%s).\n",
@@ -694,14 +696,14 @@ static int corkscrew_open(struct net_device *dev)
694{ 696{
695 int ioaddr = dev->base_addr; 697 int ioaddr = dev->base_addr;
696 struct corkscrew_private *vp = netdev_priv(dev); 698 struct corkscrew_private *vp = netdev_priv(dev);
697 union wn3_config config; 699 __u32 config;
698 int i; 700 int i;
699 701
700 /* Before initializing select the active media port. */ 702 /* Before initializing select the active media port. */
701 EL3WINDOW(3); 703 EL3WINDOW(3);
702 if (vp->full_duplex) 704 if (vp->full_duplex)
703 outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */ 705 outb(0x20, ioaddr + Wn3_MAC_Ctrl); /* Set the full-duplex bit. */
704 config.i = inl(ioaddr + Wn3_Config); 706 config = inl(ioaddr + Wn3_Config);
705 707
706 if (vp->media_override != 7) { 708 if (vp->media_override != 7) {
707 if (corkscrew_debug > 1) 709 if (corkscrew_debug > 1)
@@ -727,12 +729,12 @@ static int corkscrew_open(struct net_device *dev)
727 } else 729 } else
728 dev->if_port = vp->default_media; 730 dev->if_port = vp->default_media;
729 731
730 config.u.xcvr = dev->if_port; 732 config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
731 outl(config.i, ioaddr + Wn3_Config); 733 outl(config, ioaddr + Wn3_Config);
732 734
733 if (corkscrew_debug > 1) { 735 if (corkscrew_debug > 1) {
734 printk("%s: corkscrew_open() InternalConfig %8.8x.\n", 736 printk("%s: corkscrew_open() InternalConfig %8.8x.\n",
735 dev->name, config.i); 737 dev->name, config);
736 } 738 }
737 739
738 outw(TxReset, ioaddr + EL3_CMD); 740 outw(TxReset, ioaddr + EL3_CMD);
@@ -901,7 +903,7 @@ static void corkscrew_timer(unsigned long data)
901 ok = 1; 903 ok = 1;
902 } 904 }
903 if (!ok) { 905 if (!ok) {
904 union wn3_config config; 906 __u32 config;
905 907
906 do { 908 do {
907 dev->if_port = 909 dev->if_port =
@@ -928,9 +930,9 @@ static void corkscrew_timer(unsigned long data)
928 ioaddr + Wn4_Media); 930 ioaddr + Wn4_Media);
929 931
930 EL3WINDOW(3); 932 EL3WINDOW(3);
931 config.i = inl(ioaddr + Wn3_Config); 933 config = inl(ioaddr + Wn3_Config);
932 config.u.xcvr = dev->if_port; 934 config = (config & ~Xcvr) | (dev->if_port << Xcvr_shift);
933 outl(config.i, ioaddr + Wn3_Config); 935 outl(config, ioaddr + Wn3_Config);
934 936
935 outw(dev->if_port == 3 ? StartCoax : StopCoax, 937 outw(dev->if_port == 3 ? StartCoax : StopCoax,
936 ioaddr + EL3_CMD); 938 ioaddr + EL3_CMD);
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d9107e542dfa..9af05a2f4af3 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -166,16 +166,6 @@ config NET_SB1000
166 166
167 If you don't have this card, of course say N. 167 If you don't have this card, of course say N.
168 168
169config IP1000
170 tristate "IP1000 Gigabit Ethernet support"
171 depends on PCI && EXPERIMENTAL
172 select MII
173 ---help---
174 This driver supports IP1000 gigabit Ethernet cards.
175
176 To compile this driver as a module, choose M here: the module
177 will be called ipg. This is recommended.
178
179source "drivers/net/arcnet/Kconfig" 169source "drivers/net/arcnet/Kconfig"
180 170
181source "drivers/net/phy/Kconfig" 171source "drivers/net/phy/Kconfig"
@@ -1986,12 +1976,19 @@ config E1000E
1986 1976
1987 <http://support.intel.com> 1977 <http://support.intel.com>
1988 1978
1989 More specific information on configuring the driver is in
1990 <file:Documentation/networking/e1000e.txt>.
1991
1992 To compile this driver as a module, choose M here. The module 1979 To compile this driver as a module, choose M here. The module
1993 will be called e1000e. 1980 will be called e1000e.
1994 1981
1982config IP1000
1983 tristate "IP1000 Gigabit Ethernet support"
1984 depends on PCI && EXPERIMENTAL
1985 select MII
1986 ---help---
1987 This driver supports IP1000 gigabit Ethernet cards.
1988
1989 To compile this driver as a module, choose M here: the module
1990 will be called ipg. This is recommended.
1991
1995source "drivers/net/ixp2000/Kconfig" 1992source "drivers/net/ixp2000/Kconfig"
1996 1993
1997config MYRI_SBUS 1994config MYRI_SBUS
@@ -2468,9 +2465,6 @@ config IXGBE
2468 2465
2469 <http://support.intel.com> 2466 <http://support.intel.com>
2470 2467
2471 More specific information on configuring the driver is in
2472 <file:Documentation/networking/ixgbe.txt>.
2473
2474 To compile this driver as a module, choose M here. The module 2468 To compile this driver as a module, choose M here. The module
2475 will be called ixgbe. 2469 will be called ixgbe.
2476 2470
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 35b0a7dd4ef4..9200ee59d854 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -120,7 +120,7 @@ static int __devinit atl1_sw_init(struct atl1_adapter *adapter)
120 struct atl1_hw *hw = &adapter->hw; 120 struct atl1_hw *hw = &adapter->hw;
121 struct net_device *netdev = adapter->netdev; 121 struct net_device *netdev = adapter->netdev;
122 122
123 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 123 hw->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
124 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 124 hw->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
125 125
126 adapter->wol = 0; 126 adapter->wol = 0;
@@ -688,7 +688,7 @@ static int atl1_change_mtu(struct net_device *netdev, int new_mtu)
688{ 688{
689 struct atl1_adapter *adapter = netdev_priv(netdev); 689 struct atl1_adapter *adapter = netdev_priv(netdev);
690 int old_mtu = netdev->mtu; 690 int old_mtu = netdev->mtu;
691 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; 691 int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
692 692
693 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) || 693 if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
694 (max_frame > MAX_JUMBO_FRAME_SIZE)) { 694 (max_frame > MAX_JUMBO_FRAME_SIZE)) {
@@ -853,8 +853,8 @@ static u32 atl1_configure(struct atl1_adapter *adapter)
853 /* set Interrupt Clear Timer */ 853 /* set Interrupt Clear Timer */
854 iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER); 854 iowrite16(adapter->ict, hw->hw_addr + REG_CMBDISDMA_TIMER);
855 855
856 /* set MTU, 4 : VLAN */ 856 /* set max frame size hw will accept */
857 iowrite32(hw->max_frame_size + 4, hw->hw_addr + REG_MTU); 857 iowrite32(hw->max_frame_size, hw->hw_addr + REG_MTU);
858 858
859 /* jumbo size & rrd retirement timer */ 859 /* jumbo size & rrd retirement timer */
860 value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK) 860 value = (((u32) hw->rx_jumbo_th & RXQ_JMBOSZ_TH_MASK)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 25b8dbf6cfd7..b57bc9467dbe 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -979,7 +979,7 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct
979/* 979/*
980 * Send learning packets after MAC address swap. 980 * Send learning packets after MAC address swap.
981 * 981 *
982 * Called with RTNL and bond->lock held for read. 982 * Called with RTNL and no other locks
983 */ 983 */
984static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1, 984static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
985 struct slave *slave2) 985 struct slave *slave2)
@@ -987,6 +987,8 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
987 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2)); 987 int slaves_state_differ = (SLAVE_IS_OK(slave1) != SLAVE_IS_OK(slave2));
988 struct slave *disabled_slave = NULL; 988 struct slave *disabled_slave = NULL;
989 989
990 ASSERT_RTNL();
991
990 /* fasten the change in the switch */ 992 /* fasten the change in the switch */
991 if (SLAVE_IS_OK(slave1)) { 993 if (SLAVE_IS_OK(slave1)) {
992 alb_send_learning_packets(slave1, slave1->dev->dev_addr); 994 alb_send_learning_packets(slave1, slave1->dev->dev_addr);
@@ -1031,7 +1033,7 @@ static void alb_fasten_mac_swap(struct bonding *bond, struct slave *slave1,
1031 * a slave that has @slave's permanet address as its current address. 1033 * a slave that has @slave's permanet address as its current address.
1032 * We'll make sure that that slave no longer uses @slave's permanent address. 1034 * We'll make sure that that slave no longer uses @slave's permanent address.
1033 * 1035 *
1034 * Caller must hold bond lock 1036 * Caller must hold RTNL and no other locks
1035 */ 1037 */
1036static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave) 1038static void alb_change_hw_addr_on_detach(struct bonding *bond, struct slave *slave)
1037{ 1039{
@@ -1542,7 +1544,12 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
1542 return 0; 1544 return 0;
1543} 1545}
1544 1546
1545/* Caller must hold bond lock for write */ 1547/*
1548 * Remove slave from tlb and rlb hash tables, and fix up MAC addresses
1549 * if necessary.
1550 *
1551 * Caller must hold RTNL and no other locks
1552 */
1546void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave) 1553void bond_alb_deinit_slave(struct bonding *bond, struct slave *slave)
1547{ 1554{
1548 if (bond->slave_cnt > 1) { 1555 if (bond->slave_cnt > 1) {
@@ -1601,9 +1608,6 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1601 struct slave *swap_slave; 1608 struct slave *swap_slave;
1602 int i; 1609 int i;
1603 1610
1604 if (new_slave)
1605 ASSERT_RTNL();
1606
1607 if (bond->curr_active_slave == new_slave) { 1611 if (bond->curr_active_slave == new_slave) {
1608 return; 1612 return;
1609 } 1613 }
@@ -1649,6 +1653,8 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1649 write_unlock_bh(&bond->curr_slave_lock); 1653 write_unlock_bh(&bond->curr_slave_lock);
1650 read_unlock(&bond->lock); 1654 read_unlock(&bond->lock);
1651 1655
1656 ASSERT_RTNL();
1657
1652 /* curr_active_slave must be set before calling alb_swap_mac_addr */ 1658 /* curr_active_slave must be set before calling alb_swap_mac_addr */
1653 if (swap_slave) { 1659 if (swap_slave) {
1654 /* swap mac address */ 1660 /* swap mac address */
@@ -1659,12 +1665,11 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
1659 bond->alb_info.rlb_enabled); 1665 bond->alb_info.rlb_enabled);
1660 } 1666 }
1661 1667
1662 read_lock(&bond->lock);
1663
1664 if (swap_slave) { 1668 if (swap_slave) {
1665 alb_fasten_mac_swap(bond, swap_slave, new_slave); 1669 alb_fasten_mac_swap(bond, swap_slave, new_slave);
1670 read_lock(&bond->lock);
1666 } else { 1671 } else {
1667 /* fasten bond mac on new current slave */ 1672 read_lock(&bond->lock);
1668 alb_send_learning_packets(new_slave, bond->dev->dev_addr); 1673 alb_send_learning_packets(new_slave, bond->dev->dev_addr);
1669 } 1674 }
1670 1675
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b0b26036266b..49a198206e3d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1746,7 +1746,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1746 * has been cleared (if our_slave == old_current), 1746 * has been cleared (if our_slave == old_current),
1747 * but before a new active slave is selected. 1747 * but before a new active slave is selected.
1748 */ 1748 */
1749 write_unlock_bh(&bond->lock);
1749 bond_alb_deinit_slave(bond, slave); 1750 bond_alb_deinit_slave(bond, slave);
1751 write_lock_bh(&bond->lock);
1750 } 1752 }
1751 1753
1752 if (oldcurrent == slave) { 1754 if (oldcurrent == slave) {
@@ -1905,6 +1907,12 @@ static int bond_release_all(struct net_device *bond_dev)
1905 slave_dev = slave->dev; 1907 slave_dev = slave->dev;
1906 bond_detach_slave(bond, slave); 1908 bond_detach_slave(bond, slave);
1907 1909
1910 /* now that the slave is detached, unlock and perform
1911 * all the undo steps that should not be called from
1912 * within a lock.
1913 */
1914 write_unlock_bh(&bond->lock);
1915
1908 if ((bond->params.mode == BOND_MODE_TLB) || 1916 if ((bond->params.mode == BOND_MODE_TLB) ||
1909 (bond->params.mode == BOND_MODE_ALB)) { 1917 (bond->params.mode == BOND_MODE_ALB)) {
1910 /* must be called only after the slave 1918 /* must be called only after the slave
@@ -1915,12 +1923,6 @@ static int bond_release_all(struct net_device *bond_dev)
1915 1923
1916 bond_compute_features(bond); 1924 bond_compute_features(bond);
1917 1925
1918 /* now that the slave is detached, unlock and perform
1919 * all the undo steps that should not be called from
1920 * within a lock.
1921 */
1922 write_unlock_bh(&bond->lock);
1923
1924 bond_destroy_slave_symlinks(bond_dev, slave_dev); 1926 bond_destroy_slave_symlinks(bond_dev, slave_dev);
1925 bond_del_vlans_from_slave(bond, slave_dev); 1927 bond_del_vlans_from_slave(bond, slave_dev);
1926 1928
@@ -2384,7 +2386,9 @@ void bond_mii_monitor(struct work_struct *work)
2384 rtnl_lock(); 2386 rtnl_lock();
2385 read_lock(&bond->lock); 2387 read_lock(&bond->lock);
2386 __bond_mii_monitor(bond, 1); 2388 __bond_mii_monitor(bond, 1);
2387 rtnl_unlock(); 2389 read_unlock(&bond->lock);
2390 rtnl_unlock(); /* might sleep, hold no other locks */
2391 read_lock(&bond->lock);
2388 } 2392 }
2389 2393
2390 delay = ((bond->params.miimon * HZ) / 1000) ? : 1; 2394 delay = ((bond->params.miimon * HZ) / 1000) ? : 1;
@@ -3399,9 +3403,7 @@ static int bond_master_netdev_event(unsigned long event, struct net_device *bond
3399 case NETDEV_CHANGENAME: 3403 case NETDEV_CHANGENAME:
3400 return bond_event_changename(event_bond); 3404 return bond_event_changename(event_bond);
3401 case NETDEV_UNREGISTER: 3405 case NETDEV_UNREGISTER:
3402 /* 3406 bond_release_all(event_bond->dev);
3403 * TODO: remove a bond from the list?
3404 */
3405 break; 3407 break;
3406 default: 3408 default:
3407 break; 3409 break;
@@ -4540,18 +4542,27 @@ static void bond_free_all(void)
4540 4542
4541/* 4543/*
4542 * Convert string input module parms. Accept either the 4544 * Convert string input module parms. Accept either the
4543 * number of the mode or its string name. 4545 * number of the mode or its string name. A bit complicated because
4546 * some mode names are substrings of other names, and calls from sysfs
4547 * may have whitespace in the name (trailing newlines, for example).
4544 */ 4548 */
4545int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl) 4549int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
4546{ 4550{
4547 int i; 4551 int mode = -1, i, rv;
4552 char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
4553
4554 rv = sscanf(buf, "%d", &mode);
4555 if (!rv) {
4556 rv = sscanf(buf, "%20s", modestr);
4557 if (!rv)
4558 return -1;
4559 }
4548 4560
4549 for (i = 0; tbl[i].modename; i++) { 4561 for (i = 0; tbl[i].modename; i++) {
4550 if ((isdigit(*mode_arg) && 4562 if (mode == tbl[i].mode)
4551 tbl[i].mode == simple_strtol(mode_arg, NULL, 0)) || 4563 return tbl[i].mode;
4552 (strcmp(mode_arg, tbl[i].modename) == 0)) { 4564 if (strcmp(modestr, tbl[i].modename) == 0)
4553 return tbl[i].mode; 4565 return tbl[i].mode;
4554 }
4555 } 4566 }
4556 4567
4557 return -1; 4568 return -1;
@@ -4865,9 +4876,22 @@ static struct lock_class_key bonding_netdev_xmit_lock_key;
4865int bond_create(char *name, struct bond_params *params, struct bonding **newbond) 4876int bond_create(char *name, struct bond_params *params, struct bonding **newbond)
4866{ 4877{
4867 struct net_device *bond_dev; 4878 struct net_device *bond_dev;
4879 struct bonding *bond, *nxt;
4868 int res; 4880 int res;
4869 4881
4870 rtnl_lock(); 4882 rtnl_lock();
4883 down_write(&bonding_rwsem);
4884
4885 /* Check to see if the bond already exists. */
4886 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
4887 if (strnicmp(bond->dev->name, name, IFNAMSIZ) == 0) {
4888 printk(KERN_ERR DRV_NAME
4889 ": cannot add bond %s; it already exists\n",
4890 name);
4891 res = -EPERM;
4892 goto out_rtnl;
4893 }
4894
4871 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "", 4895 bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
4872 ether_setup); 4896 ether_setup);
4873 if (!bond_dev) { 4897 if (!bond_dev) {
@@ -4906,10 +4930,12 @@ int bond_create(char *name, struct bond_params *params, struct bonding **newbond
4906 4930
4907 netif_carrier_off(bond_dev); 4931 netif_carrier_off(bond_dev);
4908 4932
4933 up_write(&bonding_rwsem);
4909 rtnl_unlock(); /* allows sysfs registration of net device */ 4934 rtnl_unlock(); /* allows sysfs registration of net device */
4910 res = bond_create_sysfs_entry(bond_dev->priv); 4935 res = bond_create_sysfs_entry(bond_dev->priv);
4911 if (res < 0) { 4936 if (res < 0) {
4912 rtnl_lock(); 4937 rtnl_lock();
4938 down_write(&bonding_rwsem);
4913 goto out_bond; 4939 goto out_bond;
4914 } 4940 }
4915 4941
@@ -4920,6 +4946,7 @@ out_bond:
4920out_netdev: 4946out_netdev:
4921 free_netdev(bond_dev); 4947 free_netdev(bond_dev);
4922out_rtnl: 4948out_rtnl:
4949 up_write(&bonding_rwsem);
4923 rtnl_unlock(); 4950 rtnl_unlock();
4924 return res; 4951 return res;
4925} 4952}
@@ -4940,6 +4967,9 @@ static int __init bonding_init(void)
4940#ifdef CONFIG_PROC_FS 4967#ifdef CONFIG_PROC_FS
4941 bond_create_proc_dir(); 4968 bond_create_proc_dir();
4942#endif 4969#endif
4970
4971 init_rwsem(&bonding_rwsem);
4972
4943 for (i = 0; i < max_bonds; i++) { 4973 for (i = 0; i < max_bonds; i++) {
4944 res = bond_create(NULL, &bonding_defaults, NULL); 4974 res = bond_create(NULL, &bonding_defaults, NULL);
4945 if (res) 4975 if (res)
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 11b76b352415..90a1f31e8e63 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -109,11 +109,10 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
109{ 109{
110 char command[IFNAMSIZ + 1] = {0, }; 110 char command[IFNAMSIZ + 1] = {0, };
111 char *ifname; 111 char *ifname;
112 int res = count; 112 int rv, res = count;
113 struct bonding *bond; 113 struct bonding *bond;
114 struct bonding *nxt; 114 struct bonding *nxt;
115 115
116 down_write(&(bonding_rwsem));
117 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ 116 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
118 ifname = command + 1; 117 ifname = command + 1;
119 if ((strlen(command) <= 1) || 118 if ((strlen(command) <= 1) ||
@@ -121,39 +120,28 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
121 goto err_no_cmd; 120 goto err_no_cmd;
122 121
123 if (command[0] == '+') { 122 if (command[0] == '+') {
124
125 /* Check to see if the bond already exists. */
126 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
127 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
128 printk(KERN_ERR DRV_NAME
129 ": cannot add bond %s; it already exists\n",
130 ifname);
131 res = -EPERM;
132 goto out;
133 }
134
135 printk(KERN_INFO DRV_NAME 123 printk(KERN_INFO DRV_NAME
136 ": %s is being created...\n", ifname); 124 ": %s is being created...\n", ifname);
137 if (bond_create(ifname, &bonding_defaults, &bond)) { 125 rv = bond_create(ifname, &bonding_defaults, &bond);
138 printk(KERN_INFO DRV_NAME 126 if (rv) {
139 ": %s interface already exists. Bond creation failed.\n", 127 printk(KERN_INFO DRV_NAME ": Bond creation failed.\n");
140 ifname); 128 res = rv;
141 res = -EPERM;
142 } 129 }
143 goto out; 130 goto out;
144 } 131 }
145 132
146 if (command[0] == '-') { 133 if (command[0] == '-') {
134 rtnl_lock();
135 down_write(&bonding_rwsem);
136
147 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) 137 list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list)
148 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { 138 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
149 rtnl_lock();
150 /* check the ref count on the bond's kobject. 139 /* check the ref count on the bond's kobject.
151 * If it's > expected, then there's a file open, 140 * If it's > expected, then there's a file open,
152 * and we have to fail. 141 * and we have to fail.
153 */ 142 */
154 if (atomic_read(&bond->dev->dev.kobj.kref.refcount) 143 if (atomic_read(&bond->dev->dev.kobj.kref.refcount)
155 > expected_refcount){ 144 > expected_refcount){
156 rtnl_unlock();
157 printk(KERN_INFO DRV_NAME 145 printk(KERN_INFO DRV_NAME
158 ": Unable remove bond %s due to open references.\n", 146 ": Unable remove bond %s due to open references.\n",
159 ifname); 147 ifname);
@@ -164,6 +152,7 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
164 ": %s is being deleted...\n", 152 ": %s is being deleted...\n",
165 bond->dev->name); 153 bond->dev->name);
166 bond_destroy(bond); 154 bond_destroy(bond);
155 up_write(&bonding_rwsem);
167 rtnl_unlock(); 156 rtnl_unlock();
168 goto out; 157 goto out;
169 } 158 }
@@ -171,6 +160,8 @@ static ssize_t bonding_store_bonds(struct class *cls, const char *buffer, size_t
171 printk(KERN_ERR DRV_NAME 160 printk(KERN_ERR DRV_NAME
172 ": unable to delete non-existent bond %s\n", ifname); 161 ": unable to delete non-existent bond %s\n", ifname);
173 res = -ENODEV; 162 res = -ENODEV;
163 up_write(&bonding_rwsem);
164 rtnl_unlock();
174 goto out; 165 goto out;
175 } 166 }
176 167
@@ -183,7 +174,6 @@ err_no_cmd:
183 * get called forever, which is bad. 174 * get called forever, which is bad.
184 */ 175 */
185out: 176out:
186 up_write(&(bonding_rwsem));
187 return res; 177 return res;
188} 178}
189/* class attribute for bond_masters file. This ends up in /sys/class/net */ 179/* class attribute for bond_masters file. This ends up in /sys/class/net */
@@ -271,6 +261,9 @@ static ssize_t bonding_store_slaves(struct device *d,
271 261
272 /* Note: We can't hold bond->lock here, as bond_create grabs it. */ 262 /* Note: We can't hold bond->lock here, as bond_create grabs it. */
273 263
264 rtnl_lock();
265 down_write(&(bonding_rwsem));
266
274 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/ 267 sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
275 ifname = command + 1; 268 ifname = command + 1;
276 if ((strlen(command) <= 1) || 269 if ((strlen(command) <= 1) ||
@@ -336,12 +329,10 @@ static ssize_t bonding_store_slaves(struct device *d,
336 dev->mtu = bond->dev->mtu; 329 dev->mtu = bond->dev->mtu;
337 } 330 }
338 } 331 }
339 rtnl_lock();
340 res = bond_enslave(bond->dev, dev); 332 res = bond_enslave(bond->dev, dev);
341 bond_for_each_slave(bond, slave, i) 333 bond_for_each_slave(bond, slave, i)
342 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0) 334 if (strnicmp(slave->dev->name, ifname, IFNAMSIZ) == 0)
343 slave->original_mtu = original_mtu; 335 slave->original_mtu = original_mtu;
344 rtnl_unlock();
345 if (res) { 336 if (res) {
346 ret = res; 337 ret = res;
347 } 338 }
@@ -359,12 +350,10 @@ static ssize_t bonding_store_slaves(struct device *d,
359 if (dev) { 350 if (dev) {
360 printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n", 351 printk(KERN_INFO DRV_NAME ": %s: Removing slave %s\n",
361 bond->dev->name, dev->name); 352 bond->dev->name, dev->name);
362 rtnl_lock();
363 if (bond->setup_by_slave) 353 if (bond->setup_by_slave)
364 res = bond_release_and_destroy(bond->dev, dev); 354 res = bond_release_and_destroy(bond->dev, dev);
365 else 355 else
366 res = bond_release(bond->dev, dev); 356 res = bond_release(bond->dev, dev);
367 rtnl_unlock();
368 if (res) { 357 if (res) {
369 ret = res; 358 ret = res;
370 goto out; 359 goto out;
@@ -389,6 +378,8 @@ err_no_cmd:
389 ret = -EPERM; 378 ret = -EPERM;
390 379
391out: 380out:
381 up_write(&(bonding_rwsem));
382 rtnl_unlock();
392 return ret; 383 return ret;
393} 384}
394 385
@@ -423,7 +414,7 @@ static ssize_t bonding_store_mode(struct device *d,
423 goto out; 414 goto out;
424 } 415 }
425 416
426 new_value = bond_parse_parm((char *)buf, bond_mode_tbl); 417 new_value = bond_parse_parm(buf, bond_mode_tbl);
427 if (new_value < 0) { 418 if (new_value < 0) {
428 printk(KERN_ERR DRV_NAME 419 printk(KERN_ERR DRV_NAME
429 ": %s: Ignoring invalid mode value %.*s.\n", 420 ": %s: Ignoring invalid mode value %.*s.\n",
@@ -478,7 +469,7 @@ static ssize_t bonding_store_xmit_hash(struct device *d,
478 goto out; 469 goto out;
479 } 470 }
480 471
481 new_value = bond_parse_parm((char *)buf, xmit_hashtype_tbl); 472 new_value = bond_parse_parm(buf, xmit_hashtype_tbl);
482 if (new_value < 0) { 473 if (new_value < 0) {
483 printk(KERN_ERR DRV_NAME 474 printk(KERN_ERR DRV_NAME
484 ": %s: Ignoring invalid xmit hash policy value %.*s.\n", 475 ": %s: Ignoring invalid xmit hash policy value %.*s.\n",
@@ -518,7 +509,7 @@ static ssize_t bonding_store_arp_validate(struct device *d,
518 int new_value; 509 int new_value;
519 struct bonding *bond = to_bond(d); 510 struct bonding *bond = to_bond(d);
520 511
521 new_value = bond_parse_parm((char *)buf, arp_validate_tbl); 512 new_value = bond_parse_parm(buf, arp_validate_tbl);
522 if (new_value < 0) { 513 if (new_value < 0) {
523 printk(KERN_ERR DRV_NAME 514 printk(KERN_ERR DRV_NAME
524 ": %s: Ignoring invalid arp_validate value %s\n", 515 ": %s: Ignoring invalid arp_validate value %s\n",
@@ -941,7 +932,7 @@ static ssize_t bonding_store_lacp(struct device *d,
941 goto out; 932 goto out;
942 } 933 }
943 934
944 new_value = bond_parse_parm((char *)buf, bond_lacp_tbl); 935 new_value = bond_parse_parm(buf, bond_lacp_tbl);
945 936
946 if ((new_value == 1) || (new_value == 0)) { 937 if ((new_value == 1) || (new_value == 0)) {
947 bond->params.lacp_fast = new_value; 938 bond->params.lacp_fast = new_value;
@@ -1075,7 +1066,10 @@ static ssize_t bonding_store_primary(struct device *d,
1075 struct slave *slave; 1066 struct slave *slave;
1076 struct bonding *bond = to_bond(d); 1067 struct bonding *bond = to_bond(d);
1077 1068
1078 write_lock_bh(&bond->lock); 1069 rtnl_lock();
1070 read_lock(&bond->lock);
1071 write_lock_bh(&bond->curr_slave_lock);
1072
1079 if (!USES_PRIMARY(bond->params.mode)) { 1073 if (!USES_PRIMARY(bond->params.mode)) {
1080 printk(KERN_INFO DRV_NAME 1074 printk(KERN_INFO DRV_NAME
1081 ": %s: Unable to set primary slave; %s is in mode %d\n", 1075 ": %s: Unable to set primary slave; %s is in mode %d\n",
@@ -1109,8 +1103,8 @@ static ssize_t bonding_store_primary(struct device *d,
1109 } 1103 }
1110 } 1104 }
1111out: 1105out:
1112 write_unlock_bh(&bond->lock); 1106 write_unlock_bh(&bond->curr_slave_lock);
1113 1107 read_unlock(&bond->lock);
1114 rtnl_unlock(); 1108 rtnl_unlock();
1115 1109
1116 return count; 1110 return count;
@@ -1190,7 +1184,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
1190 struct bonding *bond = to_bond(d); 1184 struct bonding *bond = to_bond(d);
1191 1185
1192 rtnl_lock(); 1186 rtnl_lock();
1193 write_lock_bh(&bond->lock); 1187 read_lock(&bond->lock);
1188 write_lock_bh(&bond->curr_slave_lock);
1194 1189
1195 if (!USES_PRIMARY(bond->params.mode)) { 1190 if (!USES_PRIMARY(bond->params.mode)) {
1196 printk(KERN_INFO DRV_NAME 1191 printk(KERN_INFO DRV_NAME
@@ -1247,7 +1242,8 @@ static ssize_t bonding_store_active_slave(struct device *d,
1247 } 1242 }
1248 } 1243 }
1249out: 1244out:
1250 write_unlock_bh(&bond->lock); 1245 write_unlock_bh(&bond->curr_slave_lock);
1246 read_unlock(&bond->lock);
1251 rtnl_unlock(); 1247 rtnl_unlock();
1252 1248
1253 return count; 1249 return count;
@@ -1418,8 +1414,6 @@ int bond_create_sysfs(void)
1418 int ret = 0; 1414 int ret = 0;
1419 struct bonding *firstbond; 1415 struct bonding *firstbond;
1420 1416
1421 init_rwsem(&bonding_rwsem);
1422
1423 /* get the netdev class pointer */ 1417 /* get the netdev class pointer */
1424 firstbond = container_of(bond_dev_list.next, struct bonding, bond_list); 1418 firstbond = container_of(bond_dev_list.next, struct bonding, bond_list);
1425 if (!firstbond) 1419 if (!firstbond)
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index e1e4734e23ce..6d83be49899a 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -141,6 +141,8 @@ struct bond_parm_tbl {
141 int mode; 141 int mode;
142}; 142};
143 143
144#define BOND_MAX_MODENAME_LEN 20
145
144struct vlan_entry { 146struct vlan_entry {
145 struct list_head vlan_list; 147 struct list_head vlan_list;
146 __be32 vlan_ip; 148 __be32 vlan_ip;
@@ -314,7 +316,7 @@ void bond_mii_monitor(struct work_struct *);
314void bond_loadbalance_arp_mon(struct work_struct *); 316void bond_loadbalance_arp_mon(struct work_struct *);
315void bond_activebackup_arp_mon(struct work_struct *); 317void bond_activebackup_arp_mon(struct work_struct *);
316void bond_set_mode_ops(struct bonding *bond, int mode); 318void bond_set_mode_ops(struct bonding *bond, int mode);
317int bond_parse_parm(char *mode_arg, struct bond_parm_tbl *tbl); 319int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
318void bond_select_active_slave(struct bonding *bond); 320void bond_select_active_slave(struct bonding *bond);
319void bond_change_active_slave(struct bonding *bond, struct slave *new_active); 321void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
320void bond_register_arp(struct bonding *); 322void bond_register_arp(struct bonding *);
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7df31b5561cc..d66915d82b24 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -142,8 +142,8 @@
142 142
143#define DRV_MODULE_NAME "cassini" 143#define DRV_MODULE_NAME "cassini"
144#define PFX DRV_MODULE_NAME ": " 144#define PFX DRV_MODULE_NAME ": "
145#define DRV_MODULE_VERSION "1.4" 145#define DRV_MODULE_VERSION "1.5"
146#define DRV_MODULE_RELDATE "1 July 2004" 146#define DRV_MODULE_RELDATE "4 Jan 2008"
147 147
148#define CAS_DEF_MSG_ENABLE \ 148#define CAS_DEF_MSG_ENABLE \
149 (NETIF_MSG_DRV | \ 149 (NETIF_MSG_DRV | \
@@ -336,30 +336,6 @@ static inline void cas_mask_intr(struct cas *cp)
336 cas_disable_irq(cp, i); 336 cas_disable_irq(cp, i);
337} 337}
338 338
339static inline void cas_buffer_init(cas_page_t *cp)
340{
341 struct page *page = cp->buffer;
342 atomic_set((atomic_t *)&page->lru.next, 1);
343}
344
345static inline int cas_buffer_count(cas_page_t *cp)
346{
347 struct page *page = cp->buffer;
348 return atomic_read((atomic_t *)&page->lru.next);
349}
350
351static inline void cas_buffer_inc(cas_page_t *cp)
352{
353 struct page *page = cp->buffer;
354 atomic_inc((atomic_t *)&page->lru.next);
355}
356
357static inline void cas_buffer_dec(cas_page_t *cp)
358{
359 struct page *page = cp->buffer;
360 atomic_dec((atomic_t *)&page->lru.next);
361}
362
363static void cas_enable_irq(struct cas *cp, const int ring) 339static void cas_enable_irq(struct cas *cp, const int ring)
364{ 340{
365 if (ring == 0) { /* all but TX_DONE */ 341 if (ring == 0) { /* all but TX_DONE */
@@ -497,7 +473,6 @@ static int cas_page_free(struct cas *cp, cas_page_t *page)
497{ 473{
498 pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size, 474 pci_unmap_page(cp->pdev, page->dma_addr, cp->page_size,
499 PCI_DMA_FROMDEVICE); 475 PCI_DMA_FROMDEVICE);
500 cas_buffer_dec(page);
501 __free_pages(page->buffer, cp->page_order); 476 __free_pages(page->buffer, cp->page_order);
502 kfree(page); 477 kfree(page);
503 return 0; 478 return 0;
@@ -527,7 +502,6 @@ static cas_page_t *cas_page_alloc(struct cas *cp, const gfp_t flags)
527 page->buffer = alloc_pages(flags, cp->page_order); 502 page->buffer = alloc_pages(flags, cp->page_order);
528 if (!page->buffer) 503 if (!page->buffer)
529 goto page_err; 504 goto page_err;
530 cas_buffer_init(page);
531 page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0, 505 page->dma_addr = pci_map_page(cp->pdev, page->buffer, 0,
532 cp->page_size, PCI_DMA_FROMDEVICE); 506 cp->page_size, PCI_DMA_FROMDEVICE);
533 return page; 507 return page;
@@ -606,7 +580,7 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags)
606 list_for_each_safe(elem, tmp, &list) { 580 list_for_each_safe(elem, tmp, &list) {
607 cas_page_t *page = list_entry(elem, cas_page_t, list); 581 cas_page_t *page = list_entry(elem, cas_page_t, list);
608 582
609 if (cas_buffer_count(page) > 1) 583 if (page_count(page->buffer) > 1)
610 continue; 584 continue;
611 585
612 list_del(elem); 586 list_del(elem);
@@ -1374,7 +1348,7 @@ static inline cas_page_t *cas_page_spare(struct cas *cp, const int index)
1374 cas_page_t *page = cp->rx_pages[1][index]; 1348 cas_page_t *page = cp->rx_pages[1][index];
1375 cas_page_t *new; 1349 cas_page_t *new;
1376 1350
1377 if (cas_buffer_count(page) == 1) 1351 if (page_count(page->buffer) == 1)
1378 return page; 1352 return page;
1379 1353
1380 new = cas_page_dequeue(cp); 1354 new = cas_page_dequeue(cp);
@@ -1394,7 +1368,7 @@ static cas_page_t *cas_page_swap(struct cas *cp, const int ring,
1394 cas_page_t **page1 = cp->rx_pages[1]; 1368 cas_page_t **page1 = cp->rx_pages[1];
1395 1369
1396 /* swap if buffer is in use */ 1370 /* swap if buffer is in use */
1397 if (cas_buffer_count(page0[index]) > 1) { 1371 if (page_count(page0[index]->buffer) > 1) {
1398 cas_page_t *new = cas_page_spare(cp, index); 1372 cas_page_t *new = cas_page_spare(cp, index);
1399 if (new) { 1373 if (new) {
1400 page1[index] = page0[index]; 1374 page1[index] = page0[index];
@@ -1979,6 +1953,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
1979 struct cas_page *page; 1953 struct cas_page *page;
1980 struct sk_buff *skb; 1954 struct sk_buff *skb;
1981 void *addr, *crcaddr; 1955 void *addr, *crcaddr;
1956 __sum16 csum;
1982 char *p; 1957 char *p;
1983 1958
1984 hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]); 1959 hlen = CAS_VAL(RX_COMP2_HDR_SIZE, words[1]);
@@ -2062,10 +2037,10 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
2062 2037
2063 skb_shinfo(skb)->nr_frags++; 2038 skb_shinfo(skb)->nr_frags++;
2064 skb->data_len += hlen - swivel; 2039 skb->data_len += hlen - swivel;
2040 skb->truesize += hlen - swivel;
2065 skb->len += hlen - swivel; 2041 skb->len += hlen - swivel;
2066 2042
2067 get_page(page->buffer); 2043 get_page(page->buffer);
2068 cas_buffer_inc(page);
2069 frag->page = page->buffer; 2044 frag->page = page->buffer;
2070 frag->page_offset = off; 2045 frag->page_offset = off;
2071 frag->size = hlen - swivel; 2046 frag->size = hlen - swivel;
@@ -2090,7 +2065,6 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
2090 frag++; 2065 frag++;
2091 2066
2092 get_page(page->buffer); 2067 get_page(page->buffer);
2093 cas_buffer_inc(page);
2094 frag->page = page->buffer; 2068 frag->page = page->buffer;
2095 frag->page_offset = 0; 2069 frag->page_offset = 0;
2096 frag->size = hlen; 2070 frag->size = hlen;
@@ -2158,14 +2132,15 @@ end_copy_pkt:
2158 skb_put(skb, alloclen); 2132 skb_put(skb, alloclen);
2159 } 2133 }
2160 2134
2161 i = CAS_VAL(RX_COMP4_TCP_CSUM, words[3]); 2135 csum = (__force __sum16)htons(CAS_VAL(RX_COMP4_TCP_CSUM, words[3]));
2162 if (cp->crc_size) { 2136 if (cp->crc_size) {
2163 /* checksum includes FCS. strip it out. */ 2137 /* checksum includes FCS. strip it out. */
2164 i = csum_fold(csum_partial(crcaddr, cp->crc_size, i)); 2138 csum = csum_fold(csum_partial(crcaddr, cp->crc_size,
2139 csum_unfold(csum)));
2165 if (addr) 2140 if (addr)
2166 cas_page_unmap(addr); 2141 cas_page_unmap(addr);
2167 } 2142 }
2168 skb->csum = ntohs(i ^ 0xffff); 2143 skb->csum = csum_unfold(~csum);
2169 skb->ip_summed = CHECKSUM_COMPLETE; 2144 skb->ip_summed = CHECKSUM_COMPLETE;
2170 skb->protocol = eth_type_trans(skb, cp->dev); 2145 skb->protocol = eth_type_trans(skb, cp->dev);
2171 return len; 2146 return len;
@@ -2253,7 +2228,7 @@ static int cas_post_rxds_ringN(struct cas *cp, int ring, int num)
2253 released = 0; 2228 released = 0;
2254 while (entry != last) { 2229 while (entry != last) {
2255 /* make a new buffer if it's still in use */ 2230 /* make a new buffer if it's still in use */
2256 if (cas_buffer_count(page[entry]) > 1) { 2231 if (page_count(page[entry]->buffer) > 1) {
2257 cas_page_t *new = cas_page_dequeue(cp); 2232 cas_page_t *new = cas_page_dequeue(cp);
2258 if (!new) { 2233 if (!new) {
2259 /* let the timer know that we need to 2234 /* let the timer know that we need to
@@ -2611,7 +2586,7 @@ static int cas_poll(struct napi_struct *napi, int budget)
2611{ 2586{
2612 struct cas *cp = container_of(napi, struct cas, napi); 2587 struct cas *cp = container_of(napi, struct cas, napi);
2613 struct net_device *dev = cp->dev; 2588 struct net_device *dev = cp->dev;
2614 int i, enable_intr, todo, credits; 2589 int i, enable_intr, credits;
2615 u32 status = readl(cp->regs + REG_INTR_STATUS); 2590 u32 status = readl(cp->regs + REG_INTR_STATUS);
2616 unsigned long flags; 2591 unsigned long flags;
2617 2592
@@ -4375,7 +4350,7 @@ static int cas_close(struct net_device *dev)
4375 struct cas *cp = netdev_priv(dev); 4350 struct cas *cp = netdev_priv(dev);
4376 4351
4377#ifdef USE_NAPI 4352#ifdef USE_NAPI
4378 napi_enable(&cp->napi); 4353 napi_disable(&cp->napi);
4379#endif 4354#endif
4380 /* Make sure we don't get distracted by suspend/resume */ 4355 /* Make sure we don't get distracted by suspend/resume */
4381 mutex_lock(&cp->pm_mutex); 4356 mutex_lock(&cp->pm_mutex);
@@ -4872,6 +4847,90 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4872 return rc; 4847 return rc;
4873} 4848}
4874 4849
4850/* When this chip sits underneath an Intel 31154 bridge, it is the
4851 * only subordinate device and we can tweak the bridge settings to
4852 * reflect that fact.
4853 */
4854static void __devinit cas_program_bridge(struct pci_dev *cas_pdev)
4855{
4856 struct pci_dev *pdev = cas_pdev->bus->self;
4857 u32 val;
4858
4859 if (!pdev)
4860 return;
4861
4862 if (pdev->vendor != 0x8086 || pdev->device != 0x537c)
4863 return;
4864
4865 /* Clear bit 10 (Bus Parking Control) in the Secondary
4866 * Arbiter Control/Status Register which lives at offset
4867 * 0x41. Using a 32-bit word read/modify/write at 0x40
4868 * is much simpler so that's how we do this.
4869 */
4870 pci_read_config_dword(pdev, 0x40, &val);
4871 val &= ~0x00040000;
4872 pci_write_config_dword(pdev, 0x40, val);
4873
4874 /* Max out the Multi-Transaction Timer settings since
4875 * Cassini is the only device present.
4876 *
4877 * The register is 16-bit and lives at 0x50. When the
4878 * settings are enabled, it extends the GRANT# signal
4879 * for a requestor after a transaction is complete. This
4880 * allows the next request to run without first needing
4881 * to negotiate the GRANT# signal back.
4882 *
4883 * Bits 12:10 define the grant duration:
4884 *
4885 * 1 -- 16 clocks
4886 * 2 -- 32 clocks
4887 * 3 -- 64 clocks
4888 * 4 -- 128 clocks
4889 * 5 -- 256 clocks
4890 *
4891 * All other values are illegal.
4892 *
4893 * Bits 09:00 define which REQ/GNT signal pairs get the
4894 * GRANT# signal treatment. We set them all.
4895 */
4896 pci_write_config_word(pdev, 0x50, (5 << 10) | 0x3ff);
4897
4898 /* The Read Prefecth Policy register is 16-bit and sits at
4899 * offset 0x52. It enables a "smart" pre-fetch policy. We
4900 * enable it and max out all of the settings since only one
4901 * device is sitting underneath and thus bandwidth sharing is
4902 * not an issue.
4903 *
4904 * The register has several 3 bit fields, which indicates a
4905 * multiplier applied to the base amount of prefetching the
4906 * chip would do. These fields are at:
4907 *
4908 * 15:13 --- ReRead Primary Bus
4909 * 12:10 --- FirstRead Primary Bus
4910 * 09:07 --- ReRead Secondary Bus
4911 * 06:04 --- FirstRead Secondary Bus
4912 *
4913 * Bits 03:00 control which REQ/GNT pairs the prefetch settings
4914 * get enabled on. Bit 3 is a grouped enabler which controls
4915 * all of the REQ/GNT pairs from [8:3]. Bits 2 to 0 control
4916 * the individual REQ/GNT pairs [2:0].
4917 */
4918 pci_write_config_word(pdev, 0x52,
4919 (0x7 << 13) |
4920 (0x7 << 10) |
4921 (0x7 << 7) |
4922 (0x7 << 4) |
4923 (0xf << 0));
4924
4925 /* Force cacheline size to 0x8 */
4926 pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x08);
4927
4928 /* Force latency timer to maximum setting so Cassini can
4929 * sit on the bus as long as it likes.
4930 */
4931 pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xff);
4932}
4933
4875static int __devinit cas_init_one(struct pci_dev *pdev, 4934static int __devinit cas_init_one(struct pci_dev *pdev,
4876 const struct pci_device_id *ent) 4935 const struct pci_device_id *ent)
4877{ 4936{
@@ -4927,6 +4986,8 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
4927 printk(KERN_WARNING PFX "Could not enable MWI for %s\n", 4986 printk(KERN_WARNING PFX "Could not enable MWI for %s\n",
4928 pci_name(pdev)); 4987 pci_name(pdev));
4929 4988
4989 cas_program_bridge(pdev);
4990
4930 /* 4991 /*
4931 * On some architectures, the default cache line size set 4992 * On some architectures, the default cache line size set
4932 * by pci_try_set_mwi reduces perforamnce. We have to increase 4993 * by pci_try_set_mwi reduces perforamnce. We have to increase
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h
index 2f93f83342d2..552af89ca1cf 100644
--- a/drivers/net/cassini.h
+++ b/drivers/net/cassini.h
@@ -4122,8 +4122,8 @@ cas_saturn_patch_t cas_saturn_patch[] = {
4122 inserted into 4122 inserted into
4123 outgoing frame. */ 4123 outgoing frame. */
4124struct cas_tx_desc { 4124struct cas_tx_desc {
4125 u64 control; 4125 __le64 control;
4126 u64 buffer; 4126 __le64 buffer;
4127}; 4127};
4128 4128
4129/* descriptor ring for free buffers contains page-sized buffers. the index 4129/* descriptor ring for free buffers contains page-sized buffers. the index
@@ -4131,8 +4131,8 @@ struct cas_tx_desc {
4131 * the completion ring. 4131 * the completion ring.
4132 */ 4132 */
4133struct cas_rx_desc { 4133struct cas_rx_desc {
4134 u64 index; 4134 __le64 index;
4135 u64 buffer; 4135 __le64 buffer;
4136}; 4136};
4137 4137
4138/* received packets are put on the completion ring. */ 4138/* received packets are put on the completion ring. */
@@ -4210,10 +4210,10 @@ struct cas_rx_desc {
4210#define RX_INDEX_RELEASE 0x0000000000002000ULL 4210#define RX_INDEX_RELEASE 0x0000000000002000ULL
4211 4211
4212struct cas_rx_comp { 4212struct cas_rx_comp {
4213 u64 word1; 4213 __le64 word1;
4214 u64 word2; 4214 __le64 word2;
4215 u64 word3; 4215 __le64 word3;
4216 u64 word4; 4216 __le64 word4;
4217}; 4217};
4218 4218
4219enum link_state { 4219enum link_state {
@@ -4252,7 +4252,7 @@ struct cas_init_block {
4252 struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP]; 4252 struct cas_rx_comp rxcs[N_RX_COMP_RINGS][INIT_BLOCK_RX_COMP];
4253 struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC]; 4253 struct cas_rx_desc rxds[N_RX_DESC_RINGS][INIT_BLOCK_RX_DESC];
4254 struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX]; 4254 struct cas_tx_desc txds[N_TX_RINGS][INIT_BLOCK_TX];
4255 u64 tx_compwb; 4255 __le64 tx_compwb;
4256}; 4256};
4257 4257
4258/* tiny buffers to deal with target abort issue. we allocate a bit 4258/* tiny buffers to deal with target abort issue. we allocate a bit
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index 6fd95a2c8cec..6e12d48351b8 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -459,7 +459,7 @@ static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
459 return NETDEV_TX_OK; 459 return NETDEV_TX_OK;
460 460
461 len = max(skb->len, ETH_ZLEN); 461 len = max(skb->len, ETH_ZLEN);
462 queue = skb->queue_mapping; 462 queue = skb_get_queue_mapping(skb);
463#ifdef CONFIG_NETDEVICES_MULTIQUEUE 463#ifdef CONFIG_NETDEVICES_MULTIQUEUE
464 netif_stop_subqueue(dev, queue); 464 netif_stop_subqueue(dev, queue);
465#else 465#else
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 5066beb2e7bc..e233d04a2132 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev)
332#endif 332#endif
333 /* Read eeprom */ 333 /* Read eeprom */
334 for (i = 0; i < 128; i++) { 334 for (i = 0; i < 128; i++) {
335 ((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i)); 335 ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i));
336 } 336 }
337#ifdef MEM_MAPPING 337#ifdef MEM_MAPPING
338 ioaddr = dev->base_addr; 338 ioaddr = dev->base_addr;
@@ -516,7 +516,7 @@ rio_timer (unsigned long data)
516 PCI_DMA_FROMDEVICE)); 516 PCI_DMA_FROMDEVICE));
517 } 517 }
518 np->rx_ring[entry].fraginfo |= 518 np->rx_ring[entry].fraginfo |=
519 cpu_to_le64 (np->rx_buf_sz) << 48; 519 cpu_to_le64((u64)np->rx_buf_sz << 48);
520 np->rx_ring[entry].status = 0; 520 np->rx_ring[entry].status = 0;
521 } /* end for */ 521 } /* end for */
522 } /* end if */ 522 } /* end if */
@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev)
584 cpu_to_le64 ( pci_map_single ( 584 cpu_to_le64 ( pci_map_single (
585 np->pdev, skb->data, np->rx_buf_sz, 585 np->pdev, skb->data, np->rx_buf_sz,
586 PCI_DMA_FROMDEVICE)); 586 PCI_DMA_FROMDEVICE));
587 np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; 587 np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48);
588 } 588 }
589 589
590 /* Set RFDListPtr */ 590 /* Set RFDListPtr */
591 writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0); 591 writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
592 writel (0, dev->base_addr + RFDListPtr1); 592 writel (0, dev->base_addr + RFDListPtr1);
593 593
594 return; 594 return;
@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
620 } 620 }
621#endif 621#endif
622 if (np->vlan) { 622 if (np->vlan) {
623 tfc_vlan_tag = 623 tfc_vlan_tag = VLANTagInsert |
624 cpu_to_le64 (VLANTagInsert) | 624 ((u64)np->vlan << 32) |
625 (cpu_to_le64 (np->vlan) << 32) | 625 ((u64)skb->priority << 45);
626 (cpu_to_le64 (skb->priority) << 45);
627 } 626 }
628 txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, 627 txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data,
629 skb->len, 628 skb->len,
630 PCI_DMA_TODEVICE)); 629 PCI_DMA_TODEVICE));
631 txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48; 630 txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48);
632 631
633 /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode 632 /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
634 * Work around: Always use 1 descriptor in 10Mbps mode */ 633 * Work around: Always use 1 descriptor in 10Mbps mode */
@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance)
708 return IRQ_RETVAL(handled); 707 return IRQ_RETVAL(handled);
709} 708}
710 709
710static inline dma_addr_t desc_to_dma(struct netdev_desc *desc)
711{
712 return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK;
713}
714
711static void 715static void
712rio_free_tx (struct net_device *dev, int irq) 716rio_free_tx (struct net_device *dev, int irq)
713{ 717{
@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq)
725 while (entry != np->cur_tx) { 729 while (entry != np->cur_tx) {
726 struct sk_buff *skb; 730 struct sk_buff *skb;
727 731
728 if (!(np->tx_ring[entry].status & TFDDone)) 732 if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone)))
729 break; 733 break;
730 skb = np->tx_skbuff[entry]; 734 skb = np->tx_skbuff[entry];
731 pci_unmap_single (np->pdev, 735 pci_unmap_single (np->pdev,
732 np->tx_ring[entry].fraginfo & DMA_48BIT_MASK, 736 desc_to_dma(&np->tx_ring[entry]),
733 skb->len, PCI_DMA_TODEVICE); 737 skb->len, PCI_DMA_TODEVICE);
734 if (irq) 738 if (irq)
735 dev_kfree_skb_irq (skb); 739 dev_kfree_skb_irq (skb);
@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev)
831 int pkt_len; 835 int pkt_len;
832 u64 frame_status; 836 u64 frame_status;
833 837
834 if (!(desc->status & RFDDone) || 838 if (!(desc->status & cpu_to_le64(RFDDone)) ||
835 !(desc->status & FrameStart) || !(desc->status & FrameEnd)) 839 !(desc->status & cpu_to_le64(FrameStart)) ||
840 !(desc->status & cpu_to_le64(FrameEnd)))
836 break; 841 break;
837 842
838 /* Chip omits the CRC. */ 843 /* Chip omits the CRC. */
839 pkt_len = le64_to_cpu (desc->status & 0xffff); 844 frame_status = le64_to_cpu(desc->status);
840 frame_status = le64_to_cpu (desc->status); 845 pkt_len = frame_status & 0xffff;
841 if (--cnt < 0) 846 if (--cnt < 0)
842 break; 847 break;
843 /* Update rx error statistics, drop packet. */ 848 /* Update rx error statistics, drop packet. */
@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev)
857 /* Small skbuffs for short packets */ 862 /* Small skbuffs for short packets */
858 if (pkt_len > copy_thresh) { 863 if (pkt_len > copy_thresh) {
859 pci_unmap_single (np->pdev, 864 pci_unmap_single (np->pdev,
860 desc->fraginfo & DMA_48BIT_MASK, 865 desc_to_dma(desc),
861 np->rx_buf_sz, 866 np->rx_buf_sz,
862 PCI_DMA_FROMDEVICE); 867 PCI_DMA_FROMDEVICE);
863 skb_put (skb = np->rx_skbuff[entry], pkt_len); 868 skb_put (skb = np->rx_skbuff[entry], pkt_len);
864 np->rx_skbuff[entry] = NULL; 869 np->rx_skbuff[entry] = NULL;
865 } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { 870 } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
866 pci_dma_sync_single_for_cpu(np->pdev, 871 pci_dma_sync_single_for_cpu(np->pdev,
867 desc->fraginfo & 872 desc_to_dma(desc),
868 DMA_48BIT_MASK,
869 np->rx_buf_sz, 873 np->rx_buf_sz,
870 PCI_DMA_FROMDEVICE); 874 PCI_DMA_FROMDEVICE);
871 /* 16 byte align the IP header */ 875 /* 16 byte align the IP header */
@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev)
875 pkt_len); 879 pkt_len);
876 skb_put (skb, pkt_len); 880 skb_put (skb, pkt_len);
877 pci_dma_sync_single_for_device(np->pdev, 881 pci_dma_sync_single_for_device(np->pdev,
878 desc->fraginfo & 882 desc_to_dma(desc),
879 DMA_48BIT_MASK,
880 np->rx_buf_sz, 883 np->rx_buf_sz,
881 PCI_DMA_FROMDEVICE); 884 PCI_DMA_FROMDEVICE);
882 } 885 }
@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev)
919 PCI_DMA_FROMDEVICE)); 922 PCI_DMA_FROMDEVICE));
920 } 923 }
921 np->rx_ring[entry].fraginfo |= 924 np->rx_ring[entry].fraginfo |=
922 cpu_to_le64 (np->rx_buf_sz) << 48; 925 cpu_to_le64((u64)np->rx_buf_sz << 48);
923 np->rx_ring[entry].status = 0; 926 np->rx_ring[entry].status = 0;
924 entry = (entry + 1) % RX_RING_SIZE; 927 entry = (entry + 1) % RX_RING_SIZE;
925 } 928 }
@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev)
1121 1124
1122 hash_table[0] = hash_table[1] = 0; 1125 hash_table[0] = hash_table[1] = 0;
1123 /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ 1126 /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
1124 hash_table[1] |= cpu_to_le32(0x02000000); 1127 hash_table[1] |= 0x02000000;
1125 if (dev->flags & IFF_PROMISC) { 1128 if (dev->flags & IFF_PROMISC) {
1126 /* Receive all frames promiscuously. */ 1129 /* Receive all frames promiscuously. */
1127 rx_mode = ReceiveAllFrames; 1130 rx_mode = ReceiveAllFrames;
@@ -1313,9 +1316,10 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
1313 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", 1316 ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x",
1314 i, 1317 i,
1315 (u32) (np->tx_ring_dma + i * sizeof (*desc)), 1318 (u32) (np->tx_ring_dma + i * sizeof (*desc)),
1316 (u32) desc->next_desc, 1319 (u32)le64_to_cpu(desc->next_desc),
1317 (u32) desc->status, (u32) (desc->fraginfo >> 32), 1320 (u32)le64_to_cpu(desc->status),
1318 (u32) desc->fraginfo); 1321 (u32)(le64_to_cpu(desc->fraginfo) >> 32),
1322 (u32)le64_to_cpu(desc->fraginfo));
1319 printk ("\n"); 1323 printk ("\n");
1320 } 1324 }
1321 printk ("\n"); 1325 printk ("\n");
@@ -1432,7 +1436,7 @@ mii_write (struct net_device *dev, int phy_addr, int reg_num, u16 data)
1432static int 1436static int
1433mii_wait_link (struct net_device *dev, int wait) 1437mii_wait_link (struct net_device *dev, int wait)
1434{ 1438{
1435 BMSR_t bmsr; 1439 __u16 bmsr;
1436 int phy_addr; 1440 int phy_addr;
1437 struct netdev_private *np; 1441 struct netdev_private *np;
1438 1442
@@ -1440,8 +1444,8 @@ mii_wait_link (struct net_device *dev, int wait)
1440 phy_addr = np->phy_addr; 1444 phy_addr = np->phy_addr;
1441 1445
1442 do { 1446 do {
1443 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1447 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1444 if (bmsr.bits.link_status) 1448 if (bmsr & MII_BMSR_LINK_STATUS)
1445 return 0; 1449 return 0;
1446 mdelay (1); 1450 mdelay (1);
1447 } while (--wait > 0); 1451 } while (--wait > 0);
@@ -1450,70 +1454,72 @@ mii_wait_link (struct net_device *dev, int wait)
1450static int 1454static int
1451mii_get_media (struct net_device *dev) 1455mii_get_media (struct net_device *dev)
1452{ 1456{
1453 ANAR_t negotiate; 1457 __u16 negotiate;
1454 BMSR_t bmsr; 1458 __u16 bmsr;
1455 BMCR_t bmcr; 1459 __u16 mscr;
1456 MSCR_t mscr; 1460 __u16 mssr;
1457 MSSR_t mssr;
1458 int phy_addr; 1461 int phy_addr;
1459 struct netdev_private *np; 1462 struct netdev_private *np;
1460 1463
1461 np = netdev_priv(dev); 1464 np = netdev_priv(dev);
1462 phy_addr = np->phy_addr; 1465 phy_addr = np->phy_addr;
1463 1466
1464 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1467 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1465 if (np->an_enable) { 1468 if (np->an_enable) {
1466 if (!bmsr.bits.an_complete) { 1469 if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
1467 /* Auto-Negotiation not completed */ 1470 /* Auto-Negotiation not completed */
1468 return -1; 1471 return -1;
1469 } 1472 }
1470 negotiate.image = mii_read (dev, phy_addr, MII_ANAR) & 1473 negotiate = mii_read (dev, phy_addr, MII_ANAR) &
1471 mii_read (dev, phy_addr, MII_ANLPAR); 1474 mii_read (dev, phy_addr, MII_ANLPAR);
1472 mscr.image = mii_read (dev, phy_addr, MII_MSCR); 1475 mscr = mii_read (dev, phy_addr, MII_MSCR);
1473 mssr.image = mii_read (dev, phy_addr, MII_MSSR); 1476 mssr = mii_read (dev, phy_addr, MII_MSSR);
1474 if (mscr.bits.media_1000BT_FD & mssr.bits.lp_1000BT_FD) { 1477 if (mscr & MII_MSCR_1000BT_FD && mssr & MII_MSSR_LP_1000BT_FD) {
1475 np->speed = 1000; 1478 np->speed = 1000;
1476 np->full_duplex = 1; 1479 np->full_duplex = 1;
1477 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); 1480 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
1478 } else if (mscr.bits.media_1000BT_HD & mssr.bits.lp_1000BT_HD) { 1481 } else if (mscr & MII_MSCR_1000BT_HD && mssr & MII_MSSR_LP_1000BT_HD) {
1479 np->speed = 1000; 1482 np->speed = 1000;
1480 np->full_duplex = 0; 1483 np->full_duplex = 0;
1481 printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n"); 1484 printk (KERN_INFO "Auto 1000 Mbps, Half duplex\n");
1482 } else if (negotiate.bits.media_100BX_FD) { 1485 } else if (negotiate & MII_ANAR_100BX_FD) {
1483 np->speed = 100; 1486 np->speed = 100;
1484 np->full_duplex = 1; 1487 np->full_duplex = 1;
1485 printk (KERN_INFO "Auto 100 Mbps, Full duplex\n"); 1488 printk (KERN_INFO "Auto 100 Mbps, Full duplex\n");
1486 } else if (negotiate.bits.media_100BX_HD) { 1489 } else if (negotiate & MII_ANAR_100BX_HD) {
1487 np->speed = 100; 1490 np->speed = 100;
1488 np->full_duplex = 0; 1491 np->full_duplex = 0;
1489 printk (KERN_INFO "Auto 100 Mbps, Half duplex\n"); 1492 printk (KERN_INFO "Auto 100 Mbps, Half duplex\n");
1490 } else if (negotiate.bits.media_10BT_FD) { 1493 } else if (negotiate & MII_ANAR_10BT_FD) {
1491 np->speed = 10; 1494 np->speed = 10;
1492 np->full_duplex = 1; 1495 np->full_duplex = 1;
1493 printk (KERN_INFO "Auto 10 Mbps, Full duplex\n"); 1496 printk (KERN_INFO "Auto 10 Mbps, Full duplex\n");
1494 } else if (negotiate.bits.media_10BT_HD) { 1497 } else if (negotiate & MII_ANAR_10BT_HD) {
1495 np->speed = 10; 1498 np->speed = 10;
1496 np->full_duplex = 0; 1499 np->full_duplex = 0;
1497 printk (KERN_INFO "Auto 10 Mbps, Half duplex\n"); 1500 printk (KERN_INFO "Auto 10 Mbps, Half duplex\n");
1498 } 1501 }
1499 if (negotiate.bits.pause) { 1502 if (negotiate & MII_ANAR_PAUSE) {
1500 np->tx_flow &= 1; 1503 np->tx_flow &= 1;
1501 np->rx_flow &= 1; 1504 np->rx_flow &= 1;
1502 } else if (negotiate.bits.asymmetric) { 1505 } else if (negotiate & MII_ANAR_ASYMMETRIC) {
1503 np->tx_flow = 0; 1506 np->tx_flow = 0;
1504 np->rx_flow &= 1; 1507 np->rx_flow &= 1;
1505 } 1508 }
1506 /* else tx_flow, rx_flow = user select */ 1509 /* else tx_flow, rx_flow = user select */
1507 } else { 1510 } else {
1508 bmcr.image = mii_read (dev, phy_addr, MII_BMCR); 1511 __u16 bmcr = mii_read (dev, phy_addr, MII_BMCR);
1509 if (bmcr.bits.speed100 == 1 && bmcr.bits.speed1000 == 0) { 1512 switch (bmcr & (MII_BMCR_SPEED_100 | MII_BMCR_SPEED_1000)) {
1513 case MII_BMCR_SPEED_1000:
1514 printk (KERN_INFO "Operating at 1000 Mbps, ");
1515 break;
1516 case MII_BMCR_SPEED_100:
1510 printk (KERN_INFO "Operating at 100 Mbps, "); 1517 printk (KERN_INFO "Operating at 100 Mbps, ");
1511 } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 0) { 1518 break;
1519 case 0:
1512 printk (KERN_INFO "Operating at 10 Mbps, "); 1520 printk (KERN_INFO "Operating at 10 Mbps, ");
1513 } else if (bmcr.bits.speed100 == 0 && bmcr.bits.speed1000 == 1) {
1514 printk (KERN_INFO "Operating at 1000 Mbps, ");
1515 } 1521 }
1516 if (bmcr.bits.duplex_mode) { 1522 if (bmcr & MII_BMCR_DUPLEX_MODE) {
1517 printk ("Full duplex\n"); 1523 printk ("Full duplex\n");
1518 } else { 1524 } else {
1519 printk ("Half duplex\n"); 1525 printk ("Half duplex\n");
@@ -1534,10 +1540,10 @@ mii_get_media (struct net_device *dev)
1534static int 1540static int
1535mii_set_media (struct net_device *dev) 1541mii_set_media (struct net_device *dev)
1536{ 1542{
1537 PHY_SCR_t pscr; 1543 __u16 pscr;
1538 BMCR_t bmcr; 1544 __u16 bmcr;
1539 BMSR_t bmsr; 1545 __u16 bmsr;
1540 ANAR_t anar; 1546 __u16 anar;
1541 int phy_addr; 1547 int phy_addr;
1542 struct netdev_private *np; 1548 struct netdev_private *np;
1543 np = netdev_priv(dev); 1549 np = netdev_priv(dev);
@@ -1546,76 +1552,77 @@ mii_set_media (struct net_device *dev)
1546 /* Does user set speed? */ 1552 /* Does user set speed? */
1547 if (np->an_enable) { 1553 if (np->an_enable) {
1548 /* Advertise capabilities */ 1554 /* Advertise capabilities */
1549 bmsr.image = mii_read (dev, phy_addr, MII_BMSR); 1555 bmsr = mii_read (dev, phy_addr, MII_BMSR);
1550 anar.image = mii_read (dev, phy_addr, MII_ANAR); 1556 anar = mii_read (dev, phy_addr, MII_ANAR) &
1551 anar.bits.media_100BX_FD = bmsr.bits.media_100BX_FD; 1557 ~MII_ANAR_100BX_FD &
1552 anar.bits.media_100BX_HD = bmsr.bits.media_100BX_HD; 1558 ~MII_ANAR_100BX_HD &
1553 anar.bits.media_100BT4 = bmsr.bits.media_100BT4; 1559 ~MII_ANAR_100BT4 &
1554 anar.bits.media_10BT_FD = bmsr.bits.media_10BT_FD; 1560 ~MII_ANAR_10BT_FD &
1555 anar.bits.media_10BT_HD = bmsr.bits.media_10BT_HD; 1561 ~MII_ANAR_10BT_HD;
1556 anar.bits.pause = 1; 1562 if (bmsr & MII_BMSR_100BX_FD)
1557 anar.bits.asymmetric = 1; 1563 anar |= MII_ANAR_100BX_FD;
1558 mii_write (dev, phy_addr, MII_ANAR, anar.image); 1564 if (bmsr & MII_BMSR_100BX_HD)
1565 anar |= MII_ANAR_100BX_HD;
1566 if (bmsr & MII_BMSR_100BT4)
1567 anar |= MII_ANAR_100BT4;
1568 if (bmsr & MII_BMSR_10BT_FD)
1569 anar |= MII_ANAR_10BT_FD;
1570 if (bmsr & MII_BMSR_10BT_HD)
1571 anar |= MII_ANAR_10BT_HD;
1572 anar |= MII_ANAR_PAUSE | MII_ANAR_ASYMMETRIC;
1573 mii_write (dev, phy_addr, MII_ANAR, anar);
1559 1574
1560 /* Enable Auto crossover */ 1575 /* Enable Auto crossover */
1561 pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); 1576 pscr = mii_read (dev, phy_addr, MII_PHY_SCR);
1562 pscr.bits.mdi_crossover_mode = 3; /* 11'b */ 1577 pscr |= 3 << 5; /* 11'b */
1563 mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); 1578 mii_write (dev, phy_addr, MII_PHY_SCR, pscr);
1564 1579
1565 /* Soft reset PHY */ 1580 /* Soft reset PHY */
1566 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); 1581 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET);
1567 bmcr.image = 0; 1582 bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN | MII_BMCR_RESET;
1568 bmcr.bits.an_enable = 1; 1583 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1569 bmcr.bits.restart_an = 1;
1570 bmcr.bits.reset = 1;
1571 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1572 mdelay(1); 1584 mdelay(1);
1573 } else { 1585 } else {
1574 /* Force speed setting */ 1586 /* Force speed setting */
1575 /* 1) Disable Auto crossover */ 1587 /* 1) Disable Auto crossover */
1576 pscr.image = mii_read (dev, phy_addr, MII_PHY_SCR); 1588 pscr = mii_read (dev, phy_addr, MII_PHY_SCR);
1577 pscr.bits.mdi_crossover_mode = 0; 1589 pscr &= ~(3 << 5);
1578 mii_write (dev, phy_addr, MII_PHY_SCR, pscr.image); 1590 mii_write (dev, phy_addr, MII_PHY_SCR, pscr);
1579 1591
1580 /* 2) PHY Reset */ 1592 /* 2) PHY Reset */
1581 bmcr.image = mii_read (dev, phy_addr, MII_BMCR); 1593 bmcr = mii_read (dev, phy_addr, MII_BMCR);
1582 bmcr.bits.reset = 1; 1594 bmcr |= MII_BMCR_RESET;
1583 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1595 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1584 1596
1585 /* 3) Power Down */ 1597 /* 3) Power Down */
1586 bmcr.image = 0x1940; /* must be 0x1940 */ 1598 bmcr = 0x1940; /* must be 0x1940 */
1587 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1599 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1588 mdelay (100); /* wait a certain time */ 1600 mdelay (100); /* wait a certain time */
1589 1601
1590 /* 4) Advertise nothing */ 1602 /* 4) Advertise nothing */
1591 mii_write (dev, phy_addr, MII_ANAR, 0); 1603 mii_write (dev, phy_addr, MII_ANAR, 0);
1592 1604
1593 /* 5) Set media and Power Up */ 1605 /* 5) Set media and Power Up */
1594 bmcr.image = 0; 1606 bmcr = MII_BMCR_POWER_DOWN;
1595 bmcr.bits.power_down = 1;
1596 if (np->speed == 100) { 1607 if (np->speed == 100) {
1597 bmcr.bits.speed100 = 1; 1608 bmcr |= MII_BMCR_SPEED_100;
1598 bmcr.bits.speed1000 = 0;
1599 printk (KERN_INFO "Manual 100 Mbps, "); 1609 printk (KERN_INFO "Manual 100 Mbps, ");
1600 } else if (np->speed == 10) { 1610 } else if (np->speed == 10) {
1601 bmcr.bits.speed100 = 0;
1602 bmcr.bits.speed1000 = 0;
1603 printk (KERN_INFO "Manual 10 Mbps, "); 1611 printk (KERN_INFO "Manual 10 Mbps, ");
1604 } 1612 }
1605 if (np->full_duplex) { 1613 if (np->full_duplex) {
1606 bmcr.bits.duplex_mode = 1; 1614 bmcr |= MII_BMCR_DUPLEX_MODE;
1607 printk ("Full duplex\n"); 1615 printk ("Full duplex\n");
1608 } else { 1616 } else {
1609 bmcr.bits.duplex_mode = 0;
1610 printk ("Half duplex\n"); 1617 printk ("Half duplex\n");
1611 } 1618 }
1612#if 0 1619#if 0
1613 /* Set 1000BaseT Master/Slave setting */ 1620 /* Set 1000BaseT Master/Slave setting */
1614 mscr.image = mii_read (dev, phy_addr, MII_MSCR); 1621 mscr = mii_read (dev, phy_addr, MII_MSCR);
1615 mscr.bits.cfg_enable = 1; 1622 mscr |= MII_MSCR_CFG_ENABLE;
1616 mscr.bits.cfg_value = 0; 1623 mscr &= ~MII_MSCR_CFG_VALUE = 0;
1617#endif 1624#endif
1618 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1625 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1619 mdelay(10); 1626 mdelay(10);
1620 } 1627 }
1621 return 0; 1628 return 0;
@@ -1624,43 +1631,42 @@ mii_set_media (struct net_device *dev)
1624static int 1631static int
1625mii_get_media_pcs (struct net_device *dev) 1632mii_get_media_pcs (struct net_device *dev)
1626{ 1633{
1627 ANAR_PCS_t negotiate; 1634 __u16 negotiate;
1628 BMSR_t bmsr; 1635 __u16 bmsr;
1629 BMCR_t bmcr;
1630 int phy_addr; 1636 int phy_addr;
1631 struct netdev_private *np; 1637 struct netdev_private *np;
1632 1638
1633 np = netdev_priv(dev); 1639 np = netdev_priv(dev);
1634 phy_addr = np->phy_addr; 1640 phy_addr = np->phy_addr;
1635 1641
1636 bmsr.image = mii_read (dev, phy_addr, PCS_BMSR); 1642 bmsr = mii_read (dev, phy_addr, PCS_BMSR);
1637 if (np->an_enable) { 1643 if (np->an_enable) {
1638 if (!bmsr.bits.an_complete) { 1644 if (!(bmsr & MII_BMSR_AN_COMPLETE)) {
1639 /* Auto-Negotiation not completed */ 1645 /* Auto-Negotiation not completed */
1640 return -1; 1646 return -1;
1641 } 1647 }
1642 negotiate.image = mii_read (dev, phy_addr, PCS_ANAR) & 1648 negotiate = mii_read (dev, phy_addr, PCS_ANAR) &
1643 mii_read (dev, phy_addr, PCS_ANLPAR); 1649 mii_read (dev, phy_addr, PCS_ANLPAR);
1644 np->speed = 1000; 1650 np->speed = 1000;
1645 if (negotiate.bits.full_duplex) { 1651 if (negotiate & PCS_ANAR_FULL_DUPLEX) {
1646 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n"); 1652 printk (KERN_INFO "Auto 1000 Mbps, Full duplex\n");
1647 np->full_duplex = 1; 1653 np->full_duplex = 1;
1648 } else { 1654 } else {
1649 printk (KERN_INFO "Auto 1000 Mbps, half duplex\n"); 1655 printk (KERN_INFO "Auto 1000 Mbps, half duplex\n");
1650 np->full_duplex = 0; 1656 np->full_duplex = 0;
1651 } 1657 }
1652 if (negotiate.bits.pause) { 1658 if (negotiate & PCS_ANAR_PAUSE) {
1653 np->tx_flow &= 1; 1659 np->tx_flow &= 1;
1654 np->rx_flow &= 1; 1660 np->rx_flow &= 1;
1655 } else if (negotiate.bits.asymmetric) { 1661 } else if (negotiate & PCS_ANAR_ASYMMETRIC) {
1656 np->tx_flow = 0; 1662 np->tx_flow = 0;
1657 np->rx_flow &= 1; 1663 np->rx_flow &= 1;
1658 } 1664 }
1659 /* else tx_flow, rx_flow = user select */ 1665 /* else tx_flow, rx_flow = user select */
1660 } else { 1666 } else {
1661 bmcr.image = mii_read (dev, phy_addr, PCS_BMCR); 1667 __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR);
1662 printk (KERN_INFO "Operating at 1000 Mbps, "); 1668 printk (KERN_INFO "Operating at 1000 Mbps, ");
1663 if (bmcr.bits.duplex_mode) { 1669 if (bmcr & MII_BMCR_DUPLEX_MODE) {
1664 printk ("Full duplex\n"); 1670 printk ("Full duplex\n");
1665 } else { 1671 } else {
1666 printk ("Half duplex\n"); 1672 printk ("Half duplex\n");
@@ -1681,9 +1687,9 @@ mii_get_media_pcs (struct net_device *dev)
1681static int 1687static int
1682mii_set_media_pcs (struct net_device *dev) 1688mii_set_media_pcs (struct net_device *dev)
1683{ 1689{
1684 BMCR_t bmcr; 1690 __u16 bmcr;
1685 ESR_t esr; 1691 __u16 esr;
1686 ANAR_PCS_t anar; 1692 __u16 anar;
1687 int phy_addr; 1693 int phy_addr;
1688 struct netdev_private *np; 1694 struct netdev_private *np;
1689 np = netdev_priv(dev); 1695 np = netdev_priv(dev);
@@ -1692,41 +1698,37 @@ mii_set_media_pcs (struct net_device *dev)
1692 /* Auto-Negotiation? */ 1698 /* Auto-Negotiation? */
1693 if (np->an_enable) { 1699 if (np->an_enable) {
1694 /* Advertise capabilities */ 1700 /* Advertise capabilities */
1695 esr.image = mii_read (dev, phy_addr, PCS_ESR); 1701 esr = mii_read (dev, phy_addr, PCS_ESR);
1696 anar.image = mii_read (dev, phy_addr, MII_ANAR); 1702 anar = mii_read (dev, phy_addr, MII_ANAR) &
1697 anar.bits.half_duplex = 1703 ~PCS_ANAR_HALF_DUPLEX &
1698 esr.bits.media_1000BT_HD | esr.bits.media_1000BX_HD; 1704 ~PCS_ANAR_FULL_DUPLEX;
1699 anar.bits.full_duplex = 1705 if (esr & (MII_ESR_1000BT_HD | MII_ESR_1000BX_HD))
1700 esr.bits.media_1000BT_FD | esr.bits.media_1000BX_FD; 1706 anar |= PCS_ANAR_HALF_DUPLEX;
1701 anar.bits.pause = 1; 1707 if (esr & (MII_ESR_1000BT_FD | MII_ESR_1000BX_FD))
1702 anar.bits.asymmetric = 1; 1708 anar |= PCS_ANAR_FULL_DUPLEX;
1703 mii_write (dev, phy_addr, MII_ANAR, anar.image); 1709 anar |= PCS_ANAR_PAUSE | PCS_ANAR_ASYMMETRIC;
1710 mii_write (dev, phy_addr, MII_ANAR, anar);
1704 1711
1705 /* Soft reset PHY */ 1712 /* Soft reset PHY */
1706 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET); 1713 mii_write (dev, phy_addr, MII_BMCR, MII_BMCR_RESET);
1707 bmcr.image = 0; 1714 bmcr = MII_BMCR_AN_ENABLE | MII_BMCR_RESTART_AN |
1708 bmcr.bits.an_enable = 1; 1715 MII_BMCR_RESET;
1709 bmcr.bits.restart_an = 1; 1716 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1710 bmcr.bits.reset = 1;
1711 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1712 mdelay(1); 1717 mdelay(1);
1713 } else { 1718 } else {
1714 /* Force speed setting */ 1719 /* Force speed setting */
1715 /* PHY Reset */ 1720 /* PHY Reset */
1716 bmcr.image = 0; 1721 bmcr = MII_BMCR_RESET;
1717 bmcr.bits.reset = 1; 1722 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1718 mii_write (dev, phy_addr, MII_BMCR, bmcr.image);
1719 mdelay(10); 1723 mdelay(10);
1720 bmcr.image = 0;
1721 bmcr.bits.an_enable = 0;
1722 if (np->full_duplex) { 1724 if (np->full_duplex) {
1723 bmcr.bits.duplex_mode = 1; 1725 bmcr = MII_BMCR_DUPLEX_MODE;
1724 printk (KERN_INFO "Manual full duplex\n"); 1726 printk (KERN_INFO "Manual full duplex\n");
1725 } else { 1727 } else {
1726 bmcr.bits.duplex_mode = 0; 1728 bmcr = 0;
1727 printk (KERN_INFO "Manual half duplex\n"); 1729 printk (KERN_INFO "Manual half duplex\n");
1728 } 1730 }
1729 mii_write (dev, phy_addr, MII_BMCR, bmcr.image); 1731 mii_write (dev, phy_addr, MII_BMCR, bmcr);
1730 mdelay(10); 1732 mdelay(10);
1731 1733
1732 /* Advertise nothing */ 1734 /* Advertise nothing */
@@ -1762,7 +1764,7 @@ rio_close (struct net_device *dev)
1762 skb = np->rx_skbuff[i]; 1764 skb = np->rx_skbuff[i];
1763 if (skb) { 1765 if (skb) {
1764 pci_unmap_single(np->pdev, 1766 pci_unmap_single(np->pdev,
1765 np->rx_ring[i].fraginfo & DMA_48BIT_MASK, 1767 desc_to_dma(&np->rx_ring[i]),
1766 skb->len, PCI_DMA_FROMDEVICE); 1768 skb->len, PCI_DMA_FROMDEVICE);
1767 dev_kfree_skb (skb); 1769 dev_kfree_skb (skb);
1768 np->rx_skbuff[i] = NULL; 1770 np->rx_skbuff[i] = NULL;
@@ -1772,7 +1774,7 @@ rio_close (struct net_device *dev)
1772 skb = np->tx_skbuff[i]; 1774 skb = np->tx_skbuff[i];
1773 if (skb) { 1775 if (skb) {
1774 pci_unmap_single(np->pdev, 1776 pci_unmap_single(np->pdev,
1775 np->tx_ring[i].fraginfo & DMA_48BIT_MASK, 1777 desc_to_dma(&np->tx_ring[i]),
1776 skb->len, PCI_DMA_TODEVICE); 1778 skb->len, PCI_DMA_TODEVICE);
1777 dev_kfree_skb (skb); 1779 dev_kfree_skb (skb);
1778 np->tx_skbuff[i] = NULL; 1780 np->tx_skbuff[i] = NULL;
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 5b801775f42d..d66c605b4075 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -298,23 +298,6 @@ enum _pcs_reg {
298}; 298};
299 299
300/* Basic Mode Control Register */ 300/* Basic Mode Control Register */
301typedef union t_MII_BMCR {
302 u16 image;
303 struct {
304 u16 _bit_5_0:6; // bit 5:0
305 u16 speed1000:1; // bit 6
306 u16 col_test_enable:1; // bit 7
307 u16 duplex_mode:1; // bit 8
308 u16 restart_an:1; // bit 9
309 u16 isolate:1; // bit 10
310 u16 power_down:1; // bit 11
311 u16 an_enable:1; // bit 12
312 u16 speed100:1; // bit 13
313 u16 loopback:1; // bit 14
314 u16 reset:1; // bit 15
315 } bits;
316} BMCR_t, *PBMCR_t;
317
318enum _mii_bmcr { 301enum _mii_bmcr {
319 MII_BMCR_RESET = 0x8000, 302 MII_BMCR_RESET = 0x8000,
320 MII_BMCR_LOOP_BACK = 0x4000, 303 MII_BMCR_LOOP_BACK = 0x4000,
@@ -333,28 +316,6 @@ enum _mii_bmcr {
333}; 316};
334 317
335/* Basic Mode Status Register */ 318/* Basic Mode Status Register */
336typedef union t_MII_BMSR {
337 u16 image;
338 struct {
339 u16 ext_capability:1; // bit 0
340 u16 japper_detect:1; // bit 1
341 u16 link_status:1; // bit 2
342 u16 an_ability:1; // bit 3
343 u16 remote_fault:1; // bit 4
344 u16 an_complete:1; // bit 5
345 u16 preamble_supp:1; // bit 6
346 u16 _bit_7:1; // bit 7
347 u16 ext_status:1; // bit 8
348 u16 media_100BT2_HD:1; // bit 9
349 u16 media_100BT2_FD:1; // bit 10
350 u16 media_10BT_HD:1; // bit 11
351 u16 media_10BT_FD:1; // bit 12
352 u16 media_100BX_HD:1; // bit 13
353 u16 media_100BX_FD:1; // bit 14
354 u16 media_100BT4:1; // bit 15
355 } bits;
356} BMSR_t, *PBMSR_t;
357
358enum _mii_bmsr { 319enum _mii_bmsr {
359 MII_BMSR_100BT4 = 0x8000, 320 MII_BMSR_100BT4 = 0x8000,
360 MII_BMSR_100BX_FD = 0x4000, 321 MII_BMSR_100BX_FD = 0x4000,
@@ -374,24 +335,6 @@ enum _mii_bmsr {
374}; 335};
375 336
376/* ANAR */ 337/* ANAR */
377typedef union t_MII_ANAR {
378 u16 image;
379 struct {
380 u16 selector:5; // bit 4:0
381 u16 media_10BT_HD:1; // bit 5
382 u16 media_10BT_FD:1; // bit 6
383 u16 media_100BX_HD:1; // bit 7
384 u16 media_100BX_FD:1; // bit 8
385 u16 media_100BT4:1; // bit 9
386 u16 pause:1; // bit 10
387 u16 asymmetric:1; // bit 11
388 u16 _bit12:1; // bit 12
389 u16 remote_fault:1; // bit 13
390 u16 _bit14:1; // bit 14
391 u16 next_page:1; // bit 15
392 } bits;
393} ANAR_t, *PANAR_t;
394
395enum _mii_anar { 338enum _mii_anar {
396 MII_ANAR_NEXT_PAGE = 0x8000, 339 MII_ANAR_NEXT_PAGE = 0x8000,
397 MII_ANAR_REMOTE_FAULT = 0x4000, 340 MII_ANAR_REMOTE_FAULT = 0x4000,
@@ -407,24 +350,6 @@ enum _mii_anar {
407}; 350};
408 351
409/* ANLPAR */ 352/* ANLPAR */
410typedef union t_MII_ANLPAR {
411 u16 image;
412 struct {
413 u16 selector:5; // bit 4:0
414 u16 media_10BT_HD:1; // bit 5
415 u16 media_10BT_FD:1; // bit 6
416 u16 media_100BX_HD:1; // bit 7
417 u16 media_100BX_FD:1; // bit 8
418 u16 media_100BT4:1; // bit 9
419 u16 pause:1; // bit 10
420 u16 asymmetric:1; // bit 11
421 u16 _bit12:1; // bit 12
422 u16 remote_fault:1; // bit 13
423 u16 _bit14:1; // bit 14
424 u16 next_page:1; // bit 15
425 } bits;
426} ANLPAR_t, *PANLPAR_t;
427
428enum _mii_anlpar { 353enum _mii_anlpar {
429 MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE, 354 MII_ANLPAR_NEXT_PAGE = MII_ANAR_NEXT_PAGE,
430 MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT, 355 MII_ANLPAR_REMOTE_FAULT = MII_ANAR_REMOTE_FAULT,
@@ -439,18 +364,6 @@ enum _mii_anlpar {
439}; 364};
440 365
441/* Auto-Negotiation Expansion Register */ 366/* Auto-Negotiation Expansion Register */
442typedef union t_MII_ANER {
443 u16 image;
444 struct {
445 u16 lp_negotiable:1; // bit 0
446 u16 page_received:1; // bit 1
447 u16 nextpagable:1; // bit 2
448 u16 lp_nextpagable:1; // bit 3
449 u16 pdetect_fault:1; // bit 4
450 u16 _bit15_5:11; // bit 15:5
451 } bits;
452} ANER_t, *PANER_t;
453
454enum _mii_aner { 367enum _mii_aner {
455 MII_ANER_PAR_DETECT_FAULT = 0x0010, 368 MII_ANER_PAR_DETECT_FAULT = 0x0010,
456 MII_ANER_LP_NEXTPAGABLE = 0x0008, 369 MII_ANER_LP_NEXTPAGABLE = 0x0008,
@@ -460,19 +373,6 @@ enum _mii_aner {
460}; 373};
461 374
462/* MASTER-SLAVE Control Register */ 375/* MASTER-SLAVE Control Register */
463typedef union t_MII_MSCR {
464 u16 image;
465 struct {
466 u16 _bit_7_0:8; // bit 7:0
467 u16 media_1000BT_HD:1; // bit 8
468 u16 media_1000BT_FD:1; // bit 9
469 u16 port_type:1; // bit 10
470 u16 cfg_value:1; // bit 11
471 u16 cfg_enable:1; // bit 12
472 u16 test_mode:3; // bit 15:13
473 } bits;
474} MSCR_t, *PMSCR_t;
475
476enum _mii_mscr { 376enum _mii_mscr {
477 MII_MSCR_TEST_MODE = 0xe000, 377 MII_MSCR_TEST_MODE = 0xe000,
478 MII_MSCR_CFG_ENABLE = 0x1000, 378 MII_MSCR_CFG_ENABLE = 0x1000,
@@ -483,20 +383,6 @@ enum _mii_mscr {
483}; 383};
484 384
485/* MASTER-SLAVE Status Register */ 385/* MASTER-SLAVE Status Register */
486typedef union t_MII_MSSR {
487 u16 image;
488 struct {
489 u16 idle_err_count:8; // bit 7:0
490 u16 _bit_9_8:2; // bit 9:8
491 u16 lp_1000BT_HD:1; // bit 10
492 u16 lp_1000BT_FD:1; // bit 11
493 u16 remote_rcv_status:1; // bit 12
494 u16 local_rcv_status:1; // bit 13
495 u16 cfg_resolution:1; // bit 14
496 u16 cfg_fault:1; // bit 15
497 } bits;
498} MSSR_t, *PMSSR_t;
499
500enum _mii_mssr { 386enum _mii_mssr {
501 MII_MSSR_CFG_FAULT = 0x8000, 387 MII_MSSR_CFG_FAULT = 0x8000,
502 MII_MSSR_CFG_RES = 0x4000, 388 MII_MSSR_CFG_RES = 0x4000,
@@ -508,17 +394,6 @@ enum _mii_mssr {
508}; 394};
509 395
510/* IEEE Extened Status Register */ 396/* IEEE Extened Status Register */
511typedef union t_MII_ESR {
512 u16 image;
513 struct {
514 u16 _bit_11_0:12; // bit 11:0
515 u16 media_1000BT_HD:2; // bit 12
516 u16 media_1000BT_FD:1; // bit 13
517 u16 media_1000BX_HD:1; // bit 14
518 u16 media_1000BX_FD:1; // bit 15
519 } bits;
520} ESR_t, *PESR_t;
521
522enum _mii_esr { 397enum _mii_esr {
523 MII_ESR_1000BX_FD = 0x8000, 398 MII_ESR_1000BX_FD = 0x8000,
524 MII_ESR_1000BX_HD = 0x4000, 399 MII_ESR_1000BX_HD = 0x4000,
@@ -526,6 +401,7 @@ enum _mii_esr {
526 MII_ESR_1000BT_HD = 0x1000, 401 MII_ESR_1000BT_HD = 0x1000,
527}; 402};
528/* PHY Specific Control Register */ 403/* PHY Specific Control Register */
404#if 0
529typedef union t_MII_PHY_SCR { 405typedef union t_MII_PHY_SCR {
530 u16 image; 406 u16 image;
531 struct { 407 struct {
@@ -543,6 +419,7 @@ typedef union t_MII_PHY_SCR {
543 u16 xmit_fifo_depth:2; // bit 15:14 419 u16 xmit_fifo_depth:2; // bit 15:14
544 } bits; 420 } bits;
545} PHY_SCR_t, *PPHY_SCR_t; 421} PHY_SCR_t, *PPHY_SCR_t;
422#endif
546 423
547typedef enum t_MII_ADMIN_STATUS { 424typedef enum t_MII_ADMIN_STATUS {
548 adm_reset, 425 adm_reset,
@@ -556,21 +433,6 @@ typedef enum t_MII_ADMIN_STATUS {
556/* PCS control and status registers bitmap as the same as MII */ 433/* PCS control and status registers bitmap as the same as MII */
557/* PCS Extended Status register bitmap as the same as MII */ 434/* PCS Extended Status register bitmap as the same as MII */
558/* PCS ANAR */ 435/* PCS ANAR */
559typedef union t_PCS_ANAR {
560 u16 image;
561 struct {
562 u16 _bit_4_0:5; // bit 4:0
563 u16 full_duplex:1; // bit 5
564 u16 half_duplex:1; // bit 6
565 u16 asymmetric:1; // bit 7
566 u16 pause:1; // bit 8
567 u16 _bit_11_9:3; // bit 11:9
568 u16 remote_fault:2; // bit 13:12
569 u16 _bit_14:1; // bit 14
570 u16 next_page:1; // bit 15
571 } bits;
572} ANAR_PCS_t, *PANAR_PCS_t;
573
574enum _pcs_anar { 436enum _pcs_anar {
575 PCS_ANAR_NEXT_PAGE = 0x8000, 437 PCS_ANAR_NEXT_PAGE = 0x8000,
576 PCS_ANAR_REMOTE_FAULT = 0x3000, 438 PCS_ANAR_REMOTE_FAULT = 0x3000,
@@ -580,21 +442,6 @@ enum _pcs_anar {
580 PCS_ANAR_FULL_DUPLEX = 0x0020, 442 PCS_ANAR_FULL_DUPLEX = 0x0020,
581}; 443};
582/* PCS ANLPAR */ 444/* PCS ANLPAR */
583typedef union t_PCS_ANLPAR {
584 u16 image;
585 struct {
586 u16 _bit_4_0:5; // bit 4:0
587 u16 full_duplex:1; // bit 5
588 u16 half_duplex:1; // bit 6
589 u16 asymmetric:1; // bit 7
590 u16 pause:1; // bit 8
591 u16 _bit_11_9:3; // bit 11:9
592 u16 remote_fault:2; // bit 13:12
593 u16 _bit_14:1; // bit 14
594 u16 next_page:1; // bit 15
595 } bits;
596} ANLPAR_PCS_t, *PANLPAR_PCS_t;
597
598enum _pcs_anlpar { 445enum _pcs_anlpar {
599 PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE, 446 PCS_ANLPAR_NEXT_PAGE = PCS_ANAR_NEXT_PAGE,
600 PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT, 447 PCS_ANLPAR_REMOTE_FAULT = PCS_ANAR_REMOTE_FAULT,
@@ -633,9 +480,9 @@ struct mii_data {
633 480
634/* The Rx and Tx buffer descriptors. */ 481/* The Rx and Tx buffer descriptors. */
635struct netdev_desc { 482struct netdev_desc {
636 u64 next_desc; 483 __le64 next_desc;
637 u64 status; 484 __le64 status;
638 u64 fraginfo; 485 __le64 fraginfo;
639}; 486};
640 487
641#define PRIV_ALIGN 15 /* Required alignment mask */ 488#define PRIV_ALIGN 15 /* Required alignment mask */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 2b06e4b4dabc..b87402bc8308 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1991,13 +1991,12 @@ static int e100_poll(struct napi_struct *napi, int budget)
1991 struct nic *nic = container_of(napi, struct nic, napi); 1991 struct nic *nic = container_of(napi, struct nic, napi);
1992 struct net_device *netdev = nic->netdev; 1992 struct net_device *netdev = nic->netdev;
1993 unsigned int work_done = 0; 1993 unsigned int work_done = 0;
1994 int tx_cleaned;
1995 1994
1996 e100_rx_clean(nic, &work_done, budget); 1995 e100_rx_clean(nic, &work_done, budget);
1997 tx_cleaned = e100_tx_clean(nic); 1996 e100_tx_clean(nic);
1998 1997
1999 /* If no Rx and Tx cleanup work was done, exit polling mode. */ 1998 /* If budget not fully consumed, exit the polling mode */
2000 if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 1999 if (work_done < budget) {
2001 netif_rx_complete(netdev, napi); 2000 netif_rx_complete(netdev, napi);
2002 e100_enable_irq(nic); 2001 e100_enable_irq(nic);
2003 } 2002 }
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4f37506ad374..76c0fa690cc6 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -632,6 +632,7 @@ e1000_down(struct e1000_adapter *adapter)
632 632
633#ifdef CONFIG_E1000_NAPI 633#ifdef CONFIG_E1000_NAPI
634 napi_disable(&adapter->napi); 634 napi_disable(&adapter->napi);
635 atomic_set(&adapter->irq_sem, 0);
635#endif 636#endif
636 e1000_irq_disable(adapter); 637 e1000_irq_disable(adapter);
637 638
@@ -3924,27 +3925,24 @@ e1000_clean(struct napi_struct *napi, int budget)
3924 /* Must NOT use netdev_priv macro here. */ 3925 /* Must NOT use netdev_priv macro here. */
3925 adapter = poll_dev->priv; 3926 adapter = poll_dev->priv;
3926 3927
3927 /* Keep link state information with original netdev */
3928 if (!netif_carrier_ok(poll_dev))
3929 goto quit_polling;
3930
3931 /* e1000_clean is called per-cpu. This lock protects 3928 /* e1000_clean is called per-cpu. This lock protects
3932 * tx_ring[0] from being cleaned by multiple cpus 3929 * tx_ring[0] from being cleaned by multiple cpus
3933 * simultaneously. A failure obtaining the lock means 3930 * simultaneously. A failure obtaining the lock means
3934 * tx_ring[0] is currently being cleaned anyway. */ 3931 * tx_ring[0] is currently being cleaned anyway. */
3935 if (spin_trylock(&adapter->tx_queue_lock)) { 3932 if (spin_trylock(&adapter->tx_queue_lock)) {
3936 tx_cleaned = e1000_clean_tx_irq(adapter, 3933 tx_cleaned = e1000_clean_tx_irq(adapter,
3937 &adapter->tx_ring[0]); 3934 &adapter->tx_ring[0]);
3938 spin_unlock(&adapter->tx_queue_lock); 3935 spin_unlock(&adapter->tx_queue_lock);
3939 } 3936 }
3940 3937
3941 adapter->clean_rx(adapter, &adapter->rx_ring[0], 3938 adapter->clean_rx(adapter, &adapter->rx_ring[0],
3942 &work_done, budget); 3939 &work_done, budget);
3943 3940
3944 /* If no Tx and not enough Rx work done, exit the polling mode */ 3941 if (tx_cleaned)
3945 if ((!tx_cleaned && (work_done == 0)) || 3942 work_done = budget;
3946 !netif_running(poll_dev)) { 3943
3947quit_polling: 3944 /* If budget not fully consumed, exit the polling mode */
3945 if (work_done < budget) {
3948 if (likely(adapter->itr_setting & 3)) 3946 if (likely(adapter->itr_setting & 3))
3949 e1000_set_itr(adapter); 3947 e1000_set_itr(adapter);
3950 netif_rx_complete(poll_dev, napi); 3948 netif_rx_complete(poll_dev, napi);
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4fd2e23720b6..9cc5a6b01bc1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1389,10 +1389,6 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1389 /* Must NOT use netdev_priv macro here. */ 1389 /* Must NOT use netdev_priv macro here. */
1390 adapter = poll_dev->priv; 1390 adapter = poll_dev->priv;
1391 1391
1392 /* Keep link state information with original netdev */
1393 if (!netif_carrier_ok(poll_dev))
1394 goto quit_polling;
1395
1396 /* e1000_clean is called per-cpu. This lock protects 1392 /* e1000_clean is called per-cpu. This lock protects
1397 * tx_ring from being cleaned by multiple cpus 1393 * tx_ring from being cleaned by multiple cpus
1398 * simultaneously. A failure obtaining the lock means 1394 * simultaneously. A failure obtaining the lock means
@@ -1404,10 +1400,11 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1404 1400
1405 adapter->clean_rx(adapter, &work_done, budget); 1401 adapter->clean_rx(adapter, &work_done, budget);
1406 1402
1407 /* If no Tx and not enough Rx work done, exit the polling mode */ 1403 if (tx_cleaned)
1408 if ((!tx_cleaned && (work_done < budget)) || 1404 work_done = budget;
1409 !netif_running(poll_dev)) { 1405
1410quit_polling: 1406 /* If budget not fully consumed, exit the polling mode */
1407 if (work_done < budget) {
1411 if (adapter->itr_setting & 3) 1408 if (adapter->itr_setting & 3)
1412 e1000_set_itr(adapter); 1409 e1000_set_itr(adapter);
1413 netif_rx_complete(poll_dev, napi); 1410 netif_rx_complete(poll_dev, napi);
@@ -2186,6 +2183,7 @@ void e1000e_down(struct e1000_adapter *adapter)
2186 msleep(10); 2183 msleep(10);
2187 2184
2188 napi_disable(&adapter->napi); 2185 napi_disable(&adapter->napi);
2186 atomic_set(&adapter->irq_sem, 0);
2189 e1000_irq_disable(adapter); 2187 e1000_irq_disable(adapter);
2190 2188
2191 del_timer_sync(&adapter->watchdog_timer); 2189 del_timer_sync(&adapter->watchdog_timer);
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index ecdd3fc8d70c..0b365b8d947b 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -1273,7 +1273,7 @@ rx_action:
1273 1273
1274 epic_rx_err(dev, ep); 1274 epic_rx_err(dev, ep);
1275 1275
1276 if (netif_running(dev) && (work_done < budget)) { 1276 if (work_done < budget) {
1277 unsigned long flags; 1277 unsigned long flags;
1278 int more; 1278 int more;
1279 1279
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c
index 8d2904fa5789..ab9637ab3a8d 100644
--- a/drivers/net/fec_8xx/fec_main.c
+++ b/drivers/net/fec_8xx/fec_main.c
@@ -476,11 +476,6 @@ static int fec_enet_rx_common(struct fec_enet_private *ep,
476 __u16 pkt_len, sc; 476 __u16 pkt_len, sc;
477 int curidx; 477 int curidx;
478 478
479 if (fpi->use_napi) {
480 if (!netif_running(dev))
481 return 0;
482 }
483
484 /* 479 /*
485 * First, grab all of the stats for the incoming packet. 480 * First, grab all of the stats for the incoming packet.
486 * These get messed up if we get called due to a busy condition. 481 * These get messed up if we get called due to a busy condition.
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 79f7eade4773..f91ee700e605 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev)
568 struct mpc52xx_fec __iomem *fec = priv->fec; 568 struct mpc52xx_fec __iomem *fec = priv->fec;
569 569
570 out_be32(&fec->mib_control, FEC_MIB_DISABLE); 570 out_be32(&fec->mib_control, FEC_MIB_DISABLE);
571 memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 - 571 memset_io(&fec->rmon_t_drop, 0,
572 (__force u32)&fec->rmon_t_drop); 572 offsetof(struct mpc52xx_fec, reserved10) -
573 offsetof(struct mpc52xx_fec, rmon_t_drop));
573 out_be32(&fec->mib_control, 0); 574 out_be32(&fec->mib_control, 0);
574 575
575 memset(&dev->stats, 0, sizeof(dev->stats)); 576 memset(&dev->stats, 0, sizeof(dev->stats));
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index a96583cceb5e..f84c752997a4 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5199,10 +5199,6 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5199 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff; 5199 dev->dev_addr[3] = (np->orig_mac[0] >> 16) & 0xff;
5200 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; 5200 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
5201 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; 5201 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
5202 /* set permanent address to be correct aswell */
5203 np->orig_mac[0] = (dev->dev_addr[0] << 0) + (dev->dev_addr[1] << 8) +
5204 (dev->dev_addr[2] << 16) + (dev->dev_addr[3] << 24);
5205 np->orig_mac[1] = (dev->dev_addr[4] << 0) + (dev->dev_addr[5] << 8);
5206 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); 5202 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
5207 } 5203 }
5208 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 5204 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
@@ -5414,6 +5410,8 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
5414 */ 5410 */
5415 writel(np->orig_mac[0], base + NvRegMacAddrA); 5411 writel(np->orig_mac[0], base + NvRegMacAddrA);
5416 writel(np->orig_mac[1], base + NvRegMacAddrB); 5412 writel(np->orig_mac[1], base + NvRegMacAddrB);
5413 writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV,
5414 base + NvRegTransmitPoll);
5417 5415
5418 /* free all structures */ 5416 /* free all structures */
5419 free_rings(dev); 5417 free_rings(dev);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index f2a4d399a6e5..c83bd6560088 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -96,9 +96,6 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
96 u16 pkt_len, sc; 96 u16 pkt_len, sc;
97 int curidx; 97 int curidx;
98 98
99 if (!netif_running(dev))
100 return 0;
101
102 /* 99 /*
103 * First, grab all of the stats for the incoming packet. 100 * First, grab all of the stats for the incoming packet.
104 * These get messed up if we get called due to a busy condition. 101 * These get messed up if we get called due to a busy condition.
@@ -897,14 +894,21 @@ static void fs_get_regs(struct net_device *dev, struct ethtool_regs *regs,
897static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 894static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
898{ 895{
899 struct fs_enet_private *fep = netdev_priv(dev); 896 struct fs_enet_private *fep = netdev_priv(dev);
897
898 if (!fep->phydev)
899 return -ENODEV;
900
900 return phy_ethtool_gset(fep->phydev, cmd); 901 return phy_ethtool_gset(fep->phydev, cmd);
901} 902}
902 903
903static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 904static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
904{ 905{
905 struct fs_enet_private *fep = netdev_priv(dev); 906 struct fs_enet_private *fep = netdev_priv(dev);
906 phy_ethtool_sset(fep->phydev, cmd); 907
907 return 0; 908 if (!fep->phydev)
909 return -ENODEV;
910
911 return phy_ethtool_sset(fep->phydev, cmd);
908} 912}
909 913
910static int fs_nway_reset(struct net_device *dev) 914static int fs_nway_reset(struct net_device *dev)
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index dbd23bb65d1e..50f0c17451b1 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -857,21 +857,14 @@ static void init_tfdlist(struct net_device *dev)
857static void ipg_nic_txfree(struct net_device *dev) 857static void ipg_nic_txfree(struct net_device *dev)
858{ 858{
859 struct ipg_nic_private *sp = netdev_priv(dev); 859 struct ipg_nic_private *sp = netdev_priv(dev);
860 void __iomem *ioaddr = sp->ioaddr; 860 unsigned int released, pending, dirty;
861 unsigned int curr;
862 u64 txd_map;
863 unsigned int released, pending;
864
865 txd_map = (u64)sp->txd_map;
866 curr = ipg_r32(TFD_LIST_PTR_0) -
867 do_div(txd_map, sizeof(struct ipg_tx)) - 1;
868 861
869 IPG_DEBUG_MSG("_nic_txfree\n"); 862 IPG_DEBUG_MSG("_nic_txfree\n");
870 863
871 pending = sp->tx_current - sp->tx_dirty; 864 pending = sp->tx_current - sp->tx_dirty;
865 dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
872 866
873 for (released = 0; released < pending; released++) { 867 for (released = 0; released < pending; released++) {
874 unsigned int dirty = sp->tx_dirty % IPG_TFDLIST_LENGTH;
875 struct sk_buff *skb = sp->TxBuff[dirty]; 868 struct sk_buff *skb = sp->TxBuff[dirty];
876 struct ipg_tx *txfd = sp->txd + dirty; 869 struct ipg_tx *txfd = sp->txd + dirty;
877 870
@@ -882,11 +875,8 @@ static void ipg_nic_txfree(struct net_device *dev)
882 * If the TFDDone bit is set, free the associated 875 * If the TFDDone bit is set, free the associated
883 * buffer. 876 * buffer.
884 */ 877 */
885 if (dirty == curr) 878 if (!(txfd->tfc & cpu_to_le64(IPG_TFC_TFDDONE)))
886 break; 879 break;
887
888 /* Setup TFDDONE for compatible issue. */
889 txfd->tfc |= cpu_to_le64(IPG_TFC_TFDDONE);
890 880
891 /* Free the transmit buffer. */ 881 /* Free the transmit buffer. */
892 if (skb) { 882 if (skb) {
@@ -898,6 +888,7 @@ static void ipg_nic_txfree(struct net_device *dev)
898 888
899 sp->TxBuff[dirty] = NULL; 889 sp->TxBuff[dirty] = NULL;
900 } 890 }
891 dirty = (dirty + 1) % IPG_TFDLIST_LENGTH;
901 } 892 }
902 893
903 sp->tx_dirty += released; 894 sp->tx_dirty += released;
@@ -1630,6 +1621,8 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1630#ifdef JUMBO_FRAME 1621#ifdef JUMBO_FRAME
1631 ipg_nic_rxrestore(dev); 1622 ipg_nic_rxrestore(dev);
1632#endif 1623#endif
1624 spin_lock(&sp->lock);
1625
1633 /* Get interrupt source information, and acknowledge 1626 /* Get interrupt source information, and acknowledge
1634 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly, 1627 * some (i.e. TxDMAComplete, RxDMAComplete, RxEarly,
1635 * IntRequested, MacControlFrame, LinkEvent) interrupts 1628 * IntRequested, MacControlFrame, LinkEvent) interrupts
@@ -1647,9 +1640,7 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1647 handled = 1; 1640 handled = 1;
1648 1641
1649 if (unlikely(!netif_running(dev))) 1642 if (unlikely(!netif_running(dev)))
1650 goto out; 1643 goto out_unlock;
1651
1652 spin_lock(&sp->lock);
1653 1644
1654 /* If RFDListEnd interrupt, restore all used RFDs. */ 1645 /* If RFDListEnd interrupt, restore all used RFDs. */
1655 if (status & IPG_IS_RFD_LIST_END) { 1646 if (status & IPG_IS_RFD_LIST_END) {
@@ -1733,9 +1724,9 @@ out_enable:
1733 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE | 1724 ipg_w16(IPG_IE_TX_DMA_COMPLETE | IPG_IE_RX_DMA_COMPLETE |
1734 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE | 1725 IPG_IE_HOST_ERROR | IPG_IE_INT_REQUESTED | IPG_IE_TX_COMPLETE |
1735 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE); 1726 IPG_IE_LINK_EVENT | IPG_IE_UPDATE_STATS, INT_ENABLE);
1736 1727out_unlock:
1737 spin_unlock(&sp->lock); 1728 spin_unlock(&sp->lock);
1738out: 1729
1739 return IRQ_RETVAL(handled); 1730 return IRQ_RETVAL(handled);
1740} 1731}
1741 1732
@@ -1943,10 +1934,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
1943 */ 1934 */
1944 if (sp->tenmbpsmode) 1935 if (sp->tenmbpsmode)
1945 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE); 1936 txfd->tfc |= cpu_to_le64(IPG_TFC_TXINDICATE);
1946 else if (!((sp->tx_current - sp->tx_dirty + 1) > 1937 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1947 IPG_FRAMESBETWEENTXDMACOMPLETES)) {
1948 txfd->tfc |= cpu_to_le64(IPG_TFC_TXDMAINDICATE);
1949 }
1950 /* Based on compilation option, determine if FCS is to be 1938 /* Based on compilation option, determine if FCS is to be
1951 * appended to transmit frame by IPG. 1939 * appended to transmit frame by IPG.
1952 */ 1940 */
@@ -2003,7 +1991,7 @@ static int ipg_nic_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
2003 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL); 1991 ipg_w32(IPG_DC_TX_DMA_POLL_NOW, DMA_CTRL);
2004 1992
2005 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH)) 1993 if (sp->tx_current == (sp->tx_dirty + IPG_TFDLIST_LENGTH))
2006 netif_wake_queue(dev); 1994 netif_stop_queue(dev);
2007 1995
2008 spin_unlock_irqrestore(&sp->lock, flags); 1996 spin_unlock_irqrestore(&sp->lock, flags);
2009 1997
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index bf9085fe035a..4f63839051b0 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -296,6 +296,11 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
296{ 296{
297 struct net_device *netdev = adapter->netdev; 297 struct net_device *netdev = adapter->netdev;
298 298
299#ifdef CONFIG_IXGB_NAPI
300 napi_disable(&adapter->napi);
301 atomic_set(&adapter->irq_sem, 0);
302#endif
303
299 ixgb_irq_disable(adapter); 304 ixgb_irq_disable(adapter);
300 free_irq(adapter->pdev->irq, netdev); 305 free_irq(adapter->pdev->irq, netdev);
301 306
@@ -304,9 +309,7 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
304 309
305 if(kill_watchdog) 310 if(kill_watchdog)
306 del_timer_sync(&adapter->watchdog_timer); 311 del_timer_sync(&adapter->watchdog_timer);
307#ifdef CONFIG_IXGB_NAPI 312
308 napi_disable(&adapter->napi);
309#endif
310 adapter->link_speed = 0; 313 adapter->link_speed = 0;
311 adapter->link_duplex = 0; 314 adapter->link_duplex = 0;
312 netif_carrier_off(netdev); 315 netif_carrier_off(netdev);
@@ -1787,14 +1790,13 @@ ixgb_clean(struct napi_struct *napi, int budget)
1787{ 1790{
1788 struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi); 1791 struct ixgb_adapter *adapter = container_of(napi, struct ixgb_adapter, napi);
1789 struct net_device *netdev = adapter->netdev; 1792 struct net_device *netdev = adapter->netdev;
1790 int tx_cleaned;
1791 int work_done = 0; 1793 int work_done = 0;
1792 1794
1793 tx_cleaned = ixgb_clean_tx_irq(adapter); 1795 ixgb_clean_tx_irq(adapter);
1794 ixgb_clean_rx_irq(adapter, &work_done, budget); 1796 ixgb_clean_rx_irq(adapter, &work_done, budget);
1795 1797
1796 /* if no Tx and not enough Rx work done, exit the polling mode */ 1798 /* If budget not fully consumed, exit the polling mode */
1797 if((!tx_cleaned && (work_done == 0)) || !netif_running(netdev)) { 1799 if (work_done < budget) {
1798 netif_rx_complete(netdev, napi); 1800 netif_rx_complete(netdev, napi);
1799 ixgb_irq_enable(adapter); 1801 ixgb_irq_enable(adapter);
1800 } 1802 }
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 00bc525c6560..a4265bc1cebb 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1409,9 +1409,11 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
1409 IXGBE_WRITE_FLUSH(&adapter->hw); 1409 IXGBE_WRITE_FLUSH(&adapter->hw);
1410 msleep(10); 1410 msleep(10);
1411 1411
1412 napi_disable(&adapter->napi);
1413 atomic_set(&adapter->irq_sem, 0);
1414
1412 ixgbe_irq_disable(adapter); 1415 ixgbe_irq_disable(adapter);
1413 1416
1414 napi_disable(&adapter->napi);
1415 del_timer_sync(&adapter->watchdog_timer); 1417 del_timer_sync(&adapter->watchdog_timer);
1416 1418
1417 netif_carrier_off(netdev); 1419 netif_carrier_off(netdev);
@@ -1470,19 +1472,16 @@ static int ixgbe_clean(struct napi_struct *napi, int budget)
1470 struct net_device *netdev = adapter->netdev; 1472 struct net_device *netdev = adapter->netdev;
1471 int tx_cleaned = 0, work_done = 0; 1473 int tx_cleaned = 0, work_done = 0;
1472 1474
1473 /* Keep link state information with original netdev */
1474 if (!netif_carrier_ok(adapter->netdev))
1475 goto quit_polling;
1476
1477 /* In non-MSIX case, there is no multi-Tx/Rx queue */ 1475 /* In non-MSIX case, there is no multi-Tx/Rx queue */
1478 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring); 1476 tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
1479 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done, 1477 ixgbe_clean_rx_irq(adapter, &adapter->rx_ring[0], &work_done,
1480 budget); 1478 budget);
1481 1479
1482 /* If no Tx and not enough Rx work done, exit the polling mode */ 1480 if (tx_cleaned)
1483 if ((!tx_cleaned && (work_done < budget)) || 1481 work_done = budget;
1484 !netif_running(adapter->netdev)) { 1482
1485quit_polling: 1483 /* If budget not fully consumed, exit the polling mode */
1484 if (work_done < budget) {
1486 netif_rx_complete(netdev, napi); 1485 netif_rx_complete(netdev, napi);
1487 ixgbe_irq_enable(adapter); 1486 ixgbe_irq_enable(adapter);
1488 } 1487 }
diff --git a/drivers/net/ixp2000/ixpdev.c b/drivers/net/ixp2000/ixpdev.c
index 6c0dd49149d0..484cb2ba717f 100644
--- a/drivers/net/ixp2000/ixpdev.c
+++ b/drivers/net/ixp2000/ixpdev.c
@@ -135,8 +135,6 @@ static int ixpdev_poll(struct napi_struct *napi, int budget)
135 struct net_device *dev = ip->dev; 135 struct net_device *dev = ip->dev;
136 int rx; 136 int rx;
137 137
138 /* @@@ Have to stop polling when nds[0] is administratively
139 * downed while we are polling. */
140 rx = 0; 138 rx = 0;
141 do { 139 do {
142 ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff); 140 ixp2000_reg_write(IXP2000_IRQ_THD_RAW_STATUS_A_0, 0x00ff);
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 662b8d16803c..fa147cd5d68c 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -242,7 +242,7 @@ static void loopback_setup(struct net_device *dev)
242 | NETIF_F_NO_CSUM 242 | NETIF_F_NO_CSUM
243 | NETIF_F_HIGHDMA 243 | NETIF_F_HIGHDMA
244 | NETIF_F_LLTX 244 | NETIF_F_LLTX
245 | NETIF_F_NETNS_LOCAL, 245 | NETIF_F_NETNS_LOCAL;
246 dev->ethtool_ops = &loopback_ethtool_ops; 246 dev->ethtool_ops = &loopback_ethtool_ops;
247 dev->header_ops = &eth_header_ops; 247 dev->header_ops = &eth_header_ops;
248 dev->init = loopback_dev_init; 248 dev->init = loopback_dev_init;
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7be4850..e10528ed9081 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp)
307 (unsigned long)status); 307 (unsigned long)status);
308 308
309 if (status & MACB_BIT(UND)) { 309 if (status & MACB_BIT(UND)) {
310 int i;
310 printk(KERN_ERR "%s: TX underrun, resetting buffers\n", 311 printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
311 bp->dev->name); 312 bp->dev->name);
313
314 head = bp->tx_head;
315
316 /*Mark all the buffer as used to avoid sending a lost buffer*/
317 for (i = 0; i < TX_RING_SIZE; i++)
318 bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
319
320 /* free transmit buffer in upper layer*/
321 for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
322 struct ring_info *rp = &bp->tx_skb[tail];
323 struct sk_buff *skb = rp->skb;
324
325 BUG_ON(skb == NULL);
326
327 rmb();
328
329 dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
330 DMA_TO_DEVICE);
331 rp->skb = NULL;
332 dev_kfree_skb_irq(skb);
333 }
334
312 bp->tx_head = bp->tx_tail = 0; 335 bp->tx_head = bp->tx_tail = 0;
313 } 336 }
314 337
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 2e4bcd5654c4..e8dc2f44fec9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -384,6 +384,13 @@ static int macvlan_newlink(struct net_device *dev,
384 if (lowerdev == NULL) 384 if (lowerdev == NULL)
385 return -ENODEV; 385 return -ENODEV;
386 386
387 /* Don't allow macvlans on top of other macvlans - its not really
388 * wrong, but lockdep can't handle it and its not useful for anything
389 * you couldn't do directly on top of the real device.
390 */
391 if (lowerdev->rtnl_link_ops == dev->rtnl_link_ops)
392 return -ENODEV;
393
387 if (!tb[IFLA_MTU]) 394 if (!tb[IFLA_MTU])
388 dev->mtu = lowerdev->mtu; 395 dev->mtu = lowerdev->mtu;
389 else if (dev->mtu > lowerdev->mtu) 396 else if (dev->mtu > lowerdev->mtu)
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index 0c89b028a80c..cdaa8fc21809 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -95,11 +95,14 @@ static inline void load_eaddr(struct net_device *dev)
95{ 95{
96 int i; 96 int i;
97 DECLARE_MAC_BUF(mac); 97 DECLARE_MAC_BUF(mac);
98 u64 macaddr;
98 99
99 for (i = 0; i < 6; i++)
100 dev->dev_addr[i] = o2meth_eaddr[i];
101 DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr)); 100 DPRINTK("Loading MAC Address: %s\n", print_mac(mac, dev->dev_addr));
102 mace->eth.mac_addr = (*(unsigned long*)o2meth_eaddr) >> 16; 101 macaddr = 0;
102 for (i = 0; i < 6; i++)
103 macaddr |= dev->dev_addr[i] << ((5 - i) * 8);
104
105 mace->eth.mac_addr = macaddr;
103} 106}
104 107
105/* 108/*
@@ -794,6 +797,7 @@ static int __init meth_probe(struct platform_device *pdev)
794#endif 797#endif
795 dev->irq = MACE_ETHERNET_IRQ; 798 dev->irq = MACE_ETHERNET_IRQ;
796 dev->base_addr = (unsigned long)&mace->eth; 799 dev->base_addr = (unsigned long)&mace->eth;
800 memcpy(dev->dev_addr, o2meth_eaddr, 6);
797 801
798 priv = netdev_priv(dev); 802 priv = netdev_priv(dev);
799 spin_lock_init(&priv->meth_lock); 803 spin_lock_init(&priv->meth_lock);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 8def8657251f..c90958f6d3fe 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1239,7 +1239,7 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
1239 /* process as many rx events as NAPI will allow */ 1239 /* process as many rx events as NAPI will allow */
1240 work_done = myri10ge_clean_rx_done(mgp, budget); 1240 work_done = myri10ge_clean_rx_done(mgp, budget);
1241 1241
1242 if (work_done < budget || !netif_running(netdev)) { 1242 if (work_done < budget) {
1243 netif_rx_complete(netdev, napi); 1243 netif_rx_complete(netdev, napi);
1244 put_be32(htonl(3), mgp->irq_claim); 1244 put_be32(htonl(3), mgp->irq_claim);
1245 } 1245 }
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 87cde062fd63..c329a4f5840c 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2266,7 +2266,7 @@ static int natsemi_poll(struct napi_struct *napi, int budget)
2266 /* Reenable interrupts providing nothing is trying to shut 2266 /* Reenable interrupts providing nothing is trying to shut
2267 * the chip down. */ 2267 * the chip down. */
2268 spin_lock(&np->lock); 2268 spin_lock(&np->lock);
2269 if (!np->hands_off && netif_running(dev)) 2269 if (!np->hands_off)
2270 natsemi_irq_enable(dev); 2270 natsemi_irq_enable(dev);
2271 spin_unlock(&np->lock); 2271 spin_unlock(&np->lock);
2272 2272
diff --git a/drivers/net/netx-eth.c b/drivers/net/netx-eth.c
index 5267e031daa0..78d34af13a1c 100644
--- a/drivers/net/netx-eth.c
+++ b/drivers/net/netx-eth.c
@@ -169,8 +169,8 @@ static void netx_eth_receive(struct net_device *ndev)
169 ndev->last_rx = jiffies; 169 ndev->last_rx = jiffies;
170 skb->protocol = eth_type_trans(skb, ndev); 170 skb->protocol = eth_type_trans(skb, ndev);
171 netif_rx(skb); 171 netif_rx(skb);
172 dev->stats.rx_packets++; 172 ndev->stats.rx_packets++;
173 dev->stats.rx_bytes += len; 173 ndev->stats.rx_bytes += len;
174} 174}
175 175
176static irqreturn_t 176static irqreturn_t
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index fbc2553275dc..a8f63c47b3cd 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -65,8 +65,8 @@
65 65
66#define _NETXEN_NIC_LINUX_MAJOR 3 66#define _NETXEN_NIC_LINUX_MAJOR 3
67#define _NETXEN_NIC_LINUX_MINOR 4 67#define _NETXEN_NIC_LINUX_MINOR 4
68#define _NETXEN_NIC_LINUX_SUBVERSION 2 68#define _NETXEN_NIC_LINUX_SUBVERSION 18
69#define NETXEN_NIC_LINUX_VERSIONID "3.4.2" 69#define NETXEN_NIC_LINUX_VERSIONID "3.4.18"
70 70
71#define NETXEN_NUM_FLASH_SECTORS (64) 71#define NETXEN_NUM_FLASH_SECTORS (64)
72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) 72#define NETXEN_FLASH_SECTOR_SIZE (64 * 1024)
@@ -309,23 +309,26 @@ struct netxen_ring_ctx {
309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0)) 309 ((cmd_desc)->port_ctxid |= ((var) & 0xF0))
310 310
311#define netxen_set_cmd_desc_flags(cmd_desc, val) \ 311#define netxen_set_cmd_desc_flags(cmd_desc, val) \
312 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ 312 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
313 (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) 313 ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f)
314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \ 314#define netxen_set_cmd_desc_opcode(cmd_desc, val) \
315 ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ 315 (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \
316 (cmd_desc)->flags_opcode |= cpu_to_le16(((val & 0x3f)<<7))) 316 ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7)
317 317
318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ 318#define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \
319 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ 319 (cmd_desc)->num_of_buffers_total_length = \
320 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) 320 ((cmd_desc)->num_of_buffers_total_length & \
321 ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff)
321#define netxen_set_cmd_desc_totallength(cmd_desc, val) \ 322#define netxen_set_cmd_desc_totallength(cmd_desc, val) \
322 ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xffffff00), \ 323 (cmd_desc)->num_of_buffers_total_length = \
323 (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 8)) 324 ((cmd_desc)->num_of_buffers_total_length & \
325 ~cpu_to_le32((u32)0xffffff << 8)) | \
326 cpu_to_le32(((val) & 0xffffff) << 8)
324 327
325#define netxen_get_cmd_desc_opcode(cmd_desc) \ 328#define netxen_get_cmd_desc_opcode(cmd_desc) \
326 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) 329 ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f)
327#define netxen_get_cmd_desc_totallength(cmd_desc) \ 330#define netxen_get_cmd_desc_totallength(cmd_desc) \
328 (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) 331 ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff)
329 332
330struct cmd_desc_type0 { 333struct cmd_desc_type0 {
331 u8 tcp_hdr_offset; /* For LSO only */ 334 u8 tcp_hdr_offset; /* For LSO only */
@@ -412,29 +415,29 @@ struct rcv_desc {
412#define netxen_get_sts_desc_lro_last_frag(status_desc) \ 415#define netxen_get_sts_desc_lro_last_frag(status_desc) \
413 (((status_desc)->lro & 0x80) >> 7) 416 (((status_desc)->lro & 0x80) >> 7)
414 417
415#define netxen_get_sts_port(status_desc) \ 418#define netxen_get_sts_port(sts_data) \
416 (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) 419 ((sts_data) & 0x0F)
417#define netxen_get_sts_status(status_desc) \ 420#define netxen_get_sts_status(sts_data) \
418 ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) 421 (((sts_data) >> 4) & 0x0F)
419#define netxen_get_sts_type(status_desc) \ 422#define netxen_get_sts_type(sts_data) \
420 ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) 423 (((sts_data) >> 8) & 0x0F)
421#define netxen_get_sts_totallength(status_desc) \ 424#define netxen_get_sts_totallength(sts_data) \
422 ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) 425 (((sts_data) >> 12) & 0xFFFF)
423#define netxen_get_sts_refhandle(status_desc) \ 426#define netxen_get_sts_refhandle(sts_data) \
424 ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) 427 (((sts_data) >> 28) & 0xFFFF)
425#define netxen_get_sts_prot(status_desc) \ 428#define netxen_get_sts_prot(sts_data) \
426 ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) 429 (((sts_data) >> 44) & 0x0F)
430#define netxen_get_sts_opcode(sts_data) \
431 (((sts_data) >> 58) & 0x03F)
432
427#define netxen_get_sts_owner(status_desc) \ 433#define netxen_get_sts_owner(status_desc) \
428 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) 434 ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03)
429#define netxen_get_sts_opcode(status_desc) \ 435#define netxen_set_sts_owner(status_desc, val) { \
430 ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) 436 (status_desc)->status_desc_data = \
431 437 ((status_desc)->status_desc_data & \
432#define netxen_clear_sts_owner(status_desc) \ 438 ~cpu_to_le64(0x3ULL << 56)) | \
433 ((status_desc)->status_desc_data &= \ 439 cpu_to_le64((u64)((val) & 0x3) << 56); \
434 ~cpu_to_le64(((unsigned long long)3) << 56 )) 440}
435#define netxen_set_sts_owner(status_desc, val) \
436 ((status_desc)->status_desc_data |= \
437 cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 ))
438 441
439struct status_desc { 442struct status_desc {
440 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length 443 /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 37589265297e..485ff9398910 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -1070,16 +1070,17 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1070{ 1070{
1071 struct pci_dev *pdev = adapter->pdev; 1071 struct pci_dev *pdev = adapter->pdev;
1072 struct net_device *netdev = adapter->netdev; 1072 struct net_device *netdev = adapter->netdev;
1073 int index = netxen_get_sts_refhandle(desc); 1073 u64 sts_data = le64_to_cpu(desc->status_desc_data);
1074 int index = netxen_get_sts_refhandle(sts_data);
1074 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]); 1075 struct netxen_recv_context *recv_ctx = &(adapter->recv_ctx[ctxid]);
1075 struct netxen_rx_buffer *buffer; 1076 struct netxen_rx_buffer *buffer;
1076 struct sk_buff *skb; 1077 struct sk_buff *skb;
1077 u32 length = netxen_get_sts_totallength(desc); 1078 u32 length = netxen_get_sts_totallength(sts_data);
1078 u32 desc_ctx; 1079 u32 desc_ctx;
1079 struct netxen_rcv_desc_ctx *rcv_desc; 1080 struct netxen_rcv_desc_ctx *rcv_desc;
1080 int ret; 1081 int ret;
1081 1082
1082 desc_ctx = netxen_get_sts_type(desc); 1083 desc_ctx = netxen_get_sts_type(sts_data);
1083 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) { 1084 if (unlikely(desc_ctx >= NUM_RCV_DESC_RINGS)) {
1084 printk("%s: %s Bad Rcv descriptor ring\n", 1085 printk("%s: %s Bad Rcv descriptor ring\n",
1085 netxen_nic_driver_name, netdev->name); 1086 netxen_nic_driver_name, netdev->name);
@@ -1119,7 +1120,7 @@ netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
1119 skb = (struct sk_buff *)buffer->skb; 1120 skb = (struct sk_buff *)buffer->skb;
1120 1121
1121 if (likely(adapter->rx_csum && 1122 if (likely(adapter->rx_csum &&
1122 netxen_get_sts_status(desc) == STATUS_CKSUM_OK)) { 1123 netxen_get_sts_status(sts_data) == STATUS_CKSUM_OK)) {
1123 adapter->stats.csummed++; 1124 adapter->stats.csummed++;
1124 skb->ip_summed = CHECKSUM_UNNECESSARY; 1125 skb->ip_summed = CHECKSUM_UNNECESSARY;
1125 } else 1126 } else
@@ -1209,7 +1210,6 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
1209 break; 1210 break;
1210 } 1211 }
1211 netxen_process_rcv(adapter, ctxid, desc); 1212 netxen_process_rcv(adapter, ctxid, desc);
1212 netxen_clear_sts_owner(desc);
1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); 1213 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM);
1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); 1214 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
1215 count++; 1215 count++;
@@ -1248,7 +1248,6 @@ int netxen_process_cmd_ring(unsigned long data)
1248 struct pci_dev *pdev; 1248 struct pci_dev *pdev;
1249 struct netxen_skb_frag *frag; 1249 struct netxen_skb_frag *frag;
1250 u32 i; 1250 u32 i;
1251 struct sk_buff *skb = NULL;
1252 int done; 1251 int done;
1253 1252
1254 spin_lock(&adapter->tx_lock); 1253 spin_lock(&adapter->tx_lock);
@@ -1278,9 +1277,8 @@ int netxen_process_cmd_ring(unsigned long data)
1278 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) { 1277 while ((last_consumer != consumer) && (count1 < MAX_STATUS_HANDLE)) {
1279 buffer = &adapter->cmd_buf_arr[last_consumer]; 1278 buffer = &adapter->cmd_buf_arr[last_consumer];
1280 pdev = adapter->pdev; 1279 pdev = adapter->pdev;
1281 frag = &buffer->frag_array[0]; 1280 if (buffer->skb) {
1282 skb = buffer->skb; 1281 frag = &buffer->frag_array[0];
1283 if (skb && (cmpxchg(&buffer->skb, skb, 0) == skb)) {
1284 pci_unmap_single(pdev, frag->dma, frag->length, 1282 pci_unmap_single(pdev, frag->dma, frag->length,
1285 PCI_DMA_TODEVICE); 1283 PCI_DMA_TODEVICE);
1286 frag->dma = 0ULL; 1284 frag->dma = 0ULL;
@@ -1293,8 +1291,8 @@ int netxen_process_cmd_ring(unsigned long data)
1293 } 1291 }
1294 1292
1295 adapter->stats.skbfreed++; 1293 adapter->stats.skbfreed++;
1296 dev_kfree_skb_any(skb); 1294 dev_kfree_skb_any(buffer->skb);
1297 skb = NULL; 1295 buffer->skb = NULL;
1298 } else if (adapter->proc_cmd_buf_counter == 1) { 1296 } else if (adapter->proc_cmd_buf_counter == 1) {
1299 adapter->stats.txnullskb++; 1297 adapter->stats.txnullskb++;
1300 } 1298 }
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index a80f0cd6b528..263b55e36c7a 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -732,11 +732,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
732 732
733 unregister_netdev(netdev); 733 unregister_netdev(netdev);
734 734
735 if (adapter->stop_port)
736 adapter->stop_port(adapter);
737
738 netxen_nic_disable_int(adapter);
739
740 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { 735 if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) {
741 init_firmware_done++; 736 init_firmware_done++;
742 netxen_free_hw_resources(adapter); 737 netxen_free_hw_resources(adapter);
@@ -919,6 +914,9 @@ static int netxen_nic_close(struct net_device *netdev)
919 netif_stop_queue(netdev); 914 netif_stop_queue(netdev);
920 napi_disable(&adapter->napi); 915 napi_disable(&adapter->napi);
921 916
917 if (adapter->stop_port)
918 adapter->stop_port(adapter);
919
922 netxen_nic_disable_int(adapter); 920 netxen_nic_disable_int(adapter);
923 921
924 cmd_buff = adapter->cmd_buf_arr; 922 cmd_buff = adapter->cmd_buf_arr;
@@ -996,28 +994,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
996 return NETDEV_TX_OK; 994 return NETDEV_TX_OK;
997 } 995 }
998 996
999 /*
1000 * Everything is set up. Now, we just need to transmit it out.
1001 * Note that we have to copy the contents of buffer over to
1002 * right place. Later on, this can be optimized out by de-coupling the
1003 * producer index from the buffer index.
1004 */
1005 retry_getting_window:
1006 spin_lock_bh(&adapter->tx_lock);
1007 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1008 spin_unlock_bh(&adapter->tx_lock);
1009 /*
1010 * Yield CPU
1011 */
1012 if (!in_atomic())
1013 schedule();
1014 else {
1015 for (i = 0; i < 20; i++)
1016 cpu_relax(); /*This a nop instr on i386 */
1017 }
1018 goto retry_getting_window;
1019 }
1020 local_producer = adapter->cmd_producer;
1021 /* There 4 fragments per descriptor */ 997 /* There 4 fragments per descriptor */
1022 no_of_desc = (frag_count + 3) >> 2; 998 no_of_desc = (frag_count + 3) >> 2;
1023 if (netdev->features & NETIF_F_TSO) { 999 if (netdev->features & NETIF_F_TSO) {
@@ -1031,16 +1007,19 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1031 } 1007 }
1032 } 1008 }
1033 } 1009 }
1010
1011 spin_lock_bh(&adapter->tx_lock);
1012 if (adapter->total_threads >= MAX_XMIT_PRODUCERS) {
1013 goto out_requeue;
1014 }
1015 local_producer = adapter->cmd_producer;
1034 k = adapter->cmd_producer; 1016 k = adapter->cmd_producer;
1035 max_tx_desc_count = adapter->max_tx_desc_count; 1017 max_tx_desc_count = adapter->max_tx_desc_count;
1036 last_cmd_consumer = adapter->last_cmd_consumer; 1018 last_cmd_consumer = adapter->last_cmd_consumer;
1037 if ((k + no_of_desc) >= 1019 if ((k + no_of_desc) >=
1038 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count : 1020 ((last_cmd_consumer <= k) ? last_cmd_consumer + max_tx_desc_count :
1039 last_cmd_consumer)) { 1021 last_cmd_consumer)) {
1040 netif_stop_queue(netdev); 1022 goto out_requeue;
1041 adapter->flags |= NETXEN_NETDEV_STATUS;
1042 spin_unlock_bh(&adapter->tx_lock);
1043 return NETDEV_TX_BUSY;
1044 } 1023 }
1045 k = get_index_range(k, max_tx_desc_count, no_of_desc); 1024 k = get_index_range(k, max_tx_desc_count, no_of_desc);
1046 adapter->cmd_producer = k; 1025 adapter->cmd_producer = k;
@@ -1093,6 +1072,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1093 adapter->max_tx_desc_count); 1072 adapter->max_tx_desc_count);
1094 hwdesc = &hw->cmd_desc_head[producer]; 1073 hwdesc = &hw->cmd_desc_head[producer];
1095 memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); 1074 memset(hwdesc, 0, sizeof(struct cmd_desc_type0));
1075 pbuf = &adapter->cmd_buf_arr[producer];
1076 pbuf->skb = NULL;
1096 } 1077 }
1097 frag = &skb_shinfo(skb)->frags[i - 1]; 1078 frag = &skb_shinfo(skb)->frags[i - 1];
1098 len = frag->size; 1079 len = frag->size;
@@ -1148,6 +1129,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1148 } 1129 }
1149 /* copy the MAC/IP/TCP headers to the cmd descriptor list */ 1130 /* copy the MAC/IP/TCP headers to the cmd descriptor list */
1150 hwdesc = &hw->cmd_desc_head[producer]; 1131 hwdesc = &hw->cmd_desc_head[producer];
1132 pbuf = &adapter->cmd_buf_arr[producer];
1133 pbuf->skb = NULL;
1151 1134
1152 /* copy the first 64 bytes */ 1135 /* copy the first 64 bytes */
1153 memcpy(((void *)hwdesc) + 2, 1136 memcpy(((void *)hwdesc) + 2,
@@ -1156,6 +1139,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1156 1139
1157 if (more_hdr) { 1140 if (more_hdr) {
1158 hwdesc = &hw->cmd_desc_head[producer]; 1141 hwdesc = &hw->cmd_desc_head[producer];
1142 pbuf = &adapter->cmd_buf_arr[producer];
1143 pbuf->skb = NULL;
1159 /* copy the next 64 bytes - should be enough except 1144 /* copy the next 64 bytes - should be enough except
1160 * for pathological case 1145 * for pathological case
1161 */ 1146 */
@@ -1167,16 +1152,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1167 } 1152 }
1168 } 1153 }
1169 1154
1170 i = netxen_get_cmd_desc_totallength(&hw->cmd_desc_head[saved_producer]);
1171
1172 hw->cmd_desc_head[saved_producer].flags_opcode =
1173 cpu_to_le16(hw->cmd_desc_head[saved_producer].flags_opcode);
1174 hw->cmd_desc_head[saved_producer].num_of_buffers_total_length =
1175 cpu_to_le32(hw->cmd_desc_head[saved_producer].
1176 num_of_buffers_total_length);
1177
1178 spin_lock_bh(&adapter->tx_lock); 1155 spin_lock_bh(&adapter->tx_lock);
1179 adapter->stats.txbytes += i; 1156 adapter->stats.txbytes += skb->len;
1180 1157
1181 /* Code to update the adapter considering how many producer threads 1158 /* Code to update the adapter considering how many producer threads
1182 are currently working */ 1159 are currently working */
@@ -1189,14 +1166,17 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1189 } 1166 }
1190 1167
1191 adapter->stats.xmitfinished++; 1168 adapter->stats.xmitfinished++;
1192 spin_unlock_bh(&adapter->tx_lock);
1193
1194 netdev->trans_start = jiffies; 1169 netdev->trans_start = jiffies;
1195 1170
1196 DPRINTK(INFO, "wrote CMD producer %x to phantom\n", producer); 1171 spin_unlock_bh(&adapter->tx_lock);
1197
1198 DPRINTK(INFO, "Done. Send\n");
1199 return NETDEV_TX_OK; 1172 return NETDEV_TX_OK;
1173
1174out_requeue:
1175 netif_stop_queue(netdev);
1176 adapter->flags |= NETXEN_NETDEV_STATUS;
1177
1178 spin_unlock_bh(&adapter->tx_lock);
1179 return NETDEV_TX_BUSY;
1200} 1180}
1201 1181
1202static void netxen_watchdog(unsigned long v) 1182static void netxen_watchdog(unsigned long v)
@@ -1321,7 +1301,7 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
1321 budget / MAX_RCV_CTX); 1301 budget / MAX_RCV_CTX);
1322 } 1302 }
1323 1303
1324 if (work_done >= budget && netxen_nic_rx_has_work(adapter) != 0) 1304 if (work_done >= budget)
1325 done = 0; 1305 done = 0;
1326 1306
1327 if (netxen_process_cmd_ring((unsigned long)adapter) == 0) 1307 if (netxen_process_cmd_ring((unsigned long)adapter) == 0)
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 5b9e1b300fab..d04ecb77d08c 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -736,12 +736,12 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter)
736 __u32 mac_cfg; 736 __u32 mac_cfg;
737 u32 port = physical_port[adapter->portnum]; 737 u32 port = physical_port[adapter->portnum];
738 738
739 if (port != 0) 739 if (port > NETXEN_NIU_MAX_XG_PORTS)
740 return -EINVAL; 740 return -EINVAL;
741
741 mac_cfg = 0; 742 mac_cfg = 0;
742 netxen_xg_soft_reset(mac_cfg); 743 if (netxen_nic_hw_write_wx(adapter,
743 if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_CONFIG_0, 744 NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), &mac_cfg, 4))
744 &mac_cfg, 4))
745 return -EIO; 745 return -EIO;
746 return 0; 746 return 0;
747} 747}
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index abfc61c3a38c..5f6beabf2d17 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -33,8 +33,8 @@
33 33
34#define DRV_MODULE_NAME "niu" 34#define DRV_MODULE_NAME "niu"
35#define PFX DRV_MODULE_NAME ": " 35#define PFX DRV_MODULE_NAME ": "
36#define DRV_MODULE_VERSION "0.5" 36#define DRV_MODULE_VERSION "0.6"
37#define DRV_MODULE_RELDATE "October 5, 2007" 37#define DRV_MODULE_RELDATE "January 5, 2008"
38 38
39static char version[] __devinitdata = 39static char version[] __devinitdata =
40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 40 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -801,22 +801,90 @@ static int bcm8704_init_user_dev3(struct niu *np)
801 return 0; 801 return 0;
802} 802}
803 803
804static int xcvr_init_10g(struct niu *np) 804static int mrvl88x2011_act_led(struct niu *np, int val)
805{
806 int err;
807
808 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
809 MRVL88X2011_LED_8_TO_11_CTL);
810 if (err < 0)
811 return err;
812
813 err &= ~MRVL88X2011_LED(MRVL88X2011_LED_ACT,MRVL88X2011_LED_CTL_MASK);
814 err |= MRVL88X2011_LED(MRVL88X2011_LED_ACT,val);
815
816 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
817 MRVL88X2011_LED_8_TO_11_CTL, err);
818}
819
820static int mrvl88x2011_led_blink_rate(struct niu *np, int rate)
821{
822 int err;
823
824 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
825 MRVL88X2011_LED_BLINK_CTL);
826 if (err >= 0) {
827 err &= ~MRVL88X2011_LED_BLKRATE_MASK;
828 err |= (rate << 4);
829
830 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV2_ADDR,
831 MRVL88X2011_LED_BLINK_CTL, err);
832 }
833
834 return err;
835}
836
837static int xcvr_init_10g_mrvl88x2011(struct niu *np)
838{
839 int err;
840
841 /* Set LED functions */
842 err = mrvl88x2011_led_blink_rate(np, MRVL88X2011_LED_BLKRATE_134MS);
843 if (err)
844 return err;
845
846 /* led activity */
847 err = mrvl88x2011_act_led(np, MRVL88X2011_LED_CTL_OFF);
848 if (err)
849 return err;
850
851 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
852 MRVL88X2011_GENERAL_CTL);
853 if (err < 0)
854 return err;
855
856 err |= MRVL88X2011_ENA_XFPREFCLK;
857
858 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
859 MRVL88X2011_GENERAL_CTL, err);
860 if (err < 0)
861 return err;
862
863 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
864 MRVL88X2011_PMA_PMD_CTL_1);
865 if (err < 0)
866 return err;
867
868 if (np->link_config.loopback_mode == LOOPBACK_MAC)
869 err |= MRVL88X2011_LOOPBACK;
870 else
871 err &= ~MRVL88X2011_LOOPBACK;
872
873 err = mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
874 MRVL88X2011_PMA_PMD_CTL_1, err);
875 if (err < 0)
876 return err;
877
878 /* Enable PMD */
879 return mdio_write(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
880 MRVL88X2011_10G_PMD_TX_DIS, MRVL88X2011_ENA_PMDTX);
881}
882
883static int xcvr_init_10g_bcm8704(struct niu *np)
805{ 884{
806 struct niu_link_config *lp = &np->link_config; 885 struct niu_link_config *lp = &np->link_config;
807 u16 analog_stat0, tx_alarm_status; 886 u16 analog_stat0, tx_alarm_status;
808 int err; 887 int err;
809 u64 val;
810
811 val = nr64_mac(XMAC_CONFIG);
812 val &= ~XMAC_CONFIG_LED_POLARITY;
813 val |= XMAC_CONFIG_FORCE_LED_ON;
814 nw64_mac(XMAC_CONFIG, val);
815
816 /* XXX shared resource, lock parent XXX */
817 val = nr64(MIF_CONFIG);
818 val |= MIF_CONFIG_INDIRECT_MODE;
819 nw64(MIF_CONFIG, val);
820 888
821 err = bcm8704_reset(np); 889 err = bcm8704_reset(np);
822 if (err) 890 if (err)
@@ -896,6 +964,38 @@ static int xcvr_init_10g(struct niu *np)
896 return 0; 964 return 0;
897} 965}
898 966
967static int xcvr_init_10g(struct niu *np)
968{
969 int phy_id, err;
970 u64 val;
971
972 val = nr64_mac(XMAC_CONFIG);
973 val &= ~XMAC_CONFIG_LED_POLARITY;
974 val |= XMAC_CONFIG_FORCE_LED_ON;
975 nw64_mac(XMAC_CONFIG, val);
976
977 /* XXX shared resource, lock parent XXX */
978 val = nr64(MIF_CONFIG);
979 val |= MIF_CONFIG_INDIRECT_MODE;
980 nw64(MIF_CONFIG, val);
981
982 phy_id = phy_decode(np->parent->port_phy, np->port);
983 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
984
985 /* handle different phy types */
986 switch (phy_id & NIU_PHY_ID_MASK) {
987 case NIU_PHY_ID_MRVL88X2011:
988 err = xcvr_init_10g_mrvl88x2011(np);
989 break;
990
991 default: /* bcom 8704 */
992 err = xcvr_init_10g_bcm8704(np);
993 break;
994 }
995
996 return 0;
997}
998
899static int mii_reset(struct niu *np) 999static int mii_reset(struct niu *np)
900{ 1000{
901 int limit, err; 1001 int limit, err;
@@ -1082,19 +1182,68 @@ static int niu_link_status_common(struct niu *np, int link_up)
1082 return 0; 1182 return 0;
1083} 1183}
1084 1184
1085static int link_status_10g(struct niu *np, int *link_up_p) 1185static int link_status_10g_mrvl(struct niu *np, int *link_up_p)
1086{ 1186{
1087 unsigned long flags; 1187 int err, link_up, pma_status, pcs_status;
1088 int err, link_up;
1089 1188
1090 link_up = 0; 1189 link_up = 0;
1091 1190
1092 spin_lock_irqsave(&np->lock, flags); 1191 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1192 MRVL88X2011_10G_PMD_STATUS_2);
1193 if (err < 0)
1194 goto out;
1093 1195
1094 err = -EINVAL; 1196 /* Check PMA/PMD Register: 1.0001.2 == 1 */
1095 if (np->link_config.loopback_mode != LOOPBACK_DISABLED) 1197 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV1_ADDR,
1198 MRVL88X2011_PMA_PMD_STATUS_1);
1199 if (err < 0)
1200 goto out;
1201
1202 pma_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1203
1204 /* Check PMC Register : 3.0001.2 == 1: read twice */
1205 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1206 MRVL88X2011_PMA_PMD_STATUS_1);
1207 if (err < 0)
1208 goto out;
1209
1210 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV3_ADDR,
1211 MRVL88X2011_PMA_PMD_STATUS_1);
1212 if (err < 0)
1096 goto out; 1213 goto out;
1097 1214
1215 pcs_status = ((err & MRVL88X2011_LNK_STATUS_OK) ? 1 : 0);
1216
1217 /* Check XGXS Register : 4.0018.[0-3,12] */
1218 err = mdio_read(np, np->phy_addr, MRVL88X2011_USER_DEV4_ADDR,
1219 MRVL88X2011_10G_XGXS_LANE_STAT);
1220 if (err < 0)
1221 goto out;
1222
1223 if (err == (PHYXS_XGXS_LANE_STAT_ALINGED | PHYXS_XGXS_LANE_STAT_LANE3 |
1224 PHYXS_XGXS_LANE_STAT_LANE2 | PHYXS_XGXS_LANE_STAT_LANE1 |
1225 PHYXS_XGXS_LANE_STAT_LANE0 | PHYXS_XGXS_LANE_STAT_MAGIC |
1226 0x800))
1227 link_up = (pma_status && pcs_status) ? 1 : 0;
1228
1229 np->link_config.active_speed = SPEED_10000;
1230 np->link_config.active_duplex = DUPLEX_FULL;
1231 err = 0;
1232out:
1233 mrvl88x2011_act_led(np, (link_up ?
1234 MRVL88X2011_LED_CTL_PCS_ACT :
1235 MRVL88X2011_LED_CTL_OFF));
1236
1237 *link_up_p = link_up;
1238 return err;
1239}
1240
1241static int link_status_10g_bcom(struct niu *np, int *link_up_p)
1242{
1243 int err, link_up;
1244
1245 link_up = 0;
1246
1098 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR, 1247 err = mdio_read(np, np->phy_addr, BCM8704_PMA_PMD_DEV_ADDR,
1099 BCM8704_PMD_RCV_SIGDET); 1248 BCM8704_PMD_RCV_SIGDET);
1100 if (err < 0) 1249 if (err < 0)
@@ -1134,14 +1283,43 @@ static int link_status_10g(struct niu *np, int *link_up_p)
1134 err = 0; 1283 err = 0;
1135 1284
1136out: 1285out:
1286 *link_up_p = link_up;
1287 return err;
1288}
1289
1290static int link_status_10g(struct niu *np, int *link_up_p)
1291{
1292 unsigned long flags;
1293 int err = -EINVAL;
1294
1295 spin_lock_irqsave(&np->lock, flags);
1296
1297 if (np->link_config.loopback_mode == LOOPBACK_DISABLED) {
1298 int phy_id;
1299
1300 phy_id = phy_decode(np->parent->port_phy, np->port);
1301 phy_id = np->parent->phy_probe_info.phy_id[phy_id][np->port];
1302
1303 /* handle different phy types */
1304 switch (phy_id & NIU_PHY_ID_MASK) {
1305 case NIU_PHY_ID_MRVL88X2011:
1306 err = link_status_10g_mrvl(np, link_up_p);
1307 break;
1308
1309 default: /* bcom 8704 */
1310 err = link_status_10g_bcom(np, link_up_p);
1311 break;
1312 }
1313 }
1314
1137 spin_unlock_irqrestore(&np->lock, flags); 1315 spin_unlock_irqrestore(&np->lock, flags);
1138 1316
1139 *link_up_p = link_up;
1140 return err; 1317 return err;
1141} 1318}
1142 1319
1143static int link_status_1g(struct niu *np, int *link_up_p) 1320static int link_status_1g(struct niu *np, int *link_up_p)
1144{ 1321{
1322 struct niu_link_config *lp = &np->link_config;
1145 u16 current_speed, bmsr; 1323 u16 current_speed, bmsr;
1146 unsigned long flags; 1324 unsigned long flags;
1147 u8 current_duplex; 1325 u8 current_duplex;
@@ -1209,6 +1387,8 @@ static int link_status_1g(struct niu *np, int *link_up_p)
1209 link_up = 0; 1387 link_up = 0;
1210 } 1388 }
1211 } 1389 }
1390 lp->active_speed = current_speed;
1391 lp->active_duplex = current_duplex;
1212 err = 0; 1392 err = 0;
1213 1393
1214out: 1394out:
@@ -2241,6 +2421,8 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
2241 skb->protocol = eth_type_trans(skb, np->dev); 2421 skb->protocol = eth_type_trans(skb, np->dev);
2242 netif_receive_skb(skb); 2422 netif_receive_skb(skb);
2243 2423
2424 np->dev->last_rx = jiffies;
2425
2244 return num_rcr; 2426 return num_rcr;
2245} 2427}
2246 2428
@@ -2508,15 +2690,19 @@ static int niu_rx_error(struct niu *np, struct rx_ring_info *rp)
2508 u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel)); 2690 u64 stat = nr64(RX_DMA_CTL_STAT(rp->rx_channel));
2509 int err = 0; 2691 int err = 0;
2510 2692
2511 dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n",
2512 np->dev->name, rp->rx_channel, (unsigned long long) stat);
2513
2514 niu_log_rxchan_errors(np, rp, stat);
2515 2693
2516 if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL | 2694 if (stat & (RX_DMA_CTL_STAT_CHAN_FATAL |
2517 RX_DMA_CTL_STAT_PORT_FATAL)) 2695 RX_DMA_CTL_STAT_PORT_FATAL))
2518 err = -EINVAL; 2696 err = -EINVAL;
2519 2697
2698 if (err) {
2699 dev_err(np->device, PFX "%s: RX channel %u error, stat[%llx]\n",
2700 np->dev->name, rp->rx_channel,
2701 (unsigned long long) stat);
2702
2703 niu_log_rxchan_errors(np, rp, stat);
2704 }
2705
2520 nw64(RX_DMA_CTL_STAT(rp->rx_channel), 2706 nw64(RX_DMA_CTL_STAT(rp->rx_channel),
2521 stat & RX_DMA_CTL_WRITE_CLEAR_ERRS); 2707 stat & RX_DMA_CTL_WRITE_CLEAR_ERRS);
2522 2708
@@ -2749,13 +2935,16 @@ static int niu_device_error(struct niu *np)
2749 return -ENODEV; 2935 return -ENODEV;
2750} 2936}
2751 2937
2752static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp) 2938static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp,
2939 u64 v0, u64 v1, u64 v2)
2753{ 2940{
2754 u64 v0 = lp->v0; 2941
2755 u64 v1 = lp->v1;
2756 u64 v2 = lp->v2;
2757 int i, err = 0; 2942 int i, err = 0;
2758 2943
2944 lp->v0 = v0;
2945 lp->v1 = v1;
2946 lp->v2 = v2;
2947
2759 if (v1 & 0x00000000ffffffffULL) { 2948 if (v1 & 0x00000000ffffffffULL) {
2760 u32 rx_vec = (v1 & 0xffffffff); 2949 u32 rx_vec = (v1 & 0xffffffff);
2761 2950
@@ -2764,8 +2953,13 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
2764 2953
2765 if (rx_vec & (1 << rp->rx_channel)) { 2954 if (rx_vec & (1 << rp->rx_channel)) {
2766 int r = niu_rx_error(np, rp); 2955 int r = niu_rx_error(np, rp);
2767 if (r) 2956 if (r) {
2768 err = r; 2957 err = r;
2958 } else {
2959 if (!v0)
2960 nw64(RX_DMA_CTL_STAT(rp->rx_channel),
2961 RX_DMA_CTL_STAT_MEX);
2962 }
2769 } 2963 }
2770 } 2964 }
2771 } 2965 }
@@ -2803,7 +2997,7 @@ static int niu_slowpath_interrupt(struct niu *np, struct niu_ldg *lp)
2803 if (err) 2997 if (err)
2804 niu_enable_interrupts(np, 0); 2998 niu_enable_interrupts(np, 0);
2805 2999
2806 return -EINVAL; 3000 return err;
2807} 3001}
2808 3002
2809static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp, 3003static void niu_rxchan_intr(struct niu *np, struct rx_ring_info *rp,
@@ -2905,7 +3099,7 @@ static irqreturn_t niu_interrupt(int irq, void *dev_id)
2905 } 3099 }
2906 3100
2907 if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) { 3101 if (unlikely((v0 & ((u64)1 << LDN_MIF)) || v1 || v2)) {
2908 int err = niu_slowpath_interrupt(np, lp); 3102 int err = niu_slowpath_interrupt(np, lp, v0, v1, v2);
2909 if (err) 3103 if (err)
2910 goto out; 3104 goto out;
2911 } 3105 }
@@ -5194,7 +5388,8 @@ static int niu_start_xmit(struct sk_buff *skb, struct net_device *dev)
5194 } 5388 }
5195 kfree_skb(skb); 5389 kfree_skb(skb);
5196 skb = skb_new; 5390 skb = skb_new;
5197 } 5391 } else
5392 skb_orphan(skb);
5198 5393
5199 align = ((unsigned long) skb->data & (16 - 1)); 5394 align = ((unsigned long) skb->data & (16 - 1));
5200 headroom = align + sizeof(struct tx_pkt_hdr); 5395 headroom = align + sizeof(struct tx_pkt_hdr);
@@ -6282,7 +6477,8 @@ static int __devinit phy_record(struct niu_parent *parent,
6282 if (dev_id_1 < 0 || dev_id_2 < 0) 6477 if (dev_id_1 < 0 || dev_id_2 < 0)
6283 return 0; 6478 return 0;
6284 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) { 6479 if (type == PHY_TYPE_PMA_PMD || type == PHY_TYPE_PCS) {
6285 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) 6480 if (((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM8704) &&
6481 ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_MRVL88X2011))
6286 return 0; 6482 return 0;
6287 } else { 6483 } else {
6288 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R) 6484 if ((id & NIU_PHY_ID_MASK) != NIU_PHY_ID_BCM5464R)
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index 10e3f111b6d5..0e8626adc573 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -2538,6 +2538,39 @@ struct fcram_hash_ipv6 {
2538#define NIU_PHY_ID_MASK 0xfffff0f0 2538#define NIU_PHY_ID_MASK 0xfffff0f0
2539#define NIU_PHY_ID_BCM8704 0x00206030 2539#define NIU_PHY_ID_BCM8704 0x00206030
2540#define NIU_PHY_ID_BCM5464R 0x002060b0 2540#define NIU_PHY_ID_BCM5464R 0x002060b0
2541#define NIU_PHY_ID_MRVL88X2011 0x01410020
2542
2543/* MRVL88X2011 register addresses */
2544#define MRVL88X2011_USER_DEV1_ADDR 1
2545#define MRVL88X2011_USER_DEV2_ADDR 2
2546#define MRVL88X2011_USER_DEV3_ADDR 3
2547#define MRVL88X2011_USER_DEV4_ADDR 4
2548#define MRVL88X2011_PMA_PMD_CTL_1 0x0000
2549#define MRVL88X2011_PMA_PMD_STATUS_1 0x0001
2550#define MRVL88X2011_10G_PMD_STATUS_2 0x0008
2551#define MRVL88X2011_10G_PMD_TX_DIS 0x0009
2552#define MRVL88X2011_10G_XGXS_LANE_STAT 0x0018
2553#define MRVL88X2011_GENERAL_CTL 0x8300
2554#define MRVL88X2011_LED_BLINK_CTL 0x8303
2555#define MRVL88X2011_LED_8_TO_11_CTL 0x8306
2556
2557/* MRVL88X2011 register control */
2558#define MRVL88X2011_ENA_XFPREFCLK 0x0001
2559#define MRVL88X2011_ENA_PMDTX 0x0000
2560#define MRVL88X2011_LOOPBACK 0x1
2561#define MRVL88X2011_LED_ACT 0x1
2562#define MRVL88X2011_LNK_STATUS_OK 0x4
2563#define MRVL88X2011_LED_BLKRATE_MASK 0x70
2564#define MRVL88X2011_LED_BLKRATE_034MS 0x0
2565#define MRVL88X2011_LED_BLKRATE_067MS 0x1
2566#define MRVL88X2011_LED_BLKRATE_134MS 0x2
2567#define MRVL88X2011_LED_BLKRATE_269MS 0x3
2568#define MRVL88X2011_LED_BLKRATE_538MS 0x4
2569#define MRVL88X2011_LED_CTL_OFF 0x0
2570#define MRVL88X2011_LED_CTL_PCS_ACT 0x5
2571#define MRVL88X2011_LED_CTL_MASK 0x7
2572#define MRVL88X2011_LED(n,v) ((v)<<((n)*4))
2573#define MRVL88X2011_LED_STAT(n,v) ((v)>>((n)*4))
2541 2574
2542#define BCM8704_PMA_PMD_DEV_ADDR 1 2575#define BCM8704_PMA_PMD_DEV_ADDR 1
2543#define BCM8704_PCS_DEV_ADDR 2 2576#define BCM8704_PCS_DEV_ADDR 2
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index ad134a61302a..36a7ba3134ce 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -187,14 +187,16 @@ enum Window1 {
187enum Window3 { /* Window 3: MAC/config bits. */ 187enum Window3 { /* Window 3: MAC/config bits. */
188 Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8, 188 Wn3_Config=0, Wn3_MAC_Ctrl=6, Wn3_Options=8,
189}; 189};
190union wn3_config { 190enum wn3_config {
191 int i; 191 Ram_size = 7,
192 struct w3_config_fields { 192 Ram_width = 8,
193 unsigned int ram_size:3, ram_width:1, ram_speed:2, rom_size:2; 193 Ram_speed = 0x30,
194 int pad8:8; 194 Rom_size = 0xc0,
195 unsigned int ram_split:2, pad18:2, xcvr:3, pad21:1, autoselect:1; 195 Ram_split_shift = 16,
196 int pad24:7; 196 Ram_split = 3 << Ram_split_shift,
197 } u; 197 Xcvr_shift = 20,
198 Xcvr = 7 << Xcvr_shift,
199 Autoselect = 0x1000000,
198}; 200};
199 201
200enum Window4 { /* Window 4: Xcvr/media bits. */ 202enum Window4 { /* Window 4: Xcvr/media bits. */
@@ -337,15 +339,15 @@ static int tc574_config(struct pcmcia_device *link)
337 struct net_device *dev = link->priv; 339 struct net_device *dev = link->priv;
338 struct el3_private *lp = netdev_priv(dev); 340 struct el3_private *lp = netdev_priv(dev);
339 tuple_t tuple; 341 tuple_t tuple;
340 unsigned short buf[32]; 342 __le16 buf[32];
341 int last_fn, last_ret, i, j; 343 int last_fn, last_ret, i, j;
342 kio_addr_t ioaddr; 344 kio_addr_t ioaddr;
343 u16 *phys_addr; 345 __be16 *phys_addr;
344 char *cardname; 346 char *cardname;
345 union wn3_config config; 347 __u32 config;
346 DECLARE_MAC_BUF(mac); 348 DECLARE_MAC_BUF(mac);
347 349
348 phys_addr = (u16 *)dev->dev_addr; 350 phys_addr = (__be16 *)dev->dev_addr;
349 351
350 DEBUG(0, "3c574_config(0x%p)\n", link); 352 DEBUG(0, "3c574_config(0x%p)\n", link);
351 353
@@ -378,12 +380,12 @@ static int tc574_config(struct pcmcia_device *link)
378 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 380 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
379 pcmcia_get_tuple_data(link, &tuple); 381 pcmcia_get_tuple_data(link, &tuple);
380 for (i = 0; i < 3; i++) 382 for (i = 0; i < 3; i++)
381 phys_addr[i] = htons(buf[i]); 383 phys_addr[i] = htons(le16_to_cpu(buf[i]));
382 } else { 384 } else {
383 EL3WINDOW(0); 385 EL3WINDOW(0);
384 for (i = 0; i < 3; i++) 386 for (i = 0; i < 3; i++)
385 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); 387 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
386 if (phys_addr[0] == 0x6060) { 388 if (phys_addr[0] == htons(0x6060)) {
387 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" 389 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
388 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 390 "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
389 goto failed; 391 goto failed;
@@ -401,9 +403,9 @@ static int tc574_config(struct pcmcia_device *link)
401 outw(0<<11, ioaddr + RunnerRdCtrl); 403 outw(0<<11, ioaddr + RunnerRdCtrl);
402 printk(KERN_INFO " ASIC rev %d,", mcr>>3); 404 printk(KERN_INFO " ASIC rev %d,", mcr>>3);
403 EL3WINDOW(3); 405 EL3WINDOW(3);
404 config.i = inl(ioaddr + Wn3_Config); 406 config = inl(ioaddr + Wn3_Config);
405 lp->default_media = config.u.xcvr; 407 lp->default_media = (config & Xcvr) >> Xcvr_shift;
406 lp->autoselect = config.u.autoselect; 408 lp->autoselect = config & Autoselect ? 1 : 0;
407 } 409 }
408 410
409 init_timer(&lp->media); 411 init_timer(&lp->media);
@@ -464,8 +466,9 @@ static int tc574_config(struct pcmcia_device *link)
464 dev->name, cardname, dev->base_addr, dev->irq, 466 dev->name, cardname, dev->base_addr, dev->irq,
465 print_mac(mac, dev->dev_addr)); 467 print_mac(mac, dev->dev_addr));
466 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n", 468 printk(" %dK FIFO split %s Rx:Tx, %sMII interface.\n",
467 8 << config.u.ram_size, ram_split[config.u.ram_split], 469 8 << config & Ram_size,
468 config.u.autoselect ? "autoselect " : ""); 470 ram_split[(config & Ram_split) >> Ram_split_shift],
471 config & Autoselect ? "autoselect " : "");
469 472
470 return 0; 473 return 0;
471 474
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index a98fe07cce70..e862d14ece79 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link)
251 struct net_device *dev = link->priv; 251 struct net_device *dev = link->priv;
252 struct el3_private *lp = netdev_priv(dev); 252 struct el3_private *lp = netdev_priv(dev);
253 tuple_t tuple; 253 tuple_t tuple;
254 u16 buf[32], *phys_addr; 254 __le16 buf[32];
255 __be16 *phys_addr;
255 int last_fn, last_ret, i, j, multi = 0, fifo; 256 int last_fn, last_ret, i, j, multi = 0, fifo;
256 kio_addr_t ioaddr; 257 kio_addr_t ioaddr;
257 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 258 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link)
259 260
260 DEBUG(0, "3c589_config(0x%p)\n", link); 261 DEBUG(0, "3c589_config(0x%p)\n", link);
261 262
262 phys_addr = (u16 *)dev->dev_addr; 263 phys_addr = (__be16 *)dev->dev_addr;
263 tuple.Attributes = 0; 264 tuple.Attributes = 0;
264 tuple.TupleData = (cisdata_t *)buf; 265 tuple.TupleData = (cisdata_t *)buf;
265 tuple.TupleDataMax = sizeof(buf); 266 tuple.TupleDataMax = sizeof(buf);
@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link)
298 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 299 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
299 pcmcia_get_tuple_data(link, &tuple); 300 pcmcia_get_tuple_data(link, &tuple);
300 for (i = 0; i < 3; i++) 301 for (i = 0; i < 3; i++)
301 phys_addr[i] = htons(buf[i]); 302 phys_addr[i] = htons(le16_to_cpu(buf[i]));
302 } else { 303 } else {
303 for (i = 0; i < 3; i++) 304 for (i = 0; i < 3; i++)
304 phys_addr[i] = htons(read_eeprom(ioaddr, i)); 305 phys_addr[i] = htons(read_eeprom(ioaddr, i));
305 if (phys_addr[0] == 0x6060) { 306 if (phys_addr[0] == htons(0x6060)) {
306 printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" 307 printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx"
307 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 308 "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
308 goto failed; 309 goto failed;
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index ff92aca0a7b3..90498ffe26f2 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -455,9 +455,14 @@ static void pcnet32_netif_start(struct net_device *dev)
455{ 455{
456#ifdef CONFIG_PCNET32_NAPI 456#ifdef CONFIG_PCNET32_NAPI
457 struct pcnet32_private *lp = netdev_priv(dev); 457 struct pcnet32_private *lp = netdev_priv(dev);
458 ulong ioaddr = dev->base_addr;
459 u16 val;
458#endif 460#endif
459 netif_wake_queue(dev); 461 netif_wake_queue(dev);
460#ifdef CONFIG_PCNET32_NAPI 462#ifdef CONFIG_PCNET32_NAPI
463 val = lp->a.read_csr(ioaddr, CSR3);
464 val &= 0x00ff;
465 lp->a.write_csr(ioaddr, CSR3, val);
461 napi_enable(&lp->napi); 466 napi_enable(&lp->napi);
462#endif 467#endif
463} 468}
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a5791114b7bd..cf0774de6c41 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2320,14 +2320,9 @@ static int ql_poll(struct napi_struct *napi, int budget)
2320 unsigned long hw_flags; 2320 unsigned long hw_flags;
2321 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; 2321 struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers;
2322 2322
2323 if (!netif_carrier_ok(ndev))
2324 goto quit_polling;
2325
2326 ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget); 2323 ql_tx_rx_clean(qdev, &tx_cleaned, &rx_cleaned, budget);
2327 2324
2328 if (tx_cleaned + rx_cleaned != budget || 2325 if (tx_cleaned + rx_cleaned != budget) {
2329 !netif_running(ndev)) {
2330quit_polling:
2331 spin_lock_irqsave(&qdev->hw_lock, hw_flags); 2326 spin_lock_irqsave(&qdev->hw_lock, hw_flags);
2332 __netif_rx_complete(ndev, napi); 2327 __netif_rx_complete(ndev, napi);
2333 ql_update_small_bufq_prod_index(qdev); 2328 ql_update_small_bufq_prod_index(qdev);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 1f647b9ce352..3acfeeabdee1 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2002,7 +2002,7 @@ static void rtl8169_set_magic_reg(void __iomem *ioaddr, unsigned mac_version)
2002 u32 clk; 2002 u32 clk;
2003 2003
2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz; 2004 clk = RTL_R8(Config2) & PCI_Clock_66MHz;
2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++) { 2005 for (i = 0; i < ARRAY_SIZE(cfg2_info); i++, p++) {
2006 if ((p->mac_version == mac_version) && (p->clk == clk)) { 2006 if ((p->mac_version == mac_version) && (p->clk == clk)) {
2007 RTL_W32(0x7c, p->val); 2007 RTL_W32(0x7c, p->val);
2008 break; 2008 break;
@@ -2211,7 +2211,7 @@ out:
2211 2211
2212static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) 2212static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
2213{ 2213{
2214 desc->addr = 0x0badbadbadbadbadull; 2214 desc->addr = cpu_to_le64(0x0badbadbadbadbadull);
2215 desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); 2215 desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
2216} 2216}
2217 2217
@@ -2398,6 +2398,8 @@ static void rtl8169_wait_for_quiescence(struct net_device *dev)
2398 rtl8169_irq_mask_and_ack(ioaddr); 2398 rtl8169_irq_mask_and_ack(ioaddr);
2399 2399
2400#ifdef CONFIG_R8169_NAPI 2400#ifdef CONFIG_R8169_NAPI
2401 tp->intr_mask = 0xffff;
2402 RTL_W16(IntrMask, tp->intr_event);
2401 napi_enable(&tp->napi); 2403 napi_enable(&tp->napi);
2402#endif 2404#endif
2403} 2405}
@@ -2835,7 +2837,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
2835 } 2837 }
2836 2838
2837 /* Work around for AMD plateform. */ 2839 /* Work around for AMD plateform. */
2838 if ((desc->opts2 & 0xfffe000) && 2840 if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
2839 (tp->mac_version == RTL_GIGA_MAC_VER_05)) { 2841 (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
2840 desc->opts2 = 0; 2842 desc->opts2 = 0;
2841 cur_rx++; 2843 cur_rx++;
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 73a7e6529ee0..55a590ab1e17 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev)
294{ 294{
295 struct rr_private *rrpriv; 295 struct rr_private *rrpriv;
296 struct rr_regs __iomem *regs; 296 struct rr_regs __iomem *regs;
297 struct eeprom *hw = NULL;
298 u32 start_pc; 297 u32 start_pc;
299 int i; 298 int i;
300 299
@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev)
381 writel(RBURST_64|WBURST_64, &regs->PciState); 380 writel(RBURST_64|WBURST_64, &regs->PciState);
382 wmb(); 381 wmb();
383 382
384 start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart); 383 start_pc = rr_read_eeprom_word(rrpriv,
384 offsetof(struct eeprom, rncd_info.FwStart));
385 385
386#if (DEBUG > 1) 386#if (DEBUG > 1)
387 printk("%s: Executing firmware at address 0x%06x\n", 387 printk("%s: Executing firmware at address 0x%06x\n",
@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
438 * it to our CPU byte-order. 438 * it to our CPU byte-order.
439 */ 439 */
440static u32 rr_read_eeprom_word(struct rr_private *rrpriv, 440static u32 rr_read_eeprom_word(struct rr_private *rrpriv,
441 void * offset) 441 size_t offset)
442{ 442{
443 u32 word; 443 __be32 word;
444 444
445 if ((rr_read_eeprom(rrpriv, (unsigned long)offset, 445 if ((rr_read_eeprom(rrpriv, offset,
446 (char *)&word, 4) == 4)) 446 (unsigned char *)&word, 4) == 4))
447 return be32_to_cpu(word); 447 return be32_to_cpu(word);
448 return 0; 448 return 0;
449} 449}
@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev)
510{ 510{
511 struct rr_private *rrpriv; 511 struct rr_private *rrpriv;
512 struct rr_regs __iomem *regs; 512 struct rr_regs __iomem *regs;
513 struct eeprom *hw = NULL;
514 u32 sram_size, rev; 513 u32 sram_size, rev;
515 DECLARE_MAC_BUF(mac); 514 DECLARE_MAC_BUF(mac);
516 515
@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev)
545 * other method I've seen. -VAL 544 * other method I've seen. -VAL
546 */ 545 */
547 546
548 *(u16 *)(dev->dev_addr) = 547 *(__be16 *)(dev->dev_addr) =
549 htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA)); 548 htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA)));
550 *(u32 *)(dev->dev_addr+2) = 549 *(__be32 *)(dev->dev_addr+2) =
551 htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4])); 550 htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4])));
552 551
553 printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); 552 printk(" MAC: %s\n", print_mac(mac, dev->dev_addr));
554 553
555 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 554 sram_size = rr_read_eeprom_word(rrpriv, 8);
556 printk(" SRAM size 0x%06x\n", sram_size); 555 printk(" SRAM size 0x%06x\n", sram_size);
557 556
558 return 0; 557 return 0;
@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev)
1477{ 1476{
1478 struct rr_private *rrpriv; 1477 struct rr_private *rrpriv;
1479 struct rr_regs __iomem *regs; 1478 struct rr_regs __iomem *regs;
1480 unsigned long eptr, segptr; 1479 size_t eptr, segptr;
1481 int i, j; 1480 int i, j;
1482 u32 localctrl, sptr, len, tmp; 1481 u32 localctrl, sptr, len, tmp;
1483 u32 p2len, p2size, nr_seg, revision, io, sram_size; 1482 u32 p2len, p2size, nr_seg, revision, io, sram_size;
1484 struct eeprom *hw = NULL;
1485 1483
1486 rrpriv = netdev_priv(dev); 1484 rrpriv = netdev_priv(dev);
1487 regs = rrpriv->regs; 1485 regs = rrpriv->regs;
@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev)
1509 */ 1507 */
1510 io = readl(&regs->ExtIo); 1508 io = readl(&regs->ExtIo);
1511 writel(0, &regs->ExtIo); 1509 writel(0, &regs->ExtIo);
1512 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 1510 sram_size = rr_read_eeprom_word(rrpriv, 8);
1513 1511
1514 for (i = 200; i < sram_size / 4; i++){ 1512 for (i = 200; i < sram_size / 4; i++){
1515 writel(i * 4, &regs->WinBase); 1513 writel(i * 4, &regs->WinBase);
@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev)
1520 writel(io, &regs->ExtIo); 1518 writel(io, &regs->ExtIo);
1521 mb(); 1519 mb();
1522 1520
1523 eptr = (unsigned long)rr_read_eeprom_word(rrpriv, 1521 eptr = rr_read_eeprom_word(rrpriv,
1524 &hw->rncd_info.AddrRunCodeSegs); 1522 offsetof(struct eeprom, rncd_info.AddrRunCodeSegs));
1525 eptr = ((eptr & 0x1fffff) >> 3); 1523 eptr = ((eptr & 0x1fffff) >> 3);
1526 1524
1527 p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4)); 1525 p2len = rr_read_eeprom_word(rrpriv, 0x83*4);
1528 p2len = (p2len << 2); 1526 p2len = (p2len << 2);
1529 p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4)); 1527 p2size = rr_read_eeprom_word(rrpriv, 0x84*4);
1530 p2size = ((p2size & 0x1fffff) >> 3); 1528 p2size = ((p2size & 0x1fffff) >> 3);
1531 1529
1532 if ((eptr < p2size) || (eptr > (p2size + p2len))){ 1530 if ((eptr < p2size) || (eptr > (p2size + p2len))){
@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev)
1534 goto out; 1532 goto out;
1535 } 1533 }
1536 1534
1537 revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt); 1535 revision = rr_read_eeprom_word(rrpriv,
1536 offsetof(struct eeprom, manf.HeaderFmt));
1538 1537
1539 if (revision != 1){ 1538 if (revision != 1){
1540 printk("%s: invalid firmware format (%i)\n", 1539 printk("%s: invalid firmware format (%i)\n",
@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev)
1542 goto out; 1541 goto out;
1543 } 1542 }
1544 1543
1545 nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr); 1544 nr_seg = rr_read_eeprom_word(rrpriv, eptr);
1546 eptr +=4; 1545 eptr +=4;
1547#if (DEBUG > 1) 1546#if (DEBUG > 1)
1548 printk("%s: nr_seg %i\n", dev->name, nr_seg); 1547 printk("%s: nr_seg %i\n", dev->name, nr_seg);
1549#endif 1548#endif
1550 1549
1551 for (i = 0; i < nr_seg; i++){ 1550 for (i = 0; i < nr_seg; i++){
1552 sptr = rr_read_eeprom_word(rrpriv, (void *)eptr); 1551 sptr = rr_read_eeprom_word(rrpriv, eptr);
1553 eptr += 4; 1552 eptr += 4;
1554 len = rr_read_eeprom_word(rrpriv, (void *)eptr); 1553 len = rr_read_eeprom_word(rrpriv, eptr);
1555 eptr += 4; 1554 eptr += 4;
1556 segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr); 1555 segptr = rr_read_eeprom_word(rrpriv, eptr);
1557 segptr = ((segptr & 0x1fffff) >> 3); 1556 segptr = ((segptr & 0x1fffff) >> 3);
1558 eptr += 4; 1557 eptr += 4;
1559#if (DEBUG > 1) 1558#if (DEBUG > 1)
@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev)
1561 dev->name, i, sptr, len, segptr); 1560 dev->name, i, sptr, len, segptr);
1562#endif 1561#endif
1563 for (j = 0; j < len; j++){ 1562 for (j = 0; j < len; j++){
1564 tmp = rr_read_eeprom_word(rrpriv, (void *)segptr); 1563 tmp = rr_read_eeprom_word(rrpriv, segptr);
1565 writel(sptr, &regs->WinBase); 1564 writel(sptr, &regs->WinBase);
1566 mb(); 1565 mb();
1567 writel(tmp, &regs->WinData); 1566 writel(tmp, &regs->WinData);
diff --git a/drivers/net/rrunner.h b/drivers/net/rrunner.h
index 6a79825bc8cf..6173f11218df 100644
--- a/drivers/net/rrunner.h
+++ b/drivers/net/rrunner.h
@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
838 unsigned long offset, 838 unsigned long offset,
839 unsigned char *buf, 839 unsigned char *buf,
840 unsigned long length); 840 unsigned long length);
841static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset); 841static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
842static int rr_load_firmware(struct net_device *dev); 842static int rr_load_firmware(struct net_device *dev);
843static inline void rr_raz_tx(struct rr_private *, struct net_device *); 843static inline void rr_raz_tx(struct rr_private *, struct net_device *);
844static inline void rr_raz_rx(struct rr_private *, struct net_device *); 844static inline void rr_raz_rx(struct rr_private *, struct net_device *);
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 9d80f1cf73ac..f2ba944e035e 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -84,7 +84,7 @@
84#include "s2io.h" 84#include "s2io.h"
85#include "s2io-regs.h" 85#include "s2io-regs.h"
86 86
87#define DRV_VERSION "2.0.26.10" 87#define DRV_VERSION "2.0.26.17"
88 88
89/* S2io Driver name & version. */ 89/* S2io Driver name & version. */
90static char s2io_driver_name[] = "Neterion"; 90static char s2io_driver_name[] = "Neterion";
@@ -2704,9 +2704,6 @@ static int s2io_poll(struct napi_struct *napi, int budget)
2704 struct XENA_dev_config __iomem *bar0 = nic->bar0; 2704 struct XENA_dev_config __iomem *bar0 = nic->bar0;
2705 int i; 2705 int i;
2706 2706
2707 if (!is_s2io_card_up(nic))
2708 return 0;
2709
2710 mac_control = &nic->mac_control; 2707 mac_control = &nic->mac_control;
2711 config = &nic->config; 2708 config = &nic->config;
2712 2709
@@ -3851,8 +3848,6 @@ static int s2io_open(struct net_device *dev)
3851 netif_carrier_off(dev); 3848 netif_carrier_off(dev);
3852 sp->last_link_state = 0; 3849 sp->last_link_state = 0;
3853 3850
3854 napi_enable(&sp->napi);
3855
3856 if (sp->config.intr_type == MSI_X) { 3851 if (sp->config.intr_type == MSI_X) {
3857 int ret = s2io_enable_msi_x(sp); 3852 int ret = s2io_enable_msi_x(sp);
3858 3853
@@ -3895,7 +3890,6 @@ static int s2io_open(struct net_device *dev)
3895 return 0; 3890 return 0;
3896 3891
3897hw_init_failed: 3892hw_init_failed:
3898 napi_disable(&sp->napi);
3899 if (sp->config.intr_type == MSI_X) { 3893 if (sp->config.intr_type == MSI_X) {
3900 if (sp->entries) { 3894 if (sp->entries) {
3901 kfree(sp->entries); 3895 kfree(sp->entries);
@@ -3935,7 +3929,6 @@ static int s2io_close(struct net_device *dev)
3935 return 0; 3929 return 0;
3936 3930
3937 netif_stop_queue(dev); 3931 netif_stop_queue(dev);
3938 napi_disable(&sp->napi);
3939 /* Reset card, kill tasklet and free Tx and Rx buffers. */ 3932 /* Reset card, kill tasklet and free Tx and Rx buffers. */
3940 s2io_card_down(sp); 3933 s2io_card_down(sp);
3941 3934
@@ -6799,6 +6792,8 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6799 struct XENA_dev_config __iomem *bar0 = sp->bar0; 6792 struct XENA_dev_config __iomem *bar0 = sp->bar0;
6800 unsigned long flags; 6793 unsigned long flags;
6801 register u64 val64 = 0; 6794 register u64 val64 = 0;
6795 struct config_param *config;
6796 config = &sp->config;
6802 6797
6803 if (!is_s2io_card_up(sp)) 6798 if (!is_s2io_card_up(sp))
6804 return; 6799 return;
@@ -6810,6 +6805,10 @@ static void do_s2io_card_down(struct s2io_nic * sp, int do_io)
6810 } 6805 }
6811 clear_bit(__S2IO_STATE_CARD_UP, &sp->state); 6806 clear_bit(__S2IO_STATE_CARD_UP, &sp->state);
6812 6807
6808 /* Disable napi */
6809 if (config->napi)
6810 napi_disable(&sp->napi);
6811
6813 /* disable Tx and Rx traffic on the NIC */ 6812 /* disable Tx and Rx traffic on the NIC */
6814 if (do_io) 6813 if (do_io)
6815 stop_nic(sp); 6814 stop_nic(sp);
@@ -6903,6 +6902,11 @@ static int s2io_card_up(struct s2io_nic * sp)
6903 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i, 6902 DBG_PRINT(INFO_DBG, "Buf in ring:%d is %d:\n", i,
6904 atomic_read(&sp->rx_bufs_left[i])); 6903 atomic_read(&sp->rx_bufs_left[i]));
6905 } 6904 }
6905
6906 /* Initialise napi */
6907 if (config->napi)
6908 napi_enable(&sp->napi);
6909
6906 /* Maintain the state prior to the open */ 6910 /* Maintain the state prior to the open */
6907 if (sp->promisc_flg) 6911 if (sp->promisc_flg)
6908 sp->promisc_flg = 0; 6912 sp->promisc_flg = 0;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a74fc11a6482..bc15940ce1bc 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -944,7 +944,6 @@ static void tx_init(struct sky2_port *sky2)
944 le = get_tx_le(sky2); 944 le = get_tx_le(sky2);
945 le->addr = 0; 945 le->addr = 0;
946 le->opcode = OP_ADDR64 | HW_OWNER; 946 le->opcode = OP_ADDR64 | HW_OWNER;
947 sky2->tx_addr64 = 0;
948} 947}
949 948
950static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2, 949static inline struct tx_ring_info *tx_le_re(struct sky2_port *sky2,
@@ -978,13 +977,11 @@ static void sky2_rx_add(struct sky2_port *sky2, u8 op,
978 dma_addr_t map, unsigned len) 977 dma_addr_t map, unsigned len)
979{ 978{
980 struct sky2_rx_le *le; 979 struct sky2_rx_le *le;
981 u32 hi = upper_32_bits(map);
982 980
983 if (sky2->rx_addr64 != hi) { 981 if (sizeof(dma_addr_t) > sizeof(u32)) {
984 le = sky2_next_rx(sky2); 982 le = sky2_next_rx(sky2);
985 le->addr = cpu_to_le32(hi); 983 le->addr = cpu_to_le32(upper_32_bits(map));
986 le->opcode = OP_ADDR64 | HW_OWNER; 984 le->opcode = OP_ADDR64 | HW_OWNER;
987 sky2->rx_addr64 = upper_32_bits(map + len);
988 } 985 }
989 986
990 le = sky2_next_rx(sky2); 987 le = sky2_next_rx(sky2);
@@ -1168,6 +1165,7 @@ static void sky2_vlan_rx_register(struct net_device *dev, struct vlan_group *grp
1168 TX_VLAN_TAG_OFF); 1165 TX_VLAN_TAG_OFF);
1169 } 1166 }
1170 1167
1168 sky2_read32(hw, B0_Y2_SP_LISR);
1171 napi_enable(&hw->napi); 1169 napi_enable(&hw->napi);
1172 netif_tx_unlock_bh(dev); 1170 netif_tx_unlock_bh(dev);
1173} 1171}
@@ -1479,7 +1477,6 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1479 struct tx_ring_info *re; 1477 struct tx_ring_info *re;
1480 unsigned i, len; 1478 unsigned i, len;
1481 dma_addr_t mapping; 1479 dma_addr_t mapping;
1482 u32 addr64;
1483 u16 mss; 1480 u16 mss;
1484 u8 ctrl; 1481 u8 ctrl;
1485 1482
@@ -1492,15 +1489,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1492 1489
1493 len = skb_headlen(skb); 1490 len = skb_headlen(skb);
1494 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); 1491 mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
1495 addr64 = upper_32_bits(mapping);
1496 1492
1497 /* Send high bits if changed or crosses boundary */ 1493 /* Send high bits if needed */
1498 if (addr64 != sky2->tx_addr64 || 1494 if (sizeof(dma_addr_t) > sizeof(u32)) {
1499 upper_32_bits(mapping + len) != sky2->tx_addr64) {
1500 le = get_tx_le(sky2); 1495 le = get_tx_le(sky2);
1501 le->addr = cpu_to_le32(addr64); 1496 le->addr = cpu_to_le32(upper_32_bits(mapping));
1502 le->opcode = OP_ADDR64 | HW_OWNER; 1497 le->opcode = OP_ADDR64 | HW_OWNER;
1503 sky2->tx_addr64 = upper_32_bits(mapping + len);
1504 } 1498 }
1505 1499
1506 /* Check for TCP Segmentation Offload */ 1500 /* Check for TCP Segmentation Offload */
@@ -1581,13 +1575,12 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1581 1575
1582 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset, 1576 mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
1583 frag->size, PCI_DMA_TODEVICE); 1577 frag->size, PCI_DMA_TODEVICE);
1584 addr64 = upper_32_bits(mapping); 1578
1585 if (addr64 != sky2->tx_addr64) { 1579 if (sizeof(dma_addr_t) > sizeof(u32)) {
1586 le = get_tx_le(sky2); 1580 le = get_tx_le(sky2);
1587 le->addr = cpu_to_le32(addr64); 1581 le->addr = cpu_to_le32(upper_32_bits(mapping));
1588 le->ctrl = 0; 1582 le->ctrl = 0;
1589 le->opcode = OP_ADDR64 | HW_OWNER; 1583 le->opcode = OP_ADDR64 | HW_OWNER;
1590 sky2->tx_addr64 = addr64;
1591 } 1584 }
1592 1585
1593 le = get_tx_le(sky2); 1586 le = get_tx_le(sky2);
@@ -2043,6 +2036,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2043 err = sky2_rx_start(sky2); 2036 err = sky2_rx_start(sky2);
2044 sky2_write32(hw, B0_IMSK, imask); 2037 sky2_write32(hw, B0_IMSK, imask);
2045 2038
2039 sky2_read32(hw, B0_Y2_SP_LISR);
2046 napi_enable(&hw->napi); 2040 napi_enable(&hw->napi);
2047 2041
2048 if (err) 2042 if (err)
@@ -3861,6 +3855,7 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
3861 last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)), 3855 last = sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_PUT_IDX)),
3862 sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX))); 3856 sky2_read16(hw, Y2_QADDR(rxqaddr[port], PREF_UNIT_LAST_IDX)));
3863 3857
3858 sky2_read32(hw, B0_Y2_SP_LISR);
3864 napi_enable(&hw->napi); 3859 napi_enable(&hw->napi);
3865 return 0; 3860 return 0;
3866} 3861}
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index bc646a47edd2..ffe9b8a50a1b 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -1991,14 +1991,14 @@ struct sky2_port {
1991 u16 tx_cons; /* next le to check */ 1991 u16 tx_cons; /* next le to check */
1992 u16 tx_prod; /* next le to use */ 1992 u16 tx_prod; /* next le to use */
1993 u16 tx_next; /* debug only */ 1993 u16 tx_next; /* debug only */
1994 u32 tx_addr64; 1994
1995 u16 tx_pending; 1995 u16 tx_pending;
1996 u16 tx_last_mss; 1996 u16 tx_last_mss;
1997 u32 tx_tcpsum; 1997 u32 tx_tcpsum;
1998 1998
1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; 1999 struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp;
2000 struct sky2_rx_le *rx_le; 2000 struct sky2_rx_le *rx_le;
2001 u32 rx_addr64; 2001
2002 u16 rx_next; /* next re to check */ 2002 u16 rx_next; /* next re to check */
2003 u16 rx_put; /* next le index to use */ 2003 u16 rx_put; /* next le index to use */
2004 u16 rx_pending; 2004 u16 rx_pending;
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index d887c05588d5..370d329d15d9 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -611,7 +611,7 @@ static int __devinit tc35815_mac_match(struct device *dev, void *data)
611{ 611{
612 struct platform_device *plat_dev = to_platform_device(dev); 612 struct platform_device *plat_dev = to_platform_device(dev);
613 struct pci_dev *pci_dev = data; 613 struct pci_dev *pci_dev = data;
614 unsigned int id = (pci_dev->bus->number << 8) | pci_dev->devfn; 614 unsigned int id = pci_dev->irq;
615 return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; 615 return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id;
616} 616}
617 617
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 4942f7d18937..22eb7c8c1a25 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8189,6 +8189,7 @@ static int tg3_get_eeprom_len(struct net_device *dev)
8189} 8189}
8190 8190
8191static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val); 8191static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val);
8192static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val);
8192static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val); 8193static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val);
8193 8194
8194static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data) 8195static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, u8 *data)
@@ -8196,7 +8197,8 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8196 struct tg3 *tp = netdev_priv(dev); 8197 struct tg3 *tp = netdev_priv(dev);
8197 int ret; 8198 int ret;
8198 u8 *pd; 8199 u8 *pd;
8199 u32 i, offset, len, val, b_offset, b_count; 8200 u32 i, offset, len, b_offset, b_count;
8201 __le32 val;
8200 8202
8201 if (tp->link_config.phy_is_low_power) 8203 if (tp->link_config.phy_is_low_power)
8202 return -EAGAIN; 8204 return -EAGAIN;
@@ -8215,10 +8217,9 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8215 /* i.e. offset=1 len=2 */ 8217 /* i.e. offset=1 len=2 */
8216 b_count = len; 8218 b_count = len;
8217 } 8219 }
8218 ret = tg3_nvram_read(tp, offset-b_offset, &val); 8220 ret = tg3_nvram_read_le(tp, offset-b_offset, &val);
8219 if (ret) 8221 if (ret)
8220 return ret; 8222 return ret;
8221 val = cpu_to_le32(val);
8222 memcpy(data, ((char*)&val) + b_offset, b_count); 8223 memcpy(data, ((char*)&val) + b_offset, b_count);
8223 len -= b_count; 8224 len -= b_count;
8224 offset += b_count; 8225 offset += b_count;
@@ -8228,12 +8229,11 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8228 /* read bytes upto the last 4 byte boundary */ 8229 /* read bytes upto the last 4 byte boundary */
8229 pd = &data[eeprom->len]; 8230 pd = &data[eeprom->len];
8230 for (i = 0; i < (len - (len & 3)); i += 4) { 8231 for (i = 0; i < (len - (len & 3)); i += 4) {
8231 ret = tg3_nvram_read(tp, offset + i, &val); 8232 ret = tg3_nvram_read_le(tp, offset + i, &val);
8232 if (ret) { 8233 if (ret) {
8233 eeprom->len += i; 8234 eeprom->len += i;
8234 return ret; 8235 return ret;
8235 } 8236 }
8236 val = cpu_to_le32(val);
8237 memcpy(pd + i, &val, 4); 8237 memcpy(pd + i, &val, 4);
8238 } 8238 }
8239 eeprom->len += i; 8239 eeprom->len += i;
@@ -8243,11 +8243,10 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8243 pd = &data[eeprom->len]; 8243 pd = &data[eeprom->len];
8244 b_count = len & 3; 8244 b_count = len & 3;
8245 b_offset = offset + len - b_count; 8245 b_offset = offset + len - b_count;
8246 ret = tg3_nvram_read(tp, b_offset, &val); 8246 ret = tg3_nvram_read_le(tp, b_offset, &val);
8247 if (ret) 8247 if (ret)
8248 return ret; 8248 return ret;
8249 val = cpu_to_le32(val); 8249 memcpy(pd, &val, b_count);
8250 memcpy(pd, ((char*)&val), b_count);
8251 eeprom->len += b_count; 8250 eeprom->len += b_count;
8252 } 8251 }
8253 return 0; 8252 return 0;
@@ -8259,8 +8258,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8259{ 8258{
8260 struct tg3 *tp = netdev_priv(dev); 8259 struct tg3 *tp = netdev_priv(dev);
8261 int ret; 8260 int ret;
8262 u32 offset, len, b_offset, odd_len, start, end; 8261 u32 offset, len, b_offset, odd_len;
8263 u8 *buf; 8262 u8 *buf;
8263 __le32 start, end;
8264 8264
8265 if (tp->link_config.phy_is_low_power) 8265 if (tp->link_config.phy_is_low_power)
8266 return -EAGAIN; 8266 return -EAGAIN;
@@ -8273,10 +8273,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8273 8273
8274 if ((b_offset = (offset & 3))) { 8274 if ((b_offset = (offset & 3))) {
8275 /* adjustments to start on required 4 byte boundary */ 8275 /* adjustments to start on required 4 byte boundary */
8276 ret = tg3_nvram_read(tp, offset-b_offset, &start); 8276 ret = tg3_nvram_read_le(tp, offset-b_offset, &start);
8277 if (ret) 8277 if (ret)
8278 return ret; 8278 return ret;
8279 start = cpu_to_le32(start);
8280 len += b_offset; 8279 len += b_offset;
8281 offset &= ~3; 8280 offset &= ~3;
8282 if (len < 4) 8281 if (len < 4)
@@ -8288,10 +8287,9 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
8288 /* adjustments to end on required 4 byte boundary */ 8287 /* adjustments to end on required 4 byte boundary */
8289 odd_len = 1; 8288 odd_len = 1;
8290 len = (len + 3) & ~3; 8289 len = (len + 3) & ~3;
8291 ret = tg3_nvram_read(tp, offset+len-4, &end); 8290 ret = tg3_nvram_read_le(tp, offset+len-4, &end);
8292 if (ret) 8291 if (ret)
8293 return ret; 8292 return ret;
8294 end = cpu_to_le32(end);
8295 } 8293 }
8296 8294
8297 buf = data; 8295 buf = data;
@@ -8734,7 +8732,8 @@ static void tg3_get_ethtool_stats (struct net_device *dev,
8734 8732
8735static int tg3_test_nvram(struct tg3 *tp) 8733static int tg3_test_nvram(struct tg3 *tp)
8736{ 8734{
8737 u32 *buf, csum, magic; 8735 u32 csum, magic;
8736 __le32 *buf;
8738 int i, j, k, err = 0, size; 8737 int i, j, k, err = 0, size;
8739 8738
8740 if (tg3_nvram_read_swab(tp, 0, &magic) != 0) 8739 if (tg3_nvram_read_swab(tp, 0, &magic) != 0)
@@ -8771,21 +8770,19 @@ static int tg3_test_nvram(struct tg3 *tp)
8771 8770
8772 err = -EIO; 8771 err = -EIO;
8773 for (i = 0, j = 0; i < size; i += 4, j++) { 8772 for (i = 0, j = 0; i < size; i += 4, j++) {
8774 u32 val; 8773 if ((err = tg3_nvram_read_le(tp, i, &buf[j])) != 0)
8775
8776 if ((err = tg3_nvram_read(tp, i, &val)) != 0)
8777 break; 8774 break;
8778 buf[j] = cpu_to_le32(val);
8779 } 8775 }
8780 if (i < size) 8776 if (i < size)
8781 goto out; 8777 goto out;
8782 8778
8783 /* Selfboot format */ 8779 /* Selfboot format */
8784 if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_FW_MSK) == 8780 magic = swab32(le32_to_cpu(buf[0]));
8781 if ((magic & TG3_EEPROM_MAGIC_FW_MSK) ==
8785 TG3_EEPROM_MAGIC_FW) { 8782 TG3_EEPROM_MAGIC_FW) {
8786 u8 *buf8 = (u8 *) buf, csum8 = 0; 8783 u8 *buf8 = (u8 *) buf, csum8 = 0;
8787 8784
8788 if ((cpu_to_be32(buf[0]) & TG3_EEPROM_SB_REVISION_MASK) == 8785 if ((magic & TG3_EEPROM_SB_REVISION_MASK) ==
8789 TG3_EEPROM_SB_REVISION_2) { 8786 TG3_EEPROM_SB_REVISION_2) {
8790 /* For rev 2, the csum doesn't include the MBA. */ 8787 /* For rev 2, the csum doesn't include the MBA. */
8791 for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++) 8788 for (i = 0; i < TG3_EEPROM_SB_F1R2_MBA_OFF; i++)
@@ -8806,7 +8803,7 @@ static int tg3_test_nvram(struct tg3 *tp)
8806 goto out; 8803 goto out;
8807 } 8804 }
8808 8805
8809 if ((cpu_to_be32(buf[0]) & TG3_EEPROM_MAGIC_HW_MSK) == 8806 if ((magic & TG3_EEPROM_MAGIC_HW_MSK) ==
8810 TG3_EEPROM_MAGIC_HW) { 8807 TG3_EEPROM_MAGIC_HW) {
8811 u8 data[NVRAM_SELFBOOT_DATA_SIZE]; 8808 u8 data[NVRAM_SELFBOOT_DATA_SIZE];
8812 u8 parity[NVRAM_SELFBOOT_DATA_SIZE]; 8809 u8 parity[NVRAM_SELFBOOT_DATA_SIZE];
@@ -8852,12 +8849,12 @@ static int tg3_test_nvram(struct tg3 *tp)
8852 8849
8853 /* Bootstrap checksum at offset 0x10 */ 8850 /* Bootstrap checksum at offset 0x10 */
8854 csum = calc_crc((unsigned char *) buf, 0x10); 8851 csum = calc_crc((unsigned char *) buf, 0x10);
8855 if(csum != cpu_to_le32(buf[0x10/4])) 8852 if(csum != le32_to_cpu(buf[0x10/4]))
8856 goto out; 8853 goto out;
8857 8854
8858 /* Manufacturing block starts at offset 0x74, checksum at 0xfc */ 8855 /* Manufacturing block starts at offset 0x74, checksum at 0xfc */
8859 csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88); 8856 csum = calc_crc((unsigned char *) &buf[0x74/4], 0x88);
8860 if (csum != cpu_to_le32(buf[0xfc/4])) 8857 if (csum != le32_to_cpu(buf[0xfc/4]))
8861 goto out; 8858 goto out;
8862 8859
8863 err = 0; 8860 err = 0;
@@ -10171,6 +10168,15 @@ static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
10171 return ret; 10168 return ret;
10172} 10169}
10173 10170
10171static int tg3_nvram_read_le(struct tg3 *tp, u32 offset, __le32 *val)
10172{
10173 u32 v;
10174 int res = tg3_nvram_read(tp, offset, &v);
10175 if (!res)
10176 *val = cpu_to_le32(v);
10177 return res;
10178}
10179
10174static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val) 10180static int tg3_nvram_read_swab(struct tg3 *tp, u32 offset, u32 *val)
10175{ 10181{
10176 int err; 10182 int err;
@@ -10188,13 +10194,14 @@ static int tg3_nvram_write_block_using_eeprom(struct tg3 *tp,
10188 u32 val; 10194 u32 val;
10189 10195
10190 for (i = 0; i < len; i += 4) { 10196 for (i = 0; i < len; i += 4) {
10191 u32 addr, data; 10197 u32 addr;
10198 __le32 data;
10192 10199
10193 addr = offset + i; 10200 addr = offset + i;
10194 10201
10195 memcpy(&data, buf + i, 4); 10202 memcpy(&data, buf + i, 4);
10196 10203
10197 tw32(GRC_EEPROM_DATA, cpu_to_le32(data)); 10204 tw32(GRC_EEPROM_DATA, le32_to_cpu(data));
10198 10205
10199 val = tr32(GRC_EEPROM_ADDR); 10206 val = tr32(GRC_EEPROM_ADDR);
10200 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE); 10207 tw32(GRC_EEPROM_ADDR, val | EEPROM_ADDR_COMPLETE);
@@ -10244,8 +10251,8 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
10244 phy_addr = offset & ~pagemask; 10251 phy_addr = offset & ~pagemask;
10245 10252
10246 for (j = 0; j < pagesize; j += 4) { 10253 for (j = 0; j < pagesize; j += 4) {
10247 if ((ret = tg3_nvram_read(tp, phy_addr + j, 10254 if ((ret = tg3_nvram_read_le(tp, phy_addr + j,
10248 (u32 *) (tmp + j)))) 10255 (__le32 *) (tmp + j))))
10249 break; 10256 break;
10250 } 10257 }
10251 if (ret) 10258 if (ret)
@@ -10289,10 +10296,11 @@ static int tg3_nvram_write_block_unbuffered(struct tg3 *tp, u32 offset, u32 len,
10289 break; 10296 break;
10290 10297
10291 for (j = 0; j < pagesize; j += 4) { 10298 for (j = 0; j < pagesize; j += 4) {
10292 u32 data; 10299 __be32 data;
10293 10300
10294 data = *((u32 *) (tmp + j)); 10301 data = *((__be32 *) (tmp + j));
10295 tw32(NVRAM_WRDATA, cpu_to_be32(data)); 10302 /* swab32(le32_to_cpu(data)), actually */
10303 tw32(NVRAM_WRDATA, be32_to_cpu(data));
10296 10304
10297 tw32(NVRAM_ADDR, phy_addr + j); 10305 tw32(NVRAM_ADDR, phy_addr + j);
10298 10306
@@ -10326,10 +10334,11 @@ static int tg3_nvram_write_block_buffered(struct tg3 *tp, u32 offset, u32 len,
10326 int i, ret = 0; 10334 int i, ret = 0;
10327 10335
10328 for (i = 0; i < len; i += 4, offset += 4) { 10336 for (i = 0; i < len; i += 4, offset += 4) {
10329 u32 data, page_off, phy_addr, nvram_cmd; 10337 u32 page_off, phy_addr, nvram_cmd;
10338 __be32 data;
10330 10339
10331 memcpy(&data, buf + i, 4); 10340 memcpy(&data, buf + i, 4);
10332 tw32(NVRAM_WRDATA, cpu_to_be32(data)); 10341 tw32(NVRAM_WRDATA, be32_to_cpu(data));
10333 10342
10334 page_off = offset % tp->nvram_pagesize; 10343 page_off = offset % tp->nvram_pagesize;
10335 10344
@@ -10831,6 +10840,7 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
10831 vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD); 10840 vpd_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_VPD);
10832 for (i = 0; i < 256; i += 4) { 10841 for (i = 0; i < 256; i += 4) {
10833 u32 tmp, j = 0; 10842 u32 tmp, j = 0;
10843 __le32 v;
10834 u16 tmp16; 10844 u16 tmp16;
10835 10845
10836 pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR, 10846 pci_write_config_word(tp->pdev, vpd_cap + PCI_VPD_ADDR,
@@ -10847,8 +10857,8 @@ static void __devinit tg3_read_partno(struct tg3 *tp)
10847 10857
10848 pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA, 10858 pci_read_config_dword(tp->pdev, vpd_cap + PCI_VPD_DATA,
10849 &tmp); 10859 &tmp);
10850 tmp = cpu_to_le32(tmp); 10860 v = cpu_to_le32(tmp);
10851 memcpy(&vpd_data[i], &tmp, 4); 10861 memcpy(&vpd_data[i], &v, 4);
10852 } 10862 }
10853 } 10863 }
10854 10864
@@ -10941,11 +10951,11 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
10941 10951
10942 offset = offset + ver_offset - start; 10952 offset = offset + ver_offset - start;
10943 for (i = 0; i < 16; i += 4) { 10953 for (i = 0; i < 16; i += 4) {
10944 if (tg3_nvram_read(tp, offset + i, &val)) 10954 __le32 v;
10955 if (tg3_nvram_read_le(tp, offset + i, &v))
10945 return; 10956 return;
10946 10957
10947 val = le32_to_cpu(val); 10958 memcpy(tp->fw_ver + i, &v, 4);
10948 memcpy(tp->fw_ver + i, &val, 4);
10949 } 10959 }
10950 10960
10951 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) || 10961 if (!(tp->tg3_flags & TG3_FLAG_ENABLE_ASF) ||
@@ -10983,19 +10993,19 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
10983 tp->fw_ver[bcnt++] = ' '; 10993 tp->fw_ver[bcnt++] = ' ';
10984 10994
10985 for (i = 0; i < 4; i++) { 10995 for (i = 0; i < 4; i++) {
10986 if (tg3_nvram_read(tp, offset, &val)) 10996 __le32 v;
10997 if (tg3_nvram_read_le(tp, offset, &v))
10987 return; 10998 return;
10988 10999
10989 val = le32_to_cpu(val); 11000 offset += sizeof(v);
10990 offset += sizeof(val);
10991 11001
10992 if (bcnt > TG3_VER_SIZE - sizeof(val)) { 11002 if (bcnt > TG3_VER_SIZE - sizeof(v)) {
10993 memcpy(&tp->fw_ver[bcnt], &val, TG3_VER_SIZE - bcnt); 11003 memcpy(&tp->fw_ver[bcnt], &v, TG3_VER_SIZE - bcnt);
10994 break; 11004 break;
10995 } 11005 }
10996 11006
10997 memcpy(&tp->fw_ver[bcnt], &val, sizeof(val)); 11007 memcpy(&tp->fw_ver[bcnt], &v, sizeof(v));
10998 bcnt += sizeof(val); 11008 bcnt += sizeof(v);
10999 } 11009 }
11000 11010
11001 tp->fw_ver[TG3_VER_SIZE - 1] = 0; 11011 tp->fw_ver[TG3_VER_SIZE - 1] = 0;
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519a6c67..44a06f8b588f 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -570,7 +570,7 @@ static int xl_open(struct net_device *dev)
570 struct xl_private *xl_priv=netdev_priv(dev); 570 struct xl_private *xl_priv=netdev_priv(dev);
571 u8 __iomem *xl_mmio = xl_priv->xl_mmio ; 571 u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
572 u8 i ; 572 u8 i ;
573 u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ 573 __le16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
574 int open_err ; 574 int open_err ;
575 575
576 u16 switchsettings, switchsettings_eeprom ; 576 u16 switchsettings, switchsettings_eeprom ;
@@ -580,15 +580,12 @@ static int xl_open(struct net_device *dev)
580 } 580 }
581 581
582 /* 582 /*
583 * Read the information from the EEPROM that we need. I know we 583 * Read the information from the EEPROM that we need.
584 * should use ntohs, but the word gets stored reversed in the 16
585 * bit field anyway and it all works its self out when we memcpy
586 * it into dev->dev_addr.
587 */ 584 */
588 585
589 hwaddr[0] = xl_ee_read(dev,0x10) ; 586 hwaddr[0] = cpu_to_le16(xl_ee_read(dev,0x10));
590 hwaddr[1] = xl_ee_read(dev,0x11) ; 587 hwaddr[1] = cpu_to_le16(xl_ee_read(dev,0x11));
591 hwaddr[2] = xl_ee_read(dev,0x12) ; 588 hwaddr[2] = cpu_to_le16(xl_ee_read(dev,0x12));
592 589
593 /* Ring speed */ 590 /* Ring speed */
594 591
@@ -665,8 +662,8 @@ static int xl_open(struct net_device *dev)
665 break ; 662 break ;
666 663
667 skb->dev = dev ; 664 skb->dev = dev ;
668 xl_priv->xl_rx_ring[i].upfragaddr = pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 665 xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
669 xl_priv->xl_rx_ring[i].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG; 666 xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
670 xl_priv->rx_ring_skb[i] = skb ; 667 xl_priv->rx_ring_skb[i] = skb ;
671 } 668 }
672 669
@@ -680,7 +677,7 @@ static int xl_open(struct net_device *dev)
680 xl_priv->rx_ring_tail = 0 ; 677 xl_priv->rx_ring_tail = 0 ;
681 xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; 678 xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ;
682 for (i=0;i<(xl_priv->rx_ring_no-1);i++) { 679 for (i=0;i<(xl_priv->rx_ring_no-1);i++) {
683 xl_priv->xl_rx_ring[i].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)) ; 680 xl_priv->xl_rx_ring[i].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)));
684 } 681 }
685 xl_priv->xl_rx_ring[i].upnextptr = 0 ; 682 xl_priv->xl_rx_ring[i].upnextptr = 0 ;
686 683
@@ -698,7 +695,7 @@ static int xl_open(struct net_device *dev)
698 * Setup the first dummy DPD entry for polling to start working. 695 * Setup the first dummy DPD entry for polling to start working.
699 */ 696 */
700 697
701 xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY ; 698 xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY;
702 xl_priv->xl_tx_ring[0].buffer = 0 ; 699 xl_priv->xl_tx_ring[0].buffer = 0 ;
703 xl_priv->xl_tx_ring[0].buffer_length = 0 ; 700 xl_priv->xl_tx_ring[0].buffer_length = 0 ;
704 xl_priv->xl_tx_ring[0].dnnextptr = 0 ; 701 xl_priv->xl_tx_ring[0].dnnextptr = 0 ;
@@ -811,17 +808,17 @@ static int xl_open_hw(struct net_device *dev)
811 return open_err ; 808 return open_err ;
812 } else { 809 } else {
813 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 810 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
814 xl_priv->asb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 811 xl_priv->asb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
815 printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; 812 printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ;
816 printk("ASB: %04x",xl_priv->asb ) ; 813 printk("ASB: %04x",xl_priv->asb ) ;
817 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 814 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
818 printk(", SRB: %04x",ntohs(readw(xl_mmio + MMIO_MACDATA)) ) ; 815 printk(", SRB: %04x",swab16(readw(xl_mmio + MMIO_MACDATA)) ) ;
819 816
820 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 817 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
821 xl_priv->arb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 818 xl_priv->arb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
822 printk(", ARB: %04x \n",xl_priv->arb ) ; 819 printk(", ARB: %04x \n",xl_priv->arb ) ;
823 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 820 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
824 vsoff = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 821 vsoff = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
825 822
826 /* 823 /*
827 * Interesting, sending the individual characters directly to printk was causing klogd to use 824 * Interesting, sending the individual characters directly to printk was causing klogd to use
@@ -873,16 +870,15 @@ static int xl_open_hw(struct net_device *dev)
873static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ 870static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */
874{ 871{
875 struct xl_private *xl_priv=netdev_priv(dev); 872 struct xl_private *xl_priv=netdev_priv(dev);
876 int prev_ring_loc ; 873 int n = xl_priv->rx_ring_tail;
877 874 int prev_ring_loc;
878 prev_ring_loc = (xl_priv->rx_ring_tail + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); 875
879 xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * xl_priv->rx_ring_tail) ; 876 prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1);
880 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus = 0 ; 877 xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n));
881 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upnextptr = 0 ; 878 xl_priv->xl_rx_ring[n].framestatus = 0;
882 xl_priv->rx_ring_tail++ ; 879 xl_priv->xl_rx_ring[n].upnextptr = 0;
883 xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1) ; 880 xl_priv->rx_ring_tail++;
884 881 xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1);
885 return ;
886} 882}
887 883
888static void xl_rx(struct net_device *dev) 884static void xl_rx(struct net_device *dev)
@@ -914,7 +910,7 @@ static void xl_rx(struct net_device *dev)
914 temp_ring_loc &= (XL_RX_RING_SIZE-1) ; 910 temp_ring_loc &= (XL_RX_RING_SIZE-1) ;
915 } 911 }
916 912
917 frame_length = xl_priv->xl_rx_ring[temp_ring_loc].framestatus & 0x7FFF ; 913 frame_length = le32_to_cpu(xl_priv->xl_rx_ring[temp_ring_loc].framestatus) & 0x7FFF;
918 914
919 skb = dev_alloc_skb(frame_length) ; 915 skb = dev_alloc_skb(frame_length) ;
920 916
@@ -931,29 +927,29 @@ static void xl_rx(struct net_device *dev)
931 } 927 }
932 928
933 while (xl_priv->rx_ring_tail != temp_ring_loc) { 929 while (xl_priv->rx_ring_tail != temp_ring_loc) {
934 copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; 930 copy_len = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen) & 0x7FFF;
935 frame_length -= copy_len ; 931 frame_length -= copy_len ;
936 pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 932 pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
937 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], 933 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
938 skb_put(skb, copy_len), 934 skb_put(skb, copy_len),
939 copy_len); 935 copy_len);
940 pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 936 pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
941 adv_rx_ring(dev) ; 937 adv_rx_ring(dev) ;
942 } 938 }
943 939
944 /* Now we have found the last fragment */ 940 /* Now we have found the last fragment */
945 pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 941 pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
946 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], 942 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
947 skb_put(skb,copy_len), frame_length); 943 skb_put(skb,copy_len), frame_length);
948/* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ 944/* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */
949 pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 945 pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
950 adv_rx_ring(dev) ; 946 adv_rx_ring(dev) ;
951 skb->protocol = tr_type_trans(skb,dev) ; 947 skb->protocol = tr_type_trans(skb,dev) ;
952 netif_rx(skb) ; 948 netif_rx(skb) ;
953 949
954 } else { /* Single Descriptor Used, simply swap buffers over, fast path */ 950 } else { /* Single Descriptor Used, simply swap buffers over, fast path */
955 951
956 frame_length = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus & 0x7FFF ; 952 frame_length = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus) & 0x7FFF;
957 953
958 skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; 954 skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ;
959 955
@@ -966,13 +962,13 @@ static void xl_rx(struct net_device *dev)
966 } 962 }
967 963
968 skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; 964 skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ;
969 pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 965 pci_unmap_single(xl_priv->pdev, le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
970 skb_put(skb2, frame_length) ; 966 skb_put(skb2, frame_length) ;
971 skb2->protocol = tr_type_trans(skb2,dev) ; 967 skb2->protocol = tr_type_trans(skb2,dev) ;
972 968
973 xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ; 969 xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ;
974 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 970 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
975 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG ; 971 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
976 adv_rx_ring(dev) ; 972 adv_rx_ring(dev) ;
977 xl_priv->xl_stats.rx_packets++ ; 973 xl_priv->xl_stats.rx_packets++ ;
978 xl_priv->xl_stats.rx_bytes += frame_length ; 974 xl_priv->xl_stats.rx_bytes += frame_length ;
@@ -1022,7 +1018,7 @@ static void xl_freemem(struct net_device *dev)
1022 1018
1023 for (i=0;i<XL_RX_RING_SIZE;i++) { 1019 for (i=0;i<XL_RX_RING_SIZE;i++) {
1024 dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; 1020 dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ;
1025 pci_unmap_single(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 1021 pci_unmap_single(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE);
1026 xl_priv->rx_ring_tail++ ; 1022 xl_priv->rx_ring_tail++ ;
1027 xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; 1023 xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1;
1028 } 1024 }
@@ -1181,9 +1177,9 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
1181 1177
1182 txd = &(xl_priv->xl_tx_ring[tx_head]) ; 1178 txd = &(xl_priv->xl_tx_ring[tx_head]) ;
1183 txd->dnnextptr = 0 ; 1179 txd->dnnextptr = 0 ;
1184 txd->framestartheader = skb->len | TXDNINDICATE ; 1180 txd->framestartheader = cpu_to_le32(skb->len) | TXDNINDICATE;
1185 txd->buffer = pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE) ; 1181 txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE));
1186 txd->buffer_length = skb->len | TXDNFRAGLAST ; 1182 txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST;
1187 xl_priv->tx_ring_skb[tx_head] = skb ; 1183 xl_priv->tx_ring_skb[tx_head] = skb ;
1188 xl_priv->xl_stats.tx_packets++ ; 1184 xl_priv->xl_stats.tx_packets++ ;
1189 xl_priv->xl_stats.tx_bytes += skb->len ; 1185 xl_priv->xl_stats.tx_bytes += skb->len ;
@@ -1199,7 +1195,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
1199 xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ; 1195 xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ;
1200 xl_priv->free_ring_entries-- ; 1196 xl_priv->free_ring_entries-- ;
1201 1197
1202 xl_priv->xl_tx_ring[tx_prev].dnnextptr = xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head) ; 1198 xl_priv->xl_tx_ring[tx_prev].dnnextptr = cpu_to_le32(xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head));
1203 1199
1204 /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */ 1200 /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */
1205 /* readl(xl_mmio + MMIO_DNLISTPTR) ; */ 1201 /* readl(xl_mmio + MMIO_DNLISTPTR) ; */
@@ -1237,9 +1233,9 @@ static void xl_dn_comp(struct net_device *dev)
1237 1233
1238 while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { 1234 while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) {
1239 txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ; 1235 txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ;
1240 pci_unmap_single(xl_priv->pdev,txd->buffer, xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE) ; 1236 pci_unmap_single(xl_priv->pdev, le32_to_cpu(txd->buffer), xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE);
1241 txd->framestartheader = 0 ; 1237 txd->framestartheader = 0 ;
1242 txd->buffer = 0xdeadbeef ; 1238 txd->buffer = cpu_to_le32(0xdeadbeef);
1243 txd->buffer_length = 0 ; 1239 txd->buffer_length = 0 ;
1244 dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ; 1240 dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ;
1245 xl_priv->tx_ring_tail++ ; 1241 xl_priv->tx_ring_tail++ ;
@@ -1507,9 +1503,9 @@ static void xl_arb_cmd(struct net_device *dev)
1507 if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */ 1503 if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */
1508 writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; 1504 writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
1509 1505
1510 printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, ntohs(readw(xl_mmio + MMIO_MACDATA) )) ; 1506 printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, swab16(readw(xl_mmio + MMIO_MACDATA) )) ;
1511 1507
1512 lan_status = ntohs(readw(xl_mmio + MMIO_MACDATA)); 1508 lan_status = swab16(readw(xl_mmio + MMIO_MACDATA));
1513 1509
1514 /* Acknowledge interrupt, this tells nic we are done with the arb */ 1510 /* Acknowledge interrupt, this tells nic we are done with the arb */
1515 writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; 1511 writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ;
@@ -1573,7 +1569,7 @@ static void xl_arb_cmd(struct net_device *dev)
1573 printk(KERN_INFO "Received.Data \n") ; 1569 printk(KERN_INFO "Received.Data \n") ;
1574#endif 1570#endif
1575 writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; 1571 writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
1576 xl_priv->mac_buffer = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 1572 xl_priv->mac_buffer = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
1577 1573
1578 /* Now we are going to be really basic here and not do anything 1574 /* Now we are going to be really basic here and not do anything
1579 * with the data at all. The tech docs do not give me enough 1575 * with the data at all. The tech docs do not give me enough
@@ -1634,7 +1630,7 @@ static void xl_asb_cmd(struct net_device *dev)
1634 writeb(0x81, xl_mmio + MMIO_MACDATA) ; 1630 writeb(0x81, xl_mmio + MMIO_MACDATA) ;
1635 1631
1636 writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 1632 writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
1637 writew(ntohs(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; 1633 writew(swab16(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ;
1638 1634
1639 xl_wait_misr_flags(dev) ; 1635 xl_wait_misr_flags(dev) ;
1640 1636
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h
index 05c860368852..b880cba0f6fd 100644
--- a/drivers/net/tokenring/3c359.h
+++ b/drivers/net/tokenring/3c359.h
@@ -156,19 +156,19 @@
156#define HOSTERRINT (1<<1) 156#define HOSTERRINT (1<<1)
157 157
158/* Receive descriptor bits */ 158/* Receive descriptor bits */
159#define RXOVERRUN (1<<19) 159#define RXOVERRUN cpu_to_le32(1<<19)
160#define RXFC (1<<21) 160#define RXFC cpu_to_le32(1<<21)
161#define RXAR (1<<22) 161#define RXAR cpu_to_le32(1<<22)
162#define RXUPDCOMPLETE (1<<23) 162#define RXUPDCOMPLETE cpu_to_le32(1<<23)
163#define RXUPDFULL (1<<24) 163#define RXUPDFULL cpu_to_le32(1<<24)
164#define RXUPLASTFRAG (1<<31) 164#define RXUPLASTFRAG cpu_to_le32(1<<31)
165 165
166/* Transmit descriptor bits */ 166/* Transmit descriptor bits */
167#define TXDNCOMPLETE (1<<16) 167#define TXDNCOMPLETE cpu_to_le32(1<<16)
168#define TXTXINDICATE (1<<27) 168#define TXTXINDICATE cpu_to_le32(1<<27)
169#define TXDPDEMPTY (1<<29) 169#define TXDPDEMPTY cpu_to_le32(1<<29)
170#define TXDNINDICATE (1<<31) 170#define TXDNINDICATE cpu_to_le32(1<<31)
171#define TXDNFRAGLAST (1<<31) 171#define TXDNFRAGLAST cpu_to_le32(1<<31)
172 172
173/* Interrupts to Acknowledge */ 173/* Interrupts to Acknowledge */
174#define LATCH_ACK 1 174#define LATCH_ACK 1
@@ -232,17 +232,17 @@
232/* 3c359 data structures */ 232/* 3c359 data structures */
233 233
234struct xl_tx_desc { 234struct xl_tx_desc {
235 u32 dnnextptr ; 235 __le32 dnnextptr;
236 u32 framestartheader ; 236 __le32 framestartheader;
237 u32 buffer ; 237 __le32 buffer;
238 u32 buffer_length ; 238 __le32 buffer_length;
239}; 239};
240 240
241struct xl_rx_desc { 241struct xl_rx_desc {
242 u32 upnextptr ; 242 __le32 upnextptr;
243 u32 framestatus ; 243 __le32 framestatus;
244 u32 upfragaddr ; 244 __le32 upfragaddr;
245 u32 upfraglen ; 245 __le32 upfraglen;
246}; 246};
247 247
248struct xl_private { 248struct xl_private {
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 41f34bb91cad..6e8b18a3b3cc 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -911,7 +911,7 @@ static int de4x5_init(struct net_device *dev);
911static int de4x5_sw_reset(struct net_device *dev); 911static int de4x5_sw_reset(struct net_device *dev);
912static int de4x5_rx(struct net_device *dev); 912static int de4x5_rx(struct net_device *dev);
913static int de4x5_tx(struct net_device *dev); 913static int de4x5_tx(struct net_device *dev);
914static int de4x5_ast(struct net_device *dev); 914static void de4x5_ast(struct net_device *dev);
915static int de4x5_txur(struct net_device *dev); 915static int de4x5_txur(struct net_device *dev);
916static int de4x5_rx_ovfc(struct net_device *dev); 916static int de4x5_rx_ovfc(struct net_device *dev);
917 917
@@ -984,11 +984,9 @@ static int test_bad_enet(struct net_device *dev, int status);
984static int an_exception(struct de4x5_private *lp); 984static int an_exception(struct de4x5_private *lp);
985static char *build_setup_frame(struct net_device *dev, int mode); 985static char *build_setup_frame(struct net_device *dev, int mode);
986static void disable_ast(struct net_device *dev); 986static void disable_ast(struct net_device *dev);
987static void enable_ast(struct net_device *dev, u32 time_out);
988static long de4x5_switch_mac_port(struct net_device *dev); 987static long de4x5_switch_mac_port(struct net_device *dev);
989static int gep_rd(struct net_device *dev); 988static int gep_rd(struct net_device *dev);
990static void gep_wr(s32 data, struct net_device *dev); 989static void gep_wr(s32 data, struct net_device *dev);
991static void timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec);
992static void yawn(struct net_device *dev, int state); 990static void yawn(struct net_device *dev, int state);
993static void de4x5_parse_params(struct net_device *dev); 991static void de4x5_parse_params(struct net_device *dev);
994static void de4x5_dbg_open(struct net_device *dev); 992static void de4x5_dbg_open(struct net_device *dev);
@@ -1139,6 +1137,8 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
1139 lp->gendev = gendev; 1137 lp->gendev = gendev;
1140 spin_lock_init(&lp->lock); 1138 spin_lock_init(&lp->lock);
1141 init_timer(&lp->timer); 1139 init_timer(&lp->timer);
1140 lp->timer.function = (void (*)(unsigned long))de4x5_ast;
1141 lp->timer.data = (unsigned long)dev;
1142 de4x5_parse_params(dev); 1142 de4x5_parse_params(dev);
1143 1143
1144 /* 1144 /*
@@ -1311,7 +1311,7 @@ de4x5_open(struct net_device *dev)
1311 lp->state = OPEN; 1311 lp->state = OPEN;
1312 de4x5_dbg_open(dev); 1312 de4x5_dbg_open(dev);
1313 1313
1314 if (request_irq(dev->irq, (void *)de4x5_interrupt, IRQF_SHARED, 1314 if (request_irq(dev->irq, de4x5_interrupt, IRQF_SHARED,
1315 lp->adapter_name, dev)) { 1315 lp->adapter_name, dev)) {
1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq); 1316 printk("de4x5_open(): Requested IRQ%d is busy - attemping FAST/SHARE...", dev->irq);
1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED, 1317 if (request_irq(dev->irq, de4x5_interrupt, IRQF_DISABLED | IRQF_SHARED,
@@ -1737,27 +1737,29 @@ de4x5_tx(struct net_device *dev)
1737 return 0; 1737 return 0;
1738} 1738}
1739 1739
1740static int 1740static void
1741de4x5_ast(struct net_device *dev) 1741de4x5_ast(struct net_device *dev)
1742{ 1742{
1743 struct de4x5_private *lp = netdev_priv(dev); 1743 struct de4x5_private *lp = netdev_priv(dev);
1744 int next_tick = DE4X5_AUTOSENSE_MS; 1744 int next_tick = DE4X5_AUTOSENSE_MS;
1745 int dt;
1745 1746
1746 disable_ast(dev); 1747 if (lp->useSROM)
1748 next_tick = srom_autoconf(dev);
1749 else if (lp->chipset == DC21140)
1750 next_tick = dc21140m_autoconf(dev);
1751 else if (lp->chipset == DC21041)
1752 next_tick = dc21041_autoconf(dev);
1753 else if (lp->chipset == DC21040)
1754 next_tick = dc21040_autoconf(dev);
1755 lp->linkOK = 0;
1747 1756
1748 if (lp->useSROM) { 1757 dt = (next_tick * HZ) / 1000;
1749 next_tick = srom_autoconf(dev);
1750 } else if (lp->chipset == DC21140) {
1751 next_tick = dc21140m_autoconf(dev);
1752 } else if (lp->chipset == DC21041) {
1753 next_tick = dc21041_autoconf(dev);
1754 } else if (lp->chipset == DC21040) {
1755 next_tick = dc21040_autoconf(dev);
1756 }
1757 lp->linkOK = 0;
1758 enable_ast(dev, next_tick);
1759 1758
1760 return 0; 1759 if (!dt)
1760 dt = 1;
1761
1762 mod_timer(&lp->timer, jiffies + dt);
1761} 1763}
1762 1764
1763static int 1765static int
@@ -2174,7 +2176,7 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2174 for (j=0, i=0; i<ETH_ALEN; i++) { 2176 for (j=0, i=0; i<ETH_ALEN; i++) {
2175 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i); 2177 j += (u_char) *((u_char *)&lp->srom + SROM_HWADD + i);
2176 } 2178 }
2177 if ((j != 0) && (j != 0x5fa)) { 2179 if (j != 0 && j != 6 * 0xff) {
2178 last.chipset = device; 2180 last.chipset = device;
2179 last.bus = pb; 2181 last.bus = pb;
2180 last.irq = irq; 2182 last.irq = irq;
@@ -2371,30 +2373,19 @@ static struct pci_driver de4x5_pci_driver = {
2371static int 2373static int
2372autoconf_media(struct net_device *dev) 2374autoconf_media(struct net_device *dev)
2373{ 2375{
2374 struct de4x5_private *lp = netdev_priv(dev); 2376 struct de4x5_private *lp = netdev_priv(dev);
2375 u_long iobase = dev->base_addr; 2377 u_long iobase = dev->base_addr;
2376 int next_tick = DE4X5_AUTOSENSE_MS;
2377 2378
2378 lp->linkOK = 0; 2379 disable_ast(dev);
2379 lp->c_media = AUTO; /* Bogus last media */
2380 disable_ast(dev);
2381 inl(DE4X5_MFC); /* Zero the lost frames counter */
2382 lp->media = INIT;
2383 lp->tcount = 0;
2384 2380
2385 if (lp->useSROM) { 2381 lp->c_media = AUTO; /* Bogus last media */
2386 next_tick = srom_autoconf(dev); 2382 inl(DE4X5_MFC); /* Zero the lost frames counter */
2387 } else if (lp->chipset == DC21040) { 2383 lp->media = INIT;
2388 next_tick = dc21040_autoconf(dev); 2384 lp->tcount = 0;
2389 } else if (lp->chipset == DC21041) {
2390 next_tick = dc21041_autoconf(dev);
2391 } else if (lp->chipset == DC21140) {
2392 next_tick = dc21140m_autoconf(dev);
2393 }
2394 2385
2395 enable_ast(dev, next_tick); 2386 de4x5_ast(dev);
2396 2387
2397 return (lp->media); 2388 return lp->media;
2398} 2389}
2399 2390
2400/* 2391/*
@@ -4018,20 +4009,22 @@ DevicePresent(struct net_device *dev, u_long aprom_addr)
4018 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */ 4009 outl(0, aprom_addr); /* Reset Ethernet Address ROM Pointer */
4019 } 4010 }
4020 } else { /* Read new srom */ 4011 } else { /* Read new srom */
4021 u_short tmp, *p = (short *)((char *)&lp->srom + SROM_HWADD); 4012 u_short tmp;
4013 __le16 *p = (__le16 *)((char *)&lp->srom + SROM_HWADD);
4022 for (i=0; i<(ETH_ALEN>>1); i++) { 4014 for (i=0; i<(ETH_ALEN>>1); i++) {
4023 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i); 4015 tmp = srom_rd(aprom_addr, (SROM_HWADD>>1) + i);
4024 *p = le16_to_cpu(tmp); 4016 j += tmp; /* for check for 0:0:0:0:0:0 or ff:ff:ff:ff:ff:ff */
4025 j += *p++; 4017 *p = cpu_to_le16(tmp);
4026 } 4018 }
4027 if ((j == 0) || (j == 0x2fffd)) { 4019 if (j == 0 || j == 3 * 0xffff) {
4028 return; 4020 /* could get 0 only from all-0 and 3 * 0xffff only from all-1 */
4021 return;
4029 } 4022 }
4030 4023
4031 p=(short *)&lp->srom; 4024 p = (__le16 *)&lp->srom;
4032 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) { 4025 for (i=0; i<(sizeof(struct de4x5_srom)>>1); i++) {
4033 tmp = srom_rd(aprom_addr, i); 4026 tmp = srom_rd(aprom_addr, i);
4034 *p++ = le16_to_cpu(tmp); 4027 *p++ = cpu_to_le16(tmp);
4035 } 4028 }
4036 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom); 4029 de4x5_dbg_srom((struct de4x5_srom *)&lp->srom);
4037 } 4030 }
@@ -5161,21 +5154,10 @@ build_setup_frame(struct net_device *dev, int mode)
5161} 5154}
5162 5155
5163static void 5156static void
5164enable_ast(struct net_device *dev, u32 time_out)
5165{
5166 timeout(dev, (void *)&de4x5_ast, (u_long)dev, time_out);
5167
5168 return;
5169}
5170
5171static void
5172disable_ast(struct net_device *dev) 5157disable_ast(struct net_device *dev)
5173{ 5158{
5174 struct de4x5_private *lp = netdev_priv(dev); 5159 struct de4x5_private *lp = netdev_priv(dev);
5175 5160 del_timer_sync(&lp->timer);
5176 del_timer(&lp->timer);
5177
5178 return;
5179} 5161}
5180 5162
5181static long 5163static long
@@ -5245,29 +5227,6 @@ gep_rd(struct net_device *dev)
5245} 5227}
5246 5228
5247static void 5229static void
5248timeout(struct net_device *dev, void (*fn)(u_long data), u_long data, u_long msec)
5249{
5250 struct de4x5_private *lp = netdev_priv(dev);
5251 int dt;
5252
5253 /* First, cancel any pending timer events */
5254 del_timer(&lp->timer);
5255
5256 /* Convert msec to ticks */
5257 dt = (msec * HZ) / 1000;
5258 if (dt==0) dt=1;
5259
5260 /* Set up timer */
5261 init_timer(&lp->timer);
5262 lp->timer.expires = jiffies + dt;
5263 lp->timer.function = fn;
5264 lp->timer.data = data;
5265 add_timer(&lp->timer);
5266
5267 return;
5268}
5269
5270static void
5271yawn(struct net_device *dev, int state) 5230yawn(struct net_device *dev, int state)
5272{ 5231{
5273 struct de4x5_private *lp = netdev_priv(dev); 5232 struct de4x5_private *lp = netdev_priv(dev);
diff --git a/drivers/net/tulip/interrupt.c b/drivers/net/tulip/interrupt.c
index 365331446387..6284afd14bbb 100644
--- a/drivers/net/tulip/interrupt.c
+++ b/drivers/net/tulip/interrupt.c
@@ -117,9 +117,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
117 int received = 0; 117 int received = 0;
118#endif 118#endif
119 119
120 if (!netif_running(dev))
121 goto done;
122
123#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION 120#ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
124 121
125/* that one buffer is needed for mit activation; or might be a 122/* that one buffer is needed for mit activation; or might be a
@@ -151,7 +148,8 @@ int tulip_poll(struct napi_struct *napi, int budget)
151 if (tulip_debug > 5) 148 if (tulip_debug > 5)
152 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n", 149 printk(KERN_DEBUG "%s: In tulip_rx(), entry %d %8.8x.\n",
153 dev->name, entry, status); 150 dev->name, entry, status);
154 if (work_done++ >= budget) 151
152 if (++work_done >= budget)
155 goto not_done; 153 goto not_done;
156 154
157 if ((status & 0x38008300) != 0x0300) { 155 if ((status & 0x38008300) != 0x0300) {
@@ -260,8 +258,6 @@ int tulip_poll(struct napi_struct *napi, int budget)
260 * finally: amount of IO did not increase at all. */ 258 * finally: amount of IO did not increase at all. */
261 } while ((ioread32(tp->base_addr + CSR5) & RxIntr)); 259 } while ((ioread32(tp->base_addr + CSR5) & RxIntr));
262 260
263done:
264
265 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION 261 #ifdef CONFIG_TULIP_NAPI_HW_MITIGATION
266 262
267 /* We use this simplistic scheme for IM. It's proven by 263 /* We use this simplistic scheme for IM. It's proven by
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index e5e2c9c4ebfe..ed600bf56e78 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -797,7 +797,8 @@ static int tulip_close (struct net_device *dev)
797 797
798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */ 798 tp->rx_ring[i].status = 0; /* Not owned by Tulip chip. */
799 tp->rx_ring[i].length = 0; 799 tp->rx_ring[i].length = 0;
800 tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ 800 /* An invalid address. */
801 tp->rx_ring[i].buffer1 = cpu_to_le32(0xBADF00D0);
801 if (skb) { 802 if (skb) {
802 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ, 803 pci_unmap_single(tp->pdev, mapping, PKT_BUF_SZ,
803 PCI_DMA_FROMDEVICE); 804 PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/tulip/xircom_cb.c b/drivers/net/tulip/xircom_cb.c
index 70befe33e454..8fc7274642eb 100644
--- a/drivers/net/tulip/xircom_cb.c
+++ b/drivers/net/tulip/xircom_cb.c
@@ -83,8 +83,8 @@ static int bufferoffsets[NUMDESCRIPTORS] = {128,2048,4096,6144};
83struct xircom_private { 83struct xircom_private {
84 /* Send and receive buffers, kernel-addressable and dma addressable forms */ 84 /* Send and receive buffers, kernel-addressable and dma addressable forms */
85 85
86 unsigned int *rx_buffer; 86 __le32 *rx_buffer;
87 unsigned int *tx_buffer; 87 __le32 *tx_buffer;
88 88
89 dma_addr_t rx_dma_handle; 89 dma_addr_t rx_dma_handle;
90 dma_addr_t tx_dma_handle; 90 dma_addr_t tx_dma_handle;
@@ -412,19 +412,20 @@ static int xircom_start_xmit(struct sk_buff *skb, struct net_device *dev)
412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of 412 /* FIXME: The specification tells us that the length we send HAS to be a multiple of
413 4 bytes. */ 413 4 bytes. */
414 414
415 card->tx_buffer[4*desc+1] = skb->len; 415 card->tx_buffer[4*desc+1] = cpu_to_le32(skb->len);
416 if (desc == NUMDESCRIPTORS-1) 416 if (desc == NUMDESCRIPTORS - 1) /* bit 25: last descriptor of the ring */
417 card->tx_buffer[4*desc+1] |= (1<<25); /* bit 25: last descriptor of the ring */ 417 card->tx_buffer[4*desc+1] |= cpu_to_le32(1<<25);
418 418
419 card->tx_buffer[4*desc+1] |= 0xF0000000; 419 card->tx_buffer[4*desc+1] |= cpu_to_le32(0xF0000000);
420 /* 0xF0... means want interrupts*/ 420 /* 0xF0... means want interrupts*/
421 card->tx_skb[desc] = skb; 421 card->tx_skb[desc] = skb;
422 422
423 wmb(); 423 wmb();
424 /* This gives the descriptor to the card */ 424 /* This gives the descriptor to the card */
425 card->tx_buffer[4*desc] = 0x80000000; 425 card->tx_buffer[4*desc] = cpu_to_le32(0x80000000);
426 trigger_transmit(card); 426 trigger_transmit(card);
427 if (((int)card->tx_buffer[nextdescriptor*4])<0) { /* next descriptor is occupied... */ 427 if (card->tx_buffer[nextdescriptor*4] & cpu_to_le32(0x8000000)) {
428 /* next descriptor is occupied... */
428 netif_stop_queue(dev); 429 netif_stop_queue(dev);
429 } 430 }
430 card->transmit_used = nextdescriptor; 431 card->transmit_used = nextdescriptor;
@@ -590,8 +591,7 @@ descriptors and programs the addresses into the card.
590*/ 591*/
591static void setup_descriptors(struct xircom_private *card) 592static void setup_descriptors(struct xircom_private *card)
592{ 593{
593 unsigned int val; 594 u32 address;
594 unsigned int address;
595 int i; 595 int i;
596 enter("setup_descriptors"); 596 enter("setup_descriptors");
597 597
@@ -604,16 +604,16 @@ static void setup_descriptors(struct xircom_private *card)
604 for (i=0;i<NUMDESCRIPTORS;i++ ) { 604 for (i=0;i<NUMDESCRIPTORS;i++ ) {
605 605
606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */ 606 /* Rx Descr0: It's empty, let the card own it, no errors -> 0x80000000 */
607 card->rx_buffer[i*4 + 0] = 0x80000000; 607 card->rx_buffer[i*4 + 0] = cpu_to_le32(0x80000000);
608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 608 /* Rx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
609 card->rx_buffer[i*4 + 1] = 1536; 609 card->rx_buffer[i*4 + 1] = cpu_to_le32(1536);
610 if (i==NUMDESCRIPTORS-1) 610 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
611 card->rx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 611 card->rx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
612 612
613 /* Rx Descr2: address of the buffer 613 /* Rx Descr2: address of the buffer
614 we store the buffer at the 2nd half of the page */ 614 we store the buffer at the 2nd half of the page */
615 615
616 address = (unsigned long) card->rx_dma_handle; 616 address = card->rx_dma_handle;
617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 617 card->rx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
618 /* Rx Desc3: address of 2nd buffer -> 0 */ 618 /* Rx Desc3: address of 2nd buffer -> 0 */
619 card->rx_buffer[i*4 + 3] = 0; 619 card->rx_buffer[i*4 + 3] = 0;
@@ -621,9 +621,8 @@ static void setup_descriptors(struct xircom_private *card)
621 621
622 wmb(); 622 wmb();
623 /* Write the receive descriptor ring address to the card */ 623 /* Write the receive descriptor ring address to the card */
624 address = (unsigned long) card->rx_dma_handle; 624 address = card->rx_dma_handle;
625 val = cpu_to_le32(address); 625 outl(address, card->io_port + CSR3); /* Receive descr list address */
626 outl(val, card->io_port + CSR3); /* Receive descr list address */
627 626
628 627
629 /* transmit descriptors */ 628 /* transmit descriptors */
@@ -633,13 +632,13 @@ static void setup_descriptors(struct xircom_private *card)
633 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */ 632 /* Tx Descr0: Empty, we own it, no errors -> 0x00000000 */
634 card->tx_buffer[i*4 + 0] = 0x00000000; 633 card->tx_buffer[i*4 + 0] = 0x00000000;
635 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */ 634 /* Tx Descr1: buffer 1 is 1536 bytes, buffer 2 is 0 bytes */
636 card->tx_buffer[i*4 + 1] = 1536; 635 card->tx_buffer[i*4 + 1] = cpu_to_le32(1536);
637 if (i==NUMDESCRIPTORS-1) 636 if (i == NUMDESCRIPTORS - 1) /* bit 25 is "last descriptor" */
638 card->tx_buffer[i*4 + 1] |= (1 << 25); /* bit 25 is "last descriptor" */ 637 card->tx_buffer[i*4 + 1] |= cpu_to_le32(1 << 25);
639 638
640 /* Tx Descr2: address of the buffer 639 /* Tx Descr2: address of the buffer
641 we store the buffer at the 2nd half of the page */ 640 we store the buffer at the 2nd half of the page */
642 address = (unsigned long) card->tx_dma_handle; 641 address = card->tx_dma_handle;
643 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]); 642 card->tx_buffer[i*4 + 2] = cpu_to_le32(address + bufferoffsets[i]);
644 /* Tx Desc3: address of 2nd buffer -> 0 */ 643 /* Tx Desc3: address of 2nd buffer -> 0 */
645 card->tx_buffer[i*4 + 3] = 0; 644 card->tx_buffer[i*4 + 3] = 0;
@@ -647,9 +646,8 @@ static void setup_descriptors(struct xircom_private *card)
647 646
648 wmb(); 647 wmb();
649 /* wite the transmit descriptor ring to the card */ 648 /* wite the transmit descriptor ring to the card */
650 address = (unsigned long) card->tx_dma_handle; 649 address = card->tx_dma_handle;
651 val =cpu_to_le32(address); 650 outl(address, card->io_port + CSR4); /* xmit descr list address */
652 outl(val, card->io_port + CSR4); /* xmit descr list address */
653 651
654 leave("setup_descriptors"); 652 leave("setup_descriptors");
655} 653}
@@ -1180,7 +1178,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1180 int status; 1178 int status;
1181 1179
1182 enter("investigate_read_descriptor"); 1180 enter("investigate_read_descriptor");
1183 status = card->rx_buffer[4*descnr]; 1181 status = le32_to_cpu(card->rx_buffer[4*descnr]);
1184 1182
1185 if ((status > 0)) { /* packet received */ 1183 if ((status > 0)) { /* packet received */
1186 1184
@@ -1210,7 +1208,7 @@ static void investigate_read_descriptor(struct net_device *dev,struct xircom_pri
1210 1208
1211 out: 1209 out:
1212 /* give the buffer back to the card */ 1210 /* give the buffer back to the card */
1213 card->rx_buffer[4*descnr] = 0x80000000; 1211 card->rx_buffer[4*descnr] = cpu_to_le32(0x80000000);
1214 trigger_receive(card); 1212 trigger_receive(card);
1215 } 1213 }
1216 1214
@@ -1226,7 +1224,7 @@ static void investigate_write_descriptor(struct net_device *dev, struct xircom_p
1226 1224
1227 enter("investigate_write_descriptor"); 1225 enter("investigate_write_descriptor");
1228 1226
1229 status = card->tx_buffer[4*descnr]; 1227 status = le32_to_cpu(card->tx_buffer[4*descnr]);
1230#if 0 1228#if 0
1231 if (status & 0x8000) { /* Major error */ 1229 if (status & 0x8000) { /* Major error */
1232 printk(KERN_ERR "Major transmit error status %x \n", status); 1230 printk(KERN_ERR "Major transmit error status %x \n", status);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 1f7644695976..f8b8c71187a0 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -610,7 +610,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
610 tun->flags &= ~TUN_PERSIST; 610 tun->flags &= ~TUN_PERSIST;
611 611
612 DBG(KERN_INFO "%s: persist %s\n", 612 DBG(KERN_INFO "%s: persist %s\n",
613 tun->dev->name, arg ? "disabled" : "enabled"); 613 tun->dev->name, arg ? "enabled" : "disabled");
614 break; 614 break;
615 615
616 case TUNSETOWNER: 616 case TUNSETOWNER:
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 94ac5869bb18..f50cb520dffb 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
813 first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; 813 first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID;
814 first_txd->numDesc = 0; 814 first_txd->numDesc = 0;
815 first_txd->len = 0; 815 first_txd->len = 0;
816 first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; 816 first_txd->tx_addr = (u64)((unsigned long) skb);
817 first_txd->addrHi = (u64)((unsigned long) skb) >> 32;
818 first_txd->processFlags = 0; 817 first_txd->processFlags = 0;
819 818
820 if(skb->ip_summed == CHECKSUM_PARTIAL) { 819 if(skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
850 PCI_DMA_TODEVICE); 849 PCI_DMA_TODEVICE);
851 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; 850 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
852 txd->len = cpu_to_le16(skb->len); 851 txd->len = cpu_to_le16(skb->len);
853 txd->addr = cpu_to_le32(skb_dma); 852 txd->frag.addr = cpu_to_le32(skb_dma);
854 txd->addrHi = 0; 853 txd->frag.addrHi = 0;
855 first_txd->numDesc++; 854 first_txd->numDesc++;
856 } else { 855 } else {
857 int i, len; 856 int i, len;
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
861 PCI_DMA_TODEVICE); 860 PCI_DMA_TODEVICE);
862 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; 861 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
863 txd->len = cpu_to_le16(len); 862 txd->len = cpu_to_le16(len);
864 txd->addr = cpu_to_le32(skb_dma); 863 txd->frag.addr = cpu_to_le32(skb_dma);
865 txd->addrHi = 0; 864 txd->frag.addrHi = 0;
866 first_txd->numDesc++; 865 first_txd->numDesc++;
867 866
868 for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 867 for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
880 PCI_DMA_TODEVICE); 879 PCI_DMA_TODEVICE);
881 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; 880 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
882 txd->len = cpu_to_le16(len); 881 txd->len = cpu_to_le16(len);
883 txd->addr = cpu_to_le32(skb_dma); 882 txd->frag.addr = cpu_to_le32(skb_dma);
884 txd->addrHi = 0; 883 txd->frag.addrHi = 0;
885 first_txd->numDesc++; 884 first_txd->numDesc++;
886 } 885 }
887 } 886 }
@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp)
977 * ethtool_ops->get_{strings,stats}() 976 * ethtool_ops->get_{strings,stats}()
978 */ 977 */
979 stats->tx_packets = le32_to_cpu(s->txPackets); 978 stats->tx_packets = le32_to_cpu(s->txPackets);
980 stats->tx_bytes = le32_to_cpu(s->txBytes); 979 stats->tx_bytes = le64_to_cpu(s->txBytes);
981 stats->tx_errors = le32_to_cpu(s->txCarrierLost); 980 stats->tx_errors = le32_to_cpu(s->txCarrierLost);
982 stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); 981 stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost);
983 stats->collisions = le32_to_cpu(s->txMultipleCollisions); 982 stats->collisions = le32_to_cpu(s->txMultipleCollisions);
984 stats->rx_packets = le32_to_cpu(s->rxPacketsGood); 983 stats->rx_packets = le32_to_cpu(s->rxPacketsGood);
985 stats->rx_bytes = le32_to_cpu(s->rxBytesGood); 984 stats->rx_bytes = le64_to_cpu(s->rxBytesGood);
986 stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); 985 stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns);
987 stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + 986 stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) +
988 le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); 987 le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors);
@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1056 if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { 1055 if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
1057 strcpy(info->fw_version, "Unknown runtime"); 1056 strcpy(info->fw_version, "Unknown runtime");
1058 } else { 1057 } else {
1059 u32 sleep_ver = xp_resp[0].parm2; 1058 u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
1060 snprintf(info->fw_version, 32, "%02x.%03x.%03x", 1059 snprintf(info->fw_version, 32, "%02x.%03x.%03x",
1061 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, 1060 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
1062 sleep_ver & 0xfff); 1061 sleep_ver & 0xfff);
@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1157 } 1156 }
1158 1157
1159 INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); 1158 INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT);
1160 xp_cmd.parm1 = cpu_to_le16(xcvr); 1159 xp_cmd.parm1 = xcvr;
1161 err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); 1160 err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
1162 if(err < 0) 1161 if(err < 0)
1163 goto out; 1162 goto out;
@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp)
1320 tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; 1319 tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY;
1321 tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; 1320 tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY;
1322 1321
1323 tp->txlo_dma_addr = iface->txLoAddr; 1322 tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr);
1324 tp->card_state = Sleeping; 1323 tp->card_state = Sleeping;
1325 smp_wmb(); 1324 smp_wmb();
1326 1325
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp)
1358 u8 *image_data; 1357 u8 *image_data;
1359 void *dpage; 1358 void *dpage;
1360 dma_addr_t dpage_dma; 1359 dma_addr_t dpage_dma;
1361 unsigned int csum; 1360 __sum16 csum;
1362 u32 irqEnabled; 1361 u32 irqEnabled;
1363 u32 irqMasked; 1362 u32 irqMasked;
1364 u32 numSections; 1363 u32 numSections;
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp)
1450 * summing. Fortunately, due to the properties of 1449 * summing. Fortunately, due to the properties of
1451 * the checksum, we can do this once, at the end. 1450 * the checksum, we can do this once, at the end.
1452 */ 1451 */
1453 csum = csum_partial_copy_nocheck(image_data, dpage, 1452 csum = csum_fold(csum_partial_copy_nocheck(image_data,
1454 len, 0); 1453 dpage, len,
1455 csum = csum_fold(csum); 1454 0));
1456 csum = le16_to_cpu(csum);
1457 1455
1458 iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); 1456 iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
1459 iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); 1457 iowrite32(le16_to_cpu((__force __le16)csum),
1458 ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
1460 iowrite32(load_addr, 1459 iowrite32(load_addr,
1461 ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); 1460 ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
1462 iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); 1461 iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
1551 if(type == TYPHOON_TX_DESC) { 1550 if(type == TYPHOON_TX_DESC) {
1552 /* This tx_desc describes a packet. 1551 /* This tx_desc describes a packet.
1553 */ 1552 */
1554 unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); 1553 unsigned long ptr = tx->tx_addr;
1555 struct sk_buff *skb = (struct sk_buff *) ptr; 1554 struct sk_buff *skb = (struct sk_buff *) ptr;
1556 dev_kfree_skb_irq(skb); 1555 dev_kfree_skb_irq(skb);
1557 } else if(type == TYPHOON_FRAG_DESC) { 1556 } else if(type == TYPHOON_FRAG_DESC) {
1558 /* This tx_desc describes a memory mapping. Free it. 1557 /* This tx_desc describes a memory mapping. Free it.
1559 */ 1558 */
1560 skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); 1559 skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr);
1561 dma_len = le16_to_cpu(tx->len); 1560 dma_len = le16_to_cpu(tx->len);
1562 pci_unmap_single(tp->pdev, skb_dma, dma_len, 1561 pci_unmap_single(tp->pdev, skb_dma, dma_len,
1563 PCI_DMA_TODEVICE); 1562 PCI_DMA_TODEVICE);
@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx)
1596 struct rx_free *r; 1595 struct rx_free *r;
1597 1596
1598 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == 1597 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
1599 indexes->rxBuffCleared) { 1598 le32_to_cpu(indexes->rxBuffCleared)) {
1600 /* no room in ring, just drop the skb 1599 /* no room in ring, just drop the skb
1601 */ 1600 */
1602 dev_kfree_skb_any(rxb->skb); 1601 dev_kfree_skb_any(rxb->skb);
@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
1627 rxb->skb = NULL; 1626 rxb->skb = NULL;
1628 1627
1629 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == 1628 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
1630 indexes->rxBuffCleared) 1629 le32_to_cpu(indexes->rxBuffCleared))
1631 return -ENOMEM; 1630 return -ENOMEM;
1632 1631
1633 skb = dev_alloc_skb(PKT_BUF_SZ); 1632 skb = dev_alloc_skb(PKT_BUF_SZ);
diff --git a/drivers/net/typhoon.h b/drivers/net/typhoon.h
index 19df20889b82..dd7022ca7354 100644
--- a/drivers/net/typhoon.h
+++ b/drivers/net/typhoon.h
@@ -73,7 +73,7 @@ struct typhoon_indexes {
73 volatile __le32 txLoCleared; 73 volatile __le32 txLoCleared;
74 volatile __le32 txHiCleared; 74 volatile __le32 txHiCleared;
75 volatile __le32 rxLoReady; 75 volatile __le32 rxLoReady;
76 volatile __u32 rxBuffCleared; /* AV: really? */ 76 volatile __le32 rxBuffCleared;
77 volatile __le32 cmdCleared; 77 volatile __le32 cmdCleared;
78 volatile __le32 respReady; 78 volatile __le32 respReady;
79 volatile __le32 rxHiReady; 79 volatile __le32 rxHiReady;
@@ -166,8 +166,13 @@ struct tx_desc {
166#define TYPHOON_DESC_VALID 0x80 166#define TYPHOON_DESC_VALID 0x80
167 u8 numDesc; 167 u8 numDesc;
168 __le16 len; 168 __le16 len;
169 u32 addr; 169 union {
170 u32 addrHi; 170 struct {
171 __le32 addr;
172 __le32 addrHi;
173 } frag;
174 u64 tx_addr; /* opaque for hardware, for TX_DESC */
175 };
171 __le32 processFlags; 176 __le32 processFlags;
172#define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) 177#define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001)
173#define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) 178#define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002)
@@ -240,8 +245,8 @@ struct rx_desc {
240 u8 flags; 245 u8 flags;
241 u8 numDesc; 246 u8 numDesc;
242 __le16 frameLen; 247 __le16 frameLen;
243 u32 addr; 248 u32 addr; /* opaque, comes from virtAddr */
244 u32 addrHi; 249 u32 addrHi; /* opaque, comes from virtAddrHi */
245 __le32 rxStatus; 250 __le32 rxStatus;
246#define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) 251#define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000)
247#define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) 252#define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001)
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 61daa096de66..569028b2baf2 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -172,45 +172,76 @@ struct asix_data {
172}; 172};
173 173
174struct ax88172_int_data { 174struct ax88172_int_data {
175 u16 res1; 175 __le16 res1;
176 u8 link; 176 u8 link;
177 u16 res2; 177 __le16 res2;
178 u8 status; 178 u8 status;
179 u16 res3; 179 __le16 res3;
180} __attribute__ ((packed)); 180} __attribute__ ((packed));
181 181
182static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 182static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
183 u16 size, void *data) 183 u16 size, void *data)
184{ 184{
185 void *buf;
186 int err = -ENOMEM;
187
185 devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 188 devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
186 cmd, value, index, size); 189 cmd, value, index, size);
187 return usb_control_msg( 190
191 buf = kmalloc(size, GFP_KERNEL);
192 if (!buf)
193 goto out;
194
195 err = usb_control_msg(
188 dev->udev, 196 dev->udev,
189 usb_rcvctrlpipe(dev->udev, 0), 197 usb_rcvctrlpipe(dev->udev, 0),
190 cmd, 198 cmd,
191 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 199 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
192 value, 200 value,
193 index, 201 index,
194 data, 202 buf,
195 size, 203 size,
196 USB_CTRL_GET_TIMEOUT); 204 USB_CTRL_GET_TIMEOUT);
205 if (err == size)
206 memcpy(data, buf, size);
207 else if (err >= 0)
208 err = -EINVAL;
209 kfree(buf);
210
211out:
212 return err;
197} 213}
198 214
199static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 215static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
200 u16 size, void *data) 216 u16 size, void *data)
201{ 217{
218 void *buf = NULL;
219 int err = -ENOMEM;
220
202 devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 221 devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
203 cmd, value, index, size); 222 cmd, value, index, size);
204 return usb_control_msg( 223
224 if (data) {
225 buf = kmalloc(size, GFP_KERNEL);
226 if (!buf)
227 goto out;
228 memcpy(buf, data, size);
229 }
230
231 err = usb_control_msg(
205 dev->udev, 232 dev->udev,
206 usb_sndctrlpipe(dev->udev, 0), 233 usb_sndctrlpipe(dev->udev, 0),
207 cmd, 234 cmd,
208 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 235 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
209 value, 236 value,
210 index, 237 index,
211 data, 238 buf,
212 size, 239 size,
213 USB_CTRL_SET_TIMEOUT); 240 USB_CTRL_SET_TIMEOUT);
241 kfree(buf);
242
243out:
244 return err;
214} 245}
215 246
216static void asix_async_cmd_callback(struct urb *urb) 247static void asix_async_cmd_callback(struct urb *urb)
@@ -402,25 +433,19 @@ static inline int asix_set_hw_mii(struct usbnet *dev)
402 433
403static inline int asix_get_phy_addr(struct usbnet *dev) 434static inline int asix_get_phy_addr(struct usbnet *dev)
404{ 435{
405 int ret = 0; 436 u8 buf[2];
406 void *buf; 437 int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);
407 438
408 devdbg(dev, "asix_get_phy_addr()"); 439 devdbg(dev, "asix_get_phy_addr()");
409 440
410 buf = kmalloc(2, GFP_KERNEL); 441 if (ret < 0) {
411 if (!buf)
412 goto out1;
413
414 if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID,
415 0, 0, 2, buf)) < 2) {
416 deverr(dev, "Error reading PHYID register: %02x", ret); 442 deverr(dev, "Error reading PHYID register: %02x", ret);
417 goto out2; 443 goto out;
418 } 444 }
419 devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf)); 445 devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf));
420 ret = *((u8 *)buf + 1); 446 ret = buf[1];
421out2: 447
422 kfree(buf); 448out:
423out1:
424 return ret; 449 return ret;
425} 450}
426 451
@@ -437,22 +462,15 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags)
437 462
438static u16 asix_read_rx_ctl(struct usbnet *dev) 463static u16 asix_read_rx_ctl(struct usbnet *dev)
439{ 464{
440 u16 ret = 0; 465 __le16 v;
441 void *buf; 466 int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v);
442
443 buf = kmalloc(2, GFP_KERNEL);
444 if (!buf)
445 goto out1;
446 467
447 if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 468 if (ret < 0) {
448 0, 0, 2, buf)) < 2) {
449 deverr(dev, "Error reading RX_CTL register: %02x", ret); 469 deverr(dev, "Error reading RX_CTL register: %02x", ret);
450 goto out2; 470 goto out;
451 } 471 }
452 ret = le16_to_cpu(*((u16 *)buf)); 472 ret = le16_to_cpu(v);
453out2: 473out:
454 kfree(buf);
455out1:
456 return ret; 474 return ret;
457} 475}
458 476
@@ -471,22 +489,15 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
471 489
472static u16 asix_read_medium_status(struct usbnet *dev) 490static u16 asix_read_medium_status(struct usbnet *dev)
473{ 491{
474 u16 ret = 0; 492 __le16 v;
475 void *buf; 493 int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v);
476 494
477 buf = kmalloc(2, GFP_KERNEL); 495 if (ret < 0) {
478 if (!buf)
479 goto out1;
480
481 if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS,
482 0, 0, 2, buf)) < 2) {
483 deverr(dev, "Error reading Medium Status register: %02x", ret); 496 deverr(dev, "Error reading Medium Status register: %02x", ret);
484 goto out2; 497 goto out;
485 } 498 }
486 ret = le16_to_cpu(*((u16 *)buf)); 499 ret = le16_to_cpu(v);
487out2: 500out:
488 kfree(buf);
489out1:
490 return ret; 501 return ret;
491} 502}
492 503
@@ -568,31 +579,30 @@ static void asix_set_multicast(struct net_device *net)
568static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) 579static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
569{ 580{
570 struct usbnet *dev = netdev_priv(netdev); 581 struct usbnet *dev = netdev_priv(netdev);
571 u16 res; 582 __le16 res;
572 583
573 mutex_lock(&dev->phy_mutex); 584 mutex_lock(&dev->phy_mutex);
574 asix_set_sw_mii(dev); 585 asix_set_sw_mii(dev);
575 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, 586 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
576 (__u16)loc, 2, (u16 *)&res); 587 (__u16)loc, 2, &res);
577 asix_set_hw_mii(dev); 588 asix_set_hw_mii(dev);
578 mutex_unlock(&dev->phy_mutex); 589 mutex_unlock(&dev->phy_mutex);
579 590
580 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff)); 591 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res));
581 592
582 return le16_to_cpu(res & 0xffff); 593 return le16_to_cpu(res);
583} 594}
584 595
585static void 596static void
586asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) 597asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
587{ 598{
588 struct usbnet *dev = netdev_priv(netdev); 599 struct usbnet *dev = netdev_priv(netdev);
589 u16 res = cpu_to_le16(val); 600 __le16 res = cpu_to_le16(val);
590 601
591 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); 602 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val);
592 mutex_lock(&dev->phy_mutex); 603 mutex_lock(&dev->phy_mutex);
593 asix_set_sw_mii(dev); 604 asix_set_sw_mii(dev);
594 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, 605 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res);
595 (__u16)loc, 2, (u16 *)&res);
596 asix_set_hw_mii(dev); 606 asix_set_hw_mii(dev);
597 mutex_unlock(&dev->phy_mutex); 607 mutex_unlock(&dev->phy_mutex);
598} 608}
@@ -644,7 +654,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
644{ 654{
645 struct usbnet *dev = netdev_priv(net); 655 struct usbnet *dev = netdev_priv(net);
646 u8 opt = 0; 656 u8 opt = 0;
647 u8 buf[1];
648 657
649 if (wolinfo->wolopts & WAKE_PHY) 658 if (wolinfo->wolopts & WAKE_PHY)
650 opt |= AX_MONITOR_LINK; 659 opt |= AX_MONITOR_LINK;
@@ -654,7 +663,7 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
654 opt |= AX_MONITOR_MODE; 663 opt |= AX_MONITOR_MODE;
655 664
656 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, 665 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
657 opt, 0, 0, &buf) < 0) 666 opt, 0, 0, NULL) < 0)
658 return -EINVAL; 667 return -EINVAL;
659 668
660 return 0; 669 return 0;
@@ -672,7 +681,7 @@ static int asix_get_eeprom(struct net_device *net,
672 struct ethtool_eeprom *eeprom, u8 *data) 681 struct ethtool_eeprom *eeprom, u8 *data)
673{ 682{
674 struct usbnet *dev = netdev_priv(net); 683 struct usbnet *dev = netdev_priv(net);
675 u16 *ebuf = (u16 *)data; 684 __le16 *ebuf = (__le16 *)data;
676 int i; 685 int i;
677 686
678 /* Crude hack to ensure that we don't overwrite memory 687 /* Crude hack to ensure that we don't overwrite memory
@@ -801,7 +810,7 @@ static int ax88172_link_reset(struct usbnet *dev)
801static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) 810static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
802{ 811{
803 int ret = 0; 812 int ret = 0;
804 void *buf; 813 u8 buf[ETH_ALEN];
805 int i; 814 int i;
806 unsigned long gpio_bits = dev->driver_info->data; 815 unsigned long gpio_bits = dev->driver_info->data;
807 struct asix_data *data = (struct asix_data *)&dev->data; 816 struct asix_data *data = (struct asix_data *)&dev->data;
@@ -810,30 +819,23 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
810 819
811 usbnet_get_endpoints(dev,intf); 820 usbnet_get_endpoints(dev,intf);
812 821
813 buf = kmalloc(ETH_ALEN, GFP_KERNEL);
814 if(!buf) {
815 ret = -ENOMEM;
816 goto out1;
817 }
818
819 /* Toggle the GPIOs in a manufacturer/model specific way */ 822 /* Toggle the GPIOs in a manufacturer/model specific way */
820 for (i = 2; i >= 0; i--) { 823 for (i = 2; i >= 0; i--) {
821 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, 824 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
822 (gpio_bits >> (i * 8)) & 0xff, 0, 0, 825 (gpio_bits >> (i * 8)) & 0xff, 0, 0,
823 buf)) < 0) 826 NULL)) < 0)
824 goto out2; 827 goto out;
825 msleep(5); 828 msleep(5);
826 } 829 }
827 830
828 if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) 831 if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0)
829 goto out2; 832 goto out;
830 833
831 /* Get the MAC address */ 834 /* Get the MAC address */
832 memset(buf, 0, ETH_ALEN);
833 if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 835 if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID,
834 0, 0, 6, buf)) < 0) { 836 0, 0, ETH_ALEN, buf)) < 0) {
835 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 837 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
836 goto out2; 838 goto out;
837 } 839 }
838 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 840 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
839 841
@@ -855,9 +857,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
855 mii_nway_restart(&dev->mii); 857 mii_nway_restart(&dev->mii);
856 858
857 return 0; 859 return 0;
858out2: 860
859 kfree(buf); 861out:
860out1:
861 return ret; 862 return ret;
862} 863}
863 864
@@ -900,66 +901,58 @@ static int ax88772_link_reset(struct usbnet *dev)
900static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) 901static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
901{ 902{
902 int ret, embd_phy; 903 int ret, embd_phy;
903 void *buf;
904 u16 rx_ctl; 904 u16 rx_ctl;
905 struct asix_data *data = (struct asix_data *)&dev->data; 905 struct asix_data *data = (struct asix_data *)&dev->data;
906 u8 buf[ETH_ALEN];
906 u32 phyid; 907 u32 phyid;
907 908
908 data->eeprom_len = AX88772_EEPROM_LEN; 909 data->eeprom_len = AX88772_EEPROM_LEN;
909 910
910 usbnet_get_endpoints(dev,intf); 911 usbnet_get_endpoints(dev,intf);
911 912
912 buf = kmalloc(6, GFP_KERNEL);
913 if(!buf) {
914 dbg ("Cannot allocate memory for buffer");
915 ret = -ENOMEM;
916 goto out1;
917 }
918
919 if ((ret = asix_write_gpio(dev, 913 if ((ret = asix_write_gpio(dev,
920 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) 914 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
921 goto out2; 915 goto out;
922 916
923 /* 0x10 is the phy id of the embedded 10/100 ethernet phy */ 917 /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
924 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); 918 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
925 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 919 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
926 embd_phy, 0, 0, buf)) < 0) { 920 embd_phy, 0, 0, NULL)) < 0) {
927 dbg("Select PHY #1 failed: %d", ret); 921 dbg("Select PHY #1 failed: %d", ret);
928 goto out2; 922 goto out;
929 } 923 }
930 924
931 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) 925 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0)
932 goto out2; 926 goto out;
933 927
934 msleep(150); 928 msleep(150);
935 if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) 929 if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0)
936 goto out2; 930 goto out;
937 931
938 msleep(150); 932 msleep(150);
939 if (embd_phy) { 933 if (embd_phy) {
940 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) 934 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0)
941 goto out2; 935 goto out;
942 } 936 }
943 else { 937 else {
944 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) 938 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0)
945 goto out2; 939 goto out;
946 } 940 }
947 941
948 msleep(150); 942 msleep(150);
949 rx_ctl = asix_read_rx_ctl(dev); 943 rx_ctl = asix_read_rx_ctl(dev);
950 dbg("RX_CTL is 0x%04x after software reset", rx_ctl); 944 dbg("RX_CTL is 0x%04x after software reset", rx_ctl);
951 if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) 945 if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0)
952 goto out2; 946 goto out;
953 947
954 rx_ctl = asix_read_rx_ctl(dev); 948 rx_ctl = asix_read_rx_ctl(dev);
955 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); 949 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl);
956 950
957 /* Get the MAC address */ 951 /* Get the MAC address */
958 memset(buf, 0, ETH_ALEN);
959 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 952 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
960 0, 0, ETH_ALEN, buf)) < 0) { 953 0, 0, ETH_ALEN, buf)) < 0) {
961 dbg("Failed to read MAC address: %d", ret); 954 dbg("Failed to read MAC address: %d", ret);
962 goto out2; 955 goto out;
963 } 956 }
964 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 957 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
965 958
@@ -976,12 +969,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
976 dbg("PHYID=0x%08x", phyid); 969 dbg("PHYID=0x%08x", phyid);
977 970
978 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) 971 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
979 goto out2; 972 goto out;
980 973
981 msleep(150); 974 msleep(150);
982 975
983 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) 976 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
984 goto out2; 977 goto out;
985 978
986 msleep(150); 979 msleep(150);
987 980
@@ -994,18 +987,18 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
994 mii_nway_restart(&dev->mii); 987 mii_nway_restart(&dev->mii);
995 988
996 if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) 989 if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0)
997 goto out2; 990 goto out;
998 991
999 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, 992 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
1000 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, 993 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
1001 AX88772_IPG2_DEFAULT, 0, buf)) < 0) { 994 AX88772_IPG2_DEFAULT, 0, NULL)) < 0) {
1002 dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 995 dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
1003 goto out2; 996 goto out;
1004 } 997 }
1005 998
1006 /* Set RX_CTL to default values with 2k buffer, and enable cactus */ 999 /* Set RX_CTL to default values with 2k buffer, and enable cactus */
1007 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) 1000 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
1008 goto out2; 1001 goto out;
1009 1002
1010 rx_ctl = asix_read_rx_ctl(dev); 1003 rx_ctl = asix_read_rx_ctl(dev);
1011 dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); 1004 dbg("RX_CTL is 0x%04x after all initializations", rx_ctl);
@@ -1013,20 +1006,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1013 rx_ctl = asix_read_medium_status(dev); 1006 rx_ctl = asix_read_medium_status(dev);
1014 dbg("Medium Status is 0x%04x after all initializations", rx_ctl); 1007 dbg("Medium Status is 0x%04x after all initializations", rx_ctl);
1015 1008
1016 kfree(buf);
1017
1018 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1009 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1019 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1010 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
1020 /* hard_mtu is still the default - the device does not support 1011 /* hard_mtu is still the default - the device does not support
1021 jumbo eth frames */ 1012 jumbo eth frames */
1022 dev->rx_urb_size = 2048; 1013 dev->rx_urb_size = 2048;
1023 } 1014 }
1024
1025 return 0; 1015 return 0;
1026 1016
1027out2: 1017out:
1028 kfree(buf);
1029out1:
1030 return ret; 1018 return ret;
1031} 1019}
1032 1020
@@ -1195,23 +1183,16 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1195{ 1183{
1196 struct asix_data *data = (struct asix_data *)&dev->data; 1184 struct asix_data *data = (struct asix_data *)&dev->data;
1197 int ret; 1185 int ret;
1198 void *buf; 1186 u8 buf[ETH_ALEN];
1199 u16 eeprom; 1187 __le16 eeprom;
1188 u8 status;
1200 int gpio0 = 0; 1189 int gpio0 = 0;
1201 u32 phyid; 1190 u32 phyid;
1202 1191
1203 usbnet_get_endpoints(dev,intf); 1192 usbnet_get_endpoints(dev,intf);
1204 1193
1205 buf = kmalloc(6, GFP_KERNEL); 1194 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
1206 if(!buf) { 1195 dbg("GPIO Status: 0x%04x", status);
1207 dbg ("Cannot allocate memory for buffer");
1208 ret = -ENOMEM;
1209 goto out1;
1210 }
1211
1212 eeprom = 0;
1213 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &eeprom);
1214 dbg("GPIO Status: 0x%04x", eeprom);
1215 1196
1216 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); 1197 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
1217 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); 1198 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
@@ -1219,19 +1200,19 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1219 1200
1220 dbg("EEPROM index 0x17 is 0x%04x", eeprom); 1201 dbg("EEPROM index 0x17 is 0x%04x", eeprom);
1221 1202
1222 if (eeprom == 0xffff) { 1203 if (eeprom == cpu_to_le16(0xffff)) {
1223 data->phymode = PHY_MODE_MARVELL; 1204 data->phymode = PHY_MODE_MARVELL;
1224 data->ledmode = 0; 1205 data->ledmode = 0;
1225 gpio0 = 1; 1206 gpio0 = 1;
1226 } else { 1207 } else {
1227 data->phymode = eeprom & 7; 1208 data->phymode = le16_to_cpu(eeprom) & 7;
1228 data->ledmode = eeprom >> 8; 1209 data->ledmode = le16_to_cpu(eeprom) >> 8;
1229 gpio0 = (eeprom & 0x80) ? 0 : 1; 1210 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
1230 } 1211 }
1231 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); 1212 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
1232 1213
1233 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); 1214 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
1234 if ((eeprom >> 8) != 1) { 1215 if ((le16_to_cpu(eeprom) >> 8) != 1) {
1235 asix_write_gpio(dev, 0x003c, 30); 1216 asix_write_gpio(dev, 0x003c, 30);
1236 asix_write_gpio(dev, 0x001c, 300); 1217 asix_write_gpio(dev, 0x001c, 300);
1237 asix_write_gpio(dev, 0x003c, 30); 1218 asix_write_gpio(dev, 0x003c, 30);
@@ -1250,11 +1231,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1250 asix_write_rx_ctl(dev, 0); 1231 asix_write_rx_ctl(dev, 0);
1251 1232
1252 /* Get the MAC address */ 1233 /* Get the MAC address */
1253 memset(buf, 0, ETH_ALEN);
1254 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 1234 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
1255 0, 0, ETH_ALEN, buf)) < 0) { 1235 0, 0, ETH_ALEN, buf)) < 0) {
1256 dbg("Failed to read MAC address: %d", ret); 1236 dbg("Failed to read MAC address: %d", ret);
1257 goto out2; 1237 goto out;
1258 } 1238 }
1259 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 1239 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
1260 1240
@@ -1289,12 +1269,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1289 mii_nway_restart(&dev->mii); 1269 mii_nway_restart(&dev->mii);
1290 1270
1291 if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0) 1271 if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0)
1292 goto out2; 1272 goto out;
1293 1273
1294 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) 1274 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
1295 goto out2; 1275 goto out;
1296
1297 kfree(buf);
1298 1276
1299 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1277 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1300 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1278 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@ -1302,12 +1280,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1302 jumbo eth frames */ 1280 jumbo eth frames */
1303 dev->rx_urb_size = 2048; 1281 dev->rx_urb_size = 2048;
1304 } 1282 }
1305
1306 return 0; 1283 return 0;
1307 1284
1308out2: 1285out:
1309 kfree(buf);
1310out1:
1311 return ret; 1286 return ret;
1312} 1287}
1313 1288
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index 58a53a641754..569ad8bfd383 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -70,7 +70,7 @@
70#define KAWETH_TX_TIMEOUT (5 * HZ) 70#define KAWETH_TX_TIMEOUT (5 * HZ)
71#define KAWETH_SCRATCH_SIZE 32 71#define KAWETH_SCRATCH_SIZE 32
72#define KAWETH_FIRMWARE_BUF_SIZE 4096 72#define KAWETH_FIRMWARE_BUF_SIZE 4096
73#define KAWETH_CONTROL_TIMEOUT (30 * HZ) 73#define KAWETH_CONTROL_TIMEOUT (30000)
74 74
75#define KAWETH_STATUS_BROKEN 0x0000001 75#define KAWETH_STATUS_BROKEN 0x0000001
76#define KAWETH_STATUS_CLOSING 0x0000002 76#define KAWETH_STATUS_CLOSING 0x0000002
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index f55a5951733a..5ea7411e1337 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -94,7 +94,7 @@ static int mcs7830_get_reg(struct usbnet *dev, u16 index, u16 size, void *data)
94 94
95 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ, 95 ret = usb_control_msg(xdev, usb_rcvctrlpipe(xdev, 0), MCS7830_RD_BREQ,
96 MCS7830_RD_BMREQ, 0x0000, index, data, 96 MCS7830_RD_BMREQ, 0x0000, index, data,
97 size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT)); 97 size, MCS7830_CTRL_TIMEOUT);
98 return ret; 98 return ret;
99} 99}
100 100
@@ -105,7 +105,7 @@ static int mcs7830_set_reg(struct usbnet *dev, u16 index, u16 size, void *data)
105 105
106 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ, 106 ret = usb_control_msg(xdev, usb_sndctrlpipe(xdev, 0), MCS7830_WR_BREQ,
107 MCS7830_WR_BMREQ, 0x0000, index, data, 107 MCS7830_WR_BMREQ, 0x0000, index, data,
108 size, msecs_to_jiffies(MCS7830_CTRL_TIMEOUT)); 108 size, MCS7830_CTRL_TIMEOUT);
109 return ret; 109 return ret;
110} 110}
111 111
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index fdd1e034569d..3f67a29593bc 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -15,7 +15,7 @@
15 15
16#include <net/dst.h> 16#include <net/dst.h>
17#include <net/xfrm.h> 17#include <net/xfrm.h>
18#include <net/veth.h> 18#include <linux/veth.h>
19 19
20#define DRV_NAME "veth" 20#define DRV_NAME "veth"
21#define DRV_VERSION "1.0" 21#define DRV_VERSION "1.0"
@@ -459,19 +459,7 @@ static __init int veth_init(void)
459 459
460static __exit void veth_exit(void) 460static __exit void veth_exit(void)
461{ 461{
462 struct veth_priv *priv, *next; 462 rtnl_link_unregister(&veth_link_ops);
463
464 rtnl_lock();
465 /*
466 * cannot trust __rtnl_link_unregister() to unregister all
467 * devices, as each ->dellink call will remove two devices
468 * from the list at once.
469 */
470 list_for_each_entry_safe(priv, next, &veth_list, list)
471 veth_dellink(priv->dev);
472
473 __rtnl_link_unregister(&veth_link_ops);
474 rtnl_unlock();
475} 463}
476 464
477module_init(veth_init); 465module_init(veth_init);
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index 8a1778cf98d1..d3b28b01b9f9 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev)
503 dev->addr_len = 0; /* hardware address length */ 503 dev->addr_len = 0; /* hardware address length */
504 504
505 if (!chan->svc) 505 if (!chan->svc)
506 *(u16*)dev->dev_addr = htons(chan->lcn); 506 *(__be16*)dev->dev_addr = htons(chan->lcn);
507 507
508 /* Initialize hardware parameters (just for reference) */ 508 /* Initialize hardware parameters (just for reference) */
509 dev->irq = wandev->irq; 509 dev->irq = wandev->irq;
@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb,
565 const void *daddr, const void *saddr, 565 const void *daddr, const void *saddr,
566 unsigned len) 566 unsigned len)
567{ 567{
568 skb->protocol = type; 568 skb->protocol = htons(type);
569 569
570 return dev->hard_header_len; 570 return dev->hard_header_len;
571} 571}
@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
600 struct cycx_device *card = chan->card; 600 struct cycx_device *card = chan->card;
601 601
602 if (!chan->svc) 602 if (!chan->svc)
603 chan->protocol = skb->protocol; 603 chan->protocol = ntohs(skb->protocol);
604 604
605 if (card->wandev.state != WAN_CONNECTED) 605 if (card->wandev.state != WAN_CONNECTED)
606 ++chan->ifstats.tx_dropped; 606 ++chan->ifstats.tx_dropped;
607 else if (chan->svc && chan->protocol && 607 else if (chan->svc && chan->protocol &&
608 chan->protocol != skb->protocol) { 608 chan->protocol != ntohs(skb->protocol)) {
609 printk(KERN_INFO 609 printk(KERN_INFO
610 "%s: unsupported Ethertype 0x%04X on interface %s!\n", 610 "%s: unsupported Ethertype 0x%04X on interface %s!\n",
611 card->devname, skb->protocol, dev->name); 611 card->devname, ntohs(skb->protocol), dev->name);
612 ++chan->ifstats.tx_errors; 612 ++chan->ifstats.tx_errors;
613 } else if (chan->protocol == ETH_P_IP) { 613 } else if (chan->protocol == ETH_P_IP) {
614 switch (chan->state) { 614 switch (chan->state) {
@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
1401 switch (state) { 1401 switch (state) {
1402 case WAN_CONNECTED: 1402 case WAN_CONNECTED:
1403 string_state = "connected!"; 1403 string_state = "connected!";
1404 *(u16*)dev->dev_addr = htons(chan->lcn); 1404 *(__be16*)dev->dev_addr = htons(chan->lcn);
1405 netif_wake_queue(dev); 1405 netif_wake_queue(dev);
1406 reset_timer(dev); 1406 reset_timer(dev);
1407 1407
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c
index 33dc713b5301..c6f26e28e376 100644
--- a/drivers/net/wan/dscc4.c
+++ b/drivers/net/wan/dscc4.c
@@ -139,19 +139,21 @@ struct thingie {
139}; 139};
140 140
141struct TxFD { 141struct TxFD {
142 u32 state; 142 __le32 state;
143 u32 next; 143 __le32 next;
144 u32 data; 144 __le32 data;
145 u32 complete; 145 __le32 complete;
146 u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */ 146 u32 jiffies; /* Allows sizeof(TxFD) == sizeof(RxFD) + extra hack */
147 /* FWIW, datasheet calls that "dummy" and says that card
148 * never looks at it; neither does the driver */
147}; 149};
148 150
149struct RxFD { 151struct RxFD {
150 u32 state1; 152 __le32 state1;
151 u32 next; 153 __le32 next;
152 u32 data; 154 __le32 data;
153 u32 state2; 155 __le32 state2;
154 u32 end; 156 __le32 end;
155}; 157};
156 158
157#define DUMMY_SKB_SIZE 64 159#define DUMMY_SKB_SIZE 64
@@ -181,7 +183,7 @@ struct RxFD {
181#define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET) 183#define SCC_REG_START(dpriv) (SCC_START+(dpriv->dev_id)*SCC_OFFSET)
182 184
183struct dscc4_pci_priv { 185struct dscc4_pci_priv {
184 u32 *iqcfg; 186 __le32 *iqcfg;
185 int cfg_cur; 187 int cfg_cur;
186 spinlock_t lock; 188 spinlock_t lock;
187 struct pci_dev *pdev; 189 struct pci_dev *pdev;
@@ -197,8 +199,8 @@ struct dscc4_dev_priv {
197 199
198 struct RxFD *rx_fd; 200 struct RxFD *rx_fd;
199 struct TxFD *tx_fd; 201 struct TxFD *tx_fd;
200 u32 *iqrx; 202 __le32 *iqrx;
201 u32 *iqtx; 203 __le32 *iqtx;
202 204
203 /* FIXME: check all the volatile are required */ 205 /* FIXME: check all the volatile are required */
204 volatile u32 tx_current; 206 volatile u32 tx_current;
@@ -298,7 +300,7 @@ struct dscc4_dev_priv {
298#define BrrExpMask 0x00000f00 300#define BrrExpMask 0x00000f00
299#define BrrMultMask 0x0000003f 301#define BrrMultMask 0x0000003f
300#define EncodingMask 0x00700000 302#define EncodingMask 0x00700000
301#define Hold 0x40000000 303#define Hold cpu_to_le32(0x40000000)
302#define SccBusy 0x10000000 304#define SccBusy 0x10000000
303#define PowerUp 0x80000000 305#define PowerUp 0x80000000
304#define Vis 0x00001000 306#define Vis 0x00001000
@@ -307,14 +309,14 @@ struct dscc4_dev_priv {
307#define FrameRdo 0x40 309#define FrameRdo 0x40
308#define FrameCrc 0x20 310#define FrameCrc 0x20
309#define FrameRab 0x10 311#define FrameRab 0x10
310#define FrameAborted 0x00000200 312#define FrameAborted cpu_to_le32(0x00000200)
311#define FrameEnd 0x80000000 313#define FrameEnd cpu_to_le32(0x80000000)
312#define DataComplete 0x40000000 314#define DataComplete cpu_to_le32(0x40000000)
313#define LengthCheck 0x00008000 315#define LengthCheck 0x00008000
314#define SccEvt 0x02000000 316#define SccEvt 0x02000000
315#define NoAck 0x00000200 317#define NoAck 0x00000200
316#define Action 0x00000001 318#define Action 0x00000001
317#define HiDesc 0x20000000 319#define HiDesc cpu_to_le32(0x20000000)
318 320
319/* SCC events */ 321/* SCC events */
320#define RxEvt 0xf0000000 322#define RxEvt 0xf0000000
@@ -489,8 +491,8 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
489 skbuff = dpriv->tx_skbuff; 491 skbuff = dpriv->tx_skbuff;
490 for (i = 0; i < TX_RING_SIZE; i++) { 492 for (i = 0; i < TX_RING_SIZE; i++) {
491 if (*skbuff) { 493 if (*skbuff) {
492 pci_unmap_single(pdev, tx_fd->data, (*skbuff)->len, 494 pci_unmap_single(pdev, le32_to_cpu(tx_fd->data),
493 PCI_DMA_TODEVICE); 495 (*skbuff)->len, PCI_DMA_TODEVICE);
494 dev_kfree_skb(*skbuff); 496 dev_kfree_skb(*skbuff);
495 } 497 }
496 skbuff++; 498 skbuff++;
@@ -500,7 +502,7 @@ static void dscc4_release_ring(struct dscc4_dev_priv *dpriv)
500 skbuff = dpriv->rx_skbuff; 502 skbuff = dpriv->rx_skbuff;
501 for (i = 0; i < RX_RING_SIZE; i++) { 503 for (i = 0; i < RX_RING_SIZE; i++) {
502 if (*skbuff) { 504 if (*skbuff) {
503 pci_unmap_single(pdev, rx_fd->data, 505 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
504 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 506 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
505 dev_kfree_skb(*skbuff); 507 dev_kfree_skb(*skbuff);
506 } 508 }
@@ -522,10 +524,10 @@ static inline int try_get_rx_skb(struct dscc4_dev_priv *dpriv,
522 dpriv->rx_skbuff[dirty] = skb; 524 dpriv->rx_skbuff[dirty] = skb;
523 if (skb) { 525 if (skb) {
524 skb->protocol = hdlc_type_trans(skb, dev); 526 skb->protocol = hdlc_type_trans(skb, dev);
525 rx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, 527 rx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev,
526 len, PCI_DMA_FROMDEVICE); 528 skb->data, len, PCI_DMA_FROMDEVICE));
527 } else { 529 } else {
528 rx_fd->data = (u32) NULL; 530 rx_fd->data = 0;
529 ret = -1; 531 ret = -1;
530 } 532 }
531 return ret; 533 return ret;
@@ -587,7 +589,7 @@ static inline int dscc4_xpr_ack(struct dscc4_dev_priv *dpriv)
587 589
588 do { 590 do {
589 if (!(dpriv->flags & (NeedIDR | NeedIDT)) || 591 if (!(dpriv->flags & (NeedIDR | NeedIDT)) ||
590 (dpriv->iqtx[cur] & Xpr)) 592 (dpriv->iqtx[cur] & cpu_to_le32(Xpr)))
591 break; 593 break;
592 smp_rmb(); 594 smp_rmb();
593 schedule_timeout_uninterruptible(10); 595 schedule_timeout_uninterruptible(10);
@@ -650,8 +652,9 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv,
650 printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__); 652 printk(KERN_DEBUG "%s: skb=0 (%s)\n", dev->name, __FUNCTION__);
651 goto refill; 653 goto refill;
652 } 654 }
653 pkt_len = TO_SIZE(rx_fd->state2); 655 pkt_len = TO_SIZE(le32_to_cpu(rx_fd->state2));
654 pci_unmap_single(pdev, rx_fd->data, RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); 656 pci_unmap_single(pdev, le32_to_cpu(rx_fd->data),
657 RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE);
655 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { 658 if ((skb->data[--pkt_len] & FrameOk) == FrameOk) {
656 stats->rx_packets++; 659 stats->rx_packets++;
657 stats->rx_bytes += pkt_len; 660 stats->rx_bytes += pkt_len;
@@ -679,7 +682,7 @@ refill:
679 } 682 }
680 dscc4_rx_update(dpriv, dev); 683 dscc4_rx_update(dpriv, dev);
681 rx_fd->state2 = 0x00000000; 684 rx_fd->state2 = 0x00000000;
682 rx_fd->end = 0xbabeface; 685 rx_fd->end = cpu_to_le32(0xbabeface);
683} 686}
684 687
685static void dscc4_free1(struct pci_dev *pdev) 688static void dscc4_free1(struct pci_dev *pdev)
@@ -772,8 +775,8 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
772 } 775 }
773 /* Global interrupt queue */ 776 /* Global interrupt queue */
774 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1); 777 writel((u32)(((IRQ_RING_SIZE >> 5) - 1) << 20), ioaddr + IQLENR1);
775 priv->iqcfg = (u32 *) pci_alloc_consistent(pdev, 778 priv->iqcfg = (__le32 *) pci_alloc_consistent(pdev,
776 IRQ_RING_SIZE*sizeof(u32), &priv->iqcfg_dma); 779 IRQ_RING_SIZE*sizeof(__le32), &priv->iqcfg_dma);
777 if (!priv->iqcfg) 780 if (!priv->iqcfg)
778 goto err_free_irq_5; 781 goto err_free_irq_5;
779 writel(priv->iqcfg_dma, ioaddr + IQCFG); 782 writel(priv->iqcfg_dma, ioaddr + IQCFG);
@@ -786,7 +789,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
786 */ 789 */
787 for (i = 0; i < dev_per_card; i++) { 790 for (i = 0; i < dev_per_card; i++) {
788 dpriv = priv->root + i; 791 dpriv = priv->root + i;
789 dpriv->iqtx = (u32 *) pci_alloc_consistent(pdev, 792 dpriv->iqtx = (__le32 *) pci_alloc_consistent(pdev,
790 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma); 793 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqtx_dma);
791 if (!dpriv->iqtx) 794 if (!dpriv->iqtx)
792 goto err_free_iqtx_6; 795 goto err_free_iqtx_6;
@@ -794,7 +797,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev,
794 } 797 }
795 for (i = 0; i < dev_per_card; i++) { 798 for (i = 0; i < dev_per_card; i++) {
796 dpriv = priv->root + i; 799 dpriv = priv->root + i;
797 dpriv->iqrx = (u32 *) pci_alloc_consistent(pdev, 800 dpriv->iqrx = (__le32 *) pci_alloc_consistent(pdev,
798 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma); 801 IRQ_RING_SIZE*sizeof(u32), &dpriv->iqrx_dma);
799 if (!dpriv->iqrx) 802 if (!dpriv->iqrx)
800 goto err_free_iqrx_7; 803 goto err_free_iqrx_7;
@@ -1156,8 +1159,8 @@ static int dscc4_start_xmit(struct sk_buff *skb, struct net_device *dev)
1156 dpriv->tx_skbuff[next] = skb; 1159 dpriv->tx_skbuff[next] = skb;
1157 tx_fd = dpriv->tx_fd + next; 1160 tx_fd = dpriv->tx_fd + next;
1158 tx_fd->state = FrameEnd | TO_STATE_TX(skb->len); 1161 tx_fd->state = FrameEnd | TO_STATE_TX(skb->len);
1159 tx_fd->data = pci_map_single(ppriv->pdev, skb->data, skb->len, 1162 tx_fd->data = cpu_to_le32(pci_map_single(ppriv->pdev, skb->data, skb->len,
1160 PCI_DMA_TODEVICE); 1163 PCI_DMA_TODEVICE));
1161 tx_fd->complete = 0x00000000; 1164 tx_fd->complete = 0x00000000;
1162 tx_fd->jiffies = jiffies; 1165 tx_fd->jiffies = jiffies;
1163 mb(); 1166 mb();
@@ -1508,7 +1511,7 @@ static irqreturn_t dscc4_irq(int irq, void *token)
1508 if (state & Cfg) { 1511 if (state & Cfg) {
1509 if (debug > 0) 1512 if (debug > 0)
1510 printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME); 1513 printk(KERN_DEBUG "%s: CfgIV\n", DRV_NAME);
1511 if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & Arf) 1514 if (priv->iqcfg[priv->cfg_cur++%IRQ_RING_SIZE] & cpu_to_le32(Arf))
1512 printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG"); 1515 printk(KERN_ERR "%s: %s failed\n", dev->name, "CFG");
1513 if (!(state &= ~Cfg)) 1516 if (!(state &= ~Cfg))
1514 goto out; 1517 goto out;
@@ -1541,7 +1544,7 @@ static void dscc4_tx_irq(struct dscc4_pci_priv *ppriv,
1541 1544
1542try: 1545try:
1543 cur = dpriv->iqtx_current%IRQ_RING_SIZE; 1546 cur = dpriv->iqtx_current%IRQ_RING_SIZE;
1544 state = dpriv->iqtx[cur]; 1547 state = le32_to_cpu(dpriv->iqtx[cur]);
1545 if (!state) { 1548 if (!state) {
1546 if (debug > 4) 1549 if (debug > 4)
1547 printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name, 1550 printk(KERN_DEBUG "%s: Tx ISR = 0x%08x\n", dev->name,
@@ -1580,7 +1583,7 @@ try:
1580 tx_fd = dpriv->tx_fd + cur; 1583 tx_fd = dpriv->tx_fd + cur;
1581 skb = dpriv->tx_skbuff[cur]; 1584 skb = dpriv->tx_skbuff[cur];
1582 if (skb) { 1585 if (skb) {
1583 pci_unmap_single(ppriv->pdev, tx_fd->data, 1586 pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data),
1584 skb->len, PCI_DMA_TODEVICE); 1587 skb->len, PCI_DMA_TODEVICE);
1585 if (tx_fd->state & FrameEnd) { 1588 if (tx_fd->state & FrameEnd) {
1586 stats->tx_packets++; 1589 stats->tx_packets++;
@@ -1711,7 +1714,7 @@ static void dscc4_rx_irq(struct dscc4_pci_priv *priv,
1711 1714
1712try: 1715try:
1713 cur = dpriv->iqrx_current%IRQ_RING_SIZE; 1716 cur = dpriv->iqrx_current%IRQ_RING_SIZE;
1714 state = dpriv->iqrx[cur]; 1717 state = le32_to_cpu(dpriv->iqrx[cur]);
1715 if (!state) 1718 if (!state)
1716 return; 1719 return;
1717 dpriv->iqrx[cur] = 0; 1720 dpriv->iqrx[cur] = 0;
@@ -1755,7 +1758,7 @@ try:
1755 goto try; 1758 goto try;
1756 rx_fd->state1 &= ~Hold; 1759 rx_fd->state1 &= ~Hold;
1757 rx_fd->state2 = 0x00000000; 1760 rx_fd->state2 = 0x00000000;
1758 rx_fd->end = 0xbabeface; 1761 rx_fd->end = cpu_to_le32(0xbabeface);
1759 //} 1762 //}
1760 goto try; 1763 goto try;
1761 } 1764 }
@@ -1834,7 +1837,7 @@ try:
1834 hdlc_stats(dev)->rx_over_errors++; 1837 hdlc_stats(dev)->rx_over_errors++;
1835 rx_fd->state1 |= Hold; 1838 rx_fd->state1 |= Hold;
1836 rx_fd->state2 = 0x00000000; 1839 rx_fd->state2 = 0x00000000;
1837 rx_fd->end = 0xbabeface; 1840 rx_fd->end = cpu_to_le32(0xbabeface);
1838 } else 1841 } else
1839 dscc4_rx_skb(dpriv, dev); 1842 dscc4_rx_skb(dpriv, dev);
1840 } while (1); 1843 } while (1);
@@ -1904,8 +1907,9 @@ static struct sk_buff *dscc4_init_dummy_skb(struct dscc4_dev_priv *dpriv)
1904 skb_copy_to_linear_data(skb, version, 1907 skb_copy_to_linear_data(skb, version,
1905 strlen(version) % DUMMY_SKB_SIZE); 1908 strlen(version) % DUMMY_SKB_SIZE);
1906 tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE); 1909 tx_fd->state = FrameEnd | TO_STATE_TX(DUMMY_SKB_SIZE);
1907 tx_fd->data = pci_map_single(dpriv->pci_priv->pdev, skb->data, 1910 tx_fd->data = cpu_to_le32(pci_map_single(dpriv->pci_priv->pdev,
1908 DUMMY_SKB_SIZE, PCI_DMA_TODEVICE); 1911 skb->data, DUMMY_SKB_SIZE,
1912 PCI_DMA_TODEVICE));
1909 dpriv->tx_skbuff[last] = skb; 1913 dpriv->tx_skbuff[last] = skb;
1910 } 1914 }
1911 return skb; 1915 return skb;
@@ -1937,8 +1941,8 @@ static int dscc4_init_ring(struct net_device *dev)
1937 tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE); 1941 tx_fd->state = FrameEnd | TO_STATE_TX(2*DUMMY_SKB_SIZE);
1938 tx_fd->complete = 0x00000000; 1942 tx_fd->complete = 0x00000000;
1939 /* FIXME: NULL should be ok - to be tried */ 1943 /* FIXME: NULL should be ok - to be tried */
1940 tx_fd->data = dpriv->tx_fd_dma; 1944 tx_fd->data = cpu_to_le32(dpriv->tx_fd_dma);
1941 (tx_fd++)->next = (u32)(dpriv->tx_fd_dma + 1945 (tx_fd++)->next = cpu_to_le32(dpriv->tx_fd_dma +
1942 (++i%TX_RING_SIZE)*sizeof(*tx_fd)); 1946 (++i%TX_RING_SIZE)*sizeof(*tx_fd));
1943 } while (i < TX_RING_SIZE); 1947 } while (i < TX_RING_SIZE);
1944 1948
@@ -1951,12 +1955,12 @@ static int dscc4_init_ring(struct net_device *dev)
1951 /* size set by the host. Multiple of 4 bytes please */ 1955 /* size set by the host. Multiple of 4 bytes please */
1952 rx_fd->state1 = HiDesc; 1956 rx_fd->state1 = HiDesc;
1953 rx_fd->state2 = 0x00000000; 1957 rx_fd->state2 = 0x00000000;
1954 rx_fd->end = 0xbabeface; 1958 rx_fd->end = cpu_to_le32(0xbabeface);
1955 rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU); 1959 rx_fd->state1 |= TO_STATE_RX(HDLC_MAX_MRU);
1956 // FIXME: return value verifiee mais traitement suspect 1960 // FIXME: return value verifiee mais traitement suspect
1957 if (try_get_rx_skb(dpriv, dev) >= 0) 1961 if (try_get_rx_skb(dpriv, dev) >= 0)
1958 dpriv->rx_dirty++; 1962 dpriv->rx_dirty++;
1959 (rx_fd++)->next = (u32)(dpriv->rx_fd_dma + 1963 (rx_fd++)->next = cpu_to_le32(dpriv->rx_fd_dma +
1960 (++i%RX_RING_SIZE)*sizeof(*rx_fd)); 1964 (++i%RX_RING_SIZE)*sizeof(*rx_fd));
1961 } while (i < RX_RING_SIZE); 1965 } while (i < RX_RING_SIZE);
1962 1966
diff --git a/drivers/net/wan/lmc/lmc_media.c b/drivers/net/wan/lmc/lmc_media.c
index 574737b55f39..c9c878cd5c72 100644
--- a/drivers/net/wan/lmc/lmc_media.c
+++ b/drivers/net/wan/lmc/lmc_media.c
@@ -890,16 +890,8 @@ write_av9110 (lmc_softc_t * sc, u_int32_t n, u_int32_t m, u_int32_t v,
890static void 890static void
891lmc_ssi_watchdog (lmc_softc_t * const sc) 891lmc_ssi_watchdog (lmc_softc_t * const sc)
892{ 892{
893 u_int16_t mii17; 893 u_int16_t mii17 = lmc_mii_readreg (sc, 0, 17);
894 struct ssicsr2 894 if (((mii17 >> 3) & 7) == 7)
895 {
896 unsigned short dtr:1, dsr:1, rts:1, cable:3, crc:1, led0:1, led1:1,
897 led2:1, led3:1, fifo:1, ll:1, rl:1, tm:1, loop:1;
898 };
899 struct ssicsr2 *ssicsr;
900 mii17 = lmc_mii_readreg (sc, 0, 17);
901 ssicsr = (struct ssicsr2 *) &mii17;
902 if (ssicsr->cable == 7)
903 { 895 {
904 lmc_led_off (sc, LMC_MII16_LED2); 896 lmc_led_off (sc, LMC_MII16_LED2);
905 } 897 }
diff --git a/drivers/net/wan/sbni.h b/drivers/net/wan/sbni.h
index 27715e70f28b..84264510a8ed 100644
--- a/drivers/net/wan/sbni.h
+++ b/drivers/net/wan/sbni.h
@@ -44,9 +44,15 @@ enum {
44#define PR_RES 0x80 44#define PR_RES 0x80
45 45
46struct sbni_csr1 { 46struct sbni_csr1 {
47 unsigned rxl : 5; 47#ifdef __LITTLE_ENDIAN_BITFIELD
48 unsigned rate : 2; 48 u8 rxl : 5;
49 unsigned : 1; 49 u8 rate : 2;
50 u8 : 1;
51#else
52 u8 : 1;
53 u8 rate : 2;
54 u8 rxl : 5;
55#endif
50}; 56};
51 57
52/* fields in frame header */ 58/* fields in frame header */
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 5583719a0dca..2c08c0a5a0df 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -68,7 +68,7 @@ config WAVELAN
68 <http://www.tldp.org/docs.html#howto>. Some more specific 68 <http://www.tldp.org/docs.html#howto>. Some more specific
69 information is contained in 69 information is contained in
70 <file:Documentation/networking/wavelan.txt> and in the source code 70 <file:Documentation/networking/wavelan.txt> and in the source code
71 <file:drivers/net/wavelan.p.h>. 71 <file:drivers/net/wireless/wavelan.p.h>.
72 72
73 You will also need the wireless tools package available from 73 You will also need the wireless tools package available from
74 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>. 74 <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
@@ -587,15 +587,66 @@ config ADM8211
587config P54_COMMON 587config P54_COMMON
588 tristate "Softmac Prism54 support" 588 tristate "Softmac Prism54 support"
589 depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL 589 depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL
590 ---help---
591 This is common code for isl38xx based cards.
592 This module does nothing by itself - the USB/PCI frontends
593 also need to be enabled in order to support any devices.
594
595 These devices require softmac firmware which can be found at
596 http://prism54.org/
597
598 If you choose to build a module, it'll be called p54common.
590 599
591config P54_USB 600config P54_USB
592 tristate "Prism54 USB support" 601 tristate "Prism54 USB support"
593 depends on P54_COMMON && USB 602 depends on P54_COMMON && USB
594 select CRC32 603 select CRC32
604 ---help---
605 This driver is for USB isl38xx based wireless cards.
606 These are USB based adapters found in devices such as:
607
608 3COM 3CRWE254G72
609 SMC 2862W-G
610 Accton 802.11g WN4501 USB
611 Siemens Gigaset USB
612 Netgear WG121
613 Netgear WG111
614 Medion 40900, Roper Europe
615 Shuttle PN15, Airvast WM168g, IOGear GWU513
616 Linksys WUSB54G
617 Linksys WUSB54G Portable
618 DLink DWL-G120 Spinnaker
619 DLink DWL-G122
620 Belkin F5D7050 ver 1000
621 Cohiba Proto board
622 SMC 2862W-G version 2
623 U.S. Robotics U5 802.11g Adapter
624 FUJITSU E-5400 USB D1700
625 Sagem XG703A
626 DLink DWL-G120 Cohiba
627 Spinnaker Proto board
628 Linksys WUSB54AG
629 Inventel UR054G
630 Spinnaker DUT
631
632 These devices require softmac firmware which can be found at
633 http://prism54.org/
634
635 If you choose to build a module, it'll be called p54usb.
595 636
596config P54_PCI 637config P54_PCI
597 tristate "Prism54 PCI support" 638 tristate "Prism54 PCI support"
598 depends on P54_COMMON && PCI 639 depends on P54_COMMON && PCI
640 ---help---
641 This driver is for PCI isl38xx based wireless cards.
642 This driver supports most devices that are supported by the
643 fullmac prism54 driver plus many devices which are not
644 supported by the fullmac driver/firmware.
645
646 This driver requires softmac firmware which can be found at
647 http://prism54.org/
648
649 If you choose to build a module, it'll be called p54pci.
599 650
600source "drivers/net/wireless/iwlwifi/Kconfig" 651source "drivers/net/wireless/iwlwifi/Kconfig"
601source "drivers/net/wireless/hostap/Kconfig" 652source "drivers/net/wireless/hostap/Kconfig"
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index a28ad230d63e..7b6fc1ab2b90 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -273,6 +273,8 @@ enum {
273#define B43_PHYTYPE_A 0x00 273#define B43_PHYTYPE_A 0x00
274#define B43_PHYTYPE_B 0x01 274#define B43_PHYTYPE_B 0x01
275#define B43_PHYTYPE_G 0x02 275#define B43_PHYTYPE_G 0x02
276#define B43_PHYTYPE_N 0x04
277#define B43_PHYTYPE_LP 0x05
276 278
277/* PHYRegisters */ 279/* PHYRegisters */
278#define B43_PHY_ILT_A_CTRL 0x0072 280#define B43_PHY_ILT_A_CTRL 0x0072
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 284d17da17d1..08e2e56e48f4 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -39,11 +39,11 @@
39#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes)) 39#define PAD_BYTES(nr_bytes) P4D_BYTES( __LINE__ , (nr_bytes))
40 40
41/* Lightweight function to convert a frequency (in Mhz) to a channel number. */ 41/* Lightweight function to convert a frequency (in Mhz) to a channel number. */
42static inline u8 b43_freq_to_channel_a(int freq) 42static inline u8 b43_freq_to_channel_5ghz(int freq)
43{ 43{
44 return ((freq - 5000) / 5); 44 return ((freq - 5000) / 5);
45} 45}
46static inline u8 b43_freq_to_channel_bg(int freq) 46static inline u8 b43_freq_to_channel_2ghz(int freq)
47{ 47{
48 u8 channel; 48 u8 channel;
49 49
@@ -54,19 +54,13 @@ static inline u8 b43_freq_to_channel_bg(int freq)
54 54
55 return channel; 55 return channel;
56} 56}
57static inline u8 b43_freq_to_channel(struct b43_wldev *dev, int freq)
58{
59 if (dev->phy.type == B43_PHYTYPE_A)
60 return b43_freq_to_channel_a(freq);
61 return b43_freq_to_channel_bg(freq);
62}
63 57
64/* Lightweight function to convert a channel number to a frequency (in Mhz). */ 58/* Lightweight function to convert a channel number to a frequency (in Mhz). */
65static inline int b43_channel_to_freq_a(u8 channel) 59static inline int b43_channel_to_freq_5ghz(u8 channel)
66{ 60{
67 return (5000 + (5 * channel)); 61 return (5000 + (5 * channel));
68} 62}
69static inline int b43_channel_to_freq_bg(u8 channel) 63static inline int b43_channel_to_freq_2ghz(u8 channel)
70{ 64{
71 int freq; 65 int freq;
72 66
@@ -77,12 +71,6 @@ static inline int b43_channel_to_freq_bg(u8 channel)
77 71
78 return freq; 72 return freq;
79} 73}
80static inline int b43_channel_to_freq(struct b43_wldev *dev, u8 channel)
81{
82 if (dev->phy.type == B43_PHYTYPE_A)
83 return b43_channel_to_freq_a(channel);
84 return b43_channel_to_freq_bg(channel);
85}
86 74
87static inline int b43_is_cck_rate(int rate) 75static inline int b43_is_cck_rate(int rate)
88{ 76{
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 98cf70c5fd47..11f53cb1139e 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -138,8 +138,11 @@ void b43_rfkill_init(struct b43_wldev *dev)
138 rfk->rfkill->user_claim_unsupported = 1; 138 rfk->rfkill->user_claim_unsupported = 1;
139 139
140 rfk->poll_dev = input_allocate_polled_device(); 140 rfk->poll_dev = input_allocate_polled_device();
141 if (!rfk->poll_dev) 141 if (!rfk->poll_dev) {
142 goto err_free_rfk; 142 rfkill_free(rfk->rfkill);
143 goto err_freed_rfk;
144 }
145
143 rfk->poll_dev->private = dev; 146 rfk->poll_dev->private = dev;
144 rfk->poll_dev->poll = b43_rfkill_poll; 147 rfk->poll_dev->poll = b43_rfkill_poll;
145 rfk->poll_dev->poll_interval = 1000; /* msecs */ 148 rfk->poll_dev->poll_interval = 1000; /* msecs */
@@ -175,8 +178,7 @@ err_unreg_rfk:
175err_free_polldev: 178err_free_polldev:
176 input_free_polled_device(rfk->poll_dev); 179 input_free_polled_device(rfk->poll_dev);
177 rfk->poll_dev = NULL; 180 rfk->poll_dev = NULL;
178err_free_rfk: 181err_freed_rfk:
179 rfkill_free(rfk->rfkill);
180 rfk->rfkill = NULL; 182 rfk->rfkill = NULL;
181out_error: 183out_error:
182 rfk->registered = 0; 184 rfk->registered = 0;
@@ -195,6 +197,5 @@ void b43_rfkill_exit(struct b43_wldev *dev)
195 rfkill_unregister(rfk->rfkill); 197 rfkill_unregister(rfk->rfkill);
196 input_free_polled_device(rfk->poll_dev); 198 input_free_polled_device(rfk->poll_dev);
197 rfk->poll_dev = NULL; 199 rfk->poll_dev = NULL;
198 rfkill_free(rfk->rfkill);
199 rfk->rfkill = NULL; 200 rfk->rfkill = NULL;
200} 201}
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c
index 0bd6f8a348a8..3307ba1856b1 100644
--- a/drivers/net/wireless/b43/xmit.c
+++ b/drivers/net/wireless/b43/xmit.c
@@ -531,21 +531,32 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr)
531 switch (chanstat & B43_RX_CHAN_PHYTYPE) { 531 switch (chanstat & B43_RX_CHAN_PHYTYPE) {
532 case B43_PHYTYPE_A: 532 case B43_PHYTYPE_A:
533 status.phymode = MODE_IEEE80211A; 533 status.phymode = MODE_IEEE80211A;
534 status.freq = chanid; 534 B43_WARN_ON(1);
535 status.channel = b43_freq_to_channel_a(chanid); 535 /* FIXME: We don't really know which value the "chanid" contains.
536 break; 536 * So the following assignment might be wrong. */
537 case B43_PHYTYPE_B: 537 status.channel = chanid;
538 status.phymode = MODE_IEEE80211B; 538 status.freq = b43_channel_to_freq_5ghz(status.channel);
539 status.freq = chanid + 2400;
540 status.channel = b43_freq_to_channel_bg(chanid + 2400);
541 break; 539 break;
542 case B43_PHYTYPE_G: 540 case B43_PHYTYPE_G:
543 status.phymode = MODE_IEEE80211G; 541 status.phymode = MODE_IEEE80211G;
542 /* chanid is the radio channel cookie value as used
543 * to tune the radio. */
544 status.freq = chanid + 2400; 544 status.freq = chanid + 2400;
545 status.channel = b43_freq_to_channel_bg(chanid + 2400); 545 status.channel = b43_freq_to_channel_2ghz(status.freq);
546 break;
547 case B43_PHYTYPE_N:
548 status.phymode = 0xDEAD /*FIXME MODE_IEEE80211N*/;
549 /* chanid is the SHM channel cookie. Which is the plain
550 * channel number in b43. */
551 status.channel = chanid;
552 if (chanstat & B43_RX_CHAN_5GHZ)
553 status.freq = b43_freq_to_channel_5ghz(status.freq);
554 else
555 status.freq = b43_freq_to_channel_2ghz(status.freq);
546 break; 556 break;
547 default: 557 default:
548 B43_WARN_ON(1); 558 B43_WARN_ON(1);
559 goto drop;
549 } 560 }
550 561
551 dev->stats.last_rx = jiffies; 562 dev->stats.last_rx = jiffies;
diff --git a/drivers/net/wireless/b43/xmit.h b/drivers/net/wireless/b43/xmit.h
index 03bddd251618..6dc079382f7f 100644
--- a/drivers/net/wireless/b43/xmit.h
+++ b/drivers/net/wireless/b43/xmit.h
@@ -142,49 +142,56 @@ struct b43_rxhdr_fw4 {
142} __attribute__ ((__packed__)); 142} __attribute__ ((__packed__));
143 143
144/* PHY RX Status 0 */ 144/* PHY RX Status 0 */
145#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */ 145#define B43_RX_PHYST0_GAINCTL 0x4000 /* Gain Control */
146#define B43_RX_PHYST0_PLCPHCF 0x0200 146#define B43_RX_PHYST0_PLCPHCF 0x0200
147#define B43_RX_PHYST0_PLCPFV 0x0100 147#define B43_RX_PHYST0_PLCPFV 0x0100
148#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */ 148#define B43_RX_PHYST0_SHORTPRMBL 0x0080 /* Received with Short Preamble */
149#define B43_RX_PHYST0_LCRS 0x0040 149#define B43_RX_PHYST0_LCRS 0x0040
150#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */ 150#define B43_RX_PHYST0_ANT 0x0020 /* Antenna */
151#define B43_RX_PHYST0_UNSRATE 0x0010 151#define B43_RX_PHYST0_UNSRATE 0x0010
152#define B43_RX_PHYST0_CLIP 0x000C 152#define B43_RX_PHYST0_CLIP 0x000C
153#define B43_RX_PHYST0_CLIP_SHIFT 2 153#define B43_RX_PHYST0_CLIP_SHIFT 2
154#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */ 154#define B43_RX_PHYST0_FTYPE 0x0003 /* Frame type */
155#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */ 155#define B43_RX_PHYST0_CCK 0x0000 /* Frame type: CCK */
156#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */ 156#define B43_RX_PHYST0_OFDM 0x0001 /* Frame type: OFDM */
157#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */ 157#define B43_RX_PHYST0_PRE_N 0x0002 /* Pre-standard N-PHY frame */
158#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */ 158#define B43_RX_PHYST0_STD_N 0x0003 /* Standard N-PHY frame */
159 159
160/* PHY RX Status 2 */ 160/* PHY RX Status 2 */
161#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */ 161#define B43_RX_PHYST2_LNAG 0xC000 /* LNA Gain */
162#define B43_RX_PHYST2_LNAG_SHIFT 14 162#define B43_RX_PHYST2_LNAG_SHIFT 14
163#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */ 163#define B43_RX_PHYST2_PNAG 0x3C00 /* PNA Gain */
164#define B43_RX_PHYST2_PNAG_SHIFT 10 164#define B43_RX_PHYST2_PNAG_SHIFT 10
165#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */ 165#define B43_RX_PHYST2_FOFF 0x03FF /* F offset */
166 166
167/* PHY RX Status 3 */ 167/* PHY RX Status 3 */
168#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */ 168#define B43_RX_PHYST3_DIGG 0x1800 /* DIG Gain */
169#define B43_RX_PHYST3_DIGG_SHIFT 11 169#define B43_RX_PHYST3_DIGG_SHIFT 11
170#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */ 170#define B43_RX_PHYST3_TRSTATE 0x0400 /* TR state */
171 171
172/* MAC RX Status */ 172/* MAC RX Status */
173#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon send flag */ 173#define B43_RX_MAC_RXST_VALID 0x01000000 /* PHY RXST valid */
174#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */ 174#define B43_RX_MAC_TKIP_MICERR 0x00100000 /* TKIP MIC error */
175#define B43_RX_MAC_KEYIDX_SHIFT 5 175#define B43_RX_MAC_TKIP_MICATT 0x00080000 /* TKIP MIC attempted */
176#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */ 176#define B43_RX_MAC_AGGTYPE 0x00060000 /* Aggregation type */
177#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */ 177#define B43_RX_MAC_AGGTYPE_SHIFT 17
178#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */ 178#define B43_RX_MAC_AMSDU 0x00010000 /* A-MSDU mask */
179#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */ 179#define B43_RX_MAC_BEACONSENT 0x00008000 /* Beacon sent flag */
180#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */ 180#define B43_RX_MAC_KEYIDX 0x000007E0 /* Key index */
181#define B43_RX_MAC_KEYIDX_SHIFT 5
182#define B43_RX_MAC_DECERR 0x00000010 /* Decrypt error */
183#define B43_RX_MAC_DEC 0x00000008 /* Decryption attempted */
184#define B43_RX_MAC_PADDING 0x00000004 /* Pad bytes present */
185#define B43_RX_MAC_RESP 0x00000002 /* Response frame transmitted */
186#define B43_RX_MAC_FCSERR 0x00000001 /* FCS error */
181 187
182/* RX channel */ 188/* RX channel */
183#define B43_RX_CHAN_GAIN 0xFC00 /* Gain */ 189#define B43_RX_CHAN_40MHZ 0x1000 /* 40 Mhz channel width */
184#define B43_RX_CHAN_GAIN_SHIFT 10 190#define B43_RX_CHAN_5GHZ 0x0800 /* 5 Ghz band */
185#define B43_RX_CHAN_ID 0x03FC /* Channel ID */ 191#define B43_RX_CHAN_ID 0x07F8 /* Channel ID */
186#define B43_RX_CHAN_ID_SHIFT 2 192#define B43_RX_CHAN_ID_SHIFT 3
187#define B43_RX_CHAN_PHYTYPE 0x0003 /* PHY type */ 193#define B43_RX_CHAN_PHYTYPE 0x0007 /* PHY type */
194
188 195
189u8 b43_plcp_get_ratecode_cck(const u8 bitrate); 196u8 b43_plcp_get_ratecode_cck(const u8 bitrate);
190u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate); 197u8 b43_plcp_get_ratecode_ofdm(const u8 bitrate);
diff --git a/drivers/net/wireless/hostap/hostap_plx.c b/drivers/net/wireless/hostap/hostap_plx.c
index 040dc3e36410..cbf15d703201 100644
--- a/drivers/net/wireless/hostap/hostap_plx.c
+++ b/drivers/net/wireless/hostap/hostap_plx.c
@@ -608,7 +608,7 @@ static void prism2_plx_remove(struct pci_dev *pdev)
608 608
609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table); 609MODULE_DEVICE_TABLE(pci, prism2_plx_id_table);
610 610
611static struct pci_driver prism2_plx_drv_id = { 611static struct pci_driver prism2_plx_driver = {
612 .name = "hostap_plx", 612 .name = "hostap_plx",
613 .id_table = prism2_plx_id_table, 613 .id_table = prism2_plx_id_table,
614 .probe = prism2_plx_probe, 614 .probe = prism2_plx_probe,
@@ -618,13 +618,13 @@ static struct pci_driver prism2_plx_drv_id = {
618 618
619static int __init init_prism2_plx(void) 619static int __init init_prism2_plx(void)
620{ 620{
621 return pci_register_driver(&prism2_plx_drv_id); 621 return pci_register_driver(&prism2_plx_driver);
622} 622}
623 623
624 624
625static void __exit exit_prism2_plx(void) 625static void __exit exit_prism2_plx(void)
626{ 626{
627 pci_unregister_driver(&prism2_plx_drv_id); 627 pci_unregister_driver(&prism2_plx_driver);
628} 628}
629 629
630 630
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index da51f477e9df..003f73f89efa 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d,
1233{ 1233{
1234 struct ipw_priv *priv = dev_get_drvdata(d); 1234 struct ipw_priv *priv = dev_get_drvdata(d);
1235 u32 log_len = ipw_get_event_log_len(priv); 1235 u32 log_len = ipw_get_event_log_len(priv);
1236 struct ipw_event log[log_len]; 1236 u32 log_size;
1237 struct ipw_event *log;
1237 u32 len = 0, i; 1238 u32 len = 0, i;
1238 1239
1240 /* not using min() because of its strict type checking */
1241 log_size = PAGE_SIZE / sizeof(*log) > log_len ?
1242 sizeof(*log) * log_len : PAGE_SIZE;
1243 log = kzalloc(log_size, GFP_KERNEL);
1244 if (!log) {
1245 IPW_ERROR("Unable to allocate memory for log\n");
1246 return 0;
1247 }
1248 log_len = log_size / sizeof(*log);
1239 ipw_capture_event_log(priv, log_len, log); 1249 ipw_capture_event_log(priv, log_len, log);
1240 1250
1241 len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); 1251 len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d,
1244 "\n%08X%08X%08X", 1254 "\n%08X%08X%08X",
1245 log[i].time, log[i].event, log[i].data); 1255 log[i].time, log[i].event, log[i].data);
1246 len += snprintf(buf + len, PAGE_SIZE - len, "\n"); 1256 len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1257 kfree(log);
1247 return len; 1258 return len;
1248} 1259}
1249 1260
@@ -4924,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv)
4924/** 4935/**
4925 * Reclaim Tx queue entries no more used by NIC. 4936 * Reclaim Tx queue entries no more used by NIC.
4926 * 4937 *
4927 * When FW adwances 'R' index, all entries between old and 4938 * When FW advances 'R' index, all entries between old and
4928 * new 'R' index need to be reclaimed. As result, some free space 4939 * new 'R' index need to be reclaimed. As result, some free space
4929 * forms. If there is enough free space (> low mark), wake Tx queue. 4940 * forms. If there is enough free space (> low mark), wake Tx queue.
4930 * 4941 *
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3d1da0759b97..1a6b0e0edf6f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6246,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv)
6246 /* Unblock any waiting calls */ 6246 /* Unblock any waiting calls */
6247 wake_up_interruptible_all(&priv->wait_command_queue); 6247 wake_up_interruptible_all(&priv->wait_command_queue);
6248 6248
6249 iwl_cancel_deferred_work(priv);
6250
6251 /* Wipe out the EXIT_PENDING status bit if we are not actually 6249 /* Wipe out the EXIT_PENDING status bit if we are not actually
6252 * exiting the module */ 6250 * exiting the module */
6253 if (!exit_pending) 6251 if (!exit_pending)
@@ -6322,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv)
6322 mutex_lock(&priv->mutex); 6320 mutex_lock(&priv->mutex);
6323 __iwl_down(priv); 6321 __iwl_down(priv);
6324 mutex_unlock(&priv->mutex); 6322 mutex_unlock(&priv->mutex);
6323
6324 iwl_cancel_deferred_work(priv);
6325} 6325}
6326 6326
6327#define MAX_HW_RESTARTS 5 6327#define MAX_HW_RESTARTS 5
@@ -8580,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8580 8580
8581 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 8581 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
8582 8582
8583 mutex_lock(&priv->mutex);
8584 set_bit(STATUS_EXIT_PENDING, &priv->status); 8583 set_bit(STATUS_EXIT_PENDING, &priv->status);
8585 __iwl_down(priv); 8584
8586 mutex_unlock(&priv->mutex); 8585 iwl_down(priv);
8587 8586
8588 /* Free MAC hash list for ADHOC */ 8587 /* Free MAC hash list for ADHOC */
8589 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 8588 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -8642,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8642{ 8641{
8643 struct iwl_priv *priv = pci_get_drvdata(pdev); 8642 struct iwl_priv *priv = pci_get_drvdata(pdev);
8644 8643
8645 mutex_lock(&priv->mutex);
8646
8647 set_bit(STATUS_IN_SUSPEND, &priv->status); 8644 set_bit(STATUS_IN_SUSPEND, &priv->status);
8648 8645
8649 /* Take down the device; powers it off, etc. */ 8646 /* Take down the device; powers it off, etc. */
8650 __iwl_down(priv); 8647 iwl_down(priv);
8651 8648
8652 if (priv->mac80211_registered) 8649 if (priv->mac80211_registered)
8653 ieee80211_stop_queues(priv->hw); 8650 ieee80211_stop_queues(priv->hw);
@@ -8656,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8656 pci_disable_device(pdev); 8653 pci_disable_device(pdev);
8657 pci_set_power_state(pdev, PCI_D3hot); 8654 pci_set_power_state(pdev, PCI_D3hot);
8658 8655
8659 mutex_unlock(&priv->mutex);
8660
8661 return 0; 8656 return 0;
8662} 8657}
8663 8658
@@ -8715,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8715 8710
8716 printk(KERN_INFO "Coming out of suspend...\n"); 8711 printk(KERN_INFO "Coming out of suspend...\n");
8717 8712
8718 mutex_lock(&priv->mutex);
8719
8720 pci_set_power_state(pdev, PCI_D0); 8713 pci_set_power_state(pdev, PCI_D0);
8721 err = pci_enable_device(pdev); 8714 err = pci_enable_device(pdev);
8722 pci_restore_state(pdev); 8715 pci_restore_state(pdev);
@@ -8730,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8730 pci_write_config_byte(pdev, 0x41, 0x00); 8723 pci_write_config_byte(pdev, 0x41, 0x00);
8731 8724
8732 iwl_resume(priv); 8725 iwl_resume(priv);
8733 mutex_unlock(&priv->mutex);
8734 8726
8735 return 0; 8727 return 0;
8736} 8728}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index b54fe5e6d529..6cd57c220631 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6601,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv)
6601 /* Unblock any waiting calls */ 6601 /* Unblock any waiting calls */
6602 wake_up_interruptible_all(&priv->wait_command_queue); 6602 wake_up_interruptible_all(&priv->wait_command_queue);
6603 6603
6604 iwl_cancel_deferred_work(priv);
6605
6606 /* Wipe out the EXIT_PENDING status bit if we are not actually 6604 /* Wipe out the EXIT_PENDING status bit if we are not actually
6607 * exiting the module */ 6605 * exiting the module */
6608 if (!exit_pending) 6606 if (!exit_pending)
@@ -6677,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv)
6677 mutex_lock(&priv->mutex); 6675 mutex_lock(&priv->mutex);
6678 __iwl_down(priv); 6676 __iwl_down(priv);
6679 mutex_unlock(&priv->mutex); 6677 mutex_unlock(&priv->mutex);
6678
6679 iwl_cancel_deferred_work(priv);
6680} 6680}
6681 6681
6682#define MAX_HW_RESTARTS 5 6682#define MAX_HW_RESTARTS 5
@@ -9174,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9174 9174
9175 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 9175 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
9176 9176
9177 mutex_lock(&priv->mutex);
9178 set_bit(STATUS_EXIT_PENDING, &priv->status); 9177 set_bit(STATUS_EXIT_PENDING, &priv->status);
9179 __iwl_down(priv); 9178
9180 mutex_unlock(&priv->mutex); 9179 iwl_down(priv);
9181 9180
9182 /* Free MAC hash list for ADHOC */ 9181 /* Free MAC hash list for ADHOC */
9183 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 9182 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -9236,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9236{ 9235{
9237 struct iwl_priv *priv = pci_get_drvdata(pdev); 9236 struct iwl_priv *priv = pci_get_drvdata(pdev);
9238 9237
9239 mutex_lock(&priv->mutex);
9240
9241 set_bit(STATUS_IN_SUSPEND, &priv->status); 9238 set_bit(STATUS_IN_SUSPEND, &priv->status);
9242 9239
9243 /* Take down the device; powers it off, etc. */ 9240 /* Take down the device; powers it off, etc. */
9244 __iwl_down(priv); 9241 iwl_down(priv);
9245 9242
9246 if (priv->mac80211_registered) 9243 if (priv->mac80211_registered)
9247 ieee80211_stop_queues(priv->hw); 9244 ieee80211_stop_queues(priv->hw);
@@ -9250,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9250 pci_disable_device(pdev); 9247 pci_disable_device(pdev);
9251 pci_set_power_state(pdev, PCI_D3hot); 9248 pci_set_power_state(pdev, PCI_D3hot);
9252 9249
9253 mutex_unlock(&priv->mutex);
9254
9255 return 0; 9250 return 0;
9256} 9251}
9257 9252
@@ -9309,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9309 9304
9310 printk(KERN_INFO "Coming out of suspend...\n"); 9305 printk(KERN_INFO "Coming out of suspend...\n");
9311 9306
9312 mutex_lock(&priv->mutex);
9313
9314 pci_set_power_state(pdev, PCI_D0); 9307 pci_set_power_state(pdev, PCI_D0);
9315 err = pci_enable_device(pdev); 9308 err = pci_enable_device(pdev);
9316 pci_restore_state(pdev); 9309 pci_restore_state(pdev);
@@ -9324,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9324 pci_write_config_byte(pdev, 0x41, 0x00); 9317 pci_write_config_byte(pdev, 0x41, 0x00);
9325 9318
9326 iwl_resume(priv); 9319 iwl_resume(priv);
9327 mutex_unlock(&priv->mutex);
9328 9320
9329 return 0; 9321 return 0;
9330} 9322}
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index b24425f74883..4f1efb108c28 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -871,6 +871,10 @@ static int if_sdio_probe(struct sdio_func *func,
871 if (sscanf(func->card->info[i], 871 if (sscanf(func->card->info[i],
872 "ID: %x", &model) == 1) 872 "ID: %x", &model) == 1)
873 break; 873 break;
874 if (!strcmp(func->card->info[i], "IBIS Wireless SDIO Card")) {
875 model = 4;
876 break;
877 }
874 } 878 }
875 879
876 if (i == func->card->num_info) { 880 if (i == func->card->num_info) {
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 50775f9234cc..18b1f9145389 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -257,7 +257,7 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev, 257static void rt2500usb_config_mac_addr(struct rt2x00_dev *rt2x00dev,
258 __le32 *mac) 258 __le32 *mac)
259{ 259{
260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, &mac, 260 rt2500usb_register_multiwrite(rt2x00dev, MAC_CSR2, mac,
261 (3 * sizeof(__le16))); 261 (3 * sizeof(__le16)));
262} 262}
263 263
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
index 2780df00623c..04663eb31950 100644
--- a/drivers/net/wireless/rt2x00/rt2x00pci.c
+++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
@@ -124,7 +124,10 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
124 struct data_entry *entry; 124 struct data_entry *entry;
125 struct data_desc *rxd; 125 struct data_desc *rxd;
126 struct sk_buff *skb; 126 struct sk_buff *skb;
127 struct ieee80211_hdr *hdr;
127 struct rxdata_entry_desc desc; 128 struct rxdata_entry_desc desc;
129 int header_size;
130 int align;
128 u32 word; 131 u32 word;
129 132
130 while (1) { 133 while (1) {
@@ -138,17 +141,26 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
138 memset(&desc, 0x00, sizeof(desc)); 141 memset(&desc, 0x00, sizeof(desc));
139 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 142 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
140 143
144 hdr = (struct ieee80211_hdr *)entry->data_addr;
145 header_size =
146 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
147
148 /*
149 * The data behind the ieee80211 header must be
150 * aligned on a 4 byte boundary.
151 */
152 align = header_size % 4;
153
141 /* 154 /*
142 * Allocate the sk_buffer, initialize it and copy 155 * Allocate the sk_buffer, initialize it and copy
143 * all data into it. 156 * all data into it.
144 */ 157 */
145 skb = dev_alloc_skb(desc.size + NET_IP_ALIGN); 158 skb = dev_alloc_skb(desc.size + align);
146 if (!skb) 159 if (!skb)
147 return; 160 return;
148 161
149 skb_reserve(skb, NET_IP_ALIGN); 162 skb_reserve(skb, align);
150 skb_put(skb, desc.size); 163 memcpy(skb_put(skb, desc.size), entry->data_addr, desc.size);
151 memcpy(skb->data, entry->data_addr, desc.size);
152 164
153 /* 165 /*
154 * Send the frame to rt2x00lib for further processing. 166 * Send the frame to rt2x00lib for further processing.
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 1f5675dd329f..568d73847dca 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -221,7 +221,9 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
221 struct data_ring *ring = entry->ring; 221 struct data_ring *ring = entry->ring;
222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; 222 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
223 struct sk_buff *skb; 223 struct sk_buff *skb;
224 struct ieee80211_hdr *hdr;
224 struct rxdata_entry_desc desc; 225 struct rxdata_entry_desc desc;
226 int header_size;
225 int frame_size; 227 int frame_size;
226 228
227 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || 229 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -243,19 +245,37 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
243 * Allocate a new sk buffer to replace the current one. 245 * Allocate a new sk buffer to replace the current one.
244 * If allocation fails, we should drop the current frame 246 * If allocation fails, we should drop the current frame
245 * so we can recycle the existing sk buffer for the new frame. 247 * so we can recycle the existing sk buffer for the new frame.
248 * As alignment we use 2 and not NET_IP_ALIGN because we need
249 * to be sure we have 2 bytes room in the head. (NET_IP_ALIGN
250 * can be 0 on some hardware). We use these 2 bytes for frame
251 * alignment later, we assume that the chance that
252 * header_size % 4 == 2 is bigger then header_size % 2 == 0
253 * and thus optimize alignment by reserving the 2 bytes in
254 * advance.
246 */ 255 */
247 frame_size = entry->ring->data_size + entry->ring->desc_size; 256 frame_size = entry->ring->data_size + entry->ring->desc_size;
248 skb = dev_alloc_skb(frame_size + NET_IP_ALIGN); 257 skb = dev_alloc_skb(frame_size + 2);
249 if (!skb) 258 if (!skb)
250 goto skip_entry; 259 goto skip_entry;
251 260
252 skb_reserve(skb, NET_IP_ALIGN); 261 skb_reserve(skb, 2);
253 skb_put(skb, frame_size); 262 skb_put(skb, frame_size);
254 263
255 /* 264 /*
256 * Trim the skb_buffer to only contain the valid 265 * The data behind the ieee80211 header must be
257 * frame data (so ignore the device's descriptor). 266 * aligned on a 4 byte boundary.
267 * After that trim the entire buffer down to only
268 * contain the valid frame data excluding the device
269 * descriptor.
258 */ 270 */
271 hdr = (struct ieee80211_hdr *)entry->skb->data;
272 header_size =
273 ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control));
274
275 if (header_size % 4 == 0) {
276 skb_push(entry->skb, 2);
277 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
278 }
259 skb_trim(entry->skb, desc.size); 279 skb_trim(entry->skb, desc.size);
260 280
261 /* 281 /*
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 01dbef19d651..ecae968ce091 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1738,6 +1738,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1738{ 1738{
1739 struct data_ring *ring; 1739 struct data_ring *ring;
1740 struct data_entry *entry; 1740 struct data_entry *entry;
1741 struct data_entry *entry_done;
1741 struct data_desc *txd; 1742 struct data_desc *txd;
1742 u32 word; 1743 u32 word;
1743 u32 reg; 1744 u32 reg;
@@ -1791,6 +1792,17 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
1791 !rt2x00_get_field32(word, TXD_W0_VALID)) 1792 !rt2x00_get_field32(word, TXD_W0_VALID))
1792 return; 1793 return;
1793 1794
1795 entry_done = rt2x00_get_data_entry_done(ring);
1796 while (entry != entry_done) {
1797 /* Catch up. Just report any entries we missed as
1798 * failed. */
1799 WARNING(rt2x00dev,
1800 "TX status report missed for entry %p\n",
1801 entry_done);
1802 rt2x00lib_txdone(entry_done, TX_FAIL_OTHER, 0);
1803 entry_done = rt2x00_get_data_entry_done(ring);
1804 }
1805
1794 /* 1806 /*
1795 * Obtain the status about this packet. 1807 * Obtain the status about this packet.
1796 */ 1808 */
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index e454ae83e97a..bd1ab3b3afc0 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
38 {USB_DEVICE(0x0846, 0x6a00)}, 38 {USB_DEVICE(0x0846, 0x6a00)},
39 /* HP */ 39 /* HP */
40 {USB_DEVICE(0x03f0, 0xca02)}, 40 {USB_DEVICE(0x03f0, 0xca02)},
41 /* Sitecom */
42 {USB_DEVICE(0x0df6, 0x000d)},
41 {} 43 {}
42}; 44};
43 45
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 2a8fc431099f..bca37bf0f545 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -852,11 +852,6 @@ static int xennet_poll(struct napi_struct *napi, int budget)
852 852
853 spin_lock(&np->rx_lock); 853 spin_lock(&np->rx_lock);
854 854
855 if (unlikely(!netif_carrier_ok(dev))) {
856 spin_unlock(&np->rx_lock);
857 return 0;
858 }
859
860 skb_queue_head_init(&rxq); 855 skb_queue_head_init(&rxq);
861 skb_queue_head_init(&errq); 856 skb_queue_head_init(&errq);
862 skb_queue_head_init(&tmpq); 857 skb_queue_head_init(&tmpq);
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002ade531..fe6ff3e3d525 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -265,10 +265,10 @@ enum yellowfin_offsets {
265/* The Yellowfin Rx and Tx buffer descriptors. 265/* The Yellowfin Rx and Tx buffer descriptors.
266 Elements are written as 32 bit for endian portability. */ 266 Elements are written as 32 bit for endian portability. */
267struct yellowfin_desc { 267struct yellowfin_desc {
268 u32 dbdma_cmd; 268 __le32 dbdma_cmd;
269 u32 addr; 269 __le32 addr;
270 u32 branch_addr; 270 __le32 branch_addr;
271 u32 result_status; 271 __le32 result_status;
272}; 272};
273 273
274struct tx_status_words { 274struct tx_status_words {
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
922 dev->stats.tx_packets++; 922 dev->stats.tx_packets++;
923 dev->stats.tx_bytes += skb->len; 923 dev->stats.tx_bytes += skb->len;
924 /* Free the original skb. */ 924 /* Free the original skb. */
925 pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, 925 pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr),
926 skb->len, PCI_DMA_TODEVICE); 926 skb->len, PCI_DMA_TODEVICE);
927 dev_kfree_skb_irq(skb); 927 dev_kfree_skb_irq(skb);
928 yp->tx_skbuff[entry] = NULL; 928 yp->tx_skbuff[entry] = NULL;
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev)
1056 1056
1057 if(!desc->result_status) 1057 if(!desc->result_status)
1058 break; 1058 break;
1059 pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, 1059 pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr),
1060 yp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1060 yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1061 desc_status = le32_to_cpu(desc->result_status) >> 16; 1061 desc_status = le32_to_cpu(desc->result_status) >> 16;
1062 buf_addr = rx_skb->data; 1062 buf_addr = rx_skb->data;
1063 data_size = (le32_to_cpu(desc->dbdma_cmd) - 1063 data_size = (le32_to_cpu(desc->dbdma_cmd) -
1064 le32_to_cpu(desc->result_status)) & 0xffff; 1064 le32_to_cpu(desc->result_status)) & 0xffff;
1065 frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); 1065 frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2])));
1066 if (yellowfin_debug > 4) 1066 if (yellowfin_debug > 4)
1067 printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", 1067 printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n",
1068 frame_status); 1068 frame_status);
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev)
1123 if (pkt_len > rx_copybreak) { 1123 if (pkt_len > rx_copybreak) {
1124 skb_put(skb = rx_skb, pkt_len); 1124 skb_put(skb = rx_skb, pkt_len);
1125 pci_unmap_single(yp->pci_dev, 1125 pci_unmap_single(yp->pci_dev,
1126 yp->rx_ring[entry].addr, 1126 le32_to_cpu(yp->rx_ring[entry].addr),
1127 yp->rx_buf_sz, 1127 yp->rx_buf_sz,
1128 PCI_DMA_FROMDEVICE); 1128 PCI_DMA_FROMDEVICE);
1129 yp->rx_skbuff[entry] = NULL; 1129 yp->rx_skbuff[entry] = NULL;
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev)
1134 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1134 skb_reserve(skb, 2); /* 16 byte align the IP header */
1135 skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); 1135 skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
1136 skb_put(skb, pkt_len); 1136 skb_put(skb, pkt_len);
1137 pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, 1137 pci_dma_sync_single_for_device(yp->pci_dev,
1138 yp->rx_buf_sz, 1138 le32_to_cpu(desc->addr),
1139 PCI_DMA_FROMDEVICE); 1139 yp->rx_buf_sz,
1140 PCI_DMA_FROMDEVICE);
1140 } 1141 }
1141 skb->protocol = eth_type_trans(skb, dev); 1142 skb->protocol = eth_type_trans(skb, dev);
1142 netif_rx(skb); 1143 netif_rx(skb);
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev)
1252 /* Free all the skbuffs in the Rx queue. */ 1253 /* Free all the skbuffs in the Rx queue. */
1253 for (i = 0; i < RX_RING_SIZE; i++) { 1254 for (i = 0; i < RX_RING_SIZE; i++) {
1254 yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); 1255 yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
1255 yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ 1256 yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
1256 if (yp->rx_skbuff[i]) { 1257 if (yp->rx_skbuff[i]) {
1257 dev_kfree_skb(yp->rx_skbuff[i]); 1258 dev_kfree_skb(yp->rx_skbuff[i]);
1258 } 1259 }
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 2f75d695eed7..c5ca3134513a 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -455,22 +455,6 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int
455 return child; 455 return child;
456} 456}
457 457
458static void pci_enable_crs(struct pci_dev *dev)
459{
460 u16 cap, rpctl;
461 int rpcap = pci_find_capability(dev, PCI_CAP_ID_EXP);
462 if (!rpcap)
463 return;
464
465 pci_read_config_word(dev, rpcap + PCI_CAP_FLAGS, &cap);
466 if (((cap & PCI_EXP_FLAGS_TYPE) >> 4) != PCI_EXP_TYPE_ROOT_PORT)
467 return;
468
469 pci_read_config_word(dev, rpcap + PCI_EXP_RTCTL, &rpctl);
470 rpctl |= PCI_EXP_RTCTL_CRSSVE;
471 pci_write_config_word(dev, rpcap + PCI_EXP_RTCTL, rpctl);
472}
473
474static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max) 458static void pci_fixup_parent_subordinate_busnr(struct pci_bus *child, int max)
475{ 459{
476 struct pci_bus *parent = child->parent; 460 struct pci_bus *parent = child->parent;
@@ -517,8 +501,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
517 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, 501 pci_write_config_word(dev, PCI_BRIDGE_CONTROL,
518 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT); 502 bctl & ~PCI_BRIDGE_CTL_MASTER_ABORT);
519 503
520 pci_enable_crs(dev);
521
522 if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) { 504 if ((buses & 0xffff00) && !pcibios_assign_all_busses() && !is_cardbus) {
523 unsigned int cmax, busnr; 505 unsigned int cmax, busnr;
524 /* 506 /*
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 26cc4dcf4f0e..72e0bd5d80ac 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -465,6 +465,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, quirk
465DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi ); 465DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0, quirk_ich6_lpc_acpi );
466DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi ); 466DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2, quirk_ich6_lpc_acpi );
467DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi ); 467DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3, quirk_ich6_lpc_acpi );
468DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, quirk_ich6_lpc_acpi );
469DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_4, quirk_ich6_lpc_acpi );
470DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2, quirk_ich6_lpc_acpi );
471DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_4, quirk_ich6_lpc_acpi );
472DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_7, quirk_ich6_lpc_acpi );
473DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_8, quirk_ich6_lpc_acpi );
468 474
469/* 475/*
470 * VIA ACPI: One IO region pointed to by longword at 476 * VIA ACPI: One IO region pointed to by longword at
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c
index 1510d6cde3e2..4a05802213c8 100644
--- a/drivers/pcmcia/pxa2xx_lubbock.c
+++ b/drivers/pcmcia/pxa2xx_lubbock.c
@@ -213,7 +213,7 @@ static struct pcmcia_low_level lubbock_pcmcia_ops = {
213 213
214#include "pxa2xx_base.h" 214#include "pxa2xx_base.h"
215 215
216int __init pcmcia_lubbock_init(struct sa1111_dev *sadev) 216int pcmcia_lubbock_init(struct sa1111_dev *sadev)
217{ 217{
218 int ret = -ENODEV; 218 int ret = -ENODEV;
219 219
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 3c5eb374adf8..6b9840cce0f4 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -76,6 +76,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
76 int i = 0; 76 int i = 0;
77 int irq; 77 int irq;
78 int p, t; 78 int p, t;
79 static unsigned char warned;
79 80
80 if (!valid_IRQ(gsi)) 81 if (!valid_IRQ(gsi))
81 return; 82 return;
@@ -83,9 +84,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
83 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && 84 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
84 i < PNP_MAX_IRQ) 85 i < PNP_MAX_IRQ)
85 i++; 86 i++;
86 if (i >= PNP_MAX_IRQ) { 87 if (i >= PNP_MAX_IRQ && !warned) {
87 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " 88 printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
88 "resources: %d \n", PNP_MAX_IRQ); 89 "resources: %d \n", PNP_MAX_IRQ);
90 warned = 1;
89 return; 91 return;
90 } 92 }
91 /* 93 /*
@@ -169,6 +171,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
169 int bus_master, int transfer) 171 int bus_master, int transfer)
170{ 172{
171 int i = 0; 173 int i = 0;
174 static unsigned char warned;
172 175
173 while (i < PNP_MAX_DMA && 176 while (i < PNP_MAX_DMA &&
174 !(res->dma_resource[i].flags & IORESOURCE_UNSET)) 177 !(res->dma_resource[i].flags & IORESOURCE_UNSET))
@@ -183,9 +186,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
183 } 186 }
184 res->dma_resource[i].start = dma; 187 res->dma_resource[i].start = dma;
185 res->dma_resource[i].end = dma; 188 res->dma_resource[i].end = dma;
186 } else { 189 } else if (!warned) {
187 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " 190 printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
188 "resources: %d \n", PNP_MAX_DMA); 191 "resources: %d \n", PNP_MAX_DMA);
192 warned = 1;
189 } 193 }
190} 194}
191 195
@@ -193,6 +197,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
193 u64 io, u64 len, int io_decode) 197 u64 io, u64 len, int io_decode)
194{ 198{
195 int i = 0; 199 int i = 0;
200 static unsigned char warned;
196 201
197 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 202 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
198 i < PNP_MAX_PORT) 203 i < PNP_MAX_PORT)
@@ -207,9 +212,10 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
207 } 212 }
208 res->port_resource[i].start = io; 213 res->port_resource[i].start = io;
209 res->port_resource[i].end = io + len - 1; 214 res->port_resource[i].end = io + len - 1;
210 } else { 215 } else if (!warned) {
211 printk(KERN_ERR "pnpacpi: exceeded the max number of IO " 216 printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
212 "resources: %d \n", PNP_MAX_PORT); 217 "resources: %d \n", PNP_MAX_PORT);
218 warned = 1;
213 } 219 }
214} 220}
215 221
@@ -218,6 +224,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
218 int write_protect) 224 int write_protect)
219{ 225{
220 int i = 0; 226 int i = 0;
227 static unsigned char warned;
221 228
222 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 229 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
223 (i < PNP_MAX_MEM)) 230 (i < PNP_MAX_MEM))
@@ -233,9 +240,10 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
233 240
234 res->mem_resource[i].start = mem; 241 res->mem_resource[i].start = mem;
235 res->mem_resource[i].end = mem + len - 1; 242 res->mem_resource[i].end = mem + len - 1;
236 } else { 243 } else if (!warned) {
237 printk(KERN_ERR "pnpacpi: exceeded the max number of mem " 244 printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
238 "resources: %d\n", PNP_MAX_MEM); 245 "resources: %d\n", PNP_MAX_MEM);
246 warned = 1;
239 } 247 }
240} 248}
241 249
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
index 9dea585ef806..bb8d5b1eec90 100644
--- a/drivers/ps3/ps3-vuart.c
+++ b/drivers/ps3/ps3-vuart.c
@@ -1074,7 +1074,6 @@ static int ps3_vuart_probe(struct ps3_system_bus_device *dev)
1074 if (result) { 1074 if (result) {
1075 dev_dbg(&dev->core, "%s:%d: drv->probe failed\n", 1075 dev_dbg(&dev->core, "%s:%d: drv->probe failed\n",
1076 __func__, __LINE__); 1076 __func__, __LINE__);
1077 down(&vuart_bus_priv.probe_mutex);
1078 goto fail_probe; 1077 goto fail_probe;
1079 } 1078 }
1080 1079
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a6676be87843..184c7ae78519 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -732,7 +732,7 @@ config SCSI_GDTH
732 This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI) 732 This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI)
733 manufactured by Intel Corporation/ICP vortex GmbH. It is documented 733 manufactured by Intel Corporation/ICP vortex GmbH. It is documented
734 in the kernel source in <file:drivers/scsi/gdth.c> and 734 in the kernel source in <file:drivers/scsi/gdth.c> and
735 <file:drivers/scsi/gdth.h.> 735 <file:drivers/scsi/gdth.h>.
736 736
737 To compile this driver as a module, choose M here: the 737 To compile this driver as a module, choose M here: the
738 module will be called gdth. 738 module will be called gdth.
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 9dd3952516c5..38a1ee2eacd8 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -13906,7 +13906,7 @@ static int advansys_release(struct Scsi_Host *shost)
13906 13906
13907#define ASC_IOADR_TABLE_MAX_IX 11 13907#define ASC_IOADR_TABLE_MAX_IX 11
13908 13908
13909static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __devinitdata = { 13909static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] = {
13910 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190, 13910 0x100, 0x0110, 0x120, 0x0130, 0x140, 0x0150, 0x0190,
13911 0x0210, 0x0230, 0x0250, 0x0330 13911 0x0210, 0x0230, 0x0250, 0x0330
13912}; 13912};
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 146d540f6281..288640756099 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -3041,7 +3041,6 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3041 int cnt; 3041 int cnt;
3042 int req_cnt; 3042 int req_cnt;
3043 int seg_cnt; 3043 int seg_cnt;
3044 dma_addr_t dma_handle;
3045 u8 dir; 3044 u8 dir;
3046 3045
3047 ENTER("qla1280_32bit_start_scsi"); 3046 ENTER("qla1280_32bit_start_scsi");
@@ -3050,6 +3049,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp)
3050 cmd->cmnd[0]); 3049 cmd->cmnd[0]);
3051 3050
3052 /* Calculate number of entries and segments required. */ 3051 /* Calculate number of entries and segments required. */
3052 req_cnt = 1;
3053 seg_cnt = scsi_dma_map(cmd); 3053 seg_cnt = scsi_dma_map(cmd);
3054 if (seg_cnt) { 3054 if (seg_cnt) {
3055 /* 3055 /*
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a5bcf1f390b3..8ecc0470b8f3 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1831,7 +1831,7 @@ probe_out:
1831 return ret; 1831 return ret;
1832} 1832}
1833 1833
1834static void __devexit 1834static void
1835qla2x00_remove_one(struct pci_dev *pdev) 1835qla2x00_remove_one(struct pci_dev *pdev)
1836{ 1836{
1837 scsi_qla_host_t *ha; 1837 scsi_qla_host_t *ha;
@@ -2965,7 +2965,7 @@ static struct pci_driver qla2xxx_pci_driver = {
2965 }, 2965 },
2966 .id_table = qla2xxx_pci_tbl, 2966 .id_table = qla2xxx_pci_tbl,
2967 .probe = qla2x00_probe_one, 2967 .probe = qla2x00_probe_one,
2968 .remove = __devexit_p(qla2x00_remove_one), 2968 .remove = qla2x00_remove_one,
2969 .err_handler = &qla2xxx_err_handler, 2969 .err_handler = &qla2xxx_err_handler,
2970}; 2970};
2971 2971
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 0e81e4cf8876..a9ac5b1b1667 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1332,7 +1332,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret)
1332} 1332}
1333EXPORT_SYMBOL(scsi_prep_return); 1333EXPORT_SYMBOL(scsi_prep_return);
1334 1334
1335static int scsi_prep_fn(struct request_queue *q, struct request *req) 1335int scsi_prep_fn(struct request_queue *q, struct request *req)
1336{ 1336{
1337 struct scsi_device *sdev = q->queuedata; 1337 struct scsi_device *sdev = q->queuedata;
1338 int ret = BLKPREP_KILL; 1338 int ret = BLKPREP_KILL;
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index eff005951895..3f34e9376b0a 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -74,6 +74,9 @@ extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
74extern void scsi_free_queue(struct request_queue *q); 74extern void scsi_free_queue(struct request_queue *q);
75extern int scsi_init_queue(void); 75extern int scsi_init_queue(void);
76extern void scsi_exit_queue(void); 76extern void scsi_exit_queue(void);
77struct request_queue;
78struct request;
79extern int scsi_prep_fn(struct request_queue *, struct request *);
77 80
78/* scsi_proc.c */ 81/* scsi_proc.c */
79#ifdef CONFIG_SCSI_PROC_FS 82#ifdef CONFIG_SCSI_PROC_FS
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index f374fdcb6815..00b386677392 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -373,12 +373,29 @@ static int scsi_bus_resume(struct device * dev)
373 return err; 373 return err;
374} 374}
375 375
376static int scsi_bus_remove(struct device *dev)
377{
378 struct device_driver *drv = dev->driver;
379 struct scsi_device *sdev = to_scsi_device(dev);
380 int err = 0;
381
382 /* reset the prep_fn back to the default since the
383 * driver may have altered it and it's being removed */
384 blk_queue_prep_rq(sdev->request_queue, scsi_prep_fn);
385
386 if (drv && drv->remove)
387 err = drv->remove(dev);
388
389 return 0;
390}
391
376struct bus_type scsi_bus_type = { 392struct bus_type scsi_bus_type = {
377 .name = "scsi", 393 .name = "scsi",
378 .match = scsi_bus_match, 394 .match = scsi_bus_match,
379 .uevent = scsi_bus_uevent, 395 .uevent = scsi_bus_uevent,
380 .suspend = scsi_bus_suspend, 396 .suspend = scsi_bus_suspend,
381 .resume = scsi_bus_resume, 397 .resume = scsi_bus_resume,
398 .remove = scsi_bus_remove,
382}; 399};
383 400
384int scsi_sysfs_register(void) 401int scsi_sysfs_register(void)
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c
index 44a340bd937b..65c584db33bd 100644
--- a/drivers/scsi/scsi_transport_srp.c
+++ b/drivers/scsi/scsi_transport_srp.c
@@ -265,7 +265,8 @@ EXPORT_SYMBOL_GPL(srp_rport_del);
265 265
266static int do_srp_rport_del(struct device *dev, void *data) 266static int do_srp_rport_del(struct device *dev, void *data)
267{ 267{
268 srp_rport_del(dev_to_rport(dev)); 268 if (scsi_is_srp_rport(dev))
269 srp_rport_del(dev_to_rport(dev));
269 return 0; 270 return 0;
270} 271}
271 272
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
index 707c5b03bce9..a2d4a19550ab 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/serial/suncore.c
@@ -52,7 +52,7 @@ void sunserial_unregister_minors(struct uart_driver *drv, int count)
52} 52}
53EXPORT_SYMBOL(sunserial_unregister_minors); 53EXPORT_SYMBOL(sunserial_unregister_minors);
54 54
55int __init sunserial_console_match(struct console *con, struct device_node *dp, 55int sunserial_console_match(struct console *con, struct device_node *dp,
56 struct uart_driver *drv, int line) 56 struct uart_driver *drv, int line)
57{ 57{
58 int off; 58 int off;
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 81639c6be1c7..f7f8580edad8 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -184,6 +184,7 @@ int spi_bitbang_setup(struct spi_device *spi)
184 struct spi_bitbang_cs *cs = spi->controller_state; 184 struct spi_bitbang_cs *cs = spi->controller_state;
185 struct spi_bitbang *bitbang; 185 struct spi_bitbang *bitbang;
186 int retval; 186 int retval;
187 unsigned long flags;
187 188
188 bitbang = spi_master_get_devdata(spi->master); 189 bitbang = spi_master_get_devdata(spi->master);
189 190
@@ -222,12 +223,12 @@ int spi_bitbang_setup(struct spi_device *spi)
222 */ 223 */
223 224
224 /* deselect chip (low or high) */ 225 /* deselect chip (low or high) */
225 spin_lock(&bitbang->lock); 226 spin_lock_irqsave(&bitbang->lock, flags);
226 if (!bitbang->busy) { 227 if (!bitbang->busy) {
227 bitbang->chipselect(spi, BITBANG_CS_INACTIVE); 228 bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
228 ndelay(cs->nsecs); 229 ndelay(cs->nsecs);
229 } 230 }
230 spin_unlock(&bitbang->lock); 231 spin_unlock_irqrestore(&bitbang->lock, flags);
231 232
232 return 0; 233 return 0;
233} 234}
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c
index 96258c60919d..63ee5cfbefbb 100644
--- a/drivers/ssb/scan.c
+++ b/drivers/ssb/scan.c
@@ -388,6 +388,17 @@ int ssb_bus_scan(struct ssb_bus *bus,
388 case SSB_DEV_PCI: 388 case SSB_DEV_PCI:
389 case SSB_DEV_PCIE: 389 case SSB_DEV_PCIE:
390#ifdef CONFIG_SSB_DRIVER_PCICORE 390#ifdef CONFIG_SSB_DRIVER_PCICORE
391 if (bus->bustype == SSB_BUSTYPE_PCI) {
392 /* Ignore PCI cores on PCI-E cards.
393 * Ignore PCI-E cores on PCI cards. */
394 if (dev->id.coreid == SSB_DEV_PCI) {
395 if (bus->host_pci->is_pcie)
396 continue;
397 } else {
398 if (!bus->host_pci->is_pcie)
399 continue;
400 }
401 }
391 if (bus->pcicore.dev) { 402 if (bus->pcicore.dev) {
392 ssb_printk(KERN_WARNING PFX 403 ssb_printk(KERN_WARNING PFX
393 "WARNING: Multiple PCI(E) cores found\n"); 404 "WARNING: Multiple PCI(E) cores found\n");
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 9bb7f64a85cd..038e7d7b4da1 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -1318,7 +1318,7 @@ static void setup_received_irq(struct fsl_udc *udc,
1318 | USB_TYPE_STANDARD)) { 1318 | USB_TYPE_STANDARD)) {
1319 /* Note: The driver has not include OTG support yet. 1319 /* Note: The driver has not include OTG support yet.
1320 * This will be set when OTG support is added */ 1320 * This will be set when OTG support is added */
1321 if (!gadget_is_otg(udc->gadget)) 1321 if (!gadget_is_otg(&udc->gadget))
1322 break; 1322 break;
1323 else if (setup->bRequest == USB_DEVICE_B_HNP_ENABLE) 1323 else if (setup->bRequest == USB_DEVICE_B_HNP_ENABLE)
1324 udc->gadget.b_hnp_enable = 1; 1324 udc->gadget.b_hnp_enable = 1;
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index da16b5157816..22833589c4be 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -55,6 +55,7 @@ static int debug;
55static struct usb_device_id id_table [] = { 55static struct usb_device_id id_table [] = {
56 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ 56 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
57 { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ 57 { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
58 { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */
58 { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ 59 { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */
59 { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ 60 { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */
60 { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ 61 { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index feba9679ace8..7c069a02c1dd 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -447,7 +447,7 @@ static void usa26_indat_callback(struct urb *urb)
447 447
448 port = (struct usb_serial_port *) urb->context; 448 port = (struct usb_serial_port *) urb->context;
449 tty = port->tty; 449 tty = port->tty;
450 if (urb->actual_length) { 450 if (tty && urb->actual_length) {
451 /* 0x80 bit is error flag */ 451 /* 0x80 bit is error flag */
452 if ((data[0] & 0x80) == 0) { 452 if ((data[0] & 0x80) == 0) {
453 /* no errors on individual bytes, only possible overrun err*/ 453 /* no errors on individual bytes, only possible overrun err*/
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index cf8add91de05..0da1df9c79bf 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -483,6 +483,13 @@ static void pl2303_set_termios(struct usb_serial_port *port,
483 } 483 }
484 spin_unlock_irqrestore(&priv->lock, flags); 484 spin_unlock_irqrestore(&priv->lock, flags);
485 485
486 /* The PL2303 is reported to lose bytes if you change
487 serial settings even to the same values as before. Thus
488 we actually need to filter in this specific case */
489
490 if (!tty_termios_hw_change(port->tty->termios, old_termios))
491 return;
492
486 cflag = port->tty->termios->c_cflag; 493 cflag = port->tty->termios->c_cflag;
487 494
488 buf = kzalloc(7, GFP_KERNEL); 495 buf = kzalloc(7, GFP_KERNEL);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index e5c274044a5f..c295d0495f96 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -109,6 +109,7 @@ static struct usb_device_id id_table [] = {
109 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ 109 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
110 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ 110 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
111 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ 111 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
112 { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
112 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ 113 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
113 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ 114 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
114 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ 115 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
@@ -146,6 +147,7 @@ static struct usb_device_id id_table_3port [] = {
146 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ 147 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
147 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ 148 { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */
148 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ 149 { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */
150 { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Thinkpad internal) */
149 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ 151 { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */
150 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/ 152 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780*/
151 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/ 153 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781*/
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 11a3a222dfc3..7c30cc8df71e 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -801,5 +801,5 @@ module_init(atmel_lcdfb_init);
801module_exit(atmel_lcdfb_exit); 801module_exit(atmel_lcdfb_exit);
802 802
803MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver"); 803MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
804MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@rfo.atmel.com>"); 804MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
805MODULE_LICENSE("GPL"); 805MODULE_LICENSE("GPL");
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 8d81ef019c6c..08d072552233 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -259,6 +259,10 @@ static const struct fb_videomode modedb[] = {
259 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */ 259 /* 1366x768, 60 Hz, 47.403 kHz hsync, WXGA 16:9 aspect ratio */
260 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5, 260 NULL, 60, 1366, 768, 13806, 120, 10, 14, 3, 32, 5,
261 0, FB_VMODE_NONINTERLACED 261 0, FB_VMODE_NONINTERLACED
262 }, {
263 /* 1280x800, 60 Hz, 47.403 kHz hsync, WXGA 16:10 aspect ratio */
264 NULL, 60, 1280, 800, 12048, 200, 64, 24, 1, 136, 3,
265 0, FB_VMODE_NONINTERLACED
262 }, 266 },
263}; 267};
264 268
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index b3128903d673..044a423a72cb 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -443,8 +443,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
443 u32 ddr_line_length, xdr_line_length; 443 u32 ddr_line_length, xdr_line_length;
444 u64 ddr_base, xdr_base; 444 u64 ddr_base, xdr_base;
445 445
446 acquire_console_sem();
447
448 if (frame > par->num_frames - 1) { 446 if (frame > par->num_frames - 1) {
449 dev_dbg(info->device, "%s: invalid frame number (%u)\n", 447 dev_dbg(info->device, "%s: invalid frame number (%u)\n",
450 __func__, frame); 448 __func__, frame);
@@ -464,7 +462,6 @@ static int ps3fb_sync(struct fb_info *info, u32 frame)
464 xdr_line_length); 462 xdr_line_length);
465 463
466out: 464out:
467 release_console_sem();
468 return error; 465 return error;
469} 466}
470 467
@@ -479,7 +476,10 @@ static int ps3fb_release(struct fb_info *info, int user)
479 if (atomic_dec_and_test(&ps3fb.f_count)) { 476 if (atomic_dec_and_test(&ps3fb.f_count)) {
480 if (atomic_read(&ps3fb.ext_flip)) { 477 if (atomic_read(&ps3fb.ext_flip)) {
481 atomic_set(&ps3fb.ext_flip, 0); 478 atomic_set(&ps3fb.ext_flip, 0);
482 ps3fb_sync(info, 0); /* single buffer */ 479 if (!try_acquire_console_sem()) {
480 ps3fb_sync(info, 0); /* single buffer */
481 release_console_sem();
482 }
483 } 483 }
484 } 484 }
485 return 0; 485 return 0;
@@ -865,7 +865,9 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
865 break; 865 break;
866 866
867 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val); 867 dev_dbg(info->device, "PS3FB_IOCTL_FSEL:%d\n", val);
868 acquire_console_sem();
868 retval = ps3fb_sync(info, val); 869 retval = ps3fb_sync(info, val);
870 release_console_sem();
869 break; 871 break;
870 872
871 default: 873 default:
@@ -885,7 +887,9 @@ static int ps3fbd(void *arg)
885 set_current_state(TASK_INTERRUPTIBLE); 887 set_current_state(TASK_INTERRUPTIBLE);
886 if (ps3fb.is_kicked) { 888 if (ps3fb.is_kicked) {
887 ps3fb.is_kicked = 0; 889 ps3fb.is_kicked = 0;
890 acquire_console_sem();
888 ps3fb_sync(info, 0); /* single buffer */ 891 ps3fb_sync(info, 0); /* single buffer */
892 release_console_sem();
889 } 893 }
890 schedule(); 894 schedule();
891 } 895 }
@@ -1234,12 +1238,6 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1234 ps3fb_flip_ctl(0, &ps3fb); /* flip off */ 1238 ps3fb_flip_ctl(0, &ps3fb); /* flip off */
1235 ps3fb.dinfo->irq.mask = 0; 1239 ps3fb.dinfo->irq.mask = 0;
1236 1240
1237 if (info) {
1238 unregister_framebuffer(info);
1239 fb_dealloc_cmap(&info->cmap);
1240 framebuffer_release(info);
1241 }
1242
1243 ps3av_register_flip_ctl(NULL, NULL); 1241 ps3av_register_flip_ctl(NULL, NULL);
1244 if (ps3fb.task) { 1242 if (ps3fb.task) {
1245 struct task_struct *task = ps3fb.task; 1243 struct task_struct *task = ps3fb.task;
@@ -1250,6 +1248,12 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1250 free_irq(ps3fb.irq_no, &dev->core); 1248 free_irq(ps3fb.irq_no, &dev->core);
1251 ps3_irq_plug_destroy(ps3fb.irq_no); 1249 ps3_irq_plug_destroy(ps3fb.irq_no);
1252 } 1250 }
1251 if (info) {
1252 unregister_framebuffer(info);
1253 fb_dealloc_cmap(&info->cmap);
1254 framebuffer_release(info);
1255 info = dev->core.driver_data = NULL;
1256 }
1253 iounmap((u8 __iomem *)ps3fb.dinfo); 1257 iounmap((u8 __iomem *)ps3fb.dinfo);
1254 1258
1255 status = lv1_gpu_context_free(ps3fb.context_handle); 1259 status = lv1_gpu_context_free(ps3fb.context_handle);
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index 5857ccf5f6b1..b3c31d9dc591 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -488,7 +488,7 @@ static int s3c2410fb_set_par(struct fb_info *info)
488 break; 488 break;
489 } 489 }
490 490
491 info->fix.line_length = (var->width * var->bits_per_pixel) / 8; 491 info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) / 8;
492 492
493 /* activate this new configuration */ 493 /* activate this new configuration */
494 494
@@ -1026,7 +1026,7 @@ static int s3c2410fb_resume(struct platform_device *dev)
1026 clk_enable(info->clk); 1026 clk_enable(info->clk);
1027 msleep(1); 1027 msleep(1);
1028 1028
1029 s3c2410fb_init_registers(info); 1029 s3c2410fb_init_registers(fbinfo);
1030 1030
1031 return 0; 1031 return 0;
1032} 1032}
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index d1d6c0facd54..a14ef894d571 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -43,7 +43,7 @@ static struct fb_fix_screeninfo uvesafb_fix __devinitdata = {
43}; 43};
44 44
45static int mtrr __devinitdata = 3; /* enable mtrr by default */ 45static int mtrr __devinitdata = 3; /* enable mtrr by default */
46static int blank __devinitdata = 1; /* enable blanking by default */ 46static int blank = 1; /* enable blanking by default */
47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */ 47static int ypan __devinitdata = 1; /* 0: scroll, 1: ypan, 2: ywrap */
48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */ 48static int pmi_setpal __devinitdata = 1; /* use PMI for palette changes */
49static int nocrtc __devinitdata; /* ignore CRTC settings */ 49static int nocrtc __devinitdata; /* ignore CRTC settings */
@@ -1549,7 +1549,7 @@ static void __devinit uvesafb_init_info(struct fb_info *info,
1549 info->fbops->fb_pan_display = NULL; 1549 info->fbops->fb_pan_display = NULL;
1550} 1550}
1551 1551
1552static void uvesafb_init_mtrr(struct fb_info *info) 1552static void __devinit uvesafb_init_mtrr(struct fb_info *info)
1553{ 1553{
1554#ifdef CONFIG_MTRR 1554#ifdef CONFIG_MTRR
1555 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) { 1555 if (mtrr && !(info->fix.smem_start & (PAGE_SIZE - 1))) {
diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c
index 4318935678c5..112f4ec59035 100644
--- a/drivers/w1/slaves/w1_therm.c
+++ b/drivers/w1/slaves/w1_therm.c
@@ -112,7 +112,7 @@ static struct w1_therm_family_converter w1_therm_families[] = {
112 112
113static inline int w1_DS18B20_convert_temp(u8 rom[9]) 113static inline int w1_DS18B20_convert_temp(u8 rom[9])
114{ 114{
115 int t = (rom[1] << 8) | rom[0]; 115 s16 t = (rom[1] << 8) | rom[0];
116 t /= 16; 116 t /= 16;
117 return t; 117 return t;
118} 118}
@@ -204,7 +204,7 @@ static ssize_t w1_therm_read_bin(struct kobject *kobj,
204 204
205 crc = w1_calc_crc8(rom, 8); 205 crc = w1_calc_crc8(rom, 8);
206 206
207 if (rom[8] == crc && rom[0]) 207 if (rom[8] == crc)
208 verdict = 1; 208 verdict = 1;
209 } 209 }
210 } 210 }
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 070217322c9f..33e50310e9e0 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -869,11 +869,9 @@ void w1_search_process(struct w1_master *dev, u8 search_type)
869 w1_search_devices(dev, search_type, w1_slave_found); 869 w1_search_devices(dev, search_type, w1_slave_found);
870 870
871 list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) { 871 list_for_each_entry_safe(sl, sln, &dev->slist, w1_slave_entry) {
872 if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl) { 872 if (!test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags) && !--sl->ttl)
873 w1_slave_detach(sl); 873 w1_slave_detach(sl);
874 874 else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
875 dev->slave_count--;
876 } else if (test_bit(W1_SLAVE_ACTIVE, (unsigned long *)&sl->flags))
877 sl->ttl = dev->slave_ttl; 875 sl->ttl = dev->slave_ttl;
878 } 876 }
879 877
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index 6ea125eabeaa..c622a0e6c9ae 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -382,10 +382,8 @@ wdt_init(void)
382 /* we will autodetect the W83697HF/HG watchdog */ 382 /* we will autodetect the W83697HF/HG watchdog */
383 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) { 383 for (i = 0; ((!found) && (w83697hf_ioports[i] != 0)); i++) {
384 wdt_io = w83697hf_ioports[i]; 384 wdt_io = w83697hf_ioports[i];
385 if (!w83697hf_check_wdt()) { 385 if (!w83697hf_check_wdt())
386 found++; 386 found++;
387 break;
388 }
389 } 387 }
390 } else { 388 } else {
391 if (!w83697hf_check_wdt()) 389 if (!w83697hf_check_wdt())
diff --git a/fs/Kconfig b/fs/Kconfig
index 487236c65837..781b47d2f9f2 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1112,8 +1112,8 @@ config HFS_FS
1112 help 1112 help
1113 If you say Y here, you will be able to mount Macintosh-formatted 1113 If you say Y here, you will be able to mount Macintosh-formatted
1114 floppy disks and hard drive partitions with full read-write access. 1114 floppy disks and hard drive partitions with full read-write access.
1115 Please read <file:fs/hfs/HFS.txt> to learn about the available mount 1115 Please read <file:Documentation/filesystems/hfs.txt> to learn about
1116 options. 1116 the available mount options.
1117 1117
1118 To compile this file system support as a module, choose M here: the 1118 To compile this file system support as a module, choose M here: the
1119 module will be called hfs. 1119 module will be called hfs.
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index ba8de7ca260b..f0b3171842f2 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1384,7 +1384,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1384 prstatus->pr_sigpend = p->pending.signal.sig[0]; 1384 prstatus->pr_sigpend = p->pending.signal.sig[0];
1385 prstatus->pr_sighold = p->blocked.sig[0]; 1385 prstatus->pr_sighold = p->blocked.sig[0];
1386 prstatus->pr_pid = task_pid_vnr(p); 1386 prstatus->pr_pid = task_pid_vnr(p);
1387 prstatus->pr_ppid = task_pid_vnr(p->parent); 1387 prstatus->pr_ppid = task_pid_vnr(p->real_parent);
1388 prstatus->pr_pgrp = task_pgrp_vnr(p); 1388 prstatus->pr_pgrp = task_pgrp_vnr(p);
1389 prstatus->pr_sid = task_session_vnr(p); 1389 prstatus->pr_sid = task_session_vnr(p);
1390 if (thread_group_leader(p)) { 1390 if (thread_group_leader(p)) {
@@ -1430,7 +1430,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1430 psinfo->pr_psargs[len] = 0; 1430 psinfo->pr_psargs[len] = 0;
1431 1431
1432 psinfo->pr_pid = task_pid_vnr(p); 1432 psinfo->pr_pid = task_pid_vnr(p);
1433 psinfo->pr_ppid = task_pid_vnr(p->parent); 1433 psinfo->pr_ppid = task_pid_vnr(p->real_parent);
1434 psinfo->pr_pgrp = task_pgrp_vnr(p); 1434 psinfo->pr_pgrp = task_pgrp_vnr(p);
1435 psinfo->pr_sid = task_session_vnr(p); 1435 psinfo->pr_sid = task_session_vnr(p);
1436 1436
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index e8b7c3a98a54..da8cb3b3592c 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -10,6 +10,8 @@
10 * ioctls. 10 * ioctls.
11 */ 11 */
12 12
13#include <linux/joystick.h>
14
13#include <linux/types.h> 15#include <linux/types.h>
14#include <linux/compat.h> 16#include <linux/compat.h>
15#include <linux/kernel.h> 17#include <linux/kernel.h>
@@ -2642,6 +2644,12 @@ COMPATIBLE_IOCTL(VIDEO_SET_ATTRIBUTES)
2642COMPATIBLE_IOCTL(VIDEO_GET_SIZE) 2644COMPATIBLE_IOCTL(VIDEO_GET_SIZE)
2643COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE) 2645COMPATIBLE_IOCTL(VIDEO_GET_FRAME_RATE)
2644 2646
2647/* joystick */
2648COMPATIBLE_IOCTL(JSIOCGVERSION)
2649COMPATIBLE_IOCTL(JSIOCGAXES)
2650COMPATIBLE_IOCTL(JSIOCGBUTTONS)
2651COMPATIBLE_IOCTL(JSIOCGNAME(0))
2652
2645/* now things that need handlers */ 2653/* now things that need handlers */
2646HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob) 2654HANDLE_IOCTL(MEMREADOOB32, mtd_rw_oob)
2647HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob) 2655HANDLE_IOCTL(MEMWRITEOOB32, mtd_rw_oob)
diff --git a/fs/dquot.c b/fs/dquot.c
index 686ab63a7c6c..cee7c6f428f0 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -827,6 +827,18 @@ static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
827 clear_bit(DQ_BLKS_B, &dquot->dq_flags); 827 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
828} 828}
829 829
830static int warning_issued(struct dquot *dquot, const int warntype)
831{
832 int flag = (warntype == QUOTA_NL_BHARDWARN ||
833 warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
834 ((warntype == QUOTA_NL_IHARDWARN ||
835 warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
836
837 if (!flag)
838 return 0;
839 return test_and_set_bit(flag, &dquot->dq_flags);
840}
841
830#ifdef CONFIG_PRINT_QUOTA_WARNING 842#ifdef CONFIG_PRINT_QUOTA_WARNING
831static int flag_print_warnings = 1; 843static int flag_print_warnings = 1;
832 844
@@ -845,16 +857,12 @@ static inline int need_print_warning(struct dquot *dquot)
845} 857}
846 858
847/* Print warning to user which exceeded quota */ 859/* Print warning to user which exceeded quota */
848static void print_warning(struct dquot *dquot, const char warntype) 860static void print_warning(struct dquot *dquot, const int warntype)
849{ 861{
850 char *msg = NULL; 862 char *msg = NULL;
851 struct tty_struct *tty; 863 struct tty_struct *tty;
852 int flag = (warntype == QUOTA_NL_BHARDWARN ||
853 warntype == QUOTA_NL_BSOFTLONGWARN) ? DQ_BLKS_B :
854 ((warntype == QUOTA_NL_IHARDWARN ||
855 warntype == QUOTA_NL_ISOFTLONGWARN) ? DQ_INODES_B : 0);
856 864
857 if (!need_print_warning(dquot) || (flag && test_and_set_bit(flag, &dquot->dq_flags))) 865 if (!need_print_warning(dquot))
858 return; 866 return;
859 867
860 mutex_lock(&tty_mutex); 868 mutex_lock(&tty_mutex);
@@ -895,9 +903,6 @@ out_lock:
895 903
896#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 904#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
897 905
898/* Size of quota netlink message - actually an upperbound for buffer size */
899#define QUOTA_NL_MSG_SIZE 32
900
901/* Netlink family structure for quota */ 906/* Netlink family structure for quota */
902static struct genl_family quota_genl_family = { 907static struct genl_family quota_genl_family = {
903 .id = GENL_ID_GENERATE, 908 .id = GENL_ID_GENERATE,
@@ -914,11 +919,13 @@ static void send_warning(const struct dquot *dquot, const char warntype)
914 struct sk_buff *skb; 919 struct sk_buff *skb;
915 void *msg_head; 920 void *msg_head;
916 int ret; 921 int ret;
922 int msg_size = 4 * nla_total_size(sizeof(u32)) +
923 2 * nla_total_size(sizeof(u64));
917 924
918 /* We have to allocate using GFP_NOFS as we are called from a 925 /* We have to allocate using GFP_NOFS as we are called from a
919 * filesystem performing write and thus further recursion into 926 * filesystem performing write and thus further recursion into
920 * the fs to free some data could cause deadlocks. */ 927 * the fs to free some data could cause deadlocks. */
921 skb = genlmsg_new(QUOTA_NL_MSG_SIZE, GFP_NOFS); 928 skb = genlmsg_new(msg_size, GFP_NOFS);
922 if (!skb) { 929 if (!skb) {
923 printk(KERN_ERR 930 printk(KERN_ERR
924 "VFS: Not enough memory to send quota warning.\n"); 931 "VFS: Not enough memory to send quota warning.\n");
@@ -959,7 +966,7 @@ static void send_warning(const struct dquot *dquot, const char warntype)
959 "VFS: Failed to send notification message: %d\n", ret); 966 "VFS: Failed to send notification message: %d\n", ret);
960 return; 967 return;
961attr_err_out: 968attr_err_out:
962 printk(KERN_ERR "VFS: Failed to compose quota message: %d\n", ret); 969 printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
963err_out: 970err_out:
964 kfree_skb(skb); 971 kfree_skb(skb);
965} 972}
@@ -970,7 +977,8 @@ static inline void flush_warnings(struct dquot * const *dquots, char *warntype)
970 int i; 977 int i;
971 978
972 for (i = 0; i < MAXQUOTAS; i++) 979 for (i = 0; i < MAXQUOTAS; i++)
973 if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN) { 980 if (dquots[i] != NODQUOT && warntype[i] != QUOTA_NL_NOWARN &&
981 !warning_issued(dquots[i], warntype[i])) {
974#ifdef CONFIG_PRINT_QUOTA_WARNING 982#ifdef CONFIG_PRINT_QUOTA_WARNING
975 print_warning(dquots[i], warntype[i]); 983 print_warning(dquots[i], warntype[i]);
976#endif 984#endif
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index bbed2fd40fdc..f8ef0af919e7 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -799,7 +799,7 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
799 rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name, 799 rc = ecryptfs_crypto_api_algify_cipher_name(&full_alg_name,
800 crypt_stat->cipher, "cbc"); 800 crypt_stat->cipher, "cbc");
801 if (rc) 801 if (rc)
802 goto out; 802 goto out_unlock;
803 crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0, 803 crypt_stat->tfm = crypto_alloc_blkcipher(full_alg_name, 0,
804 CRYPTO_ALG_ASYNC); 804 CRYPTO_ALG_ASYNC);
805 kfree(full_alg_name); 805 kfree(full_alg_name);
@@ -808,12 +808,12 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
808 ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " 808 ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): "
809 "Error initializing cipher [%s]\n", 809 "Error initializing cipher [%s]\n",
810 crypt_stat->cipher); 810 crypt_stat->cipher);
811 mutex_unlock(&crypt_stat->cs_tfm_mutex); 811 goto out_unlock;
812 goto out;
813 } 812 }
814 crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY); 813 crypto_blkcipher_set_flags(crypt_stat->tfm, CRYPTO_TFM_REQ_WEAK_KEY);
815 mutex_unlock(&crypt_stat->cs_tfm_mutex);
816 rc = 0; 814 rc = 0;
815out_unlock:
816 mutex_unlock(&crypt_stat->cs_tfm_mutex);
817out: 817out:
818 return rc; 818 return rc;
819} 819}
@@ -1847,6 +1847,7 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name,
1847 mutex_init(&tmp_tfm->key_tfm_mutex); 1847 mutex_init(&tmp_tfm->key_tfm_mutex);
1848 strncpy(tmp_tfm->cipher_name, cipher_name, 1848 strncpy(tmp_tfm->cipher_name, cipher_name,
1849 ECRYPTFS_MAX_CIPHER_NAME_SIZE); 1849 ECRYPTFS_MAX_CIPHER_NAME_SIZE);
1850 tmp_tfm->cipher_name[ECRYPTFS_MAX_CIPHER_NAME_SIZE] = '\0';
1850 tmp_tfm->key_size = key_size; 1851 tmp_tfm->key_size = key_size;
1851 rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm, 1852 rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
1852 tmp_tfm->cipher_name, 1853 tmp_tfm->cipher_name,
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 0b1ab016fa2e..5a719180983c 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -120,22 +120,9 @@ ecryptfs_do_create(struct inode *directory_inode,
120 rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, 120 rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode,
121 ecryptfs_dentry, mode, nd); 121 ecryptfs_dentry, mode, nd);
122 if (rc) { 122 if (rc) {
123 struct inode *ecryptfs_inode = ecryptfs_dentry->d_inode; 123 printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
124 struct ecryptfs_inode_info *inode_info = 124 "rc = [%d]\n", __FUNCTION__, rc);
125 ecryptfs_inode_to_private(ecryptfs_inode); 125 goto out_lock;
126
127 printk(KERN_WARNING "%s: Error creating underlying file; "
128 "rc = [%d]; checking for existing\n", __FUNCTION__, rc);
129 if (inode_info) {
130 mutex_lock(&inode_info->lower_file_mutex);
131 if (!inode_info->lower_file) {
132 mutex_unlock(&inode_info->lower_file_mutex);
133 printk(KERN_ERR "%s: Failure to set underlying "
134 "file; rc = [%d]\n", __FUNCTION__, rc);
135 goto out_lock;
136 }
137 mutex_unlock(&inode_info->lower_file_mutex);
138 }
139 } 126 }
140 rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry, 127 rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry,
141 directory_inode->i_sb, 0); 128 directory_inode->i_sb, 0);
@@ -451,6 +438,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
451 dentry->d_inode->i_nlink = 438 dentry->d_inode->i_nlink =
452 ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink; 439 ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink;
453 dentry->d_inode->i_ctime = dir->i_ctime; 440 dentry->d_inode->i_ctime = dir->i_ctime;
441 d_drop(dentry);
454out_unlock: 442out_unlock:
455 unlock_parent(lower_dentry); 443 unlock_parent(lower_dentry);
456 return rc; 444 return rc;
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index a277754da171..e5580bcb923a 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -138,11 +138,14 @@ int ecryptfs_init_persistent_file(struct dentry *ecryptfs_dentry)
138 inode_info->lower_file = dentry_open(lower_dentry, 138 inode_info->lower_file = dentry_open(lower_dentry,
139 lower_mnt, 139 lower_mnt,
140 (O_RDWR | O_LARGEFILE)); 140 (O_RDWR | O_LARGEFILE));
141 if (IS_ERR(inode_info->lower_file)) 141 if (IS_ERR(inode_info->lower_file)) {
142 dget(lower_dentry);
143 mntget(lower_mnt);
142 inode_info->lower_file = dentry_open(lower_dentry, 144 inode_info->lower_file = dentry_open(lower_dentry,
143 lower_mnt, 145 lower_mnt,
144 (O_RDONLY 146 (O_RDONLY
145 | O_LARGEFILE)); 147 | O_LARGEFILE));
148 }
146 if (IS_ERR(inode_info->lower_file)) { 149 if (IS_ERR(inode_info->lower_file)) {
147 printk(KERN_ERR "Error opening lower persistent file " 150 printk(KERN_ERR "Error opening lower persistent file "
148 "for lower_dentry [0x%p] and lower_mnt [0x%p]\n", 151 "for lower_dentry [0x%p] and lower_mnt [0x%p]\n",
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index a96d341d154d..9cc2aec27b0d 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -427,6 +427,7 @@ int ecryptfs_init_messaging(unsigned int transport)
427 if (!ecryptfs_daemon_id_hash) { 427 if (!ecryptfs_daemon_id_hash) {
428 rc = -ENOMEM; 428 rc = -ENOMEM;
429 ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n"); 429 ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n");
430 mutex_unlock(&ecryptfs_daemon_id_hash_mux);
430 goto out; 431 goto out;
431 } 432 }
432 for (i = 0; i < ecryptfs_hash_buckets; i++) 433 for (i = 0; i < ecryptfs_hash_buckets; i++)
diff --git a/fs/ecryptfs/super.c b/fs/ecryptfs/super.c
index f8cdab2bee3d..4859c4eecd65 100644
--- a/fs/ecryptfs/super.c
+++ b/fs/ecryptfs/super.c
@@ -86,7 +86,6 @@ static void ecryptfs_destroy_inode(struct inode *inode)
86 fput(inode_info->lower_file); 86 fput(inode_info->lower_file);
87 inode_info->lower_file = NULL; 87 inode_info->lower_file = NULL;
88 d_drop(lower_dentry); 88 d_drop(lower_dentry);
89 d_delete(lower_dentry);
90 } 89 }
91 } 90 }
92 mutex_unlock(&inode_info->lower_file_mutex); 91 mutex_unlock(&inode_info->lower_file_mutex);
diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
index 2c1b73fb82ae..5fb366992b73 100644
--- a/fs/fat/fatent.c
+++ b/fs/fat/fatent.c
@@ -590,21 +590,49 @@ error:
590 590
591EXPORT_SYMBOL_GPL(fat_free_clusters); 591EXPORT_SYMBOL_GPL(fat_free_clusters);
592 592
593/* 128kb is the whole sectors for FAT12 and FAT16 */
594#define FAT_READA_SIZE (128 * 1024)
595
596static void fat_ent_reada(struct super_block *sb, struct fat_entry *fatent,
597 unsigned long reada_blocks)
598{
599 struct fatent_operations *ops = MSDOS_SB(sb)->fatent_ops;
600 sector_t blocknr;
601 int i, offset;
602
603 ops->ent_blocknr(sb, fatent->entry, &offset, &blocknr);
604
605 for (i = 0; i < reada_blocks; i++)
606 sb_breadahead(sb, blocknr + i);
607}
608
593int fat_count_free_clusters(struct super_block *sb) 609int fat_count_free_clusters(struct super_block *sb)
594{ 610{
595 struct msdos_sb_info *sbi = MSDOS_SB(sb); 611 struct msdos_sb_info *sbi = MSDOS_SB(sb);
596 struct fatent_operations *ops = sbi->fatent_ops; 612 struct fatent_operations *ops = sbi->fatent_ops;
597 struct fat_entry fatent; 613 struct fat_entry fatent;
614 unsigned long reada_blocks, reada_mask, cur_block;
598 int err = 0, free; 615 int err = 0, free;
599 616
600 lock_fat(sbi); 617 lock_fat(sbi);
601 if (sbi->free_clusters != -1) 618 if (sbi->free_clusters != -1)
602 goto out; 619 goto out;
603 620
621 reada_blocks = FAT_READA_SIZE >> sb->s_blocksize_bits;
622 reada_mask = reada_blocks - 1;
623 cur_block = 0;
624
604 free = 0; 625 free = 0;
605 fatent_init(&fatent); 626 fatent_init(&fatent);
606 fatent_set_entry(&fatent, FAT_START_ENT); 627 fatent_set_entry(&fatent, FAT_START_ENT);
607 while (fatent.entry < sbi->max_cluster) { 628 while (fatent.entry < sbi->max_cluster) {
629 /* readahead of fat blocks */
630 if ((cur_block & reada_mask) == 0) {
631 unsigned long rest = sbi->fat_length - cur_block;
632 fat_ent_reada(sb, &fatent, min(reada_blocks, rest));
633 }
634 cur_block++;
635
608 err = fat_ent_read_block(sb, &fatent); 636 err = fat_ent_read_block(sb, &fatent);
609 if (err) 637 if (err)
610 goto out; 638 goto out;
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 0fca82021d76..300324bd563c 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -482,8 +482,6 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
482 if (wbc->nr_to_write <= 0) 482 if (wbc->nr_to_write <= 0)
483 break; 483 break;
484 } 484 }
485 if (!list_empty(&sb->s_more_io))
486 wbc->more_io = 1;
487 return; /* Leave any unwritten inodes on s_io */ 485 return; /* Leave any unwritten inodes on s_io */
488} 486}
489 487
diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index f13f1494d4fe..f8452a0eab56 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -52,6 +52,10 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
52 rec = (e + b) / 2; 52 rec = (e + b) / 2;
53 len = hfs_brec_lenoff(bnode, rec, &off); 53 len = hfs_brec_lenoff(bnode, rec, &off);
54 keylen = hfs_brec_keylen(bnode, rec); 54 keylen = hfs_brec_keylen(bnode, rec);
55 if (keylen == HFS_BAD_KEYLEN) {
56 res = -EINVAL;
57 goto done;
58 }
55 hfs_bnode_read(bnode, fd->key, off, keylen); 59 hfs_bnode_read(bnode, fd->key, off, keylen);
56 cmpval = bnode->tree->keycmp(fd->key, fd->search_key); 60 cmpval = bnode->tree->keycmp(fd->key, fd->search_key);
57 if (!cmpval) { 61 if (!cmpval) {
@@ -67,6 +71,10 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
67 if (rec != e && e >= 0) { 71 if (rec != e && e >= 0) {
68 len = hfs_brec_lenoff(bnode, e, &off); 72 len = hfs_brec_lenoff(bnode, e, &off);
69 keylen = hfs_brec_keylen(bnode, e); 73 keylen = hfs_brec_keylen(bnode, e);
74 if (keylen == HFS_BAD_KEYLEN) {
75 res = -EINVAL;
76 goto done;
77 }
70 hfs_bnode_read(bnode, fd->key, off, keylen); 78 hfs_bnode_read(bnode, fd->key, off, keylen);
71 } 79 }
72done: 80done:
@@ -198,6 +206,10 @@ int hfs_brec_goto(struct hfs_find_data *fd, int cnt)
198 206
199 len = hfs_brec_lenoff(bnode, fd->record, &off); 207 len = hfs_brec_lenoff(bnode, fd->record, &off);
200 keylen = hfs_brec_keylen(bnode, fd->record); 208 keylen = hfs_brec_keylen(bnode, fd->record);
209 if (keylen == HFS_BAD_KEYLEN) {
210 res = -EINVAL;
211 goto out;
212 }
201 fd->keyoffset = off; 213 fd->keyoffset = off;
202 fd->keylength = keylen; 214 fd->keylength = keylen;
203 fd->entryoffset = off + keylen; 215 fd->entryoffset = off + keylen;
diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
index 5c87cf4801fc..8626ee375ea8 100644
--- a/fs/hfs/brec.c
+++ b/fs/hfs/brec.c
@@ -44,10 +44,21 @@ u16 hfs_brec_keylen(struct hfs_bnode *node, u16 rec)
44 recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2); 44 recoff = hfs_bnode_read_u16(node, node->tree->node_size - (rec + 1) * 2);
45 if (!recoff) 45 if (!recoff)
46 return 0; 46 return 0;
47 if (node->tree->attributes & HFS_TREE_BIGKEYS) 47 if (node->tree->attributes & HFS_TREE_BIGKEYS) {
48 retval = hfs_bnode_read_u16(node, recoff) + 2; 48 retval = hfs_bnode_read_u16(node, recoff) + 2;
49 else 49 if (retval > node->tree->max_key_len + 2) {
50 printk(KERN_ERR "hfs: keylen %d too large\n",
51 retval);
52 retval = HFS_BAD_KEYLEN;
53 }
54 } else {
50 retval = (hfs_bnode_read_u8(node, recoff) | 1) + 1; 55 retval = (hfs_bnode_read_u8(node, recoff) | 1) + 1;
56 if (retval > node->tree->max_key_len + 1) {
57 printk(KERN_ERR "hfs: keylen %d too large\n",
58 retval);
59 retval = HFS_BAD_KEYLEN;
60 }
61 }
51 } 62 }
52 return retval; 63 return retval;
53} 64}
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 8a3a650abc87..110dd3515dc8 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -61,7 +61,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
61 mapping = tree->inode->i_mapping; 61 mapping = tree->inode->i_mapping;
62 page = read_mapping_page(mapping, 0, NULL); 62 page = read_mapping_page(mapping, 0, NULL);
63 if (IS_ERR(page)) 63 if (IS_ERR(page))
64 goto free_tree; 64 goto free_inode;
65 65
66 /* Load the header */ 66 /* Load the header */
67 head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc)); 67 head = (struct hfs_btree_header_rec *)(kmap(page) + sizeof(struct hfs_bnode_desc));
@@ -81,6 +81,17 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
81 goto fail_page; 81 goto fail_page;
82 if (!tree->node_count) 82 if (!tree->node_count)
83 goto fail_page; 83 goto fail_page;
84 if ((id == HFS_EXT_CNID) && (tree->max_key_len != HFS_MAX_EXT_KEYLEN)) {
85 printk(KERN_ERR "hfs: invalid extent max_key_len %d\n",
86 tree->max_key_len);
87 goto fail_page;
88 }
89 if ((id == HFS_CAT_CNID) && (tree->max_key_len != HFS_MAX_CAT_KEYLEN)) {
90 printk(KERN_ERR "hfs: invalid catalog max_key_len %d\n",
91 tree->max_key_len);
92 goto fail_page;
93 }
94
84 tree->node_size_shift = ffs(size) - 1; 95 tree->node_size_shift = ffs(size) - 1;
85 tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 96 tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
86 97
@@ -88,11 +99,12 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
88 page_cache_release(page); 99 page_cache_release(page);
89 return tree; 100 return tree;
90 101
91 fail_page: 102fail_page:
92 tree->inode->i_mapping->a_ops = &hfs_aops;
93 page_cache_release(page); 103 page_cache_release(page);
94 free_tree: 104free_inode:
105 tree->inode->i_mapping->a_ops = &hfs_aops;
95 iput(tree->inode); 106 iput(tree->inode);
107free_tree:
96 kfree(tree); 108 kfree(tree);
97 return NULL; 109 return NULL;
98} 110}
diff --git a/fs/hfs/hfs.h b/fs/hfs/hfs.h
index 1445e3a56ed4..c6aae61adfe6 100644
--- a/fs/hfs/hfs.h
+++ b/fs/hfs/hfs.h
@@ -28,6 +28,8 @@
28#define HFS_MAX_NAMELEN 128 28#define HFS_MAX_NAMELEN 128
29#define HFS_MAX_VALENCE 32767U 29#define HFS_MAX_VALENCE 32767U
30 30
31#define HFS_BAD_KEYLEN 0xFF
32
31/* Meanings of the drAtrb field of the MDB, 33/* Meanings of the drAtrb field of the MDB,
32 * Reference: _Inside Macintosh: Files_ p. 2-61 34 * Reference: _Inside Macintosh: Files_ p. 2-61
33 */ 35 */
@@ -167,6 +169,9 @@ typedef union hfs_btree_key {
167 struct hfs_ext_key ext; 169 struct hfs_ext_key ext;
168} hfs_btree_key; 170} hfs_btree_key;
169 171
172#define HFS_MAX_CAT_KEYLEN (sizeof(struct hfs_cat_key) - sizeof(u8))
173#define HFS_MAX_EXT_KEYLEN (sizeof(struct hfs_ext_key) - sizeof(u8))
174
170typedef union hfs_btree_key btree_key; 175typedef union hfs_btree_key btree_key;
171 176
172struct hfs_extent { 177struct hfs_extent {
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 08ff6c7028cc..038ed7436199 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -288,10 +288,12 @@ handle_t *journal_start(journal_t *journal, int nblocks)
288 jbd_free_handle(handle); 288 jbd_free_handle(handle);
289 current->journal_info = NULL; 289 current->journal_info = NULL;
290 handle = ERR_PTR(err); 290 handle = ERR_PTR(err);
291 goto out;
291 } 292 }
292 293
293 lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_); 294 lock_acquire(&handle->h_lockdep_map, 0, 0, 0, 2, _THIS_IP_);
294 295
296out:
295 return handle; 297 return handle;
296} 298}
297 299
diff --git a/fs/namei.c b/fs/namei.c
index 3b993db26cee..73e2e665817a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1605,7 +1605,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1605 if (S_ISLNK(inode->i_mode)) 1605 if (S_ISLNK(inode->i_mode))
1606 return -ELOOP; 1606 return -ELOOP;
1607 1607
1608 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) 1608 if (S_ISDIR(inode->i_mode) && (acc_mode & MAY_WRITE))
1609 return -EISDIR; 1609 return -EISDIR;
1610 1610
1611 /* 1611 /*
@@ -1620,7 +1620,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1620 return -EACCES; 1620 return -EACCES;
1621 1621
1622 flag &= ~O_TRUNC; 1622 flag &= ~O_TRUNC;
1623 } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) 1623 } else if (IS_RDONLY(inode) && (acc_mode & MAY_WRITE))
1624 return -EROFS; 1624 return -EROFS;
1625 1625
1626 error = vfs_permission(nd, acc_mode); 1626 error = vfs_permission(nd, acc_mode);
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b35069a2aa9e..bd1b9d663fb9 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -115,6 +115,7 @@ struct nfs4_lock_state {
115#define NFS_LOCK_INITIALIZED 1 115#define NFS_LOCK_INITIALIZED 1
116 int ls_flags; 116 int ls_flags;
117 struct nfs_seqid_counter ls_seqid; 117 struct nfs_seqid_counter ls_seqid;
118 struct rpc_sequence ls_sequence;
118 struct nfs_unique_id ls_id; 119 struct nfs_unique_id ls_id;
119 nfs4_stateid ls_stateid; 120 nfs4_stateid ls_stateid;
120 atomic_t ls_count; 121 atomic_t ls_count;
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f03d9d5f5ba4..9e2e1c7291db 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -741,10 +741,10 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
741 if (data->rpc_status == 0) { 741 if (data->rpc_status == 0) {
742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data, 742 memcpy(data->o_res.stateid.data, data->c_res.stateid.data,
743 sizeof(data->o_res.stateid.data)); 743 sizeof(data->o_res.stateid.data));
744 nfs_confirm_seqid(&data->owner->so_seqid, 0);
744 renew_lease(data->o_res.server, data->timestamp); 745 renew_lease(data->o_res.server, data->timestamp);
745 data->rpc_done = 1; 746 data->rpc_done = 1;
746 } 747 }
747 nfs_confirm_seqid(&data->owner->so_seqid, data->rpc_status);
748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid); 748 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
749} 749}
750 750
@@ -759,7 +759,6 @@ static void nfs4_open_confirm_release(void *calldata)
759 /* In case of error, no cleanup! */ 759 /* In case of error, no cleanup! */
760 if (!data->rpc_done) 760 if (!data->rpc_done)
761 goto out_free; 761 goto out_free;
762 nfs_confirm_seqid(&data->owner->so_seqid, 0);
763 state = nfs4_opendata_to_nfs4_state(data); 762 state = nfs4_opendata_to_nfs4_state(data);
764 if (!IS_ERR(state)) 763 if (!IS_ERR(state))
765 nfs4_close_state(&data->path, state, data->o_arg.open_flags); 764 nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -886,7 +885,6 @@ static void nfs4_open_release(void *calldata)
886 /* In case we need an open_confirm, no cleanup! */ 885 /* In case we need an open_confirm, no cleanup! */
887 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM) 886 if (data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)
888 goto out_free; 887 goto out_free;
889 nfs_confirm_seqid(&data->owner->so_seqid, 0);
890 state = nfs4_opendata_to_nfs4_state(data); 888 state = nfs4_opendata_to_nfs4_state(data);
891 if (!IS_ERR(state)) 889 if (!IS_ERR(state))
892 nfs4_close_state(&data->path, state, data->o_arg.open_flags); 890 nfs4_close_state(&data->path, state, data->o_arg.open_flags);
@@ -3333,6 +3331,12 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
3333 3331
3334 p->arg.fh = NFS_FH(inode); 3332 p->arg.fh = NFS_FH(inode);
3335 p->arg.fl = &p->fl; 3333 p->arg.fl = &p->fl;
3334 if (!(lsp->ls_seqid.flags & NFS_SEQID_CONFIRMED)) {
3335 p->arg.open_seqid = nfs_alloc_seqid(&lsp->ls_state->owner->so_seqid);
3336 if (p->arg.open_seqid == NULL)
3337 goto out_free;
3338
3339 }
3336 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid); 3340 p->arg.lock_seqid = nfs_alloc_seqid(&lsp->ls_seqid);
3337 if (p->arg.lock_seqid == NULL) 3341 if (p->arg.lock_seqid == NULL)
3338 goto out_free; 3342 goto out_free;
@@ -3345,6 +3349,8 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
3345 memcpy(&p->fl, fl, sizeof(p->fl)); 3349 memcpy(&p->fl, fl, sizeof(p->fl));
3346 return p; 3350 return p;
3347out_free: 3351out_free:
3352 if (p->arg.open_seqid != NULL)
3353 nfs_free_seqid(p->arg.open_seqid);
3348 kfree(p); 3354 kfree(p);
3349 return NULL; 3355 return NULL;
3350} 3356}
@@ -3361,23 +3367,23 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
3361 .rpc_cred = sp->so_cred, 3367 .rpc_cred = sp->so_cred,
3362 }; 3368 };
3363 3369
3364 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3365 return;
3366 dprintk("%s: begin!\n", __FUNCTION__); 3370 dprintk("%s: begin!\n", __FUNCTION__);
3367 /* Do we need to do an open_to_lock_owner? */ 3371 /* Do we need to do an open_to_lock_owner? */
3368 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { 3372 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
3369 data->arg.open_seqid = nfs_alloc_seqid(&sp->so_seqid); 3373 if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
3370 if (data->arg.open_seqid == NULL) { 3374 return;
3371 data->rpc_status = -ENOMEM;
3372 task->tk_action = NULL;
3373 goto out;
3374 }
3375 data->arg.open_stateid = &state->stateid; 3375 data->arg.open_stateid = &state->stateid;
3376 data->arg.new_lock_owner = 1; 3376 data->arg.new_lock_owner = 1;
3377 /* Retest in case we raced... */
3378 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED))
3379 goto do_rpc;
3377 } 3380 }
3381 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0)
3382 return;
3383 data->arg.new_lock_owner = 0;
3384do_rpc:
3378 data->timestamp = jiffies; 3385 data->timestamp = jiffies;
3379 rpc_call_setup(task, &msg, 0); 3386 rpc_call_setup(task, &msg, 0);
3380out:
3381 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status); 3387 dprintk("%s: done!, ret = %d\n", __FUNCTION__, data->rpc_status);
3382} 3388}
3383 3389
@@ -3413,8 +3419,6 @@ static void nfs4_lock_release(void *calldata)
3413 struct nfs4_lockdata *data = calldata; 3419 struct nfs4_lockdata *data = calldata;
3414 3420
3415 dprintk("%s: begin!\n", __FUNCTION__); 3421 dprintk("%s: begin!\n", __FUNCTION__);
3416 if (data->arg.open_seqid != NULL)
3417 nfs_free_seqid(data->arg.open_seqid);
3418 if (data->cancelled != 0) { 3422 if (data->cancelled != 0) {
3419 struct rpc_task *task; 3423 struct rpc_task *task;
3420 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, 3424 task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
@@ -3424,6 +3428,8 @@ static void nfs4_lock_release(void *calldata)
3424 dprintk("%s: cancelling lock!\n", __FUNCTION__); 3428 dprintk("%s: cancelling lock!\n", __FUNCTION__);
3425 } else 3429 } else
3426 nfs_free_seqid(data->arg.lock_seqid); 3430 nfs_free_seqid(data->arg.lock_seqid);
3431 if (data->arg.open_seqid != NULL)
3432 nfs_free_seqid(data->arg.open_seqid);
3427 nfs4_put_lock_state(data->lsp); 3433 nfs4_put_lock_state(data->lsp);
3428 put_nfs_open_context(data->ctx); 3434 put_nfs_open_context(data->ctx);
3429 kfree(data); 3435 kfree(data);
diff --git a/fs/nfs/nfs4renewd.c b/fs/nfs/nfs4renewd.c
index 3ea352d82eba..5e2e4af1a0e6 100644
--- a/fs/nfs/nfs4renewd.c
+++ b/fs/nfs/nfs4renewd.c
@@ -133,9 +133,7 @@ nfs4_renewd_prepare_shutdown(struct nfs_server *server)
133void 133void
134nfs4_kill_renewd(struct nfs_client *clp) 134nfs4_kill_renewd(struct nfs_client *clp)
135{ 135{
136 down_read(&clp->cl_sem);
137 cancel_delayed_work_sync(&clp->cl_renewd); 136 cancel_delayed_work_sync(&clp->cl_renewd);
138 up_read(&clp->cl_sem);
139} 137}
140 138
141/* 139/*
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 23a9a36556bf..5a39c6f78acf 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -509,7 +509,10 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
509 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL); 509 lsp = kzalloc(sizeof(*lsp), GFP_KERNEL);
510 if (lsp == NULL) 510 if (lsp == NULL)
511 return NULL; 511 return NULL;
512 lsp->ls_seqid.sequence = &state->owner->so_sequence; 512 rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue");
513 spin_lock_init(&lsp->ls_sequence.lock);
514 INIT_LIST_HEAD(&lsp->ls_sequence.list);
515 lsp->ls_seqid.sequence = &lsp->ls_sequence;
513 atomic_set(&lsp->ls_count, 1); 516 atomic_set(&lsp->ls_count, 1);
514 lsp->ls_owner = fl_owner; 517 lsp->ls_owner = fl_owner;
515 spin_lock(&clp->cl_lock); 518 spin_lock(&clp->cl_lock);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index ea929207f274..0b0c72a072ff 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1475,7 +1475,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1475 error = PTR_ERR(mntroot); 1475 error = PTR_ERR(mntroot);
1476 goto error_splat_super; 1476 goto error_splat_super;
1477 } 1477 }
1478 if (mntroot->d_inode->i_op != server->nfs_client->rpc_ops->dir_inode_ops) { 1478 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1479 dput(mntroot); 1479 dput(mntroot);
1480 error = -ESTALE; 1480 error = -ESTALE;
1481 goto error_splat_super; 1481 goto error_splat_super;
@@ -1826,6 +1826,11 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
1826 error = PTR_ERR(mntroot); 1826 error = PTR_ERR(mntroot);
1827 goto error_splat_super; 1827 goto error_splat_super;
1828 } 1828 }
1829 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1830 dput(mntroot);
1831 error = -ESTALE;
1832 goto error_splat_super;
1833 }
1829 1834
1830 s->s_flags |= MS_ACTIVE; 1835 s->s_flags |= MS_ACTIVE;
1831 mnt->mnt_sb = s; 1836 mnt->mnt_sb = s;
@@ -1900,6 +1905,11 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
1900 error = PTR_ERR(mntroot); 1905 error = PTR_ERR(mntroot);
1901 goto error_splat_super; 1906 goto error_splat_super;
1902 } 1907 }
1908 if (mntroot->d_inode->i_op != NFS_SB(s)->nfs_client->rpc_ops->dir_inode_ops) {
1909 dput(mntroot);
1910 error = -ESTALE;
1911 goto error_splat_super;
1912 }
1903 1913
1904 s->s_flags |= MS_ACTIVE; 1914 s->s_flags |= MS_ACTIVE;
1905 mnt->mnt_sb = s; 1915 mnt->mnt_sb = s;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 2d116d2298f8..f917fd25858a 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -388,8 +388,11 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
388 * Round the length of the data which was specified up to 388 * Round the length of the data which was specified up to
389 * the next multiple of XDR units and then compare that 389 * the next multiple of XDR units and then compare that
390 * against the length which was actually received. 390 * against the length which was actually received.
391 * Note that when RPCSEC/GSS (for example) is used, the
392 * data buffer can be padded so dlen might be larger
393 * than required. It must never be smaller.
391 */ 394 */
392 if (dlen != XDR_QUADLEN(len)*4) 395 if (dlen < XDR_QUADLEN(len)*4)
393 return 0; 396 return 0;
394 397
395 if (args->count > max_blocksize) { 398 if (args->count > max_blocksize) {
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 986f9b32083c..b86e3658a0af 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -313,8 +313,11 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
313 * Round the length of the data which was specified up to 313 * Round the length of the data which was specified up to
314 * the next multiple of XDR units and then compare that 314 * the next multiple of XDR units and then compare that
315 * against the length which was actually received. 315 * against the length which was actually received.
316 * Note that when RPCSEC/GSS (for example) is used, the
317 * data buffer can be padded so dlen might be larger
318 * than required. It must never be smaller.
316 */ 319 */
317 if (dlen != XDR_QUADLEN(len)*4) 320 if (dlen < XDR_QUADLEN(len)*4)
318 return 0; 321 return 0;
319 322
320 rqstp->rq_vec[0].iov_base = (void*)p; 323 rqstp->rq_vec[0].iov_base = (void*)p;
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 65c62e1bfd6f..eb97f2897e2b 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -169,7 +169,7 @@ static inline char *task_state(struct task_struct *p, char *buffer)
169 ppid = pid_alive(p) ? 169 ppid = pid_alive(p) ?
170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; 170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
171 tpid = pid_alive(p) && p->ptrace ? 171 tpid = pid_alive(p) && p->ptrace ?
172 task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0; 172 task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0;
173 buffer += sprintf(buffer, 173 buffer += sprintf(buffer,
174 "State:\t%s\n" 174 "State:\t%s\n"
175 "Tgid:\t%d\n" 175 "Tgid:\t%d\n"
@@ -464,8 +464,8 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
464 } 464 }
465 465
466 sid = task_session_nr_ns(task, ns); 466 sid = task_session_nr_ns(task, ns);
467 ppid = task_tgid_nr_ns(task->real_parent, ns);
467 pgid = task_pgrp_nr_ns(task, ns); 468 pgid = task_pgrp_nr_ns(task, ns);
468 ppid = task_ppid_nr_ns(task, ns);
469 469
470 unlock_task_sighand(task, &flags); 470 unlock_task_sighand(task, &flags);
471 } 471 }
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 02a63ac04178..7411bfb0b7cc 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -202,6 +202,26 @@ static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vf
202 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \ 202 (task->state == TASK_STOPPED || task->state == TASK_TRACED) && \
203 security_ptrace(current,task) == 0)) 203 security_ptrace(current,task) == 0))
204 204
205struct mm_struct *mm_for_maps(struct task_struct *task)
206{
207 struct mm_struct *mm = get_task_mm(task);
208 if (!mm)
209 return NULL;
210 down_read(&mm->mmap_sem);
211 task_lock(task);
212 if (task->mm != mm)
213 goto out;
214 if (task->mm != current->mm && __ptrace_may_attach(task) < 0)
215 goto out;
216 task_unlock(task);
217 return mm;
218out:
219 task_unlock(task);
220 up_read(&mm->mmap_sem);
221 mmput(mm);
222 return NULL;
223}
224
205static int proc_pid_cmdline(struct task_struct *task, char * buffer) 225static int proc_pid_cmdline(struct task_struct *task, char * buffer)
206{ 226{
207 int res = 0; 227 int res = 0;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 1820eb2ef762..05b3e9006262 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -27,6 +27,8 @@ struct vmalloc_info {
27 unsigned long largest_chunk; 27 unsigned long largest_chunk;
28}; 28};
29 29
30extern struct mm_struct *mm_for_maps(struct task_struct *);
31
30#ifdef CONFIG_MMU 32#ifdef CONFIG_MMU
31#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) 33#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
32extern void get_vmalloc_info(struct vmalloc_info *vmi); 34extern void get_vmalloc_info(struct vmalloc_info *vmi);
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index e0d064e9764e..3462bfde89f6 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -410,7 +410,7 @@ static const struct file_operations proc_modules_operations = {
410}; 410};
411#endif 411#endif
412 412
413#ifdef CONFIG_SLAB 413#ifdef CONFIG_SLABINFO
414static int slabinfo_open(struct inode *inode, struct file *file) 414static int slabinfo_open(struct inode *inode, struct file *file)
415{ 415{
416 return seq_open(file, &slabinfo_op); 416 return seq_open(file, &slabinfo_op);
@@ -728,7 +728,7 @@ void __init proc_misc_init(void)
728#endif 728#endif
729 create_seq_entry("stat", 0, &proc_stat_operations); 729 create_seq_entry("stat", 0, &proc_stat_operations);
730 create_seq_entry("interrupts", 0, &proc_interrupts_operations); 730 create_seq_entry("interrupts", 0, &proc_interrupts_operations);
731#ifdef CONFIG_SLAB 731#ifdef CONFIG_SLABINFO
732 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); 732 create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations);
733#ifdef CONFIG_DEBUG_SLAB_LEAK 733#ifdef CONFIG_DEBUG_SLAB_LEAK
734 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); 734 create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations);
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index c24d81a5a040..8043a3eab52c 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -397,12 +397,11 @@ static void *m_start(struct seq_file *m, loff_t *pos)
397 if (!priv->task) 397 if (!priv->task)
398 return NULL; 398 return NULL;
399 399
400 mm = get_task_mm(priv->task); 400 mm = mm_for_maps(priv->task);
401 if (!mm) 401 if (!mm)
402 return NULL; 402 return NULL;
403 403
404 priv->tail_vma = tail_vma = get_gate_vma(priv->task); 404 priv->tail_vma = tail_vma = get_gate_vma(priv->task);
405 down_read(&mm->mmap_sem);
406 405
407 /* Start with last addr hint */ 406 /* Start with last addr hint */
408 if (last_addr && (vma = find_vma(mm, last_addr))) { 407 if (last_addr && (vma = find_vma(mm, last_addr))) {
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index d8b8c7183c24..1932c2ca3457 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -165,15 +165,13 @@ static void *m_start(struct seq_file *m, loff_t *pos)
165 if (!priv->task) 165 if (!priv->task)
166 return NULL; 166 return NULL;
167 167
168 mm = get_task_mm(priv->task); 168 mm = mm_for_maps(priv->task);
169 if (!mm) { 169 if (!mm) {
170 put_task_struct(priv->task); 170 put_task_struct(priv->task);
171 priv->task = NULL; 171 priv->task = NULL;
172 return NULL; 172 return NULL;
173 } 173 }
174 174
175 down_read(&mm->mmap_sem);
176
177 /* start from the Nth VMA */ 175 /* start from the Nth VMA */
178 for (vml = mm->context.vmlist; vml; vml = vml->next) 176 for (vml = mm->context.vmlist; vml; vml = vml->next)
179 if (n-- == 0) 177 if (n-- == 0)
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 337162935d21..f281cc6584b0 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -678,8 +678,10 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
678 sd = sysfs_find_dirent(parent_sd, dentry->d_name.name); 678 sd = sysfs_find_dirent(parent_sd, dentry->d_name.name);
679 679
680 /* no such entry */ 680 /* no such entry */
681 if (!sd) 681 if (!sd) {
682 ret = ERR_PTR(-ENOENT);
682 goto out_unlock; 683 goto out_unlock;
684 }
683 685
684 /* attach dentry and inode */ 686 /* attach dentry and inode */
685 inode = sysfs_get_inode(sd); 687 inode = sysfs_get_inode(sd);
@@ -781,6 +783,7 @@ int sysfs_rename_dir(struct kobject * kobj, const char *new_name)
781 old_dentry = sysfs_get_dentry(sd); 783 old_dentry = sysfs_get_dentry(sd);
782 if (IS_ERR(old_dentry)) { 784 if (IS_ERR(old_dentry)) {
783 error = PTR_ERR(old_dentry); 785 error = PTR_ERR(old_dentry);
786 old_dentry = NULL;
784 goto out; 787 goto out;
785 } 788 }
786 789
@@ -848,6 +851,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
848 old_dentry = sysfs_get_dentry(sd); 851 old_dentry = sysfs_get_dentry(sd);
849 if (IS_ERR(old_dentry)) { 852 if (IS_ERR(old_dentry)) {
850 error = PTR_ERR(old_dentry); 853 error = PTR_ERR(old_dentry);
854 old_dentry = NULL;
851 goto out; 855 goto out;
852 } 856 }
853 old_parent = old_dentry->d_parent; 857 old_parent = old_dentry->d_parent;
@@ -855,6 +859,7 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent_kobj)
855 new_parent = sysfs_get_dentry(new_parent_sd); 859 new_parent = sysfs_get_dentry(new_parent_sd);
856 if (IS_ERR(new_parent)) { 860 if (IS_ERR(new_parent)) {
857 error = PTR_ERR(new_parent); 861 error = PTR_ERR(new_parent);
862 new_parent = NULL;
858 goto out; 863 goto out;
859 } 864 }
860 865
@@ -878,7 +883,6 @@ again:
878 error = 0; 883 error = 0;
879 d_add(new_dentry, NULL); 884 d_add(new_dentry, NULL);
880 d_move(old_dentry, new_dentry); 885 d_move(old_dentry, new_dentry);
881 dput(new_dentry);
882 886
883 /* Remove from old parent's list and insert into new parent's list. */ 887 /* Remove from old parent's list and insert into new parent's list. */
884 sysfs_unlink_sibling(sd); 888 sysfs_unlink_sibling(sd);
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 4847eb83fc18..21a1c2b1c5fc 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -261,9 +261,9 @@ xfs_file_readdir(
261#else 261#else
262 262
263struct hack_dirent { 263struct hack_dirent {
264 int namlen;
265 loff_t offset;
266 u64 ino; 264 u64 ino;
265 loff_t offset;
266 int namlen;
267 unsigned int d_type; 267 unsigned int d_type;
268 char name[]; 268 char name[];
269}; 269};
@@ -285,8 +285,10 @@ xfs_hack_filldir(
285{ 285{
286 struct hack_callback *buf = __buf; 286 struct hack_callback *buf = __buf;
287 struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used); 287 struct hack_dirent *de = (struct hack_dirent *)(buf->dirent + buf->used);
288 unsigned int reclen;
288 289
289 if (buf->used + sizeof(struct hack_dirent) + namlen > buf->len) 290 reclen = ALIGN(sizeof(struct hack_dirent) + namlen, sizeof(u64));
291 if (buf->used + reclen > buf->len)
290 return -EINVAL; 292 return -EINVAL;
291 293
292 de->namlen = namlen; 294 de->namlen = namlen;
@@ -294,7 +296,7 @@ xfs_hack_filldir(
294 de->ino = ino; 296 de->ino = ino;
295 de->d_type = d_type; 297 de->d_type = d_type;
296 memcpy(de->name, name, namlen); 298 memcpy(de->name, name, namlen);
297 buf->used += sizeof(struct hack_dirent) + namlen; 299 buf->used += reclen;
298 return 0; 300 return 0;
299} 301}
300 302
@@ -334,7 +336,8 @@ xfs_file_readdir(
334 offset = filp->f_pos; 336 offset = filp->f_pos;
335 337
336 while (!eof) { 338 while (!eof) {
337 int reclen; 339 unsigned int reclen;
340
338 start_offset = offset; 341 start_offset = offset;
339 342
340 buf.used = 0; 343 buf.used = 0;
@@ -355,7 +358,8 @@ xfs_file_readdir(
355 goto done; 358 goto done;
356 } 359 }
357 360
358 reclen = sizeof(struct hack_dirent) + de->namlen; 361 reclen = ALIGN(sizeof(struct hack_dirent) + de->namlen,
362 sizeof(u64));
359 size -= reclen; 363 size -= reclen;
360 de = (struct hack_dirent *)((char *)de + reclen); 364 de = (struct hack_dirent *)((char *)de + reclen);
361 curr_offset = de->offset /* & 0x7fffffff */; 365 curr_offset = de->offset /* & 0x7fffffff */;
diff --git a/include/asm-arm/arch-pxa/hardware.h b/include/asm-arm/arch-pxa/hardware.h
index ab2d963e742a..e25558faa5a4 100644
--- a/include/asm-arm/arch-pxa/hardware.h
+++ b/include/asm-arm/arch-pxa/hardware.h
@@ -121,38 +121,32 @@
121 121
122#define cpu_is_pxa21x() \ 122#define cpu_is_pxa21x() \
123 ({ \ 123 ({ \
124 unsigned int id = read_cpuid(CPUID_ID); \ 124 __cpu_is_pxa21x(read_cpuid_id()); \
125 __cpu_is_pxa21x(id); \
126 }) 125 })
127 126
128#define cpu_is_pxa25x() \ 127#define cpu_is_pxa25x() \
129 ({ \ 128 ({ \
130 unsigned int id = read_cpuid(CPUID_ID); \ 129 __cpu_is_pxa25x(read_cpuid_id()); \
131 __cpu_is_pxa25x(id); \
132 }) 130 })
133 131
134#define cpu_is_pxa27x() \ 132#define cpu_is_pxa27x() \
135 ({ \ 133 ({ \
136 unsigned int id = read_cpuid(CPUID_ID); \ 134 __cpu_is_pxa27x(read_cpuid_id()); \
137 __cpu_is_pxa27x(id); \
138 }) 135 })
139 136
140#define cpu_is_pxa300() \ 137#define cpu_is_pxa300() \
141 ({ \ 138 ({ \
142 unsigned int id = read_cpuid(CPUID_ID); \ 139 __cpu_is_pxa300(read_cpuid_id()); \
143 __cpu_is_pxa300(id); \
144 }) 140 })
145 141
146#define cpu_is_pxa310() \ 142#define cpu_is_pxa310() \
147 ({ \ 143 ({ \
148 unsigned int id = read_cpuid(CPUID_ID); \ 144 __cpu_is_pxa310(read_cpuid_id()); \
149 __cpu_is_pxa310(id); \
150 }) 145 })
151 146
152#define cpu_is_pxa320() \ 147#define cpu_is_pxa320() \
153 ({ \ 148 ({ \
154 unsigned int id = read_cpuid(CPUID_ID); \ 149 __cpu_is_pxa320(read_cpuid_id()); \
155 __cpu_is_pxa320(id); \
156 }) 150 })
157 151
158/* 152/*
@@ -174,14 +168,12 @@
174 168
175#define cpu_is_pxa2xx() \ 169#define cpu_is_pxa2xx() \
176 ({ \ 170 ({ \
177 unsigned int id = read_cpuid(CPUID_ID); \ 171 __cpu_is_pxa2xx(read_cpuid_id()); \
178 __cpu_is_pxa2xx(id); \
179 }) 172 })
180 173
181#define cpu_is_pxa3xx() \ 174#define cpu_is_pxa3xx() \
182 ({ \ 175 ({ \
183 unsigned int id = read_cpuid(CPUID_ID); \ 176 __cpu_is_pxa3xx(read_cpuid_id()); \
184 __cpu_is_pxa3xx(id); \
185 }) 177 })
186 178
187/* 179/*
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 94ea8c6dc1a4..28425c473e71 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -75,8 +75,21 @@
75#ifndef __ASSEMBLY__ 75#ifndef __ASSEMBLY__
76 76
77#include <linux/linkage.h> 77#include <linux/linkage.h>
78#include <linux/stringify.h>
78#include <linux/irqflags.h> 79#include <linux/irqflags.h>
79 80
81/*
82 * The CPU ID never changes at run time, so we might as well tell the
83 * compiler that it's constant. Use this function to read the CPU ID
84 * rather than directly reading processor_id or read_cpuid() directly.
85 */
86static inline unsigned int read_cpuid_id(void) __attribute_const__;
87
88static inline unsigned int read_cpuid_id(void)
89{
90 return read_cpuid(CPUID_ID);
91}
92
80#define __exception __attribute__((section(".exception.text"))) 93#define __exception __attribute__((section(".exception.text")))
81 94
82struct thread_info; 95struct thread_info;
diff --git a/include/asm-cris/page.h b/include/asm-cris/page.h
index 0648e3153f81..b84353ef6998 100644
--- a/include/asm-cris/page.h
+++ b/include/asm-cris/page.h
@@ -4,14 +4,11 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <asm/arch/page.h> 6#include <asm/arch/page.h>
7#include <linux/const.h>
7 8
8/* PAGE_SHIFT determines the page size */ 9/* PAGE_SHIFT determines the page size */
9#define PAGE_SHIFT 13 10#define PAGE_SHIFT 13
10#ifndef __ASSEMBLY__ 11#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
11#define PAGE_SIZE (1UL << PAGE_SHIFT)
12#else
13#define PAGE_SIZE (1 << PAGE_SHIFT)
14#endif
15#define PAGE_MASK (~(PAGE_SIZE-1)) 12#define PAGE_MASK (~(PAGE_SIZE-1))
16 13
17#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 14#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index 6f2d924f4fd6..bd57a7949170 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -358,6 +358,7 @@
358#define __ARCH_WANT_SYS_SIGPENDING 358#define __ARCH_WANT_SYS_SIGPENDING
359#define __ARCH_WANT_SYS_SIGPROCMASK 359#define __ARCH_WANT_SYS_SIGPROCMASK
360#define __ARCH_WANT_SYS_RT_SIGACTION 360#define __ARCH_WANT_SYS_RT_SIGACTION
361#define __ARCH_WANT_SYS_RT_SIGSUSPEND
361 362
362/* 363/*
363 * "Conditional" syscalls 364 * "Conditional" syscalls
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index 799307eea40f..75f2bfab614f 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -86,9 +86,6 @@ tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
86static inline void 86static inline void
87tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 87tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
88{ 88{
89#ifdef CONFIG_QUICKLIST
90 tlb->need_flush += &__get_cpu_var(quicklist)[0].nr_pages != 0;
91#endif
92 tlb_flush_mmu(tlb, start, end); 89 tlb_flush_mmu(tlb, start, end);
93 90
94 /* keep the page table cache within bounds */ 91 /* keep the page table cache within bounds */
diff --git a/include/asm-ia64/sn/xpc.h b/include/asm-ia64/sn/xpc.h
index 8e5d7de9c632..3c0900ab8003 100644
--- a/include/asm-ia64/sn/xpc.h
+++ b/include/asm-ia64/sn/xpc.h
@@ -1211,11 +1211,13 @@ xpc_IPI_init(int index)
1211static inline enum xpc_retval 1211static inline enum xpc_retval
1212xpc_map_bte_errors(bte_result_t error) 1212xpc_map_bte_errors(bte_result_t error)
1213{ 1213{
1214 if (error == BTE_SUCCESS)
1215 return xpcSuccess;
1216
1214 if (is_shub2()) { 1217 if (is_shub2()) {
1215 if (BTE_VALID_SH2_ERROR(error)) 1218 if (BTE_VALID_SH2_ERROR(error))
1216 return xpcBteSh2Start + error; 1219 return xpcBteSh2Start + error;
1217 else 1220 return xpcBteUnmappedError;
1218 return xpcBteUnmappedError;
1219 } 1221 }
1220 switch (error) { 1222 switch (error) {
1221 case BTE_SUCCESS: return xpcSuccess; 1223 case BTE_SUCCESS: return xpcSuccess;
diff --git a/include/asm-mips/cacheops.h b/include/asm-mips/cacheops.h
index df7f2deb3b56..256ad2cc6eb8 100644
--- a/include/asm-mips/cacheops.h
+++ b/include/asm-mips/cacheops.h
@@ -64,7 +64,7 @@
64#define Page_Invalidate_T 0x16 64#define Page_Invalidate_T 0x16
65 65
66/* 66/*
67 * R1000-specific cacheops 67 * R10000-specific cacheops
68 * 68 *
69 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused. 69 * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused.
70 * Most of the _S cacheops are identical to the R4000SC _SD cacheops. 70 * Most of the _S cacheops are identical to the R4000SC _SD cacheops.
diff --git a/include/asm-mips/smtc_ipi.h b/include/asm-mips/smtc_ipi.h
index e09131a6127d..8ce517574340 100644
--- a/include/asm-mips/smtc_ipi.h
+++ b/include/asm-mips/smtc_ipi.h
@@ -49,7 +49,7 @@ struct smtc_ipi_q {
49 49
50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p) 50static inline void smtc_ipi_nq(struct smtc_ipi_q *q, struct smtc_ipi *p)
51{ 51{
52 long flags; 52 unsigned long flags;
53 53
54 spin_lock_irqsave(&q->lock, flags); 54 spin_lock_irqsave(&q->lock, flags);
55 if (q->head == NULL) 55 if (q->head == NULL)
@@ -98,7 +98,7 @@ static inline struct smtc_ipi *smtc_ipi_dq(struct smtc_ipi_q *q)
98 98
99static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p) 99static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
100{ 100{
101 long flags; 101 unsigned long flags;
102 102
103 spin_lock_irqsave(&q->lock, flags); 103 spin_lock_irqsave(&q->lock, flags);
104 if (q->head == NULL) { 104 if (q->head == NULL) {
@@ -114,7 +114,7 @@ static inline void smtc_ipi_req(struct smtc_ipi_q *q, struct smtc_ipi *p)
114 114
115static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q) 115static inline int smtc_ipi_qdepth(struct smtc_ipi_q *q)
116{ 116{
117 long flags; 117 unsigned long flags;
118 int retval; 118 int retval;
119 119
120 spin_lock_irqsave(&q->lock, flags); 120 spin_lock_irqsave(&q->lock, flags);
diff --git a/include/asm-powerpc/spu.h b/include/asm-powerpc/spu.h
index 5ca30e2e2639..f07c99ba5d13 100644
--- a/include/asm-powerpc/spu.h
+++ b/include/asm-powerpc/spu.h
@@ -248,6 +248,7 @@ struct spufs_calls {
248 __u32 __user *ustatus); 248 __u32 __user *ustatus);
249 int (*coredump_extra_notes_size)(void); 249 int (*coredump_extra_notes_size)(void);
250 int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset); 250 int (*coredump_extra_notes_write)(struct file *file, loff_t *foffset);
251 void (*notify_spus_active)(void);
251 struct module *owner; 252 struct module *owner;
252}; 253};
253 254
@@ -302,6 +303,9 @@ struct notifier_block;
302int spu_switch_event_register(struct notifier_block * n); 303int spu_switch_event_register(struct notifier_block * n);
303int spu_switch_event_unregister(struct notifier_block * n); 304int spu_switch_event_unregister(struct notifier_block * n);
304 305
306extern void notify_spus_active(void);
307extern void do_notify_spus_active(void);
308
305/* 309/*
306 * This defines the Local Store, Problem Area and Privilege Area of an SPU. 310 * This defines the Local Store, Problem Area and Privilege Area of an SPU.
307 */ 311 */
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index 9d528ada3c14..e034c3604111 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -43,6 +43,12 @@ extern void __flush_purge_region(void *start, int size);
43extern void __flush_invalidate_region(void *start, int size); 43extern void __flush_invalidate_region(void *start, int size);
44#endif 44#endif
45 45
46#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
47static inline void flush_kernel_dcache_page(struct page *page)
48{
49 flush_dcache_page(page);
50}
51
46#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF) 52#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
47extern void copy_to_user_page(struct vm_area_struct *vma, 53extern void copy_to_user_page(struct vm_area_struct *vma,
48 struct page *page, unsigned long vaddr, void *dst, const void *src, 54 struct page *page, unsigned long vaddr, void *dst, const void *src,
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
index f18a1a5c95c0..77c391fa93d6 100644
--- a/include/asm-sh/uaccess.h
+++ b/include/asm-sh/uaccess.h
@@ -73,38 +73,26 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
73/* 73/*
74 * __access_ok: Check if address with size is OK or not. 74 * __access_ok: Check if address with size is OK or not.
75 * 75 *
76 * We do three checks: 76 * Uhhuh, this needs 33-bit arithmetic. We have a carry..
77 * (1) is it user space?
78 * (2) addr + size --> carry?
79 * (3) addr + size >= 0x80000000 (PAGE_OFFSET)
80 * 77 *
81 * (1) (2) (3) | RESULT 78 * sum := addr + size; carry? --> flag = true;
82 * 0 0 0 | ok 79 * if (sum >= addr_limit) flag = true;
83 * 0 0 1 | ok
84 * 0 1 0 | bad
85 * 0 1 1 | bad
86 * 1 0 0 | ok
87 * 1 0 1 | bad
88 * 1 1 0 | bad
89 * 1 1 1 | bad
90 */ 80 */
91static inline int __access_ok(unsigned long addr, unsigned long size) 81static inline int __access_ok(unsigned long addr, unsigned long size)
92{ 82{
93 unsigned long flag, tmp; 83 unsigned long flag, sum;
94 84
95 __asm__("stc r7_bank, %0\n\t" 85 __asm__("clrt\n\t"
96 "mov.l @(8,%0), %0\n\t" 86 "addc %3, %1\n\t"
97 "clrt\n\t" 87 "movt %0\n\t"
98 "addc %2, %1\n\t" 88 "cmp/hi %4, %1\n\t"
99 "and %1, %0\n\t" 89 "rotcl %0"
100 "rotcl %0\n\t" 90 :"=&r" (flag), "=r" (sum)
101 "rotcl %0\n\t" 91 :"1" (addr), "r" (size),
102 "and #3, %0" 92 "r" (current_thread_info()->addr_limit.seg)
103 : "=&z" (flag), "=r" (tmp) 93 :"t");
104 : "r" (addr), "1" (size)
105 : "t");
106
107 return flag == 0; 94 return flag == 0;
95
108} 96}
109#endif /* CONFIG_MMU */ 97#endif /* CONFIG_MMU */
110 98
diff --git a/include/asm-sparc64/dma-mapping.h b/include/asm-sparc64/dma-mapping.h
index 1fc655452b81..38cbec76a33f 100644
--- a/include/asm-sparc64/dma-mapping.h
+++ b/include/asm-sparc64/dma-mapping.h
@@ -25,15 +25,9 @@ struct dma_ops {
25 void (*sync_single_for_cpu)(struct device *dev, 25 void (*sync_single_for_cpu)(struct device *dev,
26 dma_addr_t dma_handle, size_t size, 26 dma_addr_t dma_handle, size_t size,
27 enum dma_data_direction direction); 27 enum dma_data_direction direction);
28 void (*sync_single_for_device)(struct device *dev,
29 dma_addr_t dma_handle, size_t size,
30 enum dma_data_direction direction);
31 void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg, 28 void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
32 int nelems, 29 int nelems,
33 enum dma_data_direction direction); 30 enum dma_data_direction direction);
34 void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg,
35 int nelems,
36 enum dma_data_direction direction);
37}; 31};
38extern const struct dma_ops *dma_ops; 32extern const struct dma_ops *dma_ops;
39 33
@@ -105,7 +99,7 @@ static inline void dma_sync_single_for_device(struct device *dev,
105 size_t size, 99 size_t size,
106 enum dma_data_direction direction) 100 enum dma_data_direction direction)
107{ 101{
108 dma_ops->sync_single_for_device(dev, dma_handle, size, direction); 102 /* No flushing needed to sync cpu writes to the device. */
109} 103}
110 104
111static inline void dma_sync_single_range_for_cpu(struct device *dev, 105static inline void dma_sync_single_range_for_cpu(struct device *dev,
@@ -123,7 +117,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
123 size_t size, 117 size_t size,
124 enum dma_data_direction direction) 118 enum dma_data_direction direction)
125{ 119{
126 dma_sync_single_for_device(dev, dma_handle+offset, size, direction); 120 /* No flushing needed to sync cpu writes to the device. */
127} 121}
128 122
129 123
@@ -138,7 +132,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
138 struct scatterlist *sg, int nelems, 132 struct scatterlist *sg, int nelems,
139 enum dma_data_direction direction) 133 enum dma_data_direction direction)
140{ 134{
141 dma_ops->sync_sg_for_device(dev, sg, nelems, direction); 135 /* No flushing needed to sync cpu writes to the device. */
142} 136}
143 137
144static inline int dma_mapping_error(dma_addr_t dma_addr) 138static inline int dma_mapping_error(dma_addr_t dma_addr)
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 1393e57d50fb..f59f2571295b 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -200,6 +200,10 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
200struct device_node; 200struct device_node;
201extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); 201extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev);
202 202
203#define HAVE_ARCH_PCI_RESOURCE_TO_USER
204extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
205 const struct resource *rsrc,
206 resource_size_t *start, resource_size_t *end);
203#endif /* __KERNEL__ */ 207#endif /* __KERNEL__ */
204 208
205#endif /* __SPARC64_PCI_H */ 209#endif /* __SPARC64_PCI_H */
diff --git a/include/asm-x86/byteorder.h b/include/asm-x86/byteorder.h
index 1f2d6d5bf20d..fe2f2e5d51ba 100644
--- a/include/asm-x86/byteorder.h
+++ b/include/asm-x86/byteorder.h
@@ -30,13 +30,13 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
30 } v; 30 } v;
31 v.u = val; 31 v.u = val;
32#ifdef CONFIG_X86_BSWAP 32#ifdef CONFIG_X86_BSWAP
33 asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 33 __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
34 : "=r" (v.s.a), "=r" (v.s.b) 34 : "=r" (v.s.a), "=r" (v.s.b)
35 : "0" (v.s.a), "1" (v.s.b)); 35 : "0" (v.s.a), "1" (v.s.b));
36#else 36#else
37 v.s.a = ___arch__swab32(v.s.a); 37 v.s.a = ___arch__swab32(v.s.a);
38 v.s.b = ___arch__swab32(v.s.b); 38 v.s.b = ___arch__swab32(v.s.b);
39 asm("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b)); 39 __asm__("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a), "1" (v.s.b));
40#endif 40#endif
41 return v.u; 41 return v.u;
42} 42}
diff --git a/include/asm-x86/msr.h b/include/asm-x86/msr.h
index ba4b31432120..80b027081b3c 100644
--- a/include/asm-x86/msr.h
+++ b/include/asm-x86/msr.h
@@ -3,6 +3,10 @@
3 3
4#include <asm/msr-index.h> 4#include <asm/msr-index.h>
5 5
6#ifndef __ASSEMBLY__
7# include <linux/types.h>
8#endif
9
6#ifdef __i386__ 10#ifdef __i386__
7 11
8#ifdef __KERNEL__ 12#ifdef __KERNEL__
@@ -191,38 +195,6 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
191 195
192#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32) 196#define wrmsrl(msr,val) wrmsr(msr,(__u32)((__u64)(val)),((__u64)(val))>>32)
193 197
194/* wrmsr with exception handling */
195#define wrmsr_safe(msr,a,b) ({ int ret__; \
196 asm volatile("2: wrmsr ; xorl %0,%0\n" \
197 "1:\n\t" \
198 ".section .fixup,\"ax\"\n\t" \
199 "3: movl %4,%0 ; jmp 1b\n\t" \
200 ".previous\n\t" \
201 ".section __ex_table,\"a\"\n" \
202 " .align 8\n\t" \
203 " .quad 2b,3b\n\t" \
204 ".previous" \
205 : "=a" (ret__) \
206 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
207 ret__; })
208
209#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
210
211#define rdmsr_safe(msr,a,b) \
212 ({ int ret__; \
213 asm volatile ("1: rdmsr\n" \
214 "2:\n" \
215 ".section .fixup,\"ax\"\n" \
216 "3: movl %4,%0\n" \
217 " jmp 2b\n" \
218 ".previous\n" \
219 ".section __ex_table,\"a\"\n" \
220 " .align 8\n" \
221 " .quad 1b,3b\n" \
222 ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
223 :"c"(msr), "i"(-EIO), "0"(0)); \
224 ret__; })
225
226#define rdtsc(low,high) \ 198#define rdtsc(low,high) \
227 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) 199 __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
228 200
@@ -230,17 +202,17 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
230 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") 202 __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx")
231 203
232#define rdtscp(low,high,aux) \ 204#define rdtscp(low,high,aux) \
233 asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux)) 205 __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (low), "=d" (high), "=c" (aux))
234 206
235#define rdtscll(val) do { \ 207#define rdtscll(val) do { \
236 unsigned int __a,__d; \ 208 unsigned int __a,__d; \
237 asm volatile("rdtsc" : "=a" (__a), "=d" (__d)); \ 209 __asm__ __volatile__("rdtsc" : "=a" (__a), "=d" (__d)); \
238 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \ 210 (val) = ((unsigned long)__a) | (((unsigned long)__d)<<32); \
239} while(0) 211} while(0)
240 212
241#define rdtscpll(val, aux) do { \ 213#define rdtscpll(val, aux) do { \
242 unsigned long __a, __d; \ 214 unsigned long __a, __d; \
243 asm volatile (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \ 215 __asm__ __volatile__ (".byte 0x0f,0x01,0xf9" : "=a" (__a), "=d" (__d), "=c" (aux)); \
244 (val) = (__d << 32) | __a; \ 216 (val) = (__d << 32) | __a; \
245} while (0) 217} while (0)
246 218
@@ -253,6 +225,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
253 : "=a" (low), "=d" (high) \ 225 : "=a" (low), "=d" (high) \
254 : "c" (counter)) 226 : "c" (counter))
255 227
228
256static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx, 229static inline void cpuid(int op, unsigned int *eax, unsigned int *ebx,
257 unsigned int *ecx, unsigned int *edx) 230 unsigned int *ecx, unsigned int *edx)
258{ 231{
@@ -320,6 +293,40 @@ static inline unsigned int cpuid_edx(unsigned int op)
320 return edx; 293 return edx;
321} 294}
322 295
296#ifdef __KERNEL__
297
298/* wrmsr with exception handling */
299#define wrmsr_safe(msr,a,b) ({ int ret__; \
300 asm volatile("2: wrmsr ; xorl %0,%0\n" \
301 "1:\n\t" \
302 ".section .fixup,\"ax\"\n\t" \
303 "3: movl %4,%0 ; jmp 1b\n\t" \
304 ".previous\n\t" \
305 ".section __ex_table,\"a\"\n" \
306 " .align 8\n\t" \
307 " .quad 2b,3b\n\t" \
308 ".previous" \
309 : "=a" (ret__) \
310 : "c" (msr), "0" (a), "d" (b), "i" (-EFAULT)); \
311 ret__; })
312
313#define checking_wrmsrl(msr,val) wrmsr_safe(msr,(u32)(val),(u32)((val)>>32))
314
315#define rdmsr_safe(msr,a,b) \
316 ({ int ret__; \
317 asm volatile ("1: rdmsr\n" \
318 "2:\n" \
319 ".section .fixup,\"ax\"\n" \
320 "3: movl %4,%0\n" \
321 " jmp 2b\n" \
322 ".previous\n" \
323 ".section __ex_table,\"a\"\n" \
324 " .align 8\n" \
325 " .quad 1b,3b\n" \
326 ".previous":"=&bDS" (ret__), "=a"(*(a)), "=d"(*(b)) \
327 :"c"(msr), "i"(-EIO), "0"(0)); \
328 ret__; })
329
323#ifdef CONFIG_SMP 330#ifdef CONFIG_SMP
324void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 331void rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
325void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 332void wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
@@ -343,6 +350,7 @@ static inline int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
343 return wrmsr_safe(msr_no, l, h); 350 return wrmsr_safe(msr_no, l, h);
344} 351}
345#endif /* CONFIG_SMP */ 352#endif /* CONFIG_SMP */
353#endif /* __KERNEL__ */
346#endif /* __ASSEMBLY__ */ 354#endif /* __ASSEMBLY__ */
347 355
348#endif /* !__i386__ */ 356#endif /* !__i386__ */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 9abf5a806c15..f30fa92a44a1 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -153,6 +153,7 @@ header-y += toshiba.h
153header-y += ultrasound.h 153header-y += ultrasound.h
154header-y += un.h 154header-y += un.h
155header-y += utime.h 155header-y += utime.h
156header-y += veth.h
156header-y += video_decoder.h 157header-y += video_decoder.h
157header-y += video_encoder.h 158header-y += video_encoder.h
158header-y += videotext.h 159header-y += videotext.h
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 72ab80801ef6..e672e80202a8 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -554,8 +554,6 @@ static inline int ata_drive_40wire(const u16 *dev_id)
554 554
555static inline int ata_drive_40wire_relaxed(const u16 *dev_id) 555static inline int ata_drive_40wire_relaxed(const u16 *dev_id)
556{ 556{
557 if (ata_id_is_sata(dev_id))
558 return 0; /* SATA */
559 if ((dev_id[93] & 0x2000) == 0x2000) 557 if ((dev_id[93] & 0x2000) == 0x2000)
560 return 0; /* 80 wire */ 558 return 0; /* 80 wire */
561 return 1; 559 return 1;
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index b79c57569367..92f2029a34f3 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -107,7 +107,6 @@ extern void unlock_cpu_hotplug(void);
107#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 107#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
108#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 108#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
109int cpu_down(unsigned int cpu); 109int cpu_down(unsigned int cpu);
110#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
111 110
112#else /* CONFIG_HOTPLUG_CPU */ 111#else /* CONFIG_HOTPLUG_CPU */
113 112
@@ -122,9 +121,6 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
122/* These aren't inline functions due to a GCC bug. */ 121/* These aren't inline functions due to a GCC bug. */
123#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 122#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
124#define unregister_hotcpu_notifier(nb) ({ (void)(nb); }) 123#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
125
126/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
127static inline int cpu_is_offline(int cpu) { return 0; }
128#endif /* CONFIG_HOTPLUG_CPU */ 124#endif /* CONFIG_HOTPLUG_CPU */
129 125
130#ifdef CONFIG_PM_SLEEP_SMP 126#ifdef CONFIG_PM_SLEEP_SMP
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 23f55140ccd5..85bd790c201e 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -397,6 +397,8 @@ extern cpumask_t cpu_present_map;
397#define cpu_present(cpu) ((cpu) == 0) 397#define cpu_present(cpu) ((cpu) == 0)
398#endif 398#endif
399 399
400#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
401
400#ifdef CONFIG_SMP 402#ifdef CONFIG_SMP
401extern int nr_cpu_ids; 403extern int nr_cpu_ids;
402#define any_online_cpu(mask) __any_online_cpu(&(mask)) 404#define any_online_cpu(mask) __any_online_cpu(&(mask))
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 88c81403eb3f..e18017d45758 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -23,6 +23,10 @@
23#ifndef LINUX_I2C_ID_H 23#ifndef LINUX_I2C_ID_H
24#define LINUX_I2C_ID_H 24#define LINUX_I2C_ID_H
25 25
26/* Please note that I2C driver IDs are optional. They are only needed if a
27 legacy chip driver needs to identify a bus or a bus driver needs to
28 identify a legacy client. If you don't need them, just don't set them. */
29
26/* 30/*
27 * ---- Driver types ----------------------------------------------------- 31 * ---- Driver types -----------------------------------------------------
28 */ 32 */
diff --git a/include/linux/key.h b/include/linux/key.h
index fcdbd5ed227b..a70b8a8f2005 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -290,7 +290,7 @@ extern void key_init(void);
290#define key_get(k) ({ NULL; }) 290#define key_get(k) ({ NULL; })
291#define key_put(k) do { } while(0) 291#define key_put(k) do { } while(0)
292#define key_ref_put(k) do { } while(0) 292#define key_ref_put(k) do { } while(0)
293#define make_key_ref(k) ({ NULL; }) 293#define make_key_ref(k, p) ({ NULL; })
294#define key_ref_to_ptr(k) ({ NULL; }) 294#define key_ref_to_ptr(k) ({ NULL; })
295#define is_key_possessed(k) 0 295#define is_key_possessed(k) 0
296#define alloc_uid_keyring(u,c) 0 296#define alloc_uid_keyring(u,c) 0
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1e6af4f174b6..b0813c3286b1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -319,21 +319,29 @@ struct napi_struct {
319enum 319enum
320{ 320{
321 NAPI_STATE_SCHED, /* Poll is scheduled */ 321 NAPI_STATE_SCHED, /* Poll is scheduled */
322 NAPI_STATE_DISABLE, /* Disable pending */
322}; 323};
323 324
324extern void FASTCALL(__napi_schedule(struct napi_struct *n)); 325extern void FASTCALL(__napi_schedule(struct napi_struct *n));
325 326
327static inline int napi_disable_pending(struct napi_struct *n)
328{
329 return test_bit(NAPI_STATE_DISABLE, &n->state);
330}
331
326/** 332/**
327 * napi_schedule_prep - check if napi can be scheduled 333 * napi_schedule_prep - check if napi can be scheduled
328 * @n: napi context 334 * @n: napi context
329 * 335 *
330 * Test if NAPI routine is already running, and if not mark 336 * Test if NAPI routine is already running, and if not mark
331 * it as running. This is used as a condition variable 337 * it as running. This is used as a condition variable
332 * insure only one NAPI poll instance runs 338 * insure only one NAPI poll instance runs. We also make
339 * sure there is no pending NAPI disable.
333 */ 340 */
334static inline int napi_schedule_prep(struct napi_struct *n) 341static inline int napi_schedule_prep(struct napi_struct *n)
335{ 342{
336 return !test_and_set_bit(NAPI_STATE_SCHED, &n->state); 343 return !napi_disable_pending(n) &&
344 !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
337} 345}
338 346
339/** 347/**
@@ -389,8 +397,10 @@ static inline void napi_complete(struct napi_struct *n)
389 */ 397 */
390static inline void napi_disable(struct napi_struct *n) 398static inline void napi_disable(struct napi_struct *n)
391{ 399{
400 set_bit(NAPI_STATE_DISABLE, &n->state);
392 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 401 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
393 msleep(1); 402 msleep(1);
403 clear_bit(NAPI_STATE_DISABLE, &n->state);
394} 404}
395 405
396/** 406/**
@@ -1268,7 +1278,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1268static inline int netif_rx_schedule_prep(struct net_device *dev, 1278static inline int netif_rx_schedule_prep(struct net_device *dev,
1269 struct napi_struct *napi) 1279 struct napi_struct *napi)
1270{ 1280{
1271 return netif_running(dev) && napi_schedule_prep(napi); 1281 return napi_schedule_prep(napi);
1272} 1282}
1273 1283
1274/* Add interface to tail of rx poll list. This assumes that _prep has 1284/* Add interface to tail of rx poll list. This assumes that _prep has
@@ -1277,7 +1287,6 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1277static inline void __netif_rx_schedule(struct net_device *dev, 1287static inline void __netif_rx_schedule(struct net_device *dev,
1278 struct napi_struct *napi) 1288 struct napi_struct *napi)
1279{ 1289{
1280 dev_hold(dev);
1281 __napi_schedule(napi); 1290 __napi_schedule(napi);
1282} 1291}
1283 1292
@@ -1308,7 +1317,6 @@ static inline void __netif_rx_complete(struct net_device *dev,
1308 struct napi_struct *napi) 1317 struct napi_struct *napi)
1309{ 1318{
1310 __napi_complete(napi); 1319 __napi_complete(napi);
1311 dev_put(dev);
1312} 1320}
1313 1321
1314/* Remove interface from poll list: it must be in the poll list 1322/* Remove interface from poll list: it must be in the poll list
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 023656d2f1da..7f2215139e9a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2322,6 +2322,8 @@
2322#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 2322#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
2323#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 2323#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919
2324#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 2324#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2325#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
2326#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
2325#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2327#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2326#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2328#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2327#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2329#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 09a309b7b5d2..b78e0295adf4 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -246,6 +246,15 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
246 device_set_wakeup_enable(dev,val); \ 246 device_set_wakeup_enable(dev,val); \
247 } while(0) 247 } while(0)
248 248
249/*
250 * Global Power Management flags
251 * Used to keep APM and ACPI from both being active
252 */
253extern unsigned int pm_flags;
254
255#define PM_APM 1
256#define PM_ACPI 2
257
249#endif /* __KERNEL__ */ 258#endif /* __KERNEL__ */
250 259
251#endif /* _LINUX_PM_H */ 260#endif /* _LINUX_PM_H */
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h
index 514729a44688..446f4f42b952 100644
--- a/include/linux/pm_legacy.h
+++ b/include/linux/pm_legacy.h
@@ -4,10 +4,6 @@
4 4
5#ifdef CONFIG_PM_LEGACY 5#ifdef CONFIG_PM_LEGACY
6 6
7extern int pm_active;
8
9#define PM_IS_ACTIVE() (pm_active != 0)
10
11/* 7/*
12 * Register a device with power management 8 * Register a device with power management
13 */ 9 */
@@ -21,8 +17,6 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data);
21 17
22#else /* CONFIG_PM_LEGACY */ 18#else /* CONFIG_PM_LEGACY */
23 19
24#define PM_IS_ACTIVE() 0
25
26static inline struct pm_dev *pm_register(pm_dev_t type, 20static inline struct pm_dev *pm_register(pm_dev_t type,
27 unsigned long id, 21 unsigned long id,
28 pm_callback callback) 22 pm_callback callback)
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 0a0426c2867d..2a6d62c7d2d1 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -13,7 +13,7 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/mod_devicetable.h> 14#include <linux/mod_devicetable.h>
15 15
16#define PNP_MAX_PORT 24 16#define PNP_MAX_PORT 40
17#define PNP_MAX_MEM 12 17#define PNP_MAX_MEM 12
18#define PNP_MAX_IRQ 2 18#define PNP_MAX_IRQ 2
19#define PNP_MAX_DMA 2 19#define PNP_MAX_DMA 2
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ae8146abd746..3ea5750a0f7e 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -97,6 +97,7 @@ extern void __ptrace_link(struct task_struct *child,
97extern void __ptrace_unlink(struct task_struct *child); 97extern void __ptrace_unlink(struct task_struct *child);
98extern void ptrace_untrace(struct task_struct *child); 98extern void ptrace_untrace(struct task_struct *child);
99extern int ptrace_may_attach(struct task_struct *task); 99extern int ptrace_may_attach(struct task_struct *task);
100extern int __ptrace_may_attach(struct task_struct *task);
100 101
101static inline void ptrace_link(struct task_struct *child, 102static inline void ptrace_link(struct task_struct *child,
102 struct task_struct *new_parent) 103 struct task_struct *new_parent)
diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h
index 9371c6116df3..39b66713a0bb 100644
--- a/include/linux/quicklist.h
+++ b/include/linux/quicklist.h
@@ -56,14 +56,6 @@ static inline void __quicklist_free(int nr, void (*dtor)(void *), void *p,
56 struct page *page) 56 struct page *page)
57{ 57{
58 struct quicklist *q; 58 struct quicklist *q;
59 int nid = page_to_nid(page);
60
61 if (unlikely(nid != numa_node_id())) {
62 if (dtor)
63 dtor(p);
64 __free_page(page);
65 return;
66 }
67 59
68 q = &get_cpu_var(quicklist)[nr]; 60 q = &get_cpu_var(quicklist)[nr];
69 *(void **)p = q->page; 61 *(void **)p = q->page;
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 416e000dfe81..e3ff21dbac53 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -191,8 +191,8 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
191 /* 191 /*
192 * offset and length are unused for chain entry. Clear them. 192 * offset and length are unused for chain entry. Clear them.
193 */ 193 */
194 prv->offset = 0; 194 prv[prv_nents - 1].offset = 0;
195 prv->length = 0; 195 prv[prv_nents - 1].length = 0;
196 196
197 /* 197 /*
198 * Set lowest bit to indicate a link pointer, and make sure to clear 198 * Set lowest bit to indicate a link pointer, and make sure to clear
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ac3d496fbd20..cc14656f8682 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1255,13 +1255,6 @@ struct pid_namespace;
1255 * 1255 *
1256 * set_task_vxid() : assigns a virtual id to a task; 1256 * set_task_vxid() : assigns a virtual id to a task;
1257 * 1257 *
1258 * task_ppid_nr_ns() : the parent's id as seen from the namespace specified.
1259 * the result depends on the namespace and whether the
1260 * task in question is the namespace's init. e.g. for the
1261 * namespace's init this will return 0 when called from
1262 * the namespace of this init, or appropriate id otherwise.
1263 *
1264 *
1265 * see also pid_nr() etc in include/linux/pid.h 1258 * see also pid_nr() etc in include/linux/pid.h
1266 */ 1259 */
1267 1260
@@ -1317,12 +1310,6 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1317} 1310}
1318 1311
1319 1312
1320static inline pid_t task_ppid_nr_ns(struct task_struct *tsk,
1321 struct pid_namespace *ns)
1322{
1323 return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns);
1324}
1325
1326/** 1313/**
1327 * pid_alive - check that a task structure is not stale 1314 * pid_alive - check that a task structure is not stale
1328 * @p: Task structure to be checked. 1315 * @p: Task structure to be checked.
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f3a8eecd99f3..f62caaad94e0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -271,5 +271,10 @@ static inline void *kzalloc(size_t size, gfp_t flags)
271 return kmalloc(size, flags | __GFP_ZERO); 271 return kmalloc(size, flags | __GFP_ZERO);
272} 272}
273 273
274#ifdef CONFIG_SLABINFO
275extern const struct seq_operations slabinfo_op;
276ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
277#endif
278
274#endif /* __KERNEL__ */ 279#endif /* __KERNEL__ */
275#endif /* _LINUX_SLAB_H */ 280#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 32bdc2ffd715..fcc48096ee64 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -95,7 +95,4 @@ found:
95 95
96#endif /* CONFIG_NUMA */ 96#endif /* CONFIG_NUMA */
97 97
98extern const struct seq_operations slabinfo_op;
99ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
100
101#endif /* _LINUX_SLAB_DEF_H */ 98#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
index 78dfbac36375..6dac0d7365cc 100644
--- a/include/linux/tc_act/Kbuild
+++ b/include/linux/tc_act/Kbuild
@@ -2,3 +2,4 @@ header-y += tc_gact.h
2header-y += tc_ipt.h 2header-y += tc_ipt.h
3header-y += tc_mirred.h 3header-y += tc_mirred.h
4header-y += tc_pedit.h 4header-y += tc_pedit.h
5header-y += tc_nat.h
diff --git a/include/linux/tty.h b/include/linux/tty.h
index c555f5442bd7..defd2ab72449 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -319,6 +319,7 @@ extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
319extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); 319extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud);
320extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); 320extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud);
321extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 321extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
322extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
322 323
323extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 324extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
324extern void tty_ldisc_deref(struct tty_ldisc *); 325extern void tty_ldisc_deref(struct tty_ldisc *);
diff --git a/include/net/veth.h b/include/linux/veth.h
index 3354c1eb424e..3354c1eb424e 100644
--- a/include/net/veth.h
+++ b/include/linux/veth.h
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 7daafdc2514b..7f28c32d9aca 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -149,19 +149,27 @@ struct execute_work {
149 149
150extern struct workqueue_struct * 150extern struct workqueue_struct *
151__create_workqueue_key(const char *name, int singlethread, 151__create_workqueue_key(const char *name, int singlethread,
152 int freezeable, struct lock_class_key *key); 152 int freezeable, struct lock_class_key *key,
153 const char *lock_name);
153 154
154#ifdef CONFIG_LOCKDEP 155#ifdef CONFIG_LOCKDEP
155#define __create_workqueue(name, singlethread, freezeable) \ 156#define __create_workqueue(name, singlethread, freezeable) \
156({ \ 157({ \
157 static struct lock_class_key __key; \ 158 static struct lock_class_key __key; \
159 const char *__lock_name; \
160 \
161 if (__builtin_constant_p(name)) \
162 __lock_name = (name); \
163 else \
164 __lock_name = #name; \
158 \ 165 \
159 __create_workqueue_key((name), (singlethread), \ 166 __create_workqueue_key((name), (singlethread), \
160 (freezeable), &__key); \ 167 (freezeable), &__key, \
168 __lock_name); \
161}) 169})
162#else 170#else
163#define __create_workqueue(name, singlethread, freezeable) \ 171#define __create_workqueue(name, singlethread, freezeable) \
164 __create_workqueue_key((name), (singlethread), (freezeable), NULL) 172 __create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL)
165#endif 173#endif
166 174
167#define create_workqueue(name) __create_workqueue((name), 0, 0) 175#define create_workqueue(name) __create_workqueue((name), 0, 0)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index bef7d66601cb..c6148bbf1250 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,7 +62,6 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */
66}; 65};
67 66
68/* 67/*
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 4e3cd93f81fc..32a57e1dee3a 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -35,7 +35,7 @@
35#define AX25_P_ATALK 0xca /* Appletalk */ 35#define AX25_P_ATALK 0xca /* Appletalk */
36#define AX25_P_ATALK_ARP 0xcb /* Appletalk ARP */ 36#define AX25_P_ATALK_ARP 0xcb /* Appletalk ARP */
37#define AX25_P_IP 0xcc /* ARPA Internet Protocol */ 37#define AX25_P_IP 0xcc /* ARPA Internet Protocol */
38#define AX25_P_ARP 0xcd /* ARPA Adress Resolution */ 38#define AX25_P_ARP 0xcd /* ARPA Address Resolution */
39#define AX25_P_FLEXNET 0xce /* FlexNet */ 39#define AX25_P_FLEXNET 0xce /* FlexNet */
40#define AX25_P_NETROM 0xcf /* NET/ROM */ 40#define AX25_P_NETROM 0xcf /* NET/ROM */
41#define AX25_P_TEXT 0xF0 /* No layer 3 protocol impl. */ 41#define AX25_P_TEXT 0xF0 /* No layer 3 protocol impl. */
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 29c9da707c7a..c17fa1fdc356 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -23,7 +23,7 @@ struct ip6_tnl {
23 struct net_device *dev; /* virtual device associated with tunnel */ 23 struct net_device *dev; /* virtual device associated with tunnel */
24 struct net_device_stats stat; /* statistics for tunnel device */ 24 struct net_device_stats stat; /* statistics for tunnel device */
25 int recursion; /* depth of hard_start_xmit recursion */ 25 int recursion; /* depth of hard_start_xmit recursion */
26 struct ip6_tnl_parm parms; /* tunnel configuration paramters */ 26 struct ip6_tnl_parm parms; /* tunnel configuration parameters */
27 struct flowi fl; /* flowi template for xmit */ 27 struct flowi fl; /* flowi template for xmit */
28 struct dst_entry *dst_cache; /* cached dst */ 28 struct dst_entry *dst_cache; /* cached dst */
29 u32 dst_cookie; 29 u32 dst_cookie;
diff --git a/include/net/irda/discovery.h b/include/net/irda/discovery.h
index eb0f9de47294..e4efad1f9eff 100644
--- a/include/net/irda/discovery.h
+++ b/include/net/irda/discovery.h
@@ -80,7 +80,7 @@ typedef struct discovery_t {
80 irda_queue_t q; /* Must be first! */ 80 irda_queue_t q; /* Must be first! */
81 81
82 discinfo_t data; /* Basic discovery information */ 82 discinfo_t data; /* Basic discovery information */
83 int name_len; /* Lenght of nickname */ 83 int name_len; /* Length of nickname */
84 84
85 LAP_REASON condition; /* More info about the discovery */ 85 LAP_REASON condition; /* More info about the discovery */
86 int gen_addr_bit; /* Need to generate a new device 86 int gen_addr_bit; /* Need to generate a new device
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 90fb66d99d0c..4ac5ab187c2a 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -249,6 +249,7 @@ static inline int nf_ct_is_untracked(const struct sk_buff *skb)
249 return (skb->nfct == &nf_conntrack_untracked.ct_general); 249 return (skb->nfct == &nf_conntrack_untracked.ct_general);
250} 250}
251 251
252extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
252extern unsigned int nf_conntrack_htable_size; 253extern unsigned int nf_conntrack_htable_size;
253extern int nf_conntrack_checksum; 254extern int nf_conntrack_checksum;
254extern atomic_t nf_conntrack_count; 255extern atomic_t nf_conntrack_count;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c9265518a378..4c3b35153c37 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -325,7 +325,6 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask)
325 n->tc_verd = SET_TC_VERD(n->tc_verd, 0); 325 n->tc_verd = SET_TC_VERD(n->tc_verd, 0);
326 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd); 326 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
327 n->tc_verd = CLR_TC_MUNGED(n->tc_verd); 327 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
328 n->iif = skb->iif;
329 } 328 }
330 return n; 329 return n;
331} 330}
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 002a00a4e6be..bb965742b64e 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -301,7 +301,7 @@ struct sctp_sock {
301 /* The default SACK delay timeout for new associations. */ 301 /* The default SACK delay timeout for new associations. */
302 __u32 sackdelay; 302 __u32 sackdelay;
303 303
304 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ 304 /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
305 __u32 param_flags; 305 __u32 param_flags;
306 306
307 struct sctp_initmsg initmsg; 307 struct sctp_initmsg initmsg;
@@ -955,7 +955,7 @@ struct sctp_transport {
955 /* PMTU : The current known path MTU. */ 955 /* PMTU : The current known path MTU. */
956 __u32 pathmtu; 956 __u32 pathmtu;
957 957
958 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ 958 /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
959 __u32 param_flags; 959 __u32 param_flags;
960 960
961 /* The number of times INIT has been sent on this transport. */ 961 /* The number of times INIT has been sent on this transport. */
@@ -1638,7 +1638,7 @@ struct sctp_association {
1638 */ 1638 */
1639 __u32 pathmtu; 1639 __u32 pathmtu;
1640 1640
1641 /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ 1641 /* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */
1642 __u32 param_flags; 1642 __u32 param_flags;
1643 1643
1644 /* SACK delay timeout */ 1644 /* SACK delay timeout */
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 00848b641f59..954090b1e354 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -450,7 +450,7 @@ enum sctp_sn_type {
450 SCTP_SHUTDOWN_EVENT, 450 SCTP_SHUTDOWN_EVENT,
451 SCTP_PARTIAL_DELIVERY_EVENT, 451 SCTP_PARTIAL_DELIVERY_EVENT,
452 SCTP_ADAPTATION_INDICATION, 452 SCTP_ADAPTATION_INDICATION,
453 SCTP_AUTHENTICATION_EVENT, 453 SCTP_AUTHENTICATION_INDICATION,
454}; 454};
455 455
456/* Notification error codes used to fill up the error fields in some 456/* Notification error codes used to fill up the error fields in some
diff --git a/include/net/sock.h b/include/net/sock.h
index 67e35c7e230c..6e1542da33a1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -944,7 +944,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
944 return err; 944 return err;
945 945
946 rcu_read_lock_bh(); 946 rcu_read_lock_bh();
947 filter = sk->sk_filter; 947 filter = rcu_dereference(sk->sk_filter);
948 if (filter) { 948 if (filter) {
949 unsigned int pkt_len = sk_run_filter(skb, filter->insns, 949 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
950 filter->len); 950 filter->len);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 58dfa82889aa..1dd20cf17982 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1188,10 +1188,15 @@ static inline int xfrm_aevent_is_on(void)
1188 return ret; 1188 return ret;
1189} 1189}
1190 1190
1191static inline int xfrm_alg_len(struct xfrm_algo *alg)
1192{
1193 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1194}
1195
1191#ifdef CONFIG_XFRM_MIGRATE 1196#ifdef CONFIG_XFRM_MIGRATE
1192static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1197static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1193{ 1198{
1194 return (struct xfrm_algo *)kmemdup(orig, sizeof(*orig) + orig->alg_key_len, GFP_KERNEL); 1199 return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
1195} 1200}
1196 1201
1197static inline void xfrm_states_put(struct xfrm_state **states, int n) 1202static inline void xfrm_states_put(struct xfrm_state **states, int n)
diff --git a/init/Kconfig b/init/Kconfig
index 404bbf3699be..b9d11a899b88 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -658,6 +658,12 @@ endchoice
658 658
659endmenu # General setup 659endmenu # General setup
660 660
661config SLABINFO
662 bool
663 depends on PROC_FS
664 depends on SLAB || SLUB
665 default y
666
661config RT_MUTEXES 667config RT_MUTEXES
662 boolean 668 boolean
663 select PLIST 669 select PLIST
diff --git a/kernel/acct.c b/kernel/acct.c
index cf19547cc9e4..521dfa53cb99 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -482,7 +482,7 @@ static void do_acct_process(struct file *file)
482#endif 482#endif
483#if ACCT_VERSION==3 483#if ACCT_VERSION==3
484 ac.ac_pid = current->tgid; 484 ac.ac_pid = current->tgid;
485 ac.ac_ppid = current->parent->tgid; 485 ac.ac_ppid = current->real_parent->tgid;
486#endif 486#endif
487 487
488 spin_lock_irq(&current->sighand->siglock); 488 spin_lock_irq(&current->sighand->siglock);
diff --git a/kernel/futex.c b/kernel/futex.c
index 172a1aeeafdb..db9824de8bf0 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1097,15 +1097,15 @@ static void unqueue_me_pi(struct futex_q *q)
1097} 1097}
1098 1098
1099/* 1099/*
1100 * Fixup the pi_state owner with current. 1100 * Fixup the pi_state owner with the new owner.
1101 * 1101 *
1102 * Must be called with hash bucket lock held and mm->sem held for non 1102 * Must be called with hash bucket lock held and mm->sem held for non
1103 * private futexes. 1103 * private futexes.
1104 */ 1104 */
1105static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, 1105static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1106 struct task_struct *curr) 1106 struct task_struct *newowner)
1107{ 1107{
1108 u32 newtid = task_pid_vnr(curr) | FUTEX_WAITERS; 1108 u32 newtid = task_pid_vnr(newowner) | FUTEX_WAITERS;
1109 struct futex_pi_state *pi_state = q->pi_state; 1109 struct futex_pi_state *pi_state = q->pi_state;
1110 u32 uval, curval, newval; 1110 u32 uval, curval, newval;
1111 int ret; 1111 int ret;
@@ -1119,12 +1119,12 @@ static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1119 } else 1119 } else
1120 newtid |= FUTEX_OWNER_DIED; 1120 newtid |= FUTEX_OWNER_DIED;
1121 1121
1122 pi_state->owner = curr; 1122 pi_state->owner = newowner;
1123 1123
1124 spin_lock_irq(&curr->pi_lock); 1124 spin_lock_irq(&newowner->pi_lock);
1125 WARN_ON(!list_empty(&pi_state->list)); 1125 WARN_ON(!list_empty(&pi_state->list));
1126 list_add(&pi_state->list, &curr->pi_state_list); 1126 list_add(&pi_state->list, &newowner->pi_state_list);
1127 spin_unlock_irq(&curr->pi_lock); 1127 spin_unlock_irq(&newowner->pi_lock);
1128 1128
1129 /* 1129 /*
1130 * We own it, so we have to replace the pending owner 1130 * We own it, so we have to replace the pending owner
@@ -1508,9 +1508,40 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1508 * when we were on the way back before we locked the 1508 * when we were on the way back before we locked the
1509 * hash bucket. 1509 * hash bucket.
1510 */ 1510 */
1511 if (q.pi_state->owner == curr && 1511 if (q.pi_state->owner == curr) {
1512 rt_mutex_trylock(&q.pi_state->pi_mutex)) { 1512 /*
1513 ret = 0; 1513 * Try to get the rt_mutex now. This might
1514 * fail as some other task acquired the
1515 * rt_mutex after we removed ourself from the
1516 * rt_mutex waiters list.
1517 */
1518 if (rt_mutex_trylock(&q.pi_state->pi_mutex))
1519 ret = 0;
1520 else {
1521 /*
1522 * pi_state is incorrect, some other
1523 * task did a lock steal and we
1524 * returned due to timeout or signal
1525 * without taking the rt_mutex. Too
1526 * late. We can access the
1527 * rt_mutex_owner without locking, as
1528 * the other task is now blocked on
1529 * the hash bucket lock. Fix the state
1530 * up.
1531 */
1532 struct task_struct *owner;
1533 int res;
1534
1535 owner = rt_mutex_owner(&q.pi_state->pi_mutex);
1536 res = fixup_pi_state_owner(uaddr, &q, owner);
1537
1538 WARN_ON(rt_mutex_owner(&q.pi_state->pi_mutex) !=
1539 owner);
1540
1541 /* propagate -EFAULT, if the fixup failed */
1542 if (res)
1543 ret = res;
1544 }
1514 } else { 1545 } else {
1515 /* 1546 /*
1516 * Paranoia check. If we did not take the lock 1547 * Paranoia check. If we did not take the lock
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index e65dd0b47cdc..f994bb8065e6 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1378,7 +1378,7 @@ sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
1378/* 1378/*
1379 * Functions related to boot-time initialization: 1379 * Functions related to boot-time initialization:
1380 */ 1380 */
1381static void __devinit init_hrtimers_cpu(int cpu) 1381static void __cpuinit init_hrtimers_cpu(int cpu)
1382{ 1382{
1383 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 1383 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
1384 int i; 1384 int i;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index aa74a1ef2da8..9a26eec9eb04 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1404,6 +1404,7 @@ static int __init crash_save_vmcoreinfo_init(void)
1404 VMCOREINFO_OFFSET(list_head, next); 1404 VMCOREINFO_OFFSET(list_head, next);
1405 VMCOREINFO_OFFSET(list_head, prev); 1405 VMCOREINFO_OFFSET(list_head, prev);
1406 VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER); 1406 VMCOREINFO_LENGTH(zone.free_area, MAX_ORDER);
1407 VMCOREINFO_LENGTH(free_area.free_list, MIGRATE_TYPES);
1407 VMCOREINFO_NUMBER(NR_FREE_PAGES); 1408 VMCOREINFO_NUMBER(NR_FREE_PAGES);
1408 1409
1409 arch_crash_save_vmcoreinfo(); 1410 arch_crash_save_vmcoreinfo();
diff --git a/kernel/kmod.c b/kernel/kmod.c
index c6a4f8aebeba..bb7df2a28bd7 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -451,13 +451,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
451 enum umh_wait wait) 451 enum umh_wait wait)
452{ 452{
453 DECLARE_COMPLETION_ONSTACK(done); 453 DECLARE_COMPLETION_ONSTACK(done);
454 int retval; 454 int retval = 0;
455 455
456 helper_lock(); 456 helper_lock();
457 if (sub_info->path[0] == '\0') { 457 if (sub_info->path[0] == '\0')
458 retval = 0;
459 goto out; 458 goto out;
460 }
461 459
462 if (!khelper_wq || usermodehelper_disabled) { 460 if (!khelper_wq || usermodehelper_disabled) {
463 retval = -EBUSY; 461 retval = -EBUSY;
@@ -468,13 +466,14 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,
468 sub_info->wait = wait; 466 sub_info->wait = wait;
469 467
470 queue_work(khelper_wq, &sub_info->work); 468 queue_work(khelper_wq, &sub_info->work);
471 if (wait == UMH_NO_WAIT) /* task has freed sub_info */ 469 if (wait == UMH_NO_WAIT) /* task has freed sub_info */
472 return 0; 470 goto unlock;
473 wait_for_completion(&done); 471 wait_for_completion(&done);
474 retval = sub_info->retval; 472 retval = sub_info->retval;
475 473
476 out: 474out:
477 call_usermodehelper_freeinfo(sub_info); 475 call_usermodehelper_freeinfo(sub_info);
476unlock:
478 helper_unlock(); 477 helper_unlock();
479 return retval; 478 return retval;
480} 479}
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 723bd9f92556..4335f12a27c6 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2943,9 +2943,10 @@ void lockdep_free_key_range(void *start, unsigned long size)
2943 struct list_head *head; 2943 struct list_head *head;
2944 unsigned long flags; 2944 unsigned long flags;
2945 int i; 2945 int i;
2946 int locked;
2946 2947
2947 raw_local_irq_save(flags); 2948 raw_local_irq_save(flags);
2948 graph_lock(); 2949 locked = graph_lock();
2949 2950
2950 /* 2951 /*
2951 * Unhash all classes that were created by this module: 2952 * Unhash all classes that were created by this module:
@@ -2959,7 +2960,8 @@ void lockdep_free_key_range(void *start, unsigned long size)
2959 zap_class(class); 2960 zap_class(class);
2960 } 2961 }
2961 2962
2962 graph_unlock(); 2963 if (locked)
2964 graph_unlock();
2963 raw_local_irq_restore(flags); 2965 raw_local_irq_restore(flags);
2964} 2966}
2965 2967
@@ -2969,6 +2971,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)
2969 struct list_head *head; 2971 struct list_head *head;
2970 unsigned long flags; 2972 unsigned long flags;
2971 int i, j; 2973 int i, j;
2974 int locked;
2972 2975
2973 raw_local_irq_save(flags); 2976 raw_local_irq_save(flags);
2974 2977
@@ -2987,7 +2990,7 @@ void lockdep_reset_lock(struct lockdep_map *lock)
2987 * Debug check: in the end all mapped classes should 2990 * Debug check: in the end all mapped classes should
2988 * be gone. 2991 * be gone.
2989 */ 2992 */
2990 graph_lock(); 2993 locked = graph_lock();
2991 for (i = 0; i < CLASSHASH_SIZE; i++) { 2994 for (i = 0; i < CLASSHASH_SIZE; i++) {
2992 head = classhash_table + i; 2995 head = classhash_table + i;
2993 if (list_empty(head)) 2996 if (list_empty(head))
@@ -3000,7 +3003,8 @@ void lockdep_reset_lock(struct lockdep_map *lock)
3000 } 3003 }
3001 } 3004 }
3002 } 3005 }
3003 graph_unlock(); 3006 if (locked)
3007 graph_unlock();
3004 3008
3005out_restore: 3009out_restore:
3006 raw_local_irq_restore(flags); 3010 raw_local_irq_restore(flags);
diff --git a/kernel/module.c b/kernel/module.c
index 91fe6958b6e1..c2e3e2e98801 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2214,29 +2214,34 @@ static const char *get_ksymbol(struct module *mod,
2214/* For kallsyms to ask for address resolution. NULL means not found. 2214/* For kallsyms to ask for address resolution. NULL means not found.
2215 We don't lock, as this is used for oops resolution and races are a 2215 We don't lock, as this is used for oops resolution and races are a
2216 lesser concern. */ 2216 lesser concern. */
2217/* FIXME: Risky: returns a pointer into a module w/o lock */
2217const char *module_address_lookup(unsigned long addr, 2218const char *module_address_lookup(unsigned long addr,
2218 unsigned long *size, 2219 unsigned long *size,
2219 unsigned long *offset, 2220 unsigned long *offset,
2220 char **modname) 2221 char **modname)
2221{ 2222{
2222 struct module *mod; 2223 struct module *mod;
2224 const char *ret = NULL;
2223 2225
2226 preempt_disable();
2224 list_for_each_entry(mod, &modules, list) { 2227 list_for_each_entry(mod, &modules, list) {
2225 if (within(addr, mod->module_init, mod->init_size) 2228 if (within(addr, mod->module_init, mod->init_size)
2226 || within(addr, mod->module_core, mod->core_size)) { 2229 || within(addr, mod->module_core, mod->core_size)) {
2227 if (modname) 2230 if (modname)
2228 *modname = mod->name; 2231 *modname = mod->name;
2229 return get_ksymbol(mod, addr, size, offset); 2232 ret = get_ksymbol(mod, addr, size, offset);
2233 break;
2230 } 2234 }
2231 } 2235 }
2232 return NULL; 2236 preempt_enable();
2237 return ret;
2233} 2238}
2234 2239
2235int lookup_module_symbol_name(unsigned long addr, char *symname) 2240int lookup_module_symbol_name(unsigned long addr, char *symname)
2236{ 2241{
2237 struct module *mod; 2242 struct module *mod;
2238 2243
2239 mutex_lock(&module_mutex); 2244 preempt_disable();
2240 list_for_each_entry(mod, &modules, list) { 2245 list_for_each_entry(mod, &modules, list) {
2241 if (within(addr, mod->module_init, mod->init_size) || 2246 if (within(addr, mod->module_init, mod->init_size) ||
2242 within(addr, mod->module_core, mod->core_size)) { 2247 within(addr, mod->module_core, mod->core_size)) {
@@ -2246,12 +2251,12 @@ int lookup_module_symbol_name(unsigned long addr, char *symname)
2246 if (!sym) 2251 if (!sym)
2247 goto out; 2252 goto out;
2248 strlcpy(symname, sym, KSYM_NAME_LEN); 2253 strlcpy(symname, sym, KSYM_NAME_LEN);
2249 mutex_unlock(&module_mutex); 2254 preempt_enable();
2250 return 0; 2255 return 0;
2251 } 2256 }
2252 } 2257 }
2253out: 2258out:
2254 mutex_unlock(&module_mutex); 2259 preempt_enable();
2255 return -ERANGE; 2260 return -ERANGE;
2256} 2261}
2257 2262
@@ -2260,7 +2265,7 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
2260{ 2265{
2261 struct module *mod; 2266 struct module *mod;
2262 2267
2263 mutex_lock(&module_mutex); 2268 preempt_disable();
2264 list_for_each_entry(mod, &modules, list) { 2269 list_for_each_entry(mod, &modules, list) {
2265 if (within(addr, mod->module_init, mod->init_size) || 2270 if (within(addr, mod->module_init, mod->init_size) ||
2266 within(addr, mod->module_core, mod->core_size)) { 2271 within(addr, mod->module_core, mod->core_size)) {
@@ -2273,12 +2278,12 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size,
2273 strlcpy(modname, mod->name, MODULE_NAME_LEN); 2278 strlcpy(modname, mod->name, MODULE_NAME_LEN);
2274 if (name) 2279 if (name)
2275 strlcpy(name, sym, KSYM_NAME_LEN); 2280 strlcpy(name, sym, KSYM_NAME_LEN);
2276 mutex_unlock(&module_mutex); 2281 preempt_enable();
2277 return 0; 2282 return 0;
2278 } 2283 }
2279 } 2284 }
2280out: 2285out:
2281 mutex_unlock(&module_mutex); 2286 preempt_enable();
2282 return -ERANGE; 2287 return -ERANGE;
2283} 2288}
2284 2289
@@ -2287,7 +2292,7 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
2287{ 2292{
2288 struct module *mod; 2293 struct module *mod;
2289 2294
2290 mutex_lock(&module_mutex); 2295 preempt_disable();
2291 list_for_each_entry(mod, &modules, list) { 2296 list_for_each_entry(mod, &modules, list) {
2292 if (symnum < mod->num_symtab) { 2297 if (symnum < mod->num_symtab) {
2293 *value = mod->symtab[symnum].st_value; 2298 *value = mod->symtab[symnum].st_value;
@@ -2296,12 +2301,12 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
2296 KSYM_NAME_LEN); 2301 KSYM_NAME_LEN);
2297 strlcpy(module_name, mod->name, MODULE_NAME_LEN); 2302 strlcpy(module_name, mod->name, MODULE_NAME_LEN);
2298 *exported = is_exported(name, mod); 2303 *exported = is_exported(name, mod);
2299 mutex_unlock(&module_mutex); 2304 preempt_enable();
2300 return 0; 2305 return 0;
2301 } 2306 }
2302 symnum -= mod->num_symtab; 2307 symnum -= mod->num_symtab;
2303 } 2308 }
2304 mutex_unlock(&module_mutex); 2309 preempt_enable();
2305 return -ERANGE; 2310 return -ERANGE;
2306} 2311}
2307 2312
@@ -2324,6 +2329,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
2324 unsigned long ret = 0; 2329 unsigned long ret = 0;
2325 2330
2326 /* Don't lock: we're in enough trouble already. */ 2331 /* Don't lock: we're in enough trouble already. */
2332 preempt_disable();
2327 if ((colon = strchr(name, ':')) != NULL) { 2333 if ((colon = strchr(name, ':')) != NULL) {
2328 *colon = '\0'; 2334 *colon = '\0';
2329 if ((mod = find_module(name)) != NULL) 2335 if ((mod = find_module(name)) != NULL)
@@ -2334,6 +2340,7 @@ unsigned long module_kallsyms_lookup_name(const char *name)
2334 if ((ret = mod_find_symname(mod, name)) != 0) 2340 if ((ret = mod_find_symname(mod, name)) != 0)
2335 break; 2341 break;
2336 } 2342 }
2343 preempt_enable();
2337 return ret; 2344 return ret;
2338} 2345}
2339#endif /* CONFIG_KALLSYMS */ 2346#endif /* CONFIG_KALLSYMS */
diff --git a/kernel/params.c b/kernel/params.c
index 2a4c51487e72..7686417ee00e 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -697,8 +697,18 @@ static struct kset_uevent_ops module_uevent_ops = {
697decl_subsys(module, &module_ktype, &module_uevent_ops); 697decl_subsys(module, &module_ktype, &module_uevent_ops);
698int module_sysfs_initialized; 698int module_sysfs_initialized;
699 699
700static void module_release(struct kobject *kobj)
701{
702 /*
703 * Stupid empty release function to allow the memory for the kobject to
704 * be properly cleaned up. This will not need to be present for 2.6.25
705 * with the upcoming kobject core rework.
706 */
707}
708
700static struct kobj_type module_ktype = { 709static struct kobj_type module_ktype = {
701 .sysfs_ops = &module_sysfs_ops, 710 .sysfs_ops = &module_sysfs_ops,
711 .release = module_release,
702}; 712};
703 713
704/* 714/*
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 3cdf95b1dc92..f71c9504a5c5 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -28,6 +28,9 @@ BLOCKING_NOTIFIER_HEAD(pm_chain_head);
28 28
29DEFINE_MUTEX(pm_mutex); 29DEFINE_MUTEX(pm_mutex);
30 30
31unsigned int pm_flags;
32EXPORT_SYMBOL(pm_flags);
33
31#ifdef CONFIG_SUSPEND 34#ifdef CONFIG_SUSPEND
32 35
33/* This is just an arbitrary number */ 36/* This is just an arbitrary number */
diff --git a/kernel/power/pm.c b/kernel/power/pm.c
index c50d15266c10..60c73fa670d5 100644
--- a/kernel/power/pm.c
+++ b/kernel/power/pm.c
@@ -27,8 +27,6 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/mutex.h> 28#include <linux/mutex.h>
29 29
30int pm_active;
31
32/* 30/*
33 * Locking notes: 31 * Locking notes:
34 * pm_devs_lock can be a semaphore providing pm ops are not called 32 * pm_devs_lock can be a semaphore providing pm ops are not called
@@ -204,6 +202,4 @@ int pm_send_all(pm_request_t rqst, void *data)
204 202
205EXPORT_SYMBOL(pm_register); 203EXPORT_SYMBOL(pm_register);
206EXPORT_SYMBOL(pm_send_all); 204EXPORT_SYMBOL(pm_send_all);
207EXPORT_SYMBOL(pm_active);
208
209 205
diff --git a/kernel/printk.c b/kernel/printk.c
index a30fe33de395..89011bf8c106 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -817,7 +817,7 @@ __setup("console=", console_setup);
817 * commonly to provide a default console (ie from PROM variables) when 817 * commonly to provide a default console (ie from PROM variables) when
818 * the user has not supplied one. 818 * the user has not supplied one.
819 */ 819 */
820int __init add_preferred_console(char *name, int idx, char *options) 820int add_preferred_console(char *name, int idx, char *options)
821{ 821{
822 struct console_cmdline *c; 822 struct console_cmdline *c;
823 int i; 823 int i;
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 7c76f2ffaeaa..c25db863081d 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -120,7 +120,7 @@ int ptrace_check_attach(struct task_struct *child, int kill)
120 return ret; 120 return ret;
121} 121}
122 122
123static int may_attach(struct task_struct *task) 123int __ptrace_may_attach(struct task_struct *task)
124{ 124{
125 /* May we inspect the given task? 125 /* May we inspect the given task?
126 * This check is used both for attaching with ptrace 126 * This check is used both for attaching with ptrace
@@ -154,7 +154,7 @@ int ptrace_may_attach(struct task_struct *task)
154{ 154{
155 int err; 155 int err;
156 task_lock(task); 156 task_lock(task);
157 err = may_attach(task); 157 err = __ptrace_may_attach(task);
158 task_unlock(task); 158 task_unlock(task);
159 return !err; 159 return !err;
160} 160}
@@ -196,7 +196,7 @@ repeat:
196 /* the same process cannot be attached many times */ 196 /* the same process cannot be attached many times */
197 if (task->ptrace & PT_PTRACED) 197 if (task->ptrace & PT_PTRACED)
198 goto bad; 198 goto bad;
199 retval = may_attach(task); 199 retval = __ptrace_may_attach(task);
200 if (retval) 200 if (retval)
201 goto bad; 201 goto bad;
202 202
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index a66d4d1615f7..f2c1a04e9b18 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -549,7 +549,7 @@ static void rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp,
549 rdp->blimit = blimit; 549 rdp->blimit = blimit;
550} 550}
551 551
552static void __devinit rcu_online_cpu(int cpu) 552static void __cpuinit rcu_online_cpu(int cpu)
553{ 553{
554 struct rcu_data *rdp = &per_cpu(rcu_data, cpu); 554 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
555 struct rcu_data *bh_rdp = &per_cpu(rcu_bh_data, cpu); 555 struct rcu_data *bh_rdp = &per_cpu(rcu_bh_data, cpu);
diff --git a/kernel/sched.c b/kernel/sched.c
index 3df84ea6aba9..e76b11ca6df3 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4918,7 +4918,7 @@ static void show_task(struct task_struct *p)
4918 } 4918 }
4919#endif 4919#endif
4920 printk(KERN_CONT "%5lu %5d %6d\n", free, 4920 printk(KERN_CONT "%5lu %5d %6d\n", free,
4921 task_pid_nr(p), task_pid_nr(p->parent)); 4921 task_pid_nr(p), task_pid_nr(p->real_parent));
4922 4922
4923 if (state != TASK_RUNNING) 4923 if (state != TASK_RUNNING)
4924 show_stack(p, NULL); 4924 show_stack(p, NULL);
@@ -7153,6 +7153,14 @@ int sched_group_set_shares(struct task_group *tg, unsigned long shares)
7153{ 7153{
7154 int i; 7154 int i;
7155 7155
7156 /*
7157 * A weight of 0 or 1 can cause arithmetics problems.
7158 * (The default weight is 1024 - so there's no practical
7159 * limitation from this.)
7160 */
7161 if (shares < 2)
7162 shares = 2;
7163
7156 spin_lock(&tg->lock); 7164 spin_lock(&tg->lock);
7157 if (tg->shares == shares) 7165 if (tg->shares == shares)
7158 goto done; 7166 goto done;
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index d30467b47ddd..80fbbfc04290 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -31,9 +31,9 @@
31/* 31/*
32 * Ease the printing of nsec fields: 32 * Ease the printing of nsec fields:
33 */ 33 */
34static long long nsec_high(long long nsec) 34static long long nsec_high(unsigned long long nsec)
35{ 35{
36 if (nsec < 0) { 36 if ((long long)nsec < 0) {
37 nsec = -nsec; 37 nsec = -nsec;
38 do_div(nsec, 1000000); 38 do_div(nsec, 1000000);
39 return -nsec; 39 return -nsec;
@@ -43,9 +43,9 @@ static long long nsec_high(long long nsec)
43 return nsec; 43 return nsec;
44} 44}
45 45
46static unsigned long nsec_low(long long nsec) 46static unsigned long nsec_low(unsigned long long nsec)
47{ 47{
48 if (nsec < 0) 48 if ((long long)nsec < 0)
49 nsec = -nsec; 49 nsec = -nsec;
50 50
51 return do_div(nsec, 1000000); 51 return do_div(nsec, 1000000);
diff --git a/kernel/timer.c b/kernel/timer.c
index d4527dcef1af..2a00c22203f3 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -978,7 +978,7 @@ asmlinkage long sys_getppid(void)
978 int pid; 978 int pid;
979 979
980 rcu_read_lock(); 980 rcu_read_lock();
981 pid = task_ppid_nr_ns(current, current->nsproxy->pid_ns); 981 pid = task_tgid_nr_ns(current->real_parent, current->nsproxy->pid_ns);
982 rcu_read_unlock(); 982 rcu_read_unlock();
983 983
984 return pid; 984 return pid;
@@ -1289,7 +1289,7 @@ static void migrate_timer_list(tvec_base_t *new_base, struct list_head *head)
1289 } 1289 }
1290} 1290}
1291 1291
1292static void __devinit migrate_timers(int cpu) 1292static void __cpuinit migrate_timers(int cpu)
1293{ 1293{
1294 tvec_base_t *old_base; 1294 tvec_base_t *old_base;
1295 tvec_base_t *new_base; 1295 tvec_base_t *new_base;
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 52d5e7c9a8e6..8db0b597509e 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -722,7 +722,8 @@ static void start_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
722struct workqueue_struct *__create_workqueue_key(const char *name, 722struct workqueue_struct *__create_workqueue_key(const char *name,
723 int singlethread, 723 int singlethread,
724 int freezeable, 724 int freezeable,
725 struct lock_class_key *key) 725 struct lock_class_key *key,
726 const char *lock_name)
726{ 727{
727 struct workqueue_struct *wq; 728 struct workqueue_struct *wq;
728 struct cpu_workqueue_struct *cwq; 729 struct cpu_workqueue_struct *cwq;
@@ -739,7 +740,7 @@ struct workqueue_struct *__create_workqueue_key(const char *name,
739 } 740 }
740 741
741 wq->name = name; 742 wq->name = name;
742 lockdep_init_map(&wq->lockdep_map, name, key, 0); 743 lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
743 wq->singlethread = singlethread; 744 wq->singlethread = singlethread;
744 wq->freezeable = freezeable; 745 wq->freezeable = freezeable;
745 INIT_LIST_HEAD(&wq->list); 746 INIT_LIST_HEAD(&wq->list);
diff --git a/lib/proportions.c b/lib/proportions.c
index 332d8c58184d..9508d9a7af3e 100644
--- a/lib/proportions.c
+++ b/lib/proportions.c
@@ -190,6 +190,8 @@ prop_adjust_shift(int *pl_shift, unsigned long *pl_period, int new_shift)
190 * PERCPU 190 * PERCPU
191 */ 191 */
192 192
193#define PROP_BATCH (8*(1+ilog2(nr_cpu_ids)))
194
193int prop_local_init_percpu(struct prop_local_percpu *pl) 195int prop_local_init_percpu(struct prop_local_percpu *pl)
194{ 196{
195 spin_lock_init(&pl->lock); 197 spin_lock_init(&pl->lock);
@@ -230,31 +232,24 @@ void prop_norm_percpu(struct prop_global *pg, struct prop_local_percpu *pl)
230 232
231 spin_lock_irqsave(&pl->lock, flags); 233 spin_lock_irqsave(&pl->lock, flags);
232 prop_adjust_shift(&pl->shift, &pl->period, pg->shift); 234 prop_adjust_shift(&pl->shift, &pl->period, pg->shift);
235
233 /* 236 /*
234 * For each missed period, we half the local counter. 237 * For each missed period, we half the local counter.
235 * basically: 238 * basically:
236 * pl->events >> (global_period - pl->period); 239 * pl->events >> (global_period - pl->period);
237 *
238 * but since the distributed nature of percpu counters make division
239 * rather hard, use a regular subtraction loop. This is safe, because
240 * the events will only every be incremented, hence the subtraction
241 * can never result in a negative number.
242 */ 240 */
243 while (pl->period != global_period) { 241 period = (global_period - pl->period) >> (pg->shift - 1);
244 unsigned long val = percpu_counter_read(&pl->events); 242 if (period < BITS_PER_LONG) {
245 unsigned long half = (val + 1) >> 1; 243 s64 val = percpu_counter_read(&pl->events);
246 244
247 /* 245 if (val < (nr_cpu_ids * PROP_BATCH))
248 * Half of zero won't be much less, break out. 246 val = percpu_counter_sum(&pl->events);
249 * This limits the loop to shift iterations, even 247
250 * if we missed a million. 248 __percpu_counter_add(&pl->events, -val + (val >> period),
251 */ 249 PROP_BATCH);
252 if (!val) 250 } else
253 break; 251 percpu_counter_set(&pl->events, 0);
254 252
255 percpu_counter_add(&pl->events, -half);
256 pl->period += period;
257 }
258 pl->period = global_period; 253 pl->period = global_period;
259 spin_unlock_irqrestore(&pl->lock, flags); 254 spin_unlock_irqrestore(&pl->lock, flags);
260} 255}
@@ -267,7 +262,7 @@ void __prop_inc_percpu(struct prop_descriptor *pd, struct prop_local_percpu *pl)
267 struct prop_global *pg = prop_get_global(pd); 262 struct prop_global *pg = prop_get_global(pd);
268 263
269 prop_norm_percpu(pg, pl); 264 prop_norm_percpu(pg, pl);
270 percpu_counter_add(&pl->events, 1); 265 __percpu_counter_add(&pl->events, 1, PROP_BATCH);
271 percpu_counter_add(&pg->events, 1); 266 percpu_counter_add(&pg->events, 1);
272 prop_put_global(pd, pg); 267 prop_put_global(pd, pg);
273} 268}
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index e233fff61b4b..f874ae818ad3 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -25,14 +25,15 @@ static struct page *__xip_sparse_page;
25static struct page *xip_sparse_page(void) 25static struct page *xip_sparse_page(void)
26{ 26{
27 if (!__xip_sparse_page) { 27 if (!__xip_sparse_page) {
28 unsigned long zeroes = get_zeroed_page(GFP_HIGHUSER); 28 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
29 if (zeroes) { 29
30 if (page) {
30 static DEFINE_SPINLOCK(xip_alloc_lock); 31 static DEFINE_SPINLOCK(xip_alloc_lock);
31 spin_lock(&xip_alloc_lock); 32 spin_lock(&xip_alloc_lock);
32 if (!__xip_sparse_page) 33 if (!__xip_sparse_page)
33 __xip_sparse_page = virt_to_page(zeroes); 34 __xip_sparse_page = page;
34 else 35 else
35 free_page(zeroes); 36 __free_page(page);
36 spin_unlock(&xip_alloc_lock); 37 spin_unlock(&xip_alloc_lock);
37 } 38 }
38 } 39 }
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 7224a4f07106..e0fda156f021 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -418,9 +418,14 @@ static struct page *alloc_huge_page_private(struct vm_area_struct *vma,
418 if (free_huge_pages > resv_huge_pages) 418 if (free_huge_pages > resv_huge_pages)
419 page = dequeue_huge_page(vma, addr); 419 page = dequeue_huge_page(vma, addr);
420 spin_unlock(&hugetlb_lock); 420 spin_unlock(&hugetlb_lock);
421 if (!page) 421 if (!page) {
422 page = alloc_buddy_huge_page(vma, addr); 422 page = alloc_buddy_huge_page(vma, addr);
423 return page ? page : ERR_PTR(-VM_FAULT_OOM); 423 if (!page) {
424 hugetlb_put_quota(vma->vm_file->f_mapping, 1);
425 return ERR_PTR(-VM_FAULT_OOM);
426 }
427 }
428 return page;
424} 429}
425 430
426static struct page *alloc_huge_page(struct vm_area_struct *vma, 431static struct page *alloc_huge_page(struct vm_area_struct *vma,
@@ -1206,8 +1211,10 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to)
1206 if (hugetlb_get_quota(inode->i_mapping, chg)) 1211 if (hugetlb_get_quota(inode->i_mapping, chg))
1207 return -ENOSPC; 1212 return -ENOSPC;
1208 ret = hugetlb_acct_memory(chg); 1213 ret = hugetlb_acct_memory(chg);
1209 if (ret < 0) 1214 if (ret < 0) {
1215 hugetlb_put_quota(inode->i_mapping, chg);
1210 return ret; 1216 return ret;
1217 }
1211 region_add(&inode->i_mapping->private_list, from, to); 1218 region_add(&inode->i_mapping->private_list, from, to);
1212 return 0; 1219 return 0;
1213} 1220}
diff --git a/mm/memory.c b/mm/memory.c
index 4bf0b6d0eb2a..4b0144b24c12 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -392,6 +392,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_
392 return NULL; 392 return NULL;
393 } 393 }
394 394
395#ifdef CONFIG_DEBUG_VM
395 /* 396 /*
396 * Add some anal sanity checks for now. Eventually, 397 * Add some anal sanity checks for now. Eventually,
397 * we should just do "return pfn_to_page(pfn)", but 398 * we should just do "return pfn_to_page(pfn)", but
@@ -402,6 +403,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_
402 print_bad_pte(vma, pte, addr); 403 print_bad_pte(vma, pte, addr);
403 return NULL; 404 return NULL;
404 } 405 }
406#endif
405 407
406 /* 408 /*
407 * NOTE! We still have PageReserved() pages in the page 409 * NOTE! We still have PageReserved() pages in the page
@@ -1668,6 +1670,9 @@ gotten:
1668unlock: 1670unlock:
1669 pte_unmap_unlock(page_table, ptl); 1671 pte_unmap_unlock(page_table, ptl);
1670 if (dirty_page) { 1672 if (dirty_page) {
1673 if (vma->vm_file)
1674 file_update_time(vma->vm_file);
1675
1671 /* 1676 /*
1672 * Yes, Virginia, this is actually required to prevent a race 1677 * Yes, Virginia, this is actually required to prevent a race
1673 * with clear_page_dirty_for_io() from clearing the page dirty 1678 * with clear_page_dirty_for_io() from clearing the page dirty
@@ -2341,6 +2346,9 @@ out_unlocked:
2341 if (anon) 2346 if (anon)
2342 page_cache_release(vmf.page); 2347 page_cache_release(vmf.page);
2343 else if (dirty_page) { 2348 else if (dirty_page) {
2349 if (vma->vm_file)
2350 file_update_time(vma->vm_file);
2351
2344 set_page_dirty_balance(dirty_page, page_mkwrite); 2352 set_page_dirty_balance(dirty_page, page_mkwrite);
2345 put_page(dirty_page); 2353 put_page(dirty_page);
2346 } 2354 }
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index d55cfcae2ef1..3d3848fa6324 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -558,7 +558,6 @@ static void background_writeout(unsigned long _min_pages)
558 global_page_state(NR_UNSTABLE_NFS) < background_thresh 558 global_page_state(NR_UNSTABLE_NFS) < background_thresh
559 && min_pages <= 0) 559 && min_pages <= 0)
560 break; 560 break;
561 wbc.more_io = 0;
562 wbc.encountered_congestion = 0; 561 wbc.encountered_congestion = 0;
563 wbc.nr_to_write = MAX_WRITEBACK_PAGES; 562 wbc.nr_to_write = MAX_WRITEBACK_PAGES;
564 wbc.pages_skipped = 0; 563 wbc.pages_skipped = 0;
@@ -566,9 +565,8 @@ static void background_writeout(unsigned long _min_pages)
566 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write; 565 min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
567 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { 566 if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) {
568 /* Wrote less than expected */ 567 /* Wrote less than expected */
569 if (wbc.encountered_congestion || wbc.more_io) 568 congestion_wait(WRITE, HZ/10);
570 congestion_wait(WRITE, HZ/10); 569 if (!wbc.encountered_congestion)
571 else
572 break; 570 break;
573 } 571 }
574 } 572 }
@@ -633,12 +631,11 @@ static void wb_kupdate(unsigned long arg)
633 global_page_state(NR_UNSTABLE_NFS) + 631 global_page_state(NR_UNSTABLE_NFS) +
634 (inodes_stat.nr_inodes - inodes_stat.nr_unused); 632 (inodes_stat.nr_inodes - inodes_stat.nr_unused);
635 while (nr_to_write > 0) { 633 while (nr_to_write > 0) {
636 wbc.more_io = 0;
637 wbc.encountered_congestion = 0; 634 wbc.encountered_congestion = 0;
638 wbc.nr_to_write = MAX_WRITEBACK_PAGES; 635 wbc.nr_to_write = MAX_WRITEBACK_PAGES;
639 writeback_inodes(&wbc); 636 writeback_inodes(&wbc);
640 if (wbc.nr_to_write > 0) { 637 if (wbc.nr_to_write > 0) {
641 if (wbc.encountered_congestion || wbc.more_io) 638 if (wbc.encountered_congestion)
642 congestion_wait(WRITE, HZ/10); 639 congestion_wait(WRITE, HZ/10);
643 else 640 else
644 break; /* All the old data is written */ 641 break; /* All the old data is written */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d73bfad1c32f..b2838c24e582 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2566,7 +2566,7 @@ static void __meminit zone_init_free_lists(struct pglist_data *pgdat,
2566 memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY) 2566 memmap_init_zone((size), (nid), (zone), (start_pfn), MEMMAP_EARLY)
2567#endif 2567#endif
2568 2568
2569static int __devinit zone_batchsize(struct zone *zone) 2569static int zone_batchsize(struct zone *zone)
2570{ 2570{
2571 int batch; 2571 int batch;
2572 2572
@@ -3438,7 +3438,7 @@ static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
3438 mem_map = NODE_DATA(0)->node_mem_map; 3438 mem_map = NODE_DATA(0)->node_mem_map;
3439#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 3439#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
3440 if (page_to_pfn(mem_map) != pgdat->node_start_pfn) 3440 if (page_to_pfn(mem_map) != pgdat->node_start_pfn)
3441 mem_map -= pgdat->node_start_pfn; 3441 mem_map -= (pgdat->node_start_pfn - ARCH_PFN_OFFSET);
3442#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ 3442#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
3443 } 3443 }
3444#endif 3444#endif
diff --git a/mm/quicklist.c b/mm/quicklist.c
index ae8189c2799e..3f703f7cb398 100644
--- a/mm/quicklist.c
+++ b/mm/quicklist.c
@@ -26,9 +26,17 @@ DEFINE_PER_CPU(struct quicklist, quicklist)[CONFIG_NR_QUICK];
26static unsigned long max_pages(unsigned long min_pages) 26static unsigned long max_pages(unsigned long min_pages)
27{ 27{
28 unsigned long node_free_pages, max; 28 unsigned long node_free_pages, max;
29 struct zone *zones = NODE_DATA(numa_node_id())->node_zones;
30
31 node_free_pages =
32#ifdef CONFIG_ZONE_DMA
33 zone_page_state(&zones[ZONE_DMA], NR_FREE_PAGES) +
34#endif
35#ifdef CONFIG_ZONE_DMA32
36 zone_page_state(&zones[ZONE_DMA32], NR_FREE_PAGES) +
37#endif
38 zone_page_state(&zones[ZONE_NORMAL], NR_FREE_PAGES);
29 39
30 node_free_pages = node_page_state(numa_node_id(),
31 NR_FREE_PAGES);
32 max = node_free_pages / FRACTION_OF_NODE_MEM; 40 max = node_free_pages / FRACTION_OF_NODE_MEM;
33 return max(max, min_pages); 41 return max(max, min_pages);
34} 42}
diff --git a/mm/slab.c b/mm/slab.c
index 2e338a5f7b14..aebb9f68557a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4105,7 +4105,7 @@ out:
4105 schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC)); 4105 schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_CPUC));
4106} 4106}
4107 4107
4108#ifdef CONFIG_PROC_FS 4108#ifdef CONFIG_SLABINFO
4109 4109
4110static void print_slabinfo_header(struct seq_file *m) 4110static void print_slabinfo_header(struct seq_file *m)
4111{ 4111{
diff --git a/mm/slub.c b/mm/slub.c
index b9f37cb0f2e6..474945ecd89d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -172,7 +172,7 @@ static inline void ClearSlabDebug(struct page *page)
172 * Mininum number of partial slabs. These will be left on the partial 172 * Mininum number of partial slabs. These will be left on the partial
173 * lists even if they are empty. kmem_cache_shrink may reclaim them. 173 * lists even if they are empty. kmem_cache_shrink may reclaim them.
174 */ 174 */
175#define MIN_PARTIAL 2 175#define MIN_PARTIAL 5
176 176
177/* 177/*
178 * Maximum number of desirable partial slabs. 178 * Maximum number of desirable partial slabs.
@@ -1613,7 +1613,7 @@ checks_ok:
1613 * then add it. 1613 * then add it.
1614 */ 1614 */
1615 if (unlikely(!prior)) 1615 if (unlikely(!prior))
1616 add_partial(get_node(s, page_to_nid(page)), page); 1616 add_partial_tail(get_node(s, page_to_nid(page)), page);
1617 1617
1618out_unlock: 1618out_unlock:
1619 slab_unlock(page); 1619 slab_unlock(page);
@@ -3076,6 +3076,19 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
3076 return slab_alloc(s, gfpflags, node, caller); 3076 return slab_alloc(s, gfpflags, node, caller);
3077} 3077}
3078 3078
3079static unsigned long count_partial(struct kmem_cache_node *n)
3080{
3081 unsigned long flags;
3082 unsigned long x = 0;
3083 struct page *page;
3084
3085 spin_lock_irqsave(&n->list_lock, flags);
3086 list_for_each_entry(page, &n->partial, lru)
3087 x += page->inuse;
3088 spin_unlock_irqrestore(&n->list_lock, flags);
3089 return x;
3090}
3091
3079#if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG) 3092#if defined(CONFIG_SYSFS) && defined(CONFIG_SLUB_DEBUG)
3080static int validate_slab(struct kmem_cache *s, struct page *page, 3093static int validate_slab(struct kmem_cache *s, struct page *page,
3081 unsigned long *map) 3094 unsigned long *map)
@@ -3458,19 +3471,6 @@ static int list_locations(struct kmem_cache *s, char *buf,
3458 return n; 3471 return n;
3459} 3472}
3460 3473
3461static unsigned long count_partial(struct kmem_cache_node *n)
3462{
3463 unsigned long flags;
3464 unsigned long x = 0;
3465 struct page *page;
3466
3467 spin_lock_irqsave(&n->list_lock, flags);
3468 list_for_each_entry(page, &n->partial, lru)
3469 x += page->inuse;
3470 spin_unlock_irqrestore(&n->list_lock, flags);
3471 return x;
3472}
3473
3474enum slab_stat_type { 3474enum slab_stat_type {
3475 SL_FULL, 3475 SL_FULL,
3476 SL_PARTIAL, 3476 SL_PARTIAL,
@@ -4123,3 +4123,89 @@ static int __init slab_sysfs_init(void)
4123 4123
4124__initcall(slab_sysfs_init); 4124__initcall(slab_sysfs_init);
4125#endif 4125#endif
4126
4127/*
4128 * The /proc/slabinfo ABI
4129 */
4130#ifdef CONFIG_SLABINFO
4131
4132ssize_t slabinfo_write(struct file *file, const char __user * buffer,
4133 size_t count, loff_t *ppos)
4134{
4135 return -EINVAL;
4136}
4137
4138
4139static void print_slabinfo_header(struct seq_file *m)
4140{
4141 seq_puts(m, "slabinfo - version: 2.1\n");
4142 seq_puts(m, "# name <active_objs> <num_objs> <objsize> "
4143 "<objperslab> <pagesperslab>");
4144 seq_puts(m, " : tunables <limit> <batchcount> <sharedfactor>");
4145 seq_puts(m, " : slabdata <active_slabs> <num_slabs> <sharedavail>");
4146 seq_putc(m, '\n');
4147}
4148
4149static void *s_start(struct seq_file *m, loff_t *pos)
4150{
4151 loff_t n = *pos;
4152
4153 down_read(&slub_lock);
4154 if (!n)
4155 print_slabinfo_header(m);
4156
4157 return seq_list_start(&slab_caches, *pos);
4158}
4159
4160static void *s_next(struct seq_file *m, void *p, loff_t *pos)
4161{
4162 return seq_list_next(p, &slab_caches, pos);
4163}
4164
4165static void s_stop(struct seq_file *m, void *p)
4166{
4167 up_read(&slub_lock);
4168}
4169
4170static int s_show(struct seq_file *m, void *p)
4171{
4172 unsigned long nr_partials = 0;
4173 unsigned long nr_slabs = 0;
4174 unsigned long nr_inuse = 0;
4175 unsigned long nr_objs;
4176 struct kmem_cache *s;
4177 int node;
4178
4179 s = list_entry(p, struct kmem_cache, list);
4180
4181 for_each_online_node(node) {
4182 struct kmem_cache_node *n = get_node(s, node);
4183
4184 if (!n)
4185 continue;
4186
4187 nr_partials += n->nr_partial;
4188 nr_slabs += atomic_long_read(&n->nr_slabs);
4189 nr_inuse += count_partial(n);
4190 }
4191
4192 nr_objs = nr_slabs * s->objects;
4193 nr_inuse += (nr_slabs - nr_partials) * s->objects;
4194
4195 seq_printf(m, "%-17s %6lu %6lu %6u %4u %4d", s->name, nr_inuse,
4196 nr_objs, s->size, s->objects, (1 << s->order));
4197 seq_printf(m, " : tunables %4u %4u %4u", 0, 0, 0);
4198 seq_printf(m, " : slabdata %6lu %6lu %6lu", nr_slabs, nr_slabs,
4199 0UL);
4200 seq_putc(m, '\n');
4201 return 0;
4202}
4203
4204const struct seq_operations slabinfo_op = {
4205 .start = s_start,
4206 .next = s_next,
4207 .stop = s_stop,
4208 .show = s_show,
4209};
4210
4211#endif /* CONFIG_SLABINFO */
diff --git a/net/802/tr.c b/net/802/tr.c
index a2bd0f2e3af8..1e115e5beab6 100644
--- a/net/802/tr.c
+++ b/net/802/tr.c
@@ -642,7 +642,7 @@ struct net_device *alloc_trdev(int sizeof_priv)
642static int __init rif_init(void) 642static int __init rif_init(void)
643{ 643{
644 init_timer(&rif_timer); 644 init_timer(&rif_timer);
645 rif_timer.expires = sysctl_tr_rif_timeout; 645 rif_timer.expires = jiffies + sysctl_tr_rif_timeout;
646 rif_timer.data = 0L; 646 rif_timer.data = 0L;
647 rif_timer.function = rif_check_expire; 647 rif_timer.function = rif_check_expire;
648 add_timer(&rif_timer); 648 add_timer(&rif_timer);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 4add9bd4bc8d..032bf44eca5e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -323,6 +323,7 @@ static const struct header_ops vlan_header_ops = {
323static int vlan_dev_init(struct net_device *dev) 323static int vlan_dev_init(struct net_device *dev)
324{ 324{
325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; 325 struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
326 int subclass = 0;
326 327
327 /* IFF_BROADCAST|IFF_MULTICAST; ??? */ 328 /* IFF_BROADCAST|IFF_MULTICAST; ??? */
328 dev->flags = real_dev->flags & ~IFF_UP; 329 dev->flags = real_dev->flags & ~IFF_UP;
@@ -349,7 +350,11 @@ static int vlan_dev_init(struct net_device *dev)
349 dev->hard_start_xmit = vlan_dev_hard_start_xmit; 350 dev->hard_start_xmit = vlan_dev_hard_start_xmit;
350 } 351 }
351 352
352 lockdep_set_class(&dev->_xmit_lock, &vlan_netdev_xmit_lock_key); 353 if (real_dev->priv_flags & IFF_802_1Q_VLAN)
354 subclass = 1;
355
356 lockdep_set_class_and_subclass(&dev->_xmit_lock,
357 &vlan_netdev_xmit_lock_key, subclass);
353 return 0; 358 return 0;
354} 359}
355 360
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 2086396de177..9c7f712fc7e9 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -542,6 +542,13 @@ static int mpc_send_packet(struct sk_buff *skb, struct net_device *dev)
542 if (eth->h_proto != htons(ETH_P_IP)) 542 if (eth->h_proto != htons(ETH_P_IP))
543 goto non_ip; /* Multi-Protocol Over ATM :-) */ 543 goto non_ip; /* Multi-Protocol Over ATM :-) */
544 544
545 /* Weed out funny packets (e.g., AF_PACKET or raw). */
546 if (skb->len < ETH_HLEN + sizeof(struct iphdr))
547 goto non_ip;
548 skb_set_network_header(skb, ETH_HLEN);
549 if (skb->len < ETH_HLEN + ip_hdr(skb)->ihl * 4 || ip_hdr(skb)->ihl < 5)
550 goto non_ip;
551
545 while (i < mpc->number_of_mps_macs) { 552 while (i < mpc->number_of_mps_macs) {
546 if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN))) 553 if (!compare_ether_addr(eth->h_dest, (mpc->mps_macs + i*ETH_ALEN)))
547 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */ 554 if ( send_via_shortcut(skb, mpc) == 0 ) /* try shortcut */
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 8378afd54b30..b4725ff317c0 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -87,10 +87,22 @@ static void ax25_kill_by_device(struct net_device *dev)
87 return; 87 return;
88 88
89 spin_lock_bh(&ax25_list_lock); 89 spin_lock_bh(&ax25_list_lock);
90again:
90 ax25_for_each(s, node, &ax25_list) { 91 ax25_for_each(s, node, &ax25_list) {
91 if (s->ax25_dev == ax25_dev) { 92 if (s->ax25_dev == ax25_dev) {
92 s->ax25_dev = NULL; 93 s->ax25_dev = NULL;
94 spin_unlock_bh(&ax25_list_lock);
93 ax25_disconnect(s, ENETUNREACH); 95 ax25_disconnect(s, ENETUNREACH);
96 spin_lock_bh(&ax25_list_lock);
97
98 /* The entry could have been deleted from the
99 * list meanwhile and thus the next pointer is
100 * no longer valid. Play it safe and restart
101 * the scan. Forward progress is ensured
102 * because we set s->ax25_dev to NULL and we
103 * are never passed a NULL 'dev' argument.
104 */
105 goto again;
94 } 106 }
95 } 107 }
96 spin_unlock_bh(&ax25_list_lock); 108 spin_unlock_bh(&ax25_list_lock);
@@ -1109,21 +1121,19 @@ static int __must_check ax25_connect(struct socket *sock,
1109 * some sanity checks. code further down depends on this 1121 * some sanity checks. code further down depends on this
1110 */ 1122 */
1111 1123
1112 if (addr_len == sizeof(struct sockaddr_ax25)) { 1124 if (addr_len == sizeof(struct sockaddr_ax25))
1113 /* support for this will go away in early 2.5.x */ 1125 /* support for this will go away in early 2.5.x
1114 printk(KERN_WARNING "ax25_connect(): %s uses obsolete socket structure\n", 1126 * ax25_connect(): uses obsolete socket structure
1115 current->comm); 1127 */
1116 } 1128 ;
1117 else if (addr_len != sizeof(struct full_sockaddr_ax25)) { 1129 else if (addr_len != sizeof(struct full_sockaddr_ax25))
1118 /* support for old structure may go away some time */ 1130 /* support for old structure may go away some time
1131 * ax25_connect(): uses old (6 digipeater) socket structure.
1132 */
1119 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1133 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1120 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1134 (addr_len > sizeof(struct full_sockaddr_ax25)))
1121 return -EINVAL; 1135 return -EINVAL;
1122 }
1123 1136
1124 printk(KERN_WARNING "ax25_connect(): %s uses old (6 digipeater) socket structure.\n",
1125 current->comm);
1126 }
1127 1137
1128 if (fsa->fsa_ax25.sax25_family != AF_AX25) 1138 if (fsa->fsa_ax25.sax25_family != AF_AX25)
1129 return -EINVAL; 1139 return -EINVAL;
@@ -1467,21 +1477,20 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1467 goto out; 1477 goto out;
1468 } 1478 }
1469 1479
1470 if (addr_len == sizeof(struct sockaddr_ax25)) { 1480 if (addr_len == sizeof(struct sockaddr_ax25))
1471 printk(KERN_WARNING "ax25_sendmsg(): %s uses obsolete socket structure\n", 1481 /* ax25_sendmsg(): uses obsolete socket structure */
1472 current->comm); 1482 ;
1473 } 1483 else if (addr_len != sizeof(struct full_sockaddr_ax25))
1474 else if (addr_len != sizeof(struct full_sockaddr_ax25)) { 1484 /* support for old structure may go away some time
1475 /* support for old structure may go away some time */ 1485 * ax25_sendmsg(): uses old (6 digipeater)
1486 * socket structure.
1487 */
1476 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) || 1488 if ((addr_len < sizeof(struct sockaddr_ax25) + sizeof(ax25_address) * 6) ||
1477 (addr_len > sizeof(struct full_sockaddr_ax25))) { 1489 (addr_len > sizeof(struct full_sockaddr_ax25))) {
1478 err = -EINVAL; 1490 err = -EINVAL;
1479 goto out; 1491 goto out;
1480 } 1492 }
1481 1493
1482 printk(KERN_WARNING "ax25_sendmsg(): %s uses old (6 digipeater) socket structure.\n",
1483 current->comm);
1484 }
1485 1494
1486 if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) { 1495 if (addr_len > sizeof(struct sockaddr_ax25) && usax->sax25_ndigis != 0) {
1487 int ct = 0; 1496 int ct = 0;
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 3b7d1720c2ee..d1be080dcb25 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -124,7 +124,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
124 } 124 }
125 125
126 skb_pull(skb, 1); /* Remove PID */ 126 skb_pull(skb, 1); /* Remove PID */
127 skb_reset_mac_header(skb); 127 skb->mac_header = skb->network_header;
128 skb_reset_network_header(skb); 128 skb_reset_network_header(skb);
129 skb->dev = ax25->ax25_dev->dev; 129 skb->dev = ax25->ax25_dev->dev;
130 skb->pkt_type = PACKET_HOST; 130 skb->pkt_type = PACKET_HOST;
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 9483320f6dad..34d1a3c822bf 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -259,22 +259,14 @@ int hci_conn_del(struct hci_conn *conn)
259 } 259 }
260 260
261 tasklet_disable(&hdev->tx_task); 261 tasklet_disable(&hdev->tx_task);
262
263 hci_conn_del_sysfs(conn);
264
265 hci_conn_hash_del(hdev, conn); 262 hci_conn_hash_del(hdev, conn);
266 if (hdev->notify) 263 if (hdev->notify)
267 hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); 264 hdev->notify(hdev, HCI_NOTIFY_CONN_DEL);
268
269 tasklet_enable(&hdev->tx_task); 265 tasklet_enable(&hdev->tx_task);
270
271 skb_queue_purge(&conn->data_q); 266 skb_queue_purge(&conn->data_q);
272 267 hci_conn_del_sysfs(conn);
273 hci_dev_put(hdev); 268 hci_dev_put(hdev);
274 269
275 /* will free via device release */
276 put_device(&conn->dev);
277
278 return 0; 270 return 0;
279} 271}
280 272
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index cef1e3e1881c..cad510309dcf 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -320,6 +320,7 @@ static void del_conn(struct work_struct *work)
320{ 320{
321 struct hci_conn *conn = container_of(work, struct hci_conn, work); 321 struct hci_conn *conn = container_of(work, struct hci_conn, work);
322 device_del(&conn->dev); 322 device_del(&conn->dev);
323 put_device(&conn->dev);
323} 324}
324 325
325void hci_conn_del_sysfs(struct hci_conn *conn) 326void hci_conn_del_sysfs(struct hci_conn *conn)
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index e447651a2dbe..a6a758dd1f7d 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -95,9 +95,10 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
95 95
96 BT_DBG("dev %p dlc %p", dev, dlc); 96 BT_DBG("dev %p dlc %p", dev, dlc);
97 97
98 write_lock_bh(&rfcomm_dev_lock); 98 /* Refcount should only hit zero when called from rfcomm_dev_del()
99 list_del_init(&dev->list); 99 which will have taken us off the list. Everything else are
100 write_unlock_bh(&rfcomm_dev_lock); 100 refcounting bugs. */
101 BUG_ON(!list_empty(&dev->list));
101 102
102 rfcomm_dlc_lock(dlc); 103 rfcomm_dlc_lock(dlc);
103 /* Detach DLC if it's owned by this dev */ 104 /* Detach DLC if it's owned by this dev */
@@ -109,11 +110,6 @@ static void rfcomm_dev_destruct(struct rfcomm_dev *dev)
109 110
110 tty_unregister_device(rfcomm_tty_driver, dev->id); 111 tty_unregister_device(rfcomm_tty_driver, dev->id);
111 112
112 /* Refcount should only hit zero when called from rfcomm_dev_del()
113 which will have taken us off the list. Everything else are
114 refcounting bugs. */
115 BUG_ON(!list_empty(&dev->list));
116
117 kfree(dev); 113 kfree(dev);
118 114
119 /* It's safe to call module_put() here because socket still 115 /* It's safe to call module_put() here because socket still
@@ -313,7 +309,15 @@ static void rfcomm_dev_del(struct rfcomm_dev *dev)
313{ 309{
314 BT_DBG("dev %p", dev); 310 BT_DBG("dev %p", dev);
315 311
316 set_bit(RFCOMM_TTY_RELEASED, &dev->flags); 312 if (test_bit(RFCOMM_TTY_RELEASED, &dev->flags))
313 BUG_ON(1);
314 else
315 set_bit(RFCOMM_TTY_RELEASED, &dev->flags);
316
317 write_lock_bh(&rfcomm_dev_lock);
318 list_del_init(&dev->list);
319 write_unlock_bh(&rfcomm_dev_lock);
320
317 rfcomm_dev_put(dev); 321 rfcomm_dev_put(dev);
318} 322}
319 323
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index c1757c79dfbb..9f78a69d6b8b 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -142,6 +142,23 @@ static inline struct nf_bridge_info *nf_bridge_alloc(struct sk_buff *skb)
142 return skb->nf_bridge; 142 return skb->nf_bridge;
143} 143}
144 144
145static inline struct nf_bridge_info *nf_bridge_unshare(struct sk_buff *skb)
146{
147 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
148
149 if (atomic_read(&nf_bridge->use) > 1) {
150 struct nf_bridge_info *tmp = nf_bridge_alloc(skb);
151
152 if (tmp) {
153 memcpy(tmp, nf_bridge, sizeof(struct nf_bridge_info));
154 atomic_set(&tmp->use, 1);
155 nf_bridge_put(nf_bridge);
156 }
157 nf_bridge = tmp;
158 }
159 return nf_bridge;
160}
161
145static inline void nf_bridge_push_encap_header(struct sk_buff *skb) 162static inline void nf_bridge_push_encap_header(struct sk_buff *skb)
146{ 163{
147 unsigned int len = nf_bridge_encap_header_len(skb); 164 unsigned int len = nf_bridge_encap_header_len(skb);
@@ -247,8 +264,9 @@ static void __br_dnat_complain(void)
247 * Let us first consider the case that ip_route_input() succeeds: 264 * Let us first consider the case that ip_route_input() succeeds:
248 * 265 *
249 * If skb->dst->dev equals the logical bridge device the packet 266 * If skb->dst->dev equals the logical bridge device the packet
250 * came in on, we can consider this bridging. We then call 267 * came in on, we can consider this bridging. The packet is passed
251 * skb->dst->output() which will make the packet enter br_nf_local_out() 268 * through the neighbour output function to build a new destination
269 * MAC address, which will make the packet enter br_nf_local_out()
252 * not much later. In that function it is assured that the iptables 270 * not much later. In that function it is assured that the iptables
253 * FORWARD chain is traversed for the packet. 271 * FORWARD chain is traversed for the packet.
254 * 272 *
@@ -285,12 +303,17 @@ static int br_nf_pre_routing_finish_bridge(struct sk_buff *skb)
285 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; 303 skb->nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
286 304
287 skb->dev = bridge_parent(skb->dev); 305 skb->dev = bridge_parent(skb->dev);
288 if (!skb->dev) 306 if (skb->dev) {
289 kfree_skb(skb); 307 struct dst_entry *dst = skb->dst;
290 else { 308
291 nf_bridge_pull_encap_header(skb); 309 nf_bridge_pull_encap_header(skb);
292 skb->dst->output(skb); 310
311 if (dst->hh)
312 return neigh_hh_output(dst->hh, skb);
313 else if (dst->neighbour)
314 return dst->neighbour->output(skb);
293 } 315 }
316 kfree_skb(skb);
294 return 0; 317 return 0;
295} 318}
296 319
@@ -631,6 +654,11 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
631 if (!skb->nf_bridge) 654 if (!skb->nf_bridge)
632 return NF_ACCEPT; 655 return NF_ACCEPT;
633 656
657 /* Need exclusive nf_bridge_info since we might have multiple
658 * different physoutdevs. */
659 if (!nf_bridge_unshare(skb))
660 return NF_DROP;
661
634 parent = bridge_parent(out); 662 parent = bridge_parent(out);
635 if (!parent) 663 if (!parent)
636 return NF_DROP; 664 return NF_DROP;
@@ -712,6 +740,11 @@ static unsigned int br_nf_local_out(unsigned int hook, struct sk_buff *skb,
712 if (!skb->nf_bridge) 740 if (!skb->nf_bridge)
713 return NF_ACCEPT; 741 return NF_ACCEPT;
714 742
743 /* Need exclusive nf_bridge_info since we might have multiple
744 * different physoutdevs. */
745 if (!nf_bridge_unshare(skb))
746 return NF_DROP;
747
715 nf_bridge = skb->nf_bridge; 748 nf_bridge = skb->nf_bridge;
716 if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT)) 749 if (!(nf_bridge->mask & BRNF_BRIDGED_DNAT))
717 return NF_ACCEPT; 750 return NF_ACCEPT;
diff --git a/net/compat.c b/net/compat.c
index d74d82155d78..377e560ab5c9 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -254,6 +254,8 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
254 if (copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr))) 254 if (copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr)))
255 return -EFAULT; 255 return -EFAULT;
256 cmlen = CMSG_COMPAT_SPACE(len); 256 cmlen = CMSG_COMPAT_SPACE(len);
257 if (kmsg->msg_controllen < cmlen)
258 cmlen = kmsg->msg_controllen;
257 kmsg->msg_control += cmlen; 259 kmsg->msg_control += cmlen;
258 kmsg->msg_controllen -= cmlen; 260 kmsg->msg_controllen -= cmlen;
259 return 0; 261 return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index 26a3a3a15be0..0879f52115eb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2207,8 +2207,12 @@ static void net_rx_action(struct softirq_action *h)
2207 * still "owns" the NAPI instance and therefore can 2207 * still "owns" the NAPI instance and therefore can
2208 * move the instance around on the list at-will. 2208 * move the instance around on the list at-will.
2209 */ 2209 */
2210 if (unlikely(work == weight)) 2210 if (unlikely(work == weight)) {
2211 list_move_tail(&n->poll_list, list); 2211 if (unlikely(napi_disable_pending(n)))
2212 __napi_complete(n);
2213 else
2214 list_move_tail(&n->poll_list, list);
2215 }
2212 2216
2213 netpoll_poll_unlock(have); 2217 netpoll_poll_unlock(have);
2214 } 2218 }
@@ -2819,7 +2823,7 @@ void dev_set_allmulti(struct net_device *dev, int inc)
2819/* 2823/*
2820 * Upload unicast and multicast address lists to device and 2824 * Upload unicast and multicast address lists to device and
2821 * configure RX filtering. When the device doesn't support unicast 2825 * configure RX filtering. When the device doesn't support unicast
2822 * filtering it is put in promiscous mode while unicast addresses 2826 * filtering it is put in promiscuous mode while unicast addresses
2823 * are present. 2827 * are present.
2824 */ 2828 */
2825void __dev_set_rx_mode(struct net_device *dev) 2829void __dev_set_rx_mode(struct net_device *dev)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1ba26fb4bf2..fed95a323b28 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -308,9 +308,12 @@ void __rtnl_link_unregister(struct rtnl_link_ops *ops)
308 struct net *net; 308 struct net *net;
309 309
310 for_each_net(net) { 310 for_each_net(net) {
311restart:
311 for_each_netdev_safe(net, dev, n) { 312 for_each_netdev_safe(net, dev, n) {
312 if (dev->rtnl_link_ops == ops) 313 if (dev->rtnl_link_ops == ops) {
313 ops->dellink(dev); 314 ops->dellink(dev);
315 goto restart;
316 }
314 } 317 }
315 } 318 }
316 list_del(&ops->list); 319 list_del(&ops->list);
diff --git a/net/core/scm.c b/net/core/scm.c
index 100ba6d9d478..10f5c65f6a47 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -196,6 +196,8 @@ int put_cmsg(struct msghdr * msg, int level, int type, int len, void *data)
196 if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr))) 196 if (copy_to_user(CMSG_DATA(cm), data, cmlen - sizeof(struct cmsghdr)))
197 goto out; 197 goto out;
198 cmlen = CMSG_SPACE(len); 198 cmlen = CMSG_SPACE(len);
199 if (msg->msg_controllen < cmlen)
200 cmlen = msg->msg_controllen;
199 msg->msg_control += cmlen; 201 msg->msg_control += cmlen;
200 msg->msg_controllen -= cmlen; 202 msg->msg_controllen -= cmlen;
201 err = 0; 203 err = 0;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 5b4ce9b4dd20..b6283779e93d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -416,16 +416,17 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb)
416 C(len); 416 C(len);
417 C(data_len); 417 C(data_len);
418 C(mac_len); 418 C(mac_len);
419 n->cloned = 1;
420 n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len; 419 n->hdr_len = skb->nohdr ? skb_headroom(skb) : skb->hdr_len;
420 n->cloned = 1;
421 n->nohdr = 0; 421 n->nohdr = 0;
422 n->destructor = NULL; 422 n->destructor = NULL;
423 C(truesize); 423 C(iif);
424 atomic_set(&n->users, 1);
425 C(head);
426 C(data);
427 C(tail); 424 C(tail);
428 C(end); 425 C(end);
426 C(head);
427 C(data);
428 C(truesize);
429 atomic_set(&n->users, 1);
429 430
430 atomic_inc(&(skb_shinfo(skb)->dataref)); 431 atomic_inc(&(skb_shinfo(skb)->dataref));
431 skb->cloned = 1; 432 skb->cloned = 1;
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index 9ef0737043ee..9671ecd17e00 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -71,7 +71,7 @@ struct dccp_ackvec {
71 * @dccpavr_ack_ackno - sequence number being acknowledged 71 * @dccpavr_ack_ackno - sequence number being acknowledged
72 * @dccpavr_ack_ptr - pointer into dccpav_buf where this record starts 72 * @dccpavr_ack_ptr - pointer into dccpav_buf where this record starts
73 * @dccpavr_ack_nonce - dccpav_ack_nonce at the time this record was sent 73 * @dccpavr_ack_nonce - dccpav_ack_nonce at the time this record was sent
74 * @dccpavr_sent_len - lenght of the record in dccpav_buf 74 * @dccpavr_sent_len - length of the record in dccpav_buf
75 */ 75 */
76struct dccp_ackvec_record { 76struct dccp_ackvec_record {
77 struct list_head dccpavr_node; 77 struct list_head dccpavr_node;
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 19b33586333d..d133416d3970 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -239,7 +239,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
239 ccid3_tx_state_name(hctx->ccid3hctx_state), 239 ccid3_tx_state_name(hctx->ccid3hctx_state),
240 (unsigned)(hctx->ccid3hctx_x >> 6)); 240 (unsigned)(hctx->ccid3hctx_x >> 6));
241 /* The value of R is still undefined and so we can not recompute 241 /* The value of R is still undefined and so we can not recompute
242 * the timout value. Keep initial value as per [RFC 4342, 5]. */ 242 * the timeout value. Keep initial value as per [RFC 4342, 5]. */
243 t_nfb = TFRC_INITIAL_TIMEOUT; 243 t_nfb = TFRC_INITIAL_TIMEOUT;
244 ccid3_update_send_interval(hctx); 244 ccid3_update_send_interval(hctx);
245 break; 245 break;
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 66663e5d7acd..0e10ff21e292 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1665,12 +1665,12 @@ static struct dn_route *dn_rt_cache_get_first(struct seq_file *seq)
1665 break; 1665 break;
1666 rcu_read_unlock_bh(); 1666 rcu_read_unlock_bh();
1667 } 1667 }
1668 return rt; 1668 return rcu_dereference(rt);
1669} 1669}
1670 1670
1671static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt) 1671static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
1672{ 1672{
1673 struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); 1673 struct dn_rt_cache_iter_state *s = seq->private;
1674 1674
1675 rt = rt->u.dst.dn_next; 1675 rt = rt->u.dst.dn_next;
1676 while(!rt) { 1676 while(!rt) {
@@ -1680,7 +1680,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
1680 rcu_read_lock_bh(); 1680 rcu_read_lock_bh();
1681 rt = dn_rt_hash_table[s->bucket].chain; 1681 rt = dn_rt_hash_table[s->bucket].chain;
1682 } 1682 }
1683 return rt; 1683 return rcu_dereference(rt);
1684} 1684}
1685 1685
1686static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos) 1686static void *dn_rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index b3f366a33a5c..08174a2aa878 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -706,7 +706,7 @@ static int arp_process(struct sk_buff *skb)
706 struct arphdr *arp; 706 struct arphdr *arp;
707 unsigned char *arp_ptr; 707 unsigned char *arp_ptr;
708 struct rtable *rt; 708 struct rtable *rt;
709 unsigned char *sha, *tha; 709 unsigned char *sha;
710 __be32 sip, tip; 710 __be32 sip, tip;
711 u16 dev_type = dev->type; 711 u16 dev_type = dev->type;
712 int addr_type; 712 int addr_type;
@@ -771,7 +771,6 @@ static int arp_process(struct sk_buff *skb)
771 arp_ptr += dev->addr_len; 771 arp_ptr += dev->addr_len;
772 memcpy(&sip, arp_ptr, 4); 772 memcpy(&sip, arp_ptr, 4);
773 arp_ptr += 4; 773 arp_ptr += 4;
774 tha = arp_ptr;
775 arp_ptr += dev->addr_len; 774 arp_ptr += dev->addr_len;
776 memcpy(&tip, arp_ptr, 4); 775 memcpy(&tip, arp_ptr, 4);
777/* 776/*
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 3168c3de4919..b42f74617bac 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1027,7 +1027,7 @@ static void inetdev_changename(struct net_device *dev, struct in_device *in_dev)
1027 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ); 1027 memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);
1028 if (named++ == 0) 1028 if (named++ == 0)
1029 continue; 1029 continue;
1030 dot = strchr(ifa->ifa_label, ':'); 1030 dot = strchr(old, ':');
1031 if (dot == NULL) { 1031 if (dot == NULL) {
1032 sprintf(old, ":%d", named); 1032 sprintf(old, ":%d", named);
1033 dot = old; 1033 dot = old;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 732d8f088b13..97abf934d185 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -804,10 +804,13 @@ static void nl_fib_input(struct sk_buff *skb)
804 804
805 nlh = nlmsg_hdr(skb); 805 nlh = nlmsg_hdr(skb);
806 if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || 806 if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
807 nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) { 807 nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn)))
808 kfree_skb(skb);
809 return; 808 return;
810 } 809
810 skb = skb_clone(skb, GFP_KERNEL);
811 if (skb == NULL)
812 return;
813 nlh = nlmsg_hdr(skb);
811 814
812 frn = (struct fib_result_nl *) NLMSG_DATA(nlh); 815 frn = (struct fib_result_nl *) NLMSG_DATA(nlh);
813 tb = fib_get_table(frn->tb_id_in); 816 tb = fib_get_table(frn->tb_id_in);
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index 527a6e0af5b6..0dfee27cfbcd 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -444,6 +444,9 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
444 struct fib_info *fi_drop; 444 struct fib_info *fi_drop;
445 u8 state; 445 u8 state;
446 446
447 if (fi->fib_treeref > 1)
448 goto out;
449
447 write_lock_bh(&fib_hash_lock); 450 write_lock_bh(&fib_hash_lock);
448 fi_drop = fa->fa_info; 451 fi_drop = fa->fa_info;
449 fa->fa_info = fi; 452 fa->fa_info = fi;
@@ -718,19 +721,18 @@ fn_hash_dump_zone(struct sk_buff *skb, struct netlink_callback *cb,
718{ 721{
719 int h, s_h; 722 int h, s_h;
720 723
724 if (fz->fz_hash == NULL)
725 return skb->len;
721 s_h = cb->args[3]; 726 s_h = cb->args[3];
722 for (h=0; h < fz->fz_divisor; h++) { 727 for (h = s_h; h < fz->fz_divisor; h++) {
723 if (h < s_h) continue; 728 if (hlist_empty(&fz->fz_hash[h]))
724 if (h > s_h)
725 memset(&cb->args[4], 0,
726 sizeof(cb->args) - 4*sizeof(cb->args[0]));
727 if (fz->fz_hash == NULL ||
728 hlist_empty(&fz->fz_hash[h]))
729 continue; 729 continue;
730 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h])<0) { 730 if (fn_hash_dump_bucket(skb, cb, tb, fz, &fz->fz_hash[h]) < 0) {
731 cb->args[3] = h; 731 cb->args[3] = h;
732 return -1; 732 return -1;
733 } 733 }
734 memset(&cb->args[4], 0,
735 sizeof(cb->args) - 4*sizeof(cb->args[0]));
734 } 736 }
735 cb->args[3] = h; 737 cb->args[3] = h;
736 return skb->len; 738 return skb->len;
@@ -746,14 +748,13 @@ static int fn_hash_dump(struct fib_table *tb, struct sk_buff *skb, struct netlin
746 read_lock(&fib_hash_lock); 748 read_lock(&fib_hash_lock);
747 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) { 749 for (fz = table->fn_zone_list, m=0; fz; fz = fz->fz_next, m++) {
748 if (m < s_m) continue; 750 if (m < s_m) continue;
749 if (m > s_m)
750 memset(&cb->args[3], 0,
751 sizeof(cb->args) - 3*sizeof(cb->args[0]));
752 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) { 751 if (fn_hash_dump_zone(skb, cb, tb, fz) < 0) {
753 cb->args[2] = m; 752 cb->args[2] = m;
754 read_unlock(&fib_hash_lock); 753 read_unlock(&fib_hash_lock);
755 return -1; 754 return -1;
756 } 755 }
756 memset(&cb->args[3], 0,
757 sizeof(cb->args) - 3*sizeof(cb->args[0]));
757 } 758 }
758 read_unlock(&fib_hash_lock); 759 read_unlock(&fib_hash_lock);
759 cb->args[2] = m; 760 cb->args[2] = m;
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 8d8c2915e064..1010b469d7d3 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1214,6 +1214,9 @@ static int fn_trie_insert(struct fib_table *tb, struct fib_config *cfg)
1214 struct fib_info *fi_drop; 1214 struct fib_info *fi_drop;
1215 u8 state; 1215 u8 state;
1216 1216
1217 if (fi->fib_treeref > 1)
1218 goto out;
1219
1217 err = -ENOBUFS; 1220 err = -ENOBUFS;
1218 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL); 1221 new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL);
1219 if (new_fa == NULL) 1222 if (new_fa == NULL)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 233de0634298..82baea026484 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -540,7 +540,6 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
540 icmp_param.data.icmph.checksum = 0; 540 icmp_param.data.icmph.checksum = 0;
541 icmp_param.skb = skb_in; 541 icmp_param.skb = skb_in;
542 icmp_param.offset = skb_network_offset(skb_in); 542 icmp_param.offset = skb_network_offset(skb_in);
543 icmp_out_count(icmp_param.data.icmph.type);
544 inet_sk(icmp_socket->sk)->tos = tos; 543 inet_sk(icmp_socket->sk)->tos = tos;
545 ipc.addr = iph->saddr; 544 ipc.addr = iph->saddr;
546 ipc.opt = &icmp_param.replyopts; 545 ipc.opt = &icmp_param.replyopts;
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c
index 9a96c277393d..4a4d49fca1f2 100644
--- a/net/ipv4/inet_lro.c
+++ b/net/ipv4/inet_lro.c
@@ -310,7 +310,7 @@ static void lro_flush(struct net_lro_mgr *lro_mgr,
310 skb_shinfo(lro_desc->parent)->gso_size = lro_desc->mss; 310 skb_shinfo(lro_desc->parent)->gso_size = lro_desc->mss;
311 311
312 if (lro_desc->vgrp) { 312 if (lro_desc->vgrp) {
313 if (test_bit(LRO_F_NAPI, &lro_mgr->features)) 313 if (lro_mgr->features & LRO_F_NAPI)
314 vlan_hwaccel_receive_skb(lro_desc->parent, 314 vlan_hwaccel_receive_skb(lro_desc->parent,
315 lro_desc->vgrp, 315 lro_desc->vgrp,
316 lro_desc->vlan_tag); 316 lro_desc->vlan_tag);
@@ -320,7 +320,7 @@ static void lro_flush(struct net_lro_mgr *lro_mgr,
320 lro_desc->vlan_tag); 320 lro_desc->vlan_tag);
321 321
322 } else { 322 } else {
323 if (test_bit(LRO_F_NAPI, &lro_mgr->features)) 323 if (lro_mgr->features & LRO_F_NAPI)
324 netif_receive_skb(lro_desc->parent); 324 netif_receive_skb(lro_desc->parent);
325 else 325 else
326 netif_rx(lro_desc->parent); 326 netif_rx(lro_desc->parent);
@@ -352,7 +352,7 @@ static int __lro_proc_skb(struct net_lro_mgr *lro_mgr, struct sk_buff *skb,
352 goto out; 352 goto out;
353 353
354 if ((skb->protocol == htons(ETH_P_8021Q)) 354 if ((skb->protocol == htons(ETH_P_8021Q))
355 && !test_bit(LRO_F_EXTRACT_VLAN_ID, &lro_mgr->features)) 355 && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
356 vlan_hdr_len = VLAN_HLEN; 356 vlan_hdr_len = VLAN_HLEN;
357 357
358 if (!lro_desc->active) { /* start new lro session */ 358 if (!lro_desc->active) { /* start new lro session */
@@ -474,7 +474,7 @@ static struct sk_buff *__lro_proc_segment(struct net_lro_mgr *lro_mgr,
474 goto out; 474 goto out;
475 475
476 if ((skb->protocol == htons(ETH_P_8021Q)) 476 if ((skb->protocol == htons(ETH_P_8021Q))
477 && !test_bit(LRO_F_EXTRACT_VLAN_ID, &lro_mgr->features)) 477 && !(lro_mgr->features & LRO_F_EXTRACT_VLAN_ID))
478 vlan_hdr_len = VLAN_HLEN; 478 vlan_hdr_len = VLAN_HLEN;
479 479
480 iph = (void *)(skb->data + vlan_hdr_len); 480 iph = (void *)(skb->data + vlan_hdr_len);
@@ -516,7 +516,7 @@ void lro_receive_skb(struct net_lro_mgr *lro_mgr,
516 void *priv) 516 void *priv)
517{ 517{
518 if (__lro_proc_skb(lro_mgr, skb, NULL, 0, priv)) { 518 if (__lro_proc_skb(lro_mgr, skb, NULL, 0, priv)) {
519 if (test_bit(LRO_F_NAPI, &lro_mgr->features)) 519 if (lro_mgr->features & LRO_F_NAPI)
520 netif_receive_skb(skb); 520 netif_receive_skb(skb);
521 else 521 else
522 netif_rx(skb); 522 netif_rx(skb);
@@ -531,7 +531,7 @@ void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr *lro_mgr,
531 void *priv) 531 void *priv)
532{ 532{
533 if (__lro_proc_skb(lro_mgr, skb, vgrp, vlan_tag, priv)) { 533 if (__lro_proc_skb(lro_mgr, skb, vgrp, vlan_tag, priv)) {
534 if (test_bit(LRO_F_NAPI, &lro_mgr->features)) 534 if (lro_mgr->features & LRO_F_NAPI)
535 vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag); 535 vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag);
536 else 536 else
537 vlan_hwaccel_rx(skb, vgrp, vlan_tag); 537 vlan_hwaccel_rx(skb, vgrp, vlan_tag);
@@ -550,7 +550,7 @@ void lro_receive_frags(struct net_lro_mgr *lro_mgr,
550 if (!skb) 550 if (!skb)
551 return; 551 return;
552 552
553 if (test_bit(LRO_F_NAPI, &lro_mgr->features)) 553 if (lro_mgr->features & LRO_F_NAPI)
554 netif_receive_skb(skb); 554 netif_receive_skb(skb);
555 else 555 else
556 netif_rx(skb); 556 netif_rx(skb);
@@ -570,7 +570,7 @@ void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr *lro_mgr,
570 if (!skb) 570 if (!skb)
571 return; 571 return;
572 572
573 if (test_bit(LRO_F_NAPI, &lro_mgr->features)) 573 if (lro_mgr->features & LRO_F_NAPI)
574 vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag); 574 vlan_hwaccel_receive_skb(skb, vgrp, vlan_tag);
575 else 575 else
576 vlan_hwaccel_rx(skb, vgrp, vlan_tag); 576 vlan_hwaccel_rx(skb, vgrp, vlan_tag);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 02b02a8d681c..4b93f32de10d 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -613,7 +613,7 @@ static int ipgre_rcv(struct sk_buff *skb)
613 offset += 4; 613 offset += 4;
614 } 614 }
615 615
616 skb_reset_mac_header(skb); 616 skb->mac_header = skb->network_header;
617 __pskb_pull(skb, offset); 617 __pskb_pull(skb, offset);
618 skb_reset_network_header(skb); 618 skb_reset_network_header(skb);
619 skb_postpull_rcsum(skb, skb_transport_header(skb), offset); 619 skb_postpull_rcsum(skb, skb_transport_header(skb), offset);
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 96400b0bd08a..b8f7763b2261 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1403,6 +1403,9 @@ static int __init ic_proto_name(char *name)
1403 if (!strcmp(name, "on") || !strcmp(name, "any")) { 1403 if (!strcmp(name, "on") || !strcmp(name, "any")) {
1404 return 1; 1404 return 1;
1405 } 1405 }
1406 if (!strcmp(name, "off") || !strcmp(name, "none")) {
1407 return 0;
1408 }
1406#ifdef CONFIG_IP_PNP_DHCP 1409#ifdef CONFIG_IP_PNP_DHCP
1407 else if (!strcmp(name, "dhcp")) { 1410 else if (!strcmp(name, "dhcp")) {
1408 ic_proto_enabled &= ~IC_RARP; 1411 ic_proto_enabled &= ~IC_RARP;
@@ -1436,17 +1439,24 @@ static int __init ip_auto_config_setup(char *addrs)
1436 int num = 0; 1439 int num = 0;
1437 1440
1438 ic_set_manually = 1; 1441 ic_set_manually = 1;
1442 ic_enable = 1;
1439 1443
1440 ic_enable = (*addrs && 1444 /*
1441 (strcmp(addrs, "off") != 0) && 1445 * If any dhcp, bootp etc options are set, leave autoconfig on
1442 (strcmp(addrs, "none") != 0)); 1446 * and skip the below static IP processing.
1443 if (!ic_enable) 1447 */
1448 if (ic_proto_name(addrs))
1444 return 1; 1449 return 1;
1445 1450
1446 if (ic_proto_name(addrs)) 1451 /* If no static IP is given, turn off autoconfig and bail. */
1452 if (*addrs == 0 ||
1453 strcmp(addrs, "off") == 0 ||
1454 strcmp(addrs, "none") == 0) {
1455 ic_enable = 0;
1447 return 1; 1456 return 1;
1457 }
1448 1458
1449 /* Parse the whole string */ 1459 /* Parse string for static IP assignment. */
1450 ip = addrs; 1460 ip = addrs;
1451 while (ip && *ip) { 1461 while (ip && *ip) {
1452 if ((cp = strchr(ip, ':'))) 1462 if ((cp = strchr(ip, ':')))
@@ -1484,7 +1494,10 @@ static int __init ip_auto_config_setup(char *addrs)
1484 strlcpy(user_dev_name, ip, sizeof(user_dev_name)); 1494 strlcpy(user_dev_name, ip, sizeof(user_dev_name));
1485 break; 1495 break;
1486 case 6: 1496 case 6:
1487 ic_proto_name(ip); 1497 if (ic_proto_name(ip) == 0 &&
1498 ic_myaddr == NONE) {
1499 ic_enable = 0;
1500 }
1488 break; 1501 break;
1489 } 1502 }
1490 } 1503 }
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index 831e9b29806d..910dae732a0f 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -419,6 +419,9 @@ struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {
419 .me = THIS_MODULE, 419 .me = THIS_MODULE,
420}; 420};
421 421
422module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
423 &nf_conntrack_htable_size, 0600);
424
422MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET)); 425MODULE_ALIAS("nf_conntrack-" __stringify(AF_INET));
423MODULE_ALIAS("ip_conntrack"); 426MODULE_ALIAS("ip_conntrack");
424MODULE_LICENSE("GPL"); 427MODULE_LICENSE("GPL");
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index 3ca98971a1e9..8996ccb757db 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -165,7 +165,7 @@ static int mangle_content_len(struct sk_buff *skb,
165 165
166 dataoff = ip_hdrlen(skb) + sizeof(struct udphdr); 166 dataoff = ip_hdrlen(skb) + sizeof(struct udphdr);
167 167
168 /* Get actual SDP lenght */ 168 /* Get actual SDP length */
169 if (ct_sip_get_info(ct, dptr, skb->len - dataoff, &matchoff, 169 if (ct_sip_get_info(ct, dptr, skb->len - dataoff, &matchoff,
170 &matchlen, POS_SDP_HEADER) > 0) { 170 &matchlen, POS_SDP_HEADER) > 0) {
171 171
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 66b42f547bf9..e7050f8eabeb 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -271,6 +271,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
271 int hh_len; 271 int hh_len;
272 struct iphdr *iph; 272 struct iphdr *iph;
273 struct sk_buff *skb; 273 struct sk_buff *skb;
274 unsigned int iphlen;
274 int err; 275 int err;
275 276
276 if (length > rt->u.dst.dev->mtu) { 277 if (length > rt->u.dst.dev->mtu) {
@@ -304,7 +305,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
304 goto error_fault; 305 goto error_fault;
305 306
306 /* We don't modify invalid header */ 307 /* We don't modify invalid header */
307 if (length >= sizeof(*iph) && iph->ihl * 4U <= length) { 308 iphlen = iph->ihl * 4;
309 if (iphlen >= sizeof(*iph) && iphlen <= length) {
308 if (!iph->saddr) 310 if (!iph->saddr)
309 iph->saddr = rt->rt_src; 311 iph->saddr = rt->rt_src;
310 iph->check = 0; 312 iph->check = 0;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d2bc6148a737..28484f396b04 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -283,12 +283,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
283 break; 283 break;
284 rcu_read_unlock_bh(); 284 rcu_read_unlock_bh();
285 } 285 }
286 return r; 286 return rcu_dereference(r);
287} 287}
288 288
289static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r) 289static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
290{ 290{
291 struct rt_cache_iter_state *st = rcu_dereference(seq->private); 291 struct rt_cache_iter_state *st = seq->private;
292 292
293 r = r->u.dst.rt_next; 293 r = r->u.dst.rt_next;
294 while (!r) { 294 while (!r) {
@@ -298,7 +298,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
298 rcu_read_lock_bh(); 298 rcu_read_lock_bh();
299 r = rt_hash_table[st->bucket].chain; 299 r = rt_hash_table[st->bucket].chain;
300 } 300 }
301 return r; 301 return rcu_dereference(r);
302} 302}
303 303
304static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) 304static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos)
@@ -2626,11 +2626,10 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2626 int idx, s_idx; 2626 int idx, s_idx;
2627 2627
2628 s_h = cb->args[0]; 2628 s_h = cb->args[0];
2629 if (s_h < 0)
2630 s_h = 0;
2629 s_idx = idx = cb->args[1]; 2631 s_idx = idx = cb->args[1];
2630 for (h = 0; h <= rt_hash_mask; h++) { 2632 for (h = s_h; h <= rt_hash_mask; h++) {
2631 if (h < s_h) continue;
2632 if (h > s_h)
2633 s_idx = 0;
2634 rcu_read_lock_bh(); 2633 rcu_read_lock_bh();
2635 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; 2634 for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
2636 rt = rcu_dereference(rt->u.dst.rt_next), idx++) { 2635 rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
@@ -2647,6 +2646,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
2647 dst_release(xchg(&skb->dst, NULL)); 2646 dst_release(xchg(&skb->dst, NULL));
2648 } 2647 }
2649 rcu_read_unlock_bh(); 2648 rcu_read_unlock_bh();
2649 s_idx = 0;
2650 } 2650 }
2651 2651
2652done: 2652done:
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 889c89362bfc..b39f0d86e44c 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2651,6 +2651,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2651 u32 cnt = 0; 2651 u32 cnt = 0;
2652 u32 reord = tp->packets_out; 2652 u32 reord = tp->packets_out;
2653 s32 seq_rtt = -1; 2653 s32 seq_rtt = -1;
2654 s32 ca_seq_rtt = -1;
2654 ktime_t last_ackt = net_invalid_timestamp(); 2655 ktime_t last_ackt = net_invalid_timestamp();
2655 2656
2656 while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) { 2657 while ((skb = tcp_write_queue_head(sk)) && skb != tcp_send_head(sk)) {
@@ -2659,6 +2660,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2659 u32 packets_acked; 2660 u32 packets_acked;
2660 u8 sacked = scb->sacked; 2661 u8 sacked = scb->sacked;
2661 2662
2663 /* Determine how many packets and what bytes were acked, tso and else */
2662 if (after(scb->end_seq, tp->snd_una)) { 2664 if (after(scb->end_seq, tp->snd_una)) {
2663 if (tcp_skb_pcount(skb) == 1 || 2665 if (tcp_skb_pcount(skb) == 1 ||
2664 !after(tp->snd_una, scb->seq)) 2666 !after(tp->snd_una, scb->seq))
@@ -2686,15 +2688,16 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2686 if (sacked & TCPCB_SACKED_RETRANS) 2688 if (sacked & TCPCB_SACKED_RETRANS)
2687 tp->retrans_out -= packets_acked; 2689 tp->retrans_out -= packets_acked;
2688 flag |= FLAG_RETRANS_DATA_ACKED; 2690 flag |= FLAG_RETRANS_DATA_ACKED;
2691 ca_seq_rtt = -1;
2689 seq_rtt = -1; 2692 seq_rtt = -1;
2690 if ((flag & FLAG_DATA_ACKED) || 2693 if ((flag & FLAG_DATA_ACKED) ||
2691 (packets_acked > 1)) 2694 (packets_acked > 1))
2692 flag |= FLAG_NONHEAD_RETRANS_ACKED; 2695 flag |= FLAG_NONHEAD_RETRANS_ACKED;
2693 } else { 2696 } else {
2697 ca_seq_rtt = now - scb->when;
2698 last_ackt = skb->tstamp;
2694 if (seq_rtt < 0) { 2699 if (seq_rtt < 0) {
2695 seq_rtt = now - scb->when; 2700 seq_rtt = ca_seq_rtt;
2696 if (fully_acked)
2697 last_ackt = skb->tstamp;
2698 } 2701 }
2699 if (!(sacked & TCPCB_SACKED_ACKED)) 2702 if (!(sacked & TCPCB_SACKED_ACKED))
2700 reord = min(cnt, reord); 2703 reord = min(cnt, reord);
@@ -2709,10 +2712,10 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2709 !before(end_seq, tp->snd_up)) 2712 !before(end_seq, tp->snd_up))
2710 tp->urg_mode = 0; 2713 tp->urg_mode = 0;
2711 } else { 2714 } else {
2715 ca_seq_rtt = now - scb->when;
2716 last_ackt = skb->tstamp;
2712 if (seq_rtt < 0) { 2717 if (seq_rtt < 0) {
2713 seq_rtt = now - scb->when; 2718 seq_rtt = ca_seq_rtt;
2714 if (fully_acked)
2715 last_ackt = skb->tstamp;
2716 } 2719 }
2717 reord = min(cnt, reord); 2720 reord = min(cnt, reord);
2718 } 2721 }
@@ -2772,8 +2775,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, s32 *seq_rtt_p,
2772 net_invalid_timestamp())) 2775 net_invalid_timestamp()))
2773 rtt_us = ktime_us_delta(ktime_get_real(), 2776 rtt_us = ktime_us_delta(ktime_get_real(),
2774 last_ackt); 2777 last_ackt);
2775 else if (seq_rtt > 0) 2778 else if (ca_seq_rtt > 0)
2776 rtt_us = jiffies_to_usecs(seq_rtt); 2779 rtt_us = jiffies_to_usecs(ca_seq_rtt);
2777 } 2780 }
2778 2781
2779 ca_ops->pkts_acked(sk, pkts_acked, rtt_us); 2782 ca_ops->pkts_acked(sk, pkts_acked, rtt_us);
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 2ed689ac449e..5d4245ab4183 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -123,11 +123,11 @@ ipv4_connected:
123 goto out; 123 goto out;
124 } 124 }
125 sk->sk_bound_dev_if = usin->sin6_scope_id; 125 sk->sk_bound_dev_if = usin->sin6_scope_id;
126 if (!sk->sk_bound_dev_if &&
127 (addr_type & IPV6_ADDR_MULTICAST))
128 fl.oif = np->mcast_oif;
129 } 126 }
130 127
128 if (!sk->sk_bound_dev_if && (addr_type & IPV6_ADDR_MULTICAST))
129 sk->sk_bound_dev_if = np->mcast_oif;
130
131 /* Connect to link-local address requires an interface */ 131 /* Connect to link-local address requires an interface */
132 if (!sk->sk_bound_dev_if) { 132 if (!sk->sk_bound_dev_if) {
133 err = -EINVAL; 133 err = -EINVAL;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9bb031fa1c2f..f1240688dc58 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -458,8 +458,6 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
458 } 458 }
459 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr)); 459 err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr));
460 460
461 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
462
463out_put: 461out_put:
464 if (likely(idev != NULL)) 462 if (likely(idev != NULL))
465 in6_dev_put(idev); 463 in6_dev_put(idev);
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index adc73adadfae..0765d8bd380f 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -193,7 +193,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
193 sk2->sk_family == PF_INET6 && 193 sk2->sk_family == PF_INET6 &&
194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && 194 ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) &&
195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && 195 ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) &&
196 sk2->sk_bound_dev_if == sk->sk_bound_dev_if) { 196 (!sk2->sk_bound_dev_if || sk2->sk_bound_dev_if == dif)) {
197 if (twsk_unique(sk, sk2, twp)) 197 if (twsk_unique(sk, sk2, twp))
198 goto unique; 198 goto unique;
199 else 199 else
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 67997a74ddce..777ed733b2d7 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -612,7 +612,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
612 * optimistic addresses, but we may send the solicitation 612 * optimistic addresses, but we may send the solicitation
613 * if we don't include the sllao. So here we check 613 * if we don't include the sllao. So here we check
614 * if our address is optimistic, and if so, we 614 * if our address is optimistic, and if so, we
615 * supress the inclusion of the sllao. 615 * suppress the inclusion of the sllao.
616 */ 616 */
617 if (send_sllao) { 617 if (send_sllao) {
618 struct inet6_ifaddr *ifp = ipv6_get_ifaddr(saddr, dev, 1); 618 struct inet6_ifaddr *ifp = ipv6_get_ifaddr(saddr, dev, 1);
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c
index 34ba150bfe5d..41df9a578c7a 100644
--- a/net/ipv6/netfilter/ip6t_eui64.c
+++ b/net/ipv6/netfilter/ip6t_eui64.c
@@ -47,7 +47,7 @@ match(const struct sk_buff *skb,
47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3); 47 memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
48 eui64[3] = 0xff; 48 eui64[3] = 0xff;
49 eui64[4] = 0xfe; 49 eui64[4] = 0xfe;
50 eui64[0] |= 0x02; 50 eui64[0] ^= 0x02;
51 51
52 i = 0; 52 i = 0;
53 while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i] 53 while (ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i]
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 8631ed7fe8a9..44937616057e 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -88,7 +88,7 @@ static char *icmp6type2name[256] = {
88 [ICMPV6_PKT_TOOBIG] = "PktTooBigs", 88 [ICMPV6_PKT_TOOBIG] = "PktTooBigs",
89 [ICMPV6_TIME_EXCEED] = "TimeExcds", 89 [ICMPV6_TIME_EXCEED] = "TimeExcds",
90 [ICMPV6_PARAMPROB] = "ParmProblems", 90 [ICMPV6_PARAMPROB] = "ParmProblems",
91 [ICMPV6_ECHO_REQUEST] = "EchoRequest", 91 [ICMPV6_ECHO_REQUEST] = "Echos",
92 [ICMPV6_ECHO_REPLY] = "EchoReplies", 92 [ICMPV6_ECHO_REPLY] = "EchoReplies",
93 [ICMPV6_MGM_QUERY] = "GroupMembQueries", 93 [ICMPV6_MGM_QUERY] = "GroupMembQueries",
94 [ICMPV6_MGM_REPORT] = "GroupMembResponses", 94 [ICMPV6_MGM_REPORT] = "GroupMembResponses",
@@ -98,7 +98,7 @@ static char *icmp6type2name[256] = {
98 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits", 98 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits",
99 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements", 99 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements",
100 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits", 100 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits",
101 [NDISC_REDIRECT] = "NeighborRedirects", 101 [NDISC_REDIRECT] = "Redirects",
102}; 102};
103 103
104 104
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 6ecb5e6fae2e..20083e0d3995 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -329,7 +329,7 @@ static inline int rt6_check_dev(struct rt6_info *rt, int oif)
329static inline int rt6_check_neigh(struct rt6_info *rt) 329static inline int rt6_check_neigh(struct rt6_info *rt)
330{ 330{
331 struct neighbour *neigh = rt->rt6i_nexthop; 331 struct neighbour *neigh = rt->rt6i_nexthop;
332 int m = 0; 332 int m;
333 if (rt->rt6i_flags & RTF_NONEXTHOP || 333 if (rt->rt6i_flags & RTF_NONEXTHOP ||
334 !(rt->rt6i_flags & RTF_GATEWAY)) 334 !(rt->rt6i_flags & RTF_GATEWAY))
335 m = 1; 335 m = 1;
@@ -337,10 +337,15 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
337 read_lock_bh(&neigh->lock); 337 read_lock_bh(&neigh->lock);
338 if (neigh->nud_state & NUD_VALID) 338 if (neigh->nud_state & NUD_VALID)
339 m = 2; 339 m = 2;
340 else if (!(neigh->nud_state & NUD_FAILED)) 340#ifdef CONFIG_IPV6_ROUTER_PREF
341 else if (neigh->nud_state & NUD_FAILED)
342 m = 0;
343#endif
344 else
341 m = 1; 345 m = 1;
342 read_unlock_bh(&neigh->lock); 346 read_unlock_bh(&neigh->lock);
343 } 347 } else
348 m = 0;
344 return m; 349 return m;
345} 350}
346 351
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 48ce59a6e026..07dfa7fdd2a0 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -802,12 +802,18 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
802 } 802 }
803#endif /* CONFIG_IRDA_ULTRA */ 803#endif /* CONFIG_IRDA_ULTRA */
804 804
805 self->ias_obj = irias_new_object(addr->sir_name, jiffies);
806 if (self->ias_obj == NULL)
807 return -ENOMEM;
808
805 err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name); 809 err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name);
806 if (err < 0) 810 if (err < 0) {
811 kfree(self->ias_obj->name);
812 kfree(self->ias_obj);
807 return err; 813 return err;
814 }
808 815
809 /* Register with LM-IAS */ 816 /* Register with LM-IAS */
810 self->ias_obj = irias_new_object(addr->sir_name, jiffies);
811 irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel", 817 irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel",
812 self->stsap_sel, IAS_KERNEL_ATTR); 818 self->stsap_sel, IAS_KERNEL_ATTR);
813 irias_insert_object(self->ias_obj); 819 irias_insert_object(self->ias_obj);
@@ -1118,8 +1124,6 @@ static int irda_create(struct net *net, struct socket *sock, int protocol)
1118 self->max_sdu_size_rx = TTP_SAR_UNBOUND; 1124 self->max_sdu_size_rx = TTP_SAR_UNBOUND;
1119 break; 1125 break;
1120 default: 1126 default:
1121 IRDA_ERROR("%s: protocol not supported!\n",
1122 __FUNCTION__);
1123 return -ESOCKTNOSUPPORT; 1127 return -ESOCKTNOSUPPORT;
1124 } 1128 }
1125 break; 1129 break;
@@ -1827,7 +1831,7 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1827 struct irda_ias_set *ias_opt; 1831 struct irda_ias_set *ias_opt;
1828 struct ias_object *ias_obj; 1832 struct ias_object *ias_obj;
1829 struct ias_attrib * ias_attr; /* Attribute in IAS object */ 1833 struct ias_attrib * ias_attr; /* Attribute in IAS object */
1830 int opt; 1834 int opt, free_ias = 0;
1831 1835
1832 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); 1836 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
1833 1837
@@ -1883,11 +1887,20 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1883 /* Create a new object */ 1887 /* Create a new object */
1884 ias_obj = irias_new_object(ias_opt->irda_class_name, 1888 ias_obj = irias_new_object(ias_opt->irda_class_name,
1885 jiffies); 1889 jiffies);
1890 if (ias_obj == NULL) {
1891 kfree(ias_opt);
1892 return -ENOMEM;
1893 }
1894 free_ias = 1;
1886 } 1895 }
1887 1896
1888 /* Do we have the attribute already ? */ 1897 /* Do we have the attribute already ? */
1889 if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) { 1898 if(irias_find_attrib(ias_obj, ias_opt->irda_attrib_name)) {
1890 kfree(ias_opt); 1899 kfree(ias_opt);
1900 if (free_ias) {
1901 kfree(ias_obj->name);
1902 kfree(ias_obj);
1903 }
1891 return -EINVAL; 1904 return -EINVAL;
1892 } 1905 }
1893 1906
@@ -1906,6 +1919,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1906 if(ias_opt->attribute.irda_attrib_octet_seq.len > 1919 if(ias_opt->attribute.irda_attrib_octet_seq.len >
1907 IAS_MAX_OCTET_STRING) { 1920 IAS_MAX_OCTET_STRING) {
1908 kfree(ias_opt); 1921 kfree(ias_opt);
1922 if (free_ias) {
1923 kfree(ias_obj->name);
1924 kfree(ias_obj);
1925 }
1926
1909 return -EINVAL; 1927 return -EINVAL;
1910 } 1928 }
1911 /* Add an octet sequence attribute */ 1929 /* Add an octet sequence attribute */
@@ -1934,6 +1952,10 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1934 break; 1952 break;
1935 default : 1953 default :
1936 kfree(ias_opt); 1954 kfree(ias_opt);
1955 if (free_ias) {
1956 kfree(ias_obj->name);
1957 kfree(ias_obj);
1958 }
1937 return -EINVAL; 1959 return -EINVAL;
1938 } 1960 }
1939 irias_insert_object(ias_obj); 1961 irias_insert_object(ias_obj);
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index e5e4792a0314..598dcbe4a501 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -496,7 +496,7 @@ static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
496 IRDA_ASSERT(self != NULL, return -1;); 496 IRDA_ASSERT(self != NULL, return -1;);
497 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); 497 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
498 498
499 /* Poll parameters are always of lenght 0 (just a signal) */ 499 /* Poll parameters are always of length 0 (just a signal) */
500 if (!get) { 500 if (!get) {
501 /* Respond with DTE line settings */ 501 /* Respond with DTE line settings */
502 ircomm_param_request(self, IRCOMM_DTE, TRUE); 502 ircomm_param_request(self, IRCOMM_DTE, TRUE);
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index c68220773d28..1ab91f787cc1 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -342,7 +342,7 @@ static void irlan_eth_set_multicast_list(struct net_device *dev)
342 342
343 if (dev->flags & IFF_PROMISC) { 343 if (dev->flags & IFF_PROMISC) {
344 /* Enable promiscuous mode */ 344 /* Enable promiscuous mode */
345 IRDA_WARNING("Promiscous mode not implemented by IrLAN!\n"); 345 IRDA_WARNING("Promiscuous mode not implemented by IrLAN!\n");
346 } 346 }
347 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) { 347 else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > HW_MAX_ADDRS) {
348 /* Disable promiscuous mode, use normal mode. */ 348 /* Disable promiscuous mode, use normal mode. */
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 4f3764546b2f..7c132d6342af 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -144,7 +144,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
144 frame->control = SNRM_CMD | PF_BIT; 144 frame->control = SNRM_CMD | PF_BIT;
145 145
146 /* 146 /*
147 * If we are establishing a connection then insert QoS paramerters 147 * If we are establishing a connection then insert QoS parameters
148 */ 148 */
149 if (qos) { 149 if (qos) {
150 skb_put(tx_skb, 9); /* 25 left */ 150 skb_put(tx_skb, 9); /* 25 left */
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 7183e9ef7996..722bbe044d9c 100644
--- a/net/irda/parameters.c
+++ b/net/irda/parameters.c
@@ -133,7 +133,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
133 int err; 133 int err;
134 134
135 p.pi = pi; /* In case handler needs to know */ 135 p.pi = pi; /* In case handler needs to know */
136 p.pl = type & PV_MASK; /* The integer type codes the lenght as well */ 136 p.pl = type & PV_MASK; /* The integer type codes the length as well */
137 p.pv.i = 0; /* Clear value */ 137 p.pv.i = 0; /* Clear value */
138 138
139 /* Call handler for this parameter */ 139 /* Call handler for this parameter */
@@ -142,7 +142,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
142 return err; 142 return err;
143 143
144 /* 144 /*
145 * If parameter lenght is still 0, then (1) this is an any length 145 * If parameter length is still 0, then (1) this is an any length
146 * integer, and (2) the handler function does not care which length 146 * integer, and (2) the handler function does not care which length
147 * we choose to use, so we pick the one the gives the fewest bytes. 147 * we choose to use, so we pick the one the gives the fewest bytes.
148 */ 148 */
@@ -206,11 +206,11 @@ static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
206{ 206{
207 irda_param_t p; 207 irda_param_t p;
208 int n = 0; 208 int n = 0;
209 int extract_len; /* Real lenght we extract */ 209 int extract_len; /* Real length we extract */
210 int err; 210 int err;
211 211
212 p.pi = pi; /* In case handler needs to know */ 212 p.pi = pi; /* In case handler needs to know */
213 p.pl = buf[1]; /* Extract lenght of value */ 213 p.pl = buf[1]; /* Extract length of value */
214 p.pv.i = 0; /* Clear value */ 214 p.pv.i = 0; /* Clear value */
215 extract_len = p.pl; /* Default : extract all */ 215 extract_len = p.pl; /* Default : extract all */
216 216
@@ -297,7 +297,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
297 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 297 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
298 298
299 p.pi = pi; /* In case handler needs to know */ 299 p.pi = pi; /* In case handler needs to know */
300 p.pl = buf[1]; /* Extract lenght of value */ 300 p.pl = buf[1]; /* Extract length of value */
301 301
302 IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __FUNCTION__, 302 IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __FUNCTION__,
303 p.pi, p.pl); 303 p.pi, p.pl);
@@ -339,7 +339,7 @@ static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
339 irda_param_t p; 339 irda_param_t p;
340 340
341 p.pi = pi; /* In case handler needs to know */ 341 p.pi = pi; /* In case handler needs to know */
342 p.pl = buf[1]; /* Extract lenght of value */ 342 p.pl = buf[1]; /* Extract length of value */
343 343
344 /* Check if buffer is long enough for parsing */ 344 /* Check if buffer is long enough for parsing */
345 if (len < (2+p.pl)) { 345 if (len < (2+p.pl)) {
diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c
index e71286768a48..c246983308b8 100644
--- a/net/irda/wrapper.c
+++ b/net/irda/wrapper.c
@@ -238,7 +238,7 @@ async_bump(struct net_device *dev,
238 skb_reserve(newskb, 1); 238 skb_reserve(newskb, 1);
239 239
240 if(docopy) { 240 if(docopy) {
241 /* Copy data without CRC (lenght already checked) */ 241 /* Copy data without CRC (length already checked) */
242 skb_copy_to_linear_data(newskb, rx_buff->data, 242 skb_copy_to_linear_data(newskb, rx_buff->data,
243 rx_buff->len - 2); 243 rx_buff->len - 2);
244 /* Deliver this skb */ 244 /* Deliver this skb */
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 878039b9557d..76dcd882f87b 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -2784,12 +2784,22 @@ static struct sadb_msg *pfkey_get_base_msg(struct sk_buff *skb, int *errp)
2784 2784
2785static inline int aalg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d) 2785static inline int aalg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d)
2786{ 2786{
2787 return t->aalgos & (1 << d->desc.sadb_alg_id); 2787 unsigned int id = d->desc.sadb_alg_id;
2788
2789 if (id >= sizeof(t->aalgos) * 8)
2790 return 0;
2791
2792 return (t->aalgos >> id) & 1;
2788} 2793}
2789 2794
2790static inline int ealg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d) 2795static inline int ealg_tmpl_set(struct xfrm_tmpl *t, struct xfrm_algo_desc *d)
2791{ 2796{
2792 return t->ealgos & (1 << d->desc.sadb_alg_id); 2797 unsigned int id = d->desc.sadb_alg_id;
2798
2799 if (id >= sizeof(t->ealgos) * 8)
2800 return 0;
2801
2802 return (t->ealgos >> id) & 1;
2793} 2803}
2794 2804
2795static int count_ah_combs(struct xfrm_tmpl *t) 2805static int count_ah_combs(struct xfrm_tmpl *t)
@@ -3583,27 +3593,29 @@ static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
3583 /* old ipsecrequest */ 3593 /* old ipsecrequest */
3584 int mode = pfkey_mode_from_xfrm(mp->mode); 3594 int mode = pfkey_mode_from_xfrm(mp->mode);
3585 if (mode < 0) 3595 if (mode < 0)
3586 return -EINVAL; 3596 goto err;
3587 if (set_ipsecrequest(skb, mp->proto, mode, 3597 if (set_ipsecrequest(skb, mp->proto, mode,
3588 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3598 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3589 mp->reqid, mp->old_family, 3599 mp->reqid, mp->old_family,
3590 &mp->old_saddr, &mp->old_daddr) < 0) { 3600 &mp->old_saddr, &mp->old_daddr) < 0)
3591 return -EINVAL; 3601 goto err;
3592 }
3593 3602
3594 /* new ipsecrequest */ 3603 /* new ipsecrequest */
3595 if (set_ipsecrequest(skb, mp->proto, mode, 3604 if (set_ipsecrequest(skb, mp->proto, mode,
3596 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE), 3605 (mp->reqid ? IPSEC_LEVEL_UNIQUE : IPSEC_LEVEL_REQUIRE),
3597 mp->reqid, mp->new_family, 3606 mp->reqid, mp->new_family,
3598 &mp->new_saddr, &mp->new_daddr) < 0) { 3607 &mp->new_saddr, &mp->new_daddr) < 0)
3599 return -EINVAL; 3608 goto err;
3600 }
3601 } 3609 }
3602 3610
3603 /* broadcast migrate message to sockets */ 3611 /* broadcast migrate message to sockets */
3604 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL); 3612 pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL);
3605 3613
3606 return 0; 3614 return 0;
3615
3616err:
3617 kfree_skb(skb);
3618 return -EINVAL;
3607} 3619}
3608#else 3620#else
3609static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 3621static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 505af1f067ab..6378850d8580 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -427,7 +427,6 @@ static const struct header_ops ieee80211_header_ops = {
427void ieee80211_if_setup(struct net_device *dev) 427void ieee80211_if_setup(struct net_device *dev)
428{ 428{
429 ether_setup(dev); 429 ether_setup(dev);
430 dev->header_ops = &ieee80211_header_ops;
431 dev->hard_start_xmit = ieee80211_subif_start_xmit; 430 dev->hard_start_xmit = ieee80211_subif_start_xmit;
432 dev->wireless_handlers = &ieee80211_iw_handler_def; 431 dev->wireless_handlers = &ieee80211_iw_handler_def;
433 dev->set_multicast_list = ieee80211_set_multicast_list; 432 dev->set_multicast_list = ieee80211_set_multicast_list;
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 7027eed4d4ae..308bbe4a1333 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -591,7 +591,7 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
591 sdata->bss->force_unicast_rateidx = -1; 591 sdata->bss->force_unicast_rateidx = -1;
592 if (rate->value < 0) 592 if (rate->value < 0)
593 return 0; 593 return 0;
594 for (i=0; i< mode->num_rates; i++) { 594 for (i=0; i < mode->num_rates; i++) {
595 struct ieee80211_rate *rates = &mode->rates[i]; 595 struct ieee80211_rate *rates = &mode->rates[i];
596 int this_rate = rates->rate; 596 int this_rate = rates->rate;
597 597
@@ -599,10 +599,10 @@ static int ieee80211_ioctl_siwrate(struct net_device *dev,
599 sdata->bss->max_ratectrl_rateidx = i; 599 sdata->bss->max_ratectrl_rateidx = i;
600 if (rate->fixed) 600 if (rate->fixed)
601 sdata->bss->force_unicast_rateidx = i; 601 sdata->bss->force_unicast_rateidx = i;
602 break; 602 return 0;
603 } 603 }
604 } 604 }
605 return 0; 605 return -EINVAL;
606} 606}
607 607
608static int ieee80211_ioctl_giwrate(struct net_device *dev, 608static int ieee80211_ioctl_giwrate(struct net_device *dev,
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 3260a4a0ecc5..c3f278393741 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -60,11 +60,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
60 list_for_each_entry(alg, &rate_ctrl_algs, list) { 60 list_for_each_entry(alg, &rate_ctrl_algs, list) {
61 if (alg->ops == ops) { 61 if (alg->ops == ops) {
62 list_del(&alg->list); 62 list_del(&alg->list);
63 kfree(alg);
63 break; 64 break;
64 } 65 }
65 } 66 }
66 mutex_unlock(&rate_ctrl_mutex); 67 mutex_unlock(&rate_ctrl_mutex);
67 kfree(alg);
68} 68}
69EXPORT_SYMBOL(ieee80211_rate_control_unregister); 69EXPORT_SYMBOL(ieee80211_rate_control_unregister);
70 70
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 16afd24d4f6b..bee8080f2249 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -808,12 +808,8 @@ static void ieee80211_associated(struct net_device *dev,
808 sta_info_put(sta); 808 sta_info_put(sta);
809 } 809 }
810 if (disassoc) { 810 if (disassoc) {
811 union iwreq_data wrqu; 811 ifsta->state = IEEE80211_DISABLED;
812 memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN); 812 ieee80211_set_associated(dev, ifsta, 0);
813 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
814 wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
815 mod_timer(&ifsta->timer, jiffies +
816 IEEE80211_MONITORING_INTERVAL + 30 * HZ);
817 } else { 813 } else {
818 mod_timer(&ifsta->timer, jiffies + 814 mod_timer(&ifsta->timer, jiffies +
819 IEEE80211_MONITORING_INTERVAL); 815 IEEE80211_MONITORING_INTERVAL);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 00f908d9275e..a7263fc476bd 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1443,6 +1443,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1443 struct ieee80211_sub_if_data *prev = NULL; 1443 struct ieee80211_sub_if_data *prev = NULL;
1444 struct sk_buff *skb_new; 1444 struct sk_buff *skb_new;
1445 u8 *bssid; 1445 u8 *bssid;
1446 int hdrlen;
1446 1447
1447 /* 1448 /*
1448 * key references and virtual interfaces are protected using RCU 1449 * key references and virtual interfaces are protected using RCU
@@ -1472,6 +1473,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1472 rx.fc = le16_to_cpu(hdr->frame_control); 1473 rx.fc = le16_to_cpu(hdr->frame_control);
1473 type = rx.fc & IEEE80211_FCTL_FTYPE; 1474 type = rx.fc & IEEE80211_FCTL_FTYPE;
1474 1475
1476 /*
1477 * Drivers are required to align the payload data to a four-byte
1478 * boundary, so the last two bits of the address where it starts
1479 * may not be set. The header is required to be directly before
1480 * the payload data, padding like atheros hardware adds which is
1481 * inbetween the 802.11 header and the payload is not supported,
1482 * the driver is required to move the 802.11 header further back
1483 * in that case.
1484 */
1485 hdrlen = ieee80211_get_hdrlen(rx.fc);
1486 WARN_ON_ONCE(((unsigned long)(skb->data + hdrlen)) & 3);
1487
1475 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT) 1488 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
1476 local->dot11ReceivedFragmentCount++; 1489 local->dot11ReceivedFragmentCount++;
1477 1490
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index e8491554a5dc..cfd8ee9adad0 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -14,6 +14,7 @@
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/skbuff.h> 15#include <linux/skbuff.h>
16#include <linux/if_arp.h> 16#include <linux/if_arp.h>
17#include <linux/timer.h>
17 18
18#include <net/mac80211.h> 19#include <net/mac80211.h>
19#include "ieee80211_i.h" 20#include "ieee80211_i.h"
@@ -306,7 +307,8 @@ static void sta_info_cleanup(unsigned long data)
306 } 307 }
307 read_unlock_bh(&local->sta_lock); 308 read_unlock_bh(&local->sta_lock);
308 309
309 local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL; 310 local->sta_cleanup.expires =
311 round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
310 add_timer(&local->sta_cleanup); 312 add_timer(&local->sta_cleanup);
311} 313}
312 314
@@ -345,7 +347,8 @@ void sta_info_init(struct ieee80211_local *local)
345 INIT_LIST_HEAD(&local->sta_list); 347 INIT_LIST_HEAD(&local->sta_list);
346 348
347 init_timer(&local->sta_cleanup); 349 init_timer(&local->sta_cleanup);
348 local->sta_cleanup.expires = jiffies + STA_INFO_CLEANUP_INTERVAL; 350 local->sta_cleanup.expires =
351 round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL);
349 local->sta_cleanup.data = (unsigned long) local; 352 local->sta_cleanup.data = (unsigned long) local;
350 local->sta_cleanup.function = sta_info_cleanup; 353 local->sta_cleanup.function = sta_info_cleanup;
351 354
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 000c2fb462d0..a4d5cdeb0110 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1016,7 +1016,7 @@ struct hlist_head *nf_ct_alloc_hashtable(int *sizep, int *vmalloced)
1016} 1016}
1017EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable); 1017EXPORT_SYMBOL_GPL(nf_ct_alloc_hashtable);
1018 1018
1019int set_hashsize(const char *val, struct kernel_param *kp) 1019int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp)
1020{ 1020{
1021 int i, bucket, hashsize, vmalloced; 1021 int i, bucket, hashsize, vmalloced;
1022 int old_vmalloced, old_size; 1022 int old_vmalloced, old_size;
@@ -1063,8 +1063,9 @@ int set_hashsize(const char *val, struct kernel_param *kp)
1063 nf_ct_free_hashtable(old_hash, old_vmalloced, old_size); 1063 nf_ct_free_hashtable(old_hash, old_vmalloced, old_size);
1064 return 0; 1064 return 0;
1065} 1065}
1066EXPORT_SYMBOL_GPL(nf_conntrack_set_hashsize);
1066 1067
1067module_param_call(hashsize, set_hashsize, param_get_uint, 1068module_param_call(hashsize, nf_conntrack_set_hashsize, param_get_uint,
1068 &nf_conntrack_htable_size, 0600); 1069 &nf_conntrack_htable_size, 0600);
1069 1070
1070int __init nf_conntrack_init(void) 1071int __init nf_conntrack_init(void)
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 8f8b5a48df38..515abffc4a09 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -187,7 +187,7 @@ static const struct sip_header_nfo ct_sip_hdrs[] = {
187 } 187 }
188}; 188};
189 189
190/* get line lenght until first CR or LF seen. */ 190/* get line length until first CR or LF seen. */
191int ct_sip_lnlen(const char *line, const char *limit) 191int ct_sip_lnlen(const char *line, const char *limit)
192{ 192{
193 const char *k = line; 193 const char *k = line;
@@ -236,7 +236,7 @@ static int digits_len(struct nf_conn *ct, const char *dptr,
236 return len; 236 return len;
237} 237}
238 238
239/* get digits lenght, skiping blank spaces. */ 239/* get digits length, skipping blank spaces. */
240static int skp_digits_len(struct nf_conn *ct, const char *dptr, 240static int skp_digits_len(struct nf_conn *ct, const char *dptr,
241 const char *limit, int *shift) 241 const char *limit, int *shift)
242{ 242{
diff --git a/net/netfilter/xt_helper.c b/net/netfilter/xt_helper.c
index 0a1f4c6bcdef..d842c4a6d63f 100644
--- a/net/netfilter/xt_helper.c
+++ b/net/netfilter/xt_helper.c
@@ -56,8 +56,8 @@ match(const struct sk_buff *skb,
56 if (info->name[0] == '\0') 56 if (info->name[0] == '\0')
57 ret = !ret; 57 ret = !ret;
58 else 58 else
59 ret ^= !strncmp(master_help->helper->name, info->name, 59 ret ^= !strncmp(helper->name, info->name,
60 strlen(master_help->helper->name)); 60 strlen(helper->name));
61 return ret; 61 return ret;
62} 62}
63 63
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index 56483377997a..9c41464d58d1 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -71,7 +71,7 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
71}; 71};
72 72
73/* 73/*
74 * NetLabel Misc Managment Functions 74 * NetLabel Misc Management Functions
75 */ 75 */
76 76
77/** 77/**
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 8c68da5ef0a1..6caf459665f2 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -56,7 +56,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
56 56
57 /* Spoof incoming device */ 57 /* Spoof incoming device */
58 skb->dev = dev; 58 skb->dev = dev;
59 skb_reset_mac_header(skb); 59 skb->mac_header = skb->network_header;
60 skb_reset_network_header(skb); 60 skb_reset_network_header(skb);
61 skb->pkt_type = PACKET_HOST; 61 skb->pkt_type = PACKET_HOST;
62 62
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 4469a7be006c..d06d338812e9 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -392,11 +392,14 @@ int rfkill_register(struct rfkill *rfkill)
392 rfkill_led_trigger_register(rfkill); 392 rfkill_led_trigger_register(rfkill);
393 393
394 error = rfkill_add_switch(rfkill); 394 error = rfkill_add_switch(rfkill);
395 if (error) 395 if (error) {
396 rfkill_led_trigger_unregister(rfkill);
396 return error; 397 return error;
398 }
397 399
398 error = device_add(dev); 400 error = device_add(dev);
399 if (error) { 401 if (error) {
402 rfkill_led_trigger_unregister(rfkill);
400 rfkill_remove_switch(rfkill); 403 rfkill_remove_switch(rfkill);
401 return error; 404 return error;
402 } 405 }
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 55e7e4530f43..a6ad491e434b 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -160,7 +160,7 @@ struct hfsc_class
160 u64 cl_vtoff; /* inter-period cumulative vt offset */ 160 u64 cl_vtoff; /* inter-period cumulative vt offset */
161 u64 cl_cvtmax; /* max child's vt in the last period */ 161 u64 cl_cvtmax; /* max child's vt in the last period */
162 u64 cl_cvtoff; /* cumulative cvtmax of all periods */ 162 u64 cl_cvtoff; /* cumulative cvtmax of all periods */
163 u64 cl_pcvtoff; /* parent's cvtoff at initalization 163 u64 cl_pcvtoff; /* parent's cvtoff at initialization
164 time */ 164 time */
165 165
166 struct internal_sc cl_rsc; /* internal real-time service curve */ 166 struct internal_sc cl_rsc; /* internal real-time service curve */
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index f4876291bb5e..3cc629d3c9ff 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -210,6 +210,9 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
210 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types); 210 chunksize = sizeof(init) + addrs_len + SCTP_SAT_LEN(num_types);
211 chunksize += sizeof(ecap_param); 211 chunksize += sizeof(ecap_param);
212 212
213 if (sctp_prsctp_enable)
214 chunksize += sizeof(prsctp_param);
215
213 /* ADDIP: Section 4.2.7: 216 /* ADDIP: Section 4.2.7:
214 * An implementation supporting this extension [ADDIP] MUST list 217 * An implementation supporting this extension [ADDIP] MUST list
215 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and 218 * the ASCONF,the ASCONF-ACK, and the AUTH chunks in its INIT and
@@ -286,7 +289,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
286 289
287 sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param); 290 sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param);
288 291
289 /* Add the supported extensions paramter. Be nice and add this 292 /* Add the supported extensions parameter. Be nice and add this
290 * fist before addiding the parameters for the extensions themselves 293 * fist before addiding the parameters for the extensions themselves
291 */ 294 */
292 if (num_ext) { 295 if (num_ext) {
@@ -369,6 +372,9 @@ struct sctp_chunk *sctp_make_init_ack(const struct sctp_association *asoc,
369 if (asoc->peer.ecn_capable) 372 if (asoc->peer.ecn_capable)
370 chunksize += sizeof(ecap_param); 373 chunksize += sizeof(ecap_param);
371 374
375 if (sctp_prsctp_enable)
376 chunksize += sizeof(prsctp_param);
377
372 if (sctp_addip_enable) { 378 if (sctp_addip_enable) {
373 extensions[num_ext] = SCTP_CID_ASCONF; 379 extensions[num_ext] = SCTP_CID_ASCONF;
374 extensions[num_ext+1] = SCTP_CID_ASCONF_ACK; 380 extensions[num_ext+1] = SCTP_CID_ASCONF_ACK;
@@ -2859,7 +2865,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
2859 chunk_len -= length; 2865 chunk_len -= length;
2860 2866
2861 /* Skip the address parameter and store a pointer to the first 2867 /* Skip the address parameter and store a pointer to the first
2862 * asconf paramter. 2868 * asconf parameter.
2863 */ 2869 */
2864 length = ntohs(addr_param->v4.param_hdr.length); 2870 length = ntohs(addr_param->v4.param_hdr.length);
2865 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); 2871 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
@@ -2868,7 +2874,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
2868 /* create an ASCONF_ACK chunk. 2874 /* create an ASCONF_ACK chunk.
2869 * Based on the definitions of parameters, we know that the size of 2875 * Based on the definitions of parameters, we know that the size of
2870 * ASCONF_ACK parameters are less than or equal to the twice of ASCONF 2876 * ASCONF_ACK parameters are less than or equal to the twice of ASCONF
2871 * paramters. 2877 * parameters.
2872 */ 2878 */
2873 asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2); 2879 asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2);
2874 if (!asconf_ack) 2880 if (!asconf_ack)
@@ -3062,7 +3068,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
3062 asconf_len -= length; 3068 asconf_len -= length;
3063 3069
3064 /* Skip the address parameter in the last asconf sent and store a 3070 /* Skip the address parameter in the last asconf sent and store a
3065 * pointer to the first asconf paramter. 3071 * pointer to the first asconf parameter.
3066 */ 3072 */
3067 length = ntohs(addr_param->v4.param_hdr.length); 3073 length = ntohs(addr_param->v4.param_hdr.length);
3068 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); 3074 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 5fb84778846d..d247ed4ee423 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1309,26 +1309,6 @@ static void sctp_tietags_populate(struct sctp_association *new_asoc,
1309 new_asoc->c.initial_tsn = asoc->c.initial_tsn; 1309 new_asoc->c.initial_tsn = asoc->c.initial_tsn;
1310} 1310}
1311 1311
1312static void sctp_auth_params_populate(struct sctp_association *new_asoc,
1313 const struct sctp_association *asoc)
1314{
1315 /* Only perform this if AUTH extension is enabled */
1316 if (!sctp_auth_enable)
1317 return;
1318
1319 /* We need to provide the same parameter information as
1320 * was in the original INIT. This means that we need to copy
1321 * the HMACS, CHUNKS, and RANDOM parameter from the original
1322 * assocaition.
1323 */
1324 memcpy(new_asoc->c.auth_random, asoc->c.auth_random,
1325 sizeof(asoc->c.auth_random));
1326 memcpy(new_asoc->c.auth_hmacs, asoc->c.auth_hmacs,
1327 sizeof(asoc->c.auth_hmacs));
1328 memcpy(new_asoc->c.auth_chunks, asoc->c.auth_chunks,
1329 sizeof(asoc->c.auth_chunks));
1330}
1331
1332/* 1312/*
1333 * Compare vtag/tietag values to determine unexpected COOKIE-ECHO 1313 * Compare vtag/tietag values to determine unexpected COOKIE-ECHO
1334 * handling action. 1314 * handling action.
@@ -1486,8 +1466,6 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
1486 1466
1487 sctp_tietags_populate(new_asoc, asoc); 1467 sctp_tietags_populate(new_asoc, asoc);
1488 1468
1489 sctp_auth_params_populate(new_asoc, asoc);
1490
1491 /* B) "Z" shall respond immediately with an INIT ACK chunk. */ 1469 /* B) "Z" shall respond immediately with an INIT ACK chunk. */
1492 1470
1493 /* If there are errors need to be reported for unknown parameters, 1471 /* If there are errors need to be reported for unknown parameters,
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index 2c17c7efad46..307314356e16 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -830,7 +830,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey(
830 ak = (struct sctp_authkey_event *) 830 ak = (struct sctp_authkey_event *)
831 skb_put(skb, sizeof(struct sctp_authkey_event)); 831 skb_put(skb, sizeof(struct sctp_authkey_event));
832 832
833 ak->auth_type = SCTP_AUTHENTICATION_EVENT; 833 ak->auth_type = SCTP_AUTHENTICATION_INDICATION;
834 ak->auth_flags = 0; 834 ak->auth_flags = 0;
835 ak->auth_length = sizeof(struct sctp_authkey_event); 835 ak->auth_length = sizeof(struct sctp_authkey_event);
836 836
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index a6e57d1c2eb6..1f2d85e869c0 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -625,7 +625,7 @@ gss_create(struct rpc_clnt *clnt, rpc_authflavor_t flavor)
625 err = -EINVAL; 625 err = -EINVAL;
626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor); 626 gss_auth->mech = gss_mech_get_by_pseudoflavor(flavor);
627 if (!gss_auth->mech) { 627 if (!gss_auth->mech) {
628 printk(KERN_WARNING "%s: Pseudoflavor %d not found!", 628 printk(KERN_WARNING "%s: Pseudoflavor %d not found!\n",
629 __FUNCTION__, flavor); 629 __FUNCTION__, flavor);
630 goto err_free; 630 goto err_free;
631 } 631 }
diff --git a/net/x25/x25_forward.c b/net/x25/x25_forward.c
index 8738ec7ce693..34478035e05e 100644
--- a/net/x25/x25_forward.c
+++ b/net/x25/x25_forward.c
@@ -118,13 +118,14 @@ int x25_forward_data(int lci, struct x25_neigh *from, struct sk_buff *skb) {
118 goto out; 118 goto out;
119 119
120 if ( (skbn = pskb_copy(skb, GFP_ATOMIC)) == NULL){ 120 if ( (skbn = pskb_copy(skb, GFP_ATOMIC)) == NULL){
121 goto out; 121 goto output;
122 122
123 } 123 }
124 x25_transmit_link(skbn, nb); 124 x25_transmit_link(skbn, nb);
125 125
126 x25_neigh_put(nb);
127 rc = 1; 126 rc = 1;
127output:
128 x25_neigh_put(nb);
128out: 129out:
129 return rc; 130 return rc;
130} 131}
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b91b16671c1e..26b846e11bfb 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2162,7 +2162,7 @@ xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
2162 2162
2163 if (audit_enabled == 0) 2163 if (audit_enabled == 0)
2164 return; 2164 return;
2165 audit_buf = xfrm_audit_start(sid, auid); 2165 audit_buf = xfrm_audit_start(auid, sid);
2166 if (audit_buf == NULL) 2166 if (audit_buf == NULL)
2167 return; 2167 return;
2168 audit_log_format(audit_buf, " op=SPD-add res=%u", result); 2168 audit_log_format(audit_buf, " op=SPD-add res=%u", result);
@@ -2179,7 +2179,7 @@ xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
2179 2179
2180 if (audit_enabled == 0) 2180 if (audit_enabled == 0)
2181 return; 2181 return;
2182 audit_buf = xfrm_audit_start(sid, auid); 2182 audit_buf = xfrm_audit_start(auid, sid);
2183 if (audit_buf == NULL) 2183 if (audit_buf == NULL)
2184 return; 2184 return;
2185 audit_log_format(audit_buf, " op=SPD-delete res=%u", result); 2185 audit_log_format(audit_buf, " op=SPD-delete res=%u", result);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 1af522bf12ca..f26aaaca1fae 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1749,6 +1749,7 @@ void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid)
1749} 1749}
1750EXPORT_SYMBOL(km_policy_expired); 1750EXPORT_SYMBOL(km_policy_expired);
1751 1751
1752#ifdef CONFIG_XFRM_MIGRATE
1752int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1753int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1753 struct xfrm_migrate *m, int num_migrate) 1754 struct xfrm_migrate *m, int num_migrate)
1754{ 1755{
@@ -1768,6 +1769,7 @@ int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
1768 return err; 1769 return err;
1769} 1770}
1770EXPORT_SYMBOL(km_migrate); 1771EXPORT_SYMBOL(km_migrate);
1772#endif
1771 1773
1772int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr) 1774int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
1773{ 1775{
@@ -2033,7 +2035,7 @@ xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
2033 2035
2034 if (audit_enabled == 0) 2036 if (audit_enabled == 0)
2035 return; 2037 return;
2036 audit_buf = xfrm_audit_start(sid, auid); 2038 audit_buf = xfrm_audit_start(auid, sid);
2037 if (audit_buf == NULL) 2039 if (audit_buf == NULL)
2038 return; 2040 return;
2039 audit_log_format(audit_buf, " op=SAD-add res=%u",result); 2041 audit_log_format(audit_buf, " op=SAD-add res=%u",result);
@@ -2053,7 +2055,7 @@ xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
2053 2055
2054 if (audit_enabled == 0) 2056 if (audit_enabled == 0)
2055 return; 2057 return;
2056 audit_buf = xfrm_audit_start(sid, auid); 2058 audit_buf = xfrm_audit_start(auid, sid);
2057 if (audit_buf == NULL) 2059 if (audit_buf == NULL)
2058 return; 2060 return;
2059 audit_log_format(audit_buf, " op=SAD-delete res=%u",result); 2061 audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index e75dbdcb08a4..c4f6419b1769 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -31,11 +31,6 @@
31#include <linux/in6.h> 31#include <linux/in6.h>
32#endif 32#endif
33 33
34static inline int alg_len(struct xfrm_algo *alg)
35{
36 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
37}
38
39static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type) 34static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
40{ 35{
41 struct nlattr *rt = attrs[type]; 36 struct nlattr *rt = attrs[type];
@@ -45,7 +40,7 @@ static int verify_one_alg(struct nlattr **attrs, enum xfrm_attr_type_t type)
45 return 0; 40 return 0;
46 41
47 algp = nla_data(rt); 42 algp = nla_data(rt);
48 if (nla_len(rt) < alg_len(algp)) 43 if (nla_len(rt) < xfrm_alg_len(algp))
49 return -EINVAL; 44 return -EINVAL;
50 45
51 switch (type) { 46 switch (type) {
@@ -204,7 +199,7 @@ static int attach_one_algo(struct xfrm_algo **algpp, u8 *props,
204 return -ENOSYS; 199 return -ENOSYS;
205 *props = algo->desc.sadb_alg_id; 200 *props = algo->desc.sadb_alg_id;
206 201
207 p = kmemdup(ualg, alg_len(ualg), GFP_KERNEL); 202 p = kmemdup(ualg, xfrm_alg_len(ualg), GFP_KERNEL);
208 if (!p) 203 if (!p)
209 return -ENOMEM; 204 return -ENOMEM;
210 205
@@ -516,9 +511,9 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
516 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused); 511 NLA_PUT_U64(skb, XFRMA_LASTUSED, x->lastused);
517 512
518 if (x->aalg) 513 if (x->aalg)
519 NLA_PUT(skb, XFRMA_ALG_AUTH, alg_len(x->aalg), x->aalg); 514 NLA_PUT(skb, XFRMA_ALG_AUTH, xfrm_alg_len(x->aalg), x->aalg);
520 if (x->ealg) 515 if (x->ealg)
521 NLA_PUT(skb, XFRMA_ALG_CRYPT, alg_len(x->ealg), x->ealg); 516 NLA_PUT(skb, XFRMA_ALG_CRYPT, xfrm_alg_len(x->ealg), x->ealg);
522 if (x->calg) 517 if (x->calg)
523 NLA_PUT(skb, XFRMA_ALG_COMP, sizeof(*(x->calg)), x->calg); 518 NLA_PUT(skb, XFRMA_ALG_COMP, sizeof(*(x->calg)), x->calg);
524 519
@@ -1978,9 +1973,9 @@ static inline size_t xfrm_sa_len(struct xfrm_state *x)
1978{ 1973{
1979 size_t l = 0; 1974 size_t l = 0;
1980 if (x->aalg) 1975 if (x->aalg)
1981 l += nla_total_size(alg_len(x->aalg)); 1976 l += nla_total_size(xfrm_alg_len(x->aalg));
1982 if (x->ealg) 1977 if (x->ealg)
1983 l += nla_total_size(alg_len(x->ealg)); 1978 l += nla_total_size(xfrm_alg_len(x->ealg));
1984 if (x->calg) 1979 if (x->calg)
1985 l += nla_total_size(sizeof(*x->calg)); 1980 l += nla_total_size(sizeof(*x->calg));
1986 if (x->encap) 1981 if (x->encap)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index a38787a881ea..8d6f17490c5e 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -374,7 +374,8 @@ static int conf_choice(struct menu *menu)
374 continue; 374 continue;
375 break; 375 break;
376 case set_random: 376 case set_random:
377 def = (random() % cnt) + 1; 377 if (is_new)
378 def = (random() % cnt) + 1;
378 case set_default: 379 case set_default:
379 case set_yes: 380 case set_yes:
380 case set_mod: 381 case set_mod:
diff --git a/security/commoncap.c b/security/commoncap.c
index 5bc1895f3f9c..ea61bc73f6d3 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -59,6 +59,12 @@ int cap_netlink_recv(struct sk_buff *skb, int cap)
59 59
60EXPORT_SYMBOL(cap_netlink_recv); 60EXPORT_SYMBOL(cap_netlink_recv);
61 61
62/*
63 * NOTE WELL: cap_capable() cannot be used like the kernel's capable()
64 * function. That is, it has the reverse semantics: cap_capable()
65 * returns 0 when a task has a capability, but the kernel's capable()
66 * returns 1 for this case.
67 */
62int cap_capable (struct task_struct *tsk, int cap) 68int cap_capable (struct task_struct *tsk, int cap)
63{ 69{
64 /* Derived from include/linux/sched.h:capable. */ 70 /* Derived from include/linux/sched.h:capable. */
@@ -107,10 +113,11 @@ static inline int cap_block_setpcap(struct task_struct *target)
107static inline int cap_inh_is_capped(void) 113static inline int cap_inh_is_capped(void)
108{ 114{
109 /* 115 /*
110 * return 1 if changes to the inheritable set are limited 116 * Return 1 if changes to the inheritable set are limited
111 * to the old permitted set. 117 * to the old permitted set. That is, if the current task
118 * does *not* possess the CAP_SETPCAP capability.
112 */ 119 */
113 return !cap_capable(current, CAP_SETPCAP); 120 return (cap_capable(current, CAP_SETPCAP) != 0);
114} 121}
115 122
116#else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */ 123#else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */
diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
index d243ddc723a5..66e013d6f6f6 100644
--- a/security/selinux/netlabel.c
+++ b/security/selinux/netlabel.c
@@ -53,10 +53,11 @@ static int selinux_netlbl_sock_setsid(struct sock *sk, u32 sid)
53 struct sk_security_struct *sksec = sk->sk_security; 53 struct sk_security_struct *sksec = sk->sk_security;
54 struct netlbl_lsm_secattr secattr; 54 struct netlbl_lsm_secattr secattr;
55 55
56 netlbl_secattr_init(&secattr);
57
56 rc = security_netlbl_sid_to_secattr(sid, &secattr); 58 rc = security_netlbl_sid_to_secattr(sid, &secattr);
57 if (rc != 0) 59 if (rc != 0)
58 return rc; 60 goto sock_setsid_return;
59
60 rc = netlbl_sock_setattr(sk, &secattr); 61 rc = netlbl_sock_setattr(sk, &secattr);
61 if (rc == 0) { 62 if (rc == 0) {
62 spin_lock_bh(&sksec->nlbl_lock); 63 spin_lock_bh(&sksec->nlbl_lock);
@@ -64,6 +65,8 @@ static int selinux_netlbl_sock_setsid(struct sock *sk, u32 sid)
64 spin_unlock_bh(&sksec->nlbl_lock); 65 spin_unlock_bh(&sksec->nlbl_lock);
65 } 66 }
66 67
68sock_setsid_return:
69 netlbl_secattr_destroy(&secattr);
67 return rc; 70 return rc;
68} 71}
69 72
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index d572dc908f31..f83b19daed16 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2606,8 +2606,6 @@ int security_netlbl_sid_to_secattr(u32 sid, struct netlbl_lsm_secattr *secattr)
2606 int rc = -ENOENT; 2606 int rc = -ENOENT;
2607 struct context *ctx; 2607 struct context *ctx;
2608 2608
2609 netlbl_secattr_init(secattr);
2610
2611 if (!ss_initialized) 2609 if (!ss_initialized)
2612 return 0; 2610 return 0;
2613 2611
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 3ace4a5680ba..c5a5ab9cae8c 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -925,6 +925,68 @@ static void mixer_slot_clear(struct snd_mixer_oss_slot *rslot)
925 rslot->number = idx; 925 rslot->number = idx;
926} 926}
927 927
928/* In a separate function to keep gcc 3.2 happy - do NOT merge this in
929 snd_mixer_oss_build_input! */
930static int snd_mixer_oss_build_test_all(struct snd_mixer_oss *mixer,
931 struct snd_mixer_oss_assign_table *ptr,
932 struct slot *slot)
933{
934 char str[64];
935 int err;
936
937 err = snd_mixer_oss_build_test(mixer, slot, ptr->name, ptr->index,
938 SNDRV_MIXER_OSS_ITEM_GLOBAL);
939 if (err)
940 return err;
941 sprintf(str, "%s Switch", ptr->name);
942 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
943 SNDRV_MIXER_OSS_ITEM_GSWITCH);
944 if (err)
945 return err;
946 sprintf(str, "%s Route", ptr->name);
947 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
948 SNDRV_MIXER_OSS_ITEM_GROUTE);
949 if (err)
950 return err;
951 sprintf(str, "%s Volume", ptr->name);
952 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
953 SNDRV_MIXER_OSS_ITEM_GVOLUME);
954 if (err)
955 return err;
956 sprintf(str, "%s Playback Switch", ptr->name);
957 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
958 SNDRV_MIXER_OSS_ITEM_PSWITCH);
959 if (err)
960 return err;
961 sprintf(str, "%s Playback Route", ptr->name);
962 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
963 SNDRV_MIXER_OSS_ITEM_PROUTE);
964 if (err)
965 return err;
966 sprintf(str, "%s Playback Volume", ptr->name);
967 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
968 SNDRV_MIXER_OSS_ITEM_PVOLUME);
969 if (err)
970 return err;
971 sprintf(str, "%s Capture Switch", ptr->name);
972 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
973 SNDRV_MIXER_OSS_ITEM_CSWITCH);
974 if (err)
975 return err;
976 sprintf(str, "%s Capture Route", ptr->name);
977 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
978 SNDRV_MIXER_OSS_ITEM_CROUTE);
979 if (err)
980 return err;
981 sprintf(str, "%s Capture Volume", ptr->name);
982 err = snd_mixer_oss_build_test(mixer, slot, str, ptr->index,
983 SNDRV_MIXER_OSS_ITEM_CVOLUME);
984 if (err)
985 return err;
986
987 return 0;
988}
989
928/* 990/*
929 * build an OSS mixer element. 991 * build an OSS mixer element.
930 * ptr_allocated means the entry is dynamically allocated (change via proc file). 992 * ptr_allocated means the entry is dynamically allocated (change via proc file).
@@ -944,44 +1006,7 @@ static int snd_mixer_oss_build_input(struct snd_mixer_oss *mixer, struct snd_mix
944 1006
945 memset(&slot, 0, sizeof(slot)); 1007 memset(&slot, 0, sizeof(slot));
946 memset(slot.numid, 0xff, sizeof(slot.numid)); /* ID_UNKNOWN */ 1008 memset(slot.numid, 0xff, sizeof(slot.numid)); /* ID_UNKNOWN */
947 if (snd_mixer_oss_build_test(mixer, &slot, ptr->name, ptr->index, 1009 if (snd_mixer_oss_build_test_all(mixer, ptr, &slot))
948 SNDRV_MIXER_OSS_ITEM_GLOBAL))
949 return 0;
950 sprintf(str, "%s Switch", ptr->name);
951 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
952 SNDRV_MIXER_OSS_ITEM_GSWITCH))
953 return 0;
954 sprintf(str, "%s Route", ptr->name);
955 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
956 SNDRV_MIXER_OSS_ITEM_GROUTE))
957 return 0;
958 sprintf(str, "%s Volume", ptr->name);
959 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
960 SNDRV_MIXER_OSS_ITEM_GVOLUME))
961 return 0;
962 sprintf(str, "%s Playback Switch", ptr->name);
963 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
964 SNDRV_MIXER_OSS_ITEM_PSWITCH))
965 return 0;
966 sprintf(str, "%s Playback Route", ptr->name);
967 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
968 SNDRV_MIXER_OSS_ITEM_PROUTE))
969 return 0;
970 sprintf(str, "%s Playback Volume", ptr->name);
971 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
972 SNDRV_MIXER_OSS_ITEM_PVOLUME))
973 return 0;
974 sprintf(str, "%s Capture Switch", ptr->name);
975 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
976 SNDRV_MIXER_OSS_ITEM_CSWITCH))
977 return 0;
978 sprintf(str, "%s Capture Route", ptr->name);
979 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
980 SNDRV_MIXER_OSS_ITEM_CROUTE))
981 return 0;
982 sprintf(str, "%s Capture Volume", ptr->name);
983 if (snd_mixer_oss_build_test(mixer, &slot, str, ptr->index,
984 SNDRV_MIXER_OSS_ITEM_CVOLUME))
985 return 0; 1010 return 0;
986 down_read(&mixer->card->controls_rwsem); 1011 down_read(&mixer->card->controls_rwsem);
987 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) { 1012 if (ptr->index == 0 && (kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0)) != NULL) {
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index af37cd09bddd..857008bb7167 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -75,7 +75,7 @@ config SOUND_TRIDENT
75 75
76 76
77 This driver differs slightly from OSS/Free, so PLEASE READ the 77 This driver differs slightly from OSS/Free, so PLEASE READ the
78 comments at the top of <file:drivers/sound/trident.c>. 78 comments at the top of <file:sound/oss/trident.c>.
79 79
80config SOUND_MSNDCLAS 80config SOUND_MSNDCLAS
81 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey" 81 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey"
@@ -564,7 +564,7 @@ config SOUND_AEDSP16
564 questions. 564 questions.
565 565
566 Read the <file:Documentation/sound/oss/README.OSS> file and the head of 566 Read the <file:Documentation/sound/oss/README.OSS> file and the head of
567 <file:drivers/sound/aedsp16.c> as well as 567 <file:sound/oss/aedsp16.c> as well as
568 <file:Documentation/sound/oss/AudioExcelDSP16> to get more information 568 <file:Documentation/sound/oss/AudioExcelDSP16> to get more information
569 about this driver and its configuration. 569 about this driver and its configuration.
570 570
diff --git a/sound/oss/msnd.h b/sound/oss/msnd.h
index 05cf7865be5e..d0ca582c4583 100644
--- a/sound/oss/msnd.h
+++ b/sound/oss/msnd.h
@@ -233,8 +233,8 @@ typedef struct multisound_dev {
233 spinlock_t lock; 233 spinlock_t lock;
234 int nresets; 234 int nresets;
235 unsigned long recsrc; 235 unsigned long recsrc;
236 int left_levels[16]; 236 int left_levels[32];
237 int right_levels[16]; 237 int right_levels[32];
238 int mixer_mod_count; 238 int mixer_mod_count;
239 int calibrate_signal; 239 int calibrate_signal;
240 int play_sample_size, play_sample_rate, play_channels; 240 int play_sample_size, play_sample_rate, play_channels;