aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/deviceiobook.tmpl3
-rw-r--r--Documentation/HOWTO4
-rw-r--r--Documentation/SubmittingPatches2
-rw-r--r--Documentation/accounting/getdelays.c2
-rw-r--r--Documentation/dvb/get_dvb_firmware24
-rw-r--r--Documentation/filesystems/9p.txt24
-rw-r--r--Documentation/ko_KR/HOWTO623
-rw-r--r--Documentation/vm/numa_memory_policy.txt332
-rw-r--r--Documentation/watchdog/00-INDEX10
-rw-r--r--MAINTAINERS8
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c8
-rw-r--r--arch/arm/mach-s3c2442/Kconfig2
-rw-r--r--arch/avr32/boards/atngw100/setup.c18
-rw-r--r--arch/avr32/boards/atstk1000/Kconfig26
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c62
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig1
-rw-r--r--arch/h8300/kernel/process.c1
-rw-r--r--arch/h8300/kernel/sys_h8300.c1
-rw-r--r--arch/i386/Kconfig13
-rw-r--r--arch/i386/Makefile4
-rw-r--r--arch/i386/boot/edd.c54
-rw-r--r--arch/i386/boot/video.c2
-rw-r--r--arch/i386/kernel/alternative.c2
-rw-r--r--arch/i386/kernel/apic.c2
-rw-r--r--arch/i386/kernel/nmi.c4
-rw-r--r--arch/i386/kernel/tsc.c1
-rw-r--r--arch/i386/mm/fault.c5
-rw-r--r--arch/i386/xen/xen-head.S6
-rw-r--r--arch/ia64/Kconfig12
-rw-r--r--arch/ia64/configs/bigsur_defconfig2
-rw-r--r--arch/ia64/configs/gensparse_defconfig2
-rw-r--r--arch/ia64/configs/sim_defconfig2
-rw-r--r--arch/ia64/configs/sn2_defconfig2
-rw-r--r--arch/ia64/configs/tiger_defconfig2
-rw-r--r--arch/ia64/configs/zx1_defconfig2
-rw-r--r--arch/ia64/defconfig3
-rw-r--r--arch/ia64/hp/sim/boot/boot_head.S1
-rw-r--r--arch/ia64/kernel/cpufreq/acpi-cpufreq.c6
-rw-r--r--arch/ia64/kernel/irq.c5
-rw-r--r--arch/ia64/kernel/mca.c34
-rw-r--r--arch/ia64/kernel/process.c10
-rw-r--r--arch/ia64/kernel/ptrace.c10
-rw-r--r--arch/ia64/kernel/setup.c7
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S12
-rw-r--r--arch/ia64/mm/fault.c14
-rw-r--r--arch/ia64/sn/kernel/irq.c12
-rw-r--r--arch/m68k/kernel/setup.c2
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds4
-rw-r--r--arch/m68k/mm/motorola.c6
-rw-r--r--arch/m68knommu/kernel/process.c1
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c1
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts88
-rw-r--r--arch/powerpc/boot/dts/mpc8641_hpcn.dts114
-rw-r--r--arch/powerpc/boot/flatdevtree.c18
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/misc_32.S12
-rw-r--r--arch/powerpc/kernel/traps.c4
-rw-r--r--arch/powerpc/mm/hash_utils_64.c2
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/85xx/mpc8544_ds.c214
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/86xx/mpc86xx_hpcn.c224
-rw-r--r--arch/powerpc/platforms/Kconfig8
-rw-r--r--arch/powerpc/platforms/Makefile3
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c1
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c255
-rw-r--r--arch/powerpc/platforms/ps3/device-init.c2
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c2
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c1
-rw-r--r--arch/powerpc/sysdev/rtc_cmos_setup.c17
-rw-r--r--arch/ppc/kernel/misc.S12
-rw-r--r--arch/s390/hypfs/inode.c33
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/diag.c102
-rw-r--r--arch/s390/kernel/dis.c2
-rw-r--r--arch/s390/kernel/kprobes.c2
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/mm/cmm.c1
-rw-r--r--arch/s390/mm/init.c17
-rw-r--r--arch/sh/Makefile17
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh4-202.c5
-rw-r--r--arch/sh/kernel/early_printk.c2
-rw-r--r--arch/sh/kernel/machvec.c7
-rw-r--r--arch/sh/kernel/ptrace.c1
-rw-r--r--arch/sh64/kernel/setup.c4
-rw-r--r--arch/sh64/kernel/signal.c1
-rw-r--r--arch/sparc/kernel/ebus.c1
-rw-r--r--arch/sparc/mm/io-unit.c18
-rw-r--r--arch/sparc/mm/iommu.c12
-rw-r--r--arch/sparc/mm/sun4c.c2
-rw-r--r--arch/sparc64/kernel/head.S14
-rw-r--r--arch/sparc64/kernel/mdesc.c38
-rw-r--r--arch/sparc64/kernel/trampoline.S7
-rw-r--r--arch/sparc64/lib/Makefile2
-rw-r--r--arch/sparc64/lib/NG2copy_from_user.S40
-rw-r--r--arch/sparc64/lib/NG2copy_to_user.S49
-rw-r--r--arch/sparc64/lib/NG2memcpy.S520
-rw-r--r--arch/sparc64/lib/NG2page.S61
-rw-r--r--arch/sparc64/lib/NG2patch.S33
-rw-r--r--arch/sparc64/lib/NGpage.S1
-rw-r--r--arch/um/drivers/ubd_kern.c4
-rw-r--r--arch/x86_64/Makefile4
-rw-r--r--arch/x86_64/kernel/head.S3
-rw-r--r--arch/x86_64/kernel/nmi.c4
-rw-r--r--arch/x86_64/kernel/pci-dma.c4
-rw-r--r--drivers/acpi/processor_idle.c32
-rw-r--r--drivers/ata/ata_piix.c9
-rw-r--r--drivers/ata/libata-core.c9
-rw-r--r--drivers/ata/pata_artop.c19
-rw-r--r--drivers/ata/pata_hpt37x.c20
-rw-r--r--drivers/ata/pata_hpt3x2n.c8
-rw-r--r--drivers/ata/pata_isapnp.c2
-rw-r--r--drivers/ata/pata_it821x.c2
-rw-r--r--drivers/ata/pata_pdc2027x.c18
-rw-r--r--drivers/ata/pata_sis.c1
-rw-r--r--drivers/ata/pata_via.c5
-rw-r--r--drivers/ata/sata_mv.c3
-rw-r--r--drivers/atm/Kconfig5
-rw-r--r--drivers/auxdisplay/Kconfig5
-rw-r--r--drivers/auxdisplay/cfag12864b.c2
-rw-r--r--drivers/block/Kconfig7
-rw-r--r--drivers/block/lguest_blk.c9
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c2
-rw-r--r--drivers/char/keyboard.c4
-rw-r--r--drivers/char/synclink_gt.c4
-rw-r--r--drivers/char/tpm/tpm.c2
-rw-r--r--drivers/char/tpm/tpm.h2
-rw-r--r--drivers/char/tpm/tpm_atmel.c2
-rw-r--r--drivers/char/tpm/tpm_atmel.h2
-rw-r--r--drivers/char/tpm/tpm_bios.c2
-rw-r--r--drivers/char/tpm/tpm_nsc.c2
-rw-r--r--drivers/char/tpm/tpm_tis.c2
-rw-r--r--drivers/char/tty_io.c6
-rw-r--r--drivers/char/watchdog/alim1535_wdt.c7
-rw-r--r--drivers/char/watchdog/eurotechwdt.c13
-rw-r--r--drivers/crypto/Kconfig5
-rw-r--r--drivers/dma/ioatdma.c7
-rw-r--r--drivers/dma/ioatdma.h3
-rw-r--r--drivers/hid/Kconfig5
-rw-r--r--drivers/hwmon/smsc47m1.c2
-rw-r--r--drivers/hwmon/w83627ehf.c56
-rw-r--r--drivers/hwmon/w83781d.c4
-rw-r--r--drivers/ide/Kconfig12
-rw-r--r--drivers/ide/cris/ide-cris.c2
-rw-r--r--drivers/ide/ide-disk.c18
-rw-r--r--drivers/ide/ide-dma.c45
-rw-r--r--drivers/ide/ide-iops.c45
-rw-r--r--drivers/ide/pci/cs5530.c8
-rw-r--r--drivers/ide/pci/hpt34x.c6
-rw-r--r--drivers/ide/pci/ns87415.c9
-rw-r--r--drivers/ide/pci/pdc202xx_new.c10
-rw-r--r--drivers/ide/pci/pdc202xx_old.c9
-rw-r--r--drivers/ide/pci/triflex.c3
-rw-r--r--drivers/ide/ppc/pmac.c14
-rw-r--r--drivers/infiniband/core/agent.c24
-rw-r--r--drivers/infiniband/core/agent.h6
-rw-r--r--drivers/infiniband/core/device.c2
-rw-r--r--drivers/infiniband/core/mad.c25
-rw-r--r--drivers/infiniband/core/mad_rmpp.c8
-rw-r--r--drivers/infiniband/core/sa_query.c4
-rw-r--r--drivers/infiniband/core/umem.c5
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_cm.c16
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c2
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c1
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c31
-rw-r--r--drivers/input/misc/Kconfig1
-rw-r--r--drivers/isdn/hisax/hfc_usb.c603
-rw-r--r--drivers/isdn/hisax/hfc_usb.h130
-rw-r--r--drivers/kvm/Kconfig5
-rw-r--r--drivers/kvm/kvm_main.c4
-rw-r--r--drivers/lguest/Kconfig2
-rw-r--r--drivers/macintosh/Kconfig5
-rw-r--r--drivers/macintosh/mac_hid.c1
-rw-r--r--drivers/macintosh/via-pmu68k.c240
-rw-r--r--drivers/md/raid1.c25
-rw-r--r--drivers/media/dvb/b2c2/flexcop-i2c.c7
-rw-r--r--drivers/media/dvb/dvb-core/dvb_net.c5
-rw-r--r--drivers/media/dvb/frontends/dvb-pll.c2
-rw-r--r--drivers/media/video/cafe_ccic.c35
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c1
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c3
-rw-r--r--drivers/media/video/ov7670.c5
-rw-r--r--drivers/media/video/pwc/pwc-if.c52
-rw-r--r--drivers/media/video/pwc/pwc.h1
-rw-r--r--drivers/misc/Kconfig5
-rw-r--r--drivers/misc/asus-laptop.c3
-rw-r--r--drivers/mmc/core/bus.c4
-rw-r--r--drivers/mmc/core/host.c4
-rw-r--r--drivers/mmc/host/sdhci.c53
-rw-r--r--drivers/mmc/host/sdhci.h1
-rw-r--r--drivers/net/Kconfig15
-rw-r--r--drivers/net/forcedeth.c10
-rw-r--r--drivers/net/mlx4/reset.c3
-rw-r--r--drivers/net/ppp_generic.c2
-rw-r--r--drivers/net/sky2.c4
-rw-r--r--drivers/pci/hotplug/cpqphp_ctrl.c4
-rw-r--r--drivers/pci/pci.h8
-rw-r--r--drivers/pci/probe.c18
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/rtc/rtc-m41t80.c2
-rw-r--r--drivers/rtc/rtc-max6902.c6
-rw-r--r--drivers/s390/block/dasd_diag.c1
-rw-r--r--drivers/s390/char/raw3270.c1
-rw-r--r--drivers/s390/char/vmur.c250
-rw-r--r--drivers/s390/char/vmur.h1
-rw-r--r--drivers/s390/cio/cmf.c10
-rw-r--r--drivers/s390/cio/device.c5
-rw-r--r--drivers/s390/cio/device_id.c48
-rw-r--r--drivers/s390/cio/qdio.c5
-rw-r--r--drivers/scsi/Kconfig10
-rw-r--r--drivers/serial/8250.c85
-rw-r--r--drivers/serial/8250_pci.c192
-rw-r--r--drivers/serial/serial_core.c7
-rw-r--r--drivers/serial/serial_txx9.c14
-rw-r--r--drivers/usb/Kconfig4
-rw-r--r--drivers/usb/atm/cxacru.c3
-rw-r--r--drivers/usb/atm/ueagle-atm.c5
-rw-r--r--drivers/usb/class/cdc-acm.c12
-rw-r--r--drivers/usb/core/driver.c9
-rw-r--r--drivers/usb/core/hub.c3
-rw-r--r--drivers/usb/core/message.c28
-rw-r--r--drivers/usb/core/quirks.c12
-rw-r--r--drivers/usb/gadget/dummy_hcd.c2
-rw-r--r--drivers/usb/gadget/file_storage.c10
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c77
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c4
-rw-r--r--drivers/usb/host/Kconfig2
-rw-r--r--drivers/usb/host/ehci-au1xxx.c5
-rw-r--r--drivers/usb/host/ehci-hcd.c67
-rw-r--r--drivers/usb/host/ehci-mem.c3
-rw-r--r--drivers/usb/host/ehci-ppc-soc.c22
-rw-r--r--drivers/usb/host/ehci-q.c4
-rw-r--r--drivers/usb/host/ehci-sched.c127
-rw-r--r--drivers/usb/host/ehci.h14
-rw-r--r--drivers/usb/host/ohci-dbg.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/host/u132-hcd.c3
-rw-r--r--drivers/usb/serial/airprime.c1
-rw-r--r--drivers/usb/serial/belkin_sa.c4
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.h3
-rw-r--r--drivers/usb/serial/garmin_gps.c93
-rw-r--r--drivers/usb/serial/ipaq.c1
-rw-r--r--drivers/usb/serial/option.c10
-rw-r--r--drivers/usb/serial/oti6858.c10
-rw-r--r--drivers/usb/serial/safe_serial.c6
-rw-r--r--drivers/usb/serial/visor.c2
-rw-r--r--drivers/usb/serial/visor.h3
-rw-r--r--drivers/usb/storage/unusual_devs.h2
-rw-r--r--drivers/usb/storage/usb.c33
-rw-r--r--drivers/usb/storage/usb.h1
-rw-r--r--drivers/video/au1100fb.c92
-rw-r--r--drivers/video/console/newport_con.c3
-rw-r--r--drivers/video/imsttfb.c2
-rw-r--r--drivers/video/pxafb.c2
-rw-r--r--drivers/w1/w1_int.c10
-rw-r--r--drivers/zorro/zorro-sysfs.c2
-rw-r--r--fs/9p/fid.c17
-rw-r--r--fs/9p/fid.h1
-rw-r--r--fs/autofs4/root.c31
-rw-r--r--fs/cifs/CHANGES5
-rw-r--r--fs/cifs/README13
-rw-r--r--fs/cifs/TODO3
-rw-r--r--fs/cifs/file.c33
-rw-r--r--fs/cifs/sess.c4
-rw-r--r--fs/direct-io.c18
-rw-r--r--fs/ecryptfs/inode.c4
-rw-r--r--fs/exec.c25
-rw-r--r--fs/jffs2/write.c3
-rw-r--r--fs/proc/array.c44
-rw-r--r--fs/signalfd.c14
-rw-r--r--fs/sysfs/bin.c7
-rw-r--r--fs/sysfs/dir.c21
-rw-r--r--include/asm-avr32/io.h2
-rw-r--r--include/asm-avr32/pgalloc.h30
-rw-r--r--include/asm-avr32/pgtable.h4
-rw-r--r--include/asm-i386/io.h3
-rw-r--r--include/asm-i386/mach-default/mach_wakecpu.h3
-rw-r--r--include/asm-i386/mach-es7000/mach_wakecpu.h3
-rw-r--r--include/asm-i386/nmi.h3
-rw-r--r--include/asm-ia64/atomic.h4
-rw-r--r--include/asm-ia64/hw_irq.h7
-rw-r--r--include/asm-ia64/machvec.h7
-rw-r--r--include/asm-ia64/machvec_init.h1
-rw-r--r--include/asm-ia64/machvec_sn2.h2
-rw-r--r--include/asm-m68k/ioctls.h4
-rw-r--r--include/asm-m68k/page.h10
-rw-r--r--include/asm-m68k/processor.h4
-rw-r--r--include/asm-m68k/termbits.h5
-rw-r--r--include/asm-m68k/termios.h6
-rw-r--r--include/asm-m68knommu/pgtable.h2
-rw-r--r--include/asm-powerpc/reg_booke.h12
-rw-r--r--include/asm-s390/atomic.h26
-rw-r--r--include/asm-s390/cio.h15
-rw-r--r--include/asm-s390/diag.h39
-rw-r--r--include/asm-s390/pgalloc.h2
-rw-r--r--include/asm-sh/dma-mapping.h19
-rw-r--r--include/asm-sh64/dma-mapping.h18
-rw-r--r--include/asm-sparc/sbus.h1
-rw-r--r--include/asm-sparc/sfp-machine.h6
-rw-r--r--include/asm-sparc64/elf.h10
-rw-r--r--include/asm-sparc64/percpu.h4
-rw-r--r--include/asm-sparc64/sfp-machine.h2
-rw-r--r--include/asm-sparc64/system.h26
-rw-r--r--include/asm-x86_64/nmi.h3
-rw-r--r--include/linux/audit.h4
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/kbd_kern.h3
-rw-r--r--include/linux/mempolicy.h2
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/linux/mmzone.h18
-rw-r--r--include/linux/mod_devicetable.h3
-rw-r--r--include/linux/pci.h4
-rw-r--r--include/linux/pci_ids.h9
-rw-r--r--include/linux/sched.h5
-rw-r--r--include/linux/security.h20
-rw-r--r--include/linux/selection.h2
-rw-r--r--include/linux/serial_reg.h1
-rw-r--r--include/linux/videodev2.h2
-rw-r--r--include/math-emu/op-common.h5
-rw-r--r--include/math-emu/soft-fp.h7
-rw-r--r--include/rdma/ib_mad.h2
-rw-r--r--include/rdma/ib_verbs.h7
-rw-r--r--kernel/auditsc.c2
-rw-r--r--kernel/futex.c1
-rw-r--r--kernel/irq/manage.c2
-rw-r--r--kernel/module.c3
-rw-r--r--kernel/posix-timers.c9
-rw-r--r--kernel/printk.c13
-rw-r--r--kernel/sched.c68
-rw-r--r--kernel/sched_debug.c3
-rw-r--r--kernel/signal.c4
-rw-r--r--kernel/sysctl.c1
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Makefile3
-rw-r--r--lib/iomap.c15
-rw-r--r--mm/hugetlb.c2
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/mmap.c6
-rw-r--r--mm/nommu.c2
-rw-r--r--mm/page_alloc.c13
-rw-r--r--mm/slab.c14
-rw-r--r--mm/slub.c15
-rw-r--r--mm/sparse.c14
-rw-r--r--mm/vmscan.c69
-rw-r--r--net/802/psnap.c17
-rw-r--r--net/8021q/vlanproc.c2
-rw-r--r--net/9p/conv.c1
-rw-r--r--net/9p/mux.c9
-rw-r--r--net/ax25/ax25_iface.c2
-rw-r--r--net/bridge/br_stp_if.c2
-rw-r--r--net/bridge/br_sysfs_br.c25
-rw-r--r--net/core/ethtool.c1
-rw-r--r--net/dccp/ccids/ccid2.c2
-rw-r--r--net/econet/af_econet.c3
-rw-r--r--net/ipv4/netfilter/nf_nat_sip.c2
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/irda/irmod.c2
-rw-r--r--net/irda/irnetlink.c2
-rw-r--r--net/mac80211/ieee80211.c1
-rw-r--r--net/mac80211/ieee80211_sta.c6
-rw-r--r--net/netfilter/nf_conntrack_sip.c8
-rw-r--r--net/netfilter/xt_u32.c2
-rw-r--r--net/socket.c2
-rw-r--r--security/commoncap.c4
-rw-r--r--security/dummy.c4
-rw-r--r--security/selinux/hooks.c4
-rw-r--r--security/selinux/ss/services.c2
371 files changed, 4879 insertions, 2711 deletions
diff --git a/Documentation/DocBook/deviceiobook.tmpl b/Documentation/DocBook/deviceiobook.tmpl
index 90ed23df1f68..c917de681ccd 100644
--- a/Documentation/DocBook/deviceiobook.tmpl
+++ b/Documentation/DocBook/deviceiobook.tmpl
@@ -316,7 +316,8 @@ CPU B: spin_unlock_irqrestore(&dev_lock, flags)
316 316
317 <chapter id="pubfunctions"> 317 <chapter id="pubfunctions">
318 <title>Public Functions Provided</title> 318 <title>Public Functions Provided</title>
319!Einclude/asm-i386/io.h 319!Iinclude/asm-i386/io.h
320!Elib/iomap.c
320 </chapter> 321 </chapter>
321 322
322</book> 323</book>
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index f8cc3f8ed152..c64e969dc33b 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -208,7 +208,7 @@ tools. One such tool that is particularly recommended is the Linux
208Cross-Reference project, which is able to present source code in a 208Cross-Reference project, which is able to present source code in a
209self-referential, indexed webpage format. An excellent up-to-date 209self-referential, indexed webpage format. An excellent up-to-date
210repository of the kernel code may be found at: 210repository of the kernel code may be found at:
211 http://sosdg.org/~coywolf/lxr/ 211 http://users.sosdg.org/~qiyong/lxr/
212 212
213 213
214The development process 214The development process
@@ -384,7 +384,7 @@ One of the best ways to put into practice your hacking skills is by fixing
384bugs reported by other people. Not only you will help to make the kernel 384bugs reported by other people. Not only you will help to make the kernel
385more stable, you'll learn to fix real world problems and you will improve 385more stable, you'll learn to fix real world problems and you will improve
386your skills, and other developers will be aware of your presence. Fixing 386your skills, and other developers will be aware of your presence. Fixing
387bugs is one of the best ways to earn merit amongst the developers, because 387bugs is one of the best ways to get merits among other developers, because
388not many people like wasting time fixing other people's bugs. 388not many people like wasting time fixing other people's bugs.
389 389
390To work in the already reported bug reports, go to http://bugzilla.kernel.org. 390To work in the already reported bug reports, go to http://bugzilla.kernel.org.
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index d6b45a9b29b4..397575880dc4 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -560,7 +560,7 @@ NO!!!! No more huge patch bombs to linux-kernel@vger.kernel.org people!
560 <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2> 560 <http://marc.theaimsgroup.com/?l=linux-kernel&m=112112749912944&w=2>
561 561
562Kernel Documentation/CodingStyle: 562Kernel Documentation/CodingStyle:
563 <http://sosdg.org/~coywolf/lxr/source/Documentation/CodingStyle> 563 <http://users.sosdg.org/~qiyong/lxr/source/Documentation/CodingStyle>
564 564
565Linus Torvalds's mail on the canonical patch format: 565Linus Torvalds's mail on the canonical patch format:
566 <http://lkml.org/lkml/2005/4/7/183> 566 <http://lkml.org/lkml/2005/4/7/183>
diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index 24c5aade8998..cbee3a27f768 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -196,7 +196,7 @@ void print_delayacct(struct taskstats *t)
196 "IO %15s%15s\n" 196 "IO %15s%15s\n"
197 " %15llu%15llu\n" 197 " %15llu%15llu\n"
198 "MEM %15s%15s\n" 198 "MEM %15s%15s\n"
199 " %15llu%15llu\n" 199 " %15llu%15llu\n",
200 "count", "real total", "virtual total", "delay total", 200 "count", "real total", "virtual total", "delay total",
201 t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total, 201 t->cpu_count, t->cpu_run_real_total, t->cpu_run_virtual_total,
202 t->cpu_delay_total, 202 t->cpu_delay_total,
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware
index b4d306ae9234..f2e908d7f90d 100644
--- a/Documentation/dvb/get_dvb_firmware
+++ b/Documentation/dvb/get_dvb_firmware
@@ -111,21 +111,21 @@ sub tda10045 {
111} 111}
112 112
113sub tda10046 { 113sub tda10046 {
114 my $sourcefile = "tt_budget_217g.zip"; 114 my $sourcefile = "TT_PCI_2.19h_28_11_2006.zip";
115 my $url = "http://www.technotrend.de/new/217g/$sourcefile"; 115 my $url = "http://technotrend-online.com/download/software/219/$sourcefile";
116 my $hash = "6a7e1e2f2644b162ff0502367553c72d"; 116 my $hash = "6a7e1e2f2644b162ff0502367553c72d";
117 my $outfile = "dvb-fe-tda10046.fw"; 117 my $outfile = "dvb-fe-tda10046.fw";
118 my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); 118 my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
119 119
120 checkstandard(); 120 checkstandard();
121 121
122 wgetfile($sourcefile, $url); 122 wgetfile($sourcefile, $url);
123 unzip($sourcefile, $tmpdir); 123 unzip($sourcefile, $tmpdir);
124 extract("$tmpdir/software/OEM/PCI/App/ttlcdacc.dll", 0x3f731, 24478, "$tmpdir/fwtmp"); 124 extract("$tmpdir/TT_PCI_2.19h_28_11_2006/software/OEM/PCI/App/ttlcdacc.dll", 0x65389, 24478, "$tmpdir/fwtmp");
125 verify("$tmpdir/fwtmp", $hash); 125 verify("$tmpdir/fwtmp", $hash);
126 copy("$tmpdir/fwtmp", $outfile); 126 copy("$tmpdir/fwtmp", $outfile);
127 127
128 $outfile; 128 $outfile;
129} 129}
130 130
131sub tda10046lifeview { 131sub tda10046lifeview {
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt
index bbd8b28c13de..cda6905cbe49 100644
--- a/Documentation/filesystems/9p.txt
+++ b/Documentation/filesystems/9p.txt
@@ -6,12 +6,26 @@ ABOUT
6 6
7v9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol. 7v9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol.
8 8
9This software was originally developed by Ron Minnich <rminnich@lanl.gov> 9This software was originally developed by Ron Minnich <rminnich@sandia.gov>
10and Maya Gokhale <maya@lanl.gov>. Additional development by Greg Watson 10and Maya Gokhale. Additional development by Greg Watson
11<gwatson@lanl.gov> and most recently Eric Van Hensbergen 11<gwatson@lanl.gov> and most recently Eric Van Hensbergen
12<ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox 12<ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox
13<rsc@swtch.com>. 13<rsc@swtch.com>.
14 14
15The best detailed explanation of the Linux implementation and applications of
16the 9p client is available in the form of a USENIX paper:
17 http://www.usenix.org/events/usenix05/tech/freenix/hensbergen.html
18
19Other applications are described in the following papers:
20 * XCPU & Clustering
21 http://www.xcpu.org/xcpu-talk.pdf
22 * KVMFS: control file system for KVM
23 http://www.xcpu.org/kvmfs.pdf
24 * CellFS: A New ProgrammingModel for the Cell BE
25 http://www.xcpu.org/cellfs-talk.pdf
26 * PROSE I/O: Using 9p to enable Application Partitions
27 http://plan9.escet.urjc.es/iwp9/cready/PROSE_iwp9_2006.pdf
28
15USAGE 29USAGE
16===== 30=====
17 31
@@ -90,9 +104,9 @@ subset of the namespace by extending the path: '#U*'/tmp would just export
90and export. 104and export.
91 105
92A Linux version of the 9p server is now maintained under the npfs project 106A Linux version of the 9p server is now maintained under the npfs project
93on sourceforge (http://sourceforge.net/projects/npfs). There is also a 107on sourceforge (http://sourceforge.net/projects/npfs). The currently
94more stable single-threaded version of the server (named spfs) available from 108maintained version is the single-threaded version of the server (named spfs)
95the same CVS repository. 109available from the same CVS repository.
96 110
97There are user and developer mailing lists available through the v9fs project 111There are user and developer mailing lists available through the v9fs project
98on sourceforge (http://sourceforge.net/projects/v9fs). 112on sourceforge (http://sourceforge.net/projects/v9fs).
diff --git a/Documentation/ko_KR/HOWTO b/Documentation/ko_KR/HOWTO
new file mode 100644
index 000000000000..b51d7ca842ba
--- /dev/null
+++ b/Documentation/ko_KR/HOWTO
@@ -0,0 +1,623 @@
1NOTE:
2This is a version of Documentation/HOWTO translated into korean
3This document is maintained by minchan Kim < minchan.kim@gmail.com>
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.
6
7Please also note that the purpose of this file is to be easier to
8read for non English (read: korean) speakers and is not intended as
9a fork. So if you have any comments or updates for this file please
10try to update the original English file first.
11
12==================================
13이 문서는
14Documentation/HOWTO
15의 한글 번역입니다.
16
17역자: 김민찬 <minchan.kim@gmail.com >
18감수: 이제이미 <jamee.lee@samsung.com>
19==================================
20
21어떻게 리눅스 커널 개발을 하는가
22---------------------------------
23
24이 문서는 커널 개발에 있어 가장 중요한 문서이다. 이 문서는
25리눅스 커널 개발자가 되는 법과 리눅스 커널 개발 커뮤니티와 일하는
26법을 담고있다. 커널 프로그래밍의기술적인 측면과 관련된 내용들은
27포함하지 않으려고 하였지만 올바으로 여러분을 안내하는 데 도움이
28될 것이다.
29
30이 문서에서 오래된 것을 발견하면 문서의 아래쪽에 나열된 메인트너에게
31패치를 보내달라.
32
33
34소개
35----
36
37자, 여러분은 리눅스 커널 개발자가 되는 법을 배우고 싶은가? 아니면
38상사로부터"이 장치를 위한 리눅스 드라이버를 작성하시오"라는 말을
39들었는가? 이 문서는 여러분이 겪게 될 과정과 커뮤니티와 일하는 법을
40조언하여 여러분의 목적을 달성하기 위해 필요한 것 모두를 알려주는
41것이다.
42
43커널은 대부분은 C로 작성되었어고 몇몇 아키텍쳐의 의존적인 부분은
44어셈블리로 작성되었다. 커널 개발을 위해 C를 잘 이해하고 있어야 한다.
45여러분이 특정 아키텍쳐의 low-level 개발을 할 것이 아니라면
46어셈블리(특정 아키텍쳐)는 잘 알아야 할 필요는 없다.
47다음의 참고서적들은 기본에 충실한 C 교육이나 수년간의 경험에 견주지는
48못하지만 적어도 참고 용도로는 좋을 것이다
49 - "The C Programming Language" by Kernighan and Ritchie [Prentice Hall]
50 - "Practical C Programming" by Steve Oualline [O'Reilly]
51 - "C: A Reference Manual" by Harbison and Steele [Prentice Hall]
52
53커널은 GNU C와 GNU 툴체인을 사용하여 작성되었다. 이 툴들은 ISO C89 표준을
54따르는 반면 표준에 있지 않은 많은 확장기능도 가지고 있다. 커널은 표준 C
55라이브러리와는 관계없이 freestanding C 환경이어서 C 표준의 일부는
56지원되지 않는다. 임의의 long long 나누기나 floating point는 지원되지 않는다.
57때론 이런 이유로 커널이 그런 확장 기능을 가진 툴체인을 가지고 만들어졌다는
58것이 이해하기 어려울 수도 있고 게다가 불행하게도 그런 것을 정확하게 설명하는
59어떤 참고문서도 있지 않다. 정보를 얻기 위해서는 gcc info (`info gcc`)페이지를
60살펴보라.
61
62여러분은 기존의 개발 커뮤니티와 일하는 법을 배우려고 하고 있다는 것을
63기억하라. 코딩, 스타일, 절차에 관한 훌륭한 표준을 가진 사람들이 모인
64다양한 그룹이 있다. 이 표준들은 오랜동안 크고 지역적으로 분산된 팀들에
65의해 가장 좋은 방법으로 일하기위하여 찾은 것을 기초로 만들어져왔다.
66그 표준들은 문서화가 잘 되어 있기 때문에 가능한한 미리 많은 표준들에
67관하여 배우려고 시도하라. 다른 사람들은 여러분이나 여러분의 회사가
68일하는 방식에 적응하는 것을 원하지는 않는다.
69
70
71법적 문제
72---------
73
74리눅스 커널 소스 코드는 GPL로 배포(release)되었다. 소스트리의 메인
75디렉토리에 있는 라이센스에 관하여 상세하게 쓰여 있는 COPYING이라는
76파일을 봐라.여러분이 라이센스에 관한 더 깊은 문제를 가지고 있다면
77리눅스 커널 메일링 리스트에 묻지말고 변호사와 연락하라. 메일링
78리스트들에 있는 사람들은 변호사가 아니기 때문에 법적 문제에 관하여
79그들의 말에 의지해서는 안된다.
80
81GPL에 관한 잦은 질문들과 답변들은 다음을 참조하라.
82 http://www.gnu.org/licenses/gpl-faq.html
83
84
85문서
86----
87
88리눅스 커널 소스 트리는 커널 커뮤니티와 일하는 법을 배우기 위한 많은
89귀중한 문서들을 가지고 있다. 새로운 기능들이 커널에 들어가게 될 때,
90그 기능을 어떻게 사용하는지에 관한 설명을 위하여 새로운 문서 파일을
91추가하는 것을 권장한다. 커널이 유저스페이스로 노출하는 인터페이스를
92변경하게 되면 변경을 설명하는 메뉴얼 페이지들에 대한 패치나 정보를
93mtk-manpages@gmx.net의 메인트너에게 보낼 것을 권장한다.
94
95다음은 커널 소스 트리에 있는 읽어야 할 파일들의 리스트이다.
96 README
97 이 파일은 리눅스 커널에 관하여 간단한 배경 설명과 커널을 설정하고
98 빌드하기 위해 필요한 것을 설명한다. 커널에 입문하는 사람들은 여기서
99 시작해야 한다.
100
101 Documentation/Changes
102 이 파일은 커널을 성공적으로 빌드하고 실행시키기 위해 필요한 다양한
103 소프트웨어 패키지들의 최소 버젼을 나열한다.
104
105 Documentation/CodingStyle
106 이 문서는 리눅스 커널 코딩 스타일과 그렇게 한 몇몇 이유를 설명한다.
107 모든 새로운 코드는 이 문서에 가이드라인들을 따라야 한다. 대부분의
108 메인트너들은 이 규칙을 따르는 패치들만을 받아들일 것이고 많은 사람들이
109 그 패치가 올바른 스타일일 경우만 코드를 검토할 것이다.
110
111 Documentation/SubmittingPatches
112 Documentation/SubmittingDrivers
113 이 파일들은 성공적으로 패치를 만들고 보내는 법을 다음의 내용들로
114 굉장히 상세히 설명하고 있다(그러나 다음으로 한정되진 않는다).
115 - Email 내용들
116 - Email 양식
117 - 그것을 누구에게 보낼지
118 이러한 규칙들을 따르는 것이 성공을 보장하진 않는다(왜냐하면 모든
119 패치들은 내용과 스타일에 관하여 면밀히 검토되기 때문이다).
120 그러나 규칙을 따르지 않는다면 거의 성공하지도 못할 것이다.
121
122 올바른 패치들을 만드는 법에 관한 훌륭한 다른 문서들이 있다.
123 "The Perfect Patch"
124 http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
125 "Linux kernel patch submission format"
126 http://linux.yyz.us/patch-format.html
127
128 Documentation/stable_api_nonsense.txt
129 이 문서는 의도적으로 커널이 변하지 않는 API를 갖지 않도록 결정한
130 이유를 설명하며 다음과 같은 것들을 포함한다.
131 - 서브시스템 shim-layer(호환성을 위해?)
132 - 운영 체제들 간의 드라이버 이식성
133 - 커널 소스 트리내에 빠른 변화를 늦추는 것(또는 빠른 변화를 막는 것)
134 이 문서는 리눅스 개발 철학을 이해하는데 필수적이며 다른 운영체제에서
135 리눅스로 옮겨오는 사람들에게는 매우 중요하다.
136
137
138 Documentation/SecurityBugs
139 여러분들이 리눅스 커널의 보안 문제를 발견했다고 생각한다면 이 문서에
140 나온 단계에 따라서 커널 개발자들에게 알리고 그 문제를 해결할 수 있도록
141 도와 달라.
142
143 Documentation/ManagementStyle
144 이 문서는 리눅스 커널 메인트너들이 어떻게 그들의 방법론의 정신을
145 어떻게 공유하고 운영하는지를 설명한다. 이것은 커널 개발에 입문하는
146 모든 사람들(또는 커널 개발에 작은 호기심이라도 있는 사람들)이
147 읽어야 할 중요한 문서이다. 왜냐하면 이 문서는 커널 메인트너들의
148 독특한 행동에 관하여 흔히 있는 오해들과 혼란들을 해소하고 있기
149 때문이다.
150
151 Documentation/stable_kernel_rules.txt
152 이 문서는 안정적인 커널 배포가 이루어지는 규칙을 설명하고 있으며
153 여러분들이 이러한 배포들 중 하나에 변경을 하길 원한다면
154 무엇을 해야 하는지를 설명한다.
155
156 Documentation/kernel-docs.txt
157 커널 개발에 관계된 외부 문서의 리스트이다. 커널 내의 포함된 문서들
158 중에 여러분이 찾고 싶은 문서를 발견하지 못할 경우 이 리스트를
159 살펴보라.
160
161 Documentation/applying-patches.txt
162 패치가 무엇이며 그것을 커널의 다른 개발 브랜치들에 어떻게
163 적용하는지에 관하여 자세히 설명 하고 있는 좋은 입문서이다.
164
165커널은 소스 코드 그 자체에서 자동적으로 만들어질 수 있는 많은 문서들을
166가지고 있다. 이것은 커널 내의 API에 대한 모든 설명, 그리고 락킹을
167올바르게 처리하는 법에 관한 규칙을 포함하고 있다. 이 문서는
168Documentation/DocBook/ 디렉토리 내에서 만들어지며 PDF, Postscript, HTML,
169그리고 man 페이지들로 다음과 같이 실행하여 만들어 진다.
170 make pdfdocs
171 make psdocs
172 make htmldocs
173 make mandocs
174각각의 명령을 메인 커널 소스 디렉토리로부터 실행한다.
175
176
177커널 개발자가 되는 것
178---------------------
179
180여러분이 리눅스 커널 개발에 관하여 아무것도 모른다면 Linux KernelNewbies
181프로젝트를 봐야 한다.
182 http://kernelnewbies.org
183그곳은 거의 모든 종류의 기본적인 커널 개발 질문들(질문하기 전에 먼저
184아카이브를 찾아봐라. 과거에 이미 답변되었을 수도 있다)을 할수있는 도움이
185될만한 메일링 리스트가 있다. 또한 실시간으로 질문 할수 있는 IRC 채널도
186가지고 있으며 리눅스 커널 개발을 배우는 데 유용한 문서들을 보유하고 있다.
187
188웹사이트는 코드구성, 서브시스템들, 그리고 현재 프로젝트들
189(트리 내, 외부에 존재하는)에 관한 기본적인 정보들을 가지고 있다. 또한
190그곳은 커널 컴파일이나 패치를 하는 법과 같은 기본적인 것들을 설명한다.
191
192여러분이 어디서 시작해야 할진 모르지만 커널 개발 커뮤니티에 참여할 수
193있는 일들을 찾길 원한다면 리눅스 커널 Janitor 프로젝트를 살펴봐라.
194 http://janitor.kernelnewbies.org/
195그곳은 시작하기에 아주 딱 좋은 곳이다. 그곳은 리눅스 커널 소스 트리내에
196간단히 정리되고 수정될 수 있는 문제들에 관하여 설명한다. 여러분은 이
197프로젝트를 대표하는 개발자들과 일하면서 자신의 패치를 리눅스 커널 트리에
198반영하기 위한 기본적인 것들을 배우게 될것이며 여러분이 아직 아이디어를
199가지고 있지 않다면 다음에 무엇을 해야할지에 관한 방향을 배울 수 있을
200것이다.
201
202여러분들이 이미 커널 트리에 반영하길 원하는 코드 묶음을 가지고 있지만
203올바른 포맷으로 포장하는데 도움이 필요하다면 그러한 문제를 돕기 위해
204만들어진 kernel-mentors 프로젝트가 있다. 그곳은 메일링 리스트이며
205다음에서 참조할 수 있다.
206 http://selenic.com/mailman/listinfo/kernel-mentors
207
208리눅스 커널 코드에 실제 변경을 하기 전에 반드시 그 코드가 어떻게
209동작하는지 이해하고 있어야 한다. 코드를 분석하기 위하여 특정한 툴의
210도움을 빌려서라도 코드를 직접 읽는 것보다 좋은 것은 없다(대부분의
211자잘한 부분들은 잘 코멘트되어 있다). 그런 툴들 중에 특히 추천할만한
212것은 Linux Cross-Reference project이며 그것은 자기 참조 방식이며
213소스코드를 인덱스된 웹 페이지들의 형태로 보여준다. 최신의 멋진 커널
214코드 저장소는 다음을 통하여 참조할 수 있다.
215 http://sosdg.org/~coywolf/lxr/
216
217
218개발 프로세스
219-------------
220
221리눅스 커널 개발 프로세스는 현재 몇몇 다른 메인 커널 "브랜치들"과
222서브시스템에 특화된 커널 브랜치들로 구성된다. 몇몇 다른 메인
223브랜치들은 다음과 같다.
224 - main 2.6.x 커널 트리
225 - 2.6.x.y - 안정된 커널 트리
226 - 2.6.x -git 커널 패치들
227 - 2.6.x -mm 커널 패치들
228 - 서브시스템을 위한 커널 트리들과 패치들
229
2302.6.x 커널 트리
231---------------
232
2332.6.x 커널들은 Linux Torvalds가 관리하며 kernel.org의 pub/linux/kernel/v2.6/
234디렉토리에서 참조될 수 있다.개발 프로세스는 다음과 같다.
235 - 새로운 커널이 배포되자마자 2주의 시간이 주어진다. 이 기간동은
236 메인트너들은 큰 diff들을 Linus에게 제출할 수 있다. 대개 이 패치들은
237 몇 주 동안 -mm 커널내에 이미 있었던 것들이다. 큰 변경들을 제출하는 데
238 선호되는 방법은 git(커널의 소스 관리 툴, 더 많은 정보들은 http://git.or.cz/
239 에서 참조할 수 있다)를 사용하는 것이지만 순수한 패치파일의 형식으로 보내도
240 것도 무관하다.
241 - 2주 후에 -rc1 커널이 배포되며 지금부터는 전체 커널의 안정성에 영향을
242 미칠수 있는 새로운 기능들을 포함하지 않는 패치들만을 추가될 수 있다.
243 완전히 새로운 드라이버(혹은 파일시스템)는 -rc1 이후에만 받아들여진다는
244 것을 기억해라. 왜냐하면 변경이 자체내에서만 발생하고 추가된 코드가
245 드라이버 외부의 다른 부분에는 영향을 주지 않으므로 그런 변경은
246 퇴보(regression)를 일으킬 만한 위험을 가지고 있지 않기 때문이다. -rc1이
247 배포된 이후에 git를 사용하여 패치들을 Linus에게 보낼수 있지만 패치들은
248 공식적인 메일링 리스트로 보내서 검토를 받을 필요가 있다.
249 - 새로운 -rc는 Linus는 현재 git tree가 테스트 하기에 충분히 안정된 상태에
250 있다고 판단될 때마다 배포된다. 목표는 새로운 -rc 커널을 매주 배포하는
251 것이다.
252 - 이러한 프로세스는 커널이 "준비"되었다고 여겨질때까지 계속된다.
253 프로세스는 대체로 6주간 지속된다.
254 - 각 -rc 배포에 있는 알려진 퇴보의 목록들은 다음 URI에 남겨진다.
255 http://kernelnewbies.org/known_regressions
256
257커널 배포에 있어서 언급할만한 가치가 있는 리눅스 커널 메일링 리스트의
258Andrew Morton의 글이 있다.
259 "커널이 언제 배포될지는 아무로 모른다. 왜냐하면 배포는 알려진
260 버그의 상황에 따라 배포되는 것이지 미리정해 놓은 시간에 따라
261 배포되는 것은 아니기 때문이다."
262
2632.6.x.y - 안정 커널 트리
264------------------------
265
2664 자리 숫자로 이루어진 버젼의 커널들은 -stable 커널들이다. 그것들은 2.6.x
267커널에서 발견된 큰 퇴보들이나 보안 문제들 중 비교적 작고 중요한 수정들을
268포함한다.
269
270이것은 가장 최근의 안정적인 커널을 원하는 사용자에게 추천되는 브랜치이며,
271개발/실험적 버젼을 테스트하는 것을 돕는데는 별로 관심이 없다.
272
273어떤 2.6.x.y 커널도 사용가능하지 않다면 그때는 가장 높은 숫자의 2.6.x
274커널이 현재의 안정 커널이다.
275
2762.6.x.y는 "stable" 팀<stable@kernel.org>에 의해 관리되며 거의 매번 격주로
277배포된다.
278
279커널 트리 문서들 내에 Documentation/stable_kernel_rules.txt 파일은 어떤
280종류의 변경들이 -stable 트리로 들어왔는지와 배포 프로세스가 어떻게
281진행되는지를 설명한다.
282
283
2842.6.x -git 패치들
285------------------
286git 저장소(그러므로 -git이라는 이름이 붙음)에는 날마다 관리되는 Linus의
287커널 트리의 snapshot 들이 있다. 이 패치들은 일반적으로 날마다 배포되며
288Linus의 트리의 현재 상태를 나타낸다. 이 패치들은 정상적인지 조금도
289살펴보지 않고 자동적으로 생성된 것이므로 -rc 커널들 보다도 더 실험적이다.
290
2912.6.x -mm 커널 패치들
292---------------------
293Andrew Morton에 의해 배포된 실험적인 커널 패치들이다. Andrew는 모든 다른
294서브시스템 커널 트리와 패치들을 가져와서 리눅스 커널 메일링 리스트로
295온 많은 패치들과 한데 묶는다. 이 트리는 새로운 기능들과 패치들을 위한
296장소를 제공하는 역할을 한다. 하나의 패치가 -mm에 한동안 있으면서 그 가치가
297증명되게 되면 Andrew나 서브시스템 메인트너는 그것을 메인라인에 포함시키기
298위하여 Linus에게 보낸다.
299
300커널 트리에 포함하고 싶은 모든 새로운 패치들은 Linus에게 보내지기 전에
301-mm 트리에서 테스트를 하는 것을 적극 추천한다.
302
303이 커널들은 안정되게 사용할 시스템에서에 실행하는 것은 적합하지 않으며
304다른 브랜치들의 어떤 것들보다 위험하다.
305
306여러분이 커널 개발 프로세스를 돕길 원한다면 이 커널 배포들을 사용하고
307테스트한 후 어떤 문제를 발견하거나 또는 모든 것이 잘 동작한다면 리눅스
308커널 메일링 리스트로 피드백을 해달라.
309
310이 커널들은 일반적으로 모든 다른 실험적인 패치들과 배포될 당시의
311사용가능한 메인라인 -git 커널들의 몇몇 변경을 포함한다.
312
313-mm 커널들은 정해진 일정대로 배포되지 않는다. 하지만 대개 몇몇 -mm 커널들은
314각 -rc 커널(1부터 3이 흔함) 사이에서 배포된다.
315
316서브시스템 커널 트리들과 패치들
317-------------------------------
318많은 다른 커널 서브시스템 개발자들은 커널의 다른 부분들에서 무슨 일이
319일어나고 있는지를 볼수 있도록 그들의 개발 트리를 공개한다. 이 트리들은
320위에서 설명하였던 것 처럼 -mm 커널 배포들로 합쳐진다.
321
322다음은 활용가능한 커널 트리들을 나열한다.
323 git trees:
324 - Kbuild development tree, Sam Ravnborg < sam@ravnborg.org>
325 git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
326
327 - ACPI development tree, Len Brown <len.brown@intel.com >
328 git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
329
330 - Block development tree, Jens Axboe <axboe@suse.de>
331 git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
332
333 - DRM development tree, Dave Airlie <airlied@linux.ie>
334 git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
335
336 - ia64 development tree, Tony Luck < tony.luck@intel.com>
337 git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
338
339 - infiniband, Roland Dreier <rolandd@cisco.com >
340 git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
341
342 - libata, Jeff Garzik <jgarzik@pobox.com>
343 git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
344
345 - network drivers, Jeff Garzik <jgarzik@pobox.com>
346 git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
347
348 - pcmcia, Dominik Brodowski < linux@dominikbrodowski.net>
349 git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
350
351 - SCSI, James Bottomley < James.Bottomley@SteelEye.com>
352 git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
353
354 quilt trees:
355 - USB, PCI, Driver Core, and I2C, Greg Kroah-Hartman < gregkh@suse.de>
356 kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
357 - x86-64, partly i386, Andi Kleen < ak@suse.de>
358 ftp.firstfloor.org:/pub/ak/x86_64/quilt/
359
360 다른 커널 트리들은 http://kernel.org/git와 MAINTAINERS 파일에서 참조할 수
361 있다.
362
363버그 보고
364---------
365bugzilla.kernel.org는 리눅스 커널 개발자들이 커널의 버그를 추적하는 곳이다.
366사용자들은 발견한 모든 버그들을 보고하기 위하여 이 툴을 사용할 것을 권장한다.
367kernel bugzilla를 사용하는 자세한 방법은 다음을 참조하라.
368 http://test.kernel.org/bugzilla/faq.html
369
370메인 커널 소스 디렉토리에 있는 REPORTING-BUGS 파일은 커널 버그일 것 같은
371것을 보고하는는 법에 관한 좋은 템플릿이고 문제를 추적하기 위해서 커널
372개발자들이 필요로 하는 정보가 무엇들인지를 상세히 설명하고 있다.
373
374
375버그 리포트들의 관리
376--------------------
377
378여러분의 해킹 기술을 연습하는 가장 좋은 방법 중의 하는 다른 사람들이
379보고한 버그들을 수정하는 것이다. 여러분은 커널을 더욱 안정화시키는데
380도움을 줄 뿐만이 아니라 실제있는 문제들을 수정하는 법을 배우게 되고
381그와 함께 여러분들의 기술은 향상될 것이며 다른 개발자들이 여러분의
382존재에 대해 알게 될 것이다. 버그를 수정하는 것은 개발자들 사이에서
383점수를 얻을 수 있는 가장 좋은 방법중의 하나이다. 왜냐하면 많은 사람들은
384다른 사람들의 버그들을 수정하기 위하여 시간을 낭비하지 않기 때문이다.
385
386이미 보고된 버그 리포트들을 가지고 작업하기 위해서 http://bugzilla.kernelorg를
387참조하라. 여러분이 앞으로 생겨날 버그 리포트들의 조언자가 되길 원한다면
388bugme-new 메일링 리스트나(새로운 버그 리포트들만이 이곳에서 메일로 전해진다)
389bugme-janitor 메일링 리스트(bugzilla에 모든 변화들이 여기서 메일로 전해진다)
390에 등록하면 된다.
391
392 http://lists.osdl.org/mailman/listinfo/bugme-new
393 http://lists.osdl.org/mailman/listinfo/bugme-janitors
394
395
396
397메일링 리스트들
398---------------
399
400위의 몇몇 문서들이 설명하였지만 핵심 커널 개발자들의 대다수는
401리눅스 커널 메일링 리스트에 참여하고 있다. 리스트에 등록하고 해지하는
402방법에 관한 자세한 사항은 다음에서 참조할 수 있다.
403 http://vger.kernel.org/vger-lists.html#linux-kernel
404웹상의 많은 다른 곳에도 메일링 리스트의 아카이브들이 있다.
405이러한 아카이브들을 찾으려면 검색 엔진을 사용하라. 예를 들어:
406 http://dir.gmane.org/gmane.linux.kernel
407여러분이 새로운 문제에 관해 리스트에 올리기 전에 말하고 싶은 주제에 대한
408것을 아카이브에서 먼저 찾기를 강력히 권장한다. 이미 상세하게 토론된 많은
409것들이 메일링 리스트의 아카이브에 기록되어 있다.
410
411각각의 커널 서브시스템들의 대부분은 자신들의 개발에 관한 노력들로 이루어진
412분리된 메일링 리스트를 따로 가지고 있다. 다른 그룹들이 무슨 리스트를 가지고
413있는지는 MAINTAINERS 파일을 참조하라.
414
415많은 리스트들은 kernel.org에서 호스트되고 있다. 그 정보들은 다음에서 참조될 수 있다.
416 http://vger.kernel.org/vger-lists.html
417
418리스트들을 사용할 때는 올바른 예절을 따를 것을 유념해라.
419대단하진 않지만 다음 URL은 리스트(혹은 모든 리스트)와 대화하는 몇몇 간단한
420가이드라인을 가지고 있다.
421 http://www.albion.com/netiquette/
422
423여러 사람들이 여러분의 메일에 응답한다면 CC: 즉 수신 리스트는 꽤 커지게
424될 것이다. 아무 이유없이 CC에서 어떤 사람도 제거하거나 리스트 주소로만
425회신하지 마라. 메일을 보낸 사람으로서 하나를 받고 리스트로부터 또
426하나를 받아 두번 받는 것에 익숙하여 있으니 mail-header를 조작하려고 하지
427말아라. 사람들은 그런 것을 좋아하지 않을 것이다.
428
429여러분의 회신의 문맥을 원래대로 유지해야 한다. 여러분들의 회신의 윗부분에
430"John 커널해커는 작성했다...."를 유지하며 여러분들의 의견을 그 메일의 윗부분에
431작성하지 말고 각 인용한 단락들 사이에 넣어라.
432
433여러분들이 패치들을 메일에 넣는다면 그것들은 Documentation/SubmittingPatches에
434나와있는데로 명백히(plain) 읽을 수 있는 텍스트여야 한다. 커널 개발자들은
435첨부파일이나 압축된 패치들을 원하지 않는다. 그들은 여러분들의 패치의
436각 라인 단위로 코멘트를 하길 원하며 압축하거나 첨부하지 않고 보내는 것이
437그렇게 할 수 있는 유일한 방법이다. 여러분들이 사용하는 메일 프로그램이
438스페이스나 탭 문자들을 조작하지 않는지 확인하라. 가장 좋은 첫 테스트는
439메일을 자신에게 보내보고 스스로 그 패치를 적용해보라. 그것이 동작하지
440않는다면 여러분의 메일 프로그램을 고치던가 제대로 동작하는 프로그램으로
441바꾸어라.
442
443무엇보다도 메일링 리스트의 다른 구독자들에게 보여주려 한다는 것을 기억하라.
444
445
446커뮤니티와 일하는 법
447--------------------
448
449커널 커뮤니티의 목적은 가능한한 가장 좋은 커널을 제공하는 것이다. 여러분이
450받아들여질 패치를 제출하게 되면 그 패치의 기술적인 이점으로 검토될 것이다.
451그럼 여러분들은 무엇을 기대하고 있어야 하는가?
452 - 비판
453 - 의견
454 - 변경을 위한 요구
455 - 당위성을 위한 요구
456 - 고요
457
458기억하라. 이것들은 여러분의 패치가 커널로 들어가기 위한 과정이다. 여러분의
459패치들은 비판과 다른 의견을 받을 수 있고 그것들을 기술적인 레벨로 평가하고
460재작업하거나 또는 왜 수정하면 안되는지에 관하여 명료하고 간결한 이유를
461말할 수 있어야 한다. 여러분이 제출한 것에 어떤 응답도 있지 않다면 몇 일을
462기다려보고 다시 시도해라. 때론 너무 많은 메일들 속에 묻혀버리기도 한다.
463
464여러분은 무엇을 해서는 안되는가?
465 - 여러분의 패치가 아무 질문 없이 받아들여지기를 기대하는 것
466 - 방어적이 되는 것
467 - 의견을 무시하는 것
468 - 요청된 변경을 하지 않고 패치를 다시 제출하는 것
469
470가능한한 가장 좋은 기술적인 해답을 찾고 있는 커뮤니티에서는 항상
471어떤 패치가 얼마나 좋은지에 관하여 다른 의견들이 있을 수 있다. 여러분은
472협조적이어야 하고 기꺼이 여러분의 생각을 커널 내에 맞추어야 한다. 아니면
473적어도 여러분의 것이 가치있다는 것을 중명하여야 한다. 잘못된 것도 여러분이
474올바른 방향의 해결책으로 이끌어갈 의지가 있다면 받아들여질 것이라는 점을
475기억하라.
476
477여러분의 첫 패치에 여러분이 수정해야하는 십여개 정도의 회신이 오는
478경우도 흔하다. 이것은 여러분의 패치가 받아들여지지 않을 것이라는 것을
479의미하는 것이 아니고 개인적으로 여러분에게 감정이 있어서 그러는 것도
480아니다. 간단히 여러분의 패치에 제기된 문제들을 수정하고 그것을 다시
481보내라.
482
483
484커널 커뮤니티와 기업 조직간의 차이점
485-----------------------------------------------------------------
486커널 커뮤니티는 가장 전통적인 회사의 개발 환경과는 다르다. 여기에 여러분들의
487문제를 피하기 위한 목록이 있다.
488 여러분들이 제안한 변경들에 관하여 말할 때 좋은 것들 :
489 - " 이것은 여러 문제들을 해겹합니다."
490 - "이것은 2000 라인의 코드를 제거합니다."
491 - "이것은 내가 말하려는 것에 관해 설명하는 패치입니다."
492 - "나는 5개의 다른 아키텍쳐에서 그것을 테스트했슴으로..."
493 - "여기에 일련의 작은 패치들이 있습음로..."
494 - "이것은 일반적인 머신에서 성능을 향상시키므로..."
495
496 여러분들이 말할 때 피해야 할 좋지 않은 것들 :
497 - "우리를 그것을 AIT/ptx/Solaris에서 이러한 방법으로 했다. 그러므로 그것은 좋은 것임에 틀립없다..."
498 - "나는 20년동안 이것을 해왔다. 그러므로..."
499 - "이것은 돈을 벌기위해 나의 회사가 필요로 하는 것이다."
500 - "이것은 우리의 엔터프라이즈 상품 라인을 위한 것이다."
501 - "여기에 나의 생각을 말하고 있는 1000 페이지 설계 문서가 있다."
502 - "나는 6달동안 이것을 했으니..."
503 - "여기세 5000라인 짜리 패치가 있으니..."
504 - "나는 현재 뒤죽박죽인 것을 재작성했다. 그리고 여기에..."
505 - "나는 마감시한을 가지고 있으므로 이 패치는 지금 적용될 필요가 있다."
506
507커널 커뮤니티가 전통적인 소프트웨어 엔지니어링 개발 환경들과
508또 다른 점은 얼굴을 보지 않고 일한다는 점이다. 이메일과 irc를 대화의
509주요수단으로 사용하는 것의 한가지 장점은 성별이나 인종의 차별이
510없다는 것이다. 리눅스 커널의 작업 환경에서는 단지 이메일 주소만
511알수 있기 때문에 여성과 소수 민족들도 모두 받아들여진다. 국제적으로
512일하게 되는 측면은 사람의 이름에 근거하여 성별을 추측할 수 없게
513하기때문에 차별을 없애는 데 도움을 준다. Andrea라는 이름을 가진 남자와
514Pat이라는 이름을 가진 여자가 있을 수도 있는 것이다. 리눅스 커널에서
515작업하며 생각을 표현해왔던 대부분의 여성들은 긍정적인 경험을 가지고
516있다.
517
518언어 장벽은 영어에 익숙하지 않은 몇몇 사람들에게 문제가 될 수도 있다.
519 언어의 훌륭한 구사는 메일링 리스트에서 올바르게 자신의 생각을
520표현하기 위하여 필요하다. 그래서 여러분은 이메일을 보내기 전에
521영어를 올바르게 사용하고 있는지를 체크하는 것이 바람직하다.
522
523
524여러분의 변경을 나누어라
525------------------------
526
527리눅스 커널 커뮤니티는 한꺼번에 굉장히 큰 코드의 묶음을 쉽게
528받아들이지 않는다. 변경은 적절하게 소개되고, 검토되고, 각각의
529부분으로 작게 나누어져야 한다. 이것은 회사에서 하는 것과는 정확히
530반대되는 것이다. 여러분들의 제안은 개발 초기에 일찍이 소개되야 한다.
531그래서 여러분들은 자신이 하고 있는 것에 관하여 피드백을 받을 수 있게
532된다. 커뮤니티가 여러분들이 커뮤니티와 함께 일하고 있다는 것을
533느끼도록 만들고 커뮤니티가 여러분의 기능을 위한 쓰레기 장으로서
534사용되지 않고 있다는 것을 느끼게 하자. 그러나 메일링 리스트에 한번에
53550개의 이메일을 보내지는 말아라. 여러분들의 일련의 패치들은 항상
536더 작아야 한다.
537
538패치를 나누는 이유는 다음과 같다.
539
5401) 작은 패치들은 여러분의 패치들이 적용될 수 있는 확률을 높여준다.
541 왜냐하면 다른 사람들은 정확성을 검증하기 위하여 많은 시간과 노력을
542 들이기를 원하지 않는다. 5줄의 패치는 메인트너가 거의 몇 초간 힐끗
543 보면 적용될 수 있다. 그러나 500 줄의 패치는 정확성을 검토하기 위하여
544 몇시간이 걸릴 수도 있다(걸리는 시간은 패치의 크기 혹은 다른 것에
545 비례하여 기하급수적으로 늘어난다).
546
547 패치를 작게 만드는 것은 무엇인가 잘못되었을 때 디버그하는 것을
548 쉽게 만든다. 즉, 그렇게 만드는 것은 매우 큰 패치를 적용한 후에
549 조사하는 것 보다 작은 패치를 적용한 후에 (그리고 몇몇의 것이
550 깨졌을 때) 하나씩 패치들을 제거해가며 디버그 하기 쉽도록 만들어 준다.
551
5522) 작은 패치들을 보내는 것뿐만 아니라 패치들을 제출하기전에 재작성하고
553 간단하게(혹은 간단한게 재배치하여) 하는 것도 중요하다.
554
555여기에 커널 개발자 Al Viro의 이야기가 있다.
556 "학생의 수학 숙제를 채점하는 선생님을 생각해보라. 선생님은 학생들이
557 답을 얻을때까지 겪은 시행착오를 보길 원하지 않는다. 선생님들은
558 간결하고 가장 뛰어난 답을 보길 원한다. 훌륭한 학생은 이것을 알고
559 마지막으로 답을 얻기 전 중간 과정들을 제출하진 않는다.
560
561 커널 개발도 마찬가지이다. 메인트너들과 검토하는 사람들은 문제를
562 풀어나가는 과정속에 숨겨진 과정을 보길 원하진 않는다. 그들은
563 간결하고 멋진 답을 보길 원한다."
564
565커뮤니티와 함께 일하며 뛰어난 답을 찾고 여러분들의 완성되지 않은 일들
566사이에 균형을 유지해야 하는 어려움이 있을 수 있다. 그러므로 프로세스의
567초반에 여러분의 일을 향상시키기위한 피드백을 얻는 것 뿐만 아니라
568여러분들의 변경들을 작은 묶음으로 유지해서 심지어는 여러분의 작업의
569모든 부분이 지금은 포함될 준비가 되어있지 않지만 작은 부분은 이미
570받아들여질 수 있도록 유지하는 것이 바람직하다.
571
572또한 완성되지 않았고 "나중에 수정될 것이다." 와 같은 것들은 포함하는
573패치들은 받아들여지지 않을 것이라는 점을 유념하라.
574
575변경을 정당화해라
576-----------------
577
578여러분들의 나누어진 패치들을 리눅스 커뮤니티가 왜 반영해야 하는지를
579알도록 하는 것은 매우 중요하다. 새로운 기능들이 필요하고 유용하다는
580것은 반드시 그에 맞는 이유가 있어야 한다.
581
582
583변경을 문서화해라
584-----------------
585
586여러분이 패치를 보내려 할때는 여러분이 무엇을 말하려고 하는지를 충분히
587생각하여 이메일을 작성해야 한다. 이 정보는 패치를 위한 ChangeLog가 될
588것이다. 그리고 항상 그 내용을 보길 원하는 모든 사람들을 위해 보존될
589것이다. 패치는 완벽하게 다음과 같은 내용들을 포함하여 설명해야 한다.
590 - 변경이 왜 필요한지
591 - 패치에 관한 전체 설계 어프로치
592 - 구현 상세들
593 - 테스트 결과들
594
595이것이 무엇인지 더 자세한 것을 알고 싶다면 다음 문서의 ChageLog 항을 봐라.
596 "The Perfect Patch"
597 http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
598
599
600
601
602이 모든 것을 하는 것은 매우 어려운 일이다. 완벽히 소화하는 데는 적어도 몇년이
603걸릴 수도 있다. 많은 인내와 결의가 필요한 계속되는 개선의 과정이다. 그러나
604가능한한 포기하지 말라. 많은 사람들은 이전부터 해왔던 것이고 그 사람들도
605정확하게 여러분들이 지금 서 있는 그 곳부터 시작했었다.
606
607
608
609
610----------
611"개발 프로세스"(http://linux.tar.gz/articles/2.6-development_process) 섹션을
612작성하는데 있어 참고할 문서를 사용하도록 허락해준 Paolo Ciarrocchi에게
613감사한다. 여러분들이 말해야 할 것과 말해서는 안되는 것의 목록 중 일부를 제공해준
614Randy Dunlap과 Gerrit Huizenga에게 감사한다. 또한 검토와 의견 그리고
615공헌을 아끼지 않은 Pat Mochel, Hanna Linder, Randy Dunlap, Kay Sievers,
616Vojtech Pavlik, Jan Kara, Josh Boyer, Kees Cook, Andrew Morton, Andi Kleen,
617Vadim Lobanov, Jesper Juhl, Adrian Bunk, Keri Harris, Frans Pop,
618David A. Wheeler, Junio Hamano, Michael Kerrisk, and Alex Shepard에게도 감사를 전한다.
619그들의 도움이 없었다면 이 문서는 존재하지 않았을 것이다.
620
621
622
623메인트너: Greg Kroah-Hartman <greg@kroah.com>
diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt
new file mode 100644
index 000000000000..8242f52d0f22
--- /dev/null
+++ b/Documentation/vm/numa_memory_policy.txt
@@ -0,0 +1,332 @@
1
2What is Linux Memory Policy?
3
4In the Linux kernel, "memory policy" determines from which node the kernel will
5allocate memory in a NUMA system or in an emulated NUMA system. Linux has
6supported platforms with Non-Uniform Memory Access architectures since 2.4.?.
7The current memory policy support was added to Linux 2.6 around May 2004. This
8document attempts to describe the concepts and APIs of the 2.6 memory policy
9support.
10
11Memory policies should not be confused with cpusets (Documentation/cpusets.txt)
12which is an administrative mechanism for restricting the nodes from which
13memory may be allocated by a set of processes. Memory policies are a
14programming interface that a NUMA-aware application can take advantage of. When
15both cpusets and policies are applied to a task, the restrictions of the cpuset
16takes priority. See "MEMORY POLICIES AND CPUSETS" below for more details.
17
18MEMORY POLICY CONCEPTS
19
20Scope of Memory Policies
21
22The Linux kernel supports _scopes_ of memory policy, described here from
23most general to most specific:
24
25 System Default Policy: this policy is "hard coded" into the kernel. It
26 is the policy that governs all page allocations that aren't controlled
27 by one of the more specific policy scopes discussed below. When the
28 system is "up and running", the system default policy will use "local
29 allocation" described below. However, during boot up, the system
30 default policy will be set to interleave allocations across all nodes
31 with "sufficient" memory, so as not to overload the initial boot node
32 with boot-time allocations.
33
34 Task/Process Policy: this is an optional, per-task policy. When defined
35 for a specific task, this policy controls all page allocations made by or
36 on behalf of the task that aren't controlled by a more specific scope.
37 If a task does not define a task policy, then all page allocations that
38 would have been controlled by the task policy "fall back" to the System
39 Default Policy.
40
41 The task policy applies to the entire address space of a task. Thus,
42 it is inheritable, and indeed is inherited, across both fork()
43 [clone() w/o the CLONE_VM flag] and exec*(). This allows a parent task
44 to establish the task policy for a child task exec()'d from an
45 executable image that has no awareness of memory policy. See the
46 MEMORY POLICY APIS section, below, for an overview of the system call
47 that a task may use to set/change it's task/process policy.
48
49 In a multi-threaded task, task policies apply only to the thread
50 [Linux kernel task] that installs the policy and any threads
51 subsequently created by that thread. Any sibling threads existing
52 at the time a new task policy is installed retain their current
53 policy.
54
55 A task policy applies only to pages allocated after the policy is
56 installed. Any pages already faulted in by the task when the task
57 changes its task policy remain where they were allocated based on
58 the policy at the time they were allocated.
59
60 VMA Policy: A "VMA" or "Virtual Memory Area" refers to a range of a task's
61 virtual adddress space. A task may define a specific policy for a range
62 of its virtual address space. See the MEMORY POLICIES APIS section,
63 below, for an overview of the mbind() system call used to set a VMA
64 policy.
65
66 A VMA policy will govern the allocation of pages that back this region of
67 the address space. Any regions of the task's address space that don't
68 have an explicit VMA policy will fall back to the task policy, which may
69 itself fall back to the System Default Policy.
70
71 VMA policies have a few complicating details:
72
73 VMA policy applies ONLY to anonymous pages. These include pages
74 allocated for anonymous segments, such as the task stack and heap, and
75 any regions of the address space mmap()ed with the MAP_ANONYMOUS flag.
76 If a VMA policy is applied to a file mapping, it will be ignored if
77 the mapping used the MAP_SHARED flag. If the file mapping used the
78 MAP_PRIVATE flag, the VMA policy will only be applied when an
79 anonymous page is allocated on an attempt to write to the mapping--
80 i.e., at Copy-On-Write.
81
82 VMA policies are shared between all tasks that share a virtual address
83 space--a.k.a. threads--independent of when the policy is installed; and
84 they are inherited across fork(). However, because VMA policies refer
85 to a specific region of a task's address space, and because the address
86 space is discarded and recreated on exec*(), VMA policies are NOT
87 inheritable across exec(). Thus, only NUMA-aware applications may
88 use VMA policies.
89
90 A task may install a new VMA policy on a sub-range of a previously
91 mmap()ed region. When this happens, Linux splits the existing virtual
92 memory area into 2 or 3 VMAs, each with it's own policy.
93
94 By default, VMA policy applies only to pages allocated after the policy
95 is installed. Any pages already faulted into the VMA range remain
96 where they were allocated based on the policy at the time they were
97 allocated. However, since 2.6.16, Linux supports page migration via
98 the mbind() system call, so that page contents can be moved to match
99 a newly installed policy.
100
101 Shared Policy: Conceptually, shared policies apply to "memory objects"
102 mapped shared into one or more tasks' distinct address spaces. An
103 application installs a shared policies the same way as VMA policies--using
104 the mbind() system call specifying a range of virtual addresses that map
105 the shared object. However, unlike VMA policies, which can be considered
106 to be an attribute of a range of a task's address space, shared policies
107 apply directly to the shared object. Thus, all tasks that attach to the
108 object share the policy, and all pages allocated for the shared object,
109 by any task, will obey the shared policy.
110
111 As of 2.6.22, only shared memory segments, created by shmget() or
112 mmap(MAP_ANONYMOUS|MAP_SHARED), support shared policy. When shared
113 policy support was added to Linux, the associated data structures were
114 added to hugetlbfs shmem segments. At the time, hugetlbfs did not
115 support allocation at fault time--a.k.a lazy allocation--so hugetlbfs
116 shmem segments were never "hooked up" to the shared policy support.
117 Although hugetlbfs segments now support lazy allocation, their support
118 for shared policy has not been completed.
119
120 As mentioned above [re: VMA policies], allocations of page cache
121 pages for regular files mmap()ed with MAP_SHARED ignore any VMA
122 policy installed on the virtual address range backed by the shared
123 file mapping. Rather, shared page cache pages, including pages backing
124 private mappings that have not yet been written by the task, follow
125 task policy, if any, else System Default Policy.
126
127 The shared policy infrastructure supports different policies on subset
128 ranges of the shared object. However, Linux still splits the VMA of
129 the task that installs the policy for each range of distinct policy.
130 Thus, different tasks that attach to a shared memory segment can have
131 different VMA configurations mapping that one shared object. This
132 can be seen by examining the /proc/<pid>/numa_maps of tasks sharing
133 a shared memory region, when one task has installed shared policy on
134 one or more ranges of the region.
135
136Components of Memory Policies
137
138 A Linux memory policy is a tuple consisting of a "mode" and an optional set
139 of nodes. The mode determine the behavior of the policy, while the
140 optional set of nodes can be viewed as the arguments to the behavior.
141
142 Internally, memory policies are implemented by a reference counted
143 structure, struct mempolicy. Details of this structure will be discussed
144 in context, below, as required to explain the behavior.
145
146 Note: in some functions AND in the struct mempolicy itself, the mode
147 is called "policy". However, to avoid confusion with the policy tuple,
148 this document will continue to use the term "mode".
149
150 Linux memory policy supports the following 4 behavioral modes:
151
152 Default Mode--MPOL_DEFAULT: The behavior specified by this mode is
153 context or scope dependent.
154
155 As mentioned in the Policy Scope section above, during normal
156 system operation, the System Default Policy is hard coded to
157 contain the Default mode.
158
159 In this context, default mode means "local" allocation--that is
160 attempt to allocate the page from the node associated with the cpu
161 where the fault occurs. If the "local" node has no memory, or the
162 node's memory can be exhausted [no free pages available], local
163 allocation will "fallback to"--attempt to allocate pages from--
164 "nearby" nodes, in order of increasing "distance".
165
166 Implementation detail -- subject to change: "Fallback" uses
167 a per node list of sibling nodes--called zonelists--built at
168 boot time, or when nodes or memory are added or removed from
169 the system [memory hotplug]. These per node zonelist are
170 constructed with nodes in order of increasing distance based
171 on information provided by the platform firmware.
172
173 When a task/process policy or a shared policy contains the Default
174 mode, this also means "local allocation", as described above.
175
176 In the context of a VMA, Default mode means "fall back to task
177 policy"--which may or may not specify Default mode. Thus, Default
178 mode can not be counted on to mean local allocation when used
179 on a non-shared region of the address space. However, see
180 MPOL_PREFERRED below.
181
182 The Default mode does not use the optional set of nodes.
183
184 MPOL_BIND: This mode specifies that memory must come from the
185 set of nodes specified by the policy.
186
187 The memory policy APIs do not specify an order in which the nodes
188 will be searched. However, unlike "local allocation", the Bind
189 policy does not consider the distance between the nodes. Rather,
190 allocations will fallback to the nodes specified by the policy in
191 order of numeric node id. Like everything in Linux, this is subject
192 to change.
193
194 MPOL_PREFERRED: This mode specifies that the allocation should be
195 attempted from the single node specified in the policy. If that
196 allocation fails, the kernel will search other nodes, exactly as
197 it would for a local allocation that started at the preferred node
198 in increasing distance from the preferred node. "Local" allocation
199 policy can be viewed as a Preferred policy that starts at the node
200 containing the cpu where the allocation takes place.
201
202 Internally, the Preferred policy uses a single node--the
203 preferred_node member of struct mempolicy. A "distinguished
204 value of this preferred_node, currently '-1', is interpreted
205 as "the node containing the cpu where the allocation takes
206 place"--local allocation. This is the way to specify
207 local allocation for a specific range of addresses--i.e. for
208 VMA policies.
209
210 MPOL_INTERLEAVED: This mode specifies that page allocations be
211 interleaved, on a page granularity, across the nodes specified in
212 the policy. This mode also behaves slightly differently, based on
213 the context where it is used:
214
215 For allocation of anonymous pages and shared memory pages,
216 Interleave mode indexes the set of nodes specified by the policy
217 using the page offset of the faulting address into the segment
218 [VMA] containing the address modulo the number of nodes specified
219 by the policy. It then attempts to allocate a page, starting at
220 the selected node, as if the node had been specified by a Preferred
221 policy or had been selected by a local allocation. That is,
222 allocation will follow the per node zonelist.
223
224 For allocation of page cache pages, Interleave mode indexes the set
225 of nodes specified by the policy using a node counter maintained
226 per task. This counter wraps around to the lowest specified node
227 after it reaches the highest specified node. This will tend to
228 spread the pages out over the nodes specified by the policy based
229 on the order in which they are allocated, rather than based on any
230 page offset into an address range or file. During system boot up,
231 the temporary interleaved system default policy works in this
232 mode.
233
234MEMORY POLICY APIs
235
236Linux supports 3 system calls for controlling memory policy. These APIS
237always affect only the calling task, the calling task's address space, or
238some shared object mapped into the calling task's address space.
239
240 Note: the headers that define these APIs and the parameter data types
241 for user space applications reside in a package that is not part of
242 the Linux kernel. The kernel system call interfaces, with the 'sys_'
243 prefix, are defined in <linux/syscalls.h>; the mode and flag
244 definitions are defined in <linux/mempolicy.h>.
245
246Set [Task] Memory Policy:
247
248 long set_mempolicy(int mode, const unsigned long *nmask,
249 unsigned long maxnode);
250
251 Set's the calling task's "task/process memory policy" to mode
252 specified by the 'mode' argument and the set of nodes defined
253 by 'nmask'. 'nmask' points to a bit mask of node ids containing
254 at least 'maxnode' ids.
255
256 See the set_mempolicy(2) man page for more details
257
258
259Get [Task] Memory Policy or Related Information
260
261 long get_mempolicy(int *mode,
262 const unsigned long *nmask, unsigned long maxnode,
263 void *addr, int flags);
264
265 Queries the "task/process memory policy" of the calling task, or
266 the policy or location of a specified virtual address, depending
267 on the 'flags' argument.
268
269 See the get_mempolicy(2) man page for more details
270
271
272Install VMA/Shared Policy for a Range of Task's Address Space
273
274 long mbind(void *start, unsigned long len, int mode,
275 const unsigned long *nmask, unsigned long maxnode,
276 unsigned flags);
277
278 mbind() installs the policy specified by (mode, nmask, maxnodes) as
279 a VMA policy for the range of the calling task's address space
280 specified by the 'start' and 'len' arguments. Additional actions
281 may be requested via the 'flags' argument.
282
283 See the mbind(2) man page for more details.
284
285MEMORY POLICY COMMAND LINE INTERFACE
286
287Although not strictly part of the Linux implementation of memory policy,
288a command line tool, numactl(8), exists that allows one to:
289
290+ set the task policy for a specified program via set_mempolicy(2), fork(2) and
291 exec(2)
292
293+ set the shared policy for a shared memory segment via mbind(2)
294
295The numactl(8) tool is packages with the run-time version of the library
296containing the memory policy system call wrappers. Some distributions
297package the headers and compile-time libraries in a separate development
298package.
299
300
301MEMORY POLICIES AND CPUSETS
302
303Memory policies work within cpusets as described above. For memory policies
304that require a node or set of nodes, the nodes are restricted to the set of
305nodes whose memories are allowed by the cpuset constraints. If the
306intersection of the set of nodes specified for the policy and the set of nodes
307allowed by the cpuset is the empty set, the policy is considered invalid and
308cannot be installed.
309
310The interaction of memory policies and cpusets can be problematic for a
311couple of reasons:
312
3131) the memory policy APIs take physical node id's as arguments. However, the
314 memory policy APIs do not provide a way to determine what nodes are valid
315 in the context where the application is running. An application MAY consult
316 the cpuset file system [directly or via an out of tree, and not generally
317 available, libcpuset API] to obtain this information, but then the
318 application must be aware that it is running in a cpuset and use what are
319 intended primarily as administrative APIs.
320
321 However, as long as the policy specifies at least one node that is valid
322 in the controlling cpuset, the policy can be used.
323
3242) when tasks in two cpusets share access to a memory region, such as shared
325 memory segments created by shmget() of mmap() with the MAP_ANONYMOUS and
326 MAP_SHARED flags, and any of the tasks install shared policy on the region,
327 only nodes whose memories are allowed in both cpusets may be used in the
328 policies. Again, obtaining this information requires "stepping outside"
329 the memory policy APIs, as well as knowing in what cpusets other task might
330 be attaching to the shared region, to use the cpuset information.
331 Furthermore, if the cpusets' allowed memory sets are disjoint, "local"
332 allocation is the only valid policy.
diff --git a/Documentation/watchdog/00-INDEX b/Documentation/watchdog/00-INDEX
new file mode 100644
index 000000000000..c3ea47e507fe
--- /dev/null
+++ b/Documentation/watchdog/00-INDEX
@@ -0,0 +1,10 @@
100-INDEX
2 - this file.
3pcwd-watchdog.txt
4 - documentation for Berkshire Products PC Watchdog ISA cards.
5src/
6 - directory holding watchdog related example programs.
7watchdog-api.txt
8 - description of the Linux Watchdog driver API.
9wdt.txt
10 - description of the Watchdog Timer Interfaces for Linux.
diff --git a/MAINTAINERS b/MAINTAINERS
index e4dde7f1f8d2..10a6f57776b2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -167,11 +167,11 @@ S: Maintained
167P: Eric Van Hensbergen 167P: Eric Van Hensbergen
168M: ericvh@gmail.com 168M: ericvh@gmail.com
169P: Ron Minnich 169P: Ron Minnich
170M: rminnich@lanl.gov 170M: rminnich@sandia.gov
171P: Latchesar Ionkov 171P: Latchesar Ionkov
172M: lucho@ionkov.net 172M: lucho@ionkov.net
173L: v9fs-developer@lists.sourceforge.net 173L: v9fs-developer@lists.sourceforge.net
174W: http://v9fs.sf.net 174W: http://swik.net/v9fs
175T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs.git 175T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs.git
176S: Maintained 176S: Maintained
177 177
@@ -1009,7 +1009,7 @@ P: Steve French
1009M: sfrench@samba.org 1009M: sfrench@samba.org
1010L: linux-cifs-client@lists.samba.org 1010L: linux-cifs-client@lists.samba.org
1011L: samba-technical@lists.samba.org 1011L: samba-technical@lists.samba.org
1012W: http://us1.samba.org/samba/Linux_CIFS_client.html 1012W: http://linux-cifs.samba.org/
1013T: git kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git 1013T: git kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git
1014S: Supported 1014S: Supported
1015 1015
@@ -3452,7 +3452,7 @@ S: Maintained
3452 3452
3453TPM DEVICE DRIVER 3453TPM DEVICE DRIVER
3454P: Kylene Hall 3454P: Kylene Hall
3455M: kjhall@us.ibm.com 3455M: tpmdd-devel@lists.sourceforge.net
3456W: http://tpmdd.sourceforge.net 3456W: http://tpmdd.sourceforge.net
3457P: Marcel Selhorst 3457P: Marcel Selhorst
3458M: tpm@selhorst.net 3458M: tpm@selhorst.net
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index 8fc0edb5211e..2feeef81d843 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -23,24 +23,24 @@
23#include "generic.h" 23#include "generic.h"
24 24
25#ifdef CONFIG_PCI 25#ifdef CONFIG_PCI
26static int __init micrel_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 26static int micrel_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
27{ 27{
28 return KS8695_IRQ_EXTERN0; 28 return KS8695_IRQ_EXTERN0;
29} 29}
30 30
31static struct ks8695_pci_cfg micrel_pci = { 31static struct ks8695_pci_cfg __initdata micrel_pci = {
32 .mode = KS8695_MODE_MINIPCI, 32 .mode = KS8695_MODE_MINIPCI,
33 .map_irq = micrel_pci_map_irq, 33 .map_irq = micrel_pci_map_irq,
34}; 34};
35#endif 35#endif
36 36
37 37
38static void micrel_init(void) 38static void __init micrel_init(void)
39{ 39{
40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n"); 40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n");
41 41
42#ifdef CONFIG_PCI 42#ifdef CONFIG_PCI
43 ks8695_init_pci(&micrel_pci); 43// ks8695_init_pci(&micrel_pci);
44#endif 44#endif
45 45
46 /* Add devices */ 46 /* Add devices */
diff --git a/arch/arm/mach-s3c2442/Kconfig b/arch/arm/mach-s3c2442/Kconfig
index 88d5fd34fe3b..26d131a77074 100644
--- a/arch/arm/mach-s3c2442/Kconfig
+++ b/arch/arm/mach-s3c2442/Kconfig
@@ -6,7 +6,7 @@
6 6
7config CPU_S3C2442 7config CPU_S3C2442
8 bool 8 bool
9 depends on ARCH_S3C2420 9 depends on ARCH_S3C2410
10 select S3C2410_CLOCK 10 select S3C2410_CLOCK
11 select S3C2410_GPIO 11 select S3C2410_GPIO
12 select S3C2410_PM if PM 12 select S3C2410_PM if PM
diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
index 2edcecdea8bd..ef801563bbf5 100644
--- a/arch/avr32/boards/atngw100/setup.c
+++ b/arch/avr32/boards/atngw100/setup.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/clk.h> 10#include <linux/clk.h>
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/i2c-gpio.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/linkage.h> 14#include <linux/linkage.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -123,6 +124,19 @@ static struct platform_device ngw_gpio_leds = {
123 } 124 }
124}; 125};
125 126
127static struct i2c_gpio_platform_data i2c_gpio_data = {
128 .sda_pin = GPIO_PIN_PA(6),
129 .scl_pin = GPIO_PIN_PA(7),
130};
131
132static struct platform_device i2c_gpio_device = {
133 .name = "i2c-gpio",
134 .id = 0,
135 .dev = {
136 .platform_data = &i2c_gpio_data,
137 },
138};
139
126static int __init atngw100_init(void) 140static int __init atngw100_init(void)
127{ 141{
128 unsigned i; 142 unsigned i;
@@ -147,6 +161,10 @@ static int __init atngw100_init(void)
147 } 161 }
148 platform_device_register(&ngw_gpio_leds); 162 platform_device_register(&ngw_gpio_leds);
149 163
164 at32_select_gpio(i2c_gpio_data.sda_pin, 0);
165 at32_select_gpio(i2c_gpio_data.scl_pin, 0);
166 platform_device_register(&i2c_gpio_device);
167
150 return 0; 168 return 0;
151} 169}
152postcore_initcall(atngw100_init); 170postcore_initcall(atngw100_init);
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig
index 71bc7d364fb7..718578f64069 100644
--- a/arch/avr32/boards/atstk1000/Kconfig
+++ b/arch/avr32/boards/atstk1000/Kconfig
@@ -50,4 +50,30 @@ config BOARD_ATSTK1002_SPI1
50 GPIO lines and accessed through the J1 jumper block. Say "y" 50 GPIO lines and accessed through the J1 jumper block. Say "y"
51 here to configure that SPI controller. 51 here to configure that SPI controller.
52 52
53config BOARD_ATSTK1002_J2_LED
54 bool
55 default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB
56
57choice
58 prompt "LEDs connected to J2:"
59 depends on LEDS_GPIO && !BOARD_ATSTK1002_SW4_CUSTOM
60 optional
61 help
62 Select this if you have jumpered the J2 jumper block to the
63 LED0..LED7 amber leds, or to the RGB leds, using a ten-pin
64 IDC cable. A default "heartbeat" trigger is provided, but
65 you can of course override this.
66
67config BOARD_ATSTK1002_J2_LED8
68 bool "LED0..LED7"
69 help
70 Select this if J2 is jumpered to LED0..LED7 amber leds.
71
72config BOARD_ATSTK1002_J2_RGB
73 bool "RGB leds"
74 help
75 Select this if J2 is jumpered to the RGB leds.
76
77endchoice
78
53endif # stk 1002 79endif # stk 1002
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index cb93eabb9c6c..c9981b731efa 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -11,6 +11,7 @@
11#include <linux/etherdevice.h> 11#include <linux/etherdevice.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/leds.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/types.h> 17#include <linux/types.h>
@@ -120,6 +121,65 @@ static void __init set_hw_addr(struct platform_device *pdev)
120 clk_put(pclk); 121 clk_put(pclk);
121} 122}
122 123
124#ifdef CONFIG_BOARD_ATSTK1002_J2_LED
125
126static struct gpio_led stk_j2_led[] = {
127#ifdef CONFIG_BOARD_ATSTK1002_J2_LED8
128#define LEDSTRING "J2 jumpered to LED8"
129 { .name = "led0:amber", .gpio = GPIO_PIN_PB( 8), },
130 { .name = "led1:amber", .gpio = GPIO_PIN_PB( 9), },
131 { .name = "led2:amber", .gpio = GPIO_PIN_PB(10), },
132 { .name = "led3:amber", .gpio = GPIO_PIN_PB(13), },
133 { .name = "led4:amber", .gpio = GPIO_PIN_PB(14), },
134 { .name = "led5:amber", .gpio = GPIO_PIN_PB(15), },
135 { .name = "led6:amber", .gpio = GPIO_PIN_PB(16), },
136 { .name = "led7:amber", .gpio = GPIO_PIN_PB(30),
137 .default_trigger = "heartbeat", },
138#else /* RGB */
139#define LEDSTRING "J2 jumpered to RGB LEDs"
140 { .name = "r1:red", .gpio = GPIO_PIN_PB( 8), },
141 { .name = "g1:green", .gpio = GPIO_PIN_PB(10), },
142 { .name = "b1:blue", .gpio = GPIO_PIN_PB(14), },
143
144 { .name = "r2:red", .gpio = GPIO_PIN_PB( 9),
145 .default_trigger = "heartbeat", },
146 { .name = "g2:green", .gpio = GPIO_PIN_PB(13), },
147 { .name = "b2:blue", .gpio = GPIO_PIN_PB(15),
148 .default_trigger = "heartbeat", },
149 /* PB16, PB30 unused */
150#endif
151};
152
153static struct gpio_led_platform_data stk_j2_led_data = {
154 .num_leds = ARRAY_SIZE(stk_j2_led),
155 .leds = stk_j2_led,
156};
157
158static struct platform_device stk_j2_led_dev = {
159 .name = "leds-gpio",
160 .id = 2, /* gpio block J2 */
161 .dev = {
162 .platform_data = &stk_j2_led_data,
163 },
164};
165
166static void setup_j2_leds(void)
167{
168 unsigned i;
169
170 for (i = 0; i < ARRAY_SIZE(stk_j2_led); i++)
171 at32_select_gpio(stk_j2_led[i].gpio, AT32_GPIOF_OUTPUT);
172
173 printk("STK1002: " LEDSTRING "\n");
174 platform_device_register(&stk_j2_led_dev);
175}
176
177#else
178static void setup_j2_leds(void)
179{
180}
181#endif
182
123void __init setup_board(void) 183void __init setup_board(void)
124{ 184{
125#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 185#ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
@@ -185,6 +245,8 @@ static int __init atstk1002_init(void)
185 at32_add_device_ssc(0, ATMEL_SSC_TX); 245 at32_add_device_ssc(0, ATMEL_SSC_TX);
186#endif 246#endif
187 247
248 setup_j2_leds();
249
188 return 0; 250 return 0;
189} 251}
190postcore_initcall(atstk1002_init); 252postcore_initcall(atstk1002_init);
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index e7e724bc0ba6..03e2e68f947d 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -548,6 +548,7 @@ config ETRAX_IDE
548 select BLK_DEV_IDEDISK 548 select BLK_DEV_IDEDISK
549 select BLK_DEV_IDECD 549 select BLK_DEV_IDECD
550 select BLK_DEV_IDEDMA 550 select BLK_DEV_IDEDMA
551 select IDE_GENERIC
551 help 552 help
552 Enable this to get support for ATA/IDE. 553 Enable this to get support for ATA/IDE.
553 You can't use parallel ports or SCSI ports 554 You can't use parallel ports or SCSI ports
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 1d859c16931e..cc6ba5423754 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -592,6 +592,7 @@ config ETRAX_IDE
592 select BLK_DEV_IDEDISK 592 select BLK_DEV_IDEDISK
593 select BLK_DEV_IDECD 593 select BLK_DEV_IDECD
594 select BLK_DEV_IDEDMA 594 select BLK_DEV_IDEDMA
595 select IDE_GENERIC
595 help 596 help
596 Enables the ETRAX IDE driver. 597 Enables the ETRAX IDE driver.
597 598
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index e061b63a0038..dfbe7ab9ffe2 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -37,6 +37,7 @@
37#include <linux/a.out.h> 37#include <linux/a.out.h>
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/reboot.h> 39#include <linux/reboot.h>
40#include <linux/fs.h>
40 41
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include <asm/system.h> 43#include <asm/system.h>
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index de7688cfd573..ddc62727dc9f 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -18,6 +18,7 @@
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/fs.h>
21 22
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f9524933258a..97b64d7d6bf6 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -614,10 +614,14 @@ config X86_PAE
614 614
615# Common NUMA Features 615# Common NUMA Features
616config NUMA 616config NUMA
617 bool "Numa Memory Allocation and Scheduler Support" 617 bool "Numa Memory Allocation and Scheduler Support (EXPERIMENTAL)"
618 depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) 618 depends on SMP && HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT || X86_GENERICARCH) && ACPI) && EXPERIMENTAL
619 default n if X86_PC 619 default n if X86_PC
620 default y if (X86_NUMAQ || X86_SUMMIT) 620 default y if (X86_NUMAQ || X86_SUMMIT)
621 help
622 NUMA support for i386. This is currently high experimental
623 and should be only used for kernel development. It might also
624 cause boot failures.
621 625
622comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI" 626comment "NUMA (Summit) requires SMP, 64GB highmem support, ACPI"
623 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI) 627 depends on X86_SUMMIT && (!HIGHMEM64G || !ACPI)
@@ -1228,6 +1232,11 @@ menuconfig INSTRUMENTATION
1228 bool "Instrumentation Support" 1232 bool "Instrumentation Support"
1229 depends on EXPERIMENTAL 1233 depends on EXPERIMENTAL
1230 default y 1234 default y
1235 ---help---
1236 Say Y here to get to see options related to performance measurement,
1237 debugging, and testing. This option alone does not add any kernel code.
1238
1239 If you say N, all options in this submenu will be skipped and disabled.
1231 1240
1232if INSTRUMENTATION 1241if INSTRUMENTATION
1233 1242
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index 01f0ff0daaf4..52b932478c6d 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -51,8 +51,8 @@ cflags-y += -maccumulate-outgoing-args
51CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) 51CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;)
52 52
53# do binutils support CFI? 53# do binutils support CFI?
54cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 54cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
55AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 55AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
56 56
57# is .cfi_signal_frame supported too? 57# is .cfi_signal_frame supported too?
58cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 58cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
diff --git a/arch/i386/boot/edd.c b/arch/i386/boot/edd.c
index 658834d9f92a..82b5c846a194 100644
--- a/arch/i386/boot/edd.c
+++ b/arch/i386/boot/edd.c
@@ -19,40 +19,12 @@
19 19
20#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) 20#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
21 21
22struct edd_dapa {
23 u8 pkt_size;
24 u8 rsvd;
25 u16 sector_cnt;
26 u16 buf_off, buf_seg;
27 u64 lba;
28 u64 buf_lin_addr;
29};
30
31/* 22/*
32 * Read the MBR (first sector) from a specific device. 23 * Read the MBR (first sector) from a specific device.
33 */ 24 */
34static int read_mbr(u8 devno, void *buf) 25static int read_mbr(u8 devno, void *buf)
35{ 26{
36 struct edd_dapa dapa; 27 u16 ax, bx, cx, dx;
37 u16 ax, bx, cx, dx, si;
38
39 memset(&dapa, 0, sizeof dapa);
40 dapa.pkt_size = sizeof(dapa);
41 dapa.sector_cnt = 1;
42 dapa.buf_off = (size_t)buf;
43 dapa.buf_seg = ds();
44 /* dapa.lba = 0; */
45
46 ax = 0x4200; /* Extended Read */
47 si = (size_t)&dapa;
48 dx = devno;
49 asm("pushfl; stc; int $0x13; setc %%al; popfl"
50 : "+a" (ax), "+S" (si), "+d" (dx)
51 : "m" (dapa)
52 : "ebx", "ecx", "edi", "memory");
53
54 if (!(u8)ax)
55 return 0; /* OK */
56 28
57 ax = 0x0201; /* Legacy Read, one sector */ 29 ax = 0x0201; /* Legacy Read, one sector */
58 cx = 0x0001; /* Sector 0-0-1 */ 30 cx = 0x0001; /* Sector 0-0-1 */
@@ -65,11 +37,10 @@ static int read_mbr(u8 devno, void *buf)
65 return -(u8)ax; /* 0 or -1 */ 37 return -(u8)ax; /* 0 or -1 */
66} 38}
67 39
68static u32 read_mbr_sig(u8 devno, struct edd_info *ei) 40static u32 read_mbr_sig(u8 devno, struct edd_info *ei, u32 *mbrsig)
69{ 41{
70 int sector_size; 42 int sector_size;
71 char *mbrbuf_ptr, *mbrbuf_end; 43 char *mbrbuf_ptr, *mbrbuf_end;
72 u32 mbrsig;
73 u32 buf_base, mbr_base; 44 u32 buf_base, mbr_base;
74 extern char _end[]; 45 extern char _end[];
75 46
@@ -85,15 +56,15 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
85 56
86 /* Make sure we actually have space on the heap... */ 57 /* Make sure we actually have space on the heap... */
87 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) 58 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
88 return 0; 59 return -1;
89 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) 60 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
90 return 0; 61 return -1;
91 62
92 if (read_mbr(devno, mbrbuf_ptr)) 63 if (read_mbr(devno, mbrbuf_ptr))
93 return 0; 64 return -1;
94 65
95 mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET]; 66 *mbrsig = *(u32 *)&mbrbuf_ptr[EDD_MBR_SIG_OFFSET];
96 return mbrsig; 67 return 0;
97} 68}
98 69
99static int get_edd_info(u8 devno, struct edd_info *ei) 70static int get_edd_info(u8 devno, struct edd_info *ei)
@@ -160,6 +131,7 @@ void query_edd(void)
160 int do_edd = 1; 131 int do_edd = 1;
161 int devno; 132 int devno;
162 struct edd_info ei, *edp; 133 struct edd_info ei, *edp;
134 u32 *mbrptr;
163 135
164 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) { 136 if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
165 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) 137 if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip"))
@@ -168,7 +140,8 @@ void query_edd(void)
168 do_edd = 0; 140 do_edd = 0;
169 } 141 }
170 142
171 edp = (struct edd_info *)boot_params.eddbuf; 143 edp = boot_params.eddbuf;
144 mbrptr = boot_params.edd_mbr_sig_buffer;
172 145
173 if (!do_edd) 146 if (!do_edd)
174 return; 147 return;
@@ -186,11 +159,8 @@ void query_edd(void)
186 boot_params.eddbuf_entries++; 159 boot_params.eddbuf_entries++;
187 } 160 }
188 161
189 if (do_mbr) { 162 if (do_mbr && !read_mbr_sig(devno, &ei, mbrptr++))
190 u32 mbr_sig; 163 boot_params.edd_mbr_sig_buf_entries = devno-0x80+1;
191 mbr_sig = read_mbr_sig(devno, &ei);
192 boot_params.edd_mbr_sig_buffer[devno-0x80] = mbr_sig;
193 }
194 } 164 }
195} 165}
196 166
diff --git a/arch/i386/boot/video.c b/arch/i386/boot/video.c
index 958130ef0042..693f20d3102e 100644
--- a/arch/i386/boot/video.c
+++ b/arch/i386/boot/video.c
@@ -61,7 +61,7 @@ static void store_video_mode(void)
61 61
62 /* Not all BIOSes are clean with respect to the top bit */ 62 /* Not all BIOSes are clean with respect to the top bit */
63 boot_params.screen_info.orig_video_mode = ax & 0x7f; 63 boot_params.screen_info.orig_video_mode = ax & 0x7f;
64 boot_params.screen_info.orig_video_page = page; 64 boot_params.screen_info.orig_video_page = page >> 8;
65} 65}
66 66
67/* 67/*
diff --git a/arch/i386/kernel/alternative.c b/arch/i386/kernel/alternative.c
index 1b66d5c70eaf..9f4ac8b02de4 100644
--- a/arch/i386/kernel/alternative.c
+++ b/arch/i386/kernel/alternative.c
@@ -366,6 +366,8 @@ void apply_paravirt(struct paravirt_patch_site *start,
366 unsigned int used; 366 unsigned int used;
367 367
368 BUG_ON(p->len > MAX_PATCH_LEN); 368 BUG_ON(p->len > MAX_PATCH_LEN);
369 /* prep the buffer with the original instructions */
370 memcpy(insnbuf, p->instr, p->len);
369 used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf, 371 used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf,
370 (unsigned long)p->instr, p->len); 372 (unsigned long)p->instr, p->len);
371 373
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index f9fff29e01a9..3d67ae18d762 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -1085,7 +1085,7 @@ static int __init detect_init_APIC (void)
1085 if (l & MSR_IA32_APICBASE_ENABLE) 1085 if (l & MSR_IA32_APICBASE_ENABLE)
1086 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; 1086 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
1087 1087
1088 if (nmi_watchdog != NMI_NONE) 1088 if (nmi_watchdog != NMI_NONE && nmi_watchdog != NMI_DISABLED)
1089 nmi_watchdog = NMI_LOCAL_APIC; 1089 nmi_watchdog = NMI_LOCAL_APIC;
1090 1090
1091 printk(KERN_INFO "Found and enabled local APIC!\n"); 1091 printk(KERN_INFO "Found and enabled local APIC!\n");
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 99beac7f96ce..8c1c965eb2a8 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -77,7 +77,7 @@ static int __init check_nmi_watchdog(void)
77 unsigned int *prev_nmi_count; 77 unsigned int *prev_nmi_count;
78 int cpu; 78 int cpu;
79 79
80 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 80 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
81 return 0; 81 return 0;
82 82
83 if (!atomic_read(&nmi_active)) 83 if (!atomic_read(&nmi_active))
@@ -424,7 +424,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
424 if (!!old_state == !!nmi_watchdog_enabled) 424 if (!!old_state == !!nmi_watchdog_enabled)
425 return 0; 425 return 0;
426 426
427 if (atomic_read(&nmi_active) < 0) { 427 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
428 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 428 printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
429 return -EIO; 429 return -EIO;
430 } 430 }
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index debd7dbb4158..a39280b4dd3a 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -292,7 +292,6 @@ static struct clocksource clocksource_tsc = {
292 292
293void mark_tsc_unstable(char *reason) 293void mark_tsc_unstable(char *reason)
294{ 294{
295 sched_clock_unstable_event();
296 if (!tsc_unstable) { 295 if (!tsc_unstable) {
297 tsc_unstable = 1; 296 tsc_unstable = 1;
298 tsc_enabled = 0; 297 tsc_enabled = 0;
diff --git a/arch/i386/mm/fault.c b/arch/i386/mm/fault.c
index 01ffdd4964f0..fcb38e7f3543 100644
--- a/arch/i386/mm/fault.c
+++ b/arch/i386/mm/fault.c
@@ -249,9 +249,10 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
249 pmd_k = pmd_offset(pud_k, address); 249 pmd_k = pmd_offset(pud_k, address);
250 if (!pmd_present(*pmd_k)) 250 if (!pmd_present(*pmd_k))
251 return NULL; 251 return NULL;
252 if (!pmd_present(*pmd)) 252 if (!pmd_present(*pmd)) {
253 set_pmd(pmd, *pmd_k); 253 set_pmd(pmd, *pmd_k);
254 else 254 arch_flush_lazy_mmu_mode();
255 } else
255 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); 256 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
256 return pmd_k; 257 return pmd_k;
257} 258}
diff --git a/arch/i386/xen/xen-head.S b/arch/i386/xen/xen-head.S
index bc71f3bc4014..f8d6937db2ec 100644
--- a/arch/i386/xen/xen-head.S
+++ b/arch/i386/xen/xen-head.S
@@ -7,20 +7,20 @@
7#include <asm/boot.h> 7#include <asm/boot.h>
8#include <xen/interface/elfnote.h> 8#include <xen/interface/elfnote.h>
9 9
10 .section .init.text 10.pushsection .init.text
11ENTRY(startup_xen) 11ENTRY(startup_xen)
12 movl %esi,xen_start_info 12 movl %esi,xen_start_info
13 cld 13 cld
14 movl $(init_thread_union+THREAD_SIZE),%esp 14 movl $(init_thread_union+THREAD_SIZE),%esp
15 jmp xen_start_kernel 15 jmp xen_start_kernel
16.popsection
16 17
17.pushsection ".bss.page_aligned" 18.pushsection .bss.page_aligned
18 .align PAGE_SIZE_asm 19 .align PAGE_SIZE_asm
19ENTRY(hypercall_page) 20ENTRY(hypercall_page)
20 .skip 0x1000 21 .skip 0x1000
21.popsection 22.popsection
22 23
23 .section .text
24 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux") 24 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS, .asciz "linux")
25 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6") 25 ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
26 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0") 26 ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION, .asciz "xen-3.0")
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 21aa4fc5f8ef..8c39913d1729 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -327,17 +327,7 @@ config FORCE_CPEI_RETARGET
327 This option it useful to enable this feature on older BIOS's as well. 327 This option it useful to enable this feature on older BIOS's as well.
328 You can also enable this by using boot command line option force_cpei=1. 328 You can also enable this by using boot command line option force_cpei=1.
329 329
330config PREEMPT 330source "kernel/Kconfig.preempt"
331 bool "Preemptible Kernel"
332 help
333 This option reduces the latency of the kernel when reacting to
334 real-time or interactive events by allowing a low priority process to
335 be preempted even if it is in kernel mode executing a system call.
336 This allows applications to run more reliably even when the system is
337 under load.
338
339 Say Y here if you are building a kernel for a desktop, embedded
340 or real-time system. Say N if you are unsure.
341 331
342source "mm/Kconfig" 332source "mm/Kconfig"
343 333
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index 9eb48c0927b0..6dd8655664f3 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -42,7 +42,7 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0 42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0 43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0 44CONFIG_CC_ALIGN_JUMPS=0
45CONFIG_SLAB=y 45CONFIG_SLUB=y
46# CONFIG_TINY_SHMEM is not set 46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0 47CONFIG_BASE_SMALL=0
48# CONFIG_SLOB is not set 48# CONFIG_SLOB is not set
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index 3a9ed951db08..e86fbd39c795 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -43,7 +43,7 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0 43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 46CONFIG_SLUB=y
47# CONFIG_TINY_SHMEM is not set 47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 48CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 49# CONFIG_SLOB is not set
diff --git a/arch/ia64/configs/sim_defconfig b/arch/ia64/configs/sim_defconfig
index c420d9f3df98..546a772f438e 100644
--- a/arch/ia64/configs/sim_defconfig
+++ b/arch/ia64/configs/sim_defconfig
@@ -43,7 +43,7 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0 43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0 44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0 45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLAB=y 46CONFIG_SLUB=y
47# CONFIG_TINY_SHMEM is not set 47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0 48CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set 49# CONFIG_SLOB is not set
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 4c9ffc47bc7a..9aecfceeb38c 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -46,7 +46,7 @@ CONFIG_BASE_FULL=y
46CONFIG_FUTEX=y 46CONFIG_FUTEX=y
47CONFIG_EPOLL=y 47CONFIG_EPOLL=y
48CONFIG_SHMEM=y 48CONFIG_SHMEM=y
49CONFIG_SLAB=y 49CONFIG_SLUB=y
50CONFIG_VM_EVENT_COUNTERS=y 50CONFIG_VM_EVENT_COUNTERS=y
51CONFIG_RT_MUTEXES=y 51CONFIG_RT_MUTEXES=y
52# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 3dbb3987df27..797acf9066c1 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -53,7 +53,7 @@ CONFIG_TIMERFD=y
53CONFIG_EVENTFD=y 53CONFIG_EVENTFD=y
54CONFIG_SHMEM=y 54CONFIG_SHMEM=y
55CONFIG_VM_EVENT_COUNTERS=y 55CONFIG_VM_EVENT_COUNTERS=y
56CONFIG_SLAB=y 56CONFIG_SLUB=y
57# CONFIG_SLUB is not set 57# CONFIG_SLUB is not set
58# CONFIG_SLOB is not set 58# CONFIG_SLOB is not set
59CONFIG_RT_MUTEXES=y 59CONFIG_RT_MUTEXES=y
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 4a060fc39934..0a06b1333c95 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -48,7 +48,7 @@ CONFIG_BASE_FULL=y
48CONFIG_FUTEX=y 48CONFIG_FUTEX=y
49CONFIG_EPOLL=y 49CONFIG_EPOLL=y
50CONFIG_SHMEM=y 50CONFIG_SHMEM=y
51CONFIG_SLAB=y 51CONFIG_SLUB=y
52CONFIG_VM_EVENT_COUNTERS=y 52CONFIG_VM_EVENT_COUNTERS=y
53CONFIG_RT_MUTEXES=y 53CONFIG_RT_MUTEXES=y
54# CONFIG_TINY_SHMEM is not set 54# CONFIG_TINY_SHMEM is not set
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 03172dc8c403..0210545e7f61 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -53,8 +53,7 @@ CONFIG_TIMERFD=y
53CONFIG_EVENTFD=y 53CONFIG_EVENTFD=y
54CONFIG_SHMEM=y 54CONFIG_SHMEM=y
55CONFIG_VM_EVENT_COUNTERS=y 55CONFIG_VM_EVENT_COUNTERS=y
56CONFIG_SLAB=y 56CONFIG_SLUB=y
57# CONFIG_SLUB is not set
58# CONFIG_SLOB is not set 57# CONFIG_SLOB is not set
59CONFIG_RT_MUTEXES=y 58CONFIG_RT_MUTEXES=y
60# CONFIG_TINY_SHMEM is not set 59# CONFIG_TINY_SHMEM is not set
diff --git a/arch/ia64/hp/sim/boot/boot_head.S b/arch/ia64/hp/sim/boot/boot_head.S
index a9bd71ac78e2..8808565491fb 100644
--- a/arch/ia64/hp/sim/boot/boot_head.S
+++ b/arch/ia64/hp/sim/boot/boot_head.S
@@ -26,6 +26,7 @@ GLOBAL_ENTRY(_start)
26 movl sp = stack_mem+16384-16 26 movl sp = stack_mem+16384-16
27 bsw.1 27 bsw.1
28 br.call.sptk.many rp=start_bootloader 28 br.call.sptk.many rp=start_bootloader
290: nop 0 /* dummy nop to make unwinding work */
29END(_start) 30END(_start)
30 31
31/* 32/*
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
index 15c08d52f09f..8c6ec7070844 100644
--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
@@ -113,10 +113,8 @@ processor_get_freq (
113 113
114 saved_mask = current->cpus_allowed; 114 saved_mask = current->cpus_allowed;
115 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 115 set_cpus_allowed(current, cpumask_of_cpu(cpu));
116 if (smp_processor_id() != cpu) { 116 if (smp_processor_id() != cpu)
117 ret = -EAGAIN;
118 goto migrate_end; 117 goto migrate_end;
119 }
120 118
121 /* processor_get_pstate gets the instantaneous frequency */ 119 /* processor_get_pstate gets the instantaneous frequency */
122 ret = processor_get_pstate(&value); 120 ret = processor_get_pstate(&value);
@@ -125,7 +123,7 @@ processor_get_freq (
125 set_cpus_allowed(current, saved_mask); 123 set_cpus_allowed(current, saved_mask);
126 printk(KERN_WARNING "get performance failed with error %d\n", 124 printk(KERN_WARNING "get performance failed with error %d\n",
127 ret); 125 ret);
128 ret = -EAGAIN; 126 ret = 0;
129 goto migrate_end; 127 goto migrate_end;
130 } 128 }
131 clock_freq = extract_clock(data, value, cpu); 129 clock_freq = extract_clock(data, value, cpu);
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
index cc3ee4ef37af..44be1c952b7c 100644
--- a/arch/ia64/kernel/irq.c
+++ b/arch/ia64/kernel/irq.c
@@ -33,6 +33,11 @@ void ack_bad_irq(unsigned int irq)
33} 33}
34 34
35#ifdef CONFIG_IA64_GENERIC 35#ifdef CONFIG_IA64_GENERIC
36ia64_vector __ia64_irq_to_vector(int irq)
37{
38 return irq_cfg[irq].vector;
39}
40
36unsigned int __ia64_local_vector_to_irq (ia64_vector vec) 41unsigned int __ia64_local_vector_to_irq (ia64_vector vec)
37{ 42{
38 return __get_cpu_var(vector_irq)[vec]; 43 return __get_cpu_var(vector_irq)[vec];
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index ff28620cb992..63b73f3d4c9f 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -2018,22 +2018,26 @@ ia64_mca_late_init(void)
2018 2018
2019 if (cpe_vector >= 0) { 2019 if (cpe_vector >= 0) {
2020 /* If platform supports CPEI, enable the irq. */ 2020 /* If platform supports CPEI, enable the irq. */
2021 cpe_poll_enabled = 0; 2021 irq = local_vector_to_irq(cpe_vector);
2022 for (irq = 0; irq < NR_IRQS; ++irq) 2022 if (irq > 0) {
2023 if (irq_to_vector(irq) == cpe_vector) { 2023 cpe_poll_enabled = 0;
2024 desc = irq_desc + irq; 2024 desc = irq_desc + irq;
2025 desc->status |= IRQ_PER_CPU; 2025 desc->status |= IRQ_PER_CPU;
2026 setup_irq(irq, &mca_cpe_irqaction); 2026 setup_irq(irq, &mca_cpe_irqaction);
2027 ia64_cpe_irq = irq; 2027 ia64_cpe_irq = irq;
2028 } 2028 ia64_mca_register_cpev(cpe_vector);
2029 ia64_mca_register_cpev(cpe_vector); 2029 IA64_MCA_DEBUG("%s: CPEI/P setup and enabled.\n",
2030 IA64_MCA_DEBUG("%s: CPEI/P setup and enabled.\n", __FUNCTION__); 2030 __FUNCTION__);
2031 } else { 2031 return 0;
2032 /* If platform doesn't support CPEI, get the timer going. */
2033 if (cpe_poll_enabled) {
2034 ia64_mca_cpe_poll(0UL);
2035 IA64_MCA_DEBUG("%s: CPEP setup and enabled.\n", __FUNCTION__);
2036 } 2032 }
2033 printk(KERN_ERR "%s: Failed to find irq for CPE "
2034 "interrupt handler, vector %d\n",
2035 __FUNCTION__, cpe_vector);
2036 }
2037 /* If platform doesn't support CPEI, get the timer going. */
2038 if (cpe_poll_enabled) {
2039 ia64_mca_cpe_poll(0UL);
2040 IA64_MCA_DEBUG("%s: CPEP setup and enabled.\n", __FUNCTION__);
2037 } 2041 }
2038 } 2042 }
2039#endif 2043#endif
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 4158906c45aa..c613fc0e91cc 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -198,9 +198,13 @@ default_idle (void)
198{ 198{
199 local_irq_enable(); 199 local_irq_enable();
200 while (!need_resched()) { 200 while (!need_resched()) {
201 if (can_do_pal_halt) 201 if (can_do_pal_halt) {
202 safe_halt(); 202 local_irq_disable();
203 else 203 if (!need_resched()) {
204 safe_halt();
205 }
206 local_irq_enable();
207 } else
204 cpu_relax(); 208 cpu_relax();
205 } 209 }
206} 210}
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 00f803246948..122444a97897 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -951,10 +951,14 @@ access_uarea (struct task_struct *child, unsigned long addr,
951 return 0; 951 return 0;
952 952
953 case PT_CR_IPSR: 953 case PT_CR_IPSR:
954 if (write_access) 954 if (write_access) {
955 pt->cr_ipsr = ((*data & IPSR_MASK) 955 unsigned long tmp = *data;
956 /* psr.ri==3 is a reserved value: SDM 2:25 */
957 if ((tmp & IA64_PSR_RI) == IA64_PSR_RI)
958 tmp &= ~IA64_PSR_RI;
959 pt->cr_ipsr = ((tmp & IPSR_MASK)
956 | (pt->cr_ipsr & ~IPSR_MASK)); 960 | (pt->cr_ipsr & ~IPSR_MASK));
957 else 961 } else
958 *data = (pt->cr_ipsr & IPSR_MASK); 962 *data = (pt->cr_ipsr & IPSR_MASK);
959 return 0; 963 return 0;
960 964
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index cd9a37a552c3..407efea04bf5 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -389,6 +389,13 @@ early_console_setup (char *cmdline)
389 if (!efi_setup_pcdp_console(cmdline)) 389 if (!efi_setup_pcdp_console(cmdline))
390 earlycons++; 390 earlycons++;
391#endif 391#endif
392#ifdef CONFIG_HP_SIMSERIAL_CONSOLE
393 {
394 extern struct console hpsim_cons;
395 register_console(&hpsim_cons);
396 earlycons++;
397 }
398#endif
392 399
393 return (earlycons) ? 0 : -1; 400 return (earlycons) ? 0 : -1;
394} 401}
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 83e80677de70..00232b4357ba 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -20,6 +20,8 @@ PHDRS {
20 code PT_LOAD; 20 code PT_LOAD;
21 percpu PT_LOAD; 21 percpu PT_LOAD;
22 data PT_LOAD; 22 data PT_LOAD;
23 note PT_NOTE;
24 unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */
23} 25}
24SECTIONS 26SECTIONS
25{ 27{
@@ -62,6 +64,9 @@ SECTIONS
62 64
63 /* Read-only data */ 65 /* Read-only data */
64 66
67 NOTES :code :note /* put .notes in text and mark in PT_NOTE */
68 code_continues : {} :code /* switch back to regular program... */
69
65 /* Exception table */ 70 /* Exception table */
66 . = ALIGN(16); 71 . = ALIGN(16);
67 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) 72 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET)
@@ -99,7 +104,8 @@ SECTIONS
99 __start_unwind = .; 104 __start_unwind = .;
100 *(.IA_64.unwind*) 105 *(.IA_64.unwind*)
101 __end_unwind = .; 106 __end_unwind = .;
102 } 107 } :code :unwind
108 code_continues2 : {} : code
103 109
104 RODATA 110 RODATA
105 111
@@ -276,10 +282,6 @@ SECTIONS
276 .debug_typenames 0 : { *(.debug_typenames) } 282 .debug_typenames 0 : { *(.debug_typenames) }
277 .debug_varnames 0 : { *(.debug_varnames) } 283 .debug_varnames 0 : { *(.debug_varnames) }
278 /* These must appear regardless of . */ 284 /* These must appear regardless of . */
279 /* Discard them for now since Intel SoftSDV cannot handle them.
280 .comment 0 : { *(.comment) }
281 .note 0 : { *(.note) }
282 */
283 /DISCARD/ : { *(.comment) } 285 /DISCARD/ : { *(.comment) }
284 /DISCARD/ : { *(.note) } 286 /DISCARD/ : { *(.note) }
285} 287}
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 73ccb6010c05..9150ffaff9e8 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -112,11 +112,17 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
112 down_read(&mm->mmap_sem); 112 down_read(&mm->mmap_sem);
113 113
114 vma = find_vma_prev(mm, address, &prev_vma); 114 vma = find_vma_prev(mm, address, &prev_vma);
115 if (!vma) 115 if (!vma && !prev_vma )
116 goto bad_area; 116 goto bad_area;
117 117
118 /* find_vma_prev() returns vma such that address < vma->vm_end or NULL */ 118 /*
119 if (address < vma->vm_start) 119 * find_vma_prev() returns vma such that address < vma->vm_end or NULL
120 *
121 * May find no vma, but could be that the last vm area is the
122 * register backing store that needs to expand upwards, in
123 * this case vma will be null, but prev_vma will ne non-null
124 */
125 if (( !vma && prev_vma ) || (address < vma->vm_start) )
120 goto check_expansion; 126 goto check_expansion;
121 127
122 good_area: 128 good_area:
@@ -172,6 +178,8 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
172 178
173 check_expansion: 179 check_expansion:
174 if (!(prev_vma && (prev_vma->vm_flags & VM_GROWSUP) && (address == prev_vma->vm_end))) { 180 if (!(prev_vma && (prev_vma->vm_flags & VM_GROWSUP) && (address == prev_vma->vm_end))) {
181 if (!vma)
182 goto bad_area;
175 if (!(vma->vm_flags & VM_GROWSDOWN)) 183 if (!(vma->vm_flags & VM_GROWSDOWN))
176 goto bad_area; 184 goto bad_area;
177 if (REGION_NUMBER(address) != REGION_NUMBER(vma->vm_start) 185 if (REGION_NUMBER(address) != REGION_NUMBER(vma->vm_start)
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 7f6d2360a262..360047389449 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -256,6 +256,13 @@ struct irq_chip irq_type_sn = {
256 .set_affinity = sn_set_affinity_irq 256 .set_affinity = sn_set_affinity_irq
257}; 257};
258 258
259ia64_vector sn_irq_to_vector(int irq)
260{
261 if (irq >= IA64_NUM_VECTORS)
262 return 0;
263 return (ia64_vector)irq;
264}
265
259unsigned int sn_local_vector_to_irq(u8 vector) 266unsigned int sn_local_vector_to_irq(u8 vector)
260{ 267{
261 return (CPU_VECTOR_TO_IRQ(smp_processor_id(), vector)); 268 return (CPU_VECTOR_TO_IRQ(smp_processor_id(), vector));
@@ -398,7 +405,10 @@ sn_call_force_intr_provider(struct sn_irq_info *sn_irq_info)
398 struct sn_pcibus_provider *pci_provider; 405 struct sn_pcibus_provider *pci_provider;
399 406
400 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type]; 407 pci_provider = sn_pci_provider[sn_irq_info->irq_bridge_type];
401 if (pci_provider && pci_provider->force_interrupt) 408
409 /* Don't force an interrupt if the irq has been disabled */
410 if (!(irq_desc[sn_irq_info->irq_irq].status & IRQ_DISABLED) &&
411 pci_provider && pci_provider->force_interrupt)
402 (*pci_provider->force_interrupt)(sn_irq_info); 412 (*pci_provider->force_interrupt)(sn_irq_info);
403} 413}
404 414
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 7e6d5fb75390..ed3a4caec620 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -62,7 +62,6 @@ EXPORT_SYMBOL(m68k_num_memory);
62int m68k_realnum_memory; 62int m68k_realnum_memory;
63EXPORT_SYMBOL(m68k_realnum_memory); 63EXPORT_SYMBOL(m68k_realnum_memory);
64unsigned long m68k_memoffset; 64unsigned long m68k_memoffset;
65EXPORT_SYMBOL(m68k_memoffset);
66struct mem_info m68k_memory[NUM_MEMINFO]; 65struct mem_info m68k_memory[NUM_MEMINFO];
67EXPORT_SYMBOL(m68k_memory); 66EXPORT_SYMBOL(m68k_memory);
68 67
@@ -200,7 +199,6 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
200 (m68k_num_memory - 1)); 199 (m68k_num_memory - 1));
201 m68k_num_memory = 1; 200 m68k_num_memory = 1;
202 } 201 }
203 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
204#endif 202#endif
205} 203}
206 204
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index c42245775a4d..59fe285865ec 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -19,6 +19,8 @@ SECTIONS
19 *(.gnu.warning) 19 *(.gnu.warning)
20 } :text = 0x4e75 20 } :text = 0x4e75
21 21
22 _etext = .; /* End of text section */
23
22 . = ALIGN(16); /* Exception table */ 24 . = ALIGN(16); /* Exception table */
23 __start___ex_table = .; 25 __start___ex_table = .;
24 __ex_table : { *(__ex_table) } 26 __ex_table : { *(__ex_table) }
@@ -26,8 +28,6 @@ SECTIONS
26 28
27 RODATA 29 RODATA
28 30
29 _etext = .; /* End of text section */
30
31 .data : { /* Data */ 31 .data : { /* Data */
32 DATA_DATA 32 DATA_DATA
33 CONSTRUCTORS 33 CONSTRUCTORS
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 7d571a2b44dd..30d34f285024 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -210,11 +210,7 @@ void __init paging_init(void)
210 int i; 210 int i;
211 211
212#ifdef DEBUG 212#ifdef DEBUG
213 { 213 printk ("start of paging_init (%p, %lx)\n", kernel_pg_dir, availmem);
214 extern unsigned long availmem;
215 printk ("start of paging_init (%p, %lx)\n",
216 kernel_pg_dir, availmem);
217 }
218#endif 214#endif
219 215
220 /* Fix the cache mode in the page descriptors for the 680[46]0. */ 216 /* Fix the cache mode in the page descriptors for the 680[46]0. */
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 846f97534685..47502d5ec19f 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -28,6 +28,7 @@
28#include <linux/a.out.h> 28#include <linux/a.out.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/reboot.h> 30#include <linux/reboot.h>
31#include <linux/fs.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/system.h> 34#include <asm/system.h>
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index 48e6b33e8b44..15d62c5279a9 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -18,6 +18,7 @@
18#include <linux/mman.h> 18#include <linux/mman.h>
19#include <linux/file.h> 19#include <linux/file.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/fs.h>
21 22
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 4680e2010887..3e79bf0a3159 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -44,8 +44,18 @@
44 #size-cells = <1>; 44 #size-cells = <1>;
45 #interrupt-cells = <2>; 45 #interrupt-cells = <2>;
46 device_type = "soc"; 46 device_type = "soc";
47 ranges = <0 e0000000 00100000>; 47
48 reg = <e0000000 00100000>; // CCSRBAR 1M 48
49 ranges = <00001000 e0001000 000ff000
50 80000000 80000000 20000000
51 a0000000 a0000000 10000000
52 b0000000 b0000000 00100000
53 c0000000 c0000000 20000000
54 b0100000 b0100000 00100000
55 e1000000 e1000000 00010000
56 e1010000 e1010000 00010000
57 e1020000 e1020000 00010000>;
58 reg = <e0000000 00001000>; // CCSRBAR 1M
49 bus-frequency = <0>; // Filled out by uboot. 59 bus-frequency = <0>; // Filled out by uboot.
50 60
51 memory-controller@2000 { 61 memory-controller@2000 {
@@ -161,8 +171,8 @@
161 interrupt-parent = <&mpic>; 171 interrupt-parent = <&mpic>;
162 interrupts = <18 2>; 172 interrupts = <18 2>;
163 bus-range = <0 ff>; 173 bus-range = <0 ff>;
164 ranges = <02000000 0 80000000 80000000 0 10000000 174 ranges = <02000000 0 c0000000 c0000000 0 20000000
165 01000000 0 00000000 e2000000 0 00800000>; 175 01000000 0 00000000 e1000000 0 00010000>;
166 clock-frequency = <3f940aa>; 176 clock-frequency = <3f940aa>;
167 #interrupt-cells = <1>; 177 #interrupt-cells = <1>;
168 #size-cells = <2>; 178 #size-cells = <2>;
@@ -178,8 +188,8 @@
178 #address-cells = <3>; 188 #address-cells = <3>;
179 reg = <9000 1000>; 189 reg = <9000 1000>;
180 bus-range = <0 ff>; 190 bus-range = <0 ff>;
181 ranges = <02000000 0 90000000 90000000 0 10000000 191 ranges = <02000000 0 80000000 80000000 0 20000000
182 01000000 0 00000000 e3000000 0 00800000>; 192 01000000 0 00000000 e1010000 0 00010000>;
183 clock-frequency = <1fca055>; 193 clock-frequency = <1fca055>;
184 interrupt-parent = <&mpic>; 194 interrupt-parent = <&mpic>;
185 interrupts = <1a 2>; 195 interrupts = <1a 2>;
@@ -202,7 +212,7 @@
202 reg = <a000 1000>; 212 reg = <a000 1000>;
203 bus-range = <0 ff>; 213 bus-range = <0 ff>;
204 ranges = <02000000 0 a0000000 a0000000 0 10000000 214 ranges = <02000000 0 a0000000 a0000000 0 10000000
205 01000000 0 00000000 e2800000 0 00800000>; 215 01000000 0 00000000 e1020000 0 00010000>;
206 clock-frequency = <1fca055>; 216 clock-frequency = <1fca055>;
207 interrupt-parent = <&mpic>; 217 interrupt-parent = <&mpic>;
208 interrupts = <19 2>; 218 interrupts = <19 2>;
@@ -224,49 +234,29 @@
224 #address-cells = <3>; 234 #address-cells = <3>;
225 reg = <b000 1000>; 235 reg = <b000 1000>;
226 bus-range = <0 ff>; 236 bus-range = <0 ff>;
227 ranges = <02000000 0 b0000000 b0000000 0 10000000 237 ranges = <02000000 0 b0000000 b0000000 0 00100000
228 01000000 0 00000000 e3800000 0 00800000>; 238 01000000 0 00000000 b0100000 0 00100000>;
229 clock-frequency = <1fca055>; 239 clock-frequency = <1fca055>;
230 interrupt-parent = <&mpic>; 240 interrupt-parent = <&mpic>;
231 interrupts = <1b 2>; 241 interrupts = <1b 2>;
232 interrupt-map-mask = <f800 0 0 7>; 242 interrupt-map-mask = <fb00 0 0 0>;
233 interrupt-map = < 243 interrupt-map = <
234
235 // IDSEL 0x1a
236 d000 0 0 1 &i8259 6 2
237 d000 0 0 2 &i8259 3 2
238 d000 0 0 3 &i8259 4 2
239 d000 0 0 4 &i8259 5 2
240
241 // IDSEL 0x1b
242 d800 0 0 1 &i8259 5 2
243 d800 0 0 2 &i8259 0 0
244 d800 0 0 3 &i8259 0 0
245 d800 0 0 4 &i8259 0 0
246
247 // IDSEL 0x1c USB 244 // IDSEL 0x1c USB
248 e000 0 0 1 &i8259 9 2 245 e000 0 0 0 &i8259 c 2
249 e000 0 0 2 &i8259 a 2 246 e100 0 0 0 &i8259 9 2
250 e000 0 0 3 &i8259 c 2 247 e200 0 0 0 &i8259 a 2
251 e000 0 0 4 &i8259 7 2 248 e300 0 0 0 &i8259 b 2
252 249
253 // IDSEL 0x1d Audio 250 // IDSEL 0x1d Audio
254 e800 0 0 1 &i8259 9 2 251 e800 0 0 0 &i8259 6 2
255 e800 0 0 2 &i8259 a 2
256 e800 0 0 3 &i8259 b 2
257 e800 0 0 4 &i8259 0 0
258 252
259 // IDSEL 0x1e Legacy 253 // IDSEL 0x1e Legacy
260 f000 0 0 1 &i8259 c 2 254 f000 0 0 0 &i8259 7 2
261 f000 0 0 2 &i8259 0 0 255 f100 0 0 0 &i8259 7 2
262 f000 0 0 3 &i8259 0 0
263 f000 0 0 4 &i8259 0 0
264 256
265 // IDSEL 0x1f IDE/SATA 257 // IDSEL 0x1f IDE/SATA
266 f800 0 0 1 &i8259 6 2 258 f800 0 0 0 &i8259 e 2
267 f800 0 0 2 &i8259 0 0 259 f900 0 0 0 &i8259 5 2
268 f800 0 0 3 &i8259 0 0
269 f800 0 0 4 &i8259 0 0
270 >; 260 >;
271 uli1575@0 { 261 uli1575@0 {
272 reg = <0 0 0 0 0>; 262 reg = <0 0 0 0 0>;
@@ -274,10 +264,10 @@
274 #address-cells = <3>; 264 #address-cells = <3>;
275 ranges = <02000000 0 b0000000 265 ranges = <02000000 0 b0000000
276 02000000 0 b0000000 266 02000000 0 b0000000
277 0 10000000 267 0 00100000
278 01000000 0 00000000 268 01000000 0 00000000
279 01000000 0 00000000 269 01000000 0 00000000
280 0 00080000>; 270 0 00100000>;
281 271
282 pci_bridge@0 { 272 pci_bridge@0 {
283 reg = <0 0 0 0 0>; 273 reg = <0 0 0 0 0>;
@@ -285,10 +275,10 @@
285 #address-cells = <3>; 275 #address-cells = <3>;
286 ranges = <02000000 0 b0000000 276 ranges = <02000000 0 b0000000
287 02000000 0 b0000000 277 02000000 0 b0000000
288 0 20000000 278 0 00100000
289 01000000 0 00000000 279 01000000 0 00000000
290 01000000 0 00000000 280 01000000 0 00000000
291 0 00100000>; 281 0 00100000>;
292 282
293 isa@1e { 283 isa@1e {
294 device_type = "isa"; 284 device_type = "isa";
@@ -296,7 +286,8 @@
296 #size-cells = <1>; 286 #size-cells = <1>;
297 #address-cells = <2>; 287 #address-cells = <2>;
298 reg = <f000 0 0 0 0>; 288 reg = <f000 0 0 0 0>;
299 ranges = <1 0 01000000 0 0 289 ranges = <1 0
290 01000000 0 0
300 00001000>; 291 00001000>;
301 interrupt-parent = <&i8259>; 292 interrupt-parent = <&i8259>;
302 293
@@ -312,8 +303,7 @@
312 built-in; 303 built-in;
313 compatible = "chrp,iic"; 304 compatible = "chrp,iic";
314 interrupts = <9 2>; 305 interrupts = <9 2>;
315 interrupt-parent = 306 interrupt-parent = <&mpic>;
316 <&mpic>;
317 }; 307 };
318 308
319 i8042@60 { 309 i8042@60 {
@@ -321,8 +311,7 @@
321 #address-cells = <1>; 311 #address-cells = <1>;
322 reg = <1 60 1 1 64 1>; 312 reg = <1 60 1 1 64 1>;
323 interrupts = <1 3 c 3>; 313 interrupts = <1 3 c 3>;
324 interrupt-parent = 314 interrupt-parent = <&i8259>;
325 <&i8259>;
326 315
327 keyboard@0 { 316 keyboard@0 {
328 reg = <0>; 317 reg = <0>;
@@ -336,8 +325,7 @@
336 }; 325 };
337 326
338 rtc@70 { 327 rtc@70 {
339 compatible = 328 compatible = "pnpPNP,b00";
340 "pnpPNP,b00";
341 reg = <1 70 2>; 329 reg = <1 70 2>;
342 }; 330 };
343 331
diff --git a/arch/powerpc/boot/dts/mpc8641_hpcn.dts b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
index 5d82709cfcbb..b0166e5c177e 100644
--- a/arch/powerpc/boot/dts/mpc8641_hpcn.dts
+++ b/arch/powerpc/boot/dts/mpc8641_hpcn.dts
@@ -224,98 +224,36 @@
224 clock-frequency = <1fca055>; 224 clock-frequency = <1fca055>;
225 interrupt-parent = <&mpic>; 225 interrupt-parent = <&mpic>;
226 interrupts = <18 2>; 226 interrupts = <18 2>;
227 interrupt-map-mask = <f800 0 0 7>; 227 interrupt-map-mask = <fb00 0 0 0>;
228 interrupt-map = < 228 interrupt-map = <
229 /* IDSEL 0x11 */ 229 /* IDSEL 0x11 */
230 8800 0 0 1 &i8259 3 2 230 8800 0 0 1 &i8259 9 2
231 8800 0 0 2 &i8259 4 2 231 8800 0 0 2 &i8259 a 2
232 8800 0 0 3 &i8259 5 2 232 8800 0 0 3 &i8259 b 2
233 8800 0 0 4 &i8259 6 2 233 8800 0 0 4 &i8259 c 2
234 234
235 /* IDSEL 0x12 */ 235 /* IDSEL 0x12 */
236 9000 0 0 1 &i8259 4 2 236 9000 0 0 1 &i8259 a 2
237 9000 0 0 2 &i8259 5 2 237 9000 0 0 2 &i8259 b 2
238 9000 0 0 3 &i8259 6 2 238 9000 0 0 3 &i8259 c 2
239 9000 0 0 4 &i8259 3 2 239 9000 0 0 4 &i8259 9 2
240 240
241 /* IDSEL 0x13 */ 241 // IDSEL 0x1c USB
242 9800 0 0 1 &i8259 0 0 242 e000 0 0 0 &i8259 c 2
243 9800 0 0 2 &i8259 0 0 243 e100 0 0 0 &i8259 9 2
244 9800 0 0 3 &i8259 0 0 244 e200 0 0 0 &i8259 a 2
245 9800 0 0 4 &i8259 0 0 245 e300 0 0 0 &i8259 b 2
246 246
247 /* IDSEL 0x14 */ 247 // IDSEL 0x1d Audio
248 a000 0 0 1 &i8259 0 0 248 e800 0 0 0 &i8259 6 2
249 a000 0 0 2 &i8259 0 0 249
250 a000 0 0 3 &i8259 0 0 250 // IDSEL 0x1e Legacy
251 a000 0 0 4 &i8259 0 0 251 f000 0 0 0 &i8259 7 2
252 252 f100 0 0 0 &i8259 7 2
253 /* IDSEL 0x15 */ 253
254 a800 0 0 1 &i8259 0 0 254 // IDSEL 0x1f IDE/SATA
255 a800 0 0 2 &i8259 0 0 255 f800 0 0 0 &i8259 e 2
256 a800 0 0 3 &i8259 0 0 256 f900 0 0 0 &i8259 5 2
257 a800 0 0 4 &i8259 0 0
258
259 /* IDSEL 0x16 */
260 b000 0 0 1 &i8259 0 0
261 b000 0 0 2 &i8259 0 0
262 b000 0 0 3 &i8259 0 0
263 b000 0 0 4 &i8259 0 0
264
265 /* IDSEL 0x17 */
266 b800 0 0 1 &i8259 0 0
267 b800 0 0 2 &i8259 0 0
268 b800 0 0 3 &i8259 0 0
269 b800 0 0 4 &i8259 0 0
270
271 /* IDSEL 0x18 */
272 c000 0 0 1 &i8259 0 0
273 c000 0 0 2 &i8259 0 0
274 c000 0 0 3 &i8259 0 0
275 c000 0 0 4 &i8259 0 0
276
277 /* IDSEL 0x19 */
278 c800 0 0 1 &i8259 0 0
279 c800 0 0 2 &i8259 0 0
280 c800 0 0 3 &i8259 0 0
281 c800 0 0 4 &i8259 0 0
282
283 /* IDSEL 0x1a */
284 d000 0 0 1 &i8259 6 2
285 d000 0 0 2 &i8259 3 2
286 d000 0 0 3 &i8259 4 2
287 d000 0 0 4 &i8259 5 2
288
289
290 /* IDSEL 0x1b */
291 d800 0 0 1 &i8259 5 2
292 d800 0 0 2 &i8259 0 0
293 d800 0 0 3 &i8259 0 0
294 d800 0 0 4 &i8259 0 0
295
296 /* IDSEL 0x1c */
297 e000 0 0 1 &i8259 9 2
298 e000 0 0 2 &i8259 a 2
299 e000 0 0 3 &i8259 c 2
300 e000 0 0 4 &i8259 7 2
301
302 /* IDSEL 0x1d */
303 e800 0 0 1 &i8259 9 2
304 e800 0 0 2 &i8259 a 2
305 e800 0 0 3 &i8259 b 2
306 e800 0 0 4 &i8259 0 0
307
308 /* IDSEL 0x1e */
309 f000 0 0 1 &i8259 c 2
310 f000 0 0 2 &i8259 0 0
311 f000 0 0 3 &i8259 0 0
312 f000 0 0 4 &i8259 0 0
313
314 /* IDSEL 0x1f */
315 f800 0 0 1 &i8259 6 2
316 f800 0 0 2 &i8259 0 0
317 f800 0 0 3 &i8259 0 0
318 f800 0 0 4 &i8259 0 0
319 >; 257 >;
320 uli1575@0 { 258 uli1575@0 {
321 reg = <0 0 0 0 0>; 259 reg = <0 0 0 0 0>;
diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index b732644788db..13761bf160c4 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -134,20 +134,6 @@ static char *ft_next(struct ft_cxt *cxt, char *p, struct ft_atom *ret)
134#define HDR_SIZE _ALIGN(sizeof(struct boot_param_header), 8) 134#define HDR_SIZE _ALIGN(sizeof(struct boot_param_header), 8)
135#define EXPAND_INCR 1024 /* alloc this much extra when expanding */ 135#define EXPAND_INCR 1024 /* alloc this much extra when expanding */
136 136
137/* See if the regions are in the standard order and non-overlapping */
138static int ft_ordered(struct ft_cxt *cxt)
139{
140 char *p = (char *)cxt->bph + HDR_SIZE;
141 enum ft_rgn_id r;
142
143 for (r = FT_RSVMAP; r <= FT_STRINGS; ++r) {
144 if (p > cxt->rgn[r].start)
145 return 0;
146 p = cxt->rgn[r].start + cxt->rgn[r].size;
147 }
148 return p <= (char *)cxt->bph + cxt->max_size;
149}
150
151/* Copy the tree to a newly-allocated region and put things in order */ 137/* Copy the tree to a newly-allocated region and put things in order */
152static int ft_reorder(struct ft_cxt *cxt, int nextra) 138static int ft_reorder(struct ft_cxt *cxt, int nextra)
153{ 139{
@@ -573,10 +559,6 @@ int ft_open(struct ft_cxt *cxt, void *blob, unsigned int max_size,
573 cxt->rgn[FT_STRUCT].size = struct_size(cxt); 559 cxt->rgn[FT_STRUCT].size = struct_size(cxt);
574 cxt->rgn[FT_STRINGS].start = blob + be32_to_cpu(bph->off_dt_strings); 560 cxt->rgn[FT_STRINGS].start = blob + be32_to_cpu(bph->off_dt_strings);
575 cxt->rgn[FT_STRINGS].size = be32_to_cpu(bph->dt_strings_size); 561 cxt->rgn[FT_STRINGS].size = be32_to_cpu(bph->dt_strings_size);
576 /* Leave as '0' to force first ft_make_space call to do a ft_reorder
577 * and move dt to an area allocated by realloc.
578 cxt->isordered = ft_ordered(cxt);
579 */
580 562
581 cxt->p = cxt->rgn[FT_STRUCT].start; 563 cxt->p = cxt->rgn[FT_STRUCT].start;
582 cxt->str_anchor = cxt->rgn[FT_STRINGS].start; 564 cxt->str_anchor = cxt->rgn[FT_STRINGS].start;
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index f39a72f30aad..b0cb2e662c25 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -81,6 +81,7 @@ obj-y += iomap.o
81endif 81endif
82 82
83ifeq ($(CONFIG_PPC_ISERIES),y) 83ifeq ($(CONFIG_PPC_ISERIES),y)
84CFLAGS_lparmap.s += -g0
84extra-y += lparmap.s 85extra-y += lparmap.s
85$(obj)/head_64.o: $(obj)/lparmap.s 86$(obj)/head_64.o: $(obj)/lparmap.s
86AFLAGS_head_64.o += -I$(obj) 87AFLAGS_head_64.o += -I$(obj)
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index e708ab7ca9e8..8533de50347d 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -301,9 +301,19 @@ _GLOBAL(_tlbie)
301 mfspr r4,SPRN_MMUCR 301 mfspr r4,SPRN_MMUCR
302 mfspr r5,SPRN_PID /* Get PID */ 302 mfspr r5,SPRN_PID /* Get PID */
303 rlwimi r4,r5,0,24,31 /* Set TID */ 303 rlwimi r4,r5,0,24,31 /* Set TID */
304 mtspr SPRN_MMUCR,r4
305 304
305 /* We have to run the search with interrupts disabled, even critical
306 * and debug interrupts (in fact the only critical exceptions we have
307 * are debug and machine check). Otherwise an interrupt which causes
308 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
309 mfmsr r5
310 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
311 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
312 andc r6,r5,r6
313 mtmsr r6
314 mtspr SPRN_MMUCR,r4
306 tlbsx. r3, 0, r3 315 tlbsx. r3, 0, r3
316 mtmsr r5
307 bne 10f 317 bne 10f
308 sync 318 sync
309 /* There are only 64 TLB entries, so r3 < 64, 319 /* There are only 64 TLB entries, so r3 < 64,
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 2bb1cb911783..d8502e377518 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -299,7 +299,7 @@ static inline int check_io_access(struct pt_regs *regs)
299#ifndef CONFIG_FSL_BOOKE 299#ifndef CONFIG_FSL_BOOKE
300#define get_mc_reason(regs) ((regs)->dsisr) 300#define get_mc_reason(regs) ((regs)->dsisr)
301#else 301#else
302#define get_mc_reason(regs) (mfspr(SPRN_MCSR)) 302#define get_mc_reason(regs) (mfspr(SPRN_MCSR) & MCSR_MASK)
303#endif 303#endif
304#define REASON_FP ESR_FP 304#define REASON_FP ESR_FP
305#define REASON_ILLEGAL (ESR_PIL | ESR_PUO) 305#define REASON_ILLEGAL (ESR_PIL | ESR_PUO)
@@ -414,8 +414,6 @@ void machine_check_exception(struct pt_regs *regs)
414 printk("Data Cache Push Parity Error\n"); 414 printk("Data Cache Push Parity Error\n");
415 if (reason & MCSR_DCPERR) 415 if (reason & MCSR_DCPERR)
416 printk("Data Cache Parity Error\n"); 416 printk("Data Cache Parity Error\n");
417 if (reason & MCSR_GL_CI)
418 printk("Guarded Load or Cache-Inhibited stwcx.\n");
419 if (reason & MCSR_BUS_IAERR) 417 if (reason & MCSR_BUS_IAERR)
420 printk("Bus - Instruction Address Error\n"); 418 printk("Bus - Instruction Address Error\n");
421 if (reason & MCSR_BUS_RAERR) 419 if (reason & MCSR_BUS_RAERR)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index f1789578747a..a47151e806ca 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -795,7 +795,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
795 795
796#ifdef CONFIG_PPC_MM_SLICES 796#ifdef CONFIG_PPC_MM_SLICES
797 /* We only prefault standard pages for now */ 797 /* We only prefault standard pages for now */
798 if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize)); 798 if (unlikely(get_slice_psize(mm, ea) != mm->context.user_psize))
799 return; 799 return;
800#endif 800#endif
801 801
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index f58184086c8c..f620171ad6b1 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -33,6 +33,7 @@ config MPC8544_DS
33 bool "Freescale MPC8544 DS" 33 bool "Freescale MPC8544 DS"
34 select PPC_I8259 34 select PPC_I8259
35 select DEFAULT_UIMAGE 35 select DEFAULT_UIMAGE
36 select FSL_ULI1575
36 help 37 help
37 This option enables support for the MPC8544 DS board 38 This option enables support for the MPC8544 DS board
38 39
diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c b/arch/powerpc/platforms/85xx/mpc8544_ds.c
index 4905f6f8903b..0f834d8be444 100644
--- a/arch/powerpc/platforms/85xx/mpc8544_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8544_ds.c
@@ -114,211 +114,25 @@ void __init mpc8544_ds_pic_init(void)
114} 114}
115 115
116#ifdef CONFIG_PCI 116#ifdef CONFIG_PCI
117enum pirq { PIRQA = 8, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH }; 117extern int uses_fsl_uli_m1575;
118extern int uli_exclude_device(struct pci_controller *hose,
119 u_char bus, u_char devfn);
118 120
119/* 121static int mpc85xx_exclude_device(struct pci_controller *hose,
120 * Value in table -- IRQ number 122 u_char bus, u_char devfn)
121 */
122const unsigned char uli1575_irq_route_table[16] = {
123 0, /* 0: Reserved */
124 0x8,
125 0, /* 2: Reserved */
126 0x2,
127 0x4,
128 0x5,
129 0x7,
130 0x6,
131 0, /* 8: Reserved */
132 0x1,
133 0x3,
134 0x9,
135 0xb,
136 0, /* 13: Reserved */
137 0xd,
138 0xf,
139};
140
141static int __devinit
142get_pci_irq_from_of(struct pci_controller *hose, int slot, int pin)
143{
144 struct of_irq oirq;
145 u32 laddr[3];
146 struct device_node *hosenode = hose ? hose->arch_data : NULL;
147
148 if (!hosenode)
149 return -EINVAL;
150
151 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(slot, 0) << 8);
152 laddr[1] = laddr[2] = 0;
153 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
154 DBG("mpc8544_ds: pci irq addr %x, slot %d, pin %d, irq %d\n",
155 laddr[0], slot, pin, oirq.specifier[0]);
156 return oirq.specifier[0];
157}
158
159/*8259*/
160static void __devinit quirk_uli1575(struct pci_dev *dev)
161{
162 unsigned short temp;
163 struct pci_controller *hose = pci_bus_to_host(dev->bus);
164 unsigned char irq2pin[16];
165 unsigned long pirq_map_word = 0;
166 u32 irq;
167 int i;
168
169 /*
170 * ULI1575 interrupts route setup
171 */
172 memset(irq2pin, 0, 16); /* Initialize default value 0 */
173
174 irq2pin[6]=PIRQA+3; /* enabled mapping for IRQ6 to PIRQD, used by SATA */
175
176 /*
177 * PIRQE -> PIRQF mapping set manually
178 *
179 * IRQ pin IRQ#
180 * PIRQE ---- 9
181 * PIRQF ---- 10
182 * PIRQG ---- 11
183 * PIRQH ---- 12
184 */
185 for (i = 0; i < 4; i++)
186 irq2pin[i + 9] = PIRQE + i;
187
188 /* Set IRQ-PIRQ Mapping to ULI1575 */
189 for (i = 0; i < 16; i++)
190 if (irq2pin[i])
191 pirq_map_word |= (uli1575_irq_route_table[i] & 0xf)
192 << ((irq2pin[i] - PIRQA) * 4);
193
194 pirq_map_word |= 1<<26; /* disable INTx in EP mode*/
195
196 /* ULI1575 IRQ mapping conf register default value is 0xb9317542 */
197 DBG("Setup ULI1575 IRQ mapping configuration register value = 0x%x\n",
198 (int)pirq_map_word);
199 pci_write_config_dword(dev, 0x48, pirq_map_word);
200
201#define ULI1575_SET_DEV_IRQ(slot, pin, reg) \
202 do { \
203 int irq; \
204 irq = get_pci_irq_from_of(hose, slot, pin); \
205 if (irq > 0 && irq < 16) \
206 pci_write_config_byte(dev, reg, irq2pin[irq]); \
207 else \
208 printk(KERN_WARNING "ULI1575 device" \
209 "(slot %d, pin %d) irq %d is invalid.\n", \
210 slot, pin, irq); \
211 } while(0)
212
213 /* USB 1.1 OHCI controller 1, slot 28, pin 1 */
214 ULI1575_SET_DEV_IRQ(28, 1, 0x86);
215
216 /* USB 1.1 OHCI controller 2, slot 28, pin 2 */
217 ULI1575_SET_DEV_IRQ(28, 2, 0x87);
218
219 /* USB 1.1 OHCI controller 3, slot 28, pin 3 */
220 ULI1575_SET_DEV_IRQ(28, 3, 0x88);
221
222 /* USB 2.0 controller, slot 28, pin 4 */
223 irq = get_pci_irq_from_of(hose, 28, 4);
224 if (irq >= 0 && irq <= 15)
225 pci_write_config_dword(dev, 0x74, uli1575_irq_route_table[irq]);
226
227 /* Audio controller, slot 29, pin 1 */
228 ULI1575_SET_DEV_IRQ(29, 1, 0x8a);
229
230 /* Modem controller, slot 29, pin 2 */
231 ULI1575_SET_DEV_IRQ(29, 2, 0x8b);
232
233 /* HD audio controller, slot 29, pin 3 */
234 ULI1575_SET_DEV_IRQ(29, 3, 0x8c);
235
236 /* SMB interrupt: slot 30, pin 1 */
237 ULI1575_SET_DEV_IRQ(30, 1, 0x8e);
238
239 /* PMU ACPI SCI interrupt: slot 30, pin 2 */
240 ULI1575_SET_DEV_IRQ(30, 2, 0x8f);
241
242 /* Serial ATA interrupt: slot 31, pin 1 */
243 ULI1575_SET_DEV_IRQ(31, 1, 0x8d);
244
245 /* Primary PATA IDE IRQ: 14
246 * Secondary PATA IDE IRQ: 15
247 */
248 pci_write_config_byte(dev, 0x44, 0x30 | uli1575_irq_route_table[14]);
249 pci_write_config_byte(dev, 0x75, uli1575_irq_route_table[15]);
250
251 /* Set IRQ14 and IRQ15 to legacy IRQs */
252 pci_read_config_word(dev, 0x46, &temp);
253 temp |= 0xc000;
254 pci_write_config_word(dev, 0x46, temp);
255
256 /* Set i8259 interrupt trigger
257 * IRQ 3: Level
258 * IRQ 4: Level
259 * IRQ 5: Level
260 * IRQ 6: Level
261 * IRQ 7: Level
262 * IRQ 9: Level
263 * IRQ 10: Level
264 * IRQ 11: Level
265 * IRQ 12: Level
266 * IRQ 14: Edge
267 * IRQ 15: Edge
268 */
269 outb(0xfa, 0x4d0);
270 outb(0x1e, 0x4d1);
271
272#undef ULI1575_SET_DEV_IRQ
273}
274
275/* SATA */
276static void __devinit quirk_uli5288(struct pci_dev *dev)
277{ 123{
278 unsigned char c; 124 struct device_node* node;
279 125 struct resource rsrc;
280 pci_read_config_byte(dev, 0x83, &c);
281 c |= 0x80; /* read/write lock */
282 pci_write_config_byte(dev, 0x83, c);
283
284 pci_write_config_byte(dev, 0x09, 0x01); /* Base class code: storage */
285 pci_write_config_byte(dev, 0x0a, 0x06); /* IDE disk */
286 126
287 pci_read_config_byte(dev, 0x83, &c); 127 node = (struct device_node *)hose->arch_data;
288 c &= 0x7f; 128 of_address_to_resource(node, 0, &rsrc);
289 pci_write_config_byte(dev, 0x83, c);
290
291 pci_read_config_byte(dev, 0x84, &c);
292 c |= 0x01; /* emulated PATA mode enabled */
293 pci_write_config_byte(dev, 0x84, c);
294}
295 129
296/* PATA */ 130 if ((rsrc.start & 0xfffff) == 0xb000) {
297static void __devinit quirk_uli5229(struct pci_dev *dev) 131 return uli_exclude_device(hose, bus, devfn);
298{ 132 }
299 unsigned short temp;
300 pci_write_config_word(dev, 0x04, 0x0405); /* MEM IO MSI */
301 pci_read_config_word(dev, 0x4a, &temp);
302 temp |= 0x1000; /* Enable Native IRQ 14/15 */
303 pci_write_config_word(dev, 0x4a, temp);
304}
305 133
306/*Bridge*/ 134 return PCIBIOS_SUCCESSFUL;
307static void __devinit early_uli5249(struct pci_dev *dev)
308{
309 unsigned char temp;
310 pci_write_config_word(dev, 0x04, 0x0007); /* mem access */
311 pci_read_config_byte(dev, 0x7c, &temp);
312 pci_write_config_byte(dev, 0x7c, 0x80); /* R/W lock control */
313 pci_write_config_byte(dev, 0x09, 0x01); /* set as pci-pci bridge */
314 pci_write_config_byte(dev, 0x7c, temp); /* restore pci bus debug control */
315 dev->class |= 0x1;
316} 135}
317
318DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
319DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
320DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
321DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
322#endif /* CONFIG_PCI */ 136#endif /* CONFIG_PCI */
323 137
324/* 138/*
@@ -342,6 +156,8 @@ static void __init mpc8544_ds_setup_arch(void)
342 else 156 else
343 fsl_add_bridge(np, 0); 157 fsl_add_bridge(np, 0);
344 } 158 }
159 uses_fsl_uli_m1575 = 1;
160 ppc_md.pci_exclude_device = mpc85xx_exclude_device;
345#endif 161#endif
346 162
347 printk("MPC8544 DS board from Freescale Semiconductor\n"); 163 printk("MPC8544 DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 343b76d0d793..685b2fbbbe00 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -7,6 +7,7 @@ config MPC8641_HPCN
7 bool "Freescale MPC8641 HPCN" 7 bool "Freescale MPC8641 HPCN"
8 select PPC_I8259 8 select PPC_I8259
9 select DEFAULT_UIMAGE 9 select DEFAULT_UIMAGE
10 select FSL_ULI1575
10 help 11 help
11 This option enables support for the MPC8641 HPCN board. 12 This option enables support for the MPC8641 HPCN board.
12 13
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index e9eaa0749ae6..56b27caf7a27 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -107,220 +107,25 @@ mpc86xx_hpcn_init_irq(void)
107} 107}
108 108
109#ifdef CONFIG_PCI 109#ifdef CONFIG_PCI
110extern int uses_fsl_uli_m1575;
111extern int uli_exclude_device(struct pci_controller *hose,
112 u_char bus, u_char devfn);
110 113
111enum pirq{PIRQA = 8, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH}; 114static int mpc86xx_exclude_device(struct pci_controller *hose,
112const unsigned char uli1575_irq_route_table[16] = { 115 u_char bus, u_char devfn)
113 0, /* 0: Reserved */
114 0x8, /* 1: 0b1000 */
115 0, /* 2: Reserved */
116 0x2, /* 3: 0b0010 */
117 0x4, /* 4: 0b0100 */
118 0x5, /* 5: 0b0101 */
119 0x7, /* 6: 0b0111 */
120 0x6, /* 7: 0b0110 */
121 0, /* 8: Reserved */
122 0x1, /* 9: 0b0001 */
123 0x3, /* 10: 0b0011 */
124 0x9, /* 11: 0b1001 */
125 0xb, /* 12: 0b1011 */
126 0, /* 13: Reserved */
127 0xd, /* 14, 0b1101 */
128 0xf, /* 15, 0b1111 */
129};
130
131static int __devinit
132get_pci_irq_from_of(struct pci_controller *hose, int slot, int pin)
133{
134 struct of_irq oirq;
135 u32 laddr[3];
136 struct device_node *hosenode = hose ? hose->arch_data : NULL;
137
138 if (!hosenode) return -EINVAL;
139
140 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(slot, 0) << 8);
141 laddr[1] = laddr[2] = 0;
142 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq);
143 DBG("mpc86xx_hpcn: pci irq addr %x, slot %d, pin %d, irq %d\n",
144 laddr[0], slot, pin, oirq.specifier[0]);
145 return oirq.specifier[0];
146}
147
148static void __devinit quirk_uli1575(struct pci_dev *dev)
149{
150 unsigned short temp;
151 struct pci_controller *hose = pci_bus_to_host(dev->bus);
152 unsigned char irq2pin[16], c;
153 unsigned long pirq_map_word = 0;
154 u32 irq;
155 int i;
156
157 /*
158 * ULI1575 interrupts route setup
159 */
160 memset(irq2pin, 0, 16); /* Initialize default value 0 */
161
162 /*
163 * PIRQA -> PIRQD mapping read from OF-tree
164 *
165 * interrupts for PCI slot0 -- PIRQA / PIRQB / PIRQC / PIRQD
166 * PCI slot1 -- PIRQB / PIRQC / PIRQD / PIRQA
167 */
168 for (i = 0; i < 4; i++){
169 irq = get_pci_irq_from_of(hose, 17, i + 1);
170 if (irq > 0 && irq < 16)
171 irq2pin[irq] = PIRQA + i;
172 else
173 printk(KERN_WARNING "ULI1575 device"
174 "(slot %d, pin %d) irq %d is invalid.\n",
175 17, i, irq);
176 }
177
178 /*
179 * PIRQE -> PIRQF mapping set manually
180 *
181 * IRQ pin IRQ#
182 * PIRQE ---- 9
183 * PIRQF ---- 10
184 * PIRQG ---- 11
185 * PIRQH ---- 12
186 */
187 for (i = 0; i < 4; i++) irq2pin[i + 9] = PIRQE + i;
188
189 /* Set IRQ-PIRQ Mapping to ULI1575 */
190 for (i = 0; i < 16; i++)
191 if (irq2pin[i])
192 pirq_map_word |= (uli1575_irq_route_table[i] & 0xf)
193 << ((irq2pin[i] - PIRQA) * 4);
194
195 /* ULI1575 IRQ mapping conf register default value is 0xb9317542 */
196 DBG("Setup ULI1575 IRQ mapping configuration register value = 0x%x\n",
197 pirq_map_word);
198 pci_write_config_dword(dev, 0x48, pirq_map_word);
199
200#define ULI1575_SET_DEV_IRQ(slot, pin, reg) \
201 do { \
202 int irq; \
203 irq = get_pci_irq_from_of(hose, slot, pin); \
204 if (irq > 0 && irq < 16) \
205 pci_write_config_byte(dev, reg, irq2pin[irq]); \
206 else \
207 printk(KERN_WARNING "ULI1575 device" \
208 "(slot %d, pin %d) irq %d is invalid.\n", \
209 slot, pin, irq); \
210 } while(0)
211
212 /* USB 1.1 OHCI controller 1, slot 28, pin 1 */
213 ULI1575_SET_DEV_IRQ(28, 1, 0x86);
214
215 /* USB 1.1 OHCI controller 2, slot 28, pin 2 */
216 ULI1575_SET_DEV_IRQ(28, 2, 0x87);
217
218 /* USB 1.1 OHCI controller 3, slot 28, pin 3 */
219 ULI1575_SET_DEV_IRQ(28, 3, 0x88);
220
221 /* USB 2.0 controller, slot 28, pin 4 */
222 irq = get_pci_irq_from_of(hose, 28, 4);
223 if (irq >= 0 && irq <=15)
224 pci_write_config_dword(dev, 0x74, uli1575_irq_route_table[irq]);
225
226 /* Audio controller, slot 29, pin 1 */
227 ULI1575_SET_DEV_IRQ(29, 1, 0x8a);
228
229 /* Modem controller, slot 29, pin 2 */
230 ULI1575_SET_DEV_IRQ(29, 2, 0x8b);
231
232 /* HD audio controller, slot 29, pin 3 */
233 ULI1575_SET_DEV_IRQ(29, 3, 0x8c);
234
235 /* SMB interrupt: slot 30, pin 1 */
236 ULI1575_SET_DEV_IRQ(30, 1, 0x8e);
237
238 /* PMU ACPI SCI interrupt: slot 30, pin 2 */
239 ULI1575_SET_DEV_IRQ(30, 2, 0x8f);
240
241 /* Serial ATA interrupt: slot 31, pin 1 */
242 ULI1575_SET_DEV_IRQ(31, 1, 0x8d);
243
244 /* Primary PATA IDE IRQ: 14
245 * Secondary PATA IDE IRQ: 15
246 */
247 pci_write_config_byte(dev, 0x44, 0x30 | uli1575_irq_route_table[14]);
248 pci_write_config_byte(dev, 0x75, uli1575_irq_route_table[15]);
249
250 /* Set IRQ14 and IRQ15 to legacy IRQs */
251 pci_read_config_word(dev, 0x46, &temp);
252 temp |= 0xc000;
253 pci_write_config_word(dev, 0x46, temp);
254
255 /* Set i8259 interrupt trigger
256 * IRQ 3: Level
257 * IRQ 4: Level
258 * IRQ 5: Level
259 * IRQ 6: Level
260 * IRQ 7: Level
261 * IRQ 9: Level
262 * IRQ 10: Level
263 * IRQ 11: Level
264 * IRQ 12: Level
265 * IRQ 14: Edge
266 * IRQ 15: Edge
267 */
268 outb(0xfa, 0x4d0);
269 outb(0x1e, 0x4d1);
270
271#undef ULI1575_SET_DEV_IRQ
272
273 /* Disable the HD interface and enable the AC97 interface. */
274 pci_read_config_byte(dev, 0xb8, &c);
275 c &= 0x7f;
276 pci_write_config_byte(dev, 0xb8, c);
277}
278
279static void __devinit quirk_uli5288(struct pci_dev *dev)
280{ 116{
281 unsigned char c; 117 struct device_node* node;
118 struct resource rsrc;
282 119
283 pci_read_config_byte(dev,0x83,&c); 120 node = (struct device_node *)hose->arch_data;
284 c |= 0x80; 121 of_address_to_resource(node, 0, &rsrc);
285 pci_write_config_byte(dev, 0x83, c);
286 122
287 pci_write_config_byte(dev, 0x09, 0x01); 123 if ((rsrc.start & 0xfffff) == 0x8000) {
288 pci_write_config_byte(dev, 0x0a, 0x06); 124 return uli_exclude_device(hose, bus, devfn);
289 125 }
290 pci_read_config_byte(dev,0x83,&c);
291 c &= 0x7f;
292 pci_write_config_byte(dev, 0x83, c);
293
294 pci_read_config_byte(dev,0x84,&c);
295 c |= 0x01;
296 pci_write_config_byte(dev, 0x84, c);
297}
298
299static void __devinit quirk_uli5229(struct pci_dev *dev)
300{
301 unsigned short temp;
302 pci_write_config_word(dev, 0x04, 0x0405);
303 dev->class &= ~0x5;
304 pci_read_config_word(dev, 0x4a, &temp);
305 temp |= 0x1000;
306 pci_write_config_word(dev, 0x4a, temp);
307}
308 126
309static void __devinit early_uli5249(struct pci_dev *dev) 127 return PCIBIOS_SUCCESSFUL;
310{
311 unsigned char temp;
312 pci_write_config_word(dev, 0x04, 0x0007);
313 pci_read_config_byte(dev, 0x7c, &temp);
314 pci_write_config_byte(dev, 0x7c, 0x80);
315 pci_write_config_byte(dev, 0x09, 0x01);
316 pci_write_config_byte(dev, 0x7c, temp);
317 dev->class |= 0x1;
318} 128}
319
320DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
321DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
322DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
323DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
324#endif /* CONFIG_PCI */ 129#endif /* CONFIG_PCI */
325 130
326 131
@@ -353,6 +158,9 @@ mpc86xx_hpcn_setup_arch(void)
353 else 158 else
354 fsl_add_bridge(np, 0); 159 fsl_add_bridge(np, 0);
355 } 160 }
161 uses_fsl_uli_m1575 = 1;
162 ppc_md.pci_exclude_device = mpc86xx_exclude_device;
163
356#endif 164#endif
357 165
358 printk("MPC86xx HPCN board from Freescale Semiconductor\n"); 166 printk("MPC86xx HPCN board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 932538a93c2b..cfc249741592 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -282,4 +282,12 @@ config AXON_RAM
282 minor numbers are available in /proc/devices, /proc/partitions or 282 minor numbers are available in /proc/devices, /proc/partitions or
283 in /sys/block/axonram?/dev. 283 in /sys/block/axonram?/dev.
284 284
285config FSL_ULI1575
286 bool
287 default n
288 help
289 Supports for the ULI1575 PCIe south bridge that exists on some
290 Freescale reference boards. The boards all use the ULI in pretty
291 much the same way.
292
285endmenu 293endmenu
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index d6e041a46d25..d44e832b01f2 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -1,3 +1,6 @@
1
2obj-$(CONFIG_FSL_ULI1575) += fsl_uli1575.o
3
1ifeq ($(CONFIG_PPC_MERGE),y) 4ifeq ($(CONFIG_PPC_MERGE),y)
2obj-$(CONFIG_PPC_PMAC) += powermac/ 5obj-$(CONFIG_PPC_PMAC) += powermac/
3else 6else
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
index dd2c6688c8aa..027ac32cc636 100644
--- a/arch/powerpc/platforms/cell/spu_syscalls.c
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -45,6 +45,7 @@ asmlinkage long sys_spu_create(const char __user *name,
45 if (owner && try_module_get(owner)) { 45 if (owner && try_module_get(owner)) {
46 if (flags & SPU_CREATE_AFFINITY_SPU) { 46 if (flags & SPU_CREATE_AFFINITY_SPU) {
47 neighbor = fget_light(neighbor_fd, &fput_needed); 47 neighbor = fget_light(neighbor_fd, &fput_needed);
48 ret = -EBADF;
48 if (neighbor) { 49 if (neighbor) {
49 ret = spufs_calls.create_thread(name, flags, 50 ret = spufs_calls.create_thread(name, flags,
50 mode, neighbor); 51 mode, neighbor);
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
new file mode 100644
index 000000000000..afc9141be63e
--- /dev/null
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -0,0 +1,255 @@
1/*
2 * ULI M1575 setup code - specific to Freescale boards
3 *
4 * Copyright 2007 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/stddef.h>
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/interrupt.h>
16#include <linux/mc146818rtc.h>
17
18#include <asm/system.h>
19#include <asm/pci-bridge.h>
20
21#define ULI_PIRQA 0x08
22#define ULI_PIRQB 0x09
23#define ULI_PIRQC 0x0a
24#define ULI_PIRQD 0x0b
25#define ULI_PIRQE 0x0c
26#define ULI_PIRQF 0x0d
27#define ULI_PIRQG 0x0e
28
29#define ULI_8259_NONE 0x00
30#define ULI_8259_IRQ1 0x08
31#define ULI_8259_IRQ3 0x02
32#define ULI_8259_IRQ4 0x04
33#define ULI_8259_IRQ5 0x05
34#define ULI_8259_IRQ6 0x07
35#define ULI_8259_IRQ7 0x06
36#define ULI_8259_IRQ9 0x01
37#define ULI_8259_IRQ10 0x03
38#define ULI_8259_IRQ11 0x09
39#define ULI_8259_IRQ12 0x0b
40#define ULI_8259_IRQ14 0x0d
41#define ULI_8259_IRQ15 0x0f
42
43u8 uli_pirq_to_irq[8] = {
44 ULI_8259_IRQ9, /* PIRQA */
45 ULI_8259_IRQ10, /* PIRQB */
46 ULI_8259_IRQ11, /* PIRQC */
47 ULI_8259_IRQ12, /* PIRQD */
48 ULI_8259_IRQ5, /* PIRQE */
49 ULI_8259_IRQ6, /* PIRQF */
50 ULI_8259_IRQ7, /* PIRQG */
51 ULI_8259_NONE, /* PIRQH */
52};
53
54/* set in board code if you want this quirks to do something */
55int uses_fsl_uli_m1575;
56
57/* Bridge */
58static void __devinit early_uli5249(struct pci_dev *dev)
59{
60 unsigned char temp;
61
62 if (!uses_fsl_uli_m1575)
63 return;
64
65 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_IO |
66 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
67
68 /* read/write lock */
69 pci_read_config_byte(dev, 0x7c, &temp);
70 pci_write_config_byte(dev, 0x7c, 0x80);
71
72 /* set as P2P bridge */
73 pci_write_config_byte(dev, PCI_CLASS_PROG, 0x01);
74 dev->class |= 0x1;
75
76 /* restore lock */
77 pci_write_config_byte(dev, 0x7c, temp);
78}
79
80
81static void __devinit quirk_uli1575(struct pci_dev *dev)
82{
83 int i;
84
85 if (!uses_fsl_uli_m1575)
86 return;
87
88 /*
89 * ULI1575 interrupts route setup
90 */
91
92 /* ULI1575 IRQ mapping conf register maps PIRQx to IRQn */
93 for (i = 0; i < 4; i++) {
94 u8 val = uli_pirq_to_irq[i*2] | (uli_pirq_to_irq[i*2+1] << 4);
95 pci_write_config_byte(dev, 0x48 + i, val);
96 }
97
98 /* USB 1.1 OHCI controller 1: dev 28, func 0 - IRQ12 */
99 pci_write_config_byte(dev, 0x86, ULI_PIRQD);
100
101 /* USB 1.1 OHCI controller 2: dev 28, func 1 - IRQ9 */
102 pci_write_config_byte(dev, 0x87, ULI_PIRQA);
103
104 /* USB 1.1 OHCI controller 3: dev 28, func 2 - IRQ10 */
105 pci_write_config_byte(dev, 0x88, ULI_PIRQB);
106
107 /* Lan controller: dev 27, func 0 - IRQ6 */
108 pci_write_config_byte(dev, 0x89, ULI_PIRQF);
109
110 /* AC97 Audio controller: dev 29, func 0 - IRQ6 */
111 pci_write_config_byte(dev, 0x8a, ULI_PIRQF);
112
113 /* Modem controller: dev 29, func 1 - IRQ6 */
114 pci_write_config_byte(dev, 0x8b, ULI_PIRQF);
115
116 /* HD Audio controller: dev 29, func 2 - IRQ6 */
117 pci_write_config_byte(dev, 0x8c, ULI_PIRQF);
118
119 /* SATA controller: dev 31, func 1 - IRQ5 */
120 pci_write_config_byte(dev, 0x8d, ULI_PIRQE);
121
122 /* SMB interrupt: dev 30, func 1 - IRQ7 */
123 pci_write_config_byte(dev, 0x8e, ULI_PIRQG);
124
125 /* PMU ACPI SCI interrupt: dev 30, func 2 - IRQ7 */
126 pci_write_config_byte(dev, 0x8f, ULI_PIRQG);
127
128 /* USB 2.0 controller: dev 28, func 3 */
129 pci_write_config_byte(dev, 0x74, ULI_8259_IRQ11);
130
131 /* Primary PATA IDE IRQ: 14
132 * Secondary PATA IDE IRQ: 15
133 */
134 pci_write_config_byte(dev, 0x44, 0x30 | ULI_8259_IRQ14);
135 pci_write_config_byte(dev, 0x75, ULI_8259_IRQ15);
136}
137
138static void __devinit quirk_final_uli1575(struct pci_dev *dev)
139{
140 /* Set i8259 interrupt trigger
141 * IRQ 3: Level
142 * IRQ 4: Level
143 * IRQ 5: Level
144 * IRQ 6: Level
145 * IRQ 7: Level
146 * IRQ 9: Level
147 * IRQ 10: Level
148 * IRQ 11: Level
149 * IRQ 12: Level
150 * IRQ 14: Edge
151 * IRQ 15: Edge
152 */
153 if (!uses_fsl_uli_m1575)
154 return;
155
156 outb(0xfa, 0x4d0);
157 outb(0x1e, 0x4d1);
158
159 /* setup RTC */
160 CMOS_WRITE(RTC_SET, RTC_CONTROL);
161 CMOS_WRITE(RTC_24H, RTC_CONTROL);
162
163 /* ensure month, date, and week alarm fields are ignored */
164 CMOS_WRITE(0, RTC_VALID);
165
166 outb_p(0x7c, 0x72);
167 outb_p(RTC_ALARM_DONT_CARE, 0x73);
168
169 outb_p(0x7d, 0x72);
170 outb_p(RTC_ALARM_DONT_CARE, 0x73);
171}
172
173/* SATA */
174static void __devinit quirk_uli5288(struct pci_dev *dev)
175{
176 unsigned char c;
177 unsigned int d;
178
179 if (!uses_fsl_uli_m1575)
180 return;
181
182 /* read/write lock */
183 pci_read_config_byte(dev, 0x83, &c);
184 pci_write_config_byte(dev, 0x83, c|0x80);
185
186 pci_read_config_dword(dev, PCI_CLASS_REVISION, &d);
187 d = (d & 0xff) | (PCI_CLASS_STORAGE_SATA_AHCI << 8);
188 pci_write_config_dword(dev, PCI_CLASS_REVISION, d);
189
190 /* restore lock */
191 pci_write_config_byte(dev, 0x83, c);
192
193 /* disable emulated PATA mode enabled */
194 pci_read_config_byte(dev, 0x84, &c);
195 pci_write_config_byte(dev, 0x84, c & ~0x01);
196}
197
198/* PATA */
199static void __devinit quirk_uli5229(struct pci_dev *dev)
200{
201 unsigned short temp;
202
203 if (!uses_fsl_uli_m1575)
204 return;
205
206 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE |
207 PCI_COMMAND_MASTER | PCI_COMMAND_IO);
208
209 /* Enable Native IRQ 14/15 */
210 pci_read_config_word(dev, 0x4a, &temp);
211 pci_write_config_word(dev, 0x4a, temp | 0x1000);
212}
213
214/* We have to do a dummy read on the P2P for the RTC to work, WTF */
215static void __devinit quirk_final_uli5249(struct pci_dev *dev)
216{
217 int i;
218 u8 *dummy;
219 struct pci_bus *bus = dev->bus;
220
221 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
222 if ((bus->resource[i]) &&
223 (bus->resource[i]->flags & IORESOURCE_MEM)) {
224 dummy = ioremap(bus->resource[i]->start, 0x4);
225 if (dummy) {
226 in_8(dummy);
227 iounmap(dummy);
228 }
229 break;
230 }
231 }
232}
233
234DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
235DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
236DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
237DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
238DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
239DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
240
241int uli_exclude_device(struct pci_controller *hose,
242 u_char bus, u_char devfn)
243{
244 if (bus == (hose->first_busno + 2)) {
245 /* exclude Modem controller */
246 if ((PCI_SLOT(devfn) == 29) && (PCI_FUNC(devfn) == 1))
247 return PCIBIOS_DEVICE_NOT_FOUND;
248
249 /* exclude HD Audio controller */
250 if ((PCI_SLOT(devfn) == 29) && (PCI_FUNC(devfn) == 2))
251 return PCIBIOS_DEVICE_NOT_FOUND;
252 }
253
254 return PCIBIOS_SUCCESSFUL;
255}
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index e23a5a874ad3..ce15cada88d4 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -372,7 +372,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
372 notify_event->dev_type == repo->dev_type) { 372 notify_event->dev_type == repo->dev_type) {
373 pr_debug("%s:%u: device ready: dev_id %u\n", __func__, 373 pr_debug("%s:%u: device ready: dev_id %u\n", __func__,
374 __LINE__, repo->dev_id); 374 __LINE__, repo->dev_id);
375 result = 0; 375 error = 0;
376 break; 376 break;
377 } 377 }
378 378
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 9fb0ce5c7176..114c90f8f560 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -251,6 +251,8 @@ DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568E, quirk_fsl_pcie_transpare
251DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568, quirk_fsl_pcie_transparent); 251DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8568, quirk_fsl_pcie_transparent);
252DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567E, quirk_fsl_pcie_transparent); 252DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567E, quirk_fsl_pcie_transparent);
253DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567, quirk_fsl_pcie_transparent); 253DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8567, quirk_fsl_pcie_transparent);
254DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8533E, quirk_fsl_pcie_transparent);
255DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8533, quirk_fsl_pcie_transparent);
254DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544E, quirk_fsl_pcie_transparent); 256DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544E, quirk_fsl_pcie_transparent);
255DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544, quirk_fsl_pcie_transparent); 257DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8544, quirk_fsl_pcie_transparent);
256DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_transparent); 258DECLARE_PCI_FIXUP_EARLY(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_transparent);
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 727453d3e8b9..1cf29c9d4408 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/of_platform.h>
25#include <linux/phy.h> 26#include <linux/phy.h>
26#include <linux/fsl_devices.h> 27#include <linux/fsl_devices.h>
27#include <linux/fs_enet_pd.h> 28#include <linux/fs_enet_pd.h>
diff --git a/arch/powerpc/sysdev/rtc_cmos_setup.c b/arch/powerpc/sysdev/rtc_cmos_setup.c
index e276048b8c5f..0c9ac7ee08fb 100644
--- a/arch/powerpc/sysdev/rtc_cmos_setup.c
+++ b/arch/powerpc/sysdev/rtc_cmos_setup.c
@@ -20,14 +20,16 @@ static int __init add_rtc(void)
20{ 20{
21 struct device_node *np; 21 struct device_node *np;
22 struct platform_device *pd; 22 struct platform_device *pd;
23 struct resource res; 23 struct resource res[2];
24 int ret; 24 int ret;
25 25
26 memset(&res, 0, sizeof(res));
27
26 np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00"); 28 np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
27 if (!np) 29 if (!np)
28 return -ENODEV; 30 return -ENODEV;
29 31
30 ret = of_address_to_resource(np, 0, &res); 32 ret = of_address_to_resource(np, 0, &res[0]);
31 of_node_put(np); 33 of_node_put(np);
32 if (ret) 34 if (ret)
33 return ret; 35 return ret;
@@ -36,11 +38,18 @@ static int __init add_rtc(void)
36 * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the 38 * RTC_PORT(x) is hardcoded in asm/mc146818rtc.h. Verify that the
37 * address provided by the device node matches. 39 * address provided by the device node matches.
38 */ 40 */
39 if (res.start != RTC_PORT(0)) 41 if (res[0].start != RTC_PORT(0))
40 return -EINVAL; 42 return -EINVAL;
41 43
44 /* Use a fixed interrupt value of 8 since on PPC if we are using this
45 * its off an i8259 which we ensure has interrupt numbers 0..15. */
46 res[1].start = 8;
47 res[1].end = 8;
48 res[1].flags = IORESOURCE_IRQ;
49
42 pd = platform_device_register_simple("rtc_cmos", -1, 50 pd = platform_device_register_simple("rtc_cmos", -1,
43 &res, 1); 51 &res[0], 2);
52
44 if (IS_ERR(pd)) 53 if (IS_ERR(pd))
45 return PTR_ERR(pd); 54 return PTR_ERR(pd);
46 55
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 0da55368655c..a22e1f4d94c8 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -237,9 +237,19 @@ _GLOBAL(_tlbie)
237 mfspr r4,SPRN_MMUCR 237 mfspr r4,SPRN_MMUCR
238 mfspr r5,SPRN_PID /* Get PID */ 238 mfspr r5,SPRN_PID /* Get PID */
239 rlwimi r4,r5,0,24,31 /* Set TID */ 239 rlwimi r4,r5,0,24,31 /* Set TID */
240 mtspr SPRN_MMUCR,r4
241 240
241 /* We have to run the search with interrupts disabled, even critical
242 * and debug interrupts (in fact the only critical exceptions we have
243 * are debug and machine check). Otherwise an interrupt which causes
244 * a TLB miss can clobber the MMUCR between the mtspr and the tlbsx. */
245 mfmsr r5
246 lis r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@ha
247 addi r6,r6,(MSR_EE|MSR_CE|MSR_ME|MSR_DE)@l
248 andc r6,r5,r6
249 mtmsr r6
250 mtspr SPRN_MMUCR,r4
242 tlbsx. r3, 0, r3 251 tlbsx. r3, 0, r3
252 mtmsr r5
243 bne 10f 253 bne 10f
244 sync 254 sync
245 /* There are only 64 TLB entries, so r3 < 64, 255 /* There are only 64 TLB entries, so r3 < 64,
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index ad4ca75c0f04..5245717295b8 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -60,17 +60,28 @@ static void hypfs_add_dentry(struct dentry *dentry)
60 hypfs_last_dentry = dentry; 60 hypfs_last_dentry = dentry;
61} 61}
62 62
63static inline int hypfs_positive(struct dentry *dentry)
64{
65 return dentry->d_inode && !d_unhashed(dentry);
66}
67
63static void hypfs_remove(struct dentry *dentry) 68static void hypfs_remove(struct dentry *dentry)
64{ 69{
65 struct dentry *parent; 70 struct dentry *parent;
66 71
67 parent = dentry->d_parent; 72 parent = dentry->d_parent;
68 if (S_ISDIR(dentry->d_inode->i_mode)) 73 if (!parent || !parent->d_inode)
69 simple_rmdir(parent->d_inode, dentry); 74 return;
70 else 75 mutex_lock(&parent->d_inode->i_mutex);
71 simple_unlink(parent->d_inode, dentry); 76 if (hypfs_positive(dentry)) {
77 if (S_ISDIR(dentry->d_inode->i_mode))
78 simple_rmdir(parent->d_inode, dentry);
79 else
80 simple_unlink(parent->d_inode, dentry);
81 }
72 d_delete(dentry); 82 d_delete(dentry);
73 dput(dentry); 83 dput(dentry);
84 mutex_unlock(&parent->d_inode->i_mutex);
74} 85}
75 86
76static void hypfs_delete_tree(struct dentry *root) 87static void hypfs_delete_tree(struct dentry *root)
@@ -315,6 +326,7 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
315 } 326 }
316 hypfs_update_update(sb); 327 hypfs_update_update(sb);
317 sb->s_root = root_dentry; 328 sb->s_root = root_dentry;
329 printk(KERN_INFO "hypfs: Hypervisor filesystem mounted\n");
318 return 0; 330 return 0;
319 331
320err_tree: 332err_tree:
@@ -356,13 +368,17 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
356 qname.name = name; 368 qname.name = name;
357 qname.len = strlen(name); 369 qname.len = strlen(name);
358 qname.hash = full_name_hash(name, qname.len); 370 qname.hash = full_name_hash(name, qname.len);
371 mutex_lock(&parent->d_inode->i_mutex);
359 dentry = lookup_one_len(name, parent, strlen(name)); 372 dentry = lookup_one_len(name, parent, strlen(name));
360 if (IS_ERR(dentry)) 373 if (IS_ERR(dentry)) {
361 return ERR_PTR(-ENOMEM); 374 dentry = ERR_PTR(-ENOMEM);
375 goto fail;
376 }
362 inode = hypfs_make_inode(sb, mode); 377 inode = hypfs_make_inode(sb, mode);
363 if (!inode) { 378 if (!inode) {
364 dput(dentry); 379 dput(dentry);
365 return ERR_PTR(-ENOMEM); 380 dentry = ERR_PTR(-ENOMEM);
381 goto fail;
366 } 382 }
367 if (mode & S_IFREG) { 383 if (mode & S_IFREG) {
368 inode->i_fop = &hypfs_file_ops; 384 inode->i_fop = &hypfs_file_ops;
@@ -379,6 +395,8 @@ static struct dentry *hypfs_create_file(struct super_block *sb,
379 inode->i_private = data; 395 inode->i_private = data;
380 d_instantiate(dentry, inode); 396 d_instantiate(dentry, inode);
381 dget(dentry); 397 dget(dentry);
398fail:
399 mutex_unlock(&parent->d_inode->i_mutex);
382 return dentry; 400 return dentry;
383} 401}
384 402
@@ -391,7 +409,6 @@ struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent,
391 if (IS_ERR(dentry)) 409 if (IS_ERR(dentry))
392 return dentry; 410 return dentry;
393 hypfs_add_dentry(dentry); 411 hypfs_add_dentry(dentry);
394 parent->d_inode->i_nlink++;
395 return dentry; 412 return dentry;
396} 413}
397 414
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 3195d375bd51..56cb71007cd9 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -6,7 +6,7 @@ EXTRA_AFLAGS := -traditional
6 6
7obj-y := bitmap.o traps.o time.o process.o base.o early.o \ 7obj-y := bitmap.o traps.o time.o process.o base.o early.o \
8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
9 semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o 9 semaphore.o s390_ext.o debug.o irq.o ipl.o dis.o diag.o
10 10
11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) 11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) 12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
diff --git a/arch/s390/kernel/diag.c b/arch/s390/kernel/diag.c
new file mode 100644
index 000000000000..c032d11da8a1
--- /dev/null
+++ b/arch/s390/kernel/diag.c
@@ -0,0 +1,102 @@
1/*
2 * Implementation of s390 diagnose codes
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#include <linux/module.h>
9#include <asm/diag.h>
10
11/*
12 * Diagnose 10: Release pages
13 */
14void diag10(unsigned long addr)
15{
16 if (addr >= 0x7ff00000)
17 return;
18 asm volatile(
19#ifdef CONFIG_64BIT
20 " sam31\n"
21 " diag %0,%0,0x10\n"
22 "0: sam64\n"
23#else
24 " diag %0,%0,0x10\n"
25 "0:\n"
26#endif
27 EX_TABLE(0b, 0b)
28 : : "a" (addr));
29}
30EXPORT_SYMBOL(diag10);
31
32/*
33 * Diagnose 14: Input spool file manipulation
34 */
35int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode)
36{
37 register unsigned long _ry1 asm("2") = ry1;
38 register unsigned long _ry2 asm("3") = subcode;
39 int rc = 0;
40
41 asm volatile(
42#ifdef CONFIG_64BIT
43 " sam31\n"
44 " diag %2,2,0x14\n"
45 " sam64\n"
46#else
47 " diag %2,2,0x14\n"
48#endif
49 " ipm %0\n"
50 " srl %0,28\n"
51 : "=d" (rc), "+d" (_ry2)
52 : "d" (rx), "d" (_ry1)
53 : "cc");
54
55 return rc;
56}
57EXPORT_SYMBOL(diag14);
58
59/*
60 * Diagnose 210: Get information about a virtual device
61 */
62int diag210(struct diag210 *addr)
63{
64 /*
65 * diag 210 needs its data below the 2GB border, so we
66 * use a static data area to be sure
67 */
68 static struct diag210 diag210_tmp;
69 static DEFINE_SPINLOCK(diag210_lock);
70 unsigned long flags;
71 int ccode;
72
73 spin_lock_irqsave(&diag210_lock, flags);
74 diag210_tmp = *addr;
75
76#ifdef CONFIG_64BIT
77 asm volatile(
78 " lhi %0,-1\n"
79 " sam31\n"
80 " diag %1,0,0x210\n"
81 "0: ipm %0\n"
82 " srl %0,28\n"
83 "1: sam64\n"
84 EX_TABLE(0b, 1b)
85 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
86#else
87 asm volatile(
88 " lhi %0,-1\n"
89 " diag %1,0,0x210\n"
90 "0: ipm %0\n"
91 " srl %0,28\n"
92 "1:\n"
93 EX_TABLE(0b, 1b)
94 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
95#endif
96
97 *addr = diag210_tmp;
98 spin_unlock_irqrestore(&diag210_lock, flags);
99
100 return ccode;
101}
102EXPORT_SYMBOL(diag210);
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
index d3057318f2bf..50d2235df732 100644
--- a/arch/s390/kernel/dis.c
+++ b/arch/s390/kernel/dis.c
@@ -577,7 +577,7 @@ static struct insn opcode_b2[] = {
577 { "esta", 0x4a, INSTR_RRE_RR }, 577 { "esta", 0x4a, INSTR_RRE_RR },
578 { "lura", 0x4b, INSTR_RRE_RR }, 578 { "lura", 0x4b, INSTR_RRE_RR },
579 { "tar", 0x4c, INSTR_RRE_AR }, 579 { "tar", 0x4c, INSTR_RRE_AR },
580 { "cpya", INSTR_RRE_AA }, 580 { "cpya", 0x4d, INSTR_RRE_AA },
581 { "sar", 0x4e, INSTR_RRE_AR }, 581 { "sar", 0x4e, INSTR_RRE_AR },
582 { "ear", 0x4f, INSTR_RRE_RA }, 582 { "ear", 0x4f, INSTR_RRE_RA },
583 { "csp", 0x50, INSTR_RRE_RR }, 583 { "csp", 0x50, INSTR_RRE_RR },
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 358d2bbbc481..e40373d9fbce 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -85,7 +85,7 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn)
85 ainsn->reg = (*ainsn->insn & 0xf0) >> 4; 85 ainsn->reg = (*ainsn->insn & 0xf0) >> 4;
86 86
87 /* save the instruction length (pop 5-5) in bytes */ 87 /* save the instruction length (pop 5-5) in bytes */
88 switch (*(__u8 *) (ainsn->insn) >> 4) { 88 switch (*(__u8 *) (ainsn->insn) >> 6) {
89 case 0: 89 case 0:
90 ainsn->ilen = 2; 90 ainsn->ilen = 2;
91 break; 91 break;
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index 90b5ef529eb7..7234c737f825 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -25,7 +25,6 @@ EXPORT_SYMBOL(_oi_bitmap);
25EXPORT_SYMBOL(_ni_bitmap); 25EXPORT_SYMBOL(_ni_bitmap);
26EXPORT_SYMBOL(_zb_findmap); 26EXPORT_SYMBOL(_zb_findmap);
27EXPORT_SYMBOL(_sb_findmap); 27EXPORT_SYMBOL(_sb_findmap);
28EXPORT_SYMBOL(diag10);
29 28
30/* 29/*
31 * semaphore ops 30 * semaphore ops
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index c5b2f4f078bc..fabc50adc46a 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -20,6 +20,7 @@
20 20
21#include <asm/pgalloc.h> 21#include <asm/pgalloc.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/diag.h>
23 24
24static char *sender = "VMRMSVM"; 25static char *sender = "VMRMSVM";
25module_param(sender, charp, 0400); 26module_param(sender, charp, 0400);
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 9098531a2671..3a25bbf2eb0a 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -42,23 +42,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); 42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); 43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
44 44
45void diag10(unsigned long addr)
46{
47 if (addr >= 0x7ff00000)
48 return;
49 asm volatile(
50#ifdef CONFIG_64BIT
51 " sam31\n"
52 " diag %0,%0,0x10\n"
53 "0: sam64\n"
54#else
55 " diag %0,%0,0x10\n"
56 "0:\n"
57#endif
58 EX_TABLE(0b,0b)
59 : : "a" (addr));
60}
61
62void show_mem(void) 45void show_mem(void)
63{ 46{
64 int i, total = 0, reserved = 0; 47 int i, total = 0, reserved = 0;
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 3d211aa33cd8..97ac58682d0f 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -34,6 +34,8 @@ isa-y := $(isa-y)-nofpu
34endif 34endif
35endif 35endif
36 36
37isa-y := $(isa-y)-up
38
37cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,) 39cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,)
38cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \ 40cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
39 $(call cc-option,-m2a-nofpu,) 41 $(call cc-option,-m2a-nofpu,)
@@ -46,7 +48,20 @@ cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
46cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb 48cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
47cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml 49cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
48 50
49cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),) -ffreestanding 51#
52# -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
53# support it, while -Wa,-dsp by itself limits the range of usable opcodes
54# on certain CPU subtypes. Try the ISA variant first, and if that fails,
55# fall back on -Wa,-dsp for the old binutils versions. Even without DSP
56# opcodes, we always want the best ISA tuning the version of binutils
57# will provide.
58#
59isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
60
61isaflags-$(CONFIG_SH_DSP) := \
62 $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
63
64cflags-y += $(isaflags-y) -ffreestanding
50 65
51cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \ 66cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
52 $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g') 67 $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
index 6e4e96541358..dab193293f20 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
@@ -41,3 +41,8 @@ static int __init sh4202_devices_setup(void)
41 ARRAY_SIZE(sh4202_devices)); 41 ARRAY_SIZE(sh4202_devices));
42} 42}
43__initcall(sh4202_devices_setup); 43__initcall(sh4202_devices_setup);
44
45void __init plat_irq_setup(void)
46{
47 /* do nothing - all IRL interrupts are handled by the board code */
48}
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index 9833493d8867..80b637c30203 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -76,7 +76,7 @@ static void scif_sercon_putc(int c)
76 sci_in(&scif_port, SCxSR); 76 sci_in(&scif_port, SCxSR);
77 sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40)); 77 sci_out(&scif_port, SCxSR, 0xf3 & ~(0x20 | 0x40));
78 78
79 while ((sci_in(&scif_port, SCxSR) & 0x40) == 0); 79 while ((sci_in(&scif_port, SCxSR) & 0x40) == 0)
80 ; 80 ;
81 81
82 if (c == '\n') 82 if (c == '\n')
diff --git a/arch/sh/kernel/machvec.c b/arch/sh/kernel/machvec.c
index 23c5948f0124..129b2cfd18a8 100644
--- a/arch/sh/kernel/machvec.c
+++ b/arch/sh/kernel/machvec.c
@@ -91,6 +91,13 @@ void __init sh_mv_setup(void)
91 (unsigned long)&__machvec_start); 91 (unsigned long)&__machvec_start);
92 92
93 /* 93 /*
94 * Sanity check for machvec section alignment. Ensure
95 * __initmv hasn't been misused.
96 */
97 if (machvec_size % sizeof(struct sh_machine_vector))
98 panic("machvec misaligned, invalid __initmv use?");
99
100 /*
94 * If the machvec hasn't been preselected, use the first 101 * If the machvec hasn't been preselected, use the first
95 * vector (usually the only one) from .machvec.init. 102 * vector (usually the only one) from .machvec.init.
96 */ 103 */
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index 891d1d46c902..f64a2d2416d4 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -93,6 +93,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
93 case PTRACE_PEEKTEXT: /* read word at location addr. */ 93 case PTRACE_PEEKTEXT: /* read word at location addr. */
94 case PTRACE_PEEKDATA: 94 case PTRACE_PEEKDATA:
95 ret = generic_ptrace_peekdata(child, addr, data); 95 ret = generic_ptrace_peekdata(child, addr, data);
96 break;
96 97
97 /* read the word at location addr in the USER area. */ 98 /* read the word at location addr in the USER area. */
98 case PTRACE_PEEKUSR: { 99 case PTRACE_PEEKUSR: {
diff --git a/arch/sh64/kernel/setup.c b/arch/sh64/kernel/setup.c
index 53e9d20a874a..2b7264c0c6f7 100644
--- a/arch/sh64/kernel/setup.c
+++ b/arch/sh64/kernel/setup.c
@@ -59,10 +59,6 @@
59#include <asm/setup.h> 59#include <asm/setup.h>
60#include <asm/smp.h> 60#include <asm/smp.h>
61 61
62#ifdef CONFIG_VT
63#include <linux/console.h>
64#endif
65
66struct screen_info screen_info; 62struct screen_info screen_info;
67 63
68#ifdef CONFIG_BLK_DEV_RAM 64#ifdef CONFIG_BLK_DEV_RAM
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index 0bb4a8f94276..79fc48cf54c6 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -25,7 +25,6 @@
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/unistd.h> 26#include <linux/unistd.h>
27#include <linux/stddef.h> 27#include <linux/stddef.h>
28#include <linux/personality.h>
29#include <asm/ucontext.h> 28#include <asm/ucontext.h>
30#include <asm/uaccess.h> 29#include <asm/uaccess.h>
31#include <asm/pgtable.h> 30#include <asm/pgtable.h>
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index ac352eb6dff3..e2d02fd13f35 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -238,6 +238,7 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
238 sd = &dev->ofdev.dev.archdata; 238 sd = &dev->ofdev.dev.archdata;
239 sd->prom_node = dp; 239 sd->prom_node = dp;
240 sd->op = &dev->ofdev; 240 sd->op = &dev->ofdev;
241 sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu;
241 242
242 dev->ofdev.node = dp; 243 dev->ofdev.node = dp;
243 dev->ofdev.dev.parent = &dev->bus->ofdev.dev; 244 dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 4ccda77d08d6..7c89893b1fe8 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -66,7 +66,7 @@ iounit_init(int sbi_node, int io_node, struct sbus_bus *sbus)
66 } 66 }
67 if(!xpt) panic("Cannot map External Page Table."); 67 if(!xpt) panic("Cannot map External Page Table.");
68 68
69 sbus->iommu = (struct iommu_struct *)iounit; 69 sbus->ofdev.dev.archdata.iommu = iounit;
70 iounit->page_table = xpt; 70 iounit->page_table = xpt;
71 spin_lock_init(&iounit->lock); 71 spin_lock_init(&iounit->lock);
72 72
@@ -127,7 +127,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus) 127static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus *sbus)
128{ 128{
129 unsigned long ret, flags; 129 unsigned long ret, flags;
130 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 130 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
131 131
132 spin_lock_irqsave(&iounit->lock, flags); 132 spin_lock_irqsave(&iounit->lock, flags);
133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len); 133 ret = iounit_get_area(iounit, (unsigned long)vaddr, len);
@@ -138,7 +138,7 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus
138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus) 138static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus *sbus)
139{ 139{
140 unsigned long flags; 140 unsigned long flags;
141 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 141 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
142 142
143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */ 143 /* FIXME: Cache some resolved pages - often several sg entries are to the same page */
144 spin_lock_irqsave(&iounit->lock, flags); 144 spin_lock_irqsave(&iounit->lock, flags);
@@ -153,7 +153,7 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus) 153static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_bus *sbus)
154{ 154{
155 unsigned long flags; 155 unsigned long flags;
156 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 156 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
157 157
158 spin_lock_irqsave(&iounit->lock, flags); 158 spin_lock_irqsave(&iounit->lock, flags);
159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT; 159 len = ((vaddr & ~PAGE_MASK) + len + (PAGE_SIZE-1)) >> PAGE_SHIFT;
@@ -168,7 +168,7 @@ static void iounit_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_
168{ 168{
169 unsigned long flags; 169 unsigned long flags;
170 unsigned long vaddr, len; 170 unsigned long vaddr, len;
171 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 171 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
172 172
173 spin_lock_irqsave(&iounit->lock, flags); 173 spin_lock_irqsave(&iounit->lock, flags);
174 while (sz != 0) { 174 while (sz != 0) {
@@ -211,7 +211,7 @@ static int iounit_map_dma_area(dma_addr_t *pba, unsigned long va, __u32 addr, in
211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); 211 i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
212 212
213 for_each_sbus(sbus) { 213 for_each_sbus(sbus) {
214 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 214 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
215 215
216 iopte = (iopte_t *)(iounit->page_table + i); 216 iopte = (iopte_t *)(iounit->page_table + i);
217 *iopte = MKIOPTE(__pa(page)); 217 *iopte = MKIOPTE(__pa(page));
@@ -235,7 +235,7 @@ static void iounit_unmap_dma_area(unsigned long addr, int len)
235static struct page *iounit_translate_dvma(unsigned long addr) 235static struct page *iounit_translate_dvma(unsigned long addr)
236{ 236{
237 struct sbus_bus *sbus = sbus_root; /* They are all the same */ 237 struct sbus_bus *sbus = sbus_root; /* They are all the same */
238 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 238 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
239 int i; 239 int i;
240 iopte_t *iopte; 240 iopte_t *iopte;
241 241
@@ -279,7 +279,7 @@ __u32 iounit_map_dma_init(struct sbus_bus *sbus, int size)
279 unsigned long rotor, scan, limit; 279 unsigned long rotor, scan, limit;
280 unsigned long flags; 280 unsigned long flags;
281 __u32 ret; 281 __u32 ret;
282 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 282 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
283 283
284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT; 284 npages = (size + (PAGE_SIZE-1)) >> PAGE_SHIFT;
285 i = 0x0213; 285 i = 0x0213;
@@ -315,7 +315,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus) 315__u32 iounit_map_dma_page(__u32 vaddr, void *addr, struct sbus_bus *sbus)
316{ 316{
317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT; 317 int scan = (vaddr - IOUNIT_DMA_BASE) >> PAGE_SHIFT;
318 struct iounit_struct *iounit = (struct iounit_struct *)sbus->iommu; 318 struct iounit_struct *iounit = sbus->ofdev.dev.archdata.iommu;
319 319
320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK)); 320 iounit->page_table[scan] = MKIOPTE(__pa(((unsigned long)addr) & PAGE_MASK));
321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK); 321 return vaddr + (((unsigned long)addr) & ~PAGE_MASK);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index be042efd1ba4..52e907af9d29 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -132,7 +132,7 @@ iommu_init(int iommund, struct sbus_bus *sbus)
132 impl, vers, iommu->page_table, 132 impl, vers, iommu->page_table,
133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES); 133 (int)(IOMMU_NPTES*sizeof(iopte_t)), (int)IOMMU_NPTES);
134 134
135 sbus->iommu = iommu; 135 sbus->ofdev.dev.archdata.iommu = iommu;
136} 136}
137 137
138/* This begs to be btfixup-ed by srmmu. */ 138/* This begs to be btfixup-ed by srmmu. */
@@ -166,7 +166,7 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
166 166
167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus) 167static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus)
168{ 168{
169 struct iommu_struct *iommu = sbus->iommu; 169 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
170 int ioptex; 170 int ioptex;
171 iopte_t *iopte, *iopte0; 171 iopte_t *iopte, *iopte0;
172 unsigned int busa, busa0; 172 unsigned int busa, busa0;
@@ -291,7 +291,7 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
291 291
292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus) 292static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
293{ 293{
294 struct iommu_struct *iommu = sbus->iommu; 294 struct iommu_struct *iommu = sbus->ofdev.dev.archdata.iommu;
295 int ioptex; 295 int ioptex;
296 int i; 296 int i;
297 297
@@ -334,7 +334,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
334 unsigned long addr, int len) 334 unsigned long addr, int len)
335{ 335{
336 unsigned long page, end; 336 unsigned long page, end;
337 struct iommu_struct *iommu = sbus_root->iommu; 337 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
338 iopte_t *iopte = iommu->page_table; 338 iopte_t *iopte = iommu->page_table;
339 iopte_t *first; 339 iopte_t *first;
340 int ioptex; 340 int ioptex;
@@ -399,7 +399,7 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
399 399
400static void iommu_unmap_dma_area(unsigned long busa, int len) 400static void iommu_unmap_dma_area(unsigned long busa, int len)
401{ 401{
402 struct iommu_struct *iommu = sbus_root->iommu; 402 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
403 iopte_t *iopte = iommu->page_table; 403 iopte_t *iopte = iommu->page_table;
404 unsigned long end; 404 unsigned long end;
405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; 405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
@@ -420,7 +420,7 @@ static void iommu_unmap_dma_area(unsigned long busa, int len)
420 420
421static struct page *iommu_translate_dvma(unsigned long busa) 421static struct page *iommu_translate_dvma(unsigned long busa)
422{ 422{
423 struct iommu_struct *iommu = sbus_root->iommu; 423 struct iommu_struct *iommu = sbus_root->ofdev.dev.archdata.iommu;
424 iopte_t *iopte = iommu->page_table; 424 iopte_t *iopte = iommu->page_table;
425 425
426 iopte += ((busa - iommu->start) >> PAGE_SHIFT); 426 iopte += ((busa - iommu->start) >> PAGE_SHIFT);
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 79d60d86f6f8..005a3e72d4f2 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -268,7 +268,6 @@ static inline void sun4c_init_clean_mmu(unsigned long kernel_end)
268 unsigned char savectx, ctx; 268 unsigned char savectx, ctx;
269 269
270 savectx = sun4c_get_context(); 270 savectx = sun4c_get_context();
271 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
272 for (ctx = 0; ctx < num_contexts; ctx++) { 271 for (ctx = 0; ctx < num_contexts; ctx++) {
273 sun4c_set_context(ctx); 272 sun4c_set_context(ctx);
274 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE) 273 for (vaddr = 0; vaddr < 0x20000000; vaddr += SUN4C_REAL_PGDIR_SIZE)
@@ -2064,7 +2063,6 @@ void __init sun4c_paging_init(void)
2064 unsigned long end_pfn, pages_avail; 2063 unsigned long end_pfn, pages_avail;
2065 2064
2066 kernel_end = (unsigned long) &end; 2065 kernel_end = (unsigned long) &end;
2067 kernel_end += (SUN4C_REAL_PGDIR_SIZE * 4);
2068 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end); 2066 kernel_end = SUN4C_REAL_PGDIR_ALIGN(kernel_end);
2069 2067
2070 pages_avail = 0; 2068 pages_avail = 0;
diff --git a/arch/sparc64/kernel/head.S b/arch/sparc64/kernel/head.S
index ac18bd8e273f..63144ad476f6 100644
--- a/arch/sparc64/kernel/head.S
+++ b/arch/sparc64/kernel/head.S
@@ -501,7 +501,7 @@ niagara_tlb_fixup:
501 cmp %g1, SUN4V_CHIP_NIAGARA1 501 cmp %g1, SUN4V_CHIP_NIAGARA1
502 be,pt %xcc, niagara_patch 502 be,pt %xcc, niagara_patch
503 cmp %g1, SUN4V_CHIP_NIAGARA2 503 cmp %g1, SUN4V_CHIP_NIAGARA2
504 be,pt %xcc, niagara_patch 504 be,pt %xcc, niagara2_patch
505 nop 505 nop
506 506
507 call generic_patch_copyops 507 call generic_patch_copyops
@@ -512,6 +512,15 @@ niagara_tlb_fixup:
512 nop 512 nop
513 513
514 ba,a,pt %xcc, 80f 514 ba,a,pt %xcc, 80f
515niagara2_patch:
516 call niagara2_patch_copyops
517 nop
518 call niagara_patch_bzero
519 nop
520 call niagara2_patch_pageops
521 nop
522
523 ba,a,pt %xcc, 80f
515 524
516niagara_patch: 525niagara_patch:
517 call niagara_patch_copyops 526 call niagara_patch_copyops
@@ -706,12 +715,13 @@ setup_trap_table:
706 715
707 membar #Sync 716 membar #Sync
708 717
718 BRANCH_IF_SUN4V(o2, 1f)
719
709 /* Kill PROM timer */ 720 /* Kill PROM timer */
710 sethi %hi(0x80000000), %o2 721 sethi %hi(0x80000000), %o2
711 sllx %o2, 32, %o2 722 sllx %o2, 32, %o2
712 wr %o2, 0, %tick_cmpr 723 wr %o2, 0, %tick_cmpr
713 724
714 BRANCH_IF_SUN4V(o2, 1f)
715 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f) 725 BRANCH_IF_ANY_CHEETAH(o2, o3, 1f)
716 726
717 ba,pt %xcc, 2f 727 ba,pt %xcc, 2f
diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 95059c2ec414..9f22e4ff6015 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -9,6 +9,7 @@
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/miscdevice.h>
12 13
13#include <asm/hypervisor.h> 14#include <asm/hypervisor.h>
14#include <asm/mdesc.h> 15#include <asm/mdesc.h>
@@ -836,6 +837,43 @@ void __devinit mdesc_fill_in_cpu_data(cpumask_t mask)
836 mdesc_release(hp); 837 mdesc_release(hp);
837} 838}
838 839
840static ssize_t mdesc_read(struct file *file, char __user *buf,
841 size_t len, loff_t *offp)
842{
843 struct mdesc_handle *hp = mdesc_grab();
844 int err;
845
846 if (!hp)
847 return -ENODEV;
848
849 err = hp->handle_size;
850 if (len < hp->handle_size)
851 err = -EMSGSIZE;
852 else if (copy_to_user(buf, &hp->mdesc, hp->handle_size))
853 err = -EFAULT;
854 mdesc_release(hp);
855
856 return err;
857}
858
859static const struct file_operations mdesc_fops = {
860 .read = mdesc_read,
861 .owner = THIS_MODULE,
862};
863
864static struct miscdevice mdesc_misc = {
865 .minor = MISC_DYNAMIC_MINOR,
866 .name = "mdesc",
867 .fops = &mdesc_fops,
868};
869
870static int __init mdesc_misc_init(void)
871{
872 return misc_register(&mdesc_misc);
873}
874
875__initcall(mdesc_misc_init);
876
839void __init sun4v_mdesc_init(void) 877void __init sun4v_mdesc_init(void)
840{ 878{
841 struct mdesc_handle *hp; 879 struct mdesc_handle *hp;
diff --git a/arch/sparc64/kernel/trampoline.S b/arch/sparc64/kernel/trampoline.S
index 9448595f9063..9533a25ce5d2 100644
--- a/arch/sparc64/kernel/trampoline.S
+++ b/arch/sparc64/kernel/trampoline.S
@@ -95,14 +95,13 @@ spitfire_startup:
95 membar #Sync 95 membar #Sync
96 96
97startup_continue: 97startup_continue:
98 mov %o0, %l0
99 BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
100
98 sethi %hi(0x80000000), %g2 101 sethi %hi(0x80000000), %g2
99 sllx %g2, 32, %g2 102 sllx %g2, 32, %g2
100 wr %g2, 0, %tick_cmpr 103 wr %g2, 0, %tick_cmpr
101 104
102 mov %o0, %l0
103
104 BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
105
106 /* Call OBP by hand to lock KERNBASE into i/d tlbs. 105 /* Call OBP by hand to lock KERNBASE into i/d tlbs.
107 * We lock 2 consequetive entries if we are 'bigkernel'. 106 * We lock 2 consequetive entries if we are 'bigkernel'.
108 */ 107 */
diff --git a/arch/sparc64/lib/Makefile b/arch/sparc64/lib/Makefile
index f95fbfa3eeb8..f095e13910bc 100644
--- a/arch/sparc64/lib/Makefile
+++ b/arch/sparc64/lib/Makefile
@@ -13,6 +13,8 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \ 13 U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \ 14 NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
15 NGpage.o NGbzero.o \ 15 NGpage.o NGbzero.o \
16 NG2memcpy.o NG2copy_from_user.o NG2copy_to_user.o NG2patch.o \
17 NG2page.o \
16 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \ 18 GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
17 GENpage.o GENbzero.o \ 19 GENpage.o GENbzero.o \
18 copy_in_user.o user_fixup.o memmove.o \ 20 copy_in_user.o user_fixup.o memmove.o \
diff --git a/arch/sparc64/lib/NG2copy_from_user.S b/arch/sparc64/lib/NG2copy_from_user.S
new file mode 100644
index 000000000000..c77ef5f22102
--- /dev/null
+++ b/arch/sparc64/lib/NG2copy_from_user.S
@@ -0,0 +1,40 @@
1/* NG2copy_from_user.S: Niagara-2 optimized copy from userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_LD(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: wr %g0, ASI_AIUS, %asi;\
11 retl; \
12 mov 1, %o0; \
13 .section __ex_table,"a";\
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19#ifndef ASI_AIUS
20#define ASI_AIUS 0x11
21#endif
22
23#ifndef ASI_BLK_AIUS_4V
24#define ASI_BLK_AIUS_4V 0x17
25#endif
26
27#define FUNC_NAME NG2copy_from_user
28#define LOAD(type,addr,dest) type##a [addr] %asi, dest
29#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_AIUS_4V, dest
30#define EX_RETVAL(x) 0
31
32#ifdef __KERNEL__
33#define PREAMBLE \
34 rd %asi, %g1; \
35 cmp %g1, ASI_AIUS; \
36 bne,pn %icc, memcpy_user_stub; \
37 nop
38#endif
39
40#include "NG2memcpy.S"
diff --git a/arch/sparc64/lib/NG2copy_to_user.S b/arch/sparc64/lib/NG2copy_to_user.S
new file mode 100644
index 000000000000..4bd4093acbbd
--- /dev/null
+++ b/arch/sparc64/lib/NG2copy_to_user.S
@@ -0,0 +1,49 @@
1/* NG2copy_to_user.S: Niagara-2 optimized copy to userspace.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#define EX_ST(x) \
798: x; \
8 .section .fixup; \
9 .align 4; \
1099: wr %g0, ASI_AIUS, %asi;\
11 retl; \
12 mov 1, %o0; \
13 .section __ex_table,"a";\
14 .align 4; \
15 .word 98b, 99b; \
16 .text; \
17 .align 4;
18
19#ifndef ASI_AIUS
20#define ASI_AIUS 0x11
21#endif
22
23#ifndef ASI_BLK_AIUS_4V
24#define ASI_BLK_AIUS_4V 0x17
25#endif
26
27#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS
28#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23
29#endif
30
31#define FUNC_NAME NG2copy_to_user
32#define STORE(type,src,addr) type##a src, [addr] ASI_AIUS
33#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS
34#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_AIUS_4V
35#define EX_RETVAL(x) 0
36
37#ifdef __KERNEL__
38 /* Writing to %asi is _expensive_ so we hardcode it.
39 * Reading %asi to check for KERNEL_DS is comparatively
40 * cheap.
41 */
42#define PREAMBLE \
43 rd %asi, %g1; \
44 cmp %g1, ASI_AIUS; \
45 bne,pn %icc, memcpy_user_stub; \
46 nop
47#endif
48
49#include "NG2memcpy.S"
diff --git a/arch/sparc64/lib/NG2memcpy.S b/arch/sparc64/lib/NG2memcpy.S
new file mode 100644
index 000000000000..0aed75653b50
--- /dev/null
+++ b/arch/sparc64/lib/NG2memcpy.S
@@ -0,0 +1,520 @@
1/* NG2memcpy.S: Niagara-2 optimized memcpy.
2 *
3 * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
4 */
5
6#ifdef __KERNEL__
7#include <asm/visasm.h>
8#include <asm/asi.h>
9#define GLOBAL_SPARE %g7
10#else
11#define ASI_PNF 0x82
12#define ASI_BLK_P 0xf0
13#define ASI_BLK_INIT_QUAD_LDD_P 0xe2
14#define FPRS_FEF 0x04
15#ifdef MEMCPY_DEBUG
16#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs; \
17 clr %g1; clr %g2; clr %g3; subcc %g0, %g0, %g0;
18#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
19#else
20#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs
21#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
22#endif
23#define GLOBAL_SPARE %g5
24#endif
25
26#ifndef STORE_ASI
27#ifndef SIMULATE_NIAGARA_ON_NON_NIAGARA
28#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_P
29#else
30#define STORE_ASI 0x80 /* ASI_P */
31#endif
32#endif
33
34#ifndef EX_LD
35#define EX_LD(x) x
36#endif
37
38#ifndef EX_ST
39#define EX_ST(x) x
40#endif
41
42#ifndef EX_RETVAL
43#define EX_RETVAL(x) x
44#endif
45
46#ifndef LOAD
47#define LOAD(type,addr,dest) type [addr], dest
48#endif
49
50#ifndef LOAD_BLK
51#define LOAD_BLK(addr,dest) ldda [addr] ASI_BLK_P, dest
52#endif
53
54#ifndef STORE
55#ifndef MEMCPY_DEBUG
56#define STORE(type,src,addr) type src, [addr]
57#else
58#define STORE(type,src,addr) type##a src, [addr] 0x80
59#endif
60#endif
61
62#ifndef STORE_BLK
63#define STORE_BLK(src,addr) stda src, [addr] ASI_BLK_P
64#endif
65
66#ifndef STORE_INIT
67#define STORE_INIT(src,addr) stxa src, [addr] STORE_ASI
68#endif
69
70#ifndef FUNC_NAME
71#define FUNC_NAME NG2memcpy
72#endif
73
74#ifndef PREAMBLE
75#define PREAMBLE
76#endif
77
78#ifndef XCC
79#define XCC xcc
80#endif
81
82#define FREG_FROB(x0, x1, x2, x3, x4, x5, x6, x7, x8) \
83 faligndata %x0, %x1, %f0; \
84 faligndata %x1, %x2, %f2; \
85 faligndata %x2, %x3, %f4; \
86 faligndata %x3, %x4, %f6; \
87 faligndata %x4, %x5, %f8; \
88 faligndata %x5, %x6, %f10; \
89 faligndata %x6, %x7, %f12; \
90 faligndata %x7, %x8, %f14;
91
92#define FREG_MOVE_1(x0) \
93 fmovd %x0, %f0;
94#define FREG_MOVE_2(x0, x1) \
95 fmovd %x0, %f0; \
96 fmovd %x1, %f2;
97#define FREG_MOVE_3(x0, x1, x2) \
98 fmovd %x0, %f0; \
99 fmovd %x1, %f2; \
100 fmovd %x2, %f4;
101#define FREG_MOVE_4(x0, x1, x2, x3) \
102 fmovd %x0, %f0; \
103 fmovd %x1, %f2; \
104 fmovd %x2, %f4; \
105 fmovd %x3, %f6;
106#define FREG_MOVE_5(x0, x1, x2, x3, x4) \
107 fmovd %x0, %f0; \
108 fmovd %x1, %f2; \
109 fmovd %x2, %f4; \
110 fmovd %x3, %f6; \
111 fmovd %x4, %f8;
112#define FREG_MOVE_6(x0, x1, x2, x3, x4, x5) \
113 fmovd %x0, %f0; \
114 fmovd %x1, %f2; \
115 fmovd %x2, %f4; \
116 fmovd %x3, %f6; \
117 fmovd %x4, %f8; \
118 fmovd %x5, %f10;
119#define FREG_MOVE_7(x0, x1, x2, x3, x4, x5, x6) \
120 fmovd %x0, %f0; \
121 fmovd %x1, %f2; \
122 fmovd %x2, %f4; \
123 fmovd %x3, %f6; \
124 fmovd %x4, %f8; \
125 fmovd %x5, %f10; \
126 fmovd %x6, %f12;
127#define FREG_MOVE_8(x0, x1, x2, x3, x4, x5, x6, x7) \
128 fmovd %x0, %f0; \
129 fmovd %x1, %f2; \
130 fmovd %x2, %f4; \
131 fmovd %x3, %f6; \
132 fmovd %x4, %f8; \
133 fmovd %x5, %f10; \
134 fmovd %x6, %f12; \
135 fmovd %x7, %f14;
136#define FREG_LOAD_1(base, x0) \
137 EX_LD(LOAD(ldd, base + 0x00, %x0))
138#define FREG_LOAD_2(base, x0, x1) \
139 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
140 EX_LD(LOAD(ldd, base + 0x08, %x1));
141#define FREG_LOAD_3(base, x0, x1, x2) \
142 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
143 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
144 EX_LD(LOAD(ldd, base + 0x10, %x2));
145#define FREG_LOAD_4(base, x0, x1, x2, x3) \
146 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
147 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
148 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
149 EX_LD(LOAD(ldd, base + 0x18, %x3));
150#define FREG_LOAD_5(base, x0, x1, x2, x3, x4) \
151 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
152 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
153 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
154 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
155 EX_LD(LOAD(ldd, base + 0x20, %x4));
156#define FREG_LOAD_6(base, x0, x1, x2, x3, x4, x5) \
157 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
158 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
159 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
160 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
161 EX_LD(LOAD(ldd, base + 0x20, %x4)); \
162 EX_LD(LOAD(ldd, base + 0x28, %x5));
163#define FREG_LOAD_7(base, x0, x1, x2, x3, x4, x5, x6) \
164 EX_LD(LOAD(ldd, base + 0x00, %x0)); \
165 EX_LD(LOAD(ldd, base + 0x08, %x1)); \
166 EX_LD(LOAD(ldd, base + 0x10, %x2)); \
167 EX_LD(LOAD(ldd, base + 0x18, %x3)); \
168 EX_LD(LOAD(ldd, base + 0x20, %x4)); \
169 EX_LD(LOAD(ldd, base + 0x28, %x5)); \
170 EX_LD(LOAD(ldd, base + 0x30, %x6));
171
172 .register %g2,#scratch
173 .register %g3,#scratch
174
175 .text
176 .align 64
177
178 .globl FUNC_NAME
179 .type FUNC_NAME,#function
180FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */
181 srlx %o2, 31, %g2
182 cmp %g2, 0
183 tne %xcc, 5
184 PREAMBLE
185 mov %o0, GLOBAL_SPARE
186 cmp %o2, 0
187 be,pn %XCC, 85f
188 or %o0, %o1, %o3
189 cmp %o2, 16
190 blu,a,pn %XCC, 80f
191 or %o3, %o2, %o3
192
193 /* 2 blocks (128 bytes) is the minimum we can do the block
194 * copy with. We need to ensure that we'll iterate at least
195 * once in the block copy loop. At worst we'll need to align
196 * the destination to a 64-byte boundary which can chew up
197 * to (64 - 1) bytes from the length before we perform the
198 * block copy loop.
199 *
200 * However, the cut-off point, performance wise, is around
201 * 4 64-byte blocks.
202 */
203 cmp %o2, (4 * 64)
204 blu,pt %XCC, 75f
205 andcc %o3, 0x7, %g0
206
207 /* %o0: dst
208 * %o1: src
209 * %o2: len (known to be >= 128)
210 *
211 * The block copy loops can use %o4, %g2, %g3 as
212 * temporaries while copying the data. %o5 must
213 * be preserved between VISEntryHalf and VISExitHalf
214 */
215
216 LOAD(prefetch, %o1 + 0x000, #one_read)
217 LOAD(prefetch, %o1 + 0x040, #one_read)
218 LOAD(prefetch, %o1 + 0x080, #one_read)
219
220 /* Align destination on 64-byte boundary. */
221 andcc %o0, (64 - 1), %o4
222 be,pt %XCC, 2f
223 sub %o4, 64, %o4
224 sub %g0, %o4, %o4 ! bytes to align dst
225 sub %o2, %o4, %o2
2261: subcc %o4, 1, %o4
227 EX_LD(LOAD(ldub, %o1, %g1))
228 EX_ST(STORE(stb, %g1, %o0))
229 add %o1, 1, %o1
230 bne,pt %XCC, 1b
231 add %o0, 1, %o0
232
2332:
234 /* Clobbers o5/g1/g2/g3/g7/icc/xcc. We must preserve
235 * o5 from here until we hit VISExitHalf.
236 */
237 VISEntryHalf
238
239 alignaddr %o1, %g0, %g0
240
241 add %o1, (64 - 1), %o4
242 andn %o4, (64 - 1), %o4
243 andn %o2, (64 - 1), %g1
244 sub %o2, %g1, %o2
245
246 and %o1, (64 - 1), %g2
247 add %o1, %g1, %o1
248 sub %o0, %o4, %g3
249 brz,pt %g2, 190f
250 cmp %g2, 32
251 blu,a 5f
252 cmp %g2, 16
253 cmp %g2, 48
254 blu,a 4f
255 cmp %g2, 40
256 cmp %g2, 56
257 blu 170f
258 nop
259 ba,a,pt %xcc, 180f
260
2614: /* 32 <= low bits < 48 */
262 blu 150f
263 nop
264 ba,a,pt %xcc, 160f
2655: /* 0 < low bits < 32 */
266 blu,a 6f
267 cmp %g2, 8
268 cmp %g2, 24
269 blu 130f
270 nop
271 ba,a,pt %xcc, 140f
2726: /* 0 < low bits < 16 */
273 bgeu 120f
274 nop
275 /* fall through for 0 < low bits < 8 */
276110: sub %o4, 64, %g2
277 EX_LD(LOAD_BLK(%g2, %f0))
2781: EX_ST(STORE_INIT(%g0, %o4 + %g3))
279 EX_LD(LOAD_BLK(%o4, %f16))
280 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f14, f16)
281 EX_ST(STORE_BLK(%f0, %o4 + %g3))
282 FREG_MOVE_8(f16, f18, f20, f22, f24, f26, f28, f30)
283 subcc %g1, 64, %g1
284 add %o4, 64, %o4
285 bne,pt %xcc, 1b
286 LOAD(prefetch, %o4 + 64, #one_read)
287 ba,pt %xcc, 195f
288 nop
289
290120: sub %o4, 56, %g2
291 FREG_LOAD_7(%g2, f0, f2, f4, f6, f8, f10, f12)
2921: EX_ST(STORE_INIT(%g0, %o4 + %g3))
293 EX_LD(LOAD_BLK(%o4, %f16))
294 FREG_FROB(f0, f2, f4, f6, f8, f10, f12, f16, f18)
295 EX_ST(STORE_BLK(%f0, %o4 + %g3))
296 FREG_MOVE_7(f18, f20, f22, f24, f26, f28, f30)
297 subcc %g1, 64, %g1
298 add %o4, 64, %o4
299 bne,pt %xcc, 1b
300 LOAD(prefetch, %o4 + 64, #one_read)
301 ba,pt %xcc, 195f
302 nop
303
304130: sub %o4, 48, %g2
305 FREG_LOAD_6(%g2, f0, f2, f4, f6, f8, f10)
3061: EX_ST(STORE_INIT(%g0, %o4 + %g3))
307 EX_LD(LOAD_BLK(%o4, %f16))
308 FREG_FROB(f0, f2, f4, f6, f8, f10, f16, f18, f20)
309 EX_ST(STORE_BLK(%f0, %o4 + %g3))
310 FREG_MOVE_6(f20, f22, f24, f26, f28, f30)
311 subcc %g1, 64, %g1
312 add %o4, 64, %o4
313 bne,pt %xcc, 1b
314 LOAD(prefetch, %o4 + 64, #one_read)
315 ba,pt %xcc, 195f
316 nop
317
318140: sub %o4, 40, %g2
319 FREG_LOAD_5(%g2, f0, f2, f4, f6, f8)
3201: EX_ST(STORE_INIT(%g0, %o4 + %g3))
321 EX_LD(LOAD_BLK(%o4, %f16))
322 FREG_FROB(f0, f2, f4, f6, f8, f16, f18, f20, f22)
323 EX_ST(STORE_BLK(%f0, %o4 + %g3))
324 FREG_MOVE_5(f22, f24, f26, f28, f30)
325 subcc %g1, 64, %g1
326 add %o4, 64, %o4
327 bne,pt %xcc, 1b
328 LOAD(prefetch, %o4 + 64, #one_read)
329 ba,pt %xcc, 195f
330 nop
331
332150: sub %o4, 32, %g2
333 FREG_LOAD_4(%g2, f0, f2, f4, f6)
3341: EX_ST(STORE_INIT(%g0, %o4 + %g3))
335 EX_LD(LOAD_BLK(%o4, %f16))
336 FREG_FROB(f0, f2, f4, f6, f16, f18, f20, f22, f24)
337 EX_ST(STORE_BLK(%f0, %o4 + %g3))
338 FREG_MOVE_4(f24, f26, f28, f30)
339 subcc %g1, 64, %g1
340 add %o4, 64, %o4
341 bne,pt %xcc, 1b
342 LOAD(prefetch, %o4 + 64, #one_read)
343 ba,pt %xcc, 195f
344 nop
345
346160: sub %o4, 24, %g2
347 FREG_LOAD_3(%g2, f0, f2, f4)
3481: EX_ST(STORE_INIT(%g0, %o4 + %g3))
349 EX_LD(LOAD_BLK(%o4, %f16))
350 FREG_FROB(f0, f2, f4, f16, f18, f20, f22, f24, f26)
351 EX_ST(STORE_BLK(%f0, %o4 + %g3))
352 FREG_MOVE_3(f26, f28, f30)
353 subcc %g1, 64, %g1
354 add %o4, 64, %o4
355 bne,pt %xcc, 1b
356 LOAD(prefetch, %o4 + 64, #one_read)
357 ba,pt %xcc, 195f
358 nop
359
360170: sub %o4, 16, %g2
361 FREG_LOAD_2(%g2, f0, f2)
3621: EX_ST(STORE_INIT(%g0, %o4 + %g3))
363 EX_LD(LOAD_BLK(%o4, %f16))
364 FREG_FROB(f0, f2, f16, f18, f20, f22, f24, f26, f28)
365 EX_ST(STORE_BLK(%f0, %o4 + %g3))
366 FREG_MOVE_2(f28, f30)
367 subcc %g1, 64, %g1
368 add %o4, 64, %o4
369 bne,pt %xcc, 1b
370 LOAD(prefetch, %o4 + 64, #one_read)
371 ba,pt %xcc, 195f
372 nop
373
374180: sub %o4, 8, %g2
375 FREG_LOAD_1(%g2, f0)
3761: EX_ST(STORE_INIT(%g0, %o4 + %g3))
377 EX_LD(LOAD_BLK(%o4, %f16))
378 FREG_FROB(f0, f16, f18, f20, f22, f24, f26, f28, f30)
379 EX_ST(STORE_BLK(%f0, %o4 + %g3))
380 FREG_MOVE_1(f30)
381 subcc %g1, 64, %g1
382 add %o4, 64, %o4
383 bne,pt %xcc, 1b
384 LOAD(prefetch, %o4 + 64, #one_read)
385 ba,pt %xcc, 195f
386 nop
387
388190:
3891: EX_ST(STORE_INIT(%g0, %o4 + %g3))
390 subcc %g1, 64, %g1
391 EX_LD(LOAD_BLK(%o4, %f0))
392 EX_ST(STORE_BLK(%f0, %o4 + %g3))
393 add %o4, 64, %o4
394 bne,pt %xcc, 1b
395 LOAD(prefetch, %o4 + 64, #one_read)
396
397195:
398 add %o4, %g3, %o0
399 membar #Sync
400
401 VISExitHalf
402
403 /* %o2 contains any final bytes still needed to be copied
404 * over. If anything is left, we copy it one byte at a time.
405 */
406 brz,pt %o2, 85f
407 sub %o0, %o1, %o3
408 ba,a,pt %XCC, 90f
409
410 .align 64
41175: /* 16 < len <= 64 */
412 bne,pn %XCC, 75f
413 sub %o0, %o1, %o3
414
41572:
416 andn %o2, 0xf, %o4
417 and %o2, 0xf, %o2
4181: subcc %o4, 0x10, %o4
419 EX_LD(LOAD(ldx, %o1, %o5))
420 add %o1, 0x08, %o1
421 EX_LD(LOAD(ldx, %o1, %g1))
422 sub %o1, 0x08, %o1
423 EX_ST(STORE(stx, %o5, %o1 + %o3))
424 add %o1, 0x8, %o1
425 EX_ST(STORE(stx, %g1, %o1 + %o3))
426 bgu,pt %XCC, 1b
427 add %o1, 0x8, %o1
42873: andcc %o2, 0x8, %g0
429 be,pt %XCC, 1f
430 nop
431 sub %o2, 0x8, %o2
432 EX_LD(LOAD(ldx, %o1, %o5))
433 EX_ST(STORE(stx, %o5, %o1 + %o3))
434 add %o1, 0x8, %o1
4351: andcc %o2, 0x4, %g0
436 be,pt %XCC, 1f
437 nop
438 sub %o2, 0x4, %o2
439 EX_LD(LOAD(lduw, %o1, %o5))
440 EX_ST(STORE(stw, %o5, %o1 + %o3))
441 add %o1, 0x4, %o1
4421: cmp %o2, 0
443 be,pt %XCC, 85f
444 nop
445 ba,pt %xcc, 90f
446 nop
447
44875:
449 andcc %o0, 0x7, %g1
450 sub %g1, 0x8, %g1
451 be,pn %icc, 2f
452 sub %g0, %g1, %g1
453 sub %o2, %g1, %o2
454
4551: subcc %g1, 1, %g1
456 EX_LD(LOAD(ldub, %o1, %o5))
457 EX_ST(STORE(stb, %o5, %o1 + %o3))
458 bgu,pt %icc, 1b
459 add %o1, 1, %o1
460
4612: add %o1, %o3, %o0
462 andcc %o1, 0x7, %g1
463 bne,pt %icc, 8f
464 sll %g1, 3, %g1
465
466 cmp %o2, 16
467 bgeu,pt %icc, 72b
468 nop
469 ba,a,pt %xcc, 73b
470
4718: mov 64, %o3
472 andn %o1, 0x7, %o1
473 EX_LD(LOAD(ldx, %o1, %g2))
474 sub %o3, %g1, %o3
475 andn %o2, 0x7, %o4
476 sllx %g2, %g1, %g2
4771: add %o1, 0x8, %o1
478 EX_LD(LOAD(ldx, %o1, %g3))
479 subcc %o4, 0x8, %o4
480 srlx %g3, %o3, %o5
481 or %o5, %g2, %o5
482 EX_ST(STORE(stx, %o5, %o0))
483 add %o0, 0x8, %o0
484 bgu,pt %icc, 1b
485 sllx %g3, %g1, %g2
486
487 srl %g1, 3, %g1
488 andcc %o2, 0x7, %o2
489 be,pn %icc, 85f
490 add %o1, %g1, %o1
491 ba,pt %xcc, 90f
492 sub %o0, %o1, %o3
493
494 .align 64
49580: /* 0 < len <= 16 */
496 andcc %o3, 0x3, %g0
497 bne,pn %XCC, 90f
498 sub %o0, %o1, %o3
499
5001:
501 subcc %o2, 4, %o2
502 EX_LD(LOAD(lduw, %o1, %g1))
503 EX_ST(STORE(stw, %g1, %o1 + %o3))
504 bgu,pt %XCC, 1b
505 add %o1, 4, %o1
506
50785: retl
508 mov EX_RETVAL(GLOBAL_SPARE), %o0
509
510 .align 32
51190:
512 subcc %o2, 1, %o2
513 EX_LD(LOAD(ldub, %o1, %g1))
514 EX_ST(STORE(stb, %g1, %o1 + %o3))
515 bgu,pt %XCC, 90b
516 add %o1, 1, %o1
517 retl
518 mov EX_RETVAL(GLOBAL_SPARE), %o0
519
520 .size FUNC_NAME, .-FUNC_NAME
diff --git a/arch/sparc64/lib/NG2page.S b/arch/sparc64/lib/NG2page.S
new file mode 100644
index 000000000000..73b6b7c72cbf
--- /dev/null
+++ b/arch/sparc64/lib/NG2page.S
@@ -0,0 +1,61 @@
1/* NG2page.S: Niagara-2 optimized clear and copy page.
2 *
3 * Copyright (C) 2007 (davem@davemloft.net)
4 */
5
6#include <asm/asi.h>
7#include <asm/page.h>
8#include <asm/visasm.h>
9
10 .text
11 .align 32
12
13 /* This is heavily simplified from the sun4u variants
14 * because Niagara-2 does not have any D-cache aliasing issues.
15 */
16NG2copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
17 prefetch [%o1 + 0x00], #one_read
18 prefetch [%o1 + 0x40], #one_read
19 VISEntryHalf
20 set PAGE_SIZE, %g7
21 sub %o0, %o1, %g3
221: stxa %g0, [%o1 + %g3] ASI_BLK_INIT_QUAD_LDD_P
23 subcc %g7, 64, %g7
24 ldda [%o1] ASI_BLK_P, %f0
25 stda %f0, [%o1 + %g3] ASI_BLK_P
26 add %o1, 64, %o1
27 bne,pt %xcc, 1b
28 prefetch [%o1 + 0x40], #one_read
29 membar #Sync
30 VISExitHalf
31 retl
32 nop
33
34#define BRANCH_ALWAYS 0x10680000
35#define NOP 0x01000000
36#define NG_DO_PATCH(OLD, NEW) \
37 sethi %hi(NEW), %g1; \
38 or %g1, %lo(NEW), %g1; \
39 sethi %hi(OLD), %g2; \
40 or %g2, %lo(OLD), %g2; \
41 sub %g1, %g2, %g1; \
42 sethi %hi(BRANCH_ALWAYS), %g3; \
43 sll %g1, 11, %g1; \
44 srl %g1, 11 + 2, %g1; \
45 or %g3, %lo(BRANCH_ALWAYS), %g3; \
46 or %g3, %g1, %g3; \
47 stw %g3, [%g2]; \
48 sethi %hi(NOP), %g3; \
49 or %g3, %lo(NOP), %g3; \
50 stw %g3, [%g2 + 0x4]; \
51 flush %g2;
52
53 .globl niagara2_patch_pageops
54 .type niagara2_patch_pageops,#function
55niagara2_patch_pageops:
56 NG_DO_PATCH(copy_user_page, NG2copy_user_page)
57 NG_DO_PATCH(_clear_page, NGclear_page)
58 NG_DO_PATCH(clear_user_page, NGclear_user_page)
59 retl
60 nop
61 .size niagara2_patch_pageops,.-niagara2_patch_pageops
diff --git a/arch/sparc64/lib/NG2patch.S b/arch/sparc64/lib/NG2patch.S
new file mode 100644
index 000000000000..28c36f06a6d1
--- /dev/null
+++ b/arch/sparc64/lib/NG2patch.S
@@ -0,0 +1,33 @@
1/* NG2patch.S: Patch Ultra-I routines with Niagara-2 variant.
2 *
3 * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
4 */
5
6#define BRANCH_ALWAYS 0x10680000
7#define NOP 0x01000000
8#define NG_DO_PATCH(OLD, NEW) \
9 sethi %hi(NEW), %g1; \
10 or %g1, %lo(NEW), %g1; \
11 sethi %hi(OLD), %g2; \
12 or %g2, %lo(OLD), %g2; \
13 sub %g1, %g2, %g1; \
14 sethi %hi(BRANCH_ALWAYS), %g3; \
15 sll %g1, 11, %g1; \
16 srl %g1, 11 + 2, %g1; \
17 or %g3, %lo(BRANCH_ALWAYS), %g3; \
18 or %g3, %g1, %g3; \
19 stw %g3, [%g2]; \
20 sethi %hi(NOP), %g3; \
21 or %g3, %lo(NOP), %g3; \
22 stw %g3, [%g2 + 0x4]; \
23 flush %g2;
24
25 .globl niagara2_patch_copyops
26 .type niagara2_patch_copyops,#function
27niagara2_patch_copyops:
28 NG_DO_PATCH(memcpy, NG2memcpy)
29 NG_DO_PATCH(___copy_from_user, NG2copy_from_user)
30 NG_DO_PATCH(___copy_to_user, NG2copy_to_user)
31 retl
32 nop
33 .size niagara2_patch_copyops,.-niagara2_patch_copyops
diff --git a/arch/sparc64/lib/NGpage.S b/arch/sparc64/lib/NGpage.S
index 8ce3a0c9c537..428920de05ba 100644
--- a/arch/sparc64/lib/NGpage.S
+++ b/arch/sparc64/lib/NGpage.S
@@ -45,6 +45,7 @@ NGcopy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
45 retl 45 retl
46 nop 46 nop
47 47
48 .globl NGclear_page, NGclear_user_page
48NGclear_page: /* %o0=dest */ 49NGclear_page: /* %o0=dest */
49NGclear_user_page: /* %o0=dest, %o1=vaddr */ 50NGclear_user_page: /* %o0=dest, %o1=vaddr */
50 mov 8, %g1 51 mov 8, %g1
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index aff661fe2ee1..0eabe73c964d 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -612,6 +612,8 @@ static int ubd_open_dev(struct ubd *ubd_dev)
612 ubd_dev->fd = fd; 612 ubd_dev->fd = fd;
613 613
614 if(ubd_dev->cow.file != NULL){ 614 if(ubd_dev->cow.file != NULL){
615 blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
616
615 err = -ENOMEM; 617 err = -ENOMEM;
616 ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len); 618 ubd_dev->cow.bitmap = (void *) vmalloc(ubd_dev->cow.bitmap_len);
617 if(ubd_dev->cow.bitmap == NULL){ 619 if(ubd_dev->cow.bitmap == NULL){
@@ -712,8 +714,6 @@ static int ubd_add(int n, char **error_out)
712 ubd_dev->queue->queuedata = ubd_dev; 714 ubd_dev->queue->queuedata = ubd_dev;
713 715
714 blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG); 716 blk_queue_max_hw_segments(ubd_dev->queue, MAX_SG);
715 if(ubd_dev->cow.file != NULL)
716 blk_queue_max_sectors(ubd_dev->queue, 8 * sizeof(long));
717 err = ubd_disk_register(MAJOR_NR, ubd_dev->size, n, &ubd_gendisk[n]); 717 err = ubd_disk_register(MAJOR_NR, ubd_dev->size, n, &ubd_gendisk[n]);
718 if(err){ 718 if(err){
719 *error_out = "Failed to register device"; 719 *error_out = "Failed to register device";
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 128561d3e876..b024e4a86895 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -57,8 +57,8 @@ cflags-y += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
57cflags-y += -maccumulate-outgoing-args 57cflags-y += -maccumulate-outgoing-args
58 58
59# do binutils support CFI? 59# do binutils support CFI?
60cflags-y += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 60cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
61AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 61AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
62 62
63# is .cfi_signal_frame supported too? 63# is .cfi_signal_frame supported too?
64cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 64cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index e89abcdbdde8..b6167fe3330e 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -345,8 +345,7 @@ NEXT_PAGE(level2_kernel_pgt)
345 /* 40MB kernel mapping. The kernel code cannot be bigger than that. 345 /* 40MB kernel mapping. The kernel code cannot be bigger than that.
346 When you change this change KERNEL_TEXT_SIZE in page.h too. */ 346 When you change this change KERNEL_TEXT_SIZE in page.h too. */
347 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ 347 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */
348 PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, 348 PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, KERNEL_TEXT_SIZE/PMD_SIZE)
349 KERNEL_TEXT_SIZE/PMD_SIZE)
350 /* Module mapping starts here */ 349 /* Module mapping starts here */
351 .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0 350 .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0
352 351
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index cb8ee9d02f86..0ec6d2ddb931 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -85,7 +85,7 @@ int __init check_nmi_watchdog (void)
85 int *counts; 85 int *counts;
86 int cpu; 86 int cpu;
87 87
88 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 88 if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
89 return 0; 89 return 0;
90 90
91 if (!atomic_read(&nmi_active)) 91 if (!atomic_read(&nmi_active))
@@ -442,7 +442,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
442 if (!!old_state == !!nmi_watchdog_enabled) 442 if (!!old_state == !!nmi_watchdog_enabled)
443 return 0; 443 return 0;
444 444
445 if (atomic_read(&nmi_active) < 0) { 445 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
446 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 446 printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
447 return -EIO; 447 return -EIO;
448 } 448 }
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 05d745ede561..29711445c818 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -82,6 +82,10 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
82 if (dma_mask == 0) 82 if (dma_mask == 0)
83 dma_mask = DMA_32BIT_MASK; 83 dma_mask = DMA_32BIT_MASK;
84 84
85 /* Device not DMA able */
86 if (dev->dma_mask == NULL)
87 return NULL;
88
85 /* Don't invoke OOM killer */ 89 /* Don't invoke OOM killer */
86 gfp |= __GFP_NORETRY; 90 gfp |= __GFP_NORETRY;
87 91
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index a8634a0655fc..d9b8af763e1e 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -63,6 +63,7 @@
63ACPI_MODULE_NAME("processor_idle"); 63ACPI_MODULE_NAME("processor_idle");
64#define ACPI_PROCESSOR_FILE_POWER "power" 64#define ACPI_PROCESSOR_FILE_POWER "power"
65#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) 65#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
66#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY)
66#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 67#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */
67#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 68#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */
68static void (*pm_idle_save) (void) __read_mostly; 69static void (*pm_idle_save) (void) __read_mostly;
@@ -462,6 +463,9 @@ static void acpi_processor_idle(void)
462 * TBD: Can't get time duration while in C1, as resumes 463 * TBD: Can't get time duration while in C1, as resumes
463 * go to an ISR rather than here. Need to instrument 464 * go to an ISR rather than here. Need to instrument
464 * base interrupt handler. 465 * base interrupt handler.
466 *
467 * Note: the TSC better not stop in C1, sched_clock() will
468 * skew otherwise.
465 */ 469 */
466 sleep_ticks = 0xFFFFFFFF; 470 sleep_ticks = 0xFFFFFFFF;
467 break; 471 break;
@@ -469,6 +473,8 @@ static void acpi_processor_idle(void)
469 case ACPI_STATE_C2: 473 case ACPI_STATE_C2:
470 /* Get start time (ticks) */ 474 /* Get start time (ticks) */
471 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 475 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
476 /* Tell the scheduler that we are going deep-idle: */
477 sched_clock_idle_sleep_event();
472 /* Invoke C2 */ 478 /* Invoke C2 */
473 acpi_state_timer_broadcast(pr, cx, 1); 479 acpi_state_timer_broadcast(pr, cx, 1);
474 acpi_cstate_enter(cx); 480 acpi_cstate_enter(cx);
@@ -479,17 +485,22 @@ static void acpi_processor_idle(void)
479 /* TSC halts in C2, so notify users */ 485 /* TSC halts in C2, so notify users */
480 mark_tsc_unstable("possible TSC halt in C2"); 486 mark_tsc_unstable("possible TSC halt in C2");
481#endif 487#endif
488 /* Compute time (ticks) that we were actually asleep */
489 sleep_ticks = ticks_elapsed(t1, t2);
490
491 /* Tell the scheduler how much we idled: */
492 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
493
482 /* Re-enable interrupts */ 494 /* Re-enable interrupts */
483 local_irq_enable(); 495 local_irq_enable();
496 /* Do not account our idle-switching overhead: */
497 sleep_ticks -= cx->latency_ticks + C2_OVERHEAD;
498
484 current_thread_info()->status |= TS_POLLING; 499 current_thread_info()->status |= TS_POLLING;
485 /* Compute time (ticks) that we were actually asleep */
486 sleep_ticks =
487 ticks_elapsed(t1, t2) - cx->latency_ticks - C2_OVERHEAD;
488 acpi_state_timer_broadcast(pr, cx, 0); 500 acpi_state_timer_broadcast(pr, cx, 0);
489 break; 501 break;
490 502
491 case ACPI_STATE_C3: 503 case ACPI_STATE_C3:
492
493 /* 504 /*
494 * disable bus master 505 * disable bus master
495 * bm_check implies we need ARB_DIS 506 * bm_check implies we need ARB_DIS
@@ -518,6 +529,8 @@ static void acpi_processor_idle(void)
518 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); 529 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
519 /* Invoke C3 */ 530 /* Invoke C3 */
520 acpi_state_timer_broadcast(pr, cx, 1); 531 acpi_state_timer_broadcast(pr, cx, 1);
532 /* Tell the scheduler that we are going deep-idle: */
533 sched_clock_idle_sleep_event();
521 acpi_cstate_enter(cx); 534 acpi_cstate_enter(cx);
522 /* Get end time (ticks) */ 535 /* Get end time (ticks) */
523 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); 536 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -531,12 +544,17 @@ static void acpi_processor_idle(void)
531 /* TSC halts in C3, so notify users */ 544 /* TSC halts in C3, so notify users */
532 mark_tsc_unstable("TSC halts in C3"); 545 mark_tsc_unstable("TSC halts in C3");
533#endif 546#endif
547 /* Compute time (ticks) that we were actually asleep */
548 sleep_ticks = ticks_elapsed(t1, t2);
549 /* Tell the scheduler how much we idled: */
550 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
551
534 /* Re-enable interrupts */ 552 /* Re-enable interrupts */
535 local_irq_enable(); 553 local_irq_enable();
554 /* Do not account our idle-switching overhead: */
555 sleep_ticks -= cx->latency_ticks + C3_OVERHEAD;
556
536 current_thread_info()->status |= TS_POLLING; 557 current_thread_info()->status |= TS_POLLING;
537 /* Compute time (ticks) that we were actually asleep */
538 sleep_ticks =
539 ticks_elapsed(t1, t2) - cx->latency_ticks - C3_OVERHEAD;
540 acpi_state_timer_broadcast(pr, cx, 0); 558 acpi_state_timer_broadcast(pr, cx, 0);
541 break; 559 break;
542 560
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index a78832ea81fa..071d274afaab 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -436,7 +436,7 @@ static const struct piix_map_db ich8_map_db = {
436 /* PM PS SM SS MAP */ 436 /* PM PS SM SS MAP */
437 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ 437 { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */
438 { RV, RV, RV, RV }, 438 { RV, RV, RV, RV },
439 { IDE, IDE, NA, NA }, /* 10b (IDE mode) */ 439 { P0, P2, IDE, IDE }, /* 10b (IDE mode) */
440 { RV, RV, RV, RV }, 440 { RV, RV, RV, RV },
441 }, 441 },
442}; 442};
@@ -901,6 +901,13 @@ static int piix_broken_suspend(void)
901 }, 901 },
902 }, 902 },
903 { 903 {
904 .ident = "TECRA M7",
905 .matches = {
906 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
907 DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M7"),
908 },
909 },
910 {
904 .ident = "Satellite U205", 911 .ident = "Satellite U205",
905 .matches = { 912 .matches = {
906 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), 913 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 60e78bef469f..2ad4dda6d4a7 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1723,7 +1723,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1723 tf.protocol = ATA_PROT_NODATA; 1723 tf.protocol = ATA_PROT_NODATA;
1724 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 1724 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1725 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); 1725 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
1726 if (err_mask) { 1726 if (err_mask && id[2] != 0x738c) {
1727 rc = -EIO; 1727 rc = -EIO;
1728 reason = "SPINUP failed"; 1728 reason = "SPINUP failed";
1729 goto err_out; 1729 goto err_out;
@@ -3700,11 +3700,16 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int readid_flags)
3700 goto fail; 3700 goto fail;
3701 3701
3702 /* verify n_sectors hasn't changed */ 3702 /* verify n_sectors hasn't changed */
3703 if (dev->class == ATA_DEV_ATA && dev->n_sectors != n_sectors) { 3703 if (dev->class == ATA_DEV_ATA && n_sectors &&
3704 dev->n_sectors != n_sectors) {
3704 ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch " 3705 ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
3705 "%llu != %llu\n", 3706 "%llu != %llu\n",
3706 (unsigned long long)n_sectors, 3707 (unsigned long long)n_sectors,
3707 (unsigned long long)dev->n_sectors); 3708 (unsigned long long)dev->n_sectors);
3709
3710 /* restore original n_sectors */
3711 dev->n_sectors = n_sectors;
3712
3708 rc = -ENODEV; 3713 rc = -ENODEV;
3709 goto fail; 3714 goto fail;
3710 } 3715 }
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c
index ce589d96ca42..b5352ebecef9 100644
--- a/drivers/ata/pata_artop.c
+++ b/drivers/ata/pata_artop.c
@@ -2,6 +2,7 @@
2 * pata_artop.c - ARTOP ATA controller driver 2 * pata_artop.c - ARTOP ATA controller driver
3 * 3 *
4 * (C) 2006 Red Hat <alan@redhat.com> 4 * (C) 2006 Red Hat <alan@redhat.com>
5 * (C) 2007 Bartlomiej Zolnierkiewicz
5 * 6 *
6 * Based in part on drivers/ide/pci/aec62xx.c 7 * Based in part on drivers/ide/pci/aec62xx.c
7 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
@@ -28,7 +29,7 @@
28#include <linux/ata.h> 29#include <linux/ata.h>
29 30
30#define DRV_NAME "pata_artop" 31#define DRV_NAME "pata_artop"
31#define DRV_VERSION "0.4.3" 32#define DRV_VERSION "0.4.4"
32 33
33/* 34/*
34 * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we 35 * The ARTOP has 33 Mhz and "over clocked" timing tables. Until we
@@ -430,7 +431,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
430 .udma_mask = ATA_UDMA4, 431 .udma_mask = ATA_UDMA4,
431 .port_ops = &artop6260_ops, 432 .port_ops = &artop6260_ops,
432 }; 433 };
433 static const struct ata_port_info info_626x_fast = { 434 static const struct ata_port_info info_628x = {
434 .sht = &artop_sht, 435 .sht = &artop_sht,
435 .flags = ATA_FLAG_SLAVE_POSS, 436 .flags = ATA_FLAG_SLAVE_POSS,
436 .pio_mask = 0x1f, /* pio0-4 */ 437 .pio_mask = 0x1f, /* pio0-4 */
@@ -438,6 +439,14 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
438 .udma_mask = ATA_UDMA5, 439 .udma_mask = ATA_UDMA5,
439 .port_ops = &artop6260_ops, 440 .port_ops = &artop6260_ops,
440 }; 441 };
442 static const struct ata_port_info info_628x_fast = {
443 .sht = &artop_sht,
444 .flags = ATA_FLAG_SLAVE_POSS,
445 .pio_mask = 0x1f, /* pio0-4 */
446 .mwdma_mask = 0x07, /* mwdma0-2 */
447 .udma_mask = ATA_UDMA6,
448 .port_ops = &artop6260_ops,
449 };
441 const struct ata_port_info *ppi[] = { NULL, NULL }; 450 const struct ata_port_info *ppi[] = { NULL, NULL };
442 451
443 if (!printed_version++) 452 if (!printed_version++)
@@ -455,13 +464,13 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id)
455 } 464 }
456 else if (id->driver_data == 1) /* 6260 */ 465 else if (id->driver_data == 1) /* 6260 */
457 ppi[0] = &info_626x; 466 ppi[0] = &info_626x;
458 else if (id->driver_data == 2) { /* 6260 or 6260 + fast */ 467 else if (id->driver_data == 2) { /* 6280 or 6280 + fast */
459 unsigned long io = pci_resource_start(pdev, 4); 468 unsigned long io = pci_resource_start(pdev, 4);
460 u8 reg; 469 u8 reg;
461 470
462 ppi[0] = &info_626x; 471 ppi[0] = &info_628x;
463 if (inb(io) & 0x10) 472 if (inb(io) & 0x10)
464 ppi[0] = &info_626x_fast; 473 ppi[0] = &info_628x_fast;
465 /* Mac systems come up with some registers not set as we 474 /* Mac systems come up with some registers not set as we
466 will need them */ 475 will need them */
467 476
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 84d9c5568567..c5ddd937dbf2 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -8,12 +8,10 @@
8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
9 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 9 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
10 * Portions Copyright (C) 2003 Red Hat Inc 10 * Portions Copyright (C) 2003 Red Hat Inc
11 * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. 11 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
12 * 12 *
13 * TODO 13 * TODO
14 * PLL mode 14 * Look into engine reset on timeout errors. Should not be required.
15 * Look into engine reset on timeout errors. Should not be
16 * required.
17 */ 15 */
18 16
19#include <linux/kernel.h> 17#include <linux/kernel.h>
@@ -26,7 +24,7 @@
26#include <linux/libata.h> 24#include <linux/libata.h>
27 25
28#define DRV_NAME "pata_hpt37x" 26#define DRV_NAME "pata_hpt37x"
29#define DRV_VERSION "0.6.7" 27#define DRV_VERSION "0.6.9"
30 28
31struct hpt_clock { 29struct hpt_clock {
32 u8 xfer_speed; 30 u8 xfer_speed;
@@ -1092,9 +1090,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1092 int dpll, adjust; 1090 int dpll, adjust;
1093 1091
1094 /* Compute DPLL */ 1092 /* Compute DPLL */
1095 dpll = 2; 1093 dpll = (port->udma_mask & 0xC0) ? 3 : 2;
1096 if (port->udma_mask & 0xE0)
1097 dpll = 3;
1098 1094
1099 f_low = (MHz[clock_slot] * 48) / MHz[dpll]; 1095 f_low = (MHz[clock_slot] * 48) / MHz[dpll];
1100 f_high = f_low + 2; 1096 f_high = f_low + 2;
@@ -1116,7 +1112,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1116 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); 1112 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100);
1117 } 1113 }
1118 if (adjust == 8) { 1114 if (adjust == 8) {
1119 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n"); 1115 printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n");
1120 return -ENODEV; 1116 return -ENODEV;
1121 } 1117 }
1122 if (dpll == 3) 1118 if (dpll == 3)
@@ -1124,7 +1120,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1124 else 1120 else
1125 private_data = (void *)hpt37x_timings_50; 1121 private_data = (void *)hpt37x_timings_50;
1126 1122
1127 printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[dpll]); 1123 printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using %dMHz DPLL.\n",
1124 MHz[clock_slot], MHz[dpll]);
1128 } else { 1125 } else {
1129 private_data = (void *)chip_table->clocks[clock_slot]; 1126 private_data = (void *)chip_table->clocks[clock_slot];
1130 /* 1127 /*
@@ -1137,7 +1134,8 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1137 port = &info_hpt370_33; 1134 port = &info_hpt370_33;
1138 if (clock_slot < 2 && port == &info_hpt370a) 1135 if (clock_slot < 2 && port == &info_hpt370a)
1139 port = &info_hpt370a_33; 1136 port = &info_hpt370a_33;
1140 printk(KERN_INFO "hpt37x: %s: Bus clock %dMHz.\n", chip_table->name, MHz[clock_slot]); 1137 printk(KERN_INFO "pata_hpt37x: %s using %dMHz bus clock.\n",
1138 chip_table->name, MHz[clock_slot]);
1141 } 1139 }
1142 1140
1143 /* Now kick off ATA set up */ 1141 /* Now kick off ATA set up */
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
index aa29cde09f8b..f8f234bfc8ce 100644
--- a/drivers/ata/pata_hpt3x2n.c
+++ b/drivers/ata/pata_hpt3x2n.c
@@ -8,7 +8,7 @@
8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 8 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
9 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 9 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
10 * Portions Copyright (C) 2003 Red Hat Inc 10 * Portions Copyright (C) 2003 Red Hat Inc
11 * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. 11 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
12 * 12 *
13 * 13 *
14 * TODO 14 * TODO
@@ -25,7 +25,7 @@
25#include <linux/libata.h> 25#include <linux/libata.h>
26 26
27#define DRV_NAME "pata_hpt3x2n" 27#define DRV_NAME "pata_hpt3x2n"
28#define DRV_VERSION "0.3.3" 28#define DRV_VERSION "0.3.4"
29 29
30enum { 30enum {
31 HPT_PCI_FAST = (1 << 31), 31 HPT_PCI_FAST = (1 << 31),
@@ -579,10 +579,12 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
579 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low); 579 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
580 } 580 }
581 if (adjust == 8) { 581 if (adjust == 8) {
582 printk(KERN_WARNING "hpt3x2n: DPLL did not stabilize.\n"); 582 printk(KERN_ERR "pata_hpt3x2n: DPLL did not stabilize!\n");
583 return -ENODEV; 583 return -ENODEV;
584 } 584 }
585 585
586 printk(KERN_INFO "pata_hpt37x: bus clock %dMHz, using 66MHz DPLL.\n",
587 pci_mhz);
586 /* Set our private data up. We only need a few flags so we use 588 /* Set our private data up. We only need a few flags so we use
587 it directly */ 589 it directly */
588 port.private_data = NULL; 590 port.private_data = NULL;
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 5525518204e6..91a396fa5b20 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -139,6 +139,8 @@ static struct pnp_device_id isapnp_devices[] = {
139 {.id = ""} 139 {.id = ""}
140}; 140};
141 141
142MODULE_DEVICE_TABLE(pnp, isapnp_devices);
143
142static struct pnp_driver isapnp_driver = { 144static struct pnp_driver isapnp_driver = {
143 .name = DRV_NAME, 145 .name = DRV_NAME,
144 .id_table = isapnp_devices, 146 .id_table = isapnp_devices,
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 430673be1df7..7225124d96c2 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -587,7 +587,7 @@ static int it821x_port_start(struct ata_port *ap)
587 itdev->want[1][1] = ATA_ANY; 587 itdev->want[1][1] = ATA_ANY;
588 itdev->last_device = -1; 588 itdev->last_device = -1;
589 589
590 if (pdev->revision == 0x11) { 590 if (pdev->revision == 0x10) {
591 itdev->timing10 = 1; 591 itdev->timing10 = 1;
592 /* Need to disable ATAPI DMA for this case */ 592 /* Need to disable ATAPI DMA for this case */
593 if (!itdev->smart) 593 if (!itdev->smart)
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c
index 69a5aa4949f5..e3245b36269a 100644
--- a/drivers/ata/pata_pdc2027x.c
+++ b/drivers/ata/pata_pdc2027x.c
@@ -563,13 +563,13 @@ static long pdc_read_counter(struct ata_host *host)
563 u32 bccrl, bccrh, bccrlv, bccrhv; 563 u32 bccrl, bccrh, bccrlv, bccrhv;
564 564
565retry: 565retry:
566 bccrl = readl(mmio_base + PDC_BYTE_COUNT) & 0xffff; 566 bccrl = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff;
567 bccrh = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0xffff; 567 bccrh = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff;
568 rmb(); 568 rmb();
569 569
570 /* Read the counter values again for verification */ 570 /* Read the counter values again for verification */
571 bccrlv = readl(mmio_base + PDC_BYTE_COUNT) & 0xffff; 571 bccrlv = readl(mmio_base + PDC_BYTE_COUNT) & 0x7fff;
572 bccrhv = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0xffff; 572 bccrhv = readl(mmio_base + PDC_BYTE_COUNT + 0x100) & 0x7fff;
573 rmb(); 573 rmb();
574 574
575 counter = (bccrh << 15) | bccrl; 575 counter = (bccrh << 15) | bccrl;
@@ -692,16 +692,16 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
692 struct timeval start_time, end_time; 692 struct timeval start_time, end_time;
693 long pll_clock, usec_elapsed; 693 long pll_clock, usec_elapsed;
694 694
695 /* Read current counter value */
696 start_count = pdc_read_counter(host);
697 do_gettimeofday(&start_time);
698
699 /* Start the test mode */ 695 /* Start the test mode */
700 scr = readl(mmio_base + PDC_SYS_CTL); 696 scr = readl(mmio_base + PDC_SYS_CTL);
701 PDPRINTK("scr[%X]\n", scr); 697 PDPRINTK("scr[%X]\n", scr);
702 writel(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL); 698 writel(scr | (0x01 << 14), mmio_base + PDC_SYS_CTL);
703 readl(mmio_base + PDC_SYS_CTL); /* flush */ 699 readl(mmio_base + PDC_SYS_CTL); /* flush */
704 700
701 /* Read current counter value */
702 start_count = pdc_read_counter(host);
703 do_gettimeofday(&start_time);
704
705 /* Let the counter run for 100 ms. */ 705 /* Let the counter run for 100 ms. */
706 mdelay(100); 706 mdelay(100);
707 707
@@ -719,7 +719,7 @@ static long pdc_detect_pll_input_clock(struct ata_host *host)
719 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 + 719 usec_elapsed = (end_time.tv_sec - start_time.tv_sec) * 1000000 +
720 (end_time.tv_usec - start_time.tv_usec); 720 (end_time.tv_usec - start_time.tv_usec);
721 721
722 pll_clock = (start_count - end_count) / 100 * 722 pll_clock = ((start_count - end_count) & 0x3fffffff) / 100 *
723 (100000000 / usec_elapsed); 723 (100000000 / usec_elapsed);
724 724
725 PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count); 725 PDPRINTK("start[%ld] end[%ld] \n", start_count, end_count);
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 66bd0e83ac07..2bd7645f1a88 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -54,6 +54,7 @@ struct sis_laptop {
54static const struct sis_laptop sis_laptop[] = { 54static const struct sis_laptop sis_laptop[] = {
55 /* devid, subvendor, subdev */ 55 /* devid, subvendor, subdev */
56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 56 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
57 { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */
57 /* end marker */ 58 /* end marker */
58 { 0, } 59 { 0, }
59}; 60};
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index f645fe22cd1e..ea18e33f50ef 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -63,7 +63,7 @@
63#include <linux/dmi.h> 63#include <linux/dmi.h>
64 64
65#define DRV_NAME "pata_via" 65#define DRV_NAME "pata_via"
66#define DRV_VERSION "0.3.1" 66#define DRV_VERSION "0.3.2"
67 67
68/* 68/*
69 * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx 69 * The following comes directly from Vojtech Pavlik's ide/pci/via82cxxx
@@ -144,6 +144,9 @@ static int via_cable_override(struct pci_dev *pdev)
144 /* Systems by DMI */ 144 /* Systems by DMI */
145 if (dmi_check_system(cable_dmi_table)) 145 if (dmi_check_system(cable_dmi_table))
146 return 1; 146 return 1;
147 /* Arima W730-K8/Targa Visionary 811/... */
148 if (pdev->subsystem_vendor == 0x161F && pdev->subsystem_device == 0x2032)
149 return 1;
147 return 0; 150 return 0;
148} 151}
149 152
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 8ec520885b95..3acf65e75eb2 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -621,6 +621,9 @@ static const struct pci_device_id mv_pci_tbl[] = {
621 { PCI_VDEVICE(MARVELL, 0x5041), chip_504x }, 621 { PCI_VDEVICE(MARVELL, 0x5041), chip_504x },
622 { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 }, 622 { PCI_VDEVICE(MARVELL, 0x5080), chip_5080 },
623 { PCI_VDEVICE(MARVELL, 0x5081), chip_508x }, 623 { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
624 /* RocketRAID 1740/174x have different identifiers */
625 { PCI_VDEVICE(TTI, 0x1740), chip_508x },
626 { PCI_VDEVICE(TTI, 0x1742), chip_508x },
624 627
625 { PCI_VDEVICE(MARVELL, 0x6040), chip_604x }, 628 { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
626 { PCI_VDEVICE(MARVELL, 0x6041), chip_604x }, 629 { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
index bed9f58c2d5a..b554edac1ced 100644
--- a/drivers/atm/Kconfig
+++ b/drivers/atm/Kconfig
@@ -6,6 +6,11 @@ menuconfig ATM_DRIVERS
6 bool "ATM drivers" 6 bool "ATM drivers"
7 depends on NETDEVICES && ATM 7 depends on NETDEVICES && ATM
8 default y 8 default y
9 ---help---
10 Say Y here to get to see options for Asynchronous Transfer Mode
11 device drivers. This option alone does not add any kernel code.
12
13 If you say N, all options in this submenu will be skipped and disabled.
9 14
10if ATM_DRIVERS && NETDEVICES && ATM 15if ATM_DRIVERS && NETDEVICES && ATM
11 16
diff --git a/drivers/auxdisplay/Kconfig b/drivers/auxdisplay/Kconfig
index de2fcce10ba5..043353bd0600 100644
--- a/drivers/auxdisplay/Kconfig
+++ b/drivers/auxdisplay/Kconfig
@@ -8,6 +8,11 @@
8menuconfig AUXDISPLAY 8menuconfig AUXDISPLAY
9 depends on PARPORT 9 depends on PARPORT
10 bool "Auxiliary Display support" 10 bool "Auxiliary Display support"
11 ---help---
12 Say Y here to get to see options for auxiliary display drivers.
13 This option alone does not add any kernel code.
14
15 If you say N, all options in this submenu will be skipped and disabled.
11 16
12if AUXDISPLAY && PARPORT 17if AUXDISPLAY && PARPORT
13 18
diff --git a/drivers/auxdisplay/cfag12864b.c b/drivers/auxdisplay/cfag12864b.c
index cb44cb4f6a47..80bb06105387 100644
--- a/drivers/auxdisplay/cfag12864b.c
+++ b/drivers/auxdisplay/cfag12864b.c
@@ -355,7 +355,7 @@ static int __init cfag12864b_init(void)
355 355
356 cfag12864b_cache = kmalloc(sizeof(unsigned char) * 356 cfag12864b_cache = kmalloc(sizeof(unsigned char) *
357 CFAG12864B_SIZE, GFP_KERNEL); 357 CFAG12864B_SIZE, GFP_KERNEL);
358 if (cfag12864b_buffer == NULL) { 358 if (cfag12864b_cache == NULL) {
359 printk(KERN_ERR CFAG12864B_NAME ": ERROR: " 359 printk(KERN_ERR CFAG12864B_NAME ": ERROR: "
360 "can't alloc cache buffer (%i bytes)\n", 360 "can't alloc cache buffer (%i bytes)\n",
361 CFAG12864B_SIZE); 361 CFAG12864B_SIZE);
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index a4a311992408..4245b7f80a49 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -6,6 +6,12 @@ menuconfig BLK_DEV
6 bool "Block devices" 6 bool "Block devices"
7 depends on BLOCK 7 depends on BLOCK
8 default y 8 default y
9 ---help---
10 Say Y here to get to see options for various different block device
11 drivers. This option alone does not add any kernel code.
12
13 If you say N, all options in this submenu will be skipped and disabled;
14 only do this if you know what you are doing.
9 15
10if BLK_DEV 16if BLK_DEV
11 17
@@ -62,6 +68,7 @@ config AMIGA_Z2RAM
62config BLK_DEV_XD 68config BLK_DEV_XD
63 tristate "XT hard disk support" 69 tristate "XT hard disk support"
64 depends on ISA && ISA_DMA_API 70 depends on ISA && ISA_DMA_API
71 select CHECK_SIGNATURE
65 help 72 help
66 Very old 8 bit hard disk controllers used in the IBM XT computer 73 Very old 8 bit hard disk controllers used in the IBM XT computer
67 will be supported if you say Y here. 74 will be supported if you say Y here.
diff --git a/drivers/block/lguest_blk.c b/drivers/block/lguest_blk.c
index 93e3c4001bf5..160cf14431ac 100644
--- a/drivers/block/lguest_blk.c
+++ b/drivers/block/lguest_blk.c
@@ -308,9 +308,12 @@ static int lguestblk_probe(struct lguest_device *lgdev)
308 } 308 }
309 309
310 /* This allocates a "struct gendisk" where we pack all the information 310 /* This allocates a "struct gendisk" where we pack all the information
311 * about the disk which the rest of Linux sees. We ask for one minor 311 * about the disk which the rest of Linux sees. The argument is the
312 * number; I do wonder if we should be asking for more. */ 312 * number of minor devices desired: we need one minor for the main
313 bd->disk = alloc_disk(1); 313 * disk, and one for each partition. Of course, we can't possibly know
314 * how many partitions are on the disk (add_disk does that).
315 */
316 bd->disk = alloc_disk(16);
314 if (!bd->disk) { 317 if (!bd->disk) {
315 err = -ENOMEM; 318 err = -ENOMEM;
316 goto out_unregister_blkdev; 319 goto out_unregister_blkdev;
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 96d2f9ee42d6..9b07f7851061 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2292,7 +2292,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
2292 info->irq = irq_of_parse_and_map(dev->node, 0); 2292 info->irq = irq_of_parse_and_map(dev->node, 0);
2293 info->dev = &dev->dev; 2293 info->dev = &dev->dev;
2294 2294
2295 dev_dbg(&dev->dev, "addr 0x%lx regsize %ld spacing %ld irq %x\n", 2295 dev_dbg(&dev->dev, "addr 0x%lx regsize %d spacing %d irq %x\n",
2296 info->io.addr_data, info->io.regsize, info->io.regspacing, 2296 info->io.addr_data, info->io.regsize, info->io.regspacing,
2297 info->irq); 2297 info->irq);
2298 2298
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 2ce0af1bd588..d95f316afb5a 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -1022,10 +1022,6 @@ static const unsigned short x86_keycodes[256] =
1022 308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330, 1022 308,310,313,314,315,317,318,319,320,357,322,323,324,325,276,330,
1023 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 }; 1023 332,340,365,342,343,344,345,346,356,270,341,368,369,370,371,372 };
1024 1024
1025#ifdef CONFIG_MAC_EMUMOUSEBTN
1026extern int mac_hid_mouse_emulate_buttons(int, int, int);
1027#endif /* CONFIG_MAC_EMUMOUSEBTN */
1028
1029#ifdef CONFIG_SPARC 1025#ifdef CONFIG_SPARC
1030static int sparc_l1_a_state = 0; 1026static int sparc_l1_a_state = 0;
1031extern void sun_do_break(void); 1027extern void sun_do_break(void);
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
index bbb7f1292665..2f97d2f8f916 100644
--- a/drivers/char/synclink_gt.c
+++ b/drivers/char/synclink_gt.c
@@ -1565,6 +1565,9 @@ static int hdlcdev_open(struct net_device *dev)
1565 int rc; 1565 int rc;
1566 unsigned long flags; 1566 unsigned long flags;
1567 1567
1568 if (!try_module_get(THIS_MODULE))
1569 return -EBUSY;
1570
1568 DBGINFO(("%s hdlcdev_open\n", dev->name)); 1571 DBGINFO(("%s hdlcdev_open\n", dev->name));
1569 1572
1570 /* generic HDLC layer open processing */ 1573 /* generic HDLC layer open processing */
@@ -1634,6 +1637,7 @@ static int hdlcdev_close(struct net_device *dev)
1634 info->netcount=0; 1637 info->netcount=0;
1635 spin_unlock_irqrestore(&info->netlock, flags); 1638 spin_unlock_irqrestore(&info->netlock, flags);
1636 1639
1640 module_put(THIS_MODULE);
1637 return 0; 1641 return 0;
1638} 1642}
1639 1643
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 9bb542913b86..39564b76d4a3 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -7,7 +7,7 @@
7 * Reiner Sailer <sailer@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com>
9 * 9 *
10 * Maintained by: <tpmdd_devel@lists.sourceforge.net> 10 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
11 * 11 *
12 * Device driver for TCG/TCPA TPM (trusted platform module). 12 * Device driver for TCG/TCPA TPM (trusted platform module).
13 * Specifications at www.trustedcomputinggroup.org 13 * Specifications at www.trustedcomputinggroup.org
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index b2e2b002a1bb..d15ccddc92eb 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -7,7 +7,7 @@
7 * Reiner Sailer <sailer@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com>
9 * 9 *
10 * Maintained by: <tpmdd_devel@lists.sourceforge.net> 10 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
11 * 11 *
12 * Device driver for TCG/TCPA TPM (trusted platform module). 12 * Device driver for TCG/TCPA TPM (trusted platform module).
13 * Specifications at www.trustedcomputinggroup.org 13 * Specifications at www.trustedcomputinggroup.org
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index 1ab0896070be..d0e7926eb486 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -7,7 +7,7 @@
7 * Reiner Sailer <sailer@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com>
9 * 9 *
10 * Maintained by: <tpmdd_devel@lists.sourceforge.net> 10 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
11 * 11 *
12 * Device driver for TCG/TCPA TPM (trusted platform module). 12 * Device driver for TCG/TCPA TPM (trusted platform module).
13 * Specifications at www.trustedcomputinggroup.org 13 * Specifications at www.trustedcomputinggroup.org
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h
index 9363bcf0a402..6c831f9466b7 100644
--- a/drivers/char/tpm/tpm_atmel.h
+++ b/drivers/char/tpm/tpm_atmel.h
@@ -4,7 +4,7 @@
4 * Authors: 4 * Authors:
5 * Kylene Hall <kjhall@us.ibm.com> 5 * Kylene Hall <kjhall@us.ibm.com>
6 * 6 *
7 * Maintained by: <tpmdd_devel@lists.sourceforge.net> 7 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
8 * 8 *
9 * Device driver for TCG/TCPA TPM (trusted platform module). 9 * Device driver for TCG/TCPA TPM (trusted platform module).
10 * Specifications at www.trustedcomputinggroup.org 10 * Specifications at www.trustedcomputinggroup.org
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index 8677fc6a545e..60a2d2630e36 100644
--- a/drivers/char/tpm/tpm_bios.c
+++ b/drivers/char/tpm/tpm_bios.c
@@ -7,6 +7,8 @@
7 * Reiner Sailer <sailer@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com>
9 * 9 *
10 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
11 *
10 * Access to the eventlog extended by the TCG BIOS of PC platform 12 * Access to the eventlog extended by the TCG BIOS of PC platform
11 * 13 *
12 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index 608f73071bef..6313326bc41f 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -7,7 +7,7 @@
7 * Reiner Sailer <sailer@watson.ibm.com> 7 * Reiner Sailer <sailer@watson.ibm.com>
8 * Kylene Hall <kjhall@us.ibm.com> 8 * Kylene Hall <kjhall@us.ibm.com>
9 * 9 *
10 * Maintained by: <tpmdd_devel@lists.sourceforge.net> 10 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
11 * 11 *
12 * Device driver for TCG/TCPA TPM (trusted platform module). 12 * Device driver for TCG/TCPA TPM (trusted platform module).
13 * Specifications at www.trustedcomputinggroup.org 13 * Specifications at www.trustedcomputinggroup.org
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 483f3f60013c..23fa18a6654c 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -5,6 +5,8 @@
5 * Leendert van Doorn <leendert@watson.ibm.com> 5 * Leendert van Doorn <leendert@watson.ibm.com>
6 * Kylene Hall <kjhall@us.ibm.com> 6 * Kylene Hall <kjhall@us.ibm.com>
7 * 7 *
8 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
9 *
8 * Device driver for TCG/TCPA TPM (trusted platform module). 10 * Device driver for TCG/TCPA TPM (trusted platform module).
9 * Specifications at www.trustedcomputinggroup.org 11 * Specifications at www.trustedcomputinggroup.org
10 * 12 *
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 51ea93cab6c4..9c867cf6de64 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2063,8 +2063,7 @@ static int init_dev(struct tty_driver *driver, int idx,
2063 } 2063 }
2064 2064
2065 if (!*tp_loc) { 2065 if (!*tp_loc) {
2066 tp = (struct ktermios *) kmalloc(sizeof(struct ktermios), 2066 tp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
2067 GFP_KERNEL);
2068 if (!tp) 2067 if (!tp)
2069 goto free_mem_out; 2068 goto free_mem_out;
2070 *tp = driver->init_termios; 2069 *tp = driver->init_termios;
@@ -2094,8 +2093,7 @@ static int init_dev(struct tty_driver *driver, int idx,
2094 } 2093 }
2095 2094
2096 if (!*o_tp_loc) { 2095 if (!*o_tp_loc) {
2097 o_tp = (struct ktermios *) 2096 o_tp = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
2098 kmalloc(sizeof(struct ktermios), GFP_KERNEL);
2099 if (!o_tp) 2097 if (!o_tp)
2100 goto free_mem_out; 2098 goto free_mem_out;
2101 *o_tp = driver->other->init_termios; 2099 *o_tp = driver->other->init_termios;
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c
index e3f6a7d0c83d..c404fc69e7e6 100644
--- a/drivers/char/watchdog/alim1535_wdt.c
+++ b/drivers/char/watchdog/alim1535_wdt.c
@@ -312,6 +312,7 @@ static int ali_notify_sys(struct notifier_block *this, unsigned long code, void
312 */ 312 */
313 313
314static struct pci_device_id ali_pci_tbl[] = { 314static struct pci_device_id ali_pci_tbl[] = {
315 { PCI_VENDOR_ID_AL, 0x1533, PCI_ANY_ID, PCI_ANY_ID,},
315 { PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,}, 316 { PCI_VENDOR_ID_AL, 0x1535, PCI_ANY_ID, PCI_ANY_ID,},
316 { 0, }, 317 { 0, },
317}; 318};
@@ -329,9 +330,11 @@ static int __init ali_find_watchdog(void)
329 struct pci_dev *pdev; 330 struct pci_dev *pdev;
330 u32 wdog; 331 u32 wdog;
331 332
332 /* Check for a 1535 series bridge */ 333 /* Check for a 1533/1535 series bridge */
333 pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1535, NULL); 334 pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1535, NULL);
334 if(pdev == NULL) 335 if (pdev == NULL)
336 pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1533, NULL);
337 if (pdev == NULL)
335 return -ENODEV; 338 return -ENODEV;
336 pci_dev_put(pdev); 339 pci_dev_put(pdev);
337 340
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/char/watchdog/eurotechwdt.c
index b070324e27a6..b14e9d1f164d 100644
--- a/drivers/char/watchdog/eurotechwdt.c
+++ b/drivers/char/watchdog/eurotechwdt.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Eurotech CPU-1220/1410 on board WDT driver 2 * Eurotech CPU-1220/1410/1420 on board WDT driver
3 * 3 *
4 * (c) Copyright 2001 Ascensit <support@ascensit.com> 4 * (c) Copyright 2001 Ascensit <support@ascensit.com>
5 * (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com> 5 * (c) Copyright 2001 Rodolfo Giometti <giometti@ascensit.com>
@@ -25,6 +25,9 @@
25 25
26/* Changelog: 26/* Changelog:
27 * 27 *
28 * 2001 - Rodolfo Giometti
29 * Initial release
30 *
28 * 2002/04/25 - Rob Radez 31 * 2002/04/25 - Rob Radez
29 * clean up #includes 32 * clean up #includes
30 * clean up locking 33 * clean up locking
@@ -33,13 +36,15 @@
33 * add WDIOC_GETSTATUS and WDIOC_SETOPTIONS ioctls 36 * add WDIOC_GETSTATUS and WDIOC_SETOPTIONS ioctls
34 * add expect_close support 37 * add expect_close support
35 * 38 *
36 * 2001 - Rodolfo Giometti
37 * Initial release
38 *
39 * 2002.05.30 - Joel Becker <joel.becker@oracle.com> 39 * 2002.05.30 - Joel Becker <joel.becker@oracle.com>
40 * Added Matt Domsch's nowayout module option. 40 * Added Matt Domsch's nowayout module option.
41 */ 41 */
42 42
43/*
44 * The eurotech CPU-1220/1410/1420's watchdog is a part
45 * of the on-board SUPER I/O device SMSC FDC 37B782.
46 */
47
43#include <linux/interrupt.h> 48#include <linux/interrupt.h>
44#include <linux/module.h> 49#include <linux/module.h>
45#include <linux/moduleparam.h> 50#include <linux/moduleparam.h>
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
index 84ebfcc1ffb4..c0fc4aeb8596 100644
--- a/drivers/crypto/Kconfig
+++ b/drivers/crypto/Kconfig
@@ -2,6 +2,11 @@
2menuconfig CRYPTO_HW 2menuconfig CRYPTO_HW
3 bool "Hardware crypto devices" 3 bool "Hardware crypto devices"
4 default y 4 default y
5 ---help---
6 Say Y here to get to see options for hardware crypto devices and
7 processors. This option alone does not add any kernel code.
8
9 If you say N, all options in this submenu will be skipped and disabled.
5 10
6if CRYPTO_HW 11if CRYPTO_HW
7 12
diff --git a/drivers/dma/ioatdma.c b/drivers/dma/ioatdma.c
index 5fbe56b5cea0..2d1f17865b64 100644
--- a/drivers/dma/ioatdma.c
+++ b/drivers/dma/ioatdma.c
@@ -347,8 +347,7 @@ ioat_dma_prep_memcpy(struct dma_chan *chan, size_t len, int int_en)
347 new->async_tx.ack = 0; /* client is in control of this ack */ 347 new->async_tx.ack = 0; /* client is in control of this ack */
348 new->async_tx.cookie = -EBUSY; 348 new->async_tx.cookie = -EBUSY;
349 349
350 pci_unmap_len_set(new, src_len, orig_len); 350 pci_unmap_len_set(new, len, orig_len);
351 pci_unmap_len_set(new, dst_len, orig_len);
352 spin_unlock_bh(&ioat_chan->desc_lock); 351 spin_unlock_bh(&ioat_chan->desc_lock);
353 352
354 return new ? &new->async_tx : NULL; 353 return new ? &new->async_tx : NULL;
@@ -423,11 +422,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *chan)
423 */ 422 */
424 pci_unmap_page(chan->device->pdev, 423 pci_unmap_page(chan->device->pdev,
425 pci_unmap_addr(desc, dst), 424 pci_unmap_addr(desc, dst),
426 pci_unmap_len(desc, dst_len), 425 pci_unmap_len(desc, len),
427 PCI_DMA_FROMDEVICE); 426 PCI_DMA_FROMDEVICE);
428 pci_unmap_page(chan->device->pdev, 427 pci_unmap_page(chan->device->pdev,
429 pci_unmap_addr(desc, src), 428 pci_unmap_addr(desc, src),
430 pci_unmap_len(desc, src_len), 429 pci_unmap_len(desc, len),
431 PCI_DMA_TODEVICE); 430 PCI_DMA_TODEVICE);
432 } 431 }
433 432
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index d3726478031a..bf4dad70e0f5 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -111,10 +111,9 @@ struct ioat_desc_sw {
111 struct ioat_dma_descriptor *hw; 111 struct ioat_dma_descriptor *hw;
112 struct list_head node; 112 struct list_head node;
113 int tx_cnt; 113 int tx_cnt;
114 DECLARE_PCI_UNMAP_LEN(len)
114 DECLARE_PCI_UNMAP_ADDR(src) 115 DECLARE_PCI_UNMAP_ADDR(src)
115 DECLARE_PCI_UNMAP_LEN(src_len)
116 DECLARE_PCI_UNMAP_ADDR(dst) 116 DECLARE_PCI_UNMAP_ADDR(dst)
117 DECLARE_PCI_UNMAP_LEN(dst_len)
118 struct dma_async_tx_descriptor async_tx; 117 struct dma_async_tx_descriptor async_tx;
119}; 118};
120 119
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 3b63b0b78122..19667fcc722a 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -5,6 +5,11 @@ menuconfig HID_SUPPORT
5 bool "HID Devices" 5 bool "HID Devices"
6 depends on INPUT 6 depends on INPUT
7 default y 7 default y
8 ---help---
9 Say Y here to get to see options for various computer-human interface
10 device drivers. This option alone does not add any kernel code.
11
12 If you say N, all options in this submenu will be skipped and disabled.
8 13
9if HID_SUPPORT 14if HID_SUPPORT
10 15
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c
index 338ee4f54614..d3181967f167 100644
--- a/drivers/hwmon/smsc47m1.c
+++ b/drivers/hwmon/smsc47m1.c
@@ -585,6 +585,8 @@ static int __devinit smsc47m1_probe(struct platform_device *pdev)
585 585
586 if ((err = device_create_file(dev, &dev_attr_alarms))) 586 if ((err = device_create_file(dev, &dev_attr_alarms)))
587 goto error_remove_files; 587 goto error_remove_files;
588 if ((err = device_create_file(dev, &dev_attr_name)))
589 goto error_remove_files;
588 590
589 data->class_dev = hwmon_device_register(dev); 591 data->class_dev = hwmon_device_register(dev);
590 if (IS_ERR(data->class_dev)) { 592 if (IS_ERR(data->class_dev)) {
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
index c51ae2e17758..d9a9ec7dd84a 100644
--- a/drivers/hwmon/w83627ehf.c
+++ b/drivers/hwmon/w83627ehf.c
@@ -309,18 +309,16 @@ static inline int is_word_sized(u16 reg)
309 || (reg & 0x00ff) == 0x55)); 309 || (reg & 0x00ff) == 0x55));
310} 310}
311 311
312/* We assume that the default bank is 0, thus the following two functions do 312/* Registers 0x50-0x5f are banked */
313 nothing for registers which live in bank 0. For others, they respectively
314 set the bank register to the correct value (before the register is
315 accessed), and back to 0 (afterwards). */
316static inline void w83627ehf_set_bank(struct w83627ehf_data *data, u16 reg) 313static inline void w83627ehf_set_bank(struct w83627ehf_data *data, u16 reg)
317{ 314{
318 if (reg & 0xff00) { 315 if ((reg & 0x00f0) == 0x50) {
319 outb_p(W83627EHF_REG_BANK, data->addr + ADDR_REG_OFFSET); 316 outb_p(W83627EHF_REG_BANK, data->addr + ADDR_REG_OFFSET);
320 outb_p(reg >> 8, data->addr + DATA_REG_OFFSET); 317 outb_p(reg >> 8, data->addr + DATA_REG_OFFSET);
321 } 318 }
322} 319}
323 320
321/* Not strictly necessary, but play it safe for now */
324static inline void w83627ehf_reset_bank(struct w83627ehf_data *data, u16 reg) 322static inline void w83627ehf_reset_bank(struct w83627ehf_data *data, u16 reg)
325{ 323{
326 if (reg & 0xff00) { 324 if (reg & 0xff00) {
@@ -421,6 +419,31 @@ static void w83627ehf_write_fan_div(struct w83627ehf_data *data, int nr)
421 } 419 }
422} 420}
423 421
422static void w83627ehf_update_fan_div(struct w83627ehf_data *data)
423{
424 int i;
425
426 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1);
427 data->fan_div[0] = (i >> 4) & 0x03;
428 data->fan_div[1] = (i >> 6) & 0x03;
429 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV2);
430 data->fan_div[2] = (i >> 6) & 0x03;
431 i = w83627ehf_read_value(data, W83627EHF_REG_VBAT);
432 data->fan_div[0] |= (i >> 3) & 0x04;
433 data->fan_div[1] |= (i >> 4) & 0x04;
434 data->fan_div[2] |= (i >> 5) & 0x04;
435 if (data->has_fan & ((1 << 3) | (1 << 4))) {
436 i = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
437 data->fan_div[3] = i & 0x03;
438 data->fan_div[4] = ((i >> 2) & 0x03)
439 | ((i >> 5) & 0x04);
440 }
441 if (data->has_fan & (1 << 3)) {
442 i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT);
443 data->fan_div[3] |= (i >> 5) & 0x04;
444 }
445}
446
424static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) 447static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
425{ 448{
426 struct w83627ehf_data *data = dev_get_drvdata(dev); 449 struct w83627ehf_data *data = dev_get_drvdata(dev);
@@ -432,25 +455,7 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev)
432 if (time_after(jiffies, data->last_updated + HZ + HZ/2) 455 if (time_after(jiffies, data->last_updated + HZ + HZ/2)
433 || !data->valid) { 456 || !data->valid) {
434 /* Fan clock dividers */ 457 /* Fan clock dividers */
435 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1); 458 w83627ehf_update_fan_div(data);
436 data->fan_div[0] = (i >> 4) & 0x03;
437 data->fan_div[1] = (i >> 6) & 0x03;
438 i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV2);
439 data->fan_div[2] = (i >> 6) & 0x03;
440 i = w83627ehf_read_value(data, W83627EHF_REG_VBAT);
441 data->fan_div[0] |= (i >> 3) & 0x04;
442 data->fan_div[1] |= (i >> 4) & 0x04;
443 data->fan_div[2] |= (i >> 5) & 0x04;
444 if (data->has_fan & ((1 << 3) | (1 << 4))) {
445 i = w83627ehf_read_value(data, W83627EHF_REG_DIODE);
446 data->fan_div[3] = i & 0x03;
447 data->fan_div[4] = ((i >> 2) & 0x03)
448 | ((i >> 5) & 0x04);
449 }
450 if (data->has_fan & (1 << 3)) {
451 i = w83627ehf_read_value(data, W83627EHF_REG_SMI_OVT);
452 data->fan_div[3] |= (i >> 5) & 0x04;
453 }
454 459
455 /* Measured voltages and limits */ 460 /* Measured voltages and limits */
456 for (i = 0; i < data->in_num; i++) { 461 for (i = 0; i < data->in_num; i++) {
@@ -1312,6 +1317,9 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
1312 if (!(i & (1 << 1)) && (!fan5pin)) 1317 if (!(i & (1 << 1)) && (!fan5pin))
1313 data->has_fan |= (1 << 4); 1318 data->has_fan |= (1 << 4);
1314 1319
1320 /* Read fan clock dividers immediately */
1321 w83627ehf_update_fan_div(data);
1322
1315 /* Register sysfs hooks */ 1323 /* Register sysfs hooks */
1316 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++) 1324 for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays); i++)
1317 if ((err = device_create_file(dev, 1325 if ((err = device_create_file(dev,
diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c
index f85b48fea1c4..c95909cc1d21 100644
--- a/drivers/hwmon/w83781d.c
+++ b/drivers/hwmon/w83781d.c
@@ -740,9 +740,9 @@ store_sensor(struct device *dev, struct device_attribute *da,
740static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR, 740static SENSOR_DEVICE_ATTR(temp1_type, S_IRUGO | S_IWUSR,
741 show_sensor, store_sensor, 0); 741 show_sensor, store_sensor, 0);
742static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR, 742static SENSOR_DEVICE_ATTR(temp2_type, S_IRUGO | S_IWUSR,
743 show_sensor, store_sensor, 0); 743 show_sensor, store_sensor, 1);
744static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR, 744static SENSOR_DEVICE_ATTR(temp3_type, S_IRUGO | S_IWUSR,
745 show_sensor, store_sensor, 0); 745 show_sensor, store_sensor, 2);
746 746
747/* I2C devices get this name attribute automatically, but for ISA devices 747/* I2C devices get this name attribute automatically, but for ISA devices
748 we must create it by ourselves. */ 748 we must create it by ourselves. */
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index e049f65bc3a2..7adb61bad6ad 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -304,9 +304,9 @@ comment "IDE chipset support/bugfixes"
304 304
305config IDE_GENERIC 305config IDE_GENERIC
306 tristate "generic/default IDE chipset support" 306 tristate "generic/default IDE chipset support"
307 default y 307 default H8300
308 help 308 help
309 If unsure, say Y. 309 If unsure, say N.
310 310
311config BLK_DEV_CMD640 311config BLK_DEV_CMD640
312 bool "CMD640 chipset bugfix/support" 312 bool "CMD640 chipset bugfix/support"
@@ -345,6 +345,7 @@ config BLK_DEV_CMD640_ENHANCED
345config BLK_DEV_IDEPNP 345config BLK_DEV_IDEPNP
346 bool "PNP EIDE support" 346 bool "PNP EIDE support"
347 depends on PNP 347 depends on PNP
348 select IDE_GENERIC
348 help 349 help
349 If you have a PnP (Plug and Play) compatible EIDE card and 350 If you have a PnP (Plug and Play) compatible EIDE card and
350 would like the kernel to automatically detect and activate 351 would like the kernel to automatically detect and activate
@@ -834,6 +835,7 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
834 835
835config IDE_ARM 836config IDE_ARM
836 def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) 837 def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
838 select IDE_GENERIC
837 839
838config BLK_DEV_IDE_ICSIDE 840config BLK_DEV_IDE_ICSIDE
839 tristate "ICS IDE interface support" 841 tristate "ICS IDE interface support"
@@ -867,6 +869,7 @@ config BLK_DEV_IDE_BAST
867config BLK_DEV_GAYLE 869config BLK_DEV_GAYLE
868 bool "Amiga Gayle IDE interface support" 870 bool "Amiga Gayle IDE interface support"
869 depends on AMIGA 871 depends on AMIGA
872 select IDE_GENERIC
870 help 873 help
871 This is the IDE driver for the Amiga Gayle IDE interface. It supports 874 This is the IDE driver for the Amiga Gayle IDE interface. It supports
872 both the `A1200 style' and `A4000 style' of the Gayle IDE interface, 875 both the `A1200 style' and `A4000 style' of the Gayle IDE interface,
@@ -898,6 +901,7 @@ config BLK_DEV_IDEDOUBLER
898config BLK_DEV_BUDDHA 901config BLK_DEV_BUDDHA
899 bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)" 902 bool "Buddha/Catweasel/X-Surf IDE interface support (EXPERIMENTAL)"
900 depends on ZORRO && EXPERIMENTAL 903 depends on ZORRO && EXPERIMENTAL
904 select IDE_GENERIC
901 help 905 help
902 This is the IDE driver for the IDE interfaces on the Buddha, 906 This is the IDE driver for the IDE interfaces on the Buddha,
903 Catweasel and X-Surf expansion boards. It supports up to two interfaces 907 Catweasel and X-Surf expansion boards. It supports up to two interfaces
@@ -910,6 +914,7 @@ config BLK_DEV_BUDDHA
910config BLK_DEV_FALCON_IDE 914config BLK_DEV_FALCON_IDE
911 bool "Falcon IDE interface support" 915 bool "Falcon IDE interface support"
912 depends on ATARI 916 depends on ATARI
917 select IDE_GENERIC
913 help 918 help
914 This is the IDE driver for the builtin IDE interface on the Atari 919 This is the IDE driver for the builtin IDE interface on the Atari
915 Falcon. Say Y if you have a Falcon and want to use IDE devices (hard 920 Falcon. Say Y if you have a Falcon and want to use IDE devices (hard
@@ -919,6 +924,7 @@ config BLK_DEV_FALCON_IDE
919config BLK_DEV_MAC_IDE 924config BLK_DEV_MAC_IDE
920 bool "Macintosh Quadra/Powerbook IDE interface support" 925 bool "Macintosh Quadra/Powerbook IDE interface support"
921 depends on MAC 926 depends on MAC
927 select IDE_GENERIC
922 help 928 help
923 This is the IDE driver for the builtin IDE interface on some m68k 929 This is the IDE driver for the builtin IDE interface on some m68k
924 Macintosh models. It supports both the `Quadra style' (used in 930 Macintosh models. It supports both the `Quadra style' (used in
@@ -932,6 +938,7 @@ config BLK_DEV_MAC_IDE
932config BLK_DEV_Q40IDE 938config BLK_DEV_Q40IDE
933 bool "Q40/Q60 IDE interface support" 939 bool "Q40/Q60 IDE interface support"
934 depends on Q40 940 depends on Q40
941 select IDE_GENERIC
935 help 942 help
936 Enable the on-board IDE controller in the Q40/Q60. This should 943 Enable the on-board IDE controller in the Q40/Q60. This should
937 normally be on; disable it only if you are running a custom hard 944 normally be on; disable it only if you are running a custom hard
@@ -940,6 +947,7 @@ config BLK_DEV_Q40IDE
940config BLK_DEV_MPC8xx_IDE 947config BLK_DEV_MPC8xx_IDE
941 bool "MPC8xx IDE support" 948 bool "MPC8xx IDE support"
942 depends on 8xx && IDE=y && BLK_DEV_IDE=y 949 depends on 8xx && IDE=y && BLK_DEV_IDE=y
950 select IDE_GENERIC
943 help 951 help
944 This option provides support for IDE on Motorola MPC8xx Systems. 952 This option provides support for IDE on Motorola MPC8xx Systems.
945 Please see 'Type of MPC8xx IDE interface' for details. 953 Please see 'Type of MPC8xx IDE interface' for details.
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index fbfea46a34f2..04636f7eaae7 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -718,6 +718,8 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio)
718 } 718 }
719 719
720 cris_ide_set_speed(TYPE_PIO, setup, strobe, hold); 720 cris_ide_set_speed(TYPE_PIO, setup, strobe, hold);
721
722 (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio);
721} 723}
722 724
723static int speed_cris_ide(ide_drive_t *drive, u8 speed) 725static int speed_cris_ide(ide_drive_t *drive, u8 speed)
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 5ce4216f72a2..eba1adbc1b6a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -481,6 +481,15 @@ static inline int idedisk_supports_lba48(const struct hd_driveid *id)
481 && id->lba_capacity_2; 481 && id->lba_capacity_2;
482} 482}
483 483
484/*
485 * Some disks report total number of sectors instead of
486 * maximum sector address. We list them here.
487 */
488static const struct drive_list_entry hpa_list[] = {
489 { "ST340823A", NULL },
490 { NULL, NULL }
491};
492
484static void idedisk_check_hpa(ide_drive_t *drive) 493static void idedisk_check_hpa(ide_drive_t *drive)
485{ 494{
486 unsigned long long capacity, set_max; 495 unsigned long long capacity, set_max;
@@ -492,6 +501,15 @@ static void idedisk_check_hpa(ide_drive_t *drive)
492 else 501 else
493 set_max = idedisk_read_native_max_address(drive); 502 set_max = idedisk_read_native_max_address(drive);
494 503
504 if (ide_in_drive_list(drive->id, hpa_list)) {
505 /*
506 * Since we are inclusive wrt to firmware revisions do this
507 * extra check and apply the workaround only when needed.
508 */
509 if (set_max == capacity + 1)
510 set_max--;
511 }
512
495 if (set_max <= capacity) 513 if (set_max <= capacity)
496 return; 514 return;
497 515
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 5fe1d72ab451..ff644a5e12cd 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -135,25 +135,6 @@ static const struct drive_list_entry drive_blacklist [] = {
135}; 135};
136 136
137/** 137/**
138 * ide_in_drive_list - look for drive in black/white list
139 * @id: drive identifier
140 * @drive_table: list to inspect
141 *
142 * Look for a drive in the blacklist and the whitelist tables
143 * Returns 1 if the drive is found in the table.
144 */
145
146int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
147{
148 for ( ; drive_table->id_model ; drive_table++)
149 if ((!strcmp(drive_table->id_model, id->model)) &&
150 (!drive_table->id_firmware ||
151 strstr(id->fw_rev, drive_table->id_firmware)))
152 return 1;
153 return 0;
154}
155
156/**
157 * ide_dma_intr - IDE DMA interrupt handler 138 * ide_dma_intr - IDE DMA interrupt handler
158 * @drive: the drive the interrupt is for 139 * @drive: the drive the interrupt is for
159 * 140 *
@@ -349,9 +330,17 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
349 330
350static int config_drive_for_dma (ide_drive_t *drive) 331static int config_drive_for_dma (ide_drive_t *drive)
351{ 332{
333 ide_hwif_t *hwif = drive->hwif;
352 struct hd_driveid *id = drive->id; 334 struct hd_driveid *id = drive->id;
353 335
354 if ((id->capability & 1) && drive->hwif->autodma) { 336 /* consult the list of known "bad" drives */
337 if (__ide_dma_bad_drive(drive))
338 return -1;
339
340 if (drive->media != ide_disk && hwif->atapi_dma == 0)
341 return -1;
342
343 if ((id->capability & 1) && drive->autodma) {
355 /* 344 /*
356 * Enable DMA on any drive that has 345 * Enable DMA on any drive that has
357 * UltraDMA (mode 0/1/2/3/4/5/6) enabled 346 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
@@ -514,20 +503,6 @@ int __ide_dma_on (ide_drive_t *drive)
514EXPORT_SYMBOL(__ide_dma_on); 503EXPORT_SYMBOL(__ide_dma_on);
515 504
516/** 505/**
517 * __ide_dma_check - check DMA setup
518 * @drive: drive to check
519 *
520 * Don't use - due for extermination
521 */
522
523int __ide_dma_check (ide_drive_t *drive)
524{
525 return config_drive_for_dma(drive);
526}
527
528EXPORT_SYMBOL(__ide_dma_check);
529
530/**
531 * ide_dma_setup - begin a DMA phase 506 * ide_dma_setup - begin a DMA phase
532 * @drive: target device 507 * @drive: target device
533 * 508 *
@@ -1021,7 +996,7 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
1021 if (!hwif->dma_host_on) 996 if (!hwif->dma_host_on)
1022 hwif->dma_host_on = &ide_dma_host_on; 997 hwif->dma_host_on = &ide_dma_host_on;
1023 if (!hwif->ide_dma_check) 998 if (!hwif->ide_dma_check)
1024 hwif->ide_dma_check = &__ide_dma_check; 999 hwif->ide_dma_check = &config_drive_for_dma;
1025 if (!hwif->dma_setup) 1000 if (!hwif->dma_setup)
1026 hwif->dma_setup = &ide_dma_setup; 1001 hwif->dma_setup = &ide_dma_setup;
1027 if (!hwif->dma_exec_cmd) 1002 if (!hwif->dma_exec_cmd)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 92578b6832e9..f4cd2700cae5 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -565,6 +565,36 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 b
565 565
566EXPORT_SYMBOL(ide_wait_stat); 566EXPORT_SYMBOL(ide_wait_stat);
567 567
568/**
569 * ide_in_drive_list - look for drive in black/white list
570 * @id: drive identifier
571 * @drive_table: list to inspect
572 *
573 * Look for a drive in the blacklist and the whitelist tables
574 * Returns 1 if the drive is found in the table.
575 */
576
577int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table)
578{
579 for ( ; drive_table->id_model; drive_table++)
580 if ((!strcmp(drive_table->id_model, id->model)) &&
581 (!drive_table->id_firmware ||
582 strstr(id->fw_rev, drive_table->id_firmware)))
583 return 1;
584 return 0;
585}
586
587EXPORT_SYMBOL_GPL(ide_in_drive_list);
588
589/*
590 * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid.
591 * We list them here and depend on the device side cable detection for them.
592 */
593static const struct drive_list_entry ivb_list[] = {
594 { "QUANTUM FIREBALLlct10 05" , "A03.0900" },
595 { NULL , NULL }
596};
597
568/* 598/*
569 * All hosts that use the 80c ribbon must use! 599 * All hosts that use the 80c ribbon must use!
570 * The name is derived from upper byte of word 93 and the 80c ribbon. 600 * The name is derived from upper byte of word 93 and the 80c ribbon.
@@ -573,11 +603,16 @@ u8 eighty_ninty_three (ide_drive_t *drive)
573{ 603{
574 ide_hwif_t *hwif = drive->hwif; 604 ide_hwif_t *hwif = drive->hwif;
575 struct hd_driveid *id = drive->id; 605 struct hd_driveid *id = drive->id;
606 int ivb = ide_in_drive_list(id, ivb_list);
576 607
577 if (hwif->cbl == ATA_CBL_PATA40_SHORT) 608 if (hwif->cbl == ATA_CBL_PATA40_SHORT)
578 return 1; 609 return 1;
579 610
580 if (hwif->cbl != ATA_CBL_PATA80) 611 if (ivb)
612 printk(KERN_DEBUG "%s: skipping word 93 validity check\n",
613 drive->name);
614
615 if (hwif->cbl != ATA_CBL_PATA80 && !ivb)
581 goto no_80w; 616 goto no_80w;
582 617
583 /* Check for SATA but only if we are ATA5 or higher */ 618 /* Check for SATA but only if we are ATA5 or higher */
@@ -587,11 +622,11 @@ u8 eighty_ninty_three (ide_drive_t *drive)
587 /* 622 /*
588 * FIXME: 623 * FIXME:
589 * - change master/slave IDENTIFY order 624 * - change master/slave IDENTIFY order
590 * - force bit13 (80c cable present) check 625 * - force bit13 (80c cable present) check also for !ivb devices
591 * (unless the slave device is pre-ATA3) 626 * (unless the slave device is pre-ATA3)
592 */ 627 */
593#ifndef CONFIG_IDEDMA_IVB 628#ifndef CONFIG_IDEDMA_IVB
594 if (id->hw_config & 0x4000) 629 if ((id->hw_config & 0x4000) || (ivb && (id->hw_config & 0x2000)))
595#else 630#else
596 if (id->hw_config & 0x6000) 631 if (id->hw_config & 0x6000)
597#endif 632#endif
@@ -795,7 +830,7 @@ int ide_config_drive_speed (ide_drive_t *drive, u8 speed)
795 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); 830 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG);
796 hwif->OUTB(speed, IDE_NSECTOR_REG); 831 hwif->OUTB(speed, IDE_NSECTOR_REG);
797 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); 832 hwif->OUTB(SETFEATURES_XFER, IDE_FEATURE_REG);
798 hwif->OUTB(WIN_SETFEATURES, IDE_COMMAND_REG); 833 hwif->OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG);
799 if ((IDE_CONTROL_REG) && (drive->quirk_list == 2)) 834 if ((IDE_CONTROL_REG) && (drive->quirk_list == 2))
800 hwif->OUTB(drive->ctl, IDE_CONTROL_REG); 835 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
801 udelay(1); 836 udelay(1);
@@ -822,7 +857,7 @@ int ide_config_drive_speed (ide_drive_t *drive, u8 speed)
822 */ 857 */
823 for (i = 0; i < 10; i++) { 858 for (i = 0; i < 10; i++) {
824 udelay(1); 859 udelay(1);
825 if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), DRIVE_READY, BUSY_STAT|DRQ_STAT|ERR_STAT)) { 860 if (OK_STAT((stat = hwif->INB(IDE_STATUS_REG)), drive->ready_stat, BUSY_STAT|DRQ_STAT|ERR_STAT)) {
826 error = 0; 861 error = 0;
827 break; 862 break;
828 } 863 }
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index acaf71fd4c09..e5949b1d3fb0 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cs5530.c Version 0.73 Mar 10 2007 2 * linux/drivers/ide/pci/cs5530.c Version 0.74 Jul 28 2007
3 * 3 *
4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com>
@@ -207,6 +207,9 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
207 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 207 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
208 unsigned long flags; 208 unsigned long flags;
209 209
210 if (pci_resource_start(dev, 4) == 0)
211 return -EFAULT;
212
210 dev = NULL; 213 dev = NULL;
211 while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { 214 while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) {
212 switch (dev->device) { 215 switch (dev->device) {
@@ -325,6 +328,9 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
325 /* needs autotuning later */ 328 /* needs autotuning later */
326 } 329 }
327 330
331 if (hwif->dma_base == 0)
332 return;
333
328 hwif->atapi_dma = 1; 334 hwif->atapi_dma = 1;
329 hwif->ultra_mask = 0x07; 335 hwif->ultra_mask = 0x07;
330 hwif->mwdma_mask = 0x07; 336 hwif->mwdma_mask = 0x07;
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 19778c5fe711..cb8fe5643d3b 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -89,11 +89,7 @@ static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
89 drive->init_speed = 0; 89 drive->init_speed = 0;
90 90
91 if (ide_tune_dma(drive)) 91 if (ide_tune_dma(drive))
92#ifndef CONFIG_HPT34X_AUTODMA
93 return -1; 92 return -1;
94#else
95 return 0;
96#endif
97 93
98 if (ide_use_fast_pio(drive)) 94 if (ide_use_fast_pio(drive))
99 hpt34x_tune_drive(drive, 255); 95 hpt34x_tune_drive(drive, 255);
@@ -160,9 +156,11 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
160 if (!hwif->dma_base) 156 if (!hwif->dma_base)
161 return; 157 return;
162 158
159#ifdef CONFIG_HPT34X_AUTODMA
163 hwif->ultra_mask = 0x07; 160 hwif->ultra_mask = 0x07;
164 hwif->mwdma_mask = 0x07; 161 hwif->mwdma_mask = 0x07;
165 hwif->swdma_mask = 0x07; 162 hwif->swdma_mask = 0x07;
163#endif
166 164
167 hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate; 165 hwif->ide_dma_check = &hpt34x_config_drive_xfer_rate;
168 if (!noautodma) 166 if (!noautodma)
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 09941f37d635..465c935fdf25 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -187,14 +187,6 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive)
187 return 1; 187 return 1;
188} 188}
189 189
190static int ns87415_ide_dma_check (ide_drive_t *drive)
191{
192 if (drive->media != ide_disk)
193 return -1;
194
195 return __ide_dma_check(drive);
196}
197
198static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) 190static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
199{ 191{
200 struct pci_dev *dev = hwif->pci_dev; 192 struct pci_dev *dev = hwif->pci_dev;
@@ -266,7 +258,6 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
266 258
267 outb(0x60, hwif->dma_status); 259 outb(0x60, hwif->dma_status);
268 hwif->dma_setup = &ns87415_ide_dma_setup; 260 hwif->dma_setup = &ns87415_ide_dma_setup;
269 hwif->ide_dma_check = &ns87415_ide_dma_check;
270 hwif->ide_dma_end = &ns87415_ide_dma_end; 261 hwif->ide_dma_end = &ns87415_ide_dma_end;
271 262
272 if (!noautodma) 263 if (!noautodma)
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 8a66a2871b3a..f6db2f37efad 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -378,6 +378,9 @@ static unsigned int __devinit init_chipset_pdcnew(struct pci_dev *dev, const cha
378 int f, r; 378 int f, r;
379 u8 pll_ctl0, pll_ctl1; 379 u8 pll_ctl0, pll_ctl1;
380 380
381 if (dma_base == 0)
382 return -EFAULT;
383
381#ifdef CONFIG_PPC_PMAC 384#ifdef CONFIG_PPC_PMAC
382 apple_kiwi_init(dev); 385 apple_kiwi_init(dev);
383#endif 386#endif
@@ -494,15 +497,18 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
494 hwif->speedproc = &pdcnew_tune_chipset; 497 hwif->speedproc = &pdcnew_tune_chipset;
495 hwif->resetproc = &pdcnew_reset; 498 hwif->resetproc = &pdcnew_reset;
496 499
500 hwif->err_stops_fifo = 1;
501
497 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 502 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
498 503
504 if (hwif->dma_base == 0)
505 return;
506
499 hwif->atapi_dma = 1; 507 hwif->atapi_dma = 1;
500 508
501 hwif->ultra_mask = hwif->cds->udma_mask; 509 hwif->ultra_mask = hwif->cds->udma_mask;
502 hwif->mwdma_mask = 0x07; 510 hwif->mwdma_mask = 0x07;
503 511
504 hwif->err_stops_fifo = 1;
505
506 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate; 512 hwif->ide_dma_check = &pdcnew_config_drive_xfer_rate;
507 513
508 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 514 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index fbcb0bb9c956..e19a891171cb 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.50 Mar 3, 2007 2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.51 Jul 27, 2007
3 * 3 *
4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. 5 * Copyright (C) 2006-2007 MontaVista Software, Inc.
@@ -337,15 +337,18 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
337 337
338 hwif->speedproc = &pdc202xx_tune_chipset; 338 hwif->speedproc = &pdc202xx_tune_chipset;
339 339
340 hwif->err_stops_fifo = 1;
341
340 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 342 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
341 343
344 if (hwif->dma_base == 0)
345 return;
346
342 hwif->ultra_mask = hwif->cds->udma_mask; 347 hwif->ultra_mask = hwif->cds->udma_mask;
343 hwif->mwdma_mask = 0x07; 348 hwif->mwdma_mask = 0x07;
344 hwif->swdma_mask = 0x07; 349 hwif->swdma_mask = 0x07;
345 hwif->atapi_dma = 1; 350 hwif->atapi_dma = 1;
346 351
347 hwif->err_stops_fifo = 1;
348
349 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate; 352 hwif->ide_dma_check = &pdc202xx_config_drive_xfer_rate;
350 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; 353 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
351 hwif->dma_timeout = &pdc202xx_dma_timeout; 354 hwif->dma_timeout = &pdc202xx_dma_timeout;
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 024bbfae0429..098692a6d615 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -115,6 +115,9 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
115 hwif->tuneproc = &triflex_tune_drive; 115 hwif->tuneproc = &triflex_tune_drive;
116 hwif->speedproc = &triflex_tune_chipset; 116 hwif->speedproc = &triflex_tune_chipset;
117 117
118 if (hwif->dma_base == 0)
119 return;
120
118 hwif->atapi_dma = 1; 121 hwif->atapi_dma = 1;
119 hwif->mwdma_mask = 0x07; 122 hwif->mwdma_mask = 0x07;
120 hwif->swdma_mask = 0x07; 123 hwif->swdma_mask = 0x07;
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 33630ad3e794..4b13cd9a027d 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -604,6 +604,9 @@ out:
604 drive->id->dma_1word |= 0x0101; break; 604 drive->id->dma_1word |= 0x0101; break;
605 default: break; 605 default: break;
606 } 606 }
607 if (!drive->init_speed)
608 drive->init_speed = command;
609 drive->current_speed = command;
607 } 610 }
608 enable_irq(hwif->irq); 611 enable_irq(hwif->irq);
609 return result; 612 return result;
@@ -986,7 +989,6 @@ pmac_ide_tune_chipset (ide_drive_t *drive, byte speed)
986 return ret; 989 return ret;
987 990
988 pmac_ide_do_update_timings(drive); 991 pmac_ide_do_update_timings(drive);
989 drive->current_speed = speed;
990 992
991 return 0; 993 return 0;
992} 994}
@@ -1737,11 +1739,6 @@ pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode)
1737 /* Apply timings to controller */ 1739 /* Apply timings to controller */
1738 *timings = timing_local[0]; 1740 *timings = timing_local[0];
1739 *timings2 = timing_local[1]; 1741 *timings2 = timing_local[1];
1740
1741 /* Set speed info in drive */
1742 drive->current_speed = mode;
1743 if (!drive->init_speed)
1744 drive->init_speed = mode;
1745 1742
1746 return 1; 1743 return 1;
1747} 1744}
@@ -1793,11 +1790,6 @@ pmac_ide_udma_enable(ide_drive_t *drive, u16 mode)
1793 *timings = timing_local[0]; 1790 *timings = timing_local[0];
1794 *timings2 = timing_local[1]; 1791 *timings2 = timing_local[1];
1795 1792
1796 /* Set speed info in drive */
1797 drive->current_speed = mode;
1798 if (!drive->init_speed)
1799 drive->init_speed = mode;
1800
1801 return 1; 1793 return 1;
1802} 1794}
1803 1795
diff --git a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
index db2633e4aae6..ae7c2880e624 100644
--- a/drivers/infiniband/core/agent.c
+++ b/drivers/infiniband/core/agent.c
@@ -78,15 +78,14 @@ ib_get_agent_port(struct ib_device *device, int port_num)
78 return entry; 78 return entry;
79} 79}
80 80
81int agent_send_response(struct ib_mad *mad, struct ib_grh *grh, 81void agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
82 struct ib_wc *wc, struct ib_device *device, 82 struct ib_wc *wc, struct ib_device *device,
83 int port_num, int qpn) 83 int port_num, int qpn)
84{ 84{
85 struct ib_agent_port_private *port_priv; 85 struct ib_agent_port_private *port_priv;
86 struct ib_mad_agent *agent; 86 struct ib_mad_agent *agent;
87 struct ib_mad_send_buf *send_buf; 87 struct ib_mad_send_buf *send_buf;
88 struct ib_ah *ah; 88 struct ib_ah *ah;
89 int ret;
90 struct ib_mad_send_wr_private *mad_send_wr; 89 struct ib_mad_send_wr_private *mad_send_wr;
91 90
92 if (device->node_type == RDMA_NODE_IB_SWITCH) 91 if (device->node_type == RDMA_NODE_IB_SWITCH)
@@ -96,23 +95,21 @@ int agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
96 95
97 if (!port_priv) { 96 if (!port_priv) {
98 printk(KERN_ERR SPFX "Unable to find port agent\n"); 97 printk(KERN_ERR SPFX "Unable to find port agent\n");
99 return -ENODEV; 98 return;
100 } 99 }
101 100
102 agent = port_priv->agent[qpn]; 101 agent = port_priv->agent[qpn];
103 ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num); 102 ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num);
104 if (IS_ERR(ah)) { 103 if (IS_ERR(ah)) {
105 ret = PTR_ERR(ah); 104 printk(KERN_ERR SPFX "ib_create_ah_from_wc error\n");
106 printk(KERN_ERR SPFX "ib_create_ah_from_wc error:%d\n", ret); 105 return;
107 return ret;
108 } 106 }
109 107
110 send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0, 108 send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0,
111 IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, 109 IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
112 GFP_KERNEL); 110 GFP_KERNEL);
113 if (IS_ERR(send_buf)) { 111 if (IS_ERR(send_buf)) {
114 ret = PTR_ERR(send_buf); 112 printk(KERN_ERR SPFX "ib_create_send_mad error\n");
115 printk(KERN_ERR SPFX "ib_create_send_mad error:%d\n", ret);
116 goto err1; 113 goto err1;
117 } 114 }
118 115
@@ -126,16 +123,15 @@ int agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
126 mad_send_wr->send_wr.wr.ud.port_num = port_num; 123 mad_send_wr->send_wr.wr.ud.port_num = port_num;
127 } 124 }
128 125
129 if ((ret = ib_post_send_mad(send_buf, NULL))) { 126 if (ib_post_send_mad(send_buf, NULL)) {
130 printk(KERN_ERR SPFX "ib_post_send_mad error:%d\n", ret); 127 printk(KERN_ERR SPFX "ib_post_send_mad error\n");
131 goto err2; 128 goto err2;
132 } 129 }
133 return 0; 130 return;
134err2: 131err2:
135 ib_free_send_mad(send_buf); 132 ib_free_send_mad(send_buf);
136err1: 133err1:
137 ib_destroy_ah(ah); 134 ib_destroy_ah(ah);
138 return ret;
139} 135}
140 136
141static void agent_send_handler(struct ib_mad_agent *mad_agent, 137static void agent_send_handler(struct ib_mad_agent *mad_agent,
diff --git a/drivers/infiniband/core/agent.h b/drivers/infiniband/core/agent.h
index 86d72fab37b0..fb9ed1489f95 100644
--- a/drivers/infiniband/core/agent.h
+++ b/drivers/infiniband/core/agent.h
@@ -46,8 +46,8 @@ extern int ib_agent_port_open(struct ib_device *device, int port_num);
46 46
47extern int ib_agent_port_close(struct ib_device *device, int port_num); 47extern int ib_agent_port_close(struct ib_device *device, int port_num);
48 48
49extern int agent_send_response(struct ib_mad *mad, struct ib_grh *grh, 49extern void agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
50 struct ib_wc *wc, struct ib_device *device, 50 struct ib_wc *wc, struct ib_device *device,
51 int port_num, int qpn); 51 int port_num, int qpn);
52 52
53#endif /* __AGENT_H_ */ 53#endif /* __AGENT_H_ */
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 3ada17c0f239..2506c43ba041 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -702,7 +702,7 @@ int ib_find_pkey(struct ib_device *device,
702 if (ret) 702 if (ret)
703 return ret; 703 return ret;
704 704
705 if (pkey == tmp_pkey) { 705 if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) {
706 *index = i; 706 *index = i;
707 return 0; 707 return 0;
708 } 708 }
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index bc547f1d34ba..6f4287716ab1 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -1842,16 +1842,11 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
1842{ 1842{
1843 struct ib_mad_qp_info *qp_info; 1843 struct ib_mad_qp_info *qp_info;
1844 struct ib_mad_private_header *mad_priv_hdr; 1844 struct ib_mad_private_header *mad_priv_hdr;
1845 struct ib_mad_private *recv, *response; 1845 struct ib_mad_private *recv, *response = NULL;
1846 struct ib_mad_list_head *mad_list; 1846 struct ib_mad_list_head *mad_list;
1847 struct ib_mad_agent_private *mad_agent; 1847 struct ib_mad_agent_private *mad_agent;
1848 int port_num; 1848 int port_num;
1849 1849
1850 response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL);
1851 if (!response)
1852 printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory "
1853 "for response buffer\n");
1854
1855 mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; 1850 mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id;
1856 qp_info = mad_list->mad_queue->qp_info; 1851 qp_info = mad_list->mad_queue->qp_info;
1857 dequeue_mad(mad_list); 1852 dequeue_mad(mad_list);
@@ -1879,6 +1874,13 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
1879 if (!validate_mad(&recv->mad.mad, qp_info->qp->qp_num)) 1874 if (!validate_mad(&recv->mad.mad, qp_info->qp->qp_num))
1880 goto out; 1875 goto out;
1881 1876
1877 response = kmem_cache_alloc(ib_mad_cache, GFP_KERNEL);
1878 if (!response) {
1879 printk(KERN_ERR PFX "ib_mad_recv_done_handler no memory "
1880 "for response buffer\n");
1881 goto out;
1882 }
1883
1882 if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH) 1884 if (port_priv->device->node_type == RDMA_NODE_IB_SWITCH)
1883 port_num = wc->port_num; 1885 port_num = wc->port_num;
1884 else 1886 else
@@ -1914,12 +1916,11 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
1914 response->header.recv_wc.recv_buf.mad = &response->mad.mad; 1916 response->header.recv_wc.recv_buf.mad = &response->mad.mad;
1915 response->header.recv_wc.recv_buf.grh = &response->grh; 1917 response->header.recv_wc.recv_buf.grh = &response->grh;
1916 1918
1917 if (!agent_send_response(&response->mad.mad, 1919 agent_send_response(&response->mad.mad,
1918 &response->grh, wc, 1920 &response->grh, wc,
1919 port_priv->device, 1921 port_priv->device,
1920 smi_get_fwd_port(&recv->mad.smp), 1922 smi_get_fwd_port(&recv->mad.smp),
1921 qp_info->qp->qp_num)) 1923 qp_info->qp->qp_num);
1922 response = NULL;
1923 1924
1924 goto out; 1925 goto out;
1925 } 1926 }
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c
index 3663fd7022be..d43bc62005b3 100644
--- a/drivers/infiniband/core/mad_rmpp.c
+++ b/drivers/infiniband/core/mad_rmpp.c
@@ -163,8 +163,10 @@ static struct ib_mad_send_buf *alloc_response_msg(struct ib_mad_agent *agent,
163 hdr_len, 0, GFP_KERNEL); 163 hdr_len, 0, GFP_KERNEL);
164 if (IS_ERR(msg)) 164 if (IS_ERR(msg))
165 ib_destroy_ah(ah); 165 ib_destroy_ah(ah);
166 else 166 else {
167 msg->ah = ah; 167 msg->ah = ah;
168 msg->context[0] = ah;
169 }
168 170
169 return msg; 171 return msg;
170} 172}
@@ -197,9 +199,7 @@ static void ack_ds_ack(struct ib_mad_agent_private *agent,
197 199
198void ib_rmpp_send_handler(struct ib_mad_send_wc *mad_send_wc) 200void ib_rmpp_send_handler(struct ib_mad_send_wc *mad_send_wc)
199{ 201{
200 struct ib_rmpp_mad *rmpp_mad = mad_send_wc->send_buf->mad; 202 if (mad_send_wc->send_buf->context[0] == mad_send_wc->send_buf->ah)
201
202 if (rmpp_mad->rmpp_hdr.rmpp_type != IB_MGMT_RMPP_TYPE_ACK)
203 ib_destroy_ah(mad_send_wc->send_buf->ah); 203 ib_destroy_ah(mad_send_wc->send_buf->ah);
204 ib_free_send_mad(mad_send_wc->send_buf); 204 ib_free_send_mad(mad_send_wc->send_buf);
205} 205}
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 20ab6b3e484d..d271bd715c12 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -385,9 +385,7 @@ static void update_sm_ah(struct work_struct *work)
385 385
386 new_ah->pkey_index = 0; 386 new_ah->pkey_index = 0;
387 if (ib_find_pkey(port->agent->device, port->port_num, 387 if (ib_find_pkey(port->agent->device, port->port_num,
388 IB_DEFAULT_PKEY_FULL, &new_ah->pkey_index) && 388 IB_DEFAULT_PKEY_FULL, &new_ah->pkey_index))
389 ib_find_pkey(port->agent->device, port->port_num,
390 IB_DEFAULT_PKEY_PARTIAL, &new_ah->pkey_index))
391 printk(KERN_ERR "Couldn't find index for default PKey\n"); 389 printk(KERN_ERR "Couldn't find index for default PKey\n");
392 390
393 memset(&ah_attr, 0, sizeof ah_attr); 391 memset(&ah_attr, 0, sizeof ah_attr);
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 26d0470eef6e..664d2faa9e74 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -40,6 +40,11 @@
40 40
41#include "uverbs.h" 41#include "uverbs.h"
42 42
43#define IB_UMEM_MAX_PAGE_CHUNK \
44 ((PAGE_SIZE - offsetof(struct ib_umem_chunk, page_list)) / \
45 ((void *) &((struct ib_umem_chunk *) 0)->page_list[1] - \
46 (void *) &((struct ib_umem_chunk *) 0)->page_list[0]))
47
43static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int dirty) 48static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int dirty)
44{ 49{
45 struct ib_umem_chunk *chunk, *tmp; 50 struct ib_umem_chunk *chunk, *tmp;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c
index 9574088f0d4e..1cdfcd43b0bc 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_cm.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c
@@ -139,7 +139,7 @@ static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb)
139 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); 139 req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
140 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid)); 140 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid));
141 skb->priority = CPL_PRIORITY_SETUP; 141 skb->priority = CPL_PRIORITY_SETUP;
142 tdev->send(tdev, skb); 142 cxgb3_ofld_send(tdev, skb);
143 return; 143 return;
144} 144}
145 145
@@ -161,7 +161,7 @@ int iwch_quiesce_tid(struct iwch_ep *ep)
161 req->val = cpu_to_be64(1 << S_TCB_RX_QUIESCE); 161 req->val = cpu_to_be64(1 << S_TCB_RX_QUIESCE);
162 162
163 skb->priority = CPL_PRIORITY_DATA; 163 skb->priority = CPL_PRIORITY_DATA;
164 ep->com.tdev->send(ep->com.tdev, skb); 164 cxgb3_ofld_send(ep->com.tdev, skb);
165 return 0; 165 return 0;
166} 166}
167 167
@@ -183,7 +183,7 @@ int iwch_resume_tid(struct iwch_ep *ep)
183 req->val = 0; 183 req->val = 0;
184 184
185 skb->priority = CPL_PRIORITY_DATA; 185 skb->priority = CPL_PRIORITY_DATA;
186 ep->com.tdev->send(ep->com.tdev, skb); 186 cxgb3_ofld_send(ep->com.tdev, skb);
187 return 0; 187 return 0;
188} 188}
189 189
@@ -784,7 +784,7 @@ static int update_rx_credits(struct iwch_ep *ep, u32 credits)
784 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid)); 784 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid));
785 req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1)); 785 req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1));
786 skb->priority = CPL_PRIORITY_ACK; 786 skb->priority = CPL_PRIORITY_ACK;
787 ep->com.tdev->send(ep->com.tdev, skb); 787 cxgb3_ofld_send(ep->com.tdev, skb);
788 return credits; 788 return credits;
789} 789}
790 790
@@ -1152,7 +1152,7 @@ static int listen_start(struct iwch_listen_ep *ep)
1152 req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK)); 1152 req->opt1 = htonl(V_CONN_POLICY(CPL_CONN_POLICY_ASK));
1153 1153
1154 skb->priority = 1; 1154 skb->priority = 1;
1155 ep->com.tdev->send(ep->com.tdev, skb); 1155 cxgb3_ofld_send(ep->com.tdev, skb);
1156 return 0; 1156 return 0;
1157} 1157}
1158 1158
@@ -1186,7 +1186,7 @@ static int listen_stop(struct iwch_listen_ep *ep)
1186 req->cpu_idx = 0; 1186 req->cpu_idx = 0;
1187 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid)); 1187 OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid));
1188 skb->priority = 1; 1188 skb->priority = 1;
1189 ep->com.tdev->send(ep->com.tdev, skb); 1189 cxgb3_ofld_send(ep->com.tdev, skb);
1190 return 0; 1190 return 0;
1191} 1191}
1192 1192
@@ -1264,7 +1264,7 @@ static void reject_cr(struct t3cdev *tdev, u32 hwtid, __be32 peer_ip,
1264 rpl->opt0l_status = htonl(CPL_PASS_OPEN_REJECT); 1264 rpl->opt0l_status = htonl(CPL_PASS_OPEN_REJECT);
1265 rpl->opt2 = 0; 1265 rpl->opt2 = 0;
1266 rpl->rsvd = rpl->opt2; 1266 rpl->rsvd = rpl->opt2;
1267 tdev->send(tdev, skb); 1267 cxgb3_ofld_send(tdev, skb);
1268 } 1268 }
1269} 1269}
1270 1270
@@ -1557,7 +1557,7 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
1557 rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid)); 1557 rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid));
1558 OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid)); 1558 OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid));
1559 rpl->cmd = CPL_ABORT_NO_RST; 1559 rpl->cmd = CPL_ABORT_NO_RST;
1560 ep->com.tdev->send(ep->com.tdev, rpl_skb); 1560 cxgb3_ofld_send(ep->com.tdev, rpl_skb);
1561 if (state != ABORTING) { 1561 if (state != ABORTING) {
1562 state_set(&ep->com, DEAD); 1562 state_set(&ep->com, DEAD);
1563 release_ep_resources(ep); 1563 release_ep_resources(ep);
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index 660b27aecae5..8bf44daf45ec 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -389,7 +389,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
389 wc->opcode = IB_WC_SEND; 389 wc->opcode = IB_WC_SEND;
390 break; 390 break;
391 case MLX4_OPCODE_RDMA_READ: 391 case MLX4_OPCODE_RDMA_READ:
392 wc->opcode = IB_WC_SEND; 392 wc->opcode = IB_WC_RDMA_READ;
393 wc->byte_len = be32_to_cpu(cqe->byte_cnt); 393 wc->byte_len = be32_to_cpu(cqe->byte_cnt);
394 break; 394 break;
395 case MLX4_OPCODE_ATOMIC_CS: 395 case MLX4_OPCODE_ATOMIC_CS:
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 333091787c5f..0ed02b7834da 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -109,7 +109,7 @@ int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int ignore_mkey, int ignore_bkey,
109 in_modifier, op_modifier, 109 in_modifier, op_modifier,
110 MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C); 110 MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C);
111 111
112 if (!err); 112 if (!err)
113 memcpy(response_mad, outmailbox->buf, 256); 113 memcpy(response_mad, outmailbox->buf, 256);
114 114
115 mlx4_free_cmd_mailbox(dev->dev, inmailbox); 115 mlx4_free_cmd_mailbox(dev->dev, inmailbox);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index 982eb88e27ec..563aeacf9e14 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -211,6 +211,7 @@ out_free_cq:
211 211
212out_free_mr: 212out_free_mr:
213 ib_dereg_mr(priv->mr); 213 ib_dereg_mr(priv->mr);
214 ipoib_cm_dev_cleanup(dev);
214 215
215out_free_pd: 216out_free_pd:
216 ib_dealloc_pd(priv->pd); 217 ib_dealloc_pd(priv->pd);
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index f01ca182f226..f6a051428144 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -75,16 +75,12 @@ module_param(topspin_workarounds, int, 0444);
75MODULE_PARM_DESC(topspin_workarounds, 75MODULE_PARM_DESC(topspin_workarounds,
76 "Enable workarounds for Topspin/Cisco SRP target bugs if != 0"); 76 "Enable workarounds for Topspin/Cisco SRP target bugs if != 0");
77 77
78static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };
79
80static int mellanox_workarounds = 1; 78static int mellanox_workarounds = 1;
81 79
82module_param(mellanox_workarounds, int, 0444); 80module_param(mellanox_workarounds, int, 0444);
83MODULE_PARM_DESC(mellanox_workarounds, 81MODULE_PARM_DESC(mellanox_workarounds,
84 "Enable workarounds for Mellanox SRP target bugs if != 0"); 82 "Enable workarounds for Mellanox SRP target bugs if != 0");
85 83
86static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 };
87
88static void srp_add_one(struct ib_device *device); 84static void srp_add_one(struct ib_device *device);
89static void srp_remove_one(struct ib_device *device); 85static void srp_remove_one(struct ib_device *device);
90static void srp_completion(struct ib_cq *cq, void *target_ptr); 86static void srp_completion(struct ib_cq *cq, void *target_ptr);
@@ -108,6 +104,24 @@ static const char *srp_target_info(struct Scsi_Host *host)
108 return host_to_target(host)->target_name; 104 return host_to_target(host)->target_name;
109} 105}
110 106
107static int srp_target_is_topspin(struct srp_target_port *target)
108{
109 static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad };
110 static const u8 cisco_oui[3] = { 0x00, 0x1b, 0x0d };
111
112 return topspin_workarounds &&
113 (!memcmp(&target->ioc_guid, topspin_oui, sizeof topspin_oui) ||
114 !memcmp(&target->ioc_guid, cisco_oui, sizeof cisco_oui));
115}
116
117static int srp_target_is_mellanox(struct srp_target_port *target)
118{
119 static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 };
120
121 return mellanox_workarounds &&
122 !memcmp(&target->ioc_guid, mellanox_oui, sizeof mellanox_oui);
123}
124
111static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size, 125static struct srp_iu *srp_alloc_iu(struct srp_host *host, size_t size,
112 gfp_t gfp_mask, 126 gfp_t gfp_mask,
113 enum dma_data_direction direction) 127 enum dma_data_direction direction)
@@ -360,7 +374,7 @@ static int srp_send_req(struct srp_target_port *target)
360 * zero out the first 8 bytes of our initiator port ID and set 374 * zero out the first 8 bytes of our initiator port ID and set
361 * the second 8 bytes to the local node GUID. 375 * the second 8 bytes to the local node GUID.
362 */ 376 */
363 if (topspin_workarounds && !memcmp(&target->ioc_guid, topspin_oui, 3)) { 377 if (srp_target_is_topspin(target)) {
364 printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround " 378 printk(KERN_DEBUG PFX "Topspin/Cisco initiator port ID workaround "
365 "activated for target GUID %016llx\n", 379 "activated for target GUID %016llx\n",
366 (unsigned long long) be64_to_cpu(target->ioc_guid)); 380 (unsigned long long) be64_to_cpu(target->ioc_guid));
@@ -585,8 +599,8 @@ static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat,
585 if (!dev->fmr_pool) 599 if (!dev->fmr_pool)
586 return -ENODEV; 600 return -ENODEV;
587 601
588 if ((ib_sg_dma_address(ibdev, &scat[0]) & ~dev->fmr_page_mask) && 602 if (srp_target_is_mellanox(target) &&
589 mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3)) 603 (ib_sg_dma_address(ibdev, &scat[0]) & ~dev->fmr_page_mask))
590 return -EINVAL; 604 return -EINVAL;
591 605
592 len = page_cnt = 0; 606 len = page_cnt = 0;
@@ -1087,8 +1101,7 @@ static void srp_cm_rej_handler(struct ib_cm_id *cm_id,
1087 break; 1101 break;
1088 1102
1089 case IB_CM_REJ_PORT_REDIRECT: 1103 case IB_CM_REJ_PORT_REDIRECT:
1090 if (topspin_workarounds && 1104 if (srp_target_is_topspin(target)) {
1091 !memcmp(&target->ioc_guid, topspin_oui, 3)) {
1092 /* 1105 /*
1093 * Topspin/Cisco SRP gateways incorrectly send 1106 * Topspin/Cisco SRP gateways incorrectly send
1094 * reject reason code 25 when they mean 24 1107 * reject reason code 25 when they mean 24
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 9b26574f1466..d602b8fa7d46 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -68,6 +68,7 @@ config INPUT_WISTRON_BTNS
68 select INPUT_POLLDEV 68 select INPUT_POLLDEV
69 select NEW_LEDS 69 select NEW_LEDS
70 select LEDS_CLASS 70 select LEDS_CLASS
71 select CHECK_SIGNATURE
71 help 72 help
72 Say Y here for support of Winstron laptop button interface, used on 73 Say Y here for support of Winstron laptop button interface, used on
73 laptops of various brands, including Acer and Fujitsu-Siemens. If 74 laptops of various brands, including Acer and Fujitsu-Siemens. If
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index b1a26e02df02..60843b3f3b6f 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -1,12 +1,12 @@
1/* 1/*
2 * hfc_usb.c 2 * hfc_usb.c
3 * 3 *
4 * $Id: hfc_usb.c,v 2.3.2.13 2006/02/17 17:17:22 mbachem Exp $ 4 * $Id: hfc_usb.c,v 2.3.2.20 2007/08/20 14:07:54 mbachem Exp $
5 * 5 *
6 * modular HiSax ISDN driver for Colognechip HFC-S USB chip 6 * modular HiSax ISDN driver for Colognechip HFC-S USB chip
7 * 7 *
8 * Authors : Peter Sprenger (sprenger@moving-bytes.de) 8 * Authors : Peter Sprenger (sprenger@moving-bytes.de)
9 * Martin Bachem (info@colognechip.com) 9 * Martin Bachem (m.bachem@gmx.de, info@colognechip.com)
10 * 10 *
11 * based on the first hfc_usb driver of 11 * based on the first hfc_usb driver of
12 * Werner Cornelius (werner@isdn-development.de) 12 * Werner Cornelius (werner@isdn-development.de)
@@ -37,24 +37,25 @@
37#include <linux/kernel_stat.h> 37#include <linux/kernel_stat.h>
38#include <linux/usb.h> 38#include <linux/usb.h>
39#include <linux/kernel.h> 39#include <linux/kernel.h>
40#include <linux/smp_lock.h>
41#include <linux/sched.h>
42#include <linux/moduleparam.h>
40#include "hisax.h" 43#include "hisax.h"
41#include "hisax_if.h" 44#include "hisax_if.h"
42#include "hfc_usb.h" 45#include "hfc_usb.h"
43 46
44static const char *hfcusb_revision = 47static const char *hfcusb_revision =
45 "$Revision: 2.3.2.13 $ $Date: 2006/02/17 17:17:22 $ "; 48 "$Revision: 2.3.2.20 $ $Date: 2007/08/20 14:07:54 $ ";
46 49
47/* Hisax debug support 50/* Hisax debug support
48* use "modprobe debug=x" where x is bitfield of USB_DBG & ISDN_DBG 51* debug flags defined in hfc_usb.h as HFCUSB_DBG_[*]
49*/ 52*/
50#ifdef CONFIG_HISAX_DEBUG
51#include <linux/moduleparam.h>
52#define __debug_variable hfc_debug 53#define __debug_variable hfc_debug
53#include "hisax_debug.h" 54#include "hisax_debug.h"
54static u_int debug; 55static u_int debug;
55module_param(debug, uint, 0); 56module_param(debug, uint, 0);
56static int hfc_debug; 57static int hfc_debug;
57#endif 58
58 59
59/* private vendor specific data */ 60/* private vendor specific data */
60typedef struct { 61typedef struct {
@@ -63,9 +64,7 @@ typedef struct {
63 char *vend_name; // device name 64 char *vend_name; // device name
64} hfcsusb_vdata; 65} hfcsusb_vdata;
65 66
66/****************************************/ 67/* VID/PID device list */
67/* data defining the devices to be used */
68/****************************************/
69static struct usb_device_id hfcusb_idtab[] = { 68static struct usb_device_id hfcusb_idtab[] = {
70 { 69 {
71 USB_DEVICE(0x0959, 0x2bd0), 70 USB_DEVICE(0x0959, 0x2bd0),
@@ -90,49 +89,47 @@ static struct usb_device_id hfcusb_idtab[] = {
90 .driver_info = (unsigned long) &((hfcsusb_vdata) 89 .driver_info = (unsigned long) &((hfcsusb_vdata)
91 {LED_SCHEME1, {4, 0, 2, 1}, 90 {LED_SCHEME1, {4, 0, 2, 1},
92 "Stollmann USB TA"}), 91 "Stollmann USB TA"}),
93 }, 92 },
94 { 93 {
95 USB_DEVICE(0x0742, 0x2009), 94 USB_DEVICE(0x0742, 0x2009),
96 .driver_info = (unsigned long) &((hfcsusb_vdata) 95 .driver_info = (unsigned long) &((hfcsusb_vdata)
97 {LED_SCHEME1, {4, 0, 2, 1}, 96 {LED_SCHEME1, {4, 0, 2, 1},
98 "Aceex USB ISDN TA"}), 97 "Aceex USB ISDN TA"}),
99 }, 98 },
100 { 99 {
101 USB_DEVICE(0x0742, 0x200A), 100 USB_DEVICE(0x0742, 0x200A),
102 .driver_info = (unsigned long) &((hfcsusb_vdata) 101 .driver_info = (unsigned long) &((hfcsusb_vdata)
103 {LED_SCHEME1, {4, 0, 2, 1}, 102 {LED_SCHEME1, {4, 0, 2, 1},
104 "OEM USB ISDN TA"}), 103 "OEM USB ISDN TA"}),
105 }, 104 },
106 { 105 {
107 USB_DEVICE(0x08e3, 0x0301), 106 USB_DEVICE(0x08e3, 0x0301),
108 .driver_info = (unsigned long) &((hfcsusb_vdata) 107 .driver_info = (unsigned long) &((hfcsusb_vdata)
109 {LED_SCHEME1, {2, 0, 1, 4}, 108 {LED_SCHEME1, {2, 0, 1, 4},
110 "Olitec USB RNIS"}), 109 "Olitec USB RNIS"}),
111 }, 110 },
112 { 111 {
113 USB_DEVICE(0x07fa, 0x0846), 112 USB_DEVICE(0x07fa, 0x0846),
114 .driver_info = (unsigned long) &((hfcsusb_vdata) 113 .driver_info = (unsigned long) &((hfcsusb_vdata)
115 {LED_SCHEME1, {0x80, -64, -32, -16}, 114 {LED_SCHEME1, {0x80, -64, -32, -16},
116 "Bewan Modem RNIS USB"}), 115 "Bewan Modem RNIS USB"}),
117 }, 116 },
118 { 117 {
119 USB_DEVICE(0x07fa, 0x0847), 118 USB_DEVICE(0x07fa, 0x0847),
120 .driver_info = (unsigned long) &((hfcsusb_vdata) 119 .driver_info = (unsigned long) &((hfcsusb_vdata)
121 {LED_SCHEME1, {0x80, -64, -32, -16}, 120 {LED_SCHEME1, {0x80, -64, -32, -16},
122 "Djinn Numeris USB"}), 121 "Djinn Numeris USB"}),
123 }, 122 },
124 { 123 {
125 USB_DEVICE(0x07b0, 0x0006), 124 USB_DEVICE(0x07b0, 0x0006),
126 .driver_info = (unsigned long) &((hfcsusb_vdata) 125 .driver_info = (unsigned long) &((hfcsusb_vdata)
127 {LED_SCHEME1, {0x80, -64, -32, -16}, 126 {LED_SCHEME1, {0x80, -64, -32, -16},
128 "Twister ISDN TA"}), 127 "Twister ISDN TA"}),
129 }, 128 },
130 { } 129 { }
131}; 130};
132 131
133/***************************************************************/
134/* structure defining input+output fifos (interrupt/bulk mode) */ 132/* structure defining input+output fifos (interrupt/bulk mode) */
135/***************************************************************/
136struct usb_fifo; /* forward definition */ 133struct usb_fifo; /* forward definition */
137typedef struct iso_urb_struct { 134typedef struct iso_urb_struct {
138 struct urb *purb; 135 struct urb *purb;
@@ -140,8 +137,8 @@ typedef struct iso_urb_struct {
140 struct usb_fifo *owner_fifo; /* pointer to owner fifo */ 137 struct usb_fifo *owner_fifo; /* pointer to owner fifo */
141} iso_urb_struct; 138} iso_urb_struct;
142 139
143
144struct hfcusb_data; /* forward definition */ 140struct hfcusb_data; /* forward definition */
141
145typedef struct usb_fifo { 142typedef struct usb_fifo {
146 int fifonum; /* fifo index attached to this structure */ 143 int fifonum; /* fifo index attached to this structure */
147 int active; /* fifo is currently active */ 144 int active; /* fifo is currently active */
@@ -160,15 +157,12 @@ typedef struct usb_fifo {
160 struct hisax_if *hif; /* hisax interface */ 157 struct hisax_if *hif; /* hisax interface */
161 int delete_flg; /* only delete skbuff once */ 158 int delete_flg; /* only delete skbuff once */
162 int last_urblen; /* remember length of last packet */ 159 int last_urblen; /* remember length of last packet */
163
164} usb_fifo; 160} usb_fifo;
165 161
166/*********************************************/
167/* structure holding all data for one device */ 162/* structure holding all data for one device */
168/*********************************************/
169typedef struct hfcusb_data { 163typedef struct hfcusb_data {
170 /* HiSax Interface for loadable Layer1 drivers */ 164 /* HiSax Interface for loadable Layer1 drivers */
171 struct hisax_d_if d_if; /* see hisax_if.h */ 165 struct hisax_d_if d_if; /* see hisax_if.h */
172 struct hisax_b_if b_if[2]; /* see hisax_if.h */ 166 struct hisax_b_if b_if[2]; /* see hisax_if.h */
173 int protocol; 167 int protocol;
174 168
@@ -176,12 +170,13 @@ typedef struct hfcusb_data {
176 int if_used; /* used interface number */ 170 int if_used; /* used interface number */
177 int alt_used; /* used alternate config */ 171 int alt_used; /* used alternate config */
178 int ctrl_paksize; /* control pipe packet size */ 172 int ctrl_paksize; /* control pipe packet size */
179 int ctrl_in_pipe, ctrl_out_pipe; /* handles for control pipe */ 173 int ctrl_in_pipe, /* handles for control pipe */
174 ctrl_out_pipe;
180 int cfg_used; /* configuration index used */ 175 int cfg_used; /* configuration index used */
181 int vend_idx; /* vendor found */ 176 int vend_idx; /* vendor found */
182 int b_mode[2]; /* B-channel mode */ 177 int b_mode[2]; /* B-channel mode */
183 int l1_activated; /* layer 1 activated */ 178 int l1_activated; /* layer 1 activated */
184 int disc_flag; /* 'true' if device was disonnected to avoid some USB actions */ 179 int disc_flag; /* TRUE if device was disonnected to avoid some USB actions */
185 int packet_size, iso_packet_size; 180 int packet_size, iso_packet_size;
186 181
187 /* control pipe background handling */ 182 /* control pipe background handling */
@@ -208,7 +203,6 @@ typedef struct hfcusb_data {
208static void collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, 203static void collect_rx_frame(usb_fifo * fifo, __u8 * data, int len,
209 int finish); 204 int finish);
210 205
211
212static inline const char * 206static inline const char *
213symbolic(struct hfcusb_symbolic_list list[], const int num) 207symbolic(struct hfcusb_symbolic_list list[], const int num)
214{ 208{
@@ -219,10 +213,6 @@ symbolic(struct hfcusb_symbolic_list list[], const int num)
219 return "<unknown ERROR>"; 213 return "<unknown ERROR>";
220} 214}
221 215
222
223/******************************************************/
224/* start next background transfer for control channel */
225/******************************************************/
226static void 216static void
227ctrl_start_transfer(hfcusb_data * hfc) 217ctrl_start_transfer(hfcusb_data * hfc)
228{ 218{
@@ -240,10 +230,6 @@ ctrl_start_transfer(hfcusb_data * hfc)
240 } 230 }
241} /* ctrl_start_transfer */ 231} /* ctrl_start_transfer */
242 232
243/************************************/
244/* queue a control transfer request */
245/* return 0 on success. */
246/************************************/
247static int 233static int
248queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val, int action) 234queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val, int action)
249{ 235{
@@ -260,19 +246,8 @@ queue_control_request(hfcusb_data * hfc, __u8 reg, __u8 val, int action)
260 if (++hfc->ctrl_cnt == 1) 246 if (++hfc->ctrl_cnt == 1)
261 ctrl_start_transfer(hfc); 247 ctrl_start_transfer(hfc);
262 return (0); 248 return (0);
263} /* queue_control_request */
264
265static int
266control_action_handler(hfcusb_data * hfc, int reg, int val, int action)
267{
268 if (!action)
269 return (1); /* no action defined */
270 return (0);
271} 249}
272 250
273/***************************************************************/
274/* control completion routine handling background control cmds */
275/***************************************************************/
276static void 251static void
277ctrl_complete(struct urb *urb) 252ctrl_complete(struct urb *urb)
278{ 253{
@@ -282,9 +257,6 @@ ctrl_complete(struct urb *urb)
282 urb->dev = hfc->dev; 257 urb->dev = hfc->dev;
283 if (hfc->ctrl_cnt) { 258 if (hfc->ctrl_cnt) {
284 buf = &hfc->ctrl_buff[hfc->ctrl_out_idx]; 259 buf = &hfc->ctrl_buff[hfc->ctrl_out_idx];
285 control_action_handler(hfc, buf->hfc_reg, buf->reg_val,
286 buf->action);
287
288 hfc->ctrl_cnt--; /* decrement actual count */ 260 hfc->ctrl_cnt--; /* decrement actual count */
289 if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE) 261 if (++hfc->ctrl_out_idx >= HFC_CTRL_BUFSIZE)
290 hfc->ctrl_out_idx = 0; /* pointer wrap */ 262 hfc->ctrl_out_idx = 0; /* pointer wrap */
@@ -293,9 +265,7 @@ ctrl_complete(struct urb *urb)
293 } 265 }
294} /* ctrl_complete */ 266} /* ctrl_complete */
295 267
296/***************************************************/
297/* write led data to auxport & invert if necessary */ 268/* write led data to auxport & invert if necessary */
298/***************************************************/
299static void 269static void
300write_led(hfcusb_data * hfc, __u8 led_state) 270write_led(hfcusb_data * hfc, __u8 led_state)
301{ 271{
@@ -305,9 +275,6 @@ write_led(hfcusb_data * hfc, __u8 led_state)
305 } 275 }
306} 276}
307 277
308/**************************/
309/* handle LED bits */
310/**************************/
311static void 278static void
312set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset) 279set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset)
313{ 280{
@@ -324,9 +291,7 @@ set_led_bit(hfcusb_data * hfc, signed short led_bits, int unset)
324 } 291 }
325} 292}
326 293
327/**************************/ 294/* handle LED requests */
328/* handle LED requests */
329/**************************/
330static void 295static void
331handle_led(hfcusb_data * hfc, int event) 296handle_led(hfcusb_data * hfc, int event)
332{ 297{
@@ -339,85 +304,73 @@ handle_led(hfcusb_data * hfc, int event)
339 304
340 switch (event) { 305 switch (event) {
341 case LED_POWER_ON: 306 case LED_POWER_ON:
342 set_led_bit(hfc, driver_info->led_bits[0], 307 set_led_bit(hfc, driver_info->led_bits[0], 0);
343 0); 308 set_led_bit(hfc, driver_info->led_bits[1], 1);
344 set_led_bit(hfc, driver_info->led_bits[1], 309 set_led_bit(hfc, driver_info->led_bits[2], 1);
345 1); 310 set_led_bit(hfc, driver_info->led_bits[3], 1);
346 set_led_bit(hfc, driver_info->led_bits[2],
347 1);
348 set_led_bit(hfc, driver_info->led_bits[3],
349 1);
350 break; 311 break;
351 case LED_POWER_OFF: /* no Power off handling */ 312 case LED_POWER_OFF:
313 set_led_bit(hfc, driver_info->led_bits[0], 1);
314 set_led_bit(hfc, driver_info->led_bits[1], 1);
315 set_led_bit(hfc, driver_info->led_bits[2], 1);
316 set_led_bit(hfc, driver_info->led_bits[3], 1);
352 break; 317 break;
353 case LED_S0_ON: 318 case LED_S0_ON:
354 set_led_bit(hfc, driver_info->led_bits[1], 319 set_led_bit(hfc, driver_info->led_bits[1], 0);
355 0);
356 break; 320 break;
357 case LED_S0_OFF: 321 case LED_S0_OFF:
358 set_led_bit(hfc, driver_info->led_bits[1], 322 set_led_bit(hfc, driver_info->led_bits[1], 1);
359 1);
360 break; 323 break;
361 case LED_B1_ON: 324 case LED_B1_ON:
362 set_led_bit(hfc, driver_info->led_bits[2], 325 set_led_bit(hfc, driver_info->led_bits[2], 0);
363 0);
364 break; 326 break;
365 case LED_B1_OFF: 327 case LED_B1_OFF:
366 set_led_bit(hfc, driver_info->led_bits[2], 328 set_led_bit(hfc, driver_info->led_bits[2], 1);
367 1);
368 break; 329 break;
369 case LED_B2_ON: 330 case LED_B2_ON:
370 set_led_bit(hfc, driver_info->led_bits[3], 331 set_led_bit(hfc, driver_info->led_bits[3], 0);
371 0);
372 break; 332 break;
373 case LED_B2_OFF: 333 case LED_B2_OFF:
374 set_led_bit(hfc, driver_info->led_bits[3], 334 set_led_bit(hfc, driver_info->led_bits[3], 1);
375 1);
376 break; 335 break;
377 } 336 }
378 write_led(hfc, hfc->led_state); 337 write_led(hfc, hfc->led_state);
379} 338}
380 339
381/********************************/ 340/* ISDN l1 timer T3 expires */
382/* called when timer t3 expires */
383/********************************/
384static void 341static void
385l1_timer_expire_t3(hfcusb_data * hfc) 342l1_timer_expire_t3(hfcusb_data * hfc)
386{ 343{
387 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, 344 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,
388 NULL); 345 NULL);
389#ifdef CONFIG_HISAX_DEBUG 346
390 DBG(ISDN_DBG, 347 DBG(HFCUSB_DBG_STATES,
391 "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T3 expire)"); 348 "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T3 expire)");
392#endif 349
393 hfc->l1_activated = false; 350 hfc->l1_activated = 0;
394 handle_led(hfc, LED_S0_OFF); 351 handle_led(hfc, LED_S0_OFF);
395 /* deactivate : */ 352 /* deactivate : */
396 queue_control_request(hfc, HFCUSB_STATES, 0x10, 1); 353 queue_control_request(hfc, HFCUSB_STATES, 0x10, 1);
397 queue_control_request(hfc, HFCUSB_STATES, 3, 1); 354 queue_control_request(hfc, HFCUSB_STATES, 3, 1);
398} 355}
399 356
400/********************************/ 357/* ISDN l1 timer T4 expires */
401/* called when timer t4 expires */
402/********************************/
403static void 358static void
404l1_timer_expire_t4(hfcusb_data * hfc) 359l1_timer_expire_t4(hfcusb_data * hfc)
405{ 360{
406 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION, 361 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, PH_DEACTIVATE | INDICATION,
407 NULL); 362 NULL);
408#ifdef CONFIG_HISAX_DEBUG 363
409 DBG(ISDN_DBG, 364 DBG(HFCUSB_DBG_STATES,
410 "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T4 expire)"); 365 "HFC-S USB: PH_DEACTIVATE | INDICATION sent (T4 expire)");
411#endif 366
412 hfc->l1_activated = false; 367 hfc->l1_activated = 0;
413 handle_led(hfc, LED_S0_OFF); 368 handle_led(hfc, LED_S0_OFF);
414} 369}
415 370
416/*****************************/ 371/* S0 state changed */
417/* handle S0 state changes */
418/*****************************/
419static void 372static void
420state_handler(hfcusb_data * hfc, __u8 state) 373s0_state_handler(hfcusb_data * hfc, __u8 state)
421{ 374{
422 __u8 old_state; 375 __u8 old_state;
423 376
@@ -425,38 +378,29 @@ state_handler(hfcusb_data * hfc, __u8 state)
425 if (state == old_state || state < 1 || state > 8) 378 if (state == old_state || state < 1 || state > 8)
426 return; 379 return;
427 380
428#ifdef CONFIG_HISAX_DEBUG 381 DBG(HFCUSB_DBG_STATES, "HFC-S USB: S0 statechange(%d -> %d)",
429 DBG(ISDN_DBG, "HFC-S USB: new S0 state:%d old_state:%d", state, 382 old_state, state);
430 old_state); 383
431#endif
432 if (state < 4 || state == 7 || state == 8) { 384 if (state < 4 || state == 7 || state == 8) {
433 if (timer_pending(&hfc->t3_timer)) 385 if (timer_pending(&hfc->t3_timer))
434 del_timer(&hfc->t3_timer); 386 del_timer(&hfc->t3_timer);
435#ifdef CONFIG_HISAX_DEBUG 387 DBG(HFCUSB_DBG_STATES, "HFC-S USB: T3 deactivated");
436 DBG(ISDN_DBG, "HFC-S USB: T3 deactivated");
437#endif
438 } 388 }
439 if (state >= 7) { 389 if (state >= 7) {
440 if (timer_pending(&hfc->t4_timer)) 390 if (timer_pending(&hfc->t4_timer))
441 del_timer(&hfc->t4_timer); 391 del_timer(&hfc->t4_timer);
442#ifdef CONFIG_HISAX_DEBUG 392 DBG(HFCUSB_DBG_STATES, "HFC-S USB: T4 deactivated");
443 DBG(ISDN_DBG, "HFC-S USB: T4 deactivated");
444#endif
445 } 393 }
446 394
447 if (state == 7 && !hfc->l1_activated) { 395 if (state == 7 && !hfc->l1_activated) {
448 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, 396 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc,
449 PH_ACTIVATE | INDICATION, NULL); 397 PH_ACTIVATE | INDICATION, NULL);
450#ifdef CONFIG_HISAX_DEBUG 398 DBG(HFCUSB_DBG_STATES, "HFC-S USB: PH_ACTIVATE | INDICATION sent");
451 DBG(ISDN_DBG, "HFC-S USB: PH_ACTIVATE | INDICATION sent"); 399 hfc->l1_activated = 1;
452#endif
453 hfc->l1_activated = true;
454 handle_led(hfc, LED_S0_ON); 400 handle_led(hfc, LED_S0_ON);
455 } else if (state <= 3 /* && activated */ ) { 401 } else if (state <= 3 /* && activated */ ) {
456 if (old_state == 7 || old_state == 8) { 402 if (old_state == 7 || old_state == 8) {
457#ifdef CONFIG_HISAX_DEBUG 403 DBG(HFCUSB_DBG_STATES, "HFC-S USB: T4 activated");
458 DBG(ISDN_DBG, "HFC-S USB: T4 activated");
459#endif
460 if (!timer_pending(&hfc->t4_timer)) { 404 if (!timer_pending(&hfc->t4_timer)) {
461 hfc->t4_timer.expires = 405 hfc->t4_timer.expires =
462 jiffies + (HFC_TIMER_T4 * HZ) / 1000; 406 jiffies + (HFC_TIMER_T4 * HZ) / 1000;
@@ -466,18 +410,15 @@ state_handler(hfcusb_data * hfc, __u8 state)
466 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, 410 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc,
467 PH_DEACTIVATE | INDICATION, 411 PH_DEACTIVATE | INDICATION,
468 NULL); 412 NULL);
469#ifdef CONFIG_HISAX_DEBUG 413 DBG(HFCUSB_DBG_STATES,
470 DBG(ISDN_DBG,
471 "HFC-S USB: PH_DEACTIVATE | INDICATION sent"); 414 "HFC-S USB: PH_DEACTIVATE | INDICATION sent");
472#endif 415 hfc->l1_activated = 0;
473 hfc->l1_activated = false;
474 handle_led(hfc, LED_S0_OFF); 416 handle_led(hfc, LED_S0_OFF);
475 } 417 }
476 } 418 }
477 hfc->l1_state = state; 419 hfc->l1_state = state;
478} 420}
479 421
480/* prepare iso urb */
481static void 422static void
482fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe, 423fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe,
483 void *buf, int num_packets, int packet_size, int interval, 424 void *buf, int num_packets, int packet_size, int interval,
@@ -503,15 +444,16 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe,
503} 444}
504 445
505/* allocs urbs and start isoc transfer with two pending urbs to avoid 446/* allocs urbs and start isoc transfer with two pending urbs to avoid
506 gaps in the transfer chain */ 447 * gaps in the transfer chain
448 */
507static int 449static int
508start_isoc_chain(usb_fifo * fifo, int num_packets_per_urb, 450start_isoc_chain(usb_fifo * fifo, int num_packets_per_urb,
509 usb_complete_t complete, int packet_size) 451 usb_complete_t complete, int packet_size)
510{ 452{
511 int i, k, errcode; 453 int i, k, errcode;
512 454
513 printk(KERN_INFO "HFC-S USB: starting ISO-chain for Fifo %i\n", 455 DBG(HFCUSB_DBG_INIT, "HFC-S USB: starting ISO-URBs for fifo:%d\n",
514 fifo->fifonum); 456 fifo->fifonum);
515 457
516 /* allocate Memory for Iso out Urbs */ 458 /* allocate Memory for Iso out Urbs */
517 for (i = 0; i < 2; i++) { 459 for (i = 0; i < 2; i++) {
@@ -556,10 +498,9 @@ start_isoc_chain(usb_fifo * fifo, int num_packets_per_urb,
556 498
557 errcode = usb_submit_urb(fifo->iso[i].purb, GFP_KERNEL); 499 errcode = usb_submit_urb(fifo->iso[i].purb, GFP_KERNEL);
558 fifo->active = (errcode >= 0) ? 1 : 0; 500 fifo->active = (errcode >= 0) ? 1 : 0;
559 if (errcode < 0) { 501 if (errcode < 0)
560 printk(KERN_INFO "HFC-S USB: %s URB nr:%d\n", 502 printk(KERN_INFO "HFC-S USB: usb_submit_urb URB nr:%d, error(%i): '%s'\n",
561 symbolic(urb_errlist, errcode), i); 503 i, errcode, symbolic(urb_errlist, errcode));
562 };
563 } 504 }
564 return (fifo->active); 505 return (fifo->active);
565} 506}
@@ -572,16 +513,15 @@ stop_isoc_chain(usb_fifo * fifo)
572 513
573 for (i = 0; i < 2; i++) { 514 for (i = 0; i < 2; i++) {
574 if (fifo->iso[i].purb) { 515 if (fifo->iso[i].purb) {
575#ifdef CONFIG_HISAX_DEBUG 516 DBG(HFCUSB_DBG_INIT,
576 DBG(USB_DBG,
577 "HFC-S USB: Stopping iso chain for fifo %i.%i", 517 "HFC-S USB: Stopping iso chain for fifo %i.%i",
578 fifo->fifonum, i); 518 fifo->fifonum, i);
579#endif
580 usb_kill_urb(fifo->iso[i].purb); 519 usb_kill_urb(fifo->iso[i].purb);
581 usb_free_urb(fifo->iso[i].purb); 520 usb_free_urb(fifo->iso[i].purb);
582 fifo->iso[i].purb = NULL; 521 fifo->iso[i].purb = NULL;
583 } 522 }
584 } 523 }
524
585 usb_kill_urb(fifo->urb); 525 usb_kill_urb(fifo->urb);
586 usb_free_urb(fifo->urb); 526 usb_free_urb(fifo->urb);
587 fifo->urb = NULL; 527 fifo->urb = NULL;
@@ -594,9 +534,6 @@ static int iso_packets[8] =
594 ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D 534 ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D, ISOC_PACKETS_D
595}; 535};
596 536
597/*****************************************************/
598/* transmit completion routine for all ISO tx fifos */
599/*****************************************************/
600static void 537static void
601tx_iso_complete(struct urb *urb) 538tx_iso_complete(struct urb *urb)
602{ 539{
@@ -607,20 +544,38 @@ tx_iso_complete(struct urb *urb)
607 errcode; 544 errcode;
608 int frame_complete, transp_mode, fifon, status; 545 int frame_complete, transp_mode, fifon, status;
609 __u8 threshbit; 546 __u8 threshbit;
610 __u8 threshtable[8] = { 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80 };
611 547
612 fifon = fifo->fifonum; 548 fifon = fifo->fifonum;
613 status = urb->status; 549 status = urb->status;
614 550
615 tx_offset = 0; 551 tx_offset = 0;
616 552
553 /* ISO transfer only partially completed,
554 look at individual frame status for details */
555 if (status == -EXDEV) {
556 DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: tx_iso_complete with -EXDEV"
557 ", urb->status %d, fifonum %d\n",
558 status, fifon);
559
560 for (k = 0; k < iso_packets[fifon]; ++k) {
561 errcode = urb->iso_frame_desc[k].status;
562 if (errcode)
563 DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: tx_iso_complete "
564 "packet %i, status: %i\n",
565 k, errcode);
566 }
567
568 // clear status, so go on with ISO transfers
569 status = 0;
570 }
571
617 if (fifo->active && !status) { 572 if (fifo->active && !status) {
618 transp_mode = 0; 573 transp_mode = 0;
619 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) 574 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS)
620 transp_mode = true; 575 transp_mode = 1;
621 576
622 /* is FifoFull-threshold set for our channel? */ 577 /* is FifoFull-threshold set for our channel? */
623 threshbit = threshtable[fifon] & hfc->threshold_mask; 578 threshbit = (hfc->threshold_mask & (1 << fifon));
624 num_isoc_packets = iso_packets[fifon]; 579 num_isoc_packets = iso_packets[fifon];
625 580
626 /* predict dataflow to avoid fifo overflow */ 581 /* predict dataflow to avoid fifo overflow */
@@ -635,8 +590,9 @@ tx_iso_complete(struct urb *urb)
635 tx_iso_complete, urb->context); 590 tx_iso_complete, urb->context);
636 memset(context_iso_urb->buffer, 0, 591 memset(context_iso_urb->buffer, 0,
637 sizeof(context_iso_urb->buffer)); 592 sizeof(context_iso_urb->buffer));
638 frame_complete = false; 593 frame_complete = 0;
639 /* Generate next Iso Packets */ 594
595 /* Generate next ISO Packets */
640 for (k = 0; k < num_isoc_packets; ++k) { 596 for (k = 0; k < num_isoc_packets; ++k) {
641 if (fifo->skbuff) { 597 if (fifo->skbuff) {
642 len = fifo->skbuff->len; 598 len = fifo->skbuff->len;
@@ -661,7 +617,7 @@ tx_iso_complete(struct urb *urb)
661 /* add 2 byte flags and 16bit CRC at end of ISDN frame */ 617 /* add 2 byte flags and 16bit CRC at end of ISDN frame */
662 fifo->bit_line += 32; 618 fifo->bit_line += 32;
663 } 619 }
664 frame_complete = true; 620 frame_complete = 1;
665 } 621 }
666 622
667 memcpy(context_iso_urb->buffer + 623 memcpy(context_iso_urb->buffer +
@@ -688,7 +644,7 @@ tx_iso_complete(struct urb *urb)
688 } 644 }
689 645
690 if (frame_complete) { 646 if (frame_complete) {
691 fifo->delete_flg = true; 647 fifo->delete_flg = 1;
692 fifo->hif->l1l2(fifo->hif, 648 fifo->hif->l1l2(fifo->hif,
693 PH_DATA | CONFIRM, 649 PH_DATA | CONFIRM,
694 (void *) (unsigned long) fifo->skbuff-> 650 (void *) (unsigned long) fifo->skbuff->
@@ -696,30 +652,26 @@ tx_iso_complete(struct urb *urb)
696 if (fifo->skbuff && fifo->delete_flg) { 652 if (fifo->skbuff && fifo->delete_flg) {
697 dev_kfree_skb_any(fifo->skbuff); 653 dev_kfree_skb_any(fifo->skbuff);
698 fifo->skbuff = NULL; 654 fifo->skbuff = NULL;
699 fifo->delete_flg = false; 655 fifo->delete_flg = 0;
700 } 656 }
701 frame_complete = false; 657 frame_complete = 0;
702 } 658 }
703 } 659 }
704 errcode = usb_submit_urb(urb, GFP_ATOMIC); 660 errcode = usb_submit_urb(urb, GFP_ATOMIC);
705 if (errcode < 0) { 661 if (errcode < 0) {
706 printk(KERN_INFO 662 printk(KERN_INFO
707 "HFC-S USB: error submitting ISO URB: %d \n", 663 "HFC-S USB: error submitting ISO URB: %d\n",
708 errcode); 664 errcode);
709 } 665 }
710 } else { 666 } else {
711 if (status && !hfc->disc_flag) { 667 if (status && !hfc->disc_flag) {
712 printk(KERN_INFO 668 printk(KERN_INFO
713 "HFC-S USB: tx_iso_complete : urb->status %s (%i), fifonum=%d\n", 669 "HFC-S USB: tx_iso_complete: error(%i): '%s', fifonum=%d\n",
714 symbolic(urb_errlist, status), status, 670 status, symbolic(urb_errlist, status), fifon);
715 fifon);
716 } 671 }
717 } 672 }
718} /* tx_iso_complete */ 673}
719 674
720/*****************************************************/
721/* receive completion routine for all ISO tx fifos */
722/*****************************************************/
723static void 675static void
724rx_iso_complete(struct urb *urb) 676rx_iso_complete(struct urb *urb)
725{ 677{
@@ -731,21 +683,25 @@ rx_iso_complete(struct urb *urb)
731 unsigned int iso_status; 683 unsigned int iso_status;
732 __u8 *buf; 684 __u8 *buf;
733 static __u8 eof[8]; 685 static __u8 eof[8];
734#ifdef CONFIG_HISAX_DEBUG
735 __u8 i;
736#endif
737 686
738 fifon = fifo->fifonum; 687 fifon = fifo->fifonum;
739 status = urb->status; 688 status = urb->status;
740 689
741 if (urb->status == -EOVERFLOW) { 690 if (urb->status == -EOVERFLOW) {
742#ifdef CONFIG_HISAX_DEBUG 691 DBG(HFCUSB_DBG_VERBOSE_USB,
743 DBG(USB_DBG, 692 "HFC-USB: ignoring USB DATAOVERRUN fifo(%i)", fifon);
744 "HFC-USB: ignoring USB DATAOVERRUN for fifo %i \n", 693 status = 0;
745 fifon); 694 }
746#endif 695
696 /* ISO transfer only partially completed,
697 look at individual frame status for details */
698 if (status == -EXDEV) {
699 DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: rx_iso_complete with -EXDEV "
700 "urb->status %d, fifonum %d\n",
701 status, fifon);
747 status = 0; 702 status = 0;
748 } 703 }
704
749 if (fifo->active && !status) { 705 if (fifo->active && !status) {
750 num_isoc_packets = iso_packets[fifon]; 706 num_isoc_packets = iso_packets[fifon];
751 maxlen = fifo->usb_packet_maxlen; 707 maxlen = fifo->usb_packet_maxlen;
@@ -754,40 +710,38 @@ rx_iso_complete(struct urb *urb)
754 offset = urb->iso_frame_desc[k].offset; 710 offset = urb->iso_frame_desc[k].offset;
755 buf = context_iso_urb->buffer + offset; 711 buf = context_iso_urb->buffer + offset;
756 iso_status = urb->iso_frame_desc[k].status; 712 iso_status = urb->iso_frame_desc[k].status;
757#ifdef CONFIG_HISAX_DEBUG 713
758 if (iso_status && !hfc->disc_flag) 714 if (iso_status && !hfc->disc_flag)
759 DBG(USB_DBG, 715 DBG(HFCUSB_DBG_VERBOSE_USB,
760 "HFC-S USB: ISO packet failure - status:%x", 716 "HFC-S USB: rx_iso_complete "
761 iso_status); 717 "ISO packet %i, status: %i\n",
718 k, iso_status);
762 719
763 if ((fifon == 5) && (debug > 1)) { 720 if (fifon == HFCUSB_D_RX) {
764 printk(KERN_INFO 721 DBG(HFCUSB_DBG_VERBOSE_USB,
765 "HFC-S USB: ISO-D-RX lst_urblen:%2d " 722 "HFC-S USB: ISO-D-RX lst_urblen:%2d "
766 "act_urblen:%2d max-urblen:%2d " 723 "act_urblen:%2d max-urblen:%2d EOF:0x%0x",
767 "EOF:0x%0x DATA: ",
768 fifo->last_urblen, len, maxlen, 724 fifo->last_urblen, len, maxlen,
769 eof[5]); 725 eof[5]);
770 for (i = 0; i < len; i++) 726
771 printk("%.2x ", buf[i]); 727 DBG_PACKET(HFCUSB_DBG_VERBOSE_USB, buf, len);
772 printk("\n");
773 } 728 }
774#endif 729
775 if (fifo->last_urblen != maxlen) { 730 if (fifo->last_urblen != maxlen) {
776 /* the threshold mask is in the 2nd status byte */ 731 /* the threshold mask is in the 2nd status byte */
777 hfc->threshold_mask = buf[1]; 732 hfc->threshold_mask = buf[1];
778 /* care for L1 state only for D-Channel 733 /* care for L1 state only for D-Channel
779 to avoid overlapped iso completions */ 734 to avoid overlapped iso completions */
780 if (fifon == 5) { 735 if (fifon == HFCUSB_D_RX) {
781 /* the S0 state is in the upper half 736 /* the S0 state is in the upper half
782 of the 1st status byte */ 737 of the 1st status byte */
783 state_handler(hfc, buf[0] >> 4); 738 s0_state_handler(hfc, buf[0] >> 4);
784 } 739 }
785 eof[fifon] = buf[0] & 1; 740 eof[fifon] = buf[0] & 1;
786 if (len > 2) 741 if (len > 2)
787 collect_rx_frame(fifo, buf + 2, 742 collect_rx_frame(fifo, buf + 2,
788 len - 2, 743 len - 2,
789 (len < 744 (len < maxlen) ?
790 maxlen) ?
791 eof[fifon] : 0); 745 eof[fifon] : 0);
792 } else { 746 } else {
793 collect_rx_frame(fifo, buf, len, 747 collect_rx_frame(fifo, buf, len,
@@ -804,41 +758,37 @@ rx_iso_complete(struct urb *urb)
804 rx_iso_complete, urb->context); 758 rx_iso_complete, urb->context);
805 errcode = usb_submit_urb(urb, GFP_ATOMIC); 759 errcode = usb_submit_urb(urb, GFP_ATOMIC);
806 if (errcode < 0) { 760 if (errcode < 0) {
807 printk(KERN_INFO 761 printk(KERN_ERR
808 "HFC-S USB: error submitting ISO URB: %d \n", 762 "HFC-S USB: error submitting ISO URB: %d\n",
809 errcode); 763 errcode);
810 } 764 }
811 } else { 765 } else {
812 if (status && !hfc->disc_flag) { 766 if (status && !hfc->disc_flag) {
813 printk(KERN_INFO 767 printk(KERN_ERR
814 "HFC-S USB: rx_iso_complete : " 768 "HFC-S USB: rx_iso_complete : "
815 "urb->status %d, fifonum %d\n", 769 "urb->status %d, fifonum %d\n",
816 status, fifon); 770 status, fifon);
817 } 771 }
818 } 772 }
819} /* rx_iso_complete */ 773}
820 774
821/*****************************************************/ 775/* collect rx data from INT- and ISO-URBs */
822/* collect data from interrupt or isochron in */
823/*****************************************************/
824static void 776static void
825collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish) 777collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
826{ 778{
827 hfcusb_data *hfc = fifo->hfc; 779 hfcusb_data *hfc = fifo->hfc;
828 int transp_mode, fifon; 780 int transp_mode, fifon;
829#ifdef CONFIG_HISAX_DEBUG 781
830 int i;
831#endif
832 fifon = fifo->fifonum; 782 fifon = fifo->fifonum;
833 transp_mode = 0; 783 transp_mode = 0;
834 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS) 784 if (fifon < 4 && hfc->b_mode[fifon / 2] == L1_MODE_TRANS)
835 transp_mode = true; 785 transp_mode = 1;
836 786
837 if (!fifo->skbuff) { 787 if (!fifo->skbuff) {
838 fifo->skbuff = dev_alloc_skb(fifo->max_size + 3); 788 fifo->skbuff = dev_alloc_skb(fifo->max_size + 3);
839 if (!fifo->skbuff) { 789 if (!fifo->skbuff) {
840 printk(KERN_INFO 790 printk(KERN_ERR
841 "HFC-S USB: cannot allocate buffer (dev_alloc_skb) fifo:%d\n", 791 "HFC-S USB: cannot allocate buffer for fifo(%d)\n",
842 fifon); 792 fifon);
843 return; 793 return;
844 } 794 }
@@ -847,17 +797,11 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
847 if (fifo->skbuff->len + len < fifo->max_size) { 797 if (fifo->skbuff->len + len < fifo->max_size) {
848 memcpy(skb_put(fifo->skbuff, len), data, len); 798 memcpy(skb_put(fifo->skbuff, len), data, len);
849 } else { 799 } else {
850#ifdef CONFIG_HISAX_DEBUG 800 DBG(HFCUSB_DBG_FIFO_ERR,
851 printk(KERN_INFO "HFC-S USB: "); 801 "HCF-USB: got frame exceeded fifo->max_size(%d) fifo(%d)",
852 for (i = 0; i < 15; i++)
853 printk("%.2x ",
854 fifo->skbuff->data[fifo->skbuff->
855 len - 15 + i]);
856 printk("\n");
857#endif
858 printk(KERN_INFO
859 "HCF-USB: got frame exceeded fifo->max_size:%d on fifo:%d\n",
860 fifo->max_size, fifon); 802 fifo->max_size, fifon);
803 DBG_SKB(HFCUSB_DBG_VERBOSE_USB, fifo->skbuff);
804 skb_trim(fifo->skbuff, 0);
861 } 805 }
862 } 806 }
863 if (transp_mode && fifo->skbuff->len >= 128) { 807 if (transp_mode && fifo->skbuff->len >= 128) {
@@ -870,6 +814,13 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
870 if (finish) { 814 if (finish) {
871 if ((!fifo->skbuff->data[fifo->skbuff->len - 1]) 815 if ((!fifo->skbuff->data[fifo->skbuff->len - 1])
872 && (fifo->skbuff->len > 3)) { 816 && (fifo->skbuff->len > 3)) {
817
818 if (fifon == HFCUSB_D_RX) {
819 DBG(HFCUSB_DBG_DCHANNEL,
820 "HFC-S USB: D-RX len(%d)", fifo->skbuff->len);
821 DBG_SKB(HFCUSB_DBG_DCHANNEL, fifo->skbuff);
822 }
823
873 /* remove CRC & status */ 824 /* remove CRC & status */
874 skb_trim(fifo->skbuff, fifo->skbuff->len - 3); 825 skb_trim(fifo->skbuff, fifo->skbuff->len - 3);
875 if (fifon == HFCUSB_PCM_RX) { 826 if (fifon == HFCUSB_PCM_RX) {
@@ -882,39 +833,17 @@ collect_rx_frame(usb_fifo * fifo, __u8 * data, int len, int finish)
882 fifo->skbuff); 833 fifo->skbuff);
883 fifo->skbuff = NULL; /* buffer was freed from upper layer */ 834 fifo->skbuff = NULL; /* buffer was freed from upper layer */
884 } else { 835 } else {
885 if (fifo->skbuff->len > 3) { 836 DBG(HFCUSB_DBG_FIFO_ERR,
886 printk(KERN_INFO 837 "HFC-S USB: ERROR frame len(%d) fifo(%d)",
887 "HFC-S USB: got frame %d bytes but CRC ERROR on fifo:%d!!!\n", 838 fifo->skbuff->len, fifon);
888 fifo->skbuff->len, fifon); 839 DBG_SKB(HFCUSB_DBG_VERBOSE_USB, fifo->skbuff);
889#ifdef CONFIG_HISAX_DEBUG
890 if (debug > 1) {
891 printk(KERN_INFO "HFC-S USB: ");
892 for (i = 0; i < 15; i++)
893 printk("%.2x ",
894 fifo->skbuff->
895 data[fifo->skbuff->
896 len - 15 + i]);
897 printk("\n");
898 }
899#endif
900 }
901#ifdef CONFIG_HISAX_DEBUG
902 else {
903 printk(KERN_INFO
904 "HFC-S USB: frame to small (%d bytes)!!!\n",
905 fifo->skbuff->len);
906 }
907#endif
908 skb_trim(fifo->skbuff, 0); 840 skb_trim(fifo->skbuff, 0);
909 } 841 }
910 } 842 }
911} 843}
912 844
913/***********************************************/
914/* receive completion routine for all rx fifos */
915/***********************************************/
916static void 845static void
917rx_complete(struct urb *urb) 846rx_int_complete(struct urb *urb)
918{ 847{
919 int len; 848 int len;
920 int status; 849 int status;
@@ -922,18 +851,14 @@ rx_complete(struct urb *urb)
922 usb_fifo *fifo = (usb_fifo *) urb->context; 851 usb_fifo *fifo = (usb_fifo *) urb->context;
923 hfcusb_data *hfc = fifo->hfc; 852 hfcusb_data *hfc = fifo->hfc;
924 static __u8 eof[8]; 853 static __u8 eof[8];
925#ifdef CONFIG_HISAX_DEBUG
926 __u8 i;
927#endif
928 854
929 urb->dev = hfc->dev; /* security init */ 855 urb->dev = hfc->dev; /* security init */
930 856
931 fifon = fifo->fifonum; 857 fifon = fifo->fifonum;
932 if ((!fifo->active) || (urb->status)) { 858 if ((!fifo->active) || (urb->status)) {
933#ifdef CONFIG_HISAX_DEBUG 859 DBG(HFCUSB_DBG_INIT, "HFC-S USB: RX-Fifo %i is going down (%i)",
934 DBG(USB_DBG, "HFC-S USB: RX-Fifo %i is going down (%i)",
935 fifon, urb->status); 860 fifon, urb->status);
936#endif 861
937 fifo->urb->interval = 0; /* cancel automatic rescheduling */ 862 fifo->urb->interval = 0; /* cancel automatic rescheduling */
938 if (fifo->skbuff) { 863 if (fifo->skbuff) {
939 dev_kfree_skb_any(fifo->skbuff); 864 dev_kfree_skb_any(fifo->skbuff);
@@ -945,22 +870,20 @@ rx_complete(struct urb *urb)
945 buf = fifo->buffer; 870 buf = fifo->buffer;
946 maxlen = fifo->usb_packet_maxlen; 871 maxlen = fifo->usb_packet_maxlen;
947 872
948#ifdef CONFIG_HISAX_DEBUG 873 if (fifon == HFCUSB_D_RX) {
949 if ((fifon == 5) && (debug > 1)) { 874 DBG(HFCUSB_DBG_VERBOSE_USB,
950 printk(KERN_INFO 875 "HFC-S USB: INT-D-RX lst_urblen:%2d "
951 "HFC-S USB: INT-D-RX lst_urblen:%2d act_urblen:%2d max-urblen:%2d EOF:0x%0x DATA: ", 876 "act_urblen:%2d max-urblen:%2d EOF:0x%0x",
952 fifo->last_urblen, len, maxlen, eof[5]); 877 fifo->last_urblen, len, maxlen,
953 for (i = 0; i < len; i++) 878 eof[5]);
954 printk("%.2x ", buf[i]); 879 DBG_PACKET(HFCUSB_DBG_VERBOSE_USB, buf, len);
955 printk("\n");
956 } 880 }
957#endif
958 881
959 if (fifo->last_urblen != fifo->usb_packet_maxlen) { 882 if (fifo->last_urblen != fifo->usb_packet_maxlen) {
960 /* the threshold mask is in the 2nd status byte */ 883 /* the threshold mask is in the 2nd status byte */
961 hfc->threshold_mask = buf[1]; 884 hfc->threshold_mask = buf[1];
962 /* the S0 state is in the upper half of the 1st status byte */ 885 /* the S0 state is in the upper half of the 1st status byte */
963 state_handler(hfc, buf[0] >> 4); 886 s0_state_handler(hfc, buf[0] >> 4);
964 eof[fifon] = buf[0] & 1; 887 eof[fifon] = buf[0] & 1;
965 /* if we have more than the 2 status bytes -> collect data */ 888 /* if we have more than the 2 status bytes -> collect data */
966 if (len > 2) 889 if (len > 2)
@@ -975,20 +898,19 @@ rx_complete(struct urb *urb)
975 status = usb_submit_urb(urb, GFP_ATOMIC); 898 status = usb_submit_urb(urb, GFP_ATOMIC);
976 if (status) { 899 if (status) {
977 printk(KERN_INFO 900 printk(KERN_INFO
978 "HFC-S USB: error resubmitting URN at rx_complete...\n"); 901 "HFC-S USB: %s error resubmitting URB fifo(%d)\n",
902 __FUNCTION__, fifon);
979 } 903 }
980} /* rx_complete */ 904}
981 905
982/***************************************************/ 906/* start initial INT-URB for certain fifo */
983/* start the interrupt transfer for the given fifo */
984/***************************************************/
985static void 907static void
986start_int_fifo(usb_fifo * fifo) 908start_int_fifo(usb_fifo * fifo)
987{ 909{
988 int errcode; 910 int errcode;
989 911
990 printk(KERN_INFO "HFC-S USB: starting intr IN fifo:%d\n", 912 DBG(HFCUSB_DBG_INIT, "HFC-S USB: starting RX INT-URB for fifo:%d\n",
991 fifo->fifonum); 913 fifo->fifonum);
992 914
993 if (!fifo->urb) { 915 if (!fifo->urb) {
994 fifo->urb = usb_alloc_urb(0, GFP_KERNEL); 916 fifo->urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -997,33 +919,28 @@ start_int_fifo(usb_fifo * fifo)
997 } 919 }
998 usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe, 920 usb_fill_int_urb(fifo->urb, fifo->hfc->dev, fifo->pipe,
999 fifo->buffer, fifo->usb_packet_maxlen, 921 fifo->buffer, fifo->usb_packet_maxlen,
1000 rx_complete, fifo, fifo->intervall); 922 rx_int_complete, fifo, fifo->intervall);
1001 fifo->active = 1; /* must be marked active */ 923 fifo->active = 1; /* must be marked active */
1002 errcode = usb_submit_urb(fifo->urb, GFP_KERNEL); 924 errcode = usb_submit_urb(fifo->urb, GFP_KERNEL);
1003 if (errcode) { 925 if (errcode) {
1004 printk(KERN_INFO 926 printk(KERN_ERR
1005 "HFC-S USB: submit URB error(start_int_info): status:%i\n", 927 "HFC-S USB: submit URB error(start_int_info): status:%i\n",
1006 errcode); 928 errcode);
1007 fifo->active = 0; 929 fifo->active = 0;
1008 fifo->skbuff = NULL; 930 fifo->skbuff = NULL;
1009 } 931 }
1010} /* start_int_fifo */ 932}
1011 933
1012/*****************************/
1013/* set the B-channel mode */
1014/*****************************/
1015static void 934static void
1016set_hfcmode(hfcusb_data * hfc, int channel, int mode) 935setup_bchannel(hfcusb_data * hfc, int channel, int mode)
1017{ 936{
1018 __u8 val, idx_table[2] = { 0, 2 }; 937 __u8 val, idx_table[2] = { 0, 2 };
1019 938
1020 if (hfc->disc_flag) { 939 if (hfc->disc_flag) {
1021 return; 940 return;
1022 } 941 }
1023#ifdef CONFIG_HISAX_DEBUG 942 DBG(HFCUSB_DBG_STATES, "HFC-S USB: setting channel %d to mode %d",
1024 DBG(ISDN_DBG, "HFC-S USB: setting channel %d to mode %d", channel, 943 channel, mode);
1025 mode);
1026#endif
1027 hfc->b_mode[channel] = mode; 944 hfc->b_mode[channel] = mode;
1028 945
1029 /* setup CON_HDLC */ 946 /* setup CON_HDLC */
@@ -1080,20 +997,17 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg)
1080 switch (pr) { 997 switch (pr) {
1081 case PH_ACTIVATE | REQUEST: 998 case PH_ACTIVATE | REQUEST:
1082 if (fifo->fifonum == HFCUSB_D_TX) { 999 if (fifo->fifonum == HFCUSB_D_TX) {
1083#ifdef CONFIG_HISAX_DEBUG 1000 DBG(HFCUSB_DBG_STATES,
1084 DBG(ISDN_DBG,
1085 "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_ACTIVATE | REQUEST"); 1001 "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_ACTIVATE | REQUEST");
1086#endif 1002
1087 if (hfc->l1_state != 3 1003 if (hfc->l1_state != 3
1088 && hfc->l1_state != 7) { 1004 && hfc->l1_state != 7) {
1089 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc, 1005 hfc->d_if.ifc.l1l2(&hfc->d_if.ifc,
1090 PH_DEACTIVATE | 1006 PH_DEACTIVATE |
1091 INDICATION, 1007 INDICATION,
1092 NULL); 1008 NULL);
1093#ifdef CONFIG_HISAX_DEBUG 1009 DBG(HFCUSB_DBG_STATES,
1094 DBG(ISDN_DBG,
1095 "HFC-S USB: PH_DEACTIVATE | INDICATION sent (not state 3 or 7)"); 1010 "HFC-S USB: PH_DEACTIVATE | INDICATION sent (not state 3 or 7)");
1096#endif
1097 } else { 1011 } else {
1098 if (hfc->l1_state == 7) { /* l1 already active */ 1012 if (hfc->l1_state == 7) { /* l1 already active */
1099 hfc->d_if.ifc.l1l2(&hfc-> 1013 hfc->d_if.ifc.l1l2(&hfc->
@@ -1103,10 +1017,8 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg)
1103 | 1017 |
1104 INDICATION, 1018 INDICATION,
1105 NULL); 1019 NULL);
1106#ifdef CONFIG_HISAX_DEBUG 1020 DBG(HFCUSB_DBG_STATES,
1107 DBG(ISDN_DBG,
1108 "HFC-S USB: PH_ACTIVATE | INDICATION sent again ;)"); 1021 "HFC-S USB: PH_ACTIVATE | INDICATION sent again ;)");
1109#endif
1110 } else { 1022 } else {
1111 /* force sending sending INFO1 */ 1023 /* force sending sending INFO1 */
1112 queue_control_request(hfc, 1024 queue_control_request(hfc,
@@ -1132,11 +1044,9 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg)
1132 } 1044 }
1133 } 1045 }
1134 } else { 1046 } else {
1135#ifdef CONFIG_HISAX_DEBUG 1047 DBG(HFCUSB_DBG_STATES,
1136 DBG(ISDN_DBG, 1048 "HFC_USB: hfc_usb_d_l2l1 B-chan: PH_ACTIVATE | REQUEST");
1137 "HFC_USB: hfc_usb_d_l2l1 Bx-chan: PH_ACTIVATE | REQUEST"); 1049 setup_bchannel(hfc,
1138#endif
1139 set_hfcmode(hfc,
1140 (fifo->fifonum == 1050 (fifo->fifonum ==
1141 HFCUSB_B1_TX) ? 0 : 1, 1051 HFCUSB_B1_TX) ? 0 : 1,
1142 (long) arg); 1052 (long) arg);
@@ -1147,18 +1057,12 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg)
1147 break; 1057 break;
1148 case PH_DEACTIVATE | REQUEST: 1058 case PH_DEACTIVATE | REQUEST:
1149 if (fifo->fifonum == HFCUSB_D_TX) { 1059 if (fifo->fifonum == HFCUSB_D_TX) {
1150#ifdef CONFIG_HISAX_DEBUG 1060 DBG(HFCUSB_DBG_STATES,
1151 DBG(ISDN_DBG,
1152 "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_DEACTIVATE | REQUEST"); 1061 "HFC_USB: hfc_usb_d_l2l1 D-chan: PH_DEACTIVATE | REQUEST");
1153#endif
1154 printk(KERN_INFO
1155 "HFC-S USB: ISDN TE device should not deativate...\n");
1156 } else { 1062 } else {
1157#ifdef CONFIG_HISAX_DEBUG 1063 DBG(HFCUSB_DBG_STATES,
1158 DBG(ISDN_DBG,
1159 "HFC_USB: hfc_usb_d_l2l1 Bx-chan: PH_DEACTIVATE | REQUEST"); 1064 "HFC_USB: hfc_usb_d_l2l1 Bx-chan: PH_DEACTIVATE | REQUEST");
1160#endif 1065 setup_bchannel(hfc,
1161 set_hfcmode(hfc,
1162 (fifo->fifonum == 1066 (fifo->fifonum ==
1163 HFCUSB_B1_TX) ? 0 : 1, 1067 HFCUSB_B1_TX) ? 0 : 1,
1164 (int) L1_MODE_NULL); 1068 (int) L1_MODE_NULL);
@@ -1171,25 +1075,20 @@ hfc_usb_l2l1(struct hisax_if *my_hisax_if, int pr, void *arg)
1171 if (fifo->skbuff && fifo->delete_flg) { 1075 if (fifo->skbuff && fifo->delete_flg) {
1172 dev_kfree_skb_any(fifo->skbuff); 1076 dev_kfree_skb_any(fifo->skbuff);
1173 fifo->skbuff = NULL; 1077 fifo->skbuff = NULL;
1174 fifo->delete_flg = false; 1078 fifo->delete_flg = 0;
1175 } 1079 }
1176 fifo->skbuff = arg; /* we have a new buffer */ 1080 fifo->skbuff = arg; /* we have a new buffer */
1177 break; 1081 break;
1178 default: 1082 default:
1179 printk(KERN_INFO 1083 DBG(HFCUSB_DBG_STATES,
1180 "HFC_USB: hfc_usb_d_l2l1: unkown state : %#x\n", 1084 "HFC_USB: hfc_usb_d_l2l1: unkown state : %#x", pr);
1181 pr);
1182 break; 1085 break;
1183 } 1086 }
1184} 1087}
1185 1088
1186/***************************************************************************/ 1089/* initial init HFC-S USB chip registers, HiSax interface, USB URBs */
1187/* usb_init is called once when a new matching device is detected to setup */
1188/* main parameters. It registers the driver at the main hisax module. */
1189/* on success 0 is returned. */
1190/***************************************************************************/
1191static int 1090static int
1192usb_init(hfcusb_data * hfc) 1091hfc_usb_init(hfcusb_data * hfc)
1193{ 1092{
1194 usb_fifo *fifo; 1093 usb_fifo *fifo;
1195 int i, err; 1094 int i, err;
@@ -1214,11 +1113,11 @@ usb_init(hfcusb_data * hfc)
1214 /* aux = output, reset off */ 1113 /* aux = output, reset off */
1215 write_usb(hfc, HFCUSB_CIRM, 0x10); 1114 write_usb(hfc, HFCUSB_CIRM, 0x10);
1216 1115
1217 /* set USB_SIZE to match the wMaxPacketSize for INT or BULK transfers */ 1116 /* set USB_SIZE to match wMaxPacketSize for INT or BULK transfers */
1218 write_usb(hfc, HFCUSB_USB_SIZE, 1117 write_usb(hfc, HFCUSB_USB_SIZE,
1219 (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4)); 1118 (hfc->packet_size / 8) | ((hfc->packet_size / 8) << 4));
1220 1119
1221 /* set USB_SIZE_I to match the wMaxPacketSize for ISO transfers */ 1120 /* set USB_SIZE_I to match wMaxPacketSize for ISO transfers */
1222 write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size); 1121 write_usb(hfc, HFCUSB_USB_SIZE_I, hfc->iso_packet_size);
1223 1122
1224 /* enable PCM/GCI master mode */ 1123 /* enable PCM/GCI master mode */
@@ -1257,8 +1156,8 @@ usb_init(hfcusb_data * hfc)
1257 hfc->b_mode[0] = L1_MODE_NULL; 1156 hfc->b_mode[0] = L1_MODE_NULL;
1258 hfc->b_mode[1] = L1_MODE_NULL; 1157 hfc->b_mode[1] = L1_MODE_NULL;
1259 1158
1260 hfc->l1_activated = false; 1159 hfc->l1_activated = 0;
1261 hfc->disc_flag = false; 1160 hfc->disc_flag = 0;
1262 hfc->led_state = 0; 1161 hfc->led_state = 0;
1263 hfc->led_new_data = 0; 1162 hfc->led_new_data = 0;
1264 hfc->old_led_state = 0; 1163 hfc->old_led_state = 0;
@@ -1349,11 +1248,9 @@ usb_init(hfcusb_data * hfc)
1349 handle_led(hfc, LED_POWER_ON); 1248 handle_led(hfc, LED_POWER_ON);
1350 1249
1351 return (0); 1250 return (0);
1352} /* usb_init */ 1251}
1353 1252
1354/*************************************************/ 1253/* initial callback for each plugged USB device */
1355/* function called to probe a new plugged device */
1356/*************************************************/
1357static int 1254static int
1358hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) 1255hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1359{ 1256{
@@ -1378,11 +1275,6 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1378 } 1275 }
1379 } 1276 }
1380 1277
1381#ifdef CONFIG_HISAX_DEBUG
1382 DBG(USB_DBG,
1383 "HFC-USB: probing interface(%d) actalt(%d) minor(%d)\n", ifnum,
1384 iface->desc.bAlternateSetting, intf->minor);
1385#endif
1386 printk(KERN_INFO 1278 printk(KERN_INFO
1387 "HFC-S USB: probing interface(%d) actalt(%d) minor(%d)\n", 1279 "HFC-S USB: probing interface(%d) actalt(%d) minor(%d)\n",
1388 ifnum, iface->desc.bAlternateSetting, intf->minor); 1280 ifnum, iface->desc.bAlternateSetting, intf->minor);
@@ -1403,15 +1295,11 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1403 1295
1404 /* check for config EOL element */ 1296 /* check for config EOL element */
1405 while (validconf[cfg_used][0]) { 1297 while (validconf[cfg_used][0]) {
1406 cfg_found = true; 1298 cfg_found = 1;
1407 vcf = validconf[cfg_used]; 1299 vcf = validconf[cfg_used];
1408 /* first endpoint descriptor */ 1300 /* first endpoint descriptor */
1409 ep = iface->endpoint; 1301 ep = iface->endpoint;
1410#ifdef CONFIG_HISAX_DEBUG 1302
1411 DBG(USB_DBG,
1412 "HFC-S USB: (if=%d alt=%d cfg_used=%d)\n",
1413 ifnum, probe_alt_setting, cfg_used);
1414#endif
1415 memcpy(cmptbl, vcf, 16 * sizeof(int)); 1303 memcpy(cmptbl, vcf, 16 * sizeof(int));
1416 1304
1417 /* check for all endpoints in this alternate setting */ 1305 /* check for all endpoints in this alternate setting */
@@ -1425,7 +1313,7 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1425 idx++; 1313 idx++;
1426 attr = ep->desc.bmAttributes; 1314 attr = ep->desc.bmAttributes;
1427 if (cmptbl[idx] == EP_NUL) { 1315 if (cmptbl[idx] == EP_NUL) {
1428 cfg_found = false; 1316 cfg_found = 0;
1429 } 1317 }
1430 if (attr == USB_ENDPOINT_XFER_INT 1318 if (attr == USB_ENDPOINT_XFER_INT
1431 && cmptbl[idx] == EP_INT) 1319 && cmptbl[idx] == EP_INT)
@@ -1438,16 +1326,9 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1438 cmptbl[idx] = EP_NUL; 1326 cmptbl[idx] = EP_NUL;
1439 1327
1440 /* check if all INT endpoints match minimum interval */ 1328 /* check if all INT endpoints match minimum interval */
1441 if (attr == USB_ENDPOINT_XFER_INT 1329 if ((attr == USB_ENDPOINT_XFER_INT)
1442 && ep->desc.bInterval < 1330 && (ep->desc.bInterval < vcf[17])) {
1443 vcf[17]) { 1331 cfg_found = 0;
1444#ifdef CONFIG_HISAX_DEBUG
1445 if (cfg_found)
1446 DBG(USB_DBG,
1447 "HFC-S USB: Interrupt Endpoint interval < %d found - skipping config",
1448 vcf[17]);
1449#endif
1450 cfg_found = false;
1451 } 1332 }
1452 ep++; 1333 ep++;
1453 } 1334 }
@@ -1455,7 +1336,7 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1455 /* all entries must be EP_NOP or EP_NUL for a valid config */ 1336 /* all entries must be EP_NOP or EP_NUL for a valid config */
1456 if (cmptbl[i] != EP_NOP 1337 if (cmptbl[i] != EP_NOP
1457 && cmptbl[i] != EP_NUL) 1338 && cmptbl[i] != EP_NUL)
1458 cfg_found = false; 1339 cfg_found = 0;
1459 } 1340 }
1460 if (cfg_found) { 1341 if (cfg_found) {
1461 if (cfg_used < small_match) { 1342 if (cfg_used < small_match) {
@@ -1464,23 +1345,16 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1464 probe_alt_setting; 1345 probe_alt_setting;
1465 iface_used = iface; 1346 iface_used = iface;
1466 } 1347 }
1467#ifdef CONFIG_HISAX_DEBUG
1468 DBG(USB_DBG,
1469 "HFC-USB: small_match=%x %x\n",
1470 small_match, alt_used);
1471#endif
1472 } 1348 }
1473 cfg_used++; 1349 cfg_used++;
1474 } 1350 }
1475 alt_idx++; 1351 alt_idx++;
1476 } /* (alt_idx < intf->num_altsetting) */ 1352 } /* (alt_idx < intf->num_altsetting) */
1477 1353
1478 /* found a valid USB Ta Endpint config */ 1354 /* found a valid USB Ta Endpint config */
1479 if (small_match != 0xffff) { 1355 if (small_match != 0xffff) {
1480 iface = iface_used; 1356 iface = iface_used;
1481 if (! 1357 if (!(context = kzalloc(sizeof(hfcusb_data), GFP_KERNEL)))
1482 (context =
1483 kzalloc(sizeof(hfcusb_data), GFP_KERNEL)))
1484 return (-ENOMEM); /* got no mem */ 1358 return (-ENOMEM); /* got no mem */
1485 1359
1486 ep = iface->endpoint; 1360 ep = iface->endpoint;
@@ -1613,20 +1487,15 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1613 driver_info; 1487 driver_info;
1614 printk(KERN_INFO "HFC-S USB: detected \"%s\"\n", 1488 printk(KERN_INFO "HFC-S USB: detected \"%s\"\n",
1615 driver_info->vend_name); 1489 driver_info->vend_name);
1616#ifdef CONFIG_HISAX_DEBUG 1490
1617 DBG(USB_DBG, 1491 DBG(HFCUSB_DBG_INIT,
1618 "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d)\n", 1492 "HFC-S USB: Endpoint-Config: %s (if=%d alt=%d), E-Channel(%d)",
1619 conf_str[small_match], context->if_used, 1493 conf_str[small_match], context->if_used,
1620 context->alt_used); 1494 context->alt_used,
1621 printk(KERN_INFO 1495 validconf[small_match][18]);
1622 "HFC-S USB: E-channel (\"ECHO:\") logging "); 1496
1623 if (validconf[small_match][18])
1624 printk(" possible\n");
1625 else
1626 printk("NOT possible\n");
1627#endif
1628 /* init the chip and register the driver */ 1497 /* init the chip and register the driver */
1629 if (usb_init(context)) { 1498 if (hfc_usb_init(context)) {
1630 usb_kill_urb(context->ctrl_urb); 1499 usb_kill_urb(context->ctrl_urb);
1631 usb_free_urb(context->ctrl_urb); 1500 usb_free_urb(context->ctrl_urb);
1632 context->ctrl_urb = NULL; 1501 context->ctrl_urb = NULL;
@@ -1643,17 +1512,19 @@ hfc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1643 return (-EIO); 1512 return (-EIO);
1644} 1513}
1645 1514
1646/****************************************************/ 1515/* callback for unplugged USB device */
1647/* function called when an active device is removed */
1648/****************************************************/
1649static void 1516static void
1650hfc_usb_disconnect(struct usb_interface 1517hfc_usb_disconnect(struct usb_interface
1651 *intf) 1518 *intf)
1652{ 1519{
1653 hfcusb_data *context = usb_get_intfdata(intf); 1520 hfcusb_data *context = usb_get_intfdata(intf);
1654 int i; 1521 int i;
1522
1523 handle_led(context, LED_POWER_OFF);
1524 schedule_timeout((10 * HZ) / 1000);
1525
1655 printk(KERN_INFO "HFC-S USB: device disconnect\n"); 1526 printk(KERN_INFO "HFC-S USB: device disconnect\n");
1656 context->disc_flag = true; 1527 context->disc_flag = 1;
1657 usb_set_intfdata(intf, NULL); 1528 usb_set_intfdata(intf, NULL);
1658 if (!context) 1529 if (!context)
1659 return; 1530 return;
@@ -1661,25 +1532,22 @@ hfc_usb_disconnect(struct usb_interface
1661 del_timer(&context->t3_timer); 1532 del_timer(&context->t3_timer);
1662 if (timer_pending(&context->t4_timer)) 1533 if (timer_pending(&context->t4_timer))
1663 del_timer(&context->t4_timer); 1534 del_timer(&context->t4_timer);
1535
1664 /* tell all fifos to terminate */ 1536 /* tell all fifos to terminate */
1665 for (i = 0; i < HFCUSB_NUM_FIFOS; i++) { 1537 for (i = 0; i < HFCUSB_NUM_FIFOS; i++) {
1666 if (context->fifos[i].usb_transfer_mode == USB_ISOC) { 1538 if (context->fifos[i].usb_transfer_mode == USB_ISOC) {
1667 if (context->fifos[i].active > 0) { 1539 if (context->fifos[i].active > 0) {
1668 stop_isoc_chain(&context->fifos[i]); 1540 stop_isoc_chain(&context->fifos[i]);
1669#ifdef CONFIG_HISAX_DEBUG 1541 DBG(HFCUSB_DBG_INIT,
1670 DBG(USB_DBG, 1542 "HFC-S USB: %s stopping ISOC chain Fifo(%i)",
1671 "HFC-S USB: hfc_usb_disconnect: stopping ISOC chain Fifo no %i", 1543 __FUNCTION__, i);
1672 i);
1673#endif
1674 } 1544 }
1675 } else { 1545 } else {
1676 if (context->fifos[i].active > 0) { 1546 if (context->fifos[i].active > 0) {
1677 context->fifos[i].active = 0; 1547 context->fifos[i].active = 0;
1678#ifdef CONFIG_HISAX_DEBUG 1548 DBG(HFCUSB_DBG_INIT,
1679 DBG(USB_DBG, 1549 "HFC-S USB: %s unlinking URB for Fifo(%i)",
1680 "HFC-S USB: hfc_usb_disconnect: unlinking URB for Fifo no %i", 1550 __FUNCTION__, i);
1681 i);
1682#endif
1683 } 1551 }
1684 usb_kill_urb(context->fifos[i].urb); 1552 usb_kill_urb(context->fifos[i].urb);
1685 usb_free_urb(context->fifos[i].urb); 1553 usb_free_urb(context->fifos[i].urb);
@@ -1692,34 +1560,29 @@ hfc_usb_disconnect(struct usb_interface
1692 context->ctrl_urb = NULL; 1560 context->ctrl_urb = NULL;
1693 hisax_unregister(&context->d_if); 1561 hisax_unregister(&context->d_if);
1694 kfree(context); /* free our structure again */ 1562 kfree(context); /* free our structure again */
1695} /* hfc_usb_disconnect */ 1563}
1696 1564
1697/************************************/
1698/* our driver information structure */
1699/************************************/
1700static struct usb_driver hfc_drv = { 1565static struct usb_driver hfc_drv = {
1701 .name = "hfc_usb", 1566 .name = "hfc_usb",
1702 .id_table = hfcusb_idtab, 1567 .id_table = hfcusb_idtab,
1703 .probe = hfc_usb_probe, 1568 .probe = hfc_usb_probe,
1704 .disconnect = hfc_usb_disconnect, 1569 .disconnect = hfc_usb_disconnect,
1705}; 1570};
1571
1706static void __exit 1572static void __exit
1707hfc_usb_exit(void) 1573hfc_usb_mod_exit(void)
1708{ 1574{
1709#ifdef CONFIG_HISAX_DEBUG 1575 usb_deregister(&hfc_drv); /* release our driver */
1710 DBG(USB_DBG, "HFC-S USB: calling \"hfc_usb_exit\" ...");
1711#endif
1712 usb_deregister(&hfc_drv); /* release our driver */
1713 printk(KERN_INFO "HFC-S USB: module removed\n"); 1576 printk(KERN_INFO "HFC-S USB: module removed\n");
1714} 1577}
1715 1578
1716static int __init 1579static int __init
1717hfc_usb_init(void) 1580hfc_usb_mod_init(void)
1718{ 1581{
1582 char revstr[30], datestr[30], dummy[30];
1719#ifndef CONFIG_HISAX_DEBUG 1583#ifndef CONFIG_HISAX_DEBUG
1720 unsigned int debug = -1; 1584 hfc_debug = debug;
1721#endif 1585#endif
1722 char revstr[30], datestr[30], dummy[30];
1723 sscanf(hfcusb_revision, 1586 sscanf(hfcusb_revision,
1724 "%s %s $ %s %s %s $ ", dummy, revstr, 1587 "%s %s $ %s %s %s $ ", dummy, revstr,
1725 dummy, datestr, dummy); 1588 dummy, datestr, dummy);
@@ -1734,8 +1597,8 @@ hfc_usb_init(void)
1734 return (0); 1597 return (0);
1735} 1598}
1736 1599
1737module_init(hfc_usb_init); 1600module_init(hfc_usb_mod_init);
1738module_exit(hfc_usb_exit); 1601module_exit(hfc_usb_mod_exit);
1739MODULE_AUTHOR(DRIVER_AUTHOR); 1602MODULE_AUTHOR(DRIVER_AUTHOR);
1740MODULE_DESCRIPTION(DRIVER_DESC); 1603MODULE_DESCRIPTION(DRIVER_DESC);
1741MODULE_LICENSE("GPL"); 1604MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/hisax/hfc_usb.h b/drivers/isdn/hisax/hfc_usb.h
index 471f2354dfde..e79f56568d30 100644
--- a/drivers/isdn/hisax/hfc_usb.h
+++ b/drivers/isdn/hisax/hfc_usb.h
@@ -1,8 +1,8 @@
1/* 1/*
2* hfc_usb.h 2 * hfc_usb.h
3* 3 *
4* $Id: hfc_usb.h,v 4.2 2005/04/07 15:27:17 martinb1 Exp $ 4 * $Id: hfc_usb.h,v 1.1.2.5 2007/08/20 14:36:03 mbachem Exp $
5*/ 5 */
6 6
7#ifndef __HFC_USB_H__ 7#ifndef __HFC_USB_H__
8#define __HFC_USB_H__ 8#define __HFC_USB_H__
@@ -10,25 +10,20 @@
10#define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)" 10#define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)"
11#define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver" 11#define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver"
12 12
13#define VERBOSE_USB_DEBUG
14 13
14#define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */
15#define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */
16#define HFC_TIMER_T4 500 /* time for state change interval */
15 17
16/***********/ 18#define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */
17/* defines */ 19#define HFCUSB_L1_DRX 1 /* D-frame received */
18/***********/ 20#define HFCUSB_L1_ERX 2 /* E-frame received */
19#define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */ 21#define HFCUSB_L1_DTX 4 /* D-frames completed */
20#define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */
21#define HFC_TIMER_T4 500 /* time for state change interval */
22 22
23#define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */ 23#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */
24#define HFCUSB_L1_DRX 1 /* D-frame received */
25#define HFCUSB_L1_ERX 2 /* E-frame received */
26#define HFCUSB_L1_DTX 4 /* D-frames completed */
27 24
28#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */ 25#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
29 26#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
30#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
31#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
32 27
33#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */ 28#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */
34#define HFCUSB_CIRM 0x00 /* cirm register index */ 29#define HFCUSB_CIRM 0x00 /* cirm register index */
@@ -52,9 +47,8 @@
52 47
53#define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */ 48#define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */
54 49
55/******************/ 50
56/* fifo registers */ 51/* fifo registers */
57/******************/
58#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */ 52#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */
59#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */ 53#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */
60#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */ 54#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */
@@ -66,9 +60,9 @@
66#define HFCUSB_PCM_RX 7 60#define HFCUSB_PCM_RX 7
67 61
68/* 62/*
69* used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just 63 * used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just
70* supports ISO out, while the Cologne Chip EVAL TA just supports BULK out 64 * supports ISO out, while the Cologne Chip EVAL TA just supports BULK out
71*/ 65 */
72#define USB_INT 0 66#define USB_INT 0
73#define USB_BULK 1 67#define USB_BULK 1
74#define USB_ISOC 2 68#define USB_ISOC 2
@@ -77,49 +71,36 @@
77#define ISOC_PACKETS_B 8 71#define ISOC_PACKETS_B 8
78#define ISO_BUFFER_SIZE 128 72#define ISO_BUFFER_SIZE 128
79 73
80// ISO send definitions 74/* Fifo flow Control for TX ISO */
81#define SINK_MAX 68 75#define SINK_MAX 68
82#define SINK_MIN 48 76#define SINK_MIN 48
83#define SINK_DMIN 12 77#define SINK_DMIN 12
84#define SINK_DMAX 18 78#define SINK_DMAX 18
85#define BITLINE_INF (-64*8) 79#define BITLINE_INF (-64*8)
86 80
87 81/* HFC-S USB register access by Control-URSs */
88/**********/
89/* macros */
90/**********/
91#define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT) 82#define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT)
92#define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT) 83#define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
93
94
95/*******************/
96/* Debugging Flags */
97/*******************/
98#define USB_DBG 1
99#define ISDN_DBG 2
100
101
102/* *********************/
103/* USB related defines */
104/***********************/
105#define HFC_CTRL_BUFSIZE 32 84#define HFC_CTRL_BUFSIZE 32
106 85
107
108
109/*************************************************/
110/* entry and size of output/input control buffer */ 86/* entry and size of output/input control buffer */
111/*************************************************/
112typedef struct { 87typedef struct {
113 __u8 hfc_reg; /* register number */ 88 __u8 hfc_reg; /* register number */
114 __u8 reg_val; /* value to be written (or read) */ 89 __u8 reg_val; /* value to be written (or read) */
115 int action; /* data for action handler */ 90 int action; /* data for action handler */
116} ctrl_buft; 91} ctrl_buft;
117 92
93/* Debugging Flags */
94#define HFCUSB_DBG_INIT 0x0001
95#define HFCUSB_DBG_STATES 0x0002
96#define HFCUSB_DBG_DCHANNEL 0x0080
97#define HFCUSB_DBG_FIFO_ERR 0x4000
98#define HFCUSB_DBG_VERBOSE_USB 0x8000
118 99
119/********************/ 100/*
120/* URB error codes: */ 101 * URB error codes:
121/********************/ 102 * Used to represent a list of values and their respective symbolic names
122/* Used to represent a list of values and their respective symbolic names */ 103 */
123struct hfcusb_symbolic_list { 104struct hfcusb_symbolic_list {
124 const int num; 105 const int num;
125 const char *name; 106 const char *name;
@@ -134,20 +115,20 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
134 {-ENXIO, "URB already queued"}, 115 {-ENXIO, "URB already queued"},
135 {-EFBIG, "Too much ISO frames requested"}, 116 {-EFBIG, "Too much ISO frames requested"},
136 {-ENOSR, "Buffer error (overrun)"}, 117 {-ENOSR, "Buffer error (overrun)"},
137 {-EPIPE, "Specified endpoint is stalled"}, 118 {-EPIPE, "Specified endpoint is stalled (device not responding)"},
138 {-EOVERFLOW, "Babble (bad cable?)"}, 119 {-EOVERFLOW, "Babble (bad cable?)"},
139 {-EPROTO, "Bit-stuff error (bad cable?)"}, 120 {-EPROTO, "Bit-stuff error (bad cable?)"},
140 {-EILSEQ, "CRC or missing token"}, 121 {-EILSEQ, "CRC/Timeout"},
141 {-ETIME, "Device did not respond"}, 122 {-ETIMEDOUT, "NAK (device does not respond)"},
142 {-ESHUTDOWN, "Device unplugged"}, 123 {-ESHUTDOWN, "Device unplugged"},
143 {-1, NULL} 124 {-1, NULL}
144}; 125};
145 126
146 127
147/*****************************************************/ 128/*
148/* device dependant information to support different */ 129 * device dependant information to support different
149/* ISDN Ta's using the HFC-S USB chip */ 130 * ISDN Ta's using the HFC-S USB chip
150/*****************************************************/ 131 */
151 132
152/* USB descriptor need to contain one of the following EndPoint combination: */ 133/* USB descriptor need to contain one of the following EndPoint combination: */
153#define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT 134#define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT
@@ -155,16 +136,19 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
155#define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT 136#define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT
156#define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT 137#define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT
157 138
158#define EP_NUL 1 // Endpoint at this position not allowed 139#define EP_NUL 1 // Endpoint at this position not allowed
159#define EP_NOP 2 // all type of endpoints allowed at this position 140#define EP_NOP 2 // all type of endpoints allowed at this position
160#define EP_ISO 3 // Isochron endpoint mandatory at this position 141#define EP_ISO 3 // Isochron endpoint mandatory at this position
161#define EP_BLK 4 // Bulk endpoint mandatory at this position 142#define EP_BLK 4 // Bulk endpoint mandatory at this position
162#define EP_INT 5 // Interrupt endpoint mandatory at this position 143#define EP_INT 5 // Interrupt endpoint mandatory at this position
163 144
164/* this array represents all endpoints possible in the HCF-USB the last 145/*
165* 3 entries are the configuration number, the minimum interval for 146 * List of all supported endpoint configuration sets, used to find the
166* Interrupt endpoints & boolean if E-channel logging possible 147 * best matching endpoint configuration within a devices' USB descriptor.
167*/ 148 * We need at least 3 RX endpoints, and 3 TX endpoints, either
149 * INT-in and ISO-out, or ISO-in and ISO-out)
150 * with 4 RX endpoints even E-Channel logging is possible
151 */
168static int validconf[][19] = { 152static int validconf[][19] = {
169 // INT in, ISO out config 153 // INT in, ISO out config
170 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT, 154 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT,
@@ -193,7 +177,6 @@ static char *conf_str[] = {
193}; 177};
194#endif 178#endif
195 179
196
197typedef struct { 180typedef struct {
198 int vendor; // vendor id 181 int vendor; // vendor id
199 int prod_id; // product id 182 int prod_id; // product id
@@ -202,9 +185,9 @@ typedef struct {
202 signed short led_bits[8]; // array of 8 possible LED bitmask settings 185 signed short led_bits[8]; // array of 8 possible LED bitmask settings
203} vendor_data; 186} vendor_data;
204 187
205#define LED_OFF 0 // no LED support 188#define LED_OFF 0 // no LED support
206#define LED_SCHEME1 1 // LED standard scheme 189#define LED_SCHEME1 1 // LED standard scheme
207#define LED_SCHEME2 2 // not used yet... 190#define LED_SCHEME2 2 // not used yet...
208 191
209#define LED_POWER_ON 1 192#define LED_POWER_ON 1
210#define LED_POWER_OFF 2 193#define LED_POWER_OFF 2
@@ -217,11 +200,8 @@ typedef struct {
217#define LED_B2_OFF 9 200#define LED_B2_OFF 9
218#define LED_B2_DATA 10 201#define LED_B2_DATA 10
219 202
220#define LED_NORMAL 0 // LEDs are normal 203#define LED_NORMAL 0 // LEDs are normal
221#define LED_INVERTED 1 // LEDs are inverted 204#define LED_INVERTED 1 // LEDs are inverted
222
223/* time in ms to perform a Flashing LED when B-Channel has traffic */
224#define LED_TIME 250
225 205
226 206
227#endif // __HFC_USB_H__ 207#endif // __HFC_USB_H__
diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig
index 6cecc396e040..7b64fd4aa2f3 100644
--- a/drivers/kvm/Kconfig
+++ b/drivers/kvm/Kconfig
@@ -5,6 +5,11 @@ menuconfig VIRTUALIZATION
5 bool "Virtualization" 5 bool "Virtualization"
6 depends on X86 6 depends on X86
7 default y 7 default y
8 ---help---
9 Say Y here to get to see options for virtualization guest drivers.
10 This option alone does not add any kernel code.
11
12 If you say N, all options in this submenu will be skipped and disabled.
8 13
9if VIRTUALIZATION 14if VIRTUALIZATION
10 15
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 96856097d15b..cd0557954e50 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2974,6 +2974,10 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val,
2974 switch (val) { 2974 switch (val) {
2975 case CPU_DYING: 2975 case CPU_DYING:
2976 case CPU_DYING_FROZEN: 2976 case CPU_DYING_FROZEN:
2977 printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n",
2978 cpu);
2979 hardware_disable(NULL);
2980 break;
2977 case CPU_UP_CANCELED: 2981 case CPU_UP_CANCELED:
2978 case CPU_UP_CANCELED_FROZEN: 2982 case CPU_UP_CANCELED_FROZEN:
2979 printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", 2983 printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n",
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index fd6925f41647..41e2250613a1 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -1,6 +1,6 @@
1config LGUEST 1config LGUEST
2 tristate "Linux hypervisor example code" 2 tristate "Linux hypervisor example code"
3 depends on X86 && PARAVIRT && EXPERIMENTAL && !X86_PAE 3 depends on X86 && PARAVIRT && EXPERIMENTAL && !X86_PAE && FUTEX
4 select LGUEST_GUEST 4 select LGUEST_GUEST
5 select HVC_DRIVER 5 select HVC_DRIVER
6 ---help--- 6 ---help---
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index dbe96268866e..56cd8998fe4b 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -3,6 +3,11 @@ menuconfig MACINTOSH_DRIVERS
3 bool "Macintosh device drivers" 3 bool "Macintosh device drivers"
4 depends on PPC || MAC || X86 4 depends on PPC || MAC || X86
5 default y if (PPC_PMAC || MAC) 5 default y if (PPC_PMAC || MAC)
6 ---help---
7 Say Y here to get to see options for devices used with Macintosh
8 computers. This option alone does not add any kernel code.
9
10 If you say N, all options in this submenu will be skipped and disabled.
6 11
7if MACINTOSH_DRIVERS 12if MACINTOSH_DRIVERS
8 13
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 76c1e8e4a487..33dee3a773ed 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -13,6 +13,7 @@
13#include <linux/sysctl.h> 13#include <linux/sysctl.h>
14#include <linux/input.h> 14#include <linux/input.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kbd_kern.h>
16 17
17 18
18static struct input_dev *emumousebtn; 19static struct input_dev *emumousebtn;
diff --git a/drivers/macintosh/via-pmu68k.c b/drivers/macintosh/via-pmu68k.c
index dfdf11c1eec4..e2f84da09e7c 100644
--- a/drivers/macintosh/via-pmu68k.c
+++ b/drivers/macintosh/via-pmu68k.c
@@ -818,243 +818,3 @@ pmu_present(void)
818{ 818{
819 return (pmu_kind != PMU_UNKNOWN); 819 return (pmu_kind != PMU_UNKNOWN);
820} 820}
821
822#if 0 /* needs some work for 68K */
823
824/*
825 * This struct is used to store config register values for
826 * PCI devices which may get powered off when we sleep.
827 */
828static struct pci_save {
829 u16 command;
830 u16 cache_lat;
831 u16 intr;
832} *pbook_pci_saves;
833static int n_pbook_pci_saves;
834
835static inline void
836pbook_pci_save(void)
837{
838 int npci;
839 struct pci_dev *pd = NULL;
840 struct pci_save *ps;
841
842 npci = 0;
843 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL)
844 ++npci;
845 n_pbook_pci_saves = npci;
846 if (npci == 0)
847 return;
848 ps = kmalloc(npci * sizeof(*ps), GFP_KERNEL);
849 pbook_pci_saves = ps;
850 if (ps == NULL)
851 return;
852
853 pd = NULL;
854 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
855 pci_read_config_word(pd, PCI_COMMAND, &ps->command);
856 pci_read_config_word(pd, PCI_CACHE_LINE_SIZE, &ps->cache_lat);
857 pci_read_config_word(pd, PCI_INTERRUPT_LINE, &ps->intr);
858 ++ps;
859 --npci;
860 }
861}
862
863static inline void
864pbook_pci_restore(void)
865{
866 u16 cmd;
867 struct pci_save *ps = pbook_pci_saves;
868 struct pci_dev *pd = NULL;
869 int j;
870
871 while ((pd = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pd)) != NULL) {
872 if (ps->command == 0)
873 continue;
874 pci_read_config_word(pd, PCI_COMMAND, &cmd);
875 if ((ps->command & ~cmd) == 0)
876 continue;
877 switch (pd->hdr_type) {
878 case PCI_HEADER_TYPE_NORMAL:
879 for (j = 0; j < 6; ++j)
880 pci_write_config_dword(pd,
881 PCI_BASE_ADDRESS_0 + j*4,
882 pd->resource[j].start);
883 pci_write_config_dword(pd, PCI_ROM_ADDRESS,
884 pd->resource[PCI_ROM_RESOURCE].start);
885 pci_write_config_word(pd, PCI_CACHE_LINE_SIZE,
886 ps->cache_lat);
887 pci_write_config_word(pd, PCI_INTERRUPT_LINE,
888 ps->intr);
889 pci_write_config_word(pd, PCI_COMMAND, ps->command);
890 break;
891 /* other header types not restored at present */
892 }
893 }
894}
895
896/*
897 * Put the powerbook to sleep.
898 */
899#define IRQ_ENABLE ((unsigned int *)0xf3000024)
900#define MEM_CTRL ((unsigned int *)0xf8000070)
901
902int powerbook_sleep(void)
903{
904 int ret, i, x;
905 static int save_backlight;
906 static unsigned int save_irqen;
907 unsigned long msr;
908 unsigned int hid0;
909 unsigned long p, wait;
910 struct adb_request sleep_req;
911
912 /* Notify device drivers */
913 ret = blocking_notifier_call_chain(&sleep_notifier_list,
914 PBOOK_SLEEP, NULL);
915 if (ret & NOTIFY_STOP_MASK)
916 return -EBUSY;
917
918 /* Sync the disks. */
919 /* XXX It would be nice to have some way to ensure that
920 * nobody is dirtying any new buffers while we wait. */
921 sys_sync();
922
923 /* Turn off the display backlight */
924 save_backlight = backlight_enabled;
925 if (save_backlight)
926 pmu_enable_backlight(0);
927
928 /* Give the disks a little time to actually finish writing */
929 for (wait = jiffies + (HZ/4); time_before(jiffies, wait); )
930 mb();
931
932 /* Disable all interrupts except pmu */
933 save_irqen = in_le32(IRQ_ENABLE);
934 for (i = 0; i < 32; ++i)
935 if (i != vias->intrs[0].line && (save_irqen & (1 << i)))
936 disable_irq(i);
937 asm volatile("mtdec %0" : : "r" (0x7fffffff));
938
939 /* Save the state of PCI config space for some slots */
940 pbook_pci_save();
941
942 /* Set the memory controller to keep the memory refreshed
943 while we're asleep */
944 for (i = 0x403f; i >= 0x4000; --i) {
945 out_be32(MEM_CTRL, i);
946 do {
947 x = (in_be32(MEM_CTRL) >> 16) & 0x3ff;
948 } while (x == 0);
949 if (x >= 0x100)
950 break;
951 }
952
953 /* Ask the PMU to put us to sleep */
954 pmu_request(&sleep_req, NULL, 5, PMU_SLEEP, 'M', 'A', 'T', 'T');
955 while (!sleep_req.complete)
956 mb();
957 /* displacement-flush the L2 cache - necessary? */
958 for (p = KERNELBASE; p < KERNELBASE + 0x100000; p += 0x1000)
959 i = *(volatile int *)p;
960 asleep = 1;
961
962 /* Put the CPU into sleep mode */
963 asm volatile("mfspr %0,1008" : "=r" (hid0) :);
964 hid0 = (hid0 & ~(HID0_NAP | HID0_DOZE)) | HID0_SLEEP;
965 asm volatile("mtspr 1008,%0" : : "r" (hid0));
966 local_save_flags(msr);
967 msr |= MSR_POW | MSR_EE;
968 local_irq_restore(msr);
969 udelay(10);
970
971 /* OK, we're awake again, start restoring things */
972 out_be32(MEM_CTRL, 0x3f);
973 pbook_pci_restore();
974
975 /* wait for the PMU interrupt sequence to complete */
976 while (asleep)
977 mb();
978
979 /* reenable interrupts */
980 for (i = 0; i < 32; ++i)
981 if (i != vias->intrs[0].line && (save_irqen & (1 << i)))
982 enable_irq(i);
983
984 /* Notify drivers */
985 blocking_notifier_call_chain(&sleep_notifier_list, PBOOK_WAKE, NULL);
986
987 /* reenable ADB autopoll */
988 pmu_adb_autopoll(adb_dev_map);
989
990 /* Turn on the screen backlight, if it was on before */
991 if (save_backlight)
992 pmu_enable_backlight(1);
993
994 /* Wait for the hard disk to spin up */
995
996 return 0;
997}
998
999/*
1000 * Support for /dev/pmu device
1001 */
1002static int pmu_open(struct inode *inode, struct file *file)
1003{
1004 return 0;
1005}
1006
1007static ssize_t pmu_read(struct file *file, char *buf,
1008 size_t count, loff_t *ppos)
1009{
1010 return 0;
1011}
1012
1013static ssize_t pmu_write(struct file *file, const char *buf,
1014 size_t count, loff_t *ppos)
1015{
1016 return 0;
1017}
1018
1019static int pmu_ioctl(struct inode * inode, struct file *filp,
1020 u_int cmd, u_long arg)
1021{
1022 int error;
1023 __u32 value;
1024
1025 switch (cmd) {
1026 case PMU_IOC_SLEEP:
1027 return -ENOSYS;
1028 case PMU_IOC_GET_BACKLIGHT:
1029 return put_user(backlight_level, (__u32 *)arg);
1030 case PMU_IOC_SET_BACKLIGHT:
1031 error = get_user(value, (__u32 *)arg);
1032 if (!error)
1033 pmu_set_brightness(value);
1034 return error;
1035 case PMU_IOC_GET_MODEL:
1036 return put_user(pmu_kind, (__u32 *)arg);
1037 }
1038 return -EINVAL;
1039}
1040
1041static const struct file_operations pmu_device_fops = {
1042 .read = pmu_read,
1043 .write = pmu_write,
1044 .ioctl = pmu_ioctl,
1045 .open = pmu_open,
1046};
1047
1048static struct miscdevice pmu_device = {
1049 PMU_MINOR, "pmu", &pmu_device_fops
1050};
1051
1052void pmu_device_init(void)
1053{
1054 if (!via)
1055 return;
1056 if (misc_register(&pmu_device) < 0)
1057 printk(KERN_ERR "via-pmu68k: cannot register misc device.\n");
1058}
1059#endif /* CONFIG_PMAC_PBOOK */
1060
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 650991bddd8e..f33a729960ca 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1972,7 +1972,8 @@ static int run(mddev_t *mddev)
1972 !test_bit(In_sync, &disk->rdev->flags)) { 1972 !test_bit(In_sync, &disk->rdev->flags)) {
1973 disk->head_position = 0; 1973 disk->head_position = 0;
1974 mddev->degraded++; 1974 mddev->degraded++;
1975 conf->fullsync = 1; 1975 if (disk->rdev)
1976 conf->fullsync = 1;
1976 } 1977 }
1977 } 1978 }
1978 if (mddev->degraded == conf->raid_disks) { 1979 if (mddev->degraded == conf->raid_disks) {
@@ -2153,11 +2154,25 @@ static int raid1_reshape(mddev_t *mddev)
2153 oldpool = conf->r1bio_pool; 2154 oldpool = conf->r1bio_pool;
2154 conf->r1bio_pool = newpool; 2155 conf->r1bio_pool = newpool;
2155 2156
2156 for (d=d2=0; d < conf->raid_disks; d++) 2157 for (d = d2 = 0; d < conf->raid_disks; d++) {
2157 if (conf->mirrors[d].rdev) { 2158 mdk_rdev_t *rdev = conf->mirrors[d].rdev;
2158 conf->mirrors[d].rdev->raid_disk = d2; 2159 if (rdev && rdev->raid_disk != d2) {
2159 newmirrors[d2++].rdev = conf->mirrors[d].rdev; 2160 char nm[20];
2161 sprintf(nm, "rd%d", rdev->raid_disk);
2162 sysfs_remove_link(&mddev->kobj, nm);
2163 rdev->raid_disk = d2;
2164 sprintf(nm, "rd%d", rdev->raid_disk);
2165 sysfs_remove_link(&mddev->kobj, nm);
2166 if (sysfs_create_link(&mddev->kobj,
2167 &rdev->kobj, nm))
2168 printk(KERN_WARNING
2169 "md/raid1: cannot register "
2170 "%s for %s\n",
2171 nm, mdname(mddev));
2160 } 2172 }
2173 if (rdev)
2174 newmirrors[d2++].rdev = rdev;
2175 }
2161 kfree(conf->mirrors); 2176 kfree(conf->mirrors);
2162 conf->mirrors = newmirrors; 2177 conf->mirrors = newmirrors;
2163 kfree(conf->poolinfo); 2178 kfree(conf->poolinfo);
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c
index 02a0ea6e1c17..6bf858a436c9 100644
--- a/drivers/media/dvb/b2c2/flexcop-i2c.c
+++ b/drivers/media/dvb/b2c2/flexcop-i2c.c
@@ -135,6 +135,13 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
135 struct flexcop_device *fc = i2c_get_adapdata(i2c_adap); 135 struct flexcop_device *fc = i2c_get_adapdata(i2c_adap);
136 int i, ret = 0; 136 int i, ret = 0;
137 137
138 /* Some drivers use 1 byte or 0 byte reads as probes, which this
139 * driver doesn't support. These probes will always fail, so this
140 * hack makes them always succeed. If one knew how, it would of
141 * course be better to actually do the read. */
142 if (num == 1 && msgs[0].flags == I2C_M_RD && msgs[0].len <= 1)
143 return 1;
144
138 if (mutex_lock_interruptible(&fc->i2c_mutex)) 145 if (mutex_lock_interruptible(&fc->i2c_mutex))
139 return -ERESTARTSYS; 146 return -ERESTARTSYS;
140 147
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c
index acf026342ec5..bdd797071cb0 100644
--- a/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/drivers/media/dvb/dvb-core/dvb_net.c
@@ -800,7 +800,8 @@ static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
800} 800}
801 801
802 802
803static void dvb_net_sec(struct net_device *dev, u8 *pkt, int pkt_len) 803static void dvb_net_sec(struct net_device *dev, const u8 *pkt, int
804pkt_len)
804{ 805{
805 u8 *eth; 806 u8 *eth;
806 struct sk_buff *skb; 807 struct sk_buff *skb;
@@ -902,7 +903,7 @@ static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
902 * we rely on the DVB API definition where exactly one complete 903 * we rely on the DVB API definition where exactly one complete
903 * section is delivered in buffer1 904 * section is delivered in buffer1
904 */ 905 */
905 dvb_net_sec (dev, (u8*) buffer1, buffer1_len); 906 dvb_net_sec (dev, buffer1, buffer1_len);
906 return 0; 907 return 0;
907} 908}
908 909
diff --git a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
index ca99e439c97c..11f7d5939bd9 100644
--- a/drivers/media/dvb/frontends/dvb-pll.c
+++ b/drivers/media/dvb/frontends/dvb-pll.c
@@ -784,7 +784,7 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
784 strncpy(fe->ops.tuner_ops.info.name, desc->name, 784 strncpy(fe->ops.tuner_ops.info.name, desc->name,
785 sizeof(fe->ops.tuner_ops.info.name)); 785 sizeof(fe->ops.tuner_ops.info.name));
786 fe->ops.tuner_ops.info.frequency_min = desc->min; 786 fe->ops.tuner_ops.info.frequency_min = desc->min;
787 fe->ops.tuner_ops.info.frequency_min = desc->max; 787 fe->ops.tuner_ops.info.frequency_max = desc->max;
788 if (!desc->initdata) 788 if (!desc->initdata)
789 fe->ops.tuner_ops.init = NULL; 789 fe->ops.tuner_ops.init = NULL;
790 if (!desc->sleepdata) 790 if (!desc->sleepdata)
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index c08f650df423..ef5361824f87 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -356,6 +356,7 @@ static int cafe_smbus_write_data(struct cafe_camera *cam,
356{ 356{
357 unsigned int rval; 357 unsigned int rval;
358 unsigned long flags; 358 unsigned long flags;
359 DEFINE_WAIT(the_wait);
359 360
360 spin_lock_irqsave(&cam->dev_lock, flags); 361 spin_lock_irqsave(&cam->dev_lock, flags);
361 rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID); 362 rval = TWSIC0_EN | ((addr << TWSIC0_SID_SHIFT) & TWSIC0_SID);
@@ -369,10 +370,29 @@ static int cafe_smbus_write_data(struct cafe_camera *cam,
369 rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR); 370 rval = value | ((command << TWSIC1_ADDR_SHIFT) & TWSIC1_ADDR);
370 cafe_reg_write(cam, REG_TWSIC1, rval); 371 cafe_reg_write(cam, REG_TWSIC1, rval);
371 spin_unlock_irqrestore(&cam->dev_lock, flags); 372 spin_unlock_irqrestore(&cam->dev_lock, flags);
372 msleep(2); /* Required or things flake */
373 373
374 /*
375 * Time to wait for the write to complete. THIS IS A RACY
376 * WAY TO DO IT, but the sad fact is that reading the TWSIC1
377 * register too quickly after starting the operation sends
378 * the device into a place that may be kinder and better, but
379 * which is absolutely useless for controlling the sensor. In
380 * practice we have plenty of time to get into our sleep state
381 * before the interrupt hits, and the worst case is that we
382 * time out and then see that things completed, so this seems
383 * the best way for now.
384 */
385 do {
386 prepare_to_wait(&cam->smbus_wait, &the_wait,
387 TASK_UNINTERRUPTIBLE);
388 schedule_timeout(1); /* even 1 jiffy is too long */
389 finish_wait(&cam->smbus_wait, &the_wait);
390 } while (!cafe_smbus_write_done(cam));
391
392#ifdef IF_THE_CAFE_HARDWARE_WORKED_RIGHT
374 wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam), 393 wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(cam),
375 CAFE_SMBUS_TIMEOUT); 394 CAFE_SMBUS_TIMEOUT);
395#endif
376 spin_lock_irqsave(&cam->dev_lock, flags); 396 spin_lock_irqsave(&cam->dev_lock, flags);
377 rval = cafe_reg_read(cam, REG_TWSIC1); 397 rval = cafe_reg_read(cam, REG_TWSIC1);
378 spin_unlock_irqrestore(&cam->dev_lock, flags); 398 spin_unlock_irqrestore(&cam->dev_lock, flags);
@@ -710,7 +730,7 @@ static void cafe_ctlr_init(struct cafe_camera *cam)
710 * Here we must wait a bit for the controller to come around. 730 * Here we must wait a bit for the controller to come around.
711 */ 731 */
712 spin_unlock_irqrestore(&cam->dev_lock, flags); 732 spin_unlock_irqrestore(&cam->dev_lock, flags);
713 mdelay(5); /* FIXME revisit this */ 733 msleep(5);
714 spin_lock_irqsave(&cam->dev_lock, flags); 734 spin_lock_irqsave(&cam->dev_lock, flags);
715 735
716 cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); 736 cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC);
@@ -2233,12 +2253,21 @@ static int cafe_pci_resume(struct pci_dev *pdev)
2233 if (ret) 2253 if (ret)
2234 return ret; 2254 return ret;
2235 ret = pci_enable_device(pdev); 2255 ret = pci_enable_device(pdev);
2256
2236 if (ret) { 2257 if (ret) {
2237 cam_warn(cam, "Unable to re-enable device on resume!\n"); 2258 cam_warn(cam, "Unable to re-enable device on resume!\n");
2238 return ret; 2259 return ret;
2239 } 2260 }
2240 cafe_ctlr_init(cam); 2261 cafe_ctlr_init(cam);
2241 cafe_ctlr_power_up(cam); 2262 cafe_ctlr_power_down(cam);
2263
2264 mutex_lock(&cam->s_mutex);
2265 if (cam->users > 0) {
2266 cafe_ctlr_power_up(cam);
2267 __cafe_cam_reset(cam);
2268 }
2269 mutex_unlock(&cam->s_mutex);
2270
2242 set_bit(CF_CONFIG_NEEDED, &cam->flags); 2271 set_bit(CF_CONFIG_NEEDED, &cam->flags);
2243 if (cam->state == S_SPECREAD) 2272 if (cam->state == S_SPECREAD)
2244 cam->state = S_IDLE; /* Don't bother restarting */ 2273 cam->state = S_IDLE; /* Don't bother restarting */
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 2c7b158ce7e1..40307f3f6fe3 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1772,6 +1772,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
1772 if (dev->alt_max_pkt_size == NULL) { 1772 if (dev->alt_max_pkt_size == NULL) {
1773 em28xx_errdev("out of memory!\n"); 1773 em28xx_errdev("out of memory!\n");
1774 em28xx_devused&=~(1<<nr); 1774 em28xx_devused&=~(1<<nr);
1775 kfree(dev);
1775 return -ENOMEM; 1776 return -ENOMEM;
1776 } 1777 }
1777 1778
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 047624b9e271..5977a79619c2 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -1190,6 +1190,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
1190 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0; 1190 itv->osd_global_alpha_state = (fb->flags & V4L2_FBUF_FLAG_GLOBAL_ALPHA) != 0;
1191 itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0; 1191 itv->osd_local_alpha_state = (fb->flags & V4L2_FBUF_FLAG_LOCAL_ALPHA) != 0;
1192 itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0; 1192 itv->osd_color_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
1193 ivtv_set_osd_alpha(itv);
1193 break; 1194 break;
1194 } 1195 }
1195 1196
@@ -1234,7 +1235,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
1234 IVTV_INFO("Tuner: %s\n", 1235 IVTV_INFO("Tuner: %s\n",
1235 test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV"); 1236 test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags) ? "Radio" : "TV");
1236 cx2341x_log_status(&itv->params, itv->name); 1237 cx2341x_log_status(&itv->params, itv->name);
1237 IVTV_INFO("Status flags: 0x%08lx\n", itv->i_flags); 1238 IVTV_INFO("Version: %s Status flags: 0x%08lx\n", IVTV_VERSION, itv->i_flags);
1238 for (i = 0; i < IVTV_MAX_STREAMS; i++) { 1239 for (i = 0; i < IVTV_MAX_STREAMS; i++) {
1239 struct ivtv_stream *s = &itv->streams[i]; 1240 struct ivtv_stream *s = &itv->streams[i];
1240 1241
diff --git a/drivers/media/video/ov7670.c b/drivers/media/video/ov7670.c
index f8f21ddd9843..c4c5bd67f795 100644
--- a/drivers/media/video/ov7670.c
+++ b/drivers/media/video/ov7670.c
@@ -416,7 +416,10 @@ static int ov7670_read(struct i2c_client *c, unsigned char reg,
416static int ov7670_write(struct i2c_client *c, unsigned char reg, 416static int ov7670_write(struct i2c_client *c, unsigned char reg,
417 unsigned char value) 417 unsigned char value)
418{ 418{
419 return i2c_smbus_write_byte_data(c, reg, value); 419 int ret = i2c_smbus_write_byte_data(c, reg, value);
420 if (reg == REG_COM7 && (value & COM7_RESET))
421 msleep(2); /* Wait for reset to run */
422 return ret;
420} 423}
421 424
422 425
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 9c0e8d18c2f6..3d81966d8c42 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -1196,12 +1196,19 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1196 return 0; 1196 return 0;
1197} 1197}
1198 1198
1199
1200static void pwc_cleanup(struct pwc_device *pdev)
1201{
1202 pwc_remove_sysfs_files(pdev->vdev);
1203 video_unregister_device(pdev->vdev);
1204}
1205
1199/* Note that all cleanup is done in the reverse order as in _open */ 1206/* Note that all cleanup is done in the reverse order as in _open */
1200static int pwc_video_close(struct inode *inode, struct file *file) 1207static int pwc_video_close(struct inode *inode, struct file *file)
1201{ 1208{
1202 struct video_device *vdev = file->private_data; 1209 struct video_device *vdev = file->private_data;
1203 struct pwc_device *pdev; 1210 struct pwc_device *pdev;
1204 int i; 1211 int i, hint;
1205 1212
1206 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); 1213 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev);
1207 1214
@@ -1224,8 +1231,9 @@ static int pwc_video_close(struct inode *inode, struct file *file)
1224 pwc_isoc_cleanup(pdev); 1231 pwc_isoc_cleanup(pdev);
1225 pwc_free_buffers(pdev); 1232 pwc_free_buffers(pdev);
1226 1233
1234 lock_kernel();
1227 /* Turn off LEDS and power down camera, but only when not unplugged */ 1235 /* Turn off LEDS and power down camera, but only when not unplugged */
1228 if (pdev->error_status != EPIPE) { 1236 if (!pdev->unplugged) {
1229 /* Turn LEDs off */ 1237 /* Turn LEDs off */
1230 if (pwc_set_leds(pdev, 0, 0) < 0) 1238 if (pwc_set_leds(pdev, 0, 0) < 0)
1231 PWC_DEBUG_MODULE("Failed to set LED on/off time.\n"); 1239 PWC_DEBUG_MODULE("Failed to set LED on/off time.\n");
@@ -1234,9 +1242,19 @@ static int pwc_video_close(struct inode *inode, struct file *file)
1234 if (i < 0) 1242 if (i < 0)
1235 PWC_ERROR("Failed to power down camera (%d)\n", i); 1243 PWC_ERROR("Failed to power down camera (%d)\n", i);
1236 } 1244 }
1245 pdev->vopen--;
1246 PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", i);
1247 } else {
1248 pwc_cleanup(pdev);
1249 /* Free memory (don't set pdev to 0 just yet) */
1250 kfree(pdev);
1251 /* search device_hint[] table if we occupy a slot, by any chance */
1252 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1253 if (device_hint[hint].pdev == pdev)
1254 device_hint[hint].pdev = NULL;
1237 } 1255 }
1238 pdev->vopen--; 1256 unlock_kernel();
1239 PWC_DEBUG_OPEN("<< video_close() vopen=%d\n", pdev->vopen); 1257
1240 return 0; 1258 return 0;
1241} 1259}
1242 1260
@@ -1791,21 +1809,21 @@ static void usb_pwc_disconnect(struct usb_interface *intf)
1791 /* Alert waiting processes */ 1809 /* Alert waiting processes */
1792 wake_up_interruptible(&pdev->frameq); 1810 wake_up_interruptible(&pdev->frameq);
1793 /* Wait until device is closed */ 1811 /* Wait until device is closed */
1794 while (pdev->vopen) 1812 if(pdev->vopen) {
1795 schedule(); 1813 pdev->unplugged = 1;
1796 /* Device is now closed, so we can safely unregister it */ 1814 } else {
1797 PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n"); 1815 /* Device is closed, so we can safely unregister it */
1798 pwc_remove_sysfs_files(pdev->vdev); 1816 PWC_DEBUG_PROBE("Unregistering video device in disconnect().\n");
1799 video_unregister_device(pdev->vdev); 1817 pwc_cleanup(pdev);
1800 1818 /* Free memory (don't set pdev to 0 just yet) */
1801 /* Free memory (don't set pdev to 0 just yet) */ 1819 kfree(pdev);
1802 kfree(pdev);
1803 1820
1804disconnect_out: 1821disconnect_out:
1805 /* search device_hint[] table if we occupy a slot, by any chance */ 1822 /* search device_hint[] table if we occupy a slot, by any chance */
1806 for (hint = 0; hint < MAX_DEV_HINTS; hint++) 1823 for (hint = 0; hint < MAX_DEV_HINTS; hint++)
1807 if (device_hint[hint].pdev == pdev) 1824 if (device_hint[hint].pdev == pdev)
1808 device_hint[hint].pdev = NULL; 1825 device_hint[hint].pdev = NULL;
1826 }
1809 1827
1810 unlock_kernel(); 1828 unlock_kernel();
1811} 1829}
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h
index 910a04f53920..8e8e5b27e77e 100644
--- a/drivers/media/video/pwc/pwc.h
+++ b/drivers/media/video/pwc/pwc.h
@@ -193,6 +193,7 @@ struct pwc_device
193 char vsnapshot; /* snapshot mode */ 193 char vsnapshot; /* snapshot mode */
194 char vsync; /* used by isoc handler */ 194 char vsync; /* used by isoc handler */
195 char vmirror; /* for ToUCaM series */ 195 char vmirror; /* for ToUCaM series */
196 char unplugged;
196 197
197 int cmd_len; 198 int cmd_len;
198 unsigned char cmd_buf[13]; 199 unsigned char cmd_buf[13];
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 518d5d335464..a26655881e6a 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -5,6 +5,11 @@
5menuconfig MISC_DEVICES 5menuconfig MISC_DEVICES
6 bool "Misc devices" 6 bool "Misc devices"
7 default y 7 default y
8 ---help---
9 Say Y here to get to see options for device drivers from various
10 different categories. This option alone does not add any kernel code.
11
12 If you say N, all options in this submenu will be skipped and disabled.
8 13
9if MISC_DEVICES 14if MISC_DEVICES
10 15
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index d0fc4fd212e6..40db9f70148f 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -1072,7 +1072,8 @@ static void asus_backlight_exit(void)
1072} 1072}
1073 1073
1074#define ASUS_LED_UNREGISTER(object) \ 1074#define ASUS_LED_UNREGISTER(object) \
1075 led_classdev_unregister(&object##_led) 1075 if (object##_led.dev) \
1076 led_classdev_unregister(&object##_led)
1076 1077
1077static void asus_led_exit(void) 1078static void asus_led_exit(void)
1078{ 1079{
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index fe0e785ed7d2..817a79462b3d 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -186,12 +186,10 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host)
186{ 186{
187 struct mmc_card *card; 187 struct mmc_card *card;
188 188
189 card = kmalloc(sizeof(struct mmc_card), GFP_KERNEL); 189 card = kzalloc(sizeof(struct mmc_card), GFP_KERNEL);
190 if (!card) 190 if (!card)
191 return ERR_PTR(-ENOMEM); 191 return ERR_PTR(-ENOMEM);
192 192
193 memset(card, 0, sizeof(struct mmc_card));
194
195 card->host = host; 193 card->host = host;
196 194
197 device_initialize(&card->dev); 195 device_initialize(&card->dev);
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 6a7e29849603..2c7ce8f43a9a 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -58,12 +58,10 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
58{ 58{
59 struct mmc_host *host; 59 struct mmc_host *host;
60 60
61 host = kmalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); 61 host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
62 if (!host) 62 if (!host)
63 return NULL; 63 return NULL;
64 64
65 memset(host, 0, sizeof(struct mmc_host) + extra);
66
67 host->parent = dev; 65 host->parent = dev;
68 host->class_dev.parent = dev; 66 host->class_dev.parent = dev;
69 host->class_dev.class = &mmc_host_class; 67 host->class_dev.class = &mmc_host_class;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f2bc87ac24f7..20a7d89e01ba 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -385,6 +385,9 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
385 BUG_ON(data->blksz > host->mmc->max_blk_size); 385 BUG_ON(data->blksz > host->mmc->max_blk_size);
386 BUG_ON(data->blocks > 65535); 386 BUG_ON(data->blocks > 65535);
387 387
388 host->data = data;
389 host->data_early = 0;
390
388 /* timeout in us */ 391 /* timeout in us */
389 target_timeout = data->timeout_ns / 1000 + 392 target_timeout = data->timeout_ns / 1000 +
390 data->timeout_clks / host->clock; 393 data->timeout_clks / host->clock;
@@ -443,11 +446,11 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
443{ 446{
444 u16 mode; 447 u16 mode;
445 448
446 WARN_ON(host->data);
447
448 if (data == NULL) 449 if (data == NULL)
449 return; 450 return;
450 451
452 WARN_ON(!host->data);
453
451 mode = SDHCI_TRNS_BLK_CNT_EN; 454 mode = SDHCI_TRNS_BLK_CNT_EN;
452 if (data->blocks > 1) 455 if (data->blocks > 1)
453 mode |= SDHCI_TRNS_MULTI; 456 mode |= SDHCI_TRNS_MULTI;
@@ -477,8 +480,8 @@ static void sdhci_finish_data(struct sdhci_host *host)
477 /* 480 /*
478 * Controller doesn't count down when in single block mode. 481 * Controller doesn't count down when in single block mode.
479 */ 482 */
480 if ((data->blocks == 1) && (data->error == MMC_ERR_NONE)) 483 if (data->blocks == 1)
481 blocks = 0; 484 blocks = (data->error == MMC_ERR_NONE) ? 0 : 1;
482 else 485 else
483 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); 486 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
484 data->bytes_xfered = data->blksz * (data->blocks - blocks); 487 data->bytes_xfered = data->blksz * (data->blocks - blocks);
@@ -600,9 +603,10 @@ static void sdhci_finish_command(struct sdhci_host *host)
600 603
601 host->cmd->error = MMC_ERR_NONE; 604 host->cmd->error = MMC_ERR_NONE;
602 605
603 if (host->cmd->data) 606 if (host->data && host->data_early)
604 host->data = host->cmd->data; 607 sdhci_finish_data(host);
605 else 608
609 if (!host->cmd->data)
606 tasklet_schedule(&host->finish_tasklet); 610 tasklet_schedule(&host->finish_tasklet);
607 611
608 host->cmd = NULL; 612 host->cmd = NULL;
@@ -929,9 +933,9 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
929 BUG_ON(intmask == 0); 933 BUG_ON(intmask == 0);
930 934
931 if (!host->cmd) { 935 if (!host->cmd) {
932 printk(KERN_ERR "%s: Got command interrupt even though no " 936 printk(KERN_ERR "%s: Got command interrupt 0x%08x even "
933 "command operation was in progress.\n", 937 "though no command operation was in progress.\n",
934 mmc_hostname(host->mmc)); 938 mmc_hostname(host->mmc), (unsigned)intmask);
935 sdhci_dumpregs(host); 939 sdhci_dumpregs(host);
936 return; 940 return;
937 } 941 }
@@ -961,9 +965,9 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
961 if (intmask & SDHCI_INT_DATA_END) 965 if (intmask & SDHCI_INT_DATA_END)
962 return; 966 return;
963 967
964 printk(KERN_ERR "%s: Got data interrupt even though no " 968 printk(KERN_ERR "%s: Got data interrupt 0x%08x even "
965 "data operation was in progress.\n", 969 "though no data operation was in progress.\n",
966 mmc_hostname(host->mmc)); 970 mmc_hostname(host->mmc), (unsigned)intmask);
967 sdhci_dumpregs(host); 971 sdhci_dumpregs(host);
968 972
969 return; 973 return;
@@ -991,8 +995,18 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
991 writel(readl(host->ioaddr + SDHCI_DMA_ADDRESS), 995 writel(readl(host->ioaddr + SDHCI_DMA_ADDRESS),
992 host->ioaddr + SDHCI_DMA_ADDRESS); 996 host->ioaddr + SDHCI_DMA_ADDRESS);
993 997
994 if (intmask & SDHCI_INT_DATA_END) 998 if (intmask & SDHCI_INT_DATA_END) {
995 sdhci_finish_data(host); 999 if (host->cmd) {
1000 /*
1001 * Data managed to finish before the
1002 * command completed. Make sure we do
1003 * things in the proper order.
1004 */
1005 host->data_early = 1;
1006 } else {
1007 sdhci_finish_data(host);
1008 }
1009 }
996 } 1010 }
997} 1011}
998 1012
@@ -1347,12 +1361,11 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1347 */ 1361 */
1348 mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; 1362 mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
1349 if (mmc->max_blk_size >= 3) { 1363 if (mmc->max_blk_size >= 3) {
1350 printk(KERN_ERR "%s: Invalid maximum block size.\n", 1364 printk(KERN_WARNING "%s: Invalid maximum block size, assuming 512\n",
1351 host->slot_descr); 1365 host->slot_descr);
1352 ret = -ENODEV; 1366 mmc->max_blk_size = 512;
1353 goto unmap; 1367 } else
1354 } 1368 mmc->max_blk_size = 512 << mmc->max_blk_size;
1355 mmc->max_blk_size = 512 << mmc->max_blk_size;
1356 1369
1357 /* 1370 /*
1358 * Maximum block count. 1371 * Maximum block count.
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d157776c1149..e28987d6d2eb 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -182,6 +182,7 @@ struct sdhci_host {
182 struct mmc_request *mrq; /* Current request */ 182 struct mmc_request *mrq; /* Current request */
183 struct mmc_command *cmd; /* Current command */ 183 struct mmc_command *cmd; /* Current command */
184 struct mmc_data *data; /* Current data request */ 184 struct mmc_data *data; /* Current data request */
185 int data_early:1; /* Data finished before cmd */
185 186
186 struct scatterlist *cur_sg; /* We're working on this */ 187 struct scatterlist *cur_sg; /* We're working on this */
187 int num_sg; /* Entries left */ 188 int num_sg; /* Entries left */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 81ef81c9a584..5b9e17bf1749 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1968,6 +1968,16 @@ menuconfig NETDEV_1000
1968 bool "Ethernet (1000 Mbit)" 1968 bool "Ethernet (1000 Mbit)"
1969 depends on !UML 1969 depends on !UML
1970 default y 1970 default y
1971 ---help---
1972 Ethernet (also called IEEE 802.3 or ISO 8802-2) is the most common
1973 type of Local Area Network (LAN) in universities and companies.
1974
1975 Say Y here to get to see options for Gigabit Ethernet drivers.
1976 This option alone does not add any kernel code.
1977 Note that drivers supporting both 100 and 1000 MBit may be listed
1978 under "Ethernet (10 or 100MBit)" instead.
1979
1980 If you say N, all options in this submenu will be skipped and disabled.
1971 1981
1972if NETDEV_1000 1982if NETDEV_1000
1973 1983
@@ -2339,6 +2349,11 @@ menuconfig NETDEV_10000
2339 bool "Ethernet (10000 Mbit)" 2349 bool "Ethernet (10000 Mbit)"
2340 depends on !UML 2350 depends on !UML
2341 default y 2351 default y
2352 ---help---
2353 Say Y here to get to see options for 10 Gigabit Ethernet drivers.
2354 This option alone does not add any kernel code.
2355
2356 If you say N, all options in this submenu will be skipped and disabled.
2342 2357
2343if NETDEV_10000 2358if NETDEV_10000
2344 2359
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 69f5f365239a..10f4e3b55168 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -3068,8 +3068,8 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
3068 np->nic_poll_irq = np->irqmask; 3068 np->nic_poll_irq = np->irqmask;
3069 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); 3069 mod_timer(&np->nic_poll, jiffies + POLL_WAIT);
3070 } 3070 }
3071 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i);
3072 spin_unlock(&np->lock); 3071 spin_unlock(&np->lock);
3072 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i);
3073 break; 3073 break;
3074 } 3074 }
3075 3075
@@ -3186,8 +3186,8 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
3186 np->nic_poll_irq = np->irqmask; 3186 np->nic_poll_irq = np->irqmask;
3187 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); 3187 mod_timer(&np->nic_poll, jiffies + POLL_WAIT);
3188 } 3188 }
3189 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i);
3190 spin_unlock(&np->lock); 3189 spin_unlock(&np->lock);
3190 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq.\n", dev->name, i);
3191 break; 3191 break;
3192 } 3192 }
3193 3193
@@ -3233,8 +3233,8 @@ static irqreturn_t nv_nic_irq_tx(int foo, void *data)
3233 np->nic_poll_irq |= NVREG_IRQ_TX_ALL; 3233 np->nic_poll_irq |= NVREG_IRQ_TX_ALL;
3234 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); 3234 mod_timer(&np->nic_poll, jiffies + POLL_WAIT);
3235 } 3235 }
3236 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i);
3237 spin_unlock_irqrestore(&np->lock, flags); 3236 spin_unlock_irqrestore(&np->lock, flags);
3237 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_tx.\n", dev->name, i);
3238 break; 3238 break;
3239 } 3239 }
3240 3240
@@ -3348,8 +3348,8 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data)
3348 np->nic_poll_irq |= NVREG_IRQ_RX_ALL; 3348 np->nic_poll_irq |= NVREG_IRQ_RX_ALL;
3349 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); 3349 mod_timer(&np->nic_poll, jiffies + POLL_WAIT);
3350 } 3350 }
3351 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i);
3352 spin_unlock_irqrestore(&np->lock, flags); 3351 spin_unlock_irqrestore(&np->lock, flags);
3352 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_rx.\n", dev->name, i);
3353 break; 3353 break;
3354 } 3354 }
3355 } 3355 }
@@ -3421,8 +3421,8 @@ static irqreturn_t nv_nic_irq_other(int foo, void *data)
3421 np->nic_poll_irq |= NVREG_IRQ_OTHER; 3421 np->nic_poll_irq |= NVREG_IRQ_OTHER;
3422 mod_timer(&np->nic_poll, jiffies + POLL_WAIT); 3422 mod_timer(&np->nic_poll, jiffies + POLL_WAIT);
3423 } 3423 }
3424 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i);
3425 spin_unlock_irqrestore(&np->lock, flags); 3424 spin_unlock_irqrestore(&np->lock, flags);
3425 printk(KERN_DEBUG "%s: too many iterations (%d) in nv_nic_irq_other.\n", dev->name, i);
3426 break; 3426 break;
3427 } 3427 }
3428 3428
diff --git a/drivers/net/mlx4/reset.c b/drivers/net/mlx4/reset.c
index e4dfd4b11a4a..e199715fabd0 100644
--- a/drivers/net/mlx4/reset.c
+++ b/drivers/net/mlx4/reset.c
@@ -119,6 +119,9 @@ int mlx4_reset(struct mlx4_dev *dev)
119 writel(MLX4_RESET_VALUE, reset + MLX4_RESET_OFFSET); 119 writel(MLX4_RESET_VALUE, reset + MLX4_RESET_OFFSET);
120 iounmap(reset); 120 iounmap(reset);
121 121
122 /* Docs say to wait one second before accessing device */
123 msleep(1000);
124
122 end = jiffies + MLX4_RESET_TIMEOUT_JIFFIES; 125 end = jiffies + MLX4_RESET_TIMEOUT_JIFFIES;
123 do { 126 do {
124 if (!pci_read_config_word(dev->pdev, PCI_VENDOR_ID, &vendor) && 127 if (!pci_read_config_word(dev->pdev, PCI_VENDOR_ID, &vendor) &&
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index ef3325b69233..9293c82ef2af 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1726,7 +1726,7 @@ ppp_decompress_frame(struct ppp *ppp, struct sk_buff *skb)
1726 } 1726 }
1727 /* the decompressor still expects the A/C bytes in the hdr */ 1727 /* the decompressor still expects the A/C bytes in the hdr */
1728 len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2, 1728 len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2,
1729 skb->len + 2, ns->data, ppp->mru + PPP_HDRLEN); 1729 skb->len + 2, ns->data, obuff_size);
1730 if (len < 0) { 1730 if (len < 0) {
1731 /* Pass the compressed frame to pppd as an 1731 /* Pass the compressed frame to pppd as an
1732 error indication. */ 1732 error indication. */
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index e7a2eadcc3b0..757592436390 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -696,8 +696,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
696 int i; 696 int i;
697 const u8 *addr = hw->dev[port]->dev_addr; 697 const u8 *addr = hw->dev[port]->dev_addr;
698 698
699 sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); 699 sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
700 sky2_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); 700 sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR);
701 701
702 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); 702 sky2_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR);
703 703
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
index 79ff6b4de3a6..37d72f123a80 100644
--- a/drivers/pci/hotplug/cpqphp_ctrl.c
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c
@@ -1746,10 +1746,8 @@ static void pushbutton_helper_thread(unsigned long data)
1746static int event_thread(void* data) 1746static int event_thread(void* data)
1747{ 1747{
1748 struct controller *ctrl; 1748 struct controller *ctrl;
1749 lock_kernel(); 1749
1750 daemonize("phpd_event"); 1750 daemonize("phpd_event");
1751
1752 unlock_kernel();
1753 1751
1754 while (1) { 1752 while (1) {
1755 dbg("!!!!event_thread sleeping\n"); 1753 dbg("!!!!event_thread sleeping\n");
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index c6e132d7c0f7..4c36e80f6d26 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -5,12 +5,7 @@ extern int pci_uevent(struct device *dev, char **envp, int num_envp,
5extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); 5extern int pci_create_sysfs_dev_files(struct pci_dev *pdev);
6extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev); 6extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev);
7extern void pci_cleanup_rom(struct pci_dev *dev); 7extern void pci_cleanup_rom(struct pci_dev *dev);
8extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, 8
9 resource_size_t size, resource_size_t align,
10 resource_size_t min, unsigned int type_mask,
11 void (*alignf)(void *, struct resource *,
12 resource_size_t, resource_size_t),
13 void *alignf_data);
14/* Firmware callbacks */ 9/* Firmware callbacks */
15extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); 10extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state);
16extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); 11extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state);
@@ -35,7 +30,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }
35 30
36/* Functions for PCI Hotplug drivers to use */ 31/* Functions for PCI Hotplug drivers to use */
37extern unsigned int pci_do_scan_bus(struct pci_bus *bus); 32extern unsigned int pci_do_scan_bus(struct pci_bus *bus);
38extern int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
39 33
40extern void pci_remove_legacy_files(struct pci_bus *bus); 34extern void pci_remove_legacy_files(struct pci_bus *bus);
41 35
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 34b8dae0d90f..27e00b2d7b5b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -653,20 +653,20 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
653 653
654 sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number); 654 sprintf(child->name, (is_cardbus ? "PCI CardBus #%02x" : "PCI Bus #%02x"), child->number);
655 655
656 /* Has only triggered on CardBus, fixup is in yenta_socket */
656 while (bus->parent) { 657 while (bus->parent) {
657 if ((child->subordinate > bus->subordinate) || 658 if ((child->subordinate > bus->subordinate) ||
658 (child->number > bus->subordinate) || 659 (child->number > bus->subordinate) ||
659 (child->number < bus->number) || 660 (child->number < bus->number) ||
660 (child->subordinate < bus->number)) { 661 (child->subordinate < bus->number)) {
661 printk(KERN_WARNING "PCI: Bus #%02x (-#%02x) is " 662 pr_debug("PCI: Bus #%02x (-#%02x) is %s"
662 "hidden behind%s bridge #%02x (-#%02x)%s\n", 663 "hidden behind%s bridge #%02x (-#%02x)\n",
663 child->number, child->subordinate, 664 child->number, child->subordinate,
664 bus->self->transparent ? " transparent" : " ", 665 (bus->number > child->subordinate &&
665 bus->number, bus->subordinate, 666 bus->subordinate < child->number) ?
666 pcibios_assign_all_busses() ? " " : 667 "wholly " : " partially",
667 " (try 'pci=assign-busses')"); 668 bus->self->transparent ? " transparent" : " ",
668 printk(KERN_WARNING "Please report the result to " 669 bus->number, bus->subordinate);
669 "<bk@suse.de> to fix this permanently\n");
670 } 670 }
671 bus = bus->parent; 671 bus = bus->parent;
672 } 672 }
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index c559085c89a5..2d40f437b9fc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -947,7 +947,7 @@ static void k8t_sound_hostbridge(struct pci_dev *dev)
947 unsigned char val; 947 unsigned char val;
948 948
949 pci_read_config_byte(dev, 0x50, &val); 949 pci_read_config_byte(dev, 0x50, &val);
950 if (val == 0x88 || val == 0xc8) { 950 if (val == 0xc8) {
951 /* Assume it's probably a MSI-K8T-Neo2Fir */ 951 /* Assume it's probably a MSI-K8T-Neo2Fir */
952 printk(KERN_INFO "PCI: MSI-K8T-Neo2Fir, attempting to turn soundcard ON\n"); 952 printk(KERN_INFO "PCI: MSI-K8T-Neo2Fir, attempting to turn soundcard ON\n");
953 pci_write_config_byte(dev, 0x50, val & (~0x40)); 953 pci_write_config_byte(dev, 0x50, val & (~0x40));
@@ -1485,7 +1485,7 @@ static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
1485 1485
1486 iounmap(csr); 1486 iounmap(csr);
1487} 1487}
1488DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt); 1488DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
1489 1489
1490static void __devinit fixup_rev1_53c810(struct pci_dev* dev) 1490static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
1491{ 1491{
@@ -1650,6 +1650,9 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_GCN
1650DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi); 1650DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX, quirk_disable_all_msi);
1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi); 1651DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_disable_all_msi);
1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi); 1652DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RD580, quirk_disable_all_msi);
1654DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RX790, quirk_disable_all_msi);
1655DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS690, quirk_disable_all_msi);
1653DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi); 1656DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1654 1657
1655/* Disable MSI on chipsets that are known to not support it */ 1658/* Disable MSI on chipsets that are known to not support it */
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 80c4a8463065..1cb33cac1237 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -892,7 +892,7 @@ static int m41t80_remove(struct i2c_client *client)
892 892
893static struct i2c_driver m41t80_driver = { 893static struct i2c_driver m41t80_driver = {
894 .driver = { 894 .driver = {
895 .name = "m41t80", 895 .name = "rtc-m41t80",
896 }, 896 },
897 .probe = m41t80_probe, 897 .probe = m41t80_probe,
898 .remove = m41t80_remove, 898 .remove = m41t80_remove,
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index d94170728075..3e183cfee10f 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -13,7 +13,7 @@
13 * 13 *
14 * 24-May-2006: Raphael Assenat <raph@8d.com> 14 * 24-May-2006: Raphael Assenat <raph@8d.com>
15 * - Major rework 15 * - Major rework
16 * Converted to rtc_device and uses the SPI layer. 16 * Converted to rtc_device and uses the SPI layer.
17 * 17 *
18 * ??-???-2005: Someone at Compulab 18 * ??-???-2005: Someone at Compulab
19 * - Initial driver creation. 19 * - Initial driver creation.
@@ -259,11 +259,11 @@ static int __devexit max6902_remove(struct spi_device *spi)
259 259
260static struct spi_driver max6902_driver = { 260static struct spi_driver max6902_driver = {
261 .driver = { 261 .driver = {
262 .name = "max6902", 262 .name = "rtc-max6902",
263 .bus = &spi_bus_type, 263 .bus = &spi_bus_type,
264 .owner = THIS_MODULE, 264 .owner = THIS_MODULE,
265 }, 265 },
266 .probe = max6902_probe, 266 .probe = max6902_probe,
267 .remove = __devexit_p(max6902_remove), 267 .remove = __devexit_p(max6902_remove),
268}; 268};
269 269
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
index eccac1c3b71b..d32c60dbdd82 100644
--- a/drivers/s390/block/dasd_diag.c
+++ b/drivers/s390/block/dasd_diag.c
@@ -24,6 +24,7 @@
24#include <asm/s390_ext.h> 24#include <asm/s390_ext.h>
25#include <asm/todclk.h> 25#include <asm/todclk.h>
26#include <asm/vtoc.h> 26#include <asm/vtoc.h>
27#include <asm/diag.h>
27 28
28#include "dasd_int.h" 29#include "dasd_int.h"
29#include "dasd_diag.h" 30#include "dasd_diag.h"
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
index 4f2f81b16cfa..2edd5fb6d3dc 100644
--- a/drivers/s390/char/raw3270.c
+++ b/drivers/s390/char/raw3270.c
@@ -21,6 +21,7 @@
21#include <asm/ccwdev.h> 21#include <asm/ccwdev.h>
22#include <asm/cio.h> 22#include <asm/cio.h>
23#include <asm/ebcdic.h> 23#include <asm/ebcdic.h>
24#include <asm/diag.h>
24 25
25#include "raw3270.h" 26#include "raw3270.h"
26 27
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 04b19bdc09da..d70a6e65bf14 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -14,6 +14,7 @@
14#include <asm/cio.h> 14#include <asm/cio.h>
15#include <asm/ccwdev.h> 15#include <asm/ccwdev.h>
16#include <asm/debug.h> 16#include <asm/debug.h>
17#include <asm/diag.h>
17 18
18#include "vmur.h" 19#include "vmur.h"
19 20
@@ -68,8 +69,26 @@ static struct ccw_driver ur_driver = {
68 .set_offline = ur_set_offline, 69 .set_offline = ur_set_offline,
69}; 70};
70 71
72static DEFINE_MUTEX(vmur_mutex);
73
71/* 74/*
72 * Allocation, freeing, getting and putting of urdev structures 75 * Allocation, freeing, getting and putting of urdev structures
76 *
77 * Each ur device (urd) contains a reference to its corresponding ccw device
78 * (cdev) using the urd->cdev pointer. Each ccw device has a reference to the
79 * ur device using the cdev->dev.driver_data pointer.
80 *
81 * urd references:
82 * - ur_probe gets a urd reference, ur_remove drops the reference
83 * (cdev->dev.driver_data)
84 * - ur_open gets a urd reference, ur_relase drops the reference
85 * (urf->urd)
86 *
87 * cdev references:
88 * - urdev_alloc get a cdev reference (urd->cdev)
89 * - urdev_free drops the cdev reference (urd->cdev)
90 *
91 * Setting and clearing of cdev->dev.driver_data is protected by the ccwdev lock
73 */ 92 */
74static struct urdev *urdev_alloc(struct ccw_device *cdev) 93static struct urdev *urdev_alloc(struct ccw_device *cdev)
75{ 94{
@@ -78,42 +97,61 @@ static struct urdev *urdev_alloc(struct ccw_device *cdev)
78 urd = kzalloc(sizeof(struct urdev), GFP_KERNEL); 97 urd = kzalloc(sizeof(struct urdev), GFP_KERNEL);
79 if (!urd) 98 if (!urd)
80 return NULL; 99 return NULL;
81 urd->cdev = cdev;
82 urd->reclen = cdev->id.driver_info; 100 urd->reclen = cdev->id.driver_info;
83 ccw_device_get_id(cdev, &urd->dev_id); 101 ccw_device_get_id(cdev, &urd->dev_id);
84 mutex_init(&urd->io_mutex); 102 mutex_init(&urd->io_mutex);
85 mutex_init(&urd->open_mutex); 103 mutex_init(&urd->open_mutex);
104 atomic_set(&urd->ref_count, 1);
105 urd->cdev = cdev;
106 get_device(&cdev->dev);
86 return urd; 107 return urd;
87} 108}
88 109
89static void urdev_free(struct urdev *urd) 110static void urdev_free(struct urdev *urd)
90{ 111{
112 TRACE("urdev_free: %p\n", urd);
113 if (urd->cdev)
114 put_device(&urd->cdev->dev);
91 kfree(urd); 115 kfree(urd);
92} 116}
93 117
94/* 118static void urdev_get(struct urdev *urd)
95 * This is how the character device driver gets a reference to a 119{
96 * ur device. When this call returns successfully, a reference has 120 atomic_inc(&urd->ref_count);
97 * been taken (by get_device) on the underlying kobject. The recipient 121}
98 * of this urdev pointer must eventually drop it with urdev_put(urd) 122
99 * which does the corresponding put_device(). 123static struct urdev *urdev_get_from_cdev(struct ccw_device *cdev)
100 */ 124{
125 struct urdev *urd;
126 unsigned long flags;
127
128 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
129 urd = cdev->dev.driver_data;
130 if (urd)
131 urdev_get(urd);
132 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
133 return urd;
134}
135
101static struct urdev *urdev_get_from_devno(u16 devno) 136static struct urdev *urdev_get_from_devno(u16 devno)
102{ 137{
103 char bus_id[16]; 138 char bus_id[16];
104 struct ccw_device *cdev; 139 struct ccw_device *cdev;
140 struct urdev *urd;
105 141
106 sprintf(bus_id, "0.0.%04x", devno); 142 sprintf(bus_id, "0.0.%04x", devno);
107 cdev = get_ccwdev_by_busid(&ur_driver, bus_id); 143 cdev = get_ccwdev_by_busid(&ur_driver, bus_id);
108 if (!cdev) 144 if (!cdev)
109 return NULL; 145 return NULL;
110 146 urd = urdev_get_from_cdev(cdev);
111 return cdev->dev.driver_data; 147 put_device(&cdev->dev);
148 return urd;
112} 149}
113 150
114static void urdev_put(struct urdev *urd) 151static void urdev_put(struct urdev *urd)
115{ 152{
116 put_device(&urd->cdev->dev); 153 if (atomic_dec_and_test(&urd->ref_count))
154 urdev_free(urd);
117} 155}
118 156
119/* 157/*
@@ -245,6 +283,7 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
245 return; 283 return;
246 } 284 }
247 urd = cdev->dev.driver_data; 285 urd = cdev->dev.driver_data;
286 BUG_ON(!urd);
248 /* On special conditions irb is an error pointer */ 287 /* On special conditions irb is an error pointer */
249 if (IS_ERR(irb)) 288 if (IS_ERR(irb))
250 urd->io_request_rc = PTR_ERR(irb); 289 urd->io_request_rc = PTR_ERR(irb);
@@ -262,9 +301,15 @@ static void ur_int_handler(struct ccw_device *cdev, unsigned long intparm,
262static ssize_t ur_attr_reclen_show(struct device *dev, 301static ssize_t ur_attr_reclen_show(struct device *dev,
263 struct device_attribute *attr, char *buf) 302 struct device_attribute *attr, char *buf)
264{ 303{
265 struct urdev *urd = dev->driver_data; 304 struct urdev *urd;
305 int rc;
266 306
267 return sprintf(buf, "%zu\n", urd->reclen); 307 urd = urdev_get_from_cdev(to_ccwdev(dev));
308 if (!urd)
309 return -ENODEV;
310 rc = sprintf(buf, "%zu\n", urd->reclen);
311 urdev_put(urd);
312 return rc;
268} 313}
269 314
270static DEVICE_ATTR(reclen, 0444, ur_attr_reclen_show, NULL); 315static DEVICE_ATTR(reclen, 0444, ur_attr_reclen_show, NULL);
@@ -379,31 +424,6 @@ static ssize_t ur_write(struct file *file, const char __user *udata,
379 return do_write(urf->urd, udata, count, urf->dev_reclen, ppos); 424 return do_write(urf->urd, udata, count, urf->dev_reclen, ppos);
380} 425}
381 426
382static int do_diag_14(unsigned long rx, unsigned long ry1,
383 unsigned long subcode)
384{
385 register unsigned long _ry1 asm("2") = ry1;
386 register unsigned long _ry2 asm("3") = subcode;
387 int rc = 0;
388
389 asm volatile(
390#ifdef CONFIG_64BIT
391 " sam31\n"
392 " diag %2,2,0x14\n"
393 " sam64\n"
394#else
395 " diag %2,2,0x14\n"
396#endif
397 " ipm %0\n"
398 " srl %0,28\n"
399 : "=d" (rc), "+d" (_ry2)
400 : "d" (rx), "d" (_ry1)
401 : "cc");
402
403 TRACE("diag 14: subcode=0x%lx, cc=%i\n", subcode, rc);
404 return rc;
405}
406
407/* 427/*
408 * diagnose code 0x14 subcode 0x0028 - position spool file to designated 428 * diagnose code 0x14 subcode 0x0028 - position spool file to designated
409 * record 429 * record
@@ -415,7 +435,7 @@ static int diag_position_to_record(int devno, int record)
415{ 435{
416 int cc; 436 int cc;
417 437
418 cc = do_diag_14(record, devno, 0x28); 438 cc = diag14(record, devno, 0x28);
419 switch (cc) { 439 switch (cc) {
420 case 0: 440 case 0:
421 return 0; 441 return 0;
@@ -440,7 +460,7 @@ static int diag_read_file(int devno, char *buf)
440{ 460{
441 int cc; 461 int cc;
442 462
443 cc = do_diag_14((unsigned long) buf, devno, 0x00); 463 cc = diag14((unsigned long) buf, devno, 0x00);
444 switch (cc) { 464 switch (cc) {
445 case 0: 465 case 0:
446 return 0; 466 return 0;
@@ -533,7 +553,7 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
533{ 553{
534 int cc; 554 int cc;
535 555
536 cc = do_diag_14((unsigned long) buf, spid, 0xfff); 556 cc = diag14((unsigned long) buf, spid, 0xfff);
537 switch (cc) { 557 switch (cc) {
538 case 0: 558 case 0:
539 return 0; 559 return 0;
@@ -750,64 +770,63 @@ static struct file_operations ur_fops = {
750 770
751/* 771/*
752 * ccw_device infrastructure: 772 * ccw_device infrastructure:
753 * ur_probe gets its own ref to the device (i.e. get_device), 773 * ur_probe creates the struct urdev (with refcount = 1), the device
754 * creates the struct urdev, the device attributes, sets up 774 * attributes, sets up the interrupt handler and validates the virtual
755 * the interrupt handler and validates the virtual unit record device. 775 * unit record device.
756 * ur_remove removes the device attributes, frees the struct urdev 776 * ur_remove removes the device attributes and drops the reference to
757 * and drops (put_device) the ref to the device we got in ur_probe. 777 * struct urdev.
778 *
779 * ur_probe, ur_remove, ur_set_online and ur_set_offline are serialized
780 * by the vmur_mutex lock.
781 *
782 * urd->char_device is used as indication that the online function has
783 * been completed successfully.
758 */ 784 */
759static int ur_probe(struct ccw_device *cdev) 785static int ur_probe(struct ccw_device *cdev)
760{ 786{
761 struct urdev *urd; 787 struct urdev *urd;
762 int rc; 788 int rc;
763 789
764 TRACE("ur_probe: cdev=%p state=%d\n", cdev, *(int *) cdev->private); 790 TRACE("ur_probe: cdev=%p\n", cdev);
765
766 if (!get_device(&cdev->dev))
767 return -ENODEV;
768 791
792 mutex_lock(&vmur_mutex);
769 urd = urdev_alloc(cdev); 793 urd = urdev_alloc(cdev);
770 if (!urd) { 794 if (!urd) {
771 rc = -ENOMEM; 795 rc = -ENOMEM;
772 goto fail; 796 goto fail_unlock;
773 } 797 }
798
774 rc = ur_create_attributes(&cdev->dev); 799 rc = ur_create_attributes(&cdev->dev);
775 if (rc) { 800 if (rc) {
776 rc = -ENOMEM; 801 rc = -ENOMEM;
777 goto fail; 802 goto fail_urdev_put;
778 } 803 }
779 cdev->dev.driver_data = urd;
780 cdev->handler = ur_int_handler; 804 cdev->handler = ur_int_handler;
781 805
782 /* validate virtual unit record device */ 806 /* validate virtual unit record device */
783 urd->class = get_urd_class(urd); 807 urd->class = get_urd_class(urd);
784 if (urd->class < 0) { 808 if (urd->class < 0) {
785 rc = urd->class; 809 rc = urd->class;
786 goto fail; 810 goto fail_remove_attr;
787 } 811 }
788 if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) { 812 if ((urd->class != DEV_CLASS_UR_I) && (urd->class != DEV_CLASS_UR_O)) {
789 rc = -ENOTSUPP; 813 rc = -ENOTSUPP;
790 goto fail; 814 goto fail_remove_attr;
791 } 815 }
816 spin_lock_irq(get_ccwdev_lock(cdev));
817 cdev->dev.driver_data = urd;
818 spin_unlock_irq(get_ccwdev_lock(cdev));
792 819
820 mutex_unlock(&vmur_mutex);
793 return 0; 821 return 0;
794 822
795fail: 823fail_remove_attr:
796 urdev_free(urd);
797 put_device(&cdev->dev);
798 return rc;
799}
800
801static void ur_remove(struct ccw_device *cdev)
802{
803 struct urdev *urd = cdev->dev.driver_data;
804
805 TRACE("ur_remove\n");
806 if (cdev->online)
807 ur_set_offline(cdev);
808 ur_remove_attributes(&cdev->dev); 824 ur_remove_attributes(&cdev->dev);
809 urdev_free(urd); 825fail_urdev_put:
810 put_device(&cdev->dev); 826 urdev_put(urd);
827fail_unlock:
828 mutex_unlock(&vmur_mutex);
829 return rc;
811} 830}
812 831
813static int ur_set_online(struct ccw_device *cdev) 832static int ur_set_online(struct ccw_device *cdev)
@@ -816,20 +835,29 @@ static int ur_set_online(struct ccw_device *cdev)
816 int minor, major, rc; 835 int minor, major, rc;
817 char node_id[16]; 836 char node_id[16];
818 837
819 TRACE("ur_set_online: cdev=%p state=%d\n", cdev, 838 TRACE("ur_set_online: cdev=%p\n", cdev);
820 *(int *) cdev->private);
821 839
822 if (!try_module_get(ur_driver.owner)) 840 mutex_lock(&vmur_mutex);
823 return -EINVAL; 841 urd = urdev_get_from_cdev(cdev);
842 if (!urd) {
843 /* ur_remove already deleted our urd */
844 rc = -ENODEV;
845 goto fail_unlock;
846 }
847
848 if (urd->char_device) {
849 /* Another ur_set_online was faster */
850 rc = -EBUSY;
851 goto fail_urdev_put;
852 }
824 853
825 urd = (struct urdev *) cdev->dev.driver_data;
826 minor = urd->dev_id.devno; 854 minor = urd->dev_id.devno;
827 major = MAJOR(ur_first_dev_maj_min); 855 major = MAJOR(ur_first_dev_maj_min);
828 856
829 urd->char_device = cdev_alloc(); 857 urd->char_device = cdev_alloc();
830 if (!urd->char_device) { 858 if (!urd->char_device) {
831 rc = -ENOMEM; 859 rc = -ENOMEM;
832 goto fail_module_put; 860 goto fail_urdev_put;
833 } 861 }
834 862
835 cdev_init(urd->char_device, &ur_fops); 863 cdev_init(urd->char_device, &ur_fops);
@@ -858,29 +886,79 @@ static int ur_set_online(struct ccw_device *cdev)
858 TRACE("ur_set_online: device_create rc=%d\n", rc); 886 TRACE("ur_set_online: device_create rc=%d\n", rc);
859 goto fail_free_cdev; 887 goto fail_free_cdev;
860 } 888 }
861 889 urdev_put(urd);
890 mutex_unlock(&vmur_mutex);
862 return 0; 891 return 0;
863 892
864fail_free_cdev: 893fail_free_cdev:
865 cdev_del(urd->char_device); 894 cdev_del(urd->char_device);
866fail_module_put: 895 urd->char_device = NULL;
867 module_put(ur_driver.owner); 896fail_urdev_put:
868 897 urdev_put(urd);
898fail_unlock:
899 mutex_unlock(&vmur_mutex);
869 return rc; 900 return rc;
870} 901}
871 902
872static int ur_set_offline(struct ccw_device *cdev) 903static int ur_set_offline_force(struct ccw_device *cdev, int force)
873{ 904{
874 struct urdev *urd; 905 struct urdev *urd;
906 int rc;
875 907
876 TRACE("ur_set_offline: cdev=%p cdev->private=%p state=%d\n", 908 TRACE("ur_set_offline: cdev=%p\n", cdev);
877 cdev, cdev->private, *(int *) cdev->private); 909 urd = urdev_get_from_cdev(cdev);
878 urd = (struct urdev *) cdev->dev.driver_data; 910 if (!urd)
911 /* ur_remove already deleted our urd */
912 return -ENODEV;
913 if (!urd->char_device) {
914 /* Another ur_set_offline was faster */
915 rc = -EBUSY;
916 goto fail_urdev_put;
917 }
918 if (!force && (atomic_read(&urd->ref_count) > 2)) {
919 /* There is still a user of urd (e.g. ur_open) */
920 TRACE("ur_set_offline: BUSY\n");
921 rc = -EBUSY;
922 goto fail_urdev_put;
923 }
879 device_destroy(vmur_class, urd->char_device->dev); 924 device_destroy(vmur_class, urd->char_device->dev);
880 cdev_del(urd->char_device); 925 cdev_del(urd->char_device);
881 module_put(ur_driver.owner); 926 urd->char_device = NULL;
927 rc = 0;
882 928
883 return 0; 929fail_urdev_put:
930 urdev_put(urd);
931 return rc;
932}
933
934static int ur_set_offline(struct ccw_device *cdev)
935{
936 int rc;
937
938 mutex_lock(&vmur_mutex);
939 rc = ur_set_offline_force(cdev, 0);
940 mutex_unlock(&vmur_mutex);
941 return rc;
942}
943
944static void ur_remove(struct ccw_device *cdev)
945{
946 unsigned long flags;
947
948 TRACE("ur_remove\n");
949
950 mutex_lock(&vmur_mutex);
951
952 if (cdev->online)
953 ur_set_offline_force(cdev, 1);
954 ur_remove_attributes(&cdev->dev);
955
956 spin_lock_irqsave(get_ccwdev_lock(cdev), flags);
957 urdev_put(cdev->dev.driver_data);
958 cdev->dev.driver_data = NULL;
959 spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
960
961 mutex_unlock(&vmur_mutex);
884} 962}
885 963
886/* 964/*
diff --git a/drivers/s390/char/vmur.h b/drivers/s390/char/vmur.h
index 2b3c564e0472..fa959644735a 100644
--- a/drivers/s390/char/vmur.h
+++ b/drivers/s390/char/vmur.h
@@ -70,6 +70,7 @@ struct urdev {
70 size_t reclen; /* Record length for *write* CCWs */ 70 size_t reclen; /* Record length for *write* CCWs */
71 int class; /* VM device class */ 71 int class; /* VM device class */
72 int io_request_rc; /* return code from I/O request */ 72 int io_request_rc; /* return code from I/O request */
73 atomic_t ref_count; /* reference counter */
73}; 74};
74 75
75/* 76/*
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 02fd00b55e1b..34a796913b06 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -594,6 +594,9 @@ alloc_cmb (struct ccw_device *cdev)
594 free_pages((unsigned long)mem, get_order(size)); 594 free_pages((unsigned long)mem, get_order(size));
595 } else if (!mem) { 595 } else if (!mem) {
596 /* no luck */ 596 /* no luck */
597 printk(KERN_WARNING "cio: failed to allocate area "
598 "for measuring %d subchannels\n",
599 cmb_area.num_channels);
597 ret = -ENOMEM; 600 ret = -ENOMEM;
598 goto out; 601 goto out;
599 } else { 602 } else {
@@ -1279,13 +1282,6 @@ init_cmf(void)
1279 case CMF_BASIC: 1282 case CMF_BASIC:
1280 format_string = "basic"; 1283 format_string = "basic";
1281 cmbops = &cmbops_basic; 1284 cmbops = &cmbops_basic;
1282 if (cmb_area.num_channels > 4096 || cmb_area.num_channels < 1) {
1283 printk(KERN_ERR "cio: Basic channel measurement "
1284 "facility can only use 1 to 4096 devices\n"
1285 KERN_ERR "when the cmf driver is built"
1286 " as a loadable module\n");
1287 return 1;
1288 }
1289 break; 1285 break;
1290 case CMF_EXTENDED: 1286 case CMF_EXTENDED:
1291 format_string = "extended"; 1287 format_string = "extended";
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 297659fa0e26..e44d92eac8e9 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -117,7 +117,10 @@ static int ccw_uevent(struct device *dev, char **envp, int num_envp,
117 snprint_alias(modalias_buf, sizeof(modalias_buf), id, ""); 117 snprint_alias(modalias_buf, sizeof(modalias_buf), id, "");
118 ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len, 118 ret = add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len,
119 "MODALIAS=%s", modalias_buf); 119 "MODALIAS=%s", modalias_buf);
120 return ret; 120 if (ret)
121 return ret;
122 envp[i] = NULL;
123 return 0;
121} 124}
122 125
123struct bus_type ccw_bus_type; 126struct bus_type ccw_bus_type;
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c
index 60b9347f7c92..f232832f2b22 100644
--- a/drivers/s390/cio/device_id.c
+++ b/drivers/s390/cio/device_id.c
@@ -17,6 +17,7 @@
17#include <asm/delay.h> 17#include <asm/delay.h>
18#include <asm/cio.h> 18#include <asm/cio.h>
19#include <asm/lowcore.h> 19#include <asm/lowcore.h>
20#include <asm/diag.h>
20 21
21#include "cio.h" 22#include "cio.h"
22#include "cio_debug.h" 23#include "cio_debug.h"
@@ -25,51 +26,6 @@
25#include "ioasm.h" 26#include "ioasm.h"
26 27
27/* 28/*
28 * diag210 is used under VM to get information about a virtual device
29 */
30int
31diag210(struct diag210 * addr)
32{
33 /*
34 * diag 210 needs its data below the 2GB border, so we
35 * use a static data area to be sure
36 */
37 static struct diag210 diag210_tmp;
38 static DEFINE_SPINLOCK(diag210_lock);
39 unsigned long flags;
40 int ccode;
41
42 spin_lock_irqsave(&diag210_lock, flags);
43 diag210_tmp = *addr;
44
45#ifdef CONFIG_64BIT
46 asm volatile(
47 " lhi %0,-1\n"
48 " sam31\n"
49 " diag %1,0,0x210\n"
50 "0: ipm %0\n"
51 " srl %0,28\n"
52 "1: sam64\n"
53 EX_TABLE(0b,1b)
54 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
55#else
56 asm volatile(
57 " lhi %0,-1\n"
58 " diag %1,0,0x210\n"
59 "0: ipm %0\n"
60 " srl %0,28\n"
61 "1:\n"
62 EX_TABLE(0b,1b)
63 : "=&d" (ccode) : "a" (&diag210_tmp) : "cc", "memory");
64#endif
65
66 *addr = diag210_tmp;
67 spin_unlock_irqrestore(&diag210_lock, flags);
68
69 return ccode;
70}
71
72/*
73 * Input : 29 * Input :
74 * devno - device number 30 * devno - device number
75 * ps - pointer to sense ID data area 31 * ps - pointer to sense ID data area
@@ -349,5 +305,3 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event)
349 break; 305 break;
350 } 306 }
351} 307}
352
353EXPORT_SYMBOL(diag210);
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 03347aed2b3e..d8d479876ec7 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -195,6 +195,8 @@ qdio_do_eqbs(struct qdio_q *q, unsigned char *state,
195again: 195again:
196 ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt); 196 ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt);
197 rc = qdio_check_ccq(q, ccq); 197 rc = qdio_check_ccq(q, ccq);
198 if ((ccq == 96) && (tmp_cnt != *cnt))
199 rc = 0;
198 if (rc == 1) { 200 if (rc == 1) {
199 QDIO_DBF_TEXT5(1,trace,"eqAGAIN"); 201 QDIO_DBF_TEXT5(1,trace,"eqAGAIN");
200 goto again; 202 goto again;
@@ -740,7 +742,8 @@ qdio_get_outbound_buffer_frontier(struct qdio_q *q)
740 first_not_to_check=f+qdio_min(atomic_read(&q->number_of_buffers_used), 742 first_not_to_check=f+qdio_min(atomic_read(&q->number_of_buffers_used),
741 (QDIO_MAX_BUFFERS_PER_Q-1)); 743 (QDIO_MAX_BUFFERS_PER_Q-1));
742 744
743 if ((!q->is_iqdio_q)&&(!q->hydra_gives_outbound_pcis)) 745 if (((!q->is_iqdio_q) && (!q->hydra_gives_outbound_pcis)) ||
746 (q->queue_type == QDIO_IQDIO_QFMT_ASYNCH))
744 SYNC_MEMORY; 747 SYNC_MEMORY;
745 748
746check_next: 749check_next:
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index d2b3898b750a..6f2c71ef47ee 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -367,6 +367,7 @@ config SCSI_3W_9XXX
367config SCSI_7000FASST 367config SCSI_7000FASST
368 tristate "7000FASST SCSI support" 368 tristate "7000FASST SCSI support"
369 depends on ISA && SCSI && ISA_DMA_API 369 depends on ISA && SCSI && ISA_DMA_API
370 select CHECK_SIGNATURE
370 help 371 help
371 This driver supports the Western Digital 7000 SCSI host adapter 372 This driver supports the Western Digital 7000 SCSI host adapter
372 family. Some information is in the source: 373 family. Some information is in the source:
@@ -388,6 +389,7 @@ config SCSI_AHA152X
388 tristate "Adaptec AHA152X/2825 support" 389 tristate "Adaptec AHA152X/2825 support"
389 depends on ISA && SCSI && !64BIT 390 depends on ISA && SCSI && !64BIT
390 select SCSI_SPI_ATTRS 391 select SCSI_SPI_ATTRS
392 select CHECK_SIGNATURE
391 ---help--- 393 ---help---
392 This is a driver for the AHA-1510, AHA-1520, AHA-1522, and AHA-2825 394 This is a driver for the AHA-1510, AHA-1520, AHA-1522, and AHA-2825
393 SCSI host adapters. It also works for the AVA-1505, but the IRQ etc. 395 SCSI host adapters. It also works for the AVA-1505, but the IRQ etc.
@@ -583,6 +585,7 @@ config SCSI_DTC3280
583 tristate "DTC3180/3280 SCSI support" 585 tristate "DTC3180/3280 SCSI support"
584 depends on ISA && SCSI 586 depends on ISA && SCSI
585 select SCSI_SPI_ATTRS 587 select SCSI_SPI_ATTRS
588 select CHECK_SIGNATURE
586 help 589 help
587 This is support for DTC 3180/3280 SCSI Host Adapters. Please read 590 This is support for DTC 3180/3280 SCSI Host Adapters. Please read
588 the SCSI-HOWTO, available from 591 the SCSI-HOWTO, available from
@@ -657,6 +660,7 @@ config SCSI_EATA_PIO
657config SCSI_FUTURE_DOMAIN 660config SCSI_FUTURE_DOMAIN
658 tristate "Future Domain 16xx SCSI/AHA-2920A support" 661 tristate "Future Domain 16xx SCSI/AHA-2920A support"
659 depends on (ISA || PCI) && SCSI 662 depends on (ISA || PCI) && SCSI
663 select CHECK_SIGNATURE
660 ---help--- 664 ---help---
661 This is support for Future Domain's 16-bit SCSI host adapters 665 This is support for Future Domain's 16-bit SCSI host adapters
662 (TMC-1660/1680, TMC-1650/1670, TMC-3260, TMC-1610M/MER/MEX) and 666 (TMC-1660/1680, TMC-1650/1670, TMC-3260, TMC-1610M/MER/MEX) and
@@ -1324,6 +1328,7 @@ config SCSI_LPFC
1324config SCSI_SEAGATE 1328config SCSI_SEAGATE
1325 tristate "Seagate ST-02 and Future Domain TMC-8xx SCSI support" 1329 tristate "Seagate ST-02 and Future Domain TMC-8xx SCSI support"
1326 depends on X86 && ISA && SCSI 1330 depends on X86 && ISA && SCSI
1331 select CHECK_SIGNATURE
1327 ---help--- 1332 ---help---
1328 These are 8-bit SCSI controllers; the ST-01 is also supported by 1333 These are 8-bit SCSI controllers; the ST-01 is also supported by
1329 this driver. It is explained in section 3.9 of the SCSI-HOWTO, 1334 this driver. It is explained in section 3.9 of the SCSI-HOWTO,
@@ -1397,6 +1402,7 @@ config SCSI_T128
1397 tristate "Trantor T128/T128F/T228 SCSI support" 1402 tristate "Trantor T128/T128F/T228 SCSI support"
1398 depends on ISA && SCSI 1403 depends on ISA && SCSI
1399 select SCSI_SPI_ATTRS 1404 select SCSI_SPI_ATTRS
1405 select CHECK_SIGNATURE
1400 ---help--- 1406 ---help---
1401 This is support for a SCSI host adapter. It is explained in section 1407 This is support for a SCSI host adapter. It is explained in section
1402 3.11 of the SCSI-HOWTO, available from 1408 3.11 of the SCSI-HOWTO, available from
@@ -1561,7 +1567,7 @@ config A3000_SCSI
1561 built-in SCSI controller, say Y. Otherwise, say N. 1567 built-in SCSI controller, say Y. Otherwise, say N.
1562 1568
1563 To compile this driver as a module, choose M here: the 1569 To compile this driver as a module, choose M here: the
1564 module will be called wd33c93. 1570 module will be called a3000.
1565 1571
1566config A2091_SCSI 1572config A2091_SCSI
1567 tristate "A2091/A590 WD33C93A support" 1573 tristate "A2091/A590 WD33C93A support"
@@ -1571,7 +1577,7 @@ config A2091_SCSI
1571 say N. 1577 say N.
1572 1578
1573 To compile this driver as a module, choose M here: the 1579 To compile this driver as a module, choose M here: the
1574 module will be called wd33c93. 1580 module will be called a2091.
1575 1581
1576config GVP11_SCSI 1582config GVP11_SCSI
1577 tristate "GVP Series II WD33C93A support" 1583 tristate "GVP Series II WD33C93A support"
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 301313002f6b..f94109cbb46e 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -129,7 +129,16 @@ struct uart_8250_port {
129 unsigned char mcr; 129 unsigned char mcr;
130 unsigned char mcr_mask; /* mask of user bits */ 130 unsigned char mcr_mask; /* mask of user bits */
131 unsigned char mcr_force; /* mask of forced bits */ 131 unsigned char mcr_force; /* mask of forced bits */
132 unsigned char lsr_break_flag; 132
133 /*
134 * Some bits in registers are cleared on a read, so they must
135 * be saved whenever the register is read but the bits will not
136 * be immediately processed.
137 */
138#define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
139 unsigned char lsr_saved_flags;
140#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
141 unsigned char msr_saved_flags;
133 142
134 /* 143 /*
135 * We provide a per-port pm hook. 144 * We provide a per-port pm hook.
@@ -1238,6 +1247,7 @@ static void serial8250_start_tx(struct uart_port *port)
1238 if (up->bugs & UART_BUG_TXEN) { 1247 if (up->bugs & UART_BUG_TXEN) {
1239 unsigned char lsr, iir; 1248 unsigned char lsr, iir;
1240 lsr = serial_in(up, UART_LSR); 1249 lsr = serial_in(up, UART_LSR);
1250 up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
1241 iir = serial_in(up, UART_IIR) & 0x0f; 1251 iir = serial_in(up, UART_IIR) & 0x0f;
1242 if ((up->port.type == PORT_RM9000) ? 1252 if ((up->port.type == PORT_RM9000) ?
1243 (lsr & UART_LSR_THRE && 1253 (lsr & UART_LSR_THRE &&
@@ -1290,18 +1300,10 @@ receive_chars(struct uart_8250_port *up, unsigned int *status)
1290 flag = TTY_NORMAL; 1300 flag = TTY_NORMAL;
1291 up->port.icount.rx++; 1301 up->port.icount.rx++;
1292 1302
1293#ifdef CONFIG_SERIAL_8250_CONSOLE 1303 lsr |= up->lsr_saved_flags;
1294 /* 1304 up->lsr_saved_flags = 0;
1295 * Recover the break flag from console xmit
1296 */
1297 if (up->port.line == up->port.cons->index) {
1298 lsr |= up->lsr_break_flag;
1299 up->lsr_break_flag = 0;
1300 }
1301#endif
1302 1305
1303 if (unlikely(lsr & (UART_LSR_BI | UART_LSR_PE | 1306 if (unlikely(lsr & UART_LSR_BRK_ERROR_BITS)) {
1304 UART_LSR_FE | UART_LSR_OE))) {
1305 /* 1307 /*
1306 * For statistics only 1308 * For statistics only
1307 */ 1309 */
@@ -1392,6 +1394,8 @@ static unsigned int check_modem_status(struct uart_8250_port *up)
1392{ 1394{
1393 unsigned int status = serial_in(up, UART_MSR); 1395 unsigned int status = serial_in(up, UART_MSR);
1394 1396
1397 status |= up->msr_saved_flags;
1398 up->msr_saved_flags = 0;
1395 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI && 1399 if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI &&
1396 up->port.info != NULL) { 1400 up->port.info != NULL) {
1397 if (status & UART_MSR_TERI) 1401 if (status & UART_MSR_TERI)
@@ -1591,7 +1595,8 @@ static void serial8250_timeout(unsigned long data)
1591static void serial8250_backup_timeout(unsigned long data) 1595static void serial8250_backup_timeout(unsigned long data)
1592{ 1596{
1593 struct uart_8250_port *up = (struct uart_8250_port *)data; 1597 struct uart_8250_port *up = (struct uart_8250_port *)data;
1594 unsigned int iir, ier = 0; 1598 unsigned int iir, ier = 0, lsr;
1599 unsigned long flags;
1595 1600
1596 /* 1601 /*
1597 * Must disable interrupts or else we risk racing with the interrupt 1602 * Must disable interrupts or else we risk racing with the interrupt
@@ -1610,9 +1615,13 @@ static void serial8250_backup_timeout(unsigned long data)
1610 * the "Diva" UART used on the management processor on many HP 1615 * the "Diva" UART used on the management processor on many HP
1611 * ia64 and parisc boxes. 1616 * ia64 and parisc boxes.
1612 */ 1617 */
1618 spin_lock_irqsave(&up->port.lock, flags);
1619 lsr = serial_in(up, UART_LSR);
1620 up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
1621 spin_unlock_irqrestore(&up->port.lock, flags);
1613 if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) && 1622 if ((iir & UART_IIR_NO_INT) && (up->ier & UART_IER_THRI) &&
1614 (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) && 1623 (!uart_circ_empty(&up->port.info->xmit) || up->port.x_char) &&
1615 (serial_in(up, UART_LSR) & UART_LSR_THRE)) { 1624 (lsr & UART_LSR_THRE)) {
1616 iir &= ~(UART_IIR_ID | UART_IIR_NO_INT); 1625 iir &= ~(UART_IIR_ID | UART_IIR_NO_INT);
1617 iir |= UART_IIR_THRI; 1626 iir |= UART_IIR_THRI;
1618 } 1627 }
@@ -1631,13 +1640,14 @@ static unsigned int serial8250_tx_empty(struct uart_port *port)
1631{ 1640{
1632 struct uart_8250_port *up = (struct uart_8250_port *)port; 1641 struct uart_8250_port *up = (struct uart_8250_port *)port;
1633 unsigned long flags; 1642 unsigned long flags;
1634 unsigned int ret; 1643 unsigned int lsr;
1635 1644
1636 spin_lock_irqsave(&up->port.lock, flags); 1645 spin_lock_irqsave(&up->port.lock, flags);
1637 ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0; 1646 lsr = serial_in(up, UART_LSR);
1647 up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
1638 spin_unlock_irqrestore(&up->port.lock, flags); 1648 spin_unlock_irqrestore(&up->port.lock, flags);
1639 1649
1640 return ret; 1650 return lsr & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
1641} 1651}
1642 1652
1643static unsigned int serial8250_get_mctrl(struct uart_port *port) 1653static unsigned int serial8250_get_mctrl(struct uart_port *port)
@@ -1708,8 +1718,7 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits)
1708 do { 1718 do {
1709 status = serial_in(up, UART_LSR); 1719 status = serial_in(up, UART_LSR);
1710 1720
1711 if (status & UART_LSR_BI) 1721 up->lsr_saved_flags |= status & LSR_SAVE_FLAGS;
1712 up->lsr_break_flag = UART_LSR_BI;
1713 1722
1714 if (--tmout == 0) 1723 if (--tmout == 0)
1715 break; 1724 break;
@@ -1718,8 +1727,12 @@ static inline void wait_for_xmitr(struct uart_8250_port *up, int bits)
1718 1727
1719 /* Wait up to 1s for flow control if necessary */ 1728 /* Wait up to 1s for flow control if necessary */
1720 if (up->port.flags & UPF_CONS_FLOW) { 1729 if (up->port.flags & UPF_CONS_FLOW) {
1721 tmout = 1000000; 1730 unsigned int tmout;
1722 while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout) { 1731 for (tmout = 1000000; tmout; tmout--) {
1732 unsigned int msr = serial_in(up, UART_MSR);
1733 up->msr_saved_flags |= msr & MSR_SAVE_FLAGS;
1734 if (msr & UART_MSR_CTS)
1735 break;
1723 udelay(1); 1736 udelay(1);
1724 touch_nmi_watchdog(); 1737 touch_nmi_watchdog();
1725 } 1738 }
@@ -1889,6 +1902,18 @@ static int serial8250_startup(struct uart_port *port)
1889 spin_unlock_irqrestore(&up->port.lock, flags); 1902 spin_unlock_irqrestore(&up->port.lock, flags);
1890 1903
1891 /* 1904 /*
1905 * Clear the interrupt registers again for luck, and clear the
1906 * saved flags to avoid getting false values from polling
1907 * routines or the previous session.
1908 */
1909 serial_inp(up, UART_LSR);
1910 serial_inp(up, UART_RX);
1911 serial_inp(up, UART_IIR);
1912 serial_inp(up, UART_MSR);
1913 up->lsr_saved_flags = 0;
1914 up->msr_saved_flags = 0;
1915
1916 /*
1892 * Finally, enable interrupts. Note: Modem status interrupts 1917 * Finally, enable interrupts. Note: Modem status interrupts
1893 * are set via set_termios(), which will be occurring imminently 1918 * are set via set_termios(), which will be occurring imminently
1894 * anyway, so we don't enable them here. 1919 * anyway, so we don't enable them here.
@@ -1906,14 +1931,6 @@ static int serial8250_startup(struct uart_port *port)
1906 (void) inb_p(icp); 1931 (void) inb_p(icp);
1907 } 1932 }
1908 1933
1909 /*
1910 * And clear the interrupt registers again for luck.
1911 */
1912 (void) serial_inp(up, UART_LSR);
1913 (void) serial_inp(up, UART_RX);
1914 (void) serial_inp(up, UART_IIR);
1915 (void) serial_inp(up, UART_MSR);
1916
1917 return 0; 1934 return 0;
1918} 1935}
1919 1936
@@ -2484,6 +2501,16 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2484 wait_for_xmitr(up, BOTH_EMPTY); 2501 wait_for_xmitr(up, BOTH_EMPTY);
2485 serial_out(up, UART_IER, ier); 2502 serial_out(up, UART_IER, ier);
2486 2503
2504 /*
2505 * The receive handling will happen properly because the
2506 * receive ready bit will still be set; it is not cleared
2507 * on read. However, modem control will not, we must
2508 * call it if we have saved something in the saved flags
2509 * while processing with interrupts off.
2510 */
2511 if (up->msr_saved_flags)
2512 check_modem_status(up);
2513
2487 if (locked) 2514 if (locked)
2488 spin_unlock(&up->port.lock); 2515 spin_unlock(&up->port.lock);
2489 local_irq_restore(flags); 2516 local_irq_restore(flags);
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 5e485876f54c..bd66339f7a3f 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -580,6 +580,138 @@ static int pci_netmos_init(struct pci_dev *dev)
580 return num_serial; 580 return num_serial;
581} 581}
582 582
583/*
584 * ITE support by Niels de Vos <niels.devos@wincor-nixdorf.com>
585 *
586 * These chips are available with optionally one parallel port and up to
587 * two serial ports. Unfortunately they all have the same product id.
588 *
589 * Basic configuration is done over a region of 32 I/O ports. The base
590 * ioport is called INTA or INTC, depending on docs/other drivers.
591 *
592 * The region of the 32 I/O ports is configured in POSIO0R...
593 */
594
595/* registers */
596#define ITE_887x_MISCR 0x9c
597#define ITE_887x_INTCBAR 0x78
598#define ITE_887x_UARTBAR 0x7c
599#define ITE_887x_PS0BAR 0x10
600#define ITE_887x_POSIO0 0x60
601
602/* I/O space size */
603#define ITE_887x_IOSIZE 32
604/* I/O space size (bits 26-24; 8 bytes = 011b) */
605#define ITE_887x_POSIO_IOSIZE_8 (3 << 24)
606/* I/O space size (bits 26-24; 32 bytes = 101b) */
607#define ITE_887x_POSIO_IOSIZE_32 (5 << 24)
608/* Decoding speed (1 = slow, 2 = medium, 3 = fast) */
609#define ITE_887x_POSIO_SPEED (3 << 29)
610/* enable IO_Space bit */
611#define ITE_887x_POSIO_ENABLE (1 << 31)
612
613static int __devinit pci_ite887x_init(struct pci_dev *dev)
614{
615 /* inta_addr are the configuration addresses of the ITE */
616 static const short inta_addr[] = { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0,
617 0x200, 0x280, 0 };
618 int ret, i, type;
619 struct resource *iobase = NULL;
620 u32 miscr, uartbar, ioport;
621
622 /* search for the base-ioport */
623 i = 0;
624 while (inta_addr[i] && iobase == NULL) {
625 iobase = request_region(inta_addr[i], ITE_887x_IOSIZE,
626 "ite887x");
627 if (iobase != NULL) {
628 /* write POSIO0R - speed | size | ioport */
629 pci_write_config_dword(dev, ITE_887x_POSIO0,
630 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
631 ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
632 /* write INTCBAR - ioport */
633 pci_write_config_dword(dev, ITE_887x_INTCBAR, inta_addr[i]);
634 ret = inb(inta_addr[i]);
635 if (ret != 0xff) {
636 /* ioport connected */
637 break;
638 }
639 release_region(iobase->start, ITE_887x_IOSIZE);
640 iobase = NULL;
641 }
642 i++;
643 }
644
645 if (!inta_addr[i]) {
646 printk(KERN_ERR "ite887x: could not find iobase\n");
647 return -ENODEV;
648 }
649
650 /* start of undocumented type checking (see parport_pc.c) */
651 type = inb(iobase->start + 0x18) & 0x0f;
652
653 switch (type) {
654 case 0x2: /* ITE8871 (1P) */
655 case 0xa: /* ITE8875 (1P) */
656 ret = 0;
657 break;
658 case 0xe: /* ITE8872 (2S1P) */
659 ret = 2;
660 break;
661 case 0x6: /* ITE8873 (1S) */
662 ret = 1;
663 break;
664 case 0x8: /* ITE8874 (2S) */
665 ret = 2;
666 break;
667 default:
668 moan_device("Unknown ITE887x", dev);
669 ret = -ENODEV;
670 }
671
672 /* configure all serial ports */
673 for (i = 0; i < ret; i++) {
674 /* read the I/O port from the device */
675 pci_read_config_dword(dev, ITE_887x_PS0BAR + (0x4 * (i + 1)),
676 &ioport);
677 ioport &= 0x0000FF00; /* the actual base address */
678 pci_write_config_dword(dev, ITE_887x_POSIO0 + (0x4 * (i + 1)),
679 ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
680 ITE_887x_POSIO_IOSIZE_8 | ioport);
681
682 /* write the ioport to the UARTBAR */
683 pci_read_config_dword(dev, ITE_887x_UARTBAR, &uartbar);
684 uartbar &= ~(0xffff << (16 * i)); /* clear half the reg */
685 uartbar |= (ioport << (16 * i)); /* set the ioport */
686 pci_write_config_dword(dev, ITE_887x_UARTBAR, uartbar);
687
688 /* get current config */
689 pci_read_config_dword(dev, ITE_887x_MISCR, &miscr);
690 /* disable interrupts (UARTx_Routing[3:0]) */
691 miscr &= ~(0xf << (12 - 4 * i));
692 /* activate the UART (UARTx_En) */
693 miscr |= 1 << (23 - i);
694 /* write new config with activated UART */
695 pci_write_config_dword(dev, ITE_887x_MISCR, miscr);
696 }
697
698 if (ret <= 0) {
699 /* the device has no UARTs if we get here */
700 release_region(iobase->start, ITE_887x_IOSIZE);
701 }
702
703 return ret;
704}
705
706static void __devexit pci_ite887x_exit(struct pci_dev *dev)
707{
708 u32 ioport;
709 /* the ioport is bit 0-15 in POSIO0R */
710 pci_read_config_dword(dev, ITE_887x_POSIO0, &ioport);
711 ioport &= 0xffff;
712 release_region(ioport, ITE_887x_IOSIZE);
713}
714
583static int 715static int
584pci_default_setup(struct serial_private *priv, struct pciserial_board *board, 716pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
585 struct uart_port *port, int idx) 717 struct uart_port *port, int idx)
@@ -653,6 +785,18 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
653 .setup = pci_default_setup, 785 .setup = pci_default_setup,
654 }, 786 },
655 /* 787 /*
788 * ITE
789 */
790 {
791 .vendor = PCI_VENDOR_ID_ITE,
792 .device = PCI_DEVICE_ID_ITE_8872,
793 .subvendor = PCI_ANY_ID,
794 .subdevice = PCI_ANY_ID,
795 .init = pci_ite887x_init,
796 .setup = pci_default_setup,
797 .exit = __devexit_p(pci_ite887x_exit),
798 },
799 /*
656 * Panacom 800 * Panacom
657 */ 801 */
658 { 802 {
@@ -933,6 +1077,7 @@ enum pci_board_num_t {
933 1077
934 pbn_b1_2_1250000, 1078 pbn_b1_2_1250000,
935 1079
1080 pbn_b1_bt_1_115200,
936 pbn_b1_bt_2_921600, 1081 pbn_b1_bt_2_921600,
937 1082
938 pbn_b1_1_1382400, 1083 pbn_b1_1_1382400,
@@ -983,6 +1128,7 @@ enum pci_board_num_t {
983 pbn_exar_XR17C152, 1128 pbn_exar_XR17C152,
984 pbn_exar_XR17C154, 1129 pbn_exar_XR17C154,
985 pbn_exar_XR17C158, 1130 pbn_exar_XR17C158,
1131 pbn_pasemi_1682M,
986}; 1132};
987 1133
988/* 1134/*
@@ -1211,6 +1357,13 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1211 .uart_offset = 8, 1357 .uart_offset = 8,
1212 }, 1358 },
1213 1359
1360 [pbn_b1_bt_1_115200] = {
1361 .flags = FL_BASE1|FL_BASE_BARS,
1362 .num_ports = 1,
1363 .base_baud = 115200,
1364 .uart_offset = 8,
1365 },
1366
1214 [pbn_b1_bt_2_921600] = { 1367 [pbn_b1_bt_2_921600] = {
1215 .flags = FL_BASE1|FL_BASE_BARS, 1368 .flags = FL_BASE1|FL_BASE_BARS,
1216 .num_ports = 2, 1369 .num_ports = 2,
@@ -1498,6 +1651,18 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1498 .base_baud = 921600, 1651 .base_baud = 921600,
1499 .uart_offset = 0x200, 1652 .uart_offset = 0x200,
1500 }, 1653 },
1654 /*
1655 * PA Semi PWRficient PA6T-1682M on-chip UART
1656 */
1657 [pbn_pasemi_1682M] = {
1658 .flags = FL_BASE0,
1659 .num_ports = 1,
1660 .base_baud = 8333333,
1661 },
1662};
1663
1664static const struct pci_device_id softmodem_blacklist[] = {
1665 { PCI_VDEVICE ( AL, 0x5457 ), }, /* ALi Corporation M5457 AC'97 Modem */
1501}; 1666};
1502 1667
1503/* 1668/*
@@ -1508,6 +1673,7 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1508static int __devinit 1673static int __devinit
1509serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board) 1674serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
1510{ 1675{
1676 const struct pci_device_id *blacklist;
1511 int num_iomem, num_port, first_port = -1, i; 1677 int num_iomem, num_port, first_port = -1, i;
1512 1678
1513 /* 1679 /*
@@ -1522,6 +1688,18 @@ serial_pci_guess_board(struct pci_dev *dev, struct pciserial_board *board)
1522 (dev->class & 0xff) > 6) 1688 (dev->class & 0xff) > 6)
1523 return -ENODEV; 1689 return -ENODEV;
1524 1690
1691 /*
1692 * Do not access blacklisted devices that are known not to
1693 * feature serial ports.
1694 */
1695 for (blacklist = softmodem_blacklist;
1696 blacklist < softmodem_blacklist + ARRAY_SIZE(softmodem_blacklist);
1697 blacklist++) {
1698 if (dev->vendor == blacklist->vendor &&
1699 dev->device == blacklist->device)
1700 return -ENODEV;
1701 }
1702
1525 num_iomem = num_port = 0; 1703 num_iomem = num_port = 0;
1526 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) { 1704 for (i = 0; i < PCI_NUM_BAR_RESOURCES; i++) {
1527 if (pci_resource_flags(dev, i) & IORESOURCE_IO) { 1705 if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
@@ -2364,6 +2542,13 @@ static struct pci_device_id serial_pci_tbl[] = {
2364 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560, 2542 { PCI_VENDOR_ID_TOPIC, PCI_DEVICE_ID_TOPIC_TP560,
2365 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2543 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2366 pbn_b0_1_115200 }, 2544 pbn_b0_1_115200 },
2545 /*
2546 * ITE
2547 */
2548 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8872,
2549 PCI_ANY_ID, PCI_ANY_ID,
2550 0, 0,
2551 pbn_b1_bt_1_115200 },
2367 2552
2368 /* 2553 /*
2369 * IntaShield IS-200 2554 * IntaShield IS-200
@@ -2382,6 +2567,13 @@ static struct pci_device_id serial_pci_tbl[] = {
2382 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8, 2567 PCI_SUBVENDOR_ID_PERLE, PCI_SUBDEVICE_ID_PCI_RAS8,
2383 0, 0, pbn_b2_8_921600 }, 2568 0, 0, pbn_b2_8_921600 },
2384 /* 2569 /*
2570 * PA Semi PA6T-1682M on-chip UART
2571 */
2572 { PCI_VENDOR_ID_PASEMI, 0xa004,
2573 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2574 pbn_pasemi_1682M },
2575
2576 /*
2385 * These entries match devices with class COMMUNICATION_SERIAL, 2577 * These entries match devices with class COMMUNICATION_SERIAL,
2386 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL 2578 * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
2387 */ 2579 */
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 030a6063541d..a055f58f342f 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1146,11 +1146,14 @@ static void uart_set_termios(struct tty_struct *tty, struct ktermios *old_termio
1146 1146
1147 /* 1147 /*
1148 * These are the bits that are used to setup various 1148 * These are the bits that are used to setup various
1149 * flags in the low level driver. 1149 * flags in the low level driver. We can ignore the Bfoo
1150 * bits in c_cflag; c_[io]speed will always be set
1151 * appropriately by set_termios() in tty_ioctl.c
1150 */ 1152 */
1151#define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 1153#define RELEVANT_IFLAG(iflag) ((iflag) & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
1152
1153 if ((cflag ^ old_termios->c_cflag) == 0 && 1154 if ((cflag ^ old_termios->c_cflag) == 0 &&
1155 tty->termios->c_ospeed == old_termios->c_ospeed &&
1156 tty->termios->c_ispeed == old_termios->c_ispeed &&
1154 RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0) 1157 RELEVANT_IFLAG(tty->termios->c_iflag ^ old_termios->c_iflag) == 0)
1155 return; 1158 return;
1156 1159
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index b8f91e018b21..0930e2a85514 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -37,7 +37,7 @@
37 37
38#include <asm/io.h> 38#include <asm/io.h>
39 39
40static char *serial_version = "1.09"; 40static char *serial_version = "1.10";
41static char *serial_name = "TX39/49 Serial driver"; 41static char *serial_name = "TX39/49 Serial driver";
42 42
43#define PASS_LIMIT 256 43#define PASS_LIMIT 256
@@ -436,8 +436,10 @@ static unsigned int serial_txx9_get_mctrl(struct uart_port *port)
436 struct uart_txx9_port *up = (struct uart_txx9_port *)port; 436 struct uart_txx9_port *up = (struct uart_txx9_port *)port;
437 unsigned int ret; 437 unsigned int ret;
438 438
439 ret = ((sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS) 439 /* no modem control lines */
440 | ((sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS); 440 ret = TIOCM_CAR | TIOCM_DSR;
441 ret |= (sio_in(up, TXX9_SIFLCR) & TXX9_SIFLCR_RTSSC) ? 0 : TIOCM_RTS;
442 ret |= (sio_in(up, TXX9_SICISR) & TXX9_SICISR_CTSS) ? 0 : TIOCM_CTS;
441 443
442 return ret; 444 return ret;
443} 445}
@@ -557,6 +559,12 @@ serial_txx9_set_termios(struct uart_port *port, struct ktermios *termios,
557 unsigned long flags; 559 unsigned long flags;
558 unsigned int baud, quot; 560 unsigned int baud, quot;
559 561
562 /*
563 * We don't support modem control lines.
564 */
565 termios->c_cflag &= ~(HUPCL | CMSPAR);
566 termios->c_cflag |= CLOCAL;
567
560 cval = sio_in(up, TXX9_SILCR); 568 cval = sio_in(up, TXX9_SILCR);
561 /* byte size and parity */ 569 /* byte size and parity */
562 cval &= ~TXX9_SILCR_UMODE_MASK; 570 cval &= ~TXX9_SILCR_UMODE_MASK;
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 7dd73546bf43..7580aa5da0f8 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -6,6 +6,9 @@ menuconfig USB_SUPPORT
6 bool "USB support" 6 bool "USB support"
7 depends on HAS_IOMEM 7 depends on HAS_IOMEM
8 default y 8 default y
9 ---help---
10 This option adds core support for Universal Serial Bus (USB).
11 You will also need drivers from the following menu to make use of it.
9 12
10if USB_SUPPORT 13if USB_SUPPORT
11 14
@@ -18,6 +21,7 @@ config USB_ARCH_HAS_HCD
18 default y if USB_ARCH_HAS_EHCI 21 default y if USB_ARCH_HAS_EHCI
19 default y if PCMCIA && !M32R # sl811_cs 22 default y if PCMCIA && !M32R # sl811_cs
20 default y if ARM # SL-811 23 default y if ARM # SL-811
24 default y if SUPERH # r8a66597-hcd
21 default PCI 25 default PCI
22 26
23# many non-PCI SOC chips embed OHCI 27# many non-PCI SOC chips embed OHCI
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index 02c52f8d5dbf..a73e714288e5 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -456,7 +456,6 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
456 int* actual_length) 456 int* actual_length)
457{ 457{
458 struct timer_list timer; 458 struct timer_list timer;
459 int status = urb->status;
460 459
461 init_timer(&timer); 460 init_timer(&timer);
462 timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT); 461 timer.expires = jiffies + msecs_to_jiffies(CMD_TIMEOUT);
@@ -468,7 +467,7 @@ static int cxacru_start_wait_urb(struct urb *urb, struct completion *done,
468 467
469 if (actual_length) 468 if (actual_length)
470 *actual_length = urb->actual_length; 469 *actual_length = urb->actual_length;
471 return status; 470 return urb->status; /* must read status after completion */
472} 471}
473 472
474static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm, 473static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm,
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index a1a1c9d467e0..29807d048b04 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -1721,9 +1721,12 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
1721 1721
1722 ret = uea_boot(sc); 1722 ret = uea_boot(sc);
1723 if (ret < 0) 1723 if (ret < 0)
1724 goto error; 1724 goto error_rm_grp;
1725 1725
1726 return 0; 1726 return 0;
1727
1728error_rm_grp:
1729 sysfs_remove_group(&intf->dev.kobj, &attr_grp);
1727error: 1730error:
1728 kfree(sc); 1731 kfree(sc);
1729 return ret; 1732 return ret;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index fe940e0536e0..f51e22490edf 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -921,6 +921,10 @@ skip_normal_probe:
921 return -EINVAL; 921 return -EINVAL;
922 } 922 }
923 } 923 }
924
925 /* Accept probe requests only for the control interface */
926 if (intf != control_interface)
927 return -ENODEV;
924 928
925 if (usb_interface_claimed(data_interface)) { /* valid in this context */ 929 if (usb_interface_claimed(data_interface)) { /* valid in this context */
926 dev_dbg(&intf->dev,"The data interface isn't available"); 930 dev_dbg(&intf->dev,"The data interface isn't available");
@@ -1109,10 +1113,12 @@ static void acm_disconnect(struct usb_interface *intf)
1109 return; 1113 return;
1110 } 1114 }
1111 if (acm->country_codes){ 1115 if (acm->country_codes){
1112 device_remove_file(&intf->dev, &dev_attr_wCountryCodes); 1116 device_remove_file(&acm->control->dev,
1113 device_remove_file(&intf->dev, &dev_attr_iCountryCodeRelDate); 1117 &dev_attr_wCountryCodes);
1118 device_remove_file(&acm->control->dev,
1119 &dev_attr_iCountryCodeRelDate);
1114 } 1120 }
1115 device_remove_file(&intf->dev, &dev_attr_bmCapabilities); 1121 device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities);
1116 acm->dev = NULL; 1122 acm->dev = NULL;
1117 usb_set_intfdata(acm->control, NULL); 1123 usb_set_intfdata(acm->control, NULL);
1118 usb_set_intfdata(acm->data, NULL); 1124 usb_set_intfdata(acm->data, NULL);
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 654857493a82..a1ad11d0c47c 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1224,6 +1224,8 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
1224 udev->auto_pm = 1; 1224 udev->auto_pm = 1;
1225 udev->pm_usage_cnt += inc_usage_cnt; 1225 udev->pm_usage_cnt += inc_usage_cnt;
1226 WARN_ON(udev->pm_usage_cnt < 0); 1226 WARN_ON(udev->pm_usage_cnt < 0);
1227 if (inc_usage_cnt)
1228 udev->last_busy = jiffies;
1227 if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) { 1229 if (inc_usage_cnt >= 0 && udev->pm_usage_cnt > 0) {
1228 if (udev->state == USB_STATE_SUSPENDED) 1230 if (udev->state == USB_STATE_SUSPENDED)
1229 status = usb_resume_both(udev); 1231 status = usb_resume_both(udev);
@@ -1232,8 +1234,6 @@ static int usb_autopm_do_device(struct usb_device *udev, int inc_usage_cnt)
1232 else if (inc_usage_cnt) 1234 else if (inc_usage_cnt)
1233 udev->last_busy = jiffies; 1235 udev->last_busy = jiffies;
1234 } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) { 1236 } else if (inc_usage_cnt <= 0 && udev->pm_usage_cnt <= 0) {
1235 if (inc_usage_cnt)
1236 udev->last_busy = jiffies;
1237 status = usb_suspend_both(udev, PMSG_SUSPEND); 1237 status = usb_suspend_both(udev, PMSG_SUSPEND);
1238 } 1238 }
1239 usb_pm_unlock(udev); 1239 usb_pm_unlock(udev);
@@ -1342,16 +1342,15 @@ static int usb_autopm_do_interface(struct usb_interface *intf,
1342 else { 1342 else {
1343 udev->auto_pm = 1; 1343 udev->auto_pm = 1;
1344 intf->pm_usage_cnt += inc_usage_cnt; 1344 intf->pm_usage_cnt += inc_usage_cnt;
1345 udev->last_busy = jiffies;
1345 if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) { 1346 if (inc_usage_cnt >= 0 && intf->pm_usage_cnt > 0) {
1346 if (udev->state == USB_STATE_SUSPENDED) 1347 if (udev->state == USB_STATE_SUSPENDED)
1347 status = usb_resume_both(udev); 1348 status = usb_resume_both(udev);
1348 if (status != 0) 1349 if (status != 0)
1349 intf->pm_usage_cnt -= inc_usage_cnt; 1350 intf->pm_usage_cnt -= inc_usage_cnt;
1350 else if (inc_usage_cnt) 1351 else
1351 udev->last_busy = jiffies; 1352 udev->last_busy = jiffies;
1352 } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) { 1353 } else if (inc_usage_cnt <= 0 && intf->pm_usage_cnt <= 0) {
1353 if (inc_usage_cnt)
1354 udev->last_busy = jiffies;
1355 status = usb_suspend_both(udev, PMSG_SUSPEND); 1354 status = usb_suspend_both(udev, PMSG_SUSPEND);
1356 } 1355 }
1357 } 1356 }
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index e341a1da517f..f7b337feb3ea 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1644,9 +1644,10 @@ static int finish_port_resume(struct usb_device *udev)
1644 * and device drivers will know about any resume quirks. 1644 * and device drivers will know about any resume quirks.
1645 */ 1645 */
1646 if (status == 0) { 1646 if (status == 0) {
1647 devstatus = 0;
1647 status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus); 1648 status = usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
1648 if (status >= 0) 1649 if (status >= 0)
1649 status = (status == 2 ? 0 : -ENODEV); 1650 status = (status > 0 ? 0 : -ENODEV);
1650 } 1651 }
1651 1652
1652 if (status) { 1653 if (status) {
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b6bd05e3d439..d8f7b089a8f0 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -637,12 +637,12 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char
637 memset(buf,0,size); // Make sure we parse really received data 637 memset(buf,0,size); // Make sure we parse really received data
638 638
639 for (i = 0; i < 3; ++i) { 639 for (i = 0; i < 3; ++i) {
640 /* retry on length 0 or stall; some devices are flakey */ 640 /* retry on length 0 or error; some devices are flakey */
641 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 641 result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
642 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, 642 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
643 (type << 8) + index, 0, buf, size, 643 (type << 8) + index, 0, buf, size,
644 USB_CTRL_GET_TIMEOUT); 644 USB_CTRL_GET_TIMEOUT);
645 if (result == 0 || result == -EPIPE) 645 if (result <= 0 && result != -ETIMEDOUT)
646 continue; 646 continue;
647 if (result > 1 && ((u8 *)buf)[1] != type) { 647 if (result > 1 && ((u8 *)buf)[1] != type) {
648 result = -EPROTO; 648 result = -EPROTO;
@@ -1358,6 +1358,30 @@ static int usb_if_uevent(struct device *dev, char **envp, int num_envp,
1358 usb_dev = interface_to_usbdev(intf); 1358 usb_dev = interface_to_usbdev(intf);
1359 alt = intf->cur_altsetting; 1359 alt = intf->cur_altsetting;
1360 1360
1361#ifdef CONFIG_USB_DEVICEFS
1362 if (add_uevent_var(envp, num_envp, &i,
1363 buffer, buffer_size, &length,
1364 "DEVICE=/proc/bus/usb/%03d/%03d",
1365 usb_dev->bus->busnum, usb_dev->devnum))
1366 return -ENOMEM;
1367#endif
1368
1369 if (add_uevent_var(envp, num_envp, &i,
1370 buffer, buffer_size, &length,
1371 "PRODUCT=%x/%x/%x",
1372 le16_to_cpu(usb_dev->descriptor.idVendor),
1373 le16_to_cpu(usb_dev->descriptor.idProduct),
1374 le16_to_cpu(usb_dev->descriptor.bcdDevice)))
1375 return -ENOMEM;
1376
1377 if (add_uevent_var(envp, num_envp, &i,
1378 buffer, buffer_size, &length,
1379 "TYPE=%d/%d/%d",
1380 usb_dev->descriptor.bDeviceClass,
1381 usb_dev->descriptor.bDeviceSubClass,
1382 usb_dev->descriptor.bDeviceProtocol))
1383 return -ENOMEM;
1384
1361 if (add_uevent_var(envp, num_envp, &i, 1385 if (add_uevent_var(envp, num_envp, &i,
1362 buffer, buffer_size, &length, 1386 buffer, buffer_size, &length,
1363 "INTERFACE=%d/%d/%d", 1387 "INTERFACE=%d/%d/%d",
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index b7917c5a3c6f..9e467118dc94 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -30,6 +30,8 @@
30static const struct usb_device_id usb_quirk_list[] = { 30static const struct usb_device_id usb_quirk_list[] = {
31 /* HP 5300/5370C scanner */ 31 /* HP 5300/5370C scanner */
32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, 32 { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
33 /* Hewlett-Packard PhotoSmart 720 / PhotoSmart 935 (storage) */
34 { USB_DEVICE(0x03f0, 0x4002), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
33 /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */ 35 /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
34 { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 36 { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
35 /* Benq S2W 3300U */ 37 /* Benq S2W 3300U */
@@ -56,6 +58,8 @@ static const struct usb_device_id usb_quirk_list[] = {
56 { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 58 { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
57 /* Seiko Epson Corp.*/ 59 /* Seiko Epson Corp.*/
58 { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 60 { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
61 /* Samsung ML-2010 printer */
62 { USB_DEVICE(0x04e8, 0x326c), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
59 /* Samsung ML-2510 Series printer */ 63 /* Samsung ML-2510 Series printer */
60 { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 64 { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
61 /* Elsa MicroLink 56k (V.250) */ 65 /* Elsa MicroLink 56k (V.250) */
@@ -64,12 +68,20 @@ static const struct usb_device_id usb_quirk_list[] = {
64 { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 68 { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
65 /* Agfa Snapscan1212u */ 69 /* Agfa Snapscan1212u */
66 { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 70 { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
71 /* Seagate RSS LLC */
72 { USB_DEVICE(0x0bc2, 0x3000), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
67 /* Umax [hex] Astra 3400U */ 73 /* Umax [hex] Astra 3400U */
68 { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 74 { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
69 75
70 /* Philips PSC805 audio device */ 76 /* Philips PSC805 audio device */
71 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, 77 { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
72 78
79 /* Alcor multi-card reader */
80 { USB_DEVICE(0x058f, 0x6366), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
81
82 /* Canon EOS 5D in PC Connection mode */
83 { USB_DEVICE(0x04a9, 0x3101), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
84
73 /* RIM Blackberry */ 85 /* RIM Blackberry */
74 { USB_DEVICE(0x0fca, 0x0001), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 86 { USB_DEVICE(0x0fca, 0x0001), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
75 { USB_DEVICE(0x0fca, 0x0004), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, 87 { USB_DEVICE(0x0fca, 0x0004), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index f2fbdc7fe376..d008d1360a7a 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -34,8 +34,6 @@
34 * bypassing some hardware (and driver) issues. UML could help too. 34 * bypassing some hardware (and driver) issues. UML could help too.
35 */ 35 */
36 36
37#define DEBUG
38
39#include <linux/module.h> 37#include <linux/module.h>
40#include <linux/kernel.h> 38#include <linux/kernel.h>
41#include <linux/delay.h> 39#include <linux/delay.h>
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index be7a1bd2823b..965ad7bec7b7 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -599,7 +599,6 @@ enum fsg_buffer_state {
599 599
600struct fsg_buffhd { 600struct fsg_buffhd {
601 void *buf; 601 void *buf;
602 dma_addr_t dma;
603 enum fsg_buffer_state state; 602 enum fsg_buffer_state state;
604 struct fsg_buffhd *next; 603 struct fsg_buffhd *next;
605 604
@@ -1295,6 +1294,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1295 struct usb_request *req = fsg->ep0req; 1294 struct usb_request *req = fsg->ep0req;
1296 int value = -EOPNOTSUPP; 1295 int value = -EOPNOTSUPP;
1297 u16 w_index = le16_to_cpu(ctrl->wIndex); 1296 u16 w_index = le16_to_cpu(ctrl->wIndex);
1297 u16 w_value = le16_to_cpu(ctrl->wValue);
1298 u16 w_length = le16_to_cpu(ctrl->wLength); 1298 u16 w_length = le16_to_cpu(ctrl->wLength);
1299 1299
1300 if (!fsg->config) 1300 if (!fsg->config)
@@ -1308,7 +1308,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1308 if (ctrl->bRequestType != (USB_DIR_OUT | 1308 if (ctrl->bRequestType != (USB_DIR_OUT |
1309 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 1309 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
1310 break; 1310 break;
1311 if (w_index != 0) { 1311 if (w_index != 0 || w_value != 0) {
1312 value = -EDOM; 1312 value = -EDOM;
1313 break; 1313 break;
1314 } 1314 }
@@ -1324,7 +1324,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1324 if (ctrl->bRequestType != (USB_DIR_IN | 1324 if (ctrl->bRequestType != (USB_DIR_IN |
1325 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 1325 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
1326 break; 1326 break;
1327 if (w_index != 0) { 1327 if (w_index != 0 || w_value != 0) {
1328 value = -EDOM; 1328 value = -EDOM;
1329 break; 1329 break;
1330 } 1330 }
@@ -1343,7 +1343,7 @@ static int class_setup_req(struct fsg_dev *fsg,
1343 if (ctrl->bRequestType != (USB_DIR_OUT | 1343 if (ctrl->bRequestType != (USB_DIR_OUT |
1344 USB_TYPE_CLASS | USB_RECIP_INTERFACE)) 1344 USB_TYPE_CLASS | USB_RECIP_INTERFACE))
1345 break; 1345 break;
1346 if (w_index != 0) { 1346 if (w_index != 0 || w_value != 0) {
1347 value = -EDOM; 1347 value = -EDOM;
1348 break; 1348 break;
1349 } 1349 }
@@ -2611,7 +2611,6 @@ static int send_status(struct fsg_dev *fsg)
2611 2611
2612 fsg->intr_buffhd = bh; // Point to the right buffhd 2612 fsg->intr_buffhd = bh; // Point to the right buffhd
2613 fsg->intreq->buf = bh->inreq->buf; 2613 fsg->intreq->buf = bh->inreq->buf;
2614 fsg->intreq->dma = bh->inreq->dma;
2615 fsg->intreq->context = bh; 2614 fsg->intreq->context = bh;
2616 start_transfer(fsg, fsg->intr_in, fsg->intreq, 2615 start_transfer(fsg, fsg->intr_in, fsg->intreq,
2617 &fsg->intreq_busy, &bh->state); 2616 &fsg->intreq_busy, &bh->state);
@@ -3200,7 +3199,6 @@ reset:
3200 if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0) 3199 if ((rc = alloc_request(fsg, fsg->bulk_out, &bh->outreq)) != 0)
3201 goto reset; 3200 goto reset;
3202 bh->inreq->buf = bh->outreq->buf = bh->buf; 3201 bh->inreq->buf = bh->outreq->buf = bh->buf;
3203 bh->inreq->dma = bh->outreq->dma = bh->dma;
3204 bh->inreq->context = bh->outreq->context = bh; 3202 bh->inreq->context = bh->outreq->context = bh;
3205 bh->inreq->complete = bulk_in_complete; 3203 bh->inreq->complete = bulk_in_complete;
3206 bh->outreq->complete = bulk_out_complete; 3204 bh->outreq->complete = bulk_out_complete;
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 10b2b33b8698..d57bcfbc08a5 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -1277,31 +1277,32 @@ static void setup_received_irq(struct fsl_udc *udc,
1277 1277
1278 udc_reset_ep_queue(udc, 0); 1278 udc_reset_ep_queue(udc, 0);
1279 1279
1280 /* We process some stardard setup requests here */
1280 switch (setup->bRequest) { 1281 switch (setup->bRequest) {
1281 /* Request that need Data+Status phase from udc */
1282 case USB_REQ_GET_STATUS: 1282 case USB_REQ_GET_STATUS:
1283 if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_STANDARD)) 1283 /* Data+Status phase from udc */
1284 if ((setup->bRequestType & (USB_DIR_IN | USB_TYPE_MASK))
1284 != (USB_DIR_IN | USB_TYPE_STANDARD)) 1285 != (USB_DIR_IN | USB_TYPE_STANDARD))
1285 break; 1286 break;
1286 ch9getstatus(udc, setup->bRequestType, wValue, wIndex, wLength); 1287 ch9getstatus(udc, setup->bRequestType, wValue, wIndex, wLength);
1287 break; 1288 return;
1288 1289
1289 /* Requests that need Status phase from udc */
1290 case USB_REQ_SET_ADDRESS: 1290 case USB_REQ_SET_ADDRESS:
1291 /* Status phase from udc */
1291 if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD 1292 if (setup->bRequestType != (USB_DIR_OUT | USB_TYPE_STANDARD
1292 | USB_RECIP_DEVICE)) 1293 | USB_RECIP_DEVICE))
1293 break; 1294 break;
1294 ch9setaddress(udc, wValue, wIndex, wLength); 1295 ch9setaddress(udc, wValue, wIndex, wLength);
1295 break; 1296 return;
1296 1297
1297 /* Handled by udc, no data, status by udc */
1298 case USB_REQ_CLEAR_FEATURE: 1298 case USB_REQ_CLEAR_FEATURE:
1299 case USB_REQ_SET_FEATURE: 1299 case USB_REQ_SET_FEATURE:
1300 { /* status transaction */ 1300 /* Status phase from udc */
1301 {
1301 int rc = -EOPNOTSUPP; 1302 int rc = -EOPNOTSUPP;
1302 1303
1303 if ((setup->bRequestType & USB_RECIP_MASK) 1304 if ((setup->bRequestType & (USB_RECIP_MASK | USB_TYPE_MASK))
1304 == USB_RECIP_ENDPOINT) { 1305 == (USB_RECIP_ENDPOINT | USB_TYPE_STANDARD)) {
1305 int pipe = get_pipe_by_windex(wIndex); 1306 int pipe = get_pipe_by_windex(wIndex);
1306 struct fsl_ep *ep; 1307 struct fsl_ep *ep;
1307 1308
@@ -1315,8 +1316,9 @@ static void setup_received_irq(struct fsl_udc *udc,
1315 ? 1 : 0); 1316 ? 1 : 0);
1316 spin_lock(&udc->lock); 1317 spin_lock(&udc->lock);
1317 1318
1318 } else if ((setup->bRequestType & USB_RECIP_MASK) 1319 } else if ((setup->bRequestType & (USB_RECIP_MASK
1319 == USB_RECIP_DEVICE) { 1320 | USB_TYPE_MASK)) == (USB_RECIP_DEVICE
1321 | USB_TYPE_STANDARD)) {
1320 /* Note: The driver has not include OTG support yet. 1322 /* Note: The driver has not include OTG support yet.
1321 * This will be set when OTG support is added */ 1323 * This will be set when OTG support is added */
1322 if (!udc->gadget.is_otg) 1324 if (!udc->gadget.is_otg)
@@ -1329,39 +1331,42 @@ static void setup_received_irq(struct fsl_udc *udc,
1329 USB_DEVICE_A_ALT_HNP_SUPPORT) 1331 USB_DEVICE_A_ALT_HNP_SUPPORT)
1330 udc->gadget.a_alt_hnp_support = 1; 1332 udc->gadget.a_alt_hnp_support = 1;
1331 rc = 0; 1333 rc = 0;
1332 } 1334 } else
1335 break;
1336
1333 if (rc == 0) { 1337 if (rc == 0) {
1334 if (ep0_prime_status(udc, EP_DIR_IN)) 1338 if (ep0_prime_status(udc, EP_DIR_IN))
1335 ep0stall(udc); 1339 ep0stall(udc);
1336 } 1340 }
1337 break; 1341 return;
1338 } 1342 }
1339 /* Requests handled by gadget */
1340 default:
1341 if (wLength) {
1342 /* Data phase from gadget, status phase from udc */
1343 udc->ep0_dir = (setup->bRequestType & USB_DIR_IN)
1344 ? USB_DIR_IN : USB_DIR_OUT;
1345 spin_unlock(&udc->lock);
1346 if (udc->driver->setup(&udc->gadget,
1347 &udc->local_setup_buff) < 0)
1348 ep0stall(udc);
1349 spin_lock(&udc->lock);
1350 udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
1351 ? DATA_STATE_XMIT : DATA_STATE_RECV;
1352 1343
1353 } else { 1344 default:
1354 /* No data phase, IN status from gadget */
1355 udc->ep0_dir = USB_DIR_IN;
1356 spin_unlock(&udc->lock);
1357 if (udc->driver->setup(&udc->gadget,
1358 &udc->local_setup_buff) < 0)
1359 ep0stall(udc);
1360 spin_lock(&udc->lock);
1361 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1362 }
1363 break; 1345 break;
1364 } 1346 }
1347
1348 /* Requests handled by gadget */
1349 if (wLength) {
1350 /* Data phase from gadget, status phase from udc */
1351 udc->ep0_dir = (setup->bRequestType & USB_DIR_IN)
1352 ? USB_DIR_IN : USB_DIR_OUT;
1353 spin_unlock(&udc->lock);
1354 if (udc->driver->setup(&udc->gadget,
1355 &udc->local_setup_buff) < 0)
1356 ep0stall(udc);
1357 spin_lock(&udc->lock);
1358 udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
1359 ? DATA_STATE_XMIT : DATA_STATE_RECV;
1360 } else {
1361 /* No data phase, IN status from gadget */
1362 udc->ep0_dir = USB_DIR_IN;
1363 spin_unlock(&udc->lock);
1364 if (udc->driver->setup(&udc->gadget,
1365 &udc->local_setup_buff) < 0)
1366 ep0stall(udc);
1367 spin_lock(&udc->lock);
1368 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1369 }
1365} 1370}
1366 1371
1367/* Process request for Data or Status phase of ep0 1372/* Process request for Data or Status phase of ep0
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index 72b4ebbf132d..1407ad1c8128 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -967,7 +967,7 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active)
967 udc = container_of(_gadget, struct pxa2xx_udc, gadget); 967 udc = container_of(_gadget, struct pxa2xx_udc, gadget);
968 968
969 /* not all boards support pullup control */ 969 /* not all boards support pullup control */
970 if (!udc->mach->udc_command) 970 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
971 return -EOPNOTSUPP; 971 return -EOPNOTSUPP;
972 972
973 is_active = (is_active != 0); 973 is_active = (is_active != 0);
@@ -2309,7 +2309,7 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2309{ 2309{
2310 struct pxa2xx_udc *udc = platform_get_drvdata(dev); 2310 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2311 2311
2312 if (!udc->mach->udc_command) 2312 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
2313 WARN("USB host won't detect disconnect!\n"); 2313 WARN("USB host won't detect disconnect!\n");
2314 pullup(udc, 0); 2314 pullup(udc, 0);
2315 2315
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 2f529828c74d..565d6ef4c4cf 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -237,7 +237,7 @@ config USB_SL811_CS
237 module will be called "sl811_cs". 237 module will be called "sl811_cs".
238 238
239config USB_R8A66597_HCD 239config USB_R8A66597_HCD
240 tristate "R8A66597 HCD suppoort" 240 tristate "R8A66597 HCD support"
241 depends on USB 241 depends on USB
242 help 242 help
243 The R8A66597 is a USB 2.0 host and peripheral controller. 243 The R8A66597 is a USB 2.0 host and peripheral controller.
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 5d1b12aad776..b1d19268cb23 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * EHCI HCD (Host Controller Driver) for USB. 2 * EHCI HCD (Host Controller Driver) for USB.
3 * 3 *
4 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
5 *
6 * Bus Glue for AMD Alchemy Au1xxx 4 * Bus Glue for AMD Alchemy Au1xxx
7 * 5 *
8 * Based on "ohci-au1xxx.c" by Matt Porter <mporter@kernel.crashing.org> 6 * Based on "ohci-au1xxx.c" by Matt Porter <mporter@kernel.crashing.org>
@@ -196,6 +194,9 @@ static const struct hc_driver ehci_au1xxx_hc_driver = {
196 194
197 /* 195 /*
198 * basic lifecycle operations 196 * basic lifecycle operations
197 *
198 * FIXME -- ehci_init() doesn't do enough here.
199 * See ehci-ppc-soc for a complete implementation.
199 */ 200 */
200 .reset = ehci_init, 201 .reset = ehci_init,
201 .start = ehci_run, 202 .start = ehci_run,
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index c4e15ed1405a..35cdba10411b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -275,58 +275,6 @@ static void ehci_work(struct ehci_hcd *ehci);
275 275
276/*-------------------------------------------------------------------------*/ 276/*-------------------------------------------------------------------------*/
277 277
278#ifdef CONFIG_CPU_FREQ
279
280#include <linux/cpufreq.h>
281
282static void ehci_cpufreq_pause (struct ehci_hcd *ehci)
283{
284 unsigned long flags;
285
286 spin_lock_irqsave(&ehci->lock, flags);
287 if (!ehci->cpufreq_changing++)
288 qh_inactivate_split_intr_qhs(ehci);
289 spin_unlock_irqrestore(&ehci->lock, flags);
290}
291
292static void ehci_cpufreq_unpause (struct ehci_hcd *ehci)
293{
294 unsigned long flags;
295
296 spin_lock_irqsave(&ehci->lock, flags);
297 if (!--ehci->cpufreq_changing)
298 qh_reactivate_split_intr_qhs(ehci);
299 spin_unlock_irqrestore(&ehci->lock, flags);
300}
301
302/*
303 * ehci_cpufreq_notifier is needed to avoid MMF errors that occur when
304 * EHCI controllers that don't cache many uframes get delayed trying to
305 * read main memory during CPU frequency transitions. This can cause
306 * split interrupt transactions to not be completed in the required uframe.
307 * This has been observed on the Broadcom/ServerWorks HT1000 controller.
308 */
309static int ehci_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
310 void *data)
311{
312 struct ehci_hcd *ehci = container_of(nb, struct ehci_hcd,
313 cpufreq_transition);
314
315 switch (val) {
316 case CPUFREQ_PRECHANGE:
317 ehci_cpufreq_pause(ehci);
318 break;
319 case CPUFREQ_POSTCHANGE:
320 ehci_cpufreq_unpause(ehci);
321 break;
322 }
323 return 0;
324}
325
326#endif
327
328/*-------------------------------------------------------------------------*/
329
330static void ehci_watchdog (unsigned long param) 278static void ehci_watchdog (unsigned long param)
331{ 279{
332 struct ehci_hcd *ehci = (struct ehci_hcd *) param; 280 struct ehci_hcd *ehci = (struct ehci_hcd *) param;
@@ -460,10 +408,6 @@ static void ehci_stop (struct usb_hcd *hcd)
460 ehci_writel(ehci, 0, &ehci->regs->intr_enable); 408 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
461 spin_unlock_irq(&ehci->lock); 409 spin_unlock_irq(&ehci->lock);
462 410
463#ifdef CONFIG_CPU_FREQ
464 cpufreq_unregister_notifier(&ehci->cpufreq_transition,
465 CPUFREQ_TRANSITION_NOTIFIER);
466#endif
467 /* let companion controllers work when we aren't */ 411 /* let companion controllers work when we aren't */
468 ehci_writel(ehci, 0, &ehci->regs->configured_flag); 412 ehci_writel(ehci, 0, &ehci->regs->configured_flag);
469 413
@@ -569,17 +513,6 @@ static int ehci_init(struct usb_hcd *hcd)
569 } 513 }
570 ehci->command = temp; 514 ehci->command = temp;
571 515
572#ifdef CONFIG_CPU_FREQ
573 INIT_LIST_HEAD(&ehci->split_intr_qhs);
574 /*
575 * If the EHCI controller caches enough uframes, this probably
576 * isn't needed unless there are so many low/full speed devices
577 * that the controller's can't cache it all.
578 */
579 ehci->cpufreq_transition.notifier_call = ehci_cpufreq_notifier;
580 cpufreq_register_notifier(&ehci->cpufreq_transition,
581 CPUFREQ_TRANSITION_NOTIFIER);
582#endif
583 return 0; 516 return 0;
584} 517}
585 518
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index 8816d09903d0..0431397836f6 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -94,9 +94,6 @@ static struct ehci_qh *ehci_qh_alloc (struct ehci_hcd *ehci, gfp_t flags)
94 qh->qh_dma = dma; 94 qh->qh_dma = dma;
95 // INIT_LIST_HEAD (&qh->qh_list); 95 // INIT_LIST_HEAD (&qh->qh_list);
96 INIT_LIST_HEAD (&qh->qtd_list); 96 INIT_LIST_HEAD (&qh->qtd_list);
97#ifdef CONFIG_CPU_FREQ
98 INIT_LIST_HEAD (&qh->split_intr_qhs);
99#endif
100 97
101 /* dummy td enables safe urb queuing */ 98 /* dummy td enables safe urb queuing */
102 qh->dummy = ehci_qtd_alloc (ehci, flags); 99 qh->dummy = ehci_qtd_alloc (ehci, flags);
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c
index c2cedb09ed8b..4f99b0eb27bc 100644
--- a/drivers/usb/host/ehci-ppc-soc.c
+++ b/drivers/usb/host/ehci-ppc-soc.c
@@ -6,7 +6,7 @@
6 * Bus Glue for PPC On-Chip EHCI driver 6 * Bus Glue for PPC On-Chip EHCI driver
7 * Tested on AMCC 440EPx 7 * Tested on AMCC 440EPx
8 * 8 *
9 * Based on "ehci-au12xx.c" by David Brownell <dbrownell@users.sourceforge.net> 9 * Based on "ehci-au1xxx.c" by K.Boge <karsten.boge@amd.com>
10 * 10 *
11 * This file is licenced under the GPL. 11 * This file is licenced under the GPL.
12 */ 12 */
@@ -15,6 +15,24 @@
15 15
16extern int usb_disabled(void); 16extern int usb_disabled(void);
17 17
18/* called during probe() after chip reset completes */
19static int ehci_ppc_soc_setup(struct usb_hcd *hcd)
20{
21 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
22 int retval;
23
24 retval = ehci_halt(ehci);
25 if (retval)
26 return retval;
27
28 retval = ehci_init(hcd);
29 if (retval)
30 return retval;
31
32 ehci->sbrn = 0x20;
33 return ehci_reset(ehci);
34}
35
18/** 36/**
19 * usb_ehci_ppc_soc_probe - initialize PPC-SoC-based HCDs 37 * usb_ehci_ppc_soc_probe - initialize PPC-SoC-based HCDs
20 * Context: !in_interrupt() 38 * Context: !in_interrupt()
@@ -120,7 +138,7 @@ static const struct hc_driver ehci_ppc_soc_hc_driver = {
120 /* 138 /*
121 * basic lifecycle operations 139 * basic lifecycle operations
122 */ 140 */
123 .reset = ehci_init, 141 .reset = ehci_ppc_soc_setup,
124 .start = ehci_run, 142 .start = ehci_run,
125 .stop = ehci_stop, 143 .stop = ehci_stop,
126 .shutdown = ehci_shutdown, 144 .shutdown = ehci_shutdown,
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 2284028f8aa5..140bfa423e07 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -312,10 +312,6 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
312 struct urb *urb; 312 struct urb *urb;
313 u32 token = 0; 313 u32 token = 0;
314 314
315 /* ignore QHs that are currently inactive */
316 if (qh->hw_info1 & __constant_cpu_to_le32(QH_INACTIVATE))
317 break;
318
319 qtd = list_entry (entry, struct ehci_qtd, qtd_list); 315 qtd = list_entry (entry, struct ehci_qtd, qtd_list);
320 urb = qtd->urb; 316 urb = qtd->urb;
321 317
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index d4a8ace49676..e682f2342ef8 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -479,109 +479,6 @@ static int disable_periodic (struct ehci_hcd *ehci)
479} 479}
480 480
481/*-------------------------------------------------------------------------*/ 481/*-------------------------------------------------------------------------*/
482#ifdef CONFIG_CPU_FREQ
483
484static int safe_to_modify_i (struct ehci_hcd *ehci, struct ehci_qh *qh)
485{
486 int now; /* current (frame * 8) + uframe */
487 int prev_start, next_start; /* uframes from/to split start */
488 int start_uframe = ffs(le32_to_cpup (&qh->hw_info2) & QH_SMASK);
489 int end_uframe = fls((le32_to_cpup (&qh->hw_info2) & QH_CMASK) >> 8);
490 int split_duration = end_uframe - start_uframe;
491
492 now = readl(&ehci->regs->frame_index) % (ehci->periodic_size << 3);
493
494 next_start = ((1024 << 3) + (qh->start << 3) + start_uframe - now)
495 % (qh->period << 3);
496 prev_start = (qh->period << 3) - next_start;
497
498 /*
499 * Make sure there will be at least one uframe when qh is safe.
500 */
501 if ((qh->period << 3) <= (ehci->i_thresh + 2 + split_duration))
502 /* never safe */
503 return -EINVAL;
504
505 /*
506 * Wait 1 uframe after transaction should have started, to make
507 * sure controller has time to write back overlay, so we can
508 * check QTD_STS_STS to see if transaction is in progress.
509 */
510 if ((next_start > ehci->i_thresh) && (prev_start > 1))
511 /* safe to set "i" bit if split isn't in progress */
512 return (qh->hw_token & STATUS_BIT(ehci)) ? 0 : 1;
513 else
514 return 0;
515}
516
517/* Set inactivate bit for all the split interrupt QHs. */
518static void qh_inactivate_split_intr_qhs (struct ehci_hcd *ehci)
519{
520 struct ehci_qh *qh;
521 int not_done, safe;
522 u32 inactivate = INACTIVATE_BIT(ehci);
523 u32 active = ACTIVE_BIT(ehci);
524
525 do {
526 not_done = 0;
527 list_for_each_entry(qh, &ehci->split_intr_qhs,
528 split_intr_qhs) {
529 if (qh->hw_info1 & inactivate)
530 /* already off */
531 continue;
532 /*
533 * To avoid setting "I" after the start split happens,
534 * don't set it if the QH might be cached in the
535 * controller. Some HCs (Broadcom/ServerWorks HT1000)
536 * will stop in the middle of a split transaction when
537 * the "I" bit is set.
538 */
539 safe = safe_to_modify_i(ehci, qh);
540 if (safe == 0) {
541 not_done = 1;
542 } else if (safe > 0) {
543 qh->was_active = qh->hw_token & active;
544 qh->hw_info1 |= inactivate;
545 }
546 }
547 } while (not_done);
548 wmb();
549}
550
551static void qh_reactivate_split_intr_qhs (struct ehci_hcd *ehci)
552{
553 struct ehci_qh *qh;
554 u32 token;
555 int not_done, safe;
556 u32 inactivate = INACTIVATE_BIT(ehci);
557 u32 active = ACTIVE_BIT(ehci);
558 u32 halt = HALT_BIT(ehci);
559
560 do {
561 not_done = 0;
562 list_for_each_entry(qh, &ehci->split_intr_qhs, split_intr_qhs) {
563 if (!(qh->hw_info1 & inactivate)) /* already on */
564 continue;
565 /*
566 * Don't reactivate if cached, or controller might
567 * overwrite overlay after we modify it!
568 */
569 safe = safe_to_modify_i(ehci, qh);
570 if (safe == 0) {
571 not_done = 1;
572 } else if (safe > 0) {
573 /* See EHCI 1.0 section 4.15.2.4. */
574 token = qh->hw_token;
575 qh->hw_token = (token | halt) & ~active;
576 wmb();
577 qh->hw_info1 &= ~inactivate;
578 wmb();
579 qh->hw_token = (token & ~halt) | qh->was_active;
580 }
581 }
582 } while (not_done);
583}
584#endif
585 482
586/* periodic schedule slots have iso tds (normal or split) first, then a 483/* periodic schedule slots have iso tds (normal or split) first, then a
587 * sparse tree for active interrupt transfers. 484 * sparse tree for active interrupt transfers.
@@ -599,17 +496,6 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
599 period, hc32_to_cpup(ehci, &qh->hw_info2) & (QH_CMASK | QH_SMASK), 496 period, hc32_to_cpup(ehci, &qh->hw_info2) & (QH_CMASK | QH_SMASK),
600 qh, qh->start, qh->usecs, qh->c_usecs); 497 qh, qh->start, qh->usecs, qh->c_usecs);
601 498
602#ifdef CONFIG_CPU_FREQ
603 /*
604 * If low/full speed interrupt QHs are inactive (because of
605 * cpufreq changing processor speeds), start QH with I flag set--
606 * it will automatically be cleared when cpufreq is done.
607 */
608 if (ehci->cpufreq_changing)
609 if (!(qh->hw_info1 & (cpu_to_le32(1 << 13))))
610 qh->hw_info1 |= INACTIVATE_BIT(ehci);
611#endif
612
613 /* high bandwidth, or otherwise every microframe */ 499 /* high bandwidth, or otherwise every microframe */
614 if (period == 0) 500 if (period == 0)
615 period = 1; 501 period = 1;
@@ -658,12 +544,6 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
658 ? ((qh->usecs + qh->c_usecs) / qh->period) 544 ? ((qh->usecs + qh->c_usecs) / qh->period)
659 : (qh->usecs * 8); 545 : (qh->usecs * 8);
660 546
661#ifdef CONFIG_CPU_FREQ
662 /* add qh to list of low/full speed interrupt QHs, if applicable */
663 if (!(qh->hw_info1 & (cpu_to_le32(1 << 13)))) {
664 list_add(&qh->split_intr_qhs, &ehci->split_intr_qhs);
665 }
666#endif
667 /* maybe enable periodic schedule processing */ 547 /* maybe enable periodic schedule processing */
668 if (!ehci->periodic_sched++) 548 if (!ehci->periodic_sched++)
669 return enable_periodic (ehci); 549 return enable_periodic (ehci);
@@ -683,13 +563,6 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
683 // THEN 563 // THEN
684 // qh->hw_info1 |= __constant_cpu_to_hc32(1 << 7 /* "ignore" */); 564 // qh->hw_info1 |= __constant_cpu_to_hc32(1 << 7 /* "ignore" */);
685 565
686#ifdef CONFIG_CPU_FREQ
687 /* remove qh from list of low/full speed interrupt QHs */
688 if (!(qh->hw_info1 & (cpu_to_le32(1 << 13)))) {
689 list_del_init(&qh->split_intr_qhs);
690 }
691#endif
692
693 /* high bandwidth, or otherwise part of every microframe */ 566 /* high bandwidth, or otherwise part of every microframe */
694 if ((period = qh->period) == 0) 567 if ((period = qh->period) == 0)
695 period = 1; 568 period = 1;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 2c68a04230c1..951d69fec513 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -71,12 +71,6 @@ struct ehci_hcd { /* one per controller */
71 __u32 hcs_params; /* cached register copy */ 71 __u32 hcs_params; /* cached register copy */
72 spinlock_t lock; 72 spinlock_t lock;
73 73
74#ifdef CONFIG_CPU_FREQ
75 struct notifier_block cpufreq_transition;
76 int cpufreq_changing;
77 struct list_head split_intr_qhs;
78#endif
79
80 /* async schedule support */ 74 /* async schedule support */
81 struct ehci_qh *async; 75 struct ehci_qh *async;
82 struct ehci_qh *reclaim; 76 struct ehci_qh *reclaim;
@@ -439,10 +433,6 @@ struct ehci_qh {
439 __hc32 hw_next; /* see EHCI 3.6.1 */ 433 __hc32 hw_next; /* see EHCI 3.6.1 */
440 __hc32 hw_info1; /* see EHCI 3.6.2 */ 434 __hc32 hw_info1; /* see EHCI 3.6.2 */
441#define QH_HEAD 0x00008000 435#define QH_HEAD 0x00008000
442#define QH_INACTIVATE 0x00000080
443
444#define INACTIVATE_BIT(ehci) cpu_to_hc32(ehci, QH_INACTIVATE)
445
446 __hc32 hw_info2; /* see EHCI 3.6.2 */ 436 __hc32 hw_info2; /* see EHCI 3.6.2 */
447#define QH_SMASK 0x000000ff 437#define QH_SMASK 0x000000ff
448#define QH_CMASK 0x0000ff00 438#define QH_CMASK 0x0000ff00
@@ -492,10 +482,6 @@ struct ehci_qh {
492 unsigned short start; /* where polling starts */ 482 unsigned short start; /* where polling starts */
493#define NO_FRAME ((unsigned short)~0) /* pick new start */ 483#define NO_FRAME ((unsigned short)~0) /* pick new start */
494 struct usb_device *dev; /* access to TT */ 484 struct usb_device *dev; /* access to TT */
495#ifdef CONFIG_CPU_FREQ
496 struct list_head split_intr_qhs; /* list of split qhs */
497 __le32 was_active; /* active bit before "i" set */
498#endif
499} __attribute__ ((aligned (32))); 485} __attribute__ ((aligned (32)));
500 486
501/*-------------------------------------------------------------------------*/ 487/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 6f9e43e9a6ca..f61c6cdd06f2 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -74,7 +74,7 @@ urb_print (struct urb * urb, char * str, int small)
74 74
75#define ohci_dbg_sw(ohci, next, size, format, arg...) \ 75#define ohci_dbg_sw(ohci, next, size, format, arg...) \
76 do { \ 76 do { \
77 if (next) { \ 77 if (next != NULL) { \
78 unsigned s_len; \ 78 unsigned s_len; \
79 s_len = scnprintf (*next, *size, format, ## arg ); \ 79 s_len = scnprintf (*next, *size, format, ## arg ); \
80 *size -= s_len; *next += s_len; \ 80 *size -= s_len; *next += s_len; \
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index d60f1985320c..40a1de4c256e 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2208,8 +2208,6 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2208clean_up: 2208clean_up:
2209 if (reg) 2209 if (reg)
2210 iounmap(reg); 2210 iounmap(reg);
2211 if (res)
2212 release_mem_region(res->start, 1);
2213 2211
2214 return ret; 2212 return ret;
2215} 2213}
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 7f765ec038cd..b88eb3c62c02 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -1520,12 +1520,15 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1520 } 1520 }
1521 } 1521 }
1522} 1522}
1523#ifdef CONFIG_PM
1523 1524
1524static void port_power(struct u132 *u132, int pn, int is_on) 1525static void port_power(struct u132 *u132, int pn, int is_on)
1525{ 1526{
1526 u132->port[pn].power = is_on; 1527 u132->port[pn].power = is_on;
1527} 1528}
1528 1529
1530#endif
1531
1529static void u132_power(struct u132 *u132, int is_on) 1532static void u132_power(struct u132 *u132, int is_on)
1530{ 1533{
1531 struct usb_hcd *hcd = u132_to_hcd(u132) 1534 struct usb_hcd *hcd = u132_to_hcd(u132)
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index cff6fd190a28..77bb893bf2e9 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,7 +18,6 @@
18 18
19static struct usb_device_id id_table [] = { 19static struct usb_device_id id_table [] = {
20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ 20 { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
21 { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */
22 { }, 21 { },
23}; 22};
24MODULE_DEVICE_TABLE(usb, id_table); 23MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index e67ce25f7512..86724e885704 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -383,6 +383,10 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
383 } 383 }
384 384
385 baud = tty_get_baud_rate(port->tty); 385 baud = tty_get_baud_rate(port->tty);
386 if (baud == 0) {
387 dbg("%s - tty_get_baud_rate says 0 baud", __FUNCTION__);
388 return;
389 }
386 urb_value = BELKIN_SA_BAUD(baud); 390 urb_value = BELKIN_SA_BAUD(baud);
387 /* Clip to maximum speed */ 391 /* Clip to maximum speed */
388 if (urb_value == 0) 392 if (urb_value == 0)
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 7b1673a44077..1370c423d7c2 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -538,6 +538,8 @@ static struct usb_device_id id_table_combined [] = {
538 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) }, 538 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) },
539 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) }, 539 { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) },
540 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, 540 { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) },
541 { USB_DEVICE(EVOLUTION_VID, EVO_HYBRID_PID) },
542 { USB_DEVICE(EVOLUTION_VID, EVO_RCM4_PID) },
541 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, 543 { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) },
542 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, 544 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) },
543 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, 545 { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) },
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index d9e49716db13..c70e1de6389e 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -430,6 +430,9 @@
430 */ 430 */
431#define EVOLUTION_VID 0xDEEE /* Vendor ID */ 431#define EVOLUTION_VID 0xDEEE /* Vendor ID */
432#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */ 432#define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */
433#define EVO_8U232AM_PID 0x02FF /* Evolution robotics RCM2 (FT232AM)*/
434#define EVO_HYBRID_PID 0x0302 /* Evolution robotics RCM4 PID (FT232BM)*/
435#define EVO_RCM4_PID 0x0303 /* Evolution robotics RCM4 PID */
433 436
434/* Pyramid Computer GmbH */ 437/* Pyramid Computer GmbH */
435#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ 438#define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 04bd3b7a2985..f1c90cfe7251 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Garmin GPS driver 2 * Garmin GPS driver
3 * 3 *
4 * Copyright (C) 2006 Hermann Kneissel herkne@users.sourceforge.net 4 * Copyright (C) 2006,2007 Hermann Kneissel herkne@users.sourceforge.net
5 * 5 *
6 * The latest version of the driver can be found at 6 * The latest version of the driver can be found at
7 * http://sourceforge.net/projects/garmin-gps/ 7 * http://sourceforge.net/projects/garmin-gps/
@@ -34,6 +34,7 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/atomic.h>
37#include <linux/usb.h> 38#include <linux/usb.h>
38#include <linux/usb/serial.h> 39#include <linux/usb/serial.h>
39 40
@@ -52,7 +53,7 @@ static int debug = 0;
52 */ 53 */
53 54
54#define VERSION_MAJOR 0 55#define VERSION_MAJOR 0
55#define VERSION_MINOR 28 56#define VERSION_MINOR 31
56 57
57#define _STR(s) #s 58#define _STR(s) #s
58#define _DRIVER_VERSION(a,b) "v" _STR(a) "." _STR(b) 59#define _DRIVER_VERSION(a,b) "v" _STR(a) "." _STR(b)
@@ -141,6 +142,8 @@ struct garmin_data {
141 __u8 inbuffer [GPS_IN_BUFSIZ]; /* tty -> usb */ 142 __u8 inbuffer [GPS_IN_BUFSIZ]; /* tty -> usb */
142 __u8 outbuffer[GPS_OUT_BUFSIZ]; /* usb -> tty */ 143 __u8 outbuffer[GPS_OUT_BUFSIZ]; /* usb -> tty */
143 __u8 privpkt[4*6]; 144 __u8 privpkt[4*6];
145 atomic_t req_count;
146 atomic_t resp_count;
144 spinlock_t lock; 147 spinlock_t lock;
145 struct list_head pktlist; 148 struct list_head pktlist;
146}; 149};
@@ -171,8 +174,6 @@ struct garmin_data {
171#define CLEAR_HALT_REQUIRED 0x0001 174#define CLEAR_HALT_REQUIRED 0x0001
172 175
173#define FLAGS_QUEUING 0x0100 176#define FLAGS_QUEUING 0x0100
174#define FLAGS_APP_RESP_SEEN 0x0200
175#define FLAGS_APP_REQ_SEEN 0x0400
176#define FLAGS_DROP_DATA 0x0800 177#define FLAGS_DROP_DATA 0x0800
177 178
178#define FLAGS_GSP_SKIP 0x1000 179#define FLAGS_GSP_SKIP 0x1000
@@ -186,7 +187,8 @@ struct garmin_data {
186/* function prototypes */ 187/* function prototypes */
187static void gsp_next_packet(struct garmin_data * garmin_data_p); 188static void gsp_next_packet(struct garmin_data * garmin_data_p);
188static int garmin_write_bulk(struct usb_serial_port *port, 189static int garmin_write_bulk(struct usb_serial_port *port,
189 const unsigned char *buf, int count); 190 const unsigned char *buf, int count,
191 int dismiss_ack);
190 192
191/* some special packets to be send or received */ 193/* some special packets to be send or received */
192static unsigned char const GARMIN_START_SESSION_REQ[] 194static unsigned char const GARMIN_START_SESSION_REQ[]
@@ -233,9 +235,7 @@ static struct usb_driver garmin_driver = {
233 235
234static inline int noResponseFromAppLayer(struct garmin_data * garmin_data_p) 236static inline int noResponseFromAppLayer(struct garmin_data * garmin_data_p)
235{ 237{
236 return ((garmin_data_p->flags 238 return atomic_read(&garmin_data_p->req_count) == atomic_read(&garmin_data_p->resp_count);
237 & (FLAGS_APP_REQ_SEEN|FLAGS_APP_RESP_SEEN))
238 == FLAGS_APP_REQ_SEEN);
239} 239}
240 240
241 241
@@ -463,7 +463,7 @@ static int gsp_rec_packet(struct garmin_data * garmin_data_p, int count)
463 usbdata[2] = __cpu_to_le32(size); 463 usbdata[2] = __cpu_to_le32(size);
464 464
465 garmin_write_bulk (garmin_data_p->port, garmin_data_p->inbuffer, 465 garmin_write_bulk (garmin_data_p->port, garmin_data_p->inbuffer,
466 GARMIN_PKTHDR_LENGTH+size); 466 GARMIN_PKTHDR_LENGTH+size, 0);
467 467
468 /* if this was an abort-transfer command, flush all 468 /* if this was an abort-transfer command, flush all
469 queued data. */ 469 queued data. */
@@ -818,7 +818,7 @@ static int nat_receive(struct garmin_data * garmin_data_p,
818 if (garmin_data_p->insize >= len) { 818 if (garmin_data_p->insize >= len) {
819 garmin_write_bulk (garmin_data_p->port, 819 garmin_write_bulk (garmin_data_p->port,
820 garmin_data_p->inbuffer, 820 garmin_data_p->inbuffer,
821 len); 821 len, 0);
822 garmin_data_p->insize = 0; 822 garmin_data_p->insize = 0;
823 823
824 /* if this was an abort-transfer command, 824 /* if this was an abort-transfer command,
@@ -893,10 +893,11 @@ static int garmin_clear(struct garmin_data * garmin_data_p)
893 893
894 struct usb_serial_port *port = garmin_data_p->port; 894 struct usb_serial_port *port = garmin_data_p->port;
895 895
896 if (port != NULL && garmin_data_p->flags & FLAGS_APP_RESP_SEEN) { 896 if (port != NULL && atomic_read(&garmin_data_p->resp_count)) {
897 /* send a terminate command */ 897 /* send a terminate command */
898 status = garmin_write_bulk(port, GARMIN_STOP_TRANSFER_REQ, 898 status = garmin_write_bulk(port, GARMIN_STOP_TRANSFER_REQ,
899 sizeof(GARMIN_STOP_TRANSFER_REQ)); 899 sizeof(GARMIN_STOP_TRANSFER_REQ),
900 1);
900 } 901 }
901 902
902 /* flush all queued data */ 903 /* flush all queued data */
@@ -939,7 +940,8 @@ static int garmin_init_session(struct usb_serial_port *port)
939 dbg("%s - starting session ...", __FUNCTION__); 940 dbg("%s - starting session ...", __FUNCTION__);
940 garmin_data_p->state = STATE_ACTIVE; 941 garmin_data_p->state = STATE_ACTIVE;
941 status = garmin_write_bulk(port, GARMIN_START_SESSION_REQ, 942 status = garmin_write_bulk(port, GARMIN_START_SESSION_REQ,
942 sizeof(GARMIN_START_SESSION_REQ)); 943 sizeof(GARMIN_START_SESSION_REQ),
944 0);
943 945
944 if (status >= 0) { 946 if (status >= 0) {
945 947
@@ -950,7 +952,8 @@ static int garmin_init_session(struct usb_serial_port *port)
950 /* not needed, but the win32 driver does it too ... */ 952 /* not needed, but the win32 driver does it too ... */
951 status = garmin_write_bulk(port, 953 status = garmin_write_bulk(port,
952 GARMIN_START_SESSION_REQ2, 954 GARMIN_START_SESSION_REQ2,
953 sizeof(GARMIN_START_SESSION_REQ2)); 955 sizeof(GARMIN_START_SESSION_REQ2),
956 0);
954 if (status >= 0) { 957 if (status >= 0) {
955 status = 0; 958 status = 0;
956 spin_lock_irqsave(&garmin_data_p->lock, flags); 959 spin_lock_irqsave(&garmin_data_p->lock, flags);
@@ -987,6 +990,8 @@ static int garmin_open (struct usb_serial_port *port, struct file *filp)
987 garmin_data_p->mode = initial_mode; 990 garmin_data_p->mode = initial_mode;
988 garmin_data_p->count = 0; 991 garmin_data_p->count = 0;
989 garmin_data_p->flags = 0; 992 garmin_data_p->flags = 0;
993 atomic_set(&garmin_data_p->req_count, 0);
994 atomic_set(&garmin_data_p->resp_count, 0);
990 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 995 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
991 996
992 /* shutdown any bulk reads that might be going on */ 997 /* shutdown any bulk reads that might be going on */
@@ -1035,28 +1040,39 @@ static void garmin_write_bulk_callback (struct urb *urb)
1035{ 1040{
1036 unsigned long flags; 1041 unsigned long flags;
1037 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 1042 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
1038 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1039 int status = urb->status; 1043 int status = urb->status;
1040 1044
1041 /* free up the transfer buffer, as usb_free_urb() does not do this */ 1045 if (port) {
1042 kfree (urb->transfer_buffer); 1046 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1043 1047
1044 dbg("%s - port %d", __FUNCTION__, port->number); 1048 dbg("%s - port %d", __FUNCTION__, port->number);
1045 1049
1046 if (status) { 1050 if (GARMIN_LAYERID_APPL == getLayerId(urb->transfer_buffer)
1047 dbg("%s - nonzero write bulk status received: %d", 1051 && (garmin_data_p->mode == MODE_GARMIN_SERIAL)) {
1048 __FUNCTION__, status); 1052 gsp_send_ack(garmin_data_p, ((__u8 *)urb->transfer_buffer)[4]);
1049 spin_lock_irqsave(&garmin_data_p->lock, flags); 1053 }
1050 garmin_data_p->flags |= CLEAR_HALT_REQUIRED; 1054
1051 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1055 if (status) {
1056 dbg("%s - nonzero write bulk status received: %d",
1057 __FUNCTION__, urb->status);
1058 spin_lock_irqsave(&garmin_data_p->lock, flags);
1059 garmin_data_p->flags |= CLEAR_HALT_REQUIRED;
1060 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1061 }
1062
1063 usb_serial_port_softint(port);
1052 } 1064 }
1053 1065
1054 usb_serial_port_softint(port); 1066 /* Ignore errors that resulted from garmin_write_bulk with dismiss_ack=1 */
1067
1068 /* free up the transfer buffer, as usb_free_urb() does not do this */
1069 kfree (urb->transfer_buffer);
1055} 1070}
1056 1071
1057 1072
1058static int garmin_write_bulk (struct usb_serial_port *port, 1073static int garmin_write_bulk (struct usb_serial_port *port,
1059 const unsigned char *buf, int count) 1074 const unsigned char *buf, int count,
1075 int dismiss_ack)
1060{ 1076{
1061 unsigned long flags; 1077 unsigned long flags;
1062 struct usb_serial *serial = port->serial; 1078 struct usb_serial *serial = port->serial;
@@ -1093,13 +1109,12 @@ static int garmin_write_bulk (struct usb_serial_port *port,
1093 usb_sndbulkpipe (serial->dev, 1109 usb_sndbulkpipe (serial->dev,
1094 port->bulk_out_endpointAddress), 1110 port->bulk_out_endpointAddress),
1095 buffer, count, 1111 buffer, count,
1096 garmin_write_bulk_callback, port); 1112 garmin_write_bulk_callback,
1113 dismiss_ack ? NULL : port);
1097 urb->transfer_flags |= URB_ZERO_PACKET; 1114 urb->transfer_flags |= URB_ZERO_PACKET;
1098 1115
1099 if (GARMIN_LAYERID_APPL == getLayerId(buffer)) { 1116 if (GARMIN_LAYERID_APPL == getLayerId(buffer)) {
1100 spin_lock_irqsave(&garmin_data_p->lock, flags); 1117 atomic_inc(&garmin_data_p->req_count);
1101 garmin_data_p->flags |= FLAGS_APP_REQ_SEEN;
1102 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1103 if (garmin_data_p->mode == MODE_GARMIN_SERIAL) { 1118 if (garmin_data_p->mode == MODE_GARMIN_SERIAL) {
1104 pkt_clear(garmin_data_p); 1119 pkt_clear(garmin_data_p);
1105 garmin_data_p->state = STATE_GSP_WAIT_DATA; 1120 garmin_data_p->state = STATE_GSP_WAIT_DATA;
@@ -1114,13 +1129,6 @@ static int garmin_write_bulk (struct usb_serial_port *port,
1114 "failed with status = %d\n", 1129 "failed with status = %d\n",
1115 __FUNCTION__, status); 1130 __FUNCTION__, status);
1116 count = status; 1131 count = status;
1117 } else {
1118
1119 if (GARMIN_LAYERID_APPL == getLayerId(buffer)
1120 && (garmin_data_p->mode == MODE_GARMIN_SERIAL)) {
1121
1122 gsp_send_ack(garmin_data_p, buffer[4]);
1123 }
1124 } 1132 }
1125 1133
1126 /* we are done with this urb, so let the host driver 1134 /* we are done with this urb, so let the host driver
@@ -1135,7 +1143,6 @@ static int garmin_write_bulk (struct usb_serial_port *port,
1135static int garmin_write (struct usb_serial_port *port, 1143static int garmin_write (struct usb_serial_port *port,
1136 const unsigned char *buf, int count) 1144 const unsigned char *buf, int count)
1137{ 1145{
1138 unsigned long flags;
1139 int pktid, pktsiz, len; 1146 int pktid, pktsiz, len;
1140 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); 1147 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1141 __le32 *privpkt = (__le32 *)garmin_data_p->privpkt; 1148 __le32 *privpkt = (__le32 *)garmin_data_p->privpkt;
@@ -1186,9 +1193,7 @@ static int garmin_write (struct usb_serial_port *port,
1186 break; 1193 break;
1187 1194
1188 case PRIV_PKTID_RESET_REQ: 1195 case PRIV_PKTID_RESET_REQ:
1189 spin_lock_irqsave(&garmin_data_p->lock, flags); 1196 atomic_inc(&garmin_data_p->req_count);
1190 garmin_data_p->flags |= FLAGS_APP_REQ_SEEN;
1191 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1192 break; 1197 break;
1193 1198
1194 case PRIV_PKTID_SET_DEF_MODE: 1199 case PRIV_PKTID_SET_DEF_MODE:
@@ -1241,8 +1246,6 @@ static int garmin_chars_in_buffer (struct usb_serial_port *port)
1241static void garmin_read_process(struct garmin_data * garmin_data_p, 1246static void garmin_read_process(struct garmin_data * garmin_data_p,
1242 unsigned char *data, unsigned data_length) 1247 unsigned char *data, unsigned data_length)
1243{ 1248{
1244 unsigned long flags;
1245
1246 if (garmin_data_p->flags & FLAGS_DROP_DATA) { 1249 if (garmin_data_p->flags & FLAGS_DROP_DATA) {
1247 /* abort-transfer cmd is actice */ 1250 /* abort-transfer cmd is actice */
1248 dbg("%s - pkt dropped", __FUNCTION__); 1251 dbg("%s - pkt dropped", __FUNCTION__);
@@ -1254,9 +1257,7 @@ static void garmin_read_process(struct garmin_data * garmin_data_p,
1254 the device */ 1257 the device */
1255 if (0 == memcmp(data, GARMIN_APP_LAYER_REPLY, 1258 if (0 == memcmp(data, GARMIN_APP_LAYER_REPLY,
1256 sizeof(GARMIN_APP_LAYER_REPLY))) { 1259 sizeof(GARMIN_APP_LAYER_REPLY))) {
1257 spin_lock_irqsave(&garmin_data_p->lock, flags); 1260 atomic_inc(&garmin_data_p->resp_count);
1258 garmin_data_p->flags |= FLAGS_APP_RESP_SEEN;
1259 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1260 } 1261 }
1261 1262
1262 /* if throttling is active or postprecessing is required 1263 /* if throttling is active or postprecessing is required
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 0455c1552ae9..6a3a704b5849 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -545,6 +545,7 @@ static struct usb_device_id ipaq_id_table [] = {
545 { USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */ 545 { USB_DEVICE(0x413C, 0x4009) }, /* Dell Axim USB Sync */
546 { USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */ 546 { USB_DEVICE(0x4505, 0x0010) }, /* Smartphone */
547 { USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */ 547 { USB_DEVICE(0x5E04, 0xCE00) }, /* SAGEM Wireless Assistant */
548 { USB_DEVICE(0x0BB4, 0x00CF) }, /* HTC smartphone modems */
548 { } /* Terminating entry */ 549 { } /* Terminating entry */
549}; 550};
550 551
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 84c12b5f1271..4cb3c165742b 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -110,6 +110,7 @@ static int option_send_setup(struct usb_serial_port *port);
110#define HUAWEI_PRODUCT_E220 0x1003 110#define HUAWEI_PRODUCT_E220 0x1003
111 111
112#define NOVATELWIRELESS_VENDOR_ID 0x1410 112#define NOVATELWIRELESS_VENDOR_ID 0x1410
113#define DELL_VENDOR_ID 0x413C
113 114
114#define ANYDATA_VENDOR_ID 0x16d5 115#define ANYDATA_VENDOR_ID 0x16d5
115#define ANYDATA_PRODUCT_ADU_E100A 0x6501 116#define ANYDATA_PRODUCT_ADU_E100A 0x6501
@@ -119,8 +120,6 @@ static int option_send_setup(struct usb_serial_port *port);
119#define BANDRICH_PRODUCT_C100_1 0x1002 120#define BANDRICH_PRODUCT_C100_1 0x1002
120#define BANDRICH_PRODUCT_C100_2 0x1003 121#define BANDRICH_PRODUCT_C100_2 0x1003
121 122
122#define DELL_VENDOR_ID 0x413C
123
124static struct usb_device_id option_ids[] = { 123static struct usb_device_id option_ids[] = {
125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 124 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
126 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 125 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -171,11 +170,16 @@ static struct usb_device_id option_ids[] = {
171 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ 170 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */
172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ 171 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */
173 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ 172 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */
173 { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
174 { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
175 { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
176 { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
177 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
178 { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
174 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 179 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },
175 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 180 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
176 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, 181 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) },
177 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, 182 { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) },
178 { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard */
179 { } /* Terminating entry */ 183 { } /* Terminating entry */
180}; 184};
181MODULE_DEVICE_TABLE(usb, option_ids); 185MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index d7db71eca520..833ada47fc54 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -818,19 +818,17 @@ static int oti6858_ioctl(struct usb_serial_port *port, struct file *file,
818 818
819 switch (cmd) { 819 switch (cmd) {
820 case TCGETS: 820 case TCGETS:
821 if (copy_to_user(user_arg, port->tty->termios, 821 if (kernel_termios_to_user_termios((struct ktermios __user *)arg,
822 sizeof(struct ktermios))) { 822 port->tty->termios))
823 return -EFAULT; 823 return -EFAULT;
824 }
825 return 0; 824 return 0;
826 825
827 case TCSETS: 826 case TCSETS:
828 case TCSETSW: /* FIXME: this is not the same! */ 827 case TCSETSW: /* FIXME: this is not the same! */
829 case TCSETSF: /* FIXME: this is not the same! */ 828 case TCSETSF: /* FIXME: this is not the same! */
830 if (copy_from_user(port->tty->termios, user_arg, 829 if (user_termios_to_kernel_termios(port->tty->termios,
831 sizeof(struct ktermios))) { 830 (struct ktermios __user *)arg))
832 return -EFAULT; 831 return -EFAULT;
833 }
834 oti6858_set_termios(port, NULL); 832 oti6858_set_termios(port, NULL);
835 return 0; 833 return 0;
836 834
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index 86899d55d8d8..51669b7622bb 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -74,13 +74,13 @@
74#include <linux/usb/serial.h> 74#include <linux/usb/serial.h>
75 75
76 76
77#ifndef CONFIG_USB_SAFE_PADDED 77#ifndef CONFIG_USB_SERIAL_SAFE_PADDED
78#define CONFIG_USB_SAFE_PADDED 0 78#define CONFIG_USB_SERIAL_SAFE_PADDED 0
79#endif 79#endif
80 80
81static int debug; 81static int debug;
82static int safe = 1; 82static int safe = 1;
83static int padded = CONFIG_USB_SAFE_PADDED; 83static int padded = CONFIG_USB_SERIAL_SAFE_PADDED;
84 84
85#define DRIVER_VERSION "v0.0b" 85#define DRIVER_VERSION "v0.0b"
86#define DRIVER_AUTHOR "sl@lineo.com, tbr@lineo.com" 86#define DRIVER_AUTHOR "sl@lineo.com, tbr@lineo.com"
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index 7d84a7647e81..30e08c0bcdc2 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -104,6 +104,8 @@ static struct usb_device_id id_table [] = {
104 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 104 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
105 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID), 105 { USB_DEVICE(SONY_VENDOR_ID, SONY_CLIE_TJ25_ID),
106 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 106 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
107 { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID),
108 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
107 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID), 109 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID),
108 .driver_info = (kernel_ulong_t)&palm_os_4_probe }, 110 .driver_info = (kernel_ulong_t)&palm_os_4_probe },
109 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), 111 { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID),
diff --git a/drivers/usb/serial/visor.h b/drivers/usb/serial/visor.h
index 4ce6f62a6f39..57229cf66477 100644
--- a/drivers/usb/serial/visor.h
+++ b/drivers/usb/serial/visor.h
@@ -48,6 +48,9 @@
48#define SONY_CLIE_UX50_ID 0x0144 48#define SONY_CLIE_UX50_ID 0x0144
49#define SONY_CLIE_TJ25_ID 0x0169 49#define SONY_CLIE_TJ25_ID 0x0169
50 50
51#define ACER_VENDOR_ID 0x0502
52#define ACER_S10_ID 0x0001
53
51#define SAMSUNG_VENDOR_ID 0x04E8 54#define SAMSUNG_VENDOR_ID 0x04E8
52#define SAMSUNG_SCH_I330_ID 0x8001 55#define SAMSUNG_SCH_I330_ID 0x8001
53#define SAMSUNG_SPH_I500_ID 0x6601 56#define SAMSUNG_SPH_I500_ID 0x6601
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index d8d008d42946..2d92ce31018f 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -342,7 +342,7 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100,
342 US_FL_FIX_CAPACITY), 342 US_FL_FIX_CAPACITY),
343 343
344/* Reported by Emil Larsson <emil@swip.net> */ 344/* Reported by Emil Larsson <emil@swip.net> */
345UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0100, 345UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101,
346 "NIKON", 346 "NIKON",
347 "NIKON DSC D80", 347 "NIKON DSC D80",
348 US_SC_DEVICE, US_PR_DEVICE, NULL, 348 US_SC_DEVICE, US_PR_DEVICE, NULL,
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 28842d208bb0..25e557d4fe6b 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -112,13 +112,6 @@ module_param(delay_use, uint, S_IRUGO | S_IWUSR);
112MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device"); 112MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
113 113
114 114
115/* These are used to make sure the module doesn't unload before all the
116 * threads have exited.
117 */
118static atomic_t total_threads = ATOMIC_INIT(0);
119static DECLARE_COMPLETION(threads_gone);
120
121
122/* 115/*
123 * The entries in this table correspond, line for line, 116 * The entries in this table correspond, line for line,
124 * with the entries of us_unusual_dev_list[]. 117 * with the entries of us_unusual_dev_list[].
@@ -879,9 +872,6 @@ static void quiesce_and_remove_host(struct us_data *us)
879 usb_stor_stop_transport(us); 872 usb_stor_stop_transport(us);
880 wake_up(&us->delay_wait); 873 wake_up(&us->delay_wait);
881 874
882 /* It doesn't matter if the SCSI-scanning thread is still running.
883 * The thread will exit when it sees the DISCONNECTING flag. */
884
885 /* queuecommand won't accept any new commands and the control 875 /* queuecommand won't accept any new commands and the control
886 * thread won't execute a previously-queued command. If there 876 * thread won't execute a previously-queued command. If there
887 * is such a command pending, complete it with an error. */ 877 * is such a command pending, complete it with an error. */
@@ -891,12 +881,16 @@ static void quiesce_and_remove_host(struct us_data *us)
891 scsi_lock(host); 881 scsi_lock(host);
892 us->srb->scsi_done(us->srb); 882 us->srb->scsi_done(us->srb);
893 us->srb = NULL; 883 us->srb = NULL;
884 complete(&us->notify); /* in case of an abort */
894 scsi_unlock(host); 885 scsi_unlock(host);
895 } 886 }
896 mutex_unlock(&us->dev_mutex); 887 mutex_unlock(&us->dev_mutex);
897 888
898 /* Now we own no commands so it's safe to remove the SCSI host */ 889 /* Now we own no commands so it's safe to remove the SCSI host */
899 scsi_remove_host(host); 890 scsi_remove_host(host);
891
892 /* Wait for the SCSI-scanning thread to stop */
893 wait_for_completion(&us->scanning_done);
900} 894}
901 895
902/* Second stage of disconnect processing: deallocate all resources */ 896/* Second stage of disconnect processing: deallocate all resources */
@@ -947,9 +941,8 @@ retry:
947 /* Should we unbind if no devices were detected? */ 941 /* Should we unbind if no devices were detected? */
948 } 942 }
949 943
950 scsi_host_put(us_to_host(us));
951 usb_autopm_put_interface(us->pusb_intf); 944 usb_autopm_put_interface(us->pusb_intf);
952 complete_and_exit(&threads_gone, 0); 945 complete_and_exit(&us->scanning_done, 0);
953} 946}
954 947
955 948
@@ -984,6 +977,7 @@ static int storage_probe(struct usb_interface *intf,
984 init_MUTEX_LOCKED(&(us->sema)); 977 init_MUTEX_LOCKED(&(us->sema));
985 init_completion(&(us->notify)); 978 init_completion(&(us->notify));
986 init_waitqueue_head(&us->delay_wait); 979 init_waitqueue_head(&us->delay_wait);
980 init_completion(&us->scanning_done);
987 981
988 /* Associate the us_data structure with the USB device */ 982 /* Associate the us_data structure with the USB device */
989 result = associate_dev(us, intf); 983 result = associate_dev(us, intf);
@@ -1033,11 +1027,6 @@ static int storage_probe(struct usb_interface *intf,
1033 goto BadDevice; 1027 goto BadDevice;
1034 } 1028 }
1035 1029
1036 /* Take a reference to the host for the scanning thread and
1037 * count it among all the threads we have launched. Then
1038 * start it up. */
1039 scsi_host_get(us_to_host(us));
1040 atomic_inc(&total_threads);
1041 usb_autopm_get_interface(intf); /* dropped in the scanning thread */ 1030 usb_autopm_get_interface(intf); /* dropped in the scanning thread */
1042 wake_up_process(th); 1031 wake_up_process(th);
1043 1032
@@ -1104,16 +1093,6 @@ static void __exit usb_stor_exit(void)
1104 US_DEBUGP("-- calling usb_deregister()\n"); 1093 US_DEBUGP("-- calling usb_deregister()\n");
1105 usb_deregister(&usb_storage_driver) ; 1094 usb_deregister(&usb_storage_driver) ;
1106 1095
1107 /* Don't return until all of our control and scanning threads
1108 * have exited. Since each thread signals threads_gone as its
1109 * last act, we have to call wait_for_completion the right number
1110 * of times.
1111 */
1112 while (atomic_read(&total_threads) > 0) {
1113 wait_for_completion(&threads_gone);
1114 atomic_dec(&total_threads);
1115 }
1116
1117 usb_usual_clear_present(USB_US_TYPE_STOR); 1096 usb_usual_clear_present(USB_US_TYPE_STOR);
1118} 1097}
1119 1098
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 6445665b1577..8d87503e2560 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -150,6 +150,7 @@ struct us_data {
150 struct semaphore sema; /* to sleep thread on */ 150 struct semaphore sema; /* to sleep thread on */
151 struct completion notify; /* thread begin/end */ 151 struct completion notify; /* thread begin/end */
152 wait_queue_head_t delay_wait; /* wait during scan, reset */ 152 wait_queue_head_t delay_wait; /* wait during scan, reset */
153 struct completion scanning_done; /* wait for scan thread */
153 154
154 /* subdriver information */ 155 /* subdriver information */
155 void *extra; /* Any extra data */ 156 void *extra; /* Any extra data */
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 80a81eccad36..832e4613673a 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -115,6 +115,52 @@ static int nocursor = 0;
115module_param(nocursor, int, 0644); 115module_param(nocursor, int, 0644);
116MODULE_PARM_DESC(nocursor, "cursor enable/disable"); 116MODULE_PARM_DESC(nocursor, "cursor enable/disable");
117 117
118/* fb_blank
119 * Blank the screen. Depending on the mode, the screen will be
120 * activated with the backlight color, or desactivated
121 */
122static int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
123{
124 struct au1100fb_device *fbdev = to_au1100fb_device(fbi);
125
126 print_dbg("fb_blank %d %p", blank_mode, fbi);
127
128 switch (blank_mode) {
129
130 case VESA_NO_BLANKING:
131 /* Turn on panel */
132 fbdev->regs->lcd_control |= LCD_CONTROL_GO;
133#ifdef CONFIG_MIPS_PB1100
134 if (drv_info.panel_idx == 1) {
135 au_writew(au_readw(PB1100_G_CONTROL)
136 | (PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD),
137 PB1100_G_CONTROL);
138 }
139#endif
140 au_sync();
141 break;
142
143 case VESA_VSYNC_SUSPEND:
144 case VESA_HSYNC_SUSPEND:
145 case VESA_POWERDOWN:
146 /* Turn off panel */
147 fbdev->regs->lcd_control &= ~LCD_CONTROL_GO;
148#ifdef CONFIG_MIPS_PB1100
149 if (drv_info.panel_idx == 1) {
150 au_writew(au_readw(PB1100_G_CONTROL)
151 & ~(PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD),
152 PB1100_G_CONTROL);
153 }
154#endif
155 au_sync();
156 break;
157 default:
158 break;
159
160 }
161 return 0;
162}
163
118/* 164/*
119 * Set hardware with var settings. This will enable the controller with a specific 165 * Set hardware with var settings. This will enable the controller with a specific
120 * mode, normally validated with the fb_check_var method 166 * mode, normally validated with the fb_check_var method
@@ -272,52 +318,6 @@ int au1100fb_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned
272 return 0; 318 return 0;
273} 319}
274 320
275/* fb_blank
276 * Blank the screen. Depending on the mode, the screen will be
277 * activated with the backlight color, or desactivated
278 */
279int au1100fb_fb_blank(int blank_mode, struct fb_info *fbi)
280{
281 struct au1100fb_device *fbdev = to_au1100fb_device(fbi);
282
283 print_dbg("fb_blank %d %p", blank_mode, fbi);
284
285 switch (blank_mode) {
286
287 case VESA_NO_BLANKING:
288 /* Turn on panel */
289 fbdev->regs->lcd_control |= LCD_CONTROL_GO;
290#ifdef CONFIG_MIPS_PB1100
291 if (drv_info.panel_idx == 1) {
292 au_writew(au_readw(PB1100_G_CONTROL)
293 | (PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD),
294 PB1100_G_CONTROL);
295 }
296#endif
297 au_sync();
298 break;
299
300 case VESA_VSYNC_SUSPEND:
301 case VESA_HSYNC_SUSPEND:
302 case VESA_POWERDOWN:
303 /* Turn off panel */
304 fbdev->regs->lcd_control &= ~LCD_CONTROL_GO;
305#ifdef CONFIG_MIPS_PB1100
306 if (drv_info.panel_idx == 1) {
307 au_writew(au_readw(PB1100_G_CONTROL)
308 & ~(PB1100_G_CONTROL_BL | PB1100_G_CONTROL_VDD),
309 PB1100_G_CONTROL);
310 }
311#endif
312 au_sync();
313 break;
314 default:
315 break;
316
317 }
318 return 0;
319}
320
321/* fb_pan_display 321/* fb_pan_display
322 * Pan display in x and/or y as specified 322 * Pan display in x and/or y as specified
323 */ 323 */
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index 7fa1afeae8dc..dda0586ab3f3 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -738,9 +738,8 @@ const struct consw newport_con = {
738#ifdef MODULE 738#ifdef MODULE
739static int __init newport_console_init(void) 739static int __init newport_console_init(void)
740{ 740{
741
742 if (!sgi_gfxaddr) 741 if (!sgi_gfxaddr)
743 return NULL; 742 return 0;
744 743
745 if (!npregs) 744 if (!npregs)
746 npregs = (struct newport_regs *)/* ioremap cannot fail */ 745 npregs = (struct newport_regs *)/* ioremap cannot fail */
diff --git a/drivers/video/imsttfb.c b/drivers/video/imsttfb.c
index 5715b8ad0ddc..94f4511023d8 100644
--- a/drivers/video/imsttfb.c
+++ b/drivers/video/imsttfb.c
@@ -1391,7 +1391,7 @@ init_imstt(struct fb_info *info)
1391 } 1391 }
1392 } 1392 }
1393 1393
1394#if USE_NV_MODES && defined(CONFIG_PPC) 1394#if USE_NV_MODES && defined(CONFIG_PPC32)
1395 { 1395 {
1396 int vmode = init_vmode, cmode = init_cmode; 1396 int vmode = init_vmode, cmode = init_cmode;
1397 1397
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index 81e571d59b50..a280a52f8efe 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -66,7 +66,7 @@ static void set_ctrlr_state(struct pxafb_info *fbi, u_int state);
66 66
67#ifdef CONFIG_FB_PXA_PARAMETERS 67#ifdef CONFIG_FB_PXA_PARAMETERS
68#define PXAFB_OPTIONS_SIZE 256 68#define PXAFB_OPTIONS_SIZE 256
69static char g_options[PXAFB_OPTIONS_SIZE] __initdata = ""; 69static char g_options[PXAFB_OPTIONS_SIZE] __devinitdata = "";
70#endif 70#endif
71 71
72static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state) 72static inline void pxafb_schedule_work(struct pxafb_info *fbi, u_int state)
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index 2fbd8dd16df5..6840dfebe4d4 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -170,22 +170,24 @@ void __w1_remove_master_device(struct w1_master *dev)
170 170
171void w1_remove_master_device(struct w1_bus_master *bm) 171void w1_remove_master_device(struct w1_bus_master *bm)
172{ 172{
173 struct w1_master *dev = NULL; 173 struct w1_master *dev, *found = NULL;
174 174
175 list_for_each_entry(dev, &w1_masters, w1_master_entry) { 175 list_for_each_entry(dev, &w1_masters, w1_master_entry) {
176 if (!dev->initialized) 176 if (!dev->initialized)
177 continue; 177 continue;
178 178
179 if (dev->bus_master->data == bm->data) 179 if (dev->bus_master->data == bm->data) {
180 found = dev;
180 break; 181 break;
182 }
181 } 183 }
182 184
183 if (!dev) { 185 if (!found) {
184 printk(KERN_ERR "Device doesn't exist.\n"); 186 printk(KERN_ERR "Device doesn't exist.\n");
185 return; 187 return;
186 } 188 }
187 189
188 __w1_remove_master_device(dev); 190 __w1_remove_master_device(found);
189} 191}
190 192
191EXPORT_SYMBOL(w1_add_master_device); 193EXPORT_SYMBOL(w1_add_master_device);
diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c
index 9130f1c12c26..808b4f8675c5 100644
--- a/drivers/zorro/zorro-sysfs.c
+++ b/drivers/zorro/zorro-sysfs.c
@@ -78,7 +78,7 @@ static ssize_t zorro_read_config(struct kobject *kobj,
78static struct bin_attribute zorro_config_attr = { 78static struct bin_attribute zorro_config_attr = {
79 .attr = { 79 .attr = {
80 .name = "config", 80 .name = "config",
81 .mode = S_IRUGO | S_IWUSR, 81 .mode = S_IRUGO,
82 }, 82 },
83 .size = sizeof(struct ConfigDev), 83 .size = sizeof(struct ConfigDev),
84 .read = zorro_read_config, 84 .read = zorro_read_config,
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 08fa320b7e6d..15e05a15b575 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -92,23 +92,6 @@ struct p9_fid *v9fs_fid_lookup(struct dentry *dentry)
92 return fid; 92 return fid;
93} 93}
94 94
95struct p9_fid *v9fs_fid_lookup_remove(struct dentry *dentry)
96{
97 struct p9_fid *fid;
98 struct v9fs_dentry *dent;
99
100 dent = dentry->d_fsdata;
101 fid = v9fs_fid_lookup(dentry);
102 if (!IS_ERR(fid)) {
103 spin_lock(&dent->lock);
104 list_del(&fid->dlist);
105 spin_unlock(&dent->lock);
106 }
107
108 return fid;
109}
110
111
112/** 95/**
113 * v9fs_fid_clone - lookup the fid for a dentry, clone a private copy and 96 * v9fs_fid_clone - lookup the fid for a dentry, clone a private copy and
114 * release it 97 * release it
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 47a0ba742872..26e07df783b9 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -28,6 +28,5 @@ struct v9fs_dentry {
28}; 28};
29 29
30struct p9_fid *v9fs_fid_lookup(struct dentry *dentry); 30struct p9_fid *v9fs_fid_lookup(struct dentry *dentry);
31struct p9_fid *v9fs_fid_lookup_remove(struct dentry *dentry);
32struct p9_fid *v9fs_fid_clone(struct dentry *dentry); 31struct p9_fid *v9fs_fid_clone(struct dentry *dentry);
33int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid); 32int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid);
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 2d4c8a3e604e..45ff3d63b758 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -587,19 +587,20 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
587 unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); 587 unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name);
588 if (!unhashed) { 588 if (!unhashed) {
589 /* 589 /*
590 * Mark the dentry incomplete, but add it. This is needed so 590 * Mark the dentry incomplete but don't hash it. We do this
591 * that the VFS layer knows about the dentry, and we can count 591 * to serialize our inode creation operations (symlink and
592 * on catching any lookups through the revalidate. 592 * mkdir) which prevents deadlock during the callback to
593 * 593 * the daemon. Subsequent user space lookups for the same
594 * Let all the hard work be done by the revalidate function that 594 * dentry are placed on the wait queue while the daemon
595 * needs to be able to do this anyway.. 595 * itself is allowed passage unresticted so the create
596 * 596 * operation itself can then hash the dentry. Finally,
597 * We need to do this before we release the directory semaphore. 597 * we check for the hashed dentry and return the newly
598 * hashed dentry.
598 */ 599 */
599 dentry->d_op = &autofs4_root_dentry_operations; 600 dentry->d_op = &autofs4_root_dentry_operations;
600 601
601 dentry->d_fsdata = NULL; 602 dentry->d_fsdata = NULL;
602 d_add(dentry, NULL); 603 d_instantiate(dentry, NULL);
603 } else { 604 } else {
604 struct autofs_info *ino = autofs4_dentry_ino(unhashed); 605 struct autofs_info *ino = autofs4_dentry_ino(unhashed);
605 DPRINTK("rehash %p with %p", dentry, unhashed); 606 DPRINTK("rehash %p with %p", dentry, unhashed);
@@ -607,15 +608,17 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
607 * If we are racing with expire the request might not 608 * If we are racing with expire the request might not
608 * be quite complete but the directory has been removed 609 * be quite complete but the directory has been removed
609 * so it must have been successful, so just wait for it. 610 * so it must have been successful, so just wait for it.
611 * We need to ensure the AUTOFS_INF_EXPIRING flag is clear
612 * before continuing as revalidate may fail when calling
613 * try_to_fill_dentry (returning EAGAIN) if we don't.
610 */ 614 */
611 if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) { 615 while (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
612 DPRINTK("wait for incomplete expire %p name=%.*s", 616 DPRINTK("wait for incomplete expire %p name=%.*s",
613 unhashed, unhashed->d_name.len, 617 unhashed, unhashed->d_name.len,
614 unhashed->d_name.name); 618 unhashed->d_name.name);
615 autofs4_wait(sbi, unhashed, NFY_NONE); 619 autofs4_wait(sbi, unhashed, NFY_NONE);
616 DPRINTK("request completed"); 620 DPRINTK("request completed");
617 } 621 }
618 d_rehash(unhashed);
619 dentry = unhashed; 622 dentry = unhashed;
620 } 623 }
621 624
@@ -658,7 +661,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
658 * for all system calls, but it should be OK for the operations 661 * for all system calls, but it should be OK for the operations
659 * we permit from an autofs. 662 * we permit from an autofs.
660 */ 663 */
661 if (dentry->d_inode && d_unhashed(dentry)) { 664 if (!oz_mode && d_unhashed(dentry)) {
662 /* 665 /*
663 * A user space application can (and has done in the past) 666 * A user space application can (and has done in the past)
664 * remove and re-create this directory during the callback. 667 * remove and re-create this directory during the callback.
@@ -716,7 +719,7 @@ static int autofs4_dir_symlink(struct inode *dir,
716 strcpy(cp, symname); 719 strcpy(cp, symname);
717 720
718 inode = autofs4_get_inode(dir->i_sb, ino); 721 inode = autofs4_get_inode(dir->i_sb, ino);
719 d_instantiate(dentry, inode); 722 d_add(dentry, inode);
720 723
721 if (dir == dir->i_sb->s_root->d_inode) 724 if (dir == dir->i_sb->s_root->d_inode)
722 dentry->d_op = &autofs4_root_dentry_operations; 725 dentry->d_op = &autofs4_root_dentry_operations;
@@ -844,7 +847,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
844 return -ENOSPC; 847 return -ENOSPC;
845 848
846 inode = autofs4_get_inode(dir->i_sb, ino); 849 inode = autofs4_get_inode(dir->i_sb, ino);
847 d_instantiate(dentry, inode); 850 d_add(dentry, inode);
848 851
849 if (dir == dir->i_sb->s_root->d_inode) 852 if (dir == dir->i_sb->s_root->d_inode)
850 dentry->d_op = &autofs4_root_dentry_operations; 853 dentry->d_op = &autofs4_root_dentry_operations;
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 6d84ca2beead..bed6215c0794 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -3,7 +3,10 @@ Version 1.50
3Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is 3Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
4done with "serverino" mount option). Add support for POSIX Unlink 4done with "serverino" mount option). Add support for POSIX Unlink
5(helps with certain sharing violation cases when server such as 5(helps with certain sharing violation cases when server such as
6Samba supports newer POSIX CIFS Protocol Extensions). 6Samba supports newer POSIX CIFS Protocol Extensions). Add "nounix"
7mount option to allow disabling the CIFS Unix Extensions for just
8that mount. Fix hang on spinlock in find_writable_file (race when
9reopening file after session crash).
7 10
8Version 1.49 11Version 1.49
9------------ 12------------
diff --git a/fs/cifs/README b/fs/cifs/README
index 85f1eb14083e..b806b11b5560 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -444,6 +444,13 @@ A partial list of the supported mount options follows:
444 noposixpaths If CIFS Unix extensions are supported, do not request 444 noposixpaths If CIFS Unix extensions are supported, do not request
445 posix path name support (this may cause servers to 445 posix path name support (this may cause servers to
446 reject creatingfile with certain reserved characters). 446 reject creatingfile with certain reserved characters).
447 nounix Disable the CIFS Unix Extensions for this mount (tree
448 connection). This is rarely needed, but it may be useful
449 in order to turn off multiple settings all at once (ie
450 posix acls, posix locks, posix paths, symlink support
451 and retrieving uids/gids/mode from the server) or to
452 work around a bug in server which implement the Unix
453 Extensions.
447 nobrl Do not send byte range lock requests to the server. 454 nobrl Do not send byte range lock requests to the server.
448 This is necessary for certain applications that break 455 This is necessary for certain applications that break
449 with cifs style mandatory byte range locks (and most 456 with cifs style mandatory byte range locks (and most
@@ -451,6 +458,12 @@ A partial list of the supported mount options follows:
451 byte range locks). 458 byte range locks).
452 remount remount the share (often used to change from ro to rw mounts 459 remount remount the share (often used to change from ro to rw mounts
453 or vice versa) 460 or vice versa)
461 servern Specify the server 's netbios name (RFC1001 name) to use
462 when attempting to setup a session to the server. This is
463 This is needed for mounting to some older servers (such
464 as OS/2 or Windows 98 and Windows ME) since they do not
465 support a default server name. A server name can be up
466 to 15 characters long and is usually uppercased.
454 sfu When the CIFS Unix Extensions are not negotiated, attempt to 467 sfu When the CIFS Unix Extensions are not negotiated, attempt to
455 create device files and fifos in a format compatible with 468 create device files and fifos in a format compatible with
456 Services for Unix (SFU). In addition retrieve bits 10-12 469 Services for Unix (SFU). In addition retrieve bits 10-12
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index d7bd51575fd6..29d4b2715254 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -82,8 +82,7 @@ u) DOS attrs - returned as pseudo-xattr in Samba format (check VFAT and NTFS for
82 82
83v) mount check for unmatched uids 83v) mount check for unmatched uids
84 84
85w) Add mount option for Linux extension disable per mount, and partial 85w) Add support for new vfs entry points for setlease and fallocate
86disable per mount (uid off, symlink/fifo/mknod on but what about posix acls?)
87 86
88x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of 87x) Fix Samba 3 server to handle Linux kernel aio so dbench with lots of
89processes can proceed better in parallel (on the server) 88processes can proceed better in parallel (on the server)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e13592afca9c..894b1f7b299d 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1904,6 +1904,25 @@ static int cifs_readpage(struct file *file, struct page *page)
1904 return rc; 1904 return rc;
1905} 1905}
1906 1906
1907static int is_inode_writable(struct cifsInodeInfo *cifs_inode)
1908{
1909 struct cifsFileInfo *open_file;
1910
1911 read_lock(&GlobalSMBSeslock);
1912 list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1913 if (open_file->closePend)
1914 continue;
1915 if (open_file->pfile &&
1916 ((open_file->pfile->f_flags & O_RDWR) ||
1917 (open_file->pfile->f_flags & O_WRONLY))) {
1918 read_unlock(&GlobalSMBSeslock);
1919 return 1;
1920 }
1921 }
1922 read_unlock(&GlobalSMBSeslock);
1923 return 0;
1924}
1925
1907/* We do not want to update the file size from server for inodes 1926/* We do not want to update the file size from server for inodes
1908 open for write - to avoid races with writepage extending 1927 open for write - to avoid races with writepage extending
1909 the file - in the future we could consider allowing 1928 the file - in the future we could consider allowing
@@ -1912,19 +1931,13 @@ static int cifs_readpage(struct file *file, struct page *page)
1912 page caching in the current Linux kernel design */ 1931 page caching in the current Linux kernel design */
1913int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) 1932int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
1914{ 1933{
1915 struct cifsFileInfo *open_file = NULL; 1934 if (!cifsInode)
1916 1935 return 1;
1917 if (cifsInode)
1918 open_file = find_writable_file(cifsInode);
1919 1936
1920 if (open_file) { 1937 if (is_inode_writable(cifsInode)) {
1938 /* This inode is open for write at least once */
1921 struct cifs_sb_info *cifs_sb; 1939 struct cifs_sb_info *cifs_sb;
1922 1940
1923 /* there is not actually a write pending so let
1924 this handle go free and allow it to
1925 be closable if needed */
1926 atomic_dec(&open_file->wrtPending);
1927
1928 cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); 1941 cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb);
1929 if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) { 1942 if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) {
1930 /* since no page cache to corrupt on directio 1943 /* since no page cache to corrupt on directio
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 2ea027dda215..892be9b4d1f3 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -372,6 +372,10 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
372 372
373 /* 2000 big enough to fit max user, domain, NOS name etc. */ 373 /* 2000 big enough to fit max user, domain, NOS name etc. */
374 str_area = kmalloc(2000, GFP_KERNEL); 374 str_area = kmalloc(2000, GFP_KERNEL);
375 if (str_area == NULL) {
376 cifs_small_buf_release(smb_buf);
377 return -ENOMEM;
378 }
375 bcc_ptr = str_area; 379 bcc_ptr = str_area;
376 380
377 ses->flags &= ~CIFS_SES_LANMAN; 381 ses->flags &= ~CIFS_SES_LANMAN;
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 6874785bb65a..901dc55e9f54 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -958,36 +958,22 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
958 ssize_t ret2; 958 ssize_t ret2;
959 size_t bytes; 959 size_t bytes;
960 960
961 dio->bio = NULL;
962 dio->inode = inode; 961 dio->inode = inode;
963 dio->rw = rw; 962 dio->rw = rw;
964 dio->blkbits = blkbits; 963 dio->blkbits = blkbits;
965 dio->blkfactor = inode->i_blkbits - blkbits; 964 dio->blkfactor = inode->i_blkbits - blkbits;
966 dio->start_zero_done = 0;
967 dio->size = 0;
968 dio->block_in_file = offset >> blkbits; 965 dio->block_in_file = offset >> blkbits;
969 dio->blocks_available = 0;
970 dio->cur_page = NULL;
971 966
972 dio->boundary = 0;
973 dio->reap_counter = 0;
974 dio->get_block = get_block; 967 dio->get_block = get_block;
975 dio->end_io = end_io; 968 dio->end_io = end_io;
976 dio->map_bh.b_private = NULL;
977 dio->map_bh.b_state = 0;
978 dio->final_block_in_bio = -1; 969 dio->final_block_in_bio = -1;
979 dio->next_block_for_io = -1; 970 dio->next_block_for_io = -1;
980 971
981 dio->page_errors = 0;
982 dio->io_error = 0;
983 dio->result = 0;
984 dio->iocb = iocb; 972 dio->iocb = iocb;
985 dio->i_size = i_size_read(inode); 973 dio->i_size = i_size_read(inode);
986 974
987 spin_lock_init(&dio->bio_lock); 975 spin_lock_init(&dio->bio_lock);
988 dio->refcount = 1; 976 dio->refcount = 1;
989 dio->bio_list = NULL;
990 dio->waiter = NULL;
991 977
992 /* 978 /*
993 * In case of non-aligned buffers, we may need 2 more 979 * In case of non-aligned buffers, we may need 2 more
@@ -995,8 +981,6 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
995 */ 981 */
996 if (unlikely(dio->blkfactor)) 982 if (unlikely(dio->blkfactor))
997 dio->pages_in_io = 2; 983 dio->pages_in_io = 2;
998 else
999 dio->pages_in_io = 0;
1000 984
1001 for (seg = 0; seg < nr_segs; seg++) { 985 for (seg = 0; seg < nr_segs; seg++) {
1002 user_addr = (unsigned long)iov[seg].iov_base; 986 user_addr = (unsigned long)iov[seg].iov_base;
@@ -1184,7 +1168,7 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
1184 } 1168 }
1185 } 1169 }
1186 1170
1187 dio = kmalloc(sizeof(*dio), GFP_KERNEL); 1171 dio = kzalloc(sizeof(*dio), GFP_KERNEL);
1188 retval = -ENOMEM; 1172 retval = -ENOMEM;
1189 if (!dio) 1173 if (!dio)
1190 goto out; 1174 goto out;
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 131954b3fb98..5d40ad13ab5c 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -357,6 +357,10 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
357 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n"); 357 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
358 goto out; 358 goto out;
359 } 359 }
360 if (special_file(lower_inode->i_mode)) {
361 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
362 goto out;
363 }
360 if (!nd) { 364 if (!nd) {
361 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave" 365 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave"
362 "as we *think* we are about to unlink\n"); 366 "as we *think* we are about to unlink\n");
diff --git a/fs/exec.c b/fs/exec.c
index 7bdea7937ee8..c21a8cc06277 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -780,18 +780,11 @@ static int de_thread(struct task_struct *tsk)
780 int count; 780 int count;
781 781
782 /* 782 /*
783 * Tell all the sighand listeners that this sighand has
784 * been detached. The signalfd_detach() function grabs the
785 * sighand lock, if signal listeners are present on the sighand.
786 */
787 signalfd_detach(tsk);
788
789 /*
790 * If we don't share sighandlers, then we aren't sharing anything 783 * If we don't share sighandlers, then we aren't sharing anything
791 * and we can just re-use it all. 784 * and we can just re-use it all.
792 */ 785 */
793 if (atomic_read(&oldsighand->count) <= 1) { 786 if (atomic_read(&oldsighand->count) <= 1) {
794 BUG_ON(atomic_read(&sig->count) != 1); 787 signalfd_detach(tsk);
795 exit_itimers(sig); 788 exit_itimers(sig);
796 return 0; 789 return 0;
797 } 790 }
@@ -930,12 +923,11 @@ static int de_thread(struct task_struct *tsk)
930 sig->flags = 0; 923 sig->flags = 0;
931 924
932no_thread_group: 925no_thread_group:
926 signalfd_detach(tsk);
933 exit_itimers(sig); 927 exit_itimers(sig);
934 if (leader) 928 if (leader)
935 release_task(leader); 929 release_task(leader);
936 930
937 BUG_ON(atomic_read(&sig->count) != 1);
938
939 if (atomic_read(&oldsighand->count) == 1) { 931 if (atomic_read(&oldsighand->count) == 1) {
940 /* 932 /*
941 * Now that we nuked the rest of the thread group, 933 * Now that we nuked the rest of the thread group,
@@ -1084,9 +1076,12 @@ int flush_old_exec(struct linux_binprm * bprm)
1084 */ 1076 */
1085 current->mm->task_size = TASK_SIZE; 1077 current->mm->task_size = TASK_SIZE;
1086 1078
1087 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 1079 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) {
1088 file_permission(bprm->file, MAY_READ) || 1080 suid_keys(current);
1089 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { 1081 set_dumpable(current->mm, suid_dumpable);
1082 current->pdeath_signal = 0;
1083 } else if (file_permission(bprm->file, MAY_READ) ||
1084 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
1090 suid_keys(current); 1085 suid_keys(current);
1091 set_dumpable(current->mm, suid_dumpable); 1086 set_dumpable(current->mm, suid_dumpable);
1092 } 1087 }
@@ -1177,8 +1172,10 @@ void compute_creds(struct linux_binprm *bprm)
1177{ 1172{
1178 int unsafe; 1173 int unsafe;
1179 1174
1180 if (bprm->e_uid != current->uid) 1175 if (bprm->e_uid != current->uid) {
1181 suid_keys(current); 1176 suid_keys(current);
1177 current->pdeath_signal = 0;
1178 }
1182 exec_keys(current); 1179 exec_keys(current);
1183 1180
1184 task_lock(current); 1181 task_lock(current);
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index bc6185933664..664c164aa67c 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -566,6 +566,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
566 struct jffs2_full_dirent **prev = &dir_f->dents; 566 struct jffs2_full_dirent **prev = &dir_f->dents;
567 uint32_t nhash = full_name_hash(name, namelen); 567 uint32_t nhash = full_name_hash(name, namelen);
568 568
569 /* We don't actually want to reserve any space, but we do
570 want to be holding the alloc_sem when we write to flash */
571 down(&c->alloc_sem);
569 down(&dir_f->sem); 572 down(&dir_f->sem);
570 573
571 while ((*prev) && (*prev)->nhash <= nhash) { 574 while ((*prev) && (*prev)->nhash <= nhash) {
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 965625a0977d..ee4814dd98f9 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -320,7 +320,21 @@ int proc_pid_status(struct task_struct *task, char *buffer)
320 return buffer - orig; 320 return buffer - orig;
321} 321}
322 322
323static clock_t task_utime(struct task_struct *p) 323/*
324 * Use precise platform statistics if available:
325 */
326#ifdef CONFIG_VIRT_CPU_ACCOUNTING
327static cputime_t task_utime(struct task_struct *p)
328{
329 return p->utime;
330}
331
332static cputime_t task_stime(struct task_struct *p)
333{
334 return p->stime;
335}
336#else
337static cputime_t task_utime(struct task_struct *p)
324{ 338{
325 clock_t utime = cputime_to_clock_t(p->utime), 339 clock_t utime = cputime_to_clock_t(p->utime),
326 total = utime + cputime_to_clock_t(p->stime); 340 total = utime + cputime_to_clock_t(p->stime);
@@ -337,10 +351,10 @@ static clock_t task_utime(struct task_struct *p)
337 } 351 }
338 utime = (clock_t)temp; 352 utime = (clock_t)temp;
339 353
340 return utime; 354 return clock_t_to_cputime(utime);
341} 355}
342 356
343static clock_t task_stime(struct task_struct *p) 357static cputime_t task_stime(struct task_struct *p)
344{ 358{
345 clock_t stime; 359 clock_t stime;
346 360
@@ -349,10 +363,12 @@ static clock_t task_stime(struct task_struct *p)
349 * the total, to make sure the total observed by userspace 363 * the total, to make sure the total observed by userspace
350 * grows monotonically - apps rely on that): 364 * grows monotonically - apps rely on that):
351 */ 365 */
352 stime = nsec_to_clock_t(p->se.sum_exec_runtime) - task_utime(p); 366 stime = nsec_to_clock_t(p->se.sum_exec_runtime) -
367 cputime_to_clock_t(task_utime(p));
353 368
354 return stime; 369 return clock_t_to_cputime(stime);
355} 370}
371#endif
356 372
357static int do_task_stat(struct task_struct *task, char *buffer, int whole) 373static int do_task_stat(struct task_struct *task, char *buffer, int whole)
358{ 374{
@@ -368,8 +384,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
368 unsigned long long start_time; 384 unsigned long long start_time;
369 unsigned long cmin_flt = 0, cmaj_flt = 0; 385 unsigned long cmin_flt = 0, cmaj_flt = 0;
370 unsigned long min_flt = 0, maj_flt = 0; 386 unsigned long min_flt = 0, maj_flt = 0;
371 cputime_t cutime, cstime; 387 cputime_t cutime, cstime, utime, stime;
372 clock_t utime, stime;
373 unsigned long rsslim = 0; 388 unsigned long rsslim = 0;
374 char tcomm[sizeof(task->comm)]; 389 char tcomm[sizeof(task->comm)];
375 unsigned long flags; 390 unsigned long flags;
@@ -387,8 +402,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
387 402
388 sigemptyset(&sigign); 403 sigemptyset(&sigign);
389 sigemptyset(&sigcatch); 404 sigemptyset(&sigcatch);
390 cutime = cstime = cputime_zero; 405 cutime = cstime = utime = stime = cputime_zero;
391 utime = stime = 0;
392 406
393 rcu_read_lock(); 407 rcu_read_lock();
394 if (lock_task_sighand(task, &flags)) { 408 if (lock_task_sighand(task, &flags)) {
@@ -414,15 +428,15 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
414 do { 428 do {
415 min_flt += t->min_flt; 429 min_flt += t->min_flt;
416 maj_flt += t->maj_flt; 430 maj_flt += t->maj_flt;
417 utime += task_utime(t); 431 utime = cputime_add(utime, task_utime(t));
418 stime += task_stime(t); 432 stime = cputime_add(stime, task_stime(t));
419 t = next_thread(t); 433 t = next_thread(t);
420 } while (t != task); 434 } while (t != task);
421 435
422 min_flt += sig->min_flt; 436 min_flt += sig->min_flt;
423 maj_flt += sig->maj_flt; 437 maj_flt += sig->maj_flt;
424 utime += cputime_to_clock_t(sig->utime); 438 utime = cputime_add(utime, sig->utime);
425 stime += cputime_to_clock_t(sig->stime); 439 stime = cputime_add(stime, sig->stime);
426 } 440 }
427 441
428 sid = signal_session(sig); 442 sid = signal_session(sig);
@@ -471,8 +485,8 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
471 cmin_flt, 485 cmin_flt,
472 maj_flt, 486 maj_flt,
473 cmaj_flt, 487 cmaj_flt,
474 utime, 488 cputime_to_clock_t(utime),
475 stime, 489 cputime_to_clock_t(stime),
476 cputime_to_clock_t(cutime), 490 cputime_to_clock_t(cutime),
477 cputime_to_clock_t(cstime), 491 cputime_to_clock_t(cstime),
478 priority, 492 priority,
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 7b941abbcde0..a8e293d30034 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -56,12 +56,18 @@ static int signalfd_lock(struct signalfd_ctx *ctx, struct signalfd_lockctx *lk)
56 sighand = lock_task_sighand(lk->tsk, &lk->flags); 56 sighand = lock_task_sighand(lk->tsk, &lk->flags);
57 rcu_read_unlock(); 57 rcu_read_unlock();
58 58
59 if (sighand && !ctx->tsk) { 59 if (!sighand)
60 return 0;
61
62 if (!ctx->tsk) {
60 unlock_task_sighand(lk->tsk, &lk->flags); 63 unlock_task_sighand(lk->tsk, &lk->flags);
61 sighand = NULL; 64 return 0;
62 } 65 }
63 66
64 return sighand != NULL; 67 if (lk->tsk->tgid == current->tgid)
68 lk->tsk = current;
69
70 return 1;
65} 71}
66 72
67static void signalfd_unlock(struct signalfd_lockctx *lk) 73static void signalfd_unlock(struct signalfd_lockctx *lk)
@@ -331,7 +337,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas
331 337
332 init_waitqueue_head(&ctx->wqh); 338 init_waitqueue_head(&ctx->wqh);
333 ctx->sigmask = sigmask; 339 ctx->sigmask = sigmask;
334 ctx->tsk = current; 340 ctx->tsk = current->group_leader;
335 341
336 sighand = current->sighand; 342 sighand = current->sighand;
337 /* 343 /*
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 135353f8a296..5afe2a26f5d8 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -248,12 +248,7 @@ int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr)
248 248
249void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr) 249void sysfs_remove_bin_file(struct kobject * kobj, struct bin_attribute * attr)
250{ 250{
251 if (sysfs_hash_and_remove(kobj->sd, attr->attr.name) < 0) { 251 sysfs_hash_and_remove(kobj->sd, attr->attr.name);
252 printk(KERN_ERR "%s: "
253 "bad dentry or inode or no such file: \"%s\"\n",
254 __FUNCTION__, attr->attr.name);
255 dump_stack();
256 }
257} 252}
258 253
259EXPORT_SYMBOL_GPL(sysfs_create_bin_file); 254EXPORT_SYMBOL_GPL(sysfs_create_bin_file);
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 048e6054c2fd..83e76b3813c9 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -762,12 +762,15 @@ static int sysfs_count_nlink(struct sysfs_dirent *sd)
762static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, 762static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
763 struct nameidata *nd) 763 struct nameidata *nd)
764{ 764{
765 struct dentry *ret = NULL;
765 struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata; 766 struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
766 struct sysfs_dirent * sd; 767 struct sysfs_dirent * sd;
767 struct bin_attribute *bin_attr; 768 struct bin_attribute *bin_attr;
768 struct inode *inode; 769 struct inode *inode;
769 int found = 0; 770 int found = 0;
770 771
772 mutex_lock(&sysfs_mutex);
773
771 for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) { 774 for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) {
772 if (sysfs_type(sd) && 775 if (sysfs_type(sd) &&
773 !strcmp(sd->s_name, dentry->d_name.name)) { 776 !strcmp(sd->s_name, dentry->d_name.name)) {
@@ -778,14 +781,14 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
778 781
779 /* no such entry */ 782 /* no such entry */
780 if (!found) 783 if (!found)
781 return NULL; 784 goto out_unlock;
782 785
783 /* attach dentry and inode */ 786 /* attach dentry and inode */
784 inode = sysfs_get_inode(sd); 787 inode = sysfs_get_inode(sd);
785 if (!inode) 788 if (!inode) {
786 return ERR_PTR(-ENOMEM); 789 ret = ERR_PTR(-ENOMEM);
787 790 goto out_unlock;
788 mutex_lock(&sysfs_mutex); 791 }
789 792
790 if (inode->i_state & I_NEW) { 793 if (inode->i_state & I_NEW) {
791 /* initialize inode according to type */ 794 /* initialize inode according to type */
@@ -815,9 +818,9 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry,
815 sysfs_instantiate(dentry, inode); 818 sysfs_instantiate(dentry, inode);
816 sysfs_attach_dentry(sd, dentry); 819 sysfs_attach_dentry(sd, dentry);
817 820
821 out_unlock:
818 mutex_unlock(&sysfs_mutex); 822 mutex_unlock(&sysfs_mutex);
819 823 return ret;
820 return NULL;
821} 824}
822 825
823const struct inode_operations sysfs_dir_inode_operations = { 826const struct inode_operations sysfs_dir_inode_operations = {
@@ -942,6 +945,8 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
942 if (error) 945 if (error)
943 goto out_drop; 946 goto out_drop;
944 947
948 mutex_lock(&sysfs_mutex);
949
945 dup_name = sd->s_name; 950 dup_name = sd->s_name;
946 sd->s_name = new_name; 951 sd->s_name = new_name;
947 952
@@ -949,8 +954,6 @@ int sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
949 d_add(new_dentry, NULL); 954 d_add(new_dentry, NULL);
950 d_move(sd->s_dentry, new_dentry); 955 d_move(sd->s_dentry, new_dentry);
951 956
952 mutex_lock(&sysfs_mutex);
953
954 sysfs_unlink_sibling(sd); 957 sysfs_unlink_sibling(sd);
955 sysfs_get(new_parent_sd); 958 sysfs_get(new_parent_sd);
956 sysfs_put(sd->s_parent); 959 sysfs_put(sd->s_parent);
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index e30d4b3bd836..64bb92bb6773 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -255,6 +255,8 @@ static inline void memset_io(volatile void __iomem *addr, unsigned char val,
255 memset((void __force *)addr, val, count); 255 memset((void __force *)addr, val, count);
256} 256}
257 257
258#define mmiowb()
259
258#define IO_SPACE_LIMIT 0xffffffff 260#define IO_SPACE_LIMIT 0xffffffff
259 261
260extern void __iomem *__ioremap(unsigned long offset, size_t size, 262extern void __iomem *__ioremap(unsigned long offset, size_t size,
diff --git a/include/asm-avr32/pgalloc.h b/include/asm-avr32/pgalloc.h
index bb82e70cde8d..0e680f47209f 100644
--- a/include/asm-avr32/pgalloc.h
+++ b/include/asm-avr32/pgalloc.h
@@ -27,13 +27,7 @@ static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
27 */ 27 */
28static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) 28static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
29{ 29{
30 unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t)); 30 return kcalloc(USER_PTRS_PER_PGD, sizeof(pgd_t), GFP_KERNEL);
31 pgd_t *pgd = kmalloc(pgd_size, GFP_KERNEL);
32
33 if (pgd)
34 memset(pgd, 0, pgd_size);
35
36 return pgd;
37} 31}
38 32
39static inline void pgd_free(pgd_t *pgd) 33static inline void pgd_free(pgd_t *pgd)
@@ -44,18 +38,9 @@ static inline void pgd_free(pgd_t *pgd)
44static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 38static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
45 unsigned long address) 39 unsigned long address)
46{ 40{
47 int count = 0;
48 pte_t *pte; 41 pte_t *pte;
49 42
50 do { 43 pte = (pte_t *)get_zeroed_page(GFP_KERNEL | __GFP_REPEAT);
51 pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT);
52 if (pte)
53 clear_page(pte);
54 else {
55 current->state = TASK_UNINTERRUPTIBLE;
56 schedule_timeout(HZ);
57 }
58 } while (!pte && (count++ < 10));
59 44
60 return pte; 45 return pte;
61} 46}
@@ -63,18 +48,9 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
63static inline struct page *pte_alloc_one(struct mm_struct *mm, 48static inline struct page *pte_alloc_one(struct mm_struct *mm,
64 unsigned long address) 49 unsigned long address)
65{ 50{
66 int count = 0;
67 struct page *pte; 51 struct page *pte;
68 52
69 do { 53 pte = alloc_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
70 pte = alloc_pages(GFP_KERNEL, 0);
71 if (pte)
72 clear_page(page_address(pte));
73 else {
74 current->state = TASK_UNINTERRUPTIBLE;
75 schedule_timeout(HZ);
76 }
77 } while (!pte && (count++ < 10));
78 54
79 return pte; 55 return pte;
80} 56}
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h
index c07bdd10b891..018f6e2a0242 100644
--- a/include/asm-avr32/pgtable.h
+++ b/include/asm-avr32/pgtable.h
@@ -32,8 +32,6 @@
32#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 32#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
33#define FIRST_USER_ADDRESS 0 33#define FIRST_USER_ADDRESS 0
34 34
35#define PTE_PHYS_MASK 0x1ffff000
36
37#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
38extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 36extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
39extern void paging_init(void); 37extern void paging_init(void);
@@ -265,7 +263,7 @@ static inline pte_t pte_mkyoung(pte_t pte)
265 * trivial. 263 * trivial.
266 */ 264 */
267#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) 265#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
268#define pte_page(x) phys_to_page(pte_val(x) & PTE_PHYS_MASK) 266#define pte_page(x) (pfn_to_page(pte_pfn(x)))
269 267
270/* 268/*
271 * Mark the prot value as uncacheable and unbufferable 269 * Mark the prot value as uncacheable and unbufferable
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 7b65b5b00034..e8e0bd641120 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -112,6 +112,9 @@ extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsign
112 * writew/writel functions and the other mmio helpers. The returned 112 * writew/writel functions and the other mmio helpers. The returned
113 * address is not guaranteed to be usable directly as a virtual 113 * address is not guaranteed to be usable directly as a virtual
114 * address. 114 * address.
115 *
116 * If the area you are trying to map is a PCI BAR you should have a
117 * look at pci_iomap().
115 */ 118 */
116 119
117static inline void __iomem * ioremap(unsigned long offset, unsigned long size) 120static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
diff --git a/include/asm-i386/mach-default/mach_wakecpu.h b/include/asm-i386/mach-default/mach_wakecpu.h
index 673b85c9b273..3ebb17893aa5 100644
--- a/include/asm-i386/mach-default/mach_wakecpu.h
+++ b/include/asm-i386/mach-default/mach_wakecpu.h
@@ -15,7 +15,8 @@
15 15
16static inline void wait_for_init_deassert(atomic_t *deassert) 16static inline void wait_for_init_deassert(atomic_t *deassert)
17{ 17{
18 while (!atomic_read(deassert)); 18 while (!atomic_read(deassert))
19 cpu_relax();
19 return; 20 return;
20} 21}
21 22
diff --git a/include/asm-i386/mach-es7000/mach_wakecpu.h b/include/asm-i386/mach-es7000/mach_wakecpu.h
index efc903b73486..84ff58314501 100644
--- a/include/asm-i386/mach-es7000/mach_wakecpu.h
+++ b/include/asm-i386/mach-es7000/mach_wakecpu.h
@@ -31,7 +31,8 @@ wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
31static inline void wait_for_init_deassert(atomic_t *deassert) 31static inline void wait_for_init_deassert(atomic_t *deassert)
32{ 32{
33#ifdef WAKE_SECONDARY_VIA_INIT 33#ifdef WAKE_SECONDARY_VIA_INIT
34 while (!atomic_read(deassert)); 34 while (!atomic_read(deassert))
35 cpu_relax();
35#endif 36#endif
36 return; 37 return;
37} 38}
diff --git a/include/asm-i386/nmi.h b/include/asm-i386/nmi.h
index ff30c98f87b0..70a958a8e381 100644
--- a/include/asm-i386/nmi.h
+++ b/include/asm-i386/nmi.h
@@ -33,11 +33,12 @@ extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
33 33
34extern atomic_t nmi_active; 34extern atomic_t nmi_active;
35extern unsigned int nmi_watchdog; 35extern unsigned int nmi_watchdog;
36#define NMI_DEFAULT -1 36#define NMI_DISABLED -1
37#define NMI_NONE 0 37#define NMI_NONE 0
38#define NMI_IO_APIC 1 38#define NMI_IO_APIC 1
39#define NMI_LOCAL_APIC 2 39#define NMI_LOCAL_APIC 2
40#define NMI_INVALID 3 40#define NMI_INVALID 3
41#define NMI_DEFAULT NMI_DISABLED
41 42
42struct ctl_table; 43struct ctl_table;
43struct file; 44struct file;
diff --git a/include/asm-ia64/atomic.h b/include/asm-ia64/atomic.h
index 1fc3b83325da..50c2b83fd5a0 100644
--- a/include/asm-ia64/atomic.h
+++ b/include/asm-ia64/atomic.h
@@ -55,7 +55,7 @@ ia64_atomic64_add (__s64 i, atomic64_t *v)
55 55
56 do { 56 do {
57 CMPXCHG_BUGCHECK(v); 57 CMPXCHG_BUGCHECK(v);
58 old = atomic_read(v); 58 old = atomic64_read(v);
59 new = old + i; 59 new = old + i;
60 } while (ia64_cmpxchg(acq, v, old, new, sizeof(atomic64_t)) != old); 60 } while (ia64_cmpxchg(acq, v, old, new, sizeof(atomic64_t)) != old);
61 return new; 61 return new;
@@ -83,7 +83,7 @@ ia64_atomic64_sub (__s64 i, atomic64_t *v)
83 83
84 do { 84 do {
85 CMPXCHG_BUGCHECK(v); 85 CMPXCHG_BUGCHECK(v);
86 old = atomic_read(v); 86 old = atomic64_read(v);
87 new = old - i; 87 new = old - i;
88 } while (ia64_cmpxchg(acq, v, old, new, sizeof(atomic64_t)) != old); 88 } while (ia64_cmpxchg(acq, v, old, new, sizeof(atomic64_t)) != old);
89 return new; 89 return new;
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h
index efa1b8f7251d..bba5baa3c7fc 100644
--- a/include/asm-ia64/hw_irq.h
+++ b/include/asm-ia64/hw_irq.h
@@ -124,6 +124,11 @@ static inline void ia64_resend_irq(unsigned int vector)
124extern irq_desc_t irq_desc[NR_IRQS]; 124extern irq_desc_t irq_desc[NR_IRQS];
125 125
126#ifndef CONFIG_IA64_GENERIC 126#ifndef CONFIG_IA64_GENERIC
127static inline ia64_vector __ia64_irq_to_vector(int irq)
128{
129 return irq_cfg[irq].vector;
130}
131
127static inline unsigned int 132static inline unsigned int
128__ia64_local_vector_to_irq (ia64_vector vec) 133__ia64_local_vector_to_irq (ia64_vector vec)
129{ 134{
@@ -145,7 +150,7 @@ __ia64_local_vector_to_irq (ia64_vector vec)
145static inline ia64_vector 150static inline ia64_vector
146irq_to_vector (int irq) 151irq_to_vector (int irq)
147{ 152{
148 return irq_cfg[irq].vector; 153 return platform_irq_to_vector(irq);
149} 154}
150 155
151/* 156/*
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 5cf8bf1e805e..c201a2020aa4 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -30,6 +30,7 @@ typedef void ia64_mv_send_ipi_t (int, int, int, int);
30typedef void ia64_mv_timer_interrupt_t (int, void *); 30typedef void ia64_mv_timer_interrupt_t (int, void *);
31typedef void ia64_mv_global_tlb_purge_t (struct mm_struct *, unsigned long, unsigned long, unsigned long); 31typedef void ia64_mv_global_tlb_purge_t (struct mm_struct *, unsigned long, unsigned long, unsigned long);
32typedef void ia64_mv_tlb_migrate_finish_t (struct mm_struct *); 32typedef void ia64_mv_tlb_migrate_finish_t (struct mm_struct *);
33typedef u8 ia64_mv_irq_to_vector (int);
33typedef unsigned int ia64_mv_local_vector_to_irq (u8); 34typedef unsigned int ia64_mv_local_vector_to_irq (u8);
34typedef char *ia64_mv_pci_get_legacy_mem_t (struct pci_bus *); 35typedef char *ia64_mv_pci_get_legacy_mem_t (struct pci_bus *);
35typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val, 36typedef int ia64_mv_pci_legacy_read_t (struct pci_bus *, u16 port, u32 *val,
@@ -145,6 +146,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
145# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device 146# define platform_dma_sync_sg_for_device ia64_mv.dma_sync_sg_for_device
146# define platform_dma_mapping_error ia64_mv.dma_mapping_error 147# define platform_dma_mapping_error ia64_mv.dma_mapping_error
147# define platform_dma_supported ia64_mv.dma_supported 148# define platform_dma_supported ia64_mv.dma_supported
149# define platform_irq_to_vector ia64_mv.irq_to_vector
148# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq 150# define platform_local_vector_to_irq ia64_mv.local_vector_to_irq
149# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem 151# define platform_pci_get_legacy_mem ia64_mv.pci_get_legacy_mem
150# define platform_pci_legacy_read ia64_mv.pci_legacy_read 152# define platform_pci_legacy_read ia64_mv.pci_legacy_read
@@ -198,6 +200,7 @@ struct ia64_machine_vector {
198 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device; 200 ia64_mv_dma_sync_sg_for_device *dma_sync_sg_for_device;
199 ia64_mv_dma_mapping_error *dma_mapping_error; 201 ia64_mv_dma_mapping_error *dma_mapping_error;
200 ia64_mv_dma_supported *dma_supported; 202 ia64_mv_dma_supported *dma_supported;
203 ia64_mv_irq_to_vector *irq_to_vector;
201 ia64_mv_local_vector_to_irq *local_vector_to_irq; 204 ia64_mv_local_vector_to_irq *local_vector_to_irq;
202 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem; 205 ia64_mv_pci_get_legacy_mem_t *pci_get_legacy_mem;
203 ia64_mv_pci_legacy_read_t *pci_legacy_read; 206 ia64_mv_pci_legacy_read_t *pci_legacy_read;
@@ -247,6 +250,7 @@ struct ia64_machine_vector {
247 platform_dma_sync_sg_for_device, \ 250 platform_dma_sync_sg_for_device, \
248 platform_dma_mapping_error, \ 251 platform_dma_mapping_error, \
249 platform_dma_supported, \ 252 platform_dma_supported, \
253 platform_irq_to_vector, \
250 platform_local_vector_to_irq, \ 254 platform_local_vector_to_irq, \
251 platform_pci_get_legacy_mem, \ 255 platform_pci_get_legacy_mem, \
252 platform_pci_legacy_read, \ 256 platform_pci_legacy_read, \
@@ -366,6 +370,9 @@ extern ia64_mv_dma_supported swiotlb_dma_supported;
366#ifndef platform_dma_supported 370#ifndef platform_dma_supported
367# define platform_dma_supported swiotlb_dma_supported 371# define platform_dma_supported swiotlb_dma_supported
368#endif 372#endif
373#ifndef platform_irq_to_vector
374# define platform_irq_to_vector __ia64_irq_to_vector
375#endif
369#ifndef platform_local_vector_to_irq 376#ifndef platform_local_vector_to_irq
370# define platform_local_vector_to_irq __ia64_local_vector_to_irq 377# define platform_local_vector_to_irq __ia64_local_vector_to_irq
371#endif 378#endif
diff --git a/include/asm-ia64/machvec_init.h b/include/asm-ia64/machvec_init.h
index 2d36f6840f0b..7f21249fba3f 100644
--- a/include/asm-ia64/machvec_init.h
+++ b/include/asm-ia64/machvec_init.h
@@ -2,6 +2,7 @@
2 2
3extern ia64_mv_send_ipi_t ia64_send_ipi; 3extern ia64_mv_send_ipi_t ia64_send_ipi;
4extern ia64_mv_global_tlb_purge_t ia64_global_tlb_purge; 4extern ia64_mv_global_tlb_purge_t ia64_global_tlb_purge;
5extern ia64_mv_irq_to_vector __ia64_irq_to_vector;
5extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq; 6extern ia64_mv_local_vector_to_irq __ia64_local_vector_to_irq;
6extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem; 7extern ia64_mv_pci_get_legacy_mem_t ia64_pci_get_legacy_mem;
7extern ia64_mv_pci_legacy_read_t ia64_pci_legacy_read; 8extern ia64_mv_pci_legacy_read_t ia64_pci_legacy_read;
diff --git a/include/asm-ia64/machvec_sn2.h b/include/asm-ia64/machvec_sn2.h
index eaa2fce0fecd..61439a7f5b08 100644
--- a/include/asm-ia64/machvec_sn2.h
+++ b/include/asm-ia64/machvec_sn2.h
@@ -35,6 +35,7 @@ extern ia64_mv_send_ipi_t sn2_send_IPI;
35extern ia64_mv_timer_interrupt_t sn_timer_interrupt; 35extern ia64_mv_timer_interrupt_t sn_timer_interrupt;
36extern ia64_mv_global_tlb_purge_t sn2_global_tlb_purge; 36extern ia64_mv_global_tlb_purge_t sn2_global_tlb_purge;
37extern ia64_mv_tlb_migrate_finish_t sn_tlb_migrate_finish; 37extern ia64_mv_tlb_migrate_finish_t sn_tlb_migrate_finish;
38extern ia64_mv_irq_to_vector sn_irq_to_vector;
38extern ia64_mv_local_vector_to_irq sn_local_vector_to_irq; 39extern ia64_mv_local_vector_to_irq sn_local_vector_to_irq;
39extern ia64_mv_pci_get_legacy_mem_t sn_pci_get_legacy_mem; 40extern ia64_mv_pci_get_legacy_mem_t sn_pci_get_legacy_mem;
40extern ia64_mv_pci_legacy_read_t sn_pci_legacy_read; 41extern ia64_mv_pci_legacy_read_t sn_pci_legacy_read;
@@ -104,6 +105,7 @@ extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
104#define platform_readw_relaxed __sn_readw_relaxed 105#define platform_readw_relaxed __sn_readw_relaxed
105#define platform_readl_relaxed __sn_readl_relaxed 106#define platform_readl_relaxed __sn_readl_relaxed
106#define platform_readq_relaxed __sn_readq_relaxed 107#define platform_readq_relaxed __sn_readq_relaxed
108#define platform_irq_to_vector sn_irq_to_vector
107#define platform_local_vector_to_irq sn_local_vector_to_irq 109#define platform_local_vector_to_irq sn_local_vector_to_irq
108#define platform_pci_get_legacy_mem sn_pci_get_legacy_mem 110#define platform_pci_get_legacy_mem sn_pci_get_legacy_mem
109#define platform_pci_legacy_read sn_pci_legacy_read 111#define platform_pci_legacy_read sn_pci_legacy_read
diff --git a/include/asm-m68k/ioctls.h b/include/asm-m68k/ioctls.h
index 0c48929ab444..b8d2f4be7fd7 100644
--- a/include/asm-m68k/ioctls.h
+++ b/include/asm-m68k/ioctls.h
@@ -46,6 +46,10 @@
46#define TIOCSBRK 0x5427 /* BSD compatibility */ 46#define TIOCSBRK 0x5427 /* BSD compatibility */
47#define TIOCCBRK 0x5428 /* BSD compatibility */ 47#define TIOCCBRK 0x5428 /* BSD compatibility */
48#define TIOCGSID 0x5429 /* Return the session ID of FD */ 48#define TIOCGSID 0x5429 /* Return the session ID of FD */
49#define TCGETS2 _IOR('T',0x2A, struct termios2)
50#define TCSETS2 _IOW('T',0x2B, struct termios2)
51#define TCSETSW2 _IOW('T',0x2C, struct termios2)
52#define TCSETSF2 _IOW('T',0x2D, struct termios2)
49#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ 53#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
50#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ 54#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
51 55
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 9e6d0d6debdb..1431ea0b59e0 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -4,17 +4,15 @@
4 4
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6 6
7#include <linux/const.h>
8
7/* PAGE_SHIFT determines the page size */ 9/* PAGE_SHIFT determines the page size */
8#ifndef CONFIG_SUN3 10#ifndef CONFIG_SUN3
9#define PAGE_SHIFT (12) 11#define PAGE_SHIFT (12)
10#else 12#else
11#define PAGE_SHIFT (13) 13#define PAGE_SHIFT (13)
12#endif 14#endif
13#ifdef __ASSEMBLY__ 15#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
14#define PAGE_SIZE (1 << PAGE_SHIFT)
15#else
16#define PAGE_SIZE (1UL << PAGE_SHIFT)
17#endif
18#define PAGE_MASK (~(PAGE_SIZE-1)) 16#define PAGE_MASK (~(PAGE_SIZE-1))
19 17
20#include <asm/setup.h> 18#include <asm/setup.h>
@@ -27,6 +25,8 @@
27 25
28#ifndef __ASSEMBLY__ 26#ifndef __ASSEMBLY__
29 27
28#include <linux/compiler.h>
29
30#include <asm/module.h> 30#include <asm/module.h>
31 31
32#define get_user_page(vaddr) __get_free_page(GFP_KERNEL) 32#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h
index 8455f778b601..4453ec379c5d 100644
--- a/include/asm-m68k/processor.h
+++ b/include/asm-m68k/processor.h
@@ -38,12 +38,8 @@ static inline void wrusp(unsigned long usp)
38#ifndef CONFIG_SUN3 38#ifndef CONFIG_SUN3
39#define TASK_SIZE (0xF0000000UL) 39#define TASK_SIZE (0xF0000000UL)
40#else 40#else
41#ifdef __ASSEMBLY__
42#define TASK_SIZE (0x0E000000)
43#else
44#define TASK_SIZE (0x0E000000UL) 41#define TASK_SIZE (0x0E000000UL)
45#endif 42#endif
46#endif
47 43
48/* This decides where the kernel will search for a free chunk of vm 44/* This decides where the kernel will search for a free chunk of vm
49 * space during mmap's. 45 * space during mmap's.
diff --git a/include/asm-m68k/termbits.h b/include/asm-m68k/termbits.h
index 0e520f328f53..8c14170996bb 100644
--- a/include/asm-m68k/termbits.h
+++ b/include/asm-m68k/termbits.h
@@ -141,6 +141,7 @@ struct ktermios {
141#define HUPCL 0002000 141#define HUPCL 0002000
142#define CLOCAL 0004000 142#define CLOCAL 0004000
143#define CBAUDEX 0010000 143#define CBAUDEX 0010000
144#define BOTHER 0010000
144#define B57600 0010001 145#define B57600 0010001
145#define B115200 0010002 146#define B115200 0010002
146#define B230400 0010003 147#define B230400 0010003
@@ -156,10 +157,12 @@ struct ktermios {
156#define B3000000 0010015 157#define B3000000 0010015
157#define B3500000 0010016 158#define B3500000 0010016
158#define B4000000 0010017 159#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate (not used) */ 160#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */ 161#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */ 162#define CRTSCTS 020000000000 /* flow control */
162 163
164#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
165
163/* c_lflag bits */ 166/* c_lflag bits */
164#define ISIG 0000001 167#define ISIG 0000001
165#define ICANON 0000002 168#define ICANON 0000002
diff --git a/include/asm-m68k/termios.h b/include/asm-m68k/termios.h
index 00edabd76168..0823032e4045 100644
--- a/include/asm-m68k/termios.h
+++ b/include/asm-m68k/termios.h
@@ -82,8 +82,10 @@ struct termio {
82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ 82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
83}) 83})
84 84
85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
88#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
87 89
88#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
89 91
diff --git a/include/asm-m68knommu/pgtable.h b/include/asm-m68knommu/pgtable.h
index e1e6a1d2333a..46251016e821 100644
--- a/include/asm-m68knommu/pgtable.h
+++ b/include/asm-m68knommu/pgtable.h
@@ -65,4 +65,6 @@ extern unsigned int kobjsize(const void *objp);
65#define VMALLOC_START 0 65#define VMALLOC_START 0
66#define VMALLOC_END 0xffffffff 66#define VMALLOC_END 0xffffffff
67 67
68#include <asm-generic/pgtable.h>
69
68#endif /* _M68KNOMMU_PGTABLE_H */ 70#endif /* _M68KNOMMU_PGTABLE_H */
diff --git a/include/asm-powerpc/reg_booke.h b/include/asm-powerpc/reg_booke.h
index 064405c207bf..8fdc2b47afb9 100644
--- a/include/asm-powerpc/reg_booke.h
+++ b/include/asm-powerpc/reg_booke.h
@@ -223,7 +223,6 @@
223#define MCSR_ICPERR 0x40000000UL /* I-Cache Parity Error */ 223#define MCSR_ICPERR 0x40000000UL /* I-Cache Parity Error */
224#define MCSR_DCP_PERR 0x20000000UL /* D-Cache Push Parity Error */ 224#define MCSR_DCP_PERR 0x20000000UL /* D-Cache Push Parity Error */
225#define MCSR_DCPERR 0x10000000UL /* D-Cache Parity Error */ 225#define MCSR_DCPERR 0x10000000UL /* D-Cache Parity Error */
226#define MCSR_GL_CI 0x00010000UL /* Guarded Load or Cache-Inhibited stwcx. */
227#define MCSR_BUS_IAERR 0x00000080UL /* Instruction Address Error */ 226#define MCSR_BUS_IAERR 0x00000080UL /* Instruction Address Error */
228#define MCSR_BUS_RAERR 0x00000040UL /* Read Address Error */ 227#define MCSR_BUS_RAERR 0x00000040UL /* Read Address Error */
229#define MCSR_BUS_WAERR 0x00000020UL /* Write Address Error */ 228#define MCSR_BUS_WAERR 0x00000020UL /* Write Address Error */
@@ -232,6 +231,12 @@
232#define MCSR_BUS_WBERR 0x00000004UL /* Write Data Bus Error */ 231#define MCSR_BUS_WBERR 0x00000004UL /* Write Data Bus Error */
233#define MCSR_BUS_IPERR 0x00000002UL /* Instruction parity Error */ 232#define MCSR_BUS_IPERR 0x00000002UL /* Instruction parity Error */
234#define MCSR_BUS_RPERR 0x00000001UL /* Read parity Error */ 233#define MCSR_BUS_RPERR 0x00000001UL /* Read parity Error */
234
235/* e500 parts may set unused bits in MCSR; mask these off */
236#define MCSR_MASK (MCSR_MCP | MCSR_ICPERR | MCSR_DCP_PERR | \
237 MCSR_DCPERR | MCSR_BUS_IAERR | MCSR_BUS_RAERR | \
238 MCSR_BUS_WAERR | MCSR_BUS_IBERR | MCSR_BUS_RBERR | \
239 MCSR_BUS_WBERR | MCSR_BUS_IPERR | MCSR_BUS_RPERR)
235#endif 240#endif
236#ifdef CONFIG_E200 241#ifdef CONFIG_E200
237#define MCSR_MCP 0x80000000UL /* Machine Check Input Pin */ 242#define MCSR_MCP 0x80000000UL /* Machine Check Input Pin */
@@ -243,6 +248,11 @@
243#define MCSR_BUS_DRERR 0x00000008UL /* Read Bus Error on data load */ 248#define MCSR_BUS_DRERR 0x00000008UL /* Read Bus Error on data load */
244#define MCSR_BUS_WRERR 0x00000004UL /* Write Bus Error on buffered 249#define MCSR_BUS_WRERR 0x00000004UL /* Write Bus Error on buffered
245 store or cache line push */ 250 store or cache line push */
251
252/* e200 parts may set unused bits in MCSR; mask these off */
253#define MCSR_MASK (MCSR_MCP | MCSR_CP_PERR | MCSR_CPERR | \
254 MCSR_EXCP_ERR | MCSR_BUS_IRERR | MCSR_BUS_DRERR | \
255 MCSR_BUS_WRERR)
246#endif 256#endif
247 257
248/* Bit definitions for the DBSR. */ 258/* Bit definitions for the DBSR. */
diff --git a/include/asm-s390/atomic.h b/include/asm-s390/atomic.h
index ea486952f778..2d184655bc5d 100644
--- a/include/asm-s390/atomic.h
+++ b/include/asm-s390/atomic.h
@@ -67,8 +67,17 @@ typedef struct {
67 67
68#endif /* __GNUC__ */ 68#endif /* __GNUC__ */
69 69
70#define atomic_read(v) ((v)->counter) 70static inline int atomic_read(const atomic_t *v)
71#define atomic_set(v,i) (((v)->counter) = (i)) 71{
72 barrier();
73 return v->counter;
74}
75
76static inline void atomic_set(atomic_t *v, int i)
77{
78 v->counter = i;
79 barrier();
80}
72 81
73static __inline__ int atomic_add_return(int i, atomic_t * v) 82static __inline__ int atomic_add_return(int i, atomic_t * v)
74{ 83{
@@ -182,8 +191,17 @@ typedef struct {
182 191
183#endif /* __GNUC__ */ 192#endif /* __GNUC__ */
184 193
185#define atomic64_read(v) ((v)->counter) 194static inline long long atomic64_read(const atomic64_t *v)
186#define atomic64_set(v,i) (((v)->counter) = (i)) 195{
196 barrier();
197 return v->counter;
198}
199
200static inline void atomic64_set(atomic64_t *v, long long i)
201{
202 v->counter = i;
203 barrier();
204}
187 205
188static __inline__ long long atomic64_add_return(long long i, atomic64_t * v) 206static __inline__ long long atomic64_add_return(long long i, atomic64_t * v)
189{ 207{
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index f738d2827582..1982fb344164 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -258,19 +258,6 @@ struct ciw {
258/* Sick revalidation of device. */ 258/* Sick revalidation of device. */
259#define CIO_REVALIDATE 0x0008 259#define CIO_REVALIDATE 0x0008
260 260
261struct diag210 {
262 __u16 vrdcdvno : 16; /* device number (input) */
263 __u16 vrdclen : 16; /* data block length (input) */
264 __u32 vrdcvcla : 8; /* virtual device class (output) */
265 __u32 vrdcvtyp : 8; /* virtual device type (output) */
266 __u32 vrdcvsta : 8; /* virtual device status (output) */
267 __u32 vrdcvfla : 8; /* virtual device flags (output) */
268 __u32 vrdcrccl : 8; /* real device class (output) */
269 __u32 vrdccrty : 8; /* real device type (output) */
270 __u32 vrdccrmd : 8; /* real device model (output) */
271 __u32 vrdccrft : 8; /* real device feature (output) */
272} __attribute__ ((packed,aligned(4)));
273
274struct ccw_dev_id { 261struct ccw_dev_id {
275 u8 ssid; 262 u8 ssid;
276 u16 devno; 263 u16 devno;
@@ -285,8 +272,6 @@ static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
285 return 0; 272 return 0;
286} 273}
287 274
288extern int diag210(struct diag210 *addr);
289
290extern void wait_cons_dev(void); 275extern void wait_cons_dev(void);
291 276
292extern void css_schedule_reprobe(void); 277extern void css_schedule_reprobe(void);
diff --git a/include/asm-s390/diag.h b/include/asm-s390/diag.h
new file mode 100644
index 000000000000..72b2e2f2d32d
--- /dev/null
+++ b/include/asm-s390/diag.h
@@ -0,0 +1,39 @@
1/*
2 * s390 diagnose functions
3 *
4 * Copyright IBM Corp. 2007
5 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
6 */
7
8#ifndef _ASM_S390_DIAG_H
9#define _ASM_S390_DIAG_H
10
11/*
12 * Diagnose 10: Release pages
13 */
14extern void diag10(unsigned long addr);
15
16/*
17 * Diagnose 14: Input spool file manipulation
18 */
19extern int diag14(unsigned long rx, unsigned long ry1, unsigned long subcode);
20
21/*
22 * Diagnose 210: Get information about a virtual device
23 */
24struct diag210 {
25 u16 vrdcdvno; /* device number (input) */
26 u16 vrdclen; /* data block length (input) */
27 u8 vrdcvcla; /* virtual device class (output) */
28 u8 vrdcvtyp; /* virtual device type (output) */
29 u8 vrdcvsta; /* virtual device status (output) */
30 u8 vrdcvfla; /* virtual device flags (output) */
31 u8 vrdcrccl; /* real device class (output) */
32 u8 vrdccrty; /* real device type (output) */
33 u8 vrdccrmd; /* real device model (output) */
34 u8 vrdccrft; /* real device feature (output) */
35} __attribute__((packed, aligned(4)));
36
37extern int diag210(struct diag210 *addr);
38
39#endif /* _ASM_S390_DIAG_H */
diff --git a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
index 56c8a6c80e2e..e45d3c9a4b7e 100644
--- a/include/asm-s390/pgalloc.h
+++ b/include/asm-s390/pgalloc.h
@@ -19,8 +19,6 @@
19 19
20#define check_pgt_cache() do {} while (0) 20#define check_pgt_cache() do {} while (0)
21 21
22extern void diag10(unsigned long addr);
23
24/* 22/*
25 * Page allocation orders. 23 * Page allocation orders.
26 */ 24 */
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 6f492ac3fa13..84fefdaa01a5 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -160,6 +160,25 @@ static inline void dma_sync_single_for_device(struct device *dev,
160 dma_sync_single(dev, dma_handle, size, dir); 160 dma_sync_single(dev, dma_handle, size, dir);
161} 161}
162 162
163static inline void dma_sync_single_range_for_cpu(struct device *dev,
164 dma_addr_t dma_handle,
165 unsigned long offset,
166 size_t size,
167 enum dma_data_direction direction)
168{
169 dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
170}
171
172static inline void dma_sync_single_range_for_device(struct device *dev,
173 dma_addr_t dma_handle,
174 unsigned long offset,
175 size_t size,
176 enum dma_data_direction direction)
177{
178 dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
179}
180
181
163static inline void dma_sync_sg_for_cpu(struct device *dev, 182static inline void dma_sync_sg_for_cpu(struct device *dev,
164 struct scatterlist *sg, int nelems, 183 struct scatterlist *sg, int nelems,
165 enum dma_data_direction dir) 184 enum dma_data_direction dir)
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index d505f357f819..de4309960207 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -141,6 +141,24 @@ static inline void dma_sync_single_for_device(struct device *dev,
141 dma_sync_single(dev, dma_handle, size, dir); 141 dma_sync_single(dev, dma_handle, size, dir);
142} 142}
143 143
144static inline void dma_sync_single_range_for_cpu(struct device *dev,
145 dma_addr_t dma_handle,
146 unsigned long offset,
147 size_t size,
148 enum dma_data_direction direction)
149{
150 dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
151}
152
153static inline void dma_sync_single_range_for_device(struct device *dev,
154 dma_addr_t dma_handle,
155 unsigned long offset,
156 size_t size,
157 enum dma_data_direction direction)
158{
159 dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
160}
161
144static inline void dma_sync_sg_for_cpu(struct device *dev, 162static inline void dma_sync_sg_for_cpu(struct device *dev,
145 struct scatterlist *sg, int nelems, 163 struct scatterlist *sg, int nelems,
146 enum dma_data_direction dir) 164 enum dma_data_direction dir)
diff --git a/include/asm-sparc/sbus.h b/include/asm-sparc/sbus.h
index d036e4419d79..27d076c46964 100644
--- a/include/asm-sparc/sbus.h
+++ b/include/asm-sparc/sbus.h
@@ -68,7 +68,6 @@ struct sbus_dev {
68/* This struct describes the SBus(s) found on this machine. */ 68/* This struct describes the SBus(s) found on this machine. */
69struct sbus_bus { 69struct sbus_bus {
70 struct of_device ofdev; 70 struct of_device ofdev;
71 void *iommu; /* Opaque IOMMU cookie */
72 struct sbus_dev *devices; /* Link to devices on this SBus */ 71 struct sbus_dev *devices; /* Link to devices on this SBus */
73 struct sbus_bus *next; /* next SBus, if more than one SBus */ 72 struct sbus_bus *next; /* next SBus, if more than one SBus */
74 int prom_node; /* PROM device tree node for this SBus */ 73 int prom_node; /* PROM device tree node for this SBus */
diff --git a/include/asm-sparc/sfp-machine.h b/include/asm-sparc/sfp-machine.h
index ecfc86a4a725..266a42b8f99f 100644
--- a/include/asm-sparc/sfp-machine.h
+++ b/include/asm-sparc/sfp-machine.h
@@ -203,4 +203,10 @@ extern struct task_struct *last_task_used_math;
203#define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex) 203#define FP_INHIBIT_RESULTS ((last_task_used_math->thread.fsr >> 23) & _fex)
204#endif 204#endif
205 205
206#ifdef CONFIG_SMP
207#define FP_TRAPPING_EXCEPTIONS ((current->thread.fsr >> 23) & 0x1f)
208#else
209#define FP_TRAPPING_EXCEPTIONS ((last_task_used_math->thread.fsr >> 23) & 0x1f)
210#endif
211
206#endif 212#endif
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index 303d85e2f82e..8653e8665009 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -70,6 +70,7 @@
70#define HWCAP_SPARC_V9 16 70#define HWCAP_SPARC_V9 16
71#define HWCAP_SPARC_ULTRA3 32 71#define HWCAP_SPARC_ULTRA3 32
72#define HWCAP_SPARC_BLKINIT 64 72#define HWCAP_SPARC_BLKINIT 64
73#define HWCAP_SPARC_N2 128
73 74
74/* 75/*
75 * These are used to set parameters in the core dumps. 76 * These are used to set parameters in the core dumps.
@@ -155,8 +156,13 @@ static inline unsigned int sparc64_elf_hwcap(void)
155 156
156 if (tlb_type == cheetah || tlb_type == cheetah_plus) 157 if (tlb_type == cheetah || tlb_type == cheetah_plus)
157 cap |= HWCAP_SPARC_ULTRA3; 158 cap |= HWCAP_SPARC_ULTRA3;
158 else if (tlb_type == hypervisor) 159 else if (tlb_type == hypervisor) {
159 cap |= HWCAP_SPARC_BLKINIT; 160 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
161 sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
162 cap |= HWCAP_SPARC_BLKINIT;
163 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2)
164 cap |= HWCAP_SPARC_N2;
165 }
160 166
161 return cap; 167 return cap;
162} 168}
diff --git a/include/asm-sparc64/percpu.h b/include/asm-sparc64/percpu.h
index caf8750792ff..a1f53a4da405 100644
--- a/include/asm-sparc64/percpu.h
+++ b/include/asm-sparc64/percpu.h
@@ -3,6 +3,8 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6register unsigned long __local_per_cpu_offset asm("g5");
7
6#ifdef CONFIG_SMP 8#ifdef CONFIG_SMP
7 9
8#define setup_per_cpu_areas() do { } while (0) 10#define setup_per_cpu_areas() do { } while (0)
@@ -23,8 +25,6 @@ extern unsigned long __per_cpu_shift;
23 __typeof__(type) per_cpu__##name \ 25 __typeof__(type) per_cpu__##name \
24 ____cacheline_aligned_in_smp 26 ____cacheline_aligned_in_smp
25 27
26register unsigned long __local_per_cpu_offset asm("g5");
27
28/* var is in discarded region: offset to particular copy we want */ 28/* var is in discarded region: offset to particular copy we want */
29#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu))) 29#define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
30#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset)) 30#define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __local_per_cpu_offset))
diff --git a/include/asm-sparc64/sfp-machine.h b/include/asm-sparc64/sfp-machine.h
index 89d42431efb5..c9331b02d9c8 100644
--- a/include/asm-sparc64/sfp-machine.h
+++ b/include/asm-sparc64/sfp-machine.h
@@ -88,4 +88,6 @@
88 88
89#define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex) 89#define FP_INHIBIT_RESULTS ((current_thread_info()->xfsr[0] >> 23) & _fex)
90 90
91#define FP_TRAPPING_EXCEPTIONS ((current_thread_info()->xfsr[0] >> 23) & 0x1f)
92
91#endif 93#endif
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 64891cb10f05..3f175fa7e6d2 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -141,7 +141,6 @@ do { \
141 * not preserve it's value. Hairy, but it lets us remove 2 loads 141 * not preserve it's value. Hairy, but it lets us remove 2 loads
142 * and 2 stores in this critical code path. -DaveM 142 * and 2 stores in this critical code path. -DaveM
143 */ 143 */
144#define EXTRA_CLOBBER ,"%l1"
145#define switch_to(prev, next, last) \ 144#define switch_to(prev, next, last) \
146do { if (test_thread_flag(TIF_PERFCTR)) { \ 145do { if (test_thread_flag(TIF_PERFCTR)) { \
147 unsigned long __tmp; \ 146 unsigned long __tmp; \
@@ -164,33 +163,34 @@ do { if (test_thread_flag(TIF_PERFCTR)) { \
164 "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ 163 "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \
165 "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ 164 "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \
166 "rdpr %%wstate, %%o5\n\t" \ 165 "rdpr %%wstate, %%o5\n\t" \
167 "stx %%o6, [%%g6 + %3]\n\t" \ 166 "stx %%o6, [%%g6 + %6]\n\t" \
168 "stb %%o5, [%%g6 + %2]\n\t" \
169 "rdpr %%cwp, %%o5\n\t" \
170 "stb %%o5, [%%g6 + %5]\n\t" \ 167 "stb %%o5, [%%g6 + %5]\n\t" \
171 "mov %1, %%g6\n\t" \ 168 "rdpr %%cwp, %%o5\n\t" \
172 "ldub [%1 + %5], %%g1\n\t" \ 169 "stb %%o5, [%%g6 + %8]\n\t" \
170 "mov %4, %%g6\n\t" \
171 "ldub [%4 + %8], %%g1\n\t" \
173 "wrpr %%g1, %%cwp\n\t" \ 172 "wrpr %%g1, %%cwp\n\t" \
174 "ldx [%%g6 + %3], %%o6\n\t" \ 173 "ldx [%%g6 + %6], %%o6\n\t" \
175 "ldub [%%g6 + %2], %%o5\n\t" \ 174 "ldub [%%g6 + %5], %%o5\n\t" \
176 "ldub [%%g6 + %4], %%o7\n\t" \ 175 "ldub [%%g6 + %7], %%o7\n\t" \
177 "wrpr %%o5, 0x0, %%wstate\n\t" \ 176 "wrpr %%o5, 0x0, %%wstate\n\t" \
178 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ 177 "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
179 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ 178 "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \
180 "ldx [%%g6 + %6], %%g4\n\t" \ 179 "ldx [%%g6 + %9], %%g4\n\t" \
181 "brz,pt %%o7, 1f\n\t" \ 180 "brz,pt %%o7, 1f\n\t" \
182 " mov %%g7, %0\n\t" \ 181 " mov %%g7, %0\n\t" \
183 "b,a ret_from_syscall\n\t" \ 182 "b,a ret_from_syscall\n\t" \
184 "1:\n\t" \ 183 "1:\n\t" \
185 : "=&r" (last) \ 184 : "=&r" (last), "=r" (current), "=r" (current_thread_info_reg), \
185 "=r" (__local_per_cpu_offset) \
186 : "0" (task_thread_info(next)), \ 186 : "0" (task_thread_info(next)), \
187 "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ 187 "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \
188 "i" (TI_CWP), "i" (TI_TASK) \ 188 "i" (TI_CWP), "i" (TI_TASK) \
189 : "cc", \ 189 : "cc", \
190 "g1", "g2", "g3", "g7", \ 190 "g1", "g2", "g3", "g7", \
191 "l2", "l3", "l4", "l5", "l6", "l7", \ 191 "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
192 "i0", "i1", "i2", "i3", "i4", "i5", \ 192 "i0", "i1", "i2", "i3", "i4", "i5", \
193 "o0", "o1", "o2", "o3", "o4", "o5", "o7" EXTRA_CLOBBER);\ 193 "o0", "o1", "o2", "o3", "o4", "o5", "o7"); \
194 /* If you fuck with this, update ret_from_syscall code too. */ \ 194 /* If you fuck with this, update ret_from_syscall code too. */ \
195 if (test_thread_flag(TIF_PERFCTR)) { \ 195 if (test_thread_flag(TIF_PERFCTR)) { \
196 write_pcr(current_thread_info()->pcr_reg); \ 196 write_pcr(current_thread_info()->pcr_reg); \
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
index 5fb3c0de5ccc..65b6acf3bb59 100644
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -64,11 +64,12 @@ extern int setup_nmi_watchdog(char *);
64 64
65extern atomic_t nmi_active; 65extern atomic_t nmi_active;
66extern unsigned int nmi_watchdog; 66extern unsigned int nmi_watchdog;
67#define NMI_DEFAULT -1 67#define NMI_DISABLED -1
68#define NMI_NONE 0 68#define NMI_NONE 0
69#define NMI_IO_APIC 1 69#define NMI_IO_APIC 1
70#define NMI_LOCAL_APIC 2 70#define NMI_LOCAL_APIC 2
71#define NMI_INVALID 3 71#define NMI_INVALID 3
72#define NMI_DEFAULT NMI_DISABLED
72 73
73struct ctl_table; 74struct ctl_table;
74struct file; 75struct file;
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 4bbd8601b8f0..d6579df8dadf 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -63,8 +63,8 @@
63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */ 63#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */ 64#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */ 65#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
66#define AUDIT_TTY_GET 1014 /* Get TTY auditing status */ 66#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
67#define AUDIT_TTY_SET 1015 /* Set TTY auditing status */ 67#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
68 68
69#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 69#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
70#define AUDIT_USER_AVC 1107 /* We filter this differently */ 70#define AUDIT_USER_AVC 1107 /* We filter this differently */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index d71d0121b7f9..c792b4fd1588 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1285,13 +1285,14 @@ void ide_init_sg_cmd(ide_drive_t *, struct request *);
1285#define BAD_DMA_DRIVE 0 1285#define BAD_DMA_DRIVE 0
1286#define GOOD_DMA_DRIVE 1 1286#define GOOD_DMA_DRIVE 1
1287 1287
1288#ifdef CONFIG_BLK_DEV_IDEDMA
1289struct drive_list_entry { 1288struct drive_list_entry {
1290 const char *id_model; 1289 const char *id_model;
1291 const char *id_firmware; 1290 const char *id_firmware;
1292}; 1291};
1293 1292
1294int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); 1293int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1294
1295#ifdef CONFIG_BLK_DEV_IDEDMA
1295int __ide_dma_bad_drive(ide_drive_t *); 1296int __ide_dma_bad_drive(ide_drive_t *);
1296int __ide_dma_good_drive(ide_drive_t *); 1297int __ide_dma_good_drive(ide_drive_t *);
1297u8 ide_max_dma_mode(ide_drive_t *); 1298u8 ide_max_dma_mode(ide_drive_t *);
@@ -1312,7 +1313,6 @@ void ide_dma_host_off(ide_drive_t *);
1312void ide_dma_off_quietly(ide_drive_t *); 1313void ide_dma_off_quietly(ide_drive_t *);
1313void ide_dma_host_on(ide_drive_t *); 1314void ide_dma_host_on(ide_drive_t *);
1314extern int __ide_dma_on(ide_drive_t *); 1315extern int __ide_dma_on(ide_drive_t *);
1315extern int __ide_dma_check(ide_drive_t *);
1316extern int ide_dma_setup(ide_drive_t *); 1316extern int ide_dma_setup(ide_drive_t *);
1317extern void ide_dma_start(ide_drive_t *); 1317extern void ide_dma_start(ide_drive_t *);
1318extern int __ide_dma_end(ide_drive_t *); 1318extern int __ide_dma_end(ide_drive_t *);
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 506ad20c18f8..8bdb16bfe5fb 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -161,4 +161,7 @@ static inline void con_schedule_flip(struct tty_struct *t)
161 schedule_delayed_work(&t->buf.work, 0); 161 schedule_delayed_work(&t->buf.work, 0);
162} 162}
163 163
164/* mac_hid.c */
165extern int mac_hid_mouse_emulate_buttons(int, unsigned int, int);
166
164#endif 167#endif
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index e147cf50529f..5bdd656e88cf 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -166,7 +166,7 @@ extern enum zone_type policy_zone;
166 166
167static inline void check_highest_zone(enum zone_type k) 167static inline void check_highest_zone(enum zone_type k)
168{ 168{
169 if (k > policy_zone) 169 if (k > policy_zone && k != ZONE_MOVABLE)
170 policy_zone = k; 170 policy_zone = k;
171} 171}
172 172
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 655094dc9440..1692dd6cb915 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1042,7 +1042,7 @@ static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
1042} 1042}
1043 1043
1044/* mmap.c */ 1044/* mmap.c */
1045extern int __vm_enough_memory(long pages, int cap_sys_admin); 1045extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin);
1046extern void vma_adjust(struct vm_area_struct *vma, unsigned long start, 1046extern void vma_adjust(struct vm_area_struct *vma, unsigned long start,
1047 unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert); 1047 unsigned long end, pgoff_t pgoff, struct vm_area_struct *insert);
1048extern struct vm_area_struct *vma_merge(struct mm_struct *, 1048extern struct vm_area_struct *vma_merge(struct mm_struct *,
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 3ea68cd3b61f..4e5627379b09 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -410,6 +410,24 @@ struct zonelist {
410#endif 410#endif
411}; 411};
412 412
413#ifdef CONFIG_NUMA
414/*
415 * Only custom zonelists like MPOL_BIND need to be filtered as part of
416 * policies. As described in the comment for struct zonelist_cache, these
417 * zonelists will not have a zlcache so zlcache_ptr will not be set. Use
418 * that to determine if the zonelists needs to be filtered or not.
419 */
420static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
421{
422 return !zonelist->zlcache_ptr;
423}
424#else
425static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
426{
427 return 0;
428}
429#endif /* CONFIG_NUMA */
430
413#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 431#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
414struct node_active_region { 432struct node_active_region {
415 unsigned long start_pfn; 433 unsigned long start_pfn;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 2ada8ee316b3..4dc5fa8be781 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -159,7 +159,8 @@ struct ap_device_id {
159 159
160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 160#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01
161 161
162#define ACPI_ID_LEN 9 162#define ACPI_ID_LEN 16 /* only 9 bytes needed here, 16 bytes are used */
163 /* to workaround crosscompile issues */
163 164
164struct acpi_device_id { 165struct acpi_device_id {
165 __u8 id[ACPI_ID_LEN]; 166 __u8 id[ACPI_ID_LEN];
diff --git a/include/linux/pci.h b/include/linux/pci.h
index e7d8d4e19a53..038a0dc7273a 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -557,6 +557,7 @@ int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask);
557int pcix_get_max_mmrbc(struct pci_dev *dev); 557int pcix_get_max_mmrbc(struct pci_dev *dev);
558int pcix_get_mmrbc(struct pci_dev *dev); 558int pcix_get_mmrbc(struct pci_dev *dev);
559int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 559int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
560int pcie_get_readrq(struct pci_dev *dev);
560int pcie_set_readrq(struct pci_dev *dev, int rq); 561int pcie_set_readrq(struct pci_dev *dev, int rq);
561void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 562void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
562int __must_check pci_assign_resource(struct pci_dev *dev, int i); 563int __must_check pci_assign_resource(struct pci_dev *dev, int i);
@@ -578,6 +579,9 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
578pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 579pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
579int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 580int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
580 581
582/* Functions for PCI Hotplug drivers to use */
583int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap);
584
581/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 585/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
582void pci_bus_assign_resources(struct pci_bus *bus); 586void pci_bus_assign_resources(struct pci_bus *bus);
583void pci_bus_size_bridges(struct pci_bus *bus); 587void pci_bus_size_bridges(struct pci_bus *bus);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 07fc57429b58..f77944e432f2 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -360,6 +360,9 @@
360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32 360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32
361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33 361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33
362#define PCI_DEVICE_ID_ATI_RS480 0x5950 362#define PCI_DEVICE_ID_ATI_RS480 0x5950
363#define PCI_DEVICE_ID_ATI_RD580 0x5952
364#define PCI_DEVICE_ID_ATI_RX790 0x5957
365#define PCI_DEVICE_ID_ATI_RS690 0x7910
363/* ATI IXP Chipset */ 366/* ATI IXP Chipset */
364#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 367#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349
365#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 368#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353
@@ -2092,8 +2095,10 @@
2092#define PCI_DEVICE_ID_MPC8568 0x0021 2095#define PCI_DEVICE_ID_MPC8568 0x0021
2093#define PCI_DEVICE_ID_MPC8567E 0x0022 2096#define PCI_DEVICE_ID_MPC8567E 0x0022
2094#define PCI_DEVICE_ID_MPC8567 0x0023 2097#define PCI_DEVICE_ID_MPC8567 0x0023
2095#define PCI_DEVICE_ID_MPC8544E 0x0030 2098#define PCI_DEVICE_ID_MPC8533E 0x0030
2096#define PCI_DEVICE_ID_MPC8544 0x0031 2099#define PCI_DEVICE_ID_MPC8533 0x0031
2100#define PCI_DEVICE_ID_MPC8544E 0x0032
2101#define PCI_DEVICE_ID_MPC8544 0x0033
2097#define PCI_DEVICE_ID_MPC8641 0x7010 2102#define PCI_DEVICE_ID_MPC8641 0x7010
2098#define PCI_DEVICE_ID_MPC8641D 0x7011 2103#define PCI_DEVICE_ID_MPC8641D 0x7011
2099 2104
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 682ef87da6eb..ba78807eab91 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -681,7 +681,7 @@ enum cpu_idle_type {
681#define SCHED_LOAD_SHIFT 10 681#define SCHED_LOAD_SHIFT 10
682#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT) 682#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT)
683 683
684#define SCHED_LOAD_SCALE_FUZZ (SCHED_LOAD_SCALE >> 1) 684#define SCHED_LOAD_SCALE_FUZZ SCHED_LOAD_SCALE
685 685
686#ifdef CONFIG_SMP 686#ifdef CONFIG_SMP
687#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */ 687#define SD_LOAD_BALANCE 1 /* Do load balancing on this domain. */
@@ -1388,7 +1388,8 @@ extern void sched_exec(void);
1388#define sched_exec() {} 1388#define sched_exec() {}
1389#endif 1389#endif
1390 1390
1391extern void sched_clock_unstable_event(void); 1391extern void sched_clock_idle_sleep_event(void);
1392extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1392 1393
1393#ifdef CONFIG_HOTPLUG_CPU 1394#ifdef CONFIG_HOTPLUG_CPU
1394extern void idle_task_exit(void); 1395extern void idle_task_exit(void);
diff --git a/include/linux/security.h b/include/linux/security.h
index c11dc8aa0351..1a15526e9f67 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -54,7 +54,7 @@ extern int cap_inode_removexattr(struct dentry *dentry, char *name);
54extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 54extern int cap_task_post_setuid (uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
55extern void cap_task_reparent_to_init (struct task_struct *p); 55extern void cap_task_reparent_to_init (struct task_struct *p);
56extern int cap_syslog (int type); 56extern int cap_syslog (int type);
57extern int cap_vm_enough_memory (long pages); 57extern int cap_vm_enough_memory (struct mm_struct *mm, long pages);
58 58
59struct msghdr; 59struct msghdr;
60struct sk_buff; 60struct sk_buff;
@@ -1125,6 +1125,7 @@ struct request_sock;
1125 * Return 0 if permission is granted. 1125 * Return 0 if permission is granted.
1126 * @vm_enough_memory: 1126 * @vm_enough_memory:
1127 * Check permissions for allocating a new virtual mapping. 1127 * Check permissions for allocating a new virtual mapping.
1128 * @mm contains the mm struct it is being added to.
1128 * @pages contains the number of pages. 1129 * @pages contains the number of pages.
1129 * Return 0 if permission is granted. 1130 * Return 0 if permission is granted.
1130 * 1131 *
@@ -1169,7 +1170,7 @@ struct security_operations {
1169 int (*quota_on) (struct dentry * dentry); 1170 int (*quota_on) (struct dentry * dentry);
1170 int (*syslog) (int type); 1171 int (*syslog) (int type);
1171 int (*settime) (struct timespec *ts, struct timezone *tz); 1172 int (*settime) (struct timespec *ts, struct timezone *tz);
1172 int (*vm_enough_memory) (long pages); 1173 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1173 1174
1174 int (*bprm_alloc_security) (struct linux_binprm * bprm); 1175 int (*bprm_alloc_security) (struct linux_binprm * bprm);
1175 void (*bprm_free_security) (struct linux_binprm * bprm); 1176 void (*bprm_free_security) (struct linux_binprm * bprm);
@@ -1469,10 +1470,14 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
1469 return security_ops->settime(ts, tz); 1470 return security_ops->settime(ts, tz);
1470} 1471}
1471 1472
1472
1473static inline int security_vm_enough_memory(long pages) 1473static inline int security_vm_enough_memory(long pages)
1474{ 1474{
1475 return security_ops->vm_enough_memory(pages); 1475 return security_ops->vm_enough_memory(current->mm, pages);
1476}
1477
1478static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
1479{
1480 return security_ops->vm_enough_memory(mm, pages);
1476} 1481}
1477 1482
1478static inline int security_bprm_alloc (struct linux_binprm *bprm) 1483static inline int security_bprm_alloc (struct linux_binprm *bprm)
@@ -2219,7 +2224,12 @@ static inline int security_settime(struct timespec *ts, struct timezone *tz)
2219 2224
2220static inline int security_vm_enough_memory(long pages) 2225static inline int security_vm_enough_memory(long pages)
2221{ 2226{
2222 return cap_vm_enough_memory(pages); 2227 return cap_vm_enough_memory(current->mm, pages);
2228}
2229
2230static inline int security_vm_enough_memory_mm(struct mm_struct *mm, long pages)
2231{
2232 return cap_vm_enough_memory(mm, pages);
2223} 2233}
2224 2234
2225static inline int security_bprm_alloc (struct linux_binprm *bprm) 2235static inline int security_bprm_alloc (struct linux_binprm *bprm)
diff --git a/include/linux/selection.h b/include/linux/selection.h
index ed3408b400f1..f9457861937c 100644
--- a/include/linux/selection.h
+++ b/include/linux/selection.h
@@ -10,6 +10,8 @@
10#include <linux/tiocl.h> 10#include <linux/tiocl.h>
11#include <linux/vt_buffer.h> 11#include <linux/vt_buffer.h>
12 12
13struct tty_struct;
14
13extern struct vc_data *sel_cons; 15extern struct vc_data *sel_cons;
14 16
15extern void clear_selection(void); 17extern void clear_selection(void);
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 1c5ed7d92b0f..96c0d93fc2ca 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -118,6 +118,7 @@
118#define UART_LSR_PE 0x04 /* Parity error indicator */ 118#define UART_LSR_PE 0x04 /* Parity error indicator */
119#define UART_LSR_OE 0x02 /* Overrun error indicator */ 119#define UART_LSR_OE 0x02 /* Overrun error indicator */
120#define UART_LSR_DR 0x01 /* Receiver data ready */ 120#define UART_LSR_DR 0x01 /* Receiver data ready */
121#define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */
121 122
122#define UART_MSR 6 /* In: Modem Status Register */ 123#define UART_MSR 6 /* In: Modem Status Register */
123#define UART_MSR_DCD 0x80 /* Data Carrier Detect */ 124#define UART_MSR_DCD 0x80 /* Data Carrier Detect */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index c66c8a3410b9..ae9b24c12f6a 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -617,7 +617,6 @@ struct v4l2_framebuffer
617#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 617#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
618#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 618#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
619#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 619#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
620#define V4L2_FBUF_CAP_GLOBAL_INV_ALPHA 0x0080
621/* Flags for the 'flags' field. */ 620/* Flags for the 'flags' field. */
622#define V4L2_FBUF_FLAG_PRIMARY 0x0001 621#define V4L2_FBUF_FLAG_PRIMARY 0x0001
623#define V4L2_FBUF_FLAG_OVERLAY 0x0002 622#define V4L2_FBUF_FLAG_OVERLAY 0x0002
@@ -625,7 +624,6 @@ struct v4l2_framebuffer
625#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 624#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
626#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 625#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
627#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 626#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
628#define V4L2_FBUF_FLAG_GLOBAL_INV_ALPHA 0x0040
629 627
630struct v4l2_clip 628struct v4l2_clip
631{ 629{
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index 93780abd01bc..bb46e7645d53 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -145,13 +145,16 @@ do { \
145 { \ 145 { \
146 X##_e = 1; \ 146 X##_e = 1; \
147 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \ 147 _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
148 FP_SET_EXCEPTION(FP_EX_INEXACT); \
148 } \ 149 } \
149 else \ 150 else \
150 { \ 151 { \
151 X##_e = 0; \ 152 X##_e = 0; \
152 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \ 153 _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
153 FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
154 } \ 154 } \
155 if ((FP_CUR_EXCEPTIONS & FP_EX_INEXACT) || \
156 (FP_TRAPPING_EXCEPTIONS & FP_EX_UNDERFLOW)) \
157 FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
155 } \ 158 } \
156 else \ 159 else \
157 { \ 160 { \
diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h
index d02eb64a865b..a6f873b45f98 100644
--- a/include/math-emu/soft-fp.h
+++ b/include/math-emu/soft-fp.h
@@ -97,12 +97,19 @@
97#define FP_INHIBIT_RESULTS 0 97#define FP_INHIBIT_RESULTS 0
98#endif 98#endif
99 99
100#ifndef FP_TRAPPING_EXCEPTIONS
101#define FP_TRAPPING_EXCEPTIONS 0
102#endif
103
100#define FP_SET_EXCEPTION(ex) \ 104#define FP_SET_EXCEPTION(ex) \
101 _fex |= (ex) 105 _fex |= (ex)
102 106
103#define FP_UNSET_EXCEPTION(ex) \ 107#define FP_UNSET_EXCEPTION(ex) \
104 _fex &= ~(ex) 108 _fex &= ~(ex)
105 109
110#define FP_CUR_EXCEPTIONS \
111 (_fex)
112
106#define FP_CLEAR_EXCEPTIONS \ 113#define FP_CLEAR_EXCEPTIONS \
107 _fex = 0 114 _fex = 0
108 115
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 30712ddd8a5e..8ec3799e42e1 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -39,6 +39,8 @@
39#if !defined( IB_MAD_H ) 39#if !defined( IB_MAD_H )
40#define IB_MAD_H 40#define IB_MAD_H
41 41
42#include <linux/list.h>
43
42#include <rdma/ib_verbs.h> 44#include <rdma/ib_verbs.h>
43 45
44/* Management base version */ 46/* Management base version */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0627a6aa282a..4bea182d7116 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -46,6 +46,8 @@
46#include <linux/mm.h> 46#include <linux/mm.h>
47#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
48#include <linux/kref.h> 48#include <linux/kref.h>
49#include <linux/list.h>
50#include <linux/rwsem.h>
49 51
50#include <asm/atomic.h> 52#include <asm/atomic.h>
51#include <asm/scatterlist.h> 53#include <asm/scatterlist.h>
@@ -731,11 +733,6 @@ struct ib_udata {
731 size_t outlen; 733 size_t outlen;
732}; 734};
733 735
734#define IB_UMEM_MAX_PAGE_CHUNK \
735 ((PAGE_SIZE - offsetof(struct ib_umem_chunk, page_list)) / \
736 ((void *) &((struct ib_umem_chunk *) 0)->page_list[1] - \
737 (void *) &((struct ib_umem_chunk *) 0)->page_list[0]))
738
739struct ib_pd { 736struct ib_pd {
740 struct ib_device *device; 737 struct ib_device *device;
741 struct ib_uobject *uobject; 738 struct ib_uobject *uobject;
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 3401293359e8..04f3ffb8d9d4 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2023,7 +2023,7 @@ int __audit_signal_info(int sig, struct task_struct *t)
2023 axp->d.next = ctx->aux_pids; 2023 axp->d.next = ctx->aux_pids;
2024 ctx->aux_pids = (void *)axp; 2024 ctx->aux_pids = (void *)axp;
2025 } 2025 }
2026 BUG_ON(axp->pid_count > AUDIT_AUX_PIDS); 2026 BUG_ON(axp->pid_count >= AUDIT_AUX_PIDS);
2027 2027
2028 axp->target_pid[axp->pid_count] = t->tgid; 2028 axp->target_pid[axp->pid_count] = t->tgid;
2029 selinux_get_task_sid(t, &axp->target_sid[axp->pid_count]); 2029 selinux_get_task_sid(t, &axp->target_sid[axp->pid_count]);
diff --git a/kernel/futex.c b/kernel/futex.c
index 3415e9ad1391..e8935b195e88 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1670,6 +1670,7 @@ pi_faulted:
1670 attempt); 1670 attempt);
1671 if (ret) 1671 if (ret)
1672 goto out; 1672 goto out;
1673 uval = 0;
1673 goto retry_unlocked; 1674 goto retry_unlocked;
1674 } 1675 }
1675 1676
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 203a518b6f14..853aefbd184b 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -462,7 +462,9 @@ void free_irq(unsigned int irq, void *dev_id)
462 * We do this after actually deregistering it, to make sure that 462 * We do this after actually deregistering it, to make sure that
463 * a 'real' IRQ doesn't run in parallel with our fake 463 * a 'real' IRQ doesn't run in parallel with our fake
464 */ 464 */
465 local_irq_save(flags);
465 handler(irq, dev_id); 466 handler(irq, dev_id);
467 local_irq_restore(flags);
466 } 468 }
467#endif 469#endif
468} 470}
diff --git a/kernel/module.c b/kernel/module.c
index 33c04ad51175..db0ead0363e2 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -784,8 +784,7 @@ EXPORT_SYMBOL_GPL(symbol_put_addr);
784static ssize_t show_refcnt(struct module_attribute *mattr, 784static ssize_t show_refcnt(struct module_attribute *mattr,
785 struct module *mod, char *buffer) 785 struct module *mod, char *buffer)
786{ 786{
787 /* sysfs holds a reference */ 787 return sprintf(buffer, "%u\n", module_refcount(mod));
788 return sprintf(buffer, "%u\n", module_refcount(mod)-1);
789} 788}
790 789
791static struct module_attribute refcnt = { 790static struct module_attribute refcnt = {
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 55b3761edaa9..7a15afb73ed0 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -547,9 +547,9 @@ sys_timer_create(const clockid_t which_clock,
547 new_timer->it_process = process; 547 new_timer->it_process = process;
548 list_add(&new_timer->list, 548 list_add(&new_timer->list,
549 &process->signal->posix_timers); 549 &process->signal->posix_timers);
550 spin_unlock_irqrestore(&process->sighand->siglock, flags);
551 if (new_timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID)) 550 if (new_timer->it_sigev_notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID))
552 get_task_struct(process); 551 get_task_struct(process);
552 spin_unlock_irqrestore(&process->sighand->siglock, flags);
553 } else { 553 } else {
554 spin_unlock_irqrestore(&process->sighand->siglock, flags); 554 spin_unlock_irqrestore(&process->sighand->siglock, flags);
555 process = NULL; 555 process = NULL;
@@ -605,13 +605,14 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)
605 timr = (struct k_itimer *) idr_find(&posix_timers_id, (int) timer_id); 605 timr = (struct k_itimer *) idr_find(&posix_timers_id, (int) timer_id);
606 if (timr) { 606 if (timr) {
607 spin_lock(&timr->it_lock); 607 spin_lock(&timr->it_lock);
608 spin_unlock(&idr_lock);
609 608
610 if ((timr->it_id != timer_id) || !(timr->it_process) || 609 if ((timr->it_id != timer_id) || !(timr->it_process) ||
611 timr->it_process->tgid != current->tgid) { 610 timr->it_process->tgid != current->tgid) {
612 unlock_timer(timr, *flags); 611 spin_unlock(&timr->it_lock);
612 spin_unlock_irqrestore(&idr_lock, *flags);
613 timr = NULL; 613 timr = NULL;
614 } 614 } else
615 spin_unlock(&idr_lock);
615 } else 616 } else
616 spin_unlock_irqrestore(&idr_lock, *flags); 617 spin_unlock_irqrestore(&idr_lock, *flags);
617 618
diff --git a/kernel/printk.c b/kernel/printk.c
index bd2cd062878d..8451dfc31d25 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1083,6 +1083,19 @@ int unregister_console(struct console *console)
1083} 1083}
1084EXPORT_SYMBOL(unregister_console); 1084EXPORT_SYMBOL(unregister_console);
1085 1085
1086static int __init disable_boot_consoles(void)
1087{
1088 if (console_drivers != NULL) {
1089 if (console_drivers->flags & CON_BOOT) {
1090 printk(KERN_INFO "turn off boot console %s%d\n",
1091 console_drivers->name, console_drivers->index);
1092 return unregister_console(console_drivers);
1093 }
1094 }
1095 return 0;
1096}
1097late_initcall(disable_boot_consoles);
1098
1086/** 1099/**
1087 * tty_write_message - write a message to a certain tty, not just the console. 1100 * tty_write_message - write a message to a certain tty, not just the console.
1088 * @tty: the destination tty_struct 1101 * @tty: the destination tty_struct
diff --git a/kernel/sched.c b/kernel/sched.c
index 45e17b83b7f1..96e9b82246d2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -262,7 +262,8 @@ struct rq {
262 s64 clock_max_delta; 262 s64 clock_max_delta;
263 263
264 unsigned int clock_warps, clock_overflows; 264 unsigned int clock_warps, clock_overflows;
265 unsigned int clock_unstable_events; 265 u64 idle_clock;
266 unsigned int clock_deep_idle_events;
266 u64 tick_timestamp; 267 u64 tick_timestamp;
267 268
268 atomic_t nr_iowait; 269 atomic_t nr_iowait;
@@ -556,18 +557,40 @@ static inline struct rq *this_rq_lock(void)
556} 557}
557 558
558/* 559/*
559 * CPU frequency is/was unstable - start new by setting prev_clock_raw: 560 * We are going deep-idle (irqs are disabled):
560 */ 561 */
561void sched_clock_unstable_event(void) 562void sched_clock_idle_sleep_event(void)
562{ 563{
563 unsigned long flags; 564 struct rq *rq = cpu_rq(smp_processor_id());
564 struct rq *rq;
565 565
566 rq = task_rq_lock(current, &flags); 566 spin_lock(&rq->lock);
567 rq->prev_clock_raw = sched_clock(); 567 __update_rq_clock(rq);
568 rq->clock_unstable_events++; 568 spin_unlock(&rq->lock);
569 task_rq_unlock(rq, &flags); 569 rq->clock_deep_idle_events++;
570} 570}
571EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event);
572
573/*
574 * We just idled delta nanoseconds (called with irqs disabled):
575 */
576void sched_clock_idle_wakeup_event(u64 delta_ns)
577{
578 struct rq *rq = cpu_rq(smp_processor_id());
579 u64 now = sched_clock();
580
581 rq->idle_clock += delta_ns;
582 /*
583 * Override the previous timestamp and ignore all
584 * sched_clock() deltas that occured while we idled,
585 * and use the PM-provided delta_ns to advance the
586 * rq clock:
587 */
588 spin_lock(&rq->lock);
589 rq->prev_clock_raw = now;
590 rq->clock += delta_ns;
591 spin_unlock(&rq->lock);
592}
593EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
571 594
572/* 595/*
573 * resched_task - mark a task 'to be rescheduled now'. 596 * resched_task - mark a task 'to be rescheduled now'.
@@ -2494,7 +2517,7 @@ group_next:
2494 * a think about bumping its value to force at least one task to be 2517 * a think about bumping its value to force at least one task to be
2495 * moved 2518 * moved
2496 */ 2519 */
2497 if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task/2) { 2520 if (*imbalance + SCHED_LOAD_SCALE_FUZZ < busiest_load_per_task) {
2498 unsigned long tmp, pwr_now, pwr_move; 2521 unsigned long tmp, pwr_now, pwr_move;
2499 unsigned int imbn; 2522 unsigned int imbn;
2500 2523
@@ -3020,6 +3043,7 @@ static inline void rebalance_domains(int cpu, enum cpu_idle_type idle)
3020 struct sched_domain *sd; 3043 struct sched_domain *sd;
3021 /* Earliest time when we have to do rebalance again */ 3044 /* Earliest time when we have to do rebalance again */
3022 unsigned long next_balance = jiffies + 60*HZ; 3045 unsigned long next_balance = jiffies + 60*HZ;
3046 int update_next_balance = 0;
3023 3047
3024 for_each_domain(cpu, sd) { 3048 for_each_domain(cpu, sd) {
3025 if (!(sd->flags & SD_LOAD_BALANCE)) 3049 if (!(sd->flags & SD_LOAD_BALANCE))
@@ -3056,8 +3080,10 @@ static inline void rebalance_domains(int cpu, enum cpu_idle_type idle)
3056 if (sd->flags & SD_SERIALIZE) 3080 if (sd->flags & SD_SERIALIZE)
3057 spin_unlock(&balancing); 3081 spin_unlock(&balancing);
3058out: 3082out:
3059 if (time_after(next_balance, sd->last_balance + interval)) 3083 if (time_after(next_balance, sd->last_balance + interval)) {
3060 next_balance = sd->last_balance + interval; 3084 next_balance = sd->last_balance + interval;
3085 update_next_balance = 1;
3086 }
3061 3087
3062 /* 3088 /*
3063 * Stop the load balance at this level. There is another 3089 * Stop the load balance at this level. There is another
@@ -3067,7 +3093,14 @@ out:
3067 if (!balance) 3093 if (!balance)
3068 break; 3094 break;
3069 } 3095 }
3070 rq->next_balance = next_balance; 3096
3097 /*
3098 * next_balance will be updated only when there is a need.
3099 * When the cpu is attached to null domain for ex, it will not be
3100 * updated.
3101 */
3102 if (likely(update_next_balance))
3103 rq->next_balance = next_balance;
3071} 3104}
3072 3105
3073/* 3106/*
@@ -4890,7 +4923,7 @@ static inline void sched_init_granularity(void)
4890 if (sysctl_sched_granularity > gran_limit) 4923 if (sysctl_sched_granularity > gran_limit)
4891 sysctl_sched_granularity = gran_limit; 4924 sysctl_sched_granularity = gran_limit;
4892 4925
4893 sysctl_sched_runtime_limit = sysctl_sched_granularity * 4; 4926 sysctl_sched_runtime_limit = sysctl_sched_granularity * 8;
4894 sysctl_sched_wakeup_granularity = sysctl_sched_granularity / 2; 4927 sysctl_sched_wakeup_granularity = sysctl_sched_granularity / 2;
4895} 4928}
4896 4929
@@ -5234,15 +5267,16 @@ static void migrate_dead_tasks(unsigned int dead_cpu)
5234static struct ctl_table sd_ctl_dir[] = { 5267static struct ctl_table sd_ctl_dir[] = {
5235 { 5268 {
5236 .procname = "sched_domain", 5269 .procname = "sched_domain",
5237 .mode = 0755, 5270 .mode = 0555,
5238 }, 5271 },
5239 {0,}, 5272 {0,},
5240}; 5273};
5241 5274
5242static struct ctl_table sd_ctl_root[] = { 5275static struct ctl_table sd_ctl_root[] = {
5243 { 5276 {
5277 .ctl_name = CTL_KERN,
5244 .procname = "kernel", 5278 .procname = "kernel",
5245 .mode = 0755, 5279 .mode = 0555,
5246 .child = sd_ctl_dir, 5280 .child = sd_ctl_dir,
5247 }, 5281 },
5248 {0,}, 5282 {0,},
@@ -5318,7 +5352,7 @@ static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
5318 for_each_domain(cpu, sd) { 5352 for_each_domain(cpu, sd) {
5319 snprintf(buf, 32, "domain%d", i); 5353 snprintf(buf, 32, "domain%d", i);
5320 entry->procname = kstrdup(buf, GFP_KERNEL); 5354 entry->procname = kstrdup(buf, GFP_KERNEL);
5321 entry->mode = 0755; 5355 entry->mode = 0555;
5322 entry->child = sd_alloc_ctl_domain_table(sd); 5356 entry->child = sd_alloc_ctl_domain_table(sd);
5323 entry++; 5357 entry++;
5324 i++; 5358 i++;
@@ -5338,7 +5372,7 @@ static void init_sched_domain_sysctl(void)
5338 for (i = 0; i < cpu_num; i++, entry++) { 5372 for (i = 0; i < cpu_num; i++, entry++) {
5339 snprintf(buf, 32, "cpu%d", i); 5373 snprintf(buf, 32, "cpu%d", i);
5340 entry->procname = kstrdup(buf, GFP_KERNEL); 5374 entry->procname = kstrdup(buf, GFP_KERNEL);
5341 entry->mode = 0755; 5375 entry->mode = 0555;
5342 entry->child = sd_alloc_ctl_cpu_table(i); 5376 entry->child = sd_alloc_ctl_cpu_table(i);
5343 } 5377 }
5344 sd_sysctl_header = register_sysctl_table(sd_ctl_root); 5378 sd_sysctl_header = register_sysctl_table(sd_ctl_root);
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index 87e524762b85..ab18f45f2ab2 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -154,10 +154,11 @@ static void print_cpu(struct seq_file *m, int cpu)
154 P(next_balance); 154 P(next_balance);
155 P(curr->pid); 155 P(curr->pid);
156 P(clock); 156 P(clock);
157 P(idle_clock);
157 P(prev_clock_raw); 158 P(prev_clock_raw);
158 P(clock_warps); 159 P(clock_warps);
159 P(clock_overflows); 160 P(clock_overflows);
160 P(clock_unstable_events); 161 P(clock_deep_idle_events);
161 P(clock_max_delta); 162 P(clock_max_delta);
162 P(cpu_load[0]); 163 P(cpu_load[0]);
163 P(cpu_load[1]); 164 P(cpu_load[1]);
diff --git a/kernel/signal.c b/kernel/signal.c
index b27c01a66448..ad63109e413c 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -378,7 +378,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
378 /* We only dequeue private signals from ourselves, we don't let 378 /* We only dequeue private signals from ourselves, we don't let
379 * signalfd steal them 379 * signalfd steal them
380 */ 380 */
381 if (tsk == current) 381 if (likely(tsk == current))
382 signr = __dequeue_signal(&tsk->pending, mask, info); 382 signr = __dequeue_signal(&tsk->pending, mask, info);
383 if (!signr) { 383 if (!signr) {
384 signr = __dequeue_signal(&tsk->signal->shared_pending, 384 signr = __dequeue_signal(&tsk->signal->shared_pending,
@@ -425,7 +425,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
425 if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT)) 425 if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT))
426 tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; 426 tsk->signal->flags |= SIGNAL_STOP_DEQUEUED;
427 } 427 }
428 if ( signr && 428 if (signr && likely(tsk == current) &&
429 ((info->si_code & __SI_MASK) == __SI_TIMER) && 429 ((info->si_code & __SI_MASK) == __SI_TIMER) &&
430 info->si_sys_private){ 430 info->si_sys_private){
431 /* 431 /*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8bdb8c07e04f..9029690f4fae 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -27,7 +27,6 @@
27#include <linux/capability.h> 27#include <linux/capability.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/utsname.h> 29#include <linux/utsname.h>
30#include <linux/capability.h>
31#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
32#include <linux/fs.h> 31#include <linux/fs.h>
33#include <linux/init.h> 32#include <linux/init.h>
diff --git a/lib/Kconfig b/lib/Kconfig
index e5c2c514174a..ba3d104994d9 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -138,4 +138,7 @@ config HAS_DMA
138 depends on !NO_DMA 138 depends on !NO_DMA
139 default y 139 default y
140 140
141config CHECK_SIGNATURE
142 bool
143
141endmenu 144endmenu
diff --git a/lib/Makefile b/lib/Makefile
index d9e5f1cd0bfb..6b0ba8cf4e5f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -21,7 +21,8 @@ CFLAGS_kobject_uevent.o += -DDEBUG
21endif 21endif
22 22
23obj-$(CONFIG_GENERIC_IOMAP) += iomap.o 23obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
24obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o check_signature.o 24obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
25obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
25obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o 26obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
26obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o 27obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock_debug.o
27lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o 28lib-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
diff --git a/lib/iomap.c b/lib/iomap.c
index a57d262a5ed9..864f2ec1966e 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -240,7 +240,20 @@ void ioport_unmap(void __iomem *addr)
240EXPORT_SYMBOL(ioport_map); 240EXPORT_SYMBOL(ioport_map);
241EXPORT_SYMBOL(ioport_unmap); 241EXPORT_SYMBOL(ioport_unmap);
242 242
243/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 243/**
244 * pci_iomap - create a virtual mapping cookie for a PCI BAR
245 * @dev: PCI device that owns the BAR
246 * @bar: BAR number
247 * @maxlen: length of the memory to map
248 *
249 * Using this function you will get a __iomem address to your device BAR.
250 * You can access it using ioread*() and iowrite*(). These functions hide
251 * the details if this is a MMIO or PIO address space and will just do what
252 * you expect from them in the correct way.
253 *
254 * @maxlen specifies the maximum length to map. If you want to get access to
255 * the complete BAR without checking for its length first, pass %0 here.
256 * */
244void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) 257void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
245{ 258{
246 unsigned long start = pci_resource_start(dev, bar); 259 unsigned long start = pci_resource_start(dev, bar);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index d7ca59d66c59..de4cf458d6e1 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -643,7 +643,7 @@ int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma,
643 spin_unlock(&mm->page_table_lock); 643 spin_unlock(&mm->page_table_lock);
644 ret = hugetlb_fault(mm, vma, vaddr, 0); 644 ret = hugetlb_fault(mm, vma, vaddr, 0);
645 spin_lock(&mm->page_table_lock); 645 spin_lock(&mm->page_table_lock);
646 if (!(ret & VM_FAULT_MAJOR)) 646 if (!(ret & VM_FAULT_ERROR))
647 continue; 647 continue;
648 648
649 remainder = 0; 649 remainder = 0;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 71b84b45154a..172abffeb2e3 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -149,7 +149,7 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes)
149 lower zones etc. Avoid empty zones because the memory allocator 149 lower zones etc. Avoid empty zones because the memory allocator
150 doesn't like them. If you implement node hot removal you 150 doesn't like them. If you implement node hot removal you
151 have to fix that. */ 151 have to fix that. */
152 k = policy_zone; 152 k = MAX_NR_ZONES - 1;
153 while (1) { 153 while (1) {
154 for_each_node_mask(nd, *nodes) { 154 for_each_node_mask(nd, *nodes) {
155 struct zone *z = &NODE_DATA(nd)->node_zones[k]; 155 struct zone *z = &NODE_DATA(nd)->node_zones[k];
diff --git a/mm/mmap.c b/mm/mmap.c
index b6537211b9cc..0d40e66c841b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -93,7 +93,7 @@ atomic_t vm_committed_space = ATOMIC_INIT(0);
93 * Note this is a helper function intended to be used by LSMs which 93 * Note this is a helper function intended to be used by LSMs which
94 * wish to use this logic. 94 * wish to use this logic.
95 */ 95 */
96int __vm_enough_memory(long pages, int cap_sys_admin) 96int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
97{ 97{
98 unsigned long free, allowed; 98 unsigned long free, allowed;
99 99
@@ -166,7 +166,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
166 166
167 /* Don't let a single process grow too big: 167 /* Don't let a single process grow too big:
168 leave 3% of the size of this process for other processes */ 168 leave 3% of the size of this process for other processes */
169 allowed -= current->mm->total_vm / 32; 169 allowed -= mm->total_vm / 32;
170 170
171 /* 171 /*
172 * cast `allowed' as a signed long because vm_committed_space 172 * cast `allowed' as a signed long because vm_committed_space
@@ -2077,7 +2077,7 @@ int insert_vm_struct(struct mm_struct * mm, struct vm_area_struct * vma)
2077 if (__vma && __vma->vm_start < vma->vm_end) 2077 if (__vma && __vma->vm_start < vma->vm_end)
2078 return -ENOMEM; 2078 return -ENOMEM;
2079 if ((vma->vm_flags & VM_ACCOUNT) && 2079 if ((vma->vm_flags & VM_ACCOUNT) &&
2080 security_vm_enough_memory(vma_pages(vma))) 2080 security_vm_enough_memory_mm(mm, vma_pages(vma)))
2081 return -ENOMEM; 2081 return -ENOMEM;
2082 vma_link(mm, vma, prev, rb_link, rb_parent); 2082 vma_link(mm, vma, prev, rb_link, rb_parent);
2083 return 0; 2083 return 0;
diff --git a/mm/nommu.c b/mm/nommu.c
index 9eef6a398555..8ed0cb43118a 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1270,7 +1270,7 @@ EXPORT_SYMBOL(get_unmapped_area);
1270 * Note this is a helper function intended to be used by LSMs which 1270 * Note this is a helper function intended to be used by LSMs which
1271 * wish to use this logic. 1271 * wish to use this logic.
1272 */ 1272 */
1273int __vm_enough_memory(long pages, int cap_sys_admin) 1273int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
1274{ 1274{
1275 unsigned long free, allowed; 1275 unsigned long free, allowed;
1276 1276
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3da85b81dabb..6427653023aa 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1157,6 +1157,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order,
1157 nodemask_t *allowednodes = NULL;/* zonelist_cache approximation */ 1157 nodemask_t *allowednodes = NULL;/* zonelist_cache approximation */
1158 int zlc_active = 0; /* set if using zonelist_cache */ 1158 int zlc_active = 0; /* set if using zonelist_cache */
1159 int did_zlc_setup = 0; /* just call zlc_setup() one time */ 1159 int did_zlc_setup = 0; /* just call zlc_setup() one time */
1160 enum zone_type highest_zoneidx = -1; /* Gets set for policy zonelists */
1160 1161
1161zonelist_scan: 1162zonelist_scan:
1162 /* 1163 /*
@@ -1166,6 +1167,18 @@ zonelist_scan:
1166 z = zonelist->zones; 1167 z = zonelist->zones;
1167 1168
1168 do { 1169 do {
1170 /*
1171 * In NUMA, this could be a policy zonelist which contains
1172 * zones that may not be allowed by the current gfp_mask.
1173 * Check the zone is allowed by the current flags
1174 */
1175 if (unlikely(alloc_should_filter_zonelist(zonelist))) {
1176 if (highest_zoneidx == -1)
1177 highest_zoneidx = gfp_zone(gfp_mask);
1178 if (zone_idx(*z) > highest_zoneidx)
1179 continue;
1180 }
1181
1169 if (NUMA_BUILD && zlc_active && 1182 if (NUMA_BUILD && zlc_active &&
1170 !zlc_zone_worth_trying(zonelist, z, allowednodes)) 1183 !zlc_zone_worth_trying(zonelist, z, allowednodes))
1171 continue; 1184 continue;
diff --git a/mm/slab.c b/mm/slab.c
index a684778b2b41..6f6abef83a1a 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -883,6 +883,7 @@ static void __slab_error(const char *function, struct kmem_cache *cachep,
883 */ 883 */
884 884
885static int use_alien_caches __read_mostly = 1; 885static int use_alien_caches __read_mostly = 1;
886static int numa_platform __read_mostly = 1;
886static int __init noaliencache_setup(char *s) 887static int __init noaliencache_setup(char *s)
887{ 888{
888 use_alien_caches = 0; 889 use_alien_caches = 0;
@@ -1399,8 +1400,10 @@ void __init kmem_cache_init(void)
1399 int order; 1400 int order;
1400 int node; 1401 int node;
1401 1402
1402 if (num_possible_nodes() == 1) 1403 if (num_possible_nodes() == 1) {
1403 use_alien_caches = 0; 1404 use_alien_caches = 0;
1405 numa_platform = 0;
1406 }
1404 1407
1405 for (i = 0; i < NUM_INIT_LISTS; i++) { 1408 for (i = 0; i < NUM_INIT_LISTS; i++) {
1406 kmem_list3_init(&initkmem_list3[i]); 1409 kmem_list3_init(&initkmem_list3[i]);
@@ -3558,7 +3561,14 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp)
3558 check_irq_off(); 3561 check_irq_off();
3559 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0)); 3562 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
3560 3563
3561 if (cache_free_alien(cachep, objp)) 3564 /*
3565 * Skip calling cache_free_alien() when the platform is not numa.
3566 * This will avoid cache misses that happen while accessing slabp (which
3567 * is per page memory reference) to get nodeid. Instead use a global
3568 * variable to skip the call, which is mostly likely to be present in
3569 * the cache.
3570 */
3571 if (numa_platform && cache_free_alien(cachep, objp))
3562 return; 3572 return;
3563 3573
3564 if (likely(ac->avail < ac->limit)) { 3574 if (likely(ac->avail < ac->limit)) {
diff --git a/mm/slub.c b/mm/slub.c
index 69d02e3e439e..04151da399c6 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1877,9 +1877,16 @@ static struct kmem_cache_node * __init early_kmem_cache_node_alloc(gfp_t gfpflag
1877 1877
1878 BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node)); 1878 BUG_ON(kmalloc_caches->size < sizeof(struct kmem_cache_node));
1879 1879
1880 page = new_slab(kmalloc_caches, gfpflags | GFP_THISNODE, node); 1880 page = new_slab(kmalloc_caches, gfpflags, node);
1881 1881
1882 BUG_ON(!page); 1882 BUG_ON(!page);
1883 if (page_to_nid(page) != node) {
1884 printk(KERN_ERR "SLUB: Unable to allocate memory from "
1885 "node %d\n", node);
1886 printk(KERN_ERR "SLUB: Allocating a useless per node structure "
1887 "in order to be able to continue\n");
1888 }
1889
1883 n = page->freelist; 1890 n = page->freelist;
1884 BUG_ON(!n); 1891 BUG_ON(!n);
1885 page->freelist = get_freepointer(kmalloc_caches, n); 1892 page->freelist = get_freepointer(kmalloc_caches, n);
@@ -3112,7 +3119,7 @@ static int list_locations(struct kmem_cache *s, char *buf,
3112 unsigned long flags; 3119 unsigned long flags;
3113 struct page *page; 3120 struct page *page;
3114 3121
3115 if (!atomic_read(&n->nr_slabs)) 3122 if (!atomic_long_read(&n->nr_slabs))
3116 continue; 3123 continue;
3117 3124
3118 spin_lock_irqsave(&n->list_lock, flags); 3125 spin_lock_irqsave(&n->list_lock, flags);
@@ -3247,7 +3254,7 @@ static unsigned long slab_objects(struct kmem_cache *s,
3247 } 3254 }
3248 3255
3249 if (flags & SO_FULL) { 3256 if (flags & SO_FULL) {
3250 int full_slabs = atomic_read(&n->nr_slabs) 3257 int full_slabs = atomic_long_read(&n->nr_slabs)
3251 - per_cpu[node] 3258 - per_cpu[node]
3252 - n->nr_partial; 3259 - n->nr_partial;
3253 3260
@@ -3283,7 +3290,7 @@ static int any_slab_objects(struct kmem_cache *s)
3283 for_each_node(node) { 3290 for_each_node(node) {
3284 struct kmem_cache_node *n = get_node(s, node); 3291 struct kmem_cache_node *n = get_node(s, node);
3285 3292
3286 if (n->nr_partial || atomic_read(&n->nr_slabs)) 3293 if (n->nr_partial || atomic_long_read(&n->nr_slabs))
3287 return 1; 3294 return 1;
3288 } 3295 }
3289 return 0; 3296 return 0;
diff --git a/mm/sparse.c b/mm/sparse.c
index 3047bf06c1f3..239f5a720d38 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -41,6 +41,15 @@ int page_to_nid(struct page *page)
41 return section_to_node_table[page_to_section(page)]; 41 return section_to_node_table[page_to_section(page)];
42} 42}
43EXPORT_SYMBOL(page_to_nid); 43EXPORT_SYMBOL(page_to_nid);
44
45static void set_section_nid(unsigned long section_nr, int nid)
46{
47 section_to_node_table[section_nr] = nid;
48}
49#else /* !NODE_NOT_IN_PAGE_FLAGS */
50static inline void set_section_nid(unsigned long section_nr, int nid)
51{
52}
44#endif 53#endif
45 54
46#ifdef CONFIG_SPARSEMEM_EXTREME 55#ifdef CONFIG_SPARSEMEM_EXTREME
@@ -68,10 +77,6 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
68 struct mem_section *section; 77 struct mem_section *section;
69 int ret = 0; 78 int ret = 0;
70 79
71#ifdef NODE_NOT_IN_PAGE_FLAGS
72 section_to_node_table[section_nr] = nid;
73#endif
74
75 if (mem_section[root]) 80 if (mem_section[root])
76 return -EEXIST; 81 return -EEXIST;
77 82
@@ -148,6 +153,7 @@ void __init memory_present(int nid, unsigned long start, unsigned long end)
148 struct mem_section *ms; 153 struct mem_section *ms;
149 154
150 sparse_index_init(section, nid); 155 sparse_index_init(section, nid);
156 set_section_nid(section, nid);
151 157
152 ms = __nr_to_section(section); 158 ms = __nr_to_section(section);
153 if (!ms->section_mem_map) 159 if (!ms->section_mem_map)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d419e10e3daa..a6e65d024995 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -271,6 +271,12 @@ static void handle_write_error(struct address_space *mapping,
271 unlock_page(page); 271 unlock_page(page);
272} 272}
273 273
274/* Request for sync pageout. */
275enum pageout_io {
276 PAGEOUT_IO_ASYNC,
277 PAGEOUT_IO_SYNC,
278};
279
274/* possible outcome of pageout() */ 280/* possible outcome of pageout() */
275typedef enum { 281typedef enum {
276 /* failed to write page out, page is locked */ 282 /* failed to write page out, page is locked */
@@ -287,7 +293,8 @@ typedef enum {
287 * pageout is called by shrink_page_list() for each dirty page. 293 * pageout is called by shrink_page_list() for each dirty page.
288 * Calls ->writepage(). 294 * Calls ->writepage().
289 */ 295 */
290static pageout_t pageout(struct page *page, struct address_space *mapping) 296static pageout_t pageout(struct page *page, struct address_space *mapping,
297 enum pageout_io sync_writeback)
291{ 298{
292 /* 299 /*
293 * If the page is dirty, only perform writeback if that write 300 * If the page is dirty, only perform writeback if that write
@@ -346,6 +353,15 @@ static pageout_t pageout(struct page *page, struct address_space *mapping)
346 ClearPageReclaim(page); 353 ClearPageReclaim(page);
347 return PAGE_ACTIVATE; 354 return PAGE_ACTIVATE;
348 } 355 }
356
357 /*
358 * Wait on writeback if requested to. This happens when
359 * direct reclaiming a large contiguous area and the
360 * first attempt to free a range of pages fails.
361 */
362 if (PageWriteback(page) && sync_writeback == PAGEOUT_IO_SYNC)
363 wait_on_page_writeback(page);
364
349 if (!PageWriteback(page)) { 365 if (!PageWriteback(page)) {
350 /* synchronous write or broken a_ops? */ 366 /* synchronous write or broken a_ops? */
351 ClearPageReclaim(page); 367 ClearPageReclaim(page);
@@ -423,7 +439,8 @@ cannot_free:
423 * shrink_page_list() returns the number of reclaimed pages 439 * shrink_page_list() returns the number of reclaimed pages
424 */ 440 */
425static unsigned long shrink_page_list(struct list_head *page_list, 441static unsigned long shrink_page_list(struct list_head *page_list,
426 struct scan_control *sc) 442 struct scan_control *sc,
443 enum pageout_io sync_writeback)
427{ 444{
428 LIST_HEAD(ret_pages); 445 LIST_HEAD(ret_pages);
429 struct pagevec freed_pvec; 446 struct pagevec freed_pvec;
@@ -458,8 +475,23 @@ static unsigned long shrink_page_list(struct list_head *page_list,
458 if (page_mapped(page) || PageSwapCache(page)) 475 if (page_mapped(page) || PageSwapCache(page))
459 sc->nr_scanned++; 476 sc->nr_scanned++;
460 477
461 if (PageWriteback(page)) 478 may_enter_fs = (sc->gfp_mask & __GFP_FS) ||
462 goto keep_locked; 479 (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO));
480
481 if (PageWriteback(page)) {
482 /*
483 * Synchronous reclaim is performed in two passes,
484 * first an asynchronous pass over the list to
485 * start parallel writeback, and a second synchronous
486 * pass to wait for the IO to complete. Wait here
487 * for any page for which writeback has already
488 * started.
489 */
490 if (sync_writeback == PAGEOUT_IO_SYNC && may_enter_fs)
491 wait_on_page_writeback(page);
492 else
493 goto keep_locked;
494 }
463 495
464 referenced = page_referenced(page, 1); 496 referenced = page_referenced(page, 1);
465 /* In active use or really unfreeable? Activate it. */ 497 /* In active use or really unfreeable? Activate it. */
@@ -478,8 +510,6 @@ static unsigned long shrink_page_list(struct list_head *page_list,
478#endif /* CONFIG_SWAP */ 510#endif /* CONFIG_SWAP */
479 511
480 mapping = page_mapping(page); 512 mapping = page_mapping(page);
481 may_enter_fs = (sc->gfp_mask & __GFP_FS) ||
482 (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO));
483 513
484 /* 514 /*
485 * The page is mapped into the page tables of one or more 515 * The page is mapped into the page tables of one or more
@@ -505,7 +535,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
505 goto keep_locked; 535 goto keep_locked;
506 536
507 /* Page is dirty, try to write it out here */ 537 /* Page is dirty, try to write it out here */
508 switch(pageout(page, mapping)) { 538 switch (pageout(page, mapping, sync_writeback)) {
509 case PAGE_KEEP: 539 case PAGE_KEEP:
510 goto keep_locked; 540 goto keep_locked;
511 case PAGE_ACTIVATE: 541 case PAGE_ACTIVATE:
@@ -777,6 +807,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
777 (sc->order > PAGE_ALLOC_COSTLY_ORDER)? 807 (sc->order > PAGE_ALLOC_COSTLY_ORDER)?
778 ISOLATE_BOTH : ISOLATE_INACTIVE); 808 ISOLATE_BOTH : ISOLATE_INACTIVE);
779 nr_active = clear_active_flags(&page_list); 809 nr_active = clear_active_flags(&page_list);
810 __count_vm_events(PGDEACTIVATE, nr_active);
780 811
781 __mod_zone_page_state(zone, NR_ACTIVE, -nr_active); 812 __mod_zone_page_state(zone, NR_ACTIVE, -nr_active);
782 __mod_zone_page_state(zone, NR_INACTIVE, 813 __mod_zone_page_state(zone, NR_INACTIVE,
@@ -785,7 +816,29 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
785 spin_unlock_irq(&zone->lru_lock); 816 spin_unlock_irq(&zone->lru_lock);
786 817
787 nr_scanned += nr_scan; 818 nr_scanned += nr_scan;
788 nr_freed = shrink_page_list(&page_list, sc); 819 nr_freed = shrink_page_list(&page_list, sc, PAGEOUT_IO_ASYNC);
820
821 /*
822 * If we are direct reclaiming for contiguous pages and we do
823 * not reclaim everything in the list, try again and wait
824 * for IO to complete. This will stall high-order allocations
825 * but that should be acceptable to the caller
826 */
827 if (nr_freed < nr_taken && !current_is_kswapd() &&
828 sc->order > PAGE_ALLOC_COSTLY_ORDER) {
829 congestion_wait(WRITE, HZ/10);
830
831 /*
832 * The attempt at page out may have made some
833 * of the pages active, mark them inactive again.
834 */
835 nr_active = clear_active_flags(&page_list);
836 count_vm_events(PGDEACTIVATE, nr_active);
837
838 nr_freed += shrink_page_list(&page_list, sc,
839 PAGEOUT_IO_SYNC);
840 }
841
789 nr_reclaimed += nr_freed; 842 nr_reclaimed += nr_freed;
790 local_irq_disable(); 843 local_irq_disable();
791 if (current_is_kswapd()) { 844 if (current_is_kswapd()) {
diff --git a/net/802/psnap.c b/net/802/psnap.c
index 04ee43e7538f..31128cb92a23 100644
--- a/net/802/psnap.c
+++ b/net/802/psnap.c
@@ -55,6 +55,9 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
55 .type = __constant_htons(ETH_P_SNAP), 55 .type = __constant_htons(ETH_P_SNAP),
56 }; 56 };
57 57
58 if (unlikely(!pskb_may_pull(skb, 5)))
59 goto drop;
60
58 rcu_read_lock(); 61 rcu_read_lock();
59 proto = find_snap_client(skb_transport_header(skb)); 62 proto = find_snap_client(skb_transport_header(skb));
60 if (proto) { 63 if (proto) {
@@ -62,14 +65,18 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
62 skb->transport_header += 5; 65 skb->transport_header += 5;
63 skb_pull_rcsum(skb, 5); 66 skb_pull_rcsum(skb, 5);
64 rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev); 67 rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
65 } else {
66 skb->sk = NULL;
67 kfree_skb(skb);
68 rc = 1;
69 } 68 }
70
71 rcu_read_unlock(); 69 rcu_read_unlock();
70
71 if (unlikely(!proto))
72 goto drop;
73
74out:
72 return rc; 75 return rc;
76
77drop:
78 kfree_skb(skb);
79 goto out;
73} 80}
74 81
75/* 82/*
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index c0040c9064a1..bd08aa090763 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -319,7 +319,7 @@ static int vlandev_seq_show(struct seq_file *seq, void *offset)
319 static const char fmt[] = "%30s %12lu\n"; 319 static const char fmt[] = "%30s %12lu\n";
320 int i; 320 int i;
321 321
322 if ((vlandev == NULL) || (!(vlandev->priv_flags & IFF_802_1Q_VLAN))) 322 if (!(vlandev->priv_flags & IFF_802_1Q_VLAN))
323 return 0; 323 return 0;
324 324
325 seq_printf(seq, "%s VID: %d REORDER_HDR: %i dev->priv_flags: %hx\n", 325 seq_printf(seq, "%s VID: %d REORDER_HDR: %i dev->priv_flags: %hx\n",
diff --git a/net/9p/conv.c b/net/9p/conv.c
index f2a041cb508a..d979d958ea19 100644
--- a/net/9p/conv.c
+++ b/net/9p/conv.c
@@ -796,6 +796,7 @@ struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count,
796 if (err) { 796 if (err) {
797 kfree(fc); 797 kfree(fc);
798 fc = ERR_PTR(err); 798 fc = ERR_PTR(err);
799 goto error;
799 } 800 }
800 801
801 if (buf_check_overflow(bufp)) { 802 if (buf_check_overflow(bufp)) {
diff --git a/net/9p/mux.c b/net/9p/mux.c
index acb038810f39..5d70558c4c61 100644
--- a/net/9p/mux.c
+++ b/net/9p/mux.c
@@ -288,9 +288,10 @@ struct p9_conn *p9_conn_create(struct p9_transport *trans, int msize,
288 m->extended = extended; 288 m->extended = extended;
289 m->trans = trans; 289 m->trans = trans;
290 m->tagpool = p9_idpool_create(); 290 m->tagpool = p9_idpool_create();
291 if (!m->tagpool) { 291 if (IS_ERR(m->tagpool)) {
292 mtmp = ERR_PTR(-ENOMEM);
292 kfree(m); 293 kfree(m);
293 return ERR_PTR(PTR_ERR(m->tagpool)); 294 return mtmp;
294 } 295 }
295 296
296 m->err = 0; 297 m->err = 0;
@@ -308,8 +309,10 @@ struct p9_conn *p9_conn_create(struct p9_transport *trans, int msize,
308 memset(&m->poll_waddr, 0, sizeof(m->poll_waddr)); 309 memset(&m->poll_waddr, 0, sizeof(m->poll_waddr));
309 m->poll_task = NULL; 310 m->poll_task = NULL;
310 n = p9_mux_poll_start(m); 311 n = p9_mux_poll_start(m);
311 if (n) 312 if (n) {
313 kfree(m);
312 return ERR_PTR(n); 314 return ERR_PTR(n);
315 }
313 316
314 n = trans->poll(trans, &m->pt); 317 n = trans->poll(trans, &m->pt);
315 if (n & POLLIN) { 318 if (n & POLLIN) {
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index 16be0c14780a..8443af57a374 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -69,7 +69,6 @@ void ax25_protocol_release(unsigned int pid)
69 if (protocol->pid == pid) { 69 if (protocol->pid == pid) {
70 protocol_list = protocol->next; 70 protocol_list = protocol->next;
71 write_unlock_bh(&protocol_list_lock); 71 write_unlock_bh(&protocol_list_lock);
72 kfree(protocol);
73 return; 72 return;
74 } 73 }
75 74
@@ -78,7 +77,6 @@ void ax25_protocol_release(unsigned int pid)
78 s = protocol->next; 77 s = protocol->next;
79 protocol->next = protocol->next->next; 78 protocol->next = protocol->next->next;
80 write_unlock_bh(&protocol_list_lock); 79 write_unlock_bh(&protocol_list_lock);
81 kfree(s);
82 return; 80 return;
83 } 81 }
84 82
diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 1ea2f86f7683..1a430eccec9b 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -132,7 +132,7 @@ static void br_stp_start(struct net_bridge *br)
132 } else { 132 } else {
133 br->stp_enabled = BR_KERNEL_STP; 133 br->stp_enabled = BR_KERNEL_STP;
134 printk(KERN_INFO "%s: starting userspace STP failed, " 134 printk(KERN_INFO "%s: starting userspace STP failed, "
135 "staring kernel STP\n", br->dev->name); 135 "starting kernel STP\n", br->dev->name);
136 136
137 /* To start timers on any ports left in blocking */ 137 /* To start timers on any ports left in blocking */
138 spin_lock_bh(&br->lock); 138 spin_lock_bh(&br->lock);
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 4f42263e0a8a..c65f54e0e27f 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -147,20 +147,27 @@ static ssize_t show_stp_state(struct device *d,
147 return sprintf(buf, "%d\n", br->stp_enabled); 147 return sprintf(buf, "%d\n", br->stp_enabled);
148} 148}
149 149
150static void set_stp_state(struct net_bridge *br, unsigned long val)
151{
152 rtnl_lock();
153 spin_unlock_bh(&br->lock);
154 br_stp_set_enabled(br, val);
155 spin_lock_bh(&br->lock);
156 rtnl_unlock();
157}
158 150
159static ssize_t store_stp_state(struct device *d, 151static ssize_t store_stp_state(struct device *d,
160 struct device_attribute *attr, const char *buf, 152 struct device_attribute *attr, const char *buf,
161 size_t len) 153 size_t len)
162{ 154{
163 return store_bridge_parm(d, buf, len, set_stp_state); 155 struct net_bridge *br = to_bridge(d);
156 char *endp;
157 unsigned long val;
158
159 if (!capable(CAP_NET_ADMIN))
160 return -EPERM;
161
162 val = simple_strtoul(buf, &endp, 0);
163 if (endp == buf)
164 return -EINVAL;
165
166 rtnl_lock();
167 br_stp_set_enabled(br, val);
168 rtnl_unlock();
169
170 return len;
164} 171}
165static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state, 172static DEVICE_ATTR(stp_state, S_IRUGO | S_IWUSR, show_stp_state,
166 store_stp_state); 173 store_stp_state);
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2ab0a60046a5..c5e059352d43 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -948,7 +948,6 @@ int dev_ethtool(struct ifreq *ifr)
948 return rc; 948 return rc;
949} 949}
950 950
951EXPORT_SYMBOL(dev_ethtool);
952EXPORT_SYMBOL(ethtool_op_get_link); 951EXPORT_SYMBOL(ethtool_op_get_link);
953EXPORT_SYMBOL(ethtool_op_get_sg); 952EXPORT_SYMBOL(ethtool_op_get_sg);
954EXPORT_SYMBOL(ethtool_op_get_tso); 953EXPORT_SYMBOL(ethtool_op_get_tso);
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index 248d20f4c7c4..d29b88fe723c 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -298,7 +298,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len)
298 int rc; 298 int rc;
299 299
300 ccid2_pr_debug("allocating more space in history\n"); 300 ccid2_pr_debug("allocating more space in history\n");
301 rc = ccid2_hc_tx_alloc_seq(hctx, CCID2_SEQBUF_LEN, GFP_KERNEL); 301 rc = ccid2_hc_tx_alloc_seq(hctx, CCID2_SEQBUF_LEN, gfp_any());
302 BUG_ON(rc); /* XXX what do we do? */ 302 BUG_ON(rc); /* XXX what do we do? */
303 303
304 next = hctx->ccid2hctx_seqh->ccid2s_next; 304 next = hctx->ccid2hctx_seqh->ccid2s_next;
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index b5524f32ac2d..35c96bcc0f32 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -1146,6 +1146,9 @@ static void __exit econet_proto_exit(void)
1146 sock_release(udpsock); 1146 sock_release(udpsock);
1147#endif 1147#endif
1148 unregister_netdevice_notifier(&econet_netdev_notifier); 1148 unregister_netdevice_notifier(&econet_netdev_notifier);
1149#ifdef CONFIG_ECONET_NATIVE
1150 dev_remove_pack(&econet_packet_type);
1151#endif
1149 sock_unregister(econet_family_ops.family); 1152 sock_unregister(econet_family_ops.family);
1150 proto_unregister(&econet_proto); 1153 proto_unregister(&econet_proto);
1151} 1154}
diff --git a/net/ipv4/netfilter/nf_nat_sip.c b/net/ipv4/netfilter/nf_nat_sip.c
index a889ec3ec83a..e14d41976c27 100644
--- a/net/ipv4/netfilter/nf_nat_sip.c
+++ b/net/ipv4/netfilter/nf_nat_sip.c
@@ -104,7 +104,7 @@ static unsigned int ip_nat_sip(struct sk_buff **pskb,
104 dataoff = ip_hdrlen(*pskb) + sizeof(struct udphdr); 104 dataoff = ip_hdrlen(*pskb) + sizeof(struct udphdr);
105 datalen = (*pskb)->len - dataoff; 105 datalen = (*pskb)->len - dataoff;
106 if (datalen < sizeof("SIP/2.0") - 1) 106 if (datalen < sizeof("SIP/2.0") - 1)
107 return NF_DROP; 107 return NF_ACCEPT;
108 108
109 addr_map_init(ct, &map); 109 addr_map_init(ct, &map);
110 110
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 50d86e94d9ed..5dead399fe64 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -794,7 +794,7 @@ slow_path:
794 /* 794 /*
795 * Copy a block of the IP datagram. 795 * Copy a block of the IP datagram.
796 */ 796 */
797 if (skb_copy_bits(skb, ptr, skb_transport_header(skb), len)) 797 if (skb_copy_bits(skb, ptr, skb_transport_header(frag), len))
798 BUG(); 798 BUG();
799 left -= len; 799 left -= len;
800 800
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index d6846393182d..761a910f4f97 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -820,7 +820,7 @@ static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
820 return 0; 820 return 0;
821 821
822 len = min_t(unsigned int, len, ipv6_optlen(hdr)); 822 len = min_t(unsigned int, len, ipv6_optlen(hdr));
823 if (copy_to_user(optval, hdr, len)); 823 if (copy_to_user(optval, hdr, len))
824 return -EFAULT; 824 return -EFAULT;
825 return ipv6_optlen(hdr); 825 return ipv6_optlen(hdr);
826} 826}
diff --git a/net/irda/irmod.c b/net/irda/irmod.c
index 1900937b3328..8ba703da2797 100644
--- a/net/irda/irmod.c
+++ b/net/irda/irmod.c
@@ -128,8 +128,8 @@ static int __init irda_init(void)
128 out_err_3: 128 out_err_3:
129#ifdef CONFIG_SYSCTL 129#ifdef CONFIG_SYSCTL
130 irda_sysctl_unregister(); 130 irda_sysctl_unregister();
131#endif
132 out_err_2: 131 out_err_2:
132#endif
133#ifdef CONFIG_PROC_FS 133#ifdef CONFIG_PROC_FS
134 irda_proc_unregister(); 134 irda_proc_unregister();
135#endif 135#endif
diff --git a/net/irda/irnetlink.c b/net/irda/irnetlink.c
index 694ea4d92fa8..1e429c929739 100644
--- a/net/irda/irnetlink.c
+++ b/net/irda/irnetlink.c
@@ -106,7 +106,7 @@ static int irda_nl_get_mode(struct sk_buff *skb, struct genl_info *info)
106 } 106 }
107 107
108 if(nla_put_string(msg, IRDA_NL_ATTR_IFNAME, 108 if(nla_put_string(msg, IRDA_NL_ATTR_IFNAME,
109 dev->name)); 109 dev->name))
110 goto err_out; 110 goto err_out;
111 111
112 if(nla_put_u32(msg, IRDA_NL_ATTR_MODE, irlap->mode)) 112 if(nla_put_u32(msg, IRDA_NL_ATTR_MODE, irlap->mode))
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 8ec5ed192b5d..7286c389a4d0 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -4678,7 +4678,6 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
4678 memset(skb->cb, 0, sizeof(skb->cb)); 4678 memset(skb->cb, 0, sizeof(skb->cb));
4679 netif_rx(skb); 4679 netif_rx(skb);
4680 skb = skb2; 4680 skb = skb2;
4681 break;
4682 } 4681 }
4683 } 4682 }
4684 out: 4683 out:
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 7ba352e3ffe0..0d99b685df5f 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -2154,7 +2154,11 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2154 return 0; 2154 return 0;
2155 } else { 2155 } else {
2156 if (ifsta->state != IEEE80211_AUTHENTICATE) { 2156 if (ifsta->state != IEEE80211_AUTHENTICATE) {
2157 ieee80211_sta_start_scan(dev, NULL, 0); 2157 if (ifsta->auto_ssid_sel)
2158 ieee80211_sta_start_scan(dev, NULL, 0);
2159 else
2160 ieee80211_sta_start_scan(dev, ifsta->ssid,
2161 ifsta->ssid_len);
2158 ifsta->state = IEEE80211_AUTHENTICATE; 2162 ifsta->state = IEEE80211_AUTHENTICATE;
2159 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request); 2163 set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
2160 } else 2164 } else
diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index 1276a442f10c..d449fa47491c 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -295,6 +295,7 @@ static int epaddr_len(struct nf_conn *ct, const char *dptr,
295static int skp_epaddr_len(struct nf_conn *ct, const char *dptr, 295static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
296 const char *limit, int *shift) 296 const char *limit, int *shift)
297{ 297{
298 const char *start = dptr;
298 int s = *shift; 299 int s = *shift;
299 300
300 /* Search for @, but stop at the end of the line. 301 /* Search for @, but stop at the end of the line.
@@ -309,8 +310,10 @@ static int skp_epaddr_len(struct nf_conn *ct, const char *dptr,
309 if (dptr <= limit && *dptr == '@') { 310 if (dptr <= limit && *dptr == '@') {
310 dptr++; 311 dptr++;
311 (*shift)++; 312 (*shift)++;
312 } else 313 } else {
314 dptr = start;
313 *shift = s; 315 *shift = s;
316 }
314 317
315 return epaddr_len(ct, dptr, limit, shift); 318 return epaddr_len(ct, dptr, limit, shift);
316} 319}
@@ -330,7 +333,8 @@ int ct_sip_get_info(struct nf_conn *ct,
330 333
331 while (dptr <= limit) { 334 while (dptr <= limit) {
332 if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) && 335 if ((strncmp(dptr, hnfo->lname, hnfo->lnlen) != 0) &&
333 (strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) { 336 (hnfo->sname == NULL ||
337 strncmp(dptr, hnfo->sname, hnfo->snlen) != 0)) {
334 dptr++; 338 dptr++;
335 continue; 339 continue;
336 } 340 }
diff --git a/net/netfilter/xt_u32.c b/net/netfilter/xt_u32.c
index 74f9b14c012f..bec427915b30 100644
--- a/net/netfilter/xt_u32.c
+++ b/net/netfilter/xt_u32.c
@@ -36,7 +36,7 @@ static bool u32_match_it(const struct xt_u32 *data,
36 at = 0; 36 at = 0;
37 pos = ct->location[0].number; 37 pos = ct->location[0].number;
38 38
39 if (skb->len < 4 || pos > skb->len - 4); 39 if (skb->len < 4 || pos > skb->len - 4)
40 return false; 40 return false;
41 41
42 ret = skb_copy_bits(skb, pos, &n, sizeof(n)); 42 ret = skb_copy_bits(skb, pos, &n, sizeof(n));
diff --git a/net/socket.c b/net/socket.c
index ec077037f534..7d44453dfae1 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1168,7 +1168,7 @@ static int __sock_create(int family, int type, int protocol,
1168 module_put(pf->owner); 1168 module_put(pf->owner);
1169 err = security_socket_post_create(sock, family, type, protocol, kern); 1169 err = security_socket_post_create(sock, family, type, protocol, kern);
1170 if (err) 1170 if (err)
1171 goto out_release; 1171 goto out_sock_release;
1172 *res = sock; 1172 *res = sock;
1173 1173
1174 return 0; 1174 return 0;
diff --git a/security/commoncap.c b/security/commoncap.c
index 338606eb7238..7520361663e8 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -315,13 +315,13 @@ int cap_syslog (int type)
315 return 0; 315 return 0;
316} 316}
317 317
318int cap_vm_enough_memory(long pages) 318int cap_vm_enough_memory(struct mm_struct *mm, long pages)
319{ 319{
320 int cap_sys_admin = 0; 320 int cap_sys_admin = 0;
321 321
322 if (cap_capable(current, CAP_SYS_ADMIN) == 0) 322 if (cap_capable(current, CAP_SYS_ADMIN) == 0)
323 cap_sys_admin = 1; 323 cap_sys_admin = 1;
324 return __vm_enough_memory(pages, cap_sys_admin); 324 return __vm_enough_memory(mm, pages, cap_sys_admin);
325} 325}
326 326
327EXPORT_SYMBOL(cap_capable); 327EXPORT_SYMBOL(cap_capable);
diff --git a/security/dummy.c b/security/dummy.c
index 19d813d5e083..853ec2292798 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -108,13 +108,13 @@ static int dummy_settime(struct timespec *ts, struct timezone *tz)
108 return 0; 108 return 0;
109} 109}
110 110
111static int dummy_vm_enough_memory(long pages) 111static int dummy_vm_enough_memory(struct mm_struct *mm, long pages)
112{ 112{
113 int cap_sys_admin = 0; 113 int cap_sys_admin = 0;
114 114
115 if (dummy_capable(current, CAP_SYS_ADMIN) == 0) 115 if (dummy_capable(current, CAP_SYS_ADMIN) == 0)
116 cap_sys_admin = 1; 116 cap_sys_admin = 1;
117 return __vm_enough_memory(pages, cap_sys_admin); 117 return __vm_enough_memory(mm, pages, cap_sys_admin);
118} 118}
119 119
120static int dummy_bprm_alloc_security (struct linux_binprm *bprm) 120static int dummy_bprm_alloc_security (struct linux_binprm *bprm)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 6237933f7d82..d8bc4172819c 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1584,7 +1584,7 @@ static int selinux_syslog(int type)
1584 * Do not audit the selinux permission check, as this is applied to all 1584 * Do not audit the selinux permission check, as this is applied to all
1585 * processes that allocate mappings. 1585 * processes that allocate mappings.
1586 */ 1586 */
1587static int selinux_vm_enough_memory(long pages) 1587static int selinux_vm_enough_memory(struct mm_struct *mm, long pages)
1588{ 1588{
1589 int rc, cap_sys_admin = 0; 1589 int rc, cap_sys_admin = 0;
1590 struct task_security_struct *tsec = current->security; 1590 struct task_security_struct *tsec = current->security;
@@ -1600,7 +1600,7 @@ static int selinux_vm_enough_memory(long pages)
1600 if (rc == 0) 1600 if (rc == 0)
1601 cap_sys_admin = 1; 1601 cap_sys_admin = 1;
1602 1602
1603 return __vm_enough_memory(pages, cap_sys_admin); 1603 return __vm_enough_memory(mm, pages, cap_sys_admin);
1604} 1604}
1605 1605
1606/* binprm security operations */ 1606/* binprm security operations */
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index f00161ef99ed..6100fc023055 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2127,7 +2127,7 @@ int selinux_audit_rule_init(u32 field, u32 op, char *rulestr,
2127 *rule = NULL; 2127 *rule = NULL;
2128 2128
2129 if (!ss_initialized) 2129 if (!ss_initialized)
2130 return -ENOTSUPP; 2130 return -EOPNOTSUPP;
2131 2131
2132 switch (field) { 2132 switch (field) {
2133 case AUDIT_SUBJ_USER: 2133 case AUDIT_SUBJ_USER: