aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-kernel-uids14
-rw-r--r--Documentation/i2c/summary45
-rw-r--r--Documentation/ja_JP/HOWTO8
-rw-r--r--Documentation/ko_KR/HOWTO144
-rw-r--r--Documentation/ko_KR/stable_api_nonsense.txt195
-rw-r--r--Documentation/lguest/lguest.txt4
-rw-r--r--Documentation/nfsroot.txt12
-rw-r--r--Documentation/sysctl/vm.txt19
-rw-r--r--Documentation/tipar.txt93
-rw-r--r--Documentation/vm/hugetlbpage.txt35
-rw-r--r--MAINTAINERS17
-rw-r--r--Makefile2
-rw-r--r--arch/alpha/Makefile10
-rw-r--r--arch/alpha/kernel/err_ev7.c2
-rw-r--r--arch/alpha/kernel/err_marvel.c2
-rw-r--r--arch/alpha/kernel/err_titan.c2
-rw-r--r--arch/alpha/kernel/machvec_impl.h2
-rw-r--r--arch/alpha/lib/ev6-stxncpy.S14
-rw-r--r--arch/alpha/lib/strncpy.S2
-rw-r--r--arch/alpha/lib/stxncpy.S14
-rw-r--r--arch/arm/Kconfig8
-rw-r--r--arch/arm/boot/compressed/head.S2
-rw-r--r--arch/arm/common/it8152.c10
-rw-r--r--arch/arm/mach-ixp4xx/common.c10
-rw-r--r--arch/arm/mach-pxa/cm-x270-pci.c18
-rw-r--r--arch/ia64/hp/common/sba_iommu.c3
-rw-r--r--arch/ia64/ia32/binfmt_elf32.c28
-rw-r--r--arch/ia64/kernel/head.S1
-rw-r--r--arch/ia64/kernel/irq_ia64.c4
-rw-r--r--arch/ia64/kernel/mca.c33
-rw-r--r--arch/ia64/kernel/process.c7
-rw-r--r--arch/ia64/kernel/signal.c10
-rw-r--r--arch/ia64/kernel/uncached.c2
-rw-r--r--arch/ia64/mm/tlb.c18
-rw-r--r--arch/ia64/sn/kernel/bte.c4
-rw-r--r--arch/ia64/sn/kernel/bte_error.c8
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c2
-rw-r--r--arch/mips/au1000/Kconfig9
-rw-r--r--arch/mips/au1000/common/pci.c8
-rw-r--r--arch/mips/au1000/common/setup.c9
-rw-r--r--arch/mips/cobalt/time.c21
-rw-r--r--arch/mips/kernel/process.c3
-rw-r--r--arch/mips/kernel/time.c4
-rw-r--r--arch/mips/kernel/traps.c6
-rw-r--r--arch/mips/mips-boards/generic/memory.c2
-rw-r--r--arch/mips/pci/pci.c2
-rw-r--r--arch/powerpc/configs/mpc8272_ads_defconfig6
-rw-r--r--arch/powerpc/configs/pq2fads_defconfig6
-rw-r--r--arch/powerpc/configs/ps3_defconfig2
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c12
-rw-r--r--arch/powerpc/math-emu/op-2.h3
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c17
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig2
-rw-r--r--arch/powerpc/sysdev/cpm2_common.c3
-rw-r--r--arch/sparc/kernel/ptrace.c2
-rw-r--r--arch/sparc64/kernel/entry.S12
-rw-r--r--arch/sparc64/kernel/pci_schizo.c2
-rw-r--r--arch/sparc64/kernel/smp.c19
-rw-r--r--arch/sparc64/mm/init.c29
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/um/drivers/net_user.c2
-rw-r--r--arch/um/drivers/slip_user.c12
-rw-r--r--arch/um/drivers/slirp_user.c15
-rw-r--r--arch/um/drivers/ubd_user.c3
-rw-r--r--arch/um/include/os.h2
-rw-r--r--arch/um/os-Linux/aio.c4
-rw-r--r--arch/um/os-Linux/drivers/ethertap_user.c10
-rw-r--r--arch/um/os-Linux/drivers/tuntap_user.c2
-rw-r--r--arch/um/os-Linux/helper.c38
-rw-r--r--arch/um/os-Linux/process.c4
-rw-r--r--arch/um/os-Linux/skas/process.c12
-rw-r--r--arch/um/os-Linux/util.c2
-rw-r--r--arch/x86/kernel/apic_32.c2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c1
-rw-r--r--arch/x86/kernel/io_apic_32.c16
-rw-r--r--arch/x86/kernel/io_apic_64.c16
-rw-r--r--arch/x86/kernel/kprobes_32.c4
-rw-r--r--arch/x86/kernel/kprobes_64.c47
-rw-r--r--arch/x86/kernel/process_32.c2
-rw-r--r--arch/x86/kernel/setup_32.c2
-rw-r--r--arch/x86/kernel/smpboot_32.c6
-rw-r--r--arch/x86/kernel/smpboot_64.c2
-rw-r--r--arch/x86/kernel/suspend_64.c39
-rw-r--r--arch/x86/kernel/traps_32.c7
-rw-r--r--arch/x86/oprofile/op_model_athlon.c22
-rw-r--r--arch/xtensa/platform-iss/network.c4
-rw-r--r--block/as-iosched.c11
-rw-r--r--block/cfq-iosched.c8
-rw-r--r--block/deadline-iosched.c4
-rw-r--r--block/elevator.c3
-rw-r--r--block/noop-iosched.c4
-rw-r--r--block/scsi_ioctl.c4
-rw-r--r--drivers/acpi/battery.c2
-rw-r--r--drivers/acpi/numa.c4
-rw-r--r--drivers/acpi/pci_bind.c3
-rw-r--r--drivers/acpi/sbs.c27
-rw-r--r--drivers/acpi/sbshc.c17
-rw-r--r--drivers/acpi/sbshc.h6
-rw-r--r--drivers/acpi/video.c4
-rw-r--r--drivers/ata/libata-acpi.c387
-rw-r--r--drivers/ata/libata-core.c101
-rw-r--r--drivers/ata/libata-eh.c4
-rw-r--r--drivers/ata/libata.h8
-rw-r--r--drivers/ata/pata_hpt37x.c2
-rw-r--r--drivers/ata/sata_mv.c30
-rw-r--r--drivers/ata/sata_sil.c18
-rw-r--r--drivers/atm/firestream.c4
-rw-r--r--drivers/atm/fore200e.c3
-rw-r--r--drivers/block/pktcdvd.c4
-rw-r--r--drivers/block/umem.c237
-rw-r--r--drivers/char/Kconfig22
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c2
-rw-r--r--drivers/char/tipar.c557
-rw-r--r--drivers/cpufreq/cpufreq.c12
-rw-r--r--drivers/cpufreq/cpufreq_stats.c2
-rw-r--r--drivers/dma/ioat_dma.c144
-rw-r--r--drivers/dma/ioatdma.h2
-rw-r--r--drivers/i2c/busses/i2c-davinci.c4
-rw-r--r--drivers/i2c/busses/i2c-gpio.c1
-rw-r--r--drivers/i2c/busses/i2c-omap.c6
-rw-r--r--drivers/i2c/chips/isp1301_omap.c2
-rw-r--r--drivers/ide/Kconfig6
-rw-r--r--drivers/ide/ide-cd.c35
-rw-r--r--drivers/ide/ide-disk.c33
-rw-r--r--drivers/ide/ide-dma.c66
-rw-r--r--drivers/ide/ide-io.c3
-rw-r--r--drivers/ide/ide-iops.c3
-rw-r--r--drivers/ide/ide-lib.c55
-rw-r--r--drivers/ide/ide-probe.c21
-rw-r--r--drivers/ide/ide.c30
-rw-r--r--drivers/ide/pci/hpt366.c71
-rw-r--r--drivers/ide/pci/pdc202xx_new.c3
-rw-r--r--drivers/ide/setup-pci.c31
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h1
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c15
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c4
-rw-r--r--drivers/infiniband/hw/ehca/hcp_if.c27
-rw-r--r--drivers/infiniband/hw/ehca/hipz_hw.h1
-rw-r--r--drivers/macintosh/via-pmu.c1
-rw-r--r--drivers/md/Kconfig2
-rw-r--r--drivers/md/dm-crypt.c31
-rw-r--r--drivers/md/dm-ioctl.c12
-rw-r--r--drivers/md/dm-table.c16
-rw-r--r--drivers/md/dm.c31
-rw-r--r--drivers/md/dm.h7
-rw-r--r--drivers/media/Makefile2
-rw-r--r--drivers/media/common/saa7146_video.c11
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile3
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c4
-rw-r--r--drivers/media/dvb/frontends/s5h1409.c11
-rw-r--r--drivers/media/dvb/frontends/tda10086.c14
-rw-r--r--drivers/media/dvb/frontends/zl10353.c4
-rw-r--r--drivers/media/dvb/frontends/zl10353.h2
-rw-r--r--drivers/media/video/bt866.c1
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c9
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c5
-rw-r--r--drivers/media/video/cx88/cx88-video.c5
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c7
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c2
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.h2
-rw-r--r--drivers/media/video/ivtv/ivtv-streams.c2
-rw-r--r--drivers/media/video/saa5246a.c10
-rw-r--r--drivers/media/video/saa5249.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c3
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c21
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-empress.c5
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c5
-rw-r--r--drivers/media/video/tvp5150.c11
-rw-r--r--drivers/media/video/videobuf-core.c263
-rw-r--r--drivers/media/video/videobuf-vmalloc.c6
-rw-r--r--drivers/media/video/vivi.c1
-rw-r--r--drivers/misc/thinkpad_acpi.c4
-rw-r--r--drivers/mmc/host/sdhci.c63
-rw-r--r--drivers/mmc/host/sdhci.h3
-rw-r--r--drivers/net/Kconfig1
-rw-r--r--drivers/net/bnx2.c35
-rw-r--r--drivers/net/bnx2.h1
-rw-r--r--drivers/net/dl2k.c51
-rw-r--r--drivers/net/dl2k.h6
-rw-r--r--drivers/net/e100.c5
-rw-r--r--drivers/net/fec_mpc52xx.c5
-rw-r--r--drivers/net/fs_enet/mac-scc.c2
-rw-r--r--drivers/net/hamachi.c70
-rw-r--r--drivers/net/ibm_newemac/debug.c2
-rw-r--r--drivers/net/irda/irda-usb.c5
-rw-r--r--drivers/net/irda/mcs7780.c2
-rw-r--r--drivers/net/irda/stir4200.c10
-rw-r--r--drivers/net/ixgb/ixgb_main.c16
-rw-r--r--drivers/net/pcmcia/3c574_cs.c10
-rw-r--r--drivers/net/pcmcia/3c589_cs.c9
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/rrunner.c49
-rw-r--r--drivers/net/rrunner.h2
-rw-r--r--drivers/net/s2io.c4
-rw-r--r--drivers/net/sis190.c10
-rw-r--r--drivers/net/sky2.c9
-rw-r--r--drivers/net/smc911x.h2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/sundance.c34
-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/typhoon.c45
-rw-r--r--drivers/net/typhoon.h15
-rw-r--r--drivers/net/ucc_geth.c2
-rw-r--r--drivers/net/ucc_geth_mii.h2
-rw-r--r--drivers/net/usb/asix.c235
-rw-r--r--drivers/net/wan/cycx_x25.c12
-rw-r--r--drivers/net/wan/syncppp.c35
-rw-r--r--drivers/net/wireless/Kconfig1
-rw-r--r--drivers/net/wireless/b43/leds.c4
-rw-r--r--drivers/net/wireless/b43/main.c22
-rw-r--r--drivers/net/wireless/b43/rfkill.c37
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c2
-rw-r--r--drivers/net/wireless/ipw2200.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c5
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c10
-rw-r--r--drivers/net/yellowfin.c25
-rw-r--r--drivers/parport/procfs.c2
-rw-r--r--drivers/pci/probe.c3
-rw-r--r--drivers/rtc/rtc-at32ap700x.c20
-rw-r--r--drivers/s390/net/ctcmain.c6
-rw-r--r--drivers/s390/net/netiucv.c4
-rw-r--r--drivers/sbus/char/cpwatchdog.c2
-rw-r--r--drivers/scsi/dpt_i2o.c3
-rw-r--r--drivers/scsi/ide-scsi.c17
-rw-r--r--drivers/scsi/initio.c2
-rw-r--r--drivers/scsi/st.c1
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
-rw-r--r--drivers/serial/suncore.c33
-rw-r--r--drivers/serial/suncore.h3
-rw-r--r--drivers/serial/sunhv.c14
-rw-r--r--drivers/serial/sunsab.c16
-rw-r--r--drivers/serial/sunsu.c16
-rw-r--r--drivers/serial/sunzilog.c41
-rw-r--r--drivers/usb/core/hcd-pci.c2
-rw-r--r--drivers/usb/core/hub.c6
-rw-r--r--drivers/usb/gadget/at91_udc.c2
-rw-r--r--drivers/usb/host/ehci-fsl.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c23
-rw-r--r--drivers/usb/host/ohci-ppc-of.c2
-rw-r--r--drivers/usb/host/ohci-ssb.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/uhci-hcd.c9
-rw-r--r--drivers/usb/serial/cp2101.c5
-rw-r--r--drivers/usb/serial/option.c4
-rw-r--r--drivers/usb/serial/sierra.c2
-rw-r--r--drivers/usb/storage/scsiglue.c12
-rw-r--r--drivers/usb/storage/unusual_devs.h15
-rw-r--r--drivers/video/ps3fb.c28
-rw-r--r--drivers/watchdog/Kconfig23
-rw-r--r--drivers/watchdog/Makefile2
-rw-r--r--drivers/watchdog/at32ap700x_wdt.c69
-rw-r--r--drivers/watchdog/bfin_wdt.c2
-rw-r--r--drivers/watchdog/it8712f_wdt.c400
-rw-r--r--drivers/watchdog/sbc7240_wdt.c324
-rw-r--r--drivers/watchdog/w83697hf_wdt.c4
-rw-r--r--fs/Kconfig2
-rw-r--r--fs/binfmt_aout.c1
-rw-r--r--fs/dquot.c4
-rw-r--r--fs/ecryptfs/keystore.c2
-rw-r--r--fs/ecryptfs/main.c1
-rw-r--r--fs/ecryptfs/mmap.c31
-rw-r--r--fs/ecryptfs/read_write.c27
-rw-r--r--fs/ext3/super.c2
-rw-r--r--fs/ext4/super.c2
-rw-r--r--fs/nfs/client.c6
-rw-r--r--fs/nfs/direct.c2
-rw-r--r--fs/nfs/getroot.c11
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/ocfs2/alloc.c68
-rw-r--r--fs/ocfs2/journal.c13
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c4
-rw-r--r--fs/xfs/xfs_dir2_block.c6
-rw-r--r--fs/xfs/xfs_dir2_leaf.c2
-rw-r--r--fs/xfs/xfs_dir2_sf.c9
-rw-r--r--fs/xfs/xfs_inode.c6
-rw-r--r--include/asm-alpha/io_trivial.h12
-rw-r--r--include/asm-arm/arch-pxa/pxa-regs.h1
-rw-r--r--include/asm-generic/tlb.h4
-rw-r--r--include/asm-ia64/bitops.h17
-rw-r--r--include/asm-ia64/gcc_intrin.h5
-rw-r--r--include/asm-ia64/hw_irq.h2
-rw-r--r--include/asm-ia64/intel_intrin.h3
-rw-r--r--include/asm-ia64/sn/bte.h31
-rw-r--r--include/asm-ia64/sn/xp.h27
-rw-r--r--include/asm-ia64/sn/xpc.h8
-rw-r--r--include/asm-ia64/tlbflush.h6
-rw-r--r--include/asm-mips/mach-au1x00/au1000.h9
-rw-r--r--include/asm-powerpc/commproc.h3
-rw-r--r--include/asm-s390/pgtable.h8
-rw-r--r--include/asm-sparc/unistd.h9
-rw-r--r--include/asm-sparc64/dma-mapping.h12
-rw-r--r--include/asm-sparc64/hypervisor.h4
-rw-r--r--include/asm-x86/kprobes_32.h2
-rw-r--r--include/asm-x86/kprobes_64.h2
-rw-r--r--include/asm-x86/system_64.h7
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/apm_bios.h6
-rw-r--r--include/linux/ata.h15
-rw-r--r--include/linux/device-mapper.h1
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/hugetlb.h2
-rw-r--r--include/linux/ide.h6
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/libata.h29
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/netfilter_bridge.h3
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/ticable.h44
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usb_usual.h5
-rw-r--r--include/media/videobuf-core.h2
-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/sctp/structs.h6
-rw-r--r--kernel/irq/chip.c9
-rw-r--r--kernel/panic.c18
-rw-r--r--kernel/rwsem.c5
-rw-r--r--kernel/sched.c18
-rw-r--r--kernel/sched_fair.c3
-rw-r--r--kernel/sched_rt.c2
-rw-r--r--kernel/sysctl.c16
-rw-r--r--kernel/sysctl_check.c7
-rw-r--r--kernel/time/tick-broadcast.c56
-rw-r--r--kernel/timer.c4
-rw-r--r--lib/kobject.c12
-rw-r--r--lib/rwsem.c2
-rw-r--r--mm/Kconfig15
-rw-r--r--mm/filemap.c12
-rw-r--r--mm/hugetlb.c68
-rw-r--r--mm/page_alloc.c11
-rw-r--r--mm/slub.c7
-rw-r--r--mm/sparse.c20
-rw-r--r--net/8021q/vlan.c2
-rw-r--r--net/ax25/ax25_in.c2
-rw-r--r--net/ax25/ax25_subr.c2
-rw-r--r--net/bridge/br_device.c3
-rw-r--r--net/compat.c2
-rw-r--r--net/core/dev.c8
-rw-r--r--net/core/scm.c2
-rw-r--r--net/dccp/ackvec.h2
-rw-r--r--net/dccp/ccids/ccid3.c2
-rw-r--r--net/ipv4/arp.c3
-rw-r--r--net/ipv4/devinet.c3
-rw-r--r--net/ipv4/esp4.c5
-rw-r--r--net/ipv4/fib_frontend.c9
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ipconfig.c20
-rw-r--r--net/ipv4/netfilter/ip_tables.c57
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c2
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv6/esp6.c6
-rw-r--r--net/ipv6/ipv6_sockglue.c12
-rw-r--r--net/ipv6/ndisc.c2
-rw-r--r--net/ipv6/xfrm6_policy.c2
-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/irlmp.c1
-rw-r--r--net/irda/parameters.c18
-rw-r--r--net/irda/wrapper.c2
-rw-r--r--net/key/af_key.c14
-rw-r--r--net/mac80211/ieee80211.c1
-rw-r--r--net/mac80211/ieee80211_rate.c3
-rw-r--r--net/mac80211/ieee80211_sta.c8
-rw-r--r--net/netfilter/nf_conntrack_netlink.c4
-rw-r--r--net/netfilter/nf_conntrack_sip.c4
-rw-r--r--net/netfilter/x_tables.c8
-rw-r--r--net/netfilter/xt_hashlimit.c2
-rw-r--r--net/netlabel/netlabel_mgmt.c2
-rw-r--r--net/netrom/nr_dev.c2
-rw-r--r--net/sched/sch_hfsc.c2
-rw-r--r--net/sctp/sm_make_chunk.c8
-rw-r--r--net/sctp/ulpqueue.c33
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c9
-rw-r--r--net/tipc/socket.c2
-rw-r--r--net/xfrm/xfrm_policy.c13
-rw-r--r--net/xfrm/xfrm_state.c14
-rwxr-xr-xscripts/bloat-o-meter3
-rw-r--r--scripts/mkmakefile2
-rw-r--r--sound/arm/pxa2xx-ac97.c4
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c4
391 files changed, 4177 insertions, 3031 deletions
diff --git a/Documentation/ABI/testing/sysfs-kernel-uids b/Documentation/ABI/testing/sysfs-kernel-uids
new file mode 100644
index 000000000000..648d65dbc0e7
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-uids
@@ -0,0 +1,14 @@
1What: /sys/kernel/uids/<uid>/cpu_shares
2Date: December 2007
3Contact: Dhaval Giani <dhaval@linux.vnet.ibm.com>
4 Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>
5Description:
6 The /sys/kernel/uids/<uid>/cpu_shares tunable is used
7 to set the cpu bandwidth a user is allowed. This is a
8 propotional value. What that means is that if there
9 are two users logged in, each with an equal number of
10 shares, then they will get equal CPU bandwidth. Another
11 example would be, if User A has shares = 1024 and user
12 B has shares = 2048, User B will get twice the CPU
13 bandwidth user A will. For more details refer
14 Documentation/sched-design-CFS.txt
diff --git a/Documentation/i2c/summary b/Documentation/i2c/summary
index 003c7319b8c7..13ab076dcd92 100644
--- a/Documentation/i2c/summary
+++ b/Documentation/i2c/summary
@@ -1,5 +1,3 @@
1This is an explanation of what i2c is, and what is supported in this package.
2
3I2C and SMBus 1I2C and SMBus
4============= 2=============
5 3
@@ -33,52 +31,17 @@ When we talk about I2C, we use the following terms:
33 Client 31 Client
34 32
35An Algorithm driver contains general code that can be used for a whole class 33An Algorithm driver contains general code that can be used for a whole class
36of I2C adapters. Each specific adapter driver depends on one algorithm 34of I2C adapters. Each specific adapter driver either depends on one algorithm
37driver. 35driver, or includes its own implementation.
38 36
39A Driver driver (yes, this sounds ridiculous, sorry) contains the general 37A Driver driver (yes, this sounds ridiculous, sorry) contains the general
40code to access some type of device. Each detected device gets its own 38code to access some type of device. Each detected device gets its own
41data in the Client structure. Usually, Driver and Client are more closely 39data in the Client structure. Usually, Driver and Client are more closely
42integrated than Algorithm and Adapter. 40integrated than Algorithm and Adapter.
43 41
44For a given configuration, you will need a driver for your I2C bus (usually 42For a given configuration, you will need a driver for your I2C bus, and
45a separate Adapter and Algorithm driver), and drivers for your I2C devices 43drivers for your I2C devices (usually one driver for each device).
46(usually one driver for each device). There are no I2C device drivers
47in this package. See the lm_sensors project http://www.lm-sensors.nu
48for device drivers.
49 44
50At this time, Linux only operates I2C (or SMBus) in master mode; you can't 45At this time, Linux only operates I2C (or SMBus) in master mode; you can't
51use these APIs to make a Linux system behave as a slave/device, either to 46use these APIs to make a Linux system behave as a slave/device, either to
52speak a custom protocol or to emulate some other device. 47speak a custom protocol or to emulate some other device.
53
54
55Included Bus Drivers
56====================
57Note that only stable drivers are patched into the kernel by 'mkpatch'.
58
59
60Base modules
61------------
62
63i2c-core: The basic I2C code, including the /proc/bus/i2c* interface
64i2c-dev: The /dev/i2c-* interface
65i2c-proc: The /proc/sys/dev/sensors interface for device (client) drivers
66
67Algorithm drivers
68-----------------
69
70i2c-algo-bit: A bit-banging algorithm
71i2c-algo-pcf: A PCF 8584 style algorithm
72i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
73
74Adapter drivers
75---------------
76
77i2c-elektor: Elektor ISA card (uses i2c-algo-pcf)
78i2c-elv: ELV parallel port adapter (uses i2c-algo-bit)
79i2c-pcf-epp: PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
80i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
81i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
82i2c-pport: Primitive parallel port adapter (uses i2c-algo-bit)
83i2c-velleman: Velleman K8000 parallel port adapter (uses i2c-algo-bit)
84
diff --git a/Documentation/ja_JP/HOWTO b/Documentation/ja_JP/HOWTO
index d9d832c010ef..488c77fa3aae 100644
--- a/Documentation/ja_JP/HOWTO
+++ b/Documentation/ja_JP/HOWTO
@@ -11,14 +11,14 @@ for non English (read: Japanese) speakers and is not intended as a
11fork. So if you have any comments or updates for this file, please try 11fork. So if you have any comments or updates for this file, please try
12to update the original English file first. 12to update the original English file first.
13 13
14Last Updated: 2007/09/23 14Last Updated: 2007/11/16
15================================== 15==================================
16ã“ã‚Œã¯ã€ 16ã“ã‚Œã¯ã€
17linux-2.6.23/Documentation/HOWTO 17linux-2.6.24/Documentation/HOWTO
18ã®å’Œè¨³ã§ã™ã€‚ 18ã®å’Œè¨³ã§ã™ã€‚
19 19
20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 20翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
21翻訳日: 2007/09/19 21翻訳日: 2007/11/10
22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com> 22翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com> 23校正者: æ¾å€‰ã•ã‚“ <nbh--mats at nifty dot com>
24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp> 24 å°æž— é›…å…¸ã•ã‚“ (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
@@ -110,7 +110,7 @@ Linux カーãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã¯å¹…広ã„範囲ã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’å
110æ–°ã—ã„ドキュメントファイルも追加ã™ã‚‹ã“ã¨ã‚’勧ã‚ã¾ã™ã€‚ 110æ–°ã—ã„ドキュメントファイルも追加ã™ã‚‹ã“ã¨ã‚’勧ã‚ã¾ã™ã€‚
111カーãƒãƒ«ã®å¤‰æ›´ãŒã€ã‚«ãƒ¼ãƒãƒ«ãŒãƒ¦ãƒ¼ã‚¶ç©ºé–“ã«å…¬é–‹ã—ã¦ã„るインターフェイス㮠111カーãƒãƒ«ã®å¤‰æ›´ãŒã€ã‚«ãƒ¼ãƒãƒ«ãŒãƒ¦ãƒ¼ã‚¶ç©ºé–“ã«å…¬é–‹ã—ã¦ã„るインターフェイスã®
112変更を引ãèµ·ã“ã™å ´åˆã€ãã®å¤‰æ›´ã‚’説明ã™ã‚‹ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ãƒšãƒ¼ã‚¸ã®ãƒ‘ッãƒã‚„情報 112変更を引ãèµ·ã“ã™å ´åˆã€ãã®å¤‰æ›´ã‚’説明ã™ã‚‹ãƒžãƒ‹ãƒ¥ã‚¢ãƒ«ãƒšãƒ¼ã‚¸ã®ãƒ‘ッãƒã‚„情報
113をマニュアルページã®ãƒ¡ãƒ³ãƒ†ãƒŠ mtk-manpages@gmx.net ã«é€ã‚‹ã“ã¨ã‚’勧ã‚ã¾ 113をマニュアルページã®ãƒ¡ãƒ³ãƒ†ãƒŠ mtk.manpages@gmail.com ã«é€ã‚‹ã“ã¨ã‚’勧ã‚ã¾
114ã™ã€‚ 114ã™ã€‚
115 115
116以下ã¯ã‚«ãƒ¼ãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã«å«ã¾ã‚Œã¦ã„る読んã§ãŠãã¹ãファイルã®ä¸€è¦§ã§ 116以下ã¯ã‚«ãƒ¼ãƒãƒ«ã‚½ãƒ¼ã‚¹ãƒ„リーã«å«ã¾ã‚Œã¦ã„る読んã§ãŠãã¹ãファイルã®ä¸€è¦§ã§
diff --git a/Documentation/ko_KR/HOWTO b/Documentation/ko_KR/HOWTO
index b51d7ca842ba..029fca914c05 100644
--- a/Documentation/ko_KR/HOWTO
+++ b/Documentation/ko_KR/HOWTO
@@ -1,6 +1,6 @@
1NOTE: 1NOTE:
2This is a version of Documentation/HOWTO translated into korean 2This is a version of Documentation/HOWTO translated into korean
3This document is maintained by minchan Kim < minchan.kim@gmail.com> 3This document is maintained by minchan Kim <minchan.kim@gmail.com>
4If you find any difference between this document and the original file or 4If you find any difference between this document and the original file or
5a problem with the translation, please contact the maintainer of this file. 5a problem with the translation, please contact the maintainer of this file.
6 6
@@ -14,7 +14,7 @@ try to update the original English file first.
14Documentation/HOWTO 14Documentation/HOWTO
15ì˜ í•œê¸€ 번역입니다. 15ì˜ í•œê¸€ 번역입니다.
16 16
17ì—­ìžï¼š 김민찬 <minchan.kim@gmail.com > 17ì—­ìžï¼š 김민찬 <minchan.kim@gmail.com>
18ê°ìˆ˜ï¼š ì´ì œì´ë¯¸ <jamee.lee@samsung.com> 18ê°ìˆ˜ï¼š ì´ì œì´ë¯¸ <jamee.lee@samsung.com>
19================================== 19==================================
20 20
@@ -23,11 +23,11 @@ Documentation/HOWTO
23 23
24ì´ ë¬¸ì„œëŠ” ì»¤ë„ ê°œë°œì— ìžˆì–´ 가장 중요한 문서ì´ë‹¤. ì´ ë¬¸ì„œëŠ” 24ì´ ë¬¸ì„œëŠ” ì»¤ë„ ê°œë°œì— ìžˆì–´ 가장 중요한 문서ì´ë‹¤. ì´ ë¬¸ì„œëŠ”
25리눅스 ì»¤ë„ ê°œë°œìžê°€ ë˜ëŠ” 법과 리눅스 ì»¤ë„ ê°œë°œ 커뮤니티와 ì¼í•˜ëŠ” 25리눅스 ì»¤ë„ ê°œë°œìžê°€ ë˜ëŠ” 법과 리눅스 ì»¤ë„ ê°œë°œ 커뮤니티와 ì¼í•˜ëŠ”
26ë²•ì„ ë‹´ê³ ìžˆë‹¤. ì»¤ë„ í”„ë¡œê·¸ëž˜ë°ì˜ê¸°ìˆ ì ì¸ 측면과 ê´€ë ¨ëœ ë‚´ìš©ë“¤ì€ 26ë²•ì„ ë‹´ê³ ìžˆë‹¤. ì»¤ë„ í”„ë¡œê·¸ëž˜ë°ì˜ 기술ì ì¸ 측면과 ê´€ë ¨ëœ ë‚´ìš©ë“¤ì€
27í¬í•¨í•˜ì§€ 않으려고 하였지만 올바으로 ì—¬ëŸ¬ë¶„ì„ ì•ˆë‚´í•˜ëŠ” ë° ë„ì›€ì´ 27í¬í•¨í•˜ì§€ 않으려고 하였지만 올바른 길로 ì—¬ëŸ¬ë¶„ì„ ì•ˆë‚´í•˜ëŠ” ë°ëŠ” ë„움ì´
28ë  ê²ƒì´ë‹¤. 28ë  ê²ƒì´ë‹¤.
29 29
30ì´ ë¬¸ì„œì—ì„œ ì˜¤ëž˜ëœ ê²ƒì„ ë°œê²¬í•˜ë©´ ë¬¸ì„œì˜ ì•„ëž˜ìª½ì— ë‚˜ì—´ëœ ë©”ì¸íŠ¸ë„ˆì—게 30ì´ ë¬¸ì„œì—ì„œ ì˜¤ëž˜ëœ ê²ƒì„ ë°œê²¬í•˜ë©´ ë¬¸ì„œì˜ ì•„ëž˜ìª½ì— ë‚˜ì—´ëœ ë©”ì¸í…Œì´ë„ˆì—게
31패치를 보내달ë¼. 31패치를 보내달ë¼.
32 32
33 33
@@ -36,12 +36,12 @@ Documentation/HOWTO
36 36
37ìž, ì—¬ëŸ¬ë¶„ì€ ë¦¬ëˆ…ìŠ¤ ì»¤ë„ ê°œë°œìžê°€ ë˜ëŠ” ë²•ì„ ë°°ìš°ê³  싶ì€ê°€? 아니면 37ìž, ì—¬ëŸ¬ë¶„ì€ ë¦¬ëˆ…ìŠ¤ ì»¤ë„ ê°œë°œìžê°€ ë˜ëŠ” ë²•ì„ ë°°ìš°ê³  싶ì€ê°€? 아니면
38ìƒì‚¬ë¡œë¶€í„°"ì´ ìž¥ì¹˜ë¥¼ 위한 리눅스 ë“œë¼ì´ë²„를 작성하시오"ë¼ëŠ” ë§ì„ 38ìƒì‚¬ë¡œë¶€í„°"ì´ ìž¥ì¹˜ë¥¼ 위한 리눅스 ë“œë¼ì´ë²„를 작성하시오"ë¼ëŠ” ë§ì„
39들었는가? ì´ ë¬¸ì„œëŠ” ì—¬ëŸ¬ë¶„ì´ ê²ªê²Œ ë  ê³¼ì •ê³¼ 커뮤니티와 ì¼í•˜ëŠ” ë²•ì„ 39들었는가? ì´ ë¬¸ì„œì˜ ëª©ì ì€ ì—¬ëŸ¬ë¶„ì´ ê²ªê²Œ ë  ê³¼ì •ê³¼ 커뮤니티와 협력하는
40조언하여 ì—¬ëŸ¬ë¶„ì˜ ëª©ì ì„ 달성하기 위해 필요한 것 모ë‘를 알려주는 40ë²•ì„ ì¡°ì–¸í•˜ì—¬ ì—¬ëŸ¬ë¶„ì˜ ëª©ì ì„ 달성하기 위해 필요한 것 모ë‘를 알려주기
41것ì´ë‹¤. 41위함ì´ë‹¤.
42 42
43커ë„ì€ ëŒ€ë¶€ë¶„ì€ Cë¡œ 작성ë˜ì—ˆì–´ê³  몇몇 아키í…ì³ì˜ ì˜ì¡´ì ì¸ ë¶€ë¶„ì€ 43커ë„ì€ ëŒ€ë¶€ë¶„ì€ Cë¡œ 작성ë˜ì–´ 있고 몇몇 아키í…ì³ì˜ ì˜ì¡´ì ì¸ 부분ì€
44어셈블리로 작성ë˜ìˆë‹¤. ì»¤ë„ ê°œë°œì„ ìœ„í•´ C를 잘 ì´í•´í•˜ê³  있어야 한다. 44어셈블리로 작성ë˜ì–´ 있다. ì»¤ë„ ê°œë°œì„ ìœ„í•´ C를 잘 ì´í•´í•˜ê³  있어야 한다.
45ì—¬ëŸ¬ë¶„ì´ íŠ¹ì • 아키í…ì³ì˜ low-level ê°œë°œì„ í•  ê²ƒì´ ì•„ë‹ˆë¼ë©´ 45ì—¬ëŸ¬ë¶„ì´ íŠ¹ì • 아키í…ì³ì˜ low-level ê°œë°œì„ í•  ê²ƒì´ ì•„ë‹ˆë¼ë©´
46어셈블리(특정 아키í…ì³)는 잘 알아야 í•  필요는 없다. 46어셈블리(특정 아키í…ì³)는 잘 알아야 í•  필요는 없다.
47다ìŒì˜ 참고서ì ë“¤ì€ ê¸°ë³¸ì— ì¶©ì‹¤í•œ C êµìœ¡ì´ë‚˜ ìˆ˜ë…„ê°„ì˜ ê²½í—˜ì— ê²¬ì£¼ì§€ëŠ” 47다ìŒì˜ 참고서ì ë“¤ì€ ê¸°ë³¸ì— ì¶©ì‹¤í•œ C êµìœ¡ì´ë‚˜ ìˆ˜ë…„ê°„ì˜ ê²½í—˜ì— ê²¬ì£¼ì§€ëŠ”
@@ -59,11 +59,11 @@ Documentation/HOWTO
59ì–´ë–¤ ì°¸ê³ ë¬¸ì„œë„ ìžˆì§€ 않다. 정보를 얻기 위해서는 gcc info (`info gcc`)페ì´ì§€ë¥¼ 59ì–´ë–¤ ì°¸ê³ ë¬¸ì„œë„ ìžˆì§€ 않다. 정보를 얻기 위해서는 gcc info (`info gcc`)페ì´ì§€ë¥¼
60살펴보ë¼. 60살펴보ë¼.
61 61
62ì—¬ëŸ¬ë¶„ì€ ê¸°ì¡´ì˜ ê°œë°œ 커뮤니티와 ì¼í•˜ëŠ” ë²•ì„ ë°°ìš°ë ¤ê³  하고 있다는 ê²ƒì„ 62ì—¬ëŸ¬ë¶„ì€ ê¸°ì¡´ì˜ ê°œë°œ 커뮤니티와 협력하는 ë²•ì„ ë°°ìš°ë ¤ê³  하고 있다는 것ì„
63기억하ë¼. 코딩, 스타ì¼, ì ˆì°¨ì— ê´€í•œ 훌륭한 í‘œì¤€ì„ ê°€ì§„ ì‚¬ëžŒë“¤ì´ ëª¨ì¸ 63기억하ë¼. 코딩, 스타ì¼, í•¨ìˆ˜ì— ê´€í•œ 훌륭한 í‘œì¤€ì„ ê°€ì§„ ì‚¬ëžŒë“¤ì´ ëª¨ì¸
64다양한 ê·¸ë£¹ì´ ìžˆë‹¤. ì´ í‘œì¤€ë“¤ì€ ì˜¤ëžœë™ì•ˆ í¬ê³  지역ì ìœ¼ë¡œ ë¶„ì‚°ëœ íŒ€ë“¤ì— 64다양한 ê·¸ë£¹ì´ ìžˆë‹¤. ì´ í‘œì¤€ë“¤ì€ ì˜¤ëžœë™ì•ˆ í¬ê³  지역ì ìœ¼ë¡œ ë¶„ì‚°ëœ íŒ€ë“¤ì—
65ì˜í•´ 가장 ì¢‹ì€ ë°©ë²•ìœ¼ë¡œ ì¼í•˜ê¸°ìœ„하여 ì°¾ì€ ê²ƒì„ ê¸°ì´ˆë¡œ 만들어져왔다. 65ì˜í•´ 가장 ì¢‹ì€ ë°©ë²•ìœ¼ë¡œ ì¼í•˜ê¸° 위하여 ì°¾ì€ ê²ƒì„ ê¸°ì´ˆë¡œ 만들어져 왔다.
66ê·¸ í‘œì¤€ë“¤ì€ ë¬¸ì„œí™”ê°€ 잘 ë˜ì–´ 있기 ë•Œë¬¸ì— ê°€ëŠ¥í•œí•œ 미리 ë§Žì€ í‘œì¤€ë“¤ì— 66ê·¸ í‘œì¤€ë“¤ì€ ë¬¸ì„œí™”ê°€ 잘 ë˜ì–´ìžˆê¸° ë•Œë¬¸ì— ê°€ëŠ¥í•œí•œ 미리 ë§Žì€ í‘œì¤€ë“¤ì—
67관하여 배우려고 ì‹œë„하ë¼. 다른 ì‚¬ëžŒë“¤ì€ ì—¬ëŸ¬ë¶„ì´ë‚˜ ì—¬ëŸ¬ë¶„ì˜ íšŒì‚¬ê°€ 67관하여 배우려고 ì‹œë„하ë¼. 다른 ì‚¬ëžŒë“¤ì€ ì—¬ëŸ¬ë¶„ì´ë‚˜ ì—¬ëŸ¬ë¶„ì˜ íšŒì‚¬ê°€
68ì¼í•˜ëŠ” ë°©ì‹ì— ì ì‘하는 ê²ƒì„ ì›í•˜ì§€ëŠ” 않는다. 68ì¼í•˜ëŠ” ë°©ì‹ì— ì ì‘하는 ê²ƒì„ ì›í•˜ì§€ëŠ” 않는다.
69 69
@@ -73,7 +73,7 @@ Documentation/HOWTO
73 73
74리눅스 ì»¤ë„ ì†ŒìŠ¤ 코드는 GPLë¡œ ë°°í¬(release)ë˜ì—ˆë‹¤. ì†ŒìŠ¤íŠ¸ë¦¬ì˜ ë©”ì¸ 74리눅스 ì»¤ë„ ì†ŒìŠ¤ 코드는 GPLë¡œ ë°°í¬(release)ë˜ì—ˆë‹¤. ì†ŒìŠ¤íŠ¸ë¦¬ì˜ ë©”ì¸
75ë””ë ‰í† ë¦¬ì— ìžˆëŠ” ë¼ì´ì„¼ìŠ¤ì— 관하여 ìƒì„¸í•˜ê²Œ ì“°ì—¬ 있는 COPYINGì´ë¼ëŠ” 75ë””ë ‰í† ë¦¬ì— ìžˆëŠ” ë¼ì´ì„¼ìŠ¤ì— 관하여 ìƒì„¸í•˜ê²Œ ì“°ì—¬ 있는 COPYINGì´ë¼ëŠ”
76파ì¼ì„ ë´ë¼.ì—¬ëŸ¬ë¶„ì´ ë¼ì´ì„¼ìŠ¤ì— 관한 ë” ê¹Šì€ ë¬¸ì œë¥¼ 가지고 있다면 76파ì¼ì„ ë´ë¼. ì—¬ëŸ¬ë¶„ì´ ë¼ì´ì„¼ìŠ¤ì— 관한 ë” ê¹Šì€ ë¬¸ì œë¥¼ 가지고 있다면
77리눅스 ì»¤ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì— ë¬»ì§€ë§ê³  변호사와 ì—°ë½í•˜ë¼. ë©”ì¼ë§ 77리눅스 ì»¤ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì— ë¬»ì§€ë§ê³  변호사와 ì—°ë½í•˜ë¼. ë©”ì¼ë§
78ë¦¬ìŠ¤íŠ¸ë“¤ì— ìžˆëŠ” ì‚¬ëžŒë“¤ì€ ë³€í˜¸ì‚¬ê°€ 아니기 ë•Œë¬¸ì— ë²•ì  ë¬¸ì œì— ê´€í•˜ì—¬ 78ë¦¬ìŠ¤íŠ¸ë“¤ì— ìžˆëŠ” ì‚¬ëžŒë“¤ì€ ë³€í˜¸ì‚¬ê°€ 아니기 ë•Œë¬¸ì— ë²•ì  ë¬¸ì œì— ê´€í•˜ì—¬
79ê·¸ë“¤ì˜ ë§ì— ì˜ì§€í•´ì„œëŠ” 안ëœë‹¤. 79ê·¸ë“¤ì˜ ë§ì— ì˜ì§€í•´ì„œëŠ” 안ëœë‹¤.
@@ -85,12 +85,12 @@ GPLì— ê´€í•œ ìž¦ì€ ì§ˆë¬¸ë“¤ê³¼ ë‹µë³€ë“¤ì€ ë‹¤ìŒì„ 참조하ë¼.
85문서 85문서
86---- 86----
87 87
88리눅스 ì»¤ë„ ì†ŒìŠ¤ 트리는 ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ì™€ ì¼í•˜ëŠ” ë²•ì„ ë°°ìš°ê¸° 위한 ë§Žì€ 88리눅스 ì»¤ë„ ì†ŒìŠ¤ 트리는 ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ì™€ 협력하는 ë²•ì„ ë°°ìš°ê¸°ìœ„í•´ 훌륭한
89귀중한 ë¬¸ì„œë“¤ì„ ê°€ì§€ê³  있다. 새로운 ê¸°ëŠ¥ë“¤ì´ ì»¤ë„ì— ë“¤ì–´ê°€ê²Œ ë  ë•Œ, 89다양한 ë¬¸ì„œë“¤ì„ ê°€ì§€ê³  있다. 새로운 ê¸°ëŠ¥ë“¤ì´ ì»¤ë„ì— ë“¤ì–´ê°€ê²Œ ë  ë•Œ,
90ê·¸ ê¸°ëŠ¥ì„ ì–´ë–»ê²Œ ì‚¬ìš©í•˜ëŠ”ì§€ì— ê´€í•œ ì„¤ëª…ì„ ìœ„í•˜ì—¬ 새로운 문서 파ì¼ì„ 90ê·¸ ê¸°ëŠ¥ì„ ì–´ë–»ê²Œ ì‚¬ìš©í•˜ëŠ”ì§€ì— ê´€í•œ ì„¤ëª…ì„ ìœ„í•˜ì—¬ 새로운 문서 파ì¼ì„
91추가하는 ê²ƒì„ ê¶Œìž¥í•œë‹¤. 커ë„ì´ ìœ ì €ìŠ¤íŽ˜ì´ìŠ¤ë¡œ 노출하는 ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 91추가하는 ê²ƒì„ ê¶Œìž¥í•œë‹¤. 커ë„ì´ ìœ ì €ìŠ¤íŽ˜ì´ìŠ¤ë¡œ 노출하는 ì¸í„°íŽ˜ì´ìŠ¤ë¥¼
92변경하게 ë˜ë©´ ë³€ê²½ì„ ì„¤ëª…í•˜ëŠ” 메뉴얼 페ì´ì§€ë“¤ì— 대한 패치나 정보를 92변경하게 ë˜ë©´ ë³€ê²½ì„ ì„¤ëª…í•˜ëŠ” 메뉴얼 페ì´ì§€ë“¤ì— 대한 패치나 정보를
93mtk-manpages@gmx.netì˜ ë©”ì¸íŠ¸ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤. 93mtk.manpages@gmail.comì˜ ë©”ì¸í…Œì´ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤.
94 94
95다ìŒì€ ì»¤ë„ ì†ŒìŠ¤ íŠ¸ë¦¬ì— ìžˆëŠ” ì½ì–´ì•¼ í•  파ì¼ë“¤ì˜ 리스트ì´ë‹¤. 95다ìŒì€ ì»¤ë„ ì†ŒìŠ¤ íŠ¸ë¦¬ì— ìžˆëŠ” ì½ì–´ì•¼ í•  파ì¼ë“¤ì˜ 리스트ì´ë‹¤.
96 README 96 README
@@ -105,7 +105,7 @@ mtk-manpages@gmx.netì˜ ë©”ì¸íŠ¸ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤.
105 Documentation/CodingStyle 105 Documentation/CodingStyle
106 ì´ ë¬¸ì„œëŠ” 리눅스 ì»¤ë„ ì½”ë”© 스타ì¼ê³¼ 그렇게 í•œ 몇몇 ì´ìœ ë¥¼ 설명한다. 106 ì´ ë¬¸ì„œëŠ” 리눅스 ì»¤ë„ ì½”ë”© 스타ì¼ê³¼ 그렇게 í•œ 몇몇 ì´ìœ ë¥¼ 설명한다.
107 모든 새로운 코드는 ì´ ë¬¸ì„œì— ê°€ì´ë“œë¼ì¸ë“¤ì„ ë”°ë¼ì•¼ 한다. ëŒ€ë¶€ë¶„ì˜ 107 모든 새로운 코드는 ì´ ë¬¸ì„œì— ê°€ì´ë“œë¼ì¸ë“¤ì„ ë”°ë¼ì•¼ 한다. 대부분ì˜
108 ë©”ì¸íŠ¸ë„ˆë“¤ì€ ì´ ê·œì¹™ì„ ë”°ë¥´ëŠ” íŒ¨ì¹˜ë“¤ë§Œì„ ë°›ì•„ë“¤ì¼ ê²ƒì´ê³  ë§Žì€ ì‚¬ëžŒë“¤ì´ 108 ë©”ì¸í…Œì´ë„ˆë“¤ì€ ì´ ê·œì¹™ì„ ë”°ë¥´ëŠ” íŒ¨ì¹˜ë“¤ë§Œì„ ë°›ì•„ë“¤ì¼ ê²ƒì´ê³  ë§Žì€ ì‚¬ëžŒë“¤ì´
109 ê·¸ 패치가 올바른 스타ì¼ì¼ 경우만 코드를 검토할 것ì´ë‹¤. 109 ê·¸ 패치가 올바른 스타ì¼ì¼ 경우만 코드를 검토할 것ì´ë‹¤.
110 110
111 Documentation/SubmittingPatches 111 Documentation/SubmittingPatches
@@ -115,9 +115,10 @@ mtk-manpages@gmx.netì˜ ë©”ì¸íŠ¸ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤.
115 - Email 내용들 115 - Email 내용들
116 - Email ì–‘ì‹ 116 - Email ì–‘ì‹
117 - ê·¸ê²ƒì„ ëˆ„êµ¬ì—게 보낼지 117 - ê·¸ê²ƒì„ ëˆ„êµ¬ì—게 보낼지
118 ì´ëŸ¬í•œ ê·œì¹™ë“¤ì„ ë”°ë¥´ëŠ” ê²ƒì´ ì„±ê³µì„ ë³´ìž¥í•˜ì§„ 않는다(왜ëƒí•˜ë©´ 모든 118 ì´ëŸ¬í•œ ê·œì¹™ë“¤ì„ ë”°ë¥´ëŠ” ê²ƒì´ ì„±ê³µ(ì—­ìžì£¼: 패치가 받아들여 지는 것)ì„
119 íŒ¨ì¹˜ë“¤ì€ ë‚´ìš©ê³¼ 스타ì¼ì— 관하여 면밀히 검토ë˜ê¸° 때문ì´ë‹¤). 119 보장하진 않는다(왜ëƒí•˜ë©´ 모든 íŒ¨ì¹˜ë“¤ì€ ë‚´ìš©ê³¼ 스타ì¼ì— 관하여
120 그러나 ê·œì¹™ì„ ë”°ë¥´ì§€ 않는다면 ê±°ì˜ ì„±ê³µí•˜ì§€ë„ ëª»í•  것ì´ë‹¤. 120 면밀히 검토ë˜ê¸° 때문ì´ë‹¤). 그러나 ê·œì¹™ì„ ë”°ë¥´ì§€ 않는다면 ê±°ì˜
121 ì„±ê³µí•˜ì§€ë„ ëª»í•  것ì´ë‹¤.
121 122
122 올바른 íŒ¨ì¹˜ë“¤ì„ ë§Œë“œëŠ” ë²•ì— ê´€í•œ 훌륭한 다른 ë¬¸ì„œë“¤ì´ ìžˆë‹¤. 123 올바른 íŒ¨ì¹˜ë“¤ì„ ë§Œë“œëŠ” ë²•ì— ê´€í•œ 훌륭한 다른 ë¬¸ì„œë“¤ì´ ìžˆë‹¤.
123 "The Perfect Patch" 124 "The Perfect Patch"
@@ -126,13 +127,13 @@ mtk-manpages@gmx.netì˜ ë©”ì¸íŠ¸ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤.
126 http://linux.yyz.us/patch-format.html 127 http://linux.yyz.us/patch-format.html
127 128
128 Documentation/stable_api_nonsense.txt 129 Documentation/stable_api_nonsense.txt
129 ì´ ë¬¸ì„œëŠ” ì˜ë„ì ìœ¼ë¡œ 커ë„ì´ ë³€í•˜ì§€ 않는 API를 갖지 ì•Šë„ë¡ ê²°ì •í•œ 130 ì´ ë¬¸ì„œëŠ” ì˜ë„ì ìœ¼ë¡œ 커ë„ì´ ë¶ˆë³€í•˜ëŠ” API를 갖지 ì•Šë„ë¡ ê²°ì •í•œ
130 ì´ìœ ë¥¼ 설명하며 다ìŒê³¼ ê°™ì€ ê²ƒë“¤ì„ í¬í•¨í•œë‹¤. 131 ì´ìœ ë¥¼ 설명하며 다ìŒê³¼ ê°™ì€ ê²ƒë“¤ì„ í¬í•¨í•œë‹¤.
131 - 서브시스템 shim-layer(í˜¸í™˜ì„±ì„ ìœ„í•´?) 132 - 서브시스템 shim-layer(í˜¸í™˜ì„±ì„ ìœ„í•´?)
132 - ìš´ì˜ ì²´ì œë“¤ ê°„ì˜ ë“œë¼ì´ë²„ ì´ì‹ì„± 133 - ìš´ì˜ì²´ì œë“¤ê°„ì˜ ë“œë¼ì´ë²„ ì´ì‹ì„±
133 - ì»¤ë„ ì†ŒìŠ¤ íŠ¸ë¦¬ë‚´ì— ë¹ ë¥¸ 변화를 늦추는 것(ë˜ëŠ” 빠른 변화를 막는 것) 134 - ì»¤ë„ ì†ŒìŠ¤ íŠ¸ë¦¬ë‚´ì— ë¹ ë¥¸ 변화를 늦추는 것(ë˜ëŠ” 빠른 변화를 막는 것)
134 ì´ ë¬¸ì„œëŠ” 리눅스 개발 ì² í•™ì„ ì´í•´í•˜ëŠ”ë° í•„ìˆ˜ì ì´ë©° 다른 ìš´ì˜ì²´ì œì—ì„œ 135 ì´ ë¬¸ì„œëŠ” 리눅스 개발 ì² í•™ì„ ì´í•´í•˜ëŠ”ë° í•„ìˆ˜ì ì´ë©° 다른 ìš´ì˜ì²´ì œì—ì„œ
135 리눅스로 옮겨오는 사람들ì—게는 매우 중요하다. 136 리눅스로 전향하는 사람들ì—게는 매우 중요하다.
136 137
137 138
138 Documentation/SecurityBugs 139 Documentation/SecurityBugs
@@ -141,10 +142,10 @@ mtk-manpages@gmx.netì˜ ë©”ì¸íŠ¸ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤.
141 ë„와 달ë¼. 142 ë„와 달ë¼.
142 143
143 Documentation/ManagementStyle 144 Documentation/ManagementStyle
144 ì´ ë¬¸ì„œëŠ” 리눅스 ì»¤ë„ ë©”ì¸íŠ¸ë„ˆë“¤ì´ 어떻게 ê·¸ë“¤ì˜ ë°©ë²•ë¡ ì˜ ì ì‹ ì 145 ì´ ë¬¸ì„œëŠ” 리눅스 ì»¤ë„ ë©”ì¸í…Œì´ë„ˆë“¤ì´ ê·¸ë“¤ì˜ ë°©ë²•ë¡ ì 녹아 있는
145 어떻게 공유하고 ìš´ì˜í•˜ëŠ”지를 설명한다. ì´ê²ƒì€ ì»¤ë„ ê°œë°œì— ìž…ë¬¸í•˜ëŠ” 146 ì •ì‹ ì„ ì–´ë–»ê²Œ 공유하고 ìš´ì˜í•˜ëŠ”지를 설명한다. ì´ê²ƒì€ ì»¤ë„ ê°œë°œì— ìž…ë¬¸í•˜ëŠ”
146 모든 사람들(ë˜ëŠ” ì»¤ë„ ê°œë°œì— ìž‘ì€ í˜¸ê¸°ì‹¬ì´ë¼ë„ 있는 사람들)ì´ 147 모든 사람들(ë˜ëŠ” ì»¤ë„ ê°œë°œì— ìž‘ì€ í˜¸ê¸°ì‹¬ì´ë¼ë„ 있는 사람들)ì´
147 ì½ì–´ì•¼ í•  중요한 문서ì´ë‹¤. 왜ëƒí•˜ë©´ ì´ ë¬¸ì„œëŠ” ì»¤ë„ ë©”ì¸íŠ¸ë„ˆë“¤ì˜ 148 ì½ì–´ì•¼ í•  중요한 문서ì´ë‹¤. 왜ëƒí•˜ë©´ ì´ ë¬¸ì„œëŠ” ì»¤ë„ ë©”ì¸í…Œì´ë„ˆë“¤ì˜
148 ë…특한 í–‰ë™ì— 관하여 í”히 있는 오해들과 í˜¼ëž€ë“¤ì„ í•´ì†Œí•˜ê³  있기 149 ë…특한 í–‰ë™ì— 관하여 í”히 있는 오해들과 í˜¼ëž€ë“¤ì„ í•´ì†Œí•˜ê³  있기
149 때문ì´ë‹¤. 150 때문ì´ë‹¤.
150 151
@@ -160,7 +161,7 @@ mtk-manpages@gmx.netì˜ ë©”ì¸íŠ¸ë„ˆì—게 보낼 ê²ƒì„ ê¶Œìž¥í•œë‹¤.
160 161
161 Documentation/applying-patches.txt 162 Documentation/applying-patches.txt
162 패치가 무엇ì´ë©° ê·¸ê²ƒì„ ì»¤ë„ì˜ ë‹¤ë¥¸ 개발 ë¸Œëžœì¹˜ë“¤ì— ì–´ë–»ê²Œ 163 패치가 무엇ì´ë©° ê·¸ê²ƒì„ ì»¤ë„ì˜ ë‹¤ë¥¸ 개발 ë¸Œëžœì¹˜ë“¤ì— ì–´ë–»ê²Œ
163 ì ìš©í•˜ëŠ”ì§€ì— ê´€í•˜ì—¬ ìžì„¸ížˆ 설명 하고 있는 ì¢‹ì€ ìž…ë¬¸ì„œì´ë‹¤. 164 ì ìš©í•˜ëŠ”ì§€ì— ê´€í•˜ì—¬ ìžì„¸ížˆ 설명하고 있는 ì¢‹ì€ ìž…ë¬¸ì„œì´ë‹¤.
164 165
165커ë„ì€ ì†ŒìŠ¤ 코드 ê·¸ ìžì²´ì—ì„œ ìžë™ì ìœ¼ë¡œ 만들어질 수 있는 ë§Žì€ ë¬¸ì„œë“¤ì„ 166커ë„ì€ ì†ŒìŠ¤ 코드 ê·¸ ìžì²´ì—ì„œ ìžë™ì ìœ¼ë¡œ 만들어질 수 있는 ë§Žì€ ë¬¸ì„œë“¤ì„
166가지고 있다. ì´ê²ƒì€ ì»¤ë„ ë‚´ì˜ APIì— ëŒ€í•œ 모든 설명, 그리고 ë½í‚¹ì„ 167가지고 있다. ì´ê²ƒì€ ì»¤ë„ ë‚´ì˜ APIì— ëŒ€í•œ 모든 설명, 그리고 ë½í‚¹ì„
@@ -192,7 +193,7 @@ Documentation/DocBook/ 디렉토리 ë‚´ì—ì„œ 만들어지며 PDF, Postscript, H
192ì—¬ëŸ¬ë¶„ì´ ì–´ë””ì„œ 시작해야 할진 모르지만 ì»¤ë„ ê°œë°œ ì»¤ë®¤ë‹ˆí‹°ì— ì°¸ì—¬í•  수 193ì—¬ëŸ¬ë¶„ì´ ì–´ë””ì„œ 시작해야 할진 모르지만 ì»¤ë„ ê°œë°œ ì»¤ë®¤ë‹ˆí‹°ì— ì°¸ì—¬í•  수
193있는 ì¼ë“¤ì„ 찾길 ì›í•œë‹¤ë©´ 리눅스 ì»¤ë„ Janitor 프로ì íŠ¸ë¥¼ 살펴ë´ë¼. 194있는 ì¼ë“¤ì„ 찾길 ì›í•œë‹¤ë©´ 리눅스 ì»¤ë„ Janitor 프로ì íŠ¸ë¥¼ 살펴ë´ë¼.
194 http://janitor.kernelnewbies.org/ 195 http://janitor.kernelnewbies.org/
195ê·¸ê³³ì€ ì‹œìž‘í•˜ê¸°ì— ì•„ì£¼ ë”± ì¢‹ì€ ê³³ì´ë‹¤. ê·¸ê³³ì€ ë¦¬ëˆ…ìŠ¤ ì»¤ë„ ì†ŒìŠ¤ íŠ¸ë¦¬ë‚´ì— 196ê·¸ê³³ì€ ì‹œìž‘í•˜ê¸°ì— í›Œë¥­í•œ 장소ì´ë‹¤. ê·¸ê³³ì€ ë¦¬ëˆ…ìŠ¤ ì»¤ë„ ì†ŒìŠ¤ 트리내ì—
196간단히 정리ë˜ê³  ìˆ˜ì •ë  ìˆ˜ 있는 ë¬¸ì œë“¤ì— ê´€í•˜ì—¬ 설명한다. ì—¬ëŸ¬ë¶„ì€ ì´ 197간단히 정리ë˜ê³  ìˆ˜ì •ë  ìˆ˜ 있는 ë¬¸ì œë“¤ì— ê´€í•˜ì—¬ 설명한다. ì—¬ëŸ¬ë¶„ì€ ì´
197프로ì íŠ¸ë¥¼ 대표하는 개발ìžë“¤ê³¼ ì¼í•˜ë©´ì„œ ìžì‹ ì˜ 패치를 리눅스 ì»¤ë„ íŠ¸ë¦¬ì— 198프로ì íŠ¸ë¥¼ 대표하는 개발ìžë“¤ê³¼ ì¼í•˜ë©´ì„œ ìžì‹ ì˜ 패치를 리눅스 ì»¤ë„ íŠ¸ë¦¬ì—
198ë°˜ì˜í•˜ê¸° 위한 기본ì ì¸ ê²ƒë“¤ì„ ë°°ìš°ê²Œ ë ê²ƒì´ë©° ì—¬ëŸ¬ë¶„ì´ ì•„ì§ ì•„ì´ë””어를 199ë°˜ì˜í•˜ê¸° 위한 기본ì ì¸ ê²ƒë“¤ì„ ë°°ìš°ê²Œ ë ê²ƒì´ë©° ì—¬ëŸ¬ë¶„ì´ ì•„ì§ ì•„ì´ë””어를
@@ -212,7 +213,7 @@ Documentation/DocBook/ 디렉토리 ë‚´ì—ì„œ 만들어지며 PDF, Postscript, H
212ê²ƒì€ Linux Cross-Reference projectì´ë©° ê·¸ê²ƒì€ ìžê¸° 참조 ë°©ì‹ì´ë©° 213ê²ƒì€ Linux Cross-Reference projectì´ë©° ê·¸ê²ƒì€ ìžê¸° 참조 ë°©ì‹ì´ë©°
213소스코드를 ì¸ë±ìŠ¤ëœ 웹 페ì´ì§€ë“¤ì˜ 형태로 보여준다. ìµœì‹ ì˜ ë©‹ì§„ ì»¤ë„ 214소스코드를 ì¸ë±ìŠ¤ëœ 웹 페ì´ì§€ë“¤ì˜ 형태로 보여준다. ìµœì‹ ì˜ ë©‹ì§„ 커ë„
214코드 저장소는 다ìŒì„ 통하여 참조할 수 있다. 215코드 저장소는 다ìŒì„ 통하여 참조할 수 있다.
215 http://sosdg.org/~coywolf/lxr/ 216 http://users.sosdg.org/~qiyong/lxr/
216 217
217 218
218개발 프로세스 219개발 프로세스
@@ -233,44 +234,45 @@ Documentation/DocBook/ 디렉토리 ë‚´ì—ì„œ 만들어지며 PDF, Postscript, H
2332.6.x 커ë„ë“¤ì€ Linux Torvaldsê°€ 관리하며 kernel.orgì˜ pub/linux/kernel/v2.6/ 2342.6.x 커ë„ë“¤ì€ Linux Torvaldsê°€ 관리하며 kernel.orgì˜ pub/linux/kernel/v2.6/
234디렉토리ì—ì„œ ì°¸ì¡°ë  ìˆ˜ 있다.개발 프로세스는 다ìŒê³¼ 같다. 235디렉토리ì—ì„œ ì°¸ì¡°ë  ìˆ˜ 있다.개발 프로세스는 다ìŒê³¼ 같다.
235 - 새로운 커ë„ì´ ë°°í¬ë˜ìžë§ˆìž 2ì£¼ì˜ ì‹œê°„ì´ ì£¼ì–´ì§„ë‹¤. ì´ ê¸°ê°„ë™ì€ 236 - 새로운 커ë„ì´ ë°°í¬ë˜ìžë§ˆìž 2ì£¼ì˜ ì‹œê°„ì´ ì£¼ì–´ì§„ë‹¤. ì´ ê¸°ê°„ë™ì€
236 ë©”ì¸íŠ¸ë„ˆë“¤ì€ í° diffë“¤ì„ Linusì—게 제출할 수 있다. 대개 ì´ íŒ¨ì¹˜ë“¤ì€ 237 ë©”ì¸í…Œì´ë„ˆë“¤ì€ í° diffë“¤ì„ Linusì—게 제출할 수 있다. 대개 ì´ íŒ¨ì¹˜ë“¤ì€
237 몇 주 ë™ì•ˆ -mm 커ë„ë‚´ì— ì´ë¯¸ ìžˆì—ˆë˜ ê²ƒë“¤ì´ë‹¤. í° ë³€ê²½ë“¤ì„ ì œì¶œí•˜ëŠ” ë° 238 몇 주 ë™ì•ˆ -mm 커ë„ë‚´ì— ì´ë¯¸ ìžˆì—ˆë˜ ê²ƒë“¤ì´ë‹¤. í° ë³€ê²½ë“¤ì„ ì œì¶œí•˜ëŠ” ë°
238 선호ë˜ëŠ” ë°©ë²•ì€ git(커ë„ì˜ ì†ŒìŠ¤ 관리 툴, ë” ë§Žì€ ì •ë³´ë“¤ì€ http://git.or.cz/ 239 선호ë˜ëŠ” ë°©ë²•ì€ git(커ë„ì˜ ì†ŒìŠ¤ 관리 툴, ë” ë§Žì€ ì •ë³´ë“¤ì€ http://git.or.cz/
239 ì—ì„œ 참조할 수 있다)를 사용하는 것ì´ì§€ë§Œ 순수한 패치파ì¼ì˜ 형ì‹ìœ¼ë¡œ ë³´ë‚´ë 240 ì—ì„œ 참조할 수 있다)를 사용하는 것ì´ì§€ë§Œ 순수한 패치파ì¼ì˜ 형ì‹ìœ¼ë¡œ 보내는
240 ê²ƒë„ ë¬´ê´€í•˜ë‹¤. 241 ê²ƒë„ ë¬´ê´€í•˜ë‹¤.
241 - 2주 í›„ì— -rc1 커ë„ì´ ë°°í¬ë˜ë©° 지금부터는 ì „ì²´ 커ë„ì˜ ì•ˆì •ì„±ì— ì˜í–¥ì„ 242 - 2주 í›„ì— -rc1 커ë„ì´ ë°°í¬ë˜ë©° 지금부터는 ì „ì²´ 커ë„ì˜ ì•ˆì •ì„±ì— ì˜í–¥ì„
242 미칠수 있는 새로운 ê¸°ëŠ¥ë“¤ì„ í¬í•¨í•˜ì§€ 않는 패치들만ì ì¶”ê°€ë  ìˆ˜ 있다. 243 미칠수 있는 새로운 ê¸°ëŠ¥ë“¤ì„ í¬í•¨í•˜ì§€ 않는 íŒ¨ì¹˜ë“¤ë§Œì´ ì¶”ê°€ë  ìˆ˜ 있다.
243 완전히 새로운 ë“œë¼ì´ë²„(í˜¹ì€ íŒŒì¼ì‹œìŠ¤í…œ)는 -rc1 ì´í›„ì—만 받아들여진다는 244 완전히 새로운 ë“œë¼ì´ë²„(í˜¹ì€ íŒŒì¼ì‹œìŠ¤í…œ)는 -rc1 ì´í›„ì—만 받아들여진다는
244 ê²ƒì„ ê¸°ì–µí•´ë¼. 왜ëƒí•˜ë©´ ë³€ê²½ì´ ìžì²´ë‚´ì—서만 ë°œìƒí•˜ê³  ì¶”ê°€ëœ ì½”ë“œê°€ 245 ê²ƒì„ ê¸°ì–µí•´ë¼. 왜ëƒí•˜ë©´ ë³€ê²½ì´ ìžì²´ë‚´ì—서만 ë°œìƒí•˜ê³  ì¶”ê°€ëœ ì½”ë“œê°€
245 ë“œë¼ì´ë²„ ì™¸ë¶€ì˜ ë‹¤ë¥¸ 부분ì—는 ì˜í–¥ì„ 주지 않으므로 그런 ë³€ê²½ì€ 246 ë“œë¼ì´ë²„ ì™¸ë¶€ì˜ ë‹¤ë¥¸ 부분ì—는 ì˜í–¥ì„ 주지 않으므로 그런 변경ì€
246 퇴보(regression)를 ì¼ìœ¼í‚¬ 만한 ìœ„í—˜ì„ ê°€ì§€ê³  있지 않기 때문ì´ë‹¤. -rc1ì´ 247 회귀(ì—­ìžì£¼: ì´ì „ì—는 존재하지 않았지만 새로운 기능추가나 변경으로 ì¸í•´
248 ìƒê²¨ë‚œ 버그)를 ì¼ìœ¼í‚¬ 만한 ìœ„í—˜ì„ ê°€ì§€ê³  있지 않기 때문ì´ë‹¤. -rc1ì´
247 ë°°í¬ëœ ì´í›„ì— git를 사용하여 íŒ¨ì¹˜ë“¤ì„ Linusì—게 보낼수 있지만 íŒ¨ì¹˜ë“¤ì€ 249 ë°°í¬ëœ ì´í›„ì— git를 사용하여 íŒ¨ì¹˜ë“¤ì„ Linusì—게 보낼수 있지만 패치들ì€
248 ê³µì‹ì ì¸ ë©”ì¼ë§ 리스트로 ë³´ë‚´ì„œ 검토를 ë°›ì„ í•„ìš”ê°€ 있다. 250 ê³µì‹ì ì¸ ë©”ì¼ë§ 리스트로 ë³´ë‚´ì„œ 검토를 ë°›ì„ í•„ìš”ê°€ 있다.
249 - 새로운 -rc는 Linus는 현재 git treeê°€ 테스트 í•˜ê¸°ì— ì¶©ë¶„ížˆ ì•ˆì •ëœ ìƒíƒœì— 251 - 새로운 -rc는 Linusê°€ 현재 git treeê°€ 테스트 í•˜ê¸°ì— ì¶©ë¶„ížˆ ì•ˆì •ëœ ìƒíƒœì—
250 있다고 íŒë‹¨ë  때마다 ë°°í¬ëœë‹¤. 목표는 새로운 -rc 커ë„ì„ ë§¤ì£¼ ë°°í¬í•˜ëŠ” 252 있다고 íŒë‹¨ë  때마다 ë°°í¬ëœë‹¤. 목표는 새로운 -rc 커ë„ì„ ë§¤ì£¼ ë°°í¬í•˜ëŠ”
251 것ì´ë‹¤. 253 것ì´ë‹¤.
252 - ì´ëŸ¬í•œ 프로세스는 커ë„ì´ "준비"ë˜ì—ˆë‹¤ê³  여겨질때까지 계ì†ëœë‹¤. 254 - ì´ëŸ¬í•œ 프로세스는 커ë„ì´ "준비(ready)"ë˜ì—ˆë‹¤ê³  여겨질때까지 계ì†ëœë‹¤.
253 프로세스는 대체로 6주간 지ì†ëœë‹¤. 255 프로세스는 대체로 6주간 지ì†ëœë‹¤.
254 - ê° -rc ë°°í¬ì— 있는 알려진 í‡´ë³´ì˜ ëª©ë¡ë“¤ì€ ë‹¤ìŒ URIì— ë‚¨ê²¨ì§„ë‹¤. 256 - ê° -rc ë°°í¬ì— 있는 알려진 íšŒê·€ì˜ ëª©ë¡ë“¤ì€ ë‹¤ìŒ URIì— ë‚¨ê²¨ì§„ë‹¤.
255 http://kernelnewbies.org/known_regressions 257 http://kernelnewbies.org/known_regressions
256 258
257ì»¤ë„ ë°°í¬ì— 있어서 언급할만한 가치가 있는 리눅스 ì»¤ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ 259ì»¤ë„ ë°°í¬ì— 있어서 언급할만한 가치가 있는 리눅스 ì»¤ë„ ë©”ì¼ë§ 리스트ì˜
258Andrew Mortonì˜ ê¸€ì´ ìžˆë‹¤. 260Andrew Mortonì˜ ê¸€ì´ ìžˆë‹¤.
259 "커ë„ì´ ì–¸ì œ ë°°í¬ë ì§€ëŠ” 아무로 모른다. 왜ëƒí•˜ë©´ ë°°í¬ëŠ” 알려진 261 "커ë„ì´ ì–¸ì œ ë°°í¬ë ì§€ëŠ” 아무ë 모른다. 왜ëƒí•˜ë©´ ë°°í¬ëŠ” 알려진
260 ë²„ê·¸ì˜ ìƒí™©ì— ë”°ë¼ ë°°í¬ë˜ëŠ” 것ì´ì§€ 미리정해 ë†“ì€ ì‹œê°„ì— ë”°ë¼ 262 ë²„ê·¸ì˜ ìƒí™©ì— ë”°ë¼ ë°°í¬ë˜ëŠ” 것ì´ì§€ 미리정해 ë†“ì€ ì‹œê°„ì— ë”°ë¼
261 ë°°í¬ë˜ëŠ” ê²ƒì€ ì•„ë‹ˆê¸° 때문ì´ë‹¤." 263 ë°°í¬ë˜ëŠ” ê²ƒì€ ì•„ë‹ˆê¸° 때문ì´ë‹¤."
262 264
2632.6.x.y - 안정 ì»¤ë„ íŠ¸ë¦¬ 2652.6.x.y - 안정 ì»¤ë„ íŠ¸ë¦¬
264------------------------ 266------------------------
265 267
2664 ìžë¦¬ 숫ìžë¡œ ì´ë£¨ì–´ì§„ ë²„ì ¼ì˜ ì»¤ë„ë“¤ì€ -stable 커ë„들ì´ë‹¤. ê·¸ê²ƒë“¤ì€ 2.6.x 2684 ìžë¦¬ 숫ìžë¡œ ì´ë£¨ì–´ì§„ ë²„ì ¼ì˜ ì»¤ë„ë“¤ì€ -stable 커ë„들ì´ë‹¤. ê·¸ê²ƒë“¤ì€ 2.6.x
267커ë„ì—ì„œ ë°œê²¬ëœ í° í‡´ë³´ë“¤ì´ë‚˜ 보안 문제들 중 비êµì  ìž‘ê³  중요한 ìˆ˜ì •ë“¤ì„ 269커ë„ì—ì„œ ë°œê²¬ëœ í° íšŒê·€ë“¤ì´ë‚˜ 보안 문제들 중 비êµì  ìž‘ê³  중요한 수정들ì„
268í¬í•¨í•œë‹¤. 270í¬í•¨í•œë‹¤.
269 271
270ì´ê²ƒì€ 가장 ìµœê·¼ì˜ ì•ˆì •ì ì¸ 커ë„ì„ ì›í•˜ëŠ” 사용ìžì—게 추천ë˜ëŠ” 브랜치ì´ë©°, 272ì´ê²ƒì€ 가장 ìµœê·¼ì˜ ì•ˆì •ì ì¸ 커ë„ì„ ì›í•˜ëŠ” 사용ìžì—게 추천ë˜ëŠ” 브랜치ì´ë©°,
271개발/ì‹¤í—˜ì  ë²„ì ¼ì„ í…ŒìŠ¤íŠ¸í•˜ëŠ” ê²ƒì„ ë•ëŠ”ë°ëŠ” 별로 ê´€ì‹¬ì´ ì—†ë‹¤. 273개발/ì‹¤í—˜ì  ë²„ì ¼ì„ í…ŒìŠ¤íŠ¸í•˜ëŠ” ê²ƒì„ ë•ê³ ìž 하는 사용ìžë“¤ê³¼ëŠ” 별로 ê´€ë ¨ì´ ì—†ë‹¤.
272 274
273ì–´ë–¤ 2.6.x.y 커ë„ë„ ì‚¬ìš©ê°€ëŠ¥í•˜ì§€ 않다면 그때는 가장 ë†’ì€ ìˆ«ìžì˜ 2.6.x 275ì–´ë–¤ 2.6.x.y 커ë„ë„ ì‚¬ìš©í•  수 없다면 그때는 가장 ë†’ì€ ìˆ«ìžì˜ 2.6.x
274커ë„ì´ í˜„ìž¬ì˜ ì•ˆì • 커ë„ì´ë‹¤. 276커ë„ì´ í˜„ìž¬ì˜ ì•ˆì • 커ë„ì´ë‹¤.
275 277
2762.6.x.y는 "stable" 팀<stable@kernel.org>ì— ì˜í•´ 관리ë˜ë©° ê±°ì˜ ë§¤ë²ˆ 격주로 2782.6.x.y는 "stable" 팀<stable@kernel.org>ì— ì˜í•´ 관리ë˜ë©° ê±°ì˜ ë§¤ë²ˆ 격주로
@@ -294,7 +296,7 @@ Andrew Mortonì— ì˜í•´ ë°°í¬ëœ 실험ì ì¸ ì»¤ë„ íŒ¨ì¹˜ë“¤ì´ë‹¤. Andrew는
294서브시스템 ì»¤ë„ íŠ¸ë¦¬ì™€ íŒ¨ì¹˜ë“¤ì„ ê°€ì ¸ì™€ì„œ 리눅스 ì»¤ë„ ë©”ì¼ë§ 리스트로 296서브시스템 ì»¤ë„ íŠ¸ë¦¬ì™€ íŒ¨ì¹˜ë“¤ì„ ê°€ì ¸ì™€ì„œ 리눅스 ì»¤ë„ ë©”ì¼ë§ 리스트로
295온 ë§Žì€ íŒ¨ì¹˜ë“¤ê³¼ í•œë° ë¬¶ëŠ”ë‹¤. ì´ íŠ¸ë¦¬ëŠ” 새로운 기능들과 íŒ¨ì¹˜ë“¤ì„ ìœ„í•œ 297온 ë§Žì€ íŒ¨ì¹˜ë“¤ê³¼ í•œë° ë¬¶ëŠ”ë‹¤. ì´ íŠ¸ë¦¬ëŠ” 새로운 기능들과 íŒ¨ì¹˜ë“¤ì„ ìœ„í•œ
296장소를 제공하는 ì—­í• ì„ í•œë‹¤. í•˜ë‚˜ì˜ íŒ¨ì¹˜ê°€ -mmì— í•œë™ì•ˆ 있으면서 ê·¸ 가치가 298장소를 제공하는 ì—­í• ì„ í•œë‹¤. í•˜ë‚˜ì˜ íŒ¨ì¹˜ê°€ -mmì— í•œë™ì•ˆ 있으면서 ê·¸ 가치가
297ì¦ëª…ë˜ê²Œ ë˜ë©´ Andrew나 서브시스템 ë©”ì¸íŠ¸ë„ˆëŠ” ê·¸ê²ƒì„ ë©”ì¸ë¼ì¸ì— í¬í•¨ì‹œí‚¤ê¸° 299ì¦ëª…ë˜ê²Œ ë˜ë©´ Andrew나 서브시스템 ë©”ì¸í…Œì´ë„ˆëŠ” ê·¸ê²ƒì„ ë©”ì¸ë¼ì¸ì— í¬í•¨ì‹œí‚¤ê¸°
298위하여 Linusì—게 보낸다. 300위하여 Linusì—게 보낸다.
299 301
300ì»¤ë„ íŠ¸ë¦¬ì— í¬í•¨í•˜ê³  ì‹¶ì€ ëª¨ë“  새로운 íŒ¨ì¹˜ë“¤ì€ Linusì—게 보내지기 ì „ì— 302ì»¤ë„ íŠ¸ë¦¬ì— í¬í•¨í•˜ê³  ì‹¶ì€ ëª¨ë“  새로운 íŒ¨ì¹˜ë“¤ì€ Linusì—게 보내지기 ì „ì—
@@ -327,7 +329,7 @@ Andrew Mortonì— ì˜í•´ ë°°í¬ëœ 실험ì ì¸ ì»¤ë„ íŒ¨ì¹˜ë“¤ì´ë‹¤. Andrew는
327 - ACPI development tree, Len Brown <len.brown@intel.com > 329 - ACPI development tree, Len Brown <len.brown@intel.com >
328 git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git 330 git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
329 331
330 - Block development tree, Jens Axboe <axboe@suse.de> 332 - Block development tree, Jens Axboe <jens.axboe@oracle.com>
331 git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git 333 git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
332 334
333 - DRM development tree, Dave Airlie <airlied@linux.ie> 335 - DRM development tree, Dave Airlie <airlied@linux.ie>
@@ -367,8 +369,8 @@ bugzilla.kernel.org는 리눅스 ì»¤ë„ ê°œë°œìžë“¤ì´ 커ë„ì˜ ë²„ê·¸ë¥¼ 추ì
367kernel bugzilla를 사용하는 ìžì„¸í•œ ë°©ë²•ì€ ë‹¤ìŒì„ 참조하ë¼. 369kernel bugzilla를 사용하는 ìžì„¸í•œ ë°©ë²•ì€ ë‹¤ìŒì„ 참조하ë¼.
368 http://test.kernel.org/bugzilla/faq.html 370 http://test.kernel.org/bugzilla/faq.html
369 371
370ë©”ì¸ ì»¤ë„ ì†ŒìŠ¤ ë””ë ‰í† ë¦¬ì— ìžˆëŠ” REPORTING-BUGS 파ì¼ì€ ì»¤ë„ ë²„ê·¸ì¼ ê²ƒ ê°™ì 372ë©”ì¸ ì»¤ë„ ì†ŒìŠ¤ ë””ë ‰í† ë¦¬ì— ìžˆëŠ” REPORTING-BUGS 파ì¼ì€ ì»¤ë„ ë²„ê·¸ë¼ê³  ìƒê°ë˜ëŠ”
371ê²ƒì„ ë³´ê³ í•˜ëŠ”ëŠ” ë²•ì— ê´€í•œ ì¢‹ì€ í…œí”Œë¦¿ì´ê³  문제를 추ì í•˜ê¸° 위해서 ì»¤ë„ 373ê²ƒì„ ë³´ê³ í•˜ëŠ” ë°©ë²•ì— ê´€í•œ ì¢‹ì€ í…œí”Œë¦¿ì´ë©° 문제를 추ì í•˜ê¸° 위해서 커ë„
372개발ìžë“¤ì´ 필요로 하는 ì •ë³´ê°€ 무엇들ì¸ì§€ë¥¼ ìƒì„¸ížˆ 설명하고 있다. 374개발ìžë“¤ì´ 필요로 하는 ì •ë³´ê°€ 무엇들ì¸ì§€ë¥¼ ìƒì„¸ížˆ 설명하고 있다.
373 375
374 376
@@ -383,7 +385,7 @@ kernel bugzilla를 사용하는 ìžì„¸í•œ ë°©ë²•ì€ ë‹¤ìŒì„ 참조하ë¼.
383ì ìˆ˜ë¥¼ ì–»ì„ ìˆ˜ 있는 가장 ì¢‹ì€ ë°©ë²•ì¤‘ì˜ í•˜ë‚˜ì´ë‹¤. 왜ëƒí•˜ë©´ ë§Žì€ ì‚¬ëžŒë“¤ì€ 385ì ìˆ˜ë¥¼ ì–»ì„ ìˆ˜ 있는 가장 ì¢‹ì€ ë°©ë²•ì¤‘ì˜ í•˜ë‚˜ì´ë‹¤. 왜ëƒí•˜ë©´ ë§Žì€ ì‚¬ëžŒë“¤ì€
384다른 ì‚¬ëžŒë“¤ì˜ ë²„ê·¸ë“¤ì„ ìˆ˜ì •í•˜ê¸° 위하여 ì‹œê°„ì„ ë‚­ë¹„í•˜ì§€ 않기 때문ì´ë‹¤. 386다른 ì‚¬ëžŒë“¤ì˜ ë²„ê·¸ë“¤ì„ ìˆ˜ì •í•˜ê¸° 위하여 ì‹œê°„ì„ ë‚­ë¹„í•˜ì§€ 않기 때문ì´ë‹¤.
385 387
386ì´ë¯¸ ë³´ê³ ëœ ë²„ê·¸ 리í¬íŠ¸ë“¤ì„ 가지고 작업하기 위해서 http://bugzilla.kernelorg를 388ì´ë¯¸ ë³´ê³ ëœ ë²„ê·¸ 리í¬íŠ¸ë“¤ì„ 가지고 작업하기 위해서 http://bugzilla.kernel.org를
387참조하ë¼. ì—¬ëŸ¬ë¶„ì´ ì•žìœ¼ë¡œ ìƒê²¨ë‚  버그 리í¬íŠ¸ë“¤ì˜ ì¡°ì–¸ìžê°€ ë˜ê¸¸ ì›í•œë‹¤ë©´ 389참조하ë¼. ì—¬ëŸ¬ë¶„ì´ ì•žìœ¼ë¡œ ìƒê²¨ë‚  버그 리í¬íŠ¸ë“¤ì˜ ì¡°ì–¸ìžê°€ ë˜ê¸¸ ì›í•œë‹¤ë©´
388bugme-new ë©”ì¼ë§ 리스트나(새로운 버그 리í¬íŠ¸ë“¤ë§Œì´ ì´ê³³ì—ì„œ ë©”ì¼ë¡œ 전해진다) 390bugme-new ë©”ì¼ë§ 리스트나(새로운 버그 리í¬íŠ¸ë“¤ë§Œì´ ì´ê³³ì—ì„œ ë©”ì¼ë¡œ 전해진다)
389bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì¼ë¡œ 전해진다) 391bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì¼ë¡œ 전해진다)
@@ -404,8 +406,8 @@ bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì
404웹ìƒì˜ ë§Žì€ ë‹¤ë¥¸ ê³³ì—ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ ì•„ì¹´ì´ë¸Œë“¤ì´ 있다. 406웹ìƒì˜ ë§Žì€ ë‹¤ë¥¸ ê³³ì—ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ ì•„ì¹´ì´ë¸Œë“¤ì´ 있다.
405ì´ëŸ¬í•œ ì•„ì¹´ì´ë¸Œë“¤ì„ 찾으려면 검색 ì—”ì§„ì„ ì‚¬ìš©í•˜ë¼. 예를 들어: 407ì´ëŸ¬í•œ ì•„ì¹´ì´ë¸Œë“¤ì„ 찾으려면 검색 ì—”ì§„ì„ ì‚¬ìš©í•˜ë¼. 예를 들어:
406 http://dir.gmane.org/gmane.linux.kernel 408 http://dir.gmane.org/gmane.linux.kernel
407ì—¬ëŸ¬ë¶„ì´ ìƒˆë¡œìš´ ë¬¸ì œì— ê´€í•´ ë¦¬ìŠ¤íŠ¸ì— ì˜¬ë¦¬ê¸° ì „ì— ë§í•˜ê³  ì‹¶ì€ ì£¼ì œì— ëŒ€í•œ 409ì—¬ëŸ¬ë¶„ì´ ìƒˆë¡œìš´ ë¬¸ì œì— ê´€í•´ ë¦¬ìŠ¤íŠ¸ì— ì˜¬ë¦¬ê¸° ì „ì— ë§í•˜ê³  ì‹¶ì€ ì£¼ì œì— ê´€í•œ
408ê²ƒì„ ì•„ì¹´ì´ë¸Œì—ì„œ 먼저 찾기를 강력히 권장한다. ì´ë¯¸ ìƒì„¸í•˜ê²Œ í† ë¡ ëœ ë§Žì€ 410ê²ƒì„ ì•„ì¹´ì´ë¸Œì—ì„œ 먼저 찾아보기를 강력히 권장한다. ì´ë¯¸ ìƒì„¸í•˜ê²Œ í† ë¡ ëœ ë§Žì€
409ê²ƒë“¤ì´ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ ì•„ì¹´ì´ë¸Œì— 기ë¡ë˜ì–´ 있다. 411ê²ƒë“¤ì´ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ ì•„ì¹´ì´ë¸Œì— 기ë¡ë˜ì–´ 있다.
410 412
411ê°ê°ì˜ ì»¤ë„ ì„œë¸Œì‹œìŠ¤í…œë“¤ì˜ ëŒ€ë¶€ë¶„ì€ ìžì‹ ë“¤ì˜ ê°œë°œì— ê´€í•œ 노력들로 ì´ë£¨ì–´ì§„ 413ê°ê°ì˜ ì»¤ë„ ì„œë¸Œì‹œìŠ¤í…œë“¤ì˜ ëŒ€ë¶€ë¶„ì€ ìžì‹ ë“¤ì˜ ê°œë°œì— ê´€í•œ 노력들로 ì´ë£¨ì–´ì§„
@@ -443,7 +445,7 @@ bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì
443ë¬´ì—‡ë³´ë‹¤ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ ë‹¤ë¥¸ 구ë…ìžë“¤ì—게 보여주려 한다는 ê²ƒì„ ê¸°ì–µí•˜ë¼. 445ë¬´ì—‡ë³´ë‹¤ë„ ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì˜ ë‹¤ë¥¸ 구ë…ìžë“¤ì—게 보여주려 한다는 ê²ƒì„ ê¸°ì–µí•˜ë¼.
444 446
445 447
446커뮤니티와 ì¼í•˜ëŠ” 법 448커뮤니티와 협력하는 법
447-------------------- 449--------------------
448 450
449ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ì˜ ëª©ì ì€ 가능한한 가장 ì¢‹ì€ ì»¤ë„ì„ ì œê³µí•˜ëŠ” 것ì´ë‹¤. ì—¬ëŸ¬ë¶„ì´ 451ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ì˜ ëª©ì ì€ 가능한한 가장 ì¢‹ì€ ì»¤ë„ì„ ì œê³µí•˜ëŠ” 것ì´ë‹¤. 여러분ì´
@@ -474,7 +476,7 @@ bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì
474올바른 ë°©í–¥ì˜ í•´ê²°ì±…ìœ¼ë¡œ ì´ëŒì–´ê°ˆ ì˜ì§€ê°€ 있다면 받아들여질 것ì´ë¼ëŠ” ì ì„ 476올바른 ë°©í–¥ì˜ í•´ê²°ì±…ìœ¼ë¡œ ì´ëŒì–´ê°ˆ ì˜ì§€ê°€ 있다면 받아들여질 것ì´ë¼ëŠ” ì ì„
475기억하ë¼. 477기억하ë¼.
476 478
477ì—¬ëŸ¬ë¶„ì˜ ì²« íŒ¨ì¹˜ì— ì—¬ëŸ¬ë¶„ì´ ìˆ˜ì •í•´ì•¼í•˜ëŠ” 십여개 ì •ë„ì˜ íšŒì‹ ì´ ì˜¤ëŠ” 479ì—¬ëŸ¬ë¶„ì˜ ì²« íŒ¨ì¹˜ì— ì—¬ëŸ¬ë¶„ì´ ìˆ˜ì •í•´ì•¼í•˜ëŠ” 십여개 ì •ë„ì˜ íšŒì‹ ì´ ì˜¤ëŠ”
478ê²½ìš°ë„ í”하다. ì´ê²ƒì€ ì—¬ëŸ¬ë¶„ì˜ íŒ¨ì¹˜ê°€ 받아들여지지 ì•Šì„ ê²ƒì´ë¼ëŠ” ê²ƒì„ 480ê²½ìš°ë„ í”하다. ì´ê²ƒì€ ì—¬ëŸ¬ë¶„ì˜ íŒ¨ì¹˜ê°€ 받아들여지지 ì•Šì„ ê²ƒì´ë¼ëŠ” 것ì„
479ì˜ë¯¸í•˜ëŠ” ê²ƒì´ ì•„ë‹ˆê³  ê°œì¸ì ìœ¼ë¡œ 여러분ì—게 ê°ì •ì´ 있어서 그러는 ê²ƒë„ 481ì˜ë¯¸í•˜ëŠ” ê²ƒì´ ì•„ë‹ˆê³  ê°œì¸ì ìœ¼ë¡œ 여러분ì—게 ê°ì •ì´ 있어서 그러는 것ë„
480아니다. 간단히 ì—¬ëŸ¬ë¶„ì˜ íŒ¨ì¹˜ì— ì œê¸°ëœ ë¬¸ì œë“¤ì„ ìˆ˜ì •í•˜ê³  ê·¸ê²ƒì„ ë‹¤ì‹œ 482아니다. 간단히 ì—¬ëŸ¬ë¶„ì˜ íŒ¨ì¹˜ì— ì œê¸°ëœ ë¬¸ì œë“¤ì„ ìˆ˜ì •í•˜ê³  ê·¸ê²ƒì„ ë‹¤ì‹œ
@@ -486,12 +488,12 @@ bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì
486ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ëŠ” 가장 전통ì ì¸ íšŒì‚¬ì˜ ê°œë°œ 환경과는 다르다. ì—¬ê¸°ì— ì—¬ëŸ¬ë¶„ë“¤ì˜ 488ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ëŠ” 가장 전통ì ì¸ íšŒì‚¬ì˜ ê°œë°œ 환경과는 다르다. ì—¬ê¸°ì— ì—¬ëŸ¬ë¶„ë“¤ì˜
487문제를 피하기 위한 목ë¡ì´ 있다. 489문제를 피하기 위한 목ë¡ì´ 있다.
488 ì—¬ëŸ¬ë¶„ë“¤ì´ ì œì•ˆí•œ ë³€ê²½ë“¤ì— ê´€í•˜ì—¬ ë§í•  ë•Œ ì¢‹ì€ ê²ƒë“¤ : 490 ì—¬ëŸ¬ë¶„ë“¤ì´ ì œì•ˆí•œ ë³€ê²½ë“¤ì— ê´€í•˜ì—¬ ë§í•  ë•Œ ì¢‹ì€ ê²ƒë“¤ :
489 - " ì´ê²ƒì€ 여러 ë¬¸ì œë“¤ì„ í•´ê²¹í•©ë‹ˆë‹¤." 491 - "ì´ê²ƒì€ 여러 ë¬¸ì œë“¤ì„ í•´ê²¹í•©ë‹ˆë‹¤."
490 - "ì´ê²ƒì€ 2000 ë¼ì¸ì˜ 코드를 제거합니다." 492 - "ì´ê²ƒì€ 2000 ë¼ì¸ì˜ 코드를 제거합니다."
491 - "ì´ê²ƒì€ ë‚´ê°€ ë§í•˜ë ¤ëŠ” ê²ƒì— ê´€í•´ 설명하는 패치입니다." 493 - "ì´ê²ƒì€ ë‚´ê°€ ë§í•˜ë ¤ëŠ” ê²ƒì— ê´€í•´ 설명하는 패치입니다."
492 - "나는 5ê°œì˜ ë‹¤ë¥¸ 아키í…ì³ì—ì„œ ê·¸ê²ƒì„ í…ŒìŠ¤íŠ¸í–ˆìŠ´ìœ¼ë¡œ..." 494 - "나는 5ê°œì˜ ë‹¤ë¥¸ 아키í…ì³ì—ì„œ ê·¸ê²ƒì„ í…ŒìŠ¤íŠ¸í–ˆìŠ´ìœ¼ë¡œ..."
493 - "ì—¬ê¸°ì— ì¼ë ¨ì˜ ìž‘ì€ íŒ¨ì¹˜ë“¤ì´ ìžˆìŠµìŒë¡œ..." 495 - "ì—¬ê¸°ì— ì¼ë ¨ì˜ ìž‘ì€ íŒ¨ì¹˜ë“¤ì´ ìžˆìŠ´ìŒë¡œ..."
494 - "ì´ê²ƒì€ ì¼ë°˜ì ì¸ 머신ì—ì„œ ì„±ëŠ¥ì„ í–¥ìƒì‹œí‚¤ë¯€ë¡œ..." 496 - "ì´ê²ƒì€ ì¼ë°˜ì ì¸ 머신ì—ì„œ ì„±ëŠ¥ì„ í–¥ìƒì‹œí‚´ìœ¼ë¡œ..."
495 497
496 ì—¬ëŸ¬ë¶„ë“¤ì´ ë§í•  ë•Œ 피해야 í•  좋지 ì•Šì€ ê²ƒë“¤ : 498 ì—¬ëŸ¬ë¶„ë“¤ì´ ë§í•  ë•Œ 피해야 í•  좋지 ì•Šì€ ê²ƒë“¤ :
497 - "우리를 ê·¸ê²ƒì„ AIT/ptx/Solarisì—ì„œ ì´ëŸ¬í•œ 방법으로 했다. 그러므로 ê·¸ê²ƒì€ ì¢‹ì€ ê²ƒìž„ì— í‹€ë¦½ì—†ë‹¤..." 499 - "우리를 ê·¸ê²ƒì„ AIT/ptx/Solarisì—ì„œ ì´ëŸ¬í•œ 방법으로 했다. 그러므로 ê·¸ê²ƒì€ ì¢‹ì€ ê²ƒìž„ì— í‹€ë¦½ì—†ë‹¤..."
@@ -500,7 +502,7 @@ bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì
500 - "ì´ê²ƒì€ ìš°ë¦¬ì˜ ì—”í„°í”„ë¼ì´ì¦ˆ ìƒí’ˆ ë¼ì¸ì„ 위한 것ì´ë‹¤." 502 - "ì´ê²ƒì€ ìš°ë¦¬ì˜ ì—”í„°í”„ë¼ì´ì¦ˆ ìƒí’ˆ ë¼ì¸ì„ 위한 것ì´ë‹¤."
501 - "ì—¬ê¸°ì— ë‚˜ì˜ ìƒê°ì„ ë§í•˜ê³  있는 1000 페ì´ì§€ 설계 문서가 있다." 503 - "ì—¬ê¸°ì— ë‚˜ì˜ ìƒê°ì„ ë§í•˜ê³  있는 1000 페ì´ì§€ 설계 문서가 있다."
502 - "나는 6달ë™ì•ˆ ì´ê²ƒì„ 했으니..." 504 - "나는 6달ë™ì•ˆ ì´ê²ƒì„ 했으니..."
503 - "여기세 5000ë¼ì¸ 짜리 패치가 있으니..." 505 - "여기ì 5000ë¼ì¸ 짜리 패치가 있으니..."
504 - "나는 현재 ë’¤ì£½ë°•ì£½ì¸ ê²ƒì„ ìž¬ìž‘ì„±í–ˆë‹¤. 그리고 여기ì—..." 506 - "나는 현재 ë’¤ì£½ë°•ì£½ì¸ ê²ƒì„ ìž¬ìž‘ì„±í–ˆë‹¤. 그리고 여기ì—..."
505 - "나는 마ê°ì‹œí•œì„ 가지고 있으므로 ì´ íŒ¨ì¹˜ëŠ” 지금 ì ìš©ë  필요가 있다." 507 - "나는 마ê°ì‹œí•œì„ 가지고 있으므로 ì´ íŒ¨ì¹˜ëŠ” 지금 ì ìš©ë  필요가 있다."
506 508
@@ -510,13 +512,13 @@ bugme-janitor ë©”ì¼ë§ 리스트(bugzillaì— ëª¨ë“  ë³€í™”ë“¤ì´ ì—¬ê¸°ì„œ ë©”ì
510없다는 것ì´ë‹¤. 리눅스 커ë„ì˜ ìž‘ì—… 환경ì—서는 단지 ì´ë©”ì¼ ì£¼ì†Œë§Œ 512없다는 것ì´ë‹¤. 리눅스 커ë„ì˜ ìž‘ì—… 환경ì—서는 단지 ì´ë©”ì¼ ì£¼ì†Œë§Œ
511알수 있기 ë•Œë¬¸ì— ì—¬ì„±ê³¼ 소수 ë¯¼ì¡±ë“¤ë„ ëª¨ë‘ ë°›ì•„ë“¤ì—¬ì§„ë‹¤. êµ­ì œì ìœ¼ë¡œ 513알수 있기 ë•Œë¬¸ì— ì—¬ì„±ê³¼ 소수 ë¯¼ì¡±ë“¤ë„ ëª¨ë‘ ë°›ì•„ë“¤ì—¬ì§„ë‹¤. êµ­ì œì ìœ¼ë¡œ
512ì¼í•˜ê²Œ ë˜ëŠ” ì¸¡ë©´ì€ ì‚¬ëžŒì˜ ì´ë¦„ì— ê·¼ê±°í•˜ì—¬ ì„±ë³„ì„ ì¶”ì¸¡í•  수 없게 514ì¼í•˜ê²Œ ë˜ëŠ” ì¸¡ë©´ì€ ì‚¬ëžŒì˜ ì´ë¦„ì— ê·¼ê±°í•˜ì—¬ ì„±ë³„ì„ ì¶”ì¸¡í•  수 없게
513í•˜ê¸°ë•Œë¬¸ì— ì°¨ë³„ì„ ì—†ì• ëŠ” ë° ë„ì›€ì„ ì¤€ë‹¤. Andreaë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ 남ìžì™€ 515í•˜ê¸°ë•Œë¬¸ì— ì°¨ë³„ì„ ì—†ì• ëŠ” ë° ë„ì›€ì„ ì¤€ë‹¤. Andreaë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ 남ìžì™€
514Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅스 커ë„ì—ì„œ 516Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅스 커ë„ì—ì„œ
515작업하며 ìƒê°ì„ í‘œí˜„í•´ì™”ë˜ ëŒ€ë¶€ë¶„ì˜ ì—¬ì„±ë“¤ì€ ê¸ì •ì ì¸ ê²½í—˜ì„ ê°€ì§€ê³  517작업하며 ìƒê°ì„ í‘œí˜„í•´ì™”ë˜ ëŒ€ë¶€ë¶„ì˜ ì—¬ì„±ë“¤ì€ ê¸ì •ì ì¸ ê²½í—˜ì„ ê°€ì§€ê³ 
516있다. 518있다.
517 519
518언어 ìž¥ë²½ì€ ì˜ì–´ì— ìµìˆ™í•˜ì§€ ì•Šì€ ëª‡ëª‡ 사람들ì—게 문제가 ë  ìˆ˜ë„ ìžˆë‹¤. 520언어 ìž¥ë²½ì€ ì˜ì–´ì— ìµìˆ™í•˜ì§€ ì•Šì€ ëª‡ëª‡ 사람들ì—게 문제가 ë  ìˆ˜ë„ ìžˆë‹¤.
519 ì–¸ì–´ì˜ í›Œë¥­í•œ 구사는 ë©”ì¼ë§ 리스트ì—ì„œ 올바르게 ìžì‹ ì˜ ìƒê°ì„ 521ì–¸ì–´ì˜ í›Œë¥­í•œ 구사는 ë©”ì¼ë§ 리스트ì—ì„œ 올바르게 ìžì‹ ì˜ ìƒê°ì„
520표현하기 위하여 필요하다. 그래서 ì—¬ëŸ¬ë¶„ì€ ì´ë©”ì¼ì„ 보내기 ì „ì— 522표현하기 위하여 필요하다. 그래서 ì—¬ëŸ¬ë¶„ì€ ì´ë©”ì¼ì„ 보내기 ì „ì—
521ì˜ì–´ë¥¼ 올바르게 사용하고 있는지를 ì²´í¬í•˜ëŠ” ê²ƒì´ ë°”ëžŒì§í•˜ë‹¤. 523ì˜ì–´ë¥¼ 올바르게 사용하고 있는지를 ì²´í¬í•˜ëŠ” ê²ƒì´ ë°”ëžŒì§í•˜ë‹¤.
522 524
@@ -524,13 +526,13 @@ Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅ìŠ
524ì—¬ëŸ¬ë¶„ì˜ ë³€ê²½ì„ ë‚˜ëˆ„ì–´ë¼ 526ì—¬ëŸ¬ë¶„ì˜ ë³€ê²½ì„ ë‚˜ëˆ„ì–´ë¼
525------------------------ 527------------------------
526 528
527리눅스 ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ëŠ” í•œêº¼ë²ˆì— êµ‰ìž¥ížˆ í° ì½”ë“œì˜ ë¬¶ìŒì„ 쉽게 529리눅스 ì»¤ë„ ì»¤ë®¤ë‹ˆí‹°ëŠ” í•œêº¼ë²ˆì— êµ‰ìž¥ížˆ í° ì½”ë“œì˜ ë¬¶ìŒ(chunk)ì„ ì‰½ê²Œ
528받아들ì´ì§€ 않는다. ë³€ê²½ì€ ì ì ˆí•˜ê²Œ 소개ë˜ê³ , 검토ë˜ê³ , ê°ê°ì˜ 530받아들ì´ì§€ 않는다. ë³€ê²½ì€ ì ì ˆí•˜ê²Œ 소개ë˜ê³ , 검토ë˜ê³ , ê°ê°ì˜
529부분으로 작게 나누어져야 한다. ì´ê²ƒì€ 회사ì—ì„œ 하는 것과는 정확히 531부분으로 작게 나누어져야 한다. ì´ê²ƒì€ 회사ì—ì„œ 하는 것과는 정확히
530반대ë˜ëŠ” 것ì´ë‹¤. ì—¬ëŸ¬ë¶„ë“¤ì˜ ì œì•ˆì€ ê°œë°œ ì´ˆê¸°ì— ì¼ì°ì´ 소개ë˜ì•¼ 한다. 532반대ë˜ëŠ” 것ì´ë‹¤. ì—¬ëŸ¬ë¶„ë“¤ì˜ ì œì•ˆì€ ê°œë°œ ì´ˆê¸°ì— ì¼ì°ì´ 소개ë˜ì•¼ 한다.
531그래서 ì—¬ëŸ¬ë¶„ë“¤ì€ ìžì‹ ì´ 하고 있는 ê²ƒì— ê´€í•˜ì—¬ í”¼ë“œë°±ì„ ë°›ì„ ìˆ˜ 있게 533그래서 ì—¬ëŸ¬ë¶„ë“¤ì€ ìžì‹ ì´ 하고 있는 ê²ƒì— ê´€í•˜ì—¬ í”¼ë“œë°±ì„ ë°›ì„ ìˆ˜ 있게
532ëœë‹¤. 커뮤니티가 ì—¬ëŸ¬ë¶„ë“¤ì´ ì»¤ë®¤ë‹ˆí‹°ì™€ 함께 ì¼í•˜ê³  있다는 ê²ƒì„ 534ëœë‹¤. 커뮤니티가 ì—¬ëŸ¬ë¶„ë“¤ì´ ì»¤ë®¤ë‹ˆí‹°ì™€ 함께 ì¼í•˜ê³  있다는 것ì„
533ëŠë¼ë„ë¡ ë§Œë“¤ê³  커뮤니티가 ì—¬ëŸ¬ë¶„ì˜ ê¸°ëŠ¥ì„ ìœ„í•œ 쓰레기 장으로서 535ëŠë¼ë„ë¡ ë§Œë“¤ê³  커뮤니티가 ì—¬ëŸ¬ë¶„ì˜ ê¸°ëŠ¥ì„ ìœ„í•œ 쓰레기 장으로ì¨
534사용ë˜ì§€ ì•Šê³  있다는 ê²ƒì„ ëŠë¼ê²Œ 하ìž. 그러나 ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì— í•œë²ˆì— 536사용ë˜ì§€ ì•Šê³  있다는 ê²ƒì„ ëŠë¼ê²Œ 하ìž. 그러나 ë©”ì¼ë§ ë¦¬ìŠ¤íŠ¸ì— í•œë²ˆì—
53550ê°œì˜ ì´ë©”ì¼ì„ 보내지는 ë§ì•„ë¼. ì—¬ëŸ¬ë¶„ë“¤ì˜ ì¼ë ¨ì˜ íŒ¨ì¹˜ë“¤ì€ í•­ìƒ 53750ê°œì˜ ì´ë©”ì¼ì„ 보내지는 ë§ì•„ë¼. ì—¬ëŸ¬ë¶„ë“¤ì˜ ì¼ë ¨ì˜ íŒ¨ì¹˜ë“¤ì€ í•­ìƒ
536ë” ìž‘ì•„ì•¼ 한다. 538ë” ìž‘ì•„ì•¼ 한다.
@@ -539,7 +541,7 @@ Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅ìŠ
539 541
5401) ìž‘ì€ íŒ¨ì¹˜ë“¤ì€ ì—¬ëŸ¬ë¶„ì˜ íŒ¨ì¹˜ë“¤ì´ ì ìš©ë  수 있는 í™•ë¥ ì„ ë†’ì—¬ì¤€ë‹¤. 5421) ìž‘ì€ íŒ¨ì¹˜ë“¤ì€ ì—¬ëŸ¬ë¶„ì˜ íŒ¨ì¹˜ë“¤ì´ ì ìš©ë  수 있는 í™•ë¥ ì„ ë†’ì—¬ì¤€ë‹¤.
541 왜ëƒí•˜ë©´ 다른 ì‚¬ëžŒë“¤ì€ ì •í™•ì„±ì„ ê²€ì¦í•˜ê¸° 위하여 ë§Žì€ ì‹œê°„ê³¼ ë…¸ë ¥ì„ 543 왜ëƒí•˜ë©´ 다른 ì‚¬ëžŒë“¤ì€ ì •í™•ì„±ì„ ê²€ì¦í•˜ê¸° 위하여 ë§Žì€ ì‹œê°„ê³¼ 노력ì„
542 들ì´ê¸°ë¥¼ ì›í•˜ì§€ 않는다. 5ì¤„ì˜ íŒ¨ì¹˜ëŠ” ë©”ì¸íŠ¸ë„ˆê°€ ê±°ì˜ ëª‡ 초간 ížë— 544 들ì´ê¸°ë¥¼ ì›í•˜ì§€ 않는다. 5ì¤„ì˜ íŒ¨ì¹˜ëŠ” ë©”ì¸í…Œì´ë„ˆê°€ ê±°ì˜ ëª‡ 초간 ížë—
543 ë³´ë©´ ì ìš©ë  수 있다. 그러나 500 ì¤„ì˜ íŒ¨ì¹˜ëŠ” ì •í™•ì„±ì„ ê²€í† í•˜ê¸° 위하여 545 ë³´ë©´ ì ìš©ë  수 있다. 그러나 500 ì¤„ì˜ íŒ¨ì¹˜ëŠ” ì •í™•ì„±ì„ ê²€í† í•˜ê¸° 위하여
544 ëª‡ì‹œê°„ì´ ê±¸ë¦´ ìˆ˜ë„ ìžˆë‹¤(걸리는 ì‹œê°„ì€ íŒ¨ì¹˜ì˜ í¬ê¸° í˜¹ì€ ë‹¤ë¥¸ ê²ƒì— 546 ëª‡ì‹œê°„ì´ ê±¸ë¦´ ìˆ˜ë„ ìžˆë‹¤(걸리는 ì‹œê°„ì€ íŒ¨ì¹˜ì˜ í¬ê¸° í˜¹ì€ ë‹¤ë¥¸ 것ì—
545 비례하여 기하급수ì ìœ¼ë¡œ 늘어난다). 547 비례하여 기하급수ì ìœ¼ë¡œ 늘어난다).
@@ -558,18 +560,18 @@ Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅ìŠ
558 간결하고 가장 ë›°ì–´ë‚œ ë‹µì„ ë³´ê¸¸ ì›í•œë‹¤. 훌륭한 í•™ìƒì€ ì´ê²ƒì„ 알고 560 간결하고 가장 ë›°ì–´ë‚œ ë‹µì„ ë³´ê¸¸ ì›í•œë‹¤. 훌륭한 í•™ìƒì€ ì´ê²ƒì„ 알고
559 마지막으로 ë‹µì„ ì–»ê¸° ì „ 중간 ê³¼ì •ë“¤ì„ ì œì¶œí•˜ì§„ 않는다. 561 마지막으로 ë‹µì„ ì–»ê¸° ì „ 중간 ê³¼ì •ë“¤ì„ ì œì¶œí•˜ì§„ 않는다.
560 562
561 ì»¤ë„ ê°œë°œë„ ë§ˆì°¬ê°€ì§€ì´ë‹¤. ë©”ì¸íŠ¸ë„ˆë“¤ê³¼ 검토하는 ì‚¬ëžŒë“¤ì€ ë¬¸ì œë¥¼ 563 ì»¤ë„ ê°œë°œë„ ë§ˆì°¬ê°€ì§€ì´ë‹¤. ë©”ì¸í…Œì´ë„ˆë“¤ê³¼ 검토하는 ì‚¬ëžŒë“¤ì€ ë¬¸ì œë¥¼
562 풀어나가는 과정ì†ì— 숨겨진 ê³¼ì •ì„ ë³´ê¸¸ ì›í•˜ì§„ 않는다. ê·¸ë“¤ì€ 564 풀어나가는 과정ì†ì— 숨겨진 ê³¼ì •ì„ ë³´ê¸¸ ì›í•˜ì§„ 않는다. 그들ì€
563 간결하고 멋진 ë‹µì„ ë³´ê¸¸ ì›í•œë‹¤." 565 간결하고 멋진 ë‹µì„ ë³´ê¸¸ ì›í•œë‹¤."
564 566
565커뮤니티와 함께 ì¼í•˜ë©° ë›°ì–´ë‚œ ë‹µì„ ì°¾ê³  ì—¬ëŸ¬ë¶„ë“¤ì˜ ì™„ì„±ë˜ì§€ ìŠì€ ì¼ë“¤ 567커뮤니티와 협력하며 ë›°ì–´ë‚œ ë‹µì„ ì°¾ëŠ” 것과 ì—¬ëŸ¬ë¶„ë“¤ì˜ ë마치지 ëª»íœ ìž‘ì—…ë“¤
566사ì´ì— ê· í˜•ì„ ìœ ì§€í•´ì•¼ 하는 ì–´ë ¤ì›€ì´ ìžˆì수 있다. 그러므로 í”„ë¡œì„¸ìŠ¤ì˜ 568사ì´ì— ê· í˜•ì„ ìœ ì§€í•´ì•¼ 하는 ê²ƒì€ ì–´ë ¤ìš¸ì§€ë„ ëª¨ë¥¸ë‹¤. 그러므로 프로세스ì˜
567ì´ˆë°˜ì— ì—¬ëŸ¬ë¶„ì˜ ì¼ì„ í–¥ìƒì‹œí‚¤ê¸°ìœ„í•œ í”¼ë“œë°±ì„ ì–»ëŠ” 것 ë¿ë§Œ ì•„ë‹ˆë¼ 569ì´ˆë°˜ì— ì—¬ëŸ¬ë¶„ì˜ ìž‘ì—…ì„ í–¥ìƒì‹œí‚¤ê¸°ìœ„í•œ í”¼ë“œë°±ì„ ì–»ëŠ” 것 ë¿ë§Œ 아니ë¼
568ì—¬ëŸ¬ë¶„ë“¤ì˜ ë³€ê²½ë“¤ì„ ìž‘ì€ ë¬¶ìŒìœ¼ë¡œ 유지해서 심지어는 ì—¬ëŸ¬ë¶„ì˜ ìž‘ì—…ì˜ 570ì—¬ëŸ¬ë¶„ë“¤ì˜ ë³€ê²½ë“¤ì„ ìž‘ì€ ë¬¶ìŒìœ¼ë¡œ 유지해서 심지어는 ì—¬ëŸ¬ë¶„ì˜ ìž‘ì—…ì˜
569모든 ë¶€ë¶„ì´ ì§€ê¸ˆì€ í¬í•¨ë  준비가 ë˜ì–´ìžˆì§€ 않지만 ìž‘ì€ ë¶€ë¶„ì€ ì´ë¯¸ 571모든 ë¶€ë¶„ì´ ì§€ê¸ˆì€ í¬í•¨ë  준비가 ë˜ì–´ìžˆì§€ 않지만 ìž‘ì€ ë¶€ë¶„ì€ ë²Œì¨
570받아들여질 수 있ë„ë¡ ìœ ì§€í•˜ëŠ” ê²ƒì´ ë°”ëžŒì§í•˜ë‹¤. 572받아들여질 수 있ë„ë¡ ìœ ì§€í•˜ëŠ” ê²ƒì´ ë°”ëžŒì§í•˜ë‹¤.
571 573
572ë˜í•œ 완성ë˜ì§€ 않았고 "ë‚˜ì¤‘ì— ìˆ˜ì •ë  ê²ƒì´ë‹¤." 와 ê°™ì€ ê²ƒë“¤ì í¬í•¨í•˜ëŠ” 574ë˜í•œ 완성ë˜ì§€ 않았고 "ë‚˜ì¤‘ì— ìˆ˜ì •ë  ê²ƒì´ë‹¤." 와 ê°™ì€ ê²ƒë“¤ì í¬í•¨í•˜ëŠ”
573íŒ¨ì¹˜ë“¤ì€ ë°›ì•„ë“¤ì—¬ì§€ì§€ ì•Šì„ ê²ƒì´ë¼ëŠ” ì ì„ 유ë…하ë¼. 575íŒ¨ì¹˜ë“¤ì€ ë°›ì•„ë“¤ì—¬ì§€ì§€ ì•Šì„ ê²ƒì´ë¼ëŠ” ì ì„ 유ë…하ë¼.
574 576
575ë³€ê²½ì„ ì •ë‹¹í™”í•´ë¼ 577ë³€ê²½ì„ ì •ë‹¹í™”í•´ë¼
@@ -577,7 +579,7 @@ Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅ìŠ
577 579
578ì—¬ëŸ¬ë¶„ë“¤ì˜ ë‚˜ëˆ„ì–´ì§„ íŒ¨ì¹˜ë“¤ì„ ë¦¬ëˆ…ìŠ¤ 커뮤니티가 왜 ë°˜ì˜í•´ì•¼ 하는지를 580ì—¬ëŸ¬ë¶„ë“¤ì˜ ë‚˜ëˆ„ì–´ì§„ íŒ¨ì¹˜ë“¤ì„ ë¦¬ëˆ…ìŠ¤ 커뮤니티가 왜 ë°˜ì˜í•´ì•¼ 하는지를
579ì•Œë„ë¡ í•˜ëŠ” ê²ƒì€ ë§¤ìš° 중요하다. 새로운 ê¸°ëŠ¥ë“¤ì´ í•„ìš”í•˜ê³  유용하다는 581ì•Œë„ë¡ í•˜ëŠ” ê²ƒì€ ë§¤ìš° 중요하다. 새로운 ê¸°ëŠ¥ë“¤ì´ í•„ìš”í•˜ê³  유용하다는
580ê²ƒì€ ë°˜ë“œì‹œ ê·¸ì— ë§žëŠ” ì´ìœ ê°€ 있어야 한다. 582ê²ƒì€ ë°˜ë“œì‹œ ê·¸ì— í•©ë‹¹í•œ ì´ìœ ê°€ 있어야 한다.
581 583
582 584
583ë³€ê²½ì„ ë¬¸ì„œí™”í•´ë¼ 585ë³€ê²½ì„ ë¬¸ì„œí™”í•´ë¼
@@ -588,7 +590,7 @@ Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅ìŠ
588것ì´ë‹¤. 그리고 í•­ìƒ ê·¸ ë‚´ìš©ì„ ë³´ê¸¸ ì›í•˜ëŠ” 모든 ì‚¬ëžŒë“¤ì„ ìœ„í•´ ë³´ì¡´ë  590것ì´ë‹¤. 그리고 í•­ìƒ ê·¸ ë‚´ìš©ì„ ë³´ê¸¸ ì›í•˜ëŠ” 모든 ì‚¬ëžŒë“¤ì„ ìœ„í•´ ë³´ì¡´ë 
589것ì´ë‹¤. 패치는 완벽하게 다ìŒê³¼ ê°™ì€ ë‚´ìš©ë“¤ì„ í¬í•¨í•˜ì—¬ 설명해야 한다. 591것ì´ë‹¤. 패치는 완벽하게 다ìŒê³¼ ê°™ì€ ë‚´ìš©ë“¤ì„ í¬í•¨í•˜ì—¬ 설명해야 한다.
590 - ë³€ê²½ì´ ì™œ 필요한지 592 - ë³€ê²½ì´ ì™œ 필요한지
591 - íŒ¨ì¹˜ì— ê´€í•œ ì „ì²´ 설계 어프로치 593 - íŒ¨ì¹˜ì— ê´€í•œ ì „ì²´ 설계 ì ‘ê·¼(approach)
592 - 구현 ìƒì„¸ë“¤ 594 - 구현 ìƒì„¸ë“¤
593 - 테스트 결과들 595 - 테스트 결과들
594 596
@@ -600,7 +602,7 @@ Patì´ë¼ëŠ” ì´ë¦„ì„ ê°€ì§„ ì—¬ìžê°€ ìžˆì„ ìˆ˜ë„ ìžˆëŠ” 것ì´ë‹¤. 리눅ìŠ
600 602
601 603
602ì´ ëª¨ë“  ê²ƒì„ í•˜ëŠ” ê²ƒì€ ë§¤ìš° 어려운 ì¼ì´ë‹¤. 완벽히 소화하는 ë°ëŠ” ì ì–´ë„ ëª‡ë…„ì´ 604ì´ ëª¨ë“  ê²ƒì„ í•˜ëŠ” ê²ƒì€ ë§¤ìš° 어려운 ì¼ì´ë‹¤. 완벽히 소화하는 ë°ëŠ” ì ì–´ë„ 몇년ì´
603걸릴 ìˆ˜ë„ ìžˆë‹¤. ë§Žì€ ì¸ë‚´ì™€ ê²°ì˜ê°€ 필요한 계ì†ë˜ëŠ” ê°œì„ ì˜ ê³¼ì •ì´ë‹¤. 그러나 605걸릴 ìˆ˜ë„ ìžˆë‹¤. ë§Žì€ ì¸ë‚´ì™€ ê²°ì‹¬ì´ í•„ìš”í•œ 계ì†ë˜ëŠ” ê°œì„ ì˜ ê³¼ì •ì´ë‹¤. 그러나
604가능한한 í¬ê¸°í•˜ì§€ ë§ë¼. ë§Žì€ ì‚¬ëžŒë“¤ì€ ì´ì „부터 í•´ì™”ë˜ ê²ƒì´ê³  ê·¸ ì‚¬ëžŒë“¤ë„ 606가능한한 í¬ê¸°í•˜ì§€ ë§ë¼. ë§Žì€ ì‚¬ëžŒë“¤ì€ ì´ì „부터 í•´ì™”ë˜ ê²ƒì´ê³  ê·¸ 사람들ë„
605정확하게 ì—¬ëŸ¬ë¶„ë“¤ì´ ì§€ê¸ˆ ì„œ 있는 ê·¸ 곳부터 시작했었다. 607정확하게 ì—¬ëŸ¬ë¶„ë“¤ì´ ì§€ê¸ˆ ì„œ 있는 ê·¸ 곳부터 시작했었다.
606 608
@@ -620,4 +622,4 @@ David A. Wheeler, Junio Hamano, Michael Kerrisk, and Alex Shepardì—ê²Œë„ ê°ì‚
620 622
621 623
622 624
623ë©”ì¸íŠ¸ë„ˆ: Greg Kroah-Hartman <greg@kroah.com> 625ë©”ì¸í…Œì´ë„ˆ: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/Documentation/ko_KR/stable_api_nonsense.txt b/Documentation/ko_KR/stable_api_nonsense.txt
new file mode 100644
index 000000000000..8f2b0e1d98c4
--- /dev/null
+++ b/Documentation/ko_KR/stable_api_nonsense.txt
@@ -0,0 +1,195 @@
1NOTE:
2This is a version of Documentation/stable_api_nonsense.txt translated
3into korean
4This document is maintained by barrios <minchan.kim@gmail.com>
5If you find any difference between this document and the original file or
6a problem with the translation, please contact the maintainer of this file.
7
8Please also note that the purpose of this file is to be easier to
9read for non English (read: korean) speakers and is not intended as
10a fork. So if you have any comments or updates for this file please
11try to update the original English file first.
12
13==================================
14ì´ ë¬¸ì„œëŠ”
15Documentation/stable_api_nonsense.txt
16ì˜ í•œê¸€ 번역입니다.
17
18ì—­ìžï¼š 김민찬 <minchan.kim@gmail.com>
19ê°ìˆ˜ï¼š ì´ì œì´ë¯¸ <jamee.lee@samsung.com>
20==================================
21
22리눅스 ì»¤ë„ ë“œë¼ì´ë²„ ì¸í„°íŽ˜ì´ìŠ¤
23(ì—¬ëŸ¬ë¶„ë“¤ì˜ ëª¨ë“  ì§ˆë¬¸ì— ëŒ€í•œ 답 그리고 다른 몇가지)
24
25Greg Kroah-Hartman <greg@kroah.com>
26
27ì´ ë¬¸ì„œëŠ” 리눅스가 왜 ë°”ì´ë„ˆë¦¬ ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 갖지 않는지, 왜 변하지
28않는(stable) ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 갖지 않는지를 설명하기 위해 쓰여졌다.
29ì´ ë¬¸ì„œëŠ” 커ë„ê³¼ 유저공간 사ì´ì˜ ì¸í„°íŽ˜ì´ìŠ¤ê°€ ì•„ë‹ˆë¼ ì»¤ë„ ë‚´ë¶€ì˜
30ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì„ 설명하고 있다는 ê²ƒì„ ìœ ë…하ë¼. 커ë„ê³¼ 유저공간 사ì´ì˜
31ì¸í„°íŽ˜ì´ìŠ¤ëŠ” ì‘ìš©í”„ë¡œê·¸ëž¨ì´ ì‚¬ìš©í•˜ëŠ” syscall ì¸í„°íŽ˜ì´ìŠ¤ì´ë‹¤. ê·¸ ì¸í„°íŽ˜ì´ìŠ¤ëŠ”
32오랫ë™ì•ˆ ê±°ì˜ ë³€í•˜ì§€ 않았고 ì•žìœ¼ë¡œë„ ë³€í•˜ì§€ ì•Šì„ ê²ƒì´ë‹¤. 나는 pre 0.9ì—ì„œ
33만들어졌지만 ìµœì‹ ì˜ 2.6 ì»¤ë„ ë°°í¬ì—ì„œë„ ìž˜ ë™ìž‘하는 í”„ë¡œê·¸ëž¨ì„ ê°€ì§€ê³ 
34있다. ì´ ì¸í„°íŽ˜ì´ìŠ¤ëŠ” 사용ìžì™€ ì‘용프로그램 개발ìžë“¤ì´ 변하지 ì•Šì„ ê²ƒì´ë¼ê³ 
35여길수 있는 것ì´ë‹¤.
36
37
38ì´ˆë¡
39----
40ì—¬ëŸ¬ë¶„ì€ ë³€í•˜ì§€ 않는 ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ ì›í•œë‹¤ê³  ìƒê°í•˜ì§€ë§Œ 실제로는
41그렇지 않으며 심지어는 ê·¸ê²ƒì„ ì•Œì•„ì±„ì§€ 못한다. ì—¬ëŸ¬ë¶„ì´ ì›í•˜ëŠ” 것ì€
42안정ë˜ê²Œ 실행ë˜ëŠ” ë“œë¼ì´ë²„ì´ë©° ë“œë¼ì´ë²„ê°€ ë©”ì¸ ì»¤ë„ íŠ¸ë¦¬ì— ìžˆì„ ë•Œ
43그런 안정ì ì¸ ë“œë¼ì´ë²„를 ì–»ì„ ìˆ˜ 있게 ëœë‹¤. ë˜í•œ ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ê°€
44ë©”ì¸ ì»¤ë„ íŠ¸ë¦¬ì— ìžˆë‹¤ë©´ 다른 ë§Žì€ ì¢‹ì€ ì´ì ë“¤ì„ 얻게 ëœë‹¤. 그러한 것들ì´
45리눅스를 강건하고, 안정ì ì´ë©°, 성숙한 ìš´ì˜ì²´ì œë¡œ 만들어 놓ìŒìœ¼ë¡œì¨
46여러분들로 하여금 바로 리눅스를 사용하게 만드는 ì´ìœ ì´ë‹¤.
47
48
49소개
50----
51
52ì»¤ë„ ë‚´ë¶€ì˜ ì¸í„°íŽ˜ì´ìŠ¤ê°€ 바뀌는 ê²ƒì„ ê±±ì •í•˜ë©° ì»¤ë„ ë“œë¼ì´ë²„를 작성하고
53싶어하는 ì‚¬ëžŒì€ ì •ë§ ì´ìƒí•œ 사람ì´ë‹¤. 세ìƒì˜ ëŒ€ë‹¤ìˆ˜ì˜ ì‚¬ëžŒë“¤ì€ ì´ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼
54보지못할 것ì´ë©° 전혀 ê±±ì •í•˜ì§€ë„ ì•ŠëŠ”ë‹¤.
55
56먼저, 나는 closed 소스, hidden 소스, binary blobs, 소스 wrappers, ë˜ëŠ” GPLë¡œ
57ë°°í¬ë˜ì—ˆì§€ë§Œ 소스 코드를 ê°–ê³  있지 ì•Šì€ ì»¤ë„ ë“œë¼ì´ë²„ë“¤ì„ ì„¤ëª…í•˜ëŠ” ì–´ë–¤ 다른
58ìš©ì–´ë“¤ì— ê´€í•œ ì–´ë–¤ 법ì ì¸ ë¬¸ì œì— ê´€í•´ì„œëŠ” 언급하지 ì•Šì„ ê²ƒì´ë‹¤. ì–´ë–¤ 법ì ì¸
59ì§ˆë¬¸ë“¤ì„ ê°€ì§€ê³  있다면 변호사와 ì—°ë½í•˜ë¼. 나는 프로그래머ì´ë¯€ë¡œ 여기서 기술ì ì¸
60ë¬¸ì œë“¤ë§Œì„ ì„¤ëª…í•˜ë ¤ê³  한다. (법ì ì¸ 문제를 경시하는 ê²ƒì€ ì•„ë‹ˆë‹¤. 그런 문제들ì€
61엄연히 í˜„ì‹¤ì— ìžˆê³  ì—¬ëŸ¬ë¶„ë“¤ì€ í•­ìƒ ê·¸ ë¬¸ì œë“¤ì„ ì¸ì‹í•˜ê³  ìžˆì„ í•„ìš”ëŠ” 있다.)
62
63ìž, ë‘ê°€ì§€ì˜ ì£¼ìš” 주제가 있다. ë°”ì´ë„ˆë¦¬ ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë“¤ê³¼ 변하지 않는
64ì»¤ë„ ì†ŒìŠ¤ ì¸í„°íŽ˜ì´ë“¤. ê·¸ê²ƒë“¤ì€ ì„œë¡œ ì˜ì¡´ì„±ì„ 가지고 있지만 ë°”ì´ë„ˆë¦¬
65문제를 먼저 풀고 넘어갈 것ì´ë‹¤.
66
67
68
69ë°”ì´ë„ˆë¦¬ ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤
70------------------------
71우리가 변하지 않는 ì»¤ë„ ì†ŒìŠ¤ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 가지고 있다고 가정하ìž. 그러면
72ë°”ì´ë„ˆë¦¬ ì¸í„°íŽ˜ì´ìŠ¤ ë˜í•œ ìžì—°ì ìœ¼ë¡œ 변하지 ì•Šì„까? 틀렸다. 리눅스 커ë„ì—
73관한 ë‹¤ìŒ ì‚¬ì‹¤ë“¤ì„ ìƒê°í•´ë³´ë¼.
74 - ì—¬ëŸ¬ë¶„ë“¤ì´ ì‚¬ìš©í•˜ëŠ” C 컴파ì¼ëŸ¬ì˜ ë²„ì ¼ì— ë”°ë¼ ë‹¤ë¥¸ ì»¤ë„ ìžë£Œ 구조들ì€
75 다른 alignmnetë“¤ì„ ê°–ê²Œ ë ê²ƒì´ê³  다른 방법으로(í•¨ìˆ˜ë“¤ì„ inline으로
76 í–ˆëŠëƒ, 아니ëƒ) 다른 í•¨ìˆ˜ë“¤ì„ í¬í•¨í•˜ëŠ” ê²ƒë„ ê°€ëŠ¥í•œë‹¤. 중요한 것ì€
77 개별ì ì¸ 함수 êµ¬ì„±ì´ ì•„ë‹ˆë¼ ìžë£Œ 구조 íŒ¨ë”©ì´ ë‹¬ë¼ì§„다는 ì ì´ë‹¤.
78 - ì—¬ëŸ¬ë¶„ì´ ì„ íƒí•œ ì»¤ë„ ë¹Œë“œ ì˜µì…˜ì— ë”°ë¼ì„œ 커ë„ì€ ë‹¤ì–‘í•œ ê²ƒë“¤ì„ ê°€ì •í• 
79 수 있다.
80 - 다른 êµ¬ì¡°ì²´ë“¤ì€ ë‹¤ë¥¸ í•„ë“œë“¤ì„ í¬í•¨í•  수 있다.
81 - 몇몇 í•¨ìˆ˜ë“¤ì€ ì „í˜€ 구현ë˜ì§€ ì•Šì„ ìˆ˜ë„ ìžˆë‹¤(즉, 몇몇 lock들ì€
82 non-SMP 빌드ì—서는 사ë¼ì ¸ ë²„ë¦´ìˆ˜ë„ ìžˆë‹¤).
83 - 커ë„ë‚´ì— ë©”ëª¨ë¦¬ëŠ” build optoinë“¤ì— ë”°ë¼ ë‹¤ë¥¸ 방법으로 alignë ìˆ˜
84 있다.
85 - 리눅스는 ë§Žì€ ë‹¤ì–‘í•œ 프로세서 아키í…ì³ì—ì„œ 실행ëœë‹¤. í•œ 아키í…ì³ì˜
86 ë°”ì´ë„ˆë¦¬ ë“œë¼ì´ë²„를 다른 아키í…ì³ì—ì„œ ì •ìƒì ìœ¼ë¡œ 실행시킬 방법ì€
87 없다.
88
89커ë„ì„ ë¹Œë“œí–ˆë˜ C 컴파ì¼ëŸ¬ì™€ 정확하게 ê°™ì€ ê²ƒì„ ì‚¬ìš©í•˜ê³  정확하게 ê°™ì€
90ì»¤ë„ êµ¬ì„±(configuration)ì„ ì‚¬ìš©í•˜ì—¬ ì—¬ëŸ¬ë¶„ë“¤ì˜ ëª¨ë“ˆì„ ë¹Œë“œí•˜ë©´ 간단히
91ë§Žì€ ë¬¸ì œë“¤ì„ í•´ê²°í•  수 있다. ì´ë ‡ê²Œ 하는 ê²ƒì€ ì—¬ëŸ¬ë¶„ë“¤ì´ í•˜ë‚˜ì˜ ë¦¬ëˆ…ìŠ¤
92ë°°í¬íŒì˜ í•˜ë‚˜ì˜ ë°°í¬ ë²„ì ¼ì„ ìœ„í•œ ëª¨ë“ˆë§Œì„ ì œê³µí•œë‹¤ë©´ ë³„ì¼ ì•„ë‹ ê²ƒì´ë‹¤.
93그러나 ê°ê¸° 다른 리눅스 ë°°í¬íŒë§ˆë‹¤ 한번씩 빌드하는 수를 ê° ë¦¬ëˆ…ìŠ¤ ë°°í¬íŒë§ˆë‹¤
94제공하는 다른 ë¦´ë¦¬ì¦ˆì˜ ìˆ˜ì™€ 곱하게 ë˜ë©´ ì´ë²ˆì—는 ê° ë¦´ë¦¬ì¦ˆë“¤ì˜ ë‹¤ë¥¸ 빌드
95ì˜µì…˜ì˜ ì•…ëª½ê³¼ 마주하게 것ì´ë‹¤. ë˜í•œ ê° ë¦¬ëˆ…ìŠ¤ ë°°í¬íŒë“¤ì€ 다른 하드웨어
96종류ì—(다른 프로세서 타입과 다른 옵션들) 맞춰져 있는 ë§Žì€ ë‹¤ë¥¸ 커ë„들ì„
97ë°°í¬í•œë‹¤. 그러므로 í•œë²ˆì˜ ë°°í¬ì—서조차 ì—¬ëŸ¬ë¶„ë“¤ì˜ ëª¨ë“ˆì€ ì—¬ëŸ¬ 버젼ì„
98만들 필요가 있다.
99
100나를 믿어ë¼. ì—¬ëŸ¬ë¶„ë“¤ì€ ì´ëŸ¬í•œ ì¢…ë¥˜ì˜ ë°°í¬ë¥¼ 지ì›í•˜ë ¤ê³  ì‹œë„한다면 시간ì´
101지나면 ë¯¸ì¹ ì§€ê²½ì´ ë  ê²ƒì´ë‹¤. ë‚œ ì´ëŸ¬í•œ ê²ƒì„ ì˜¤ëž˜ì „ì— ì•„ì£¼ 어렵게 배웠다...
102
103
104
105변하지않는 ì»¤ë„ ì†ŒìŠ¤ ì¸í„°íŽ˜ì´ìŠ¤ë“¤
106---------------------------------
107
108리눅스 ì»¤ë„ ë“œë¼ì´ë²„를 계ì†í•´ì„œ ë©”ì¸ ì»¤ë„ íŠ¸ë¦¬ì— ë°˜ì˜í•˜ì§€ ì•Šê³ 
109유지보수하려고 하는 사름들과 ì´ ë¬¸ì œë¥¼ ë…¼ì˜í•˜ê²Œ ë˜ë©´ 훨씬 ë”
110"ë…¼ëž€ì˜ ì—¬ì§€ê°€ 많ì€" 주제가 ë  ê²ƒì´ë‹¤.
111
112리눅스 ì»¤ë„ ê°œë°œì€ ëŠìž„ì—†ì´ ë¹ ë¥¸ ì†ë„ë¡œ ì´ë£¨ì–´ì§€ê³  있으며 ê²°ì½”
113ëŠìŠ¨í•´ì§„ ì ì´ 없다. ì»¤ë„ ê°œë°œìžë“¤ì´ 현재 ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì—ì„œ 버그를
114발견하거나 무엇ì¸ê°€ 할수 있는 ë” ì¢‹ì€ ë°©ë²•ì„ ì°¾ê²Œ ë˜ì—ˆë‹¤ê³  하ìž.
115ê·¸ë“¤ì´ ë°œê²¬í•œ ê²ƒì„ ì‹¤í–‰í•œë‹¤ë©´ ì•„ë§ˆë„ ë” ìž˜ ë™ìž‘하ë„ë¡ í˜„ìž¬ ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì„
116수정하게 ë  ê²ƒì´ë‹¤. ê·¸ë“¤ì´ ê·¸ëŸ° ì¼ì„ 하게ë˜ë©´ 함수 ì´ë¦„ë“¤ì€ ë³€í•˜ê²Œ ë˜ê³ ,
117êµ¬ì¡°ì²´ë“¤ì€ ëŠ˜ì–´ë‚˜ê±°ë‚˜ 줄어들게 ë˜ê³ , 함수 파ë¼ë¯¸í„°ë“¤ì€ ìž¬ìž‘ì—…ë  ê²ƒì´ë‹¤.
118ì´ëŸ¬í•œ ì¼ì´ ë°œìƒë˜ë©´ ì»¤ë„ ë‚´ì— ì´ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ ì‚¬ìš©í–ˆë˜ ì¸ìŠ¤í„´ìŠ¤ë“¤ì´ ë™ì‹œì—
119ìˆ˜ì •ë  ê²ƒì´ë©° ì´ëŸ¬í•œ ê³¼ì •ì€ ëª¨ë“  ê²ƒì´ ê³„ì†í•´ì„œ 올바르게 ë™ìž‘í•  것ì´ë¼ëŠ”
120ê²ƒì„ ë³´ìž¥í•œë‹¤.
121
122ì´ëŸ¬í•œ ê²ƒì˜ í•œ 예로ì¨, ì»¤ë„ ë‚´ë¶€ì˜ USB ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì€ ì´ ì„œë¸Œì‹œìŠ¤í…œì´
123ìƒê¸´ ì´í›„ë¡œ ì ì–´ë„ 3ë²ˆì˜ ë‹¤ë¥¸ ìž¬ìž‘ì—…ì„ ê²ªì—ˆë‹¤. ì´ ìž¬ìž‘ì—…ë“¤ì€ ë§Žì€ ë‹¤ë¥¸
124ë¬¸ì œë“¤ì„ í’€ì—ˆë‹¤.
125 - ë°ì´í„° ìŠ¤íŠ¸ë¦¼ë“¤ì˜ ë™ê¸°ì ì¸ 모ë¸ì—ì„œ 비ë™ê¸°ì ì¸ 모ë¸ë¡œì˜ 변화. ì´ê²ƒì€
126 ë§Žì€ ë“œë¼ì´ë²„ë“¤ì˜ ë³µìž¡ì„±ì„ ì¤„ì´ê³  ì²˜ë¦¬ëŸ‰ì„ í–¥ìƒì‹œì¼œ 현재는 ê±°ì˜ ëª¨ë“ 
127 USB ìž¥ì¹˜ë“¤ì˜ ê±°ì˜ ìµœëŒ€ ì†ë„ë¡œ 실행ë˜ê³  있다.
128 - USB ë“œë¼ì´ë²„ê°€ USB 코어로부터 ë°ì´í„° íŒ¨í‚·ë“¤ì„ í• ë‹¹ë°›ë¡œë¡ í•œ 변경으로
129 ì¸í•´ì„œ ì§€ê¸ˆì˜ ëª¨ë“  ë“œë¼ì´ë²„ë“¤ì€ ë§Žì€ ë¬¸ì„œí™”ëœ ë°ë“œë½ì„ 수정하기 위하여
130 USB 코어ì—게 ë” ë§Žì€ ì •ë³´ë¥¼ 제공해야만 한다.
131
132ì´ê²ƒì€ 오랫ë™ì•ˆ ìžì‹ ì˜ ì˜¤ëž˜ëœ USB ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì„ 유지해야 하는 closed ìš´ì˜ì²´ì œë“¤ê³¼ëŠ”
133완전히 반대ë˜ëŠ” 것ì´ë‹¤. closedëœ ìš´ì˜ì²´ì œë“¤ì€ 새로운 개발ìžë“¤ì—게 우연히 ë‚¡ì€
134ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 사용하게 í•  기회를 주게ë˜ë©°, ì ì ˆí•˜ì§€ 못한 방법으로 처리하게 ë˜ì–´
135ìš´ì˜ì²´ì œì˜ ì•ˆì •ì„±ì„ í•´ì¹˜ëŠ” 문제를 야기하게 ëœë‹¤.
136
137ì´ ë‘ê°€ì§€ì˜ ì˜ˆë“¤ 모ë‘, 모든 개발ìžë“¤ì€ ê¼­ ì´ë£¨ì–´ì ¸ì•¼ 하는 중요한 변화들ì´ë¼ê³ 
138ë™ì˜ë¥¼ 하였고 비êµì  ì ì€ 고통으로 변경ë˜ì–´ì¡Œë‹¤. 리눅스가 변하지 않는 소스
139ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 고집한다면, 새로운 ì¸í„°íŽ˜ì´ìŠ¤ê°€ 만들어지게 ë˜ë©° 반면 ê¸°ì¡´ì˜ ì˜¤ëž˜ëœ
140것들, 그리고 깨진 ê²ƒë“¤ì€ ê³„ì†í•´ì„œ 유지ë˜ì–´ì•¼ 하며 ì´ëŸ¬í•œ ì¼ë“¤ì€ USB 개발ìžë“¤ì—게
141ë˜ ë‹¤ë¥¸ ì¼ê±°ë¦¬ë¥¼ 주게 ëœë‹¤. 모든 리눅스 USB 개발ìžë“¤ì—게 ìžì‹ ì˜ ê·¸ë“¤ì˜ ì—…ë¬´ë¥¼
142마친 후 ì‹œê°„ì„ íˆ¬ìží•˜ì—¬ 아무 ë“ë„ ì—†ëŠ” 무료 봉사를 해달ë¼ê³  하는 ê²ƒì€ ê°€ëŠ¥ì„±ì´
143í¬ë°•í•œ ì¼ì´ë‹¤.
144
145보안 문제 ì—­ì‹œ 리눅스ì—게는 매우 중요하다. 보안 문제가 발견ë˜ë©´ 그것ì€
146매우 ì§§ì€ ì‹œê°„ ì•ˆì— ìˆ˜ì •ëœë‹¤. 보안 문제는 ê·¸ 문제를 해결하기 위하여
147여러번 내부 ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì„ 재작업하게 만들었다. ì´ëŸ¬í•œ 문제가
148ë°œìƒí•˜ì˜€ì„ ë•Œ ê·¸ ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì„ 사용하는 모든 ë“œë¼ì´ë²„ë“¤ë„ ë™ì‹œì—
149수정ë˜ì–´ 보안 문제가 앞으로 갑작스럽게 ìƒê¸°ì§€ëŠ” ì•Šì„ ê²ƒì´ë¼ëŠ” 것ì„
150보장한다. 내부 ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì˜ ë³€ê²½ì´ í—ˆë½ë˜ì§€ 않으면 ì´ëŸ¬í•œ ì¢…ë¥˜ì˜ ë³´ì•ˆ
151문제를 수정하고 ê·¸ê²ƒì´ ë‹¤ì‹œ ë°œìƒí•˜ì§€ ì•Šì„ ê²ƒì´ë¼ê³  보장하는 ê²ƒì€ ê°€ëŠ¥í•˜ì§€
152ì•Šì„ ê²ƒì´ë‹¤.
153
154ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì€ 계ì†í•´ì„œ 정리ë˜ê³  있다. 현재 ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 사용하는
155ì‚¬ëžŒì´ í•œëª…ë„ ì—†ë‹¤ë©´ ê·¸ê²ƒì€ ì‚­ì œëœë‹¤. ì´ê²ƒì€ 커ë„ì´ ê°€ëŠ¥í•œí•œ 가장 작게
156유지ë˜ë©° 존재하는 모든 ê°€ëŠ¥ì„±ì´ ìžˆëŠ” ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì´ 테스트ëœë‹¤ëŠ” 것ì„
157보장한다(사용ë˜ì§€ 않는 ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì€ 유효성 ê²€ì¦ì„ 하기가 ê±°ì˜ ë¶ˆê°€ëŠ¥í•˜ë‹¤).
158
159
160ë¬´ì—‡ì„ í•´ì•¼ 하나
161---------------
162ìž, ì—¬ëŸ¬ë¶„ì´ ë©”ì¸ ì»¤ë„ íŠ¸ë¦¬ì— ìžˆì§€ ì•Šì€ ë¦¬ëˆ…ìŠ¤ ì»¤ë„ ë“œë¼ì´ë²„를 가지고
163있다면 ì—¬ëŸ¬ë¶„ì€ ì¦‰, 개발ìžëŠ” ë¬´ì—‡ì„ í•´ì•¼ 하나? 모든 ë°°í¬íŒë§ˆë‹¤ 다른
164ì»¤ë„ ë²„ì ¼ì„ ìœ„í•œ ë°”ì´ë„ˆë¦¬ ë“œë¼ì´ë²„를 ë°°í¬í•˜ëŠ” ê²ƒì€ ì•…ëª½ì´ë©° 계ì†í•´ì„œ
165변하고 있는 ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ë“¤ì˜ 맞처 유지보수하려고 ì‹œë„하는 ê²ƒì€ íž˜ë“ 
166ì¼ì´ë‹¤.
167
168간단하다. ì—¬ëŸ¬ë¶„ì˜ ì»¤ë„ ë“œë¼ì´ë²„를 ë©”ì¸ ì»¤ë„ íŠ¸ë¦¬ì— ë°˜ì˜í•˜ë¼(우리는 여기서
169GPLì„ ë”°ë¥´ëŠ” ë°°í¬ ë“œë¼ì´ë²„ì— ê´€í•´ 얘기하고 있다는 ê²ƒì„ ìƒê¸°í•˜ë¼. 여러분ì˜
170코드가 ì´ëŸ¬í•œ ë¶„ë¥˜ì— í•´ë‹¹ë˜ì§€ 않는다면 í–‰ìš´ì„ ë¹ˆë‹¤. 여러분 스스로 어떻게든
171해야만 한다). ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ê°€ íŠ¸ë¦¬ì— ìžˆê²Œë˜ë©´ ì»¤ë„ ì¸í„°íŽ˜ì´ìŠ¤ê°€
172변경ë˜ë”ë¼ë„ 가장 먼저 커ë„ì— ë³€ê²½ì„ ê°€í–ˆë˜ ì‚¬ëžŒì— ì˜í•´ì„œ ìˆ˜ì •ë  ê²ƒì´ë‹¤.
173ì´ê²ƒì€ ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ê°€ ì—¬ëŸ¬ë¶„ì˜ ë³„ë‹¤ë¥¸ ë…¸ë ¥ì—†ì´ í•­ìƒ ë¹Œë“œê°€ 가능하며
174ë™ìž‘하는 ê²ƒì„ ë³´ìž¥í•œë‹¤.
175
176ë©”ì¸ ì»¤ë„ íŠ¸ë¦¬ì— ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„를 ë°˜ì˜í•˜ë©´ 얻게 ë˜ëŠ” 장ì ë“¤ì€ 다ìŒê³¼ 같다.
177 - ê´€ë¦¬ì˜ ë“œëŠ” 비용(ì›ëž˜ 개발ìžì˜)ì€ ì¤„ì–´ì¤„ë©´ì„œ ë“œë¼ì´ë²„ì˜ ì§ˆì€ í–¥ìƒë  것ì´ë‹¤.
178 - 다른 개발ìžë“¤ì´ ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ì— ê¸°ëŠ¥ë“¤ì„ ì¶”ê°€ í•  것ì´ë‹¤.
179 - 다른 ì‚¬ëžŒë“¤ì€ ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ì— ë²„ê·¸ë¥¼ 발견하고 수정할 것ì´ë‹¤.
180 - 다른 ì‚¬ëžŒë“¤ì€ ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ì˜ ê°œì„ ì ì„ ì°¾ì„ ì¤„ 것ì´ë‹¤.
181 - 외부 ì¸í„°íŽ˜ì´ìŠ¤ 변경으로 ì¸í•´ ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„ì˜ ìˆ˜ì •ì´ í•„ìš”í•˜ë‹¤ë©´ 다른
182 ì‚¬ëžŒë“¤ì´ ë“œë¼ì´ë²„를 ì—…ë°ì´íŠ¸í•  것ì´ë‹¤.
183 - ì—¬ëŸ¬ë¶„ì˜ ë“œë¼ì´ë²„는 별다른 노력 ì—†ì´ ëª¨ë“  리눅스 ë°°í¬íŒì— ìžë™ì ìœ¼ë¡œ
184 ì¶”ê°€ë  ê²ƒì´ë‹¤.
185
186리눅스는 다른 ìš´ì˜ ì²´ì œë³´ë‹¤ "쉽게 쓸수 있는(out of the box)" ë§Žì€ ë‹¤ë¥¸ 장치들ì„
187지ì›í•˜ê³  ì–´ë–¤ 다른 ìš´ì˜ ì²´ì œë³´ë‹¤ 다양한 아키í…ì³ìœ„ì—ì„œ ì´ëŸ¬í•œ ìž¥ì¹˜ë“¤ì„ ì§€ì›í•˜ê¸° 때문ì—
188ì´ëŸ¬í•œ ì¦ëª…ëœ ê°œë°œ 모ë¸ì€ í‹€ë¦¼ì—†ì´ ë°”ë¡œ 가고 있는 것ì´ë‹¤.
189
190
191
192------
193
194ì´ ë¬¸ì„œì˜ ì´ˆì•ˆì„ ê²€í† í•´ì£¼ê³  코멘트 해준 Randy Dunlap, Andrew Morton, David Brownell,
195Hanna Linder, Robert Love, 그리고 Nishanth Aravamudanì—게 ê°ì‚¬í•œë‹¤.
diff --git a/Documentation/lguest/lguest.txt b/Documentation/lguest/lguest.txt
index 7885ab2d5f53..722d4e7fbebe 100644
--- a/Documentation/lguest/lguest.txt
+++ b/Documentation/lguest/lguest.txt
@@ -109,10 +109,6 @@ Running Lguest:
109 See http://linux-net.osdl.org/index.php/Bridge for general information 109 See http://linux-net.osdl.org/index.php/Bridge for general information
110 on how to get bridging working. 110 on how to get bridging working.
111 111
112- You can also create an inter-guest network using
113 "--sharenet=<filename>": any two guests using the same file are on
114 the same network. This file is created if it does not exist.
115
116There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest 112There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest
117 113
118Good luck! 114Good luck!
diff --git a/Documentation/nfsroot.txt b/Documentation/nfsroot.txt
index 16a7cae2721d..9b956a969362 100644
--- a/Documentation/nfsroot.txt
+++ b/Documentation/nfsroot.txt
@@ -92,8 +92,14 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
92 autoconfiguration. 92 autoconfiguration.
93 93
94 The <autoconf> parameter can appear alone as the value to the `ip' 94 The <autoconf> parameter can appear alone as the value to the `ip'
95 parameter (without all the ':' characters before) in which case auto- 95 parameter (without all the ':' characters before). If the value is
96 configuration is used. 96 "ip=off" or "ip=none", no autoconfiguration will take place, otherwise
97 autoconfiguration will take place. The most common way to use this
98 is "ip=dhcp".
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.
97 103
98 <client-ip> IP address of the client. 104 <client-ip> IP address of the client.
99 105
@@ -142,7 +148,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
142 into the kernel will be used, regardless of the value of 148 into the kernel will be used, regardless of the value of
143 this option. 149 this option.
144 150
145 off or none: don't use autoconfiguration (default) 151 off or none: don't use autoconfiguration
146 on or any: use any protocol available in the kernel 152 on or any: use any protocol available in the kernel
147 dhcp: use DHCP 153 dhcp: use DHCP
148 bootp: use BOOTP 154 bootp: use BOOTP
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index b89570c30434..6f31f0a247d0 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -34,6 +34,8 @@ Currently, these files are in /proc/sys/vm:
34- oom_kill_allocating_task 34- oom_kill_allocating_task
35- mmap_min_address 35- mmap_min_address
36- numa_zonelist_order 36- numa_zonelist_order
37- nr_hugepages
38- nr_overcommit_hugepages
37 39
38============================================================== 40==============================================================
39 41
@@ -305,3 +307,20 @@ will select "node" order in following case.
305 307
306Otherwise, "zone" order will be selected. Default order is recommended unless 308Otherwise, "zone" order will be selected. Default order is recommended unless
307this is causing problems for your system/application. 309this is causing problems for your system/application.
310
311==============================================================
312
313nr_hugepages
314
315Change the minimum size of the hugepage pool.
316
317See Documentation/vm/hugetlbpage.txt
318
319==============================================================
320
321nr_overcommit_hugepages
322
323Change the maximum size of the hugepage pool. The maximum is
324nr_hugepages + nr_overcommit_hugepages.
325
326See Documentation/vm/hugetlbpage.txt
diff --git a/Documentation/tipar.txt b/Documentation/tipar.txt
deleted file mode 100644
index 67133baef6ef..000000000000
--- a/Documentation/tipar.txt
+++ /dev/null
@@ -1,93 +0,0 @@
1
2 Parallel link cable for Texas Instruments handhelds
3 ===================================================
4
5
6Author: Romain Lievin
7Homepage: http://lpg.ticalc.org/prj_tidev/index.html
8
9
10INTRODUCTION:
11
12This is a driver for the very common home-made parallel link cable, a cable
13designed for connecting TI8x/9x graphing calculators (handhelds) to a computer
14or workstation (Alpha, Sparc). Given that driver is built on parport, the
15parallel port abstraction layer, this driver is architecture-independent.
16
17It can also be used with another device plugged on the same port (such as a
18ZIP drive). I have a 100MB ZIP and both of them work fine!
19
20If you need more information, please visit the 'TI drivers' homepage at the URL
21above.
22
23WHAT YOU NEED:
24
25A TI calculator and a program capable of communicating with your calculator.
26
27TiLP will work for sure (since I am its developer!). yal92 may be able to use
28it by changing tidev for tipar (may require some hacking...).
29
30HOW TO USE IT:
31
32You must have first compiled parport support (CONFIG_PARPORT_DEV): either
33compiled in your kernel, either as a module.
34
35Next, (as root):
36
37 modprobe parport
38 modprobe tipar
39
40If it is not already there (it usually is), create the device:
41
42 mknod /dev/tipar0 c 115 0
43 mknod /dev/tipar1 c 115 1
44 mknod /dev/tipar2 c 115 2
45
46You will have to set permissions on this device to allow you to read/write
47from it:
48
49 chmod 666 /dev/tipar[0..2]
50
51Now you are ready to run a linking program such as TiLP. Be sure to configure
52it properly (RTFM).
53
54MODULE PARAMETERS:
55
56 You can set these with: modprobe tipar NAME=VALUE
57 There is currently no way to set these on a per-cable basis.
58
59 NAME: timeout
60 TYPE: integer
61 DEFAULT: 15
62 DESC: Timeout value in tenth of seconds. If no data is available once this
63 time has expired then the driver will return with a timeout error.
64
65 NAME: delay
66 TYPE: integer
67 DEFAULT: 10
68 DESC: Inter-bit delay in micro-seconds. A lower value gives an higher data
69 rate but makes transmission less reliable.
70
71These parameters can be changed at run time by any program via ioctl(2) calls
72as listed in ./include/linux/ticable.h.
73
74Rather than write 50 pages describing the ioctl() and so on, it is
75perhaps more useful you look at ticables library (dev_link.c) that demonstrates
76how to use them, and demonstrates the features of the driver. This is
77probably a lot more useful to people interested in writing applications
78that will be using this driver.
79
80QUIRKS/BUGS:
81
82None.
83
84HOW TO CONTACT US:
85
86You can email me at roms@lpg.ticalc.org. Please prefix the subject line
87with "TIPAR: " so that I am certain to notice your message.
88You can also mail JB at jb@jblache.org. He packaged these drivers for Debian.
89
90CREDITS:
91
92The code is based on tidev.c & parport.c.
93The driver has been developed independently of Texas Instruments.
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index 51ccc48aa763..f962d01bea2a 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -30,9 +30,10 @@ alignment and size of the arguments to the above system calls.
30The output of "cat /proc/meminfo" will have lines like: 30The output of "cat /proc/meminfo" will have lines like:
31 31
32..... 32.....
33HugePages_Total: xxx 33HugePages_Total: vvv
34HugePages_Free: yyy 34HugePages_Free: www
35HugePages_Rsvd: www 35HugePages_Rsvd: xxx
36HugePages_Surp: yyy
36Hugepagesize: zzz kB 37Hugepagesize: zzz kB
37 38
38where: 39where:
@@ -42,6 +43,10 @@ allocated.
42HugePages_Rsvd is short for "reserved," and is the number of hugepages 43HugePages_Rsvd is short for "reserved," and is the number of hugepages
43for which a commitment to allocate from the pool has been made, but no 44for which a commitment to allocate from the pool has been made, but no
44allocation has yet been made. It's vaguely analogous to overcommit. 45allocation has yet been made. It's vaguely analogous to overcommit.
46HugePages_Surp is short for "surplus," and is the number of hugepages in
47the pool above the value in /proc/sys/vm/nr_hugepages. The maximum
48number of surplus hugepages is controlled by
49/proc/sys/vm/nr_overcommit_hugepages.
45 50
46/proc/filesystems should also show a filesystem of type "hugetlbfs" configured 51/proc/filesystems should also show a filesystem of type "hugetlbfs" configured
47in the kernel. 52in the kernel.
@@ -71,7 +76,25 @@ or failure of allocation depends on the amount of physically contiguous
71memory that is preset in system at this time. System administrators may want 76memory that is preset in system at this time. System administrators may want
72to put this command in one of the local rc init files. This will enable the 77to put this command in one of the local rc init files. This will enable the
73kernel to request huge pages early in the boot process (when the possibility 78kernel to request huge pages early in the boot process (when the possibility
74of getting physical contiguous pages is still very high). 79of getting physical contiguous pages is still very high). In either
80case, adminstrators will want to verify the number of hugepages actually
81allocated by checking the sysctl or meminfo.
82
83/proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of
84hugepages can grow, if more hugepages than /proc/sys/vm/nr_hugepages are
85requested by applications. echo'ing any non-zero value into this file
86indicates that the hugetlb subsystem is allowed to try to obtain
87hugepages from the buddy allocator, if the normal pool is exhausted. As
88these surplus hugepages go out of use, they are freed back to the buddy
89allocator.
90
91Caveat: Shrinking the pool via nr_hugepages while a surplus is in effect
92will allow the number of surplus huge pages to exceed the overcommit
93value, as the pool hugepages (which must have been in use for a surplus
94hugepages to be allocated) will become surplus hugepages. As long as
95this condition holds, however, no more surplus huge pages will be
96allowed on the system until one of the two sysctls are increased
97sufficiently, or the surplus huge pages go out of use and are freed.
75 98
76If the user applications are going to request hugepages using mmap system 99If the user applications are going to request hugepages using mmap system
77call, then it is required that system administrator mount a file system of 100call, then it is required that system administrator mount a file system of
@@ -94,8 +117,8 @@ provided on command line then no limits are set. For size and nr_inodes
94options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For 117options, you can use [G|g]/[M|m]/[K|k] to represent giga/mega/kilo. For
95example, size=2K has the same meaning as size=2048. 118example, size=2K has the same meaning as size=2048.
96 119
97read and write system calls are not supported on files that reside on hugetlb 120While read system calls are supported on files that reside on hugetlb
98file systems. 121file systems, write system calls are not.
99 122
100Regular chown, chgrp, and chmod commands (with right permissions) could be 123Regular chown, chgrp, and chmod commands (with right permissions) could be
101used to change the file attributes on hugetlbfs. 124used to change the file attributes on hugetlbfs.
diff --git a/MAINTAINERS b/MAINTAINERS
index 9507b4207512..3c7db6222f86 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2489,6 +2489,12 @@ M: mtk.manpages@gmail.com
2489W: ftp://ftp.kernel.org/pub/linux/docs/manpages 2489W: ftp://ftp.kernel.org/pub/linux/docs/manpages
2490S: Maintained 2490S: Maintained
2491 2491
2492MARVELL LIBERTAS WIRELESS DRIVER
2493P: Dan Williams
2494M: dcbw@redhat.com
2495L: libertas-dev@lists.infradead.org
2496S: Maintained
2497
2492MARVELL MV643XX ETHERNET DRIVER 2498MARVELL MV643XX ETHERNET DRIVER
2493P: Dale Farnsworth 2499P: Dale Farnsworth
2494M: dale@farnsworth.org 2500M: dale@farnsworth.org
@@ -2751,8 +2757,10 @@ S: Maintained
2751 2757
2752NFS CLIENT 2758NFS CLIENT
2753P: Trond Myklebust 2759P: Trond Myklebust
2754M: trond.myklebust@fys.uio.no 2760M: Trond.Myklebust@netapp.com
2755L: linux-kernel@vger.kernel.org 2761L: linux-nfs@vger.kernel.org
2762W: http://client.linux-nfs.org
2763T: git git://git.linux-nfs.org/pub/linux/nfs-2.6.git
2756S: Maintained 2764S: Maintained
2757 2765
2758NI5010 NETWORK DRIVER 2766NI5010 NETWORK DRIVER
@@ -3699,11 +3707,6 @@ M: nagar@watson.ibm.com
3699L: linux-kernel@vger.kernel.org 3707L: linux-kernel@vger.kernel.org
3700S: Maintained 3708S: Maintained
3701 3709
3702TI PARALLEL LINK CABLE DRIVER
3703P: Romain Lievin
3704M: roms@lpg.ticalc.org
3705S: Maintained
3706
3707TIPC NETWORK LAYER 3710TIPC NETWORK LAYER
3708P: Per Liden 3711P: Per Liden
3709M: per.liden@ericsson.com 3712M: per.liden@ericsson.com
diff --git a/Makefile b/Makefile
index c1825aab77e8..fbb8dfc063d3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 24 3SUBLEVEL = 24
4EXTRAVERSION = -rc5 4EXTRAVERSION = -rc6
5NAME = Arr Matey! A Hairy Bilge Rat! 5NAME = Arr Matey! A Hairy Bilge Rat!
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 63104ebd1806..4e1a8e2c4541 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -14,13 +14,13 @@ LDFLAGS_vmlinux := -static -N #-relax
14CHECKFLAGS += -D__alpha__ -m64 14CHECKFLAGS += -D__alpha__ -m64
15cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data 15cflags-y := -pipe -mno-fp-regs -ffixed-8 -msmall-data
16 16
17cpuflags-$(CONFIG_ALPHA_EV67) := -mcpu=ev67 17cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4
18cpuflags-$(CONFIG_ALPHA_EV6) := -mcpu=ev6 18cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5
19cpuflags-$(CONFIG_ALPHA_EV56) := -mcpu=ev56
19cpuflags-$(CONFIG_ALPHA_POLARIS) := -mcpu=pca56 20cpuflags-$(CONFIG_ALPHA_POLARIS) := -mcpu=pca56
20cpuflags-$(CONFIG_ALPHA_SX164) := -mcpu=pca56 21cpuflags-$(CONFIG_ALPHA_SX164) := -mcpu=pca56
21cpuflags-$(CONFIG_ALPHA_EV56) := -mcpu=ev56 22cpuflags-$(CONFIG_ALPHA_EV6) := -mcpu=ev6
22cpuflags-$(CONFIG_ALPHA_EV5) := -mcpu=ev5 23cpuflags-$(CONFIG_ALPHA_EV67) := -mcpu=ev67
23cpuflags-$(CONFIG_ALPHA_EV4) := -mcpu=ev4
24# If GENERIC, make sure to turn off any instruction set extensions that 24# If GENERIC, make sure to turn off any instruction set extensions that
25# the host compiler might have on by default. Given that EV4 and EV5 25# the host compiler might have on by default. Given that EV4 and EV5
26# have the same instruction set, prefer EV5 because an EV5 schedule is 26# have the same instruction set, prefer EV5 because an EV5 schedule is
diff --git a/arch/alpha/kernel/err_ev7.c b/arch/alpha/kernel/err_ev7.c
index bc799f72d8c1..68cd493f54c5 100644
--- a/arch/alpha/kernel/err_ev7.c
+++ b/arch/alpha/kernel/err_ev7.c
@@ -273,7 +273,7 @@ ev7_process_pal_subpacket(struct el_subpacket *header)
273struct el_subpacket_handler ev7_pal_subpacket_handler = 273struct el_subpacket_handler ev7_pal_subpacket_handler =
274 SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket); 274 SUBPACKET_HANDLER_INIT(EL_CLASS__PAL, ev7_process_pal_subpacket);
275 275
276void 276void __init
277ev7_register_error_handlers(void) 277ev7_register_error_handlers(void)
278{ 278{
279 int i; 279 int i;
diff --git a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c
index 497877bf2012..413bf37eb094 100644
--- a/arch/alpha/kernel/err_marvel.c
+++ b/arch/alpha/kernel/err_marvel.c
@@ -1152,7 +1152,7 @@ marvel_machine_check(u64 vector, u64 la_ptr)
1152 mb(); 1152 mb();
1153} 1153}
1154 1154
1155void 1155void __init
1156marvel_register_error_handlers(void) 1156marvel_register_error_handlers(void)
1157{ 1157{
1158 ev7_register_error_handlers(); 1158 ev7_register_error_handlers();
diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c
index 6f3867877d9e..257449ed15ef 100644
--- a/arch/alpha/kernel/err_titan.c
+++ b/arch/alpha/kernel/err_titan.c
@@ -564,7 +564,7 @@ static struct el_subpacket_handler titan_subpacket_handler =
564 SUBPACKET_HANDLER_INIT(EL_CLASS__REGATTA_FAMILY, 564 SUBPACKET_HANDLER_INIT(EL_CLASS__REGATTA_FAMILY,
565 el_process_regatta_subpacket); 565 el_process_regatta_subpacket);
566 566
567void 567void __init
568titan_register_error_handlers(void) 568titan_register_error_handlers(void)
569{ 569{
570 size_t i; 570 size_t i;
diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
index 0caa45aa128d..466c9dff8181 100644
--- a/arch/alpha/kernel/machvec_impl.h
+++ b/arch/alpha/kernel/machvec_impl.h
@@ -134,7 +134,7 @@
134#define __initmv __initdata 134#define __initmv __initdata
135#define ALIAS_MV(x) 135#define ALIAS_MV(x)
136#else 136#else
137#define __initmv 137#define __initmv __initdata_refok
138 138
139/* GCC actually has a syntax for defining aliases, but is under some 139/* GCC actually has a syntax for defining aliases, but is under some
140 delusion that you shouldn't be able to declare it extern somewhere 140 delusion that you shouldn't be able to declare it extern somewhere
diff --git a/arch/alpha/lib/ev6-stxncpy.S b/arch/alpha/lib/ev6-stxncpy.S
index b581a7af2456..1aa6e97e04b5 100644
--- a/arch/alpha/lib/ev6-stxncpy.S
+++ b/arch/alpha/lib/ev6-stxncpy.S
@@ -362,10 +362,10 @@ $unaligned:
362 362
363 extql t2, a1, t2 # U : 363 extql t2, a1, t2 # U :
364 cmpbge zero, t1, t8 # E : is there a zero? 364 cmpbge zero, t1, t8 # E : is there a zero?
365 andnot t2, t6, t12 # E : dest mask for a single word copy 365 andnot t2, t6, t2 # E : dest mask for a single word copy
366 or t8, t10, t5 # E : test for end-of-count too 366 or t8, t10, t5 # E : test for end-of-count too
367 367
368 cmpbge zero, t12, t3 # E : 368 cmpbge zero, t2, t3 # E :
369 cmoveq a2, t5, t8 # E : Latency=2, extra map slot 369 cmoveq a2, t5, t8 # E : Latency=2, extra map slot
370 nop # E : keep with cmoveq 370 nop # E : keep with cmoveq
371 andnot t8, t3, t8 # E : (stall) 371 andnot t8, t3, t8 # E : (stall)
@@ -379,13 +379,13 @@ $unaligned:
379 negq t8, t6 # E : build bitmask of bytes <= zero 379 negq t8, t6 # E : build bitmask of bytes <= zero
380 mskqh t1, t4, t1 # U : 380 mskqh t1, t4, t1 # U :
381 381
382 and t6, t8, t2 # E : 382 and t6, t8, t12 # E :
383 subq t2, 1, t6 # E : (stall) 383 subq t12, 1, t6 # E : (stall)
384 or t6, t2, t8 # E : (stall) 384 or t6, t12, t8 # E : (stall)
385 zapnot t12, t8, t12 # U : prepare source word; mirror changes (stall) 385 zapnot t2, t8, t2 # U : prepare source word; mirror changes (stall)
386 386
387 zapnot t1, t8, t1 # U : to source validity mask 387 zapnot t1, t8, t1 # U : to source validity mask
388 andnot t0, t12, t0 # E : zero place for source to reside 388 andnot t0, t2, t0 # E : zero place for source to reside
389 or t0, t1, t0 # E : and put it there (stall both t0, t1) 389 or t0, t1, t0 # E : and put it there (stall both t0, t1)
390 stq_u t0, 0(a0) # L : (stall) 390 stq_u t0, 0(a0) # L : (stall)
391 391
diff --git a/arch/alpha/lib/strncpy.S b/arch/alpha/lib/strncpy.S
index bbdef1be5f95..a46f7f3ad8c7 100644
--- a/arch/alpha/lib/strncpy.S
+++ b/arch/alpha/lib/strncpy.S
@@ -35,7 +35,7 @@ strncpy:
35 35
36 or $3, $24, $3 # clear the bits between the last 36 or $3, $24, $3 # clear the bits between the last
37 or $4, $27, $4 # written byte and the last byte in COUNT 37 or $4, $27, $4 # written byte and the last byte in COUNT
38 andnot $4, $3, $4 38 andnot $3, $4, $4
39 zap $1, $4, $1 39 zap $1, $4, $1
40 40
41 stq_u $1, 0($16) 41 stq_u $1, 0($16)
diff --git a/arch/alpha/lib/stxncpy.S b/arch/alpha/lib/stxncpy.S
index da1a72740d29..3dece25283a3 100644
--- a/arch/alpha/lib/stxncpy.S
+++ b/arch/alpha/lib/stxncpy.S
@@ -315,9 +315,9 @@ $unaligned:
315 315
316 extql t2, a1, t2 # e0 : 316 extql t2, a1, t2 # e0 :
317 cmpbge zero, t1, t8 # .. e1 : is there a zero? 317 cmpbge zero, t1, t8 # .. e1 : is there a zero?
318 andnot t2, t6, t12 # e0 : dest mask for a single word copy 318 andnot t2, t6, t2 # e0 : dest mask for a single word copy
319 or t8, t10, t5 # .. e1 : test for end-of-count too 319 or t8, t10, t5 # .. e1 : test for end-of-count too
320 cmpbge zero, t12, t3 # e0 : 320 cmpbge zero, t2, t3 # e0 :
321 cmoveq a2, t5, t8 # .. e1 : 321 cmoveq a2, t5, t8 # .. e1 :
322 andnot t8, t3, t8 # e0 : 322 andnot t8, t3, t8 # e0 :
323 beq t8, $u_head # .. e1 (zdb) 323 beq t8, $u_head # .. e1 (zdb)
@@ -330,14 +330,14 @@ $unaligned:
330 ldq_u t0, 0(a0) # e0 : 330 ldq_u t0, 0(a0) # e0 :
331 negq t8, t6 # .. e1 : build bitmask of bytes <= zero 331 negq t8, t6 # .. e1 : build bitmask of bytes <= zero
332 mskqh t1, t4, t1 # e0 : 332 mskqh t1, t4, t1 # e0 :
333 and t6, t8, t2 # .. e1 : 333 and t6, t8, t12 # .. e1 :
334 subq t2, 1, t6 # e0 : 334 subq t12, 1, t6 # e0 :
335 or t6, t2, t8 # e1 : 335 or t6, t12, t8 # e1 :
336 336
337 zapnot t12, t8, t12 # e0 : prepare source word; mirror changes 337 zapnot t2, t8, t2 # e0 : prepare source word; mirror changes
338 zapnot t1, t8, t1 # .. e1 : to source validity mask 338 zapnot t1, t8, t1 # .. e1 : to source validity mask
339 339
340 andnot t0, t12, t0 # e0 : zero place for source to reside 340 andnot t0, t2, t0 # e0 : zero place for source to reside
341 or t0, t1, t0 # e1 : and put it there 341 or t0, t1, t0 # e1 : and put it there
342 stq_u t0, 0(a0) # e0 : 342 stq_u t0, 0(a0) # e0 :
343 ret (t9) # .. e1 : 343 ret (t9) # .. e1 :
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a7e9fea978a6..c4de2d4664d7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -537,7 +537,7 @@ config ISA_DMA_API
537 bool 537 bool
538 538
539config PCI 539config PCI
540 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_IXP4XX || ARCH_KS8695 540 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_IXP4XX || ARCH_KS8695 || MACH_ARMCORE
541 help 541 help
542 Find out whether you have a PCI motherboard. PCI is the name of a 542 Find out whether you have a PCI motherboard. PCI is the name of a
543 bus system, i.e. the way the CPU talks to the other stuff inside 543 bus system, i.e. the way the CPU talks to the other stuff inside
@@ -558,6 +558,12 @@ config PCI_HOST_VIA82C505
558 depends on PCI && ARCH_SHARK 558 depends on PCI && ARCH_SHARK
559 default y 559 default y
560 560
561config PCI_HOST_ITE8152
562 bool
563 depends on PCI && MACH_ARMCORE
564 default y
565 select DMABOUNCE
566
561source "drivers/pci/Kconfig" 567source "drivers/pci/Kconfig"
562 568
563source "drivers/pcmcia/Kconfig" 569source "drivers/pcmcia/Kconfig"
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index b9b03eda70e5..5cac46a19bb7 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -31,7 +31,7 @@
31 .macro loadsp, rb 31 .macro loadsp, rb
32 .endm 32 .endm
33 .macro writeb, ch, rb 33 .macro writeb, ch, rb
34 mcr p14, 0, \ch, c0, c1, 0 34 mcr p14, 0, \ch, c1, c0, 0
35 .endm 35 .endm
36#endif 36#endif
37 37
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index c03de9bfd76b..97b7dc13d9aa 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -70,8 +70,6 @@ static inline void it8152_irq(int irq)
70{ 70{
71 struct irq_desc *desc; 71 struct irq_desc *desc;
72 72
73 printk(KERN_DEBUG "===> %s: irq=%d\n", __FUNCTION__, irq);
74
75 desc = irq_desc + irq; 73 desc = irq_desc + irq;
76 desc_handle_irq(irq, desc); 74 desc_handle_irq(irq, desc);
77} 75}
@@ -106,8 +104,6 @@ void it8152_irq_demux(unsigned int irq, struct irq_desc *desc)
106 int bits_pd, bits_lp, bits_ld; 104 int bits_pd, bits_lp, bits_ld;
107 int i; 105 int i;
108 106
109 printk(KERN_DEBUG "=> %s: irq = %d\n", __FUNCTION__, irq);
110
111 while (1) { 107 while (1) {
112 /* Read all */ 108 /* Read all */
113 bits_pd = __raw_readl(IT8152_INTC_PDCNIRR); 109 bits_pd = __raw_readl(IT8152_INTC_PDCNIRR);
@@ -293,8 +289,7 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
293 */ 289 */
294int pci_set_dma_mask(struct pci_dev *dev, u64 mask) 290int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
295{ 291{
296 printk(KERN_DEBUG "%s: %s %llx\n", 292 dev_dbg(&dev->dev, "%s: %llx\n", __FUNCTION__, mask);
297 __FUNCTION__, dev->dev.bus_id, mask);
298 if (mask >= PHYS_OFFSET + SZ_64M - 1) 293 if (mask >= PHYS_OFFSET + SZ_64M - 1)
299 return 0; 294 return 0;
300 295
@@ -304,8 +299,7 @@ int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
304int 299int
305pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask) 300pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
306{ 301{
307 printk(KERN_DEBUG "%s: %s %llx\n", 302 dev_dbg(&dev->dev, "%s: %llx\n", __FUNCTION__, mask);
308 __FUNCTION__, dev->dev.bus_id, mask);
309 if (mask >= PHYS_OFFSET + SZ_64M - 1) 303 if (mask >= PHYS_OFFSET + SZ_64M - 1)
310 return 0; 304 return 0;
311 305
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index c1271c449246..f6d66dce6852 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -442,7 +442,8 @@ static int ixp4xx_set_next_event(unsigned long evt,
442static void ixp4xx_set_mode(enum clock_event_mode mode, 442static void ixp4xx_set_mode(enum clock_event_mode mode,
443 struct clock_event_device *evt) 443 struct clock_event_device *evt)
444{ 444{
445 unsigned long opts, osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK; 445 unsigned long opts = *IXP4XX_OSRT1 & IXP4XX_OST_RELOAD_MASK;
446 unsigned long osrt = *IXP4XX_OSRT1 & ~IXP4XX_OST_RELOAD_MASK;
446 447
447 switch (mode) { 448 switch (mode) {
448 case CLOCK_EVT_MODE_PERIODIC: 449 case CLOCK_EVT_MODE_PERIODIC:
@@ -455,12 +456,15 @@ static void ixp4xx_set_mode(enum clock_event_mode mode,
455 opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT; 456 opts = IXP4XX_OST_ENABLE | IXP4XX_OST_ONE_SHOT;
456 break; 457 break;
457 case CLOCK_EVT_MODE_SHUTDOWN: 458 case CLOCK_EVT_MODE_SHUTDOWN:
459 opts &= ~IXP4XX_OST_ENABLE;
460 break;
461 case CLOCK_EVT_MODE_RESUME:
462 opts |= IXP4XX_OST_ENABLE;
463 break;
458 case CLOCK_EVT_MODE_UNUSED: 464 case CLOCK_EVT_MODE_UNUSED:
459 default: 465 default:
460 osrt = opts = 0; 466 osrt = opts = 0;
461 break; 467 break;
462 case CLOCK_EVT_MODE_RESUME:
463 break;
464 } 468 }
465 469
466 *IXP4XX_OSRT1 = osrt | opts; 470 *IXP4XX_OSRT1 = osrt | opts;
diff --git a/arch/arm/mach-pxa/cm-x270-pci.c b/arch/arm/mach-pxa/cm-x270-pci.c
index 878d3b9b8633..15c4e0df3e10 100644
--- a/arch/arm/mach-pxa/cm-x270-pci.c
+++ b/arch/arm/mach-pxa/cm-x270-pci.c
@@ -40,7 +40,7 @@ void __init cmx270_pci_adjust_zones(int node, unsigned long *zone_size,
40{ 40{
41 unsigned int sz = SZ_64M >> PAGE_SHIFT; 41 unsigned int sz = SZ_64M >> PAGE_SHIFT;
42 42
43 printk(KERN_INFO "Adjusting zones for CM-x270\n"); 43 pr_info("Adjusting zones for CM-x270\n");
44 44
45 /* 45 /*
46 * Only adjust if > 64M on current system 46 * Only adjust if > 64M on current system
@@ -104,8 +104,7 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
104{ 104{
105 int irq; 105 int irq;
106 106
107 printk(KERN_DEBUG "===> %s: %s slot=%x, pin=%x\n", __FUNCTION__, 107 dev_dbg(&dev->dev, "%s: slot=%x, pin=%x\n", __FUNCTION__, slot, pin);
108 pci_name(dev), slot, pin);
109 108
110 irq = it8152_pci_map_irq(dev, slot, pin); 109 irq = it8152_pci_map_irq(dev, slot, pin);
111 if (irq) 110 if (irq)
@@ -141,14 +140,13 @@ static int __init cmx270_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
141 return(0); 140 return(0);
142} 141}
143 142
144static struct pci_bus * __init 143static void cmx270_pci_preinit(void)
145cmx270_pci_scan_bus(int nr, struct pci_sys_data *sys)
146{ 144{
147 printk(KERN_INFO "Initializing CM-X270 PCI subsystem\n"); 145 pr_info("Initializing CM-X270 PCI subsystem\n");
148 146
149 __raw_writel(0x800, IT8152_PCI_CFG_ADDR); 147 __raw_writel(0x800, IT8152_PCI_CFG_ADDR);
150 if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) { 148 if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) {
151 printk(KERN_INFO "PCI Bridge found.\n"); 149 pr_info("PCI Bridge found.\n");
152 150
153 /* set PCI I/O base at 0 */ 151 /* set PCI I/O base at 0 */
154 writel(0x848, IT8152_PCI_CFG_ADDR); 152 writel(0x848, IT8152_PCI_CFG_ADDR);
@@ -163,7 +161,7 @@ cmx270_pci_scan_bus(int nr, struct pci_sys_data *sys)
163 /* CardBus Controller on ATXbase baseboard */ 161 /* CardBus Controller on ATXbase baseboard */
164 writel(0x4000, IT8152_PCI_CFG_ADDR); 162 writel(0x4000, IT8152_PCI_CFG_ADDR);
165 if (readl(IT8152_PCI_CFG_DATA) == 0xAC51104C) { 163 if (readl(IT8152_PCI_CFG_DATA) == 0xAC51104C) {
166 printk(KERN_INFO "CardBus Bridge found.\n"); 164 pr_info("CardBus Bridge found.\n");
167 165
168 /* Configure socket 0 */ 166 /* Configure socket 0 */
169 writel(0x408C, IT8152_PCI_CFG_ADDR); 167 writel(0x408C, IT8152_PCI_CFG_ADDR);
@@ -196,7 +194,6 @@ cmx270_pci_scan_bus(int nr, struct pci_sys_data *sys)
196 writel(0xb0000000, IT8152_PCI_CFG_DATA); 194 writel(0xb0000000, IT8152_PCI_CFG_DATA);
197 } 195 }
198 } 196 }
199 return it8152_pci_scan_bus(nr, sys);
200} 197}
201 198
202static struct hw_pci cmx270_pci __initdata = { 199static struct hw_pci cmx270_pci __initdata = {
@@ -204,7 +201,8 @@ static struct hw_pci cmx270_pci __initdata = {
204 .map_irq = cmx270_pci_map_irq, 201 .map_irq = cmx270_pci_map_irq,
205 .nr_controllers = 1, 202 .nr_controllers = 1,
206 .setup = it8152_pci_setup, 203 .setup = it8152_pci_setup,
207 .scan = cmx270_pci_scan_bus, 204 .scan = it8152_pci_scan_bus,
205 .preinit = cmx270_pci_preinit,
208}; 206};
209 207
210static int __init cmx270_init_pci(void) 208static int __init cmx270_init_pci(void)
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index bc859a311eaf..45bf04eb7d70 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -2034,7 +2034,8 @@ sba_init(void)
2034 if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb")) 2034 if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb"))
2035 return 0; 2035 return 0;
2036 2036
2037#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP) 2037#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP) && \
2038 defined(CONFIG_PROC_FS)
2038 /* If we are booting a kdump kernel, the sba_iommu will 2039 /* If we are booting a kdump kernel, the sba_iommu will
2039 * cause devices that were not shutdown properly to MCA 2040 * cause devices that were not shutdown properly to MCA
2040 * as soon as they are turned back on. Our only option for 2041 * as soon as they are turned back on. Our only option for
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
index f6ae3ec93810..3e35987af458 100644
--- a/arch/ia64/ia32/binfmt_elf32.c
+++ b/arch/ia64/ia32/binfmt_elf32.c
@@ -52,33 +52,29 @@ extern struct page *ia32_shared_page[];
52extern unsigned long *ia32_gdt; 52extern unsigned long *ia32_gdt;
53extern struct page *ia32_gate_page; 53extern struct page *ia32_gate_page;
54 54
55struct page * 55int
56ia32_install_shared_page (struct vm_area_struct *vma, unsigned long address, int *type) 56ia32_install_shared_page (struct vm_area_struct *vma, struct vm_fault *vmf)
57{ 57{
58 struct page *pg = ia32_shared_page[smp_processor_id()]; 58 vmf->page = ia32_shared_page[smp_processor_id()];
59 get_page(pg); 59 get_page(vmf->page);
60 if (type) 60 return 0;
61 *type = VM_FAULT_MINOR;
62 return pg;
63} 61}
64 62
65struct page * 63int
66ia32_install_gate_page (struct vm_area_struct *vma, unsigned long address, int *type) 64ia32_install_gate_page (struct vm_area_struct *vma, struct vm_fault *vmf)
67{ 65{
68 struct page *pg = ia32_gate_page; 66 vmf->page = ia32_gate_page;
69 get_page(pg); 67 get_page(vmf->page);
70 if (type) 68 return 0;
71 *type = VM_FAULT_MINOR;
72 return pg;
73} 69}
74 70
75 71
76static struct vm_operations_struct ia32_shared_page_vm_ops = { 72static struct vm_operations_struct ia32_shared_page_vm_ops = {
77 .nopage = ia32_install_shared_page 73 .fault = ia32_install_shared_page
78}; 74};
79 75
80static struct vm_operations_struct ia32_gate_page_vm_ops = { 76static struct vm_operations_struct ia32_gate_page_vm_ops = {
81 .nopage = ia32_install_gate_page 77 .fault = ia32_install_gate_page
82}; 78};
83 79
84void 80void
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 4e5e27540e27..d3a41d5f8d12 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1176,6 +1176,7 @@ tlb_purge_done:
1176 RESTORE_REG(cr.dcr, r25, r17);; 1176 RESTORE_REG(cr.dcr, r25, r17);;
1177 RESTORE_REG(cr.iva, r25, r17);; 1177 RESTORE_REG(cr.iva, r25, r17);;
1178 RESTORE_REG(cr.pta, r25, r17);; 1178 RESTORE_REG(cr.pta, r25, r17);;
1179 srlz.d;; // required not to violate RAW dependency
1179 RESTORE_REG(cr.itv, r25, r17);; 1180 RESTORE_REG(cr.itv, r25, r17);;
1180 RESTORE_REG(cr.pmv, r25, r17);; 1181 RESTORE_REG(cr.pmv, r25, r17);;
1181 RESTORE_REG(cr.cmcv, r25, r17);; 1182 RESTORE_REG(cr.cmcv, r25, r17);;
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 00a4599e5f47..0b52f19ed046 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -200,7 +200,7 @@ assign_irq_vector (int irq)
200{ 200{
201 unsigned long flags; 201 unsigned long flags;
202 int vector, cpu; 202 int vector, cpu;
203 cpumask_t domain; 203 cpumask_t domain = CPU_MASK_NONE;
204 204
205 vector = -ENOSPC; 205 vector = -ENOSPC;
206 206
@@ -340,7 +340,7 @@ int create_irq(void)
340{ 340{
341 unsigned long flags; 341 unsigned long flags;
342 int irq, vector, cpu; 342 int irq, vector, cpu;
343 cpumask_t domain; 343 cpumask_t domain = CPU_MASK_NONE;
344 344
345 irq = vector = -ENOSPC; 345 irq = vector = -ENOSPC;
346 spin_lock_irqsave(&vector_lock, flags); 346 spin_lock_irqsave(&vector_lock, flags);
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 10b48cd15a87..6dbf5919d2d0 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -75,6 +75,7 @@
75#include <linux/workqueue.h> 75#include <linux/workqueue.h>
76#include <linux/cpumask.h> 76#include <linux/cpumask.h>
77#include <linux/kdebug.h> 77#include <linux/kdebug.h>
78#include <linux/cpu.h>
78 79
79#include <asm/delay.h> 80#include <asm/delay.h>
80#include <asm/machvec.h> 81#include <asm/machvec.h>
@@ -1813,6 +1814,36 @@ ia64_mca_cpu_init(void *cpu_data)
1813 PAGE_KERNEL)); 1814 PAGE_KERNEL));
1814} 1815}
1815 1816
1817static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy)
1818{
1819 unsigned long flags;
1820
1821 local_irq_save(flags);
1822 if (!cmc_polling_enabled)
1823 ia64_mca_cmc_vector_enable(NULL);
1824 local_irq_restore(flags);
1825}
1826
1827static int __cpuinit mca_cpu_callback(struct notifier_block *nfb,
1828 unsigned long action,
1829 void *hcpu)
1830{
1831 int hotcpu = (unsigned long) hcpu;
1832
1833 switch (action) {
1834 case CPU_ONLINE:
1835 case CPU_ONLINE_FROZEN:
1836 smp_call_function_single(hotcpu, ia64_mca_cmc_vector_adjust,
1837 NULL, 1, 0);
1838 break;
1839 }
1840 return NOTIFY_OK;
1841}
1842
1843static struct notifier_block mca_cpu_notifier __cpuinitdata = {
1844 .notifier_call = mca_cpu_callback
1845};
1846
1816/* 1847/*
1817 * ia64_mca_init 1848 * ia64_mca_init
1818 * 1849 *
@@ -1996,6 +2027,8 @@ ia64_mca_late_init(void)
1996 if (!mca_init) 2027 if (!mca_init)
1997 return 0; 2028 return 0;
1998 2029
2030 register_hotcpu_notifier(&mca_cpu_notifier);
2031
1999 /* Setup the CMCI/P vector and handler */ 2032 /* Setup the CMCI/P vector and handler */
2000 init_timer(&cmc_poll_timer); 2033 init_timer(&cmc_poll_timer);
2001 cmc_poll_timer.function = ia64_mca_cmc_poll; 2034 cmc_poll_timer.function = ia64_mca_cmc_poll;
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 2418289ee5ca..7377d323131d 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -27,6 +27,7 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/kdebug.h> 29#include <linux/kdebug.h>
30#include <linux/utsname.h>
30 31
31#include <asm/cpu.h> 32#include <asm/cpu.h>
32#include <asm/delay.h> 33#include <asm/delay.h>
@@ -107,8 +108,9 @@ show_regs (struct pt_regs *regs)
107 print_modules(); 108 print_modules();
108 printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current), 109 printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
109 smp_processor_id(), current->comm); 110 smp_processor_id(), current->comm);
110 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n", 111 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
111 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted()); 112 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
113 init_utsname()->release);
112 print_symbol("ip is at %s\n", ip); 114 print_symbol("ip is at %s\n", ip);
113 printk("unat: %016lx pfs : %016lx rsc : %016lx\n", 115 printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
114 regs->ar_unat, regs->ar_pfs, regs->ar_rsc); 116 regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
@@ -737,6 +739,7 @@ flush_thread (void)
737 ia32_drop_ia64_partial_page_list(current); 739 ia32_drop_ia64_partial_page_list(current);
738 current->thread.task_size = IA32_PAGE_OFFSET; 740 current->thread.task_size = IA32_PAGE_OFFSET;
739 set_fs(USER_DS); 741 set_fs(USER_DS);
742 memset(current->thread.tls_array, 0, sizeof(current->thread.tls_array));
740 } 743 }
741#endif 744#endif
742} 745}
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 4c730099d58f..309da3567bc8 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -280,15 +280,7 @@ setup_sigcontext (struct sigcontext __user *sc, sigset_t *mask, struct sigscratc
280 err |= __copy_to_user(&sc->sc_gr[15], &scr->pt.r15, 8); /* r15 */ 280 err |= __copy_to_user(&sc->sc_gr[15], &scr->pt.r15, 8); /* r15 */
281 err |= __put_user(scr->pt.cr_iip + ia64_psr(&scr->pt)->ri, &sc->sc_ip); 281 err |= __put_user(scr->pt.cr_iip + ia64_psr(&scr->pt)->ri, &sc->sc_ip);
282 282
283 if (flags & IA64_SC_FLAG_IN_SYSCALL) { 283 if (!(flags & IA64_SC_FLAG_IN_SYSCALL)) {
284 /* Clear scratch registers if the signal interrupted a system call. */
285 err |= __put_user(0, &sc->sc_ar_ccv); /* ar.ccv */
286 err |= __put_user(0, &sc->sc_br[7]); /* b7 */
287 err |= __put_user(0, &sc->sc_gr[14]); /* r14 */
288 err |= __clear_user(&sc->sc_ar25, 2*8); /* ar.csd & ar.ssd */
289 err |= __clear_user(&sc->sc_gr[2], 2*8); /* r2-r3 */
290 err |= __clear_user(&sc->sc_gr[16], 16*8); /* r16-r31 */
291 } else {
292 /* Copy scratch regs to sigcontext if the signal didn't interrupt a syscall. */ 284 /* Copy scratch regs to sigcontext if the signal didn't interrupt a syscall. */
293 err |= __put_user(scr->pt.ar_ccv, &sc->sc_ar_ccv); /* ar.ccv */ 285 err |= __put_user(scr->pt.ar_ccv, &sc->sc_ar_ccv); /* ar.ccv */
294 err |= __put_user(scr->pt.b7, &sc->sc_br[7]); /* b7 */ 286 err |= __put_user(scr->pt.b7, &sc->sc_br[7]); /* b7 */
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index a7be4f203420..2a90c32024f4 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -118,7 +118,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
118 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++) 118 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
119 SetPageUncached(&page[i]); 119 SetPageUncached(&page[i]);
120 120
121 flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE); 121 flush_tlb_kernel_range(uc_addr, uc_addr + IA64_GRANULE_SIZE);
122 122
123 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); 123 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
124 if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) { 124 if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) {
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index cef164729db7..655da240d13c 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -10,6 +10,7 @@
10 * IPI based ptc implementation and A-step IPI implementation. 10 * IPI based ptc implementation and A-step IPI implementation.
11 * Rohit Seth <rohit.seth@intel.com> 11 * Rohit Seth <rohit.seth@intel.com>
12 * Ken Chen <kenneth.w.chen@intel.com> 12 * Ken Chen <kenneth.w.chen@intel.com>
13 * Christophe de Dinechin <ddd@hp.com>: Avoid ptc.e on memory allocation
13 */ 14 */
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -89,9 +90,16 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
89{ 90{
90 static DEFINE_SPINLOCK(ptcg_lock); 91 static DEFINE_SPINLOCK(ptcg_lock);
91 92
92 if (mm != current->active_mm || !current->mm) { 93 struct mm_struct *active_mm = current->active_mm;
93 flush_tlb_all(); 94
94 return; 95 if (mm != active_mm) {
96 /* Restore region IDs for mm */
97 if (mm && active_mm) {
98 activate_context(mm);
99 } else {
100 flush_tlb_all();
101 return;
102 }
95 } 103 }
96 104
97 /* HW requires global serialization of ptc.ga. */ 105 /* HW requires global serialization of ptc.ga. */
@@ -107,6 +115,10 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
107 } while (start < end); 115 } while (start < end);
108 } 116 }
109 spin_unlock(&ptcg_lock); 117 spin_unlock(&ptcg_lock);
118
119 if (mm != active_mm) {
120 activate_context(active_mm);
121 }
110} 122}
111 123
112void 124void
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index b362d6d6a8c8..9456d4034024 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -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) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/module.h> 9#include <linux/module.h>
@@ -227,7 +227,7 @@ retry_bteop:
227 BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na)); 227 BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na));
228 228
229 if (transfer_stat & IBLS_ERROR) { 229 if (transfer_stat & IBLS_ERROR) {
230 bte_status = transfer_stat & ~IBLS_ERROR; 230 bte_status = BTE_GET_ERROR_STATUS(transfer_stat);
231 } else { 231 } else {
232 bte_status = BTE_SUCCESS; 232 bte_status = BTE_SUCCESS;
233 } 233 }
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c
index 27c5936ccfe9..4cb09f3f1efc 100644
--- a/arch/ia64/sn/kernel/bte_error.c
+++ b/arch/ia64/sn/kernel/bte_error.c
@@ -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) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
@@ -148,7 +148,11 @@ int shub2_bte_error_handler(unsigned long _nodepda)
148 for (i = 0; i < BTES_PER_NODE; i++) { 148 for (i = 0; i < BTES_PER_NODE; i++) {
149 bte = &err_nodepda->bte_if[i]; 149 bte = &err_nodepda->bte_if[i];
150 status = BTE_LNSTAT_LOAD(bte); 150 status = BTE_LNSTAT_LOAD(bte);
151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY)) 151 if (status & IBLS_ERROR) {
152 bte->bh_error = BTE_SHUB2_ERROR(status);
153 continue;
154 }
155 if (!(status & IBLS_BUSY))
152 continue; 156 continue;
153 mod_timer(recovery_timer, jiffies + (HZ * 5)); 157 mod_timer(recovery_timer, jiffies + (HZ * 5));
154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 158 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index cee9379d44e0..e1a3e19d3d9c 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -41,7 +41,7 @@
41 * } else 41 * } else
42 * do desired mmr access 42 * do desired mmr access
43 * 43 *
44 * According to hw, we can use reads instead of writes to the above addres 44 * According to hw, we can use reads instead of writes to the above address
45 * 45 *
46 * Note this WAR can only to be used for accessing internal MMR's in the 46 * Note this WAR can only to be used for accessing internal MMR's in the
47 * TIOCE Coretalk Address Range 0x0 - 0x07ff_ffff. This includes the 47 * TIOCE Coretalk Address Range 0x0 - 0x07ff_ffff. This includes the
diff --git a/arch/mips/au1000/Kconfig b/arch/mips/au1000/Kconfig
index 05d1354aad3a..1fe97cccead1 100644
--- a/arch/mips/au1000/Kconfig
+++ b/arch/mips/au1000/Kconfig
@@ -7,7 +7,6 @@ config MIPS_MTX1
7 bool "4G Systems MTX-1 board" 7 bool "4G Systems MTX-1 board"
8 select DMA_NONCOHERENT 8 select DMA_NONCOHERENT
9 select HW_HAS_PCI 9 select HW_HAS_PCI
10 select RESOURCES_64BIT if PCI
11 select SOC_AU1500 10 select SOC_AU1500
12 select SYS_SUPPORTS_LITTLE_ENDIAN 11 select SYS_SUPPORTS_LITTLE_ENDIAN
13 12
@@ -22,7 +21,6 @@ config MIPS_DB1000
22 select SOC_AU1000 21 select SOC_AU1000
23 select DMA_NONCOHERENT 22 select DMA_NONCOHERENT
24 select HW_HAS_PCI 23 select HW_HAS_PCI
25 select RESOURCES_64BIT if PCI
26 select SYS_SUPPORTS_LITTLE_ENDIAN 24 select SYS_SUPPORTS_LITTLE_ENDIAN
27 25
28config MIPS_DB1100 26config MIPS_DB1100
@@ -44,7 +42,6 @@ config MIPS_DB1500
44 select DMA_NONCOHERENT 42 select DMA_NONCOHERENT
45 select HW_HAS_PCI 43 select HW_HAS_PCI
46 select MIPS_DISABLE_OBSOLETE_IDE 44 select MIPS_DISABLE_OBSOLETE_IDE
47 select RESOURCES_64BIT if PCI
48 select SYS_SUPPORTS_BIG_ENDIAN 45 select SYS_SUPPORTS_BIG_ENDIAN
49 select SYS_SUPPORTS_LITTLE_ENDIAN 46 select SYS_SUPPORTS_LITTLE_ENDIAN
50 47
@@ -54,7 +51,6 @@ config MIPS_DB1550
54 select HW_HAS_PCI 51 select HW_HAS_PCI
55 select DMA_NONCOHERENT 52 select DMA_NONCOHERENT
56 select MIPS_DISABLE_OBSOLETE_IDE 53 select MIPS_DISABLE_OBSOLETE_IDE
57 select RESOURCES_64BIT if PCI
58 select SYS_SUPPORTS_LITTLE_ENDIAN 54 select SYS_SUPPORTS_LITTLE_ENDIAN
59 55
60config MIPS_MIRAGE 56config MIPS_MIRAGE
@@ -68,7 +64,6 @@ config MIPS_PB1000
68 select SOC_AU1000 64 select SOC_AU1000
69 select DMA_NONCOHERENT 65 select DMA_NONCOHERENT
70 select HW_HAS_PCI 66 select HW_HAS_PCI
71 select RESOURCES_64BIT if PCI
72 select SWAP_IO_SPACE 67 select SWAP_IO_SPACE
73 select SYS_SUPPORTS_LITTLE_ENDIAN 68 select SYS_SUPPORTS_LITTLE_ENDIAN
74 69
@@ -77,7 +72,6 @@ config MIPS_PB1100
77 select SOC_AU1100 72 select SOC_AU1100
78 select DMA_NONCOHERENT 73 select DMA_NONCOHERENT
79 select HW_HAS_PCI 74 select HW_HAS_PCI
80 select RESOURCES_64BIT if PCI
81 select SWAP_IO_SPACE 75 select SWAP_IO_SPACE
82 select SYS_SUPPORTS_LITTLE_ENDIAN 76 select SYS_SUPPORTS_LITTLE_ENDIAN
83 77
@@ -86,7 +80,6 @@ config MIPS_PB1200
86 select SOC_AU1200 80 select SOC_AU1200
87 select DMA_NONCOHERENT 81 select DMA_NONCOHERENT
88 select MIPS_DISABLE_OBSOLETE_IDE 82 select MIPS_DISABLE_OBSOLETE_IDE
89 select RESOURCES_64BIT if PCI
90 select SYS_SUPPORTS_LITTLE_ENDIAN 83 select SYS_SUPPORTS_LITTLE_ENDIAN
91 84
92config MIPS_PB1500 85config MIPS_PB1500
@@ -94,7 +87,6 @@ config MIPS_PB1500
94 select SOC_AU1500 87 select SOC_AU1500
95 select DMA_NONCOHERENT 88 select DMA_NONCOHERENT
96 select HW_HAS_PCI 89 select HW_HAS_PCI
97 select RESOURCES_64BIT if PCI
98 select SYS_SUPPORTS_LITTLE_ENDIAN 90 select SYS_SUPPORTS_LITTLE_ENDIAN
99 91
100config MIPS_PB1550 92config MIPS_PB1550
@@ -103,7 +95,6 @@ config MIPS_PB1550
103 select DMA_NONCOHERENT 95 select DMA_NONCOHERENT
104 select HW_HAS_PCI 96 select HW_HAS_PCI
105 select MIPS_DISABLE_OBSOLETE_IDE 97 select MIPS_DISABLE_OBSOLETE_IDE
106 select RESOURCES_64BIT if PCI
107 select SYS_SUPPORTS_LITTLE_ENDIAN 98 select SYS_SUPPORTS_LITTLE_ENDIAN
108 99
109config MIPS_XXS1500 100config MIPS_XXS1500
diff --git a/arch/mips/au1000/common/pci.c b/arch/mips/au1000/common/pci.c
index 9be99a68932a..6fa70a36a250 100644
--- a/arch/mips/au1000/common/pci.c
+++ b/arch/mips/au1000/common/pci.c
@@ -39,15 +39,15 @@
39 39
40/* TBD */ 40/* TBD */
41static struct resource pci_io_resource = { 41static struct resource pci_io_resource = {
42 .start = (resource_size_t)PCI_IO_START, 42 .start = PCI_IO_START,
43 .end = (resource_size_t)PCI_IO_END, 43 .end = PCI_IO_END,
44 .name = "PCI IO space", 44 .name = "PCI IO space",
45 .flags = IORESOURCE_IO 45 .flags = IORESOURCE_IO
46}; 46};
47 47
48static struct resource pci_mem_resource = { 48static struct resource pci_mem_resource = {
49 .start = (resource_size_t)PCI_MEM_START, 49 .start = PCI_MEM_START,
50 .end = (resource_size_t)PCI_MEM_END, 50 .end = PCI_MEM_END,
51 .name = "PCI memory space", 51 .name = "PCI memory space",
52 .flags = IORESOURCE_MEM 52 .flags = IORESOURCE_MEM
53}; 53};
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index a90d425d4651..d885e3848ec6 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -137,12 +137,11 @@ phys_t __fixup_bigphys_addr(phys_t phys_addr, phys_t size)
137 137
138#ifdef CONFIG_PCI 138#ifdef CONFIG_PCI
139 { 139 {
140 u32 start, end; 140 u32 start = (u32)Au1500_PCI_MEM_START;
141 u32 end = (u32)Au1500_PCI_MEM_END;
141 142
142 start = (u32)Au1500_PCI_MEM_START; 143 /* Check for PCI memory window */
143 end = (u32)Au1500_PCI_MEM_END; 144 if (phys_addr >= start && (phys_addr + size - 1) <= end)
144 /* check for pci memory window */
145 if ((phys_addr >= start) && ((phys_addr + size) < end))
146 return (phys_t) 145 return (phys_t)
147 ((phys_addr - start) + Au1500_PCI_MEM_START); 146 ((phys_addr - start) + Au1500_PCI_MEM_START);
148 } 147 }
diff --git a/arch/mips/cobalt/time.c b/arch/mips/cobalt/time.c
index fa819fccd5db..4a570e7145fe 100644
--- a/arch/mips/cobalt/time.c
+++ b/arch/mips/cobalt/time.c
@@ -27,9 +27,28 @@
27 27
28void __init plat_time_init(void) 28void __init plat_time_init(void)
29{ 29{
30 u32 start, end;
31 int i = HZ / 10;
32
30 setup_pit_timer(); 33 setup_pit_timer();
31 34
32 gt641xx_set_base_clock(GT641XX_BASE_CLOCK); 35 gt641xx_set_base_clock(GT641XX_BASE_CLOCK);
33 36
34 mips_timer_state = gt641xx_timer0_state; 37 /*
38 * MIPS counter frequency is measured during a 100msec interval
39 * using GT64111 timer0.
40 */
41 while (!gt641xx_timer0_state())
42 ;
43
44 start = read_c0_count();
45
46 while (i--)
47 while (!gt641xx_timer0_state())
48 ;
49
50 end = read_c0_count();
51
52 mips_hpt_frequency = (end - start) * 10;
53 printk(KERN_INFO "MIPS counter frequency %dHz\n", mips_hpt_frequency);
35} 54}
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 11cb264f59ce..2c09a442e5e5 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -77,9 +77,8 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
77 unsigned long status; 77 unsigned long status;
78 78
79 /* New thread loses kernel privileges. */ 79 /* New thread loses kernel privileges. */
80 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|KU_MASK); 80 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|ST0_FR|KU_MASK);
81#ifdef CONFIG_64BIT 81#ifdef CONFIG_64BIT
82 status &= ~ST0_FR;
83 status |= test_thread_flag(TIF_32BIT_REGS) ? 0 : ST0_FR; 82 status |= test_thread_flag(TIF_32BIT_REGS) ? 0 : ST0_FR;
84#endif 83#endif
85 status |= KU_USER; 84 status |= KU_USER;
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 52075426c373..1ecfbb7eba6c 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -109,10 +109,6 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
109 cd->mult = (u32) temp; 109 cd->mult = (u32) temp;
110} 110}
111 111
112void __init __weak plat_time_init(void)
113{
114}
115
116/* 112/*
117 * This function exists in order to cause an error due to a duplicate 113 * This function exists in order to cause an error due to a duplicate
118 * definition if platform code should have its own implementation. The hook 114 * definition if platform code should have its own implementation. The hook
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 23e73d0650a3..fcae66752972 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1317,12 +1317,12 @@ void __init per_cpu_trap_init(void)
1317#endif 1317#endif
1318 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) 1318 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV)
1319 status_set |= ST0_XX; 1319 status_set |= ST0_XX;
1320 if (cpu_has_dsp)
1321 status_set |= ST0_MX;
1322
1320 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, 1323 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
1321 status_set); 1324 status_set);
1322 1325
1323 if (cpu_has_dsp)
1324 set_c0_status(ST0_MX);
1325
1326#ifdef CONFIG_CPU_MIPSR2 1326#ifdef CONFIG_CPU_MIPSR2
1327 if (cpu_has_mips_r2) { 1327 if (cpu_has_mips_r2) {
1328 unsigned int enable = 0x0000000f; 1328 unsigned int enable = 0x0000000f;
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index dc272c188233..2c5c27c8e86d 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -169,6 +169,7 @@ 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 ... */
172 unsigned long addr; 173 unsigned long addr;
173 int i; 174 int i;
174 175
@@ -180,4 +181,5 @@ void __init prom_free_prom_memory(void)
180 free_init_pages("prom memory", 181 free_init_pages("prom memory",
181 addr, addr + boot_mem_map.map[i].size); 182 addr, addr + boot_mem_map.map[i].size);
182 } 183 }
184#endif
183} 185}
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 589b745d822a..6e6981fd7934 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -242,6 +242,8 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev,
242 for (i = 0; i < PCI_NUM_RESOURCES; i++) { 242 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
243 if (!dev->resource[i].start) 243 if (!dev->resource[i].start)
244 continue; 244 continue;
245 if (dev->resource[i].flags & IORESOURCE_PCI_FIXED)
246 continue;
245 if (dev->resource[i].flags & IORESOURCE_IO) 247 if (dev->resource[i].flags & IORESOURCE_IO)
246 offset = hose->io_offset; 248 offset = hose->io_offset;
247 else if (dev->resource[i].flags & IORESOURCE_MEM) 249 else if (dev->resource[i].flags & IORESOURCE_MEM)
diff --git a/arch/powerpc/configs/mpc8272_ads_defconfig b/arch/powerpc/configs/mpc8272_ads_defconfig
index a31b7a030a6b..5eae305215dc 100644
--- a/arch/powerpc/configs/mpc8272_ads_defconfig
+++ b/arch/powerpc/configs/mpc8272_ads_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc4 3# Linux kernel version: 2.6.24-rc5
4# Thu Dec 6 16:48:30 2007 4# Thu Dec 13 22:40:57 2007
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -491,7 +491,7 @@ CONFIG_MII=y
491CONFIG_FS_ENET=y 491CONFIG_FS_ENET=y
492# CONFIG_FS_ENET_HAS_SCC is not set 492# CONFIG_FS_ENET_HAS_SCC is not set
493CONFIG_FS_ENET_HAS_FCC=y 493CONFIG_FS_ENET_HAS_FCC=y
494# CONFIG_FS_ENET_MDIO_FCC is not set 494CONFIG_FS_ENET_MDIO_FCC=y
495CONFIG_NETDEV_1000=y 495CONFIG_NETDEV_1000=y
496# CONFIG_ACENIC is not set 496# CONFIG_ACENIC is not set
497# CONFIG_DL2K is not set 497# CONFIG_DL2K is not set
diff --git a/arch/powerpc/configs/pq2fads_defconfig b/arch/powerpc/configs/pq2fads_defconfig
index 142d206d6870..a3bfbb65a933 100644
--- a/arch/powerpc/configs/pq2fads_defconfig
+++ b/arch/powerpc/configs/pq2fads_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc4 3# Linux kernel version: 2.6.24-rc5
4# Thu Dec 6 16:49:09 2007 4# Thu Dec 13 22:39:18 2007
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7 7
@@ -548,7 +548,7 @@ CONFIG_MII=y
548CONFIG_FS_ENET=y 548CONFIG_FS_ENET=y
549# CONFIG_FS_ENET_HAS_SCC is not set 549# CONFIG_FS_ENET_HAS_SCC is not set
550CONFIG_FS_ENET_HAS_FCC=y 550CONFIG_FS_ENET_HAS_FCC=y
551# CONFIG_FS_ENET_MDIO_FCC is not set 551CONFIG_FS_ENET_MDIO_FCC=y
552CONFIG_NETDEV_1000=y 552CONFIG_NETDEV_1000=y
553# CONFIG_ACENIC is not set 553# CONFIG_ACENIC is not set
554# CONFIG_DL2K is not set 554# CONFIG_DL2K is not set
diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index 5bd547ecd60a..0b5469fb6e0f 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -157,7 +157,7 @@ CONFIG_PS3_HTAB_SIZE=20
157CONFIG_PS3_USE_LPAR_ADDR=y 157CONFIG_PS3_USE_LPAR_ADDR=y
158CONFIG_PS3_VUART=y 158CONFIG_PS3_VUART=y
159CONFIG_PS3_PS3AV=y 159CONFIG_PS3_PS3AV=y
160CONFIG_PS3_SYS_MANAGER=m 160CONFIG_PS3_SYS_MANAGER=y
161CONFIG_PS3_STORAGE=y 161CONFIG_PS3_STORAGE=y
162CONFIG_PS3_DISK=y 162CONFIG_PS3_DISK=y
163CONFIG_PS3_ROM=y 163CONFIG_PS3_ROM=y
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index c6b1aa3efbb9..13ebeb2d71e6 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -45,10 +45,6 @@
45#include <asm/signal.h> 45#include <asm/signal.h>
46#include <asm/dcr.h> 46#include <asm/dcr.h>
47 47
48#ifdef CONFIG_8xx
49#include <asm/commproc.h>
50#endif
51
52#ifdef CONFIG_PPC64 48#ifdef CONFIG_PPC64
53EXPORT_SYMBOL(local_irq_restore); 49EXPORT_SYMBOL(local_irq_restore);
54#endif 50#endif
@@ -172,14 +168,6 @@ EXPORT_SYMBOL(console_drivers);
172EXPORT_SYMBOL(cacheable_memcpy); 168EXPORT_SYMBOL(cacheable_memcpy);
173#endif 169#endif
174 170
175#ifdef CONFIG_8xx
176EXPORT_SYMBOL(cpm_install_handler);
177EXPORT_SYMBOL(cpm_free_handler);
178#endif /* CONFIG_8xx */
179#if defined(CONFIG_8xx)
180EXPORT_SYMBOL(__res);
181#endif
182
183#ifdef CONFIG_PPC32 171#ifdef CONFIG_PPC32
184EXPORT_SYMBOL(next_mmu_context); 172EXPORT_SYMBOL(next_mmu_context);
185EXPORT_SYMBOL(set_context); 173EXPORT_SYMBOL(set_context);
diff --git a/arch/powerpc/math-emu/op-2.h b/arch/powerpc/math-emu/op-2.h
index b9b06b4c6ea1..7d6f17cc2929 100644
--- a/arch/powerpc/math-emu/op-2.h
+++ b/arch/powerpc/math-emu/op-2.h
@@ -59,7 +59,8 @@
59 else \ 59 else \
60 { \ 60 { \
61 X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \ 61 X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \
62 (((X##_f1 << (sz - (N))) | X##_f0) != 0)); \ 62 (((X##_f1 << (2 * _FP_W_TYPE_SIZE - (N))) | \
63 X##_f0) != 0)); \
63 X##_f1 = 0; \ 64 X##_f1 = 0; \
64 } \ 65 } \
65 } while (0) 66 } while (0)
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index 34bdbbe3ce59..275f49449839 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -121,6 +121,7 @@ void process_hvlpevents(void)
121{ 121{
122 struct HvLpEvent * event; 122 struct HvLpEvent * event;
123 123
124 restart:
124 /* If we have recursed, just return */ 125 /* If we have recursed, just return */
125 if (!spin_trylock(&hvlpevent_queue.hq_lock)) 126 if (!spin_trylock(&hvlpevent_queue.hq_lock))
126 return; 127 return;
@@ -146,8 +147,20 @@ void process_hvlpevents(void)
146 if (event->xType < HvLpEvent_Type_NumTypes && 147 if (event->xType < HvLpEvent_Type_NumTypes &&
147 lpEventHandler[event->xType]) 148 lpEventHandler[event->xType])
148 lpEventHandler[event->xType](event); 149 lpEventHandler[event->xType](event);
149 else 150 else {
150 printk(KERN_INFO "Unexpected Lp Event type=%d\n", event->xType ); 151 u8 type = event->xType;
152
153 /*
154 * Don't printk in the spinlock as printk
155 * may require ack events form the HV to send
156 * any characters there.
157 */
158 hvlpevent_clear_valid(event);
159 spin_unlock(&hvlpevent_queue.hq_lock);
160 printk(KERN_INFO
161 "Unexpected Lp Event type=%d\n", type);
162 goto restart;
163 }
151 164
152 hvlpevent_clear_valid(event); 165 hvlpevent_clear_valid(event);
153 } else if (hvlpevent_queue.hq_overflow_pending) 166 } else if (hvlpevent_queue.hq_overflow_pending)
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index 67144d1d1405..298f1c9679fb 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -91,7 +91,7 @@ config PS3_SYS_MANAGER
91 depends on PPC_PS3 91 depends on PPC_PS3
92 tristate "PS3 System Manager driver" if PS3_ADVANCED 92 tristate "PS3 System Manager driver" if PS3_ADVANCED
93 select PS3_VUART 93 select PS3_VUART
94 default m 94 default y
95 help 95 help
96 Include support for the PS3 System Manager. 96 Include support for the PS3 System Manager.
97 97
diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c
index 859362fecb7c..c1d824032020 100644
--- a/arch/powerpc/sysdev/cpm2_common.c
+++ b/arch/powerpc/sysdev/cpm2_common.c
@@ -61,8 +61,7 @@ cpm2_map_t __iomem *cpm2_immr;
61 of space for CPM as it is larger 61 of space for CPM as it is larger
62 than on PQ2 */ 62 than on PQ2 */
63 63
64void 64void __init cpm2_reset(void)
65cpm2_reset(void)
66{ 65{
67#ifdef CONFIG_PPC_85xx 66#ifdef CONFIG_PPC_85xx
68 cpm2_immr = ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE); 67 cpm2_immr = ioremap(CPM_MAP_ADDR, CPM_MAP_SIZE);
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/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index c9b0d7af64ae..ea257e828364 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -2593,3 +2593,15 @@ sun4v_mmustat_info:
2593 retl 2593 retl
2594 nop 2594 nop
2595 .size sun4v_mmustat_info, .-sun4v_mmustat_info 2595 .size sun4v_mmustat_info, .-sun4v_mmustat_info
2596
2597 .globl sun4v_mmu_demap_all
2598 .type sun4v_mmu_demap_all,#function
2599sun4v_mmu_demap_all:
2600 clr %o0
2601 clr %o1
2602 mov HV_MMU_ALL, %o2
2603 mov HV_FAST_MMU_DEMAP_ALL, %o5
2604 ta HV_FAST_TRAP
2605 retl
2606 nop
2607 .size sun4v_mmu_demap_all, .-sun4v_mmu_demap_all
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/smp.c b/arch/sparc64/kernel/smp.c
index 894b506f9636..c39944927f1a 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -476,7 +476,7 @@ static inline void spitfire_xcall_deliver(u64 data0, u64 data1, u64 data2, cpuma
476 */ 476 */
477static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask) 477static void cheetah_xcall_deliver(u64 data0, u64 data1, u64 data2, cpumask_t mask)
478{ 478{
479 u64 pstate, ver; 479 u64 pstate, ver, busy_mask;
480 int nack_busy_id, is_jbus, need_more; 480 int nack_busy_id, is_jbus, need_more;
481 481
482 if (cpus_empty(mask)) 482 if (cpus_empty(mask))
@@ -508,14 +508,20 @@ retry:
508 "i" (ASI_INTR_W)); 508 "i" (ASI_INTR_W));
509 509
510 nack_busy_id = 0; 510 nack_busy_id = 0;
511 busy_mask = 0;
511 { 512 {
512 int i; 513 int i;
513 514
514 for_each_cpu_mask(i, mask) { 515 for_each_cpu_mask(i, mask) {
515 u64 target = (i << 14) | 0x70; 516 u64 target = (i << 14) | 0x70;
516 517
517 if (!is_jbus) 518 if (is_jbus) {
519 busy_mask |= (0x1UL << (i * 2));
520 } else {
518 target |= (nack_busy_id << 24); 521 target |= (nack_busy_id << 24);
522 busy_mask |= (0x1UL <<
523 (nack_busy_id * 2));
524 }
519 __asm__ __volatile__( 525 __asm__ __volatile__(
520 "stxa %%g0, [%0] %1\n\t" 526 "stxa %%g0, [%0] %1\n\t"
521 "membar #Sync\n\t" 527 "membar #Sync\n\t"
@@ -531,15 +537,16 @@ retry:
531 537
532 /* Now, poll for completion. */ 538 /* Now, poll for completion. */
533 { 539 {
534 u64 dispatch_stat; 540 u64 dispatch_stat, nack_mask;
535 long stuck; 541 long stuck;
536 542
537 stuck = 100000 * nack_busy_id; 543 stuck = 100000 * nack_busy_id;
544 nack_mask = busy_mask << 1;
538 do { 545 do {
539 __asm__ __volatile__("ldxa [%%g0] %1, %0" 546 __asm__ __volatile__("ldxa [%%g0] %1, %0"
540 : "=r" (dispatch_stat) 547 : "=r" (dispatch_stat)
541 : "i" (ASI_INTR_DISPATCH_STAT)); 548 : "i" (ASI_INTR_DISPATCH_STAT));
542 if (dispatch_stat == 0UL) { 549 if (!(dispatch_stat & (busy_mask | nack_mask))) {
543 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" 550 __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
544 : : "r" (pstate)); 551 : : "r" (pstate));
545 if (unlikely(need_more)) { 552 if (unlikely(need_more)) {
@@ -556,12 +563,12 @@ retry:
556 } 563 }
557 if (!--stuck) 564 if (!--stuck)
558 break; 565 break;
559 } while (dispatch_stat & 0x5555555555555555UL); 566 } while (dispatch_stat & busy_mask);
560 567
561 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" 568 __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
562 : : "r" (pstate)); 569 : : "r" (pstate));
563 570
564 if ((dispatch_stat & ~(0x5555555555555555UL)) == 0) { 571 if (dispatch_stat & busy_mask) {
565 /* Busy bits will not clear, continue instead 572 /* Busy bits will not clear, continue instead
566 * of freezing up on this cpu. 573 * of freezing up on this cpu.
567 */ 574 */
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index e18ccf85224f..fbeb55d71e76 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -1133,14 +1133,9 @@ static void __init mark_kpte_bitmap(unsigned long start, unsigned long end)
1133 } 1133 }
1134} 1134}
1135 1135
1136static void __init kernel_physical_mapping_init(void) 1136static void __init init_kpte_bitmap(void)
1137{ 1137{
1138 unsigned long i; 1138 unsigned long i;
1139#ifdef CONFIG_DEBUG_PAGEALLOC
1140 unsigned long mem_alloced = 0UL;
1141#endif
1142
1143 read_obp_memory("reg", &pall[0], &pall_ents);
1144 1139
1145 for (i = 0; i < pall_ents; i++) { 1140 for (i = 0; i < pall_ents; i++) {
1146 unsigned long phys_start, phys_end; 1141 unsigned long phys_start, phys_end;
@@ -1149,14 +1144,24 @@ static void __init kernel_physical_mapping_init(void)
1149 phys_end = phys_start + pall[i].reg_size; 1144 phys_end = phys_start + pall[i].reg_size;
1150 1145
1151 mark_kpte_bitmap(phys_start, phys_end); 1146 mark_kpte_bitmap(phys_start, phys_end);
1147 }
1148}
1152 1149
1150static void __init kernel_physical_mapping_init(void)
1151{
1153#ifdef CONFIG_DEBUG_PAGEALLOC 1152#ifdef CONFIG_DEBUG_PAGEALLOC
1153 unsigned long i, mem_alloced = 0UL;
1154
1155 for (i = 0; i < pall_ents; i++) {
1156 unsigned long phys_start, phys_end;
1157
1158 phys_start = pall[i].phys_addr;
1159 phys_end = phys_start + pall[i].reg_size;
1160
1154 mem_alloced += kernel_map_range(phys_start, phys_end, 1161 mem_alloced += kernel_map_range(phys_start, phys_end,
1155 PAGE_KERNEL); 1162 PAGE_KERNEL);
1156#endif
1157 } 1163 }
1158 1164
1159#ifdef CONFIG_DEBUG_PAGEALLOC
1160 printk("Allocated %ld bytes for kernel page tables.\n", 1165 printk("Allocated %ld bytes for kernel page tables.\n",
1161 mem_alloced); 1166 mem_alloced);
1162 1167
@@ -1398,6 +1403,10 @@ void __init paging_init(void)
1398 1403
1399 inherit_prom_mappings(); 1404 inherit_prom_mappings();
1400 1405
1406 read_obp_memory("reg", &pall[0], &pall_ents);
1407
1408 init_kpte_bitmap();
1409
1401 /* Ok, we can use our TLB miss and window trap handlers safely. */ 1410 /* Ok, we can use our TLB miss and window trap handlers safely. */
1402 setup_tba(); 1411 setup_tba();
1403 1412
@@ -1904,7 +1913,9 @@ void __flush_tlb_all(void)
1904 "wrpr %0, %1, %%pstate" 1913 "wrpr %0, %1, %%pstate"
1905 : "=r" (pstate) 1914 : "=r" (pstate)
1906 : "i" (PSTATE_IE)); 1915 : "i" (PSTATE_IE));
1907 if (tlb_type == spitfire) { 1916 if (tlb_type == hypervisor) {
1917 sun4v_mmu_demap_all();
1918 } else if (tlb_type == spitfire) {
1908 for (i = 0; i < 64; i++) { 1919 for (i = 0; i < 64; i++) {
1909 /* Spitfire Errata #32 workaround */ 1920 /* Spitfire Errata #32 workaround */
1910 /* NOTE: Always runs on spitfire, so no 1921 /* NOTE: Always runs on spitfire, so no
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 73681f14f9fc..3c6c44ca1ffa 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -98,10 +98,10 @@ static int uml_net_rx(struct net_device *dev)
98 if (pkt_len > 0) { 98 if (pkt_len > 0) {
99 skb_trim(skb, pkt_len); 99 skb_trim(skb, pkt_len);
100 skb->protocol = (*lp->protocol)(skb); 100 skb->protocol = (*lp->protocol)(skb);
101 netif_rx(skb);
102 101
103 lp->stats.rx_bytes += skb->len; 102 lp->stats.rx_bytes += skb->len;
104 lp->stats.rx_packets++; 103 lp->stats.rx_packets++;
104 netif_rx(skb);
105 return pkt_len; 105 return pkt_len;
106 } 106 }
107 107
diff --git a/arch/um/drivers/net_user.c b/arch/um/drivers/net_user.c
index 90d7f2e8ead8..29185cad9fff 100644
--- a/arch/um/drivers/net_user.c
+++ b/arch/um/drivers/net_user.c
@@ -201,7 +201,7 @@ static int change_tramp(char **argv, char *output, int output_len)
201 close(fds[1]); 201 close(fds[1]);
202 202
203 if (pid > 0) 203 if (pid > 0)
204 CATCH_EINTR(err = waitpid(pid, NULL, 0)); 204 helper_wait(pid, 0, "change_tramp");
205 return pid; 205 return pid;
206} 206}
207 207
diff --git a/arch/um/drivers/slip_user.c b/arch/um/drivers/slip_user.c
index 5f06204d6871..b8711e50da80 100644
--- a/arch/um/drivers/slip_user.c
+++ b/arch/um/drivers/slip_user.c
@@ -77,7 +77,7 @@ static int slip_tramp(char **argv, int fd)
77{ 77{
78 struct slip_pre_exec_data pe_data; 78 struct slip_pre_exec_data pe_data;
79 char *output; 79 char *output;
80 int status, pid, fds[2], err, output_len; 80 int pid, fds[2], err, output_len;
81 81
82 err = os_pipe(fds, 1, 0); 82 err = os_pipe(fds, 1, 0);
83 if (err < 0) { 83 if (err < 0) {
@@ -109,15 +109,7 @@ static int slip_tramp(char **argv, int fd)
109 read_output(fds[0], output, output_len); 109 read_output(fds[0], output, output_len);
110 printk("%s", output); 110 printk("%s", output);
111 111
112 CATCH_EINTR(err = waitpid(pid, &status, 0)); 112 err = helper_wait(pid, 0, argv[0]);
113 if (err < 0)
114 err = errno;
115 else if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) {
116 printk(UM_KERN_ERR "'%s' didn't exit with status 0\n", argv[0]);
117 err = -EINVAL;
118 }
119 else err = 0;
120
121 close(fds[0]); 113 close(fds[0]);
122 114
123out_free: 115out_free:
diff --git a/arch/um/drivers/slirp_user.c b/arch/um/drivers/slirp_user.c
index 1865089ff41a..89c1be225fda 100644
--- a/arch/um/drivers/slirp_user.c
+++ b/arch/um/drivers/slirp_user.c
@@ -79,7 +79,7 @@ out:
79static void slirp_close(int fd, void *data) 79static void slirp_close(int fd, void *data)
80{ 80{
81 struct slirp_data *pri = data; 81 struct slirp_data *pri = data;
82 int status,err; 82 int err;
83 83
84 close(fd); 84 close(fd);
85 close(pri->slave); 85 close(pri->slave);
@@ -98,18 +98,9 @@ static void slirp_close(int fd, void *data)
98 "(%d)\n", pri->pid, errno); 98 "(%d)\n", pri->pid, errno);
99 } 99 }
100#endif 100#endif
101 101 err = helper_wait(pri->pid, 1, "slirp_close");
102 CATCH_EINTR(err = waitpid(pri->pid, &status, WNOHANG)); 102 if (err < 0)
103 if (err < 0) {
104 printk(UM_KERN_ERR "slirp_close: waitpid returned %d\n", errno);
105 return;
106 }
107
108 if (err == 0) {
109 printk(UM_KERN_ERR "slirp_close: process %d has not exited\n",
110 pri->pid);
111 return; 103 return;
112 }
113 104
114 pri->pid = -1; 105 pri->pid = -1;
115} 106}
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c
index 41d254bd38df..48fc7452bc1d 100644
--- a/arch/um/drivers/ubd_user.c
+++ b/arch/um/drivers/ubd_user.c
@@ -49,8 +49,7 @@ int start_io_thread(unsigned long sp, int *fd_out)
49 goto out_close; 49 goto out_close;
50 } 50 }
51 51
52 pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD, 52 pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM, NULL);
53 NULL);
54 if(pid < 0){ 53 if(pid < 0){
55 err = -errno; 54 err = -errno;
56 printk("start_io_thread - clone failed : errno = %d\n", errno); 55 printk("start_io_thread - clone failed : errno = %d\n", errno);
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index fbf0a87c6eaa..6f0d1c741bca 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -214,7 +214,7 @@ extern int execvp_noalloc(char *buf, const char *file, char *const argv[]);
214extern int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv); 214extern int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv);
215extern int run_helper_thread(int (*proc)(void *), void *arg, 215extern int run_helper_thread(int (*proc)(void *), void *arg,
216 unsigned int flags, unsigned long *stack_out); 216 unsigned int flags, unsigned long *stack_out);
217extern int helper_wait(int pid); 217extern int helper_wait(int pid, int nohang, char *pname);
218 218
219 219
220/* tls.c */ 220/* tls.c */
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index 4158118c4a56..93dc0c80ebaf 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -218,7 +218,7 @@ static int init_aio_24(void)
218 goto out_close_pipe; 218 goto out_close_pipe;
219 219
220 err = run_helper_thread(not_aio_thread, NULL, 220 err = run_helper_thread(not_aio_thread, NULL,
221 CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack); 221 CLONE_FILES | CLONE_VM, &aio_stack);
222 if (err < 0) 222 if (err < 0)
223 goto out_close_pipe; 223 goto out_close_pipe;
224 224
@@ -254,7 +254,7 @@ static int init_aio_26(void)
254 } 254 }
255 255
256 err = run_helper_thread(aio_thread, NULL, 256 err = run_helper_thread(aio_thread, NULL,
257 CLONE_FILES | CLONE_VM | SIGCHLD, &aio_stack); 257 CLONE_FILES | CLONE_VM, &aio_stack);
258 if (err < 0) 258 if (err < 0)
259 return err; 259 return err;
260 260
diff --git a/arch/um/os-Linux/drivers/ethertap_user.c b/arch/um/os-Linux/drivers/ethertap_user.c
index 4ff553603449..07ca0cb472ac 100644
--- a/arch/um/os-Linux/drivers/ethertap_user.c
+++ b/arch/um/os-Linux/drivers/ethertap_user.c
@@ -94,7 +94,7 @@ static int etap_tramp(char *dev, char *gate, int control_me,
94 int control_remote, int data_me, int data_remote) 94 int control_remote, int data_me, int data_remote)
95{ 95{
96 struct etap_pre_exec_data pe_data; 96 struct etap_pre_exec_data pe_data;
97 int pid, status, err, n; 97 int pid, err, n;
98 char version_buf[sizeof("nnnnn\0")]; 98 char version_buf[sizeof("nnnnn\0")];
99 char data_fd_buf[sizeof("nnnnnn\0")]; 99 char data_fd_buf[sizeof("nnnnnn\0")];
100 char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")]; 100 char gate_buf[sizeof("nnn.nnn.nnn.nnn\0")];
@@ -131,13 +131,7 @@ static int etap_tramp(char *dev, char *gate, int control_me,
131 } 131 }
132 if (c != 1) { 132 if (c != 1) {
133 printk(UM_KERN_ERR "etap_tramp : uml_net failed\n"); 133 printk(UM_KERN_ERR "etap_tramp : uml_net failed\n");
134 err = -EINVAL; 134 err = helper_wait(pid, 0, "uml_net");
135 CATCH_EINTR(n = waitpid(pid, &status, 0));
136 if (n < 0)
137 err = -errno;
138 else if (!WIFEXITED(status) || (WEXITSTATUS(status) != 1))
139 printk(UM_KERN_ERR "uml_net didn't exit with "
140 "status 1\n");
141 } 135 }
142 return err; 136 return err;
143} 137}
diff --git a/arch/um/os-Linux/drivers/tuntap_user.c b/arch/um/os-Linux/drivers/tuntap_user.c
index 6c55d3c8ead8..1037a3b6386e 100644
--- a/arch/um/os-Linux/drivers/tuntap_user.c
+++ b/arch/um/os-Linux/drivers/tuntap_user.c
@@ -107,7 +107,7 @@ static int tuntap_open_tramp(char *gate, int *fd_out, int me, int remote,
107 "errno = %d\n", errno); 107 "errno = %d\n", errno);
108 return err; 108 return err;
109 } 109 }
110 CATCH_EINTR(waitpid(pid, NULL, 0)); 110 helper_wait(pid, 0, "tuntap_open_tramp");
111 111
112 cmsg = CMSG_FIRSTHDR(&msg); 112 cmsg = CMSG_FIRSTHDR(&msg);
113 if (cmsg == NULL) { 113 if (cmsg == NULL) {
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 7a72dbb61b0d..fba3f0fefeef 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -76,7 +76,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
76 data.fd = fds[1]; 76 data.fd = fds[1];
77 data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) : 77 data.buf = __cant_sleep() ? kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
78 kmalloc(PATH_MAX, UM_GFP_KERNEL); 78 kmalloc(PATH_MAX, UM_GFP_KERNEL);
79 pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); 79 pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
80 if (pid < 0) { 80 if (pid < 0) {
81 ret = -errno; 81 ret = -errno;
82 printk("run_helper : clone failed, errno = %d\n", errno); 82 printk("run_helper : clone failed, errno = %d\n", errno);
@@ -101,7 +101,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
101 ret = n; 101 ret = n;
102 kill(pid, SIGKILL); 102 kill(pid, SIGKILL);
103 } 103 }
104 CATCH_EINTR(waitpid(pid, NULL, 0)); 104 CATCH_EINTR(waitpid(pid, NULL, __WCLONE));
105 } 105 }
106 106
107out_free2: 107out_free2:
@@ -126,7 +126,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
126 return -ENOMEM; 126 return -ENOMEM;
127 127
128 sp = stack + UM_KERN_PAGE_SIZE - sizeof(void *); 128 sp = stack + UM_KERN_PAGE_SIZE - sizeof(void *);
129 pid = clone(proc, (void *) sp, flags | SIGCHLD, arg); 129 pid = clone(proc, (void *) sp, flags, arg);
130 if (pid < 0) { 130 if (pid < 0) {
131 err = -errno; 131 err = -errno;
132 printk("run_helper_thread : clone failed, errno = %d\n", 132 printk("run_helper_thread : clone failed, errno = %d\n",
@@ -134,7 +134,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
134 return err; 134 return err;
135 } 135 }
136 if (stack_out == NULL) { 136 if (stack_out == NULL) {
137 CATCH_EINTR(pid = waitpid(pid, &status, 0)); 137 CATCH_EINTR(pid = waitpid(pid, &status, __WCLONE));
138 if (pid < 0) { 138 if (pid < 0) {
139 err = -errno; 139 err = -errno;
140 printk("run_helper_thread - wait failed, errno = %d\n", 140 printk("run_helper_thread - wait failed, errno = %d\n",
@@ -150,14 +150,30 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
150 return pid; 150 return pid;
151} 151}
152 152
153int helper_wait(int pid) 153int helper_wait(int pid, int nohang, char *pname)
154{ 154{
155 int ret; 155 int ret, status;
156 int wflags = __WCLONE;
156 157
157 CATCH_EINTR(ret = waitpid(pid, NULL, WNOHANG)); 158 if (nohang)
159 wflags |= WNOHANG;
160
161 if (!pname)
162 pname = "helper_wait";
163
164 CATCH_EINTR(ret = waitpid(pid, &status, wflags));
158 if (ret < 0) { 165 if (ret < 0) {
159 ret = -errno; 166 printk(UM_KERN_ERR "%s : waitpid process %d failed, "
160 printk("helper_wait : waitpid failed, errno = %d\n", errno); 167 "errno = %d\n", pname, pid, errno);
161 } 168 return -errno;
162 return ret; 169 } else if (nohang && ret == 0) {
170 printk(UM_KERN_ERR "%s : process %d has not exited\n",
171 pname, pid);
172 return -ECHILD;
173 } else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
174 printk(UM_KERN_ERR "%s : process %d didn't exit with "
175 "status 0\n", pname, pid);
176 return -ECHILD;
177 } else
178 return 0;
163} 179}
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index 37781db4ceca..bda5c3150d6c 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -101,7 +101,7 @@ void os_kill_process(int pid, int reap_child)
101{ 101{
102 kill(pid, SIGKILL); 102 kill(pid, SIGKILL);
103 if (reap_child) 103 if (reap_child)
104 CATCH_EINTR(waitpid(pid, NULL, 0)); 104 CATCH_EINTR(waitpid(pid, NULL, __WALL));
105} 105}
106 106
107/* This is here uniquely to have access to the userspace errno, i.e. the one 107/* This is here uniquely to have access to the userspace errno, i.e. the one
@@ -130,7 +130,7 @@ void os_kill_ptraced_process(int pid, int reap_child)
130 ptrace(PTRACE_KILL, pid); 130 ptrace(PTRACE_KILL, pid);
131 ptrace(PTRACE_CONT, pid); 131 ptrace(PTRACE_CONT, pid);
132 if (reap_child) 132 if (reap_child)
133 CATCH_EINTR(waitpid(pid, NULL, 0)); 133 CATCH_EINTR(waitpid(pid, NULL, __WALL));
134} 134}
135 135
136/* Don't use the glibc version, which caches the result in TLS. It misses some 136/* Don't use the glibc version, which caches the result in TLS. It misses some
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index d77c81d7068a..e8b7a97e83d3 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -64,7 +64,7 @@ void wait_stub_done(int pid)
64 int n, status, err; 64 int n, status, err;
65 65
66 while (1) { 66 while (1) {
67 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 67 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
68 if ((n < 0) || !WIFSTOPPED(status)) 68 if ((n < 0) || !WIFSTOPPED(status))
69 goto bad_wait; 69 goto bad_wait;
70 70
@@ -153,7 +153,7 @@ static void handle_trap(int pid, struct uml_pt_regs *regs,
153 panic("handle_trap - continuing to end of syscall " 153 panic("handle_trap - continuing to end of syscall "
154 "failed, errno = %d\n", errno); 154 "failed, errno = %d\n", errno);
155 155
156 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 156 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL));
157 if ((err < 0) || !WIFSTOPPED(status) || 157 if ((err < 0) || !WIFSTOPPED(status) ||
158 (WSTOPSIG(status) != SIGTRAP + 0x80)) { 158 (WSTOPSIG(status) != SIGTRAP + 0x80)) {
159 err = ptrace_dump_regs(pid); 159 err = ptrace_dump_regs(pid);
@@ -255,16 +255,18 @@ int start_userspace(unsigned long stub_stack)
255 panic("start_userspace : mmap failed, errno = %d", errno); 255 panic("start_userspace : mmap failed, errno = %d", errno);
256 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *); 256 sp = (unsigned long) stack + UM_KERN_PAGE_SIZE - sizeof(void *);
257 257
258 flags = CLONE_FILES | SIGCHLD; 258 flags = CLONE_FILES;
259 if (proc_mm) 259 if (proc_mm)
260 flags |= CLONE_VM; 260 flags |= CLONE_VM;
261 else
262 flags |= SIGCHLD;
261 263
262 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack); 264 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
263 if (pid < 0) 265 if (pid < 0)
264 panic("start_userspace : clone failed, errno = %d", errno); 266 panic("start_userspace : clone failed, errno = %d", errno);
265 267
266 do { 268 do {
267 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 269 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL));
268 if (n < 0) 270 if (n < 0)
269 panic("start_userspace : wait failed, errno = %d", 271 panic("start_userspace : wait failed, errno = %d",
270 errno); 272 errno);
@@ -314,7 +316,7 @@ void userspace(struct uml_pt_regs *regs)
314 "pid=%d, ptrace operation = %d, errno = %d\n", 316 "pid=%d, ptrace operation = %d, errno = %d\n",
315 pid, op, errno); 317 pid, op, errno);
316 318
317 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED)); 319 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED | __WALL));
318 if (err < 0) 320 if (err < 0)
319 panic("userspace - waitpid failed, errno = %d\n", 321 panic("userspace - waitpid failed, errno = %d\n",
320 errno); 322 errno);
diff --git a/arch/um/os-Linux/util.c b/arch/um/os-Linux/util.c
index ef095436a78c..3e058ce9ffb6 100644
--- a/arch/um/os-Linux/util.c
+++ b/arch/um/os-Linux/util.c
@@ -141,7 +141,7 @@ void os_dump_core(void)
141 * nothing reasonable to do if that fails. 141 * nothing reasonable to do if that fails.
142 */ 142 */
143 143
144 while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) 144 while ((pid = waitpid(-1, NULL, WNOHANG | __WALL)) > 0)
145 os_kill_ptraced_process(pid, 0); 145 os_kill_ptraced_process(pid, 0);
146 146
147 abort(); 147 abort();
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 96986b46bc85..edb5108e5d0e 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -849,7 +849,7 @@ void __init init_bsp_APIC(void)
849/** 849/**
850 * setup_local_APIC - setup the local APIC 850 * setup_local_APIC - setup the local APIC
851 */ 851 */
852void __devinit setup_local_APIC(void) 852void __cpuinit setup_local_APIC(void)
853{ 853{
854 unsigned long oldvalue, value, maxlvt, integrated; 854 unsigned long oldvalue, value, maxlvt, integrated;
855 int i, j; 855 int i, j;
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 606fe4d55a91..9f530ff43c21 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -49,6 +49,7 @@ static struct _cache_table cache_table[] __cpuinitdata =
49 { 0x3c, LVL_2, 256 }, /* 4-way set assoc, sectored cache, 64 byte line size */ 49 { 0x3c, LVL_2, 256 }, /* 4-way set assoc, sectored cache, 64 byte line size */
50 { 0x3d, LVL_2, 384 }, /* 6-way set assoc, sectored cache, 64 byte line size */ 50 { 0x3d, LVL_2, 384 }, /* 6-way set assoc, sectored cache, 64 byte line size */
51 { 0x3e, LVL_2, 512 }, /* 4-way set assoc, sectored cache, 64 byte line size */ 51 { 0x3e, LVL_2, 512 }, /* 4-way set assoc, sectored cache, 64 byte line size */
52 { 0x3f, LVL_2, 256 }, /* 2-way set assoc, 64 byte line size */
52 { 0x41, LVL_2, 128 }, /* 4-way set assoc, 32 byte line size */ 53 { 0x41, LVL_2, 128 }, /* 4-way set assoc, 32 byte line size */
53 { 0x42, LVL_2, 256 }, /* 4-way set assoc, 32 byte line size */ 54 { 0x42, LVL_2, 256 }, /* 4-way set assoc, 32 byte line size */
54 { 0x43, LVL_2, 512 }, /* 4-way set assoc, 32 byte line size */ 55 { 0x43, LVL_2, 512 }, /* 4-way set assoc, 32 byte line size */
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 6cf27319a91c..c3a565bba106 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -1882,13 +1882,16 @@ __setup("no_timer_check", notimercheck);
1882static int __init timer_irq_works(void) 1882static int __init timer_irq_works(void)
1883{ 1883{
1884 unsigned long t1 = jiffies; 1884 unsigned long t1 = jiffies;
1885 unsigned long flags;
1885 1886
1886 if (no_timer_check) 1887 if (no_timer_check)
1887 return 1; 1888 return 1;
1888 1889
1890 local_save_flags(flags);
1889 local_irq_enable(); 1891 local_irq_enable();
1890 /* Let ten ticks pass... */ 1892 /* Let ten ticks pass... */
1891 mdelay((10 * 1000) / HZ); 1893 mdelay((10 * 1000) / HZ);
1894 local_irq_restore(flags);
1892 1895
1893 /* 1896 /*
1894 * Expect a few ticks at least, to be sure some possible 1897 * Expect a few ticks at least, to be sure some possible
@@ -2167,6 +2170,9 @@ static inline void __init check_timer(void)
2167 int apic1, pin1, apic2, pin2; 2170 int apic1, pin1, apic2, pin2;
2168 int vector; 2171 int vector;
2169 unsigned int ver; 2172 unsigned int ver;
2173 unsigned long flags;
2174
2175 local_irq_save(flags);
2170 2176
2171 ver = apic_read(APIC_LVR); 2177 ver = apic_read(APIC_LVR);
2172 ver = GET_APIC_VERSION(ver); 2178 ver = GET_APIC_VERSION(ver);
@@ -2219,7 +2225,7 @@ static inline void __init check_timer(void)
2219 } 2225 }
2220 if (disable_timer_pin_1 > 0) 2226 if (disable_timer_pin_1 > 0)
2221 clear_IO_APIC_pin(0, pin1); 2227 clear_IO_APIC_pin(0, pin1);
2222 return; 2228 goto out;
2223 } 2229 }
2224 clear_IO_APIC_pin(apic1, pin1); 2230 clear_IO_APIC_pin(apic1, pin1);
2225 printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to " 2231 printk(KERN_ERR "..MP-BIOS bug: 8254 timer not connected to "
@@ -2242,7 +2248,7 @@ static inline void __init check_timer(void)
2242 if (nmi_watchdog == NMI_IO_APIC) { 2248 if (nmi_watchdog == NMI_IO_APIC) {
2243 setup_nmi(); 2249 setup_nmi();
2244 } 2250 }
2245 return; 2251 goto out;
2246 } 2252 }
2247 /* 2253 /*
2248 * Cleanup, just in case ... 2254 * Cleanup, just in case ...
@@ -2266,7 +2272,7 @@ static inline void __init check_timer(void)
2266 2272
2267 if (timer_irq_works()) { 2273 if (timer_irq_works()) {
2268 printk(" works.\n"); 2274 printk(" works.\n");
2269 return; 2275 goto out;
2270 } 2276 }
2271 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); 2277 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
2272 printk(" failed.\n"); 2278 printk(" failed.\n");
@@ -2282,11 +2288,13 @@ static inline void __init check_timer(void)
2282 2288
2283 if (timer_irq_works()) { 2289 if (timer_irq_works()) {
2284 printk(" works.\n"); 2290 printk(" works.\n");
2285 return; 2291 goto out;
2286 } 2292 }
2287 printk(" failed :(.\n"); 2293 printk(" failed :(.\n");
2288 panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a " 2294 panic("IO-APIC + timer doesn't work! Boot with apic=debug and send a "
2289 "report. Then try booting with the 'noapic' option"); 2295 "report. Then try booting with the 'noapic' option");
2296out:
2297 local_irq_restore(flags);
2290} 2298}
2291 2299
2292/* 2300/*
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 435a8c9b55f8..cbac1670c7c3 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1281,10 +1281,13 @@ void disable_IO_APIC(void)
1281static int __init timer_irq_works(void) 1281static int __init timer_irq_works(void)
1282{ 1282{
1283 unsigned long t1 = jiffies; 1283 unsigned long t1 = jiffies;
1284 unsigned long flags;
1284 1285
1286 local_save_flags(flags);
1285 local_irq_enable(); 1287 local_irq_enable();
1286 /* Let ten ticks pass... */ 1288 /* Let ten ticks pass... */
1287 mdelay((10 * 1000) / HZ); 1289 mdelay((10 * 1000) / HZ);
1290 local_irq_restore(flags);
1288 1291
1289 /* 1292 /*
1290 * Expect a few ticks at least, to be sure some possible 1293 * Expect a few ticks at least, to be sure some possible
@@ -1655,6 +1658,9 @@ static inline void check_timer(void)
1655{ 1658{
1656 struct irq_cfg *cfg = irq_cfg + 0; 1659 struct irq_cfg *cfg = irq_cfg + 0;
1657 int apic1, pin1, apic2, pin2; 1660 int apic1, pin1, apic2, pin2;
1661 unsigned long flags;
1662
1663 local_irq_save(flags);
1658 1664
1659 /* 1665 /*
1660 * get/set the timer IRQ vector: 1666 * get/set the timer IRQ vector:
@@ -1696,7 +1702,7 @@ static inline void check_timer(void)
1696 } 1702 }
1697 if (disable_timer_pin_1 > 0) 1703 if (disable_timer_pin_1 > 0)
1698 clear_IO_APIC_pin(0, pin1); 1704 clear_IO_APIC_pin(0, pin1);
1699 return; 1705 goto out;
1700 } 1706 }
1701 clear_IO_APIC_pin(apic1, pin1); 1707 clear_IO_APIC_pin(apic1, pin1);
1702 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not " 1708 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not "
@@ -1718,7 +1724,7 @@ static inline void check_timer(void)
1718 if (nmi_watchdog == NMI_IO_APIC) { 1724 if (nmi_watchdog == NMI_IO_APIC) {
1719 setup_nmi(); 1725 setup_nmi();
1720 } 1726 }
1721 return; 1727 goto out;
1722 } 1728 }
1723 /* 1729 /*
1724 * Cleanup, just in case ... 1730 * Cleanup, just in case ...
@@ -1741,7 +1747,7 @@ static inline void check_timer(void)
1741 1747
1742 if (timer_irq_works()) { 1748 if (timer_irq_works()) {
1743 apic_printk(APIC_VERBOSE," works.\n"); 1749 apic_printk(APIC_VERBOSE," works.\n");
1744 return; 1750 goto out;
1745 } 1751 }
1746 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector); 1752 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | cfg->vector);
1747 apic_printk(APIC_VERBOSE," failed.\n"); 1753 apic_printk(APIC_VERBOSE," failed.\n");
@@ -1756,10 +1762,12 @@ static inline void check_timer(void)
1756 1762
1757 if (timer_irq_works()) { 1763 if (timer_irq_works()) {
1758 apic_printk(APIC_VERBOSE," works.\n"); 1764 apic_printk(APIC_VERBOSE," works.\n");
1759 return; 1765 goto out;
1760 } 1766 }
1761 apic_printk(APIC_VERBOSE," failed :(.\n"); 1767 apic_printk(APIC_VERBOSE," failed :(.\n");
1762 panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n"); 1768 panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
1769out:
1770 local_irq_restore(flags);
1763} 1771}
1764 1772
1765static int __init notimercheck(char *s) 1773static int __init notimercheck(char *s)
diff --git a/arch/x86/kernel/kprobes_32.c b/arch/x86/kernel/kprobes_32.c
index d87a523070d1..3a020f79f82b 100644
--- a/arch/x86/kernel/kprobes_32.c
+++ b/arch/x86/kernel/kprobes_32.c
@@ -727,9 +727,7 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
727 727
728 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { 728 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
729 if (&regs->esp != kcb->jprobe_saved_esp) { 729 if (&regs->esp != kcb->jprobe_saved_esp) {
730 struct pt_regs *saved_regs = 730 struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
731 container_of(kcb->jprobe_saved_esp,
732 struct pt_regs, esp);
733 printk("current esp %p does not match saved esp %p\n", 731 printk("current esp %p does not match saved esp %p\n",
734 &regs->esp, kcb->jprobe_saved_esp); 732 &regs->esp, kcb->jprobe_saved_esp);
735 printk("Saved registers for jprobe %p\n", jp); 733 printk("Saved registers for jprobe %p\n", jp);
diff --git a/arch/x86/kernel/kprobes_64.c b/arch/x86/kernel/kprobes_64.c
index 0c467644589c..5df19a9f9239 100644
--- a/arch/x86/kernel/kprobes_64.c
+++ b/arch/x86/kernel/kprobes_64.c
@@ -485,7 +485,6 @@ static void __kprobes resume_execution(struct kprobe *p,
485 struct pt_regs *regs, struct kprobe_ctlblk *kcb) 485 struct pt_regs *regs, struct kprobe_ctlblk *kcb)
486{ 486{
487 unsigned long *tos = (unsigned long *)regs->rsp; 487 unsigned long *tos = (unsigned long *)regs->rsp;
488 unsigned long next_rip = 0;
489 unsigned long copy_rip = (unsigned long)p->ainsn.insn; 488 unsigned long copy_rip = (unsigned long)p->ainsn.insn;
490 unsigned long orig_rip = (unsigned long)p->addr; 489 unsigned long orig_rip = (unsigned long)p->addr;
491 kprobe_opcode_t *insn = p->ainsn.insn; 490 kprobe_opcode_t *insn = p->ainsn.insn;
@@ -494,46 +493,42 @@ static void __kprobes resume_execution(struct kprobe *p,
494 if (*insn >= 0x40 && *insn <= 0x4f) 493 if (*insn >= 0x40 && *insn <= 0x4f)
495 insn++; 494 insn++;
496 495
496 regs->eflags &= ~TF_MASK;
497 switch (*insn) { 497 switch (*insn) {
498 case 0x9c: /* pushfl */ 498 case 0x9c: /* pushfl */
499 *tos &= ~(TF_MASK | IF_MASK); 499 *tos &= ~(TF_MASK | IF_MASK);
500 *tos |= kcb->kprobe_old_rflags; 500 *tos |= kcb->kprobe_old_rflags;
501 break; 501 break;
502 case 0xc3: /* ret/lret */ 502 case 0xc2: /* iret/ret/lret */
503 case 0xcb: 503 case 0xc3:
504 case 0xc2:
505 case 0xca: 504 case 0xca:
506 regs->eflags &= ~TF_MASK; 505 case 0xcb:
507 /* rip is already adjusted, no more changes required*/ 506 case 0xcf:
508 return; 507 case 0xea: /* jmp absolute -- ip is correct */
509 case 0xe8: /* call relative - Fix return addr */ 508 /* ip is already adjusted, no more changes required */
509 goto no_change;
510 case 0xe8: /* call relative - Fix return addr */
510 *tos = orig_rip + (*tos - copy_rip); 511 *tos = orig_rip + (*tos - copy_rip);
511 break; 512 break;
512 case 0xff: 513 case 0xff:
513 if ((insn[1] & 0x30) == 0x10) { 514 if ((insn[1] & 0x30) == 0x10) {
514 /* call absolute, indirect */ 515 /* call absolute, indirect */
515 /* Fix return addr; rip is correct. */ 516 /* Fix return addr; ip is correct. */
516 next_rip = regs->rip;
517 *tos = orig_rip + (*tos - copy_rip); 517 *tos = orig_rip + (*tos - copy_rip);
518 goto no_change;
518 } else if (((insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */ 519 } else if (((insn[1] & 0x31) == 0x20) || /* jmp near, absolute indirect */
519 ((insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */ 520 ((insn[1] & 0x31) == 0x21)) { /* jmp far, absolute indirect */
520 /* rip is correct. */ 521 /* ip is correct. */
521 next_rip = regs->rip; 522 goto no_change;
522 } 523 }
523 break;
524 case 0xea: /* jmp absolute -- rip is correct */
525 next_rip = regs->rip;
526 break;
527 default: 524 default:
528 break; 525 break;
529 } 526 }
530 527
531 regs->eflags &= ~TF_MASK; 528 regs->rip = orig_rip + (regs->rip - copy_rip);
532 if (next_rip) { 529no_change:
533 regs->rip = next_rip; 530
534 } else { 531 return;
535 regs->rip = orig_rip + (regs->rip - copy_rip);
536 }
537} 532}
538 533
539int __kprobes post_kprobe_handler(struct pt_regs *regs) 534int __kprobes post_kprobe_handler(struct pt_regs *regs)
@@ -716,10 +711,8 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
716 struct jprobe *jp = container_of(p, struct jprobe, kp); 711 struct jprobe *jp = container_of(p, struct jprobe, kp);
717 712
718 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) { 713 if ((addr > (u8 *) jprobe_return) && (addr < (u8 *) jprobe_return_end)) {
719 if ((long *)regs->rsp != kcb->jprobe_saved_rsp) { 714 if ((unsigned long *)regs->rsp != kcb->jprobe_saved_rsp) {
720 struct pt_regs *saved_regs = 715 struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
721 container_of(kcb->jprobe_saved_rsp,
722 struct pt_regs, rsp);
723 printk("current rsp %p does not match saved rsp %p\n", 716 printk("current rsp %p does not match saved rsp %p\n",
724 (long *)regs->rsp, kcb->jprobe_saved_rsp); 717 (long *)regs->rsp, kcb->jprobe_saved_rsp);
725 printk("Saved registers for jprobe %p\n", jp); 718 printk("Saved registers for jprobe %p\n", jp);
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 7b899584d290..9663c2a74830 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -261,7 +261,7 @@ static void mwait_idle(void)
261 mwait_idle_with_hints(0, 0); 261 mwait_idle_with_hints(0, 0);
262} 262}
263 263
264void __devinit select_idle_routine(const struct cpuinfo_x86 *c) 264void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
265{ 265{
266 if (cpu_has(c, X86_FEATURE_MWAIT)) { 266 if (cpu_has(c, X86_FEATURE_MWAIT)) {
267 printk("monitor/mwait feature present.\n"); 267 printk("monitor/mwait feature present.\n");
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index e1e18c34c821..9c24b45b513c 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -67,7 +67,7 @@
67 address, and must not be in the .bss segment! */ 67 address, and must not be in the .bss segment! */
68unsigned long init_pg_tables_end __initdata = ~0UL; 68unsigned long init_pg_tables_end __initdata = ~0UL;
69 69
70int disable_pse __devinitdata = 0; 70int disable_pse __cpuinitdata = 0;
71 71
72/* 72/*
73 * Machine setup.. 73 * Machine setup..
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index ef0f34ede1ab..4ea80cbe52e5 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -60,7 +60,7 @@
60#include <asm/mtrr.h> 60#include <asm/mtrr.h>
61 61
62/* Set if we find a B stepping CPU */ 62/* Set if we find a B stepping CPU */
63static int __devinitdata smp_b_stepping; 63static int __cpuinitdata smp_b_stepping;
64 64
65/* Number of siblings per CPU package */ 65/* Number of siblings per CPU package */
66int smp_num_siblings = 1; 66int smp_num_siblings = 1;
@@ -745,8 +745,8 @@ static inline int alloc_cpu_id(void)
745} 745}
746 746
747#ifdef CONFIG_HOTPLUG_CPU 747#ifdef CONFIG_HOTPLUG_CPU
748static struct task_struct * __devinitdata cpu_idle_tasks[NR_CPUS]; 748static struct task_struct * __cpuinitdata cpu_idle_tasks[NR_CPUS];
749static inline struct task_struct * alloc_idle_task(int cpu) 749static inline struct task_struct * __cpuinit alloc_idle_task(int cpu)
750{ 750{
751 struct task_struct *idle; 751 struct task_struct *idle;
752 752
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index 500670c93d81..594889521da1 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 c->cpu_index = id;
145 identify_cpu(c); 144 identify_cpu(c);
145 c->cpu_index = id;
146 print_cpu_info(c); 146 print_cpu_info(c);
147} 147}
148 148
diff --git a/arch/x86/kernel/suspend_64.c b/arch/x86/kernel/suspend_64.c
index db284ef44d53..2e5efaaf8800 100644
--- a/arch/x86/kernel/suspend_64.c
+++ b/arch/x86/kernel/suspend_64.c
@@ -192,42 +192,25 @@ static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long en
192 return 0; 192 return 0;
193} 193}
194 194
195static int res_kernel_text_pud_init(pud_t *pud, unsigned long start)
196{
197 pmd_t *pmd;
198 unsigned long paddr;
199
200 pmd = (pmd_t *)get_safe_page(GFP_ATOMIC);
201 if (!pmd)
202 return -ENOMEM;
203 set_pud(pud + pud_index(start), __pud(__pa(pmd) | _KERNPG_TABLE));
204 for (paddr = 0; paddr < KERNEL_TEXT_SIZE; pmd++, paddr += PMD_SIZE) {
205 unsigned long pe;
206
207 pe = __PAGE_KERNEL_LARGE_EXEC | _PAGE_GLOBAL | paddr;
208 pe &= __supported_pte_mask;
209 set_pmd(pmd, __pmd(pe));
210 }
211
212 return 0;
213}
214
215static int set_up_temporary_mappings(void) 195static int set_up_temporary_mappings(void)
216{ 196{
217 unsigned long start, end, next; 197 unsigned long start, end, next;
218 pud_t *pud;
219 int error; 198 int error;
220 199
221 temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC); 200 temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC);
222 if (!temp_level4_pgt) 201 if (!temp_level4_pgt)
223 return -ENOMEM; 202 return -ENOMEM;
224 203
204 /* It is safe to reuse the original kernel mapping */
205 set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
206 init_level4_pgt[pgd_index(__START_KERNEL_map)]);
207
225 /* Set up the direct mapping from scratch */ 208 /* Set up the direct mapping from scratch */
226 start = (unsigned long)pfn_to_kaddr(0); 209 start = (unsigned long)pfn_to_kaddr(0);
227 end = (unsigned long)pfn_to_kaddr(end_pfn); 210 end = (unsigned long)pfn_to_kaddr(end_pfn);
228 211
229 for (; start < end; start = next) { 212 for (; start < end; start = next) {
230 pud = (pud_t *)get_safe_page(GFP_ATOMIC); 213 pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC);
231 if (!pud) 214 if (!pud)
232 return -ENOMEM; 215 return -ENOMEM;
233 next = start + PGDIR_SIZE; 216 next = start + PGDIR_SIZE;
@@ -238,17 +221,7 @@ static int set_up_temporary_mappings(void)
238 set_pgd(temp_level4_pgt + pgd_index(start), 221 set_pgd(temp_level4_pgt + pgd_index(start),
239 mk_kernel_pgd(__pa(pud))); 222 mk_kernel_pgd(__pa(pud)));
240 } 223 }
241 224 return 0;
242 /* Set up the kernel text mapping from scratch */
243 pud = (pud_t *)get_safe_page(GFP_ATOMIC);
244 if (!pud)
245 return -ENOMEM;
246 error = res_kernel_text_pud_init(pud, __START_KERNEL_map);
247 if (!error)
248 set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
249 __pgd(__pa(pud) | _PAGE_TABLE));
250
251 return error;
252} 225}
253 226
254int swsusp_arch_resume(void) 227int swsusp_arch_resume(void)
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index ef6010262597..c88bbffcaa03 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -373,14 +373,13 @@ void die(const char * str, struct pt_regs * regs, long err)
373 373
374 if (die.lock_owner != raw_smp_processor_id()) { 374 if (die.lock_owner != raw_smp_processor_id()) {
375 console_verbose(); 375 console_verbose();
376 raw_local_irq_save(flags);
376 __raw_spin_lock(&die.lock); 377 __raw_spin_lock(&die.lock);
377 raw_local_save_flags(flags);
378 die.lock_owner = smp_processor_id(); 378 die.lock_owner = smp_processor_id();
379 die.lock_owner_depth = 0; 379 die.lock_owner_depth = 0;
380 bust_spinlocks(1); 380 bust_spinlocks(1);
381 } 381 } else
382 else 382 raw_local_irq_save(flags);
383 raw_local_save_flags(flags);
384 383
385 if (++die.lock_owner_depth < 3) { 384 if (++die.lock_owner_depth < 3) {
386 unsigned long esp; 385 unsigned long esp;
diff --git a/arch/x86/oprofile/op_model_athlon.c b/arch/x86/oprofile/op_model_athlon.c
index 3057a19e4641..c3ee43333f26 100644
--- a/arch/x86/oprofile/op_model_athlon.c
+++ b/arch/x86/oprofile/op_model_athlon.c
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file op_model_athlon.h 2 * @file op_model_athlon.h
3 * athlon / K7 model-specific MSR operations 3 * athlon / K7 / K8 / Family 10h model-specific MSR operations
4 * 4 *
5 * @remark Copyright 2002 OProfile authors 5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING 6 * @remark Read the file COPYING
@@ -31,12 +31,16 @@
31#define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0) 31#define CTRL_WRITE(l,h,msrs,c) do {wrmsr(msrs->controls[(c)].addr, (l), (h));} while (0)
32#define CTRL_SET_ACTIVE(n) (n |= (1<<22)) 32#define CTRL_SET_ACTIVE(n) (n |= (1<<22))
33#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22)) 33#define CTRL_SET_INACTIVE(n) (n &= ~(1<<22))
34#define CTRL_CLEAR(x) (x &= (1<<21)) 34#define CTRL_CLEAR_LO(x) (x &= (1<<21))
35#define CTRL_CLEAR_HI(x) (x &= 0xfffffcf0)
35#define CTRL_SET_ENABLE(val) (val |= 1<<20) 36#define CTRL_SET_ENABLE(val) (val |= 1<<20)
36#define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16)) 37#define CTRL_SET_USR(val,u) (val |= ((u & 1) << 16))
37#define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17)) 38#define CTRL_SET_KERN(val,k) (val |= ((k & 1) << 17))
38#define CTRL_SET_UM(val, m) (val |= (m << 8)) 39#define CTRL_SET_UM(val, m) (val |= (m << 8))
39#define CTRL_SET_EVENT(val, e) (val |= e) 40#define CTRL_SET_EVENT_LOW(val, e) (val |= (e & 0xff))
41#define CTRL_SET_EVENT_HIGH(val, e) (val |= ((e >> 8) & 0xf))
42#define CTRL_SET_HOST_ONLY(val, h) (val |= ((h & 1) << 9))
43#define CTRL_SET_GUEST_ONLY(val, h) (val |= ((h & 1) << 8))
40 44
41static unsigned long reset_value[NUM_COUNTERS]; 45static unsigned long reset_value[NUM_COUNTERS];
42 46
@@ -70,7 +74,8 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
70 if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 74 if (unlikely(!CTRL_IS_RESERVED(msrs,i)))
71 continue; 75 continue;
72 CTRL_READ(low, high, msrs, i); 76 CTRL_READ(low, high, msrs, i);
73 CTRL_CLEAR(low); 77 CTRL_CLEAR_LO(low);
78 CTRL_CLEAR_HI(high);
74 CTRL_WRITE(low, high, msrs, i); 79 CTRL_WRITE(low, high, msrs, i);
75 } 80 }
76 81
@@ -89,12 +94,17 @@ static void athlon_setup_ctrs(struct op_msrs const * const msrs)
89 CTR_WRITE(counter_config[i].count, msrs, i); 94 CTR_WRITE(counter_config[i].count, msrs, i);
90 95
91 CTRL_READ(low, high, msrs, i); 96 CTRL_READ(low, high, msrs, i);
92 CTRL_CLEAR(low); 97 CTRL_CLEAR_LO(low);
98 CTRL_CLEAR_HI(high);
93 CTRL_SET_ENABLE(low); 99 CTRL_SET_ENABLE(low);
94 CTRL_SET_USR(low, counter_config[i].user); 100 CTRL_SET_USR(low, counter_config[i].user);
95 CTRL_SET_KERN(low, counter_config[i].kernel); 101 CTRL_SET_KERN(low, counter_config[i].kernel);
96 CTRL_SET_UM(low, counter_config[i].unit_mask); 102 CTRL_SET_UM(low, counter_config[i].unit_mask);
97 CTRL_SET_EVENT(low, counter_config[i].event); 103 CTRL_SET_EVENT_LOW(low, counter_config[i].event);
104 CTRL_SET_EVENT_HIGH(high, counter_config[i].event);
105 CTRL_SET_HOST_ONLY(high, 0);
106 CTRL_SET_GUEST_ONLY(high, 0);
107
98 CTRL_WRITE(low, high, msrs, i); 108 CTRL_WRITE(low, high, msrs, i);
99 } else { 109 } else {
100 reset_value[i] = 0; 110 reset_value[i] = 0;
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c
index b61fb36674e7..f21b9b0899a8 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platform-iss/network.c
@@ -393,11 +393,11 @@ static int iss_net_rx(struct net_device *dev)
393 if (pkt_len > 0) { 393 if (pkt_len > 0) {
394 skb_trim(skb, pkt_len); 394 skb_trim(skb, pkt_len);
395 skb->protocol = lp->tp.protocol(skb); 395 skb->protocol = lp->tp.protocol(skb);
396 // netif_rx(skb);
397 netif_rx_ni(skb);
398 396
399 lp->stats.rx_bytes += skb->len; 397 lp->stats.rx_bytes += skb->len;
400 lp->stats.rx_packets++; 398 lp->stats.rx_packets++;
399 // netif_rx(skb);
400 netif_rx_ni(skb);
401 return pkt_len; 401 return pkt_len;
402 } 402 }
403 kfree_skb(skb); 403 kfree_skb(skb);
diff --git a/block/as-iosched.c b/block/as-iosched.c
index dc715a562e14..cb5e53b05c7c 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -880,7 +880,7 @@ static void as_remove_queued_request(struct request_queue *q,
880} 880}
881 881
882/* 882/*
883 * as_fifo_expired returns 0 if there are no expired reads on the fifo, 883 * as_fifo_expired returns 0 if there are no expired requests on the fifo,
884 * 1 otherwise. It is ratelimited so that we only perform the check once per 884 * 1 otherwise. It is ratelimited so that we only perform the check once per
885 * `fifo_expire' interval. Otherwise a large number of expired requests 885 * `fifo_expire' interval. Otherwise a large number of expired requests
886 * would create a hopeless seekstorm. 886 * would create a hopeless seekstorm.
@@ -1097,7 +1097,8 @@ dispatch_writes:
1097 ad->batch_data_dir = REQ_ASYNC; 1097 ad->batch_data_dir = REQ_ASYNC;
1098 ad->current_write_count = ad->write_batch_count; 1098 ad->current_write_count = ad->write_batch_count;
1099 ad->write_batch_idled = 0; 1099 ad->write_batch_idled = 0;
1100 rq = ad->next_rq[ad->batch_data_dir]; 1100 rq = rq_entry_fifo(ad->fifo_list[REQ_ASYNC].next);
1101 ad->last_check_fifo[REQ_ASYNC] = jiffies;
1101 goto dispatch_request; 1102 goto dispatch_request;
1102 } 1103 }
1103 1104
@@ -1159,7 +1160,7 @@ static void as_add_request(struct request_queue *q, struct request *rq)
1159 as_add_rq_rb(ad, rq); 1160 as_add_rq_rb(ad, rq);
1160 1161
1161 /* 1162 /*
1162 * set expire time (only used for reads) and add to fifo list 1163 * set expire time and add to fifo list
1163 */ 1164 */
1164 rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]); 1165 rq_set_fifo_time(rq, jiffies + ad->fifo_expire[data_dir]);
1165 list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]); 1166 list_add_tail(&rq->queuelist, &ad->fifo_list[data_dir]);
@@ -1463,7 +1464,9 @@ static struct elevator_type iosched_as = {
1463 1464
1464static int __init as_init(void) 1465static int __init as_init(void)
1465{ 1466{
1466 return elv_register(&iosched_as); 1467 elv_register(&iosched_as);
1468
1469 return 0;
1467} 1470}
1468 1471
1469static void __exit as_exit(void) 1472static void __exit as_exit(void)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 0b4a47905575..13553e015d72 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2279,8 +2279,6 @@ static struct elevator_type iosched_cfq = {
2279 2279
2280static int __init cfq_init(void) 2280static int __init cfq_init(void)
2281{ 2281{
2282 int ret;
2283
2284 /* 2282 /*
2285 * could be 0 on HZ < 1000 setups 2283 * could be 0 on HZ < 1000 setups
2286 */ 2284 */
@@ -2292,11 +2290,9 @@ static int __init cfq_init(void)
2292 if (cfq_slab_setup()) 2290 if (cfq_slab_setup())
2293 return -ENOMEM; 2291 return -ENOMEM;
2294 2292
2295 ret = elv_register(&iosched_cfq); 2293 elv_register(&iosched_cfq);
2296 if (ret)
2297 cfq_slab_kill();
2298 2294
2299 return ret; 2295 return 0;
2300} 2296}
2301 2297
2302static void __exit cfq_exit(void) 2298static void __exit cfq_exit(void)
diff --git a/block/deadline-iosched.c b/block/deadline-iosched.c
index a054eef8dff6..342448c3d2dd 100644
--- a/block/deadline-iosched.c
+++ b/block/deadline-iosched.c
@@ -467,7 +467,9 @@ static struct elevator_type iosched_deadline = {
467 467
468static int __init deadline_init(void) 468static int __init deadline_init(void)
469{ 469{
470 return elv_register(&iosched_deadline); 470 elv_register(&iosched_deadline);
471
472 return 0;
471} 473}
472 474
473static void __exit deadline_exit(void) 475static void __exit deadline_exit(void)
diff --git a/block/elevator.c b/block/elevator.c
index 446aea2a3cfb..e452deb80395 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -960,7 +960,7 @@ void elv_unregister_queue(struct request_queue *q)
960 __elv_unregister_queue(q->elevator); 960 __elv_unregister_queue(q->elevator);
961} 961}
962 962
963int elv_register(struct elevator_type *e) 963void elv_register(struct elevator_type *e)
964{ 964{
965 char *def = ""; 965 char *def = "";
966 966
@@ -975,7 +975,6 @@ int elv_register(struct elevator_type *e)
975 def = " (default)"; 975 def = " (default)";
976 976
977 printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def); 977 printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
978 return 0;
979} 978}
980EXPORT_SYMBOL_GPL(elv_register); 979EXPORT_SYMBOL_GPL(elv_register);
981 980
diff --git a/block/noop-iosched.c b/block/noop-iosched.c
index 7563d8aa3944..c23e02969650 100644
--- a/block/noop-iosched.c
+++ b/block/noop-iosched.c
@@ -101,7 +101,9 @@ static struct elevator_type elevator_noop = {
101 101
102static int __init noop_init(void) 102static int __init noop_init(void)
103{ 103{
104 return elv_register(&elevator_noop); 104 elv_register(&elevator_noop);
105
106 return 0;
105} 107}
106 108
107static void __exit noop_exit(void) 109static void __exit noop_exit(void)
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 91c73224f4c6..9675b34638d4 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -230,7 +230,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
230 rq->cmd_len = hdr->cmd_len; 230 rq->cmd_len = hdr->cmd_len;
231 rq->cmd_type = REQ_TYPE_BLOCK_PC; 231 rq->cmd_type = REQ_TYPE_BLOCK_PC;
232 232
233 rq->timeout = (hdr->timeout * HZ) / 1000; 233 rq->timeout = msecs_to_jiffies(hdr->timeout);
234 if (!rq->timeout) 234 if (!rq->timeout)
235 rq->timeout = q->sg_timeout; 235 rq->timeout = q->sg_timeout;
236 if (!rq->timeout) 236 if (!rq->timeout)
@@ -366,7 +366,7 @@ static int sg_io(struct file *file, struct request_queue *q,
366 */ 366 */
367 blk_execute_rq(q, bd_disk, rq, 0); 367 blk_execute_rq(q, bd_disk, rq, 0);
368 368
369 hdr->duration = ((jiffies - start_time) * 1000) / HZ; 369 hdr->duration = jiffies_to_msecs(jiffies - start_time);
370 370
371 return blk_complete_sghdr_rq(rq, hdr, bio); 371 return blk_complete_sghdr_rq(rq, hdr, bio);
372out: 372out:
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7d6be23eff89..8f7505d304b5 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -125,7 +125,7 @@ static int acpi_battery_technology(struct acpi_battery *battery)
125 return POWER_SUPPLY_TECHNOLOGY_NiMH; 125 return POWER_SUPPLY_TECHNOLOGY_NiMH;
126 if (!strcasecmp("LION", battery->type)) 126 if (!strcasecmp("LION", battery->type))
127 return POWER_SUPPLY_TECHNOLOGY_LION; 127 return POWER_SUPPLY_TECHNOLOGY_LION;
128 if (!strcasecmp("LI-ION", battery->type)) 128 if (!strncasecmp("LI-ION", battery->type, 6))
129 return POWER_SUPPLY_TECHNOLOGY_LION; 129 return POWER_SUPPLY_TECHNOLOGY_LION;
130 if (!strcasecmp("LiP", battery->type)) 130 if (!strcasecmp("LiP", battery->type))
131 return POWER_SUPPLY_TECHNOLOGY_LIPO; 131 return POWER_SUPPLY_TECHNOLOGY_LIPO;
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index ab04d848b19d..0822d9fc1cb4 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -38,9 +38,9 @@ ACPI_MODULE_NAME("numa");
38static nodemask_t nodes_found_map = NODE_MASK_NONE; 38static nodemask_t nodes_found_map = NODE_MASK_NONE;
39 39
40/* maps to convert between proximity domain and logical node ID */ 40/* maps to convert between proximity domain and logical node ID */
41static int __cpuinitdata pxm_to_node_map[MAX_PXM_DOMAINS] 41static int pxm_to_node_map[MAX_PXM_DOMAINS]
42 = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL }; 42 = { [0 ... MAX_PXM_DOMAINS - 1] = NID_INVAL };
43static int __cpuinitdata node_to_pxm_map[MAX_NUMNODES] 43static int node_to_pxm_map[MAX_NUMNODES]
44 = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL }; 44 = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
45 45
46int pxm_to_node(int pxm) 46int pxm_to_node(int pxm)
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
index 028969370bbf..388300de005d 100644
--- a/drivers/acpi/pci_bind.c
+++ b/drivers/acpi/pci_bind.c
@@ -294,9 +294,6 @@ int acpi_pci_unbind(struct acpi_device *device)
294 acpi_get_data(device->handle, acpi_pci_data_handler, 294 acpi_get_data(device->handle, acpi_pci_data_handler,
295 (void **)&data); 295 (void **)&data);
296 if (ACPI_FAILURE(status)) { 296 if (ACPI_FAILURE(status)) {
297 ACPI_EXCEPTION((AE_INFO, status,
298 "Unable to get data from device %s",
299 acpi_device_bid(device)));
300 result = -ENODEV; 297 result = -ENODEV;
301 goto end; 298 goto end;
302 } 299 }
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 6045cdbe176b..22cb95b349e4 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -54,12 +54,6 @@
54#define ACPI_BATTERY_DIR_NAME "BAT%i" 54#define ACPI_BATTERY_DIR_NAME "BAT%i"
55#define ACPI_AC_DIR_NAME "AC0" 55#define ACPI_AC_DIR_NAME "AC0"
56 56
57enum acpi_sbs_device_addr {
58 ACPI_SBS_CHARGER = 0x9,
59 ACPI_SBS_MANAGER = 0xa,
60 ACPI_SBS_BATTERY = 0xb,
61};
62
63#define ACPI_SBS_NOTIFY_STATUS 0x80 57#define ACPI_SBS_NOTIFY_STATUS 0x80
64#define ACPI_SBS_NOTIFY_INFO 0x81 58#define ACPI_SBS_NOTIFY_INFO 0x81
65 59
@@ -539,7 +533,7 @@ static struct proc_dir_entry *acpi_battery_dir = NULL;
539 533
540static inline char *acpi_battery_units(struct acpi_battery *battery) 534static inline char *acpi_battery_units(struct acpi_battery *battery)
541{ 535{
542 return acpi_battery_mode(battery) ? " mWh" : " mAh"; 536 return acpi_battery_mode(battery) ? " mW" : " mA";
543} 537}
544 538
545 539
@@ -556,10 +550,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
556 if (!battery->present) 550 if (!battery->present)
557 goto end; 551 goto end;
558 552
559 seq_printf(seq, "design capacity: %i%s\n", 553 seq_printf(seq, "design capacity: %i%sh\n",
560 battery->design_capacity * acpi_battery_scale(battery), 554 battery->design_capacity * acpi_battery_scale(battery),
561 acpi_battery_units(battery)); 555 acpi_battery_units(battery));
562 seq_printf(seq, "last full capacity: %i%s\n", 556 seq_printf(seq, "last full capacity: %i%sh\n",
563 battery->full_charge_capacity * acpi_battery_scale(battery), 557 battery->full_charge_capacity * acpi_battery_scale(battery),
564 acpi_battery_units(battery)); 558 acpi_battery_units(battery));
565 seq_printf(seq, "battery technology: rechargeable\n"); 559 seq_printf(seq, "battery technology: rechargeable\n");
@@ -590,7 +584,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
590{ 584{
591 struct acpi_battery *battery = seq->private; 585 struct acpi_battery *battery = seq->private;
592 struct acpi_sbs *sbs = battery->sbs; 586 struct acpi_sbs *sbs = battery->sbs;
593 int result = 0; 587 int rate;
594 588
595 mutex_lock(&sbs->lock); 589 mutex_lock(&sbs->lock);
596 seq_printf(seq, "present: %s\n", 590 seq_printf(seq, "present: %s\n",
@@ -604,9 +598,12 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
604 seq_printf(seq, "charging state: %s\n", 598 seq_printf(seq, "charging state: %s\n",
605 (battery->current_now < 0) ? "discharging" : 599 (battery->current_now < 0) ? "discharging" :
606 ((battery->current_now > 0) ? "charging" : "charged")); 600 ((battery->current_now > 0) ? "charging" : "charged"));
607 seq_printf(seq, "present rate: %d mA\n", 601 rate = abs(battery->current_now) * acpi_battery_ipscale(battery);
608 abs(battery->current_now) * acpi_battery_ipscale(battery)); 602 rate *= (acpi_battery_mode(battery))?(battery->voltage_now *
609 seq_printf(seq, "remaining capacity: %i%s\n", 603 acpi_battery_vscale(battery)/1000):1;
604 seq_printf(seq, "present rate: %d%s\n", rate,
605 acpi_battery_units(battery));
606 seq_printf(seq, "remaining capacity: %i%sh\n",
610 battery->capacity_now * acpi_battery_scale(battery), 607 battery->capacity_now * acpi_battery_scale(battery),
611 acpi_battery_units(battery)); 608 acpi_battery_units(battery));
612 seq_printf(seq, "present voltage: %i mV\n", 609 seq_printf(seq, "present voltage: %i mV\n",
@@ -614,7 +611,7 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
614 611
615 end: 612 end:
616 mutex_unlock(&sbs->lock); 613 mutex_unlock(&sbs->lock);
617 return result; 614 return 0;
618} 615}
619 616
620static int acpi_battery_state_open_fs(struct inode *inode, struct file *file) 617static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
@@ -638,7 +635,7 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
638 acpi_battery_get_alarm(battery); 635 acpi_battery_get_alarm(battery);
639 seq_printf(seq, "alarm: "); 636 seq_printf(seq, "alarm: ");
640 if (battery->alarm_capacity) 637 if (battery->alarm_capacity)
641 seq_printf(seq, "%i%s\n", 638 seq_printf(seq, "%i%sh\n",
642 battery->alarm_capacity * 639 battery->alarm_capacity *
643 acpi_battery_scale(battery), 640 acpi_battery_scale(battery),
644 acpi_battery_units(battery)); 641 acpi_battery_units(battery));
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index 046d7c3ed356..fd40b6a1d639 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -202,10 +202,9 @@ int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc)
202 202
203EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback); 203EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback);
204 204
205static void acpi_smbus_callback(void *context) 205static inline void acpi_smbus_callback(void *context)
206{ 206{
207 struct acpi_smb_hc *hc = context; 207 struct acpi_smb_hc *hc = context;
208
209 if (hc->callback) 208 if (hc->callback)
210 hc->callback(hc->context); 209 hc->callback(hc->context);
211} 210}
@@ -214,6 +213,7 @@ static int smbus_alarm(void *context)
214{ 213{
215 struct acpi_smb_hc *hc = context; 214 struct acpi_smb_hc *hc = context;
216 union acpi_smb_status status; 215 union acpi_smb_status status;
216 u8 address;
217 if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw)) 217 if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))
218 return 0; 218 return 0;
219 /* Check if it is only a completion notify */ 219 /* Check if it is only a completion notify */
@@ -222,9 +222,18 @@ static int smbus_alarm(void *context)
222 if (!status.fields.alarm) 222 if (!status.fields.alarm)
223 return 0; 223 return 0;
224 mutex_lock(&hc->lock); 224 mutex_lock(&hc->lock);
225 smb_hc_read(hc, ACPI_SMB_ALARM_ADDRESS, &address);
226 status.fields.alarm = 0;
225 smb_hc_write(hc, ACPI_SMB_STATUS, status.raw); 227 smb_hc_write(hc, ACPI_SMB_STATUS, status.raw);
226 if (hc->callback) 228 /* We are only interested in events coming from known devices */
227 acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc); 229 switch (address >> 1) {
230 case ACPI_SBS_CHARGER:
231 case ACPI_SBS_MANAGER:
232 case ACPI_SBS_BATTERY:
233 acpi_os_execute(OSL_GPE_HANDLER,
234 acpi_smbus_callback, hc);
235 default:;
236 }
228 mutex_unlock(&hc->lock); 237 mutex_unlock(&hc->lock);
229 return 0; 238 return 0;
230} 239}
diff --git a/drivers/acpi/sbshc.h b/drivers/acpi/sbshc.h
index 3bda3491a97b..a57b0762dd7f 100644
--- a/drivers/acpi/sbshc.h
+++ b/drivers/acpi/sbshc.h
@@ -16,6 +16,12 @@ enum acpi_smb_protocol {
16 16
17static const u8 SMBUS_PEC = 0x80; 17static const u8 SMBUS_PEC = 0x80;
18 18
19enum acpi_sbs_device_addr {
20 ACPI_SBS_CHARGER = 0x9,
21 ACPI_SBS_MANAGER = 0xa,
22 ACPI_SBS_BATTERY = 0xb,
23};
24
19typedef void (*smbus_alarm_callback)(void *context); 25typedef void (*smbus_alarm_callback)(void *context);
20 26
21extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address, 27extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address,
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 44a0d9ba9bd6..bd77e81e81c1 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -577,7 +577,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
577 struct acpi_video_device_brightness *br = NULL; 577 struct acpi_video_device_brightness *br = NULL;
578 578
579 579
580 memset(&device->cap, 0, 4); 580 memset(&device->cap, 0, sizeof(device->cap));
581 581
582 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { 582 if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) {
583 device->cap._ADR = 1; 583 device->cap._ADR = 1;
@@ -697,7 +697,7 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
697{ 697{
698 acpi_handle h_dummy1; 698 acpi_handle h_dummy1;
699 699
700 memset(&video->cap, 0, 4); 700 memset(&video->cap, 0, sizeof(video->cap));
701 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { 701 if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) {
702 video->cap._DOS = 1; 702 video->cap._DOS = 1;
703 } 703 }
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index 545ea865ceb5..7bf4befd96bc 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -6,6 +6,7 @@
6 * Copyright (C) 2006 Randy Dunlap 6 * Copyright (C) 2006 Randy Dunlap
7 */ 7 */
8 8
9#include <linux/module.h>
9#include <linux/ata.h> 10#include <linux/ata.h>
10#include <linux/delay.h> 11#include <linux/delay.h>
11#include <linux/device.h> 12#include <linux/device.h>
@@ -25,6 +26,18 @@
25#include <acpi/acmacros.h> 26#include <acpi/acmacros.h>
26#include <acpi/actypes.h> 27#include <acpi/actypes.h>
27 28
29enum {
30 ATA_ACPI_FILTER_SETXFER = 1 << 0,
31 ATA_ACPI_FILTER_LOCK = 1 << 1,
32
33 ATA_ACPI_FILTER_DEFAULT = ATA_ACPI_FILTER_SETXFER |
34 ATA_ACPI_FILTER_LOCK,
35};
36
37static unsigned int ata_acpi_gtf_filter = ATA_ACPI_FILTER_DEFAULT;
38module_param_named(acpi_gtf_filter, ata_acpi_gtf_filter, int, 0644);
39MODULE_PARM_DESC(acpi_gtf_filter, "filter mask for ACPI _GTF commands, set to filter out (0x1=set xfermode, 0x2=lock/freeze lock)");
40
28#define NO_PORT_MULT 0xffff 41#define NO_PORT_MULT 0xffff
29#define SATA_ADR(root, pmp) (((root) << 16) | (pmp)) 42#define SATA_ADR(root, pmp) (((root) << 16) | (pmp))
30 43
@@ -41,6 +54,12 @@ static int is_pci_dev(struct device *dev)
41 return (dev->bus == &pci_bus_type); 54 return (dev->bus == &pci_bus_type);
42} 55}
43 56
57static void ata_acpi_clear_gtf(struct ata_device *dev)
58{
59 kfree(dev->gtf_cache);
60 dev->gtf_cache = NULL;
61}
62
44/** 63/**
45 * ata_acpi_associate_sata_port - associate SATA port with ACPI objects 64 * ata_acpi_associate_sata_port - associate SATA port with ACPI objects
46 * @ap: target SATA port 65 * @ap: target SATA port
@@ -94,6 +113,9 @@ static void ata_acpi_associate_ide_port(struct ata_port *ap)
94 113
95 dev->acpi_handle = acpi_get_child(ap->acpi_handle, i); 114 dev->acpi_handle = acpi_get_child(ap->acpi_handle, i);
96 } 115 }
116
117 if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
118 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
97} 119}
98 120
99static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj, 121static void ata_acpi_handle_hotplug(struct ata_port *ap, struct kobject *kobj,
@@ -188,6 +210,32 @@ void ata_acpi_associate(struct ata_host *host)
188} 210}
189 211
190/** 212/**
213 * ata_acpi_dissociate - dissociate ATA host from ACPI objects
214 * @host: target ATA host
215 *
216 * This function is called during driver detach after the whole host
217 * is shut down.
218 *
219 * LOCKING:
220 * EH context.
221 */
222void ata_acpi_dissociate(struct ata_host *host)
223{
224 int i;
225
226 /* Restore initial _GTM values so that driver which attaches
227 * afterward can use them too.
228 */
229 for (i = 0; i < host->n_ports; i++) {
230 struct ata_port *ap = host->ports[i];
231 const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
232
233 if (ap->acpi_handle && gtm)
234 ata_acpi_stm(ap, gtm);
235 }
236}
237
238/**
191 * ata_acpi_gtm - execute _GTM 239 * ata_acpi_gtm - execute _GTM
192 * @ap: target ATA port 240 * @ap: target ATA port
193 * @gtm: out parameter for _GTM result 241 * @gtm: out parameter for _GTM result
@@ -200,7 +248,7 @@ void ata_acpi_associate(struct ata_host *host)
200 * RETURNS: 248 * RETURNS:
201 * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure. 249 * 0 on success, -ENOENT if _GTM doesn't exist, -errno on failure.
202 */ 250 */
203int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *gtm) 251int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *gtm)
204{ 252{
205 struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER }; 253 struct acpi_buffer output = { .length = ACPI_ALLOCATE_BUFFER };
206 union acpi_object *out_obj; 254 union acpi_object *out_obj;
@@ -259,15 +307,16 @@ EXPORT_SYMBOL_GPL(ata_acpi_gtm);
259 * RETURNS: 307 * RETURNS:
260 * 0 on success, -ENOENT if _STM doesn't exist, -errno on failure. 308 * 0 on success, -ENOENT if _STM doesn't exist, -errno on failure.
261 */ 309 */
262int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm) 310int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm)
263{ 311{
264 acpi_status status; 312 acpi_status status;
313 struct ata_acpi_gtm stm_buf = *stm;
265 struct acpi_object_list input; 314 struct acpi_object_list input;
266 union acpi_object in_params[3]; 315 union acpi_object in_params[3];
267 316
268 in_params[0].type = ACPI_TYPE_BUFFER; 317 in_params[0].type = ACPI_TYPE_BUFFER;
269 in_params[0].buffer.length = sizeof(struct ata_acpi_gtm); 318 in_params[0].buffer.length = sizeof(struct ata_acpi_gtm);
270 in_params[0].buffer.pointer = (u8 *)stm; 319 in_params[0].buffer.pointer = (u8 *)&stm_buf;
271 /* Buffers for id may need byteswapping ? */ 320 /* Buffers for id may need byteswapping ? */
272 in_params[1].type = ACPI_TYPE_BUFFER; 321 in_params[1].type = ACPI_TYPE_BUFFER;
273 in_params[1].buffer.length = 512; 322 in_params[1].buffer.length = 512;
@@ -297,7 +346,6 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm);
297 * ata_dev_get_GTF - get the drive bootup default taskfile settings 346 * ata_dev_get_GTF - get the drive bootup default taskfile settings
298 * @dev: target ATA device 347 * @dev: target ATA device
299 * @gtf: output parameter for buffer containing _GTF taskfile arrays 348 * @gtf: output parameter for buffer containing _GTF taskfile arrays
300 * @ptr_to_free: pointer which should be freed
301 * 349 *
302 * This applies to both PATA and SATA drives. 350 * This applies to both PATA and SATA drives.
303 * 351 *
@@ -311,11 +359,10 @@ EXPORT_SYMBOL_GPL(ata_acpi_stm);
311 * EH context. 359 * EH context.
312 * 360 *
313 * RETURNS: 361 * RETURNS:
314 * Number of taskfiles on success, 0 if _GTF doesn't exist or doesn't 362 * Number of taskfiles on success, 0 if _GTF doesn't exist. -EINVAL
315 * contain valid data. 363 * if _GTF is invalid.
316 */ 364 */
317static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf, 365static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf)
318 void **ptr_to_free)
319{ 366{
320 struct ata_port *ap = dev->link->ap; 367 struct ata_port *ap = dev->link->ap;
321 acpi_status status; 368 acpi_status status;
@@ -323,6 +370,12 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
323 union acpi_object *out_obj; 370 union acpi_object *out_obj;
324 int rc = 0; 371 int rc = 0;
325 372
373 /* if _GTF is cached, use the cached value */
374 if (dev->gtf_cache) {
375 out_obj = dev->gtf_cache;
376 goto done;
377 }
378
326 /* set up output buffer */ 379 /* set up output buffer */
327 output.length = ACPI_ALLOCATE_BUFFER; 380 output.length = ACPI_ALLOCATE_BUFFER;
328 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ 381 output.pointer = NULL; /* ACPI-CA sets this; save/free it later */
@@ -333,12 +386,14 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
333 386
334 /* _GTF has no input parameters */ 387 /* _GTF has no input parameters */
335 status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output); 388 status = acpi_evaluate_object(dev->acpi_handle, "_GTF", NULL, &output);
389 out_obj = dev->gtf_cache = output.pointer;
336 390
337 if (ACPI_FAILURE(status)) { 391 if (ACPI_FAILURE(status)) {
338 if (status != AE_NOT_FOUND) { 392 if (status != AE_NOT_FOUND) {
339 ata_dev_printk(dev, KERN_WARNING, 393 ata_dev_printk(dev, KERN_WARNING,
340 "_GTF evaluation failed (AE 0x%x)\n", 394 "_GTF evaluation failed (AE 0x%x)\n",
341 status); 395 status);
396 rc = -EINVAL;
342 } 397 }
343 goto out_free; 398 goto out_free;
344 } 399 }
@@ -350,14 +405,15 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
350 __FUNCTION__, 405 __FUNCTION__,
351 (unsigned long long)output.length, 406 (unsigned long long)output.length,
352 output.pointer); 407 output.pointer);
408 rc = -EINVAL;
353 goto out_free; 409 goto out_free;
354 } 410 }
355 411
356 out_obj = output.pointer;
357 if (out_obj->type != ACPI_TYPE_BUFFER) { 412 if (out_obj->type != ACPI_TYPE_BUFFER) {
358 ata_dev_printk(dev, KERN_WARNING, 413 ata_dev_printk(dev, KERN_WARNING,
359 "_GTF unexpected object type 0x%x\n", 414 "_GTF unexpected object type 0x%x\n",
360 out_obj->type); 415 out_obj->type);
416 rc = -EINVAL;
361 goto out_free; 417 goto out_free;
362 } 418 }
363 419
@@ -365,21 +421,23 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
365 ata_dev_printk(dev, KERN_WARNING, 421 ata_dev_printk(dev, KERN_WARNING,
366 "unexpected _GTF length (%d)\n", 422 "unexpected _GTF length (%d)\n",
367 out_obj->buffer.length); 423 out_obj->buffer.length);
424 rc = -EINVAL;
368 goto out_free; 425 goto out_free;
369 } 426 }
370 427
371 *ptr_to_free = out_obj; 428 done:
372 *gtf = (void *)out_obj->buffer.pointer;
373 rc = out_obj->buffer.length / REGS_PER_GTF; 429 rc = out_obj->buffer.length / REGS_PER_GTF;
374 430 if (gtf) {
375 if (ata_msg_probe(ap)) 431 *gtf = (void *)out_obj->buffer.pointer;
376 ata_dev_printk(dev, KERN_DEBUG, "%s: returning " 432 if (ata_msg_probe(ap))
377 "gtf=%p, gtf_count=%d, ptr_to_free=%p\n", 433 ata_dev_printk(dev, KERN_DEBUG,
378 __FUNCTION__, *gtf, rc, *ptr_to_free); 434 "%s: returning gtf=%p, gtf_count=%d\n",
435 __FUNCTION__, *gtf, rc);
436 }
379 return rc; 437 return rc;
380 438
381 out_free: 439 out_free:
382 kfree(output.pointer); 440 ata_acpi_clear_gtf(dev);
383 return rc; 441 return rc;
384} 442}
385 443
@@ -393,22 +451,21 @@ static int ata_dev_get_GTF(struct ata_device *dev, struct ata_acpi_gtf **gtf,
393 451
394int ata_acpi_cbl_80wire(struct ata_port *ap) 452int ata_acpi_cbl_80wire(struct ata_port *ap)
395{ 453{
396 struct ata_acpi_gtm gtm; 454 const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
397 int valid = 0; 455 int valid = 0;
398 456
399 /* No _GTM data, no information */ 457 if (!gtm)
400 if (ata_acpi_gtm(ap, &gtm) < 0)
401 return 0; 458 return 0;
402 459
403 /* Split timing, DMA enabled */ 460 /* Split timing, DMA enabled */
404 if ((gtm.flags & 0x11) == 0x11 && gtm.drive[0].dma < 55) 461 if ((gtm->flags & 0x11) == 0x11 && gtm->drive[0].dma < 55)
405 valid |= 1; 462 valid |= 1;
406 if ((gtm.flags & 0x14) == 0x14 && gtm.drive[1].dma < 55) 463 if ((gtm->flags & 0x14) == 0x14 && gtm->drive[1].dma < 55)
407 valid |= 2; 464 valid |= 2;
408 /* Shared timing, DMA enabled */ 465 /* Shared timing, DMA enabled */
409 if ((gtm.flags & 0x11) == 0x01 && gtm.drive[0].dma < 55) 466 if ((gtm->flags & 0x11) == 0x01 && gtm->drive[0].dma < 55)
410 valid |= 1; 467 valid |= 1;
411 if ((gtm.flags & 0x14) == 0x04 && gtm.drive[0].dma < 55) 468 if ((gtm->flags & 0x14) == 0x04 && gtm->drive[0].dma < 55)
412 valid |= 2; 469 valid |= 2;
413 470
414 /* Drive check */ 471 /* Drive check */
@@ -421,8 +478,62 @@ int ata_acpi_cbl_80wire(struct ata_port *ap)
421 478
422EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire); 479EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
423 480
481static void ata_acpi_gtf_to_tf(struct ata_device *dev,
482 const struct ata_acpi_gtf *gtf,
483 struct ata_taskfile *tf)
484{
485 ata_tf_init(dev, tf);
486
487 tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
488 tf->protocol = ATA_PROT_NODATA;
489 tf->feature = gtf->tf[0]; /* 0x1f1 */
490 tf->nsect = gtf->tf[1]; /* 0x1f2 */
491 tf->lbal = gtf->tf[2]; /* 0x1f3 */
492 tf->lbam = gtf->tf[3]; /* 0x1f4 */
493 tf->lbah = gtf->tf[4]; /* 0x1f5 */
494 tf->device = gtf->tf[5]; /* 0x1f6 */
495 tf->command = gtf->tf[6]; /* 0x1f7 */
496}
497
498static int ata_acpi_filter_tf(const struct ata_taskfile *tf,
499 const struct ata_taskfile *ptf)
500{
501 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_SETXFER) {
502 /* libata doesn't use ACPI to configure transfer mode.
503 * It will only confuse device configuration. Skip.
504 */
505 if (tf->command == ATA_CMD_SET_FEATURES &&
506 tf->feature == SETFEATURES_XFER)
507 return 1;
508 }
509
510 if (ata_acpi_gtf_filter & ATA_ACPI_FILTER_LOCK) {
511 /* BIOS writers, sorry but we don't wanna lock
512 * features unless the user explicitly said so.
513 */
514
515 /* DEVICE CONFIGURATION FREEZE LOCK */
516 if (tf->command == ATA_CMD_CONF_OVERLAY &&
517 tf->feature == ATA_DCO_FREEZE_LOCK)
518 return 1;
519
520 /* SECURITY FREEZE LOCK */
521 if (tf->command == ATA_CMD_SEC_FREEZE_LOCK)
522 return 1;
523
524 /* SET MAX LOCK and SET MAX FREEZE LOCK */
525 if ((!ptf || ptf->command != ATA_CMD_READ_NATIVE_MAX) &&
526 tf->command == ATA_CMD_SET_MAX &&
527 (tf->feature == ATA_SET_MAX_LOCK ||
528 tf->feature == ATA_SET_MAX_FREEZE_LOCK))
529 return 1;
530 }
531
532 return 0;
533}
534
424/** 535/**
425 * taskfile_load_raw - send taskfile registers to host controller 536 * ata_acpi_run_tf - send taskfile registers to host controller
426 * @dev: target ATA device 537 * @dev: target ATA device
427 * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) 538 * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
428 * 539 *
@@ -441,56 +552,77 @@ EXPORT_SYMBOL_GPL(ata_acpi_cbl_80wire);
441 * EH context. 552 * EH context.
442 * 553 *
443 * RETURNS: 554 * RETURNS:
444 * 0 on success, -errno on failure. 555 * 1 if command is executed successfully. 0 if ignored, rejected or
556 * filtered out, -errno on other errors.
445 */ 557 */
446static int taskfile_load_raw(struct ata_device *dev, 558static int ata_acpi_run_tf(struct ata_device *dev,
447 const struct ata_acpi_gtf *gtf) 559 const struct ata_acpi_gtf *gtf,
560 const struct ata_acpi_gtf *prev_gtf)
448{ 561{
449 struct ata_port *ap = dev->link->ap; 562 struct ata_taskfile *pptf = NULL;
450 struct ata_taskfile tf, rtf; 563 struct ata_taskfile tf, ptf, rtf;
451 unsigned int err_mask; 564 unsigned int err_mask;
565 const char *level;
566 char msg[60];
567 int rc;
452 568
453 if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0) 569 if ((gtf->tf[0] == 0) && (gtf->tf[1] == 0) && (gtf->tf[2] == 0)
454 && (gtf->tf[3] == 0) && (gtf->tf[4] == 0) && (gtf->tf[5] == 0) 570 && (gtf->tf[3] == 0) && (gtf->tf[4] == 0) && (gtf->tf[5] == 0)
455 && (gtf->tf[6] == 0)) 571 && (gtf->tf[6] == 0))
456 return 0; 572 return 0;
457 573
458 ata_tf_init(dev, &tf); 574 ata_acpi_gtf_to_tf(dev, gtf, &tf);
575 if (prev_gtf) {
576 ata_acpi_gtf_to_tf(dev, prev_gtf, &ptf);
577 pptf = &ptf;
578 }
459 579
460 /* convert gtf to tf */ 580 if (!ata_acpi_filter_tf(&tf, pptf)) {
461 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ 581 rtf = tf;
462 tf.protocol = ATA_PROT_NODATA; 582 err_mask = ata_exec_internal(dev, &rtf, NULL,
463 tf.feature = gtf->tf[0]; /* 0x1f1 */ 583 DMA_NONE, NULL, 0, 0);
464 tf.nsect = gtf->tf[1]; /* 0x1f2 */
465 tf.lbal = gtf->tf[2]; /* 0x1f3 */
466 tf.lbam = gtf->tf[3]; /* 0x1f4 */
467 tf.lbah = gtf->tf[4]; /* 0x1f5 */
468 tf.device = gtf->tf[5]; /* 0x1f6 */
469 tf.command = gtf->tf[6]; /* 0x1f7 */
470 584
471 if (ata_msg_probe(ap)) 585 switch (err_mask) {
472 ata_dev_printk(dev, KERN_DEBUG, "executing ACPI cmd " 586 case 0:
473 "%02x/%02x:%02x:%02x:%02x:%02x:%02x\n", 587 level = KERN_DEBUG;
474 tf.command, tf.feature, tf.nsect, 588 snprintf(msg, sizeof(msg), "succeeded");
475 tf.lbal, tf.lbam, tf.lbah, tf.device); 589 rc = 1;
476 590 break;
477 rtf = tf; 591
478 err_mask = ata_exec_internal(dev, &rtf, NULL, DMA_NONE, NULL, 0, 0); 592 case AC_ERR_DEV:
479 if (err_mask) { 593 level = KERN_INFO;
480 ata_dev_printk(dev, KERN_ERR, 594 snprintf(msg, sizeof(msg),
481 "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x failed " 595 "rejected by device (Stat=0x%02x Err=0x%02x)",
482 "(Emask=0x%x Stat=0x%02x Err=0x%02x)\n", 596 rtf.command, rtf.feature);
483 tf.command, tf.feature, tf.nsect, tf.lbal, tf.lbam, 597 rc = 0;
484 tf.lbah, tf.device, err_mask, rtf.command, rtf.feature); 598 break;
485 return -EIO; 599
600 default:
601 level = KERN_ERR;
602 snprintf(msg, sizeof(msg),
603 "failed (Emask=0x%x Stat=0x%02x Err=0x%02x)",
604 err_mask, rtf.command, rtf.feature);
605 rc = -EIO;
606 break;
607 }
608 } else {
609 level = KERN_INFO;
610 snprintf(msg, sizeof(msg), "filtered out");
611 rc = 0;
486 } 612 }
487 613
488 return 0; 614 ata_dev_printk(dev, level,
615 "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x %s\n",
616 tf.command, tf.feature, tf.nsect, tf.lbal,
617 tf.lbam, tf.lbah, tf.device, msg);
618
619 return rc;
489} 620}
490 621
491/** 622/**
492 * ata_acpi_exec_tfs - get then write drive taskfile settings 623 * ata_acpi_exec_tfs - get then write drive taskfile settings
493 * @dev: target ATA device 624 * @dev: target ATA device
625 * @nr_executed: out paramter for the number of executed commands
494 * 626 *
495 * Evaluate _GTF and excute returned taskfiles. 627 * Evaluate _GTF and excute returned taskfiles.
496 * 628 *
@@ -498,35 +630,36 @@ static int taskfile_load_raw(struct ata_device *dev,
498 * EH context. 630 * EH context.
499 * 631 *
500 * RETURNS: 632 * RETURNS:
501 * Number of executed taskfiles on success, 0 if _GTF doesn't exist or 633 * Number of executed taskfiles on success, 0 if _GTF doesn't exist.
502 * doesn't contain valid data. -errno on other errors. 634 * -errno on other errors.
503 */ 635 */
504static int ata_acpi_exec_tfs(struct ata_device *dev) 636static int ata_acpi_exec_tfs(struct ata_device *dev, int *nr_executed)
505{ 637{
506 struct ata_acpi_gtf *gtf = NULL; 638 struct ata_acpi_gtf *gtf = NULL, *pgtf = NULL;
507 void *ptr_to_free = NULL;
508 int gtf_count, i, rc; 639 int gtf_count, i, rc;
509 640
510 /* get taskfiles */ 641 /* get taskfiles */
511 gtf_count = ata_dev_get_GTF(dev, &gtf, &ptr_to_free); 642 rc = ata_dev_get_GTF(dev, &gtf);
643 if (rc < 0)
644 return rc;
645 gtf_count = rc;
512 646
513 /* execute them */ 647 /* execute them */
514 for (i = 0, rc = 0; i < gtf_count; i++) { 648 for (i = 0; i < gtf_count; i++, gtf++) {
515 int tmp; 649 rc = ata_acpi_run_tf(dev, gtf, pgtf);
516 650 if (rc < 0)
517 /* ACPI errors are eventually ignored. Run till the 651 break;
518 * end even after errors. 652 if (rc) {
519 */ 653 (*nr_executed)++;
520 tmp = taskfile_load_raw(dev, gtf++); 654 pgtf = gtf;
521 if (!rc) 655 }
522 rc = tmp;
523 } 656 }
524 657
525 kfree(ptr_to_free); 658 ata_acpi_clear_gtf(dev);
526 659
527 if (rc == 0) 660 if (rc < 0)
528 return gtf_count; 661 return rc;
529 return rc; 662 return 0;
530} 663}
531 664
532/** 665/**
@@ -596,27 +729,8 @@ static int ata_acpi_push_id(struct ata_device *dev)
596 */ 729 */
597int ata_acpi_on_suspend(struct ata_port *ap) 730int ata_acpi_on_suspend(struct ata_port *ap)
598{ 731{
599 unsigned long flags; 732 /* nada */
600 int rc; 733 return 0;
601
602 /* proceed iff per-port acpi_handle is valid */
603 if (!ap->acpi_handle)
604 return 0;
605 BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA);
606
607 /* store timing parameters */
608 rc = ata_acpi_gtm(ap, &ap->acpi_gtm);
609
610 spin_lock_irqsave(ap->lock, flags);
611 if (rc == 0)
612 ap->pflags |= ATA_PFLAG_GTM_VALID;
613 else
614 ap->pflags &= ~ATA_PFLAG_GTM_VALID;
615 spin_unlock_irqrestore(ap->lock, flags);
616
617 if (rc == -ENOENT)
618 rc = 0;
619 return rc;
620} 734}
621 735
622/** 736/**
@@ -631,18 +745,34 @@ int ata_acpi_on_suspend(struct ata_port *ap)
631 */ 745 */
632void ata_acpi_on_resume(struct ata_port *ap) 746void ata_acpi_on_resume(struct ata_port *ap)
633{ 747{
748 const struct ata_acpi_gtm *gtm = ata_acpi_init_gtm(ap);
634 struct ata_device *dev; 749 struct ata_device *dev;
635 750
636 if (ap->acpi_handle && (ap->pflags & ATA_PFLAG_GTM_VALID)) { 751 if (ap->acpi_handle && gtm) {
637 BUG_ON(ap->flags & ATA_FLAG_ACPI_SATA); 752 /* _GTM valid */
638 753
639 /* restore timing parameters */ 754 /* restore timing parameters */
640 ata_acpi_stm(ap, &ap->acpi_gtm); 755 ata_acpi_stm(ap, gtm);
641 }
642 756
643 /* schedule _GTF */ 757 /* _GTF should immediately follow _STM so that it can
644 ata_link_for_each_dev(dev, &ap->link) 758 * use values set by _STM. Cache _GTF result and
645 dev->flags |= ATA_DFLAG_ACPI_PENDING; 759 * schedule _GTF.
760 */
761 ata_link_for_each_dev(dev, &ap->link) {
762 ata_acpi_clear_gtf(dev);
763 if (ata_dev_get_GTF(dev, NULL) >= 0)
764 dev->flags |= ATA_DFLAG_ACPI_PENDING;
765 }
766 } else {
767 /* SATA _GTF needs to be evaulated after _SDD and
768 * there's no reason to evaluate IDE _GTF early
769 * without _STM. Clear cache and schedule _GTF.
770 */
771 ata_link_for_each_dev(dev, &ap->link) {
772 ata_acpi_clear_gtf(dev);
773 dev->flags |= ATA_DFLAG_ACPI_PENDING;
774 }
775 }
646} 776}
647 777
648/** 778/**
@@ -664,6 +794,7 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
664 struct ata_port *ap = dev->link->ap; 794 struct ata_port *ap = dev->link->ap;
665 struct ata_eh_context *ehc = &ap->link.eh_context; 795 struct ata_eh_context *ehc = &ap->link.eh_context;
666 int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA; 796 int acpi_sata = ap->flags & ATA_FLAG_ACPI_SATA;
797 int nr_executed = 0;
667 int rc; 798 int rc;
668 799
669 if (!dev->acpi_handle) 800 if (!dev->acpi_handle)
@@ -682,14 +813,14 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
682 } 813 }
683 814
684 /* do _GTF */ 815 /* do _GTF */
685 rc = ata_acpi_exec_tfs(dev); 816 rc = ata_acpi_exec_tfs(dev, &nr_executed);
686 if (rc < 0) 817 if (rc)
687 goto acpi_err; 818 goto acpi_err;
688 819
689 dev->flags &= ~ATA_DFLAG_ACPI_PENDING; 820 dev->flags &= ~ATA_DFLAG_ACPI_PENDING;
690 821
691 /* refresh IDENTIFY page if any _GTF command has been executed */ 822 /* refresh IDENTIFY page if any _GTF command has been executed */
692 if (rc > 0) { 823 if (nr_executed) {
693 rc = ata_dev_reread_id(dev, 0); 824 rc = ata_dev_reread_id(dev, 0);
694 if (rc < 0) { 825 if (rc < 0) {
695 ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY " 826 ata_dev_printk(dev, KERN_ERR, "failed to IDENTIFY "
@@ -701,17 +832,39 @@ int ata_acpi_on_devcfg(struct ata_device *dev)
701 return 0; 832 return 0;
702 833
703 acpi_err: 834 acpi_err:
704 /* let EH retry on the first failure, disable ACPI on the second */ 835 /* ignore evaluation failure if we can continue safely */
705 if (dev->flags & ATA_DFLAG_ACPI_FAILED) { 836 if (rc == -EINVAL && !nr_executed && !(ap->pflags & ATA_PFLAG_FROZEN))
706 ata_dev_printk(dev, KERN_WARNING, "ACPI on devcfg failed the " 837 return 0;
707 "second time, disabling (errno=%d)\n", rc);
708
709 dev->acpi_handle = NULL;
710 838
711 /* if port is working, request IDENTIFY reload and continue */ 839 /* fail and let EH retry once more for unknown IO errors */
712 if (!(ap->pflags & ATA_PFLAG_FROZEN)) 840 if (!(dev->flags & ATA_DFLAG_ACPI_FAILED)) {
713 rc = 1; 841 dev->flags |= ATA_DFLAG_ACPI_FAILED;
842 return rc;
714 } 843 }
715 dev->flags |= ATA_DFLAG_ACPI_FAILED; 844
845 ata_dev_printk(dev, KERN_WARNING,
846 "ACPI: failed the second time, disabled\n");
847 dev->acpi_handle = NULL;
848
849 /* We can safely continue if no _GTF command has been executed
850 * and port is not frozen.
851 */
852 if (!nr_executed && !(ap->pflags & ATA_PFLAG_FROZEN))
853 return 0;
854
716 return rc; 855 return rc;
717} 856}
857
858/**
859 * ata_acpi_on_disable - ATA ACPI hook called when a device is disabled
860 * @dev: target ATA device
861 *
862 * This function is called when @dev is about to be disabled.
863 *
864 * LOCKING:
865 * EH context.
866 */
867void ata_acpi_on_disable(struct ata_device *dev)
868{
869 ata_acpi_clear_gtf(dev);
870}
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e4dea8623a71..4753a1831dbc 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -64,6 +64,7 @@
64#include <linux/libata.h> 64#include <linux/libata.h>
65#include <asm/semaphore.h> 65#include <asm/semaphore.h>
66#include <asm/byteorder.h> 66#include <asm/byteorder.h>
67#include <linux/cdrom.h>
67 68
68#include "libata.h" 69#include "libata.h"
69 70
@@ -622,6 +623,7 @@ void ata_dev_disable(struct ata_device *dev)
622 if (ata_dev_enabled(dev)) { 623 if (ata_dev_enabled(dev)) {
623 if (ata_msg_drv(dev->link->ap)) 624 if (ata_msg_drv(dev->link->ap))
624 ata_dev_printk(dev, KERN_WARNING, "disabled\n"); 625 ata_dev_printk(dev, KERN_WARNING, "disabled\n");
626 ata_acpi_on_disable(dev);
625 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | 627 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
626 ATA_DNXFER_QUIET); 628 ATA_DNXFER_QUIET);
627 dev->class++; 629 dev->class++;
@@ -3923,6 +3925,7 @@ void ata_std_postreset(struct ata_link *link, unsigned int *classes)
3923 /* clear SError */ 3925 /* clear SError */
3924 if (sata_scr_read(link, SCR_ERROR, &serror) == 0) 3926 if (sata_scr_read(link, SCR_ERROR, &serror) == 0)
3925 sata_scr_write(link, SCR_ERROR, serror); 3927 sata_scr_write(link, SCR_ERROR, serror);
3928 link->eh_info.serror = 0;
3926 3929
3927 /* is double-select really necessary? */ 3930 /* is double-select really necessary? */
3928 if (classes[0] != ATA_DEV_NONE) 3931 if (classes[0] != ATA_DEV_NONE)
@@ -4149,6 +4152,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
4149 { "HITACHI HDS7250SASUN500G*", NULL, ATA_HORKAGE_NONCQ }, 4152 { "HITACHI HDS7250SASUN500G*", NULL, ATA_HORKAGE_NONCQ },
4150 { "HITACHI HDS7225SBSUN250G*", NULL, ATA_HORKAGE_NONCQ }, 4153 { "HITACHI HDS7225SBSUN250G*", NULL, ATA_HORKAGE_NONCQ },
4151 { "ST380817AS", "3.42", ATA_HORKAGE_NONCQ }, 4154 { "ST380817AS", "3.42", ATA_HORKAGE_NONCQ },
4155 { "ST3160023AS", "3.42", ATA_HORKAGE_NONCQ },
4152 4156
4153 /* Blacklist entries taken from Silicon Image 3124/3132 4157 /* Blacklist entries taken from Silicon Image 3124/3132
4154 Windows driver .inf file - also several Linux problem reports */ 4158 Windows driver .inf file - also several Linux problem reports */
@@ -4649,6 +4653,43 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc)
4649} 4653}
4650 4654
4651/** 4655/**
4656 * atapi_qc_may_overflow - Check whether data transfer may overflow
4657 * @qc: ATA command in question
4658 *
4659 * ATAPI commands which transfer variable length data to host
4660 * might overflow due to application error or hardare bug. This
4661 * function checks whether overflow should be drained and ignored
4662 * for @qc.
4663 *
4664 * LOCKING:
4665 * None.
4666 *
4667 * RETURNS:
4668 * 1 if @qc may overflow; otherwise, 0.
4669 */
4670static int atapi_qc_may_overflow(struct ata_queued_cmd *qc)
4671{
4672 if (qc->tf.protocol != ATA_PROT_ATAPI &&
4673 qc->tf.protocol != ATA_PROT_ATAPI_DMA)
4674 return 0;
4675
4676 if (qc->tf.flags & ATA_TFLAG_WRITE)
4677 return 0;
4678
4679 switch (qc->cdb[0]) {
4680 case READ_10:
4681 case READ_12:
4682 case WRITE_10:
4683 case WRITE_12:
4684 case GPCMD_READ_CD:
4685 case GPCMD_READ_CD_MSF:
4686 return 0;
4687 }
4688
4689 return 1;
4690}
4691
4692/**
4652 * ata_std_qc_defer - Check whether a qc needs to be deferred 4693 * ata_std_qc_defer - Check whether a qc needs to be deferred
4653 * @qc: ATA command in question 4694 * @qc: ATA command in question
4654 * 4695 *
@@ -5136,23 +5177,19 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
5136 * Inherited from caller. 5177 * Inherited from caller.
5137 * 5178 *
5138 */ 5179 */
5139 5180static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
5140static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
5141{ 5181{
5142 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE); 5182 int do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
5143 struct scatterlist *sg = qc->__sg;
5144 struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem);
5145 struct ata_port *ap = qc->ap; 5183 struct ata_port *ap = qc->ap;
5184 struct ata_eh_info *ehi = &qc->dev->link->eh_info;
5185 struct scatterlist *sg;
5146 struct page *page; 5186 struct page *page;
5147 unsigned char *buf; 5187 unsigned char *buf;
5148 unsigned int offset, count; 5188 unsigned int offset, count;
5149 int no_more_sg = 0;
5150
5151 if (qc->curbytes + bytes >= qc->nbytes)
5152 ap->hsm_task_state = HSM_ST_LAST;
5153 5189
5154next_sg: 5190next_sg:
5155 if (unlikely(no_more_sg)) { 5191 sg = qc->cursg;
5192 if (unlikely(!sg)) {
5156 /* 5193 /*
5157 * The end of qc->sg is reached and the device expects 5194 * The end of qc->sg is reached and the device expects
5158 * more data to transfer. In order not to overrun qc->sg 5195 * more data to transfer. In order not to overrun qc->sg
@@ -5161,21 +5198,28 @@ next_sg:
5161 * - for write case, padding zero data to the device 5198 * - for write case, padding zero data to the device
5162 */ 5199 */
5163 u16 pad_buf[1] = { 0 }; 5200 u16 pad_buf[1] = { 0 };
5164 unsigned int words = bytes >> 1;
5165 unsigned int i; 5201 unsigned int i;
5166 5202
5167 if (words) /* warning if bytes > 1 */ 5203 if (bytes > qc->curbytes - qc->nbytes + ATAPI_MAX_DRAIN) {
5168 ata_dev_printk(qc->dev, KERN_WARNING, 5204 ata_ehi_push_desc(ehi, "too much trailing data "
5169 "%u bytes trailing data\n", bytes); 5205 "buf=%u cur=%u bytes=%u",
5206 qc->nbytes, qc->curbytes, bytes);
5207 return -1;
5208 }
5170 5209
5171 for (i = 0; i < words; i++) 5210 /* overflow is exptected for misc ATAPI commands */
5211 if (bytes && !atapi_qc_may_overflow(qc))
5212 ata_dev_printk(qc->dev, KERN_WARNING, "ATAPI %u bytes "
5213 "trailing data (cdb=%02x nbytes=%u)\n",
5214 bytes, qc->cdb[0], qc->nbytes);
5215
5216 for (i = 0; i < (bytes + 1) / 2; i++)
5172 ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write); 5217 ap->ops->data_xfer(qc->dev, (unsigned char *)pad_buf, 2, do_write);
5173 5218
5174 ap->hsm_task_state = HSM_ST_LAST; 5219 qc->curbytes += bytes;
5175 return;
5176 }
5177 5220
5178 sg = qc->cursg; 5221 return 0;
5222 }
5179 5223
5180 page = sg_page(sg); 5224 page = sg_page(sg);
5181 offset = sg->offset + qc->cursg_ofs; 5225 offset = sg->offset + qc->cursg_ofs;
@@ -5210,19 +5254,20 @@ next_sg:
5210 } 5254 }
5211 5255
5212 bytes -= count; 5256 bytes -= count;
5257 if ((count & 1) && bytes)
5258 bytes--;
5213 qc->curbytes += count; 5259 qc->curbytes += count;
5214 qc->cursg_ofs += count; 5260 qc->cursg_ofs += count;
5215 5261
5216 if (qc->cursg_ofs == sg->length) { 5262 if (qc->cursg_ofs == sg->length) {
5217 if (qc->cursg == lsg)
5218 no_more_sg = 1;
5219
5220 qc->cursg = sg_next(qc->cursg); 5263 qc->cursg = sg_next(qc->cursg);
5221 qc->cursg_ofs = 0; 5264 qc->cursg_ofs = 0;
5222 } 5265 }
5223 5266
5224 if (bytes) 5267 if (bytes)
5225 goto next_sg; 5268 goto next_sg;
5269
5270 return 0;
5226} 5271}
5227 5272
5228/** 5273/**
@@ -5265,7 +5310,8 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
5265 5310
5266 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes); 5311 VPRINTK("ata%u: xfering %d bytes\n", ap->print_id, bytes);
5267 5312
5268 __atapi_pio_bytes(qc, bytes); 5313 if (__atapi_pio_bytes(qc, bytes))
5314 goto err_out;
5269 ata_altstatus(ap); /* flush */ 5315 ata_altstatus(ap); /* flush */
5270 5316
5271 return; 5317 return;
@@ -7208,18 +7254,14 @@ static void ata_port_detach(struct ata_port *ap)
7208 7254
7209 ata_port_wait_eh(ap); 7255 ata_port_wait_eh(ap);
7210 7256
7211 /* EH is now guaranteed to see UNLOADING, so no new device 7257 /* EH is now guaranteed to see UNLOADING - EH context belongs
7212 * will be attached. Disable all existing devices. 7258 * to us. Disable all existing devices.
7213 */ 7259 */
7214 spin_lock_irqsave(ap->lock, flags);
7215
7216 ata_port_for_each_link(link, ap) { 7260 ata_port_for_each_link(link, ap) {
7217 ata_link_for_each_dev(dev, link) 7261 ata_link_for_each_dev(dev, link)
7218 ata_dev_disable(dev); 7262 ata_dev_disable(dev);
7219 } 7263 }
7220 7264
7221 spin_unlock_irqrestore(ap->lock, flags);
7222
7223 /* Final freeze & EH. All in-flight commands are aborted. EH 7265 /* Final freeze & EH. All in-flight commands are aborted. EH
7224 * will be skipped and retrials will be terminated with bad 7266 * will be skipped and retrials will be terminated with bad
7225 * target. 7267 * target.
@@ -7251,6 +7293,9 @@ void ata_host_detach(struct ata_host *host)
7251 7293
7252 for (i = 0; i < host->n_ports; i++) 7294 for (i = 0; i < host->n_ports; i++)
7253 ata_port_detach(host->ports[i]); 7295 ata_port_detach(host->ports[i]);
7296
7297 /* the host is dead now, dissociate ACPI */
7298 ata_acpi_dissociate(host);
7254} 7299}
7255 7300
7256/** 7301/**
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index e6605f038647..f0124a8d3134 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1264,8 +1264,8 @@ static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc)
1264 tf.feature |= ATAPI_PKT_DMA; 1264 tf.feature |= ATAPI_PKT_DMA;
1265 } else { 1265 } else {
1266 tf.protocol = ATA_PROT_ATAPI; 1266 tf.protocol = ATA_PROT_ATAPI;
1267 tf.lbam = (8 * 1024) & 0xff; 1267 tf.lbam = SCSI_SENSE_BUFFERSIZE;
1268 tf.lbah = (8 * 1024) >> 8; 1268 tf.lbah = 0;
1269 } 1269 }
1270 1270
1271 return ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE, 1271 return ata_exec_internal(dev, &tf, cdb, DMA_FROM_DEVICE,
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 0e6cf3a484dc..bbe59c2fd1e2 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -108,15 +108,19 @@ extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm);
108#ifdef CONFIG_ATA_ACPI 108#ifdef CONFIG_ATA_ACPI
109extern void ata_acpi_associate_sata_port(struct ata_port *ap); 109extern void ata_acpi_associate_sata_port(struct ata_port *ap);
110extern void ata_acpi_associate(struct ata_host *host); 110extern void ata_acpi_associate(struct ata_host *host);
111extern void ata_acpi_dissociate(struct ata_host *host);
111extern int ata_acpi_on_suspend(struct ata_port *ap); 112extern int ata_acpi_on_suspend(struct ata_port *ap);
112extern void ata_acpi_on_resume(struct ata_port *ap); 113extern void ata_acpi_on_resume(struct ata_port *ap);
113extern int ata_acpi_on_devcfg(struct ata_device *adev); 114extern int ata_acpi_on_devcfg(struct ata_device *dev);
115extern void ata_acpi_on_disable(struct ata_device *dev);
114#else 116#else
115static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { } 117static inline void ata_acpi_associate_sata_port(struct ata_port *ap) { }
116static inline void ata_acpi_associate(struct ata_host *host) { } 118static inline void ata_acpi_associate(struct ata_host *host) { }
119static inline void ata_acpi_dissociate(struct ata_host *host) { }
117static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; } 120static inline int ata_acpi_on_suspend(struct ata_port *ap) { return 0; }
118static inline void ata_acpi_on_resume(struct ata_port *ap) { } 121static inline void ata_acpi_on_resume(struct ata_port *ap) { }
119static inline int ata_acpi_on_devcfg(struct ata_device *adev) { return 0; } 122static inline int ata_acpi_on_devcfg(struct ata_device *dev) { return 0; }
123static inline void ata_acpi_on_disable(struct ata_device *dev) { }
120#endif 124#endif
121 125
122/* libata-scsi.c */ 126/* libata-scsi.c */
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 46dc70e0dee7..c79f066c2bc9 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -375,7 +375,7 @@ static int hpt374_pre_reset(struct ata_link *link, unsigned long deadline)
375 pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000); 375 pci_write_config_word(pdev, mcrbase + 2, mcr3 | 0x8000);
376 pci_read_config_byte(pdev, 0x5A, &ata66); 376 pci_read_config_byte(pdev, 0x5A, &ata66);
377 /* Reset TCBLID/FCBLID to output */ 377 /* Reset TCBLID/FCBLID to output */
378 pci_write_config_word(pdev, 0x52, mcr3); 378 pci_write_config_word(pdev, mcrbase + 2, mcr3);
379 379
380 if (ata66 & (2 >> ap->port_no)) 380 if (ata66 & (2 >> ap->port_no))
381 ap->cbl = ATA_CBL_PATA40; 381 ap->cbl = ATA_CBL_PATA40;
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index fe0105d35bae..37b850ae0845 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -2506,11 +2506,31 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2506 if (pdev->vendor == PCI_VENDOR_ID_TTI && 2506 if (pdev->vendor == PCI_VENDOR_ID_TTI &&
2507 (pdev->device == 0x2300 || pdev->device == 0x2310)) 2507 (pdev->device == 0x2300 || pdev->device == 0x2310))
2508 { 2508 {
2509 printk(KERN_WARNING "sata_mv: Highpoint RocketRAID BIOS" 2509 /*
2510 " will CORRUPT DATA on attached drives when" 2510 * Highpoint RocketRAID PCIe 23xx series cards:
2511 " configured as \"Legacy\". BEWARE!\n"); 2511 *
2512 printk(KERN_WARNING "sata_mv: Use BIOS \"JBOD\" volumes" 2512 * Unconfigured drives are treated as "Legacy"
2513 " instead for safety.\n"); 2513 * by the BIOS, and it overwrites sector 8 with
2514 * a "Lgcy" metadata block prior to Linux boot.
2515 *
2516 * Configured drives (RAID or JBOD) leave sector 8
2517 * alone, but instead overwrite a high numbered
2518 * sector for the RAID metadata. This sector can
2519 * be determined exactly, by truncating the physical
2520 * drive capacity to a nice even GB value.
2521 *
2522 * RAID metadata is at: (dev->n_sectors & ~0xfffff)
2523 *
2524 * Warn the user, lest they think we're just buggy.
2525 */
2526 printk(KERN_WARNING DRV_NAME ": Highpoint RocketRAID"
2527 " BIOS CORRUPTS DATA on all attached drives,"
2528 " regardless of if/how they are configured."
2529 " BEWARE!\n");
2530 printk(KERN_WARNING DRV_NAME ": For data safety, do not"
2531 " use sectors 8-9 on \"Legacy\" drives,"
2532 " and avoid the final two gigabytes on"
2533 " all RocketRAID BIOS initialized drives.\n");
2514 } 2534 }
2515 case chip_6042: 2535 case chip_6042:
2516 hpriv->ops = &mv6xxx_ops; 2536 hpriv->ops = &mv6xxx_ops;
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 4e6e381279cc..f5119bf40c24 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -390,23 +390,19 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
390 sil_scr_read(ap, SCR_ERROR, &serror); 390 sil_scr_read(ap, SCR_ERROR, &serror);
391 sil_scr_write(ap, SCR_ERROR, serror); 391 sil_scr_write(ap, SCR_ERROR, serror);
392 392
393 /* Trigger hotplug and accumulate SError only if the 393 /* Sometimes spurious interrupts occur, double check
394 * port isn't already frozen. Otherwise, PHY events 394 * it's PHYRDY CHG.
395 * during hardreset makes controllers with broken SIEN
396 * repeat probing needlessly.
397 */ 395 */
398 if (!(ap->pflags & ATA_PFLAG_FROZEN)) { 396 if (serror & SERR_PHYRDY_CHG) {
399 ata_ehi_hotplugged(&ap->link.eh_info);
400 ap->link.eh_info.serror |= serror; 397 ap->link.eh_info.serror |= serror;
398 goto freeze;
401 } 399 }
402 400
403 goto freeze; 401 if (!(bmdma2 & SIL_DMA_COMPLETE))
402 return;
404 } 403 }
405 404
406 if (unlikely(!qc)) 405 if (unlikely(!qc || (qc->tf.flags & ATA_TFLAG_POLLING))) {
407 goto freeze;
408
409 if (unlikely(qc->tf.flags & ATA_TFLAG_POLLING)) {
410 /* this sometimes happens, just clear IRQ */ 406 /* this sometimes happens, just clear IRQ */
411 ata_chk_status(ap); 407 ata_chk_status(ap);
412 return; 408 return;
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/fore200e.c b/drivers/atm/fore200e.c
index 8b12925fe7a4..f97e050338f0 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2689,7 +2689,7 @@ fore200e_init(struct fore200e* fore200e)
2689 return 0; 2689 return 0;
2690} 2690}
2691 2691
2692 2692#ifdef CONFIG_ATM_FORE200E_PCA
2693static int __devinit 2693static int __devinit
2694fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) 2694fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
2695{ 2695{
@@ -2756,7 +2756,6 @@ static void __devexit fore200e_pca_remove_one(struct pci_dev *pci_dev)
2756} 2756}
2757 2757
2758 2758
2759#ifdef CONFIG_ATM_FORE200E_PCA
2760static struct pci_device_id fore200e_pca_tbl[] = { 2759static struct pci_device_id fore200e_pca_tbl[] = {
2761 { PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, PCI_ANY_ID, PCI_ANY_ID, 2760 { PCI_VENDOR_ID_FORE, PCI_DEVICE_ID_FORE_PCA200E, PCI_ANY_ID, PCI_ANY_ID,
2762 0, 0, (unsigned long) &fore200e_bus[0] }, 2761 0, 0, (unsigned long) &fore200e_bus[0] },
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a5ee21319d37..3535ef896677 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -117,8 +117,10 @@ static struct pktcdvd_kobj* pkt_kobj_create(struct pktcdvd_device *pd,
117 p->kobj.parent = parent; 117 p->kobj.parent = parent;
118 p->kobj.ktype = ktype; 118 p->kobj.ktype = ktype;
119 p->pd = pd; 119 p->pd = pd;
120 if (kobject_register(&p->kobj) != 0) 120 if (kobject_register(&p->kobj) != 0) {
121 kobject_put(&p->kobj);
121 return NULL; 122 return NULL;
123 }
122 return p; 124 return p;
123} 125}
124/* 126/*
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 5f5095afb06b..c24e1bdbad43 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -34,7 +34,7 @@
34 * - set initialised bit then. 34 * - set initialised bit then.
35 */ 35 */
36 36
37//#define DEBUG /* uncomment if you want debugging info (pr_debug) */ 37#undef DEBUG /* #define DEBUG if you want debugging info (pr_debug) */
38#include <linux/fs.h> 38#include <linux/fs.h>
39#include <linux/bio.h> 39#include <linux/bio.h>
40#include <linux/kernel.h> 40#include <linux/kernel.h>
@@ -143,17 +143,12 @@ static struct cardinfo cards[MM_MAXCARDS];
143static struct block_device_operations mm_fops; 143static struct block_device_operations mm_fops;
144static struct timer_list battery_timer; 144static struct timer_list battery_timer;
145 145
146static int num_cards = 0; 146static int num_cards;
147 147
148static struct gendisk *mm_gendisk[MM_MAXCARDS]; 148static struct gendisk *mm_gendisk[MM_MAXCARDS];
149 149
150static void check_batteries(struct cardinfo *card); 150static void check_batteries(struct cardinfo *card);
151 151
152/*
153-----------------------------------------------------------------------------------
154-- get_userbit
155-----------------------------------------------------------------------------------
156*/
157static int get_userbit(struct cardinfo *card, int bit) 152static int get_userbit(struct cardinfo *card, int bit)
158{ 153{
159 unsigned char led; 154 unsigned char led;
@@ -161,11 +156,7 @@ static int get_userbit(struct cardinfo *card, int bit)
161 led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL); 156 led = readb(card->csr_remap + MEMCTRLCMD_LEDCTRL);
162 return led & bit; 157 return led & bit;
163} 158}
164/* 159
165-----------------------------------------------------------------------------------
166-- set_userbit
167-----------------------------------------------------------------------------------
168*/
169static int set_userbit(struct cardinfo *card, int bit, unsigned char state) 160static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
170{ 161{
171 unsigned char led; 162 unsigned char led;
@@ -179,11 +170,7 @@ static int set_userbit(struct cardinfo *card, int bit, unsigned char state)
179 170
180 return 0; 171 return 0;
181} 172}
182/* 173
183-----------------------------------------------------------------------------------
184-- set_led
185-----------------------------------------------------------------------------------
186*/
187/* 174/*
188 * NOTE: For the power LED, use the LED_POWER_* macros since they differ 175 * NOTE: For the power LED, use the LED_POWER_* macros since they differ
189 */ 176 */
@@ -203,11 +190,6 @@ static void set_led(struct cardinfo *card, int shift, unsigned char state)
203} 190}
204 191
205#ifdef MM_DIAG 192#ifdef MM_DIAG
206/*
207-----------------------------------------------------------------------------------
208-- dump_regs
209-----------------------------------------------------------------------------------
210*/
211static void dump_regs(struct cardinfo *card) 193static void dump_regs(struct cardinfo *card)
212{ 194{
213 unsigned char *p; 195 unsigned char *p;
@@ -224,32 +206,28 @@ static void dump_regs(struct cardinfo *card)
224 } 206 }
225} 207}
226#endif 208#endif
227/* 209
228-----------------------------------------------------------------------------------
229-- dump_dmastat
230-----------------------------------------------------------------------------------
231*/
232static void dump_dmastat(struct cardinfo *card, unsigned int dmastat) 210static void dump_dmastat(struct cardinfo *card, unsigned int dmastat)
233{ 211{
234 dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - "); 212 dev_printk(KERN_DEBUG, &card->dev->dev, "DMAstat - ");
235 if (dmastat & DMASCR_ANY_ERR) 213 if (dmastat & DMASCR_ANY_ERR)
236 printk("ANY_ERR "); 214 printk(KERN_CONT "ANY_ERR ");
237 if (dmastat & DMASCR_MBE_ERR) 215 if (dmastat & DMASCR_MBE_ERR)
238 printk("MBE_ERR "); 216 printk(KERN_CONT "MBE_ERR ");
239 if (dmastat & DMASCR_PARITY_ERR_REP) 217 if (dmastat & DMASCR_PARITY_ERR_REP)
240 printk("PARITY_ERR_REP "); 218 printk(KERN_CONT "PARITY_ERR_REP ");
241 if (dmastat & DMASCR_PARITY_ERR_DET) 219 if (dmastat & DMASCR_PARITY_ERR_DET)
242 printk("PARITY_ERR_DET "); 220 printk(KERN_CONT "PARITY_ERR_DET ");
243 if (dmastat & DMASCR_SYSTEM_ERR_SIG) 221 if (dmastat & DMASCR_SYSTEM_ERR_SIG)
244 printk("SYSTEM_ERR_SIG "); 222 printk(KERN_CONT "SYSTEM_ERR_SIG ");
245 if (dmastat & DMASCR_TARGET_ABT) 223 if (dmastat & DMASCR_TARGET_ABT)
246 printk("TARGET_ABT "); 224 printk(KERN_CONT "TARGET_ABT ");
247 if (dmastat & DMASCR_MASTER_ABT) 225 if (dmastat & DMASCR_MASTER_ABT)
248 printk("MASTER_ABT "); 226 printk(KERN_CONT "MASTER_ABT ");
249 if (dmastat & DMASCR_CHAIN_COMPLETE) 227 if (dmastat & DMASCR_CHAIN_COMPLETE)
250 printk("CHAIN_COMPLETE "); 228 printk(KERN_CONT "CHAIN_COMPLETE ");
251 if (dmastat & DMASCR_DMA_COMPLETE) 229 if (dmastat & DMASCR_DMA_COMPLETE)
252 printk("DMA_COMPLETE "); 230 printk(KERN_CONT "DMA_COMPLETE ");
253 printk("\n"); 231 printk("\n");
254} 232}
255 233
@@ -286,7 +264,8 @@ static void mm_start_io(struct cardinfo *card)
286 264
287 /* make the last descriptor end the chain */ 265 /* make the last descriptor end the chain */
288 page = &card->mm_pages[card->Active]; 266 page = &card->mm_pages[card->Active];
289 pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1); 267 pr_debug("start_io: %d %d->%d\n",
268 card->Active, page->headcnt, page->cnt - 1);
290 desc = &page->desc[page->cnt-1]; 269 desc = &page->desc[page->cnt-1];
291 270
292 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN); 271 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -310,8 +289,8 @@ static void mm_start_io(struct cardinfo *card)
310 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR); 289 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR);
311 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4); 290 writel(0, card->csr_remap + DMA_SEMAPHORE_ADDR + 4);
312 291
313 offset = ((char*)desc) - ((char*)page->desc); 292 offset = ((char *)desc) - ((char *)page->desc);
314 writel(cpu_to_le32((page->page_dma+offset)&0xffffffff), 293 writel(cpu_to_le32((page->page_dma+offset) & 0xffffffff),
315 card->csr_remap + DMA_DESCRIPTOR_ADDR); 294 card->csr_remap + DMA_DESCRIPTOR_ADDR);
316 /* Force the value to u64 before shifting otherwise >> 32 is undefined C 295 /* Force the value to u64 before shifting otherwise >> 32 is undefined C
317 * and on some ports will do nothing ! */ 296 * and on some ports will do nothing ! */
@@ -352,7 +331,7 @@ static inline void reset_page(struct mm_page *page)
352 page->cnt = 0; 331 page->cnt = 0;
353 page->headcnt = 0; 332 page->headcnt = 0;
354 page->bio = NULL; 333 page->bio = NULL;
355 page->biotail = & page->bio; 334 page->biotail = &page->bio;
356} 335}
357 336
358static void mm_unplug_device(struct request_queue *q) 337static void mm_unplug_device(struct request_queue *q)
@@ -408,7 +387,7 @@ static int add_bio(struct cardinfo *card)
408 vec->bv_page, 387 vec->bv_page,
409 vec->bv_offset, 388 vec->bv_offset,
410 len, 389 len,
411 (rw==READ) ? 390 (rw == READ) ?
412 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); 391 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE);
413 392
414 p = &card->mm_pages[card->Ready]; 393 p = &card->mm_pages[card->Ready];
@@ -427,10 +406,10 @@ static int add_bio(struct cardinfo *card)
427 desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle); 406 desc->pci_addr = cpu_to_le64((u64)desc->data_dma_handle);
428 desc->local_addr = cpu_to_le64(card->current_sector << 9); 407 desc->local_addr = cpu_to_le64(card->current_sector << 9);
429 desc->transfer_size = cpu_to_le32(len); 408 desc->transfer_size = cpu_to_le32(len);
430 offset = ( ((char*)&desc->sem_control_bits) - ((char*)p->desc)); 409 offset = (((char *)&desc->sem_control_bits) - ((char *)p->desc));
431 desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset)); 410 desc->sem_addr = cpu_to_le64((u64)(p->page_dma+offset));
432 desc->zero1 = desc->zero2 = 0; 411 desc->zero1 = desc->zero2 = 0;
433 offset = ( ((char*)(desc+1)) - ((char*)p->desc)); 412 offset = (((char *)(desc+1)) - ((char *)p->desc));
434 desc->next_desc_addr = cpu_to_le64(p->page_dma+offset); 413 desc->next_desc_addr = cpu_to_le64(p->page_dma+offset);
435 desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN| 414 desc->control_bits = cpu_to_le32(DMASCR_GO|DMASCR_ERR_INT_EN|
436 DMASCR_PARITY_INT_EN| 415 DMASCR_PARITY_INT_EN|
@@ -455,11 +434,11 @@ static void process_page(unsigned long data)
455 /* check if any of the requests in the page are DMA_COMPLETE, 434 /* check if any of the requests in the page are DMA_COMPLETE,
456 * and deal with them appropriately. 435 * and deal with them appropriately.
457 * If we find a descriptor without DMA_COMPLETE in the semaphore, then 436 * If we find a descriptor without DMA_COMPLETE in the semaphore, then
458 * dma must have hit an error on that descriptor, so use dma_status instead 437 * dma must have hit an error on that descriptor, so use dma_status
459 * and assume that all following descriptors must be re-tried. 438 * instead and assume that all following descriptors must be re-tried.
460 */ 439 */
461 struct mm_page *page; 440 struct mm_page *page;
462 struct bio *return_bio=NULL; 441 struct bio *return_bio = NULL;
463 struct cardinfo *card = (struct cardinfo *)data; 442 struct cardinfo *card = (struct cardinfo *)data;
464 unsigned int dma_status = card->dma_status; 443 unsigned int dma_status = card->dma_status;
465 444
@@ -472,12 +451,12 @@ static void process_page(unsigned long data)
472 struct bio *bio = page->bio; 451 struct bio *bio = page->bio;
473 struct mm_dma_desc *desc = &page->desc[page->headcnt]; 452 struct mm_dma_desc *desc = &page->desc[page->headcnt];
474 int control = le32_to_cpu(desc->sem_control_bits); 453 int control = le32_to_cpu(desc->sem_control_bits);
475 int last=0; 454 int last = 0;
476 int idx; 455 int idx;
477 456
478 if (!(control & DMASCR_DMA_COMPLETE)) { 457 if (!(control & DMASCR_DMA_COMPLETE)) {
479 control = dma_status; 458 control = dma_status;
480 last=1; 459 last = 1;
481 } 460 }
482 page->headcnt++; 461 page->headcnt++;
483 idx = page->idx; 462 idx = page->idx;
@@ -489,8 +468,8 @@ static void process_page(unsigned long data)
489 } 468 }
490 469
491 pci_unmap_page(card->dev, desc->data_dma_handle, 470 pci_unmap_page(card->dev, desc->data_dma_handle,
492 bio_iovec_idx(bio,idx)->bv_len, 471 bio_iovec_idx(bio, idx)->bv_len,
493 (control& DMASCR_TRANSFER_READ) ? 472 (control & DMASCR_TRANSFER_READ) ?
494 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE); 473 PCI_DMA_TODEVICE : PCI_DMA_FROMDEVICE);
495 if (control & DMASCR_HARD_ERROR) { 474 if (control & DMASCR_HARD_ERROR) {
496 /* error */ 475 /* error */
@@ -501,9 +480,10 @@ static void process_page(unsigned long data)
501 le32_to_cpu(desc->transfer_size)); 480 le32_to_cpu(desc->transfer_size));
502 dump_dmastat(card, control); 481 dump_dmastat(card, control);
503 } else if (test_bit(BIO_RW, &bio->bi_rw) && 482 } else if (test_bit(BIO_RW, &bio->bi_rw) &&
504 le32_to_cpu(desc->local_addr)>>9 == card->init_size) { 483 le32_to_cpu(desc->local_addr) >> 9 ==
505 card->init_size += le32_to_cpu(desc->transfer_size)>>9; 484 card->init_size) {
506 if (card->init_size>>1 >= card->mm_size) { 485 card->init_size += le32_to_cpu(desc->transfer_size) >> 9;
486 if (card->init_size >> 1 >= card->mm_size) {
507 dev_printk(KERN_INFO, &card->dev->dev, 487 dev_printk(KERN_INFO, &card->dev->dev,
508 "memory now initialised\n"); 488 "memory now initialised\n");
509 set_userbit(card, MEMORY_INITIALIZED, 1); 489 set_userbit(card, MEMORY_INITIALIZED, 1);
@@ -514,7 +494,8 @@ static void process_page(unsigned long data)
514 return_bio = bio; 494 return_bio = bio;
515 } 495 }
516 496
517 if (last) break; 497 if (last)
498 break;
518 } 499 }
519 500
520 if (debug & DEBUG_LED_ON_TRANSFER) 501 if (debug & DEBUG_LED_ON_TRANSFER)
@@ -536,7 +517,7 @@ static void process_page(unsigned long data)
536 out_unlock: 517 out_unlock:
537 spin_unlock_bh(&card->lock); 518 spin_unlock_bh(&card->lock);
538 519
539 while(return_bio) { 520 while (return_bio) {
540 struct bio *bio = return_bio; 521 struct bio *bio = return_bio;
541 522
542 return_bio = bio->bi_next; 523 return_bio = bio->bi_next;
@@ -545,11 +526,6 @@ static void process_page(unsigned long data)
545 } 526 }
546} 527}
547 528
548/*
549-----------------------------------------------------------------------------------
550-- mm_make_request
551-----------------------------------------------------------------------------------
552*/
553static int mm_make_request(struct request_queue *q, struct bio *bio) 529static int mm_make_request(struct request_queue *q, struct bio *bio)
554{ 530{
555 struct cardinfo *card = q->queuedata; 531 struct cardinfo *card = q->queuedata;
@@ -566,11 +542,6 @@ static int mm_make_request(struct request_queue *q, struct bio *bio)
566 return 0; 542 return 0;
567} 543}
568 544
569/*
570-----------------------------------------------------------------------------------
571-- mm_interrupt
572-----------------------------------------------------------------------------------
573*/
574static irqreturn_t mm_interrupt(int irq, void *__card) 545static irqreturn_t mm_interrupt(int irq, void *__card)
575{ 546{
576 struct cardinfo *card = (struct cardinfo *) __card; 547 struct cardinfo *card = (struct cardinfo *) __card;
@@ -584,15 +555,15 @@ HW_TRACE(0x30);
584 if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) { 555 if (!(dma_status & (DMASCR_ERROR_MASK | DMASCR_CHAIN_COMPLETE))) {
585 /* interrupt wasn't for me ... */ 556 /* interrupt wasn't for me ... */
586 return IRQ_NONE; 557 return IRQ_NONE;
587 } 558 }
588 559
589 /* clear COMPLETION interrupts */ 560 /* clear COMPLETION interrupts */
590 if (card->flags & UM_FLAG_NO_BYTE_STATUS) 561 if (card->flags & UM_FLAG_NO_BYTE_STATUS)
591 writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE), 562 writel(cpu_to_le32(DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE),
592 card->csr_remap+ DMA_STATUS_CTRL); 563 card->csr_remap + DMA_STATUS_CTRL);
593 else 564 else
594 writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16, 565 writeb((DMASCR_DMA_COMPLETE|DMASCR_CHAIN_COMPLETE) >> 16,
595 card->csr_remap+ DMA_STATUS_CTRL + 2); 566 card->csr_remap + DMA_STATUS_CTRL + 2);
596 567
597 /* log errors and clear interrupt status */ 568 /* log errors and clear interrupt status */
598 if (dma_status & DMASCR_ANY_ERR) { 569 if (dma_status & DMASCR_ANY_ERR) {
@@ -602,9 +573,12 @@ HW_TRACE(0x30);
602 573
603 stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS); 574 stat = readb(card->csr_remap + MEMCTRLCMD_ERRSTATUS);
604 575
605 data_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG)); 576 data_log1 = le32_to_cpu(readl(card->csr_remap +
606 data_log2 = le32_to_cpu(readl(card->csr_remap + ERROR_DATA_LOG + 4)); 577 ERROR_DATA_LOG));
607 addr_log1 = le32_to_cpu(readl(card->csr_remap + ERROR_ADDR_LOG)); 578 data_log2 = le32_to_cpu(readl(card->csr_remap +
579 ERROR_DATA_LOG + 4));
580 addr_log1 = le32_to_cpu(readl(card->csr_remap +
581 ERROR_ADDR_LOG));
608 addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4); 582 addr_log2 = readb(card->csr_remap + ERROR_ADDR_LOG + 4);
609 583
610 count = readb(card->csr_remap + ERROR_COUNT); 584 count = readb(card->csr_remap + ERROR_COUNT);
@@ -671,11 +645,7 @@ HW_TRACE(0x36);
671 645
672 return IRQ_HANDLED; 646 return IRQ_HANDLED;
673} 647}
674/* 648
675-----------------------------------------------------------------------------------
676-- set_fault_to_battery_status
677-----------------------------------------------------------------------------------
678*/
679/* 649/*
680 * If both batteries are good, no LED 650 * If both batteries are good, no LED
681 * If either battery has been warned, solid LED 651 * If either battery has been warned, solid LED
@@ -696,12 +666,6 @@ static void set_fault_to_battery_status(struct cardinfo *card)
696 666
697static void init_battery_timer(void); 667static void init_battery_timer(void);
698 668
699
700/*
701-----------------------------------------------------------------------------------
702-- check_battery
703-----------------------------------------------------------------------------------
704*/
705static int check_battery(struct cardinfo *card, int battery, int status) 669static int check_battery(struct cardinfo *card, int battery, int status)
706{ 670{
707 if (status != card->battery[battery].good) { 671 if (status != card->battery[battery].good) {
@@ -730,11 +694,7 @@ static int check_battery(struct cardinfo *card, int battery, int status)
730 694
731 return 0; 695 return 0;
732} 696}
733/* 697
734-----------------------------------------------------------------------------------
735-- check_batteries
736-----------------------------------------------------------------------------------
737*/
738static void check_batteries(struct cardinfo *card) 698static void check_batteries(struct cardinfo *card)
739{ 699{
740 /* NOTE: this must *never* be called while the card 700 /* NOTE: this must *never* be called while the card
@@ -775,11 +735,7 @@ static void check_all_batteries(unsigned long ptr)
775 735
776 init_battery_timer(); 736 init_battery_timer();
777} 737}
778/* 738
779-----------------------------------------------------------------------------------
780-- init_battery_timer
781-----------------------------------------------------------------------------------
782*/
783static void init_battery_timer(void) 739static void init_battery_timer(void)
784{ 740{
785 init_timer(&battery_timer); 741 init_timer(&battery_timer);
@@ -787,20 +743,12 @@ static void init_battery_timer(void)
787 battery_timer.expires = jiffies + (HZ * 60); 743 battery_timer.expires = jiffies + (HZ * 60);
788 add_timer(&battery_timer); 744 add_timer(&battery_timer);
789} 745}
790/* 746
791-----------------------------------------------------------------------------------
792-- del_battery_timer
793-----------------------------------------------------------------------------------
794*/
795static void del_battery_timer(void) 747static void del_battery_timer(void)
796{ 748{
797 del_timer(&battery_timer); 749 del_timer(&battery_timer);
798} 750}
799/* 751
800-----------------------------------------------------------------------------------
801-- mm_revalidate
802-----------------------------------------------------------------------------------
803*/
804/* 752/*
805 * Note no locks taken out here. In a worst case scenario, we could drop 753 * Note no locks taken out here. In a worst case scenario, we could drop
806 * a chunk of system memory. But that should never happen, since validation 754 * a chunk of system memory. But that should never happen, since validation
@@ -833,33 +781,23 @@ static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
833} 781}
834 782
835/* 783/*
836----------------------------------------------------------------------------------- 784 * Future support for removable devices
837-- mm_check_change 785 */
838-----------------------------------------------------------------------------------
839 Future support for removable devices
840*/
841static int mm_check_change(struct gendisk *disk) 786static int mm_check_change(struct gendisk *disk)
842{ 787{
843/* struct cardinfo *dev = disk->private_data; */ 788/* struct cardinfo *dev = disk->private_data; */
844 return 0; 789 return 0;
845} 790}
846/* 791
847-----------------------------------------------------------------------------------
848-- mm_fops
849-----------------------------------------------------------------------------------
850*/
851static struct block_device_operations mm_fops = { 792static struct block_device_operations mm_fops = {
852 .owner = THIS_MODULE, 793 .owner = THIS_MODULE,
853 .getgeo = mm_getgeo, 794 .getgeo = mm_getgeo,
854 .revalidate_disk= mm_revalidate, 795 .revalidate_disk = mm_revalidate,
855 .media_changed = mm_check_change, 796 .media_changed = mm_check_change,
856}; 797};
857/* 798
858----------------------------------------------------------------------------------- 799static int __devinit mm_pci_probe(struct pci_dev *dev,
859-- mm_pci_probe 800 const struct pci_device_id *id)
860-----------------------------------------------------------------------------------
861*/
862static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
863{ 801{
864 int ret = -ENODEV; 802 int ret = -ENODEV;
865 struct cardinfo *card = &cards[num_cards]; 803 struct cardinfo *card = &cards[num_cards];
@@ -889,7 +827,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
889 return -ENODEV; 827 return -ENODEV;
890 828
891 dev_printk(KERN_INFO, &dev->dev, 829 dev_printk(KERN_INFO, &dev->dev,
892 "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n"); 830 "Micro Memory(tm) controller found (PCI Mem Module (Battery Backup))\n");
893 831
894 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) && 832 if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
895 pci_set_dma_mask(dev, DMA_32BIT_MASK)) { 833 pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
@@ -917,7 +855,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
917 "CSR 0x%08lx -> 0x%p (0x%lx)\n", 855 "CSR 0x%08lx -> 0x%p (0x%lx)\n",
918 csr_base, card->csr_remap, csr_len); 856 csr_base, card->csr_remap, csr_len);
919 857
920 switch(card->dev->device) { 858 switch (card->dev->device) {
921 case 0x5415: 859 case 0x5415:
922 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG; 860 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG;
923 magic_number = 0x59; 861 magic_number = 0x59;
@@ -929,7 +867,8 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
929 break; 867 break;
930 868
931 case 0x6155: 869 case 0x6155:
932 card->flags |= UM_FLAG_NO_BYTE_STATUS | UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT; 870 card->flags |= UM_FLAG_NO_BYTE_STATUS |
871 UM_FLAG_NO_BATTREG | UM_FLAG_NO_BATT;
933 magic_number = 0x99; 872 magic_number = 0x99;
934 break; 873 break;
935 874
@@ -945,11 +884,11 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
945 } 884 }
946 885
947 card->mm_pages[0].desc = pci_alloc_consistent(card->dev, 886 card->mm_pages[0].desc = pci_alloc_consistent(card->dev,
948 PAGE_SIZE*2, 887 PAGE_SIZE * 2,
949 &card->mm_pages[0].page_dma); 888 &card->mm_pages[0].page_dma);
950 card->mm_pages[1].desc = pci_alloc_consistent(card->dev, 889 card->mm_pages[1].desc = pci_alloc_consistent(card->dev,
951 PAGE_SIZE*2, 890 PAGE_SIZE * 2,
952 &card->mm_pages[1].page_dma); 891 &card->mm_pages[1].page_dma);
953 if (card->mm_pages[0].desc == NULL || 892 if (card->mm_pages[0].desc == NULL ||
954 card->mm_pages[1].desc == NULL) { 893 card->mm_pages[1].desc == NULL) {
955 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n"); 894 dev_printk(KERN_ERR, &card->dev->dev, "alloc failed\n");
@@ -1013,9 +952,9 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1013 dev_printk(KERN_INFO, &card->dev->dev, 952 dev_printk(KERN_INFO, &card->dev->dev,
1014 "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n", 953 "Size %d KB, Battery 1 %s (%s), Battery 2 %s (%s)\n",
1015 card->mm_size, 954 card->mm_size,
1016 (batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled"), 955 batt_status & BATTERY_1_DISABLED ? "Disabled" : "Enabled",
1017 card->battery[0].good ? "OK" : "FAILURE", 956 card->battery[0].good ? "OK" : "FAILURE",
1018 (batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled"), 957 batt_status & BATTERY_2_DISABLED ? "Disabled" : "Enabled",
1019 card->battery[1].good ? "OK" : "FAILURE"); 958 card->battery[1].good ? "OK" : "FAILURE");
1020 959
1021 set_fault_to_battery_status(card); 960 set_fault_to_battery_status(card);
@@ -1030,18 +969,18 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1030 data = ~data; 969 data = ~data;
1031 data += 1; 970 data += 1;
1032 971
1033 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME, card)) { 972 if (request_irq(dev->irq, mm_interrupt, IRQF_SHARED, DRIVER_NAME,
973 card)) {
1034 dev_printk(KERN_ERR, &card->dev->dev, 974 dev_printk(KERN_ERR, &card->dev->dev,
1035 "Unable to allocate IRQ\n"); 975 "Unable to allocate IRQ\n");
1036 ret = -ENODEV; 976 ret = -ENODEV;
1037
1038 goto failed_req_irq; 977 goto failed_req_irq;
1039 } 978 }
1040 979
1041 dev_printk(KERN_INFO, &card->dev->dev, 980 dev_printk(KERN_INFO, &card->dev->dev,
1042 "Window size %d bytes, IRQ %d\n", data, dev->irq); 981 "Window size %d bytes, IRQ %d\n", data, dev->irq);
1043 982
1044 spin_lock_init(&card->lock); 983 spin_lock_init(&card->lock);
1045 984
1046 pci_set_drvdata(dev, card); 985 pci_set_drvdata(dev, card);
1047 986
@@ -1060,7 +999,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1060 999
1061 if (!get_userbit(card, MEMORY_INITIALIZED)) { 1000 if (!get_userbit(card, MEMORY_INITIALIZED)) {
1062 dev_printk(KERN_INFO, &card->dev->dev, 1001 dev_printk(KERN_INFO, &card->dev->dev,
1063 "memory NOT initialized. Consider over-writing whole device.\n"); 1002 "memory NOT initialized. Consider over-writing whole device.\n");
1064 card->init_size = 0; 1003 card->init_size = 0;
1065 } else { 1004 } else {
1066 dev_printk(KERN_INFO, &card->dev->dev, 1005 dev_printk(KERN_INFO, &card->dev->dev,
@@ -1091,11 +1030,7 @@ static int __devinit mm_pci_probe(struct pci_dev *dev, const struct pci_device_i
1091 1030
1092 return ret; 1031 return ret;
1093} 1032}
1094/* 1033
1095-----------------------------------------------------------------------------------
1096-- mm_pci_remove
1097-----------------------------------------------------------------------------------
1098*/
1099static void mm_pci_remove(struct pci_dev *dev) 1034static void mm_pci_remove(struct pci_dev *dev)
1100{ 1035{
1101 struct cardinfo *card = pci_get_drvdata(dev); 1036 struct cardinfo *card = pci_get_drvdata(dev);
@@ -1119,16 +1054,16 @@ static void mm_pci_remove(struct pci_dev *dev)
1119} 1054}
1120 1055
1121static const struct pci_device_id mm_pci_ids[] = { 1056static const struct pci_device_id mm_pci_ids[] = {
1122 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5415CN)}, 1057 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5415CN)},
1123 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_5425CN)}, 1058 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_5425CN)},
1124 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY,PCI_DEVICE_ID_MICRO_MEMORY_6155)}, 1059 {PCI_DEVICE(PCI_VENDOR_ID_MICRO_MEMORY, PCI_DEVICE_ID_MICRO_MEMORY_6155)},
1125 { 1060 {
1126 .vendor = 0x8086, 1061 .vendor = 0x8086,
1127 .device = 0xB555, 1062 .device = 0xB555,
1128 .subvendor= 0x1332, 1063 .subvendor = 0x1332,
1129 .subdevice= 0x5460, 1064 .subdevice = 0x5460,
1130 .class = 0x050000, 1065 .class = 0x050000,
1131 .class_mask= 0, 1066 .class_mask = 0,
1132 }, { /* end: all zeroes */ } 1067 }, { /* end: all zeroes */ }
1133}; 1068};
1134 1069
@@ -1141,12 +1076,6 @@ static struct pci_driver mm_pci_driver = {
1141 .remove = mm_pci_remove, 1076 .remove = mm_pci_remove,
1142}; 1077};
1143 1078
1144/*
1145-----------------------------------------------------------------------------------
1146-- mm_init
1147-----------------------------------------------------------------------------------
1148*/
1149
1150static int __init mm_init(void) 1079static int __init mm_init(void)
1151{ 1080{
1152 int retval, i; 1081 int retval, i;
@@ -1193,18 +1122,14 @@ out:
1193 put_disk(mm_gendisk[i]); 1122 put_disk(mm_gendisk[i]);
1194 return -ENOMEM; 1123 return -ENOMEM;
1195} 1124}
1196/* 1125
1197-----------------------------------------------------------------------------------
1198-- mm_cleanup
1199-----------------------------------------------------------------------------------
1200*/
1201static void __exit mm_cleanup(void) 1126static void __exit mm_cleanup(void)
1202{ 1127{
1203 int i; 1128 int i;
1204 1129
1205 del_battery_timer(); 1130 del_battery_timer();
1206 1131
1207 for (i=0; i < num_cards ; i++) { 1132 for (i = 0; i < num_cards ; i++) {
1208 del_gendisk(mm_gendisk[i]); 1133 del_gendisk(mm_gendisk[i]);
1209 put_disk(mm_gendisk[i]); 1134 put_disk(mm_gendisk[i]);
1210 } 1135 }
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index a509b8d79781..ef1ed5d70125 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -543,28 +543,6 @@ config PPDEV
543 543
544 If unsure, say N. 544 If unsure, say N.
545 545
546config TIPAR
547 tristate "Texas Instruments parallel link cable support"
548 depends on PARPORT
549 ---help---
550 If you own a Texas Instruments graphing calculator and use a
551 parallel link cable, then you might be interested in this driver.
552
553 If you enable this driver, you will be able to communicate with
554 your calculator through a set of device nodes under /dev. The
555 main advantage of this driver is that you don't have to be root
556 to use this precise link cable (depending on the permissions on
557 the device nodes, though).
558
559 To compile this driver as a module, choose M here: the
560 module will be called tipar.
561
562 If you don't know what a parallel link cable is or what a Texas
563 Instruments graphing calculator is, then you probably don't need this
564 driver.
565
566 If unsure, say N.
567
568config HVC_DRIVER 546config HVC_DRIVER
569 bool 547 bool
570 help 548 help
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index e686fc925168..8f45ca9235ad 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -669,6 +669,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
669 return 0; 669 return 0;
670 670
671 case WDIOC_SET_PRETIMEOUT: 671 case WDIOC_SET_PRETIMEOUT:
672 case WDIOC_SETPRETIMEOUT:
672 i = copy_from_user(&val, argp, sizeof(int)); 673 i = copy_from_user(&val, argp, sizeof(int));
673 if (i) 674 if (i)
674 return -EFAULT; 675 return -EFAULT;
@@ -676,6 +677,7 @@ static int ipmi_ioctl(struct inode *inode, struct file *file,
676 return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); 677 return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
677 678
678 case WDIOC_GET_PRETIMEOUT: 679 case WDIOC_GET_PRETIMEOUT:
680 case WDIOC_GETPRETIMEOUT:
679 i = copy_to_user(argp, &pretimeout, sizeof(pretimeout)); 681 i = copy_to_user(argp, &pretimeout, sizeof(pretimeout));
680 if (i) 682 if (i)
681 return -EFAULT; 683 return -EFAULT;
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c
deleted file mode 100644
index cef55c40654f..000000000000
--- a/drivers/char/tipar.c
+++ /dev/null
@@ -1,557 +0,0 @@
1/* Hey EMACS -*- linux-c -*-
2 *
3 * tipar - low level driver for handling a parallel link cable designed
4 * for Texas Instruments graphing calculators (http://lpg.ticalc.org).
5 * A part of the TiLP project.
6 *
7 * Copyright (C) 2000-2002, Romain Lievin <roms@lpg.ticalc.org>
8 * under the terms of the GNU General Public License.
9 *
10 * Various fixes & clean-up from the Linux Kernel Mailing List
11 * (Alan Cox, Richard B. Johnson, Christoph Hellwig).
12 */
13
14/* This driver should, in theory, work with any parallel port that has an
15 * appropriate low-level driver; all I/O is done through the parport
16 * abstraction layer.
17 *
18 * If this driver is built into the kernel, you can configure it using the
19 * kernel command-line. For example:
20 *
21 * tipar=timeout,delay (set timeout and delay)
22 *
23 * If the driver is loaded as a module, similar functionality is available
24 * using module parameters. The equivalent of the above commands would be:
25 *
26 * # insmod tipar timeout=15 delay=10
27 */
28
29/* COMPATIBILITY WITH OLD KERNELS
30 *
31 * Usually, parallel cables were bound to ports at
32 * particular I/O addresses, as follows:
33 *
34 * tipar0 0x378
35 * tipar1 0x278
36 * tipar2 0x3bc
37 *
38 *
39 * This driver, by default, binds tipar devices according to parport and
40 * the minor number.
41 *
42 */
43#undef DEBUG /* change to #define to get debugging
44 * output - for pr_debug() */
45#include <linux/module.h>
46#include <linux/types.h>
47#include <linux/errno.h>
48#include <linux/kernel.h>
49#include <linux/sched.h>
50#include <linux/delay.h>
51#include <linux/fcntl.h>
52#include <linux/fs.h>
53#include <linux/init.h>
54#include <asm/uaccess.h>
55#include <linux/ioport.h>
56#include <asm/io.h>
57#include <linux/bitops.h>
58#include <linux/parport.h> /* Our code depend on parport */
59#include <linux/device.h>
60
61/*
62 * TI definitions
63 */
64#include <linux/ticable.h>
65
66/*
67 * Version Information
68 */
69#define DRIVER_VERSION "1.19"
70#define DRIVER_AUTHOR "Romain Lievin <roms@lpg.ticalc.org>"
71#define DRIVER_DESC "Device driver for TI/PC parallel link cables"
72#define DRIVER_LICENSE "GPL"
73
74#define VERSION(ver,rel,seq) (((ver)<<16) | ((rel)<<8) | (seq))
75
76/* ----- global variables --------------------------------------------- */
77
78struct tipar_struct {
79 struct pardevice *dev; /* Parport device entry */
80};
81
82#define PP_NO 3
83static struct tipar_struct table[PP_NO];
84
85static int delay = IO_DELAY; /* inter-bit delay in microseconds */
86static int timeout = TIMAXTIME; /* timeout in tenth of seconds */
87
88static unsigned int tp_count; /* tipar count */
89static unsigned long opened; /* opened devices */
90
91static struct class *tipar_class;
92
93/* --- macros for parport access -------------------------------------- */
94
95#define r_dtr(x) (parport_read_data(table[(x)].dev->port))
96#define r_str(x) (parport_read_status(table[(x)].dev->port))
97#define w_ctr(x,y) (parport_write_control(table[(x)].dev->port, (y)))
98#define w_dtr(x,y) (parport_write_data(table[(x)].dev->port, (y)))
99
100/* --- setting states on the D-bus with the right timing: ------------- */
101
102static inline void
103outbyte(int value, int minor)
104{
105 w_dtr(minor, value);
106}
107
108static inline int
109inbyte(int minor)
110{
111 return (r_str(minor));
112}
113
114static inline void
115init_ti_parallel(int minor)
116{
117 outbyte(3, minor);
118}
119
120/* ----- global defines ----------------------------------------------- */
121
122#define START(x) { x = jiffies + (HZ * timeout) / 10; }
123#define WAIT(x) { \
124 if (time_before((x), jiffies)) return -1; \
125 if (need_resched()) schedule(); }
126
127/* ----- D-bus bit-banging functions ---------------------------------- */
128
129/* D-bus protocol (45kbit/s max):
130 1 0 0
131 _______ ______|______ __________|________ __________
132Red : ________ | ____ | ____
133 _ ____________|________ ______|__________ _____
134White: ________ | ______ | _______
135*/
136
137/* Try to transmit a byte on the specified port (-1 if error). */
138static int
139put_ti_parallel(int minor, unsigned char data)
140{
141 unsigned int bit;
142 unsigned long max;
143
144 for (bit = 0; bit < 8; bit++) {
145 if (data & 1) {
146 outbyte(2, minor);
147 START(max);
148 do {
149 WAIT(max);
150 } while (inbyte(minor) & 0x10);
151
152 outbyte(3, minor);
153 START(max);
154 do {
155 WAIT(max);
156 } while (!(inbyte(minor) & 0x10));
157 } else {
158 outbyte(1, minor);
159 START(max);
160 do {
161 WAIT(max);
162 } while (inbyte(minor) & 0x20);
163
164 outbyte(3, minor);
165 START(max);
166 do {
167 WAIT(max);
168 } while (!(inbyte(minor) & 0x20));
169 }
170
171 data >>= 1;
172 udelay(delay);
173
174 if (need_resched())
175 schedule();
176 }
177
178 return 0;
179}
180
181/* Receive a byte on the specified port or -1 if error. */
182static int
183get_ti_parallel(int minor)
184{
185 unsigned int bit;
186 unsigned char v, data = 0;
187 unsigned long max;
188
189 for (bit = 0; bit < 8; bit++) {
190 START(max);
191 do {
192 WAIT(max);
193 } while ((v = inbyte(minor) & 0x30) == 0x30);
194
195 if (v == 0x10) {
196 data = (data >> 1) | 0x80;
197 outbyte(1, minor);
198 START(max);
199 do {
200 WAIT(max);
201 } while (!(inbyte(minor) & 0x20));
202 outbyte(3, minor);
203 } else {
204 data = data >> 1;
205 outbyte(2, minor);
206 START(max);
207 do {
208 WAIT(max);
209 } while (!(inbyte(minor) & 0x10));
210 outbyte(3, minor);
211 }
212
213 udelay(delay);
214 if (need_resched())
215 schedule();
216 }
217
218 return (int) data;
219}
220
221/* Try to detect a parallel link cable on the specified port */
222static int
223probe_ti_parallel(int minor)
224{
225 int i;
226 int seq[] = { 0x00, 0x20, 0x10, 0x30 };
227 int data;
228
229 for (i = 3; i >= 0; i--) {
230 outbyte(3, minor);
231 outbyte(i, minor);
232 udelay(delay);
233 data = inbyte(minor) & 0x30;
234 pr_debug("tipar: Probing -> %i: 0x%02x 0x%02x\n", i,
235 data, seq[i]);
236 if (data != seq[i]) {
237 outbyte(3, minor);
238 return -1;
239 }
240 }
241
242 outbyte(3, minor);
243 return 0;
244}
245
246/* ----- kernel module functions--------------------------------------- */
247
248static int
249tipar_open(struct inode *inode, struct file *file)
250{
251 unsigned int minor = iminor(inode) - TIPAR_MINOR;
252
253 if (tp_count == 0 || minor > tp_count - 1)
254 return -ENXIO;
255
256 if (test_and_set_bit(minor, &opened))
257 return -EBUSY;
258
259 if (!table[minor].dev) {
260 printk(KERN_ERR "%s: NULL device for minor %u\n",
261 __FUNCTION__, minor);
262 return -ENXIO;
263 }
264 parport_claim_or_block(table[minor].dev);
265 init_ti_parallel(minor);
266 parport_release(table[minor].dev);
267
268 return nonseekable_open(inode, file);
269}
270
271static int
272tipar_close(struct inode *inode, struct file *file)
273{
274 unsigned int minor = iminor(inode) - TIPAR_MINOR;
275
276 if (minor > tp_count - 1)
277 return -ENXIO;
278
279 clear_bit(minor, &opened);
280
281 return 0;
282}
283
284static ssize_t
285tipar_write (struct file *file, const char __user *buf, size_t count,
286 loff_t * ppos)
287{
288 unsigned int minor = iminor(file->f_path.dentry->d_inode) - TIPAR_MINOR;
289 ssize_t n;
290
291 parport_claim_or_block(table[minor].dev);
292
293 for (n = 0; n < count; n++) {
294 unsigned char b;
295
296 if (get_user(b, buf + n)) {
297 n = -EFAULT;
298 goto out;
299 }
300
301 if (put_ti_parallel(minor, b) == -1) {
302 init_ti_parallel(minor);
303 n = -ETIMEDOUT;
304 goto out;
305 }
306 }
307 out:
308 parport_release(table[minor].dev);
309 return n;
310}
311
312static ssize_t
313tipar_read(struct file *file, char __user *buf, size_t count, loff_t * ppos)
314{
315 int b = 0;
316 unsigned int minor = iminor(file->f_path.dentry->d_inode) - TIPAR_MINOR;
317 ssize_t retval = 0;
318 ssize_t n = 0;
319
320 if (count == 0)
321 return 0;
322
323 parport_claim_or_block(table[minor].dev);
324
325 while (n < count) {
326 b = get_ti_parallel(minor);
327 if (b == -1) {
328 init_ti_parallel(minor);
329 retval = -ETIMEDOUT;
330 goto out;
331 } else {
332 if (put_user(b, buf + n)) {
333 retval = -EFAULT;
334 break;
335 } else
336 retval = ++n;
337 }
338
339 /* Non-blocking mode : try again ! */
340 if (file->f_flags & O_NONBLOCK) {
341 retval = -EAGAIN;
342 goto out;
343 }
344
345 /* Signal pending, try again ! */
346 if (signal_pending(current)) {
347 retval = -ERESTARTSYS;
348 goto out;
349 }
350
351 if (need_resched())
352 schedule();
353 }
354
355 out:
356 parport_release(table[minor].dev);
357 return retval;
358}
359
360static int
361tipar_ioctl(struct inode *inode, struct file *file,
362 unsigned int cmd, unsigned long arg)
363{
364 int retval = 0;
365
366 switch (cmd) {
367 case IOCTL_TIPAR_DELAY:
368 delay = (int)arg; //get_user(delay, &arg);
369 break;
370 case IOCTL_TIPAR_TIMEOUT:
371 if (arg != 0)
372 timeout = (int)arg;
373 else
374 retval = -EINVAL;
375 break;
376 default:
377 retval = -ENOTTY;
378 break;
379 }
380
381 return retval;
382}
383
384/* ----- kernel module registering ------------------------------------ */
385
386static const struct file_operations tipar_fops = {
387 .owner = THIS_MODULE,
388 .llseek = no_llseek,
389 .read = tipar_read,
390 .write = tipar_write,
391 .ioctl = tipar_ioctl,
392 .open = tipar_open,
393 .release = tipar_close,
394};
395
396/* --- initialisation code ------------------------------------- */
397
398#ifndef MODULE
399/* You must set these - there is no sane way to probe for this cable.
400 * You can use 'tipar=timeout,delay' to set these now. */
401static int __init
402tipar_setup(char *str)
403{
404 int ints[3];
405
406 str = get_options(str, ARRAY_SIZE(ints), ints);
407
408 if (ints[0] > 0) {
409 if (ints[1] != 0)
410 timeout = ints[1];
411 else
412 printk(KERN_WARNING "tipar: bad timeout value (0), "
413 "using default value instead");
414 if (ints[0] > 1) {
415 delay = ints[2];
416 }
417 }
418
419 return 1;
420}
421#endif
422
423/*
424 * Register our module into parport.
425 * Pass also 2 callbacks functions to parport: a pre-emptive function and an
426 * interrupt handler function (unused).
427 * Display a message such "tipar0: using parport0 (polling)".
428 */
429static int
430tipar_register(int nr, struct parport *port)
431{
432 int err = 0;
433
434 /* Register our module into parport */
435 table[nr].dev = parport_register_device(port, "tipar",
436 NULL, NULL, NULL, 0,
437 (void *) &table[nr]);
438
439 if (table[nr].dev == NULL) {
440 err = 1;
441 goto out;
442 }
443
444 device_create(tipar_class, port->dev, MKDEV(TIPAR_MAJOR,
445 TIPAR_MINOR + nr), "par%d", nr);
446
447 /* Display informations */
448 pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq ==
449 PARPORT_IRQ_NONE) ? "polling" : "interrupt-driven");
450
451 if (probe_ti_parallel(nr) != -1)
452 pr_info("tipar%d: link cable found\n", nr);
453 else
454 pr_info("tipar%d: link cable not found\n", nr);
455
456 err = 0;
457
458out:
459 return err;
460}
461
462static void
463tipar_attach(struct parport *port)
464{
465 if (tp_count == PP_NO) {
466 pr_info("tipar: ignoring parallel port (max. %d)\n", PP_NO);
467 return;
468 }
469
470 if (!tipar_register(tp_count, port))
471 tp_count++;
472}
473
474static void
475tipar_detach(struct parport *port)
476{
477 /* Nothing to do */
478}
479
480static struct parport_driver tipar_driver = {
481 .name = "tipar",
482 .attach = tipar_attach,
483 .detach = tipar_detach,
484};
485
486static int __init
487tipar_init_module(void)
488{
489 int err = 0;
490
491 pr_info("tipar: parallel link cable driver, version %s\n",
492 DRIVER_VERSION);
493
494 if (register_chrdev(TIPAR_MAJOR, "tipar", &tipar_fops)) {
495 printk(KERN_ERR "tipar: unable to get major %d\n", TIPAR_MAJOR);
496 err = -EIO;
497 goto out;
498 }
499
500 tipar_class = class_create(THIS_MODULE, "ticables");
501 if (IS_ERR(tipar_class)) {
502 err = PTR_ERR(tipar_class);
503 goto out_chrdev;
504 }
505 if (parport_register_driver(&tipar_driver)) {
506 printk(KERN_ERR "tipar: unable to register with parport\n");
507 err = -EIO;
508 goto out_class;
509 }
510
511 err = 0;
512 goto out;
513
514out_class:
515 class_destroy(tipar_class);
516
517out_chrdev:
518 unregister_chrdev(TIPAR_MAJOR, "tipar");
519out:
520 return err;
521}
522
523static void __exit
524tipar_cleanup_module(void)
525{
526 unsigned int i;
527
528 /* Unregistering module */
529 parport_unregister_driver(&tipar_driver);
530
531 unregister_chrdev(TIPAR_MAJOR, "tipar");
532
533 for (i = 0; i < PP_NO; i++) {
534 if (table[i].dev == NULL)
535 continue;
536 parport_unregister_device(table[i].dev);
537 device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i));
538 }
539 class_destroy(tipar_class);
540
541 pr_info("tipar: module unloaded\n");
542}
543
544/* --------------------------------------------------------------------- */
545
546__setup("tipar=", tipar_setup);
547module_init(tipar_init_module);
548module_exit(tipar_cleanup_module);
549
550MODULE_AUTHOR(DRIVER_AUTHOR);
551MODULE_DESCRIPTION(DRIVER_DESC);
552MODULE_LICENSE(DRIVER_LICENSE);
553
554module_param(timeout, int, 0);
555MODULE_PARM_DESC(timeout, "Timeout (default=1.5 seconds)");
556module_param(delay, int, 0);
557MODULE_PARM_DESC(delay, "Inter-bit delay (default=10 microseconds)");
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5e626b12b97e..79581fab82d6 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -841,19 +841,25 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
841 drv_attr = cpufreq_driver->attr; 841 drv_attr = cpufreq_driver->attr;
842 while ((drv_attr) && (*drv_attr)) { 842 while ((drv_attr) && (*drv_attr)) {
843 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); 843 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
844 if (ret) 844 if (ret) {
845 unlock_policy_rwsem_write(cpu);
845 goto err_out_driver_exit; 846 goto err_out_driver_exit;
847 }
846 drv_attr++; 848 drv_attr++;
847 } 849 }
848 if (cpufreq_driver->get){ 850 if (cpufreq_driver->get){
849 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); 851 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
850 if (ret) 852 if (ret) {
853 unlock_policy_rwsem_write(cpu);
851 goto err_out_driver_exit; 854 goto err_out_driver_exit;
855 }
852 } 856 }
853 if (cpufreq_driver->target){ 857 if (cpufreq_driver->target){
854 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); 858 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
855 if (ret) 859 if (ret) {
860 unlock_policy_rwsem_write(cpu);
856 goto err_out_driver_exit; 861 goto err_out_driver_exit;
862 }
857 } 863 }
858 864
859 spin_lock_irqsave(&cpufreq_driver_lock, flags); 865 spin_lock_irqsave(&cpufreq_driver_lock, flags);
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 8a45d0f93e26..1b8312b02006 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -164,7 +164,7 @@ freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq)
164 return -1; 164 return -1;
165} 165}
166 166
167static void __cpuexit cpufreq_stats_free_table(unsigned int cpu) 167static void cpufreq_stats_free_table(unsigned int cpu)
168{ 168{
169 struct cpufreq_stats *stat = cpufreq_stats_table[cpu]; 169 struct cpufreq_stats *stat = cpufreq_stats_table[cpu];
170 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); 170 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index c1c2dcc6fc2e..45e7b4666c7b 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -173,10 +173,47 @@ static void ioat_set_dest(dma_addr_t addr,
173 tx_to_ioat_desc(tx)->dst = addr; 173 tx_to_ioat_desc(tx)->dst = addr;
174} 174}
175 175
176/**
177 * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended
178 * descriptors to hw
179 * @chan: DMA channel handle
180 */
176static inline void __ioat1_dma_memcpy_issue_pending( 181static inline void __ioat1_dma_memcpy_issue_pending(
177 struct ioat_dma_chan *ioat_chan); 182 struct ioat_dma_chan *ioat_chan)
183{
184 ioat_chan->pending = 0;
185 writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET);
186}
187
188static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan)
189{
190 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
191
192 if (ioat_chan->pending != 0) {
193 spin_lock_bh(&ioat_chan->desc_lock);
194 __ioat1_dma_memcpy_issue_pending(ioat_chan);
195 spin_unlock_bh(&ioat_chan->desc_lock);
196 }
197}
198
178static inline void __ioat2_dma_memcpy_issue_pending( 199static inline void __ioat2_dma_memcpy_issue_pending(
179 struct ioat_dma_chan *ioat_chan); 200 struct ioat_dma_chan *ioat_chan)
201{
202 ioat_chan->pending = 0;
203 writew(ioat_chan->dmacount,
204 ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET);
205}
206
207static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan)
208{
209 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
210
211 if (ioat_chan->pending != 0) {
212 spin_lock_bh(&ioat_chan->desc_lock);
213 __ioat2_dma_memcpy_issue_pending(ioat_chan);
214 spin_unlock_bh(&ioat_chan->desc_lock);
215 }
216}
180 217
181static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx) 218static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
182{ 219{
@@ -203,7 +240,7 @@ static dma_cookie_t ioat1_tx_submit(struct dma_async_tx_descriptor *tx)
203 prev = to_ioat_desc(ioat_chan->used_desc.prev); 240 prev = to_ioat_desc(ioat_chan->used_desc.prev);
204 prefetch(prev->hw); 241 prefetch(prev->hw);
205 do { 242 do {
206 copy = min((u32) len, ioat_chan->xfercap); 243 copy = min_t(size_t, len, ioat_chan->xfercap);
207 244
208 new->async_tx.ack = 1; 245 new->async_tx.ack = 1;
209 246
@@ -291,10 +328,12 @@ static dma_cookie_t ioat2_tx_submit(struct dma_async_tx_descriptor *tx)
291 orig_ack = first->async_tx.ack; 328 orig_ack = first->async_tx.ack;
292 new = first; 329 new = first;
293 330
294 /* ioat_chan->desc_lock is still in force in version 2 path */ 331 /*
295 332 * ioat_chan->desc_lock is still in force in version 2 path
333 * it gets unlocked at end of this function
334 */
296 do { 335 do {
297 copy = min((u32) len, ioat_chan->xfercap); 336 copy = min_t(size_t, len, ioat_chan->xfercap);
298 337
299 new->async_tx.ack = 1; 338 new->async_tx.ack = 1;
300 339
@@ -432,7 +471,7 @@ static void ioat2_dma_massage_chan_desc(struct ioat_dma_chan *ioat_chan)
432static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) 471static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
433{ 472{
434 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); 473 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
435 struct ioat_desc_sw *desc = NULL; 474 struct ioat_desc_sw *desc;
436 u16 chanctrl; 475 u16 chanctrl;
437 u32 chanerr; 476 u32 chanerr;
438 int i; 477 int i;
@@ -575,7 +614,7 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
575static struct ioat_desc_sw * 614static struct ioat_desc_sw *
576ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) 615ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
577{ 616{
578 struct ioat_desc_sw *new = NULL; 617 struct ioat_desc_sw *new;
579 618
580 if (!list_empty(&ioat_chan->free_desc)) { 619 if (!list_empty(&ioat_chan->free_desc)) {
581 new = to_ioat_desc(ioat_chan->free_desc.next); 620 new = to_ioat_desc(ioat_chan->free_desc.next);
@@ -583,9 +622,11 @@ ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
583 } else { 622 } else {
584 /* try to get another desc */ 623 /* try to get another desc */
585 new = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC); 624 new = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC);
586 /* will this ever happen? */ 625 if (!new) {
587 /* TODO add upper limit on these */ 626 dev_err(&ioat_chan->device->pdev->dev,
588 BUG_ON(!new); 627 "alloc failed\n");
628 return NULL;
629 }
589 } 630 }
590 631
591 prefetch(new->hw); 632 prefetch(new->hw);
@@ -595,7 +636,7 @@ ioat1_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
595static struct ioat_desc_sw * 636static struct ioat_desc_sw *
596ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan) 637ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
597{ 638{
598 struct ioat_desc_sw *new = NULL; 639 struct ioat_desc_sw *new;
599 640
600 /* 641 /*
601 * used.prev points to where to start processing 642 * used.prev points to where to start processing
@@ -609,8 +650,8 @@ ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
609 if (ioat_chan->used_desc.prev && 650 if (ioat_chan->used_desc.prev &&
610 ioat_chan->used_desc.next == ioat_chan->used_desc.prev->prev) { 651 ioat_chan->used_desc.next == ioat_chan->used_desc.prev->prev) {
611 652
612 struct ioat_desc_sw *desc = NULL; 653 struct ioat_desc_sw *desc;
613 struct ioat_desc_sw *noop_desc = NULL; 654 struct ioat_desc_sw *noop_desc;
614 int i; 655 int i;
615 656
616 /* set up the noop descriptor */ 657 /* set up the noop descriptor */
@@ -624,10 +665,14 @@ ioat2_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
624 ioat_chan->pending++; 665 ioat_chan->pending++;
625 ioat_chan->dmacount++; 666 ioat_chan->dmacount++;
626 667
627 /* get a few more descriptors */ 668 /* try to get a few more descriptors */
628 for (i = 16; i; i--) { 669 for (i = 16; i; i--) {
629 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC); 670 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_ATOMIC);
630 BUG_ON(!desc); 671 if (!desc) {
672 dev_err(&ioat_chan->device->pdev->dev,
673 "alloc failed\n");
674 break;
675 }
631 list_add_tail(&desc->node, ioat_chan->used_desc.next); 676 list_add_tail(&desc->node, ioat_chan->used_desc.next);
632 677
633 desc->hw->next 678 desc->hw->next
@@ -677,10 +722,13 @@ static struct dma_async_tx_descriptor *ioat1_dma_prep_memcpy(
677 722
678 spin_lock_bh(&ioat_chan->desc_lock); 723 spin_lock_bh(&ioat_chan->desc_lock);
679 new = ioat_dma_get_next_descriptor(ioat_chan); 724 new = ioat_dma_get_next_descriptor(ioat_chan);
680 new->len = len;
681 spin_unlock_bh(&ioat_chan->desc_lock); 725 spin_unlock_bh(&ioat_chan->desc_lock);
682 726
683 return new ? &new->async_tx : NULL; 727 if (new) {
728 new->len = len;
729 return &new->async_tx;
730 } else
731 return NULL;
684} 732}
685 733
686static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy( 734static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy(
@@ -693,53 +741,17 @@ static struct dma_async_tx_descriptor *ioat2_dma_prep_memcpy(
693 741
694 spin_lock_bh(&ioat_chan->desc_lock); 742 spin_lock_bh(&ioat_chan->desc_lock);
695 new = ioat2_dma_get_next_descriptor(ioat_chan); 743 new = ioat2_dma_get_next_descriptor(ioat_chan);
696 new->len = len;
697
698 /* leave ioat_chan->desc_lock set in version 2 path */
699 return new ? &new->async_tx : NULL;
700}
701 744
745 /*
746 * leave ioat_chan->desc_lock set in ioat 2 path
747 * it will get unlocked at end of tx_submit
748 */
702 749
703/** 750 if (new) {
704 * ioat_dma_memcpy_issue_pending - push potentially unrecognized appended 751 new->len = len;
705 * descriptors to hw 752 return &new->async_tx;
706 * @chan: DMA channel handle 753 } else
707 */ 754 return NULL;
708static inline void __ioat1_dma_memcpy_issue_pending(
709 struct ioat_dma_chan *ioat_chan)
710{
711 ioat_chan->pending = 0;
712 writeb(IOAT_CHANCMD_APPEND, ioat_chan->reg_base + IOAT1_CHANCMD_OFFSET);
713}
714
715static void ioat1_dma_memcpy_issue_pending(struct dma_chan *chan)
716{
717 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
718
719 if (ioat_chan->pending != 0) {
720 spin_lock_bh(&ioat_chan->desc_lock);
721 __ioat1_dma_memcpy_issue_pending(ioat_chan);
722 spin_unlock_bh(&ioat_chan->desc_lock);
723 }
724}
725
726static inline void __ioat2_dma_memcpy_issue_pending(
727 struct ioat_dma_chan *ioat_chan)
728{
729 ioat_chan->pending = 0;
730 writew(ioat_chan->dmacount,
731 ioat_chan->reg_base + IOAT_CHAN_DMACOUNT_OFFSET);
732}
733
734static void ioat2_dma_memcpy_issue_pending(struct dma_chan *chan)
735{
736 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
737
738 if (ioat_chan->pending != 0) {
739 spin_lock_bh(&ioat_chan->desc_lock);
740 __ioat2_dma_memcpy_issue_pending(ioat_chan);
741 spin_unlock_bh(&ioat_chan->desc_lock);
742 }
743} 755}
744 756
745static void ioat_dma_cleanup_tasklet(unsigned long data) 757static void ioat_dma_cleanup_tasklet(unsigned long data)
@@ -1019,7 +1031,7 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
1019static void ioat_dma_test_callback(void *dma_async_param) 1031static void ioat_dma_test_callback(void *dma_async_param)
1020{ 1032{
1021 printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n", 1033 printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n",
1022 dma_async_param); 1034 dma_async_param);
1023} 1035}
1024 1036
1025/** 1037/**
@@ -1032,7 +1044,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1032 u8 *src; 1044 u8 *src;
1033 u8 *dest; 1045 u8 *dest;
1034 struct dma_chan *dma_chan; 1046 struct dma_chan *dma_chan;
1035 struct dma_async_tx_descriptor *tx = NULL; 1047 struct dma_async_tx_descriptor *tx;
1036 dma_addr_t addr; 1048 dma_addr_t addr;
1037 dma_cookie_t cookie; 1049 dma_cookie_t cookie;
1038 int err = 0; 1050 int err = 0;
@@ -1351,7 +1363,7 @@ err_completion_pool:
1351err_dma_pool: 1363err_dma_pool:
1352 kfree(device); 1364 kfree(device);
1353err_kzalloc: 1365err_kzalloc:
1354 dev_err(&device->pdev->dev, 1366 dev_err(&pdev->dev,
1355 "Intel(R) I/OAT DMA Engine initialization failed\n"); 1367 "Intel(R) I/OAT DMA Engine initialization failed\n");
1356 return NULL; 1368 return NULL;
1357} 1369}
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index b668234ef654..f2c7fedbf009 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -76,7 +76,7 @@ struct ioat_dma_chan {
76 dma_cookie_t completed_cookie; 76 dma_cookie_t completed_cookie;
77 unsigned long last_completion; 77 unsigned long last_completion;
78 78
79 u32 xfercap; /* XFERCAP register value expanded out */ 79 size_t xfercap; /* XFERCAP register value expanded out */
80 80
81 spinlock_t cleanup_lock; 81 spinlock_t cleanup_lock;
82 spinlock_t desc_lock; 82 spinlock_t desc_lock;
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index bd7aaff35240..67679882ebef 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -404,7 +404,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
404 DAVINCI_I2C_STR_REG, 404 DAVINCI_I2C_STR_REG,
405 w); 405 w);
406 } else 406 } else
407 dev_err(dev->dev, "RDR IRQ while no" 407 dev_err(dev->dev, "RDR IRQ while no "
408 "data requested\n"); 408 "data requested\n");
409 break; 409 break;
410 410
@@ -423,7 +423,7 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
423 DAVINCI_I2C_IMR_REG, 423 DAVINCI_I2C_IMR_REG,
424 w); 424 w);
425 } else 425 } else
426 dev_err(dev->dev, "TDR IRQ while no data to" 426 dev_err(dev->dev, "TDR IRQ while no data to "
427 "send\n"); 427 "send\n");
428 break; 428 break;
429 429
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 44e1cd21bb01..3ca19fc234fb 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
140 adap->owner = THIS_MODULE; 140 adap->owner = THIS_MODULE;
141 snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); 141 snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
142 adap->algo_data = bit_data; 142 adap->algo_data = bit_data;
143 adap->class = I2C_CLASS_HWMON;
143 adap->dev.parent = &pdev->dev; 144 adap->dev.parent = &pdev->dev;
144 145
145 /* 146 /*
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 89a30028ddb6..cb55cf2ba1e9 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -203,7 +203,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
203 while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) & 203 while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) &
204 OMAP_I2C_SYSS_RDONE)) { 204 OMAP_I2C_SYSS_RDONE)) {
205 if (time_after(jiffies, timeout)) { 205 if (time_after(jiffies, timeout)) {
206 dev_warn(dev->dev, "timeout waiting" 206 dev_warn(dev->dev, "timeout waiting "
207 "for controller reset\n"); 207 "for controller reset\n");
208 return -ETIMEDOUT; 208 return -ETIMEDOUT;
209 } 209 }
@@ -483,7 +483,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
483 dev->buf_len--; 483 dev->buf_len--;
484 } 484 }
485 } else 485 } else
486 dev_err(dev->dev, "RRDY IRQ while no data" 486 dev_err(dev->dev, "RRDY IRQ while no data "
487 "requested\n"); 487 "requested\n");
488 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY); 488 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY);
489 continue; 489 continue;
@@ -498,7 +498,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
498 dev->buf_len--; 498 dev->buf_len--;
499 } 499 }
500 } else 500 } else
501 dev_err(dev->dev, "XRDY IRQ while no" 501 dev_err(dev->dev, "XRDY IRQ while no "
502 "data to send\n"); 502 "data to send\n");
503 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); 503 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
504 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY); 504 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY);
diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
index fe04e46991aa..b767603a07ba 100644
--- a/drivers/i2c/chips/isp1301_omap.c
+++ b/drivers/i2c/chips/isp1301_omap.c
@@ -26,7 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/usb/ch9.h> 28#include <linux/usb/ch9.h>
29#include <linux/usb_gadget.h> 29#include <linux/usb/gadget.h>
30#include <linux/usb.h> 30#include <linux/usb.h>
31#include <linux/usb/otg.h> 31#include <linux/usb/otg.h>
32#include <linux/i2c.h> 32#include <linux/i2c.h>
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 45b22282f149..fb06555708a8 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -390,7 +390,7 @@ config IDEPCI_PCIBUS_ORDER
390 390
391# TODO: split it on per host driver config options (or module parameters) 391# TODO: split it on per host driver config options (or module parameters)
392config BLK_DEV_OFFBOARD 392config BLK_DEV_OFFBOARD
393 bool "Boot off-board chipsets first support" 393 bool "Boot off-board chipsets first support (DEPRECATED)"
394 depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001) 394 depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001)
395 help 395 help
396 Normally, IDE controllers built into the motherboard (on-board 396 Normally, IDE controllers built into the motherboard (on-board
@@ -410,6 +410,10 @@ config BLK_DEV_OFFBOARD
410 Note that, if you do this, the order of the hd* devices will be 410 Note that, if you do this, the order of the hd* devices will be
411 rearranged which may require modification of fstab and other files. 411 rearranged which may require modification of fstab and other files.
412 412
413 Please also note that this method of assuring stable naming of
414 IDE devices is unreliable and use other means for achieving it
415 (i.e. udev).
416
413 If in doubt, say N. 417 If in doubt, say N.
414 418
415config BLK_DEV_GENERIC 419config BLK_DEV_GENERIC
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 57a5f63d6ae3..92ac658dac33 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1650,31 +1650,6 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1650 return 1; 1650 return 1;
1651} 1651}
1652 1652
1653static void post_transform_command(struct request *req)
1654{
1655 u8 *c = req->cmd;
1656 char *ibuf;
1657
1658 if (!blk_pc_request(req))
1659 return;
1660
1661 if (req->bio)
1662 ibuf = bio_data(req->bio);
1663 else
1664 ibuf = req->data;
1665
1666 if (!ibuf)
1667 return;
1668
1669 /*
1670 * set ansi-revision and response data as atapi
1671 */
1672 if (c[0] == GPCMD_INQUIRY) {
1673 ibuf[2] |= 2;
1674 ibuf[3] = (ibuf[3] & 0xf0) | 2;
1675 }
1676}
1677
1678typedef void (xfer_func_t)(ide_drive_t *, void *, u32); 1653typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
1679 1654
1680/* 1655/*
@@ -1810,9 +1785,6 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1810 return ide_started; 1785 return ide_started;
1811 1786
1812end_request: 1787end_request:
1813 if (!rq->data_len)
1814 post_transform_command(rq);
1815
1816 spin_lock_irqsave(&ide_lock, flags); 1788 spin_lock_irqsave(&ide_lock, flags);
1817 blkdev_dequeue_request(rq); 1789 blkdev_dequeue_request(rq);
1818 end_that_request_last(rq, 1); 1790 end_that_request_last(rq, 1);
@@ -3049,12 +3021,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
3049 else 3021 else
3050 printk(" drive"); 3022 printk(" drive");
3051 3023
3052 printk(", %dkB Cache", be16_to_cpu(cap.buffer_size)); 3024 printk(KERN_CONT ", %dkB Cache\n", be16_to_cpu(cap.buffer_size));
3053
3054 if (drive->using_dma)
3055 ide_dma_verbose(drive);
3056
3057 printk("\n");
3058 3025
3059 return nslots; 3026 return nslots;
3060} 3027}
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 00123d99527a..b1781908e1f2 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -13,32 +13,6 @@
13 * and Andre Hedrick <andre@linux-ide.org> 13 * and Andre Hedrick <andre@linux-ide.org>
14 * 14 *
15 * This is the IDE/ATA disk driver, as evolved from hd.c and ide.c. 15 * This is the IDE/ATA disk driver, as evolved from hd.c and ide.c.
16 *
17 * Version 1.00 move disk only code from ide.c to ide-disk.c
18 * support optional byte-swapping of all data
19 * Version 1.01 fix previous byte-swapping code
20 * Version 1.02 remove ", LBA" from drive identification msgs
21 * Version 1.03 fix display of id->buf_size for big-endian
22 * Version 1.04 add /proc configurable settings and S.M.A.R.T support
23 * Version 1.05 add capacity support for ATA3 >= 8GB
24 * Version 1.06 get boot-up messages to show full cyl count
25 * Version 1.07 disable door-locking if it fails
26 * Version 1.08 fixed CHS/LBA translations for ATA4 > 8GB,
27 * process of adding new ATA4 compliance.
28 * fixed problems in allowing fdisk to see
29 * the entire disk.
30 * Version 1.09 added increment of rq->sector in ide_multwrite
31 * added UDMA 3/4 reporting
32 * Version 1.10 request queue changes, Ultra DMA 100
33 * Version 1.11 added 48-bit lba
34 * Version 1.12 adding taskfile io access method
35 * Version 1.13 added standby and flush-cache for notifier
36 * Version 1.14 added acoustic-wcache
37 * Version 1.15 convert all calls to ide_raw_taskfile
38 * since args will return register content.
39 * Version 1.16 added suspend-resume-checkpower
40 * Version 1.17 do flush on standby, do flush on ATA < ATA6
41 * fix wcache setup.
42 */ 16 */
43 17
44#define IDEDISK_VERSION "1.18" 18#define IDEDISK_VERSION "1.18"
@@ -961,11 +935,8 @@ static void idedisk_setup (ide_drive_t *drive)
961 if (id->buf_size) 935 if (id->buf_size)
962 printk (" w/%dKiB Cache", id->buf_size/2); 936 printk (" w/%dKiB Cache", id->buf_size/2);
963 937
964 printk(", CHS=%d/%d/%d", 938 printk(KERN_CONT ", CHS=%d/%d/%d\n",
965 drive->bios_cyl, drive->bios_head, drive->bios_sect); 939 drive->bios_cyl, drive->bios_head, drive->bios_sect);
966 if (drive->using_dma)
967 ide_dma_verbose(drive);
968 printk("\n");
969 940
970 /* write cache enabled? */ 941 /* write cache enabled? */
971 if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5))) 942 if ((id->csfo & 1) || (id->cfs_enable_1 & (1 << 5)))
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 0d795a1678c7..4703837bf1fc 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -611,12 +611,6 @@ static int __ide_dma_test_irq(ide_drive_t *drive)
611 ide_hwif_t *hwif = HWIF(drive); 611 ide_hwif_t *hwif = HWIF(drive);
612 u8 dma_stat = hwif->INB(hwif->dma_status); 612 u8 dma_stat = hwif->INB(hwif->dma_status);
613 613
614#if 0 /* do not set unless you know what you are doing */
615 if (dma_stat & 4) {
616 u8 stat = hwif->INB(IDE_STATUS_REG);
617 hwif->OUTB(hwif->dma_status, dma_stat & 0xE4);
618 }
619#endif
620 /* return 1 if INTR asserted */ 614 /* return 1 if INTR asserted */
621 if ((dma_stat & 4) == 4) 615 if ((dma_stat & 4) == 4)
622 return 1; 616 return 1;
@@ -753,10 +747,12 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
753 mode = XFER_MW_DMA_1; 747 mode = XFER_MW_DMA_1;
754 } 748 }
755 749
756 printk(KERN_DEBUG "%s: %s mode selected\n", drive->name, 750 mode = min(mode, req_mode);
751
752 printk(KERN_INFO "%s: %s mode selected\n", drive->name,
757 mode ? ide_xfer_verbose(mode) : "no DMA"); 753 mode ? ide_xfer_verbose(mode) : "no DMA");
758 754
759 return min(mode, req_mode); 755 return mode;
760} 756}
761 757
762EXPORT_SYMBOL_GPL(ide_find_dma_mode); 758EXPORT_SYMBOL_GPL(ide_find_dma_mode);
@@ -772,6 +768,9 @@ static int ide_tune_dma(ide_drive_t *drive)
772 if (__ide_dma_bad_drive(drive)) 768 if (__ide_dma_bad_drive(drive))
773 return 0; 769 return 0;
774 770
771 if (ide_id_dma_bug(drive))
772 return 0;
773
775 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) 774 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
776 return config_drive_for_dma(drive); 775 return config_drive_for_dma(drive);
777 776
@@ -806,58 +805,23 @@ static int ide_dma_check(ide_drive_t *drive)
806 return vdma ? 0 : -1; 805 return vdma ? 0 : -1;
807} 806}
808 807
809void ide_dma_verbose(ide_drive_t *drive) 808int ide_id_dma_bug(ide_drive_t *drive)
810{ 809{
811 struct hd_driveid *id = drive->id; 810 struct hd_driveid *id = drive->id;
812 ide_hwif_t *hwif = HWIF(drive);
813 811
814 if (id->field_valid & 4) { 812 if (id->field_valid & 4) {
815 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) 813 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8))
816 goto bug_dma_off; 814 goto err_out;
817 if (id->dma_ultra & ((id->dma_ultra >> 8) & hwif->ultra_mask)) {
818 if (((id->dma_ultra >> 11) & 0x1F) &&
819 eighty_ninty_three(drive)) {
820 if ((id->dma_ultra >> 15) & 1) {
821 printk(", UDMA(mode 7)");
822 } else if ((id->dma_ultra >> 14) & 1) {
823 printk(", UDMA(133)");
824 } else if ((id->dma_ultra >> 13) & 1) {
825 printk(", UDMA(100)");
826 } else if ((id->dma_ultra >> 12) & 1) {
827 printk(", UDMA(66)");
828 } else if ((id->dma_ultra >> 11) & 1) {
829 printk(", UDMA(44)");
830 } else
831 goto mode_two;
832 } else {
833 mode_two:
834 if ((id->dma_ultra >> 10) & 1) {
835 printk(", UDMA(33)");
836 } else if ((id->dma_ultra >> 9) & 1) {
837 printk(", UDMA(25)");
838 } else if ((id->dma_ultra >> 8) & 1) {
839 printk(", UDMA(16)");
840 }
841 }
842 } else {
843 printk(", (U)DMA"); /* Can be BIOS-enabled! */
844 }
845 } else if (id->field_valid & 2) { 815 } else if (id->field_valid & 2) {
846 if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) 816 if ((id->dma_mword >> 8) && (id->dma_1word >> 8))
847 goto bug_dma_off; 817 goto err_out;
848 printk(", DMA");
849 } else if (id->field_valid & 1) {
850 goto bug_dma_off;
851 } 818 }
852 return; 819 return 0;
853bug_dma_off: 820err_out:
854 printk(", BUG DMA OFF"); 821 printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
855 hwif->dma_off_quietly(drive); 822 return 1;
856 return;
857} 823}
858 824
859EXPORT_SYMBOL(ide_dma_verbose);
860
861int ide_set_dma(ide_drive_t *drive) 825int ide_set_dma(ide_drive_t *drive)
862{ 826{
863 ide_hwif_t *hwif = drive->hwif; 827 ide_hwif_t *hwif = drive->hwif;
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index db22d1ff4e55..bef781fec500 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -970,7 +970,8 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
970 if (rc) 970 if (rc)
971 printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); 971 printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
972 SELECT_DRIVE(drive); 972 SELECT_DRIVE(drive);
973 HWIF(drive)->OUTB(8, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]); 973 if (IDE_CONTROL_REG)
974 HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
974 rc = ide_wait_not_busy(HWIF(drive), 100000); 975 rc = ide_wait_not_busy(HWIF(drive), 100000);
975 if (rc) 976 if (rc)
976 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); 977 printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 5c3256180ae5..cef405ddaf0e 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -748,6 +748,9 @@ int ide_driveid_update(ide_drive_t *drive)
748 drive->id->dma_1word = id->dma_1word; 748 drive->id->dma_1word = id->dma_1word;
749 /* anything more ? */ 749 /* anything more ? */
750 kfree(id); 750 kfree(id);
751
752 if (drive->using_dma && ide_id_dma_bug(drive))
753 ide_dma_off(drive);
751 } 754 }
752 755
753 return 1; 756 return 1;
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 1609b8604f56..062d3bcb2471 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -29,41 +29,44 @@
29 * Add common non I/O op stuff here. Make sure it has proper 29 * Add common non I/O op stuff here. Make sure it has proper
30 * kernel-doc function headers or your patch will be rejected 30 * kernel-doc function headers or your patch will be rejected
31 */ 31 */
32 32
33static const char *udma_str[] =
34 { "UDMA/16", "UDMA/25", "UDMA/33", "UDMA/44",
35 "UDMA/66", "UDMA/100", "UDMA/133", "UDMA7" };
36static const char *mwdma_str[] =
37 { "MWDMA0", "MWDMA1", "MWDMA2" };
38static const char *swdma_str[] =
39 { "SWDMA0", "SWDMA1", "SWDMA2" };
40static const char *pio_str[] =
41 { "PIO0", "PIO1", "PIO2", "PIO3", "PIO4", "PIO5" };
33 42
34/** 43/**
35 * ide_xfer_verbose - return IDE mode names 44 * ide_xfer_verbose - return IDE mode names
36 * @xfer_rate: rate to name 45 * @mode: transfer mode
37 * 46 *
38 * Returns a constant string giving the name of the mode 47 * Returns a constant string giving the name of the mode
39 * requested. 48 * requested.
40 */ 49 */
41 50
42char *ide_xfer_verbose (u8 xfer_rate) 51const char *ide_xfer_verbose(u8 mode)
43{ 52{
44 switch(xfer_rate) { 53 const char *s;
45 case XFER_UDMA_7: return("UDMA 7"); 54 u8 i = mode & 0xf;
46 case XFER_UDMA_6: return("UDMA 6"); 55
47 case XFER_UDMA_5: return("UDMA 5"); 56 if (mode >= XFER_UDMA_0 && mode <= XFER_UDMA_7)
48 case XFER_UDMA_4: return("UDMA 4"); 57 s = udma_str[i];
49 case XFER_UDMA_3: return("UDMA 3"); 58 else if (mode >= XFER_MW_DMA_0 && mode <= XFER_MW_DMA_2)
50 case XFER_UDMA_2: return("UDMA 2"); 59 s = mwdma_str[i];
51 case XFER_UDMA_1: return("UDMA 1"); 60 else if (mode >= XFER_SW_DMA_0 && mode <= XFER_SW_DMA_2)
52 case XFER_UDMA_0: return("UDMA 0"); 61 s = swdma_str[i];
53 case XFER_MW_DMA_2: return("MW DMA 2"); 62 else if (mode >= XFER_PIO_0 && mode <= XFER_PIO_5)
54 case XFER_MW_DMA_1: return("MW DMA 1"); 63 s = pio_str[i & 0x7];
55 case XFER_MW_DMA_0: return("MW DMA 0"); 64 else if (mode == XFER_PIO_SLOW)
56 case XFER_SW_DMA_2: return("SW DMA 2"); 65 s = "PIO SLOW";
57 case XFER_SW_DMA_1: return("SW DMA 1"); 66 else
58 case XFER_SW_DMA_0: return("SW DMA 0"); 67 s = "XFER ERROR";
59 case XFER_PIO_4: return("PIO 4"); 68
60 case XFER_PIO_3: return("PIO 3"); 69 return s;
61 case XFER_PIO_2: return("PIO 2");
62 case XFER_PIO_1: return("PIO 1");
63 case XFER_PIO_0: return("PIO 0");
64 case XFER_PIO_SLOW: return("PIO SLOW");
65 default: return("XFER ERROR");
66 }
67} 70}
68 71
69EXPORT_SYMBOL(ide_xfer_verbose); 72EXPORT_SYMBOL(ide_xfer_verbose);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index ee848c705995..2994523be7bf 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -13,22 +13,8 @@
13 * 13 *
14 * This is the IDE probe module, as evolved from hd.c and ide.c. 14 * This is the IDE probe module, as evolved from hd.c and ide.c.
15 * 15 *
16 * Version 1.00 move drive probing code from ide.c to ide-probe.c 16 * -- increase WAIT_PIDENTIFY to avoid CD-ROM locking at boot
17 * Version 1.01 fix compilation problem for m68k 17 * by Andrea Arcangeli
18 * Version 1.02 increase WAIT_PIDENTIFY to avoid CD-ROM locking at boot
19 * by Andrea Arcangeli
20 * Version 1.03 fix for (hwif->chipset == ide_4drives)
21 * Version 1.04 fixed buggy treatments of known flash memory cards
22 *
23 * Version 1.05 fix for (hwif->chipset == ide_pdc4030)
24 * added ide6/7/8/9
25 * allowed for secondary flash card to be detectable
26 * with new flag : drive->ata_flash : 1;
27 * Version 1.06 stream line request queue and prep for cascade project.
28 * Version 1.07 max_sect <= 255; slower disks would get behind and
29 * then fall over when they get to 256. Paul G.
30 * Version 1.10 Update set for new IDE. drive->id is now always
31 * valid after probe time even with noprobe
32 */ 18 */
33 19
34#include <linux/module.h> 20#include <linux/module.h>
@@ -667,7 +653,8 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
667 /* Ignore disks that we will not probe for later. */ 653 /* Ignore disks that we will not probe for later. */
668 if (!drive->noprobe || drive->present) { 654 if (!drive->noprobe || drive->present) {
669 SELECT_DRIVE(drive); 655 SELECT_DRIVE(drive);
670 hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); 656 if (IDE_CONTROL_REG)
657 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
671 mdelay(2); 658 mdelay(2);
672 rc = ide_wait_not_busy(hwif, 35000); 659 rc = ide_wait_not_busy(hwif, 35000);
673 if (rc) 660 if (rc)
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 674a65c1a130..54943da6e4e5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -800,11 +800,17 @@ int set_io_32bit(ide_drive_t *drive, int arg)
800 if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) 800 if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1))
801 return -EINVAL; 801 return -EINVAL;
802 802
803 if (ide_spin_wait_hwgroup(drive))
804 return -EBUSY;
805
803 drive->io_32bit = arg; 806 drive->io_32bit = arg;
804#ifdef CONFIG_BLK_DEV_DTC2278 807#ifdef CONFIG_BLK_DEV_DTC2278
805 if (HWIF(drive)->chipset == ide_dtc2278) 808 if (HWIF(drive)->chipset == ide_dtc2278)
806 HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg; 809 HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg;
807#endif /* CONFIG_BLK_DEV_DTC2278 */ 810#endif /* CONFIG_BLK_DEV_DTC2278 */
811
812 spin_unlock_irq(&ide_lock);
813
808 return 0; 814 return 0;
809} 815}
810 816
@@ -1670,10 +1676,34 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
1670 return sprintf(buf, "ide:m-%s\n", media_string(drive)); 1676 return sprintf(buf, "ide:m-%s\n", media_string(drive));
1671} 1677}
1672 1678
1679static ssize_t model_show(struct device *dev, struct device_attribute *attr,
1680 char *buf)
1681{
1682 ide_drive_t *drive = to_ide_device(dev);
1683 return sprintf(buf, "%s\n", drive->id->model);
1684}
1685
1686static ssize_t firmware_show(struct device *dev, struct device_attribute *attr,
1687 char *buf)
1688{
1689 ide_drive_t *drive = to_ide_device(dev);
1690 return sprintf(buf, "%s\n", drive->id->fw_rev);
1691}
1692
1693static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
1694 char *buf)
1695{
1696 ide_drive_t *drive = to_ide_device(dev);
1697 return sprintf(buf, "%s\n", drive->id->serial_no);
1698}
1699
1673static struct device_attribute ide_dev_attrs[] = { 1700static struct device_attribute ide_dev_attrs[] = {
1674 __ATTR_RO(media), 1701 __ATTR_RO(media),
1675 __ATTR_RO(drivename), 1702 __ATTR_RO(drivename),
1676 __ATTR_RO(modalias), 1703 __ATTR_RO(modalias),
1704 __ATTR_RO(model),
1705 __ATTR_RO(firmware),
1706 __ATTR(serial, 0400, serial_show, NULL),
1677 __ATTR_NULL 1707 __ATTR_NULL
1678}; 1708};
1679 1709
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 5682895d36d9..9fce25bdec8a 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.21 Oct 23, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.22 Dec 4, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -310,6 +310,8 @@ static u32 twenty_five_base_hpt36x[] = {
310 /* XFER_PIO_0 */ 0xc0d08585 310 /* XFER_PIO_0 */ 0xc0d08585
311}; 311};
312 312
313#if 0
314/* These are the timing tables from the HighPoint open source drivers... */
313static u32 thirty_three_base_hpt37x[] = { 315static u32 thirty_three_base_hpt37x[] = {
314 /* XFER_UDMA_6 */ 0x12446231, /* 0x12646231 ?? */ 316 /* XFER_UDMA_6 */ 0x12446231, /* 0x12646231 ?? */
315 /* XFER_UDMA_5 */ 0x12446231, 317 /* XFER_UDMA_5 */ 0x12446231,
@@ -369,6 +371,73 @@ static u32 sixty_six_base_hpt37x[] = {
369 /* XFER_PIO_1 */ 0x0d029d26, 371 /* XFER_PIO_1 */ 0x0d029d26,
370 /* XFER_PIO_0 */ 0x0d029d5e 372 /* XFER_PIO_0 */ 0x0d029d5e
371}; 373};
374#else
375/*
376 * The following are the new timing tables with PIO mode data/taskfile transfer
377 * overclocking fixed...
378 */
379
380/* This table is taken from the HPT370 data manual rev. 1.02 */
381static u32 thirty_three_base_hpt37x[] = {
382 /* XFER_UDMA_6 */ 0x16455031, /* 0x16655031 ?? */
383 /* XFER_UDMA_5 */ 0x16455031,
384 /* XFER_UDMA_4 */ 0x16455031,
385 /* XFER_UDMA_3 */ 0x166d5031,
386 /* XFER_UDMA_2 */ 0x16495031,
387 /* XFER_UDMA_1 */ 0x164d5033,
388 /* XFER_UDMA_0 */ 0x16515097,
389
390 /* XFER_MW_DMA_2 */ 0x26515031,
391 /* XFER_MW_DMA_1 */ 0x26515033,
392 /* XFER_MW_DMA_0 */ 0x26515097,
393
394 /* XFER_PIO_4 */ 0x06515021,
395 /* XFER_PIO_3 */ 0x06515022,
396 /* XFER_PIO_2 */ 0x06515033,
397 /* XFER_PIO_1 */ 0x06915065,
398 /* XFER_PIO_0 */ 0x06d1508a
399};
400
401static u32 fifty_base_hpt37x[] = {
402 /* XFER_UDMA_6 */ 0x1a861842,
403 /* XFER_UDMA_5 */ 0x1a861842,
404 /* XFER_UDMA_4 */ 0x1aae1842,
405 /* XFER_UDMA_3 */ 0x1a8e1842,
406 /* XFER_UDMA_2 */ 0x1a0e1842,
407 /* XFER_UDMA_1 */ 0x1a161854,
408 /* XFER_UDMA_0 */ 0x1a1a18ea,
409
410 /* XFER_MW_DMA_2 */ 0x2a821842,
411 /* XFER_MW_DMA_1 */ 0x2a821854,
412 /* XFER_MW_DMA_0 */ 0x2a8218ea,
413
414 /* XFER_PIO_4 */ 0x0a821842,
415 /* XFER_PIO_3 */ 0x0a821843,
416 /* XFER_PIO_2 */ 0x0a821855,
417 /* XFER_PIO_1 */ 0x0ac218a8,
418 /* XFER_PIO_0 */ 0x0b02190c
419};
420
421static u32 sixty_six_base_hpt37x[] = {
422 /* XFER_UDMA_6 */ 0x1c86fe62,
423 /* XFER_UDMA_5 */ 0x1caefe62, /* 0x1c8afe62 */
424 /* XFER_UDMA_4 */ 0x1c8afe62,
425 /* XFER_UDMA_3 */ 0x1c8efe62,
426 /* XFER_UDMA_2 */ 0x1c92fe62,
427 /* XFER_UDMA_1 */ 0x1c9afe62,
428 /* XFER_UDMA_0 */ 0x1c82fe62,
429
430 /* XFER_MW_DMA_2 */ 0x2c82fe62,
431 /* XFER_MW_DMA_1 */ 0x2c82fe66,
432 /* XFER_MW_DMA_0 */ 0x2c82ff2e,
433
434 /* XFER_PIO_4 */ 0x0c82fe62,
435 /* XFER_PIO_3 */ 0x0c82fe84,
436 /* XFER_PIO_2 */ 0x0c82fea6,
437 /* XFER_PIO_1 */ 0x0d02ff26,
438 /* XFER_PIO_0 */ 0x0d42ff7f
439};
440#endif
372 441
373#define HPT366_DEBUG_DRIVE_INFO 0 442#define HPT366_DEBUG_DRIVE_INFO 0
374#define HPT371_ALLOW_ATA133_6 1 443#define HPT371_ALLOW_ATA133_6 1
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 4234efeba606..2b4f44e45a1a 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -482,8 +482,9 @@ static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev)
482{ 482{
483 struct pci_dev *dev2; 483 struct pci_dev *dev2;
484 484
485 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2, 485 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 1,
486 PCI_FUNC(dev->devfn))); 486 PCI_FUNC(dev->devfn)));
487
487 if (dev2 && 488 if (dev2 &&
488 dev2->vendor == dev->vendor && 489 dev2->vendor == dev->vendor &&
489 dev2->device == dev->device) { 490 dev2->device == dev->device) {
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 25fd09053220..d2cd5a3d38f8 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -704,7 +704,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_devices);
704/* 704/*
705 * Module interfaces 705 * Module interfaces
706 */ 706 */
707 707
708static int pre_init = 1; /* Before first ordered IDE scan */ 708static int pre_init = 1; /* Before first ordered IDE scan */
709static LIST_HEAD(ide_pci_drivers); 709static LIST_HEAD(ide_pci_drivers);
710 710
@@ -714,7 +714,7 @@ static LIST_HEAD(ide_pci_drivers);
714 * @module: owner module of the driver 714 * @module: owner module of the driver
715 * 715 *
716 * Registers a driver with the IDE layer. The IDE layer arranges that 716 * Registers a driver with the IDE layer. The IDE layer arranges that
717 * boot time setup is done in the expected device order and then 717 * boot time setup is done in the expected device order and then
718 * hands the controllers off to the core PCI code to do the rest of 718 * hands the controllers off to the core PCI code to do the rest of
719 * the work. 719 * the work.
720 * 720 *
@@ -724,13 +724,12 @@ static LIST_HEAD(ide_pci_drivers);
724int __ide_pci_register_driver(struct pci_driver *driver, struct module *module, 724int __ide_pci_register_driver(struct pci_driver *driver, struct module *module,
725 const char *mod_name) 725 const char *mod_name)
726{ 726{
727 if(!pre_init) 727 if (!pre_init)
728 return __pci_register_driver(driver, module, mod_name); 728 return __pci_register_driver(driver, module, mod_name);
729 driver->driver.owner = module; 729 driver->driver.owner = module;
730 list_add_tail(&driver->node, &ide_pci_drivers); 730 list_add_tail(&driver->node, &ide_pci_drivers);
731 return 0; 731 return 0;
732} 732}
733
734EXPORT_SYMBOL_GPL(__ide_pci_register_driver); 733EXPORT_SYMBOL_GPL(__ide_pci_register_driver);
735 734
736/** 735/**
@@ -741,17 +740,18 @@ EXPORT_SYMBOL_GPL(__ide_pci_register_driver);
741 * This is only used during boot up to get the ordering correct. After 740 * This is only used during boot up to get the ordering correct. After
742 * boot up the pci layer takes over the job. 741 * boot up the pci layer takes over the job.
743 */ 742 */
744 743
745static int __init ide_scan_pcidev(struct pci_dev *dev) 744static int __init ide_scan_pcidev(struct pci_dev *dev)
746{ 745{
747 struct list_head *l; 746 struct list_head *l;
748 struct pci_driver *d; 747 struct pci_driver *d;
749 748
750 list_for_each(l, &ide_pci_drivers) { 749 list_for_each(l, &ide_pci_drivers) {
751 d = list_entry(l, struct pci_driver, node); 750 d = list_entry(l, struct pci_driver, node);
752 if (d->id_table) { 751 if (d->id_table) {
753 const struct pci_device_id *id = pci_match_id(d->id_table, 752 const struct pci_device_id *id =
754 dev); 753 pci_match_id(d->id_table, dev);
754
755 if (id != NULL && d->probe(dev, id) >= 0) { 755 if (id != NULL && d->probe(dev, id) >= 0) {
756 dev->driver = d; 756 dev->driver = d;
757 pci_dev_get(dev); 757 pci_dev_get(dev);
@@ -779,13 +779,13 @@ void __init ide_scan_pcibus (int scan_direction)
779 779
780 pre_init = 0; 780 pre_init = 0;
781 if (!scan_direction) 781 if (!scan_direction)
782 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) 782 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)))
783 ide_scan_pcidev(dev); 783 ide_scan_pcidev(dev);
784 else 784 else
785 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) 785 while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID,
786 != NULL) 786 dev)))
787 ide_scan_pcidev(dev); 787 ide_scan_pcidev(dev);
788 788
789 /* 789 /*
790 * Hand the drivers over to the PCI layer now we 790 * Hand the drivers over to the PCI layer now we
791 * are post init. 791 * are post init.
@@ -794,9 +794,10 @@ void __init ide_scan_pcibus (int scan_direction)
794 list_for_each_safe(l, n, &ide_pci_drivers) { 794 list_for_each_safe(l, n, &ide_pci_drivers) {
795 list_del(l); 795 list_del(l);
796 d = list_entry(l, struct pci_driver, node); 796 d = list_entry(l, struct pci_driver, node);
797 if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name)) 797 if (__pci_register_driver(d, d->driver.owner,
798 printk(KERN_ERR "%s: failed to register driver for %s\n", 798 d->driver.mod_name))
799 __FUNCTION__, d->driver.mod_name); 799 printk(KERN_ERR "%s: failed to register %s driver\n",
800 __FUNCTION__, d->driver.mod_name);
800 } 801 }
801} 802}
802#endif 803#endif
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 87f12d4312a7..74d2b72a11d8 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -322,6 +322,7 @@ extern int ehca_static_rate;
322extern int ehca_port_act_time; 322extern int ehca_port_act_time;
323extern int ehca_use_hp_mr; 323extern int ehca_use_hp_mr;
324extern int ehca_scaling_code; 324extern int ehca_scaling_code;
325extern int ehca_lock_hcalls;
325 326
326struct ipzu_queue_resp { 327struct ipzu_queue_resp {
327 u32 qe_size; /* queue entry size */ 328 u32 qe_size; /* queue entry size */
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 90d4334179bf..6a56d86a2951 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -43,13 +43,14 @@
43#ifdef CONFIG_PPC_64K_PAGES 43#ifdef CONFIG_PPC_64K_PAGES
44#include <linux/slab.h> 44#include <linux/slab.h>
45#endif 45#endif
46
46#include "ehca_classes.h" 47#include "ehca_classes.h"
47#include "ehca_iverbs.h" 48#include "ehca_iverbs.h"
48#include "ehca_mrmw.h" 49#include "ehca_mrmw.h"
49#include "ehca_tools.h" 50#include "ehca_tools.h"
50#include "hcp_if.h" 51#include "hcp_if.h"
51 52
52#define HCAD_VERSION "0024" 53#define HCAD_VERSION "0025"
53 54
54MODULE_LICENSE("Dual BSD/GPL"); 55MODULE_LICENSE("Dual BSD/GPL");
55MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>"); 56MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
@@ -66,6 +67,7 @@ int ehca_poll_all_eqs = 1;
66int ehca_static_rate = -1; 67int ehca_static_rate = -1;
67int ehca_scaling_code = 0; 68int ehca_scaling_code = 0;
68int ehca_mr_largepage = 1; 69int ehca_mr_largepage = 1;
70int ehca_lock_hcalls = -1;
69 71
70module_param_named(open_aqp1, ehca_open_aqp1, int, S_IRUGO); 72module_param_named(open_aqp1, ehca_open_aqp1, int, S_IRUGO);
71module_param_named(debug_level, ehca_debug_level, int, S_IRUGO); 73module_param_named(debug_level, ehca_debug_level, int, S_IRUGO);
@@ -77,6 +79,7 @@ module_param_named(poll_all_eqs, ehca_poll_all_eqs, int, S_IRUGO);
77module_param_named(static_rate, ehca_static_rate, int, S_IRUGO); 79module_param_named(static_rate, ehca_static_rate, int, S_IRUGO);
78module_param_named(scaling_code, ehca_scaling_code, int, S_IRUGO); 80module_param_named(scaling_code, ehca_scaling_code, int, S_IRUGO);
79module_param_named(mr_largepage, ehca_mr_largepage, int, S_IRUGO); 81module_param_named(mr_largepage, ehca_mr_largepage, int, S_IRUGO);
82module_param_named(lock_hcalls, ehca_lock_hcalls, bool, S_IRUGO);
80 83
81MODULE_PARM_DESC(open_aqp1, 84MODULE_PARM_DESC(open_aqp1,
82 "AQP1 on startup (0: no (default), 1: yes)"); 85 "AQP1 on startup (0: no (default), 1: yes)");
@@ -102,6 +105,9 @@ MODULE_PARM_DESC(scaling_code,
102MODULE_PARM_DESC(mr_largepage, 105MODULE_PARM_DESC(mr_largepage,
103 "use large page for MR (0: use PAGE_SIZE (default), " 106 "use large page for MR (0: use PAGE_SIZE (default), "
104 "1: use large page depending on MR size"); 107 "1: use large page depending on MR size");
108MODULE_PARM_DESC(lock_hcalls,
109 "serialize all hCalls made by the driver "
110 "(default: autodetect)");
105 111
106DEFINE_RWLOCK(ehca_qp_idr_lock); 112DEFINE_RWLOCK(ehca_qp_idr_lock);
107DEFINE_RWLOCK(ehca_cq_idr_lock); 113DEFINE_RWLOCK(ehca_cq_idr_lock);
@@ -258,6 +264,7 @@ static struct cap_descr {
258 { HCA_CAP_UD_LL_QP, "HCA_CAP_UD_LL_QP" }, 264 { HCA_CAP_UD_LL_QP, "HCA_CAP_UD_LL_QP" },
259 { HCA_CAP_RESIZE_MR, "HCA_CAP_RESIZE_MR" }, 265 { HCA_CAP_RESIZE_MR, "HCA_CAP_RESIZE_MR" },
260 { HCA_CAP_MINI_QP, "HCA_CAP_MINI_QP" }, 266 { HCA_CAP_MINI_QP, "HCA_CAP_MINI_QP" },
267 { HCA_CAP_H_ALLOC_RES_SYNC, "HCA_CAP_H_ALLOC_RES_SYNC" },
261}; 268};
262 269
263static int ehca_sense_attributes(struct ehca_shca *shca) 270static int ehca_sense_attributes(struct ehca_shca *shca)
@@ -333,6 +340,12 @@ static int ehca_sense_attributes(struct ehca_shca *shca)
333 if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap)) 340 if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap))
334 ehca_gen_dbg(" %s", hca_cap_descr[i].descr); 341 ehca_gen_dbg(" %s", hca_cap_descr[i].descr);
335 342
343 /* Autodetect hCall locking -- the "H_ALLOC_RESOURCE synced" flag is
344 * a firmware property, so it's valid across all adapters
345 */
346 if (ehca_lock_hcalls == -1)
347 ehca_lock_hcalls = !(shca->hca_cap & HCA_CAP_H_ALLOC_RES_SYNC);
348
336 /* translate supported MR page sizes; always support 4K */ 349 /* translate supported MR page sizes; always support 4K */
337 shca->hca_cap_mr_pgsize = EHCA_PAGESIZE; 350 shca->hca_cap_mr_pgsize = EHCA_PAGESIZE;
338 if (ehca_mr_largepage) { /* support extra sizes only if enabled */ 351 if (ehca_mr_largepage) { /* support extra sizes only if enabled */
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index dd126681fed0..eff5fb55604b 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -838,7 +838,7 @@ struct ib_srq *ehca_create_srq(struct ib_pd *pd,
838 838
839 /* copy back return values */ 839 /* copy back return values */
840 srq_init_attr->attr.max_wr = qp_init_attr.cap.max_recv_wr; 840 srq_init_attr->attr.max_wr = qp_init_attr.cap.max_recv_wr;
841 srq_init_attr->attr.max_sge = qp_init_attr.cap.max_recv_sge; 841 srq_init_attr->attr.max_sge = 3;
842 842
843 /* drive SRQ into RTR state */ 843 /* drive SRQ into RTR state */
844 mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); 844 mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
@@ -1750,7 +1750,7 @@ int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr)
1750 } 1750 }
1751 1751
1752 srq_attr->max_wr = qpcb->max_nr_outst_recv_wr - 1; 1752 srq_attr->max_wr = qpcb->max_nr_outst_recv_wr - 1;
1753 srq_attr->max_sge = qpcb->actual_nr_sges_in_rq_wqe; 1753 srq_attr->max_sge = 3;
1754 srq_attr->srq_limit = EHCA_BMASK_GET( 1754 srq_attr->srq_limit = EHCA_BMASK_GET(
1755 MQPCB_CURR_SRQ_LIMIT, qpcb->curr_srq_limit); 1755 MQPCB_CURR_SRQ_LIMIT, qpcb->curr_srq_limit);
1756 1756
diff --git a/drivers/infiniband/hw/ehca/hcp_if.c b/drivers/infiniband/hw/ehca/hcp_if.c
index c16a21374bb5..7029aa653751 100644
--- a/drivers/infiniband/hw/ehca/hcp_if.c
+++ b/drivers/infiniband/hw/ehca/hcp_if.c
@@ -120,26 +120,21 @@ static long ehca_plpar_hcall_norets(unsigned long opcode,
120 unsigned long arg7) 120 unsigned long arg7)
121{ 121{
122 long ret; 122 long ret;
123 int i, sleep_msecs, do_lock; 123 int i, sleep_msecs;
124 unsigned long flags; 124 unsigned long flags = 0;
125 125
126 ehca_gen_dbg("opcode=%lx " HCALL7_REGS_FORMAT, 126 ehca_gen_dbg("opcode=%lx " HCALL7_REGS_FORMAT,
127 opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7); 127 opcode, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
128 128
129 /* lock H_FREE_RESOURCE(MR) against itself and H_ALLOC_RESOURCE(MR) */
130 if ((opcode == H_FREE_RESOURCE) && (arg7 == 5)) {
131 arg7 = 0; /* better not upset firmware */
132 do_lock = 1;
133 }
134
135 for (i = 0; i < 5; i++) { 129 for (i = 0; i < 5; i++) {
136 if (do_lock) 130 /* serialize hCalls to work around firmware issue */
131 if (ehca_lock_hcalls)
137 spin_lock_irqsave(&hcall_lock, flags); 132 spin_lock_irqsave(&hcall_lock, flags);
138 133
139 ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4, 134 ret = plpar_hcall_norets(opcode, arg1, arg2, arg3, arg4,
140 arg5, arg6, arg7); 135 arg5, arg6, arg7);
141 136
142 if (do_lock) 137 if (ehca_lock_hcalls)
143 spin_unlock_irqrestore(&hcall_lock, flags); 138 spin_unlock_irqrestore(&hcall_lock, flags);
144 139
145 if (H_IS_LONG_BUSY(ret)) { 140 if (H_IS_LONG_BUSY(ret)) {
@@ -174,24 +169,22 @@ static long ehca_plpar_hcall9(unsigned long opcode,
174 unsigned long arg9) 169 unsigned long arg9)
175{ 170{
176 long ret; 171 long ret;
177 int i, sleep_msecs, do_lock; 172 int i, sleep_msecs;
178 unsigned long flags = 0; 173 unsigned long flags = 0;
179 174
180 ehca_gen_dbg("INPUT -- opcode=%lx " HCALL9_REGS_FORMAT, opcode, 175 ehca_gen_dbg("INPUT -- opcode=%lx " HCALL9_REGS_FORMAT, opcode,
181 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); 176 arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
182 177
183 /* lock H_ALLOC_RESOURCE(MR) against itself and H_FREE_RESOURCE(MR) */
184 do_lock = ((opcode == H_ALLOC_RESOURCE) && (arg2 == 5));
185
186 for (i = 0; i < 5; i++) { 178 for (i = 0; i < 5; i++) {
187 if (do_lock) 179 /* serialize hCalls to work around firmware issue */
180 if (ehca_lock_hcalls)
188 spin_lock_irqsave(&hcall_lock, flags); 181 spin_lock_irqsave(&hcall_lock, flags);
189 182
190 ret = plpar_hcall9(opcode, outs, 183 ret = plpar_hcall9(opcode, outs,
191 arg1, arg2, arg3, arg4, arg5, 184 arg1, arg2, arg3, arg4, arg5,
192 arg6, arg7, arg8, arg9); 185 arg6, arg7, arg8, arg9);
193 186
194 if (do_lock) 187 if (ehca_lock_hcalls)
195 spin_unlock_irqrestore(&hcall_lock, flags); 188 spin_unlock_irqrestore(&hcall_lock, flags);
196 189
197 if (H_IS_LONG_BUSY(ret)) { 190 if (H_IS_LONG_BUSY(ret)) {
@@ -821,7 +814,7 @@ u64 hipz_h_free_resource_mr(const struct ipz_adapter_handle adapter_handle,
821 return ehca_plpar_hcall_norets(H_FREE_RESOURCE, 814 return ehca_plpar_hcall_norets(H_FREE_RESOURCE,
822 adapter_handle.handle, /* r4 */ 815 adapter_handle.handle, /* r4 */
823 mr->ipz_mr_handle.handle, /* r5 */ 816 mr->ipz_mr_handle.handle, /* r5 */
824 0, 0, 0, 0, 5); 817 0, 0, 0, 0, 0);
825} 818}
826 819
827u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle, 820u64 hipz_h_reregister_pmr(const struct ipz_adapter_handle adapter_handle,
diff --git a/drivers/infiniband/hw/ehca/hipz_hw.h b/drivers/infiniband/hw/ehca/hipz_hw.h
index 485b8400359e..bf996c7acc42 100644
--- a/drivers/infiniband/hw/ehca/hipz_hw.h
+++ b/drivers/infiniband/hw/ehca/hipz_hw.h
@@ -378,6 +378,7 @@ struct hipz_query_hca {
378#define HCA_CAP_UD_LL_QP EHCA_BMASK_IBM(16, 16) 378#define HCA_CAP_UD_LL_QP EHCA_BMASK_IBM(16, 16)
379#define HCA_CAP_RESIZE_MR EHCA_BMASK_IBM(17, 17) 379#define HCA_CAP_RESIZE_MR EHCA_BMASK_IBM(17, 17)
380#define HCA_CAP_MINI_QP EHCA_BMASK_IBM(18, 18) 380#define HCA_CAP_MINI_QP EHCA_BMASK_IBM(18, 18)
381#define HCA_CAP_H_ALLOC_RES_SYNC EHCA_BMASK_IBM(19, 19)
381 382
382/* query port response block */ 383/* query port response block */
383struct hipz_query_port { 384struct hipz_query_port {
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index dc741d3a4531..6123c70153d3 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -2336,6 +2336,7 @@ powerbook_sleep_3400(void)
2336 ret = pmac_suspend_devices(); 2336 ret = pmac_suspend_devices();
2337 if (ret) { 2337 if (ret) {
2338 pbook_free_pci_save(); 2338 pbook_free_pci_save();
2339 iounmap(mem_ctrl);
2339 printk(KERN_ERR "Sleep rejected by devices\n"); 2340 printk(KERN_ERR "Sleep rejected by devices\n");
2340 return ret; 2341 return ret;
2341 } 2342 }
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 9b6fbf044fd8..3fa7c77d9bd9 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -269,7 +269,7 @@ config DM_MULTIPATH_RDAC
269 269
270config DM_MULTIPATH_HP 270config DM_MULTIPATH_HP
271 tristate "HP MSA multipath support (EXPERIMENTAL)" 271 tristate "HP MSA multipath support (EXPERIMENTAL)"
272 depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL 272 depends on DM_MULTIPATH && BLK_DEV_DM && SCSI && EXPERIMENTAL
273 ---help--- 273 ---help---
274 Multipath support for HP MSA (Active/Passive) series hardware. 274 Multipath support for HP MSA (Active/Passive) series hardware.
275 275
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 28c6ae095c56..6b66ee46b87d 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -398,7 +398,8 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
398 struct bio *clone; 398 struct bio *clone;
399 unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 399 unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
400 gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM; 400 gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM;
401 unsigned int i; 401 unsigned i, len;
402 struct page *page;
402 403
403 clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, cc->bs); 404 clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, cc->bs);
404 if (!clone) 405 if (!clone)
@@ -407,10 +408,8 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
407 clone_init(io, clone); 408 clone_init(io, clone);
408 409
409 for (i = 0; i < nr_iovecs; i++) { 410 for (i = 0; i < nr_iovecs; i++) {
410 struct bio_vec *bv = bio_iovec_idx(clone, i); 411 page = mempool_alloc(cc->page_pool, gfp_mask);
411 412 if (!page)
412 bv->bv_page = mempool_alloc(cc->page_pool, gfp_mask);
413 if (!bv->bv_page)
414 break; 413 break;
415 414
416 /* 415 /*
@@ -421,15 +420,14 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
421 if (i == (MIN_BIO_PAGES - 1)) 420 if (i == (MIN_BIO_PAGES - 1))
422 gfp_mask = (gfp_mask | __GFP_NOWARN) & ~__GFP_WAIT; 421 gfp_mask = (gfp_mask | __GFP_NOWARN) & ~__GFP_WAIT;
423 422
424 bv->bv_offset = 0; 423 len = (size > PAGE_SIZE) ? PAGE_SIZE : size;
425 if (size > PAGE_SIZE) 424
426 bv->bv_len = PAGE_SIZE; 425 if (!bio_add_page(clone, page, len, 0)) {
427 else 426 mempool_free(page, cc->page_pool);
428 bv->bv_len = size; 427 break;
428 }
429 429
430 clone->bi_size += bv->bv_len; 430 size -= len;
431 clone->bi_vcnt++;
432 size -= bv->bv_len;
433 } 431 }
434 432
435 if (!clone->bi_size) { 433 if (!clone->bi_size) {
@@ -511,6 +509,9 @@ static void crypt_endio(struct bio *clone, int error)
511 struct crypt_config *cc = io->target->private; 509 struct crypt_config *cc = io->target->private;
512 unsigned read_io = bio_data_dir(clone) == READ; 510 unsigned read_io = bio_data_dir(clone) == READ;
513 511
512 if (unlikely(!bio_flagged(clone, BIO_UPTODATE) && !error))
513 error = -EIO;
514
514 /* 515 /*
515 * free the processed pages 516 * free the processed pages
516 */ 517 */
@@ -519,10 +520,8 @@ static void crypt_endio(struct bio *clone, int error)
519 goto out; 520 goto out;
520 } 521 }
521 522
522 if (unlikely(!bio_flagged(clone, BIO_UPTODATE))) { 523 if (unlikely(error))
523 error = -EIO;
524 goto out; 524 goto out;
525 }
526 525
527 bio_put(clone); 526 bio_put(clone);
528 kcryptd_queue_crypt(io); 527 kcryptd_queue_crypt(io);
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 138200bf5e0b..9627fa0f9470 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -332,6 +332,8 @@ static int dm_hash_rename(const char *old, const char *new)
332 dm_table_put(table); 332 dm_table_put(table);
333 } 333 }
334 334
335 dm_kobject_uevent(hc->md);
336
335 dm_put(hc->md); 337 dm_put(hc->md);
336 up_write(&_hash_lock); 338 up_write(&_hash_lock);
337 kfree(old_name); 339 kfree(old_name);
@@ -1250,21 +1252,17 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
1250 if (!table) 1252 if (!table)
1251 goto out_argv; 1253 goto out_argv;
1252 1254
1253 if (tmsg->sector >= dm_table_get_size(table)) { 1255 ti = dm_table_find_target(table, tmsg->sector);
1256 if (!dm_target_is_valid(ti)) {
1254 DMWARN("Target message sector outside device."); 1257 DMWARN("Target message sector outside device.");
1255 r = -EINVAL; 1258 r = -EINVAL;
1256 goto out_table; 1259 } else if (ti->type->message)
1257 }
1258
1259 ti = dm_table_find_target(table, tmsg->sector);
1260 if (ti->type->message)
1261 r = ti->type->message(ti, argc, argv); 1260 r = ti->type->message(ti, argc, argv);
1262 else { 1261 else {
1263 DMWARN("Target type does not support messages"); 1262 DMWARN("Target type does not support messages");
1264 r = -EINVAL; 1263 r = -EINVAL;
1265 } 1264 }
1266 1265
1267 out_table:
1268 dm_table_put(table); 1266 dm_table_put(table);
1269 out_argv: 1267 out_argv:
1270 kfree(argv); 1268 kfree(argv);
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index e298d8d11f24..47818d8249cb 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -99,6 +99,9 @@ static void combine_restrictions_low(struct io_restrictions *lhs,
99 lhs->max_segment_size = 99 lhs->max_segment_size =
100 min_not_zero(lhs->max_segment_size, rhs->max_segment_size); 100 min_not_zero(lhs->max_segment_size, rhs->max_segment_size);
101 101
102 lhs->max_hw_sectors =
103 min_not_zero(lhs->max_hw_sectors, rhs->max_hw_sectors);
104
102 lhs->seg_boundary_mask = 105 lhs->seg_boundary_mask =
103 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask); 106 min_not_zero(lhs->seg_boundary_mask, rhs->seg_boundary_mask);
104 107
@@ -189,8 +192,10 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
189 192
190 /* 193 /*
191 * Allocate both the target array and offset array at once. 194 * Allocate both the target array and offset array at once.
195 * Append an empty entry to catch sectors beyond the end of
196 * the device.
192 */ 197 */
193 n_highs = (sector_t *) dm_vcalloc(num, sizeof(struct dm_target) + 198 n_highs = (sector_t *) dm_vcalloc(num + 1, sizeof(struct dm_target) +
194 sizeof(sector_t)); 199 sizeof(sector_t));
195 if (!n_highs) 200 if (!n_highs)
196 return -ENOMEM; 201 return -ENOMEM;
@@ -564,6 +569,9 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
564 rs->max_segment_size = 569 rs->max_segment_size =
565 min_not_zero(rs->max_segment_size, q->max_segment_size); 570 min_not_zero(rs->max_segment_size, q->max_segment_size);
566 571
572 rs->max_hw_sectors =
573 min_not_zero(rs->max_hw_sectors, q->max_hw_sectors);
574
567 rs->seg_boundary_mask = 575 rs->seg_boundary_mask =
568 min_not_zero(rs->seg_boundary_mask, 576 min_not_zero(rs->seg_boundary_mask,
569 q->seg_boundary_mask); 577 q->seg_boundary_mask);
@@ -701,6 +709,8 @@ static void check_for_valid_limits(struct io_restrictions *rs)
701{ 709{
702 if (!rs->max_sectors) 710 if (!rs->max_sectors)
703 rs->max_sectors = SAFE_MAX_SECTORS; 711 rs->max_sectors = SAFE_MAX_SECTORS;
712 if (!rs->max_hw_sectors)
713 rs->max_hw_sectors = SAFE_MAX_SECTORS;
704 if (!rs->max_phys_segments) 714 if (!rs->max_phys_segments)
705 rs->max_phys_segments = MAX_PHYS_SEGMENTS; 715 rs->max_phys_segments = MAX_PHYS_SEGMENTS;
706 if (!rs->max_hw_segments) 716 if (!rs->max_hw_segments)
@@ -867,6 +877,9 @@ struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
867 877
868/* 878/*
869 * Search the btree for the correct target. 879 * Search the btree for the correct target.
880 *
881 * Caller should check returned pointer with dm_target_is_valid()
882 * to trap I/O beyond end of device.
870 */ 883 */
871struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector) 884struct dm_target *dm_table_find_target(struct dm_table *t, sector_t sector)
872{ 885{
@@ -896,6 +909,7 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q)
896 q->max_hw_segments = t->limits.max_hw_segments; 909 q->max_hw_segments = t->limits.max_hw_segments;
897 q->hardsect_size = t->limits.hardsect_size; 910 q->hardsect_size = t->limits.hardsect_size;
898 q->max_segment_size = t->limits.max_segment_size; 911 q->max_segment_size = t->limits.max_segment_size;
912 q->max_hw_sectors = t->limits.max_hw_sectors;
899 q->seg_boundary_mask = t->limits.seg_boundary_mask; 913 q->seg_boundary_mask = t->limits.seg_boundary_mask;
900 q->bounce_pfn = t->limits.bounce_pfn; 914 q->bounce_pfn = t->limits.bounce_pfn;
901 if (t->limits.no_cluster) 915 if (t->limits.no_cluster)
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 07cbbb8eb3e0..88c0fd657825 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -672,13 +672,19 @@ static struct bio *clone_bio(struct bio *bio, sector_t sector,
672 return clone; 672 return clone;
673} 673}
674 674
675static void __clone_and_map(struct clone_info *ci) 675static int __clone_and_map(struct clone_info *ci)
676{ 676{
677 struct bio *clone, *bio = ci->bio; 677 struct bio *clone, *bio = ci->bio;
678 struct dm_target *ti = dm_table_find_target(ci->map, ci->sector); 678 struct dm_target *ti;
679 sector_t len = 0, max = max_io_len(ci->md, ci->sector, ti); 679 sector_t len = 0, max;
680 struct dm_target_io *tio; 680 struct dm_target_io *tio;
681 681
682 ti = dm_table_find_target(ci->map, ci->sector);
683 if (!dm_target_is_valid(ti))
684 return -EIO;
685
686 max = max_io_len(ci->md, ci->sector, ti);
687
682 /* 688 /*
683 * Allocate a target io object. 689 * Allocate a target io object.
684 */ 690 */
@@ -736,6 +742,9 @@ static void __clone_and_map(struct clone_info *ci)
736 do { 742 do {
737 if (offset) { 743 if (offset) {
738 ti = dm_table_find_target(ci->map, ci->sector); 744 ti = dm_table_find_target(ci->map, ci->sector);
745 if (!dm_target_is_valid(ti))
746 return -EIO;
747
739 max = max_io_len(ci->md, ci->sector, ti); 748 max = max_io_len(ci->md, ci->sector, ti);
740 749
741 tio = alloc_tio(ci->md); 750 tio = alloc_tio(ci->md);
@@ -759,6 +768,8 @@ static void __clone_and_map(struct clone_info *ci)
759 768
760 ci->idx++; 769 ci->idx++;
761 } 770 }
771
772 return 0;
762} 773}
763 774
764/* 775/*
@@ -767,6 +778,7 @@ static void __clone_and_map(struct clone_info *ci)
767static int __split_bio(struct mapped_device *md, struct bio *bio) 778static int __split_bio(struct mapped_device *md, struct bio *bio)
768{ 779{
769 struct clone_info ci; 780 struct clone_info ci;
781 int error = 0;
770 782
771 ci.map = dm_get_table(md); 783 ci.map = dm_get_table(md);
772 if (unlikely(!ci.map)) 784 if (unlikely(!ci.map))
@@ -784,11 +796,11 @@ static int __split_bio(struct mapped_device *md, struct bio *bio)
784 ci.idx = bio->bi_idx; 796 ci.idx = bio->bi_idx;
785 797
786 start_io_acct(ci.io); 798 start_io_acct(ci.io);
787 while (ci.sector_count) 799 while (ci.sector_count && !error)
788 __clone_and_map(&ci); 800 error = __clone_and_map(&ci);
789 801
790 /* drop the extra reference count */ 802 /* drop the extra reference count */
791 dec_pending(ci.io, 0); 803 dec_pending(ci.io, error);
792 dm_table_put(ci.map); 804 dm_table_put(ci.map);
793 805
794 return 0; 806 return 0;
@@ -1502,7 +1514,7 @@ int dm_resume(struct mapped_device *md)
1502 1514
1503 dm_table_unplug_all(map); 1515 dm_table_unplug_all(map);
1504 1516
1505 kobject_uevent(&md->disk->kobj, KOBJ_CHANGE); 1517 dm_kobject_uevent(md);
1506 1518
1507 r = 0; 1519 r = 0;
1508 1520
@@ -1516,6 +1528,11 @@ out:
1516/*----------------------------------------------------------------- 1528/*-----------------------------------------------------------------
1517 * Event notification. 1529 * Event notification.
1518 *---------------------------------------------------------------*/ 1530 *---------------------------------------------------------------*/
1531void dm_kobject_uevent(struct mapped_device *md)
1532{
1533 kobject_uevent(&md->disk->kobj, KOBJ_CHANGE);
1534}
1535
1519uint32_t dm_next_uevent_seq(struct mapped_device *md) 1536uint32_t dm_next_uevent_seq(struct mapped_device *md)
1520{ 1537{
1521 return atomic_add_return(1, &md->uevent_seq); 1538 return atomic_add_return(1, &md->uevent_seq);
diff --git a/drivers/md/dm.h b/drivers/md/dm.h
index 4b3faa45277e..b4584a39383b 100644
--- a/drivers/md/dm.h
+++ b/drivers/md/dm.h
@@ -112,6 +112,11 @@ int dm_table_resume_targets(struct dm_table *t);
112int dm_table_any_congested(struct dm_table *t, int bdi_bits); 112int dm_table_any_congested(struct dm_table *t, int bdi_bits);
113void dm_table_unplug_all(struct dm_table *t); 113void dm_table_unplug_all(struct dm_table *t);
114 114
115/*
116 * To check the return value from dm_table_find_target().
117 */
118#define dm_target_is_valid(t) ((t)->table)
119
115/*----------------------------------------------------------------- 120/*-----------------------------------------------------------------
116 * A registry of target types. 121 * A registry of target types.
117 *---------------------------------------------------------------*/ 122 *---------------------------------------------------------------*/
@@ -182,4 +187,6 @@ union map_info *dm_get_mapinfo(struct bio *bio);
182int dm_open_count(struct mapped_device *md); 187int dm_open_count(struct mapped_device *md);
183int dm_lock_for_deletion(struct mapped_device *md); 188int dm_lock_for_deletion(struct mapped_device *md);
184 189
190void dm_kobject_uevent(struct mapped_device *md);
191
185#endif 192#endif
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index 8fa19939c2b6..8cf91353b56a 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5obj-y := common/ 5obj-y := common/
6obj-$(CONFIG_VIDEO_DEV) += video/ 6obj-y += video/
7obj-$(CONFIG_VIDEO_DEV) += radio/ 7obj-$(CONFIG_VIDEO_DEV) += radio/
8obj-$(CONFIG_DVB_CORE) += dvb/ 8obj-$(CONFIG_DVB_CORE) += dvb/
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index f245a3b2ef47..ae36d101006b 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -1205,13 +1205,10 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1205 DEB_D(("VIDIOCGMBUF \n")); 1205 DEB_D(("VIDIOCGMBUF \n"));
1206 1206
1207 q = &fh->video_q; 1207 q = &fh->video_q;
1208 mutex_lock(&q->lock);
1209 err = videobuf_mmap_setup(q,gbuffers,gbufsize, 1208 err = videobuf_mmap_setup(q,gbuffers,gbufsize,
1210 V4L2_MEMORY_MMAP); 1209 V4L2_MEMORY_MMAP);
1211 if (err < 0) { 1210 if (err < 0)
1212 mutex_unlock(&q->lock);
1213 return err; 1211 return err;
1214 }
1215 1212
1216 gbuffers = err; 1213 gbuffers = err;
1217 memset(mbuf,0,sizeof(*mbuf)); 1214 memset(mbuf,0,sizeof(*mbuf));
@@ -1219,7 +1216,6 @@ int saa7146_video_do_ioctl(struct inode *inode, struct file *file, unsigned int
1219 mbuf->size = gbuffers * gbufsize; 1216 mbuf->size = gbuffers * gbufsize;
1220 for (i = 0; i < gbuffers; i++) 1217 for (i = 0; i < gbuffers; i++)
1221 mbuf->offsets[i] = i * gbufsize; 1218 mbuf->offsets[i] = i * gbufsize;
1222 mutex_unlock(&q->lock);
1223 return 0; 1219 return 0;
1224 } 1220 }
1225#endif 1221#endif
@@ -1440,10 +1436,7 @@ static void video_close(struct saa7146_dev *dev, struct file *file)
1440 err = saa7146_stop_preview(fh); 1436 err = saa7146_stop_preview(fh);
1441 } 1437 }
1442 1438
1443 // release all capture buffers 1439 videobuf_stop(q);
1444 mutex_lock(&q->lock);
1445 videobuf_read_stop(q);
1446 mutex_unlock(&q->lock);
1447 1440
1448 /* hmm, why is this function declared void? */ 1441 /* hmm, why is this function declared void? */
1449 /* return err */ 1442 /* return err */
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 73ac0a93fdeb..60a910052c16 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -62,3 +62,6 @@ dvb-usb-af9005-remote-objs = af9005-remote.o
62obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o 62obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
63 63
64EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 64EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
65# due to tuner-xc3028
66EXTRA_CFLAGS += -Idrivers/media/video
67
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 9a184da01c47..8ee6cd4da9e7 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -223,6 +223,9 @@ static struct dibx000_agc_config dib3000p_panasonic_agc_config = {
223 .agc2_slope2 = 0x1e, 223 .agc2_slope2 = 0x1e,
224}; 224};
225 225
226#if defined(CONFIG_DVB_DIB3000MC) || \
227 (defined(CONFIG_DVB_DIB3000MC_MODULE) && defined(MODULE))
228
226static struct dib3000mc_config mod3000p_dib3000p_config = { 229static struct dib3000mc_config mod3000p_dib3000p_config = {
227 &dib3000p_panasonic_agc_config, 230 &dib3000p_panasonic_agc_config,
228 231
@@ -305,6 +308,7 @@ int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
305 return 0; 308 return 0;
306} 309}
307EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); 310EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach);
311#endif
308 312
309/* 313/*
310 * common remote control stuff 314 * common remote control stuff
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
index 8dee7ec9456a..562d9208857a 100644
--- a/drivers/media/dvb/frontends/s5h1409.c
+++ b/drivers/media/dvb/frontends/s5h1409.c
@@ -107,7 +107,7 @@ static struct vsb_snr_tab {
107 u16 val; 107 u16 val;
108 u16 data; 108 u16 data;
109} vsb_snr_tab[] = { 109} vsb_snr_tab[] = {
110 { 1023, 770, }, 110 { 924, 300, },
111 { 923, 300, }, 111 { 923, 300, },
112 { 918, 295, }, 112 { 918, 295, },
113 { 915, 290, }, 113 { 915, 290, },
@@ -154,6 +154,7 @@ static struct qam64_snr_tab {
154 u16 val; 154 u16 val;
155 u16 data; 155 u16 data;
156} qam64_snr_tab[] = { 156} qam64_snr_tab[] = {
157 { 1, 0, },
157 { 12, 300, }, 158 { 12, 300, },
158 { 15, 290, }, 159 { 15, 290, },
159 { 18, 280, }, 160 { 18, 280, },
@@ -217,6 +218,7 @@ static struct qam64_snr_tab {
217 { 95, 202, }, 218 { 95, 202, },
218 { 96, 201, }, 219 { 96, 201, },
219 { 104, 200, }, 220 { 104, 200, },
221 { 255, 0, },
220}; 222};
221 223
222/* QAM256 SNR lookup table */ 224/* QAM256 SNR lookup table */
@@ -224,6 +226,7 @@ static struct qam256_snr_tab {
224 u16 val; 226 u16 val;
225 u16 data; 227 u16 data;
226} qam256_snr_tab[] = { 228} qam256_snr_tab[] = {
229 { 1, 0, },
227 { 12, 400, }, 230 { 12, 400, },
228 { 13, 390, }, 231 { 13, 390, },
229 { 15, 380, }, 232 { 15, 380, },
@@ -292,6 +295,7 @@ static struct qam256_snr_tab {
292 { 105, 262, }, 295 { 105, 262, },
293 { 106, 261, }, 296 { 106, 261, },
294 { 110, 260, }, 297 { 110, 260, },
298 { 255, 0, },
295}; 299};
296 300
297/* 8 bit registers, 16 bit values */ 301/* 8 bit registers, 16 bit values */
@@ -670,14 +674,15 @@ static int s5h1409_read_snr(struct dvb_frontend* fe, u16* snr)
670 u16 reg; 674 u16 reg;
671 dprintk("%s()\n", __FUNCTION__); 675 dprintk("%s()\n", __FUNCTION__);
672 676
673 reg = s5h1409_readreg(state, 0xf1) & 0x1ff;
674
675 switch(state->current_modulation) { 677 switch(state->current_modulation) {
676 case QAM_64: 678 case QAM_64:
679 reg = s5h1409_readreg(state, 0xf0) & 0xff;
677 return s5h1409_qam64_lookup_snr(fe, snr, reg); 680 return s5h1409_qam64_lookup_snr(fe, snr, reg);
678 case QAM_256: 681 case QAM_256:
682 reg = s5h1409_readreg(state, 0xf0) & 0xff;
679 return s5h1409_qam256_lookup_snr(fe, snr, reg); 683 return s5h1409_qam256_lookup_snr(fe, snr, reg);
680 case VSB_8: 684 case VSB_8:
685 reg = s5h1409_readreg(state, 0xf1) & 0x3ff;
681 return s5h1409_vsb_lookup_snr(fe, snr, reg); 686 return s5h1409_vsb_lookup_snr(fe, snr, reg);
682 default: 687 default:
683 break; 688 break;
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c
index 9a8ddc537f8f..9d26ace65151 100644
--- a/drivers/media/dvb/frontends/tda10086.c
+++ b/drivers/media/dvb/frontends/tda10086.c
@@ -158,7 +158,7 @@ static int tda10086_init(struct dvb_frontend* fe)
158 tda10086_write_byte(state, 0x3d, 0x80); 158 tda10086_write_byte(state, 0x3d, 0x80);
159 159
160 // setup SEC 160 // setup SEC
161 tda10086_write_byte(state, 0x36, 0x00); // all SEC off 161 tda10086_write_byte(state, 0x36, 0x80); // all SEC off, no 22k tone
162 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency 162 tda10086_write_byte(state, 0x34, (((1<<19) * (22000/1000)) / (SACLK/1000))); // } tone frequency
163 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // } 163 tda10086_write_byte(state, 0x35, (((1<<19) * (22000/1000)) / (SACLK/1000)) >> 8); // }
164 164
@@ -183,13 +183,13 @@ static int tda10086_set_tone (struct dvb_frontend* fe, fe_sec_tone_mode_t tone)
183 183
184 dprintk ("%s\n", __FUNCTION__); 184 dprintk ("%s\n", __FUNCTION__);
185 185
186 switch(tone) { 186 switch (tone) {
187 case SEC_TONE_OFF: 187 case SEC_TONE_OFF:
188 tda10086_write_byte(state, 0x36, 0x00); 188 tda10086_write_byte(state, 0x36, 0x80);
189 break; 189 break;
190 190
191 case SEC_TONE_ON: 191 case SEC_TONE_ON:
192 tda10086_write_byte(state, 0x36, 0x01); 192 tda10086_write_byte(state, 0x36, 0x81);
193 break; 193 break;
194 } 194 }
195 195
@@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe,
212 for(i=0; i< cmd->msg_len; i++) { 212 for(i=0; i< cmd->msg_len; i++) {
213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]); 213 tda10086_write_byte(state, 0x48+i, cmd->msg[i]);
214 } 214 }
215 tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4)); 215 tda10086_write_byte(state, 0x36, 0x88 | ((cmd->msg_len - 1) << 4));
216 216
217 tda10086_diseqc_wait(state); 217 tda10086_diseqc_wait(state);
218 218
@@ -230,11 +230,11 @@ static int tda10086_send_burst (struct dvb_frontend* fe, fe_sec_mini_cmd_t minic
230 230
231 switch(minicmd) { 231 switch(minicmd) {
232 case SEC_MINI_A: 232 case SEC_MINI_A:
233 tda10086_write_byte(state, 0x36, 0x04); 233 tda10086_write_byte(state, 0x36, 0x84);
234 break; 234 break;
235 235
236 case SEC_MINI_B: 236 case SEC_MINI_B:
237 tda10086_write_byte(state, 0x36, 0x06); 237 tda10086_write_byte(state, 0x36, 0x86);
238 break; 238 break;
239 } 239 }
240 240
diff --git a/drivers/media/dvb/frontends/zl10353.c b/drivers/media/dvb/frontends/zl10353.c
index a97a7fd2c891..0106df4c55e8 100644
--- a/drivers/media/dvb/frontends/zl10353.c
+++ b/drivers/media/dvb/frontends/zl10353.c
@@ -122,7 +122,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
122 enum fe_bandwidth bandwidth, 122 enum fe_bandwidth bandwidth,
123 u16 *nominal_rate) 123 u16 *nominal_rate)
124{ 124{
125 u32 adc_clock = 22528; /* 20.480 MHz on the board(!?) */ 125 u32 adc_clock = 45056; /* 45.056 MHz */
126 u8 bw; 126 u8 bw;
127 struct zl10353_state *state = fe->demodulator_priv; 127 struct zl10353_state *state = fe->demodulator_priv;
128 128
@@ -142,7 +142,7 @@ static void zl10353_calc_nominal_rate(struct dvb_frontend *fe,
142 break; 142 break;
143 } 143 }
144 144
145 *nominal_rate = (64 * bw * (1<<16) / (7 * 8) * 4000 / adc_clock + 2) / 4; 145 *nominal_rate = (bw * (1 << 23) / 7 * 125 + adc_clock / 2) / adc_clock;
146 146
147 dprintk("%s: bw %d, adc_clock %d => 0x%x\n", 147 dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
148 __FUNCTION__, bw, adc_clock, *nominal_rate); 148 __FUNCTION__, bw, adc_clock, *nominal_rate);
diff --git a/drivers/media/dvb/frontends/zl10353.h b/drivers/media/dvb/frontends/zl10353.h
index cb274dc12b82..1c3d494a6da9 100644
--- a/drivers/media/dvb/frontends/zl10353.h
+++ b/drivers/media/dvb/frontends/zl10353.h
@@ -30,7 +30,7 @@ struct zl10353_config
30 u8 demod_address; 30 u8 demod_address;
31 31
32 /* frequencies in kHz */ 32 /* frequencies in kHz */
33 int adc_clock; // default: 22528 33 int adc_clock; /* default: 45056 */
34 34
35 /* set if no pll is connected to the secondary i2c bus */ 35 /* set if no pll is connected to the secondary i2c bus */
36 int no_tuner; 36 int no_tuner;
diff --git a/drivers/media/video/bt866.c b/drivers/media/video/bt866.c
index b767b098d14b..96b415576f0d 100644
--- a/drivers/media/video/bt866.c
+++ b/drivers/media/video/bt866.c
@@ -300,7 +300,6 @@ static struct i2c_client bt866_client_tmpl =
300 .addr = 0, 300 .addr = 0,
301 .adapter = NULL, 301 .adapter = NULL,
302 .driver = &i2c_driver_bt866, 302 .driver = &i2c_driver_bt866,
303 .usage_count = 0
304}; 303};
305 304
306static int bt866_found_proc(struct i2c_adapter *adapter, 305static int bt866_found_proc(struct i2c_adapter *adapter,
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 3abd9fa54d2c..585d1ef95afd 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -5080,7 +5080,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
5080/* ----------------------------------------------------------------------- */ 5080/* ----------------------------------------------------------------------- */
5081/* motherboard chipset specific stuff */ 5081/* motherboard chipset specific stuff */
5082 5082
5083void __devinit bttv_check_chipset(void) 5083void __init bttv_check_chipset(void)
5084{ 5084{
5085 int pcipci_fail = 0; 5085 int pcipci_fail = 0;
5086 struct pci_dev *dev = NULL; 5086 struct pci_dev *dev = NULL;
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a88b56e6ca05..c02d92deacd2 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3827,10 +3827,7 @@ static int bttv_release(struct inode *inode, struct file *file)
3827 3827
3828 /* stop vbi capture */ 3828 /* stop vbi capture */
3829 if (check_btres(fh, RESOURCE_VBI)) { 3829 if (check_btres(fh, RESOURCE_VBI)) {
3830 if (fh->vbi.streaming) 3830 videobuf_stop(&fh->vbi);
3831 videobuf_streamoff(&fh->vbi);
3832 if (fh->vbi.reading)
3833 videobuf_read_stop(&fh->vbi);
3834 free_btres(btv,fh,RESOURCE_VBI); 3831 free_btres(btv,fh,RESOURCE_VBI);
3835 } 3832 }
3836 3833
@@ -4988,7 +4985,7 @@ static struct pci_driver bttv_pci_driver = {
4988#endif 4985#endif
4989}; 4986};
4990 4987
4991static int bttv_init_module(void) 4988static int __init bttv_init_module(void)
4992{ 4989{
4993 int ret; 4990 int ret;
4994 4991
@@ -5021,7 +5018,7 @@ static int bttv_init_module(void)
5021 return pci_register_driver(&bttv_pci_driver); 5018 return pci_register_driver(&bttv_pci_driver);
5022} 5019}
5023 5020
5024static void bttv_cleanup_module(void) 5021static void __exit bttv_cleanup_module(void)
5025{ 5022{
5026 pci_unregister_driver(&bttv_pci_driver); 5023 pci_unregister_driver(&bttv_pci_driver);
5027 bus_unregister(&bttv_sub_bus_type); 5024 bus_unregister(&bttv_sub_bus_type);
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index f33f0b47142c..f802b5653569 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1085,10 +1085,7 @@ static int mpeg_release(struct inode *inode, struct file *file)
1085 1085
1086 cx8802_cancel_buffers(fh->dev); 1086 cx8802_cancel_buffers(fh->dev);
1087 /* stop mpeg capture */ 1087 /* stop mpeg capture */
1088 if (fh->mpegq.streaming) 1088 videobuf_stop(&fh->mpegq);
1089 videobuf_streamoff(&fh->mpegq);
1090 if (fh->mpegq.reading)
1091 videobuf_read_stop(&fh->mpegq);
1092 1089
1093 videobuf_mmap_free(&fh->mpegq); 1090 videobuf_mmap_free(&fh->mpegq);
1094 file->private_data = NULL; 1091 file->private_data = NULL;
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 5ee05f8f3fad..c84dafbdb991 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -851,10 +851,7 @@ static int video_release(struct inode *inode, struct file *file)
851 851
852 /* stop vbi capture */ 852 /* stop vbi capture */
853 if (res_check(fh, RESOURCE_VBI)) { 853 if (res_check(fh, RESOURCE_VBI)) {
854 if (fh->vbiq.streaming) 854 videobuf_stop(&fh->vbiq);
855 videobuf_streamoff(&fh->vbiq);
856 if (fh->vbiq.reading)
857 videobuf_read_stop(&fh->vbiq);
858 res_free(dev,fh,RESOURCE_VBI); 855 res_free(dev,fh,RESOURCE_VBI);
859 } 856 }
860 857
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 2529c298b862..0906bc5766cc 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -144,7 +144,8 @@ static int em28xx_config(struct em28xx *dev)
144{ 144{
145 145
146 /* Sets I2C speed to 100 KHz */ 146 /* Sets I2C speed to 100 KHz */
147 em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); 147 if (!dev->is_em2800)
148 em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
148 149
149 /* enable vbi capturing */ 150 /* enable vbi capturing */
150 151
@@ -570,7 +571,9 @@ static void em28xx_vm_close(struct vm_area_struct *vma)
570{ 571{
571 /* NOTE: buffers are not freed here */ 572 /* NOTE: buffers are not freed here */
572 struct em28xx_frame_t *f = vma->vm_private_data; 573 struct em28xx_frame_t *f = vma->vm_private_data;
573 f->vma_use_count--; 574
575 if (f->vma_use_count)
576 f->vma_use_count--;
574} 577}
575 578
576static struct vm_operations_struct em28xx_vm_ops = { 579static struct vm_operations_struct em28xx_vm_ops = {
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 623eea2652ca..77b27dc750b1 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -706,7 +706,7 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg)
706} 706}
707 707
708/* init + register i2c algo-bit adapter */ 708/* init + register i2c algo-bit adapter */
709int __devinit init_ivtv_i2c(struct ivtv *itv) 709int init_ivtv_i2c(struct ivtv *itv)
710{ 710{
711 IVTV_DEBUG_I2C("i2c init\n"); 711 IVTV_DEBUG_I2C("i2c init\n");
712 712
diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h
index de6a07442298..987042c09b64 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.h
+++ b/drivers/media/video/ivtv/ivtv-i2c.h
@@ -35,7 +35,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg
35void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg); 35void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg);
36 36
37/* init + register i2c algo-bit adapter */ 37/* init + register i2c algo-bit adapter */
38int __devinit init_ivtv_i2c(struct ivtv *itv); 38int init_ivtv_i2c(struct ivtv *itv);
39void exit_ivtv_i2c(struct ivtv *itv); 39void exit_ivtv_i2c(struct ivtv *itv);
40 40
41#endif 41#endif
diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c
index aa03e61ef310..74fb0e021979 100644
--- a/drivers/media/video/ivtv/ivtv-streams.c
+++ b/drivers/media/video/ivtv/ivtv-streams.c
@@ -76,7 +76,7 @@ static struct {
76 int minor_offset; 76 int minor_offset;
77 int dma, pio; 77 int dma, pio;
78 enum v4l2_buf_type buf_type; 78 enum v4l2_buf_type buf_type;
79 struct file_operations *fops; 79 const struct file_operations *fops;
80} ivtv_stream_info[] = { 80} ivtv_stream_info[] = {
81 { /* IVTV_ENC_STREAM_TYPE_MPG */ 81 { /* IVTV_ENC_STREAM_TYPE_MPG */
82 "encoder MPG", 82 "encoder MPG",
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index ad0232935df6..996b49491f5a 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -187,12 +187,14 @@ static int i2c_senddata(struct saa5246a_device *t, ...)
187{ 187{
188 unsigned char buf[64]; 188 unsigned char buf[64];
189 int v; 189 int v;
190 int ct=0; 190 int ct = 0;
191 va_list argp; 191 va_list argp;
192 va_start(argp,t); 192 va_start(argp, t);
193 193
194 while((v=va_arg(argp,int))!=-1) 194 while ((v = va_arg(argp, int)) != -1)
195 buf[ct++]=v; 195 buf[ct++] = v;
196
197 va_end(argp);
196 return i2c_sendbuf(t, buf[0], ct-1, buf+1); 198 return i2c_sendbuf(t, buf[0], ct-1, buf+1);
197} 199}
198 200
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 94bb59a32b17..f55d6e85f20f 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -282,12 +282,14 @@ static int i2c_senddata(struct saa5249_device *t, ...)
282{ 282{
283 unsigned char buf[64]; 283 unsigned char buf[64];
284 int v; 284 int v;
285 int ct=0; 285 int ct = 0;
286 va_list argp; 286 va_list argp;
287 va_start(argp,t); 287 va_start(argp,t);
288 288
289 while((v=va_arg(argp,int))!=-1) 289 while ((v = va_arg(argp, int)) != -1)
290 buf[ct++]=v; 290 buf[ct++] = v;
291
292 va_end(argp);
291 return i2c_sendbuf(t, buf[0], ct-1, buf+1); 293 return i2c_sendbuf(t, buf[0], ct-1, buf+1);
292} 294}
293 295
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index b9c5cf7dc849..4878f3067787 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -222,7 +222,8 @@ static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id)
222 222
223 if (report & SAA7134_IRQ_REPORT_DONE_RA3) { 223 if (report & SAA7134_IRQ_REPORT_DONE_RA3) {
224 handled = 1; 224 handled = 1;
225 saa_writel(SAA7134_IRQ_REPORT,report); 225 saa_writel(SAA7134_IRQ_REPORT,
226 SAA7134_IRQ_REPORT_DONE_RA3);
226 saa7134_irq_alsa_done(dev, status); 227 saa7134_irq_alsa_done(dev, status);
227 } else { 228 } else {
228 goto out; 229 goto out;
@@ -457,7 +458,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture =
457 .buffer_bytes_max = (256*1024), 458 .buffer_bytes_max = (256*1024),
458 .period_bytes_min = 64, 459 .period_bytes_min = 64,
459 .period_bytes_max = (256*1024), 460 .period_bytes_max = (256*1024),
460 .periods_min = 2, 461 .periods_min = 4,
461 .periods_max = 1024, 462 .periods_max = 1024,
462}; 463};
463 464
@@ -491,7 +492,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
491 492
492 snd_assert(period_size >= 0x100 && period_size <= 0x10000, 493 snd_assert(period_size >= 0x100 && period_size <= 0x10000,
493 return -EINVAL); 494 return -EINVAL);
494 snd_assert(periods >= 2, return -EINVAL); 495 snd_assert(periods >= 4, return -EINVAL);
495 snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); 496 snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL);
496 497
497 dev = saa7134->dev; 498 dev = saa7134->dev;
@@ -647,7 +648,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
647 saa7134_tvaudio_setmute(dev); 648 saa7134_tvaudio_setmute(dev);
648 } 649 }
649 650
650 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 651 err = snd_pcm_hw_constraint_integer(runtime,
652 SNDRV_PCM_HW_PARAM_PERIODS);
653 if (err < 0)
654 return err;
655
656 err = snd_pcm_hw_constraint_step(runtime, 0,
657 SNDRV_PCM_HW_PARAM_PERIODS, 2);
658 if (err < 0)
651 return err; 659 return err;
652 660
653 return 0; 661 return 0;
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 4f3dad9ae6d6..98c1b084a716 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -334,7 +334,7 @@ struct saa7134_board saa7134_boards[] = {
334 .tv = 1, 334 .tv = 1,
335 },{ 335 },{
336 .name = name_comp1, 336 .name = name_comp1,
337 .vmux = 2, 337 .vmux = 0,
338 .amux = LINE1, 338 .amux = LINE1,
339 },{ 339 },{
340 .name = name_comp2, 340 .name = name_comp2,
@@ -3221,6 +3221,7 @@ struct saa7134_board saa7134_boards[] = {
3221 .radio_type = UNSET, 3221 .radio_type = UNSET,
3222 .tuner_addr = ADDR_UNSET, 3222 .tuner_addr = ADDR_UNSET,
3223 .radio_addr = ADDR_UNSET, 3223 .radio_addr = ADDR_UNSET,
3224 .tuner_config = 1,
3224 .mpeg = SAA7134_MPEG_DVB, 3225 .mpeg = SAA7134_MPEG_DVB,
3225 .inputs = {{ 3226 .inputs = {{
3226 .name = name_tv, 3227 .name = name_tv,
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index a499eea379e6..4fd187ac9d70 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -569,21 +569,22 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id)
569 for (loop = 0; loop < 10; loop++) { 569 for (loop = 0; loop < 10; loop++) {
570 report = saa_readl(SAA7134_IRQ_REPORT); 570 report = saa_readl(SAA7134_IRQ_REPORT);
571 status = saa_readl(SAA7134_IRQ_STATUS); 571 status = saa_readl(SAA7134_IRQ_STATUS);
572 if (0 == report) {
573 if (irq_debug > 1)
574 printk(KERN_DEBUG "%s/irq: no (more) work\n",
575 dev->name);
576 goto out;
577 }
578
579 /* If dmasound support is active and we get a sound report, exit
580 and let the saa7134-alsa/oss module deal with it */
581 572
573 /* If dmasound support is active and we get a sound report,
574 * mask out the report and let the saa7134-alsa module deal
575 * with it */
582 if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && 576 if ((report & SAA7134_IRQ_REPORT_DONE_RA3) &&
583 (dev->dmasound.priv_data != NULL) ) 577 (dev->dmasound.priv_data != NULL) )
584 { 578 {
585 if (irq_debug > 1) 579 if (irq_debug > 1)
586 printk(KERN_DEBUG "%s/irq: ignoring interrupt for DMA sound\n", 580 printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n",
581 dev->name);
582 report &= ~SAA7134_IRQ_REPORT_DONE_RA3;
583 }
584
585 if (0 == report) {
586 if (irq_debug > 1)
587 printk(KERN_DEBUG "%s/irq: no (more) work\n",
587 dev->name); 588 dev->name);
588 goto out; 589 goto out;
589 } 590 }
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 38d87332cc5d..e1ab099ec4c6 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -662,6 +662,7 @@ static struct tda1004x_config hauppauge_hvr_1110_config = {
662 .if_freq = TDA10046_FREQ_045, 662 .if_freq = TDA10046_FREQ_045,
663 .i2c_gate = 0x4b, 663 .i2c_gate = 0x4b,
664 .tuner_address = 0x61, 664 .tuner_address = 0x61,
665 .tuner_config = 1,
665 .request_firmware = philips_tda1004x_request_firmware 666 .request_firmware = philips_tda1004x_request_firmware
666}; 667};
667 668
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c
index 75d0c5bf46d2..9322f44865b8 100644
--- a/drivers/media/video/saa7134/saa7134-empress.c
+++ b/drivers/media/video/saa7134/saa7134-empress.c
@@ -110,11 +110,8 @@ static int ts_release(struct inode *inode, struct file *file)
110{ 110{
111 struct saa7134_dev *dev = file->private_data; 111 struct saa7134_dev *dev = file->private_data;
112 112
113 if (dev->empress_tsq.streaming)
114 videobuf_streamoff(&dev->empress_tsq);
115 mutex_lock(&dev->empress_tsq.lock); 113 mutex_lock(&dev->empress_tsq.lock);
116 if (dev->empress_tsq.reading) 114 videobuf_stop(&dev->empress_tsq);
117 videobuf_read_stop(&dev->empress_tsq);
118 videobuf_mmap_free(&dev->empress_tsq); 115 videobuf_mmap_free(&dev->empress_tsq);
119 dev->empress_users--; 116 dev->empress_users--;
120 117
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 3b9ffb4b648a..6396d9b5c063 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1445,10 +1445,7 @@ static int video_release(struct inode *inode, struct file *file)
1445 1445
1446 /* stop vbi capture */ 1446 /* stop vbi capture */
1447 if (res_check(fh, RESOURCE_VBI)) { 1447 if (res_check(fh, RESOURCE_VBI)) {
1448 if (fh->vbi.streaming) 1448 videobuf_stop(&fh->vbi);
1449 videobuf_streamoff(&fh->vbi);
1450 if (fh->vbi.reading)
1451 videobuf_read_stop(&fh->vbi);
1452 res_free(dev,fh,RESOURCE_VBI); 1449 res_free(dev,fh,RESOURCE_VBI);
1453 } 1450 }
1454 1451
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 25d0aef88ef5..445eba4174d7 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -290,6 +290,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
290 int opmode=0; 290 int opmode=0;
291 struct tvp5150 *decoder = i2c_get_clientdata(c); 291 struct tvp5150 *decoder = i2c_get_clientdata(c);
292 int input = 0; 292 int input = 0;
293 unsigned char val;
293 294
294 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) 295 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
295 input = 8; 296 input = 8;
@@ -315,6 +316,16 @@ static inline void tvp5150_selmux(struct i2c_client *c)
315 316
316 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); 317 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
317 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); 318 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
319
320 /* Svideo should enable YCrCb output and disable GPCL output
321 * For Composite and TV, it should be the reverse
322 */
323 val = tvp5150_read(c, TVP5150_MISC_CTL);
324 if (decoder->route.input == TVP5150_SVIDEO)
325 val = (val & ~0x40) | 0x10;
326 else
327 val = (val & ~0x10) | 0x40;
328 tvp5150_write(c, TVP5150_MISC_CTL, val);
318}; 329};
319 330
320struct i2c_reg_value { 331struct i2c_reg_value {
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c
index 89a44f16f0ba..c8a5cb57963b 100644
--- a/drivers/media/video/videobuf-core.c
+++ b/drivers/media/video/videobuf-core.c
@@ -141,6 +141,7 @@ void videobuf_queue_core_init(struct videobuf_queue* q,
141 INIT_LIST_HEAD(&q->stream); 141 INIT_LIST_HEAD(&q->stream);
142} 142}
143 143
144/* Locking: Only usage in bttv unsafe find way to remove */
144int videobuf_queue_is_busy(struct videobuf_queue *q) 145int videobuf_queue_is_busy(struct videobuf_queue *q)
145{ 146{
146 int i; 147 int i;
@@ -178,6 +179,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q)
178 return 0; 179 return 0;
179} 180}
180 181
182/* Locking: Caller holds q->lock */
181void videobuf_queue_cancel(struct videobuf_queue *q) 183void videobuf_queue_cancel(struct videobuf_queue *q)
182{ 184{
183 unsigned long flags=0; 185 unsigned long flags=0;
@@ -208,6 +210,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q)
208 210
209/* --------------------------------------------------------------------- */ 211/* --------------------------------------------------------------------- */
210 212
213/* Locking: Caller holds q->lock */
211enum v4l2_field videobuf_next_field(struct videobuf_queue *q) 214enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
212{ 215{
213 enum v4l2_field field = q->field; 216 enum v4l2_field field = q->field;
@@ -226,6 +229,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q)
226 return field; 229 return field;
227} 230}
228 231
232/* Locking: Caller holds q->lock */
229static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, 233static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
230 struct videobuf_buffer *vb, enum v4l2_buf_type type) 234 struct videobuf_buffer *vb, enum v4l2_buf_type type)
231{ 235{
@@ -281,20 +285,108 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
281 b->sequence = vb->field_count >> 1; 285 b->sequence = vb->field_count >> 1;
282} 286}
283 287
288/* Locking: Caller holds q->lock */
289static int __videobuf_mmap_free(struct videobuf_queue *q)
290{
291 int i;
292 int rc;
293
294 if (!q)
295 return 0;
296
297 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
298
299 rc = CALL(q,mmap_free,q);
300 if (rc<0)
301 return rc;
302
303 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
304 if (NULL == q->bufs[i])
305 continue;
306 q->ops->buf_release(q,q->bufs[i]);
307 kfree(q->bufs[i]);
308 q->bufs[i] = NULL;
309 }
310
311 return rc;
312}
313
314int videobuf_mmap_free(struct videobuf_queue *q)
315{
316 int ret;
317 mutex_lock(&q->lock);
318 ret = __videobuf_mmap_free(q);
319 mutex_unlock(&q->lock);
320 return ret;
321}
322
323/* Locking: Caller holds q->lock */
324static int __videobuf_mmap_setup(struct videobuf_queue *q,
325 unsigned int bcount, unsigned int bsize,
326 enum v4l2_memory memory)
327{
328 unsigned int i;
329 int err;
330
331 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
332
333 err = __videobuf_mmap_free(q);
334 if (0 != err)
335 return err;
336
337 /* Allocate and initialize buffers */
338 for (i = 0; i < bcount; i++) {
339 q->bufs[i] = videobuf_alloc(q);
340
341 if (q->bufs[i] == NULL)
342 break;
343
344 q->bufs[i]->i = i;
345 q->bufs[i]->input = UNSET;
346 q->bufs[i]->memory = memory;
347 q->bufs[i]->bsize = bsize;
348 switch (memory) {
349 case V4L2_MEMORY_MMAP:
350 q->bufs[i]->boff = bsize * i;
351 break;
352 case V4L2_MEMORY_USERPTR:
353 case V4L2_MEMORY_OVERLAY:
354 /* nothing */
355 break;
356 }
357 }
358
359 if (!i)
360 return -ENOMEM;
361
362 dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
363 i, bsize);
364
365 return i;
366}
367
368int videobuf_mmap_setup(struct videobuf_queue *q,
369 unsigned int bcount, unsigned int bsize,
370 enum v4l2_memory memory)
371{
372 int ret;
373 mutex_lock(&q->lock);
374 ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
375 mutex_unlock(&q->lock);
376 return ret;
377}
378
284int videobuf_reqbufs(struct videobuf_queue *q, 379int videobuf_reqbufs(struct videobuf_queue *q,
285 struct v4l2_requestbuffers *req) 380 struct v4l2_requestbuffers *req)
286{ 381{
287 unsigned int size,count; 382 unsigned int size,count;
288 int retval; 383 int retval;
289 384
290 if (req->type != q->type) {
291 dprintk(1,"reqbufs: queue type invalid\n");
292 return -EINVAL;
293 }
294 if (req->count < 1) { 385 if (req->count < 1) {
295 dprintk(1,"reqbufs: count invalid (%d)\n",req->count); 386 dprintk(1,"reqbufs: count invalid (%d)\n",req->count);
296 return -EINVAL; 387 return -EINVAL;
297 } 388 }
389
298 if (req->memory != V4L2_MEMORY_MMAP && 390 if (req->memory != V4L2_MEMORY_MMAP &&
299 req->memory != V4L2_MEMORY_USERPTR && 391 req->memory != V4L2_MEMORY_USERPTR &&
300 req->memory != V4L2_MEMORY_OVERLAY) { 392 req->memory != V4L2_MEMORY_OVERLAY) {
@@ -303,6 +395,12 @@ int videobuf_reqbufs(struct videobuf_queue *q,
303 } 395 }
304 396
305 mutex_lock(&q->lock); 397 mutex_lock(&q->lock);
398 if (req->type != q->type) {
399 dprintk(1,"reqbufs: queue type invalid\n");
400 retval = -EINVAL;
401 goto done;
402 }
403
306 if (q->streaming) { 404 if (q->streaming) {
307 dprintk(1,"reqbufs: streaming already exists\n"); 405 dprintk(1,"reqbufs: streaming already exists\n");
308 retval = -EBUSY; 406 retval = -EBUSY;
@@ -323,7 +421,7 @@ int videobuf_reqbufs(struct videobuf_queue *q,
323 dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", 421 dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n",
324 count, size, (count*size)>>PAGE_SHIFT); 422 count, size, (count*size)>>PAGE_SHIFT);
325 423
326 retval = videobuf_mmap_setup(q,count,size,req->memory); 424 retval = __videobuf_mmap_setup(q,count,size,req->memory);
327 if (retval < 0) { 425 if (retval < 0) {
328 dprintk(1,"reqbufs: mmap setup returned %d\n",retval); 426 dprintk(1,"reqbufs: mmap setup returned %d\n",retval);
329 goto done; 427 goto done;
@@ -338,20 +436,28 @@ int videobuf_reqbufs(struct videobuf_queue *q,
338 436
339int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) 437int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b)
340{ 438{
439 int ret = -EINVAL;
440
441 mutex_lock(&q->lock);
341 if (unlikely(b->type != q->type)) { 442 if (unlikely(b->type != q->type)) {
342 dprintk(1,"querybuf: Wrong type.\n"); 443 dprintk(1,"querybuf: Wrong type.\n");
343 return -EINVAL; 444 goto done;
344 } 445 }
345 if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { 446 if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) {
346 dprintk(1,"querybuf: index out of range.\n"); 447 dprintk(1,"querybuf: index out of range.\n");
347 return -EINVAL; 448 goto done;
348 } 449 }
349 if (unlikely(NULL == q->bufs[b->index])) { 450 if (unlikely(NULL == q->bufs[b->index])) {
350 dprintk(1,"querybuf: buffer is null.\n"); 451 dprintk(1,"querybuf: buffer is null.\n");
351 return -EINVAL; 452 goto done;
352 } 453 }
454
353 videobuf_status(q,b,q->bufs[b->index],q->type); 455 videobuf_status(q,b,q->bufs[b->index],q->type);
354 return 0; 456
457 ret = 0;
458done:
459 mutex_unlock(&q->lock);
460 return ret;
355} 461}
356 462
357int videobuf_qbuf(struct videobuf_queue *q, 463int videobuf_qbuf(struct videobuf_queue *q,
@@ -541,22 +647,30 @@ int videobuf_streamon(struct videobuf_queue *q)
541 return retval; 647 return retval;
542} 648}
543 649
544int videobuf_streamoff(struct videobuf_queue *q) 650/* Locking: Caller holds q->lock */
651static int __videobuf_streamoff(struct videobuf_queue *q)
545{ 652{
546 int retval = -EINVAL;
547
548 mutex_lock(&q->lock);
549 if (!q->streaming) 653 if (!q->streaming)
550 goto done; 654 return -EINVAL;
655
551 videobuf_queue_cancel(q); 656 videobuf_queue_cancel(q);
552 q->streaming = 0; 657 q->streaming = 0;
553 retval = 0;
554 658
555 done: 659 return 0;
660}
661
662int videobuf_streamoff(struct videobuf_queue *q)
663{
664 int retval;
665
666 mutex_lock(&q->lock);
667 retval = __videobuf_streamoff(q);
556 mutex_unlock(&q->lock); 668 mutex_unlock(&q->lock);
669
557 return retval; 670 return retval;
558} 671}
559 672
673/* Locking: Caller holds q->lock */
560static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, 674static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q,
561 char __user *data, 675 char __user *data,
562 size_t count, loff_t *ppos) 676 size_t count, loff_t *ppos)
@@ -691,7 +805,8 @@ ssize_t videobuf_read_one(struct videobuf_queue *q,
691 return retval; 805 return retval;
692} 806}
693 807
694int videobuf_read_start(struct videobuf_queue *q) 808/* Locking: Caller holds q->lock */
809int __videobuf_read_start(struct videobuf_queue *q)
695{ 810{
696 enum v4l2_field field; 811 enum v4l2_field field;
697 unsigned long flags=0; 812 unsigned long flags=0;
@@ -705,7 +820,7 @@ int videobuf_read_start(struct videobuf_queue *q)
705 count = VIDEO_MAX_FRAME; 820 count = VIDEO_MAX_FRAME;
706 size = PAGE_ALIGN(size); 821 size = PAGE_ALIGN(size);
707 822
708 err = videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR); 823 err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR);
709 if (err < 0) 824 if (err < 0)
710 return err; 825 return err;
711 826
@@ -728,12 +843,13 @@ int videobuf_read_start(struct videobuf_queue *q)
728 return 0; 843 return 0;
729} 844}
730 845
731void videobuf_read_stop(struct videobuf_queue *q) 846static void __videobuf_read_stop(struct videobuf_queue *q)
732{ 847{
733 int i; 848 int i;
734 849
850
735 videobuf_queue_cancel(q); 851 videobuf_queue_cancel(q);
736 videobuf_mmap_free(q); 852 __videobuf_mmap_free(q);
737 INIT_LIST_HEAD(&q->stream); 853 INIT_LIST_HEAD(&q->stream);
738 for (i = 0; i < VIDEO_MAX_FRAME; i++) { 854 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
739 if (NULL == q->bufs[i]) 855 if (NULL == q->bufs[i])
@@ -743,8 +859,41 @@ void videobuf_read_stop(struct videobuf_queue *q)
743 } 859 }
744 q->read_buf = NULL; 860 q->read_buf = NULL;
745 q->reading = 0; 861 q->reading = 0;
862
746} 863}
747 864
865int videobuf_read_start(struct videobuf_queue *q)
866{
867 int rc;
868
869 mutex_lock(&q->lock);
870 rc = __videobuf_read_start(q);
871 mutex_unlock(&q->lock);
872
873 return rc;
874}
875
876void videobuf_read_stop(struct videobuf_queue *q)
877{
878 mutex_lock(&q->lock);
879 __videobuf_read_stop(q);
880 mutex_unlock(&q->lock);
881}
882
883void videobuf_stop(struct videobuf_queue *q)
884{
885 mutex_lock(&q->lock);
886
887 if (q->streaming)
888 __videobuf_streamoff(q);
889
890 if (q->reading)
891 __videobuf_read_stop(q);
892
893 mutex_unlock(&q->lock);
894}
895
896
748ssize_t videobuf_read_stream(struct videobuf_queue *q, 897ssize_t videobuf_read_stream(struct videobuf_queue *q,
749 char __user *data, size_t count, loff_t *ppos, 898 char __user *data, size_t count, loff_t *ppos,
750 int vbihack, int nonblocking) 899 int vbihack, int nonblocking)
@@ -760,7 +909,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q,
760 if (q->streaming) 909 if (q->streaming)
761 goto done; 910 goto done;
762 if (!q->reading) { 911 if (!q->reading) {
763 retval = videobuf_read_start(q); 912 retval = __videobuf_read_start(q);
764 if (retval < 0) 913 if (retval < 0)
765 goto done; 914 goto done;
766 } 915 }
@@ -833,7 +982,7 @@ unsigned int videobuf_poll_stream(struct file *file,
833 struct videobuf_buffer, stream); 982 struct videobuf_buffer, stream);
834 } else { 983 } else {
835 if (!q->reading) 984 if (!q->reading)
836 videobuf_read_start(q); 985 __videobuf_read_start(q);
837 if (!q->reading) { 986 if (!q->reading) {
838 rc = POLLERR; 987 rc = POLLERR;
839 } else if (NULL == q->read_buf) { 988 } else if (NULL == q->read_buf) {
@@ -858,75 +1007,6 @@ unsigned int videobuf_poll_stream(struct file *file,
858 return rc; 1007 return rc;
859} 1008}
860 1009
861int videobuf_mmap_setup(struct videobuf_queue *q,
862 unsigned int bcount, unsigned int bsize,
863 enum v4l2_memory memory)
864{
865 unsigned int i;
866 int err;
867
868 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
869
870 err = videobuf_mmap_free(q);
871 if (0 != err)
872 return err;
873
874 /* Allocate and initialize buffers */
875 for (i = 0; i < bcount; i++) {
876 q->bufs[i] = videobuf_alloc(q);
877
878 if (q->bufs[i] == NULL)
879 break;
880
881 q->bufs[i]->i = i;
882 q->bufs[i]->input = UNSET;
883 q->bufs[i]->memory = memory;
884 q->bufs[i]->bsize = bsize;
885 switch (memory) {
886 case V4L2_MEMORY_MMAP:
887 q->bufs[i]->boff = bsize * i;
888 break;
889 case V4L2_MEMORY_USERPTR:
890 case V4L2_MEMORY_OVERLAY:
891 /* nothing */
892 break;
893 }
894 }
895
896 if (!i)
897 return -ENOMEM;
898
899 dprintk(1,"mmap setup: %d buffers, %d bytes each\n",
900 i, bsize);
901
902 return i;
903}
904
905int videobuf_mmap_free(struct videobuf_queue *q)
906{
907 int i;
908 int rc;
909
910 if (!q)
911 return 0;
912
913 MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS);
914
915 rc = CALL(q,mmap_free,q);
916 if (rc<0)
917 return rc;
918
919 for (i = 0; i < VIDEO_MAX_FRAME; i++) {
920 if (NULL == q->bufs[i])
921 continue;
922 q->ops->buf_release(q,q->bufs[i]);
923 kfree(q->bufs[i]);
924 q->bufs[i] = NULL;
925 }
926
927 return rc;
928}
929
930int videobuf_mmap_mapper(struct videobuf_queue *q, 1010int videobuf_mmap_mapper(struct videobuf_queue *q,
931 struct vm_area_struct *vma) 1011 struct vm_area_struct *vma)
932{ 1012{
@@ -991,6 +1071,7 @@ EXPORT_SYMBOL_GPL(videobuf_streamoff);
991 1071
992EXPORT_SYMBOL_GPL(videobuf_read_start); 1072EXPORT_SYMBOL_GPL(videobuf_read_start);
993EXPORT_SYMBOL_GPL(videobuf_read_stop); 1073EXPORT_SYMBOL_GPL(videobuf_read_stop);
1074EXPORT_SYMBOL_GPL(videobuf_stop);
994EXPORT_SYMBOL_GPL(videobuf_read_stream); 1075EXPORT_SYMBOL_GPL(videobuf_read_stream);
995EXPORT_SYMBOL_GPL(videobuf_read_one); 1076EXPORT_SYMBOL_GPL(videobuf_read_one);
996EXPORT_SYMBOL_GPL(videobuf_poll_stream); 1077EXPORT_SYMBOL_GPL(videobuf_poll_stream);
diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c
index cd74341c984f..e01259438bb2 100644
--- a/drivers/media/video/videobuf-vmalloc.c
+++ b/drivers/media/video/videobuf-vmalloc.c
@@ -51,7 +51,7 @@ videobuf_vm_open(struct vm_area_struct *vma)
51{ 51{
52 struct videobuf_mapping *map = vma->vm_private_data; 52 struct videobuf_mapping *map = vma->vm_private_data;
53 53
54 dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map, 54 dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map,
55 map->count,vma->vm_start,vma->vm_end); 55 map->count,vma->vm_start,vma->vm_end);
56 56
57 map->count++; 57 map->count++;
@@ -64,7 +64,7 @@ videobuf_vm_close(struct vm_area_struct *vma)
64 struct videobuf_queue *q = map->q; 64 struct videobuf_queue *q = map->q;
65 int i; 65 int i;
66 66
67 dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, 67 dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map,
68 map->count,vma->vm_start,vma->vm_end); 68 map->count,vma->vm_start,vma->vm_end);
69 69
70 map->count--; 70 map->count--;
@@ -221,7 +221,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
221 } 221 }
222 222
223 /* create mapping + update buffer list */ 223 /* create mapping + update buffer list */
224 map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); 224 map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL);
225 if (NULL == map) 225 if (NULL == map)
226 return -ENOMEM; 226 return -ENOMEM;
227 227
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index ee73dc75131c..9b54ff9d2e36 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -1076,6 +1076,7 @@ static int vivi_release(struct inode *inode, struct file *file)
1076 int minor = iminor(inode); 1076 int minor = iminor(inode);
1077 1077
1078 vivi_stop_thread(vidq); 1078 vivi_stop_thread(vidq);
1079 videobuf_stop(&fh->vb_vidq);
1079 videobuf_mmap_free(&fh->vb_vidq); 1080 videobuf_mmap_free(&fh->vb_vidq);
1080 1081
1081 kfree (fh); 1082 kfree (fh);
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index ab23a3221585..cf56647a6ca4 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -987,9 +987,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
987 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ 987 KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */
988 KEY_UNKNOWN, /* 0x0D: FN+INSERT */ 988 KEY_UNKNOWN, /* 0x0D: FN+INSERT */
989 KEY_UNKNOWN, /* 0x0E: FN+DELETE */ 989 KEY_UNKNOWN, /* 0x0E: FN+DELETE */
990 KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ 990 KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */
991 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ 991 /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */
992 KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ 992 KEY_RESERVED, /* 0x10: FN+END (brightness down) */
993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ 993 KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */
994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ 994 KEY_UNKNOWN, /* 0x12: FN+PGDOWN */
995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ 995 KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ff59d2e0475b..785bbdcf4a58 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -7,6 +7,10 @@
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at 8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version. 9 * your option) any later version.
10 *
11 * Thanks to the following companies for their support:
12 *
13 * - JMicron (hardware and technical support)
10 */ 14 */
11 15
12#include <linux/delay.h> 16#include <linux/delay.h>
@@ -26,13 +30,29 @@
26 30
27static unsigned int debug_quirks = 0; 31static unsigned int debug_quirks = 0;
28 32
33/*
34 * Different quirks to handle when the hardware deviates from a strict
35 * interpretation of the SDHCI specification.
36 */
37
38/* Controller doesn't honor resets unless we touch the clock register */
29#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0) 39#define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1<<0)
40/* Controller has bad caps bits, but really supports DMA */
30#define SDHCI_QUIRK_FORCE_DMA (1<<1) 41#define SDHCI_QUIRK_FORCE_DMA (1<<1)
31/* Controller doesn't like some resets when there is no card inserted. */ 42/* Controller doesn't like some resets when there is no card inserted. */
32#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2) 43#define SDHCI_QUIRK_NO_CARD_NO_RESET (1<<2)
44/* Controller doesn't like clearing the power reg before a change */
33#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3) 45#define SDHCI_QUIRK_SINGLE_POWER_WRITE (1<<3)
46/* Controller has flaky internal state so reset it on each ios change */
34#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) 47#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4)
48/* Controller has an unusable DMA engine */
35#define SDHCI_QUIRK_BROKEN_DMA (1<<5) 49#define SDHCI_QUIRK_BROKEN_DMA (1<<5)
50/* Controller can only DMA from 32-bit aligned addresses */
51#define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<6)
52/* Controller can only DMA chunk sizes that are a multiple of 32 bits */
53#define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<7)
54/* Controller needs to be reset after each request to stay stable */
55#define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<8)
36 56
37static const struct pci_device_id pci_ids[] __devinitdata = { 57static const struct pci_device_id pci_ids[] __devinitdata = {
38 { 58 {
@@ -97,6 +117,16 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
97 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS, 117 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
98 }, 118 },
99 119
120 {
121 .vendor = PCI_VENDOR_ID_JMICRON,
122 .device = PCI_DEVICE_ID_JMICRON_JMB38X_SD,
123 .subvendor = PCI_ANY_ID,
124 .subdevice = PCI_ANY_ID,
125 .driver_data = SDHCI_QUIRK_32BIT_DMA_ADDR |
126 SDHCI_QUIRK_32BIT_DMA_SIZE |
127 SDHCI_QUIRK_RESET_AFTER_REQUEST,
128 },
129
100 { /* Generic SD host controller */ 130 { /* Generic SD host controller */
101 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00) 131 PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
102 }, 132 },
@@ -419,7 +449,29 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
419 449
420 writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL); 450 writeb(count, host->ioaddr + SDHCI_TIMEOUT_CONTROL);
421 451
422 if (host->flags & SDHCI_USE_DMA) { 452 if (host->flags & SDHCI_USE_DMA)
453 host->flags |= SDHCI_REQ_USE_DMA;
454
455 if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
456 (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_SIZE) &&
457 ((data->blksz * data->blocks) & 0x3))) {
458 DBG("Reverting to PIO because of transfer size (%d)\n",
459 data->blksz * data->blocks);
460 host->flags &= ~SDHCI_REQ_USE_DMA;
461 }
462
463 /*
464 * The assumption here being that alignment is the same after
465 * translation to device address space.
466 */
467 if (unlikely((host->flags & SDHCI_REQ_USE_DMA) &&
468 (host->chip->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) &&
469 (data->sg->offset & 0x3))) {
470 DBG("Reverting to PIO because of bad alignment\n");
471 host->flags &= ~SDHCI_REQ_USE_DMA;
472 }
473
474 if (host->flags & SDHCI_REQ_USE_DMA) {
423 int count; 475 int count;
424 476
425 count = pci_map_sg(host->chip->pdev, data->sg, data->sg_len, 477 count = pci_map_sg(host->chip->pdev, data->sg, data->sg_len,
@@ -456,7 +508,7 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
456 mode |= SDHCI_TRNS_MULTI; 508 mode |= SDHCI_TRNS_MULTI;
457 if (data->flags & MMC_DATA_READ) 509 if (data->flags & MMC_DATA_READ)
458 mode |= SDHCI_TRNS_READ; 510 mode |= SDHCI_TRNS_READ;
459 if (host->flags & SDHCI_USE_DMA) 511 if (host->flags & SDHCI_REQ_USE_DMA)
460 mode |= SDHCI_TRNS_DMA; 512 mode |= SDHCI_TRNS_DMA;
461 513
462 writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE); 514 writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
@@ -472,7 +524,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
472 data = host->data; 524 data = host->data;
473 host->data = NULL; 525 host->data = NULL;
474 526
475 if (host->flags & SDHCI_USE_DMA) { 527 if (host->flags & SDHCI_REQ_USE_DMA) {
476 pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len, 528 pci_unmap_sg(host->chip->pdev, data->sg, data->sg_len,
477 (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE); 529 (data->flags & MMC_DATA_READ)?PCI_DMA_FROMDEVICE:PCI_DMA_TODEVICE);
478 } 530 }
@@ -886,7 +938,8 @@ static void sdhci_tasklet_finish(unsigned long param)
886 */ 938 */
887 if (mrq->cmd->error || 939 if (mrq->cmd->error ||
888 (mrq->data && (mrq->data->error || 940 (mrq->data && (mrq->data->error ||
889 (mrq->data->stop && mrq->data->stop->error)))) { 941 (mrq->data->stop && mrq->data->stop->error))) ||
942 (host->chip->quirks & SDHCI_QUIRK_RESET_AFTER_REQUEST)) {
890 943
891 /* Some controllers need this kick or reset won't work here */ 944 /* Some controllers need this kick or reset won't work here */
892 if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) { 945 if (host->chip->quirks & SDHCI_QUIRK_CLOCK_BEFORE_RESET) {
@@ -1284,7 +1337,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1284 1337
1285 version = readw(host->ioaddr + SDHCI_HOST_VERSION); 1338 version = readw(host->ioaddr + SDHCI_HOST_VERSION);
1286 version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; 1339 version = (version & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
1287 if (version != 0) { 1340 if (version > 1) {
1288 printk(KERN_ERR "%s: Unknown controller version (%d). " 1341 printk(KERN_ERR "%s: Unknown controller version (%d). "
1289 "You may experience problems.\n", host->slot_descr, 1342 "You may experience problems.\n", host->slot_descr,
1290 version); 1343 version);
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 05195ea900f4..e4d77b038bfa 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -171,7 +171,8 @@ struct sdhci_host {
171 spinlock_t lock; /* Mutex */ 171 spinlock_t lock; /* Mutex */
172 172
173 int flags; /* Host attributes */ 173 int flags; /* Host attributes */
174#define SDHCI_USE_DMA (1<<0) 174#define SDHCI_USE_DMA (1<<0) /* Host is DMA capable */
175#define SDHCI_REQ_USE_DMA (1<<1) /* Use DMA for this req. */
175 176
176 unsigned int max_clk; /* Max possible freq (MHz) */ 177 unsigned int max_clk; /* Max possible freq (MHz) */
177 unsigned int timeout_clk; /* Timeout freq (KHz) */ 178 unsigned int timeout_clk; /* Timeout freq (KHz) */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6cde4edc846b..d9107e542dfa 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2588,7 +2588,6 @@ config MLX4_DEBUG
2588config TEHUTI 2588config TEHUTI
2589 tristate "Tehuti Networks 10G Ethernet" 2589 tristate "Tehuti Networks 10G Ethernet"
2590 depends on PCI 2590 depends on PCI
2591 select ZLIB_INFLATE
2592 help 2591 help
2593 Tehuti Networks 10G Ethernet NIC 2592 Tehuti Networks 10G Ethernet NIC
2594 2593
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index da767d3d5af5..4e7b46e44874 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -56,8 +56,8 @@
56 56
57#define DRV_MODULE_NAME "bnx2" 57#define DRV_MODULE_NAME "bnx2"
58#define PFX DRV_MODULE_NAME ": " 58#define PFX DRV_MODULE_NAME ": "
59#define DRV_MODULE_VERSION "1.6.8" 59#define DRV_MODULE_VERSION "1.6.9"
60#define DRV_MODULE_RELDATE "October 17, 2007" 60#define DRV_MODULE_RELDATE "December 8, 2007"
61 61
62#define RUN_AT(x) (jiffies + (x)) 62#define RUN_AT(x) (jiffies + (x))
63 63
@@ -2387,18 +2387,24 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct sk_buff *skb,
2387 prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo; 2387 prod_bd->rx_bd_haddr_lo = cons_bd->rx_bd_haddr_lo;
2388} 2388}
2389 2389
2390static inline u16
2391bnx2_get_hw_rx_cons(struct bnx2 *bp)
2392{
2393 u16 cons = bp->status_blk->status_rx_quick_consumer_index0;
2394
2395 if (unlikely((cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT))
2396 cons++;
2397 return cons;
2398}
2399
2390static int 2400static int
2391bnx2_rx_int(struct bnx2 *bp, int budget) 2401bnx2_rx_int(struct bnx2 *bp, int budget)
2392{ 2402{
2393 struct status_block *sblk = bp->status_blk;
2394 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; 2403 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
2395 struct l2_fhdr *rx_hdr; 2404 struct l2_fhdr *rx_hdr;
2396 int rx_pkt = 0; 2405 int rx_pkt = 0;
2397 2406
2398 hw_cons = bp->hw_rx_cons = sblk->status_rx_quick_consumer_index0; 2407 hw_cons = bnx2_get_hw_rx_cons(bp);
2399 if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT) {
2400 hw_cons++;
2401 }
2402 sw_cons = bp->rx_cons; 2408 sw_cons = bp->rx_cons;
2403 sw_prod = bp->rx_prod; 2409 sw_prod = bp->rx_prod;
2404 2410
@@ -2515,10 +2521,7 @@ next_rx:
2515 2521
2516 /* Refresh hw_cons to see if there is new work */ 2522 /* Refresh hw_cons to see if there is new work */
2517 if (sw_cons == hw_cons) { 2523 if (sw_cons == hw_cons) {
2518 hw_cons = bp->hw_rx_cons = 2524 hw_cons = bnx2_get_hw_rx_cons(bp);
2519 sblk->status_rx_quick_consumer_index0;
2520 if ((hw_cons & MAX_RX_DESC_CNT) == MAX_RX_DESC_CNT)
2521 hw_cons++;
2522 rmb(); 2525 rmb();
2523 } 2526 }
2524 } 2527 }
@@ -2622,7 +2625,7 @@ bnx2_has_work(struct bnx2 *bp)
2622{ 2625{
2623 struct status_block *sblk = bp->status_blk; 2626 struct status_block *sblk = bp->status_blk;
2624 2627
2625 if ((sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) || 2628 if ((bnx2_get_hw_rx_cons(bp) != bp->rx_cons) ||
2626 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) 2629 (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons))
2627 return 1; 2630 return 1;
2628 2631
@@ -2655,7 +2658,7 @@ static int bnx2_poll_work(struct bnx2 *bp, int work_done, int budget)
2655 if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons) 2658 if (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)
2656 bnx2_tx_int(bp); 2659 bnx2_tx_int(bp);
2657 2660
2658 if (sblk->status_rx_quick_consumer_index0 != bp->hw_rx_cons) 2661 if (bnx2_get_hw_rx_cons(bp) != bp->rx_cons)
2659 work_done += bnx2_rx_int(bp, budget - work_done); 2662 work_done += bnx2_rx_int(bp, budget - work_done);
2660 2663
2661 return work_done; 2664 return work_done;
@@ -4177,7 +4180,6 @@ bnx2_init_rx_ring(struct bnx2 *bp)
4177 4180
4178 ring_prod = prod = bp->rx_prod = 0; 4181 ring_prod = prod = bp->rx_prod = 0;
4179 bp->rx_cons = 0; 4182 bp->rx_cons = 0;
4180 bp->hw_rx_cons = 0;
4181 bp->rx_prod_bseq = 0; 4183 bp->rx_prod_bseq = 0;
4182 4184
4183 for (i = 0; i < bp->rx_max_ring; i++) { 4185 for (i = 0; i < bp->rx_max_ring; i++) {
@@ -6685,8 +6687,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6685 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 || 6687 } else if (CHIP_NUM(bp) == CHIP_NUM_5706 ||
6686 CHIP_NUM(bp) == CHIP_NUM_5708) 6688 CHIP_NUM(bp) == CHIP_NUM_5708)
6687 bp->phy_flags |= PHY_CRC_FIX_FLAG; 6689 bp->phy_flags |= PHY_CRC_FIX_FLAG;
6688 else if (CHIP_ID(bp) == CHIP_ID_5709_A0 || 6690 else if (CHIP_NUM(bp) == CHIP_NUM_5709 &&
6689 CHIP_ID(bp) == CHIP_ID_5709_A1) 6691 (CHIP_REV(bp) == CHIP_REV_Ax ||
6692 CHIP_REV(bp) == CHIP_REV_Bx))
6690 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG; 6693 bp->phy_flags |= PHY_DIS_EARLY_DAC_FLAG;
6691 6694
6692 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || 6695 if ((CHIP_ID(bp) == CHIP_ID_5708_A0) ||
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index 1dce0d1a2581..30ba366608b0 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6513,7 +6513,6 @@ struct bnx2 {
6513 u32 rx_prod_bseq; 6513 u32 rx_prod_bseq;
6514 u16 rx_prod; 6514 u16 rx_prod;
6515 u16 rx_cons; 6515 u16 rx_cons;
6516 u16 hw_rx_cons;
6517 6516
6518 u32 rx_csum; 6517 u32 rx_csum;
6519 6518
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 5066beb2e7bc..47cce9cad30f 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;
@@ -1762,7 +1765,7 @@ rio_close (struct net_device *dev)
1762 skb = np->rx_skbuff[i]; 1765 skb = np->rx_skbuff[i];
1763 if (skb) { 1766 if (skb) {
1764 pci_unmap_single(np->pdev, 1767 pci_unmap_single(np->pdev,
1765 np->rx_ring[i].fraginfo & DMA_48BIT_MASK, 1768 desc_to_dma(&np->rx_ring[i]),
1766 skb->len, PCI_DMA_FROMDEVICE); 1769 skb->len, PCI_DMA_FROMDEVICE);
1767 dev_kfree_skb (skb); 1770 dev_kfree_skb (skb);
1768 np->rx_skbuff[i] = NULL; 1771 np->rx_skbuff[i] = NULL;
@@ -1772,7 +1775,7 @@ rio_close (struct net_device *dev)
1772 skb = np->tx_skbuff[i]; 1775 skb = np->tx_skbuff[i];
1773 if (skb) { 1776 if (skb) {
1774 pci_unmap_single(np->pdev, 1777 pci_unmap_single(np->pdev,
1775 np->tx_ring[i].fraginfo & DMA_48BIT_MASK, 1778 desc_to_dma(&np->tx_ring[i]),
1776 skb->len, PCI_DMA_TODEVICE); 1779 skb->len, PCI_DMA_TODEVICE);
1777 dev_kfree_skb (skb); 1780 dev_kfree_skb (skb);
1778 np->tx_skbuff[i] = NULL; 1781 np->tx_skbuff[i] = NULL;
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 5b801775f42d..014b77ce96df 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -633,9 +633,9 @@ struct mii_data {
633 633
634/* The Rx and Tx buffer descriptors. */ 634/* The Rx and Tx buffer descriptors. */
635struct netdev_desc { 635struct netdev_desc {
636 u64 next_desc; 636 __le64 next_desc;
637 u64 status; 637 __le64 status;
638 u64 fraginfo; 638 __le64 fraginfo;
639}; 639};
640 640
641#define PRIV_ALIGN 15 /* Required alignment mask */ 641#define PRIV_ALIGN 15 /* Required alignment mask */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index e1c8a0d023ea..2b06e4b4dabc 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2737,8 +2737,9 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2737 pci_enable_wake(pdev, PCI_D3cold, 0); 2737 pci_enable_wake(pdev, PCI_D3cold, 0);
2738 } 2738 }
2739 2739
2740 pci_disable_device(pdev);
2741 free_irq(pdev->irq, netdev); 2740 free_irq(pdev->irq, netdev);
2741
2742 pci_disable_device(pdev);
2742 pci_set_power_state(pdev, PCI_D3hot); 2743 pci_set_power_state(pdev, PCI_D3hot);
2743 2744
2744 return 0; 2745 return 0;
@@ -2780,6 +2781,8 @@ static void e100_shutdown(struct pci_dev *pdev)
2780 pci_enable_wake(pdev, PCI_D3cold, 0); 2781 pci_enable_wake(pdev, PCI_D3cold, 0);
2781 } 2782 }
2782 2783
2784 free_irq(pdev->irq, netdev);
2785
2783 pci_disable_device(pdev); 2786 pci_disable_device(pdev);
2784 pci_set_power_state(pdev, PCI_D3hot); 2787 pci_set_power_state(pdev, PCI_D3hot);
2785} 2788}
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/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index 03134f47a4eb..48f2f3005935 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -158,7 +158,7 @@ static int setup_data(struct net_device *dev)
158{ 158{
159 struct fs_enet_private *fep = netdev_priv(dev); 159 struct fs_enet_private *fep = netdev_priv(dev);
160 160
161#ifdef CONFIG_PPC_CPM_NEW_BINDING 161#ifndef CONFIG_PPC_CPM_NEW_BINDING
162 struct fs_platform_info *fpi = fep->fpi; 162 struct fs_platform_info *fpi = fep->fpi;
163 163
164 fep->scc.idx = fs_get_scc_index(fpi->fs_no); 164 fep->scc.idx = fs_get_scc_index(fpi->fs_no);
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index ed407c85708f..b53f6b6491b3 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -204,8 +204,10 @@ KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>
204/* Condensed bus+endian portability operations. */ 204/* Condensed bus+endian portability operations. */
205#if ADDRLEN == 64 205#if ADDRLEN == 64
206#define cpu_to_leXX(addr) cpu_to_le64(addr) 206#define cpu_to_leXX(addr) cpu_to_le64(addr)
207#define leXX_to_cpu(addr) le64_to_cpu(addr)
207#else 208#else
208#define cpu_to_leXX(addr) cpu_to_le32(addr) 209#define cpu_to_leXX(addr) cpu_to_le32(addr)
210#define leXX_to_cpu(addr) le32_to_cpu(addr)
209#endif 211#endif
210 212
211 213
@@ -465,12 +467,12 @@ enum intr_status_bits {
465 467
466/* The Hamachi Rx and Tx buffer descriptors. */ 468/* The Hamachi Rx and Tx buffer descriptors. */
467struct hamachi_desc { 469struct hamachi_desc {
468 u32 status_n_length; 470 __le32 status_n_length;
469#if ADDRLEN == 64 471#if ADDRLEN == 64
470 u32 pad; 472 u32 pad;
471 u64 addr; 473 __le64 addr;
472#else 474#else
473 u32 addr; 475 __le32 addr;
474#endif 476#endif
475}; 477};
476 478
@@ -874,13 +876,13 @@ static int hamachi_open(struct net_device *dev)
874 876
875#if ADDRLEN == 64 877#if ADDRLEN == 64
876 /* writellll anyone ? */ 878 /* writellll anyone ? */
877 writel(cpu_to_le64(hmp->rx_ring_dma), ioaddr + RxPtr); 879 writel(hmp->rx_ring_dma, ioaddr + RxPtr);
878 writel(cpu_to_le64(hmp->rx_ring_dma) >> 32, ioaddr + RxPtr + 4); 880 writel(hmp->rx_ring_dma >> 32, ioaddr + RxPtr + 4);
879 writel(cpu_to_le64(hmp->tx_ring_dma), ioaddr + TxPtr); 881 writel(hmp->tx_ring_dma, ioaddr + TxPtr);
880 writel(cpu_to_le64(hmp->tx_ring_dma) >> 32, ioaddr + TxPtr + 4); 882 writel(hmp->tx_ring_dma >> 32, ioaddr + TxPtr + 4);
881#else 883#else
882 writel(cpu_to_le32(hmp->rx_ring_dma), ioaddr + RxPtr); 884 writel(hmp->rx_ring_dma, ioaddr + RxPtr);
883 writel(cpu_to_le32(hmp->tx_ring_dma), ioaddr + TxPtr); 885 writel(hmp->tx_ring_dma, ioaddr + TxPtr);
884#endif 886#endif
885 887
886 /* TODO: It would make sense to organize this as words since the card 888 /* TODO: It would make sense to organize this as words since the card
@@ -1019,8 +1021,8 @@ static inline int hamachi_tx(struct net_device *dev)
1019 skb = hmp->tx_skbuff[entry]; 1021 skb = hmp->tx_skbuff[entry];
1020 if (skb) { 1022 if (skb) {
1021 pci_unmap_single(hmp->pci_dev, 1023 pci_unmap_single(hmp->pci_dev,
1022 hmp->tx_ring[entry].addr, skb->len, 1024 leXX_to_cpu(hmp->tx_ring[entry].addr),
1023 PCI_DMA_TODEVICE); 1025 skb->len, PCI_DMA_TODEVICE);
1024 dev_kfree_skb(skb); 1026 dev_kfree_skb(skb);
1025 hmp->tx_skbuff[entry] = NULL; 1027 hmp->tx_skbuff[entry] = NULL;
1026 } 1028 }
@@ -1071,10 +1073,10 @@ static void hamachi_tx_timeout(struct net_device *dev)
1071 { 1073 {
1072 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); 1074 printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring);
1073 for (i = 0; i < RX_RING_SIZE; i++) 1075 for (i = 0; i < RX_RING_SIZE; i++)
1074 printk(" %8.8x", (unsigned int)hmp->rx_ring[i].status_n_length); 1076 printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length));
1075 printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); 1077 printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring);
1076 for (i = 0; i < TX_RING_SIZE; i++) 1078 for (i = 0; i < TX_RING_SIZE; i++)
1077 printk(" %4.4x", hmp->tx_ring[i].status_n_length); 1079 printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length));
1078 printk("\n"); 1080 printk("\n");
1079 } 1081 }
1080 1082
@@ -1099,14 +1101,15 @@ static void hamachi_tx_timeout(struct net_device *dev)
1099 struct sk_buff *skb; 1101 struct sk_buff *skb;
1100 1102
1101 if (i >= TX_RING_SIZE - 1) 1103 if (i >= TX_RING_SIZE - 1)
1102 hmp->tx_ring[i].status_n_length = cpu_to_le32( 1104 hmp->tx_ring[i].status_n_length =
1103 DescEndRing | 1105 cpu_to_le32(DescEndRing) |
1104 (hmp->tx_ring[i].status_n_length & 0x0000FFFF)); 1106 (hmp->tx_ring[i].status_n_length &
1107 cpu_to_le32(0x0000ffff));
1105 else 1108 else
1106 hmp->tx_ring[i].status_n_length &= 0x0000ffff; 1109 hmp->tx_ring[i].status_n_length &= cpu_to_le32(0x0000ffff);
1107 skb = hmp->tx_skbuff[i]; 1110 skb = hmp->tx_skbuff[i];
1108 if (skb){ 1111 if (skb){
1109 pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr, 1112 pci_unmap_single(hmp->pci_dev, leXX_to_cpu(hmp->tx_ring[i].addr),
1110 skb->len, PCI_DMA_TODEVICE); 1113 skb->len, PCI_DMA_TODEVICE);
1111 dev_kfree_skb(skb); 1114 dev_kfree_skb(skb);
1112 hmp->tx_skbuff[i] = NULL; 1115 hmp->tx_skbuff[i] = NULL;
@@ -1128,7 +1131,8 @@ static void hamachi_tx_timeout(struct net_device *dev)
1128 struct sk_buff *skb = hmp->rx_skbuff[i]; 1131 struct sk_buff *skb = hmp->rx_skbuff[i];
1129 1132
1130 if (skb){ 1133 if (skb){
1131 pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr, 1134 pci_unmap_single(hmp->pci_dev,
1135 leXX_to_cpu(hmp->rx_ring[i].addr),
1132 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1136 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1133 dev_kfree_skb(skb); 1137 dev_kfree_skb(skb);
1134 hmp->rx_skbuff[i] = NULL; 1138 hmp->rx_skbuff[i] = NULL;
@@ -1420,7 +1424,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance)
1420 /* Free the original skb. */ 1424 /* Free the original skb. */
1421 if (skb){ 1425 if (skb){
1422 pci_unmap_single(hmp->pci_dev, 1426 pci_unmap_single(hmp->pci_dev,
1423 hmp->tx_ring[entry].addr, 1427 leXX_to_cpu(hmp->tx_ring[entry].addr),
1424 skb->len, 1428 skb->len,
1425 PCI_DMA_TODEVICE); 1429 PCI_DMA_TODEVICE);
1426 dev_kfree_skb_irq(skb); 1430 dev_kfree_skb_irq(skb);
@@ -1500,11 +1504,11 @@ static int hamachi_rx(struct net_device *dev)
1500 if (desc_status & DescOwn) 1504 if (desc_status & DescOwn)
1501 break; 1505 break;
1502 pci_dma_sync_single_for_cpu(hmp->pci_dev, 1506 pci_dma_sync_single_for_cpu(hmp->pci_dev,
1503 desc->addr, 1507 leXX_to_cpu(desc->addr),
1504 hmp->rx_buf_sz, 1508 hmp->rx_buf_sz,
1505 PCI_DMA_FROMDEVICE); 1509 PCI_DMA_FROMDEVICE);
1506 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data; 1510 buf_addr = (u8 *) hmp->rx_skbuff[entry]->data;
1507 frame_status = le32_to_cpu(get_unaligned((s32*)&(buf_addr[data_size - 12]))); 1511 frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12])));
1508 if (hamachi_debug > 4) 1512 if (hamachi_debug > 4)
1509 printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n", 1513 printk(KERN_DEBUG " hamachi_rx() status was %8.8x.\n",
1510 frame_status); 1514 frame_status);
@@ -1518,9 +1522,9 @@ static int hamachi_rx(struct net_device *dev)
1518 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]); 1522 dev->name, desc, &hmp->rx_ring[hmp->cur_rx % RX_RING_SIZE]);
1519 printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n", 1523 printk(KERN_WARNING "%s: Oversized Ethernet frame -- next status %x/%x last status %x.\n",
1520 dev->name, 1524 dev->name,
1521 hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0xffff0000, 1525 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0xffff0000,
1522 hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length & 0x0000ffff, 1526 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx+1) % RX_RING_SIZE].status_n_length) & 0x0000ffff,
1523 hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length); 1527 le32_to_cpu(hmp->rx_ring[(hmp->cur_rx-1) % RX_RING_SIZE].status_n_length));
1524 hmp->stats.rx_length_errors++; 1528 hmp->stats.rx_length_errors++;
1525 } /* else Omit for prototype errata??? */ 1529 } /* else Omit for prototype errata??? */
1526 if (frame_status & 0x00380000) { 1530 if (frame_status & 0x00380000) {
@@ -1566,7 +1570,7 @@ static int hamachi_rx(struct net_device *dev)
1566#endif 1570#endif
1567 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1571 skb_reserve(skb, 2); /* 16 byte align the IP header */
1568 pci_dma_sync_single_for_cpu(hmp->pci_dev, 1572 pci_dma_sync_single_for_cpu(hmp->pci_dev,
1569 hmp->rx_ring[entry].addr, 1573 leXX_to_cpu(hmp->rx_ring[entry].addr),
1570 hmp->rx_buf_sz, 1574 hmp->rx_buf_sz,
1571 PCI_DMA_FROMDEVICE); 1575 PCI_DMA_FROMDEVICE);
1572 /* Call copy + cksum if available. */ 1576 /* Call copy + cksum if available. */
@@ -1579,12 +1583,12 @@ static int hamachi_rx(struct net_device *dev)
1579 + entry*sizeof(*desc), pkt_len); 1583 + entry*sizeof(*desc), pkt_len);
1580#endif 1584#endif
1581 pci_dma_sync_single_for_device(hmp->pci_dev, 1585 pci_dma_sync_single_for_device(hmp->pci_dev,
1582 hmp->rx_ring[entry].addr, 1586 leXX_to_cpu(hmp->rx_ring[entry].addr),
1583 hmp->rx_buf_sz, 1587 hmp->rx_buf_sz,
1584 PCI_DMA_FROMDEVICE); 1588 PCI_DMA_FROMDEVICE);
1585 } else { 1589 } else {
1586 pci_unmap_single(hmp->pci_dev, 1590 pci_unmap_single(hmp->pci_dev,
1587 hmp->rx_ring[entry].addr, 1591 leXX_to_cpu(hmp->rx_ring[entry].addr),
1588 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1592 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1589 skb_put(skb = hmp->rx_skbuff[entry], pkt_len); 1593 skb_put(skb = hmp->rx_skbuff[entry], pkt_len);
1590 hmp->rx_skbuff[entry] = NULL; 1594 hmp->rx_skbuff[entry] = NULL;
@@ -1787,21 +1791,21 @@ static int hamachi_close(struct net_device *dev)
1787 for (i = 0; i < RX_RING_SIZE; i++) { 1791 for (i = 0; i < RX_RING_SIZE; i++) {
1788 skb = hmp->rx_skbuff[i]; 1792 skb = hmp->rx_skbuff[i];
1789 hmp->rx_ring[i].status_n_length = 0; 1793 hmp->rx_ring[i].status_n_length = 0;
1790 hmp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */
1791 if (skb) { 1794 if (skb) {
1792 pci_unmap_single(hmp->pci_dev, 1795 pci_unmap_single(hmp->pci_dev,
1793 hmp->rx_ring[i].addr, hmp->rx_buf_sz, 1796 leXX_to_cpu(hmp->rx_ring[i].addr),
1794 PCI_DMA_FROMDEVICE); 1797 hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1795 dev_kfree_skb(skb); 1798 dev_kfree_skb(skb);
1796 hmp->rx_skbuff[i] = NULL; 1799 hmp->rx_skbuff[i] = NULL;
1797 } 1800 }
1801 hmp->rx_ring[i].addr = cpu_to_leXX(0xBADF00D0); /* An invalid address. */
1798 } 1802 }
1799 for (i = 0; i < TX_RING_SIZE; i++) { 1803 for (i = 0; i < TX_RING_SIZE; i++) {
1800 skb = hmp->tx_skbuff[i]; 1804 skb = hmp->tx_skbuff[i];
1801 if (skb) { 1805 if (skb) {
1802 pci_unmap_single(hmp->pci_dev, 1806 pci_unmap_single(hmp->pci_dev,
1803 hmp->tx_ring[i].addr, skb->len, 1807 leXX_to_cpu(hmp->tx_ring[i].addr),
1804 PCI_DMA_TODEVICE); 1808 skb->len, PCI_DMA_TODEVICE);
1805 dev_kfree_skb(skb); 1809 dev_kfree_skb(skb);
1806 hmp->tx_skbuff[i] = NULL; 1810 hmp->tx_skbuff[i] = NULL;
1807 } 1811 }
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
index a2fc660ca5d4..86b756a30784 100644
--- a/drivers/net/ibm_newemac/debug.c
+++ b/drivers/net/ibm_newemac/debug.c
@@ -26,7 +26,7 @@
26 26
27#include "core.h" 27#include "core.h"
28 28
29static spinlock_t emac_dbg_lock = SPIN_LOCK_UNLOCKED; 29static DEFINE_SPINLOCK(emac_dbg_lock);
30 30
31static void emac_desc_dump(struct emac_instance *p) 31static void emac_desc_dump(struct emac_instance *p)
32{ 32{
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index c6355c00fd7a..9081234ab458 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
1168static int irda_usb_net_open(struct net_device *netdev) 1168static int irda_usb_net_open(struct net_device *netdev)
1169{ 1169{
1170 struct irda_usb_cb *self; 1170 struct irda_usb_cb *self;
1171 unsigned long flags;
1171 char hwname[16]; 1172 char hwname[16];
1172 int i; 1173 int i;
1173 1174
@@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_device *netdev)
1177 self = (struct irda_usb_cb *) netdev->priv; 1178 self = (struct irda_usb_cb *) netdev->priv;
1178 IRDA_ASSERT(self != NULL, return -1;); 1179 IRDA_ASSERT(self != NULL, return -1;);
1179 1180
1181 spin_lock_irqsave(&self->lock, flags);
1180 /* Can only open the device if it's there */ 1182 /* Can only open the device if it's there */
1181 if(!self->present) { 1183 if(!self->present) {
1184 spin_unlock_irqrestore(&self->lock, flags);
1182 IRDA_WARNING("%s(), device not present!\n", __FUNCTION__); 1185 IRDA_WARNING("%s(), device not present!\n", __FUNCTION__);
1183 return -1; 1186 return -1;
1184 } 1187 }
1185 1188
1186 if(self->needspatch) { 1189 if(self->needspatch) {
1190 spin_unlock_irqrestore(&self->lock, flags);
1187 IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ; 1191 IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ;
1188 return -EIO ; 1192 return -EIO ;
1189 } 1193 }
@@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_device *netdev)
1198 /* To do *before* submitting Rx urbs and starting net Tx queue 1202 /* To do *before* submitting Rx urbs and starting net Tx queue
1199 * Jean II */ 1203 * Jean II */
1200 self->netopen = 1; 1204 self->netopen = 1;
1205 spin_unlock_irqrestore(&self->lock, flags);
1201 1206
1202 /* 1207 /*
1203 * Now that everything should be initialized properly, 1208 * Now that everything should be initialized properly,
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 0b769192d4ce..93916cf33f29 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -677,6 +677,8 @@ static int mcs_net_close(struct net_device *netdev)
677 /* Stop transmit processing */ 677 /* Stop transmit processing */
678 netif_stop_queue(netdev); 678 netif_stop_queue(netdev);
679 679
680 kfree_skb(mcs->rx_buff.skb);
681
680 /* kill and free the receive and transmit URBs */ 682 /* kill and free the receive and transmit URBs */
681 usb_kill_urb(mcs->rx_urb); 683 usb_kill_urb(mcs->rx_urb);
682 usb_free_urb(mcs->rx_urb); 684 usb_free_urb(mcs->rx_urb);
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index 042bc2f0417d..e59c485bc497 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -142,9 +142,6 @@ enum StirCtrl2Mask {
142}; 142};
143 143
144enum StirFifoCtlMask { 144enum StirFifoCtlMask {
145 FIFOCTL_EOF = 0x80,
146 FIFOCTL_UNDER = 0x40,
147 FIFOCTL_OVER = 0x20,
148 FIFOCTL_DIR = 0x10, 145 FIFOCTL_DIR = 0x10,
149 FIFOCTL_CLR = 0x08, 146 FIFOCTL_CLR = 0x08,
150 FIFOCTL_EMPTY = 0x04, 147 FIFOCTL_EMPTY = 0x04,
@@ -594,9 +591,10 @@ static int fifo_txwait(struct stir_cb *stir, int space)
594{ 591{
595 int err; 592 int err;
596 unsigned long count, status; 593 unsigned long count, status;
594 unsigned long prev_count = 0x1fff;
597 595
598 /* Read FIFO status and count */ 596 /* Read FIFO status and count */
599 for(;;) { 597 for (;; prev_count = count) {
600 err = read_reg(stir, REG_FIFOCTL, stir->fifo_status, 598 err = read_reg(stir, REG_FIFOCTL, stir->fifo_status,
601 FIFO_REGS_SIZE); 599 FIFO_REGS_SIZE);
602 if (unlikely(err != FIFO_REGS_SIZE)) { 600 if (unlikely(err != FIFO_REGS_SIZE)) {
@@ -629,6 +627,10 @@ static int fifo_txwait(struct stir_cb *stir, int space)
629 if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count) 627 if (space >= 0 && STIR_FIFO_SIZE - 4 > space + count)
630 return 0; 628 return 0;
631 629
630 /* queue confused */
631 if (prev_count < count)
632 break;
633
632 /* estimate transfer time for remaining chars */ 634 /* estimate transfer time for remaining chars */
633 msleep((count * 8000) / stir->speed); 635 msleep((count * 8000) / stir->speed);
634 } 636 }
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 3021234b1e17..bf9085fe035a 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -320,10 +320,22 @@ ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog)
320void 320void
321ixgb_reset(struct ixgb_adapter *adapter) 321ixgb_reset(struct ixgb_adapter *adapter)
322{ 322{
323 struct ixgb_hw *hw = &adapter->hw;
323 324
324 ixgb_adapter_stop(&adapter->hw); 325 ixgb_adapter_stop(hw);
325 if(!ixgb_init_hw(&adapter->hw)) 326 if (!ixgb_init_hw(hw))
326 DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n"); 327 DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n");
328
329 /* restore frame size information */
330 IXGB_WRITE_REG(hw, MFS, hw->max_frame_size << IXGB_MFS_SHIFT);
331 if (hw->max_frame_size >
332 IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) {
333 u32 ctrl0 = IXGB_READ_REG(hw, CTRL0);
334 if (!(ctrl0 & IXGB_CTRL0_JFE)) {
335 ctrl0 |= IXGB_CTRL0_JFE;
336 IXGB_WRITE_REG(hw, CTRL0, ctrl0);
337 }
338 }
327} 339}
328 340
329/** 341/**
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index ad134a61302a..288177716a49 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -337,15 +337,15 @@ static int tc574_config(struct pcmcia_device *link)
337 struct net_device *dev = link->priv; 337 struct net_device *dev = link->priv;
338 struct el3_private *lp = netdev_priv(dev); 338 struct el3_private *lp = netdev_priv(dev);
339 tuple_t tuple; 339 tuple_t tuple;
340 unsigned short buf[32]; 340 __le16 buf[32];
341 int last_fn, last_ret, i, j; 341 int last_fn, last_ret, i, j;
342 kio_addr_t ioaddr; 342 kio_addr_t ioaddr;
343 u16 *phys_addr; 343 __be16 *phys_addr;
344 char *cardname; 344 char *cardname;
345 union wn3_config config; 345 union wn3_config config;
346 DECLARE_MAC_BUF(mac); 346 DECLARE_MAC_BUF(mac);
347 347
348 phys_addr = (u16 *)dev->dev_addr; 348 phys_addr = (__be16 *)dev->dev_addr;
349 349
350 DEBUG(0, "3c574_config(0x%p)\n", link); 350 DEBUG(0, "3c574_config(0x%p)\n", link);
351 351
@@ -378,12 +378,12 @@ static int tc574_config(struct pcmcia_device *link)
378 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 378 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
379 pcmcia_get_tuple_data(link, &tuple); 379 pcmcia_get_tuple_data(link, &tuple);
380 for (i = 0; i < 3; i++) 380 for (i = 0; i < 3; i++)
381 phys_addr[i] = htons(buf[i]); 381 phys_addr[i] = htons(le16_to_cpu(buf[i]));
382 } else { 382 } else {
383 EL3WINDOW(0); 383 EL3WINDOW(0);
384 for (i = 0; i < 3; i++) 384 for (i = 0; i < 3; i++)
385 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); 385 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
386 if (phys_addr[0] == 0x6060) { 386 if (phys_addr[0] == htons(0x6060)) {
387 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" 387 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
388 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 388 "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
389 goto failed; 389 goto failed;
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/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index db6a97d1d7b1..51bbd582f16c 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1746,6 +1746,7 @@ static struct pcmcia_device_id pcnet_ids[] = {
1746 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), 1746 PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"),
1747 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), 1747 PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"),
1748 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"), 1748 PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"),
1749 PCMCIA_DEVICE_PROD_ID12("Ethernet", "CF Size PC Card", 0x00b2e941, 0x43ac239b),
1749 PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0", 1750 PCMCIA_DEVICE_PROD_ID123("Fast Ethernet", "CF Size PC Card", "1.0",
1750 0xb4be14e3, 0x43ac239b, 0x0877b627), 1751 0xb4be14e3, 0x43ac239b, 0x0877b627),
1751 PCMCIA_DEVICE_NULL 1752 PCMCIA_DEVICE_NULL
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 1f647b9ce352..5863190894cc 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -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
@@ -2835,7 +2835,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
2835 } 2835 }
2836 2836
2837 /* Work around for AMD plateform. */ 2837 /* Work around for AMD plateform. */
2838 if ((desc->opts2 & 0xfffe000) && 2838 if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
2839 (tp->mac_version == RTL_GIGA_MAC_VER_05)) { 2839 (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
2840 desc->opts2 = 0; 2840 desc->opts2 = 0;
2841 cur_rx++; 2841 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 121cb100f93a..9d80f1cf73ac 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -3737,7 +3737,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
3737} 3737}
3738 3738
3739/* Handle software interrupt used during MSI(X) test */ 3739/* Handle software interrupt used during MSI(X) test */
3740static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id) 3740static irqreturn_t s2io_test_intr(int irq, void *dev_id)
3741{ 3741{
3742 struct s2io_nic *sp = dev_id; 3742 struct s2io_nic *sp = dev_id;
3743 3743
@@ -3748,7 +3748,7 @@ static irqreturn_t __devinit s2io_test_intr(int irq, void *dev_id)
3748} 3748}
3749 3749
3750/* Test interrupt path by forcing a a software IRQ */ 3750/* Test interrupt path by forcing a a software IRQ */
3751static int __devinit s2io_test_msi(struct s2io_nic *sp) 3751static int s2io_test_msi(struct s2io_nic *sp)
3752{ 3752{
3753 struct pci_dev *pdev = sp->pdev; 3753 struct pci_dev *pdev = sp->pdev;
3754 struct XENA_dev_config __iomem *bar0 = sp->bar0; 3754 struct XENA_dev_config __iomem *bar0 = sp->bar0;
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 720088396bb9..7eab072ae792 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -474,7 +474,7 @@ static inline void sis190_map_to_asic(struct RxDesc *desc, dma_addr_t mapping,
474static inline void sis190_make_unusable_by_asic(struct RxDesc *desc) 474static inline void sis190_make_unusable_by_asic(struct RxDesc *desc)
475{ 475{
476 desc->PSize = 0x0; 476 desc->PSize = 0x0;
477 desc->addr = 0xdeadbeef; 477 desc->addr = cpu_to_le32(0xdeadbeef);
478 desc->size &= cpu_to_le32(RingEnd); 478 desc->size &= cpu_to_le32(RingEnd);
479 wmb(); 479 wmb();
480 desc->status = 0x0; 480 desc->status = 0x0;
@@ -580,7 +580,7 @@ static int sis190_rx_interrupt(struct net_device *dev,
580 struct RxDesc *desc = tp->RxDescRing + entry; 580 struct RxDesc *desc = tp->RxDescRing + entry;
581 u32 status; 581 u32 status;
582 582
583 if (desc->status & OWNbit) 583 if (le32_to_cpu(desc->status) & OWNbit)
584 break; 584 break;
585 585
586 status = le32_to_cpu(desc->PSize); 586 status = le32_to_cpu(desc->PSize);
@@ -1381,7 +1381,7 @@ out:
1381 return rc; 1381 return rc;
1382} 1382}
1383 1383
1384static void __devexit sis190_mii_remove(struct net_device *dev) 1384static void sis190_mii_remove(struct net_device *dev)
1385{ 1385{
1386 struct sis190_private *tp = netdev_priv(dev); 1386 struct sis190_private *tp = netdev_priv(dev);
1387 1387
@@ -1538,9 +1538,9 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
1538 1538
1539 /* Get MAC address from EEPROM */ 1539 /* Get MAC address from EEPROM */
1540 for (i = 0; i < MAC_ADDR_LEN / 2; i++) { 1540 for (i = 0; i < MAC_ADDR_LEN / 2; i++) {
1541 __le16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i); 1541 u16 w = sis190_read_eeprom(ioaddr, EEPROMMACAddr + i);
1542 1542
1543 ((u16 *)dev->dev_addr)[i] = le16_to_cpu(w); 1543 ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(w);
1544 } 1544 }
1545 1545
1546 sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo)); 1546 sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo));
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 6197afb3ed83..a74fc11a6482 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -822,8 +822,13 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
822 822
823 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg); 823 sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T), rx_reg);
824 824
825 /* Flush Rx MAC FIFO on any flow control or error */ 825 if (hw->chip_id == CHIP_ID_YUKON_XL) {
826 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); 826 /* Hardware errata - clear flush mask */
827 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), 0);
828 } else {
829 /* Flush Rx MAC FIFO on any flow control or error */
830 sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR);
831 }
827 832
828 /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */ 833 /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */
829 reg = RX_GMF_FL_THR_DEF + 1; 834 reg = RX_GMF_FL_THR_DEF + 1;
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index d04e4fa35206..7defa63b9c74 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -76,7 +76,7 @@
76 76
77 77
78 78
79#if SMC_USE_PXA_DMA 79#ifdef SMC_USE_PXA_DMA
80#define SMC_USE_DMA 80#define SMC_USE_DMA
81 81
82/* 82/*
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index bcc430bd9e49..6e00dc857afa 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -1742,7 +1742,7 @@ static void set_rx_mode(struct net_device *dev)
1742 if (vlan_group_get_device(np->vlgrp, i)) { 1742 if (vlan_group_get_device(np->vlgrp, i)) {
1743 if (vlan_count >= 32) 1743 if (vlan_count >= 32)
1744 break; 1744 break;
1745 writew(cpu_to_be16(i), filter_addr); 1745 writew(i, filter_addr);
1746 filter_addr += 16; 1746 filter_addr += 16;
1747 vlan_count++; 1747 vlan_count++;
1748 } 1748 }
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index ff98f5d597f1..0a6186d4a48e 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -340,9 +340,9 @@ enum mac_ctrl1_bits {
340/* Note that using only 32 bit fields simplifies conversion to big-endian 340/* Note that using only 32 bit fields simplifies conversion to big-endian
341 architectures. */ 341 architectures. */
342struct netdev_desc { 342struct netdev_desc {
343 u32 next_desc; 343 __le32 next_desc;
344 u32 status; 344 __le32 status;
345 struct desc_frag { u32 addr, length; } frag[1]; 345 struct desc_frag { __le32 addr, length; } frag[1];
346}; 346};
347 347
348/* Bits in netdev_desc.status */ 348/* Bits in netdev_desc.status */
@@ -495,8 +495,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
495 goto err_out_res; 495 goto err_out_res;
496 496
497 for (i = 0; i < 3; i++) 497 for (i = 0; i < 3; i++)
498 ((u16 *)dev->dev_addr)[i] = 498 ((__le16 *)dev->dev_addr)[i] =
499 le16_to_cpu(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET)); 499 cpu_to_le16(eeprom_read(ioaddr, i + EEPROM_SA_OFFSET));
500 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 500 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
501 501
502 dev->base_addr = (unsigned long)ioaddr; 502 dev->base_addr = (unsigned long)ioaddr;
@@ -1090,8 +1090,8 @@ reset_tx (struct net_device *dev)
1090 skb = np->tx_skbuff[i]; 1090 skb = np->tx_skbuff[i];
1091 if (skb) { 1091 if (skb) {
1092 pci_unmap_single(np->pci_dev, 1092 pci_unmap_single(np->pci_dev,
1093 np->tx_ring[i].frag[0].addr, skb->len, 1093 le32_to_cpu(np->tx_ring[i].frag[0].addr),
1094 PCI_DMA_TODEVICE); 1094 skb->len, PCI_DMA_TODEVICE);
1095 if (irq) 1095 if (irq)
1096 dev_kfree_skb_irq (skb); 1096 dev_kfree_skb_irq (skb);
1097 else 1097 else
@@ -1214,7 +1214,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1214 skb = np->tx_skbuff[entry]; 1214 skb = np->tx_skbuff[entry];
1215 /* Free the original skb. */ 1215 /* Free the original skb. */
1216 pci_unmap_single(np->pci_dev, 1216 pci_unmap_single(np->pci_dev,
1217 np->tx_ring[entry].frag[0].addr, 1217 le32_to_cpu(np->tx_ring[entry].frag[0].addr),
1218 skb->len, PCI_DMA_TODEVICE); 1218 skb->len, PCI_DMA_TODEVICE);
1219 dev_kfree_skb_irq (np->tx_skbuff[entry]); 1219 dev_kfree_skb_irq (np->tx_skbuff[entry]);
1220 np->tx_skbuff[entry] = NULL; 1220 np->tx_skbuff[entry] = NULL;
@@ -1233,7 +1233,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
1233 skb = np->tx_skbuff[entry]; 1233 skb = np->tx_skbuff[entry];
1234 /* Free the original skb. */ 1234 /* Free the original skb. */
1235 pci_unmap_single(np->pci_dev, 1235 pci_unmap_single(np->pci_dev,
1236 np->tx_ring[entry].frag[0].addr, 1236 le32_to_cpu(np->tx_ring[entry].frag[0].addr),
1237 skb->len, PCI_DMA_TODEVICE); 1237 skb->len, PCI_DMA_TODEVICE);
1238 dev_kfree_skb_irq (np->tx_skbuff[entry]); 1238 dev_kfree_skb_irq (np->tx_skbuff[entry]);
1239 np->tx_skbuff[entry] = NULL; 1239 np->tx_skbuff[entry] = NULL;
@@ -1311,19 +1311,19 @@ static void rx_poll(unsigned long data)
1311 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) { 1311 && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
1312 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1312 skb_reserve(skb, 2); /* 16 byte align the IP header */
1313 pci_dma_sync_single_for_cpu(np->pci_dev, 1313 pci_dma_sync_single_for_cpu(np->pci_dev,
1314 desc->frag[0].addr, 1314 le32_to_cpu(desc->frag[0].addr),
1315 np->rx_buf_sz, 1315 np->rx_buf_sz,
1316 PCI_DMA_FROMDEVICE); 1316 PCI_DMA_FROMDEVICE);
1317 1317
1318 skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len); 1318 skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len);
1319 pci_dma_sync_single_for_device(np->pci_dev, 1319 pci_dma_sync_single_for_device(np->pci_dev,
1320 desc->frag[0].addr, 1320 le32_to_cpu(desc->frag[0].addr),
1321 np->rx_buf_sz, 1321 np->rx_buf_sz,
1322 PCI_DMA_FROMDEVICE); 1322 PCI_DMA_FROMDEVICE);
1323 skb_put(skb, pkt_len); 1323 skb_put(skb, pkt_len);
1324 } else { 1324 } else {
1325 pci_unmap_single(np->pci_dev, 1325 pci_unmap_single(np->pci_dev,
1326 desc->frag[0].addr, 1326 le32_to_cpu(desc->frag[0].addr),
1327 np->rx_buf_sz, 1327 np->rx_buf_sz,
1328 PCI_DMA_FROMDEVICE); 1328 PCI_DMA_FROMDEVICE);
1329 skb_put(skb = np->rx_skbuff[entry], pkt_len); 1329 skb_put(skb = np->rx_skbuff[entry], pkt_len);
@@ -1709,23 +1709,23 @@ static int netdev_close(struct net_device *dev)
1709 /* Free all the skbuffs in the Rx queue. */ 1709 /* Free all the skbuffs in the Rx queue. */
1710 for (i = 0; i < RX_RING_SIZE; i++) { 1710 for (i = 0; i < RX_RING_SIZE; i++) {
1711 np->rx_ring[i].status = 0; 1711 np->rx_ring[i].status = 0;
1712 np->rx_ring[i].frag[0].addr = 0xBADF00D0; /* An invalid address. */
1713 skb = np->rx_skbuff[i]; 1712 skb = np->rx_skbuff[i];
1714 if (skb) { 1713 if (skb) {
1715 pci_unmap_single(np->pci_dev, 1714 pci_unmap_single(np->pci_dev,
1716 np->rx_ring[i].frag[0].addr, np->rx_buf_sz, 1715 le32_to_cpu(np->rx_ring[i].frag[0].addr),
1717 PCI_DMA_FROMDEVICE); 1716 np->rx_buf_sz, PCI_DMA_FROMDEVICE);
1718 dev_kfree_skb(skb); 1717 dev_kfree_skb(skb);
1719 np->rx_skbuff[i] = NULL; 1718 np->rx_skbuff[i] = NULL;
1720 } 1719 }
1720 np->rx_ring[i].frag[0].addr = cpu_to_le32(0xBADF00D0); /* poison */
1721 } 1721 }
1722 for (i = 0; i < TX_RING_SIZE; i++) { 1722 for (i = 0; i < TX_RING_SIZE; i++) {
1723 np->tx_ring[i].next_desc = 0; 1723 np->tx_ring[i].next_desc = 0;
1724 skb = np->tx_skbuff[i]; 1724 skb = np->tx_skbuff[i];
1725 if (skb) { 1725 if (skb) {
1726 pci_unmap_single(np->pci_dev, 1726 pci_unmap_single(np->pci_dev,
1727 np->tx_ring[i].frag[0].addr, skb->len, 1727 le32_to_cpu(np->tx_ring[i].frag[0].addr),
1728 PCI_DMA_TODEVICE); 1728 skb->len, PCI_DMA_TODEVICE);
1729 dev_kfree_skb(skb); 1729 dev_kfree_skb(skb);
1730 np->tx_skbuff[i] = NULL; 1730 np->tx_skbuff[i] = NULL;
1731 } 1731 }
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/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/ucc_geth.c b/drivers/net/ucc_geth.c
index 7f689907ac28..abac7db3819e 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3447,7 +3447,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
3447 u16 length, howmany = 0; 3447 u16 length, howmany = 0;
3448 u32 bd_status; 3448 u32 bd_status;
3449 u8 *bdBuffer; 3449 u8 *bdBuffer;
3450 struct net_device * dev; 3450 struct net_device *dev;
3451 3451
3452 ugeth_vdbg("%s: IN", __FUNCTION__); 3452 ugeth_vdbg("%s: IN", __FUNCTION__);
3453 3453
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
index d83437039919..1e45b2028a50 100644
--- a/drivers/net/ucc_geth_mii.h
+++ b/drivers/net/ucc_geth_mii.h
@@ -96,5 +96,5 @@ enum enet_tbi_mii_reg {
96int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum); 96int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value); 97int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
98int __init uec_mdio_init(void); 98int __init uec_mdio_init(void);
99void __exit uec_mdio_exit(void); 99void uec_mdio_exit(void);
100#endif /* __UEC_MII_H */ 100#endif /* __UEC_MII_H */
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 61daa096de66..1249f444039e 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 >= 0 && err < size)
206 err = -EINVAL;
207 if (!err)
208 memcpy(data, buf, size);
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/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/syncppp.c b/drivers/net/wan/syncppp.c
index 232ecba5340f..61e24b7a45a3 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -107,24 +107,24 @@
107struct ppp_header { 107struct ppp_header {
108 u8 address; 108 u8 address;
109 u8 control; 109 u8 control;
110 u16 protocol; 110 __be16 protocol;
111}; 111};
112#define PPP_HEADER_LEN sizeof (struct ppp_header) 112#define PPP_HEADER_LEN sizeof (struct ppp_header)
113 113
114struct lcp_header { 114struct lcp_header {
115 u8 type; 115 u8 type;
116 u8 ident; 116 u8 ident;
117 u16 len; 117 __be16 len;
118}; 118};
119#define LCP_HEADER_LEN sizeof (struct lcp_header) 119#define LCP_HEADER_LEN sizeof (struct lcp_header)
120 120
121struct cisco_packet { 121struct cisco_packet {
122 u32 type; 122 __be32 type;
123 u32 par1; 123 __be32 par1;
124 u32 par2; 124 __be32 par2;
125 u16 rel; 125 __be16 rel;
126 u16 time0; 126 __be16 time0;
127 u16 time1; 127 __be16 time1;
128}; 128};
129#define CISCO_PACKET_LEN 18 129#define CISCO_PACKET_LEN 18
130#define CISCO_BIG_PACKET_LEN 20 130#define CISCO_BIG_PACKET_LEN 20
@@ -139,7 +139,7 @@ static struct sk_buff_head tx_queue;
139static void sppp_keepalive (unsigned long dummy); 139static void sppp_keepalive (unsigned long dummy);
140static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type, 140static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type,
141 u8 ident, u16 len, void *data); 141 u8 ident, u16 len, void *data);
142static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2); 142static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2);
143static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m); 143static void sppp_lcp_input (struct sppp *sp, struct sk_buff *m);
144static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m); 144static void sppp_cisco_input (struct sppp *sp, struct sk_buff *m);
145static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m); 145static void sppp_ipcp_input (struct sppp *sp, struct sk_buff *m);
@@ -447,7 +447,7 @@ static void sppp_keepalive (unsigned long dummy)
447 sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq, 447 sppp_cisco_send (sp, CISCO_KEEPALIVE_REQ, ++sp->pp_seq,
448 sp->pp_rseq); 448 sp->pp_rseq);
449 else if (sp->lcp.state == LCP_STATE_OPENED) { 449 else if (sp->lcp.state == LCP_STATE_OPENED) {
450 long nmagic = htonl (sp->lcp.magic); 450 __be32 nmagic = htonl (sp->lcp.magic);
451 sp->lcp.echoid = ++sp->pp_seq; 451 sp->lcp.echoid = ++sp->pp_seq;
452 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ, 452 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REQ,
453 sp->lcp.echoid, 4, &nmagic); 453 sp->lcp.echoid, 4, &nmagic);
@@ -667,7 +667,7 @@ badreq:
667 dev->name, len); 667 dev->name, len);
668 break; 668 break;
669 } 669 }
670 if (ntohl (*(long*)(h+1)) == sp->lcp.magic) { 670 if (ntohl (*(__be32*)(h+1)) == sp->lcp.magic) {
671 /* Line loopback mode detected. */ 671 /* Line loopback mode detected. */
672 printk (KERN_WARNING "%s: loopback\n", dev->name); 672 printk (KERN_WARNING "%s: loopback\n", dev->name);
673 if_down (dev); 673 if_down (dev);
@@ -680,7 +680,7 @@ badreq:
680 sppp_lcp_open (sp); 680 sppp_lcp_open (sp);
681 break; 681 break;
682 } 682 }
683 *(long*)(h+1) = htonl (sp->lcp.magic); 683 *(__be32 *)(h+1) = htonl (sp->lcp.magic);
684 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1); 684 sppp_cp_send (sp, PPP_LCP, LCP_ECHO_REPLY, h->ident, len-4, h+1);
685 break; 685 break;
686 case LCP_ECHO_REPLY: 686 case LCP_ECHO_REPLY:
@@ -692,7 +692,7 @@ badreq:
692 dev->name, len); 692 dev->name, len);
693 break; 693 break;
694 } 694 }
695 if (ntohl (*(long*)(h+1)) != sp->lcp.magic) 695 if (ntohl(*(__be32 *)(h+1)) != sp->lcp.magic)
696 sp->pp_alivecnt = 0; 696 sp->pp_alivecnt = 0;
697 break; 697 break;
698 } 698 }
@@ -765,7 +765,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
765 { 765 {
766 struct in_device *in_dev; 766 struct in_device *in_dev;
767 struct in_ifaddr *ifa; 767 struct in_ifaddr *ifa;
768 __be32 addr = 0, mask = ~0; /* FIXME: is the mask correct? */ 768 __be32 addr = 0, mask = htonl(~0U); /* FIXME: is the mask correct? */
769#ifdef CONFIG_INET 769#ifdef CONFIG_INET
770 rcu_read_lock(); 770 rcu_read_lock();
771 if ((in_dev = __in_dev_get_rcu(dev)) != NULL) 771 if ((in_dev = __in_dev_get_rcu(dev)) != NULL)
@@ -782,8 +782,7 @@ static void sppp_cisco_input (struct sppp *sp, struct sk_buff *skb)
782 } 782 }
783 rcu_read_unlock(); 783 rcu_read_unlock();
784#endif 784#endif
785 /* I hope both addr and mask are in the net order */ 785 sppp_cisco_send (sp, CISCO_ADDR_REPLY, ntohl(addr), ntohl(mask));
786 sppp_cisco_send (sp, CISCO_ADDR_REPLY, addr, mask);
787 break; 786 break;
788 } 787 }
789 } 788 }
@@ -844,7 +843,7 @@ static void sppp_cp_send (struct sppp *sp, u16 proto, u8 type,
844 * Send Cisco keepalive packet. 843 * Send Cisco keepalive packet.
845 */ 844 */
846 845
847static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2) 846static void sppp_cisco_send (struct sppp *sp, int type, u32 par1, u32 par2)
848{ 847{
849 struct ppp_header *h; 848 struct ppp_header *h;
850 struct cisco_packet *ch; 849 struct cisco_packet *ch;
@@ -868,7 +867,7 @@ static void sppp_cisco_send (struct sppp *sp, int type, long par1, long par2)
868 ch->type = htonl (type); 867 ch->type = htonl (type);
869 ch->par1 = htonl (par1); 868 ch->par1 = htonl (par1);
870 ch->par2 = htonl (par2); 869 ch->par2 = htonl (par2);
871 ch->rel = -1; 870 ch->rel = htons(0xffff);
872 ch->time0 = htons ((u16) (t >> 16)); 871 ch->time0 = htons ((u16) (t >> 16));
873 ch->time1 = htons ((u16) t); 872 ch->time1 = htons ((u16) t);
874 873
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 7bdf9da59992..c98fc62a3e61 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -264,6 +264,7 @@ config IPW2200_DEBUG
264config LIBERTAS 264config LIBERTAS
265 tristate "Marvell 8xxx Libertas WLAN driver support" 265 tristate "Marvell 8xxx Libertas WLAN driver support"
266 depends on WLAN_80211 266 depends on WLAN_80211
267 select WIRELESS_EXT
267 select IEEE80211 268 select IEEE80211
268 select FW_LOADER 269 select FW_LOADER
269 ---help--- 270 ---help---
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index 19e588582c7c..6c0e2b9f7760 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -163,6 +163,9 @@ static void b43_map_led(struct b43_wldev *dev,
163 b43_register_led(dev, &dev->led_radio, name, 163 b43_register_led(dev, &dev->led_radio, name,
164 b43_rfkill_led_name(dev), 164 b43_rfkill_led_name(dev),
165 led_index, activelow); 165 led_index, activelow);
166 /* Sync the RF-kill LED state with the switch state. */
167 if (dev->radio_hw_enable)
168 b43_led_turn_on(dev, led_index, activelow);
166 break; 169 break;
167 case B43_LED_WEIRD: 170 case B43_LED_WEIRD:
168 case B43_LED_ASSOC: 171 case B43_LED_ASSOC:
@@ -232,4 +235,5 @@ void b43_leds_exit(struct b43_wldev *dev)
232 b43_unregister_led(&dev->led_tx); 235 b43_unregister_led(&dev->led_tx);
233 b43_unregister_led(&dev->led_rx); 236 b43_unregister_led(&dev->led_rx);
234 b43_unregister_led(&dev->led_assoc); 237 b43_unregister_led(&dev->led_assoc);
238 b43_unregister_led(&dev->led_radio);
235} 239}
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index b45eecc53c4a..1c93b4f4bfe3 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2163,7 +2163,6 @@ static void b43_mgmtframe_txantenna(struct b43_wldev *dev, int antenna)
2163static void b43_chip_exit(struct b43_wldev *dev) 2163static void b43_chip_exit(struct b43_wldev *dev)
2164{ 2164{
2165 b43_radio_turn_off(dev, 1); 2165 b43_radio_turn_off(dev, 1);
2166 b43_leds_exit(dev);
2167 b43_gpio_cleanup(dev); 2166 b43_gpio_cleanup(dev);
2168 /* firmware is released later */ 2167 /* firmware is released later */
2169} 2168}
@@ -2191,11 +2190,10 @@ static int b43_chip_init(struct b43_wldev *dev)
2191 err = b43_gpio_init(dev); 2190 err = b43_gpio_init(dev);
2192 if (err) 2191 if (err)
2193 goto out; /* firmware is released later */ 2192 goto out; /* firmware is released later */
2194 b43_leds_init(dev);
2195 2193
2196 err = b43_upload_initvals(dev); 2194 err = b43_upload_initvals(dev);
2197 if (err) 2195 if (err)
2198 goto err_leds_exit; 2196 goto err_gpio_clean;
2199 b43_radio_turn_on(dev); 2197 b43_radio_turn_on(dev);
2200 2198
2201 b43_write16(dev, 0x03E6, 0x0000); 2199 b43_write16(dev, 0x03E6, 0x0000);
@@ -2271,8 +2269,7 @@ out:
2271 2269
2272err_radio_off: 2270err_radio_off:
2273 b43_radio_turn_off(dev, 1); 2271 b43_radio_turn_off(dev, 1);
2274err_leds_exit: 2272err_gpio_clean:
2275 b43_leds_exit(dev);
2276 b43_gpio_cleanup(dev); 2273 b43_gpio_cleanup(dev);
2277 return err; 2274 return err;
2278} 2275}
@@ -3273,10 +3270,7 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
3273 return; 3270 return;
3274 b43_set_status(dev, B43_STAT_UNINIT); 3271 b43_set_status(dev, B43_STAT_UNINIT);
3275 3272
3276 mutex_unlock(&dev->wl->mutex); 3273 b43_leds_exit(dev);
3277 b43_rfkill_exit(dev);
3278 mutex_lock(&dev->wl->mutex);
3279
3280 b43_rng_exit(dev->wl); 3274 b43_rng_exit(dev->wl);
3281 b43_pio_free(dev); 3275 b43_pio_free(dev);
3282 b43_dma_free(dev); 3276 b43_dma_free(dev);
@@ -3405,12 +3399,12 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
3405 memset(wl->mac_addr, 0, ETH_ALEN); 3399 memset(wl->mac_addr, 0, ETH_ALEN);
3406 b43_upload_card_macaddress(dev); 3400 b43_upload_card_macaddress(dev);
3407 b43_security_init(dev); 3401 b43_security_init(dev);
3408 b43_rfkill_init(dev);
3409 b43_rng_init(wl); 3402 b43_rng_init(wl);
3410 3403
3411 b43_set_status(dev, B43_STAT_INITIALIZED); 3404 b43_set_status(dev, B43_STAT_INITIALIZED);
3412 3405
3413 out: 3406 b43_leds_init(dev);
3407out:
3414 return err; 3408 return err;
3415 3409
3416 err_chip_exit: 3410 err_chip_exit:
@@ -3499,6 +3493,10 @@ static int b43_start(struct ieee80211_hw *hw)
3499 int did_init = 0; 3493 int did_init = 0;
3500 int err = 0; 3494 int err = 0;
3501 3495
3496 /* First register RFkill.
3497 * LEDs that are registered later depend on it. */
3498 b43_rfkill_init(dev);
3499
3502 mutex_lock(&wl->mutex); 3500 mutex_lock(&wl->mutex);
3503 3501
3504 if (b43_status(dev) < B43_STAT_INITIALIZED) { 3502 if (b43_status(dev) < B43_STAT_INITIALIZED) {
@@ -3528,6 +3526,8 @@ static void b43_stop(struct ieee80211_hw *hw)
3528 struct b43_wl *wl = hw_to_b43_wl(hw); 3526 struct b43_wl *wl = hw_to_b43_wl(hw);
3529 struct b43_wldev *dev = wl->current_dev; 3527 struct b43_wldev *dev = wl->current_dev;
3530 3528
3529 b43_rfkill_exit(dev);
3530
3531 mutex_lock(&wl->mutex); 3531 mutex_lock(&wl->mutex);
3532 if (b43_status(dev) >= B43_STAT_STARTED) 3532 if (b43_status(dev) >= B43_STAT_STARTED)
3533 b43_wireless_core_stop(dev); 3533 b43_wireless_core_stop(dev);
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index 9b1f905ffbf4..98cf70c5fd47 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -25,6 +25,8 @@
25#include "rfkill.h" 25#include "rfkill.h"
26#include "b43.h" 26#include "b43.h"
27 27
28#include <linux/kmod.h>
29
28 30
29/* Returns TRUE, if the radio is enabled in hardware. */ 31/* Returns TRUE, if the radio is enabled in hardware. */
30static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) 32static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
@@ -50,7 +52,10 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
50 bool report_change = 0; 52 bool report_change = 0;
51 53
52 mutex_lock(&wl->mutex); 54 mutex_lock(&wl->mutex);
53 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); 55 if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED)) {
56 mutex_unlock(&wl->mutex);
57 return;
58 }
54 enabled = b43_is_hw_radio_enabled(dev); 59 enabled = b43_is_hw_radio_enabled(dev);
55 if (unlikely(enabled != dev->radio_hw_enable)) { 60 if (unlikely(enabled != dev->radio_hw_enable)) {
56 dev->radio_hw_enable = enabled; 61 dev->radio_hw_enable = enabled;
@@ -60,8 +65,12 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
60 } 65 }
61 mutex_unlock(&wl->mutex); 66 mutex_unlock(&wl->mutex);
62 67
63 if (unlikely(report_change)) 68 /* send the radio switch event to the system - note both a key press
64 input_report_key(poll_dev->input, KEY_WLAN, enabled); 69 * and a release are required */
70 if (unlikely(report_change)) {
71 input_report_key(poll_dev->input, KEY_WLAN, 1);
72 input_report_key(poll_dev->input, KEY_WLAN, 0);
73 }
65} 74}
66 75
67/* Called when the RFKILL toggled in software. */ 76/* Called when the RFKILL toggled in software. */
@@ -69,13 +78,15 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state)
69{ 78{
70 struct b43_wldev *dev = data; 79 struct b43_wldev *dev = data;
71 struct b43_wl *wl = dev->wl; 80 struct b43_wl *wl = dev->wl;
72 int err = 0; 81 int err = -EBUSY;
73 82
74 if (!wl->rfkill.registered) 83 if (!wl->rfkill.registered)
75 return 0; 84 return 0;
76 85
77 mutex_lock(&wl->mutex); 86 mutex_lock(&wl->mutex);
78 B43_WARN_ON(b43_status(dev) < B43_STAT_INITIALIZED); 87 if (b43_status(dev) < B43_STAT_INITIALIZED)
88 goto out_unlock;
89 err = 0;
79 switch (state) { 90 switch (state) {
80 case RFKILL_STATE_ON: 91 case RFKILL_STATE_ON:
81 if (!dev->radio_hw_enable) { 92 if (!dev->radio_hw_enable) {
@@ -133,9 +144,25 @@ void b43_rfkill_init(struct b43_wldev *dev)
133 rfk->poll_dev->poll = b43_rfkill_poll; 144 rfk->poll_dev->poll = b43_rfkill_poll;
134 rfk->poll_dev->poll_interval = 1000; /* msecs */ 145 rfk->poll_dev->poll_interval = 1000; /* msecs */
135 146
147 rfk->poll_dev->input->name = rfk->name;
148 rfk->poll_dev->input->id.bustype = BUS_HOST;
149 rfk->poll_dev->input->id.vendor = dev->dev->bus->boardinfo.vendor;
150 rfk->poll_dev->input->evbit[0] = BIT(EV_KEY);
151 set_bit(KEY_WLAN, rfk->poll_dev->input->keybit);
152
136 err = rfkill_register(rfk->rfkill); 153 err = rfkill_register(rfk->rfkill);
137 if (err) 154 if (err)
138 goto err_free_polldev; 155 goto err_free_polldev;
156
157#ifdef CONFIG_RFKILL_INPUT_MODULE
158 /* B43 RF-kill isn't useful without the rfkill-input subsystem.
159 * Try to load the module. */
160 err = request_module("rfkill-input");
161 if (err)
162 b43warn(wl, "Failed to load the rfkill-input module. "
163 "The built-in radio LED will not work.\n");
164#endif /* CONFIG_RFKILL_INPUT */
165
139 err = input_register_polled_device(rfk->poll_dev); 166 err = input_register_polled_device(rfk->poll_dev);
140 if (err) 167 if (err)
141 goto err_unreg_rfk; 168 goto err_unreg_rfk;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
index 35dbe4554513..76e9dd843faa 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c
@@ -219,7 +219,7 @@ static ssize_t tsf_write_file(struct file *file, const char __user *user_buf,
219 ssize_t buf_size; 219 ssize_t buf_size;
220 ssize_t res; 220 ssize_t res;
221 unsigned long flags; 221 unsigned long flags;
222 u64 tsf; 222 unsigned long long tsf;
223 223
224 buf_size = min(count, sizeof (really_big_buffer) - 1); 224 buf_size = min(count, sizeof (really_big_buffer) - 1);
225 down(&big_buffer_sem); 225 down(&big_buffer_sem);
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 38ce8ee8d6f9..88062c1318a8 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -10762,7 +10762,7 @@ static void ipw_bg_link_down(struct work_struct *work)
10762 mutex_unlock(&priv->mutex); 10762 mutex_unlock(&priv->mutex);
10763} 10763}
10764 10764
10765static int ipw_setup_deferred_work(struct ipw_priv *priv) 10765static int __devinit ipw_setup_deferred_work(struct ipw_priv *priv)
10766{ 10766{
10767 int ret = 0; 10767 int ret = 0;
10768 10768
@@ -11611,7 +11611,8 @@ static void ipw_prom_free(struct ipw_priv *priv)
11611#endif 11611#endif
11612 11612
11613 11613
11614static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 11614static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11615 const struct pci_device_id *ent)
11615{ 11616{
11616 int err = 0; 11617 int err = 0;
11617 struct net_device *net_dev; 11618 struct net_device *net_dev;
@@ -11778,7 +11779,7 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
11778 return err; 11779 return err;
11779} 11780}
11780 11781
11781static void ipw_pci_remove(struct pci_dev *pdev) 11782static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11782{ 11783{
11783 struct ipw_priv *priv = pci_get_drvdata(pdev); 11784 struct ipw_priv *priv = pci_get_drvdata(pdev);
11784 struct list_head *p, *q; 11785 struct list_head *p, *q;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 5c67b5b409e0..1a6b0e0edf6f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -4743,8 +4743,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
4743 * when we loaded driver, and is now set to "enable". 4743 * when we loaded driver, and is now set to "enable".
4744 * After we're Alive, RF_KILL gets handled by 4744 * After we're Alive, RF_KILL gets handled by
4745 * iwl_rx_card_state_notif() */ 4745 * iwl_rx_card_state_notif() */
4746 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) 4746 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
4747 clear_bit(STATUS_RF_KILL_HW, &priv->status);
4747 queue_work(priv->workqueue, &priv->restart); 4748 queue_work(priv->workqueue, &priv->restart);
4749 }
4748 4750
4749 handled |= CSR_INT_BIT_RF_KILL; 4751 handled |= CSR_INT_BIT_RF_KILL;
4750 } 4752 }
@@ -6171,6 +6173,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6171 mutex_lock(&priv->mutex); 6173 mutex_lock(&priv->mutex);
6172 6174
6173 if (rc) { 6175 if (rc) {
6176 iwl_rate_control_unregister(priv->hw);
6174 IWL_ERROR("Failed to register network " 6177 IWL_ERROR("Failed to register network "
6175 "device (error %d)\n", rc); 6178 "device (error %d)\n", rc);
6176 return; 6179 return;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index ed148ea3dec3..6cd57c220631 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -5059,8 +5059,10 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
5059 * when we loaded driver, and is now set to "enable". 5059 * when we loaded driver, and is now set to "enable".
5060 * After we're Alive, RF_KILL gets handled by 5060 * After we're Alive, RF_KILL gets handled by
5061 * iwl_rx_card_state_notif() */ 5061 * iwl_rx_card_state_notif() */
5062 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) 5062 if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
5063 clear_bit(STATUS_RF_KILL_HW, &priv->status);
5063 queue_work(priv->workqueue, &priv->restart); 5064 queue_work(priv->workqueue, &priv->restart);
5065 }
5064 5066
5065 handled |= CSR_INT_BIT_RF_KILL; 5067 handled |= CSR_INT_BIT_RF_KILL;
5066 } 5068 }
@@ -6527,6 +6529,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
6527 mutex_lock(&priv->mutex); 6529 mutex_lock(&priv->mutex);
6528 6530
6529 if (rc) { 6531 if (rc) {
6532 iwl_rate_control_unregister(priv->hw);
6530 IWL_ERROR("Failed to register network " 6533 IWL_ERROR("Failed to register network "
6531 "device (error %d)\n", rc); 6534 "device (error %d)\n", rc);
6532 return; 6535 return;
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a903645e157a..5298a8bf1129 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1130,6 +1130,8 @@ static void zd_mac_rx(struct zd_mac *mac, struct sk_buff *skb)
1130 __skb_trim(skb, skb->len - 1130 __skb_trim(skb, skb->len -
1131 (IEEE80211_FCS_LEN + sizeof(struct rx_status))); 1131 (IEEE80211_FCS_LEN + sizeof(struct rx_status)));
1132 1132
1133 ZD_ASSERT(IS_ALIGNED((unsigned long)skb->data, 4));
1134
1133 update_qual_rssi(mac, skb->data, skb->len, stats.signal, 1135 update_qual_rssi(mac, skb->data, skb->len, stats.signal,
1134 status->signal_strength); 1136 status->signal_strength);
1135 1137
@@ -1166,15 +1168,19 @@ static void do_rx(unsigned long mac_ptr)
1166int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length) 1168int zd_mac_rx_irq(struct zd_mac *mac, const u8 *buffer, unsigned int length)
1167{ 1169{
1168 struct sk_buff *skb; 1170 struct sk_buff *skb;
1171 unsigned int reserved =
1172 ALIGN(max_t(unsigned int,
1173 sizeof(struct zd_rt_hdr), ZD_PLCP_HEADER_SIZE), 4) -
1174 ZD_PLCP_HEADER_SIZE;
1169 1175
1170 skb = dev_alloc_skb(sizeof(struct zd_rt_hdr) + length); 1176 skb = dev_alloc_skb(reserved + length);
1171 if (!skb) { 1177 if (!skb) {
1172 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); 1178 struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac);
1173 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n"); 1179 dev_warn(zd_mac_dev(mac), "Could not allocate skb.\n");
1174 ieee->stats.rx_dropped++; 1180 ieee->stats.rx_dropped++;
1175 return -ENOMEM; 1181 return -ENOMEM;
1176 } 1182 }
1177 skb_reserve(skb, sizeof(struct zd_rt_hdr)); 1183 skb_reserve(skb, reserved);
1178 memcpy(__skb_put(skb, length), buffer, length); 1184 memcpy(__skb_put(skb, length), buffer, length);
1179 skb_queue_tail(&mac->rx_queue, skb); 1185 skb_queue_tail(&mac->rx_queue, skb);
1180 tasklet_schedule(&mac->rx_tasklet); 1186 tasklet_schedule(&mac->rx_tasklet);
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/parport/procfs.c b/drivers/parport/procfs.c
index ed82e41210d1..d950fc34320a 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -384,7 +384,7 @@ parport_device_sysctl_template = {
384 { 384 {
385 .procname = "timeslice", 385 .procname = "timeslice",
386 .data = NULL, 386 .data = NULL,
387 .maxlen = sizeof(int), 387 .maxlen = sizeof(unsigned long),
388 .mode = 0644, 388 .mode = 0644,
389 .proc_handler = &proc_doulongvec_ms_jiffies_minmax, 389 .proc_handler = &proc_doulongvec_ms_jiffies_minmax,
390 .extra1 = (void*) &parport_min_timeslice_value, 390 .extra1 = (void*) &parport_min_timeslice_value,
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index c2f8a78c894c..2f75d695eed7 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -276,7 +276,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
276 sz = pci_size(l, sz, (u32)PCI_ROM_ADDRESS_MASK); 276 sz = pci_size(l, sz, (u32)PCI_ROM_ADDRESS_MASK);
277 if (sz) { 277 if (sz) {
278 res->flags = (l & IORESOURCE_ROM_ENABLE) | 278 res->flags = (l & IORESOURCE_ROM_ENABLE) |
279 IORESOURCE_MEM | IORESOURCE_READONLY; 279 IORESOURCE_MEM | IORESOURCE_PREFETCH |
280 IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
280 res->start = l & PCI_ROM_ADDRESS_MASK; 281 res->start = l & PCI_ROM_ADDRESS_MASK;
281 res->end = res->start + (unsigned long) sz; 282 res->end = res->start + (unsigned long) sz;
282 } 283 }
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 2999214ca534..d3b9b14267ab 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -225,18 +225,12 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
225 goto out; 225 goto out;
226 } 226 }
227 227
228 ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
229 if (ret) {
230 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
231 goto out;
232 }
233
234 rtc->irq = irq; 228 rtc->irq = irq;
235 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1); 229 rtc->regs = ioremap(regs->start, regs->end - regs->start + 1);
236 if (!rtc->regs) { 230 if (!rtc->regs) {
237 ret = -ENOMEM; 231 ret = -ENOMEM;
238 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 232 dev_dbg(&pdev->dev, "could not map I/O memory\n");
239 goto out_free_irq; 233 goto out;
240 } 234 }
241 spin_lock_init(&rtc->lock); 235 spin_lock_init(&rtc->lock);
242 236
@@ -253,12 +247,18 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
253 | RTC_BIT(CTRL_EN)); 247 | RTC_BIT(CTRL_EN));
254 } 248 }
255 249
250 ret = request_irq(irq, at32_rtc_interrupt, IRQF_SHARED, "rtc", rtc);
251 if (ret) {
252 dev_dbg(&pdev->dev, "could not request irq %d\n", irq);
253 goto out_iounmap;
254 }
255
256 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev, 256 rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
257 &at32_rtc_ops, THIS_MODULE); 257 &at32_rtc_ops, THIS_MODULE);
258 if (IS_ERR(rtc->rtc)) { 258 if (IS_ERR(rtc->rtc)) {
259 dev_dbg(&pdev->dev, "could not register rtc device\n"); 259 dev_dbg(&pdev->dev, "could not register rtc device\n");
260 ret = PTR_ERR(rtc->rtc); 260 ret = PTR_ERR(rtc->rtc);
261 goto out_iounmap; 261 goto out_free_irq;
262 } 262 }
263 263
264 platform_set_drvdata(pdev, rtc); 264 platform_set_drvdata(pdev, rtc);
@@ -268,10 +268,10 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
268 268
269 return 0; 269 return 0;
270 270
271out_iounmap:
272 iounmap(rtc->regs);
273out_free_irq: 271out_free_irq:
274 free_irq(irq, rtc); 272 free_irq(irq, rtc);
273out_iounmap:
274 iounmap(rtc->regs);
275out: 275out:
276 kfree(rtc); 276 kfree(rtc);
277 return ret; 277 return ret;
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 97adc701a819..77a503139e32 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -478,14 +478,14 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
478 skb->dev = pskb->dev; 478 skb->dev = pskb->dev;
479 skb->protocol = pskb->protocol; 479 skb->protocol = pskb->protocol;
480 pskb->ip_summed = CHECKSUM_UNNECESSARY; 480 pskb->ip_summed = CHECKSUM_UNNECESSARY;
481 netif_rx_ni(skb);
482 /** 481 /**
483 * Successful rx; reset logflags 482 * reset logflags
484 */ 483 */
485 ch->logflags = 0; 484 ch->logflags = 0;
486 dev->last_rx = jiffies;
487 privptr->stats.rx_packets++; 485 privptr->stats.rx_packets++;
488 privptr->stats.rx_bytes += skb->len; 486 privptr->stats.rx_bytes += skb->len;
487 netif_rx_ni(skb);
488 dev->last_rx = jiffies;
489 if (len > 0) { 489 if (len > 0) {
490 skb_pull(pskb, header->length); 490 skb_pull(pskb, header->length);
491 if (skb_tailroom(pskb) < LL_HEADER_LENGTH) { 491 if (skb_tailroom(pskb) < LL_HEADER_LENGTH) {
diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index 4d18d6419ddc..c7ea9381db9f 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -639,14 +639,14 @@ static void netiucv_unpack_skb(struct iucv_connection *conn,
639 skb->dev = pskb->dev; 639 skb->dev = pskb->dev;
640 skb->protocol = pskb->protocol; 640 skb->protocol = pskb->protocol;
641 pskb->ip_summed = CHECKSUM_UNNECESSARY; 641 pskb->ip_summed = CHECKSUM_UNNECESSARY;
642 privptr->stats.rx_packets++;
643 privptr->stats.rx_bytes += skb->len;
642 /* 644 /*
643 * Since receiving is always initiated from a tasklet (in iucv.c), 645 * Since receiving is always initiated from a tasklet (in iucv.c),
644 * we must use netif_rx_ni() instead of netif_rx() 646 * we must use netif_rx_ni() instead of netif_rx()
645 */ 647 */
646 netif_rx_ni(skb); 648 netif_rx_ni(skb);
647 dev->last_rx = jiffies; 649 dev->last_rx = jiffies;
648 privptr->stats.rx_packets++;
649 privptr->stats.rx_bytes += skb->len;
650 skb_pull(pskb, header->next); 650 skb_pull(pskb, header->next);
651 skb_put(pskb, NETIUCV_HDRLEN); 651 skb_put(pskb, NETIUCV_HDRLEN);
652 } 652 }
diff --git a/drivers/sbus/char/cpwatchdog.c b/drivers/sbus/char/cpwatchdog.c
index 7b5773d88212..a4e758143665 100644
--- a/drivers/sbus/char/cpwatchdog.c
+++ b/drivers/sbus/char/cpwatchdog.c
@@ -154,7 +154,7 @@ struct wd_device {
154}; 154};
155 155
156static struct wd_device wd_dev = { 156static struct wd_device wd_dev = {
157 0, SPIN_LOCK_UNLOCKED, 0, 0, 0, 0, 157 0, __SPIN_LOCK_UNLOCKED(wd_dev.lock), 0, 0, 0, 0,
158}; 158};
159 159
160static struct timer_list wd_timer; 160static struct timer_list wd_timer;
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 70f48a1a6d58..b31d1c95c9fb 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -906,8 +906,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev
906 } 906 }
907 907
908 pci_set_master(pDev); 908 pci_set_master(pDev);
909 if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) && 909 if (pci_set_dma_mask(pDev, DMA_32BIT_MASK))
910 pci_set_dma_mask(pDev, DMA_32BIT_MASK))
911 return -EINVAL; 910 return -EINVAL;
912 911
913 base_addr0_phys = pci_resource_start(pDev,0); 912 base_addr0_phys = pci_resource_start(pDev,0);
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 7a835a35f21d..9706de9d98d5 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -242,6 +242,11 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
242 } 242 }
243} 243}
244 244
245static void ide_scsi_hex_dump(u8 *data, int len)
246{
247 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0);
248}
249
245static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) 250static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command)
246{ 251{
247 idescsi_scsi_t *scsi = drive_to_idescsi(drive); 252 idescsi_scsi_t *scsi = drive_to_idescsi(drive);
@@ -272,8 +277,7 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
272 pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; 277 pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd;
273 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 278 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
274 printk ("ide-scsi: %s: queue cmd = ", drive->name); 279 printk ("ide-scsi: %s: queue cmd = ", drive->name);
275 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, pc->c, 280 ide_scsi_hex_dump(pc->c, 6);
276 6, 0);
277 } 281 }
278 rq->rq_disk = scsi->disk; 282 rq->rq_disk = scsi->disk;
279 return ide_do_drive_cmd(drive, rq, ide_preempt); 283 return ide_do_drive_cmd(drive, rq, ide_preempt);
@@ -328,8 +332,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
328 idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; 332 idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer;
329 if (log) { 333 if (log) {
330 printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); 334 printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number);
331 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, 335 ide_scsi_hex_dump(pc->buffer, 16);
332 pc->buffer, 16, 0);
333 } 336 }
334 memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); 337 memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE);
335 kfree(pc->buffer); 338 kfree(pc->buffer);
@@ -808,12 +811,10 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
808 811
809 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { 812 if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
810 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); 813 printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number);
811 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, 814 ide_scsi_hex_dump(cmd->cmnd, cmd->cmd_len);
812 cmd->cmnd, cmd->cmd_len, 0);
813 if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { 815 if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) {
814 printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); 816 printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number);
815 print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, 817 ide_scsi_hex_dump(pc->c, 12);
816 pc->c, 12, 0);
817 } 818 }
818 } 819 }
819 820
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 4c4465d39a1d..01bf0189367d 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2616,6 +2616,7 @@ static void initio_build_scb(struct initio_host * host, struct scsi_ctrl_blk * c
2616 scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) { 2616 scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) {
2617 sg->data = cpu_to_le32((u32)sg_dma_address(sglist)); 2617 sg->data = cpu_to_le32((u32)sg_dma_address(sglist));
2618 total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist)); 2618 total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist));
2619 ++sg;
2619 } 2620 }
2620 2621
2621 cblk->buflen = (scsi_bufflen(cmnd) > total_len) ? 2622 cblk->buflen = (scsi_bufflen(cmnd) > total_len) ?
@@ -2867,6 +2868,7 @@ static int initio_probe_one(struct pci_dev *pdev,
2867 } 2868 }
2868 host = (struct initio_host *)shost->hostdata; 2869 host = (struct initio_host *)shost->hostdata;
2869 memset(host, 0, sizeof(struct initio_host)); 2870 memset(host, 0, sizeof(struct initio_host));
2871 host->addr = pci_resource_start(pdev, 0);
2870 2872
2871 if (!request_region(host->addr, 256, "i91u")) { 2873 if (!request_region(host->addr, 256, "i91u")) {
2872 printk(KERN_WARNING "initio: I/O port range 0x%x is busy.\n", host->addr); 2874 printk(KERN_WARNING "initio: I/O port range 0x%x is busy.\n", host->addr);
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 98dfd6ea209c..328c47c6aeb1 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3611,6 +3611,7 @@ static struct st_buffer *
3611 3611
3612 tb->dma = need_dma; 3612 tb->dma = need_dma;
3613 tb->buffer_size = got; 3613 tb->buffer_size = got;
3614 sg_init_table(tb->sg, max_sg);
3614 3615
3615 return tb; 3616 return tb;
3616} 3617}
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 0f74aba5b237..9e0908d1981a 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1243,7 +1243,7 @@ static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev)
1243 * Free O/S specific resources. 1243 * Free O/S specific resources.
1244 */ 1244 */
1245 if (pdev->irq) 1245 if (pdev->irq)
1246 free_irq(pdev->irq, np); 1246 free_irq(pdev->irq, np->s.host);
1247 if (np->s.ioaddr) 1247 if (np->s.ioaddr)
1248 pci_iounmap(pdev, np->s.ioaddr); 1248 pci_iounmap(pdev, np->s.ioaddr);
1249 if (np->s.ramaddr) 1249 if (np->s.ramaddr)
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 463f119f20e9..254bdaeb35ff 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -2791,7 +2791,7 @@ irqreturn_t sym_interrupt(struct Scsi_Host *shost)
2791 istat = INB(np, nc_istat); 2791 istat = INB(np, nc_istat);
2792 if (istat & INTF) { 2792 if (istat & INTF) {
2793 OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem); 2793 OUTB(np, nc_istat, (istat & SIGP) | INTF | np->istat_sem);
2794 istat = INB(np, nc_istat); /* DUMMY READ */ 2794 istat |= INB(np, nc_istat); /* DUMMY READ */
2795 if (DEBUG_FLAGS & DEBUG_TINY) printf ("F "); 2795 if (DEBUG_FLAGS & DEBUG_TINY) printf ("F ");
2796 sym_wakeup_done(np); 2796 sym_wakeup_done(np);
2797 } 2797 }
diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
index 70a09a3d5af0..707c5b03bce9 100644
--- a/drivers/serial/suncore.c
+++ b/drivers/serial/suncore.c
@@ -23,11 +23,36 @@
23 23
24#include "suncore.h" 24#include "suncore.h"
25 25
26int sunserial_current_minor = 64; 26static int sunserial_current_minor = 64;
27 27
28EXPORT_SYMBOL(sunserial_current_minor); 28int sunserial_register_minors(struct uart_driver *drv, int count)
29{
30 int err = 0;
31
32 drv->minor = sunserial_current_minor;
33 drv->nr += count;
34 /* Register the driver on the first call */
35 if (drv->nr == count)
36 err = uart_register_driver(drv);
37 if (err == 0) {
38 sunserial_current_minor += count;
39 drv->tty_driver->name_base = drv->minor - 64;
40 }
41 return err;
42}
43EXPORT_SYMBOL(sunserial_register_minors);
44
45void sunserial_unregister_minors(struct uart_driver *drv, int count)
46{
47 drv->nr -= count;
48 sunserial_current_minor -= count;
49
50 if (drv->nr == 0)
51 uart_unregister_driver(drv);
52}
53EXPORT_SYMBOL(sunserial_unregister_minors);
29 54
30int sunserial_console_match(struct console *con, struct device_node *dp, 55int __init sunserial_console_match(struct console *con, struct device_node *dp,
31 struct uart_driver *drv, int line) 56 struct uart_driver *drv, int line)
32{ 57{
33 int off; 58 int off;
@@ -133,8 +158,6 @@ sunserial_console_termios(struct console *con)
133 con->cflag = cflag; 158 con->cflag = cflag;
134} 159}
135 160
136EXPORT_SYMBOL(sunserial_console_termios);
137
138/* Sun serial MOUSE auto baud rate detection. */ 161/* Sun serial MOUSE auto baud rate detection. */
139static struct mouse_baud_cflag { 162static struct mouse_baud_cflag {
140 int baud; 163 int baud;
diff --git a/drivers/serial/suncore.h b/drivers/serial/suncore.h
index 829d7d65d6db..042668aa602e 100644
--- a/drivers/serial/suncore.h
+++ b/drivers/serial/suncore.h
@@ -22,7 +22,8 @@
22extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *); 22extern unsigned int suncore_mouse_baud_cflag_next(unsigned int, int *);
23extern int suncore_mouse_baud_detection(unsigned char, int); 23extern int suncore_mouse_baud_detection(unsigned char, int);
24 24
25extern int sunserial_current_minor; 25extern int sunserial_register_minors(struct uart_driver *, int);
26extern void sunserial_unregister_minors(struct uart_driver *, int);
26 27
27extern int sunserial_console_match(struct console *, struct device_node *, 28extern int sunserial_console_match(struct console *, struct device_node *,
28 struct uart_driver *, int); 29 struct uart_driver *, int);
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 8ff900b09811..be0fe152891b 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -562,16 +562,10 @@ static int __devinit hv_probe(struct of_device *op, const struct of_device_id *m
562 562
563 port->dev = &op->dev; 563 port->dev = &op->dev;
564 564
565 sunhv_reg.minor = sunserial_current_minor; 565 err = sunserial_register_minors(&sunhv_reg, 1);
566 sunhv_reg.nr = 1;
567
568 err = uart_register_driver(&sunhv_reg);
569 if (err) 566 if (err)
570 goto out_free_con_read_page; 567 goto out_free_con_read_page;
571 568
572 sunhv_reg.tty_driver->name_base = sunhv_reg.minor - 64;
573 sunserial_current_minor += 1;
574
575 sunserial_console_match(&sunhv_console, op->node, 569 sunserial_console_match(&sunhv_console, op->node,
576 &sunhv_reg, port->line); 570 &sunhv_reg, port->line);
577 571
@@ -591,8 +585,7 @@ out_remove_port:
591 uart_remove_one_port(&sunhv_reg, port); 585 uart_remove_one_port(&sunhv_reg, port);
592 586
593out_unregister_driver: 587out_unregister_driver:
594 sunserial_current_minor -= 1; 588 sunserial_unregister_minors(&sunhv_reg, 1);
595 uart_unregister_driver(&sunhv_reg);
596 589
597out_free_con_read_page: 590out_free_con_read_page:
598 kfree(con_read_page); 591 kfree(con_read_page);
@@ -614,8 +607,7 @@ static int __devexit hv_remove(struct of_device *dev)
614 607
615 uart_remove_one_port(&sunhv_reg, port); 608 uart_remove_one_port(&sunhv_reg, port);
616 609
617 sunserial_current_minor -= 1; 610 sunserial_unregister_minors(&sunhv_reg, 1);
618 uart_unregister_driver(&sunhv_reg);
619 611
620 kfree(port); 612 kfree(port);
621 sunhv_port = NULL; 613 sunhv_port = NULL;
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index ff610c23314b..543f93741e6f 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -832,7 +832,6 @@ static struct uart_driver sunsab_reg = {
832}; 832};
833 833
834static struct uart_sunsab_port *sunsab_ports; 834static struct uart_sunsab_port *sunsab_ports;
835static int num_channels;
836 835
837#ifdef CONFIG_SERIAL_SUNSAB_CONSOLE 836#ifdef CONFIG_SERIAL_SUNSAB_CONSOLE
838 837
@@ -1102,8 +1101,8 @@ static int __init sunsab_init(void)
1102{ 1101{
1103 struct device_node *dp; 1102 struct device_node *dp;
1104 int err; 1103 int err;
1104 int num_channels = 0;
1105 1105
1106 num_channels = 0;
1107 for_each_node_by_name(dp, "se") 1106 for_each_node_by_name(dp, "se")
1108 num_channels += 2; 1107 num_channels += 2;
1109 for_each_node_by_name(dp, "serial") { 1108 for_each_node_by_name(dp, "serial") {
@@ -1117,20 +1116,14 @@ static int __init sunsab_init(void)
1117 if (!sunsab_ports) 1116 if (!sunsab_ports)
1118 return -ENOMEM; 1117 return -ENOMEM;
1119 1118
1120 sunsab_reg.minor = sunserial_current_minor;
1121 sunsab_reg.nr = num_channels;
1122 sunsab_reg.cons = SUNSAB_CONSOLE(); 1119 sunsab_reg.cons = SUNSAB_CONSOLE();
1123 1120 err = sunserial_register_minors(&sunsab_reg, num_channels);
1124 err = uart_register_driver(&sunsab_reg);
1125 if (err) { 1121 if (err) {
1126 kfree(sunsab_ports); 1122 kfree(sunsab_ports);
1127 sunsab_ports = NULL; 1123 sunsab_ports = NULL;
1128 1124
1129 return err; 1125 return err;
1130 } 1126 }
1131
1132 sunsab_reg.tty_driver->name_base = sunsab_reg.minor - 64;
1133 sunserial_current_minor += num_channels;
1134 } 1127 }
1135 1128
1136 return of_register_driver(&sab_driver, &of_bus_type); 1129 return of_register_driver(&sab_driver, &of_bus_type);
@@ -1139,9 +1132,8 @@ static int __init sunsab_init(void)
1139static void __exit sunsab_exit(void) 1132static void __exit sunsab_exit(void)
1140{ 1133{
1141 of_unregister_driver(&sab_driver); 1134 of_unregister_driver(&sab_driver);
1142 if (num_channels) { 1135 if (sunsab_reg.nr) {
1143 sunserial_current_minor -= num_channels; 1136 sunserial_unregister_minors(&sunsab_reg, sunsab_reg.nr);
1144 uart_unregister_driver(&sunsab_reg);
1145 } 1137 }
1146 1138
1147 kfree(sunsab_ports); 1139 kfree(sunsab_ports);
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index e074943feff5..4e2302d43ab1 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1528,14 +1528,12 @@ static struct of_platform_driver su_driver = {
1528 .remove = __devexit_p(su_remove), 1528 .remove = __devexit_p(su_remove),
1529}; 1529};
1530 1530
1531static int num_uart;
1532
1533static int __init sunsu_init(void) 1531static int __init sunsu_init(void)
1534{ 1532{
1535 struct device_node *dp; 1533 struct device_node *dp;
1536 int err; 1534 int err;
1535 int num_uart = 0;
1537 1536
1538 num_uart = 0;
1539 for_each_node_by_name(dp, "su") { 1537 for_each_node_by_name(dp, "su") {
1540 if (su_get_type(dp) == SU_PORT_PORT) 1538 if (su_get_type(dp) == SU_PORT_PORT)
1541 num_uart++; 1539 num_uart++;
@@ -1552,26 +1550,22 @@ static int __init sunsu_init(void)
1552 } 1550 }
1553 1551
1554 if (num_uart) { 1552 if (num_uart) {
1555 sunsu_reg.minor = sunserial_current_minor; 1553 err = sunserial_register_minors(&sunsu_reg, num_uart);
1556 sunsu_reg.nr = num_uart;
1557 err = uart_register_driver(&sunsu_reg);
1558 if (err) 1554 if (err)
1559 return err; 1555 return err;
1560 sunsu_reg.tty_driver->name_base = sunsu_reg.minor - 64;
1561 sunserial_current_minor += num_uart;
1562 } 1556 }
1563 1557
1564 err = of_register_driver(&su_driver, &of_bus_type); 1558 err = of_register_driver(&su_driver, &of_bus_type);
1565 if (err && num_uart) 1559 if (err && num_uart)
1566 uart_unregister_driver(&sunsu_reg); 1560 sunserial_unregister_minors(&sunsu_reg, num_uart);
1567 1561
1568 return err; 1562 return err;
1569} 1563}
1570 1564
1571static void __exit sunsu_exit(void) 1565static void __exit sunsu_exit(void)
1572{ 1566{
1573 if (num_uart) 1567 if (sunsu_reg.nr)
1574 uart_unregister_driver(&sunsu_reg); 1568 sunserial_unregister_minors(&sunsu_reg, sunsu_reg.nr);
1575} 1569}
1576 1570
1577module_init(sunsu_init); 1571module_init(sunsu_init);
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 283bef0d24cb..cb2e40506379 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -63,10 +63,6 @@
63 readb(&((__channel)->control)) 63 readb(&((__channel)->control))
64#endif 64#endif
65 65
66static int num_sunzilog;
67#define NUM_SUNZILOG num_sunzilog
68#define NUM_CHANNELS (NUM_SUNZILOG * 2)
69
70#define ZS_CLOCK 4915200 /* Zilog input clock rate. */ 66#define ZS_CLOCK 4915200 /* Zilog input clock rate. */
71#define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */ 67#define ZS_CLOCK_DIVISOR 16 /* Divisor this driver uses. */
72 68
@@ -1031,18 +1027,19 @@ static struct uart_driver sunzilog_reg = {
1031 .major = TTY_MAJOR, 1027 .major = TTY_MAJOR,
1032}; 1028};
1033 1029
1034static int __init sunzilog_alloc_tables(void) 1030static int __init sunzilog_alloc_tables(int num_sunzilog)
1035{ 1031{
1036 struct uart_sunzilog_port *up; 1032 struct uart_sunzilog_port *up;
1037 unsigned long size; 1033 unsigned long size;
1034 int num_channels = num_sunzilog * 2;
1038 int i; 1035 int i;
1039 1036
1040 size = NUM_CHANNELS * sizeof(struct uart_sunzilog_port); 1037 size = num_channels * sizeof(struct uart_sunzilog_port);
1041 sunzilog_port_table = kzalloc(size, GFP_KERNEL); 1038 sunzilog_port_table = kzalloc(size, GFP_KERNEL);
1042 if (!sunzilog_port_table) 1039 if (!sunzilog_port_table)
1043 return -ENOMEM; 1040 return -ENOMEM;
1044 1041
1045 for (i = 0; i < NUM_CHANNELS; i++) { 1042 for (i = 0; i < num_channels; i++) {
1046 up = &sunzilog_port_table[i]; 1043 up = &sunzilog_port_table[i];
1047 1044
1048 spin_lock_init(&up->port.lock); 1045 spin_lock_init(&up->port.lock);
@@ -1050,13 +1047,13 @@ static int __init sunzilog_alloc_tables(void)
1050 if (i == 0) 1047 if (i == 0)
1051 sunzilog_irq_chain = up; 1048 sunzilog_irq_chain = up;
1052 1049
1053 if (i < NUM_CHANNELS - 1) 1050 if (i < num_channels - 1)
1054 up->next = up + 1; 1051 up->next = up + 1;
1055 else 1052 else
1056 up->next = NULL; 1053 up->next = NULL;
1057 } 1054 }
1058 1055
1059 size = NUM_SUNZILOG * sizeof(struct zilog_layout __iomem *); 1056 size = num_sunzilog * sizeof(struct zilog_layout __iomem *);
1060 sunzilog_chip_regs = kzalloc(size, GFP_KERNEL); 1057 sunzilog_chip_regs = kzalloc(size, GFP_KERNEL);
1061 if (!sunzilog_chip_regs) { 1058 if (!sunzilog_chip_regs) {
1062 kfree(sunzilog_port_table); 1059 kfree(sunzilog_port_table);
@@ -1496,34 +1493,28 @@ static int __init sunzilog_init(void)
1496 struct device_node *dp; 1493 struct device_node *dp;
1497 int err, uart_count; 1494 int err, uart_count;
1498 int num_keybms; 1495 int num_keybms;
1496 int num_sunzilog = 0;
1499 1497
1500 NUM_SUNZILOG = 0;
1501 num_keybms = 0; 1498 num_keybms = 0;
1502 for_each_node_by_name(dp, "zs") { 1499 for_each_node_by_name(dp, "zs") {
1503 NUM_SUNZILOG++; 1500 num_sunzilog++;
1504 if (of_find_property(dp, "keyboard", NULL)) 1501 if (of_find_property(dp, "keyboard", NULL))
1505 num_keybms++; 1502 num_keybms++;
1506 } 1503 }
1507 1504
1508 uart_count = 0; 1505 uart_count = 0;
1509 if (NUM_SUNZILOG) { 1506 if (num_sunzilog) {
1510 int uart_count; 1507 int uart_count;
1511 1508
1512 err = sunzilog_alloc_tables(); 1509 err = sunzilog_alloc_tables(num_sunzilog);
1513 if (err) 1510 if (err)
1514 goto out; 1511 goto out;
1515 1512
1516 uart_count = (NUM_SUNZILOG * 2) - (2 * num_keybms); 1513 uart_count = (num_sunzilog * 2) - (2 * num_keybms);
1517 1514
1518 sunzilog_reg.nr = uart_count; 1515 err = sunserial_register_minors(&sunzilog_reg, uart_count);
1519 sunzilog_reg.minor = sunserial_current_minor;
1520 err = uart_register_driver(&sunzilog_reg);
1521 if (err) 1516 if (err)
1522 goto out_free_tables; 1517 goto out_free_tables;
1523
1524 sunzilog_reg.tty_driver->name_base = sunzilog_reg.minor - 64;
1525
1526 sunserial_current_minor += uart_count;
1527 } 1518 }
1528 1519
1529 err = of_register_driver(&zs_driver, &of_bus_type); 1520 err = of_register_driver(&zs_driver, &of_bus_type);
@@ -1557,8 +1548,8 @@ out_unregister_driver:
1557 of_unregister_driver(&zs_driver); 1548 of_unregister_driver(&zs_driver);
1558 1549
1559out_unregister_uart: 1550out_unregister_uart:
1560 if (NUM_SUNZILOG) { 1551 if (num_sunzilog) {
1561 uart_unregister_driver(&sunzilog_reg); 1552 sunserial_unregister_minors(&sunzilog_reg, num_sunzilog);
1562 sunzilog_reg.cons = NULL; 1553 sunzilog_reg.cons = NULL;
1563 } 1554 }
1564 1555
@@ -1590,8 +1581,8 @@ static void __exit sunzilog_exit(void)
1590 zilog_irq = -1; 1581 zilog_irq = -1;
1591 } 1582 }
1592 1583
1593 if (NUM_SUNZILOG) { 1584 if (sunzilog_reg.nr) {
1594 uart_unregister_driver(&sunzilog_reg); 1585 sunserial_unregister_minors(&sunzilog_reg, sunzilog_reg.nr);
1595 sunzilog_free_tables(); 1586 sunzilog_free_tables();
1596 } 1587 }
1597} 1588}
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 5cf6d5f9acbd..3fb9af80cbf4 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -125,7 +125,7 @@ int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
125 125
126 pci_set_master (dev); 126 pci_set_master (dev);
127 127
128 retval = usb_add_hcd (hcd, dev->irq, IRQF_SHARED); 128 retval = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
129 if (retval != 0) 129 if (retval != 0)
130 goto err4; 130 goto err4;
131 return retval; 131 return retval;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 13b326a13377..b04d232d4c65 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -522,9 +522,9 @@ static void hub_quiesce(struct usb_hub *hub)
522 /* (blocking) stop khubd and related activity */ 522 /* (blocking) stop khubd and related activity */
523 usb_kill_urb(hub->urb); 523 usb_kill_urb(hub->urb);
524 if (hub->has_indicators) 524 if (hub->has_indicators)
525 cancel_delayed_work(&hub->leds); 525 cancel_delayed_work_sync(&hub->leds);
526 if (hub->has_indicators || hub->tt.hub) 526 if (hub->tt.hub)
527 flush_scheduled_work(); 527 cancel_work_sync(&hub->tt.kevent);
528} 528}
529 529
530static void hub_activate(struct usb_hub *hub) 530static void hub_activate(struct usb_hub *hub)
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index a6adf7e0f6f8..cd62b029d176 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -887,6 +887,7 @@ static void pullup(struct at91_udc *udc, int is_on)
887 887
888 if (is_on) { 888 if (is_on) {
889 clk_on(udc); 889 clk_on(udc);
890 at91_udp_write(udc, AT91_UDP_ICR, AT91_UDP_RXRSM);
890 at91_udp_write(udc, AT91_UDP_TXVC, 0); 891 at91_udp_write(udc, AT91_UDP_TXVC, 0);
891 if (cpu_is_at91rm9200()) 892 if (cpu_is_at91rm9200())
892 at91_set_gpio_value(udc->board.pullup_pin, 1); 893 at91_set_gpio_value(udc->board.pullup_pin, 1);
@@ -904,6 +905,7 @@ static void pullup(struct at91_udc *udc, int is_on)
904 } 905 }
905 } else { 906 } else {
906 stop_activity(udc); 907 stop_activity(udc);
908 at91_udp_write(udc, AT91_UDP_IDR, AT91_UDP_RXRSM);
907 at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS); 909 at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
908 if (cpu_is_at91rm9200()) 910 if (cpu_is_at91rm9200())
909 at91_set_gpio_value(udc->board.pullup_pin, 0); 911 at91_set_gpio_value(udc->board.pullup_pin, 0);
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index b7b7bfbce527..430821cb95c8 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -122,7 +122,7 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
122 temp = in_le32(hcd->regs + 0x1a8); 122 temp = in_le32(hcd->regs + 0x1a8);
123 out_le32(hcd->regs + 0x1a8, temp | 0x3); 123 out_le32(hcd->regs + 0x1a8, temp | 0x3);
124 124
125 retval = usb_add_hcd(hcd, irq, IRQF_SHARED); 125 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
126 if (retval != 0) 126 if (retval != 0)
127 goto err4; 127 goto err4;
128 return retval; 128 return retval;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 704f33fdd2f1..ecfe800fd720 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -732,24 +732,27 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
732 struct ohci_regs __iomem *regs = ohci->regs; 732 struct ohci_regs __iomem *regs = ohci->regs;
733 int ints; 733 int ints;
734 734
735 /* we can eliminate a (slow) ohci_readl() 735 /* Read interrupt status (and flush pending writes). We ignore the
736 * if _only_ WDH caused this irq 736 * optimization of checking the LSB of hcca->done_head; it doesn't
737 * work on all systems (edge triggering for OHCI can be a factor).
737 */ 738 */
738 if ((ohci->hcca->done_head != 0) 739 ints = ohci_readl(ohci, &regs->intrstatus);
739 && ! (hc32_to_cpup (ohci, &ohci->hcca->done_head)
740 & 0x01)) {
741 ints = OHCI_INTR_WDH;
742 740
743 /* cardbus/... hardware gone before remove() */ 741 /* Check for an all 1's result which is a typical consequence
744 } else if ((ints = ohci_readl (ohci, &regs->intrstatus)) == ~(u32)0) { 742 * of dead, unclocked, or unplugged (CardBus...) devices
743 */
744 if (ints == ~(u32)0) {
745 disable (ohci); 745 disable (ohci);
746 ohci_dbg (ohci, "device removed!\n"); 746 ohci_dbg (ohci, "device removed!\n");
747 return IRQ_HANDLED; 747 return IRQ_HANDLED;
748 }
749
750 /* We only care about interrupts that are enabled */
751 ints &= ohci_readl(ohci, &regs->intrenable);
748 752
749 /* interrupt for some other device? */ 753 /* interrupt for some other device? */
750 } else if ((ints &= ohci_readl (ohci, &regs->intrenable)) == 0) { 754 if (ints == 0)
751 return IRQ_NOTMINE; 755 return IRQ_NOTMINE;
752 }
753 756
754 if (ints & OHCI_INTR_UE) { 757 if (ints & OHCI_INTR_UE) {
755 // e.g. due to PCI Master/Target Abort 758 // e.g. due to PCI Master/Target Abort
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 0a7426920150..0c3e6b790b7b 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -142,7 +142,7 @@ ohci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
142 142
143 ohci_hcd_init(ohci); 143 ohci_hcd_init(ohci);
144 144
145 rv = usb_add_hcd(hcd, irq, 0); 145 rv = usb_add_hcd(hcd, irq, IRQF_DISABLED);
146 if (rv == 0) 146 if (rv == 0)
147 return 0; 147 return 0;
148 148
diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
index fe70e72340de..6e9c2d6db887 100644
--- a/drivers/usb/host/ohci-ssb.c
+++ b/drivers/usb/host/ohci-ssb.c
@@ -160,7 +160,7 @@ static int ssb_ohci_attach(struct ssb_device *dev)
160 hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); 160 hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
161 if (!hcd->regs) 161 if (!hcd->regs)
162 goto err_put_hcd; 162 goto err_put_hcd;
163 err = usb_add_hcd(hcd, dev->irq, IRQF_SHARED); 163 err = usb_add_hcd(hcd, dev->irq, IRQF_DISABLED | IRQF_SHARED);
164 if (err) 164 if (err)
165 goto err_iounmap; 165 goto err_iounmap;
166 166
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index ae8ec4474eb8..0ce2fc5e396b 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2197,7 +2197,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2197 INIT_LIST_HEAD(&r8a66597->child_device); 2197 INIT_LIST_HEAD(&r8a66597->child_device);
2198 2198
2199 hcd->rsrc_start = res->start; 2199 hcd->rsrc_start = res->start;
2200 ret = usb_add_hcd(hcd, irq, 0); 2200 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED);
2201 if (ret != 0) { 2201 if (ret != 0) {
2202 err("Failed to add hcd"); 2202 err("Failed to add hcd");
2203 goto clean_up; 2203 goto clean_up;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 4db17f75f4f1..ec987897b8ed 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -378,7 +378,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
378{ 378{
379 struct uhci_hcd *uhci = hcd_to_uhci(hcd); 379 struct uhci_hcd *uhci = hcd_to_uhci(hcd);
380 unsigned short status; 380 unsigned short status;
381 unsigned long flags;
382 381
383 /* 382 /*
384 * Read the interrupt status, and write it back to clear the 383 * Read the interrupt status, and write it back to clear the
@@ -398,7 +397,7 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
398 dev_err(uhci_dev(uhci), "host controller process " 397 dev_err(uhci_dev(uhci), "host controller process "
399 "error, something bad happened!\n"); 398 "error, something bad happened!\n");
400 if (status & USBSTS_HCH) { 399 if (status & USBSTS_HCH) {
401 spin_lock_irqsave(&uhci->lock, flags); 400 spin_lock(&uhci->lock);
402 if (uhci->rh_state >= UHCI_RH_RUNNING) { 401 if (uhci->rh_state >= UHCI_RH_RUNNING) {
403 dev_err(uhci_dev(uhci), 402 dev_err(uhci_dev(uhci),
404 "host controller halted, " 403 "host controller halted, "
@@ -415,16 +414,16 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
415 * pending unlinks */ 414 * pending unlinks */
416 mod_timer(&hcd->rh_timer, jiffies); 415 mod_timer(&hcd->rh_timer, jiffies);
417 } 416 }
418 spin_unlock_irqrestore(&uhci->lock, flags); 417 spin_unlock(&uhci->lock);
419 } 418 }
420 } 419 }
421 420
422 if (status & USBSTS_RD) 421 if (status & USBSTS_RD)
423 usb_hcd_poll_rh_status(hcd); 422 usb_hcd_poll_rh_status(hcd);
424 else { 423 else {
425 spin_lock_irqsave(&uhci->lock, flags); 424 spin_lock(&uhci->lock);
426 uhci_scan_schedule(uhci); 425 uhci_scan_schedule(uhci);
427 spin_unlock_irqrestore(&uhci->lock, flags); 426 spin_unlock(&uhci->lock);
428 } 427 }
429 428
430 return IRQ_HANDLED; 429 return IRQ_HANDLED;
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index 3a83cb4c4bc2..da16b5157816 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -71,6 +71,7 @@ static struct usb_device_id id_table [] = {
71 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 71 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
72 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ 72 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
73 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ 73 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
74 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
74 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 75 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
75 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 76 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
76 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 77 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
@@ -98,8 +99,8 @@ static struct usb_serial_driver cp2101_device = {
98 .usb_driver = &cp2101_driver, 99 .usb_driver = &cp2101_driver,
99 .id_table = id_table, 100 .id_table = id_table,
100 .num_interrupt_in = 0, 101 .num_interrupt_in = 0,
101 .num_bulk_in = 0, 102 .num_bulk_in = NUM_DONT_CARE,
102 .num_bulk_out = 0, 103 .num_bulk_out = NUM_DONT_CARE,
103 .num_ports = 1, 104 .num_ports = 1,
104 .open = cp2101_open, 105 .open = cp2101_open,
105 .close = cp2101_close, 106 .close = cp2101_close,
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 4590124cf888..d1185f53447b 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -158,8 +158,8 @@ static struct usb_device_id option_ids[] = {
158 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, 158 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) },
159 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, 159 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
160 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, 160 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) },
161 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) }, 161 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
162 { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS) }, 162 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
163 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1100) }, /* Novatel Merlin XS620/S640 */ 163 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1100) }, /* Novatel Merlin XS620/S640 */
164 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1110) }, /* Novatel Merlin S620 */ 164 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1110) }, /* Novatel Merlin S620 */
165 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1120) }, /* Novatel Merlin EX720 */ 165 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1120) }, /* Novatel Merlin EX720 */
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 605ebccdcd51..e5c274044a5f 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -100,6 +100,7 @@ static struct usb_device_id id_table [] = {
100 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 100 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
101 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ 101 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */
102 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 102 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
103 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
103 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 104 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
104 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 105 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
105 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ 106 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */
@@ -137,7 +138,6 @@ static struct usb_device_id id_table_3port [] = {
137 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 138 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
138 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 139 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
139 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ 140 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
140 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
141 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ 141 { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */
142 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ 142 { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */
143 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ 143 { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 836a34ae6ec6..7c9593b7b04e 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -114,9 +114,15 @@ static int slave_configure(struct scsi_device *sdev)
114 * while others have trouble with more than 64K. At this time we 114 * while others have trouble with more than 64K. At this time we
115 * are limiting both to 32K (64 sectores). 115 * are limiting both to 32K (64 sectores).
116 */ 116 */
117 if ((us->flags & US_FL_MAX_SECTORS_64) && 117 if (us->flags & (US_FL_MAX_SECTORS_64 | US_FL_MAX_SECTORS_MIN)) {
118 sdev->request_queue->max_sectors > 64) 118 unsigned int max_sectors = 64;
119 blk_queue_max_sectors(sdev->request_queue, 64); 119
120 if (us->flags & US_FL_MAX_SECTORS_MIN)
121 max_sectors = PAGE_CACHE_SIZE >> 9;
122 if (sdev->request_queue->max_sectors > max_sectors)
123 blk_queue_max_sectors(sdev->request_queue,
124 max_sectors);
125 }
120 126
121 /* We can't put these settings in slave_alloc() because that gets 127 /* We can't put these settings in slave_alloc() because that gets
122 * called before the device type is known. Consequently these 128 * called before the device type is known. Consequently these
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 2c27721bd259..6d6108b3993b 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -376,6 +376,13 @@ UNUSUAL_DEV( 0x04b0, 0x0417, 0x0100, 0x0100,
376 US_SC_DEVICE, US_PR_DEVICE, NULL, 376 US_SC_DEVICE, US_PR_DEVICE, NULL,
377 US_FL_FIX_CAPACITY), 377 US_FL_FIX_CAPACITY),
378 378
379/* Reported by Doug Maxey (dwm@austin.ibm.com) */
380UNUSUAL_DEV( 0x04b3, 0x4001, 0x0110, 0x0110,
381 "IBM",
382 "IBM RSA2",
383 US_SC_DEVICE, US_PR_CB, NULL,
384 US_FL_MAX_SECTORS_MIN),
385
379/* BENQ DC5330 386/* BENQ DC5330
380 * Reported by Manuel Fombuena <mfombuena@ya.com> and 387 * Reported by Manuel Fombuena <mfombuena@ya.com> and
381 * Frank Copeland <fjc@thingy.apana.org.au> */ 388 * Frank Copeland <fjc@thingy.apana.org.au> */
@@ -1258,14 +1265,6 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0101,
1258 US_SC_DEVICE, US_PR_DEVICE, NULL, 1265 US_SC_DEVICE, US_PR_DEVICE, NULL,
1259 US_FL_IGNORE_DEVICE ), 1266 US_FL_IGNORE_DEVICE ),
1260 1267
1261/* SanDisk that has a second LUN for a driver ISO, reported by
1262 * Ben Collins <bcollins@ubuntu.com> */
1263UNUSUAL_DEV( 0x0781, 0x5406, 0x0000, 0xffff,
1264 "SanDisk",
1265 "U3 Cruzer Micro driver ISO",
1266 US_SC_DEVICE, US_PR_DEVICE, NULL,
1267 US_FL_SINGLE_LUN ),
1268
1269#ifdef CONFIG_USB_STORAGE_ISD200 1268#ifdef CONFIG_USB_STORAGE_ISD200
1270UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, 1269UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110,
1271 "ATI", 1270 "ATI",
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c
index 9c56c492a693..b3128903d673 100644
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -51,7 +51,8 @@
51#define L1GPU_DISPLAY_SYNC_HSYNC 1 51#define L1GPU_DISPLAY_SYNC_HSYNC 1
52#define L1GPU_DISPLAY_SYNC_VSYNC 2 52#define L1GPU_DISPLAY_SYNC_VSYNC 2
53 53
54#define GPU_CMD_BUF_SIZE (64 * 1024) 54#define GPU_CMD_BUF_SIZE (2 * 1024 * 1024)
55#define GPU_FB_START (64 * 1024)
55#define GPU_IOIF (0x0d000000UL) 56#define GPU_IOIF (0x0d000000UL)
56#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) 57#define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64)
57#define GPU_MAX_LINE_LENGTH (65536 - 64) 58#define GPU_MAX_LINE_LENGTH (65536 - 64)
@@ -406,6 +407,7 @@ static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
406 if (src_line_length != dst_line_length) 407 if (src_line_length != dst_line_length)
407 line_length |= (u64)src_line_length << 32; 408 line_length |= (u64)src_line_length << 32;
408 409
410 src_offset += GPU_FB_START;
409 status = lv1_gpu_context_attribute(ps3fb.context_handle, 411 status = lv1_gpu_context_attribute(ps3fb.context_handle,
410 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT, 412 L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
411 dst_offset, GPU_IOIF + src_offset, 413 dst_offset, GPU_IOIF + src_offset,
@@ -976,9 +978,8 @@ static int ps3fb_xdr_settings(u64 xdr_lpar, struct device *dev)
976 978
977 status = lv1_gpu_context_attribute(ps3fb.context_handle, 979 status = lv1_gpu_context_attribute(ps3fb.context_handle,
978 L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP, 980 L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
979 xdr_lpar + ps3fb.xdr_size, 981 xdr_lpar, GPU_CMD_BUF_SIZE,
980 GPU_CMD_BUF_SIZE, 982 GPU_IOIF, 0);
981 GPU_IOIF + ps3fb.xdr_size, 0);
982 if (status) { 983 if (status) {
983 dev_err(dev, 984 dev_err(dev,
984 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n", 985 "%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n",
@@ -1061,6 +1062,11 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1061 struct task_struct *task; 1062 struct task_struct *task;
1062 unsigned long max_ps3fb_size; 1063 unsigned long max_ps3fb_size;
1063 1064
1065 if (ps3fb_videomemory.size < GPU_CMD_BUF_SIZE) {
1066 dev_err(&dev->core, "%s: Not enough video memory\n", __func__);
1067 return -ENOMEM;
1068 }
1069
1064 status = ps3_open_hv_device(dev); 1070 status = ps3_open_hv_device(dev);
1065 if (status) { 1071 if (status) {
1066 dev_err(&dev->core, "%s: ps3_open_hv_device failed\n", 1072 dev_err(&dev->core, "%s: ps3_open_hv_device failed\n",
@@ -1131,8 +1137,14 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev)
1131 /* Clear memory to prevent kernel info leakage into userspace */ 1137 /* Clear memory to prevent kernel info leakage into userspace */
1132 memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size); 1138 memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size);
1133 1139
1134 /* The GPU command buffer is at the end of video memory */ 1140 /*
1135 ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE; 1141 * The GPU command buffer is at the start of video memory
1142 * As we don't use the full command buffer, we can put the actual
1143 * frame buffer at offset GPU_FB_START and save some precious XDR
1144 * memory
1145 */
1146 ps3fb.xdr_ea += GPU_FB_START;
1147 ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START;
1136 1148
1137 retval = ps3fb_xdr_settings(xdr_lpar, &dev->core); 1149 retval = ps3fb_xdr_settings(xdr_lpar, &dev->core);
1138 if (retval) 1150 if (retval)
@@ -1200,7 +1212,7 @@ err_fb_dealloc:
1200err_framebuffer_release: 1212err_framebuffer_release:
1201 framebuffer_release(info); 1213 framebuffer_release(info);
1202err_free_irq: 1214err_free_irq:
1203 free_irq(ps3fb.irq_no, dev); 1215 free_irq(ps3fb.irq_no, &dev->core);
1204 ps3_irq_plug_destroy(ps3fb.irq_no); 1216 ps3_irq_plug_destroy(ps3fb.irq_no);
1205err_iounmap_dinfo: 1217err_iounmap_dinfo:
1206 iounmap((u8 __iomem *)ps3fb.dinfo); 1218 iounmap((u8 __iomem *)ps3fb.dinfo);
@@ -1235,7 +1247,7 @@ static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
1235 kthread_stop(task); 1247 kthread_stop(task);
1236 } 1248 }
1237 if (ps3fb.irq_no) { 1249 if (ps3fb.irq_no) {
1238 free_irq(ps3fb.irq_no, dev); 1250 free_irq(ps3fb.irq_no, &dev->core);
1239 ps3_irq_plug_destroy(ps3fb.irq_no); 1251 ps3_irq_plug_destroy(ps3fb.irq_no);
1240 } 1252 }
1241 iounmap((u8 __iomem *)ps3fb.dinfo); 1253 iounmap((u8 __iomem *)ps3fb.dinfo);
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 2792bc1a7269..52dff40ec192 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -392,6 +392,16 @@ config ITCO_VENDOR_SUPPORT
392 devices. At this moment we only have additional support for some 392 devices. At this moment we only have additional support for some
393 SuperMicro Inc. motherboards. 393 SuperMicro Inc. motherboards.
394 394
395config IT8712F_WDT
396 tristate "IT8712F (Smart Guardian) Watchdog Timer"
397 depends on X86
398 ---help---
399 This is the driver for the built-in watchdog timer on the IT8712F
400 Super I/0 chipset used on many motherboards.
401
402 To compile this driver as a module, choose M here: the
403 module will be called it8712f_wdt.
404
395config SC1200_WDT 405config SC1200_WDT
396 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" 406 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
397 depends on X86 407 depends on X86
@@ -456,6 +466,19 @@ config SBC8360_WDT
456 466
457 Most people will say N. 467 Most people will say N.
458 468
469config SBC7240_WDT
470 tristate "SBC Nano 7240 Watchdog Timer"
471 depends on X86_32
472 ---help---
473 This is the driver for the hardware watchdog found on the IEI
474 single board computers EPIC Nano 7240 (and likely others). This
475 watchdog simply watches your kernel to make sure it doesn't freeze,
476 and if it does, it reboots your computer after a certain amount of
477 time.
478
479 To compile this driver as a module, choose M here: the
480 module will be called sbc7240_wdt.
481
459config CPU5_WDT 482config CPU5_WDT
460 tristate "SMA CPU5 Watchdog" 483 tristate "SMA CPU5 Watchdog"
461 depends on X86 484 depends on X86
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 7d9e5734f8bb..87483cc63252 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -66,11 +66,13 @@ obj-$(CONFIG_IBMASR) += ibmasr.o
66obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o 66obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
67obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o 67obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
68obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o 68obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o iTCO_vendor_support.o
69obj-$(CONFIG_IT8712F_WDT) += it8712f_wdt.o
69obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 70obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
70obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 71obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
71obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o 72obj-$(CONFIG_PC87413_WDT) += pc87413_wdt.o
72obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o 73obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
73obj-$(CONFIG_SBC8360_WDT) += sbc8360.o 74obj-$(CONFIG_SBC8360_WDT) += sbc8360.o
75obj-$(CONFIG_SBC7240_WDT) += sbc7240_wdt.o
74obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o 76obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
75obj-$(CONFIG_SMSC37B787_WDT) += smsc37b787_wdt.o 77obj-$(CONFIG_SMSC37B787_WDT) += smsc37b787_wdt.o
76obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o 78obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
diff --git a/drivers/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index 54a516169d07..fb5ed6478f78 100644
--- a/drivers/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
@@ -6,6 +6,19 @@
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 *
10 *
11 * Errata: WDT Clear is blocked after WDT Reset
12 *
13 * A watchdog timer event will, after reset, block writes to the WDT_CLEAR
14 * register, preventing the program to clear the next Watchdog Timer Reset.
15 *
16 * If you still want to use the WDT after a WDT reset a small code can be
17 * insterted at the startup checking the AVR32_PM.rcause register for WDT reset
18 * and use a GPIO pin to reset the system. This method requires that one of the
19 * GPIO pins are available and connected externally to the RESET_N pin. After
20 * the GPIO pin has pulled down the reset line the GPIO will be reset and leave
21 * the pin tristated with pullup.
9 */ 22 */
10 23
11#include <linux/init.h> 24#include <linux/init.h>
@@ -44,6 +57,13 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
44 57
45#define WDT_CLR 0x04 58#define WDT_CLR 0x04
46 59
60#define WDT_RCAUSE 0x10
61#define WDT_RCAUSE_POR 0
62#define WDT_RCAUSE_EXT 2
63#define WDT_RCAUSE_WDT 3
64#define WDT_RCAUSE_JTAG 4
65#define WDT_RCAUSE_SERP 5
66
47#define WDT_BIT(name) (1 << WDT_##name) 67#define WDT_BIT(name) (1 << WDT_##name)
48#define WDT_BF(name, value) ((value) << WDT_##name) 68#define WDT_BF(name, value) ((value) << WDT_##name)
49 69
@@ -56,6 +76,7 @@ struct wdt_at32ap700x {
56 void __iomem *regs; 76 void __iomem *regs;
57 spinlock_t io_lock; 77 spinlock_t io_lock;
58 int timeout; 78 int timeout;
79 int boot_status;
59 unsigned long users; 80 unsigned long users;
60 struct miscdevice miscdev; 81 struct miscdevice miscdev;
61}; 82};
@@ -126,7 +147,7 @@ static int at32_wdt_close(struct inode *inode, struct file *file)
126 at32_wdt_stop(); 147 at32_wdt_stop();
127 } else { 148 } else {
128 dev_dbg(wdt->miscdev.parent, 149 dev_dbg(wdt->miscdev.parent,
129 "Unexpected close, not stopping watchdog!\n"); 150 "unexpected close, not stopping watchdog!\n");
130 at32_wdt_pat(); 151 at32_wdt_pat();
131 } 152 }
132 clear_bit(1, &wdt->users); 153 clear_bit(1, &wdt->users);
@@ -154,6 +175,33 @@ static int at32_wdt_settimeout(int time)
154 return 0; 175 return 0;
155} 176}
156 177
178/*
179 * Get the watchdog status.
180 */
181static int at32_wdt_get_status(void)
182{
183 int rcause;
184 int status = 0;
185
186 rcause = wdt_readl(wdt, RCAUSE);
187
188 switch (rcause) {
189 case WDT_BIT(RCAUSE_EXT):
190 status = WDIOF_EXTERN1;
191 break;
192 case WDT_BIT(RCAUSE_WDT):
193 status = WDIOF_CARDRESET;
194 break;
195 case WDT_BIT(RCAUSE_POR): /* fall through */
196 case WDT_BIT(RCAUSE_JTAG): /* fall through */
197 case WDT_BIT(RCAUSE_SERP): /* fall through */
198 default:
199 break;
200 }
201
202 return status;
203}
204
157static struct watchdog_info at32_wdt_info = { 205static struct watchdog_info at32_wdt_info = {
158 .identity = "at32ap700x watchdog", 206 .identity = "at32ap700x watchdog",
159 .options = WDIOF_SETTIMEOUT | 207 .options = WDIOF_SETTIMEOUT |
@@ -194,10 +242,12 @@ static int at32_wdt_ioctl(struct inode *inode, struct file *file,
194 case WDIOC_GETTIMEOUT: 242 case WDIOC_GETTIMEOUT:
195 ret = put_user(wdt->timeout, p); 243 ret = put_user(wdt->timeout, p);
196 break; 244 break;
197 case WDIOC_GETSTATUS: /* fall through */ 245 case WDIOC_GETSTATUS:
198 case WDIOC_GETBOOTSTATUS:
199 ret = put_user(0, p); 246 ret = put_user(0, p);
200 break; 247 break;
248 case WDIOC_GETBOOTSTATUS:
249 ret = put_user(wdt->boot_status, p);
250 break;
201 case WDIOC_SETOPTIONS: 251 case WDIOC_SETOPTIONS:
202 ret = get_user(time, p); 252 ret = get_user(time, p);
203 if (ret) 253 if (ret)
@@ -282,8 +332,19 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
282 dev_dbg(&pdev->dev, "could not map I/O memory\n"); 332 dev_dbg(&pdev->dev, "could not map I/O memory\n");
283 goto err_free; 333 goto err_free;
284 } 334 }
335
285 spin_lock_init(&wdt->io_lock); 336 spin_lock_init(&wdt->io_lock);
286 wdt->users = 0; 337 wdt->boot_status = at32_wdt_get_status();
338
339 /* Work-around for watchdog silicon errata. */
340 if (wdt->boot_status & WDIOF_CARDRESET) {
341 dev_info(&pdev->dev, "CPU must be reset with external "
342 "reset or POR due to silicon errata.\n");
343 ret = -EIO;
344 goto err_iounmap;
345 } else {
346 wdt->users = 0;
347 }
287 wdt->miscdev.minor = WATCHDOG_MINOR; 348 wdt->miscdev.minor = WATCHDOG_MINOR;
288 wdt->miscdev.name = "watchdog"; 349 wdt->miscdev.name = "watchdog";
289 wdt->miscdev.fops = &at32_wdt_fops; 350 wdt->miscdev.fops = &at32_wdt_fops;
diff --git a/drivers/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 309d27913fc1..31dc7a69e90c 100644
--- a/drivers/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
@@ -71,7 +71,7 @@ static int nowayout = WATCHDOG_NOWAYOUT;
71static struct watchdog_info bfin_wdt_info; 71static struct watchdog_info bfin_wdt_info;
72static unsigned long open_check; 72static unsigned long open_check;
73static char expect_close; 73static char expect_close;
74static spinlock_t bfin_wdt_spinlock = SPIN_LOCK_UNLOCKED; 74static DEFINE_SPINLOCK(bfin_wdt_spinlock);
75 75
76/** 76/**
77 * bfin_wdt_keepalive - Keep the Userspace Watchdog Alive 77 * bfin_wdt_keepalive - Keep the Userspace Watchdog Alive
diff --git a/drivers/watchdog/it8712f_wdt.c b/drivers/watchdog/it8712f_wdt.c
new file mode 100644
index 000000000000..6330fc02464e
--- /dev/null
+++ b/drivers/watchdog/it8712f_wdt.c
@@ -0,0 +1,400 @@
1/*
2 * IT8712F "Smart Guardian" Watchdog support
3 *
4 * Copyright (c) 2006-2007 Jorge Boncompte - DTI2 <jorge@dti2.net>
5 *
6 * Based on info and code taken from:
7 *
8 * drivers/char/watchdog/scx200_wdt.c
9 * drivers/hwmon/it87.c
10 * IT8712F EC-LPC I/O Preliminary Specification 0.9.2.pdf
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of the
15 * License, or (at your option) any later version.
16 *
17 * The author(s) of this software shall not be held liable for damages
18 * of any nature resulting due to the use of this software. This
19 * software is provided AS-IS with no warranties.
20 */
21
22#include <linux/module.h>
23#include <linux/moduleparam.h>
24#include <linux/init.h>
25#include <linux/miscdevice.h>
26#include <linux/watchdog.h>
27#include <linux/notifier.h>
28#include <linux/reboot.h>
29#include <linux/fs.h>
30#include <linux/pci.h>
31#include <linux/spinlock.h>
32
33#include <asm/uaccess.h>
34#include <asm/io.h>
35
36#define NAME "it8712f_wdt"
37
38MODULE_AUTHOR("Jorge Boncompte - DTI2 <jorge@dti2.net>");
39MODULE_DESCRIPTION("IT8712F Watchdog Driver");
40MODULE_LICENSE("GPL");
41MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
42
43static int margin = 60; /* in seconds */
44module_param(margin, int, 0);
45MODULE_PARM_DESC(margin, "Watchdog margin in seconds");
46
47static int nowayout = WATCHDOG_NOWAYOUT;
48module_param(nowayout, int, 0);
49MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");
50
51static struct semaphore it8712f_wdt_sem;
52static unsigned expect_close;
53static spinlock_t io_lock;
54
55/* Dog Food address - We use the game port address */
56static unsigned short address;
57
58#define REG 0x2e /* The register to read/write */
59#define VAL 0x2f /* The value to read/write */
60
61#define LDN 0x07 /* Register: Logical device select */
62#define DEVID 0x20 /* Register: Device ID */
63#define DEVREV 0x22 /* Register: Device Revision */
64#define ACT_REG 0x30 /* LDN Register: Activation */
65#define BASE_REG 0x60 /* LDN Register: Base address */
66
67#define IT8712F_DEVID 0x8712
68
69#define LDN_GPIO 0x07 /* GPIO and Watch Dog Timer */
70#define LDN_GAME 0x09 /* Game Port */
71
72#define WDT_CONTROL 0x71 /* WDT Register: Control */
73#define WDT_CONFIG 0x72 /* WDT Register: Configuration */
74#define WDT_TIMEOUT 0x73 /* WDT Register: Timeout Value */
75
76#define WDT_RESET_GAME 0x10
77#define WDT_RESET_KBD 0x20
78#define WDT_RESET_MOUSE 0x40
79#define WDT_RESET_CIR 0x80
80
81#define WDT_UNIT_SEC 0x80 /* If 0 in MINUTES */
82
83#define WDT_OUT_PWROK 0x10
84#define WDT_OUT_KRST 0x40
85
86static int
87superio_inb(int reg)
88{
89 outb(reg, REG);
90 return inb(VAL);
91}
92
93static void
94superio_outb(int val, int reg)
95{
96 outb(reg, REG);
97 outb(val, VAL);
98}
99
100static int
101superio_inw(int reg)
102{
103 int val;
104 outb(reg++, REG);
105 val = inb(VAL) << 8;
106 outb(reg, REG);
107 val |= inb(VAL);
108 return val;
109}
110
111static inline void
112superio_select(int ldn)
113{
114 outb(LDN, REG);
115 outb(ldn, VAL);
116}
117
118static inline void
119superio_enter(void)
120{
121 spin_lock(&io_lock);
122 outb(0x87, REG);
123 outb(0x01, REG);
124 outb(0x55, REG);
125 outb(0x55, REG);
126}
127
128static inline void
129superio_exit(void)
130{
131 outb(0x02, REG);
132 outb(0x02, VAL);
133 spin_unlock(&io_lock);
134}
135
136static inline void
137it8712f_wdt_ping(void)
138{
139 inb(address);
140}
141
142static void
143it8712f_wdt_update_margin(void)
144{
145 int config = WDT_OUT_KRST | WDT_OUT_PWROK;
146
147 printk(KERN_INFO NAME ": timer margin %d seconds\n", margin);
148
149 /* The timeout register only has 8bits wide */
150 if (margin < 256)
151 config |= WDT_UNIT_SEC; /* else UNIT are MINUTES */
152 superio_outb(config, WDT_CONFIG);
153
154 superio_outb((margin > 255) ? (margin / 60) : margin, WDT_TIMEOUT);
155}
156
157static void
158it8712f_wdt_enable(void)
159{
160 printk(KERN_DEBUG NAME ": enabling watchdog timer\n");
161 superio_enter();
162 superio_select(LDN_GPIO);
163
164 superio_outb(WDT_RESET_GAME, WDT_CONTROL);
165
166 it8712f_wdt_update_margin();
167
168 superio_exit();
169
170 it8712f_wdt_ping();
171}
172
173static void
174it8712f_wdt_disable(void)
175{
176 printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
177
178 superio_enter();
179 superio_select(LDN_GPIO);
180
181 superio_outb(0, WDT_CONFIG);
182 superio_outb(0, WDT_CONTROL);
183 superio_outb(0, WDT_TIMEOUT);
184
185 superio_exit();
186}
187
188static int
189it8712f_wdt_notify(struct notifier_block *this,
190 unsigned long code, void *unused)
191{
192 if (code == SYS_HALT || code == SYS_POWER_OFF)
193 if (!nowayout)
194 it8712f_wdt_disable();
195
196 return NOTIFY_DONE;
197}
198
199static struct notifier_block it8712f_wdt_notifier = {
200 .notifier_call = it8712f_wdt_notify,
201};
202
203static ssize_t
204it8712f_wdt_write(struct file *file, const char __user *data,
205 size_t len, loff_t *ppos)
206{
207 /* check for a magic close character */
208 if (len) {
209 size_t i;
210
211 it8712f_wdt_ping();
212
213 expect_close = 0;
214 for (i = 0; i < len; ++i) {
215 char c;
216 if (get_user(c, data+i))
217 return -EFAULT;
218 if (c == 'V')
219 expect_close = 42;
220 }
221 }
222
223 return len;
224}
225
226static int
227it8712f_wdt_ioctl(struct inode *inode, struct file *file,
228 unsigned int cmd, unsigned long arg)
229{
230 void __user *argp = (void __user *)arg;
231 int __user *p = argp;
232 static struct watchdog_info ident = {
233 .identity = "IT8712F Watchdog",
234 .firmware_version = 1,
235 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
236 };
237 int new_margin;
238
239 switch (cmd) {
240 default:
241 return -ENOTTY;
242 case WDIOC_GETSUPPORT:
243 if (copy_to_user(argp, &ident, sizeof(ident)))
244 return -EFAULT;
245 return 0;
246 case WDIOC_GETSTATUS:
247 case WDIOC_GETBOOTSTATUS:
248 return put_user(0, p);
249 case WDIOC_KEEPALIVE:
250 it8712f_wdt_ping();
251 return 0;
252 case WDIOC_SETTIMEOUT:
253 if (get_user(new_margin, p))
254 return -EFAULT;
255 if (new_margin < 1)
256 return -EINVAL;
257 margin = new_margin;
258 superio_enter();
259 superio_select(LDN_GPIO);
260
261 it8712f_wdt_update_margin();
262
263 superio_exit();
264 it8712f_wdt_ping();
265 case WDIOC_GETTIMEOUT:
266 if (put_user(margin, p))
267 return -EFAULT;
268 return 0;
269 }
270}
271
272static int
273it8712f_wdt_open(struct inode *inode, struct file *file)
274{
275 /* only allow one at a time */
276 if (down_trylock(&it8712f_wdt_sem))
277 return -EBUSY;
278 it8712f_wdt_enable();
279
280 return nonseekable_open(inode, file);
281}
282
283static int
284it8712f_wdt_release(struct inode *inode, struct file *file)
285{
286 if (expect_close != 42) {
287 printk(KERN_WARNING NAME
288 ": watchdog device closed unexpectedly, will not"
289 " disable the watchdog timer\n");
290 } else if (!nowayout) {
291 it8712f_wdt_disable();
292 }
293 expect_close = 0;
294 up(&it8712f_wdt_sem);
295
296 return 0;
297}
298
299static struct file_operations it8712f_wdt_fops = {
300 .owner = THIS_MODULE,
301 .llseek = no_llseek,
302 .write = it8712f_wdt_write,
303 .ioctl = it8712f_wdt_ioctl,
304 .open = it8712f_wdt_open,
305 .release = it8712f_wdt_release,
306};
307
308static struct miscdevice it8712f_wdt_miscdev = {
309 .minor = WATCHDOG_MINOR,
310 .name = "watchdog",
311 .fops = &it8712f_wdt_fops,
312};
313
314static int __init
315it8712f_wdt_find(unsigned short *address)
316{
317 int err = -ENODEV;
318 int chip_type;
319
320 superio_enter();
321 chip_type = superio_inw(DEVID);
322 if (chip_type != IT8712F_DEVID)
323 goto exit;
324
325 superio_select(LDN_GAME);
326 superio_outb(1, ACT_REG);
327 if (!(superio_inb(ACT_REG) & 0x01)) {
328 printk(KERN_ERR NAME ": Device not activated, skipping\n");
329 goto exit;
330 }
331
332 *address = superio_inw(BASE_REG);
333 if (*address == 0) {
334 printk(KERN_ERR NAME ": Base address not set, skipping\n");
335 goto exit;
336 }
337
338 err = 0;
339 printk(KERN_DEBUG NAME ": Found IT%04xF chip revision %d - "
340 "using DogFood address 0x%x\n",
341 chip_type, superio_inb(DEVREV) & 0x0f, *address);
342
343exit:
344 superio_exit();
345 return err;
346}
347
348static int __init
349it8712f_wdt_init(void)
350{
351 int err = 0;
352
353 spin_lock_init(&io_lock);
354
355 if (it8712f_wdt_find(&address))
356 return -ENODEV;
357
358 if (!request_region(address, 1, "IT8712F Watchdog")) {
359 printk(KERN_WARNING NAME ": watchdog I/O region busy\n");
360 return -EBUSY;
361 }
362
363 it8712f_wdt_disable();
364
365 sema_init(&it8712f_wdt_sem, 1);
366
367 err = register_reboot_notifier(&it8712f_wdt_notifier);
368 if (err) {
369 printk(KERN_ERR NAME ": unable to register reboot notifier\n");
370 goto out;
371 }
372
373 err = misc_register(&it8712f_wdt_miscdev);
374 if (err) {
375 printk(KERN_ERR NAME
376 ": cannot register miscdev on minor=%d (err=%d)\n",
377 WATCHDOG_MINOR, err);
378 goto reboot_out;
379 }
380
381 return 0;
382
383
384reboot_out:
385 unregister_reboot_notifier(&it8712f_wdt_notifier);
386out:
387 release_region(address, 1);
388 return err;
389}
390
391static void __exit
392it8712f_wdt_exit(void)
393{
394 misc_deregister(&it8712f_wdt_miscdev);
395 unregister_reboot_notifier(&it8712f_wdt_notifier);
396 release_region(address, 1);
397}
398
399module_init(it8712f_wdt_init);
400module_exit(it8712f_wdt_exit);
diff --git a/drivers/watchdog/sbc7240_wdt.c b/drivers/watchdog/sbc7240_wdt.c
new file mode 100644
index 000000000000..4c8cefbd8627
--- /dev/null
+++ b/drivers/watchdog/sbc7240_wdt.c
@@ -0,0 +1,324 @@
1/*
2 * NANO7240 SBC Watchdog device driver
3 *
4 * Based on w83877f.c by Scott Jennings,
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * Software distributed under the License is distributed on an "AS IS"
11 * basis, WITHOUT WARRANTY OF ANY KIND, either express or
12 * implied. See the License for the specific language governing
13 * rights and limitations under the License.
14 *
15 * (c) Copyright 2007 Gilles GIGAN <gilles.gigan@jcu.edu.au>
16 *
17 */
18
19#include <linux/fs.h>
20#include <linux/init.h>
21#include <linux/ioport.h>
22#include <linux/jiffies.h>
23#include <linux/module.h>
24#include <linux/moduleparam.h>
25#include <linux/miscdevice.h>
26#include <linux/notifier.h>
27#include <linux/reboot.h>
28#include <linux/types.h>
29#include <linux/watchdog.h>
30#include <asm/atomic.h>
31#include <asm/io.h>
32#include <asm/system.h>
33#include <asm/uaccess.h>
34
35#define SBC7240_PREFIX "sbc7240_wdt: "
36
37#define SBC7240_ENABLE_PORT 0x443
38#define SBC7240_DISABLE_PORT 0x043
39#define SBC7240_SET_TIMEOUT_PORT SBC7240_ENABLE_PORT
40#define SBC7240_MAGIC_CHAR 'V'
41
42#define SBC7240_TIMEOUT 30
43#define SBC7240_MAX_TIMEOUT 255
44static int timeout = SBC7240_TIMEOUT; /* in seconds */
45module_param(timeout, int, 0);
46MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<="
47 __MODULE_STRING(SBC7240_MAX_TIMEOUT) ", default="
48 __MODULE_STRING(SBC7240_TIMEOUT) ")");
49
50static int nowayout = WATCHDOG_NOWAYOUT;
51module_param(nowayout, int, 0);
52MODULE_PARM_DESC(nowayout, "Disable watchdog when closing device file");
53
54#define SBC7240_OPEN_STATUS_BIT 0
55#define SBC7240_ENABLED_STATUS_BIT 1
56#define SBC7240_EXPECT_CLOSE_STATUS_BIT 2
57static unsigned long wdt_status;
58
59/*
60 * Utility routines
61 */
62
63static void wdt_disable(void)
64{
65 /* disable the watchdog */
66 if (test_and_clear_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) {
67 inb_p(SBC7240_DISABLE_PORT);
68 printk(KERN_INFO SBC7240_PREFIX
69 "Watchdog timer is now disabled.\n");
70 }
71}
72
73static void wdt_enable(void)
74{
75 /* enable the watchdog */
76 if (!test_and_set_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status)) {
77 inb_p(SBC7240_ENABLE_PORT);
78 printk(KERN_INFO SBC7240_PREFIX
79 "Watchdog timer is now enabled.\n");
80 }
81}
82
83static int wdt_set_timeout(int t)
84{
85 if (t < 1 || t > SBC7240_MAX_TIMEOUT) {
86 printk(KERN_ERR SBC7240_PREFIX
87 "timeout value must be 1<=x<=%d\n",
88 SBC7240_MAX_TIMEOUT);
89 return -1;
90 }
91 /* set the timeout */
92 outb_p((unsigned)t, SBC7240_SET_TIMEOUT_PORT);
93 timeout = t;
94 printk(KERN_INFO SBC7240_PREFIX "timeout set to %d seconds\n", t);
95 return 0;
96}
97
98/* Whack the dog */
99static inline void wdt_keepalive(void)
100{
101 if (test_bit(SBC7240_ENABLED_STATUS_BIT, &wdt_status))
102 inb_p(SBC7240_ENABLE_PORT);
103}
104
105/*
106 * /dev/watchdog handling
107 */
108static ssize_t fop_write(struct file *file, const char __user *buf,
109 size_t count, loff_t *ppos)
110{
111 size_t i;
112 char c;
113
114 if (count) {
115 if (!nowayout) {
116 clear_bit(SBC7240_EXPECT_CLOSE_STATUS_BIT,
117 &wdt_status);
118
119 /* is there a magic char ? */
120 for (i = 0; i != count; i++) {
121 if (get_user(c, buf + i))
122 return -EFAULT;
123 if (c == SBC7240_MAGIC_CHAR) {
124 set_bit(SBC7240_EXPECT_CLOSE_STATUS_BIT,
125 &wdt_status);
126 break;
127 }
128 }
129 }
130
131 wdt_keepalive();
132 }
133
134 return count;
135}
136
137static int fop_open(struct inode *inode, struct file *file)
138{
139 if (test_and_set_bit(SBC7240_OPEN_STATUS_BIT, &wdt_status))
140 return -EBUSY;
141
142 wdt_enable();
143
144 return nonseekable_open(inode, file);
145}
146
147static int fop_close(struct inode *inode, struct file *file)
148{
149 if (test_and_clear_bit(SBC7240_EXPECT_CLOSE_STATUS_BIT, &wdt_status)
150 || !nowayout) {
151 wdt_disable();
152 } else {
153 printk(KERN_CRIT SBC7240_PREFIX
154 "Unexpected close, not stopping watchdog!\n");
155 wdt_keepalive();
156 }
157
158 clear_bit(SBC7240_OPEN_STATUS_BIT, &wdt_status);
159 return 0;
160}
161
162static struct watchdog_info ident = {
163 .options = WDIOF_KEEPALIVEPING|
164 WDIOF_SETTIMEOUT|
165 WDIOF_MAGICCLOSE,
166 .firmware_version = 1,
167 .identity = "SBC7240",
168};
169
170
171static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
172 unsigned long arg)
173{
174 switch (cmd) {
175 case WDIOC_GETSUPPORT:
176 return copy_to_user
177 ((void __user *)arg, &ident, sizeof(ident))
178 ? -EFAULT : 0;
179 case WDIOC_GETSTATUS:
180 case WDIOC_GETBOOTSTATUS:
181 return put_user(0, (int __user *)arg);
182 case WDIOC_KEEPALIVE:
183 wdt_keepalive();
184 return 0;
185 case WDIOC_SETOPTIONS:{
186 int options;
187 int retval = -EINVAL;
188
189 if (get_user(options, (int __user *)arg))
190 return -EFAULT;
191
192 if (options & WDIOS_DISABLECARD) {
193 wdt_disable();
194 retval = 0;
195 }
196
197 if (options & WDIOS_ENABLECARD) {
198 wdt_enable();
199 retval = 0;
200 }
201
202 return retval;
203 }
204 case WDIOC_SETTIMEOUT:{
205 int new_timeout;
206
207 if (get_user(new_timeout, (int __user *)arg))
208 return -EFAULT;
209
210 if (wdt_set_timeout(new_timeout))
211 return -EINVAL;
212
213 /* Fall through */
214 }
215 case WDIOC_GETTIMEOUT:
216 return put_user(timeout, (int __user *)arg);
217 default:
218 return -ENOTTY;
219 }
220}
221
222static const struct file_operations wdt_fops = {
223 .owner = THIS_MODULE,
224 .llseek = no_llseek,
225 .write = fop_write,
226 .open = fop_open,
227 .release = fop_close,
228 .ioctl = fop_ioctl,
229};
230
231static struct miscdevice wdt_miscdev = {
232 .minor = WATCHDOG_MINOR,
233 .name = "watchdog",
234 .fops = &wdt_fops,
235};
236
237/*
238 * Notifier for system down
239 */
240
241static int wdt_notify_sys(struct notifier_block *this, unsigned long code,
242 void *unused)
243{
244 if (code == SYS_DOWN || code == SYS_HALT)
245 wdt_disable();
246 return NOTIFY_DONE;
247}
248
249static struct notifier_block wdt_notifier = {
250 .notifier_call = wdt_notify_sys,
251};
252
253static void __exit sbc7240_wdt_unload(void)
254{
255 printk(KERN_INFO SBC7240_PREFIX "Removing watchdog\n");
256 misc_deregister(&wdt_miscdev);
257
258 unregister_reboot_notifier(&wdt_notifier);
259 release_region(SBC7240_ENABLE_PORT, 1);
260}
261
262static int __init sbc7240_wdt_init(void)
263{
264 int rc = -EBUSY;
265
266 if (!request_region(SBC7240_ENABLE_PORT, 1, "SBC7240 WDT")) {
267 printk(KERN_ERR SBC7240_PREFIX
268 "I/O address 0x%04x already in use\n",
269 SBC7240_ENABLE_PORT);
270 rc = -EIO;
271 goto err_out;
272 }
273
274 /* The IO port 0x043 used to disable the watchdog
275 * is already claimed by the system timer, so we
276 * cant request_region() it ...*/
277
278 if (timeout < 1 || timeout > SBC7240_MAX_TIMEOUT) {
279 timeout = SBC7240_TIMEOUT;
280 printk(KERN_INFO SBC7240_PREFIX
281 "timeout value must be 1<=x<=%d, using %d\n",
282 SBC7240_MAX_TIMEOUT, timeout);
283 }
284 wdt_set_timeout(timeout);
285 wdt_disable();
286
287 rc = register_reboot_notifier(&wdt_notifier);
288 if (rc) {
289 printk(KERN_ERR SBC7240_PREFIX
290 "cannot register reboot notifier (err=%d)\n", rc);
291 goto err_out_region;
292 }
293
294 rc = misc_register(&wdt_miscdev);
295 if (rc) {
296 printk(KERN_ERR SBC7240_PREFIX
297 "cannot register miscdev on minor=%d (err=%d)\n",
298 wdt_miscdev.minor, rc);
299 goto err_out_reboot_notifier;
300 }
301
302 printk(KERN_INFO SBC7240_PREFIX
303 "Watchdog driver for SBC7240 initialised (nowayout=%d)\n",
304 nowayout);
305
306 return 0;
307
308err_out_reboot_notifier:
309 unregister_reboot_notifier(&wdt_notifier);
310err_out_region:
311 release_region(SBC7240_ENABLE_PORT, 1);
312err_out:
313 return rc;
314}
315
316module_init(sbc7240_wdt_init);
317module_exit(sbc7240_wdt_unload);
318
319MODULE_AUTHOR("Gilles Gigan");
320MODULE_DESCRIPTION("Watchdog device driver for single board"
321 " computers EPIC Nano 7240 from iEi");
322MODULE_LICENSE("GPL");
323MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
324
diff --git a/drivers/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index c622a0e6c9ae..6ea125eabeaa 100644
--- a/drivers/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -382,8 +382,10 @@ 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 }
387 } 389 }
388 } else { 390 } else {
389 if (!w83697hf_check_wdt()) 391 if (!w83697hf_check_wdt())
diff --git a/fs/Kconfig b/fs/Kconfig
index 635f3e286ad8..487236c65837 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1305,7 +1305,7 @@ config JFFS2_COMPRESSION_OPTIONS
1305 help 1305 help
1306 Enabling this option allows you to explicitly choose which 1306 Enabling this option allows you to explicitly choose which
1307 compression modules, if any, are enabled in JFFS2. Removing 1307 compression modules, if any, are enabled in JFFS2. Removing
1308 compressors and mean you cannot read existing file systems, 1308 compressors can mean you cannot read existing file systems,
1309 and enabling experimental compressors can mean that you 1309 and enabling experimental compressors can mean that you
1310 write a file system which cannot be read by a standard kernel. 1310 write a file system which cannot be read by a standard kernel.
1311 1311
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index e176d195e7e5..7596e1e94cde 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -319,7 +319,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
319 current->mm->free_area_cache = current->mm->mmap_base; 319 current->mm->free_area_cache = current->mm->mmap_base;
320 current->mm->cached_hole_size = 0; 320 current->mm->cached_hole_size = 0;
321 321
322 current->mm->mmap = NULL;
323 compute_creds(bprm); 322 compute_creds(bprm);
324 current->flags &= ~PF_FORKNOEXEC; 323 current->flags &= ~PF_FORKNOEXEC;
325#ifdef __sparc__ 324#ifdef __sparc__
diff --git a/fs/dquot.c b/fs/dquot.c
index 2809768d9c41..686ab63a7c6c 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -965,7 +965,7 @@ err_out:
965} 965}
966#endif 966#endif
967 967
968static inline void flush_warnings(struct dquot **dquots, char *warntype) 968static inline void flush_warnings(struct dquot * const *dquots, char *warntype)
969{ 969{
970 int i; 970 int i;
971 971
@@ -1216,7 +1216,7 @@ warn_put_all:
1216 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 1216 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1217 if (inode->i_dquot[cnt]) 1217 if (inode->i_dquot[cnt])
1218 mark_dquot_dirty(inode->i_dquot[cnt]); 1218 mark_dquot_dirty(inode->i_dquot[cnt]);
1219 flush_warnings((struct dquot **)inode->i_dquot, warntype); 1219 flush_warnings(inode->i_dquot, warntype);
1220 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); 1220 up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
1221 return ret; 1221 return ret;
1222} 1222}
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 263fed88c0ca..f458c1f35565 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -1860,7 +1860,7 @@ ecryptfs_add_global_auth_tok(struct ecryptfs_mount_crypt_stat *mount_crypt_stat,
1860 struct ecryptfs_global_auth_tok *new_auth_tok; 1860 struct ecryptfs_global_auth_tok *new_auth_tok;
1861 int rc = 0; 1861 int rc = 0;
1862 1862
1863 new_auth_tok = kmem_cache_alloc(ecryptfs_global_auth_tok_cache, 1863 new_auth_tok = kmem_cache_zalloc(ecryptfs_global_auth_tok_cache,
1864 GFP_KERNEL); 1864 GFP_KERNEL);
1865 if (!new_auth_tok) { 1865 if (!new_auth_tok) {
1866 rc = -ENOMEM; 1866 rc = -ENOMEM;
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index b83a512b7e08..a277754da171 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -523,6 +523,7 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
523 lower_mnt = nd.mnt; 523 lower_mnt = nd.mnt;
524 ecryptfs_set_superblock_lower(sb, lower_root->d_sb); 524 ecryptfs_set_superblock_lower(sb, lower_root->d_sb);
525 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 525 sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
526 sb->s_blocksize = lower_root->d_sb->s_blocksize;
526 ecryptfs_set_dentry_lower(sb->s_root, lower_root); 527 ecryptfs_set_dentry_lower(sb->s_root, lower_root);
527 ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt); 528 ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt);
528 rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0); 529 rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0);
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 16a7a555f392..32c5711d79a3 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -263,14 +263,13 @@ out:
263 return 0; 263 return 0;
264} 264}
265 265
266/* This function must zero any hole we create */
266static int ecryptfs_prepare_write(struct file *file, struct page *page, 267static int ecryptfs_prepare_write(struct file *file, struct page *page,
267 unsigned from, unsigned to) 268 unsigned from, unsigned to)
268{ 269{
269 int rc = 0; 270 int rc = 0;
271 loff_t prev_page_end_size;
270 272
271 if (from == 0 && to == PAGE_CACHE_SIZE)
272 goto out; /* If we are writing a full page, it will be
273 up to date. */
274 if (!PageUptodate(page)) { 273 if (!PageUptodate(page)) {
275 rc = ecryptfs_read_lower_page_segment(page, page->index, 0, 274 rc = ecryptfs_read_lower_page_segment(page, page->index, 0,
276 PAGE_CACHE_SIZE, 275 PAGE_CACHE_SIZE,
@@ -283,22 +282,32 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page,
283 } else 282 } else
284 SetPageUptodate(page); 283 SetPageUptodate(page);
285 } 284 }
286 if (page->index != 0) {
287 loff_t end_of_prev_pg_pos =
288 (((loff_t)page->index << PAGE_CACHE_SHIFT) - 1);
289 285
290 if (end_of_prev_pg_pos > i_size_read(page->mapping->host)) { 286 prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT);
287
288 /*
289 * If creating a page or more of holes, zero them out via truncate.
290 * Note, this will increase i_size.
291 */
292 if (page->index != 0) {
293 if (prev_page_end_size > i_size_read(page->mapping->host)) {
291 rc = ecryptfs_truncate(file->f_path.dentry, 294 rc = ecryptfs_truncate(file->f_path.dentry,
292 end_of_prev_pg_pos); 295 prev_page_end_size);
293 if (rc) { 296 if (rc) {
294 printk(KERN_ERR "Error on attempt to " 297 printk(KERN_ERR "Error on attempt to "
295 "truncate to (higher) offset [%lld];" 298 "truncate to (higher) offset [%lld];"
296 " rc = [%d]\n", end_of_prev_pg_pos, rc); 299 " rc = [%d]\n", prev_page_end_size, rc);
297 goto out; 300 goto out;
298 } 301 }
299 } 302 }
300 if (end_of_prev_pg_pos + 1 > i_size_read(page->mapping->host)) 303 }
301 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0); 304 /*
305 * Writing to a new page, and creating a small hole from start of page?
306 * Zero it out.
307 */
308 if ((i_size_read(page->mapping->host) == prev_page_end_size) &&
309 (from != 0)) {
310 zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
302 } 311 }
303out: 312out:
304 return rc; 313 return rc;
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
index 6b7474a4336a..948f57624c05 100644
--- a/fs/ecryptfs/read_write.c
+++ b/fs/ecryptfs/read_write.c
@@ -124,6 +124,10 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
124 loff_t pos; 124 loff_t pos;
125 int rc = 0; 125 int rc = 0;
126 126
127 /*
128 * if we are writing beyond current size, then start pos
129 * at the current size - we'll fill in zeros from there.
130 */
127 if (offset > ecryptfs_file_size) 131 if (offset > ecryptfs_file_size)
128 pos = ecryptfs_file_size; 132 pos = ecryptfs_file_size;
129 else 133 else
@@ -137,6 +141,7 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
137 if (num_bytes > total_remaining_bytes) 141 if (num_bytes > total_remaining_bytes)
138 num_bytes = total_remaining_bytes; 142 num_bytes = total_remaining_bytes;
139 if (pos < offset) { 143 if (pos < offset) {
144 /* remaining zeros to write, up to destination offset */
140 size_t total_remaining_zeros = (offset - pos); 145 size_t total_remaining_zeros = (offset - pos);
141 146
142 if (num_bytes > total_remaining_zeros) 147 if (num_bytes > total_remaining_zeros)
@@ -167,17 +172,27 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset,
167 } 172 }
168 } 173 }
169 ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); 174 ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0);
175
176 /*
177 * pos: where we're now writing, offset: where the request was
178 * If current pos is before request, we are filling zeros
179 * If we are at or beyond request, we are writing the *data*
180 * If we're in a fresh page beyond eof, zero it in either case
181 */
182 if (pos < offset || !start_offset_in_page) {
183 /* We are extending past the previous end of the file.
184 * Fill in zero values to the end of the page */
185 memset(((char *)ecryptfs_page_virt
186 + start_offset_in_page), 0,
187 PAGE_CACHE_SIZE - start_offset_in_page);
188 }
189
190 /* pos >= offset, we are now writing the data request */
170 if (pos >= offset) { 191 if (pos >= offset) {
171 memcpy(((char *)ecryptfs_page_virt 192 memcpy(((char *)ecryptfs_page_virt
172 + start_offset_in_page), 193 + start_offset_in_page),
173 (data + data_offset), num_bytes); 194 (data + data_offset), num_bytes);
174 data_offset += num_bytes; 195 data_offset += num_bytes;
175 } else {
176 /* We are extending past the previous end of the file.
177 * Fill in zero values up to the start of where we
178 * will be writing data. */
179 memset(((char *)ecryptfs_page_virt
180 + start_offset_in_page), 0, num_bytes);
181 } 196 }
182 kunmap_atomic(ecryptfs_page_virt, KM_USER0); 197 kunmap_atomic(ecryptfs_page_virt, KM_USER0);
183 flush_dcache_page(ecryptfs_page); 198 flush_dcache_page(ecryptfs_page);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index de55da9e28ba..cb14de1502c3 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1676,7 +1676,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1676 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); 1676 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
1677 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group); 1677 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group);
1678 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); 1678 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
1679 if (EXT3_INODE_SIZE(sb) == 0) 1679 if (EXT3_INODE_SIZE(sb) == 0 || EXT3_INODES_PER_GROUP(sb) == 0)
1680 goto cantfind_ext3; 1680 goto cantfind_ext3;
1681 sbi->s_inodes_per_block = blocksize / EXT3_INODE_SIZE(sb); 1681 sbi->s_inodes_per_block = blocksize / EXT3_INODE_SIZE(sb);
1682 if (sbi->s_inodes_per_block == 0) 1682 if (sbi->s_inodes_per_block == 0)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8031dc0e24e5..1ca0f546c466 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1797,7 +1797,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1797 sbi->s_desc_size = EXT4_MIN_DESC_SIZE; 1797 sbi->s_desc_size = EXT4_MIN_DESC_SIZE;
1798 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); 1798 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
1799 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); 1799 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
1800 if (EXT4_INODE_SIZE(sb) == 0) 1800 if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0)
1801 goto cantfind_ext4; 1801 goto cantfind_ext4;
1802 sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb); 1802 sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);
1803 if (sbi->s_inodes_per_block == 0) 1803 if (sbi->s_inodes_per_block == 0)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 70587f383f10..a6f625497612 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -410,9 +410,6 @@ static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
410 */ 410 */
411static void nfs_destroy_server(struct nfs_server *server) 411static void nfs_destroy_server(struct nfs_server *server)
412{ 412{
413 if (!IS_ERR(server->client_acl))
414 rpc_shutdown_client(server->client_acl);
415
416 if (!(server->flags & NFS_MOUNT_NONLM)) 413 if (!(server->flags & NFS_MOUNT_NONLM))
417 lockd_down(); /* release rpc.lockd */ 414 lockd_down(); /* release rpc.lockd */
418} 415}
@@ -755,6 +752,9 @@ void nfs_free_server(struct nfs_server *server)
755 752
756 if (server->destroy != NULL) 753 if (server->destroy != NULL)
757 server->destroy(server); 754 server->destroy(server);
755
756 if (!IS_ERR(server->client_acl))
757 rpc_shutdown_client(server->client_acl);
758 if (!IS_ERR(server->client)) 758 if (!IS_ERR(server->client))
759 rpc_shutdown_client(server->client); 759 rpc_shutdown_client(server->client);
760 760
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 5e8d82f6666b..3c9d16b4f80c 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -894,8 +894,6 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
894 retval = generic_write_checks(file, &pos, &count, 0); 894 retval = generic_write_checks(file, &pos, &count, 0);
895 if (retval) 895 if (retval)
896 goto out; 896 goto out;
897 if (!count)
898 goto out; /* return 0 */
899 897
900 retval = -EINVAL; 898 retval = -EINVAL;
901 if ((ssize_t) count < 0) 899 if ((ssize_t) count < 0)
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index 0ee43843f4ec..e6242cdbaf91 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -57,6 +57,17 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i
57 } 57 }
58 /* Circumvent igrab(): we know the inode is not being freed */ 58 /* Circumvent igrab(): we know the inode is not being freed */
59 atomic_inc(&inode->i_count); 59 atomic_inc(&inode->i_count);
60 /*
61 * Ensure that this dentry is invisible to d_find_alias().
62 * Otherwise, it may be spliced into the tree by
63 * d_materialise_unique if a parent directory from the same
64 * filesystem gets mounted at a later time.
65 * This again causes shrink_dcache_for_umount_subtree() to
66 * Oops, since the test for IS_ROOT() will fail.
67 */
68 spin_lock(&dcache_lock);
69 list_del_init(&sb->s_root->d_alias);
70 spin_unlock(&dcache_lock);
60 } 71 }
61 return 0; 72 return 0;
62} 73}
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2426e713b77f..ea929207f274 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 != &nfs_dir_inode_operations) { 1478 if (mntroot->d_inode->i_op != server->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;
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index ce62c152823d..23c8cda43f19 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -2389,6 +2389,18 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2389 goto out; 2389 goto out;
2390 } 2390 }
2391 2391
2392 /*
2393 * Caller might still want to make changes to the
2394 * tree root, so re-add it to the journal here.
2395 */
2396 ret = ocfs2_journal_access(handle, inode,
2397 path_root_bh(left_path),
2398 OCFS2_JOURNAL_ACCESS_WRITE);
2399 if (ret) {
2400 mlog_errno(ret);
2401 goto out;
2402 }
2403
2392 ret = ocfs2_rotate_subtree_left(inode, handle, left_path, 2404 ret = ocfs2_rotate_subtree_left(inode, handle, left_path,
2393 right_path, subtree_root, 2405 right_path, subtree_root,
2394 dealloc, &deleted); 2406 dealloc, &deleted);
@@ -3289,16 +3301,6 @@ static int ocfs2_insert_path(struct inode *inode,
3289 int ret, subtree_index; 3301 int ret, subtree_index;
3290 struct buffer_head *leaf_bh = path_leaf_bh(right_path); 3302 struct buffer_head *leaf_bh = path_leaf_bh(right_path);
3291 3303
3292 /*
3293 * Pass both paths to the journal. The majority of inserts
3294 * will be touching all components anyway.
3295 */
3296 ret = ocfs2_journal_access_path(inode, handle, right_path);
3297 if (ret < 0) {
3298 mlog_errno(ret);
3299 goto out;
3300 }
3301
3302 if (left_path) { 3304 if (left_path) {
3303 int credits = handle->h_buffer_credits; 3305 int credits = handle->h_buffer_credits;
3304 3306
@@ -3323,6 +3325,16 @@ static int ocfs2_insert_path(struct inode *inode,
3323 } 3325 }
3324 } 3326 }
3325 3327
3328 /*
3329 * Pass both paths to the journal. The majority of inserts
3330 * will be touching all components anyway.
3331 */
3332 ret = ocfs2_journal_access_path(inode, handle, right_path);
3333 if (ret < 0) {
3334 mlog_errno(ret);
3335 goto out;
3336 }
3337
3326 if (insert->ins_split != SPLIT_NONE) { 3338 if (insert->ins_split != SPLIT_NONE) {
3327 /* 3339 /*
3328 * We could call ocfs2_insert_at_leaf() for some types 3340 * We could call ocfs2_insert_at_leaf() for some types
@@ -3331,6 +3343,17 @@ static int ocfs2_insert_path(struct inode *inode,
3331 */ 3343 */
3332 ocfs2_split_record(inode, left_path, right_path, 3344 ocfs2_split_record(inode, left_path, right_path,
3333 insert_rec, insert->ins_split); 3345 insert_rec, insert->ins_split);
3346
3347 /*
3348 * Split might have modified either leaf and we don't
3349 * have a guarantee that the later edge insert will
3350 * dirty this for us.
3351 */
3352 if (left_path)
3353 ret = ocfs2_journal_dirty(handle,
3354 path_leaf_bh(left_path));
3355 if (ret)
3356 mlog_errno(ret);
3334 } else 3357 } else
3335 ocfs2_insert_at_leaf(insert_rec, path_leaf_el(right_path), 3358 ocfs2_insert_at_leaf(insert_rec, path_leaf_el(right_path),
3336 insert, inode); 3359 insert, inode);
@@ -3430,6 +3453,17 @@ static int ocfs2_do_insert_extent(struct inode *inode,
3430 mlog_errno(ret); 3453 mlog_errno(ret);
3431 goto out; 3454 goto out;
3432 } 3455 }
3456
3457 /*
3458 * ocfs2_rotate_tree_right() might have extended the
3459 * transaction without re-journaling our tree root.
3460 */
3461 ret = ocfs2_journal_access(handle, inode, di_bh,
3462 OCFS2_JOURNAL_ACCESS_WRITE);
3463 if (ret) {
3464 mlog_errno(ret);
3465 goto out;
3466 }
3433 } else if (type->ins_appending == APPEND_TAIL 3467 } else if (type->ins_appending == APPEND_TAIL
3434 && type->ins_contig != CONTIG_LEFT) { 3468 && type->ins_contig != CONTIG_LEFT) {
3435 ret = ocfs2_append_rec_to_path(inode, handle, insert_rec, 3469 ret = ocfs2_append_rec_to_path(inode, handle, insert_rec,
@@ -3941,7 +3975,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
3941{ 3975{
3942 int ret = 0; 3976 int ret = 0;
3943 struct ocfs2_extent_list *el = path_leaf_el(path); 3977 struct ocfs2_extent_list *el = path_leaf_el(path);
3944 struct buffer_head *eb_bh, *last_eb_bh = NULL; 3978 struct buffer_head *last_eb_bh = NULL;
3945 struct ocfs2_extent_rec *rec = &el->l_recs[split_index]; 3979 struct ocfs2_extent_rec *rec = &el->l_recs[split_index];
3946 struct ocfs2_merge_ctxt ctxt; 3980 struct ocfs2_merge_ctxt ctxt;
3947 struct ocfs2_extent_list *rightmost_el; 3981 struct ocfs2_extent_list *rightmost_el;
@@ -3960,14 +3994,6 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
3960 goto out; 3994 goto out;
3961 } 3995 }
3962 3996
3963 eb_bh = path_leaf_bh(path);
3964 ret = ocfs2_journal_access(handle, inode, eb_bh,
3965 OCFS2_JOURNAL_ACCESS_WRITE);
3966 if (ret) {
3967 mlog_errno(ret);
3968 goto out;
3969 }
3970
3971 ctxt.c_contig_type = ocfs2_figure_merge_contig_type(inode, el, 3997 ctxt.c_contig_type = ocfs2_figure_merge_contig_type(inode, el,
3972 split_index, 3998 split_index,
3973 split_rec); 3999 split_rec);
@@ -4029,8 +4055,6 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
4029 mlog_errno(ret); 4055 mlog_errno(ret);
4030 } 4056 }
4031 4057
4032 ocfs2_journal_dirty(handle, eb_bh);
4033
4034out: 4058out:
4035 brelse(last_eb_bh); 4059 brelse(last_eb_bh);
4036 return ret; 4060 return ret;
@@ -6093,8 +6117,6 @@ start:
6093 mlog(0, "clusters_to_del = %u in this pass, tail blk=%llu\n", 6117 mlog(0, "clusters_to_del = %u in this pass, tail blk=%llu\n",
6094 clusters_to_del, (unsigned long long)path_leaf_bh(path)->b_blocknr); 6118 clusters_to_del, (unsigned long long)path_leaf_bh(path)->b_blocknr);
6095 6119
6096 BUG_ON(clusters_to_del == 0);
6097
6098 mutex_lock(&tl_inode->i_mutex); 6120 mutex_lock(&tl_inode->i_mutex);
6099 tl_sem = 1; 6121 tl_sem = 1;
6100 /* ocfs2_truncate_log_needs_flush guarantees us at least one 6122 /* ocfs2_truncate_log_needs_flush guarantees us at least one
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index f9d01e25298d..8d81f6c1b877 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -174,6 +174,12 @@ int ocfs2_commit_trans(struct ocfs2_super *osb,
174 * transaction. extend_trans will either extend the current handle by 174 * transaction. extend_trans will either extend the current handle by
175 * nblocks, or commit it and start a new one with nblocks credits. 175 * nblocks, or commit it and start a new one with nblocks credits.
176 * 176 *
177 * This might call journal_restart() which will commit dirty buffers
178 * and then restart the transaction. Before calling
179 * ocfs2_extend_trans(), any changed blocks should have been
180 * dirtied. After calling it, all blocks which need to be changed must
181 * go through another set of journal_access/journal_dirty calls.
182 *
177 * WARNING: This will not release any semaphores or disk locks taken 183 * WARNING: This will not release any semaphores or disk locks taken
178 * during the transaction, so make sure they were taken *before* 184 * during the transaction, so make sure they were taken *before*
179 * start_trans or we'll have ordering deadlocks. 185 * start_trans or we'll have ordering deadlocks.
@@ -193,11 +199,15 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks)
193 199
194 mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); 200 mlog(0, "Trying to extend transaction by %d blocks\n", nblocks);
195 201
202#ifdef OCFS2_DEBUG_FS
203 status = 1;
204#else
196 status = journal_extend(handle, nblocks); 205 status = journal_extend(handle, nblocks);
197 if (status < 0) { 206 if (status < 0) {
198 mlog_errno(status); 207 mlog_errno(status);
199 goto bail; 208 goto bail;
200 } 209 }
210#endif
201 211
202 if (status > 0) { 212 if (status > 0) {
203 mlog(0, "journal_extend failed, trying journal_restart\n"); 213 mlog(0, "journal_extend failed, trying journal_restart\n");
@@ -1277,11 +1287,12 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb,
1277 ocfs2_orphan_filldir); 1287 ocfs2_orphan_filldir);
1278 if (status) { 1288 if (status) {
1279 mlog_errno(status); 1289 mlog_errno(status);
1280 goto out; 1290 goto out_cluster;
1281 } 1291 }
1282 1292
1283 *head = priv.head; 1293 *head = priv.head;
1284 1294
1295out_cluster:
1285 ocfs2_meta_unlock(orphan_dir_inode, 0); 1296 ocfs2_meta_unlock(orphan_dir_inode, 0);
1286out: 1297out:
1287 mutex_unlock(&orphan_dir_inode->i_mutex); 1298 mutex_unlock(&orphan_dir_inode->i_mutex);
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 54c564693d93..4847eb83fc18 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -347,6 +347,7 @@ xfs_file_readdir(
347 347
348 size = buf.used; 348 size = buf.used;
349 de = (struct hack_dirent *)buf.dirent; 349 de = (struct hack_dirent *)buf.dirent;
350 curr_offset = de->offset /* & 0x7fffffff */;
350 while (size > 0) { 351 while (size > 0) {
351 if (filldir(dirent, de->name, de->namlen, 352 if (filldir(dirent, de->name, de->namlen,
352 curr_offset & 0x7fffffff, 353 curr_offset & 0x7fffffff,
@@ -356,13 +357,13 @@ xfs_file_readdir(
356 357
357 reclen = sizeof(struct hack_dirent) + de->namlen; 358 reclen = sizeof(struct hack_dirent) + de->namlen;
358 size -= reclen; 359 size -= reclen;
359 curr_offset = de->offset /* & 0x7fffffff */;
360 de = (struct hack_dirent *)((char *)de + reclen); 360 de = (struct hack_dirent *)((char *)de + reclen);
361 curr_offset = de->offset /* & 0x7fffffff */;
361 } 362 }
362 } 363 }
363 364
364 done: 365 done:
365 if (!error) { 366 if (!error) {
366 if (size == 0) 367 if (size == 0)
367 filp->f_pos = offset & 0x7fffffff; 368 filp->f_pos = offset & 0x7fffffff;
368 else if (de) 369 else if (de)
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 37e116779eb1..5e8bb7f71b5a 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -332,9 +332,7 @@ xfs_vn_mknod(
332 ASSERT(vp); 332 ASSERT(vp);
333 ip = vn_to_inode(vp); 333 ip = vn_to_inode(vp);
334 334
335 if (S_ISCHR(mode) || S_ISBLK(mode)) 335 if (S_ISDIR(mode))
336 ip->i_rdev = rdev;
337 else if (S_ISDIR(mode))
338 xfs_validate_fields(ip); 336 xfs_validate_fields(ip);
339 d_instantiate(dentry, ip); 337 d_instantiate(dentry, ip);
340 xfs_validate_fields(dir); 338 xfs_validate_fields(dir);
diff --git a/fs/xfs/xfs_dir2_block.c b/fs/xfs/xfs_dir2_block.c
index c171767e242a..a5f4f4fb8868 100644
--- a/fs/xfs/xfs_dir2_block.c
+++ b/fs/xfs/xfs_dir2_block.c
@@ -508,7 +508,7 @@ xfs_dir2_block_getdents(
508 continue; 508 continue;
509 509
510 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, 510 cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
511 ptr - (char *)block); 511 (char *)dep - (char *)block);
512 ino = be64_to_cpu(dep->inumber); 512 ino = be64_to_cpu(dep->inumber);
513#if XFS_BIG_INUMS 513#if XFS_BIG_INUMS
514 ino += mp->m_inoadd; 514 ino += mp->m_inoadd;
@@ -519,9 +519,7 @@ xfs_dir2_block_getdents(
519 */ 519 */
520 if (filldir(dirent, dep->name, dep->namelen, cook, 520 if (filldir(dirent, dep->name, dep->namelen, cook,
521 ino, DT_UNKNOWN)) { 521 ino, DT_UNKNOWN)) {
522 *offset = xfs_dir2_db_off_to_dataptr(mp, 522 *offset = cook;
523 mp->m_dirdatablk,
524 (char *)dep - (char *)block);
525 xfs_da_brelse(NULL, bp); 523 xfs_da_brelse(NULL, bp);
526 return 0; 524 return 0;
527 } 525 }
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index e7c12fa1303e..0ca0020ba09f 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -1091,7 +1091,7 @@ xfs_dir2_leaf_getdents(
1091 * Won't fit. Return to caller. 1091 * Won't fit. Return to caller.
1092 */ 1092 */
1093 if (filldir(dirent, dep->name, dep->namelen, 1093 if (filldir(dirent, dep->name, dep->namelen,
1094 xfs_dir2_byte_to_dataptr(mp, curoff + length), 1094 xfs_dir2_byte_to_dataptr(mp, curoff),
1095 ino, DT_UNKNOWN)) 1095 ino, DT_UNKNOWN))
1096 break; 1096 break;
1097 1097
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
index 182c70315ad1..919d275a1cef 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -752,7 +752,7 @@ xfs_dir2_sf_getdents(
752#if XFS_BIG_INUMS 752#if XFS_BIG_INUMS
753 ino += mp->m_inoadd; 753 ino += mp->m_inoadd;
754#endif 754#endif
755 if (filldir(dirent, ".", 1, dotdot_offset, ino, DT_DIR)) { 755 if (filldir(dirent, ".", 1, dot_offset, ino, DT_DIR)) {
756 *offset = dot_offset; 756 *offset = dot_offset;
757 return 0; 757 return 0;
758 } 758 }
@@ -762,13 +762,11 @@ xfs_dir2_sf_getdents(
762 * Put .. entry unless we're starting past it. 762 * Put .. entry unless we're starting past it.
763 */ 763 */
764 if (*offset <= dotdot_offset) { 764 if (*offset <= dotdot_offset) {
765 off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
766 XFS_DIR2_DATA_FIRST_OFFSET);
767 ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent); 765 ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
768#if XFS_BIG_INUMS 766#if XFS_BIG_INUMS
769 ino += mp->m_inoadd; 767 ino += mp->m_inoadd;
770#endif 768#endif
771 if (filldir(dirent, "..", 2, off, ino, DT_DIR)) { 769 if (filldir(dirent, "..", 2, dotdot_offset, ino, DT_DIR)) {
772 *offset = dotdot_offset; 770 *offset = dotdot_offset;
773 return 0; 771 return 0;
774 } 772 }
@@ -793,8 +791,7 @@ xfs_dir2_sf_getdents(
793#endif 791#endif
794 792
795 if (filldir(dirent, sfep->name, sfep->namelen, 793 if (filldir(dirent, sfep->name, sfep->namelen,
796 off + xfs_dir2_data_entsize(sfep->namelen), 794 off, ino, DT_UNKNOWN)) {
797 ino, DT_UNKNOWN)) {
798 *offset = off; 795 *offset = off;
799 return 0; 796 return 0;
800 } 797 }
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index abf509a88915..344948082819 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1459,8 +1459,10 @@ xfs_itruncate_start(
1459 mp = ip->i_mount; 1459 mp = ip->i_mount;
1460 vp = XFS_ITOV(ip); 1460 vp = XFS_ITOV(ip);
1461 1461
1462 vn_iowait(ip); /* wait for the completion of any pending DIOs */ 1462 /* wait for the completion of any pending DIOs */
1463 1463 if (new_size < ip->i_size)
1464 vn_iowait(ip);
1465
1464 /* 1466 /*
1465 * Call toss_pages or flushinval_pages to get rid of pages 1467 * Call toss_pages or flushinval_pages to get rid of pages
1466 * overlapping the region being removed. We have to use 1468 * overlapping the region being removed. We have to use
diff --git a/include/asm-alpha/io_trivial.h b/include/asm-alpha/io_trivial.h
index b10d1aa4cdd1..1c77f10b4b36 100644
--- a/include/asm-alpha/io_trivial.h
+++ b/include/asm-alpha/io_trivial.h
@@ -72,25 +72,29 @@ IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
72__EXTERN_INLINE u8 72__EXTERN_INLINE u8
73IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a) 73IO_CONCAT(__IO_PREFIX,readb)(const volatile void __iomem *a)
74{ 74{
75 return IO_CONCAT(__IO_PREFIX,ioread8)((void __iomem *)a); 75 void __iomem *addr = (void __iomem *)a;
76 return IO_CONCAT(__IO_PREFIX,ioread8)(addr);
76} 77}
77 78
78__EXTERN_INLINE u16 79__EXTERN_INLINE u16
79IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a) 80IO_CONCAT(__IO_PREFIX,readw)(const volatile void __iomem *a)
80{ 81{
81 return IO_CONCAT(__IO_PREFIX,ioread16)((void __iomem *)a); 82 void __iomem *addr = (void __iomem *)a;
83 return IO_CONCAT(__IO_PREFIX,ioread16)(addr);
82} 84}
83 85
84__EXTERN_INLINE void 86__EXTERN_INLINE void
85IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a) 87IO_CONCAT(__IO_PREFIX,writeb)(u8 b, volatile void __iomem *a)
86{ 88{
87 IO_CONCAT(__IO_PREFIX,iowrite8)(b, (void __iomem *)a); 89 void __iomem *addr = (void __iomem *)a;
90 IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr);
88} 91}
89 92
90__EXTERN_INLINE void 93__EXTERN_INLINE void
91IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a) 94IO_CONCAT(__IO_PREFIX,writew)(u16 b, volatile void __iomem *a)
92{ 95{
93 IO_CONCAT(__IO_PREFIX,iowrite16)(b, (void __iomem *)a); 96 void __iomem *addr = (void __iomem *)a;
97 IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr);
94} 98}
95#endif 99#endif
96 100
diff --git a/include/asm-arm/arch-pxa/pxa-regs.h b/include/asm-arm/arch-pxa/pxa-regs.h
index 6b33df6f1995..1bd398da07da 100644
--- a/include/asm-arm/arch-pxa/pxa-regs.h
+++ b/include/asm-arm/arch-pxa/pxa-regs.h
@@ -1784,6 +1784,7 @@
1784#define CCCR_M_MASK 0x0060 /* Memory Frequency to Run Mode Frequency Multiplier */ 1784#define CCCR_M_MASK 0x0060 /* Memory Frequency to Run Mode Frequency Multiplier */
1785#define CCCR_L_MASK 0x001f /* Crystal Frequency to Memory Frequency Multiplier */ 1785#define CCCR_L_MASK 0x001f /* Crystal Frequency to Memory Frequency Multiplier */
1786 1786
1787#define CKEN_AC97CONF (31) /* AC97 Controller Configuration */
1787#define CKEN_CAMERA (24) /* Camera Interface Clock Enable */ 1788#define CKEN_CAMERA (24) /* Camera Interface Clock Enable */
1788#define CKEN_SSP1 (23) /* SSP1 Unit Clock Enable */ 1789#define CKEN_SSP1 (23) /* SSP1 Unit Clock Enable */
1789#define CKEN_MEMC (22) /* Memory Controller Clock Enable */ 1790#define CKEN_MEMC (22) /* Memory Controller Clock Enable */
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
index f490e43a90b9..799307eea40f 100644
--- a/include/asm-generic/tlb.h
+++ b/include/asm-generic/tlb.h
@@ -14,6 +14,7 @@
14#define _ASM_GENERIC__TLB_H 14#define _ASM_GENERIC__TLB_H
15 15
16#include <linux/swap.h> 16#include <linux/swap.h>
17#include <linux/quicklist.h>
17#include <asm/pgalloc.h> 18#include <asm/pgalloc.h>
18#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
19 20
@@ -85,6 +86,9 @@ tlb_flush_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
85static inline void 86static inline void
86tlb_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)
87{ 88{
89#ifdef CONFIG_QUICKLIST
90 tlb->need_flush += &__get_cpu_var(quicklist)[0].nr_pages != 0;
91#endif
88 tlb_flush_mmu(tlb, start, end); 92 tlb_flush_mmu(tlb, start, end);
89 93
90 /* keep the page table cache within bounds */ 94 /* keep the page table cache within bounds */
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index a977affaebec..a1b9719f5fbb 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -124,10 +124,21 @@ clear_bit_unlock (int nr, volatile void *addr)
124/** 124/**
125 * __clear_bit_unlock - Non-atomically clear a bit with release 125 * __clear_bit_unlock - Non-atomically clear a bit with release
126 * 126 *
127 * This is like clear_bit_unlock, but the implementation may use a non-atomic 127 * This is like clear_bit_unlock, but the implementation uses a store
128 * store (this one uses an atomic, however). 128 * with release semantics. See also __raw_spin_unlock().
129 */ 129 */
130#define __clear_bit_unlock clear_bit_unlock 130static __inline__ void
131__clear_bit_unlock(int nr, volatile void *addr)
132{
133 __u32 mask, new;
134 volatile __u32 *m;
135
136 m = (volatile __u32 *)addr + (nr >> 5);
137 mask = ~(1 << (nr & 31));
138 new = *m & mask;
139 barrier();
140 ia64_st4_rel_nta(m, new);
141}
131 142
132/** 143/**
133 * __clear_bit - Clears a bit in memory (non-atomic version) 144 * __clear_bit - Clears a bit in memory (non-atomic version)
diff --git a/include/asm-ia64/gcc_intrin.h b/include/asm-ia64/gcc_intrin.h
index 4fb4e439b05c..e58d3298fa10 100644
--- a/include/asm-ia64/gcc_intrin.h
+++ b/include/asm-ia64/gcc_intrin.h
@@ -191,6 +191,11 @@ register unsigned long ia64_r13 asm ("r13") __attribute_used__;
191 asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \ 191 asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \
192}) 192})
193 193
194#define ia64_st4_rel_nta(m, val) \
195({ \
196 asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(val)); \
197})
198
194#define ia64_stfs(x, regnum) \ 199#define ia64_stfs(x, regnum) \
195({ \ 200({ \
196 register double __f__ asm ("f"#regnum); \ 201 register double __f__ asm ("f"#regnum); \
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index bba5baa3c7fc..7e6e3779670a 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -63,7 +63,7 @@ extern int ia64_last_device_vector;
63#define IA64_NUM_DEVICE_VECTORS (IA64_LAST_DEVICE_VECTOR - IA64_FIRST_DEVICE_VECTOR + 1) 63#define IA64_NUM_DEVICE_VECTORS (IA64_LAST_DEVICE_VECTOR - IA64_FIRST_DEVICE_VECTOR + 1)
64 64
65#define IA64_MCA_RENDEZ_VECTOR 0xe8 /* MCA rendez interrupt */ 65#define IA64_MCA_RENDEZ_VECTOR 0xe8 /* MCA rendez interrupt */
66#define IA64_PERFMON_VECTOR 0xee /* performanc monitor interrupt vector */ 66#define IA64_PERFMON_VECTOR 0xee /* performance monitor interrupt vector */
67#define IA64_TIMER_VECTOR 0xef /* use highest-prio group 15 interrupt for timer */ 67#define IA64_TIMER_VECTOR 0xef /* use highest-prio group 15 interrupt for timer */
68#define IA64_MCA_WAKEUP_VECTOR 0xf0 /* MCA wakeup (must be >MCA_RENDEZ_VECTOR) */ 68#define IA64_MCA_WAKEUP_VECTOR 0xf0 /* MCA wakeup (must be >MCA_RENDEZ_VECTOR) */
69#define IA64_IPI_LOCAL_TLB_FLUSH 0xfc /* SMP flush local TLB */ 69#define IA64_IPI_LOCAL_TLB_FLUSH 0xfc /* SMP flush local TLB */
diff --git a/include/asm-ia64/intel_intrin.h b/include/asm-ia64/intel_intrin.h
index d069b6acddce..a520d103d808 100644
--- a/include/asm-ia64/intel_intrin.h
+++ b/include/asm-ia64/intel_intrin.h
@@ -110,6 +110,9 @@
110#define ia64_st4_rel __st4_rel 110#define ia64_st4_rel __st4_rel
111#define ia64_st8_rel __st8_rel 111#define ia64_st8_rel __st8_rel
112 112
113/* FIXME: need st4.rel.nta intrinsic */
114#define ia64_st4_rel_nta __st4_rel
115
113#define ia64_ld1_acq __ld1_acq 116#define ia64_ld1_acq __ld1_acq
114#define ia64_ld2_acq __ld2_acq 117#define ia64_ld2_acq __ld2_acq
115#define ia64_ld4_acq __ld4_acq 118#define ia64_ld4_acq __ld4_acq
diff --git a/include/asm-ia64/sn/bte.h b/include/asm-ia64/sn/bte.h
index 5335d87ca5f8..a0d214f43115 100644
--- a/include/asm-ia64/sn/bte.h
+++ b/include/asm-ia64/sn/bte.h
@@ -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) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -150,6 +150,35 @@ typedef enum {
150 BTEFAIL_NOTAVAIL, /* BTE not available */ 150 BTEFAIL_NOTAVAIL, /* BTE not available */
151} bte_result_t; 151} bte_result_t;
152 152
153#define BTEFAIL_SH2_RESP_SHORT 0x1 /* bit 000001 */
154#define BTEFAIL_SH2_RESP_LONG 0x2 /* bit 000010 */
155#define BTEFAIL_SH2_RESP_DSP 0x4 /* bit 000100 */
156#define BTEFAIL_SH2_RESP_ACCESS 0x8 /* bit 001000 */
157#define BTEFAIL_SH2_CRB_TO 0x10 /* bit 010000 */
158#define BTEFAIL_SH2_NACK_LIMIT 0x20 /* bit 100000 */
159#define BTEFAIL_SH2_ALL 0x3F /* bit 111111 */
160
161#define BTE_ERR_BITS 0x3FUL
162#define BTE_ERR_SHIFT 36
163#define BTE_ERR_MASK (BTE_ERR_BITS << BTE_ERR_SHIFT)
164
165#define BTE_ERROR_RETRY(value) \
166 (is_shub2() ? (value != BTEFAIL_SH2_CRB_TO) \
167 : (value != BTEFAIL_TOUT))
168
169/*
170 * On shub1 BTE_ERR_MASK will always be false, so no need for is_shub2()
171 */
172#define BTE_SHUB2_ERROR(_status) \
173 ((_status & BTE_ERR_MASK) \
174 ? (((_status >> BTE_ERR_SHIFT) & BTE_ERR_BITS) | IBLS_ERROR) \
175 : _status)
176
177#define BTE_GET_ERROR_STATUS(_status) \
178 (BTE_SHUB2_ERROR(_status) & ~IBLS_ERROR)
179
180#define BTE_VALID_SH2_ERROR(value) \
181 ((value >= BTEFAIL_SH2_RESP_SHORT) && (value <= BTEFAIL_SH2_ALL))
153 182
154/* 183/*
155 * Structure defining a bte. An instance of this 184 * Structure defining a bte. An instance of this
diff --git a/include/asm-ia64/sn/xp.h b/include/asm-ia64/sn/xp.h
index 6f807e0193b7..f7711b308e48 100644
--- a/include/asm-ia64/sn/xp.h
+++ b/include/asm-ia64/sn/xp.h
@@ -86,7 +86,7 @@ xp_bte_copy(u64 src, u64 vdst, u64 len, u64 mode, void *notification)
86 BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL); 86 BUG_ON(REGION_NUMBER(vdst) != RGN_KERNEL);
87 87
88 ret = bte_copy(src, pdst, len, mode, notification); 88 ret = bte_copy(src, pdst, len, mode, notification);
89 if (ret != BTE_SUCCESS) { 89 if ((ret != BTE_SUCCESS) && BTE_ERROR_RETRY(ret)) {
90 if (!in_interrupt()) { 90 if (!in_interrupt()) {
91 cond_resched(); 91 cond_resched();
92 } 92 }
@@ -244,7 +244,30 @@ enum xpc_retval {
244 244
245 xpcDisconnected, /* 51: channel disconnected (closed) */ 245 xpcDisconnected, /* 51: channel disconnected (closed) */
246 246
247 xpcUnknownReason /* 52: unknown reason -- must be last in list */ 247 xpcBteSh2Start, /* 52: BTE CRB timeout */
248
249 /* 53: 0x1 BTE Error Response Short */
250 xpcBteSh2RspShort = xpcBteSh2Start + BTEFAIL_SH2_RESP_SHORT,
251
252 /* 54: 0x2 BTE Error Response Long */
253 xpcBteSh2RspLong = xpcBteSh2Start + BTEFAIL_SH2_RESP_LONG,
254
255 /* 56: 0x4 BTE Error Response DSB */
256 xpcBteSh2RspDSB = xpcBteSh2Start + BTEFAIL_SH2_RESP_DSP,
257
258 /* 60: 0x8 BTE Error Response Access */
259 xpcBteSh2RspAccess = xpcBteSh2Start + BTEFAIL_SH2_RESP_ACCESS,
260
261 /* 68: 0x10 BTE Error CRB timeout */
262 xpcBteSh2CRBTO = xpcBteSh2Start + BTEFAIL_SH2_CRB_TO,
263
264 /* 84: 0x20 BTE Error NACK limit */
265 xpcBteSh2NACKLimit = xpcBteSh2Start + BTEFAIL_SH2_NACK_LIMIT,
266
267 /* 115: BTE end */
268 xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL,
269
270 xpcUnknownReason /* 116: unknown reason -- must be last in list */
248}; 271};
249 272
250 273
diff --git a/include/asm-ia64/sn/xpc.h b/include/asm-ia64/sn/xpc.h
index e52b8508083b..8e5d7de9c632 100644
--- a/include/asm-ia64/sn/xpc.h
+++ b/include/asm-ia64/sn/xpc.h
@@ -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-2006 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -1211,6 +1211,12 @@ 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 (is_shub2()) {
1215 if (BTE_VALID_SH2_ERROR(error))
1216 return xpcBteSh2Start + error;
1217 else
1218 return xpcBteUnmappedError;
1219 }
1214 switch (error) { 1220 switch (error) {
1215 case BTE_SUCCESS: return xpcSuccess; 1221 case BTE_SUCCESS: return xpcSuccess;
1216 case BTEFAIL_DIR: return xpcBteDirectoryError; 1222 case BTEFAIL_DIR: return xpcBteDirectoryError;
diff --git a/include/asm-ia64/tlbflush.h b/include/asm-ia64/tlbflush.h
index 80bcb0a38e8a..7774a1cac0cc 100644
--- a/include/asm-ia64/tlbflush.h
+++ b/include/asm-ia64/tlbflush.h
@@ -92,6 +92,10 @@ void smp_local_flush_tlb(void);
92#define smp_local_flush_tlb() 92#define smp_local_flush_tlb()
93#endif 93#endif
94 94
95#define flush_tlb_kernel_range(start, end) flush_tlb_all() /* XXX fix me */ 95static inline void flush_tlb_kernel_range(unsigned long start,
96 unsigned long end)
97{
98 flush_tlb_all(); /* XXX fix me */
99}
96 100
97#endif /* _ASM_IA64_TLBFLUSH_H */ 101#endif /* _ASM_IA64_TLBFLUSH_H */
diff --git a/include/asm-mips/mach-au1x00/au1000.h b/include/asm-mips/mach-au1x00/au1000.h
index bf7701243d71..cb18af989645 100644
--- a/include/asm-mips/mach-au1x00/au1000.h
+++ b/include/asm-mips/mach-au1x00/au1000.h
@@ -1680,10 +1680,11 @@ enum soc_au1200_ints {
1680#define Au1500_PCI_MEM_START 0x440000000ULL 1680#define Au1500_PCI_MEM_START 0x440000000ULL
1681#define Au1500_PCI_MEM_END 0x44FFFFFFFULL 1681#define Au1500_PCI_MEM_END 0x44FFFFFFFULL
1682 1682
1683#define PCI_IO_START (Au1500_PCI_IO_START + 0x1000) 1683#define PCI_IO_START 0x00001000
1684#define PCI_IO_END (Au1500_PCI_IO_END) 1684#define PCI_IO_END 0x000FFFFF
1685#define PCI_MEM_START (Au1500_PCI_MEM_START) 1685#define PCI_MEM_START 0x40000000
1686#define PCI_MEM_END (Au1500_PCI_MEM_END) 1686#define PCI_MEM_END 0x4FFFFFFF
1687
1687#define PCI_FIRST_DEVFN (0<<3) 1688#define PCI_FIRST_DEVFN (0<<3)
1688#define PCI_LAST_DEVFN (19<<3) 1689#define PCI_LAST_DEVFN (19<<3)
1689 1690
diff --git a/include/asm-powerpc/commproc.h b/include/asm-powerpc/commproc.h
index a2328b8addd8..2ee59d7b335c 100644
--- a/include/asm-powerpc/commproc.h
+++ b/include/asm-powerpc/commproc.h
@@ -698,9 +698,6 @@ typedef struct risc_timer_pram {
698#define CICR_IEN ((uint)0x00000080) /* Int. enable */ 698#define CICR_IEN ((uint)0x00000080) /* Int. enable */
699#define CICR_SPS ((uint)0x00000001) /* SCC Spread */ 699#define CICR_SPS ((uint)0x00000001) /* SCC Spread */
700 700
701extern void cpm_install_handler(int vec, void (*handler)(void *), void *dev_id);
702extern void cpm_free_handler(int vec);
703
704#define IMAP_ADDR (get_immrbase()) 701#define IMAP_ADDR (get_immrbase())
705 702
706#define CPM_PIN_INPUT 0 703#define CPM_PIN_INPUT 0
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index f2cc25b74adf..1f530f8a6280 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -453,12 +453,12 @@ static inline int pgd_bad(pgd_t pgd) { return 0; }
453 453
454static inline int pud_present(pud_t pud) 454static inline int pud_present(pud_t pud)
455{ 455{
456 return pud_val(pud) & _REGION_ENTRY_ORIGIN; 456 return (pud_val(pud) & _REGION_ENTRY_ORIGIN) != 0UL;
457} 457}
458 458
459static inline int pud_none(pud_t pud) 459static inline int pud_none(pud_t pud)
460{ 460{
461 return pud_val(pud) & _REGION_ENTRY_INV; 461 return (pud_val(pud) & _REGION_ENTRY_INV) != 0UL;
462} 462}
463 463
464static inline int pud_bad(pud_t pud) 464static inline int pud_bad(pud_t pud)
@@ -471,12 +471,12 @@ static inline int pud_bad(pud_t pud)
471 471
472static inline int pmd_present(pmd_t pmd) 472static inline int pmd_present(pmd_t pmd)
473{ 473{
474 return pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN; 474 return (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) != 0UL;
475} 475}
476 476
477static inline int pmd_none(pmd_t pmd) 477static inline int pmd_none(pmd_t pmd)
478{ 478{
479 return pmd_val(pmd) & _SEGMENT_ENTRY_INV; 479 return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
480} 480}
481 481
482static inline int pmd_bad(pmd_t pmd) 482static inline int pmd_bad(pmd_t pmd)
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 029b3e0d5e4c..0decdf763716 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -333,6 +333,15 @@
333 333
334#define NR_SYSCALLS 315 334#define NR_SYSCALLS 315
335 335
336/* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
337 * it never had the plain ones and there is no value to adding those
338 * old versions into the syscall table.
339 */
340#define __IGNORE_setresuid
341#define __IGNORE_getresuid
342#define __IGNORE_setresgid
343#define __IGNORE_getresgid
344
336#ifdef __KERNEL__ 345#ifdef __KERNEL__
337#define __ARCH_WANT_IPC_PARSE_VERSION 346#define __ARCH_WANT_IPC_PARSE_VERSION
338#define __ARCH_WANT_OLD_READDIR 347#define __ARCH_WANT_OLD_READDIR
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/hypervisor.h b/include/asm-sparc64/hypervisor.h
index 524d49835dfd..3ad45dff52f8 100644
--- a/include/asm-sparc64/hypervisor.h
+++ b/include/asm-sparc64/hypervisor.h
@@ -709,6 +709,10 @@ extern unsigned long sun4v_mmu_tsb_ctx0(unsigned long num_descriptions,
709 */ 709 */
710#define HV_FAST_MMU_DEMAP_ALL 0x24 710#define HV_FAST_MMU_DEMAP_ALL 0x24
711 711
712#ifndef __ASSEMBLY__
713extern void sun4v_mmu_demap_all(void);
714#endif
715
712/* mmu_map_perm_addr() 716/* mmu_map_perm_addr()
713 * TRAP: HV_FAST_TRAP 717 * TRAP: HV_FAST_TRAP
714 * FUNCTION: HV_FAST_MMU_MAP_PERM_ADDR 718 * FUNCTION: HV_FAST_MMU_MAP_PERM_ADDR
diff --git a/include/asm-x86/kprobes_32.h b/include/asm-x86/kprobes_32.h
index b772d5b38685..9fe8f3bddfd5 100644
--- a/include/asm-x86/kprobes_32.h
+++ b/include/asm-x86/kprobes_32.h
@@ -73,7 +73,7 @@ struct kprobe_ctlblk {
73 unsigned long kprobe_status; 73 unsigned long kprobe_status;
74 unsigned long kprobe_old_eflags; 74 unsigned long kprobe_old_eflags;
75 unsigned long kprobe_saved_eflags; 75 unsigned long kprobe_saved_eflags;
76 long *jprobe_saved_esp; 76 unsigned long *jprobe_saved_esp;
77 struct pt_regs jprobe_saved_regs; 77 struct pt_regs jprobe_saved_regs;
78 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; 78 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
79 struct prev_kprobe prev_kprobe; 79 struct prev_kprobe prev_kprobe;
diff --git a/include/asm-x86/kprobes_64.h b/include/asm-x86/kprobes_64.h
index 53f4d8507354..743d76218fc9 100644
--- a/include/asm-x86/kprobes_64.h
+++ b/include/asm-x86/kprobes_64.h
@@ -66,7 +66,7 @@ struct kprobe_ctlblk {
66 unsigned long kprobe_status; 66 unsigned long kprobe_status;
67 unsigned long kprobe_old_rflags; 67 unsigned long kprobe_old_rflags;
68 unsigned long kprobe_saved_rflags; 68 unsigned long kprobe_saved_rflags;
69 long *jprobe_saved_rsp; 69 unsigned long *jprobe_saved_rsp;
70 struct pt_regs jprobe_saved_regs; 70 struct pt_regs jprobe_saved_regs;
71 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; 71 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
72 struct prev_kprobe prev_kprobe; 72 struct prev_kprobe prev_kprobe;
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h
index 4cb23848d460..6e9e4841a2da 100644
--- a/include/asm-x86/system_64.h
+++ b/include/asm-x86/system_64.h
@@ -7,6 +7,13 @@
7 7
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10/* entries in ARCH_DLINFO: */
11#ifdef CONFIG_IA32_EMULATION
12# define AT_VECTOR_SIZE_ARCH 2
13#else
14# define AT_VECTOR_SIZE_ARCH 1
15#endif
16
10#define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t" 17#define __SAVE(reg,offset) "movq %%" #reg ",(14-" #offset ")*8(%%rsp)\n\t"
11#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t" 18#define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
12 19
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 37bfa19d8064..9abf5a806c15 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -145,7 +145,6 @@ header-y += sound.h
145header-y += taskstats.h 145header-y += taskstats.h
146header-y += telephony.h 146header-y += telephony.h
147header-y += termios.h 147header-y += termios.h
148header-y += ticable.h
149header-y += times.h 148header-y += times.h
150header-y += tiocl.h 149header-y += tiocl.h
151header-y += tipc.h 150header-y += tipc.h
diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h
index 9754baa14921..01a6244c9bc9 100644
--- a/include/linux/apm_bios.h
+++ b/include/linux/apm_bios.h
@@ -18,6 +18,9 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20 20
21typedef unsigned short apm_event_t;
22typedef unsigned short apm_eventinfo_t;
23
21struct apm_bios_info { 24struct apm_bios_info {
22 __u16 version; 25 __u16 version;
23 __u16 cseg; 26 __u16 cseg;
@@ -32,9 +35,6 @@ struct apm_bios_info {
32 35
33#ifdef __KERNEL__ 36#ifdef __KERNEL__
34 37
35typedef unsigned short apm_event_t;
36typedef unsigned short apm_eventinfo_t;
37
38#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8) 38#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
39#define APM_CS_16 (APM_CS + 8) 39#define APM_CS_16 (APM_CS + 8)
40#define APM_DS (APM_CS_16 + 8) 40#define APM_DS (APM_CS_16 + 8)
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 5c4e54a2a8d6..72ab80801ef6 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -190,6 +190,8 @@ enum {
190 ATA_CMD_READ_LOG_EXT = 0x2f, 190 ATA_CMD_READ_LOG_EXT = 0x2f,
191 ATA_CMD_PMP_READ = 0xE4, 191 ATA_CMD_PMP_READ = 0xE4,
192 ATA_CMD_PMP_WRITE = 0xE8, 192 ATA_CMD_PMP_WRITE = 0xE8,
193 ATA_CMD_CONF_OVERLAY = 0xB1,
194 ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
193 195
194 /* READ_LOG_EXT pages */ 196 /* READ_LOG_EXT pages */
195 ATA_LOG_SATA_NCQ = 0x10, 197 ATA_LOG_SATA_NCQ = 0x10,
@@ -239,6 +241,19 @@ enum {
239 SATA_AN = 0x05, /* Asynchronous Notification */ 241 SATA_AN = 0x05, /* Asynchronous Notification */
240 SATA_DIPM = 0x03, /* Device Initiated Power Management */ 242 SATA_DIPM = 0x03, /* Device Initiated Power Management */
241 243
244 /* feature values for SET_MAX */
245 ATA_SET_MAX_ADDR = 0x00,
246 ATA_SET_MAX_PASSWD = 0x01,
247 ATA_SET_MAX_LOCK = 0x02,
248 ATA_SET_MAX_UNLOCK = 0x03,
249 ATA_SET_MAX_FREEZE_LOCK = 0x04,
250
251 /* feature values for DEVICE CONFIGURATION OVERLAY */
252 ATA_DCO_RESTORE = 0xC0,
253 ATA_DCO_FREEZE_LOCK = 0xC1,
254 ATA_DCO_IDENTIFY = 0xC2,
255 ATA_DCO_SET = 0xC3,
256
242 /* ATAPI stuff */ 257 /* ATAPI stuff */
243 ATAPI_PKT_DMA = (1 << 0), 258 ATAPI_PKT_DMA = (1 << 0),
244 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 259 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index b8b7c51389fe..e765e191663d 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -115,6 +115,7 @@ struct io_restrictions {
115 unsigned short max_hw_segments; 115 unsigned short max_hw_segments;
116 unsigned short hardsect_size; 116 unsigned short hardsect_size;
117 unsigned int max_segment_size; 117 unsigned int max_segment_size;
118 unsigned int max_hw_sectors;
118 unsigned long seg_boundary_mask; 119 unsigned long seg_boundary_mask;
119 unsigned long bounce_pfn; 120 unsigned long bounce_pfn;
120 unsigned char no_cluster; /* inverted so that 0 is default */ 121 unsigned char no_cluster; /* inverted so that 0 is default */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index e8f42133a616..639624b55fbe 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
119/* 119/*
120 * io scheduler registration 120 * io scheduler registration
121 */ 121 */
122extern int elv_register(struct elevator_type *); 122extern void elv_register(struct elevator_type *);
123extern void elv_unregister(struct elevator_type *); 123extern void elv_unregister(struct elevator_type *);
124 124
125/* 125/*
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 24968790bc3e..30d606afcafe 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -33,7 +33,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
33 33
34extern unsigned long max_huge_pages; 34extern unsigned long max_huge_pages;
35extern unsigned long hugepages_treat_as_movable; 35extern unsigned long hugepages_treat_as_movable;
36extern int hugetlb_dynamic_pool; 36extern unsigned long nr_overcommit_huge_pages;
37extern const unsigned long hugetlb_zero, hugetlb_infinity; 37extern const unsigned long hugetlb_zero, hugetlb_infinity;
38extern int sysctl_hugetlb_shm_group; 38extern int sysctl_hugetlb_shm_group;
39 39
diff --git a/include/linux/ide.h b/include/linux/ide.h
index dc75ccbcf991..9a6a41e7079f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1255,6 +1255,7 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1255 1255
1256#ifdef CONFIG_BLK_DEV_IDEDMA 1256#ifdef CONFIG_BLK_DEV_IDEDMA
1257int __ide_dma_bad_drive(ide_drive_t *); 1257int __ide_dma_bad_drive(ide_drive_t *);
1258int ide_id_dma_bug(ide_drive_t *);
1258 1259
1259u8 ide_find_dma_mode(ide_drive_t *, u8); 1260u8 ide_find_dma_mode(ide_drive_t *, u8);
1260 1261
@@ -1264,7 +1265,6 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive)
1264} 1265}
1265 1266
1266void ide_dma_off(ide_drive_t *); 1267void ide_dma_off(ide_drive_t *);
1267void ide_dma_verbose(ide_drive_t *);
1268int ide_set_dma(ide_drive_t *); 1268int ide_set_dma(ide_drive_t *);
1269ide_startstop_t ide_dma_intr(ide_drive_t *); 1269ide_startstop_t ide_dma_intr(ide_drive_t *);
1270 1270
@@ -1287,6 +1287,7 @@ extern void ide_dma_timeout(ide_drive_t *);
1287#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 1287#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
1288 1288
1289#else 1289#else
1290static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1290static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1291static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1291static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1292static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1292static inline void ide_dma_off(ide_drive_t *drive) { ; } 1293static inline void ide_dma_off(ide_drive_t *drive) { ; }
@@ -1333,8 +1334,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1333 hwif->hwif_data = data; 1334 hwif->hwif_data = data;
1334} 1335}
1335 1336
1336/* ide-lib.c */ 1337const char *ide_xfer_verbose(u8 mode);
1337extern char *ide_xfer_verbose(u8 xfer_rate);
1338extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1338extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1339extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1339extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1340 1340
diff --git a/include/linux/irq.h b/include/linux/irq.h
index efc88538b2ba..4669be080617 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -339,6 +339,13 @@ extern void
339__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, 339__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
340 const char *name); 340 const char *name);
341 341
342/* caller has locked the irq_desc and both params are valid */
343static inline void __set_irq_handler_unlocked(int irq,
344 irq_flow_handler_t handler)
345{
346 irq_desc[irq].handle_irq = handler;
347}
348
342/* 349/*
343 * Set a highlevel flow handler for a given IRQ: 350 * Set a highlevel flow handler for a given IRQ:
344 */ 351 */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ef52a07c43d8..124033cb5e9b 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -119,6 +119,8 @@ enum {
119 ATA_DEF_BUSY_WAIT = 10000, 119 ATA_DEF_BUSY_WAIT = 10000,
120 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 120 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
121 121
122 ATAPI_MAX_DRAIN = 16 << 10,
123
122 ATA_SHT_EMULATED = 1, 124 ATA_SHT_EMULATED = 1,
123 ATA_SHT_CMD_PER_LUN = 1, 125 ATA_SHT_CMD_PER_LUN = 1,
124 ATA_SHT_THIS_ID = -1, 126 ATA_SHT_THIS_ID = -1,
@@ -211,7 +213,7 @@ enum {
211 213
212 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 214 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
213 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 215 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
214 ATA_PFLAG_GTM_VALID = (1 << 19), /* acpi_gtm data valid */ 216 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
215 217
216 /* struct ata_queued_cmd flags */ 218 /* struct ata_queued_cmd flags */
217 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 219 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
@@ -498,6 +500,7 @@ struct ata_device {
498 struct scsi_device *sdev; /* attached SCSI device */ 500 struct scsi_device *sdev; /* attached SCSI device */
499#ifdef CONFIG_ATA_ACPI 501#ifdef CONFIG_ATA_ACPI
500 acpi_handle acpi_handle; 502 acpi_handle acpi_handle;
503 union acpi_object *gtf_cache;
501#endif 504#endif
502 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 505 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
503 u64 n_sectors; /* size of device, if ATA */ 506 u64 n_sectors; /* size of device, if ATA */
@@ -653,7 +656,7 @@ struct ata_port {
653 656
654#ifdef CONFIG_ATA_ACPI 657#ifdef CONFIG_ATA_ACPI
655 acpi_handle acpi_handle; 658 acpi_handle acpi_handle;
656 struct ata_acpi_gtm acpi_gtm; 659 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
657#endif 660#endif
658 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 661 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
659}; 662};
@@ -939,10 +942,20 @@ enum {
939 942
940/* libata-acpi.c */ 943/* libata-acpi.c */
941#ifdef CONFIG_ATA_ACPI 944#ifdef CONFIG_ATA_ACPI
945static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
946{
947 if (ap->pflags & ATA_PFLAG_INIT_GTM_VALID)
948 return &ap->__acpi_init_gtm;
949 return NULL;
950}
942extern int ata_acpi_cbl_80wire(struct ata_port *ap); 951extern int ata_acpi_cbl_80wire(struct ata_port *ap);
943int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm); 952int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
944int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *stm); 953int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
945#else 954#else
955static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
956{
957 return NULL;
958}
946static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; } 959static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
947#endif 960#endif
948 961
@@ -1013,18 +1026,18 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
1013 * printk helpers 1026 * printk helpers
1014 */ 1027 */
1015#define ata_port_printk(ap, lv, fmt, args...) \ 1028#define ata_port_printk(ap, lv, fmt, args...) \
1016 printk(lv"ata%u: "fmt, (ap)->print_id , ##args) 1029 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
1017 1030
1018#define ata_link_printk(link, lv, fmt, args...) do { \ 1031#define ata_link_printk(link, lv, fmt, args...) do { \
1019 if ((link)->ap->nr_pmp_links) \ 1032 if ((link)->ap->nr_pmp_links) \
1020 printk(lv"ata%u.%02u: "fmt, (link)->ap->print_id, \ 1033 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
1021 (link)->pmp , ##args); \ 1034 (link)->pmp , ##args); \
1022 else \ 1035 else \
1023 printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args); \ 1036 printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
1024 } while(0) 1037 } while(0)
1025 1038
1026#define ata_dev_printk(dev, lv, fmt, args...) \ 1039#define ata_dev_printk(dev, lv, fmt, args...) \
1027 printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, \ 1040 printk("%sata%u.%02u: "fmt, lv, (dev)->link->ap->print_id, \
1028 (dev)->link->pmp + (dev)->devno , ##args) 1041 (dev)->link->pmp + (dev)->devno , ##args)
1029 1042
1030/* 1043/*
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 125eee1407ff..7ab962fa1d73 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -118,10 +118,6 @@ struct mmc_host {
118 unsigned int removed:1; /* host is being removed */ 118 unsigned int removed:1; /* host is being removed */
119#endif 119#endif
120 120
121 unsigned int mode; /* current card mode of host */
122#define MMC_MODE_MMC 0
123#define MMC_MODE_SD 1
124
125 struct mmc_card *card; /* device attached to this host */ 121 struct mmc_card *card; /* device attached to this host */
126 122
127 wait_queue_head_t wq; 123 wait_queue_head_t wq;
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 533ee351a273..499aa9375901 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -50,7 +50,8 @@ enum nf_br_hook_priorities {
50extern int nf_bridge_copy_header(struct sk_buff *skb); 50extern int nf_bridge_copy_header(struct sk_buff *skb);
51static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 51static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
52{ 52{
53 if (skb->nf_bridge) 53 if (skb->nf_bridge &&
54 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
54 return nf_bridge_copy_header(skb); 55 return nf_bridge_copy_header(skb);
55 return 0; 56 return 0;
56} 57}
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 111aa10f1136..023656d2f1da 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2148,6 +2148,7 @@
2148#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 2148#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2149#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2149#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2150#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 2150#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2151#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2151 2152
2152#define PCI_VENDOR_ID_KORENIX 0x1982 2153#define PCI_VENDOR_ID_KORENIX 0x1982
2153#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2154#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
diff --git a/include/linux/ticable.h b/include/linux/ticable.h
deleted file mode 100644
index 8c2212086dcd..000000000000
--- a/include/linux/ticable.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/* Hey EMACS -*- linux-c -*-
2 *
3 * tipar/tiser/tiusb - low level driver for handling link cables
4 * designed for Texas Instruments graphing calculators.
5 *
6 * Copyright (C) 2000-2002, Romain Lievin <roms@lpg.ticalc.org>
7 *
8 * Redistribution of this file is permitted under the terms of the GNU
9 * Public License (GPL)
10 */
11
12#ifndef _TICABLE_H
13#define _TICABLE_H 1
14
15/* Internal default constants for the kernel module */
16#define TIMAXTIME 15 /* 1.5 seconds */
17#define IO_DELAY 10 /* 10 micro-seconds */
18
19/* Major & minor number for character devices */
20#define TIPAR_MAJOR 115 /* 0 to 7 */
21#define TIPAR_MINOR 0
22
23#define TISER_MAJOR 115 /* 8 to 15 */
24#define TISER_MINOR 8
25
26#define TIUSB_MAJOR 115 /* 16 to 31 */
27#define TIUSB_MINOR 16
28
29/*
30 * Request values for the 'ioctl' function.
31 */
32#define IOCTL_TIPAR_DELAY _IOW('p', 0xa8, int) /* set delay */
33#define IOCTL_TIPAR_TIMEOUT _IOW('p', 0xa9, int) /* set timeout */
34
35#define IOCTL_TISER_DELAY _IOW('p', 0xa0, int) /* set delay */
36#define IOCTL_TISER_TIMEOUT _IOW('p', 0xa1, int) /* set timeout */
37
38#define IOCTL_TIUSB_TIMEOUT _IOW('N', 0x20, int) /* set timeout */
39#define IOCTL_TIUSB_RESET_DEVICE _IOW('N', 0x21, int) /* reset device */
40#define IOCTL_TIUSB_RESET_PIPES _IOW('N', 0x22, int) /* reset both pipes*/
41#define IOCTL_TIUSB_GET_MAXPS _IOR('N', 0x23, int) /* max packet size */
42#define IOCTL_TIUSB_GET_DEVID _IOR('N', 0x24, int) /* get device type */
43
44#endif /* TICABLE_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 416ee7617d9e..5fc8ff73b7bb 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -107,6 +107,7 @@ enum usb_interface_condition {
107 * @condition: binding state of the interface: not bound, binding 107 * @condition: binding state of the interface: not bound, binding
108 * (in probe()), bound to a driver, or unbinding (in disconnect()) 108 * (in probe()), bound to a driver, or unbinding (in disconnect())
109 * @is_active: flag set when the interface is bound and not suspended. 109 * @is_active: flag set when the interface is bound and not suspended.
110 * @sysfs_files_created: sysfs attributes exist
110 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
111 * capability during autosuspend. 112 * capability during autosuspend.
112 * @dev: driver model's view of this device 113 * @dev: driver model's view of this device
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 1b792b9286ba..a417b09b8b3d 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -48,7 +48,10 @@
48 US_FLAG(IGNORE_DEVICE, 0x00000800) \ 48 US_FLAG(IGNORE_DEVICE, 0x00000800) \
49 /* Don't claim device */ \ 49 /* Don't claim device */ \
50 US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \ 50 US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
51 /* sometimes sizes is too big */ 51 /* sometimes sizes is too big */ \
52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \
53 /* Sets max_sectors to arch min */
54
52 55
53#define US_FLAG(name, value) US_FL_##name = value , 56#define US_FLAG(name, value) US_FL_##name = value ,
54enum { US_DO_ALL_FLAGS }; 57enum { US_DO_ALL_FLAGS };
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 0fa5d5912555..4fd5d0eaa935 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -208,6 +208,8 @@ int videobuf_cgmbuf(struct videobuf_queue *q,
208int videobuf_streamon(struct videobuf_queue *q); 208int videobuf_streamon(struct videobuf_queue *q);
209int videobuf_streamoff(struct videobuf_queue *q); 209int videobuf_streamoff(struct videobuf_queue *q);
210 210
211void videobuf_stop(struct videobuf_queue *q);
212
211int videobuf_read_start(struct videobuf_queue *q); 213int videobuf_read_start(struct videobuf_queue *q);
212void videobuf_read_stop(struct videobuf_queue *q); 214void videobuf_read_stop(struct videobuf_queue *q);
213ssize_t videobuf_read_stream(struct videobuf_queue *q, 215ssize_t videobuf_read_stream(struct videobuf_queue *q,
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/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/kernel/irq/chip.c b/kernel/irq/chip.c
index 9b5dff6b3f6a..44019ce30a14 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -297,18 +297,13 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
297 297
298 if (unlikely(desc->status & IRQ_INPROGRESS)) 298 if (unlikely(desc->status & IRQ_INPROGRESS))
299 goto out_unlock; 299 goto out_unlock;
300 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
300 kstat_cpu(cpu).irqs[irq]++; 301 kstat_cpu(cpu).irqs[irq]++;
301 302
302 action = desc->action; 303 action = desc->action;
303 if (unlikely(!action || (desc->status & IRQ_DISABLED))) { 304 if (unlikely(!action || (desc->status & IRQ_DISABLED)))
304 if (desc->chip->mask)
305 desc->chip->mask(irq);
306 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
307 desc->status |= IRQ_PENDING;
308 goto out_unlock; 305 goto out_unlock;
309 }
310 306
311 desc->status &= ~(IRQ_REPLAY | IRQ_WAITING | IRQ_PENDING);
312 desc->status |= IRQ_INPROGRESS; 307 desc->status |= IRQ_INPROGRESS;
313 spin_unlock(&desc->lock); 308 spin_unlock(&desc->lock);
314 309
diff --git a/kernel/panic.c b/kernel/panic.c
index 6f6e03e91595..da4d6bac270e 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -19,6 +19,7 @@
19#include <linux/nmi.h> 19#include <linux/nmi.h>
20#include <linux/kexec.h> 20#include <linux/kexec.h>
21#include <linux/debug_locks.h> 21#include <linux/debug_locks.h>
22#include <linux/random.h>
22 23
23int panic_on_oops; 24int panic_on_oops;
24int tainted; 25int tainted;
@@ -266,12 +267,29 @@ void oops_enter(void)
266} 267}
267 268
268/* 269/*
270 * 64-bit random ID for oopses:
271 */
272static u64 oops_id;
273
274static int init_oops_id(void)
275{
276 if (!oops_id)
277 get_random_bytes(&oops_id, sizeof(oops_id));
278
279 return 0;
280}
281late_initcall(init_oops_id);
282
283/*
269 * Called when the architecture exits its oops handler, after printing 284 * Called when the architecture exits its oops handler, after printing
270 * everything. 285 * everything.
271 */ 286 */
272void oops_exit(void) 287void oops_exit(void)
273{ 288{
274 do_oops_enter_exit(); 289 do_oops_enter_exit();
290 init_oops_id();
291 printk(KERN_WARNING "---[ end trace %016llx ]---\n",
292 (unsigned long long)oops_id);
275} 293}
276 294
277#ifdef CONFIG_CC_STACKPROTECTOR 295#ifdef CONFIG_CC_STACKPROTECTOR
diff --git a/kernel/rwsem.c b/kernel/rwsem.c
index 1ec620c03064..cae050b05f5e 100644
--- a/kernel/rwsem.c
+++ b/kernel/rwsem.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h>
9#include <linux/module.h> 10#include <linux/module.h>
10#include <linux/rwsem.h> 11#include <linux/rwsem.h>
11 12
@@ -15,7 +16,7 @@
15/* 16/*
16 * lock for reading 17 * lock for reading
17 */ 18 */
18void down_read(struct rw_semaphore *sem) 19void __sched down_read(struct rw_semaphore *sem)
19{ 20{
20 might_sleep(); 21 might_sleep();
21 rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); 22 rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
@@ -42,7 +43,7 @@ EXPORT_SYMBOL(down_read_trylock);
42/* 43/*
43 * lock for writing 44 * lock for writing
44 */ 45 */
45void down_write(struct rw_semaphore *sem) 46void __sched down_write(struct rw_semaphore *sem)
46{ 47{
47 might_sleep(); 48 might_sleep();
48 rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); 49 rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
diff --git a/kernel/sched.c b/kernel/sched.c
index c6e551de795b..3df84ea6aba9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -508,10 +508,15 @@ EXPORT_SYMBOL_GPL(cpu_clock);
508# define finish_arch_switch(prev) do { } while (0) 508# define finish_arch_switch(prev) do { } while (0)
509#endif 509#endif
510 510
511static inline int task_current(struct rq *rq, struct task_struct *p)
512{
513 return rq->curr == p;
514}
515
511#ifndef __ARCH_WANT_UNLOCKED_CTXSW 516#ifndef __ARCH_WANT_UNLOCKED_CTXSW
512static inline int task_running(struct rq *rq, struct task_struct *p) 517static inline int task_running(struct rq *rq, struct task_struct *p)
513{ 518{
514 return rq->curr == p; 519 return task_current(rq, p);
515} 520}
516 521
517static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next) 522static inline void prepare_lock_switch(struct rq *rq, struct task_struct *next)
@@ -540,7 +545,7 @@ static inline int task_running(struct rq *rq, struct task_struct *p)
540#ifdef CONFIG_SMP 545#ifdef CONFIG_SMP
541 return p->oncpu; 546 return p->oncpu;
542#else 547#else
543 return rq->curr == p; 548 return task_current(rq, p);
544#endif 549#endif
545} 550}
546 551
@@ -663,6 +668,7 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
663 struct rq *rq = cpu_rq(smp_processor_id()); 668 struct rq *rq = cpu_rq(smp_processor_id());
664 u64 now = sched_clock(); 669 u64 now = sched_clock();
665 670
671 touch_softlockup_watchdog();
666 rq->idle_clock += delta_ns; 672 rq->idle_clock += delta_ns;
667 /* 673 /*
668 * Override the previous timestamp and ignore all 674 * Override the previous timestamp and ignore all
@@ -3334,7 +3340,7 @@ unsigned long long task_sched_runtime(struct task_struct *p)
3334 3340
3335 rq = task_rq_lock(p, &flags); 3341 rq = task_rq_lock(p, &flags);
3336 ns = p->se.sum_exec_runtime; 3342 ns = p->se.sum_exec_runtime;
3337 if (rq->curr == p) { 3343 if (task_current(rq, p)) {
3338 update_rq_clock(rq); 3344 update_rq_clock(rq);
3339 delta_exec = rq->clock - p->se.exec_start; 3345 delta_exec = rq->clock - p->se.exec_start;
3340 if ((s64)delta_exec > 0) 3346 if ((s64)delta_exec > 0)
@@ -4021,7 +4027,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
4021 4027
4022 oldprio = p->prio; 4028 oldprio = p->prio;
4023 on_rq = p->se.on_rq; 4029 on_rq = p->se.on_rq;
4024 running = task_running(rq, p); 4030 running = task_current(rq, p);
4025 if (on_rq) { 4031 if (on_rq) {
4026 dequeue_task(rq, p, 0); 4032 dequeue_task(rq, p, 0);
4027 if (running) 4033 if (running)
@@ -4332,7 +4338,7 @@ recheck:
4332 } 4338 }
4333 update_rq_clock(rq); 4339 update_rq_clock(rq);
4334 on_rq = p->se.on_rq; 4340 on_rq = p->se.on_rq;
4335 running = task_running(rq, p); 4341 running = task_current(rq, p);
4336 if (on_rq) { 4342 if (on_rq) {
4337 deactivate_task(rq, p, 0); 4343 deactivate_task(rq, p, 0);
4338 if (running) 4344 if (running)
@@ -7101,7 +7107,7 @@ void sched_move_task(struct task_struct *tsk)
7101 7107
7102 update_rq_clock(rq); 7108 update_rq_clock(rq);
7103 7109
7104 running = task_running(rq, tsk); 7110 running = task_current(rq, tsk);
7105 on_rq = tsk->se.on_rq; 7111 on_rq = tsk->se.on_rq;
7106 7112
7107 if (on_rq) { 7113 if (on_rq) {
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index c33f0ceb3de9..da7c061e7206 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -511,8 +511,7 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
511 511
512 if (!initial) { 512 if (!initial) {
513 /* sleeps upto a single latency don't count. */ 513 /* sleeps upto a single latency don't count. */
514 if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) && 514 if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se))
515 task_of(se)->policy != SCHED_BATCH)
516 vruntime -= sysctl_sched_latency; 515 vruntime -= sysctl_sched_latency;
517 516
518 /* ensure we never gain time by being placed backwards. */ 517 /* ensure we never gain time by being placed backwards. */
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index ee9c8b6529e9..9ba3daa03475 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -208,6 +208,8 @@ move_one_task_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
208 208
209static void task_tick_rt(struct rq *rq, struct task_struct *p) 209static void task_tick_rt(struct rq *rq, struct task_struct *p)
210{ 210{
211 update_curr_rt(rq);
212
211 /* 213 /*
212 * RR tasks need a special form of timeslice management. 214 * RR tasks need a special form of timeslice management.
213 * FIFO tasks have no timeslices. 215 * FIFO tasks have no timeslices.
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8ac51714b08c..c68f68dcc605 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -225,10 +225,10 @@ static struct ctl_table root_table[] = {
225}; 225};
226 226
227#ifdef CONFIG_SCHED_DEBUG 227#ifdef CONFIG_SCHED_DEBUG
228static unsigned long min_sched_granularity_ns = 100000; /* 100 usecs */ 228static int min_sched_granularity_ns = 100000; /* 100 usecs */
229static unsigned long max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */ 229static int max_sched_granularity_ns = NSEC_PER_SEC; /* 1 second */
230static unsigned long min_wakeup_granularity_ns; /* 0 usecs */ 230static int min_wakeup_granularity_ns; /* 0 usecs */
231static unsigned long max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */ 231static int max_wakeup_granularity_ns = NSEC_PER_SEC; /* 1 second */
232#endif 232#endif
233 233
234static struct ctl_table kern_table[] = { 234static struct ctl_table kern_table[] = {
@@ -906,11 +906,11 @@ static struct ctl_table vm_table[] = {
906 }, 906 },
907 { 907 {
908 .ctl_name = CTL_UNNUMBERED, 908 .ctl_name = CTL_UNNUMBERED,
909 .procname = "hugetlb_dynamic_pool", 909 .procname = "nr_overcommit_hugepages",
910 .data = &hugetlb_dynamic_pool, 910 .data = &nr_overcommit_huge_pages,
911 .maxlen = sizeof(hugetlb_dynamic_pool), 911 .maxlen = sizeof(nr_overcommit_huge_pages),
912 .mode = 0644, 912 .mode = 0644,
913 .proc_handler = &proc_dointvec, 913 .proc_handler = &proc_doulongvec_minmax,
914 }, 914 },
915#endif 915#endif
916 { 916 {
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
index bed939f82c31..a68425a5cc1d 100644
--- a/kernel/sysctl_check.c
+++ b/kernel/sysctl_check.c
@@ -428,7 +428,7 @@ static struct trans_ctl_table trans_net_netrom_table[] = {
428 {} 428 {}
429}; 429};
430 430
431static struct trans_ctl_table trans_net_ax25_table[] = { 431static struct trans_ctl_table trans_net_ax25_param_table[] = {
432 { NET_AX25_IP_DEFAULT_MODE, "ip_default_mode" }, 432 { NET_AX25_IP_DEFAULT_MODE, "ip_default_mode" },
433 { NET_AX25_DEFAULT_MODE, "ax25_default_mode" }, 433 { NET_AX25_DEFAULT_MODE, "ax25_default_mode" },
434 { NET_AX25_BACKOFF_TYPE, "backoff_type" }, 434 { NET_AX25_BACKOFF_TYPE, "backoff_type" },
@@ -446,6 +446,11 @@ static struct trans_ctl_table trans_net_ax25_table[] = {
446 {} 446 {}
447}; 447};
448 448
449static struct trans_ctl_table trans_net_ax25_table[] = {
450 { 0, NULL, trans_net_ax25_param_table },
451 {}
452};
453
449static struct trans_ctl_table trans_net_bridge_table[] = { 454static struct trans_ctl_table trans_net_bridge_table[] = {
450 { NET_BRIDGE_NF_CALL_ARPTABLES, "bridge-nf-call-arptables" }, 455 { NET_BRIDGE_NF_CALL_ARPTABLES, "bridge-nf-call-arptables" },
451 { NET_BRIDGE_NF_CALL_IPTABLES, "bridge-nf-call-iptables" }, 456 { NET_BRIDGE_NF_CALL_IPTABLES, "bridge-nf-call-iptables" },
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index aa82d7bf478a..5b86698faa0b 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -384,45 +384,19 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
384} 384}
385 385
386/* 386/*
387 * Reprogram the broadcast device:
388 *
389 * Called with tick_broadcast_lock held and interrupts disabled.
390 */
391static int tick_broadcast_reprogram(void)
392{
393 ktime_t expires = { .tv64 = KTIME_MAX };
394 struct tick_device *td;
395 int cpu;
396
397 /*
398 * Find the event which expires next:
399 */
400 for (cpu = first_cpu(tick_broadcast_oneshot_mask); cpu != NR_CPUS;
401 cpu = next_cpu(cpu, tick_broadcast_oneshot_mask)) {
402 td = &per_cpu(tick_cpu_device, cpu);
403 if (td->evtdev->next_event.tv64 < expires.tv64)
404 expires = td->evtdev->next_event;
405 }
406
407 if (expires.tv64 == KTIME_MAX)
408 return 0;
409
410 return tick_broadcast_set_event(expires, 0);
411}
412
413/*
414 * Handle oneshot mode broadcasting 387 * Handle oneshot mode broadcasting
415 */ 388 */
416static void tick_handle_oneshot_broadcast(struct clock_event_device *dev) 389static void tick_handle_oneshot_broadcast(struct clock_event_device *dev)
417{ 390{
418 struct tick_device *td; 391 struct tick_device *td;
419 cpumask_t mask; 392 cpumask_t mask;
420 ktime_t now; 393 ktime_t now, next_event;
421 int cpu; 394 int cpu;
422 395
423 spin_lock(&tick_broadcast_lock); 396 spin_lock(&tick_broadcast_lock);
424again: 397again:
425 dev->next_event.tv64 = KTIME_MAX; 398 dev->next_event.tv64 = KTIME_MAX;
399 next_event.tv64 = KTIME_MAX;
426 mask = CPU_MASK_NONE; 400 mask = CPU_MASK_NONE;
427 now = ktime_get(); 401 now = ktime_get();
428 /* Find all expired events */ 402 /* Find all expired events */
@@ -431,19 +405,31 @@ again:
431 td = &per_cpu(tick_cpu_device, cpu); 405 td = &per_cpu(tick_cpu_device, cpu);
432 if (td->evtdev->next_event.tv64 <= now.tv64) 406 if (td->evtdev->next_event.tv64 <= now.tv64)
433 cpu_set(cpu, mask); 407 cpu_set(cpu, mask);
408 else if (td->evtdev->next_event.tv64 < next_event.tv64)
409 next_event.tv64 = td->evtdev->next_event.tv64;
434 } 410 }
435 411
436 /* 412 /*
437 * Wakeup the cpus which have an expired event. The broadcast 413 * Wakeup the cpus which have an expired event.
438 * device is reprogrammed in the return from idle code. 414 */
415 tick_do_broadcast(mask);
416
417 /*
418 * Two reasons for reprogram:
419 *
420 * - The global event did not expire any CPU local
421 * events. This happens in dyntick mode, as the maximum PIT
422 * delta is quite small.
423 *
424 * - There are pending events on sleeping CPUs which were not
425 * in the event mask
439 */ 426 */
440 if (!tick_do_broadcast(mask)) { 427 if (next_event.tv64 != KTIME_MAX) {
441 /* 428 /*
442 * The global event did not expire any CPU local 429 * Rearm the broadcast device. If event expired,
443 * events. This happens in dyntick mode, as the 430 * repeat the above
444 * maximum PIT delta is quite small.
445 */ 431 */
446 if (tick_broadcast_reprogram()) 432 if (tick_broadcast_set_event(next_event, 0))
447 goto again; 433 goto again;
448 } 434 }
449 spin_unlock(&tick_broadcast_lock); 435 spin_unlock(&tick_broadcast_lock);
diff --git a/kernel/timer.c b/kernel/timer.c
index a05817c021d6..d4527dcef1af 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1219,11 +1219,11 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info)
1219 */ 1219 */
1220static struct lock_class_key base_lock_keys[NR_CPUS]; 1220static struct lock_class_key base_lock_keys[NR_CPUS];
1221 1221
1222static int __devinit init_timers_cpu(int cpu) 1222static int __cpuinit init_timers_cpu(int cpu)
1223{ 1223{
1224 int j; 1224 int j;
1225 tvec_base_t *base; 1225 tvec_base_t *base;
1226 static char __devinitdata tvec_base_done[NR_CPUS]; 1226 static char __cpuinitdata tvec_base_done[NR_CPUS];
1227 1227
1228 if (!tvec_base_done[cpu]) { 1228 if (!tvec_base_done[cpu]) {
1229 static char boot_done; 1229 static char boot_done;
diff --git a/lib/kobject.c b/lib/kobject.c
index b52e9f4ef371..3590f022a609 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -234,13 +234,13 @@ int kobject_register(struct kobject * kobj)
234 234
235 235
236/** 236/**
237 * kobject_set_name - Set the name of an object 237 * kobject_set_name - Set the name of a kobject
238 * @kobj: object. 238 * @kobj: kobject to name
239 * @fmt: format string used to build the name 239 * @fmt: format string used to build the name
240 * 240 *
241 * If strlen(name) >= KOBJ_NAME_LEN, then use a dynamically allocated 241 * This sets the name of the kobject. If you have already added the
242 * string that @kobj->k_name points to. Otherwise, use the static 242 * kobject to the system, you must call kobject_rename() in order to
243 * @kobj->name array. 243 * change the name of the kobject.
244 */ 244 */
245int kobject_set_name(struct kobject * kobj, const char * fmt, ...) 245int kobject_set_name(struct kobject * kobj, const char * fmt, ...)
246{ 246{
diff --git a/lib/rwsem.c b/lib/rwsem.c
index cdb4e3d05607..7d02700a4b0e 100644
--- a/lib/rwsem.c
+++ b/lib/rwsem.c
@@ -146,7 +146,7 @@ __rwsem_do_wake(struct rw_semaphore *sem, int downgrading)
146/* 146/*
147 * wait for a lock to be granted 147 * wait for a lock to be granted
148 */ 148 */
149static struct rw_semaphore * 149static struct rw_semaphore __sched *
150rwsem_down_failed_common(struct rw_semaphore *sem, 150rwsem_down_failed_common(struct rw_semaphore *sem,
151 struct rwsem_waiter *waiter, signed long adjustment) 151 struct rwsem_waiter *waiter, signed long adjustment)
152{ 152{
diff --git a/mm/Kconfig b/mm/Kconfig
index c070ec0c15bf..9ef97417a0b9 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -112,18 +112,17 @@ config SPARSEMEM_EXTREME
112 def_bool y 112 def_bool y
113 depends on SPARSEMEM && !SPARSEMEM_STATIC 113 depends on SPARSEMEM && !SPARSEMEM_STATIC
114 114
115#
116# SPARSEMEM_VMEMMAP uses a virtually mapped mem_map to optimise pfn_to_page
117# and page_to_pfn. The most efficient option where kernel virtual space is
118# not under pressure.
119#
120config SPARSEMEM_VMEMMAP_ENABLE 115config SPARSEMEM_VMEMMAP_ENABLE
121 def_bool n 116 def_bool n
122 117
123config SPARSEMEM_VMEMMAP 118config SPARSEMEM_VMEMMAP
124 bool 119 bool "Sparse Memory virtual memmap"
125 depends on SPARSEMEM 120 depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
126 default y if (SPARSEMEM_VMEMMAP_ENABLE) 121 default y
122 help
123 SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
124 pfn_to_page and page_to_pfn operations. This is the most
125 efficient option when sufficient kernel resources are available.
127 126
128# eventually, we can have this option just 'select SPARSEMEM' 127# eventually, we can have this option just 'select SPARSEMEM'
129config MEMORY_HOTPLUG 128config MEMORY_HOTPLUG
diff --git a/mm/filemap.c b/mm/filemap.c
index 188cf5fd3e8d..f4d0cded0e10 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -124,6 +124,18 @@ void __remove_from_page_cache(struct page *page)
124 mapping->nrpages--; 124 mapping->nrpages--;
125 __dec_zone_page_state(page, NR_FILE_PAGES); 125 __dec_zone_page_state(page, NR_FILE_PAGES);
126 BUG_ON(page_mapped(page)); 126 BUG_ON(page_mapped(page));
127
128 /*
129 * Some filesystems seem to re-dirty the page even after
130 * the VM has canceled the dirty bit (eg ext3 journaling).
131 *
132 * Fix it up by doing a final dirty accounting check after
133 * having removed the page entirely.
134 */
135 if (PageDirty(page) && mapping_cap_account_dirty(mapping)) {
136 dec_zone_page_state(page, NR_FILE_DIRTY);
137 dec_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE);
138 }
127} 139}
128 140
129void remove_from_page_cache(struct page *page) 141void remove_from_page_cache(struct page *page)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6f978218c2c8..7224a4f07106 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -31,7 +31,7 @@ static unsigned int free_huge_pages_node[MAX_NUMNODES];
31static unsigned int surplus_huge_pages_node[MAX_NUMNODES]; 31static unsigned int surplus_huge_pages_node[MAX_NUMNODES];
32static gfp_t htlb_alloc_mask = GFP_HIGHUSER; 32static gfp_t htlb_alloc_mask = GFP_HIGHUSER;
33unsigned long hugepages_treat_as_movable; 33unsigned long hugepages_treat_as_movable;
34int hugetlb_dynamic_pool; 34unsigned long nr_overcommit_huge_pages;
35static int hugetlb_next_nid; 35static int hugetlb_next_nid;
36 36
37/* 37/*
@@ -227,22 +227,58 @@ static struct page *alloc_buddy_huge_page(struct vm_area_struct *vma,
227 unsigned long address) 227 unsigned long address)
228{ 228{
229 struct page *page; 229 struct page *page;
230 unsigned int nid;
230 231
231 /* Check if the dynamic pool is enabled */ 232 /*
232 if (!hugetlb_dynamic_pool) 233 * Assume we will successfully allocate the surplus page to
234 * prevent racing processes from causing the surplus to exceed
235 * overcommit
236 *
237 * This however introduces a different race, where a process B
238 * tries to grow the static hugepage pool while alloc_pages() is
239 * called by process A. B will only examine the per-node
240 * counters in determining if surplus huge pages can be
241 * converted to normal huge pages in adjust_pool_surplus(). A
242 * won't be able to increment the per-node counter, until the
243 * lock is dropped by B, but B doesn't drop hugetlb_lock until
244 * no more huge pages can be converted from surplus to normal
245 * state (and doesn't try to convert again). Thus, we have a
246 * case where a surplus huge page exists, the pool is grown, and
247 * the surplus huge page still exists after, even though it
248 * should just have been converted to a normal huge page. This
249 * does not leak memory, though, as the hugepage will be freed
250 * once it is out of use. It also does not allow the counters to
251 * go out of whack in adjust_pool_surplus() as we don't modify
252 * the node values until we've gotten the hugepage and only the
253 * per-node value is checked there.
254 */
255 spin_lock(&hugetlb_lock);
256 if (surplus_huge_pages >= nr_overcommit_huge_pages) {
257 spin_unlock(&hugetlb_lock);
233 return NULL; 258 return NULL;
259 } else {
260 nr_huge_pages++;
261 surplus_huge_pages++;
262 }
263 spin_unlock(&hugetlb_lock);
234 264
235 page = alloc_pages(htlb_alloc_mask|__GFP_COMP|__GFP_NOWARN, 265 page = alloc_pages(htlb_alloc_mask|__GFP_COMP|__GFP_NOWARN,
236 HUGETLB_PAGE_ORDER); 266 HUGETLB_PAGE_ORDER);
267
268 spin_lock(&hugetlb_lock);
237 if (page) { 269 if (page) {
270 nid = page_to_nid(page);
238 set_compound_page_dtor(page, free_huge_page); 271 set_compound_page_dtor(page, free_huge_page);
239 spin_lock(&hugetlb_lock); 272 /*
240 nr_huge_pages++; 273 * We incremented the global counters already
241 nr_huge_pages_node[page_to_nid(page)]++; 274 */
242 surplus_huge_pages++; 275 nr_huge_pages_node[nid]++;
243 surplus_huge_pages_node[page_to_nid(page)]++; 276 surplus_huge_pages_node[nid]++;
244 spin_unlock(&hugetlb_lock); 277 } else {
278 nr_huge_pages--;
279 surplus_huge_pages--;
245 } 280 }
281 spin_unlock(&hugetlb_lock);
246 282
247 return page; 283 return page;
248} 284}
@@ -481,6 +517,12 @@ static unsigned long set_max_huge_pages(unsigned long count)
481 * Increase the pool size 517 * Increase the pool size
482 * First take pages out of surplus state. Then make up the 518 * First take pages out of surplus state. Then make up the
483 * remaining difference by allocating fresh huge pages. 519 * remaining difference by allocating fresh huge pages.
520 *
521 * We might race with alloc_buddy_huge_page() here and be unable
522 * to convert a surplus huge page to a normal huge page. That is
523 * not critical, though, it just means the overall size of the
524 * pool might be one hugepage larger than it needs to be, but
525 * within all the constraints specified by the sysctls.
484 */ 526 */
485 spin_lock(&hugetlb_lock); 527 spin_lock(&hugetlb_lock);
486 while (surplus_huge_pages && count > persistent_huge_pages) { 528 while (surplus_huge_pages && count > persistent_huge_pages) {
@@ -509,6 +551,14 @@ static unsigned long set_max_huge_pages(unsigned long count)
509 * to keep enough around to satisfy reservations). Then place 551 * to keep enough around to satisfy reservations). Then place
510 * pages into surplus state as needed so the pool will shrink 552 * pages into surplus state as needed so the pool will shrink
511 * to the desired size as pages become free. 553 * to the desired size as pages become free.
554 *
555 * By placing pages into the surplus state independent of the
556 * overcommit value, we are allowing the surplus pool size to
557 * exceed overcommit. There are few sane options here. Since
558 * alloc_buddy_huge_page() is checking the global counter,
559 * though, we'll note that we're not allowed to exceed surplus
560 * and won't grow the pool anywhere else. Not until one of the
561 * sysctls are changed, or the surplus pages go out of use.
512 */ 562 */
513 min_count = resv_huge_pages + nr_huge_pages - free_huge_pages; 563 min_count = resv_huge_pages + nr_huge_pages - free_huge_pages;
514 min_count = max(count, min_count); 564 min_count = max(count, min_count);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b5a58d476c1a..d73bfad1c32f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -847,8 +847,19 @@ static int rmqueue_bulk(struct zone *zone, unsigned int order,
847 struct page *page = __rmqueue(zone, order, migratetype); 847 struct page *page = __rmqueue(zone, order, migratetype);
848 if (unlikely(page == NULL)) 848 if (unlikely(page == NULL))
849 break; 849 break;
850
851 /*
852 * Split buddy pages returned by expand() are received here
853 * in physical page order. The page is added to the callers and
854 * list and the list head then moves forward. From the callers
855 * perspective, the linked list is ordered by page number in
856 * some conditions. This is useful for IO devices that can
857 * merge IO requests if the physical pages are ordered
858 * properly.
859 */
850 list_add(&page->lru, list); 860 list_add(&page->lru, list);
851 set_page_private(page, migratetype); 861 set_page_private(page, migratetype);
862 list = &page->lru;
852 } 863 }
853 spin_unlock(&zone->lock); 864 spin_unlock(&zone->lock);
854 return i; 865 return i;
diff --git a/mm/slub.c b/mm/slub.c
index 9c1d9f3b364f..3655ad359f03 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.
@@ -1468,9 +1468,6 @@ static void *__slab_alloc(struct kmem_cache *s,
1468 void **object; 1468 void **object;
1469 struct page *new; 1469 struct page *new;
1470 1470
1471 /* We handle __GFP_ZERO in the caller */
1472 gfpflags &= ~__GFP_ZERO;
1473
1474 if (!c->page) 1471 if (!c->page)
1475 goto new_slab; 1472 goto new_slab;
1476 1473
@@ -1616,7 +1613,7 @@ checks_ok:
1616 * then add it. 1613 * then add it.
1617 */ 1614 */
1618 if (unlikely(!prior)) 1615 if (unlikely(!prior))
1619 add_partial(get_node(s, page_to_nid(page)), page); 1616 add_partial_tail(get_node(s, page_to_nid(page)), page);
1620 1617
1621out_unlock: 1618out_unlock:
1622 slab_unlock(page); 1619 slab_unlock(page);
diff --git a/mm/sparse.c b/mm/sparse.c
index e06f514fe04f..a2183cb5d524 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -83,6 +83,8 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
83 return -EEXIST; 83 return -EEXIST;
84 84
85 section = sparse_index_alloc(nid); 85 section = sparse_index_alloc(nid);
86 if (!section)
87 return -ENOMEM;
86 /* 88 /*
87 * This lock keeps two different sections from 89 * This lock keeps two different sections from
88 * reallocating for the same index 90 * reallocating for the same index
@@ -389,9 +391,17 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
389 * no locking for this, because it does its own 391 * no locking for this, because it does its own
390 * plus, it does a kmalloc 392 * plus, it does a kmalloc
391 */ 393 */
392 sparse_index_init(section_nr, pgdat->node_id); 394 ret = sparse_index_init(section_nr, pgdat->node_id);
395 if (ret < 0 && ret != -EEXIST)
396 return ret;
393 memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, nr_pages); 397 memmap = kmalloc_section_memmap(section_nr, pgdat->node_id, nr_pages);
398 if (!memmap)
399 return -ENOMEM;
394 usemap = __kmalloc_section_usemap(); 400 usemap = __kmalloc_section_usemap();
401 if (!usemap) {
402 __kfree_section_memmap(memmap, nr_pages);
403 return -ENOMEM;
404 }
395 405
396 pgdat_resize_lock(pgdat, &flags); 406 pgdat_resize_lock(pgdat, &flags);
397 407
@@ -401,18 +411,16 @@ int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
401 goto out; 411 goto out;
402 } 412 }
403 413
404 if (!usemap) {
405 ret = -ENOMEM;
406 goto out;
407 }
408 ms->section_mem_map |= SECTION_MARKED_PRESENT; 414 ms->section_mem_map |= SECTION_MARKED_PRESENT;
409 415
410 ret = sparse_init_one_section(ms, section_nr, memmap, usemap); 416 ret = sparse_init_one_section(ms, section_nr, memmap, usemap);
411 417
412out: 418out:
413 pgdat_resize_unlock(pgdat, &flags); 419 pgdat_resize_unlock(pgdat, &flags);
414 if (ret <= 0) 420 if (ret <= 0) {
421 kfree(usemap);
415 __kfree_section_memmap(memmap, nr_pages); 422 __kfree_section_memmap(memmap, nr_pages);
423 }
416 return ret; 424 return ret;
417} 425}
418#endif 426#endif
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 5b183156307a..4add9bd4bc8d 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -124,8 +124,8 @@ static void __exit vlan_cleanup_module(void)
124{ 124{
125 int i; 125 int i;
126 126
127 vlan_netlink_fini();
128 vlan_ioctl_set(NULL); 127 vlan_ioctl_set(NULL);
128 vlan_netlink_fini();
129 129
130 /* Un-register us from receiving netdevice events */ 130 /* Un-register us from receiving netdevice events */
131 unregister_netdevice_notifier(&vlan_notifier_block); 131 unregister_netdevice_notifier(&vlan_notifier_block);
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/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index 5fe9b2a6697d..d8f215733175 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -279,6 +279,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
279 ax25_link_failed(ax25, reason); 279 ax25_link_failed(ax25, reason);
280 280
281 if (ax25->sk != NULL) { 281 if (ax25->sk != NULL) {
282 local_bh_disable();
282 bh_lock_sock(ax25->sk); 283 bh_lock_sock(ax25->sk);
283 ax25->sk->sk_state = TCP_CLOSE; 284 ax25->sk->sk_state = TCP_CLOSE;
284 ax25->sk->sk_err = reason; 285 ax25->sk->sk_err = reason;
@@ -288,5 +289,6 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
288 sock_set_flag(ax25->sk, SOCK_DEAD); 289 sock_set_flag(ax25->sk, SOCK_DEAD);
289 } 290 }
290 bh_unlock_sock(ax25->sk); 291 bh_unlock_sock(ax25->sk);
292 local_bh_enable();
291 } 293 }
292} 294}
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index c07bac5e3e10..bf7787395fe0 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -157,8 +157,7 @@ static struct ethtool_ops br_ethtool_ops = {
157 157
158void br_dev_setup(struct net_device *dev) 158void br_dev_setup(struct net_device *dev)
159{ 159{
160 memset(dev->dev_addr, 0, ETH_ALEN); 160 random_ether_addr(dev->dev_addr);
161
162 ether_setup(dev); 161 ether_setup(dev);
163 162
164 dev->do_ioctl = br_dev_ioctl; 163 dev->do_ioctl = br_dev_ioctl;
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 86d62611f2fc..be9d3015beaa 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2819,7 +2819,7 @@ void dev_set_allmulti(struct net_device *dev, int inc)
2819/* 2819/*
2820 * Upload unicast and multicast address lists to device and 2820 * Upload unicast and multicast address lists to device and
2821 * configure RX filtering. When the device doesn't support unicast 2821 * configure RX filtering. When the device doesn't support unicast
2822 * filtering it is put in promiscous mode while unicast addresses 2822 * filtering it is put in promiscuous mode while unicast addresses
2823 * are present. 2823 * are present.
2824 */ 2824 */
2825void __dev_set_rx_mode(struct net_device *dev) 2825void __dev_set_rx_mode(struct net_device *dev)
@@ -3972,8 +3972,7 @@ void synchronize_net(void)
3972 * @dev: device 3972 * @dev: device
3973 * 3973 *
3974 * This function shuts down a device interface and removes it 3974 * This function shuts down a device interface and removes it
3975 * from the kernel tables. On success 0 is returned, on a failure 3975 * from the kernel tables.
3976 * a negative errno code is returned.
3977 * 3976 *
3978 * Callers must hold the rtnl semaphore. You may want 3977 * Callers must hold the rtnl semaphore. You may want
3979 * unregister_netdev() instead of this. 3978 * unregister_netdev() instead of this.
@@ -3991,8 +3990,7 @@ void unregister_netdevice(struct net_device *dev)
3991 * @dev: device 3990 * @dev: device
3992 * 3991 *
3993 * This function shuts down a device interface and removes it 3992 * This function shuts down a device interface and removes it
3994 * from the kernel tables. On success 0 is returned, on a failure 3993 * from the kernel tables.
3995 * a negative errno code is returned.
3996 * 3994 *
3997 * This is just a wrapper for unregister_netdevice that takes 3995 * This is just a wrapper for unregister_netdevice that takes
3998 * the rtnl semaphore. In general you want to use this and not 3996 * the rtnl semaphore. In general you want to use this and not
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/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/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 55d199e4ae21..3168c3de4919 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -516,8 +516,6 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
516 goto errout; 516 goto errout;
517 } 517 }
518 518
519 ipv4_devconf_setall(in_dev);
520
521 ifa = inet_alloc_ifa(); 519 ifa = inet_alloc_ifa();
522 if (ifa == NULL) { 520 if (ifa == NULL) {
523 /* 521 /*
@@ -528,6 +526,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
528 goto errout; 526 goto errout;
529 } 527 }
530 528
529 ipv4_devconf_setall(in_dev);
531 in_dev_hold(in_dev); 530 in_dev_hold(in_dev);
532 531
533 if (tb[IFA_ADDRESS] == NULL) 532 if (tb[IFA_ADDRESS] == NULL)
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index c31bccb9b526..1738113268bc 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -9,6 +9,7 @@
9#include <linux/pfkeyv2.h> 9#include <linux/pfkeyv2.h>
10#include <linux/random.h> 10#include <linux/random.h>
11#include <linux/spinlock.h> 11#include <linux/spinlock.h>
12#include <linux/in6.h>
12#include <net/icmp.h> 13#include <net/icmp.h>
13#include <net/protocol.h> 14#include <net/protocol.h>
14#include <net/udp.h> 15#include <net/udp.h>
@@ -224,6 +225,10 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
224 225
225 /* ... check padding bits here. Silly. :-) */ 226 /* ... check padding bits here. Silly. :-) */
226 227
228 /* RFC4303: Drop dummy packets without any error */
229 if (nexthdr[1] == IPPROTO_NONE)
230 goto out;
231
227 iph = ip_hdr(skb); 232 iph = ip_hdr(skb);
228 ihl = iph->ihl * 4; 233 ihl = iph->ihl * 4;
229 234
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/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 c5c107a01823..96400b0bd08a 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1396,25 +1396,7 @@ late_initcall(ip_auto_config);
1396 1396
1397/* 1397/*
1398 * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel 1398 * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel
1399 * command line parameter. It consists of option fields separated by colons in 1399 * command line parameter. See Documentation/nfsroot.txt.
1400 * the following order:
1401 *
1402 * <client-ip>:<server-ip>:<gw-ip>:<netmask>:<host name>:<device>:<PROTO>
1403 *
1404 * Any of the fields can be empty which means to use a default value:
1405 * <client-ip> - address given by BOOTP or RARP
1406 * <server-ip> - address of host returning BOOTP or RARP packet
1407 * <gw-ip> - none, or the address returned by BOOTP
1408 * <netmask> - automatically determined from <client-ip>, or the
1409 * one returned by BOOTP
1410 * <host name> - <client-ip> in ASCII notation, or the name returned
1411 * by BOOTP
1412 * <device> - use all available devices
1413 * <PROTO>:
1414 * off|none - don't do autoconfig at all (DEFAULT)
1415 * on|any - use any configured protocol
1416 * dhcp|bootp|rarp - use only the specified protocol
1417 * both - use both BOOTP and RARP (not DHCP)
1418 */ 1400 */
1419static int __init ic_proto_name(char *name) 1401static int __init ic_proto_name(char *name)
1420{ 1402{
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 4b10b98640ac..b9b189c26208 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1492,8 +1492,10 @@ static inline int compat_copy_match_to_user(struct ipt_entry_match *m,
1492 return xt_compat_match_to_user(m, dstptr, size); 1492 return xt_compat_match_to_user(m, dstptr, size);
1493} 1493}
1494 1494
1495static int compat_copy_entry_to_user(struct ipt_entry *e, 1495static int
1496 void __user **dstptr, compat_uint_t *size) 1496compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr,
1497 compat_uint_t *size, struct xt_counters *counters,
1498 unsigned int *i)
1497{ 1499{
1498 struct ipt_entry_target *t; 1500 struct ipt_entry_target *t;
1499 struct compat_ipt_entry __user *ce; 1501 struct compat_ipt_entry __user *ce;
@@ -1507,6 +1509,9 @@ static int compat_copy_entry_to_user(struct ipt_entry *e,
1507 if (copy_to_user(ce, e, sizeof(struct ipt_entry))) 1509 if (copy_to_user(ce, e, sizeof(struct ipt_entry)))
1508 goto out; 1510 goto out;
1509 1511
1512 if (copy_to_user(&ce->counters, &counters[*i], sizeof(counters[*i])))
1513 goto out;
1514
1510 *dstptr += sizeof(struct compat_ipt_entry); 1515 *dstptr += sizeof(struct compat_ipt_entry);
1511 ret = IPT_MATCH_ITERATE(e, compat_copy_match_to_user, dstptr, size); 1516 ret = IPT_MATCH_ITERATE(e, compat_copy_match_to_user, dstptr, size);
1512 target_offset = e->target_offset - (origsize - *size); 1517 target_offset = e->target_offset - (origsize - *size);
@@ -1522,6 +1527,8 @@ static int compat_copy_entry_to_user(struct ipt_entry *e,
1522 goto out; 1527 goto out;
1523 if (put_user(next_offset, &ce->next_offset)) 1528 if (put_user(next_offset, &ce->next_offset))
1524 goto out; 1529 goto out;
1530
1531 (*i)++;
1525 return 0; 1532 return 0;
1526out: 1533out:
1527 return ret; 1534 return ret;
@@ -1937,14 +1944,13 @@ struct compat_ipt_get_entries
1937static int compat_copy_entries_to_user(unsigned int total_size, 1944static int compat_copy_entries_to_user(unsigned int total_size,
1938 struct xt_table *table, void __user *userptr) 1945 struct xt_table *table, void __user *userptr)
1939{ 1946{
1940 unsigned int off, num;
1941 struct compat_ipt_entry e;
1942 struct xt_counters *counters; 1947 struct xt_counters *counters;
1943 struct xt_table_info *private = table->private; 1948 struct xt_table_info *private = table->private;
1944 void __user *pos; 1949 void __user *pos;
1945 unsigned int size; 1950 unsigned int size;
1946 int ret = 0; 1951 int ret = 0;
1947 void *loc_cpu_entry; 1952 void *loc_cpu_entry;
1953 unsigned int i = 0;
1948 1954
1949 counters = alloc_counters(table); 1955 counters = alloc_counters(table);
1950 if (IS_ERR(counters)) 1956 if (IS_ERR(counters))
@@ -1958,48 +1964,9 @@ static int compat_copy_entries_to_user(unsigned int total_size,
1958 pos = userptr; 1964 pos = userptr;
1959 size = total_size; 1965 size = total_size;
1960 ret = IPT_ENTRY_ITERATE(loc_cpu_entry, total_size, 1966 ret = IPT_ENTRY_ITERATE(loc_cpu_entry, total_size,
1961 compat_copy_entry_to_user, &pos, &size); 1967 compat_copy_entry_to_user,
1962 if (ret) 1968 &pos, &size, counters, &i);
1963 goto free_counters;
1964
1965 /* ... then go back and fix counters and names */
1966 for (off = 0, num = 0; off < size; off += e.next_offset, num++) {
1967 unsigned int i;
1968 struct ipt_entry_match m;
1969 struct ipt_entry_target t;
1970 1969
1971 ret = -EFAULT;
1972 if (copy_from_user(&e, userptr + off,
1973 sizeof(struct compat_ipt_entry)))
1974 goto free_counters;
1975 if (copy_to_user(userptr + off +
1976 offsetof(struct compat_ipt_entry, counters),
1977 &counters[num], sizeof(counters[num])))
1978 goto free_counters;
1979
1980 for (i = sizeof(struct compat_ipt_entry);
1981 i < e.target_offset; i += m.u.match_size) {
1982 if (copy_from_user(&m, userptr + off + i,
1983 sizeof(struct ipt_entry_match)))
1984 goto free_counters;
1985 if (copy_to_user(userptr + off + i +
1986 offsetof(struct ipt_entry_match, u.user.name),
1987 m.u.kernel.match->name,
1988 strlen(m.u.kernel.match->name) + 1))
1989 goto free_counters;
1990 }
1991
1992 if (copy_from_user(&t, userptr + off + e.target_offset,
1993 sizeof(struct ipt_entry_target)))
1994 goto free_counters;
1995 if (copy_to_user(userptr + off + e.target_offset +
1996 offsetof(struct ipt_entry_target, u.user.name),
1997 t.u.kernel.target->name,
1998 strlen(t.u.kernel.target->name) + 1))
1999 goto free_counters;
2000 }
2001 ret = 0;
2002free_counters:
2003 vfree(counters); 1970 vfree(counters);
2004 return ret; 1971 return ret;
2005} 1972}
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/tcp_input.c b/net/ipv4/tcp_input.c
index b9e429d2d1de..889c89362bfc 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -923,7 +923,7 @@ static void tcp_init_metrics(struct sock *sk)
923 } 923 }
924 if (dst_metric(dst, RTAX_RTTVAR) > tp->mdev) { 924 if (dst_metric(dst, RTAX_RTTVAR) > tp->mdev) {
925 tp->mdev = dst_metric(dst, RTAX_RTTVAR); 925 tp->mdev = dst_metric(dst, RTAX_RTTVAR);
926 tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN); 926 tp->mdev_max = tp->rttvar = max(tp->mdev, tcp_rto_min(sk));
927 } 927 }
928 tcp_set_rto(sk); 928 tcp_set_rto(sk);
929 tcp_bound_rto(sk); 929 tcp_bound_rto(sk);
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 7db66f10e00d..444053254676 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -230,6 +230,12 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
230 } 230 }
231 /* ... check padding bits here. Silly. :-) */ 231 /* ... check padding bits here. Silly. :-) */
232 232
233 /* RFC4303: Drop dummy packets without any error */
234 if (nexthdr[1] == IPPROTO_NONE) {
235 ret = -EINVAL;
236 goto out;
237 }
238
233 pskb_trim(skb, skb->len - alen - padlen - 2); 239 pskb_trim(skb, skb->len - alen - padlen - 2);
234 ret = nexthdr[1]; 240 ret = nexthdr[1];
235 } 241 }
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index 1334fc174bcf..8c5f80fd03ad 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -1046,7 +1046,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,
1046 break; 1046 break;
1047 1047
1048 default: 1048 default:
1049 return -EINVAL; 1049 return -ENOPROTOOPT;
1050 } 1050 }
1051 len = min_t(unsigned int, sizeof(int), len); 1051 len = min_t(unsigned int, sizeof(int), len);
1052 if(put_user(len, optlen)) 1052 if(put_user(len, optlen))
@@ -1069,9 +1069,8 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
1069 1069
1070 err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); 1070 err = do_ipv6_getsockopt(sk, level, optname, optval, optlen);
1071#ifdef CONFIG_NETFILTER 1071#ifdef CONFIG_NETFILTER
1072 /* we need to exclude all possible EINVALs except default case */ 1072 /* we need to exclude all possible ENOPROTOOPTs except default case */
1073 if (err == -EINVAL && optname != IPV6_ADDRFORM && 1073 if (err == -ENOPROTOOPT && optname != IPV6_2292PKTOPTIONS) {
1074 optname != MCAST_MSFILTER) {
1075 int len; 1074 int len;
1076 1075
1077 if (get_user(len, optlen)) 1076 if (get_user(len, optlen))
@@ -1108,9 +1107,8 @@ int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
1108 1107
1109 err = do_ipv6_getsockopt(sk, level, optname, optval, optlen); 1108 err = do_ipv6_getsockopt(sk, level, optname, optval, optlen);
1110#ifdef CONFIG_NETFILTER 1109#ifdef CONFIG_NETFILTER
1111 /* we need to exclude all possible EINVALs except default case */ 1110 /* we need to exclude all possible ENOPROTOOPTs except default case */
1112 if (err == -EINVAL && optname != IPV6_ADDRFORM && 1111 if (err == -ENOPROTOOPT && optname != IPV6_2292PKTOPTIONS) {
1113 optname != MCAST_MSFILTER) {
1114 int len; 1112 int len;
1115 1113
1116 if (get_user(len, optlen)) 1114 if (get_user(len, optlen))
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/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 82e27b80d07d..b8e9eb445d74 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -233,7 +233,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
233 dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output; 233 dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output;
234 /* Sheit... I remember I did this right. Apparently, 234 /* Sheit... I remember I did this right. Apparently,
235 * it was magically lost, so this code needs audit */ 235 * it was magically lost, so this code needs audit */
236 x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); 236 x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTF_ANYCAST|RTF_LOCAL);
237 x->u.rt6.rt6i_metric = rt0->rt6i_metric; 237 x->u.rt6.rt6i_metric = rt0->rt6i_metric;
238 x->u.rt6.rt6i_node = rt0->rt6i_node; 238 x->u.rt6.rt6i_node = rt0->rt6i_node;
239 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway; 239 x->u.rt6.rt6i_gateway = rt0->rt6i_gateway;
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/irlmp.c b/net/irda/irlmp.c
index cedff8068fbc..f24cb755908e 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -353,6 +353,7 @@ void irlmp_unregister_link(__u32 saddr)
353 /* Final cleanup */ 353 /* Final cleanup */
354 del_timer(&link->idle_timer); 354 del_timer(&link->idle_timer);
355 link->magic = 0; 355 link->magic = 0;
356 hashbin_delete(link->lsaps, (FREE_FUNC) __irlmp_close_lsap);
356 kfree(link); 357 kfree(link);
357 } 358 }
358} 359}
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 2627dad7cd87..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)) {
@@ -463,7 +463,7 @@ int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
463 int n = 0; 463 int n = 0;
464 464
465 IRDA_ASSERT(buf != NULL, return ret;); 465 IRDA_ASSERT(buf != NULL, return ret;);
466 IRDA_ASSERT(info != 0, return ret;); 466 IRDA_ASSERT(info != NULL, return ret;);
467 467
468 pi_minor = pi & info->pi_mask; 468 pi_minor = pi & info->pi_mask;
469 pi_major = pi >> info->pi_major_offset; 469 pi_major = pi >> info->pi_major_offset;
@@ -517,7 +517,7 @@ static int irda_param_extract(void *self, __u8 *buf, int len,
517 int n = 0; 517 int n = 0;
518 518
519 IRDA_ASSERT(buf != NULL, return ret;); 519 IRDA_ASSERT(buf != NULL, return ret;);
520 IRDA_ASSERT(info != 0, return ret;); 520 IRDA_ASSERT(info != NULL, return ret;);
521 521
522 pi_minor = buf[n] & info->pi_mask; 522 pi_minor = buf[n] & info->pi_mask;
523 pi_major = buf[n] >> info->pi_major_offset; 523 pi_major = buf[n] >> info->pi_major_offset;
@@ -570,7 +570,7 @@ int irda_param_extract_all(void *self, __u8 *buf, int len,
570 int n = 0; 570 int n = 0;
571 571
572 IRDA_ASSERT(buf != NULL, return ret;); 572 IRDA_ASSERT(buf != NULL, return ret;);
573 IRDA_ASSERT(info != 0, return ret;); 573 IRDA_ASSERT(info != NULL, return ret;);
574 574
575 /* 575 /*
576 * Parse all parameters. Each parameter must be at least two bytes 576 * Parse all parameters. Each parameter must be at least two bytes
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..26d5e63c4cc5 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)
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_rate.c b/net/mac80211/ieee80211_rate.c
index 7254bd609839..c3f278393741 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -33,6 +33,7 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
33 if (!strcmp(alg->ops->name, ops->name)) { 33 if (!strcmp(alg->ops->name, ops->name)) {
34 /* don't register an algorithm twice */ 34 /* don't register an algorithm twice */
35 WARN_ON(1); 35 WARN_ON(1);
36 mutex_unlock(&rate_ctrl_mutex);
36 return -EALREADY; 37 return -EALREADY;
37 } 38 }
38 } 39 }
@@ -59,11 +60,11 @@ void ieee80211_rate_control_unregister(struct rate_control_ops *ops)
59 list_for_each_entry(alg, &rate_ctrl_algs, list) { 60 list_for_each_entry(alg, &rate_ctrl_algs, list) {
60 if (alg->ops == ops) { 61 if (alg->ops == ops) {
61 list_del(&alg->list); 62 list_del(&alg->list);
63 kfree(alg);
62 break; 64 break;
63 } 65 }
64 } 66 }
65 mutex_unlock(&rate_ctrl_mutex); 67 mutex_unlock(&rate_ctrl_mutex);
66 kfree(alg);
67} 68}
68EXPORT_SYMBOL(ieee80211_rate_control_unregister); 69EXPORT_SYMBOL(ieee80211_rate_control_unregister);
69 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/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9be1826e6cdd..7d231243754a 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1024,8 +1024,10 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
1024 } 1024 }
1025 1025
1026 /* setup master conntrack: this is a confirmed expectation */ 1026 /* setup master conntrack: this is a confirmed expectation */
1027 if (master_ct) 1027 if (master_ct) {
1028 __set_bit(IPS_EXPECTED_BIT, &ct->status);
1028 ct->master = master_ct; 1029 ct->master = master_ct;
1030 }
1029 1031
1030 add_timer(&ct->timeout); 1032 add_timer(&ct->timeout);
1031 nf_conntrack_hash_insert(ct); 1033 nf_conntrack_hash_insert(ct);
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/x_tables.c b/net/netfilter/x_tables.c
index d9a3bded0d00..b6160e41eb1c 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -377,7 +377,9 @@ int xt_compat_match_to_user(struct xt_entry_match *m, void __user **dstptr,
377 u_int16_t msize = m->u.user.match_size - off; 377 u_int16_t msize = m->u.user.match_size - off;
378 378
379 if (copy_to_user(cm, m, sizeof(*cm)) || 379 if (copy_to_user(cm, m, sizeof(*cm)) ||
380 put_user(msize, &cm->u.user.match_size)) 380 put_user(msize, &cm->u.user.match_size) ||
381 copy_to_user(cm->u.user.name, m->u.kernel.match->name,
382 strlen(m->u.kernel.match->name) + 1))
381 return -EFAULT; 383 return -EFAULT;
382 384
383 if (match->compat_to_user) { 385 if (match->compat_to_user) {
@@ -468,7 +470,9 @@ int xt_compat_target_to_user(struct xt_entry_target *t, void __user **dstptr,
468 u_int16_t tsize = t->u.user.target_size - off; 470 u_int16_t tsize = t->u.user.target_size - off;
469 471
470 if (copy_to_user(ct, t, sizeof(*ct)) || 472 if (copy_to_user(ct, t, sizeof(*ct)) ||
471 put_user(tsize, &ct->u.user.target_size)) 473 put_user(tsize, &ct->u.user.target_size) ||
474 copy_to_user(ct->u.user.name, t->u.kernel.target->name,
475 strlen(t->u.kernel.target->name) + 1))
472 return -EFAULT; 476 return -EFAULT;
473 477
474 if (target->compat_to_user) { 478 if (target->compat_to_user) {
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 19103678bf20..2ef44d8560c1 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -240,7 +240,7 @@ static bool select_all(const struct xt_hashlimit_htable *ht,
240static bool select_gc(const struct xt_hashlimit_htable *ht, 240static bool select_gc(const struct xt_hashlimit_htable *ht,
241 const struct dsthash_ent *he) 241 const struct dsthash_ent *he)
242{ 242{
243 return jiffies >= he->expires; 243 return time_after_eq(jiffies, he->expires);
244} 244}
245 245
246static void htable_selective_cleanup(struct xt_hashlimit_htable *ht, 246static void htable_selective_cleanup(struct xt_hashlimit_htable *ht,
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/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..ed7c9e30ebc9 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -286,7 +286,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc,
286 286
287 sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param); 287 sctp_addto_chunk(retval, sizeof(ecap_param), &ecap_param);
288 288
289 /* Add the supported extensions paramter. Be nice and add this 289 /* Add the supported extensions parameter. Be nice and add this
290 * fist before addiding the parameters for the extensions themselves 290 * fist before addiding the parameters for the extensions themselves
291 */ 291 */
292 if (num_ext) { 292 if (num_ext) {
@@ -2859,7 +2859,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
2859 chunk_len -= length; 2859 chunk_len -= length;
2860 2860
2861 /* Skip the address parameter and store a pointer to the first 2861 /* Skip the address parameter and store a pointer to the first
2862 * asconf paramter. 2862 * asconf parameter.
2863 */ 2863 */
2864 length = ntohs(addr_param->v4.param_hdr.length); 2864 length = ntohs(addr_param->v4.param_hdr.length);
2865 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); 2865 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
@@ -2868,7 +2868,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
2868 /* create an ASCONF_ACK chunk. 2868 /* create an ASCONF_ACK chunk.
2869 * Based on the definitions of parameters, we know that the size of 2869 * 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 2870 * ASCONF_ACK parameters are less than or equal to the twice of ASCONF
2871 * paramters. 2871 * parameters.
2872 */ 2872 */
2873 asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2); 2873 asconf_ack = sctp_make_asconf_ack(asoc, serial, chunk_len * 2);
2874 if (!asconf_ack) 2874 if (!asconf_ack)
@@ -3062,7 +3062,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,
3062 asconf_len -= length; 3062 asconf_len -= length;
3063 3063
3064 /* Skip the address parameter in the last asconf sent and store a 3064 /* Skip the address parameter in the last asconf sent and store a
3065 * pointer to the first asconf paramter. 3065 * pointer to the first asconf parameter.
3066 */ 3066 */
3067 length = ntohs(addr_param->v4.param_hdr.length); 3067 length = ntohs(addr_param->v4.param_hdr.length);
3068 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); 3068 asconf_param = (sctp_addip_param_t *)((void *)addr_param + length);
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 4908041ffb31..1733fa29a501 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -53,6 +53,7 @@ static struct sctp_ulpevent * sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
53 struct sctp_ulpevent *); 53 struct sctp_ulpevent *);
54static struct sctp_ulpevent * sctp_ulpq_order(struct sctp_ulpq *, 54static struct sctp_ulpevent * sctp_ulpq_order(struct sctp_ulpq *,
55 struct sctp_ulpevent *); 55 struct sctp_ulpevent *);
56static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq);
56 57
57/* 1st Level Abstractions */ 58/* 1st Level Abstractions */
58 59
@@ -190,6 +191,7 @@ static void sctp_ulpq_set_pd(struct sctp_ulpq *ulpq)
190static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq) 191static int sctp_ulpq_clear_pd(struct sctp_ulpq *ulpq)
191{ 192{
192 ulpq->pd_mode = 0; 193 ulpq->pd_mode = 0;
194 sctp_ulpq_reasm_drain(ulpq);
193 return sctp_clear_pd(ulpq->asoc->base.sk, ulpq->asoc); 195 return sctp_clear_pd(ulpq->asoc->base.sk, ulpq->asoc);
194} 196}
195 197
@@ -699,6 +701,37 @@ void sctp_ulpq_reasm_flushtsn(struct sctp_ulpq *ulpq, __u32 fwd_tsn)
699 } 701 }
700} 702}
701 703
704/*
705 * Drain the reassembly queue. If we just cleared parted delivery, it
706 * is possible that the reassembly queue will contain already reassembled
707 * messages. Retrieve any such messages and give them to the user.
708 */
709static void sctp_ulpq_reasm_drain(struct sctp_ulpq *ulpq)
710{
711 struct sctp_ulpevent *event = NULL;
712 struct sk_buff_head temp;
713
714 if (skb_queue_empty(&ulpq->reasm))
715 return;
716
717 while ((event = sctp_ulpq_retrieve_reassembled(ulpq)) != NULL) {
718 /* Do ordering if needed. */
719 if ((event) && (event->msg_flags & MSG_EOR)){
720 skb_queue_head_init(&temp);
721 __skb_queue_tail(&temp, sctp_event2skb(event));
722
723 event = sctp_ulpq_order(ulpq, event);
724 }
725
726 /* Send event to the ULP. 'event' is the
727 * sctp_ulpevent for very first SKB on the temp' list.
728 */
729 if (event)
730 sctp_ulpq_tail_event(ulpq, event);
731 }
732}
733
734
702/* Helper function to gather skbs that have possibly become 735/* Helper function to gather skbs that have possibly become
703 * ordered by an an incoming chunk. 736 * ordered by an an incoming chunk.
704 */ 737 */
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 9e11ce715958..ee8de7af2a5b 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -92,7 +92,6 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
92 seg[n].mr_page = NULL; 92 seg[n].mr_page = NULL;
93 seg[n].mr_offset = xdrbuf->head[0].iov_base; 93 seg[n].mr_offset = xdrbuf->head[0].iov_base;
94 seg[n].mr_len = xdrbuf->head[0].iov_len; 94 seg[n].mr_len = xdrbuf->head[0].iov_len;
95 pos += xdrbuf->head[0].iov_len;
96 ++n; 95 ++n;
97 } 96 }
98 97
@@ -104,7 +103,6 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
104 seg[n].mr_len = min_t(u32, 103 seg[n].mr_len = min_t(u32,
105 PAGE_SIZE - xdrbuf->page_base, xdrbuf->page_len); 104 PAGE_SIZE - xdrbuf->page_base, xdrbuf->page_len);
106 len = xdrbuf->page_len - seg[n].mr_len; 105 len = xdrbuf->page_len - seg[n].mr_len;
107 pos += len;
108 ++n; 106 ++n;
109 p = 1; 107 p = 1;
110 while (len > 0) { 108 while (len > 0) {
@@ -119,20 +117,15 @@ rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos,
119 } 117 }
120 } 118 }
121 119
122 if (pos < xdrbuf->len && xdrbuf->tail[0].iov_len) { 120 if (xdrbuf->tail[0].iov_len) {
123 if (n == nsegs) 121 if (n == nsegs)
124 return 0; 122 return 0;
125 seg[n].mr_page = NULL; 123 seg[n].mr_page = NULL;
126 seg[n].mr_offset = xdrbuf->tail[0].iov_base; 124 seg[n].mr_offset = xdrbuf->tail[0].iov_base;
127 seg[n].mr_len = xdrbuf->tail[0].iov_len; 125 seg[n].mr_len = xdrbuf->tail[0].iov_len;
128 pos += xdrbuf->tail[0].iov_len;
129 ++n; 126 ++n;
130 } 127 }
131 128
132 if (pos < xdrbuf->len)
133 dprintk("RPC: %s: marshaled only %d of %d\n",
134 __func__, pos, xdrbuf->len);
135
136 return n; 129 return n;
137} 130}
138 131
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 6b792265dc06..24ddfd2ca38b 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -253,7 +253,7 @@ static int release(struct socket *sock)
253 dbg("sock_delete: %x\n",tsock); 253 dbg("sock_delete: %x\n",tsock);
254 if (!tsock) 254 if (!tsock)
255 return 0; 255 return 0;
256 down_interruptible(&tsock->sem); 256 down(&tsock->sem);
257 if (!sock->sk) { 257 if (!sock->sk) {
258 up(&tsock->sem); 258 up(&tsock->sem);
259 return 0; 259 return 0;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 9a4cf2e45a15..26b846e11bfb 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1318,8 +1318,9 @@ restart:
1318 1318
1319 if (sk && sk->sk_policy[XFRM_POLICY_OUT]) { 1319 if (sk && sk->sk_policy[XFRM_POLICY_OUT]) {
1320 policy = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl); 1320 policy = xfrm_sk_policy_lookup(sk, XFRM_POLICY_OUT, fl);
1321 err = PTR_ERR(policy);
1321 if (IS_ERR(policy)) 1322 if (IS_ERR(policy))
1322 return PTR_ERR(policy); 1323 goto dropdst;
1323 } 1324 }
1324 1325
1325 if (!policy) { 1326 if (!policy) {
@@ -1330,8 +1331,9 @@ restart:
1330 1331
1331 policy = flow_cache_lookup(fl, dst_orig->ops->family, 1332 policy = flow_cache_lookup(fl, dst_orig->ops->family,
1332 dir, xfrm_policy_lookup); 1333 dir, xfrm_policy_lookup);
1334 err = PTR_ERR(policy);
1333 if (IS_ERR(policy)) 1335 if (IS_ERR(policy))
1334 return PTR_ERR(policy); 1336 goto dropdst;
1335 } 1337 }
1336 1338
1337 if (!policy) 1339 if (!policy)
@@ -1501,8 +1503,9 @@ restart:
1501 return 0; 1503 return 0;
1502 1504
1503error: 1505error:
1504 dst_release(dst_orig);
1505 xfrm_pols_put(pols, npols); 1506 xfrm_pols_put(pols, npols);
1507dropdst:
1508 dst_release(dst_orig);
1506 *dst_p = NULL; 1509 *dst_p = NULL;
1507 return err; 1510 return err;
1508} 1511}
@@ -2159,7 +2162,7 @@ xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
2159 2162
2160 if (audit_enabled == 0) 2163 if (audit_enabled == 0)
2161 return; 2164 return;
2162 audit_buf = xfrm_audit_start(sid, auid); 2165 audit_buf = xfrm_audit_start(auid, sid);
2163 if (audit_buf == NULL) 2166 if (audit_buf == NULL)
2164 return; 2167 return;
2165 audit_log_format(audit_buf, " op=SPD-add res=%u", result); 2168 audit_log_format(audit_buf, " op=SPD-add res=%u", result);
@@ -2176,7 +2179,7 @@ xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
2176 2179
2177 if (audit_enabled == 0) 2180 if (audit_enabled == 0)
2178 return; 2181 return;
2179 audit_buf = xfrm_audit_start(sid, auid); 2182 audit_buf = xfrm_audit_start(auid, sid);
2180 if (audit_buf == NULL) 2183 if (audit_buf == NULL)
2181 return; 2184 return;
2182 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 cf43c49eab37..ee1e69753932 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2028,17 +2028,18 @@ void
2028xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid) 2028xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
2029{ 2029{
2030 struct audit_buffer *audit_buf; 2030 struct audit_buffer *audit_buf;
2031 u32 spi;
2031 extern int audit_enabled; 2032 extern int audit_enabled;
2032 2033
2033 if (audit_enabled == 0) 2034 if (audit_enabled == 0)
2034 return; 2035 return;
2035 audit_buf = xfrm_audit_start(sid, auid); 2036 audit_buf = xfrm_audit_start(auid, sid);
2036 if (audit_buf == NULL) 2037 if (audit_buf == NULL)
2037 return; 2038 return;
2038 audit_log_format(audit_buf, " op=SAD-add res=%u",result); 2039 audit_log_format(audit_buf, " op=SAD-add res=%u",result);
2039 xfrm_audit_common_stateinfo(x, audit_buf); 2040 xfrm_audit_common_stateinfo(x, audit_buf);
2040 audit_log_format(audit_buf, " spi=%lu(0x%lx)", 2041 spi = ntohl(x->id.spi);
2041 (unsigned long)x->id.spi, (unsigned long)x->id.spi); 2042 audit_log_format(audit_buf, " spi=%u(0x%x)", spi, spi);
2042 audit_log_end(audit_buf); 2043 audit_log_end(audit_buf);
2043} 2044}
2044EXPORT_SYMBOL_GPL(xfrm_audit_state_add); 2045EXPORT_SYMBOL_GPL(xfrm_audit_state_add);
@@ -2047,17 +2048,18 @@ void
2047xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid) 2048xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
2048{ 2049{
2049 struct audit_buffer *audit_buf; 2050 struct audit_buffer *audit_buf;
2051 u32 spi;
2050 extern int audit_enabled; 2052 extern int audit_enabled;
2051 2053
2052 if (audit_enabled == 0) 2054 if (audit_enabled == 0)
2053 return; 2055 return;
2054 audit_buf = xfrm_audit_start(sid, auid); 2056 audit_buf = xfrm_audit_start(auid, sid);
2055 if (audit_buf == NULL) 2057 if (audit_buf == NULL)
2056 return; 2058 return;
2057 audit_log_format(audit_buf, " op=SAD-delete res=%u",result); 2059 audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
2058 xfrm_audit_common_stateinfo(x, audit_buf); 2060 xfrm_audit_common_stateinfo(x, audit_buf);
2059 audit_log_format(audit_buf, " spi=%lu(0x%lx)", 2061 spi = ntohl(x->id.spi);
2060 (unsigned long)x->id.spi, (unsigned long)x->id.spi); 2062 audit_log_format(audit_buf, " spi=%u(0x%x)", spi, spi);
2061 audit_log_end(audit_buf); 2063 audit_log_end(audit_buf);
2062} 2064}
2063EXPORT_SYMBOL_GPL(xfrm_audit_state_delete); 2065EXPORT_SYMBOL_GPL(xfrm_audit_state_delete);
diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index ce59fc2d8de4..6501a50e17f0 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -18,7 +18,8 @@ def getsizes(file):
18 for l in os.popen("nm --size-sort " + file).readlines(): 18 for l in os.popen("nm --size-sort " + file).readlines():
19 size, type, name = l[:-1].split() 19 size, type, name = l[:-1].split()
20 if type in "tTdDbB": 20 if type in "tTdDbB":
21 if "." in name: name = "static." + name.split(".")[0] 21 # function names begin with '.' on 64-bit powerpc
22 if "." in name[1:]: name = "static." + name.split(".")[0]
22 sym[name] = sym.get(name, 0) + int(size, 16) 23 sym[name] = sym.get(name, 0) + int(size, 16)
23 return sym 24 return sym
24 25
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index 9ad1bd793252..e0f54b9d8fec 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -13,7 +13,7 @@
13test ! -r $2/Makefile -o -O $2/Makefile || exit 0 13test ! -r $2/Makefile -o -O $2/Makefile || exit 0
14# Only overwrite automatically generated Makefiles 14# Only overwrite automatically generated Makefiles
15# (so we do not overwrite kernel Makefile) 15# (so we do not overwrite kernel Makefile)
16if ! grep -q Automatically $2/Makefile 16if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
17then 17then
18 exit 0 18 exit 0
19fi 19fi
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 7bc2767e1584..55c6c822bec1 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -113,9 +113,9 @@ static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
113 gsr_bits = 0; 113 gsr_bits = 0;
114#ifdef CONFIG_PXA27x 114#ifdef CONFIG_PXA27x
115 /* PXA27x Developers Manual section 13.5.2.2.1 */ 115 /* PXA27x Developers Manual section 13.5.2.2.1 */
116 pxa_set_cken(1 << 31, 1); 116 pxa_set_cken(CKEN_AC97CONF, 1);
117 udelay(5); 117 udelay(5);
118 pxa_set_cken(1 << 31, 0); 118 pxa_set_cken(CKEN_AC97CONF, 0);
119 GCR = GCR_COLD_RST; 119 GCR = GCR_COLD_RST;
120 udelay(50); 120 udelay(50);
121#else 121#else
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index dd14abcdf1bd..60e6f4677f93 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -160,9 +160,9 @@ static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
160 gsr_bits = 0; 160 gsr_bits = 0;
161#ifdef CONFIG_PXA27x 161#ifdef CONFIG_PXA27x
162 /* PXA27x Developers Manual section 13.5.2.2.1 */ 162 /* PXA27x Developers Manual section 13.5.2.2.1 */
163 pxa_set_cken(31, 1); 163 pxa_set_cken(CKEN_AC97CONF, 1);
164 udelay(5); 164 udelay(5);
165 pxa_set_cken(31, 0); 165 pxa_set_cken(CKEN_AC97CONF, 0);
166 GCR = GCR_COLD_RST; 166 GCR = GCR_COLD_RST;
167 udelay(50); 167 udelay(50);
168#else 168#else