aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-05-15 20:19:52 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-15 20:19:52 -0400
commit18594822fcb01d4b35e05b9018f770a0b4156d1a (patch)
tree38d35c38086a564beaac215f8e52694cdbfab1c3
parent5b5ffbc1e6d62d89747f3f59c09b2e488a7d7fce (diff)
parentc4694c76ce28dd7e415b4f3014d8c6e580b5f3d2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r--CREDITS19
-rw-r--r--Documentation/devices.txt5
-rw-r--r--Documentation/memory-barriers.txt4
-rw-r--r--Documentation/networking/operstates.txt161
-rw-r--r--Documentation/scsi/ChangeLog.megaraid25
-rw-r--r--MAINTAINERS12
-rw-r--r--Makefile22
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/boot/compressed/misc.c4
-rw-r--r--arch/arm/configs/collie_defconfig430
-rw-r--r--arch/arm/configs/versatile_defconfig390
-rw-r--r--arch/arm/kernel/asm-offsets.c6
-rw-r--r--arch/arm/kernel/head-nommu.S4
-rw-r--r--arch/arm/kernel/head.S8
-rw-r--r--arch/arm/kernel/process.c37
-rw-r--r--arch/arm/mach-aaec2000/aaed2000.c7
-rw-r--r--arch/arm/mach-aaec2000/core.c5
-rw-r--r--arch/arm/mach-aaec2000/core.h1
-rw-r--r--arch/arm/mach-imx/generic.c52
-rw-r--r--arch/arm/mach-imx/mx1ads.c76
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig15
-rw-r--r--arch/arm/mach-ixp4xx/Makefile3
-rw-r--r--arch/arm/mach-pxa/dma.c17
-rw-r--r--arch/arm/mach-sa1100/irq.c16
-rw-r--r--arch/arm/tools/mach-types89
-rw-r--r--arch/arm/vfp/vfpmodule.c2
-rw-r--r--arch/i386/Kconfig6
-rw-r--r--arch/i386/kernel/acpi/boot.c6
-rw-r--r--arch/i386/kernel/io_apic.c5
-rw-r--r--arch/i386/kernel/mpparse.c12
-rw-r--r--arch/i386/kernel/setup.c2
-rw-r--r--arch/i386/oprofile/nmi_int.c7
-rw-r--r--arch/ia64/lib/memcpy_mck.S9
-rw-r--r--arch/powerpc/kernel/kprobes.c14
-rw-r--r--arch/powerpc/kernel/prom.c70
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c8
-rw-r--r--arch/ppc/kernel/head_8xx.S4
-rw-r--r--arch/ppc/platforms/mpc866ads_setup.c2
-rw-r--r--arch/s390/kernel/compat_wrapper.S8
-rw-r--r--arch/s390/kernel/syscalls.S1
-rw-r--r--arch/s390/kernel/time.c7
-rw-r--r--arch/sparc/kernel/ioport.c5
-rw-r--r--arch/sparc/kernel/module.c1
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c13
-rw-r--r--arch/sparc/kernel/systbls.S2
-rw-r--r--arch/sparc64/defconfig19
-rw-r--r--arch/sparc64/kernel/module.c5
-rw-r--r--arch/sparc64/kernel/sys32.S1
-rw-r--r--arch/sparc64/kernel/systbls.S4
-rw-r--r--arch/um/kernel/time_kern.c2
-rw-r--r--arch/x86_64/kernel/e820.c6
-rw-r--r--arch/x86_64/kernel/io_apic.c5
-rw-r--r--arch/x86_64/kernel/mpparse.c12
-rw-r--r--arch/x86_64/kernel/pci-gart.c8
-rw-r--r--arch/x86_64/kernel/setup.c30
-rw-r--r--arch/x86_64/kernel/traps.c12
-rw-r--r--block/elevator.c8
-rw-r--r--block/ll_rw_blk.c17
-rw-r--r--drivers/base/class.c32
-rw-r--r--drivers/block/ub.c18
-rw-r--r--drivers/char/Kconfig2
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c10
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c11
-rw-r--r--drivers/char/rio/host.h9
-rw-r--r--drivers/char/rio/rioboot.c1
-rw-r--r--drivers/char/rio/rioctrl.c43
-rw-r--r--drivers/char/rio/rioioctl.h56
-rw-r--r--drivers/char/tpm/Kconfig2
-rw-r--r--drivers/char/tpm/tpm.h2
-rw-r--r--drivers/char/tpm/tpm_tis.c2
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c28
-rw-r--r--drivers/edac/e752x_edac.c17
-rw-r--r--drivers/i2c/busses/scx200_acb.c16
-rw-r--r--drivers/ide/legacy/ide-cs.c1
-rw-r--r--drivers/infiniband/core/cm.c12
-rw-r--r--drivers/infiniband/core/mad.c47
-rw-r--r--drivers/infiniband/core/mad_priv.h5
-rw-r--r--drivers/infiniband/core/mad_rmpp.c20
-rw-r--r--drivers/infiniband/core/sysfs.c2
-rw-r--r--drivers/infiniband/core/ucm.c12
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c7
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c41
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c15
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.h22
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c31
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c23
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_vlan.c4
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c195
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h4
-rw-r--r--drivers/input/touchscreen/corgi_ts.c2
-rw-r--r--drivers/isdn/capi/capi.c1
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
-rw-r--r--drivers/leds/Kconfig7
-rw-r--r--drivers/leds/led-class.c9
-rw-r--r--drivers/leds/ledtrig-timer.c17
-rw-r--r--drivers/message/fusion/mptbase.c63
-rw-r--r--drivers/message/fusion/mptbase.h10
-rw-r--r--drivers/message/fusion/mptfc.c134
-rw-r--r--drivers/message/fusion/mptsas.c99
-rw-r--r--drivers/message/fusion/mptscsih.c50
-rw-r--r--drivers/message/fusion/mptspi.c68
-rw-r--r--drivers/mmc/at91_mci.c3
-rw-r--r--drivers/mmc/au1xmmc.c4
-rw-r--r--drivers/mmc/imxmmc.c60
-rw-r--r--drivers/mmc/mmc.c62
-rw-r--r--drivers/mmc/mmc_block.c6
-rw-r--r--drivers/mmc/mmci.c3
-rw-r--r--drivers/mmc/pxamci.c13
-rw-r--r--drivers/mmc/sdhci.c4
-rw-r--r--drivers/mmc/wbsd.c4
-rw-r--r--drivers/net/au1000_eth.c18
-rw-r--r--drivers/net/dl2k.c13
-rw-r--r--drivers/net/hamradio/dmascc.c1
-rw-r--r--drivers/net/hamradio/scc.c1
-rw-r--r--drivers/net/hamradio/yam.c1
-rw-r--r--drivers/net/irda/Makefile2
-rw-r--r--drivers/net/irda/irda-usb.c2
-rw-r--r--drivers/net/irda/sir-dev.h13
-rw-r--r--drivers/net/irda/sir_dev.c315
-rw-r--r--drivers/net/irda/sir_kthread.c508
-rw-r--r--drivers/net/irda/smsc-ircc2.c14
-rw-r--r--drivers/net/ne.c31
-rw-r--r--drivers/net/phy/mdio_bus.c4
-rw-r--r--drivers/net/sis900.c1
-rw-r--r--drivers/net/sky2.c222
-rw-r--r--drivers/net/sky2.h3
-rw-r--r--drivers/net/spider_net.c12
-rw-r--r--drivers/net/spider_net.h2
-rw-r--r--drivers/net/sungem_phy.c45
-rw-r--r--drivers/net/sungem_phy.h1
-rw-r--r--drivers/net/tg3.c11
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c45
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.h6
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c7
-rw-r--r--drivers/pci/quirks.c16
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c23
-rw-r--r--drivers/rtc/rtc-sa1100.c6
-rw-r--r--drivers/s390/net/lcs.c2
-rw-r--r--drivers/sbus/char/openprom.c15
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_pci.c12
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c30
-rw-r--r--drivers/scsi/lpfc/lpfc_crtn.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_disc.h1
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c95
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c18
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c22
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c33
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c134
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c68
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
-rw-r--r--drivers/scsi/megaraid.c1
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c59
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.h7
-rw-r--r--drivers/scsi/megaraid/megaraid_mm.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c19
-rw-r--r--drivers/scsi/scsi_devinfo.c2
-rw-r--r--drivers/scsi/scsi_lib.c27
-rw-r--r--drivers/scsi/sim710.c2
-rw-r--r--drivers/serial/8250.c74
-rw-r--r--drivers/serial/8250_au1x00.c5
-rw-r--r--drivers/serial/cpm_uart/cpm_uart.h19
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c37
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm1.c2
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c2
-rw-r--r--drivers/serial/imx.c40
-rw-r--r--drivers/serial/serial_core.c114
-rw-r--r--drivers/sn/ioc4.c2
-rw-r--r--drivers/usb/atm/speedtch.c2
-rw-r--r--drivers/usb/atm/usbatm.c8
-rw-r--r--drivers/usb/core/hcd.c13
-rw-r--r--drivers/usb/core/hub.c23
-rw-r--r--drivers/usb/host/ohci-hcd.c2
-rw-r--r--drivers/usb/input/hid-core.c4
-rw-r--r--drivers/usb/misc/emi26.c4
-rw-r--r--drivers/usb/misc/emi62.c4
-rw-r--r--drivers/usb/net/pegasus.c20
-rw-r--r--drivers/usb/serial/Kconfig10
-rw-r--r--drivers/usb/serial/Makefile1
-rw-r--r--drivers/usb/serial/airprime.c1
-rw-r--r--drivers/usb/serial/ark3116.c465
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio.h9
-rw-r--r--drivers/usb/serial/generic.c1
-rw-r--r--drivers/usb/serial/omninet.c12
-rw-r--r--drivers/usb/serial/usb-serial.c19
-rw-r--r--drivers/video/backlight/backlight.c18
-rw-r--r--drivers/video/backlight/lcd.c32
-rw-r--r--drivers/video/logo/Makefile2
-rw-r--r--fs/9p/fcall.c21
-rw-r--r--fs/9p/mux.c222
-rw-r--r--fs/9p/mux.h4
-rw-r--r--fs/9p/vfs_file.c13
-rw-r--r--fs/9p/vfs_inode.c19
-rw-r--r--fs/autofs4/autofs_i.h5
-rw-r--r--fs/autofs4/root.c10
-rw-r--r--fs/autofs4/waitq.c77
-rw-r--r--fs/compat.c4
-rw-r--r--fs/ext3/inode.c13
-rw-r--r--fs/locks.c21
-rw-r--r--fs/namespace.c7
-rw-r--r--fs/open.c1
-rw-r--r--fs/partitions/check.c3
-rw-r--r--fs/smbfs/dir.c5
-rw-r--r--fs/smbfs/request.c4
-rw-r--r--fs/splice.c74
-rw-r--r--fs/xfs/xfs_alloc.c5
-rw-r--r--fs/xfs/xfs_rename.c12
-rw-r--r--fs/xfs/xfs_vfsops.c27
-rw-r--r--fs/xfs/xfs_vnodeops.c2
-rw-r--r--include/asm-arm/arch-aaec2000/debug-macro.S1
-rw-r--r--include/asm-arm/arch-aaec2000/entry-macro.S1
-rw-r--r--include/asm-arm/arch-imx/debug-macro.S2
-rw-r--r--include/asm-arm/arch-imx/imx-uart.h10
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h7
-rw-r--r--include/asm-arm/arch-ixp4xx/memory.h2
-rw-r--r--include/asm-arm/arch-pxa/dma.h26
-rw-r--r--include/asm-arm/bug.h1
-rw-r--r--include/asm-arm/unistd.h23
-rw-r--r--include/asm-i386/io_apic.h1
-rw-r--r--include/asm-ia64/bitops.h1
-rw-r--r--include/asm-powerpc/uaccess.h19
-rw-r--r--include/asm-ppc/commproc.h1
-rw-r--r--include/asm-ppc/cpm2.h2
-rw-r--r--include/asm-ppc/page.h1
-rw-r--r--include/asm-s390/unistd.h8
-rw-r--r--include/asm-sparc/unistd.h2
-rw-r--r--include/asm-sparc64/unistd.h2
-rw-r--r--include/asm-x86_64/e820.h2
-rw-r--r--include/asm-x86_64/io_apic.h1
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/dma-mapping.h1
-rw-r--r--include/linux/fs_uart_pd.h60
-rw-r--r--include/linux/kernel.h1
-rw-r--r--include/linux/mmc/card.h1
-rw-r--r--include/linux/netdevice.h23
-rw-r--r--include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h2
-rw-r--r--include/linux/pipe_fs_i.h5
-rw-r--r--include/linux/rcupdate.h1
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/net/ax25.h10
-rw-r--r--include/net/ieee80211.h6
-rw-r--r--include/net/ieee80211softmac.h3
-rw-r--r--include/net/neighbour.h1
-rw-r--r--include/net/netrom.h8
-rw-r--r--include/net/rose.h14
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--include/scsi/srp.h23
-rw-r--r--init/do_mounts.c5
-rw-r--r--init/initramfs.c8
-rw-r--r--kernel/extable.c2
-rw-r--r--kernel/module.c12
-rw-r--r--kernel/ptrace.c57
-rw-r--r--kernel/rcupdate.c19
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--mm/page_alloc.c11
-rw-r--r--mm/slab.c8
-rw-r--r--mm/sparse.c2
-rw-r--r--net/atm/clip.c2
-rw-r--r--net/ax25/af_ax25.c93
-rw-r--r--net/ax25/ax25_addr.c9
-rw-r--r--net/ax25/ax25_ds_timer.c3
-rw-r--r--net/ax25/ax25_iface.c13
-rw-r--r--net/ax25/ax25_ip.c3
-rw-r--r--net/ax25/ax25_out.c3
-rw-r--r--net/ax25/ax25_route.c2
-rw-r--r--net/ax25/ax25_timer.c3
-rw-r--r--net/ax25/ax25_uid.c4
-rw-r--r--net/ax25/sysctl_net_ax25.c10
-rw-r--r--net/bridge/br_if.c21
-rw-r--r--net/bridge/br_input.c1
-rw-r--r--net/core/dev.c99
-rw-r--r--net/core/link_watch.c10
-rw-r--r--net/core/neighbour.c21
-rw-r--r--net/core/net-sysfs.c49
-rw-r--r--net/dccp/proto.c13
-rw-r--r--net/decnet/dn_neigh.c5
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_assoc.c17
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_auth.c16
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_module.c4
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_scan.c8
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/ip_options.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_h323.c2
-rw-r--r--net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c10
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c2
-rw-r--r--net/ipv4/netfilter/ip_tables.c6
-rw-r--r--net/ipv4/tcp.c13
-rw-r--r--net/ipv4/tcp_highspeed.c2
-rw-r--r--net/ipv6/inet6_connection_sock.c2
-rw-r--r--net/irda/irias_object.c3
-rw-r--r--net/netfilter/x_tables.c4
-rw-r--r--net/netrom/af_netrom.c18
-rw-r--r--net/netrom/nr_dev.c1
-rw-r--r--net/rose/af_rose.c13
-rw-r--r--net/rose/rose_dev.c1
-rw-r--r--net/rose/rose_link.c6
-rw-r--r--net/rose/rose_route.c7
-rw-r--r--net/sched/sch_hfsc.c6
-rw-r--r--net/sctp/inqueue.c1
-rw-r--r--net/sctp/sm_statefuns.c59
-rw-r--r--net/sctp/sm_statetable.c10
-rw-r--r--net/sctp/ulpqueue.c27
-rw-r--r--scripts/gen_initramfs_list.sh6
-rw-r--r--scripts/mkmakefile5
-rw-r--r--scripts/mod/modpost.c6
-rw-r--r--security/selinux/hooks.c3
-rw-r--r--security/selinux/include/security.h5
-rw-r--r--security/selinux/ss/services.c4
314 files changed, 4689 insertions, 2770 deletions
diff --git a/CREDITS b/CREDITS
index 787564bc248b..9bf714a1c7d9 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1194,15 +1194,9 @@ S: Brecksville, OH 44141-1334
1194S: USA 1194S: USA
1195 1195
1196N: Tristan Greaves 1196N: Tristan Greaves
1197E: Tristan.Greaves@icl.com 1197E: tristan@extricate.org
1198E: tmg296@ecs.soton.ac.uk 1198W: http://www.extricate.org/
1199W: http://www.ecs.soton.ac.uk/~tmg296
1200D: Miscellaneous ipv4 sysctl patches 1199D: Miscellaneous ipv4 sysctl patches
1201S: 15 Little Mead
1202S: Denmead
1203S: Hampshire
1204S: PO7 6HS
1205S: United Kingdom
1206 1200
1207N: Michael A. Griffith 1201N: Michael A. Griffith
1208E: grif@cs.ucr.edu 1202E: grif@cs.ucr.edu
@@ -3247,14 +3241,9 @@ S: 12725 SW Millikan Way, Suite 400
3247S: Beaverton, Oregon 97005 3241S: Beaverton, Oregon 97005
3248S: USA 3242S: USA
3249 3243
3250N: Marcelo W. Tosatti 3244N: Marcelo Tosatti
3251E: marcelo.tosatti@cyclades.com 3245E: marcelo@kvack.org
3252D: Miscellaneous kernel hacker
3253D: v2.4 kernel maintainer 3246D: v2.4 kernel maintainer
3254D: Current pc300/cyclades maintainer
3255S: Cyclades Corporation
3256S: Av Cristovao Colombo, 462. Floresta.
3257S: Porto Alegre
3258S: Brazil 3247S: Brazil
3259 3248
3260N: Stefan Traby 3249N: Stefan Traby
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index 3c406acd4dfa..b369a8c46a73 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -1721,11 +1721,6 @@ Your cooperation is appreciated.
1721 These devices support the same API as the generic SCSI 1721 These devices support the same API as the generic SCSI
1722 devices. 1722 devices.
1723 1723
1724 97 block Packet writing for CD/DVD devices
1725 0 = /dev/pktcdvd0 First packet-writing module
1726 1 = /dev/pktcdvd1 Second packet-writing module
1727 ...
1728
1729 98 char Control and Measurement Device (comedi) 1724 98 char Control and Measurement Device (comedi)
1730 0 = /dev/comedi0 First comedi device 1725 0 = /dev/comedi0 First comedi device
1731 1 = /dev/comedi1 Second comedi device 1726 1 = /dev/comedi1 Second comedi device
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 92f0056d928c..c61d8b876fdb 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1031,7 +1031,7 @@ conflict on any particular lock.
1031LOCKS VS MEMORY ACCESSES 1031LOCKS VS MEMORY ACCESSES
1032------------------------ 1032------------------------
1033 1033
1034Consider the following: the system has a pair of spinlocks (N) and (Q), and 1034Consider the following: the system has a pair of spinlocks (M) and (Q), and
1035three CPUs; then should the following sequence of events occur: 1035three CPUs; then should the following sequence of events occur:
1036 1036
1037 CPU 1 CPU 2 1037 CPU 1 CPU 2
@@ -1678,7 +1678,7 @@ CPU's caches by some other cache event:
1678 smp_wmb(); 1678 smp_wmb();
1679 <A:modify v=2> <C:busy> 1679 <A:modify v=2> <C:busy>
1680 <C:queue v=2> 1680 <C:queue v=2>
1681 p = &b; q = p; 1681 p = &v; q = p;
1682 <D:request p> 1682 <D:request p>
1683 <B:modify p=&v> <D:commit p=&v> 1683 <B:modify p=&v> <D:commit p=&v>
1684 <D:read p> 1684 <D:read p>
diff --git a/Documentation/networking/operstates.txt b/Documentation/networking/operstates.txt
new file mode 100644
index 000000000000..4a21d9bb836b
--- /dev/null
+++ b/Documentation/networking/operstates.txt
@@ -0,0 +1,161 @@
1
21. Introduction
3
4Linux distinguishes between administrative and operational state of an
5interface. Admininstrative state is the result of "ip link set dev
6<dev> up or down" and reflects whether the administrator wants to use
7the device for traffic.
8
9However, an interface is not usable just because the admin enabled it
10- ethernet requires to be plugged into the switch and, depending on
11a site's networking policy and configuration, an 802.1X authentication
12to be performed before user data can be transferred. Operational state
13shows the ability of an interface to transmit this user data.
14
15Thanks to 802.1X, userspace must be granted the possibility to
16influence operational state. To accommodate this, operational state is
17split into two parts: Two flags that can be set by the driver only, and
18a RFC2863 compatible state that is derived from these flags, a policy,
19and changeable from userspace under certain rules.
20
21
222. Querying from userspace
23
24Both admin and operational state can be queried via the netlink
25operation RTM_GETLINK. It is also possible to subscribe to RTMGRP_LINK
26to be notified of updates. This is important for setting from userspace.
27
28These values contain interface state:
29
30ifinfomsg::if_flags & IFF_UP:
31 Interface is admin up
32ifinfomsg::if_flags & IFF_RUNNING:
33 Interface is in RFC2863 operational state UP or UNKNOWN. This is for
34 backward compatibility, routing daemons, dhcp clients can use this
35 flag to determine whether they should use the interface.
36ifinfomsg::if_flags & IFF_LOWER_UP:
37 Driver has signaled netif_carrier_on()
38ifinfomsg::if_flags & IFF_DORMANT:
39 Driver has signaled netif_dormant_on()
40
41These interface flags can also be queried without netlink using the
42SIOCGIFFLAGS ioctl.
43
44TLV IFLA_OPERSTATE
45
46contains RFC2863 state of the interface in numeric representation:
47
48IF_OPER_UNKNOWN (0):
49 Interface is in unknown state, neither driver nor userspace has set
50 operational state. Interface must be considered for user data as
51 setting operational state has not been implemented in every driver.
52IF_OPER_NOTPRESENT (1):
53 Unused in current kernel (notpresent interfaces normally disappear),
54 just a numerical placeholder.
55IF_OPER_DOWN (2):
56 Interface is unable to transfer data on L1, f.e. ethernet is not
57 plugged or interface is ADMIN down.
58IF_OPER_LOWERLAYERDOWN (3):
59 Interfaces stacked on an interface that is IF_OPER_DOWN show this
60 state (f.e. VLAN).
61IF_OPER_TESTING (4):
62 Unused in current kernel.
63IF_OPER_DORMANT (5):
64 Interface is L1 up, but waiting for an external event, f.e. for a
65 protocol to establish. (802.1X)
66IF_OPER_UP (6):
67 Interface is operational up and can be used.
68
69This TLV can also be queried via sysfs.
70
71TLV IFLA_LINKMODE
72
73contains link policy. This is needed for userspace interaction
74described below.
75
76This TLV can also be queried via sysfs.
77
78
793. Kernel driver API
80
81Kernel drivers have access to two flags that map to IFF_LOWER_UP and
82IFF_DORMANT. These flags can be set from everywhere, even from
83interrupts. It is guaranteed that only the driver has write access,
84however, if different layers of the driver manipulate the same flag,
85the driver has to provide the synchronisation needed.
86
87__LINK_STATE_NOCARRIER, maps to !IFF_LOWER_UP:
88
89The driver uses netif_carrier_on() to clear and netif_carrier_off() to
90set this flag. On netif_carrier_off(), the scheduler stops sending
91packets. The name 'carrier' and the inversion are historical, think of
92it as lower layer.
93
94netif_carrier_ok() can be used to query that bit.
95
96__LINK_STATE_DORMANT, maps to IFF_DORMANT:
97
98Set by the driver to express that the device cannot yet be used
99because some driver controlled protocol establishment has to
100complete. Corresponding functions are netif_dormant_on() to set the
101flag, netif_dormant_off() to clear it and netif_dormant() to query.
102
103On device allocation, networking core sets the flags equivalent to
104netif_carrier_ok() and !netif_dormant().
105
106
107Whenever the driver CHANGES one of these flags, a workqueue event is
108scheduled to translate the flag combination to IFLA_OPERSTATE as
109follows:
110
111!netif_carrier_ok():
112 IF_OPER_LOWERLAYERDOWN if the interface is stacked, IF_OPER_DOWN
113 otherwise. Kernel can recognise stacked interfaces because their
114 ifindex != iflink.
115
116netif_carrier_ok() && netif_dormant():
117 IF_OPER_DORMANT
118
119netif_carrier_ok() && !netif_dormant():
120 IF_OPER_UP if userspace interaction is disabled. Otherwise
121 IF_OPER_DORMANT with the possibility for userspace to initiate the
122 IF_OPER_UP transition afterwards.
123
124
1254. Setting from userspace
126
127Applications have to use the netlink interface to influence the
128RFC2863 operational state of an interface. Setting IFLA_LINKMODE to 1
129via RTM_SETLINK instructs the kernel that an interface should go to
130IF_OPER_DORMANT instead of IF_OPER_UP when the combination
131netif_carrier_ok() && !netif_dormant() is set by the
132driver. Afterwards, the userspace application can set IFLA_OPERSTATE
133to IF_OPER_DORMANT or IF_OPER_UP as long as the driver does not set
134netif_carrier_off() or netif_dormant_on(). Changes made by userspace
135are multicasted on the netlink group RTMGRP_LINK.
136
137So basically a 802.1X supplicant interacts with the kernel like this:
138
139-subscribe to RTMGRP_LINK
140-set IFLA_LINKMODE to 1 via RTM_SETLINK
141-query RTM_GETLINK once to get initial state
142-if initial flags are not (IFF_LOWER_UP && !IFF_DORMANT), wait until
143 netlink multicast signals this state
144-do 802.1X, eventually abort if flags go down again
145-send RTM_SETLINK to set operstate to IF_OPER_UP if authentication
146 succeeds, IF_OPER_DORMANT otherwise
147-see how operstate and IFF_RUNNING is echoed via netlink multicast
148-set interface back to IF_OPER_DORMANT if 802.1X reauthentication
149 fails
150-restart if kernel changes IFF_LOWER_UP or IFF_DORMANT flag
151
152if supplicant goes down, bring back IFLA_LINKMODE to 0 and
153IFLA_OPERSTATE to a sane value.
154
155A routing daemon or dhcp client just needs to care for IFF_RUNNING or
156waiting for operstate to go IF_OPER_UP/IF_OPER_UNKNOWN before
157considering the interface / querying a DHCP address.
158
159
160For technical questions and/or comments please e-mail to Stefan Rompf
161(stefan at loplof.de).
diff --git a/Documentation/scsi/ChangeLog.megaraid b/Documentation/scsi/ChangeLog.megaraid
index 09f6300eda4b..c173806c91fa 100644
--- a/Documentation/scsi/ChangeLog.megaraid
+++ b/Documentation/scsi/ChangeLog.megaraid
@@ -1,3 +1,28 @@
1Release Date : Mon Apr 11 12:27:22 EST 2006 - Seokmann Ju <sju@lsil.com>
2Current Version : 2.20.4.8 (scsi module), 2.20.2.6 (cmm module)
3Older Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module)
4
51. Fixed a bug in megaraid_reset_handler().
6 Customer reported "Unable to handle kernel NULL pointer dereference
7 at virtual address 00000000" when system goes to reset condition
8 for some reason. It happened randomly.
9 Root Cause: in the megaraid_reset_handler(), there is possibility not
10 returning pending packets in the pend_list if there are multiple
11 pending packets.
12 Fix: Made the change in the driver so that it will return all packets
13 in the pend_list.
14
152. Added change request.
16 As found in the following URL, rmb() only didn't help the
17 problem. I had to increase the loop counter to 0xFFFFFF. (6 F's)
18 http://marc.theaimsgroup.com/?l=linux-scsi&m=110971060502497&w=2
19
20 I attached a patch for your reference, too.
21 Could you check and get this fix in your driver?
22
23 Best Regards,
24 Jun'ichi Nomura
25
1Release Date : Fri Nov 11 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com> 26Release Date : Fri Nov 11 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com>
2Current Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module) 27Current Version : 2.20.4.7 (scsi module), 2.20.2.6 (cmm module)
3Older Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module) 28Older Version : 2.20.4.6 (scsi module), 2.20.2.6 (cmm module)
diff --git a/MAINTAINERS b/MAINTAINERS
index 564cbfa716b1..e564e4eb0f5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1480,10 +1480,11 @@ L: netdev@vger.kernel.org
1480S: Maintained 1480S: Maintained
1481 1481
1482IRDA SUBSYSTEM 1482IRDA SUBSYSTEM
1483P: Jean Tourrilhes 1483P: Samuel Ortiz
1484M: samuel@sortiz.org
1484L: irda-users@lists.sourceforge.net (subscribers-only) 1485L: irda-users@lists.sourceforge.net (subscribers-only)
1485W: http://irda.sourceforge.net/ 1486W: http://irda.sourceforge.net/
1486S: Odd Fixes 1487S: Maintained
1487 1488
1488ISAPNP 1489ISAPNP
1489P: Jaroslav Kysela 1490P: Jaroslav Kysela
@@ -1602,6 +1603,11 @@ M: James.Bottomley@HansenPartnership.com
1602L: linux-scsi@vger.kernel.org 1603L: linux-scsi@vger.kernel.org
1603S: Maintained 1604S: Maintained
1604 1605
1606LED SUBSYSTEM
1607P: Richard Purdie
1608M: rpurdie@rpsys.net
1609S: Maintained
1610
1605LEGO USB Tower driver 1611LEGO USB Tower driver
1606P: Juergen Stuber 1612P: Juergen Stuber
1607M: starblue@users.sourceforge.net 1613M: starblue@users.sourceforge.net
@@ -1661,7 +1667,7 @@ S: Maintained
1661 1667
1662LINUX FOR POWERPC EMBEDDED PPC8XX 1668LINUX FOR POWERPC EMBEDDED PPC8XX
1663P: Marcelo Tosatti 1669P: Marcelo Tosatti
1664M: marcelo.tosatti@cyclades.com 1670M: marcelo@kvack.org
1665W: http://www.penguinppc.org/ 1671W: http://www.penguinppc.org/
1666L: linuxppc-embedded@ozlabs.org 1672L: linuxppc-embedded@ozlabs.org
1667S: Maintained 1673S: Maintained
diff --git a/Makefile b/Makefile
index 6bf99624bd4c..3494c17c9fb9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 17 3SUBLEVEL = 17
4EXTRAVERSION =-rc3 4EXTRAVERSION =-rc4
5NAME=Sliding Snow Leopard 5NAME=Sliding Snow Leopard
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
@@ -344,16 +344,14 @@ scripts_basic:
344scripts/basic/%: scripts_basic ; 344scripts/basic/%: scripts_basic ;
345 345
346PHONY += outputmakefile 346PHONY += outputmakefile
347# outputmakefile generate a Makefile to be placed in output directory, if 347# outputmakefile generates a Makefile in the output directory, if using a
348# using a seperate output directory. This allows convinient use 348# separate output directory. This allows convenient use of make in the
349# of make in output directory 349# output directory.
350outputmakefile: 350outputmakefile:
351 $(Q)if test ! $(srctree) -ef $(objtree); then \ 351ifneq ($(KBUILD_SRC),)
352 $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ 352 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
353 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \ 353 $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
354 > $(objtree)/Makefile; \ 354endif
355 echo ' GEN $(objtree)/Makefile'; \
356 fi
357 355
358# To make sure we do not include .config for any of the *config targets 356# To make sure we do not include .config for any of the *config targets
359# catch them early, and hand them over to scripts/kconfig/Makefile 357# catch them early, and hand them over to scripts/kconfig/Makefile
@@ -796,8 +794,8 @@ prepare2: prepare3 outputmakefile
796prepare1: prepare2 include/linux/version.h include/asm \ 794prepare1: prepare2 include/linux/version.h include/asm \
797 include/config/MARKER 795 include/config/MARKER
798ifneq ($(KBUILD_MODULES),) 796ifneq ($(KBUILD_MODULES),)
799 $(Q)rm -rf $(MODVERDIR)
800 $(Q)mkdir -p $(MODVERDIR) 797 $(Q)mkdir -p $(MODVERDIR)
798 $(Q)rm -f $(MODVERDIR)/*
801endif 799endif
802 800
803archprepare: prepare1 scripts_basic 801archprepare: prepare1 scripts_basic
@@ -1086,8 +1084,8 @@ else # KBUILD_EXTMOD
1086KBUILD_MODULES := 1 1084KBUILD_MODULES := 1
1087PHONY += crmodverdir 1085PHONY += crmodverdir
1088crmodverdir: 1086crmodverdir:
1089 $(Q)rm -rf $(MODVERDIR)
1090 $(Q)mkdir -p $(MODVERDIR) 1087 $(Q)mkdir -p $(MODVERDIR)
1088 $(Q)rm -f $(MODVERDIR)/*
1091 1089
1092PHONY += $(objtree)/Module.symvers 1090PHONY += $(objtree)/Module.symvers
1093$(objtree)/Module.symvers: 1091$(objtree)/Module.symvers:
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1dbf6ddb300d..08b7cc900cae 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -150,8 +150,6 @@ config ARCH_IOP3XX
150 150
151config ARCH_IXP4XX 151config ARCH_IXP4XX
152 bool "IXP4xx-based" 152 bool "IXP4xx-based"
153 select DMABOUNCE
154 select PCI
155 help 153 help
156 Support for Intel's IXP4XX (XScale) family of processors. 154 Support for Intel's IXP4XX (XScale) family of processors.
157 155
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 0af3772efcb7..ace3fb5835d9 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -38,10 +38,10 @@ static void icedcc_putc(int ch)
38 if (--i < 0) 38 if (--i < 0)
39 return; 39 return;
40 40
41 asm("mrc p14, 0, %0, c0, c0, 0" : "=r" (status)); 41 asm volatile ("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
42 } while (status & 2); 42 } while (status & 2);
43 43
44 asm("mcr p15, 0, %0, c1, c0, 0" : : "r" (ch)); 44 asm("mcr p14, 0, %0, c1, c0, 0" : : "r" (ch));
45} 45}
46 46
47#define putc(ch) icedcc_putc(ch) 47#define putc(ch) icedcc_putc(ch)
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index c9aa878e610a..074c47a4fb2e 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -1,21 +1,21 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc3 3# Linux kernel version: 2.6.17-rc1
4# Sun Oct 9 16:55:14 2005 4# Fri Apr 14 19:09:52 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_ARCH_MTD_XIP=y
12CONFIG_VECTORS_BASE=0xffff0000
11 13
12# 14#
13# Code maturity level options 15# Code maturity level options
14# 16#
15CONFIG_EXPERIMENTAL=y 17CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y 18CONFIG_BROKEN_ON_SMP=y
18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32 19CONFIG_INIT_ENV_ARG_LIMIT=32
20 20
21# 21#
@@ -23,45 +23,58 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
23# 23#
24CONFIG_LOCALVERSION="" 24CONFIG_LOCALVERSION=""
25CONFIG_LOCALVERSION_AUTO=y 25CONFIG_LOCALVERSION_AUTO=y
26CONFIG_SWAP=y 26# CONFIG_SWAP is not set
27CONFIG_SYSVIPC=y 27CONFIG_SYSVIPC=y
28# CONFIG_POSIX_MQUEUE is not set 28# CONFIG_POSIX_MQUEUE is not set
29CONFIG_BSD_PROCESS_ACCT=y 29# CONFIG_BSD_PROCESS_ACCT is not set
30# CONFIG_BSD_PROCESS_ACCT_V3 is not set
31CONFIG_SYSCTL=y 30CONFIG_SYSCTL=y
32# CONFIG_AUDIT is not set 31# CONFIG_AUDIT is not set
33CONFIG_HOTPLUG=y
34CONFIG_KOBJECT_UEVENT=y
35# CONFIG_IKCONFIG is not set 32# CONFIG_IKCONFIG is not set
33# CONFIG_RELAY is not set
36CONFIG_INITRAMFS_SOURCE="" 34CONFIG_INITRAMFS_SOURCE=""
35CONFIG_UID16=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37CONFIG_EMBEDDED=y 37CONFIG_EMBEDDED=y
38CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
39# CONFIG_KALLSYMS_ALL is not set 39# CONFIG_KALLSYMS_ALL is not set
40# CONFIG_KALLSYMS_EXTRA_PASS is not set 40# CONFIG_KALLSYMS_EXTRA_PASS is not set
41CONFIG_HOTPLUG=y
41CONFIG_PRINTK=y 42CONFIG_PRINTK=y
42CONFIG_BUG=y 43CONFIG_BUG=y
43CONFIG_BASE_FULL=y 44CONFIG_ELF_CORE=y
45# CONFIG_BASE_FULL is not set
44CONFIG_FUTEX=y 46CONFIG_FUTEX=y
45CONFIG_EPOLL=y 47# CONFIG_EPOLL is not set
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y 48CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0 49# CONFIG_SLAB is not set
49CONFIG_CC_ALIGN_LABELS=0 50CONFIG_DOUBLEFAULT=y
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set 51# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0 52CONFIG_BASE_SMALL=1
53CONFIG_SLOB=y
54CONFIG_OBSOLETE_INTERMODULE=y
54 55
55# 56#
56# Loadable module support 57# Loadable module support
57# 58#
58CONFIG_MODULES=y 59# CONFIG_MODULES is not set
59CONFIG_MODULE_UNLOAD=y 60
60CONFIG_MODULE_FORCE_UNLOAD=y 61#
61CONFIG_OBSOLETE_MODPARM=y 62# Block layer
62CONFIG_MODVERSIONS=y 63#
63# CONFIG_MODULE_SRCVERSION_ALL is not set 64# CONFIG_BLK_DEV_IO_TRACE is not set
64CONFIG_KMOD=y 65
66#
67# IO Schedulers
68#
69CONFIG_IOSCHED_NOOP=y
70CONFIG_IOSCHED_AS=y
71# CONFIG_IOSCHED_DEADLINE is not set
72# CONFIG_IOSCHED_CFQ is not set
73CONFIG_DEFAULT_AS=y
74# CONFIG_DEFAULT_DEADLINE is not set
75# CONFIG_DEFAULT_CFQ is not set
76# CONFIG_DEFAULT_NOOP is not set
77CONFIG_DEFAULT_IOSCHED="anticipatory"
65 78
66# 79#
67# System Type 80# System Type
@@ -70,11 +83,13 @@ CONFIG_KMOD=y
70# CONFIG_ARCH_CLPS711X is not set 83# CONFIG_ARCH_CLPS711X is not set
71# CONFIG_ARCH_CO285 is not set 84# CONFIG_ARCH_CO285 is not set
72# CONFIG_ARCH_EBSA110 is not set 85# CONFIG_ARCH_EBSA110 is not set
86# CONFIG_ARCH_EP93XX is not set
73# CONFIG_ARCH_FOOTBRIDGE is not set 87# CONFIG_ARCH_FOOTBRIDGE is not set
74# CONFIG_ARCH_INTEGRATOR is not set 88# CONFIG_ARCH_INTEGRATOR is not set
75# CONFIG_ARCH_IOP3XX is not set 89# CONFIG_ARCH_IOP3XX is not set
76# CONFIG_ARCH_IXP4XX is not set 90# CONFIG_ARCH_IXP4XX is not set
77# CONFIG_ARCH_IXP2000 is not set 91# CONFIG_ARCH_IXP2000 is not set
92# CONFIG_ARCH_IXP23XX is not set
78# CONFIG_ARCH_L7200 is not set 93# CONFIG_ARCH_L7200 is not set
79# CONFIG_ARCH_PXA is not set 94# CONFIG_ARCH_PXA is not set
80# CONFIG_ARCH_RPC is not set 95# CONFIG_ARCH_RPC is not set
@@ -84,9 +99,11 @@ CONFIG_ARCH_SA1100=y
84# CONFIG_ARCH_LH7A40X is not set 99# CONFIG_ARCH_LH7A40X is not set
85# CONFIG_ARCH_OMAP is not set 100# CONFIG_ARCH_OMAP is not set
86# CONFIG_ARCH_VERSATILE is not set 101# CONFIG_ARCH_VERSATILE is not set
102# CONFIG_ARCH_REALVIEW is not set
87# CONFIG_ARCH_IMX is not set 103# CONFIG_ARCH_IMX is not set
88# CONFIG_ARCH_H720X is not set 104# CONFIG_ARCH_H720X is not set
89# CONFIG_ARCH_AAEC2000 is not set 105# CONFIG_ARCH_AAEC2000 is not set
106# CONFIG_ARCH_AT91RM9200 is not set
90 107
91# 108#
92# SA11x0 Implementations 109# SA11x0 Implementations
@@ -128,20 +145,32 @@ CONFIG_SHARP_SCOOP=y
128# Bus support 145# Bus support
129# 146#
130CONFIG_ISA=y 147CONFIG_ISA=y
131CONFIG_ISA_DMA_API=y
132 148
133# 149#
134# PCCARD (PCMCIA/CardBus) support 150# PCCARD (PCMCIA/CardBus) support
135# 151#
136# CONFIG_PCCARD is not set 152CONFIG_PCCARD=y
153CONFIG_PCMCIA_DEBUG=y
154CONFIG_PCMCIA=y
155CONFIG_PCMCIA_LOAD_CIS=y
156CONFIG_PCMCIA_IOCTL=y
157
158#
159# PC-card bridges
160#
161# CONFIG_I82365 is not set
162# CONFIG_TCIC is not set
163CONFIG_PCMCIA_SA1100=y
137 164
138# 165#
139# Kernel Features 166# Kernel Features
140# 167#
141# CONFIG_SMP is not set 168# CONFIG_PREEMPT is not set
142CONFIG_PREEMPT=y
143# CONFIG_NO_IDLE_HZ is not set 169# CONFIG_NO_IDLE_HZ is not set
170CONFIG_HZ=100
171# CONFIG_AEABI is not set
144CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 172CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
173CONFIG_NODES_SHIFT=2
145CONFIG_SELECT_MEMORY_MODEL=y 174CONFIG_SELECT_MEMORY_MODEL=y
146# CONFIG_FLATMEM_MANUAL is not set 175# CONFIG_FLATMEM_MANUAL is not set
147CONFIG_DISCONTIGMEM_MANUAL=y 176CONFIG_DISCONTIGMEM_MANUAL=y
@@ -150,6 +179,7 @@ CONFIG_DISCONTIGMEM=y
150CONFIG_FLAT_NODE_MEM_MAP=y 179CONFIG_FLAT_NODE_MEM_MAP=y
151CONFIG_NEED_MULTIPLE_NODES=y 180CONFIG_NEED_MULTIPLE_NODES=y
152# CONFIG_SPARSEMEM_STATIC is not set 181# CONFIG_SPARSEMEM_STATIC is not set
182CONFIG_SPLIT_PTLOCK_CPUS=4096
153# CONFIG_LEDS is not set 183# CONFIG_LEDS is not set
154CONFIG_ALIGNMENT_TRAP=y 184CONFIG_ALIGNMENT_TRAP=y
155 185
@@ -158,7 +188,7 @@ CONFIG_ALIGNMENT_TRAP=y
158# 188#
159CONFIG_ZBOOT_ROM_TEXT=0x0 189CONFIG_ZBOOT_ROM_TEXT=0x0
160CONFIG_ZBOOT_ROM_BSS=0x0 190CONFIG_ZBOOT_ROM_BSS=0x0
161CONFIG_CMDLINE="console=ttyS0,115200n8 console=tty1 noinitrd root=/dev/mtdblock2 rootfstype=jffs2 debug" 191CONFIG_CMDLINE="noinitrd root=/dev/mtdblock2 rootfstype=jffs2 fbcon=rotate:1"
162# CONFIG_XIP_KERNEL is not set 192# CONFIG_XIP_KERNEL is not set
163 193
164# 194#
@@ -181,14 +211,16 @@ CONFIG_FPE_NWFPE=y
181# Userspace binary formats 211# Userspace binary formats
182# 212#
183CONFIG_BINFMT_ELF=y 213CONFIG_BINFMT_ELF=y
184CONFIG_BINFMT_AOUT=m 214# CONFIG_BINFMT_AOUT is not set
185CONFIG_BINFMT_MISC=m 215# CONFIG_BINFMT_MISC is not set
186# CONFIG_ARTHUR is not set 216# CONFIG_ARTHUR is not set
187 217
188# 218#
189# Power management options 219# Power management options
190# 220#
191CONFIG_PM=y 221CONFIG_PM=y
222CONFIG_PM_LEGACY=y
223# CONFIG_PM_DEBUG is not set
192CONFIG_APM=y 224CONFIG_APM=y
193 225
194# 226#
@@ -199,6 +231,7 @@ CONFIG_NET=y
199# 231#
200# Networking options 232# Networking options
201# 233#
234# CONFIG_NETDEBUG is not set
202CONFIG_PACKET=y 235CONFIG_PACKET=y
203CONFIG_PACKET_MMAP=y 236CONFIG_PACKET_MMAP=y
204CONFIG_UNIX=y 237CONFIG_UNIX=y
@@ -211,16 +244,19 @@ CONFIG_IP_FIB_HASH=y
211# CONFIG_NET_IPIP is not set 244# CONFIG_NET_IPIP is not set
212# CONFIG_NET_IPGRE is not set 245# CONFIG_NET_IPGRE is not set
213# CONFIG_ARPD is not set 246# CONFIG_ARPD is not set
214CONFIG_SYN_COOKIES=y 247# CONFIG_SYN_COOKIES is not set
215# CONFIG_INET_AH is not set 248# CONFIG_INET_AH is not set
216# CONFIG_INET_ESP is not set 249# CONFIG_INET_ESP is not set
217# CONFIG_INET_IPCOMP is not set 250# CONFIG_INET_IPCOMP is not set
251# CONFIG_INET_XFRM_TUNNEL is not set
218# CONFIG_INET_TUNNEL is not set 252# CONFIG_INET_TUNNEL is not set
219CONFIG_INET_DIAG=y 253CONFIG_INET_DIAG=y
220CONFIG_INET_TCP_DIAG=y 254CONFIG_INET_TCP_DIAG=y
221# CONFIG_TCP_CONG_ADVANCED is not set 255# CONFIG_TCP_CONG_ADVANCED is not set
222CONFIG_TCP_CONG_BIC=y 256CONFIG_TCP_CONG_BIC=y
223# CONFIG_IPV6 is not set 257# CONFIG_IPV6 is not set
258# CONFIG_INET6_XFRM_TUNNEL is not set
259# CONFIG_INET6_TUNNEL is not set
224# CONFIG_NETFILTER is not set 260# CONFIG_NETFILTER is not set
225 261
226# 262#
@@ -232,6 +268,11 @@ CONFIG_TCP_CONG_BIC=y
232# SCTP Configuration (EXPERIMENTAL) 268# SCTP Configuration (EXPERIMENTAL)
233# 269#
234# CONFIG_IP_SCTP is not set 270# CONFIG_IP_SCTP is not set
271
272#
273# TIPC Configuration (EXPERIMENTAL)
274#
275# CONFIG_TIPC is not set
235# CONFIG_ATM is not set 276# CONFIG_ATM is not set
236# CONFIG_BRIDGE is not set 277# CONFIG_BRIDGE is not set
237# CONFIG_VLAN_8021Q is not set 278# CONFIG_VLAN_8021Q is not set
@@ -244,8 +285,11 @@ CONFIG_TCP_CONG_BIC=y
244# CONFIG_NET_DIVERT is not set 285# CONFIG_NET_DIVERT is not set
245# CONFIG_ECONET is not set 286# CONFIG_ECONET is not set
246# CONFIG_WAN_ROUTER is not set 287# CONFIG_WAN_ROUTER is not set
288
289#
290# QoS and/or fair queueing
291#
247# CONFIG_NET_SCHED is not set 292# CONFIG_NET_SCHED is not set
248# CONFIG_NET_CLS_ROUTE is not set
249 293
250# 294#
251# Network testing 295# Network testing
@@ -265,10 +309,15 @@ CONFIG_TCP_CONG_BIC=y
265# 309#
266CONFIG_STANDALONE=y 310CONFIG_STANDALONE=y
267CONFIG_PREVENT_FIRMWARE_BUILD=y 311CONFIG_PREVENT_FIRMWARE_BUILD=y
268CONFIG_FW_LOADER=m 312CONFIG_FW_LOADER=y
269# CONFIG_DEBUG_DRIVER is not set 313# CONFIG_DEBUG_DRIVER is not set
270 314
271# 315#
316# Connector - unified userspace <-> kernelspace linker
317#
318# CONFIG_CONNECTOR is not set
319
320#
272# Memory Technology Devices (MTD) 321# Memory Technology Devices (MTD)
273# 322#
274CONFIG_MTD=y 323CONFIG_MTD=y
@@ -287,32 +336,49 @@ CONFIG_MTD_BLOCK=y
287# CONFIG_FTL is not set 336# CONFIG_FTL is not set
288# CONFIG_NFTL is not set 337# CONFIG_NFTL is not set
289# CONFIG_INFTL is not set 338# CONFIG_INFTL is not set
339# CONFIG_RFD_FTL is not set
290 340
291# 341#
292# RAM/ROM/Flash chip drivers 342# RAM/ROM/Flash chip drivers
293# 343#
294# CONFIG_MTD_CFI is not set 344CONFIG_MTD_CFI=y
295# CONFIG_MTD_JEDECPROBE is not set 345CONFIG_MTD_JEDECPROBE=y
296CONFIG_MTD_MAP_BANK_WIDTH_1=y 346CONFIG_MTD_GEN_PROBE=y
297CONFIG_MTD_MAP_BANK_WIDTH_2=y 347CONFIG_MTD_CFI_ADV_OPTIONS=y
348CONFIG_MTD_CFI_NOSWAP=y
349# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
350# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
351CONFIG_MTD_CFI_GEOMETRY=y
352# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
353# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
298CONFIG_MTD_MAP_BANK_WIDTH_4=y 354CONFIG_MTD_MAP_BANK_WIDTH_4=y
299# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set 355# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
300# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set 356# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
301# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set 357# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
302CONFIG_MTD_CFI_I1=y 358# CONFIG_MTD_CFI_I1 is not set
303CONFIG_MTD_CFI_I2=y 359# CONFIG_MTD_CFI_I2 is not set
304# CONFIG_MTD_CFI_I4 is not set 360CONFIG_MTD_CFI_I4=y
305# CONFIG_MTD_CFI_I8 is not set 361# CONFIG_MTD_CFI_I8 is not set
362# CONFIG_MTD_OTP is not set
363CONFIG_MTD_CFI_INTELEXT=y
364# CONFIG_MTD_CFI_AMDSTD is not set
365# CONFIG_MTD_CFI_STAA is not set
366CONFIG_MTD_CFI_UTIL=y
306# CONFIG_MTD_RAM is not set 367# CONFIG_MTD_RAM is not set
307# CONFIG_MTD_ROM is not set 368# CONFIG_MTD_ROM is not set
308# CONFIG_MTD_ABSENT is not set 369# CONFIG_MTD_ABSENT is not set
309CONFIG_MTD_OBSOLETE_CHIPS=y 370CONFIG_MTD_OBSOLETE_CHIPS=y
310CONFIG_MTD_SHARP=y 371CONFIG_MTD_SHARP=y
372# CONFIG_MTD_XIP is not set
311 373
312# 374#
313# Mapping drivers for chip access 375# Mapping drivers for chip access
314# 376#
315# CONFIG_MTD_COMPLEX_MAPPINGS is not set 377# CONFIG_MTD_COMPLEX_MAPPINGS is not set
378# CONFIG_MTD_PHYSMAP is not set
379# CONFIG_MTD_ARM_INTEGRATOR is not set
380CONFIG_MTD_SA1100=y
381# CONFIG_MTD_IMPA7 is not set
316# CONFIG_MTD_PLATRAM is not set 382# CONFIG_MTD_PLATRAM is not set
317 383
318# 384#
@@ -321,7 +387,6 @@ CONFIG_MTD_SHARP=y
321# CONFIG_MTD_SLRAM is not set 387# CONFIG_MTD_SLRAM is not set
322# CONFIG_MTD_PHRAM is not set 388# CONFIG_MTD_PHRAM is not set
323# CONFIG_MTD_MTDRAM is not set 389# CONFIG_MTD_MTDRAM is not set
324# CONFIG_MTD_BLKMTD is not set
325# CONFIG_MTD_BLOCK2MTD is not set 390# CONFIG_MTD_BLOCK2MTD is not set
326 391
327# 392#
@@ -337,6 +402,11 @@ CONFIG_MTD_SHARP=y
337# CONFIG_MTD_NAND is not set 402# CONFIG_MTD_NAND is not set
338 403
339# 404#
405# OneNAND Flash Device Drivers
406#
407# CONFIG_MTD_ONENAND is not set
408
409#
340# Parallel port support 410# Parallel port support
341# 411#
342# CONFIG_PARPORT is not set 412# CONFIG_PARPORT is not set
@@ -349,7 +419,6 @@ CONFIG_MTD_SHARP=y
349# 419#
350# Block devices 420# Block devices
351# 421#
352# CONFIG_BLK_DEV_XD is not set
353# CONFIG_BLK_DEV_COW_COMMON is not set 422# CONFIG_BLK_DEV_COW_COMMON is not set
354CONFIG_BLK_DEV_LOOP=y 423CONFIG_BLK_DEV_LOOP=y
355# CONFIG_BLK_DEV_CRYPTOLOOP is not set 424# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -359,20 +428,35 @@ CONFIG_BLK_DEV_RAM_COUNT=16
359CONFIG_BLK_DEV_RAM_SIZE=1024 428CONFIG_BLK_DEV_RAM_SIZE=1024
360CONFIG_BLK_DEV_INITRD=y 429CONFIG_BLK_DEV_INITRD=y
361# CONFIG_CDROM_PKTCDVD is not set 430# CONFIG_CDROM_PKTCDVD is not set
431# CONFIG_ATA_OVER_ETH is not set
362 432
363# 433#
364# IO Schedulers 434# ATA/ATAPI/MFM/RLL support
365# 435#
366CONFIG_IOSCHED_NOOP=y 436CONFIG_IDE=y
367CONFIG_IOSCHED_AS=y 437CONFIG_BLK_DEV_IDE=y
368CONFIG_IOSCHED_DEADLINE=y
369CONFIG_IOSCHED_CFQ=y
370CONFIG_ATA_OVER_ETH=m
371 438
372# 439#
373# ATA/ATAPI/MFM/RLL support 440# Please see Documentation/ide.txt for help/info on IDE drives
441#
442# CONFIG_BLK_DEV_IDE_SATA is not set
443CONFIG_BLK_DEV_IDEDISK=y
444CONFIG_IDEDISK_MULTI_MODE=y
445CONFIG_BLK_DEV_IDECS=y
446# CONFIG_BLK_DEV_IDECD is not set
447# CONFIG_BLK_DEV_IDETAPE is not set
448# CONFIG_BLK_DEV_IDEFLOPPY is not set
449# CONFIG_IDE_TASK_IOCTL is not set
450
451#
452# IDE chipset support/bugfixes
374# 453#
375# CONFIG_IDE is not set 454CONFIG_IDE_GENERIC=y
455# CONFIG_IDE_ARM is not set
456# CONFIG_IDE_CHIPSETS is not set
457# CONFIG_BLK_DEV_IDEDMA is not set
458# CONFIG_IDEDMA_AUTO is not set
459# CONFIG_BLK_DEV_HD is not set
376 460
377# 461#
378# SCSI device support 462# SCSI device support
@@ -402,6 +486,39 @@ CONFIG_ATA_OVER_ETH=m
402# Network device support 486# Network device support
403# 487#
404# CONFIG_NETDEVICES is not set 488# CONFIG_NETDEVICES is not set
489# CONFIG_DUMMY is not set
490# CONFIG_BONDING is not set
491# CONFIG_EQUALIZER is not set
492# CONFIG_TUN is not set
493
494#
495# PHY device support
496#
497
498#
499# Ethernet (10 or 100Mbit)
500#
501# CONFIG_NET_ETHERNET is not set
502
503#
504# Ethernet (1000 Mbit)
505#
506
507#
508# Ethernet (10000 Mbit)
509#
510CONFIG_PPP=y
511# CONFIG_PPP_MULTILINK is not set
512# CONFIG_PPP_FILTER is not set
513CONFIG_PPP_ASYNC=y
514# CONFIG_PPP_SYNC_TTY is not set
515# CONFIG_PPP_DEFLATE is not set
516# CONFIG_PPP_BSDCOMP is not set
517# CONFIG_PPP_MPPE is not set
518# CONFIG_PPPOE is not set
519# CONFIG_SLIP is not set
520# CONFIG_SHAPER is not set
521# CONFIG_NETCONSOLE is not set
405# CONFIG_NETPOLL is not set 522# CONFIG_NETPOLL is not set
406# CONFIG_NET_POLL_CONTROLLER is not set 523# CONFIG_NET_POLL_CONTROLLER is not set
407 524
@@ -424,7 +541,7 @@ CONFIG_INPUT_TSDEV=y
424CONFIG_INPUT_TSDEV_SCREEN_X=240 541CONFIG_INPUT_TSDEV_SCREEN_X=240
425CONFIG_INPUT_TSDEV_SCREEN_Y=320 542CONFIG_INPUT_TSDEV_SCREEN_Y=320
426CONFIG_INPUT_EVDEV=y 543CONFIG_INPUT_EVDEV=y
427CONFIG_INPUT_EVBUG=y 544# CONFIG_INPUT_EVBUG is not set
428 545
429# 546#
430# Input Device Drivers 547# Input Device Drivers
@@ -438,7 +555,11 @@ CONFIG_KEYBOARD_LOCOMO=y
438# CONFIG_KEYBOARD_NEWTON is not set 555# CONFIG_KEYBOARD_NEWTON is not set
439# CONFIG_INPUT_MOUSE is not set 556# CONFIG_INPUT_MOUSE is not set
440# CONFIG_INPUT_JOYSTICK is not set 557# CONFIG_INPUT_JOYSTICK is not set
441# CONFIG_INPUT_TOUCHSCREEN is not set 558CONFIG_INPUT_TOUCHSCREEN=y
559# CONFIG_TOUCHSCREEN_GUNZE is not set
560# CONFIG_TOUCHSCREEN_ELO is not set
561# CONFIG_TOUCHSCREEN_MTOUCH is not set
562# CONFIG_TOUCHSCREEN_MK712 is not set
442# CONFIG_INPUT_MISC is not set 563# CONFIG_INPUT_MISC is not set
443 564
444# 565#
@@ -461,7 +582,16 @@ CONFIG_HW_CONSOLE=y
461# 582#
462# Serial drivers 583# Serial drivers
463# 584#
464# CONFIG_SERIAL_8250 is not set 585CONFIG_SERIAL_8250=y
586# CONFIG_SERIAL_8250_CONSOLE is not set
587CONFIG_SERIAL_8250_CS=y
588CONFIG_SERIAL_8250_NR_UARTS=4
589CONFIG_SERIAL_8250_RUNTIME_UARTS=4
590CONFIG_SERIAL_8250_EXTENDED=y
591# CONFIG_SERIAL_8250_MANY_PORTS is not set
592# CONFIG_SERIAL_8250_SHARE_IRQ is not set
593# CONFIG_SERIAL_8250_DETECT_IRQ is not set
594# CONFIG_SERIAL_8250_RSA is not set
465 595
466# 596#
467# Non-8250 serial port support 597# Non-8250 serial port support
@@ -483,94 +613,48 @@ CONFIG_UNIX98_PTYS=y
483# 613#
484# CONFIG_WATCHDOG is not set 614# CONFIG_WATCHDOG is not set
485# CONFIG_NVRAM is not set 615# CONFIG_NVRAM is not set
486# CONFIG_RTC is not set
487# CONFIG_DTLK is not set 616# CONFIG_DTLK is not set
488# CONFIG_R3964 is not set 617# CONFIG_R3964 is not set
489 618
490# 619#
491# Ftape, the floppy tape device driver 620# Ftape, the floppy tape device driver
492# 621#
493# CONFIG_RAW_DRIVER is not set
494 622
495# 623#
496# TPM devices 624# PCMCIA character devices
497# 625#
626# CONFIG_SYNCLINK_CS is not set
627# CONFIG_CARDMAN_4000 is not set
628# CONFIG_CARDMAN_4040 is not set
629# CONFIG_RAW_DRIVER is not set
498 630
499# 631#
500# I2C support 632# TPM devices
501# 633#
502CONFIG_I2C=m 634# CONFIG_TCG_TPM is not set
503# CONFIG_I2C_CHARDEV is not set 635# CONFIG_TELCLOCK is not set
504 636
505# 637#
506# I2C Algorithms 638# I2C support
507# 639#
508CONFIG_I2C_ALGOBIT=m 640# CONFIG_I2C is not set
509# CONFIG_I2C_ALGOPCF is not set
510# CONFIG_I2C_ALGOPCA is not set
511 641
512# 642#
513# I2C Hardware Bus support 643# SPI support
514# 644#
515# CONFIG_I2C_ELEKTOR is not set 645# CONFIG_SPI is not set
516# CONFIG_I2C_PARPORT_LIGHT is not set 646# CONFIG_SPI_MASTER is not set
517# CONFIG_I2C_STUB is not set
518# CONFIG_I2C_PCA_ISA is not set
519 647
520# 648#
521# Miscellaneous I2C Chip support 649# Dallas's 1-wire bus
522# 650#
523# CONFIG_SENSORS_DS1337 is not set 651# CONFIG_W1 is not set
524# CONFIG_SENSORS_DS1374 is not set
525# CONFIG_SENSORS_EEPROM is not set
526# CONFIG_SENSORS_PCF8574 is not set
527# CONFIG_SENSORS_PCA9539 is not set
528# CONFIG_SENSORS_PCF8591 is not set
529# CONFIG_SENSORS_RTC8564 is not set
530# CONFIG_SENSORS_MAX6875 is not set
531# CONFIG_I2C_DEBUG_CORE is not set
532# CONFIG_I2C_DEBUG_ALGO is not set
533# CONFIG_I2C_DEBUG_BUS is not set
534# CONFIG_I2C_DEBUG_CHIP is not set
535 652
536# 653#
537# Hardware Monitoring support 654# Hardware Monitoring support
538# 655#
539CONFIG_HWMON=y 656# CONFIG_HWMON is not set
540# CONFIG_HWMON_VID is not set 657# CONFIG_HWMON_VID is not set
541# CONFIG_SENSORS_ADM1021 is not set
542# CONFIG_SENSORS_ADM1025 is not set
543# CONFIG_SENSORS_ADM1026 is not set
544# CONFIG_SENSORS_ADM1031 is not set
545# CONFIG_SENSORS_ADM9240 is not set
546# CONFIG_SENSORS_ASB100 is not set
547# CONFIG_SENSORS_ATXP1 is not set
548# CONFIG_SENSORS_DS1621 is not set
549# CONFIG_SENSORS_FSCHER is not set
550# CONFIG_SENSORS_FSCPOS is not set
551# CONFIG_SENSORS_GL518SM is not set
552# CONFIG_SENSORS_GL520SM is not set
553# CONFIG_SENSORS_IT87 is not set
554# CONFIG_SENSORS_LM63 is not set
555# CONFIG_SENSORS_LM75 is not set
556# CONFIG_SENSORS_LM77 is not set
557# CONFIG_SENSORS_LM78 is not set
558# CONFIG_SENSORS_LM80 is not set
559# CONFIG_SENSORS_LM83 is not set
560# CONFIG_SENSORS_LM85 is not set
561# CONFIG_SENSORS_LM87 is not set
562# CONFIG_SENSORS_LM90 is not set
563# CONFIG_SENSORS_LM92 is not set
564# CONFIG_SENSORS_MAX1619 is not set
565# CONFIG_SENSORS_PC87360 is not set
566# CONFIG_SENSORS_SMSC47M1 is not set
567# CONFIG_SENSORS_SMSC47B397 is not set
568# CONFIG_SENSORS_W83781D is not set
569# CONFIG_SENSORS_W83792D is not set
570# CONFIG_SENSORS_W83L785TS is not set
571# CONFIG_SENSORS_W83627HF is not set
572# CONFIG_SENSORS_W83627EHF is not set
573# CONFIG_HWMON_DEBUG_CHIP is not set
574 658
575# 659#
576# Misc devices 660# Misc devices
@@ -579,42 +663,33 @@ CONFIG_HWMON=y
579# 663#
580# Multimedia Capabilities Port drivers 664# Multimedia Capabilities Port drivers
581# 665#
582# CONFIG_MCP_SA11X0 is not set 666CONFIG_MCP=y
667CONFIG_MCP_SA11X0=y
668CONFIG_MCP_UCB1200=y
669CONFIG_MCP_UCB1200_TS=y
583 670
584# 671#
585# Multimedia devices 672# LED devices
586# 673#
587CONFIG_VIDEO_DEV=m 674CONFIG_NEW_LEDS=y
675CONFIG_LEDS_CLASS=y
588 676
589# 677#
590# Video For Linux 678# LED drivers
591# 679#
680CONFIG_LEDS_LOCOMO=y
592 681
593# 682#
594# Video Adapters 683# LED Triggers
595# 684#
596# CONFIG_VIDEO_PMS is not set 685CONFIG_LEDS_TRIGGERS=y
597# CONFIG_VIDEO_CPIA is not set 686CONFIG_LEDS_TRIGGER_TIMER=y
598# CONFIG_VIDEO_SAA5246A is not set 687CONFIG_LEDS_TRIGGER_IDE_DISK=y
599# CONFIG_VIDEO_SAA5249 is not set
600# CONFIG_TUNER_3036 is not set
601# CONFIG_VIDEO_OVCAMCHIP is not set
602 688
603# 689#
604# Radio Adapters 690# Multimedia devices
605# 691#
606# CONFIG_RADIO_CADET is not set 692# CONFIG_VIDEO_DEV is not set
607# CONFIG_RADIO_RTRACK is not set
608# CONFIG_RADIO_RTRACK2 is not set
609# CONFIG_RADIO_AZTECH is not set
610# CONFIG_RADIO_GEMTEK is not set
611# CONFIG_RADIO_MAESTRO is not set
612# CONFIG_RADIO_SF16FMI is not set
613# CONFIG_RADIO_SF16FMR2 is not set
614# CONFIG_RADIO_TERRATEC is not set
615# CONFIG_RADIO_TRUST is not set
616# CONFIG_RADIO_TYPHOON is not set
617# CONFIG_RADIO_ZOLTRIX is not set
618 693
619# 694#
620# Digital Video Broadcasting Devices 695# Digital Video Broadcasting Devices
@@ -628,8 +703,8 @@ CONFIG_FB=y
628CONFIG_FB_CFB_FILLRECT=y 703CONFIG_FB_CFB_FILLRECT=y
629CONFIG_FB_CFB_COPYAREA=y 704CONFIG_FB_CFB_COPYAREA=y
630CONFIG_FB_CFB_IMAGEBLIT=y 705CONFIG_FB_CFB_IMAGEBLIT=y
631CONFIG_FB_SOFT_CURSOR=y
632# CONFIG_FB_MACMODES is not set 706# CONFIG_FB_MACMODES is not set
707# CONFIG_FB_FIRMWARE_EDID is not set
633CONFIG_FB_MODE_HELPERS=y 708CONFIG_FB_MODE_HELPERS=y
634# CONFIG_FB_TILEBLITTING is not set 709# CONFIG_FB_TILEBLITTING is not set
635CONFIG_FB_SA1100=y 710CONFIG_FB_SA1100=y
@@ -643,14 +718,15 @@ CONFIG_FB_SA1100=y
643# CONFIG_MDA_CONSOLE is not set 718# CONFIG_MDA_CONSOLE is not set
644CONFIG_DUMMY_CONSOLE=y 719CONFIG_DUMMY_CONSOLE=y
645CONFIG_FRAMEBUFFER_CONSOLE=y 720CONFIG_FRAMEBUFFER_CONSOLE=y
721CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
646CONFIG_FONTS=y 722CONFIG_FONTS=y
647CONFIG_FONT_8x8=y 723# CONFIG_FONT_8x8 is not set
648# CONFIG_FONT_8x16 is not set 724# CONFIG_FONT_8x16 is not set
649# CONFIG_FONT_6x11 is not set 725# CONFIG_FONT_6x11 is not set
650# CONFIG_FONT_7x14 is not set 726# CONFIG_FONT_7x14 is not set
651# CONFIG_FONT_PEARL_8x8 is not set 727# CONFIG_FONT_PEARL_8x8 is not set
652# CONFIG_FONT_ACORN_8x8 is not set 728# CONFIG_FONT_ACORN_8x8 is not set
653# CONFIG_FONT_MINI_4x6 is not set 729CONFIG_FONT_MINI_4x6=y
654# CONFIG_FONT_SUN8x16 is not set 730# CONFIG_FONT_SUN8x16 is not set
655# CONFIG_FONT_SUN12x22 is not set 731# CONFIG_FONT_SUN12x22 is not set
656# CONFIG_FONT_10x18 is not set 732# CONFIG_FONT_10x18 is not set
@@ -659,7 +735,11 @@ CONFIG_FONT_8x8=y
659# Logo configuration 735# Logo configuration
660# 736#
661# CONFIG_LOGO is not set 737# CONFIG_LOGO is not set
662# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 738CONFIG_BACKLIGHT_LCD_SUPPORT=y
739CONFIG_BACKLIGHT_CLASS_DEVICE=y
740CONFIG_BACKLIGHT_DEVICE=y
741CONFIG_LCD_CLASS_DEVICE=y
742CONFIG_LCD_DEVICE=y
663 743
664# 744#
665# Sound 745# Sound
@@ -671,20 +751,17 @@ CONFIG_FONT_8x8=y
671# 751#
672CONFIG_USB_ARCH_HAS_HCD=y 752CONFIG_USB_ARCH_HAS_HCD=y
673# CONFIG_USB_ARCH_HAS_OHCI is not set 753# CONFIG_USB_ARCH_HAS_OHCI is not set
754# CONFIG_USB_ARCH_HAS_EHCI is not set
674# CONFIG_USB is not set 755# CONFIG_USB is not set
675 756
676# 757#
758# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
759#
760
761#
677# USB Gadget Support 762# USB Gadget Support
678# 763#
679CONFIG_USB_GADGET=y 764# CONFIG_USB_GADGET is not set
680# CONFIG_USB_GADGET_DEBUG_FILES is not set
681# CONFIG_USB_GADGET_NET2280 is not set
682# CONFIG_USB_GADGET_PXA2XX is not set
683# CONFIG_USB_GADGET_GOKU is not set
684# CONFIG_USB_GADGET_LH7A40X is not set
685# CONFIG_USB_GADGET_OMAP is not set
686# CONFIG_USB_GADGET_DUMMY_HCD is not set
687# CONFIG_USB_GADGET_DUALSPEED is not set
688 765
689# 766#
690# MMC/SD Card support 767# MMC/SD Card support
@@ -692,23 +769,24 @@ CONFIG_USB_GADGET=y
692# CONFIG_MMC is not set 769# CONFIG_MMC is not set
693 770
694# 771#
772# Real Time Clock
773#
774CONFIG_RTC_LIB=y
775# CONFIG_RTC_CLASS is not set
776
777#
695# File systems 778# File systems
696# 779#
697CONFIG_EXT2_FS=y 780# CONFIG_EXT2_FS is not set
698CONFIG_EXT2_FS_XATTR=y
699CONFIG_EXT2_FS_POSIX_ACL=y
700CONFIG_EXT2_FS_SECURITY=y
701# CONFIG_EXT2_FS_XIP is not set
702# CONFIG_EXT3_FS is not set 781# CONFIG_EXT3_FS is not set
703# CONFIG_JBD is not set
704CONFIG_FS_MBCACHE=y
705# CONFIG_REISERFS_FS is not set 782# CONFIG_REISERFS_FS is not set
706# CONFIG_JFS_FS is not set 783# CONFIG_JFS_FS is not set
707CONFIG_FS_POSIX_ACL=y 784# CONFIG_FS_POSIX_ACL is not set
708# CONFIG_XFS_FS is not set 785# CONFIG_XFS_FS is not set
786# CONFIG_OCFS2_FS is not set
709# CONFIG_MINIX_FS is not set 787# CONFIG_MINIX_FS is not set
710CONFIG_ROMFS_FS=y 788CONFIG_ROMFS_FS=y
711CONFIG_INOTIFY=y 789# CONFIG_INOTIFY is not set
712# CONFIG_QUOTA is not set 790# CONFIG_QUOTA is not set
713# CONFIG_DNOTIFY is not set 791# CONFIG_DNOTIFY is not set
714# CONFIG_AUTOFS_FS is not set 792# CONFIG_AUTOFS_FS is not set
@@ -725,7 +803,7 @@ CONFIG_INOTIFY=y
725# DOS/FAT/NT Filesystems 803# DOS/FAT/NT Filesystems
726# 804#
727CONFIG_FAT_FS=y 805CONFIG_FAT_FS=y
728CONFIG_MSDOS_FS=y 806# CONFIG_MSDOS_FS is not set
729CONFIG_VFAT_FS=y 807CONFIG_VFAT_FS=y
730CONFIG_FAT_DEFAULT_CODEPAGE=437 808CONFIG_FAT_DEFAULT_CODEPAGE=437
731CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 809CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
@@ -739,7 +817,7 @@ CONFIG_SYSFS=y
739CONFIG_TMPFS=y 817CONFIG_TMPFS=y
740# CONFIG_HUGETLB_PAGE is not set 818# CONFIG_HUGETLB_PAGE is not set
741CONFIG_RAMFS=y 819CONFIG_RAMFS=y
742# CONFIG_RELAYFS_FS is not set 820# CONFIG_CONFIGFS_FS is not set
743 821
744# 822#
745# Miscellaneous filesystems 823# Miscellaneous filesystems
@@ -755,11 +833,12 @@ CONFIG_RAMFS=y
755CONFIG_JFFS2_FS=y 833CONFIG_JFFS2_FS=y
756CONFIG_JFFS2_FS_DEBUG=0 834CONFIG_JFFS2_FS_DEBUG=0
757CONFIG_JFFS2_FS_WRITEBUFFER=y 835CONFIG_JFFS2_FS_WRITEBUFFER=y
836# CONFIG_JFFS2_SUMMARY is not set
758# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 837# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
759CONFIG_JFFS2_ZLIB=y 838CONFIG_JFFS2_ZLIB=y
760CONFIG_JFFS2_RTIME=y 839CONFIG_JFFS2_RTIME=y
761# CONFIG_JFFS2_RUBIN is not set 840# CONFIG_JFFS2_RUBIN is not set
762CONFIG_CRAMFS=y 841# CONFIG_CRAMFS is not set
763# CONFIG_VXFS_FS is not set 842# CONFIG_VXFS_FS is not set
764# CONFIG_HPFS_FS is not set 843# CONFIG_HPFS_FS is not set
765# CONFIG_QNX4FS_FS is not set 844# CONFIG_QNX4FS_FS is not set
@@ -789,7 +868,7 @@ CONFIG_MSDOS_PARTITION=y
789# 868#
790CONFIG_NLS=y 869CONFIG_NLS=y
791CONFIG_NLS_DEFAULT="cp437" 870CONFIG_NLS_DEFAULT="cp437"
792CONFIG_NLS_CODEPAGE_437=m 871CONFIG_NLS_CODEPAGE_437=y
793# CONFIG_NLS_CODEPAGE_737 is not set 872# CONFIG_NLS_CODEPAGE_737 is not set
794# CONFIG_NLS_CODEPAGE_775 is not set 873# CONFIG_NLS_CODEPAGE_775 is not set
795# CONFIG_NLS_CODEPAGE_850 is not set 874# CONFIG_NLS_CODEPAGE_850 is not set
@@ -813,7 +892,7 @@ CONFIG_NLS_CODEPAGE_437=m
813# CONFIG_NLS_CODEPAGE_1250 is not set 892# CONFIG_NLS_CODEPAGE_1250 is not set
814# CONFIG_NLS_CODEPAGE_1251 is not set 893# CONFIG_NLS_CODEPAGE_1251 is not set
815# CONFIG_NLS_ASCII is not set 894# CONFIG_NLS_ASCII is not set
816CONFIG_NLS_ISO8859_1=m 895CONFIG_NLS_ISO8859_1=y
817# CONFIG_NLS_ISO8859_2 is not set 896# CONFIG_NLS_ISO8859_2 is not set
818# CONFIG_NLS_ISO8859_3 is not set 897# CONFIG_NLS_ISO8859_3 is not set
819# CONFIG_NLS_ISO8859_4 is not set 898# CONFIG_NLS_ISO8859_4 is not set
@@ -826,7 +905,7 @@ CONFIG_NLS_ISO8859_1=m
826# CONFIG_NLS_ISO8859_15 is not set 905# CONFIG_NLS_ISO8859_15 is not set
827# CONFIG_NLS_KOI8_R is not set 906# CONFIG_NLS_KOI8_R is not set
828# CONFIG_NLS_KOI8_U is not set 907# CONFIG_NLS_KOI8_U is not set
829CONFIG_NLS_UTF8=m 908# CONFIG_NLS_UTF8 is not set
830 909
831# 910#
832# Profiling support 911# Profiling support
@@ -837,20 +916,23 @@ CONFIG_NLS_UTF8=m
837# Kernel hacking 916# Kernel hacking
838# 917#
839# CONFIG_PRINTK_TIME is not set 918# CONFIG_PRINTK_TIME is not set
840CONFIG_DEBUG_KERNEL=y
841CONFIG_MAGIC_SYSRQ=y 919CONFIG_MAGIC_SYSRQ=y
920CONFIG_DEBUG_KERNEL=y
842CONFIG_LOG_BUF_SHIFT=14 921CONFIG_LOG_BUF_SHIFT=14
843CONFIG_DETECT_SOFTLOCKUP=y 922# CONFIG_DETECT_SOFTLOCKUP is not set
844# CONFIG_SCHEDSTATS is not set 923# CONFIG_SCHEDSTATS is not set
845# CONFIG_DEBUG_SLAB is not set 924CONFIG_DEBUG_MUTEXES=y
846CONFIG_DEBUG_PREEMPT=y
847# CONFIG_DEBUG_SPINLOCK is not set 925# CONFIG_DEBUG_SPINLOCK is not set
848# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 926# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
849# CONFIG_DEBUG_KOBJECT is not set 927# CONFIG_DEBUG_KOBJECT is not set
850# CONFIG_DEBUG_BUGVERBOSE is not set 928# CONFIG_DEBUG_BUGVERBOSE is not set
851# CONFIG_DEBUG_INFO is not set 929# CONFIG_DEBUG_INFO is not set
852# CONFIG_DEBUG_FS is not set 930# CONFIG_DEBUG_FS is not set
931# CONFIG_DEBUG_VM is not set
853CONFIG_FRAME_POINTER=y 932CONFIG_FRAME_POINTER=y
933# CONFIG_UNWIND_INFO is not set
934CONFIG_FORCED_INLINING=y
935# CONFIG_RCU_TORTURE_TEST is not set
854# CONFIG_DEBUG_USER is not set 936# CONFIG_DEBUG_USER is not set
855# CONFIG_DEBUG_WAITQ is not set 937# CONFIG_DEBUG_WAITQ is not set
856CONFIG_DEBUG_ERRORS=y 938CONFIG_DEBUG_ERRORS=y
@@ -874,7 +956,7 @@ CONFIG_DEBUG_ERRORS=y
874# 956#
875# Library routines 957# Library routines
876# 958#
877# CONFIG_CRC_CCITT is not set 959CONFIG_CRC_CCITT=y
878# CONFIG_CRC16 is not set 960# CONFIG_CRC16 is not set
879CONFIG_CRC32=y 961CONFIG_CRC32=y
880# CONFIG_LIBCRC32C is not set 962# CONFIG_LIBCRC32C is not set
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index 2687a225aa6a..96b7a7762426 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -1,50 +1,55 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc1-bk2 3# Linux kernel version: 2.6.17-rc3
4# Mon Mar 28 00:20:50 2005 4# Mon May 8 20:15:57 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_GENERIC_IOMAP=y 11CONFIG_VECTORS_BASE=0xffff0000
12 12
13# 13#
14# Code maturity level options 14# Code maturity level options
15# 15#
16CONFIG_EXPERIMENTAL=y 16CONFIG_EXPERIMENTAL=y
17CONFIG_CLEAN_COMPILE=y
18CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
19 19
20# 20#
21# General setup 21# General setup
22# 22#
23CONFIG_LOCALVERSION="" 23CONFIG_LOCALVERSION=""
24# CONFIG_LOCALVERSION_AUTO is not set
24CONFIG_SWAP=y 25CONFIG_SWAP=y
25CONFIG_SYSVIPC=y 26CONFIG_SYSVIPC=y
26# CONFIG_POSIX_MQUEUE is not set 27# CONFIG_POSIX_MQUEUE is not set
27# CONFIG_BSD_PROCESS_ACCT is not set 28# CONFIG_BSD_PROCESS_ACCT is not set
28CONFIG_SYSCTL=y 29CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set 30# CONFIG_AUDIT is not set
30CONFIG_HOTPLUG=y
31CONFIG_KOBJECT_UEVENT=y
32# CONFIG_IKCONFIG is not set 31# CONFIG_IKCONFIG is not set
32# CONFIG_RELAY is not set
33CONFIG_INITRAMFS_SOURCE=""
34CONFIG_UID16=y
35CONFIG_CC_OPTIMIZE_FOR_SIZE=y
33# CONFIG_EMBEDDED is not set 36# CONFIG_EMBEDDED is not set
34CONFIG_KALLSYMS=y 37CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_ALL is not set 38# CONFIG_KALLSYMS_ALL is not set
36# CONFIG_KALLSYMS_EXTRA_PASS is not set 39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_HOTPLUG=y
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_ELF_CORE=y
37CONFIG_BASE_FULL=y 44CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y 45CONFIG_FUTEX=y
39CONFIG_EPOLL=y 46CONFIG_EPOLL=y
40CONFIG_CC_OPTIMIZE_FOR_SIZE=y
41CONFIG_SHMEM=y 47CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0 48CONFIG_SLAB=y
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set 49# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0 50CONFIG_BASE_SMALL=0
51# CONFIG_SLOB is not set
52CONFIG_OBSOLETE_INTERMODULE=y
48 53
49# 54#
50# Loadable module support 55# Loadable module support
@@ -52,23 +57,42 @@ CONFIG_BASE_SMALL=0
52CONFIG_MODULES=y 57CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y 58CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set 59# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56# CONFIG_MODVERSIONS is not set 60# CONFIG_MODVERSIONS is not set
57# CONFIG_MODULE_SRCVERSION_ALL is not set 61# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y 62CONFIG_KMOD=y
59 63
60# 64#
65# Block layer
66#
67# CONFIG_BLK_DEV_IO_TRACE is not set
68
69#
70# IO Schedulers
71#
72CONFIG_IOSCHED_NOOP=y
73CONFIG_IOSCHED_AS=y
74CONFIG_IOSCHED_DEADLINE=y
75CONFIG_IOSCHED_CFQ=y
76CONFIG_DEFAULT_AS=y
77# CONFIG_DEFAULT_DEADLINE is not set
78# CONFIG_DEFAULT_CFQ is not set
79# CONFIG_DEFAULT_NOOP is not set
80CONFIG_DEFAULT_IOSCHED="anticipatory"
81
82#
61# System Type 83# System Type
62# 84#
63# CONFIG_ARCH_CLPS7500 is not set 85# CONFIG_ARCH_CLPS7500 is not set
64# CONFIG_ARCH_CLPS711X is not set 86# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 87# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 88# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_EP93XX is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 90# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 91# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 92# CONFIG_ARCH_IOP3XX is not set
70# CONFIG_ARCH_IXP4XX is not set 93# CONFIG_ARCH_IXP4XX is not set
71# CONFIG_ARCH_IXP2000 is not set 94# CONFIG_ARCH_IXP2000 is not set
95# CONFIG_ARCH_IXP23XX is not set
72# CONFIG_ARCH_L7200 is not set 96# CONFIG_ARCH_L7200 is not set
73# CONFIG_ARCH_PXA is not set 97# CONFIG_ARCH_PXA is not set
74# CONFIG_ARCH_RPC is not set 98# CONFIG_ARCH_RPC is not set
@@ -78,14 +102,17 @@ CONFIG_KMOD=y
78# CONFIG_ARCH_LH7A40X is not set 102# CONFIG_ARCH_LH7A40X is not set
79# CONFIG_ARCH_OMAP is not set 103# CONFIG_ARCH_OMAP is not set
80CONFIG_ARCH_VERSATILE=y 104CONFIG_ARCH_VERSATILE=y
105# CONFIG_ARCH_REALVIEW is not set
81# CONFIG_ARCH_IMX is not set 106# CONFIG_ARCH_IMX is not set
82# CONFIG_ARCH_H720X is not set 107# CONFIG_ARCH_H720X is not set
108# CONFIG_ARCH_AAEC2000 is not set
109# CONFIG_ARCH_AT91RM9200 is not set
83 110
84# 111#
85# Versatile platform type 112# Versatile platform type
86# 113#
87CONFIG_ARCH_VERSATILE_PB=y 114CONFIG_ARCH_VERSATILE_PB=y
88# CONFIG_MACH_VERSATILE_AB is not set 115CONFIG_MACH_VERSATILE_AB=y
89 116
90# 117#
91# Processor Type 118# Processor Type
@@ -106,12 +133,14 @@ CONFIG_ARM_THUMB=y
106# CONFIG_CPU_DCACHE_DISABLE is not set 133# CONFIG_CPU_DCACHE_DISABLE is not set
107# CONFIG_CPU_DCACHE_WRITETHROUGH is not set 134# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
108# CONFIG_CPU_CACHE_ROUND_ROBIN is not set 135# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
136CONFIG_ARM_VIC=y
109CONFIG_ICST307=y 137CONFIG_ICST307=y
110 138
111# 139#
112# Bus support 140# Bus support
113# 141#
114CONFIG_ARM_AMBA=y 142CONFIG_ARM_AMBA=y
143# CONFIG_PCI is not set
115 144
116# 145#
117# PCCARD (PCMCIA/CardBus) support 146# PCCARD (PCMCIA/CardBus) support
@@ -122,6 +151,18 @@ CONFIG_ARM_AMBA=y
122# Kernel Features 151# Kernel Features
123# 152#
124# CONFIG_PREEMPT is not set 153# CONFIG_PREEMPT is not set
154# CONFIG_NO_IDLE_HZ is not set
155CONFIG_HZ=100
156# CONFIG_AEABI is not set
157# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
158CONFIG_SELECT_MEMORY_MODEL=y
159CONFIG_FLATMEM_MANUAL=y
160# CONFIG_DISCONTIGMEM_MANUAL is not set
161# CONFIG_SPARSEMEM_MANUAL is not set
162CONFIG_FLATMEM=y
163CONFIG_FLAT_NODE_MEM_MAP=y
164# CONFIG_SPARSEMEM_STATIC is not set
165CONFIG_SPLIT_PTLOCK_CPUS=4096
125CONFIG_LEDS=y 166CONFIG_LEDS=y
126CONFIG_LEDS_TIMER=y 167CONFIG_LEDS_TIMER=y
127CONFIG_LEDS_CPU=y 168CONFIG_LEDS_CPU=y
@@ -145,7 +186,7 @@ CONFIG_CMDLINE="root=1f03 mem=32M"
145CONFIG_FPE_NWFPE=y 186CONFIG_FPE_NWFPE=y
146# CONFIG_FPE_NWFPE_XP is not set 187# CONFIG_FPE_NWFPE_XP is not set
147# CONFIG_FPE_FASTFPE is not set 188# CONFIG_FPE_FASTFPE is not set
148# CONFIG_VFP is not set 189CONFIG_VFP=y
149 190
150# 191#
151# Userspace binary formats 192# Userspace binary formats
@@ -159,9 +200,92 @@ CONFIG_BINFMT_ELF=y
159# Power management options 200# Power management options
160# 201#
161CONFIG_PM=y 202CONFIG_PM=y
203CONFIG_PM_LEGACY=y
204# CONFIG_PM_DEBUG is not set
162# CONFIG_APM is not set 205# CONFIG_APM is not set
163 206
164# 207#
208# Networking
209#
210CONFIG_NET=y
211
212#
213# Networking options
214#
215# CONFIG_NETDEBUG is not set
216CONFIG_PACKET=y
217CONFIG_PACKET_MMAP=y
218CONFIG_UNIX=y
219# CONFIG_NET_KEY is not set
220CONFIG_INET=y
221CONFIG_IP_MULTICAST=y
222# CONFIG_IP_ADVANCED_ROUTER is not set
223CONFIG_IP_FIB_HASH=y
224CONFIG_IP_PNP=y
225# CONFIG_IP_PNP_DHCP is not set
226CONFIG_IP_PNP_BOOTP=y
227# CONFIG_IP_PNP_RARP is not set
228# CONFIG_NET_IPIP is not set
229# CONFIG_NET_IPGRE is not set
230# CONFIG_IP_MROUTE is not set
231# CONFIG_ARPD is not set
232# CONFIG_SYN_COOKIES is not set
233# CONFIG_INET_AH is not set
234# CONFIG_INET_ESP is not set
235# CONFIG_INET_IPCOMP is not set
236# CONFIG_INET_XFRM_TUNNEL is not set
237# CONFIG_INET_TUNNEL is not set
238# CONFIG_INET_DIAG is not set
239CONFIG_INET_TCP_DIAG=y
240# CONFIG_TCP_CONG_ADVANCED is not set
241CONFIG_TCP_CONG_BIC=y
242# CONFIG_IPV6 is not set
243# CONFIG_INET6_XFRM_TUNNEL is not set
244# CONFIG_INET6_TUNNEL is not set
245# CONFIG_NETFILTER is not set
246
247#
248# DCCP Configuration (EXPERIMENTAL)
249#
250# CONFIG_IP_DCCP is not set
251
252#
253# SCTP Configuration (EXPERIMENTAL)
254#
255# CONFIG_IP_SCTP is not set
256
257#
258# TIPC Configuration (EXPERIMENTAL)
259#
260# CONFIG_TIPC is not set
261# CONFIG_ATM is not set
262# CONFIG_BRIDGE is not set
263# CONFIG_VLAN_8021Q is not set
264# CONFIG_DECNET is not set
265# CONFIG_LLC2 is not set
266# CONFIG_IPX is not set
267# CONFIG_ATALK is not set
268# CONFIG_X25 is not set
269# CONFIG_LAPB is not set
270# CONFIG_NET_DIVERT is not set
271# CONFIG_ECONET is not set
272# CONFIG_WAN_ROUTER is not set
273
274#
275# QoS and/or fair queueing
276#
277# CONFIG_NET_SCHED is not set
278
279#
280# Network testing
281#
282# CONFIG_NET_PKTGEN is not set
283# CONFIG_HAMRADIO is not set
284# CONFIG_IRDA is not set
285# CONFIG_BT is not set
286# CONFIG_IEEE80211 is not set
287
288#
165# Device Drivers 289# Device Drivers
166# 290#
167 291
@@ -174,6 +298,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
174# CONFIG_DEBUG_DRIVER is not set 298# CONFIG_DEBUG_DRIVER is not set
175 299
176# 300#
301# Connector - unified userspace <-> kernelspace linker
302#
303# CONFIG_CONNECTOR is not set
304
305#
177# Memory Technology Devices (MTD) 306# Memory Technology Devices (MTD)
178# 307#
179CONFIG_MTD=y 308CONFIG_MTD=y
@@ -192,6 +321,7 @@ CONFIG_MTD_BLOCK=y
192# CONFIG_FTL is not set 321# CONFIG_FTL is not set
193# CONFIG_NFTL is not set 322# CONFIG_NFTL is not set
194# CONFIG_INFTL is not set 323# CONFIG_INFTL is not set
324# CONFIG_RFD_FTL is not set
195 325
196# 326#
197# RAM/ROM/Flash chip drivers 327# RAM/ROM/Flash chip drivers
@@ -214,6 +344,7 @@ CONFIG_MTD_CFI_I1=y
214CONFIG_MTD_CFI_I2=y 344CONFIG_MTD_CFI_I2=y
215# CONFIG_MTD_CFI_I4 is not set 345# CONFIG_MTD_CFI_I4 is not set
216# CONFIG_MTD_CFI_I8 is not set 346# CONFIG_MTD_CFI_I8 is not set
347# CONFIG_MTD_OTP is not set
217CONFIG_MTD_CFI_INTELEXT=y 348CONFIG_MTD_CFI_INTELEXT=y
218# CONFIG_MTD_CFI_AMDSTD is not set 349# CONFIG_MTD_CFI_AMDSTD is not set
219# CONFIG_MTD_CFI_STAA is not set 350# CONFIG_MTD_CFI_STAA is not set
@@ -221,7 +352,7 @@ CONFIG_MTD_CFI_UTIL=y
221# CONFIG_MTD_RAM is not set 352# CONFIG_MTD_RAM is not set
222# CONFIG_MTD_ROM is not set 353# CONFIG_MTD_ROM is not set
223# CONFIG_MTD_ABSENT is not set 354# CONFIG_MTD_ABSENT is not set
224# CONFIG_MTD_XIP is not set 355# CONFIG_MTD_OBSOLETE_CHIPS is not set
225 356
226# 357#
227# Mapping drivers for chip access 358# Mapping drivers for chip access
@@ -229,7 +360,7 @@ CONFIG_MTD_CFI_UTIL=y
229# CONFIG_MTD_COMPLEX_MAPPINGS is not set 360# CONFIG_MTD_COMPLEX_MAPPINGS is not set
230# CONFIG_MTD_PHYSMAP is not set 361# CONFIG_MTD_PHYSMAP is not set
231CONFIG_MTD_ARM_INTEGRATOR=y 362CONFIG_MTD_ARM_INTEGRATOR=y
232# CONFIG_MTD_EDB7312 is not set 363# CONFIG_MTD_PLATRAM is not set
233 364
234# 365#
235# Self-contained MTD device drivers 366# Self-contained MTD device drivers
@@ -237,7 +368,6 @@ CONFIG_MTD_ARM_INTEGRATOR=y
237# CONFIG_MTD_SLRAM is not set 368# CONFIG_MTD_SLRAM is not set
238# CONFIG_MTD_PHRAM is not set 369# CONFIG_MTD_PHRAM is not set
239# CONFIG_MTD_MTDRAM is not set 370# CONFIG_MTD_MTDRAM is not set
240# CONFIG_MTD_BLKMTD is not set
241# CONFIG_MTD_BLOCK2MTD is not set 371# CONFIG_MTD_BLOCK2MTD is not set
242 372
243# 373#
@@ -253,6 +383,11 @@ CONFIG_MTD_ARM_INTEGRATOR=y
253# CONFIG_MTD_NAND is not set 383# CONFIG_MTD_NAND is not set
254 384
255# 385#
386# OneNAND Flash Device Drivers
387#
388# CONFIG_MTD_ONENAND is not set
389
390#
256# Parallel port support 391# Parallel port support
257# 392#
258# CONFIG_PARPORT is not set 393# CONFIG_PARPORT is not set
@@ -264,7 +399,6 @@ CONFIG_MTD_ARM_INTEGRATOR=y
264# 399#
265# Block devices 400# Block devices
266# 401#
267# CONFIG_BLK_DEV_FD is not set
268# CONFIG_BLK_DEV_COW_COMMON is not set 402# CONFIG_BLK_DEV_COW_COMMON is not set
269# CONFIG_BLK_DEV_LOOP is not set 403# CONFIG_BLK_DEV_LOOP is not set
270# CONFIG_BLK_DEV_NBD is not set 404# CONFIG_BLK_DEV_NBD is not set
@@ -272,21 +406,13 @@ CONFIG_BLK_DEV_RAM=y
272CONFIG_BLK_DEV_RAM_COUNT=16 406CONFIG_BLK_DEV_RAM_COUNT=16
273CONFIG_BLK_DEV_RAM_SIZE=4096 407CONFIG_BLK_DEV_RAM_SIZE=4096
274CONFIG_BLK_DEV_INITRD=y 408CONFIG_BLK_DEV_INITRD=y
275CONFIG_INITRAMFS_SOURCE=""
276# CONFIG_CDROM_PKTCDVD is not set 409# CONFIG_CDROM_PKTCDVD is not set
277
278#
279# IO Schedulers
280#
281CONFIG_IOSCHED_NOOP=y
282CONFIG_IOSCHED_AS=y
283CONFIG_IOSCHED_DEADLINE=y
284CONFIG_IOSCHED_CFQ=y
285# CONFIG_ATA_OVER_ETH is not set 410# CONFIG_ATA_OVER_ETH is not set
286 411
287# 412#
288# SCSI device support 413# SCSI device support
289# 414#
415# CONFIG_RAID_ATTRS is not set
290# CONFIG_SCSI is not set 416# CONFIG_SCSI is not set
291 417
292# 418#
@@ -297,6 +423,7 @@ CONFIG_IOSCHED_CFQ=y
297# 423#
298# Fusion MPT device support 424# Fusion MPT device support
299# 425#
426# CONFIG_FUSION is not set
300 427
301# 428#
302# IEEE 1394 (FireWire) support 429# IEEE 1394 (FireWire) support
@@ -307,71 +434,8 @@ CONFIG_IOSCHED_CFQ=y
307# 434#
308 435
309# 436#
310# Networking support 437# Network device support
311#
312CONFIG_NET=y
313
314#
315# Networking options
316#
317CONFIG_PACKET=y
318CONFIG_PACKET_MMAP=y
319# CONFIG_NETLINK_DEV is not set
320CONFIG_UNIX=y
321# CONFIG_NET_KEY is not set
322CONFIG_INET=y
323CONFIG_IP_MULTICAST=y
324# CONFIG_IP_ADVANCED_ROUTER is not set
325CONFIG_IP_PNP=y
326# CONFIG_IP_PNP_DHCP is not set
327CONFIG_IP_PNP_BOOTP=y
328# CONFIG_IP_PNP_RARP is not set
329# CONFIG_NET_IPIP is not set
330# CONFIG_NET_IPGRE is not set
331# CONFIG_IP_MROUTE is not set
332# CONFIG_ARPD is not set
333# CONFIG_SYN_COOKIES is not set
334# CONFIG_INET_AH is not set
335# CONFIG_INET_ESP is not set
336# CONFIG_INET_IPCOMP is not set
337# CONFIG_INET_TUNNEL is not set
338# CONFIG_IP_TCPDIAG is not set
339# CONFIG_IP_TCPDIAG_IPV6 is not set
340# CONFIG_IPV6 is not set
341# CONFIG_NETFILTER is not set
342
343#
344# SCTP Configuration (EXPERIMENTAL)
345#
346# CONFIG_IP_SCTP is not set
347# CONFIG_ATM is not set
348# CONFIG_BRIDGE is not set
349# CONFIG_VLAN_8021Q is not set
350# CONFIG_DECNET is not set
351# CONFIG_LLC2 is not set
352# CONFIG_IPX is not set
353# CONFIG_ATALK is not set
354# CONFIG_X25 is not set
355# CONFIG_LAPB is not set
356# CONFIG_NET_DIVERT is not set
357# CONFIG_ECONET is not set
358# CONFIG_WAN_ROUTER is not set
359
360#
361# QoS and/or fair queueing
362#
363# CONFIG_NET_SCHED is not set
364# CONFIG_NET_CLS_ROUTE is not set
365
366#
367# Network testing
368# 438#
369# CONFIG_NET_PKTGEN is not set
370# CONFIG_NETPOLL is not set
371# CONFIG_NET_POLL_CONTROLLER is not set
372# CONFIG_HAMRADIO is not set
373# CONFIG_IRDA is not set
374# CONFIG_BT is not set
375CONFIG_NETDEVICES=y 439CONFIG_NETDEVICES=y
376# CONFIG_DUMMY is not set 440# CONFIG_DUMMY is not set
377# CONFIG_BONDING is not set 441# CONFIG_BONDING is not set
@@ -379,11 +443,17 @@ CONFIG_NETDEVICES=y
379# CONFIG_TUN is not set 443# CONFIG_TUN is not set
380 444
381# 445#
446# PHY device support
447#
448# CONFIG_PHYLIB is not set
449
450#
382# Ethernet (10 or 100Mbit) 451# Ethernet (10 or 100Mbit)
383# 452#
384CONFIG_NET_ETHERNET=y 453CONFIG_NET_ETHERNET=y
385CONFIG_MII=y 454CONFIG_MII=y
386CONFIG_SMC91X=y 455CONFIG_SMC91X=y
456# CONFIG_DM9000 is not set
387 457
388# 458#
389# Ethernet (1000 Mbit) 459# Ethernet (1000 Mbit)
@@ -410,6 +480,8 @@ CONFIG_SMC91X=y
410# CONFIG_SLIP is not set 480# CONFIG_SLIP is not set
411# CONFIG_SHAPER is not set 481# CONFIG_SHAPER is not set
412# CONFIG_NETCONSOLE is not set 482# CONFIG_NETCONSOLE is not set
483# CONFIG_NETPOLL is not set
484# CONFIG_NET_POLL_CONTROLLER is not set
413 485
414# 486#
415# ISDN subsystem 487# ISDN subsystem
@@ -459,7 +531,6 @@ CONFIG_SERIO_AMBAKMI=y
459CONFIG_SERIO_LIBPS2=y 531CONFIG_SERIO_LIBPS2=y
460# CONFIG_SERIO_RAW is not set 532# CONFIG_SERIO_RAW is not set
461# CONFIG_GAMEPORT is not set 533# CONFIG_GAMEPORT is not set
462CONFIG_SOUND_GAMEPORT=y
463 534
464# 535#
465# Character devices 536# Character devices
@@ -474,17 +545,16 @@ CONFIG_HW_CONSOLE=y
474# 545#
475CONFIG_SERIAL_8250=m 546CONFIG_SERIAL_8250=m
476CONFIG_SERIAL_8250_NR_UARTS=4 547CONFIG_SERIAL_8250_NR_UARTS=4
548CONFIG_SERIAL_8250_RUNTIME_UARTS=4
477CONFIG_SERIAL_8250_EXTENDED=y 549CONFIG_SERIAL_8250_EXTENDED=y
478CONFIG_SERIAL_8250_MANY_PORTS=y 550CONFIG_SERIAL_8250_MANY_PORTS=y
479CONFIG_SERIAL_8250_SHARE_IRQ=y 551CONFIG_SERIAL_8250_SHARE_IRQ=y
480# CONFIG_SERIAL_8250_DETECT_IRQ is not set 552# CONFIG_SERIAL_8250_DETECT_IRQ is not set
481CONFIG_SERIAL_8250_MULTIPORT=y
482CONFIG_SERIAL_8250_RSA=y 553CONFIG_SERIAL_8250_RSA=y
483 554
484# 555#
485# Non-8250 serial port support 556# Non-8250 serial port support
486# 557#
487# CONFIG_SERIAL_AMBA_PL010 is not set
488CONFIG_SERIAL_AMBA_PL011=y 558CONFIG_SERIAL_AMBA_PL011=y
489CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 559CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
490CONFIG_SERIAL_CORE=y 560CONFIG_SERIAL_CORE=y
@@ -503,20 +573,19 @@ CONFIG_LEGACY_PTY_COUNT=16
503# 573#
504# CONFIG_WATCHDOG is not set 574# CONFIG_WATCHDOG is not set
505# CONFIG_NVRAM is not set 575# CONFIG_NVRAM is not set
506# CONFIG_RTC is not set
507# CONFIG_DTLK is not set 576# CONFIG_DTLK is not set
508# CONFIG_R3964 is not set 577# CONFIG_R3964 is not set
509 578
510# 579#
511# Ftape, the floppy tape device driver 580# Ftape, the floppy tape device driver
512# 581#
513# CONFIG_DRM is not set
514# CONFIG_RAW_DRIVER is not set 582# CONFIG_RAW_DRIVER is not set
515 583
516# 584#
517# TPM devices 585# TPM devices
518# 586#
519# CONFIG_TCG_TPM is not set 587# CONFIG_TCG_TPM is not set
588# CONFIG_TELCLOCK is not set
520 589
521# 590#
522# I2C support 591# I2C support
@@ -534,60 +603,60 @@ CONFIG_I2C_ALGOBIT=y
534# 603#
535# I2C Hardware Bus support 604# I2C Hardware Bus support
536# 605#
537# CONFIG_I2C_ISA is not set
538# CONFIG_I2C_PARPORT_LIGHT is not set 606# CONFIG_I2C_PARPORT_LIGHT is not set
539# CONFIG_I2C_STUB is not set 607# CONFIG_I2C_STUB is not set
540# CONFIG_I2C_PCA_ISA is not set 608# CONFIG_I2C_PCA_ISA is not set
541 609
542# 610#
543# Hardware Sensors Chip support 611# Miscellaneous I2C Chip support
544#
545CONFIG_I2C_SENSOR=m
546# CONFIG_SENSORS_ADM1021 is not set
547# CONFIG_SENSORS_ADM1025 is not set
548# CONFIG_SENSORS_ADM1026 is not set
549# CONFIG_SENSORS_ADM1031 is not set
550# CONFIG_SENSORS_ASB100 is not set
551# CONFIG_SENSORS_DS1621 is not set
552# CONFIG_SENSORS_FSCHER is not set
553# CONFIG_SENSORS_FSCPOS is not set
554# CONFIG_SENSORS_GL518SM is not set
555# CONFIG_SENSORS_GL520SM is not set
556# CONFIG_SENSORS_IT87 is not set
557# CONFIG_SENSORS_LM63 is not set
558# CONFIG_SENSORS_LM75 is not set
559# CONFIG_SENSORS_LM77 is not set
560# CONFIG_SENSORS_LM78 is not set
561# CONFIG_SENSORS_LM80 is not set
562# CONFIG_SENSORS_LM83 is not set
563# CONFIG_SENSORS_LM85 is not set
564# CONFIG_SENSORS_LM87 is not set
565# CONFIG_SENSORS_LM90 is not set
566# CONFIG_SENSORS_MAX1619 is not set
567# CONFIG_SENSORS_PC87360 is not set
568# CONFIG_SENSORS_SMSC47B397 is not set
569# CONFIG_SENSORS_SMSC47M1 is not set
570# CONFIG_SENSORS_W83781D is not set
571# CONFIG_SENSORS_W83L785TS is not set
572# CONFIG_SENSORS_W83627HF is not set
573
574#
575# Other I2C Chip support
576# 612#
613# CONFIG_SENSORS_DS1337 is not set
614# CONFIG_SENSORS_DS1374 is not set
577CONFIG_SENSORS_EEPROM=m 615CONFIG_SENSORS_EEPROM=m
578# CONFIG_SENSORS_PCF8574 is not set 616# CONFIG_SENSORS_PCF8574 is not set
617# CONFIG_SENSORS_PCA9539 is not set
579# CONFIG_SENSORS_PCF8591 is not set 618# CONFIG_SENSORS_PCF8591 is not set
580# CONFIG_SENSORS_RTC8564 is not set 619# CONFIG_SENSORS_MAX6875 is not set
581# CONFIG_I2C_DEBUG_CORE is not set 620# CONFIG_I2C_DEBUG_CORE is not set
582# CONFIG_I2C_DEBUG_ALGO is not set 621# CONFIG_I2C_DEBUG_ALGO is not set
583# CONFIG_I2C_DEBUG_BUS is not set 622# CONFIG_I2C_DEBUG_BUS is not set
584# CONFIG_I2C_DEBUG_CHIP is not set 623# CONFIG_I2C_DEBUG_CHIP is not set
585 624
586# 625#
626# SPI support
627#
628# CONFIG_SPI is not set
629# CONFIG_SPI_MASTER is not set
630
631#
632# Dallas's 1-wire bus
633#
634# CONFIG_W1 is not set
635
636#
637# Hardware Monitoring support
638#
639# CONFIG_HWMON is not set
640# CONFIG_HWMON_VID is not set
641
642#
587# Misc devices 643# Misc devices
588# 644#
589 645
590# 646#
647# LED devices
648#
649# CONFIG_NEW_LEDS is not set
650
651#
652# LED drivers
653#
654
655#
656# LED Triggers
657#
658
659#
591# Multimedia devices 660# Multimedia devices
592# 661#
593# CONFIG_VIDEO_DEV is not set 662# CONFIG_VIDEO_DEV is not set
@@ -604,27 +673,31 @@ CONFIG_FB=y
604CONFIG_FB_CFB_FILLRECT=y 673CONFIG_FB_CFB_FILLRECT=y
605CONFIG_FB_CFB_COPYAREA=y 674CONFIG_FB_CFB_COPYAREA=y
606CONFIG_FB_CFB_IMAGEBLIT=y 675CONFIG_FB_CFB_IMAGEBLIT=y
607CONFIG_FB_SOFT_CURSOR=y 676# CONFIG_FB_MACMODES is not set
677# CONFIG_FB_FIRMWARE_EDID is not set
608# CONFIG_FB_MODE_HELPERS is not set 678# CONFIG_FB_MODE_HELPERS is not set
609# CONFIG_FB_TILEBLITTING is not set 679# CONFIG_FB_TILEBLITTING is not set
610CONFIG_FB_ARMCLCD=y 680CONFIG_FB_ARMCLCD=y
681# CONFIG_FB_S1D13XXX is not set
611# CONFIG_FB_VIRTUAL is not set 682# CONFIG_FB_VIRTUAL is not set
612 683
613# 684#
614# Console display driver support 685# Console display driver support
615# 686#
616# CONFIG_VGA_CONSOLE is not set
617CONFIG_DUMMY_CONSOLE=y 687CONFIG_DUMMY_CONSOLE=y
618CONFIG_FRAMEBUFFER_CONSOLE=y 688CONFIG_FRAMEBUFFER_CONSOLE=y
689# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
619CONFIG_FONTS=y 690CONFIG_FONTS=y
620# CONFIG_FONT_8x8 is not set 691# CONFIG_FONT_8x8 is not set
621# CONFIG_FONT_8x16 is not set 692# CONFIG_FONT_8x16 is not set
622# CONFIG_FONT_6x11 is not set 693# CONFIG_FONT_6x11 is not set
694# CONFIG_FONT_7x14 is not set
623# CONFIG_FONT_PEARL_8x8 is not set 695# CONFIG_FONT_PEARL_8x8 is not set
624CONFIG_FONT_ACORN_8x8=y 696CONFIG_FONT_ACORN_8x8=y
625# CONFIG_FONT_MINI_4x6 is not set 697# CONFIG_FONT_MINI_4x6 is not set
626# CONFIG_FONT_SUN8x16 is not set 698# CONFIG_FONT_SUN8x16 is not set
627# CONFIG_FONT_SUN12x22 is not set 699# CONFIG_FONT_SUN12x22 is not set
700# CONFIG_FONT_10x18 is not set
628 701
629# 702#
630# Logo configuration 703# Logo configuration
@@ -647,12 +720,18 @@ CONFIG_SND_PCM=m
647CONFIG_SND_OSSEMUL=y 720CONFIG_SND_OSSEMUL=y
648CONFIG_SND_MIXER_OSS=m 721CONFIG_SND_MIXER_OSS=m
649CONFIG_SND_PCM_OSS=m 722CONFIG_SND_PCM_OSS=m
723CONFIG_SND_PCM_OSS_PLUGINS=y
724# CONFIG_SND_DYNAMIC_MINORS is not set
725CONFIG_SND_SUPPORT_OLD_API=y
726CONFIG_SND_VERBOSE_PROCFS=y
650# CONFIG_SND_VERBOSE_PRINTK is not set 727# CONFIG_SND_VERBOSE_PRINTK is not set
651# CONFIG_SND_DEBUG is not set 728# CONFIG_SND_DEBUG is not set
652 729
653# 730#
654# Generic devices 731# Generic devices
655# 732#
733CONFIG_SND_AC97_CODEC=m
734CONFIG_SND_AC97_BUS=m
656# CONFIG_SND_DUMMY is not set 735# CONFIG_SND_DUMMY is not set
657# CONFIG_SND_MTPAV is not set 736# CONFIG_SND_MTPAV is not set
658# CONFIG_SND_SERIAL_U16550 is not set 737# CONFIG_SND_SERIAL_U16550 is not set
@@ -661,6 +740,7 @@ CONFIG_SND_PCM_OSS=m
661# 740#
662# ALSA ARM devices 741# ALSA ARM devices
663# 742#
743CONFIG_SND_ARMAACI=m
664 744
665# 745#
666# Open Sound System 746# Open Sound System
@@ -672,9 +752,14 @@ CONFIG_SND_PCM_OSS=m
672# 752#
673CONFIG_USB_ARCH_HAS_HCD=y 753CONFIG_USB_ARCH_HAS_HCD=y
674# CONFIG_USB_ARCH_HAS_OHCI is not set 754# CONFIG_USB_ARCH_HAS_OHCI is not set
755# CONFIG_USB_ARCH_HAS_EHCI is not set
675# CONFIG_USB is not set 756# CONFIG_USB is not set
676 757
677# 758#
759# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
760#
761
762#
678# USB Gadget Support 763# USB Gadget Support
679# 764#
680# CONFIG_USB_GADGET is not set 765# CONFIG_USB_GADGET is not set
@@ -688,25 +773,31 @@ CONFIG_MMC_BLOCK=y
688CONFIG_MMC_ARMMMCI=m 773CONFIG_MMC_ARMMMCI=m
689 774
690# 775#
776# Real Time Clock
777#
778CONFIG_RTC_LIB=y
779# CONFIG_RTC_CLASS is not set
780
781#
691# File systems 782# File systems
692# 783#
693CONFIG_EXT2_FS=y 784CONFIG_EXT2_FS=y
694# CONFIG_EXT2_FS_XATTR is not set 785# CONFIG_EXT2_FS_XATTR is not set
786# CONFIG_EXT2_FS_XIP is not set
695# CONFIG_EXT3_FS is not set 787# CONFIG_EXT3_FS is not set
696# CONFIG_JBD is not set
697# CONFIG_REISERFS_FS is not set 788# CONFIG_REISERFS_FS is not set
698# CONFIG_JFS_FS is not set 789# CONFIG_JFS_FS is not set
699 790# CONFIG_FS_POSIX_ACL is not set
700#
701# XFS support
702#
703# CONFIG_XFS_FS is not set 791# CONFIG_XFS_FS is not set
792# CONFIG_OCFS2_FS is not set
704CONFIG_MINIX_FS=y 793CONFIG_MINIX_FS=y
705CONFIG_ROMFS_FS=y 794CONFIG_ROMFS_FS=y
795# CONFIG_INOTIFY is not set
706# CONFIG_QUOTA is not set 796# CONFIG_QUOTA is not set
707CONFIG_DNOTIFY=y 797CONFIG_DNOTIFY=y
708# CONFIG_AUTOFS_FS is not set 798# CONFIG_AUTOFS_FS is not set
709# CONFIG_AUTOFS4_FS is not set 799# CONFIG_AUTOFS4_FS is not set
800# CONFIG_FUSE_FS is not set
710 801
711# 802#
712# CD-ROM/DVD Filesystems 803# CD-ROM/DVD Filesystems
@@ -729,11 +820,10 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
729# 820#
730CONFIG_PROC_FS=y 821CONFIG_PROC_FS=y
731CONFIG_SYSFS=y 822CONFIG_SYSFS=y
732# CONFIG_DEVFS_FS is not set
733# CONFIG_DEVPTS_FS_XATTR is not set
734# CONFIG_TMPFS is not set 823# CONFIG_TMPFS is not set
735# CONFIG_HUGETLB_PAGE is not set 824# CONFIG_HUGETLB_PAGE is not set
736CONFIG_RAMFS=y 825CONFIG_RAMFS=y
826# CONFIG_CONFIGFS_FS is not set
737 827
738# 828#
739# Miscellaneous filesystems 829# Miscellaneous filesystems
@@ -748,8 +838,8 @@ CONFIG_RAMFS=y
748# CONFIG_JFFS_FS is not set 838# CONFIG_JFFS_FS is not set
749CONFIG_JFFS2_FS=y 839CONFIG_JFFS2_FS=y
750CONFIG_JFFS2_FS_DEBUG=0 840CONFIG_JFFS2_FS_DEBUG=0
751# CONFIG_JFFS2_FS_NAND is not set 841CONFIG_JFFS2_FS_WRITEBUFFER=y
752# CONFIG_JFFS2_FS_NOR_ECC is not set 842# CONFIG_JFFS2_SUMMARY is not set
753# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 843# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
754CONFIG_JFFS2_ZLIB=y 844CONFIG_JFFS2_ZLIB=y
755CONFIG_JFFS2_RTIME=y 845CONFIG_JFFS2_RTIME=y
@@ -766,16 +856,19 @@ CONFIG_CRAMFS=y
766# 856#
767CONFIG_NFS_FS=y 857CONFIG_NFS_FS=y
768CONFIG_NFS_V3=y 858CONFIG_NFS_V3=y
859# CONFIG_NFS_V3_ACL is not set
769# CONFIG_NFS_V4 is not set 860# CONFIG_NFS_V4 is not set
770# CONFIG_NFS_DIRECTIO is not set 861# CONFIG_NFS_DIRECTIO is not set
771CONFIG_NFSD=y 862CONFIG_NFSD=y
772CONFIG_NFSD_V3=y 863CONFIG_NFSD_V3=y
864# CONFIG_NFSD_V3_ACL is not set
773# CONFIG_NFSD_V4 is not set 865# CONFIG_NFSD_V4 is not set
774# CONFIG_NFSD_TCP is not set 866# CONFIG_NFSD_TCP is not set
775CONFIG_ROOT_NFS=y 867CONFIG_ROOT_NFS=y
776CONFIG_LOCKD=y 868CONFIG_LOCKD=y
777CONFIG_LOCKD_V4=y 869CONFIG_LOCKD_V4=y
778CONFIG_EXPORTFS=y 870CONFIG_EXPORTFS=y
871CONFIG_NFS_COMMON=y
779CONFIG_SUNRPC=y 872CONFIG_SUNRPC=y
780# CONFIG_RPCSEC_GSS_KRB5 is not set 873# CONFIG_RPCSEC_GSS_KRB5 is not set
781# CONFIG_RPCSEC_GSS_SPKM3 is not set 874# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -784,6 +877,7 @@ CONFIG_SUNRPC=y
784# CONFIG_NCP_FS is not set 877# CONFIG_NCP_FS is not set
785# CONFIG_CODA_FS is not set 878# CONFIG_CODA_FS is not set
786# CONFIG_AFS_FS is not set 879# CONFIG_AFS_FS is not set
880# CONFIG_9P_FS is not set
787 881
788# 882#
789# Partition Types 883# Partition Types
@@ -803,6 +897,7 @@ CONFIG_MSDOS_PARTITION=y
803# CONFIG_SGI_PARTITION is not set 897# CONFIG_SGI_PARTITION is not set
804# CONFIG_ULTRIX_PARTITION is not set 898# CONFIG_ULTRIX_PARTITION is not set
805# CONFIG_SUN_PARTITION is not set 899# CONFIG_SUN_PARTITION is not set
900# CONFIG_KARMA_PARTITION is not set
806# CONFIG_EFI_PARTITION is not set 901# CONFIG_EFI_PARTITION is not set
807 902
808# 903#
@@ -858,18 +953,24 @@ CONFIG_NLS_ISO8859_1=m
858# Kernel hacking 953# Kernel hacking
859# 954#
860# CONFIG_PRINTK_TIME is not set 955# CONFIG_PRINTK_TIME is not set
861CONFIG_DEBUG_KERNEL=y
862CONFIG_MAGIC_SYSRQ=y 956CONFIG_MAGIC_SYSRQ=y
957CONFIG_DEBUG_KERNEL=y
863CONFIG_LOG_BUF_SHIFT=14 958CONFIG_LOG_BUF_SHIFT=14
959CONFIG_DETECT_SOFTLOCKUP=y
864# CONFIG_SCHEDSTATS is not set 960# CONFIG_SCHEDSTATS is not set
865# CONFIG_DEBUG_SLAB is not set 961# CONFIG_DEBUG_SLAB is not set
962# CONFIG_DEBUG_MUTEXES is not set
866# CONFIG_DEBUG_SPINLOCK is not set 963# CONFIG_DEBUG_SPINLOCK is not set
867# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 964# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
868# CONFIG_DEBUG_KOBJECT is not set 965# CONFIG_DEBUG_KOBJECT is not set
869CONFIG_DEBUG_BUGVERBOSE=y 966CONFIG_DEBUG_BUGVERBOSE=y
870# CONFIG_DEBUG_INFO is not set 967# CONFIG_DEBUG_INFO is not set
871# CONFIG_DEBUG_FS is not set 968# CONFIG_DEBUG_FS is not set
969# CONFIG_DEBUG_VM is not set
872CONFIG_FRAME_POINTER=y 970CONFIG_FRAME_POINTER=y
971# CONFIG_UNWIND_INFO is not set
972CONFIG_FORCED_INLINING=y
973# CONFIG_RCU_TORTURE_TEST is not set
873CONFIG_DEBUG_USER=y 974CONFIG_DEBUG_USER=y
874# CONFIG_DEBUG_WAITQ is not set 975# CONFIG_DEBUG_WAITQ is not set
875CONFIG_DEBUG_ERRORS=y 976CONFIG_DEBUG_ERRORS=y
@@ -895,6 +996,7 @@ CONFIG_DEBUG_LL=y
895# Library routines 996# Library routines
896# 997#
897# CONFIG_CRC_CCITT is not set 998# CONFIG_CRC_CCITT is not set
999# CONFIG_CRC16 is not set
898CONFIG_CRC32=y 1000CONFIG_CRC32=y
899# CONFIG_LIBCRC32C is not set 1001# CONFIG_LIBCRC32C is not set
900CONFIG_ZLIB_INFLATE=y 1002CONFIG_ZLIB_INFLATE=y
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index b324dcac1c56..45fdf4a51a2a 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -95,5 +95,11 @@ int main(void)
95 DEFINE(SYS_ERROR0, 0x9f0000); 95 DEFINE(SYS_ERROR0, 0x9f0000);
96 BLANK(); 96 BLANK();
97 DEFINE(SIZEOF_MACHINE_DESC, sizeof(struct machine_desc)); 97 DEFINE(SIZEOF_MACHINE_DESC, sizeof(struct machine_desc));
98 DEFINE(MACHINFO_TYPE, offsetof(struct machine_desc, nr));
99 DEFINE(MACHINFO_NAME, offsetof(struct machine_desc, name));
100 DEFINE(MACHINFO_PHYSIO, offsetof(struct machine_desc, phys_io));
101 DEFINE(MACHINFO_PGOFFIO, offsetof(struct machine_desc, io_pg_offst));
102 DEFINE(PROCINFO_INITFUNC, offsetof(struct proc_info_list, __cpu_flush));
103 DEFINE(PROCINFO_MMUFLAGS, offsetof(struct proc_info_list, __cpu_mmu_flags));
98 return 0; 104 return 0;
99} 105}
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 0bea65864051..adf62e5eaad7 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -20,12 +20,10 @@
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/procinfo.h> 21#include <asm/procinfo.h>
22#include <asm/ptrace.h> 22#include <asm/ptrace.h>
23#include <asm/asm-offsets.h>
23#include <asm/thread_info.h> 24#include <asm/thread_info.h>
24#include <asm/system.h> 25#include <asm/system.h>
25 26
26#define PROCINFO_INITFUNC 12
27#define MACHINFO_TYPE 0
28
29/* 27/*
30 * Kernel startup entry point. 28 * Kernel startup entry point.
31 * --------------------------- 29 * ---------------------------
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 04b66a9328ef..04f7344e356a 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -24,14 +24,6 @@
24#include <asm/thread_info.h> 24#include <asm/thread_info.h>
25#include <asm/system.h> 25#include <asm/system.h>
26 26
27#define PROCINFO_MMUFLAGS 8
28#define PROCINFO_INITFUNC 12
29
30#define MACHINFO_TYPE 0
31#define MACHINFO_PHYSIO 4
32#define MACHINFO_PGOFFIO 8
33#define MACHINFO_NAME 12
34
35#define KERNEL_RAM_ADDR (PAGE_OFFSET + TEXT_OFFSET) 27#define KERNEL_RAM_ADDR (PAGE_OFFSET + TEXT_OFFSET)
36 28
37/* 29/*
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 1ff75cee4b0d..1a1539e3a946 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -264,8 +264,12 @@ void show_fpregs(struct user_fp *regs)
264/* 264/*
265 * Task structure and kernel stack allocation. 265 * Task structure and kernel stack allocation.
266 */ 266 */
267static unsigned long *thread_info_head; 267struct thread_info_list {
268static unsigned int nr_thread_info; 268 unsigned long *head;
269 unsigned int nr;
270};
271
272static DEFINE_PER_CPU(struct thread_info_list, thread_info_list) = { NULL, 0 };
269 273
270#define EXTRA_TASK_STRUCT 4 274#define EXTRA_TASK_STRUCT 4
271 275
@@ -274,12 +278,15 @@ struct thread_info *alloc_thread_info(struct task_struct *task)
274 struct thread_info *thread = NULL; 278 struct thread_info *thread = NULL;
275 279
276 if (EXTRA_TASK_STRUCT) { 280 if (EXTRA_TASK_STRUCT) {
277 unsigned long *p = thread_info_head; 281 struct thread_info_list *th = &get_cpu_var(thread_info_list);
282 unsigned long *p = th->head;
278 283
279 if (p) { 284 if (p) {
280 thread_info_head = (unsigned long *)p[0]; 285 th->head = (unsigned long *)p[0];
281 nr_thread_info -= 1; 286 th->nr -= 1;
282 } 287 }
288 put_cpu_var(thread_info_list);
289
283 thread = (struct thread_info *)p; 290 thread = (struct thread_info *)p;
284 } 291 }
285 292
@@ -300,13 +307,19 @@ struct thread_info *alloc_thread_info(struct task_struct *task)
300 307
301void free_thread_info(struct thread_info *thread) 308void free_thread_info(struct thread_info *thread)
302{ 309{
303 if (EXTRA_TASK_STRUCT && nr_thread_info < EXTRA_TASK_STRUCT) { 310 if (EXTRA_TASK_STRUCT) {
304 unsigned long *p = (unsigned long *)thread; 311 struct thread_info_list *th = &get_cpu_var(thread_info_list);
305 p[0] = (unsigned long)thread_info_head; 312 if (th->nr < EXTRA_TASK_STRUCT) {
306 thread_info_head = p; 313 unsigned long *p = (unsigned long *)thread;
307 nr_thread_info += 1; 314 p[0] = th->head;
308 } else 315 th->head = p;
309 free_pages((unsigned long)thread, THREAD_SIZE_ORDER); 316 th->nr += 1;
317 put_cpu_var(thread_info_list);
318 return;
319 }
320 put_cpu_var(thread_info_list);
321 }
322 free_pages((unsigned long)thread, THREAD_SIZE_ORDER);
310} 323}
311 324
312/* 325/*
diff --git a/arch/arm/mach-aaec2000/aaed2000.c b/arch/arm/mach-aaec2000/aaed2000.c
index dc5fa8e5ebef..83f57da3184c 100644
--- a/arch/arm/mach-aaec2000/aaed2000.c
+++ b/arch/arm/mach-aaec2000/aaed2000.c
@@ -79,7 +79,12 @@ static void __init aaed2000_init(void)
79} 79}
80 80
81static struct map_desc aaed2000_io_desc[] __initdata = { 81static struct map_desc aaed2000_io_desc[] __initdata = {
82 { EXT_GPIO_VBASE, EXT_GPIO_PBASE, EXT_GPIO_LENGTH, MT_DEVICE }, /* Ext GPIO */ 82 {
83 .virtual = EXT_GPIO_VBASE,
84 .pfn = __phys_to_pfn(EXT_GPIO_PBASE),
85 .length = EXT_GPIO_LENGTH,
86 .type = MT_DEVICE
87 },
83}; 88};
84 89
85static void __init aaed2000_map_io(void) 90static void __init aaed2000_map_io(void)
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index dce4815cf53c..65be5efd633c 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -20,7 +20,6 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/timex.h> 21#include <linux/timex.h>
22#include <linux/signal.h> 22#include <linux/signal.h>
23#include <linux/amba/bus.h>
24 23
25#include <asm/hardware.h> 24#include <asm/hardware.h>
26#include <asm/irq.h> 25#include <asm/irq.h>
@@ -50,12 +49,12 @@
50static struct map_desc standard_io_desc[] __initdata = { 49static struct map_desc standard_io_desc[] __initdata = {
51 { 50 {
52 .virtual = VIO_APB_BASE, 51 .virtual = VIO_APB_BASE,
53 .physical = __phys_to_pfn(PIO_APB_BASE), 52 .pfn = __phys_to_pfn(PIO_APB_BASE),
54 .length = IO_APB_LENGTH, 53 .length = IO_APB_LENGTH,
55 .type = MT_DEVICE 54 .type = MT_DEVICE
56 }, { 55 }, {
57 .virtual = VIO_AHB_BASE, 56 .virtual = VIO_AHB_BASE,
58 .physical = __phys_to_pfn(PIO_AHB_BASE), 57 .pfn = __phys_to_pfn(PIO_AHB_BASE),
59 .length = IO_AHB_LENGTH, 58 .length = IO_AHB_LENGTH,
60 .type = MT_DEVICE 59 .type = MT_DEVICE
61 } 60 }
diff --git a/arch/arm/mach-aaec2000/core.h b/arch/arm/mach-aaec2000/core.h
index b6029a95f19c..59501b573167 100644
--- a/arch/arm/mach-aaec2000/core.h
+++ b/arch/arm/mach-aaec2000/core.h
@@ -9,6 +9,7 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/amba/bus.h>
12#include <linux/amba/clcd.h> 13#include <linux/amba/clcd.h>
13 14
14struct sys_timer; 15struct sys_timer;
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index 9d8331be2b58..12ea58a3b84f 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -195,56 +195,6 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data *info)
195} 195}
196EXPORT_SYMBOL(imx_set_mmc_info); 196EXPORT_SYMBOL(imx_set_mmc_info);
197 197
198static struct resource imx_uart1_resources[] = {
199 [0] = {
200 .start = 0x00206000,
201 .end = 0x002060FF,
202 .flags = IORESOURCE_MEM,
203 },
204 [1] = {
205 .start = (UART1_MINT_RX),
206 .end = (UART1_MINT_RX),
207 .flags = IORESOURCE_IRQ,
208 },
209 [2] = {
210 .start = (UART1_MINT_TX),
211 .end = (UART1_MINT_TX),
212 .flags = IORESOURCE_IRQ,
213 },
214};
215
216static struct platform_device imx_uart1_device = {
217 .name = "imx-uart",
218 .id = 0,
219 .num_resources = ARRAY_SIZE(imx_uart1_resources),
220 .resource = imx_uart1_resources,
221};
222
223static struct resource imx_uart2_resources[] = {
224 [0] = {
225 .start = 0x00207000,
226 .end = 0x002070FF,
227 .flags = IORESOURCE_MEM,
228 },
229 [1] = {
230 .start = (UART2_MINT_RX),
231 .end = (UART2_MINT_RX),
232 .flags = IORESOURCE_IRQ,
233 },
234 [2] = {
235 .start = (UART2_MINT_TX),
236 .end = (UART2_MINT_TX),
237 .flags = IORESOURCE_IRQ,
238 },
239};
240
241static struct platform_device imx_uart2_device = {
242 .name = "imx-uart",
243 .id = 1,
244 .num_resources = ARRAY_SIZE(imx_uart2_resources),
245 .resource = imx_uart2_resources,
246};
247
248static struct imxfb_mach_info imx_fb_info; 198static struct imxfb_mach_info imx_fb_info;
249 199
250void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info) 200void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
@@ -283,8 +233,6 @@ static struct platform_device imxfb_device = {
283static struct platform_device *devices[] __initdata = { 233static struct platform_device *devices[] __initdata = {
284 &imx_mmc_device, 234 &imx_mmc_device,
285 &imxfb_device, 235 &imxfb_device,
286 &imx_uart1_device,
287 &imx_uart2_device,
288}; 236};
289 237
290static struct map_desc imx_io_desc[] __initdata = { 238static struct map_desc imx_io_desc[] __initdata = {
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index e34d0df90aed..da893c80d471 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/arch/mmc.h> 28#include <asm/arch/mmc.h>
29#include <asm/arch/imx-uart.h>
29#include <linux/interrupt.h> 30#include <linux/interrupt.h>
30#include "generic.h" 31#include "generic.h"
31 32
@@ -48,8 +49,70 @@ static struct platform_device cs89x0_device = {
48 .resource = cs89x0_resources, 49 .resource = cs89x0_resources,
49}; 50};
50 51
52static struct imxuart_platform_data uart_pdata = {
53 .flags = IMXUART_HAVE_RTSCTS,
54};
55
56static struct resource imx_uart1_resources[] = {
57 [0] = {
58 .start = 0x00206000,
59 .end = 0x002060FF,
60 .flags = IORESOURCE_MEM,
61 },
62 [1] = {
63 .start = (UART1_MINT_RX),
64 .end = (UART1_MINT_RX),
65 .flags = IORESOURCE_IRQ,
66 },
67 [2] = {
68 .start = (UART1_MINT_TX),
69 .end = (UART1_MINT_TX),
70 .flags = IORESOURCE_IRQ,
71 },
72};
73
74static struct platform_device imx_uart1_device = {
75 .name = "imx-uart",
76 .id = 0,
77 .num_resources = ARRAY_SIZE(imx_uart1_resources),
78 .resource = imx_uart1_resources,
79 .dev = {
80 .platform_data = &uart_pdata,
81 }
82};
83
84static struct resource imx_uart2_resources[] = {
85 [0] = {
86 .start = 0x00207000,
87 .end = 0x002070FF,
88 .flags = IORESOURCE_MEM,
89 },
90 [1] = {
91 .start = (UART2_MINT_RX),
92 .end = (UART2_MINT_RX),
93 .flags = IORESOURCE_IRQ,
94 },
95 [2] = {
96 .start = (UART2_MINT_TX),
97 .end = (UART2_MINT_TX),
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
102static struct platform_device imx_uart2_device = {
103 .name = "imx-uart",
104 .id = 1,
105 .num_resources = ARRAY_SIZE(imx_uart2_resources),
106 .resource = imx_uart2_resources,
107 .dev = {
108 .platform_data = &uart_pdata,
109 }
110};
111
51static struct platform_device *devices[] __initdata = { 112static struct platform_device *devices[] __initdata = {
52 &cs89x0_device, 113 &cs89x0_device,
114 &imx_uart1_device,
115 &imx_uart2_device,
53}; 116};
54 117
55#ifdef CONFIG_MMC_IMX 118#ifdef CONFIG_MMC_IMX
@@ -75,6 +138,17 @@ mx1ads_init(void)
75 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20); 138 imx_gpio_mode(GPIO_PORTB | GPIO_GIUS | GPIO_IN | 20);
76 imx_set_mmc_info(&mx1ads_mmc_info); 139 imx_set_mmc_info(&mx1ads_mmc_info);
77#endif 140#endif
141
142 imx_gpio_mode(PC9_PF_UART1_CTS);
143 imx_gpio_mode(PC10_PF_UART1_RTS);
144 imx_gpio_mode(PC11_PF_UART1_TXD);
145 imx_gpio_mode(PC12_PF_UART1_RXD);
146
147 imx_gpio_mode(PB28_PF_UART2_CTS);
148 imx_gpio_mode(PB29_PF_UART2_RTS);
149 imx_gpio_mode(PB30_PF_UART2_TXD);
150 imx_gpio_mode(PB31_PF_UART2_RXD);
151
78 platform_add_devices(devices, ARRAY_SIZE(devices)); 152 platform_add_devices(devices, ARRAY_SIZE(devices));
79} 153}
80 154
@@ -87,7 +161,7 @@ mx1ads_map_io(void)
87MACHINE_START(MX1ADS, "Motorola MX1ADS") 161MACHINE_START(MX1ADS, "Motorola MX1ADS")
88 /* Maintainer: Sascha Hauer, Pengutronix */ 162 /* Maintainer: Sascha Hauer, Pengutronix */
89 .phys_io = 0x00200000, 163 .phys_io = 0x00200000,
90 .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, 164 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
91 .boot_params = 0x08000100, 165 .boot_params = 0x08000100,
92 .map_io = mx1ads_map_io, 166 .map_io = mx1ads_map_io,
93 .init_irq = imx_init_irq, 167 .init_irq = imx_init_irq,
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index 5bf50a2a737d..2a39f9e481ad 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -11,6 +11,7 @@ comment "IXP4xx Platforms"
11config MACH_NSLU2 11config MACH_NSLU2
12 bool 12 bool
13 prompt "Linksys NSLU2" 13 prompt "Linksys NSLU2"
14 select PCI
14 help 15 help
15 Say 'Y' here if you want your kernel to support Linksys's 16 Say 'Y' here if you want your kernel to support Linksys's
16 NSLU2 NAS device. For more information on this platform, 17 NSLU2 NAS device. For more information on this platform,
@@ -18,6 +19,7 @@ config MACH_NSLU2
18 19
19config ARCH_AVILA 20config ARCH_AVILA
20 bool "Avila" 21 bool "Avila"
22 select PCI
21 help 23 help
22 Say 'Y' here if you want your kernel to support the Gateworks 24 Say 'Y' here if you want your kernel to support the Gateworks
23 Avila Network Platform. For more information on this platform, 25 Avila Network Platform. For more information on this platform,
@@ -25,6 +27,7 @@ config ARCH_AVILA
25 27
26config ARCH_ADI_COYOTE 28config ARCH_ADI_COYOTE
27 bool "Coyote" 29 bool "Coyote"
30 select PCI
28 help 31 help
29 Say 'Y' here if you want your kernel to support the ADI 32 Say 'Y' here if you want your kernel to support the ADI
30 Engineering Coyote Gateway Reference Platform. For more 33 Engineering Coyote Gateway Reference Platform. For more
@@ -32,6 +35,7 @@ config ARCH_ADI_COYOTE
32 35
33config ARCH_IXDP425 36config ARCH_IXDP425
34 bool "IXDP425" 37 bool "IXDP425"
38 select PCI
35 help 39 help
36 Say 'Y' here if you want your kernel to support Intel's 40 Say 'Y' here if you want your kernel to support Intel's
37 IXDP425 Development Platform (Also known as Richfield). 41 IXDP425 Development Platform (Also known as Richfield).
@@ -39,6 +43,7 @@ config ARCH_IXDP425
39 43
40config MACH_IXDPG425 44config MACH_IXDPG425
41 bool "IXDPG425" 45 bool "IXDPG425"
46 select PCI
42 help 47 help
43 Say 'Y' here if you want your kernel to support Intel's 48 Say 'Y' here if you want your kernel to support Intel's
44 IXDPG425 Development Platform (Also known as Montajade). 49 IXDPG425 Development Platform (Also known as Montajade).
@@ -46,6 +51,7 @@ config MACH_IXDPG425
46 51
47config MACH_IXDP465 52config MACH_IXDP465
48 bool "IXDP465" 53 bool "IXDP465"
54 select PCI
49 help 55 help
50 Say 'Y' here if you want your kernel to support Intel's 56 Say 'Y' here if you want your kernel to support Intel's
51 IXDP465 Development Platform (Also known as BMP). 57 IXDP465 Development Platform (Also known as BMP).
@@ -72,6 +78,7 @@ config ARCH_PRPMC1100
72config MACH_NAS100D 78config MACH_NAS100D
73 bool 79 bool
74 prompt "NAS100D" 80 prompt "NAS100D"
81 select PCI
75 help 82 help
76 Say 'Y' here if you want your kernel to support Iomega's 83 Say 'Y' here if you want your kernel to support Iomega's
77 NAS 100d device. For more information on this platform, 84 NAS 100d device. For more information on this platform,
@@ -96,6 +103,7 @@ config CPU_IXP46X
96config MACH_GTWX5715 103config MACH_GTWX5715
97 bool "Gemtek WX5715 (Linksys WRV54G)" 104 bool "Gemtek WX5715 (Linksys WRV54G)"
98 depends on ARCH_IXP4XX 105 depends on ARCH_IXP4XX
106 select PCI
99 help 107 help
100 This board is currently inside the Linksys WRV54G Gateways. 108 This board is currently inside the Linksys WRV54G Gateways.
101 109
@@ -110,11 +118,16 @@ config MACH_GTWX5715
110 "High Speed" UART is n/c (as far as I can tell) 118 "High Speed" UART is n/c (as far as I can tell)
111 20 Pin ARM/Xscale JTAG interface on J2 119 20 Pin ARM/Xscale JTAG interface on J2
112 120
113
114comment "IXP4xx Options" 121comment "IXP4xx Options"
115 122
123config DMABOUNCE
124 bool
125 default y
126 depends on PCI
127
116config IXP4XX_INDIRECT_PCI 128config IXP4XX_INDIRECT_PCI
117 bool "Use indirect PCI memory access" 129 bool "Use indirect PCI memory access"
130 depends on PCI
118 help 131 help
119 IXP4xx provides two methods of accessing PCI memory space: 132 IXP4xx provides two methods of accessing PCI memory space:
120 133
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index 0471044fa179..5a4aaa0e0a09 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -2,8 +2,9 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5obj-y += common.o common-pci.o 5obj-y += common.o
6 6
7obj-$(CONFIG_PCI) += common-pci.o
7obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o ixdp425-setup.o 8obj-$(CONFIG_ARCH_IXDP4XX) += ixdp425-pci.o ixdp425-setup.o
8obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o 9obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o
9obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o 10obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o
diff --git a/arch/arm/mach-pxa/dma.c b/arch/arm/mach-pxa/dma.c
index 458112b21e25..7d8c85486c66 100644
--- a/arch/arm/mach-pxa/dma.c
+++ b/arch/arm/mach-pxa/dma.c
@@ -45,23 +45,16 @@ int pxa_request_dma (char *name, pxa_dma_prio prio,
45 45
46 local_irq_save(flags); 46 local_irq_save(flags);
47 47
48 /* try grabbing a DMA channel with the requested priority */ 48 do {
49 for (i = prio; i < prio + PXA_DMA_NBCH(prio); i++) { 49 /* try grabbing a DMA channel with the requested priority */
50 if (!dma_channels[i].name) { 50 pxa_for_each_dma_prio (i, prio) {
51 found = 1;
52 break;
53 }
54 }
55
56 if (!found) {
57 /* requested prio group is full, try hier priorities */
58 for (i = prio-1; i >= 0; i--) {
59 if (!dma_channels[i].name) { 51 if (!dma_channels[i].name) {
60 found = 1; 52 found = 1;
61 break; 53 break;
62 } 54 }
63 } 55 }
64 } 56 /* if requested prio group is full, try a hier priority */
57 } while (!found && prio--);
65 58
66 if (found) { 59 if (found) {
67 DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR; 60 DCSR(i) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index c131a5201b5b..b3a56024182e 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -199,10 +199,26 @@ static void sa1100_unmask_irq(unsigned int irq)
199 ICMR |= (1 << irq); 199 ICMR |= (1 << irq);
200} 200}
201 201
202/*
203 * Apart form GPIOs, only the RTC alarm can be a wakeup event.
204 */
205static int sa1100_set_wake(unsigned int irq, unsigned int on)
206{
207 if (irq == IRQ_RTCAlrm) {
208 if (on)
209 PWER |= PWER_RTC;
210 else
211 PWER &= ~PWER_RTC;
212 return 0;
213 }
214 return -EINVAL;
215}
216
202static struct irqchip sa1100_normal_chip = { 217static struct irqchip sa1100_normal_chip = {
203 .ack = sa1100_mask_irq, 218 .ack = sa1100_mask_irq,
204 .mask = sa1100_mask_irq, 219 .mask = sa1100_mask_irq,
205 .unmask = sa1100_unmask_irq, 220 .unmask = sa1100_unmask_irq,
221 .set_wake = sa1100_set_wake,
206}; 222};
207 223
208static struct resource irq_resource = { 224static struct resource irq_resource = {
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 8ab5300dcb94..6d7de9c0412f 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Mon Feb 20 10:18:02 2006 15# Last update: Mon May 8 20:11:05 2006
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -566,8 +566,8 @@ switchgrass MACH_SWITCHGRASS SWITCHGRASS 549
566ens_cmu MACH_ENS_CMU ENS_CMU 550 566ens_cmu MACH_ENS_CMU ENS_CMU 550
567mm6_sdb MACH_MM6_SDB MM6_SDB 551 567mm6_sdb MACH_MM6_SDB MM6_SDB 551
568saturn MACH_SATURN SATURN 552 568saturn MACH_SATURN SATURN 552
569argonplusevb MACH_ARGONPLUSEVB ARGONPLUSEVB 553 569i30030evb MACH_ARGONPLUSEVB ARGONPLUSEVB 553
570scma11evb MACH_SCMA11EVB SCMA11EVB 554 570mxc27530evb MACH_SCMA11EVB SCMA11EVB 554
571smdk2800 MACH_SMDK2800 SMDK2800 555 571smdk2800 MACH_SMDK2800 SMDK2800 555
572mtwilson MACH_MTWILSON MTWILSON 556 572mtwilson MACH_MTWILSON MTWILSON 556
573ziti MACH_ZITI ZITI 557 573ziti MACH_ZITI ZITI 557
@@ -647,7 +647,7 @@ sendt MACH_SENDT SENDT 630
647mx2jazz MACH_MX2JAZZ MX2JAZZ 631 647mx2jazz MACH_MX2JAZZ MX2JAZZ 631
648multiio MACH_MULTIIO MULTIIO 632 648multiio MACH_MULTIIO MULTIIO 632
649hrdisplay MACH_HRDISPLAY HRDISPLAY 633 649hrdisplay MACH_HRDISPLAY HRDISPLAY 633
650scma11bb MACH_SCMA11BB SCMA11BB 634 650mxc27530ads MACH_SCMA11BB SCMA11BB 634
651trizeps3 MACH_TRIZEPS3 TRIZEPS3 635 651trizeps3 MACH_TRIZEPS3 TRIZEPS3 635
652zefeerdza MACH_ZEFEERDZA ZEFEERDZA 636 652zefeerdza MACH_ZEFEERDZA ZEFEERDZA 636
653zefeerdzb MACH_ZEFEERDZB ZEFEERDZB 637 653zefeerdzb MACH_ZEFEERDZB ZEFEERDZB 637
@@ -721,7 +721,7 @@ gp32 MACH_GP32 GP32 706
721gem MACH_GEM GEM 707 721gem MACH_GEM GEM 707
722i858 MACH_I858 I858 708 722i858 MACH_I858 I858 708
723hx2750 MACH_HX2750 HX2750 709 723hx2750 MACH_HX2750 HX2750 709
724zeusevb MACH_ZEUSEVB ZEUSEVB 710 724mxc91131evb MACH_ZEUSEVB ZEUSEVB 710
725p700 MACH_P700 P700 711 725p700 MACH_P700 P700 711
726cpe MACH_CPE CPE 712 726cpe MACH_CPE CPE 712
727spitz MACH_SPITZ SPITZ 713 727spitz MACH_SPITZ SPITZ 713
@@ -802,7 +802,7 @@ cpuat91 MACH_CPUAT91 CPUAT91 787
802rea9200 MACH_REA9200 REA9200 788 802rea9200 MACH_REA9200 REA9200 788
803acts_pune_sa1110 MACH_ACTS_PUNE_SA1110 ACTS_PUNE_SA1110 789 803acts_pune_sa1110 MACH_ACTS_PUNE_SA1110 ACTS_PUNE_SA1110 789
804ixp425 MACH_IXP425 IXP425 790 804ixp425 MACH_IXP425 IXP425 790
805argonplusodyssey MACH_ARGONPLUSODYSSEY ARGONPLUSODYSSEY 791 805i30030ads MACH_ARGONPLUSODYSSEY ARGONPLUSODYSSEY 791
806perch MACH_PERCH PERCH 792 806perch MACH_PERCH PERCH 792
807eis05r1 MACH_EIS05R1 EIS05R1 793 807eis05r1 MACH_EIS05R1 EIS05R1 793
808pepperpad MACH_PEPPERPAD PEPPERPAD 794 808pepperpad MACH_PEPPERPAD PEPPERPAD 794
@@ -827,7 +827,7 @@ micro9l MACH_MICRO9L MICRO9L 812
827uc5471dsp MACH_UC5471DSP UC5471DSP 813 827uc5471dsp MACH_UC5471DSP UC5471DSP 813
828sj5471eng MACH_SJ5471ENG SJ5471ENG 814 828sj5471eng MACH_SJ5471ENG SJ5471ENG 814
829none MACH_CMPXA26X CMPXA26X 815 829none MACH_CMPXA26X CMPXA26X 815
830nc MACH_NC NC 816 830nc1 MACH_NC NC 816
831omap_palmte MACH_OMAP_PALMTE OMAP_PALMTE 817 831omap_palmte MACH_OMAP_PALMTE OMAP_PALMTE 817
832ajax52x MACH_AJAX52X AJAX52X 818 832ajax52x MACH_AJAX52X AJAX52X 818
833siriustar MACH_SIRIUSTAR SIRIUSTAR 819 833siriustar MACH_SIRIUSTAR SIRIUSTAR 819
@@ -930,7 +930,7 @@ netclient MACH_NETCLIENT NETCLIENT 916
930xscale_palmtt5 MACH_XSCALE_PALMTT5 XSCALE_PALMTT5 917 930xscale_palmtt5 MACH_XSCALE_PALMTT5 XSCALE_PALMTT5 917
931xscale_palmtc MACH_OMAP_PALMTC OMAP_PALMTC 918 931xscale_palmtc MACH_OMAP_PALMTC OMAP_PALMTC 918
932omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919 932omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
933argonlvevb MACH_ARGONLVEVB ARGONLVEVB 920 933mxc30030evb MACH_ARGONLVEVB ARGONLVEVB 920
934rea_2d MACH_REA_2D REA_2D 921 934rea_2d MACH_REA_2D REA_2D 921
935eti3e524 MACH_TI3E524 TI3E524 922 935eti3e524 MACH_TI3E524 TI3E524 922
936ateb9200 MACH_ATEB9200 ATEB9200 923 936ateb9200 MACH_ATEB9200 ATEB9200 923
@@ -965,7 +965,78 @@ sisteron MACH_SISTERON SISTERON 951
965rx1950 MACH_RX1950 RX1950 952 965rx1950 MACH_RX1950 RX1950 952
966tsc_venus MACH_TSC_VENUS TSC_VENUS 953 966tsc_venus MACH_TSC_VENUS TSC_VENUS 953
967ds101j MACH_DS101J DS101J 954 967ds101j MACH_DS101J DS101J 954
968mxc300_30ads MACH_MXC30030ADS MXC30030ADS 955 968mxc30030ads MACH_MXC30030ADS MXC30030ADS 955
969fujitsu_wimaxsoc MACH_FUJITSU_WIMAXSOC FUJITSU_WIMAXSOC 956 969fujitsu_wimaxsoc MACH_FUJITSU_WIMAXSOC FUJITSU_WIMAXSOC 956
970dualpcmodem MACH_DUALPCMODEM DUALPCMODEM 957 970dualpcmodem MACH_DUALPCMODEM DUALPCMODEM 957
971gesbc9312 MACH_GESBC9312 GESBC9312 958 971gesbc9312 MACH_GESBC9312 GESBC9312 958
972htcapache MACH_HTCAPACHE HTCAPACHE 959
973ixdp435 MACH_IXDP435 IXDP435 960
974catprovt100 MACH_CATPROVT100 CATPROVT100 961
975picotux1xx MACH_PICOTUX1XX PICOTUX1XX 962
976picotux2xx MACH_PICOTUX2XX PICOTUX2XX 963
977dsmg600 MACH_DSMG600 DSMG600 964
978empc2 MACH_EMPC2 EMPC2 965
979ventura MACH_VENTURA VENTURA 966
980phidget_sbc MACH_PHIDGET_SBC PHIDGET_SBC 967
981ij3k MACH_IJ3K IJ3K 968
982pisgah MACH_PISGAH PISGAH 969
983omap_fsample MACH_OMAP_FSAMPLE OMAP_FSAMPLE 970
984sg720 MACH_SG720 SG720 971
985redfox MACH_REDFOX REDFOX 972
986mysh_ep9315_1 MACH_MYSH_EP9315_1 MYSH_EP9315_1 973
987tpf106 MACH_TPF106 TPF106 974
988at91rm9200kg MACH_AT91RM9200KG AT91RM9200KG 975
989racemt2 MACH_SLEDB SLEDB 976
990ontrack MACH_ONTRACK ONTRACK 977
991pm1200 MACH_PM1200 PM1200 978
992ess24562 MACH_ESS24XXX ESS24XXX 979
993coremp7 MACH_COREMP7 COREMP7 980
994nexcoder_6446 MACH_NEXCODER_6446 NEXCODER_6446 981
995stvc8380 MACH_STVC8380 STVC8380 982
996teklynx MACH_TEKLYNX TEKLYNX 983
997carbonado MACH_CARBONADO CARBONADO 984
998sysmos_mp730 MACH_SYSMOS_MP730 SYSMOS_MP730 985
999snapper_cl15 MACH_SNAPPER_CL15 SNAPPER_CL15 986
1000pgigim MACH_PGIGIM PGIGIM 987
1001ptx9160p2 MACH_PTX9160P2 PTX9160P2 988
1002dcore1 MACH_DCORE1 DCORE1 989
1003victorpxa MACH_VICTORPXA VICTORPXA 990
1004mx2dtb MACH_MX2DTB MX2DTB 991
1005pxa_irex_er0100 MACH_PXA_IREX_ER0100 PXA_IREX_ER0100 992
1006omap_palmz71 MACH_OMAP_PALMZ71 OMAP_PALMZ71 993
1007bartec_deg MACH_BARTEC_DEG BARTEC_DEG 994
1008hw50251 MACH_HW50251 HW50251 995
1009ibox MACH_IBOX IBOX 996
1010atlaslh7a404 MACH_ATLASLH7A404 ATLASLH7A404 997
1011pt2026 MACH_PT2026 PT2026 998
1012htcalpine MACH_HTCALPINE HTCALPINE 999
1013bartec_vtu MACH_BARTEC_VTU BARTEC_VTU 1000
1014vcoreii MACH_VCOREII VCOREII 1001
1015pdnb3 MACH_PDNB3 PDNB3 1002
1016htcbeetles MACH_HTCBEETLES HTCBEETLES 1003
1017s3c6400 MACH_S3C6400 S3C6400 1004
1018s3c2443 MACH_S3C2443 S3C2443 1005
1019omap_ldk MACH_OMAP_LDK OMAP_LDK 1006
1020smdk2460 MACH_SMDK2460 SMDK2460 1007
1021smdk2440 MACH_SMDK2440 SMDK2440 1008
1022smdk2412 MACH_SMDK2412 SMDK2412 1009
1023webbox MACH_WEBBOX WEBBOX 1010
1024cwwndp MACH_CWWNDP CWWNDP 1011
1025dragon MACH_DRAGON DRAGON 1012
1026opendo_cpu_board MACH_OPENDO_CPU_BOARD OPENDO_CPU_BOARD 1013
1027ccm2200 MACH_CCM2200 CCM2200 1014
1028etwarm MACH_ETWARM ETWARM 1015
1029m93030 MACH_M93030 M93030 1016
1030cc7u MACH_CC7U CC7U 1017
1031mtt_ranger MACH_MTT_RANGER MTT_RANGER 1018
1032nexus MACH_NEXUS NEXUS 1019
1033desman MACH_DESMAN DESMAN 1020
1034bkde303 MACH_BKDE303 BKDE303 1021
1035smdk2413 MACH_SMDK2413 SMDK2413 1022
1036aml_m7200 MACH_AML_M7200 AML_M7200 1023
1037aml_m5900 MACH_AML_M5900 AML_M5900 1024
1038sg640 MACH_SG640 SG640 1025
1039edg79524 MACH_EDG79524 EDG79524 1026
1040ai2410 MACH_AI2410 AI2410 1027
1041ixp465 MACH_IXP465 IXP465 1028
1042balloon3 MACH_BALLOON3 BALLOON3 1029
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 37ff8145b5b5..03486be04193 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -245,7 +245,7 @@ void VFP9_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
245 */ 245 */
246 barrier(); 246 barrier();
247 trigger = fmrx(FPINST2); 247 trigger = fmrx(FPINST2);
248 fpscr = fmrx(FPSCR); 248 orig_fpscr = fpscr = fmrx(FPSCR);
249 249
250 emulate: 250 emulate:
251 exceptions = vfp_emulate_instruction(trigger, fpscr, regs); 251 exceptions = vfp_emulate_instruction(trigger, fpscr, regs);
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index c6fe99e57a05..8dfa3054f10f 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -758,10 +758,10 @@ config HOTPLUG_CPU
758 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" 758 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
759 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER 759 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER
760 ---help--- 760 ---help---
761 Say Y here to experiment with turning CPUs off and on. CPUs 761 Say Y here to experiment with turning CPUs off and on, and to
762 can be controlled through /sys/devices/system/cpu. 762 enable suspend on SMP systems. CPUs can be controlled through
763 /sys/devices/system/cpu.
763 764
764 Say N.
765 765
766endmenu 766endmenu
767 767
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 4c785a67d585..40e5aba3ad3d 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -1102,9 +1102,6 @@ int __init acpi_boot_table_init(void)
1102 dmi_check_system(acpi_dmi_table); 1102 dmi_check_system(acpi_dmi_table);
1103#endif 1103#endif
1104 1104
1105 if (!cpu_has_apic)
1106 return -ENODEV;
1107
1108 /* 1105 /*
1109 * If acpi_disabled, bail out 1106 * If acpi_disabled, bail out
1110 * One exception: acpi=ht continues far enough to enumerate LAPICs 1107 * One exception: acpi=ht continues far enough to enumerate LAPICs
@@ -1151,9 +1148,6 @@ int __init acpi_boot_init(void)
1151 1148
1152 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf); 1149 acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
1153 1150
1154 if (!cpu_has_apic)
1155 return -ENODEV;
1156
1157 /* 1151 /*
1158 * set sci_int and PM timer address 1152 * set sci_int and PM timer address
1159 */ 1153 */
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index f8f132aa5472..d70f2ade5cde 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -2238,6 +2238,8 @@ static inline void unlock_ExtINT_logic(void)
2238 spin_unlock_irqrestore(&ioapic_lock, flags); 2238 spin_unlock_irqrestore(&ioapic_lock, flags);
2239} 2239}
2240 2240
2241int timer_uses_ioapic_pin_0;
2242
2241/* 2243/*
2242 * This code may look a bit paranoid, but it's supposed to cooperate with 2244 * This code may look a bit paranoid, but it's supposed to cooperate with
2243 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 2245 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
@@ -2274,6 +2276,9 @@ static inline void check_timer(void)
2274 pin2 = ioapic_i8259.pin; 2276 pin2 = ioapic_i8259.pin;
2275 apic2 = ioapic_i8259.apic; 2277 apic2 = ioapic_i8259.apic;
2276 2278
2279 if (pin1 == 0)
2280 timer_uses_ioapic_pin_0 = 1;
2281
2277 printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", 2282 printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
2278 vector, apic1, pin1, apic2, pin2); 2283 vector, apic1, pin1, apic2, pin2);
2279 2284
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 34d21e21e012..6b1392d33ed5 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -1130,7 +1130,17 @@ int mp_register_gsi (u32 gsi, int triggering, int polarity)
1130 */ 1130 */
1131 int irq = gsi; 1131 int irq = gsi;
1132 if (gsi < MAX_GSI_NUM) { 1132 if (gsi < MAX_GSI_NUM) {
1133 if (gsi > 15) 1133 /*
1134 * Retain the VIA chipset work-around (gsi > 15), but
1135 * avoid a problem where the 8254 timer (IRQ0) is setup
1136 * via an override (so it's not on pin 0 of the ioapic),
1137 * and at the same time, the pin 0 interrupt is a PCI
1138 * type. The gsi > 15 test could cause these two pins
1139 * to be shared as IRQ0, and they are not shareable.
1140 * So test for this condition, and if necessary, avoid
1141 * the pin collision.
1142 */
1143 if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
1134 gsi = pci_irq++; 1144 gsi = pci_irq++;
1135 /* 1145 /*
1136 * Don't assign IRQ used by ACPI SCI 1146 * Don't assign IRQ used by ACPI SCI
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index d77e89ac0d54..846e1639ef7c 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -1320,6 +1320,8 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
1320 probe_roms(); 1320 probe_roms();
1321 for (i = 0; i < e820.nr_map; i++) { 1321 for (i = 0; i < e820.nr_map; i++) {
1322 struct resource *res; 1322 struct resource *res;
1323 if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
1324 continue;
1323 res = kzalloc(sizeof(struct resource), GFP_ATOMIC); 1325 res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
1324 switch (e820.map[i].type) { 1326 switch (e820.map[i].type) {
1325 case E820_RAM: res->name = "System RAM"; break; 1327 case E820_RAM: res->name = "System RAM"; break;
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 1a2076ce6f6a..ec0fd3cfa774 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -332,10 +332,11 @@ static int __init ppro_init(char ** cpu_type)
332{ 332{
333 __u8 cpu_model = boot_cpu_data.x86_model; 333 __u8 cpu_model = boot_cpu_data.x86_model;
334 334
335 if (cpu_model > 0xd) 335 if (cpu_model == 14)
336 *cpu_type = "i386/core";
337 else if (cpu_model > 0xd)
336 return 0; 338 return 0;
337 339 else if (cpu_model == 9) {
338 if (cpu_model == 9) {
339 *cpu_type = "i386/p6_mobile"; 340 *cpu_type = "i386/p6_mobile";
340 } else if (cpu_model > 5) { 341 } else if (cpu_model > 5) {
341 *cpu_type = "i386/piii"; 342 *cpu_type = "i386/piii";
diff --git a/arch/ia64/lib/memcpy_mck.S b/arch/ia64/lib/memcpy_mck.S
index 46c9331e7ab5..9e534d52b1d5 100644
--- a/arch/ia64/lib/memcpy_mck.S
+++ b/arch/ia64/lib/memcpy_mck.S
@@ -6,7 +6,9 @@
6 * in1: source address 6 * in1: source address
7 * in2: number of bytes to copy 7 * in2: number of bytes to copy
8 * Output: 8 * Output:
9 * 0 if success, or number of byte NOT copied if error occurred. 9 * for memcpy: return dest
10 * for copy_user: return 0 if success,
11 * or number of byte NOT copied if error occurred.
10 * 12 *
11 * Copyright (C) 2002 Intel Corp. 13 * Copyright (C) 2002 Intel Corp.
12 * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com> 14 * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com>
@@ -73,6 +75,7 @@ GLOBAL_ENTRY(memcpy)
73 and r28=0x7,in0 75 and r28=0x7,in0
74 and r29=0x7,in1 76 and r29=0x7,in1
75 mov f6=f0 77 mov f6=f0
78 mov retval=in0
76 br.cond.sptk .common_code 79 br.cond.sptk .common_code
77 ;; 80 ;;
78END(memcpy) 81END(memcpy)
@@ -84,7 +87,7 @@ GLOBAL_ENTRY(__copy_user)
84 mov f6=f1 87 mov f6=f1
85 mov saved_in0=in0 // save dest pointer 88 mov saved_in0=in0 // save dest pointer
86 mov saved_in1=in1 // save src pointer 89 mov saved_in1=in1 // save src pointer
87 mov saved_in2=in2 // save len 90 mov retval=r0 // initialize return value
88 ;; 91 ;;
89.common_code: 92.common_code:
90 cmp.gt p15,p0=8,in2 // check for small size 93 cmp.gt p15,p0=8,in2 // check for small size
@@ -92,7 +95,7 @@ GLOBAL_ENTRY(__copy_user)
92 cmp.ne p14,p0=0,r29 // check src alignment 95 cmp.ne p14,p0=0,r29 // check src alignment
93 add src0=0,in1 96 add src0=0,in1
94 sub r30=8,r28 // for .align_dest 97 sub r30=8,r28 // for .align_dest
95 mov retval=r0 // initialize return value 98 mov saved_in2=in2 // save len
96 ;; 99 ;;
97 add dst0=0,in0 100 add dst0=0,in0
98 add dst1=1,in0 // dest odd index 101 add dst1=1,in0 // dest odd index
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 856ef1a832b9..f78866367b70 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -90,15 +90,15 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
90 90
91static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 91static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
92{ 92{
93 kprobe_opcode_t insn = *p->ainsn.insn;
94
95 regs->msr |= MSR_SE; 93 regs->msr |= MSR_SE;
96 94
97 /* single step inline if it is a trap variant */ 95 /*
98 if (is_trap(insn)) 96 * On powerpc we should single step on the original
99 regs->nip = (unsigned long)p->addr; 97 * instruction even if the probed insn is a trap
100 else 98 * variant as values in regs could play a part in
101 regs->nip = (unsigned long)p->ainsn.insn; 99 * if the trap is taken or not
100 */
101 regs->nip = (unsigned long)p->ainsn.insn;
102} 102}
103 103
104static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) 104static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 1cb69e8fb0b1..9a07f97f0712 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -885,6 +885,74 @@ void __init unflatten_device_tree(void)
885 DBG(" <- unflatten_device_tree()\n"); 885 DBG(" <- unflatten_device_tree()\n");
886} 886}
887 887
888/*
889 * ibm,pa-features is a per-cpu property that contains a string of
890 * attribute descriptors, each of which has a 2 byte header plus up
891 * to 254 bytes worth of processor attribute bits. First header
892 * byte specifies the number of bytes following the header.
893 * Second header byte is an "attribute-specifier" type, of which
894 * zero is the only currently-defined value.
895 * Implementation: Pass in the byte and bit offset for the feature
896 * that we are interested in. The function will return -1 if the
897 * pa-features property is missing, or a 1/0 to indicate if the feature
898 * is supported/not supported. Note that the bit numbers are
899 * big-endian to match the definition in PAPR.
900 */
901static struct ibm_pa_feature {
902 unsigned long cpu_features; /* CPU_FTR_xxx bit */
903 unsigned int cpu_user_ftrs; /* PPC_FEATURE_xxx bit */
904 unsigned char pabyte; /* byte number in ibm,pa-features */
905 unsigned char pabit; /* bit number (big-endian) */
906 unsigned char invert; /* if 1, pa bit set => clear feature */
907} ibm_pa_features[] __initdata = {
908 {0, PPC_FEATURE_HAS_MMU, 0, 0, 0},
909 {0, PPC_FEATURE_HAS_FPU, 0, 1, 0},
910 {CPU_FTR_SLB, 0, 0, 2, 0},
911 {CPU_FTR_CTRL, 0, 0, 3, 0},
912 {CPU_FTR_NOEXECUTE, 0, 0, 6, 0},
913 {CPU_FTR_NODSISRALIGN, 0, 1, 1, 1},
914 {CPU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0},
915};
916
917static void __init check_cpu_pa_features(unsigned long node)
918{
919 unsigned char *pa_ftrs;
920 unsigned long len, tablelen, i, bit;
921
922 pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen);
923 if (pa_ftrs == NULL)
924 return;
925
926 /* find descriptor with type == 0 */
927 for (;;) {
928 if (tablelen < 3)
929 return;
930 len = 2 + pa_ftrs[0];
931 if (tablelen < len)
932 return; /* descriptor 0 not found */
933 if (pa_ftrs[1] == 0)
934 break;
935 tablelen -= len;
936 pa_ftrs += len;
937 }
938
939 /* loop over bits we know about */
940 for (i = 0; i < ARRAY_SIZE(ibm_pa_features); ++i) {
941 struct ibm_pa_feature *fp = &ibm_pa_features[i];
942
943 if (fp->pabyte >= pa_ftrs[0])
944 continue;
945 bit = (pa_ftrs[2 + fp->pabyte] >> (7 - fp->pabit)) & 1;
946 if (bit ^ fp->invert) {
947 cur_cpu_spec->cpu_features |= fp->cpu_features;
948 cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs;
949 } else {
950 cur_cpu_spec->cpu_features &= ~fp->cpu_features;
951 cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs;
952 }
953 }
954}
955
888static int __init early_init_dt_scan_cpus(unsigned long node, 956static int __init early_init_dt_scan_cpus(unsigned long node,
889 const char *uname, int depth, 957 const char *uname, int depth,
890 void *data) 958 void *data)
@@ -969,6 +1037,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
969 } 1037 }
970#endif /* CONFIG_ALTIVEC */ 1038#endif /* CONFIG_ALTIVEC */
971 1039
1040 check_cpu_pa_features(node);
1041
972#ifdef CONFIG_PPC_PSERIES 1042#ifdef CONFIG_PPC_PSERIES
973 if (nthreads > 1) 1043 if (nthreads > 1)
974 cur_cpu_spec->cpu_features |= CPU_FTR_SMT; 1044 cur_cpu_spec->cpu_features |= CPU_FTR_SMT;
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index a1bda6f96fd1..40020c65c89e 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -118,7 +118,15 @@ int eeh_send_failure_event (struct device_node *dn,
118{ 118{
119 unsigned long flags; 119 unsigned long flags;
120 struct eeh_event *event; 120 struct eeh_event *event;
121 char *location;
121 122
123 if (!mem_init_done) {
124 printk(KERN_ERR "EEH: event during early boot not handled\n");
125 location = (char *) get_property(dn, "ibm,loc-code", NULL);
126 printk(KERN_ERR "EEH: device node = %s\n", dn->full_name);
127 printk(KERN_ERR "EEH: PCI location = %s\n", location);
128 return 1;
129 }
122 event = kmalloc(sizeof(*event), GFP_ATOMIC); 130 event = kmalloc(sizeof(*event), GFP_ATOMIC);
123 if (event == NULL) { 131 if (event == NULL) {
124 printk (KERN_ERR "EEH: out of memory, event not handled\n"); 132 printk (KERN_ERR "EEH: out of memory, event not handled\n");
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index ec53c7d65f2b..7a2f20583be4 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -355,9 +355,7 @@ InstructionTLBMiss:
355 355
356 . = 0x1200 356 . = 0x1200
357DataStoreTLBMiss: 357DataStoreTLBMiss:
358#ifdef CONFIG_8xx_CPU6
359 stw r3, 8(r0) 358 stw r3, 8(r0)
360#endif
361 DO_8xx_CPU6(0x3f80, r3) 359 DO_8xx_CPU6(0x3f80, r3)
362 mtspr SPRN_M_TW, r10 /* Save a couple of working registers */ 360 mtspr SPRN_M_TW, r10 /* Save a couple of working registers */
363 mfcr r10 361 mfcr r10
@@ -417,9 +415,7 @@ DataStoreTLBMiss:
417 lwz r11, 0(r0) 415 lwz r11, 0(r0)
418 mtcr r11 416 mtcr r11
419 lwz r11, 4(r0) 417 lwz r11, 4(r0)
420#ifdef CONFIG_8xx_CPU6
421 lwz r3, 8(r0) 418 lwz r3, 8(r0)
422#endif
423 rfi 419 rfi
424 420
425/* This is an instruction TLB error on the MPC8xx. This could be due 421/* This is an instruction TLB error on the MPC8xx. This could be due
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c
index 6ce3b842defe..d919dab61347 100644
--- a/arch/ppc/platforms/mpc866ads_setup.c
+++ b/arch/ppc/platforms/mpc866ads_setup.c
@@ -378,7 +378,7 @@ int __init mpc866ads_init(void)
378 ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART); 378 ppc_sys_device_setfunc(MPC8xx_CPM_SMC1, PPC_SYS_FUNC_UART);
379#endif 379#endif
380 380
381#ifdef CONFIG_SERIAL_CPM_SMCer 381#ifdef CONFIG_SERIAL_CPM_SMC
382 ppc_sys_device_enable(MPC8xx_CPM_SMC2); 382 ppc_sys_device_enable(MPC8xx_CPM_SMC2);
383 ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART); 383 ppc_sys_device_setfunc(MPC8xx_CPM_SMC2, PPC_SYS_FUNC_UART);
384#endif 384#endif
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index ef5b9c44b86b..4d53b2739357 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1650,3 +1650,11 @@ sys_tee_wrapper:
1650 llgfr %r4,%r4 # size_t 1650 llgfr %r4,%r4 # size_t
1651 llgfr %r5,%r5 # unsigned int 1651 llgfr %r5,%r5 # unsigned int
1652 jg sys_tee 1652 jg sys_tee
1653
1654 .globl compat_sys_vmsplice_wrapper
1655compat_sys_vmsplice_wrapper:
1656 lgfr %r2,%r2 # int
1657 llgtr %r3,%r3 # compat_iovec *
1658 llgfr %r4,%r4 # unsigned int
1659 llgfr %r5,%r5 # unsigned int
1660 jg compat_sys_vmsplice
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index fc2c0767202b..93be1d56c036 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -317,3 +317,4 @@ SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list_wrapp
317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper) 317SYSCALL(sys_splice,sys_splice,sys_splice_wrapper)
318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper) 318SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper) 319SYSCALL(sys_tee,sys_tee,sys_tee_wrapper)
320SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice_wrapper)
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index fea043b69b91..029f09901b85 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -249,18 +249,19 @@ static inline void stop_hz_timer(void)
249 unsigned long flags; 249 unsigned long flags;
250 unsigned long seq, next; 250 unsigned long seq, next;
251 __u64 timer, todval; 251 __u64 timer, todval;
252 int cpu = smp_processor_id();
252 253
253 if (sysctl_hz_timer != 0) 254 if (sysctl_hz_timer != 0)
254 return; 255 return;
255 256
256 cpu_set(smp_processor_id(), nohz_cpu_mask); 257 cpu_set(cpu, nohz_cpu_mask);
257 258
258 /* 259 /*
259 * Leave the clock comparator set up for the next timer 260 * Leave the clock comparator set up for the next timer
260 * tick if either rcu or a softirq is pending. 261 * tick if either rcu or a softirq is pending.
261 */ 262 */
262 if (rcu_pending(smp_processor_id()) || local_softirq_pending()) { 263 if (rcu_needs_cpu(cpu) || local_softirq_pending()) {
263 cpu_clear(smp_processor_id(), nohz_cpu_mask); 264 cpu_clear(cpu, nohz_cpu_mask);
264 return; 265 return;
265 } 266 }
266 267
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 460f72e640e6..f9ff29734848 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -274,6 +274,11 @@ void *sbus_alloc_consistent(struct sbus_dev *sdev, long len, u32 *dma_addrp)
274 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0) 274 if (mmu_map_dma_area(dma_addrp, va, res->start, len_total) != 0)
275 goto err_noiommu; 275 goto err_noiommu;
276 276
277 /* Set the resource name, if known. */
278 if (sdev) {
279 res->name = sdev->prom_name;
280 }
281
277 return (void *)res->start; 282 return (void *)res->start;
278 283
279err_noiommu: 284err_noiommu:
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 787d5f1347ec..598682f31ebf 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -113,6 +113,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
113 113
114 switch (ELF32_R_TYPE(rel[i].r_info)) { 114 switch (ELF32_R_TYPE(rel[i].r_info)) {
115 case R_SPARC_32: 115 case R_SPARC_32:
116 case R_SPARC_UA32:
116 location[0] = v >> 24; 117 location[0] = v >> 24;
117 location[1] = v >> 16; 118 location[1] = v >> 16;
118 location[2] = v >> 8; 119 location[2] = v >> 8;
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index ec1c9687d679..4b376fae752c 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -251,19 +251,9 @@ EXPORT_SYMBOL(__prom_getchild);
251EXPORT_SYMBOL(__prom_getsibling); 251EXPORT_SYMBOL(__prom_getsibling);
252 252
253/* sparc library symbols */ 253/* sparc library symbols */
254EXPORT_SYMBOL(memchr);
255EXPORT_SYMBOL(memscan); 254EXPORT_SYMBOL(memscan);
256EXPORT_SYMBOL(strlen); 255EXPORT_SYMBOL(strlen);
257EXPORT_SYMBOL(strnlen);
258EXPORT_SYMBOL(strcpy);
259EXPORT_SYMBOL(strncpy);
260EXPORT_SYMBOL(strcat);
261EXPORT_SYMBOL(strncat);
262EXPORT_SYMBOL(strcmp);
263EXPORT_SYMBOL(strncmp); 256EXPORT_SYMBOL(strncmp);
264EXPORT_SYMBOL(strchr);
265EXPORT_SYMBOL(strrchr);
266EXPORT_SYMBOL(strstr);
267EXPORT_SYMBOL(page_kernel); 257EXPORT_SYMBOL(page_kernel);
268 258
269/* Special internal versions of library functions. */ 259/* Special internal versions of library functions. */
@@ -317,6 +307,3 @@ EXPORT_SYMBOL(do_BUG);
317 307
318/* Sun Power Management Idle Handler */ 308/* Sun Power Management Idle Handler */
319EXPORT_SYMBOL(pm_idle); 309EXPORT_SYMBOL(pm_idle);
320
321/* Binfmt_misc needs this */
322EXPORT_SYMBOL(sys_close);
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index db8faa75f94d..6e1135cc03b0 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -23,7 +23,7 @@ sys_call_table:
23/*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod 23/*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
24/*15*/ .long sys_chmod, sys_lchown16, sparc_brk, sys_nis_syscall, sys_lseek 24/*15*/ .long sys_chmod, sys_lchown16, sparc_brk, sys_nis_syscall, sys_lseek
25/*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 25/*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
26/*25*/ .long sys_time, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause 26/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
27/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 27/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
28/*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile 28/*35*/ .long sys_chown, sys_sync, sys_kill, sys_newstat, sys_sendfile
29/*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_getuid 29/*40*/ .long sys_newlstat, sys_dup, sys_pipe, sys_times, sys_getuid
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 1317380fa937..f09a70b8aabd 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16 3# Linux kernel version: 2.6.17-rc3
4# Sun Apr 2 19:31:04 2006 4# Fri May 12 12:43:49 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -114,6 +114,7 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
114CONFIG_HUGETLB_PAGE_SIZE_4MB=y 114CONFIG_HUGETLB_PAGE_SIZE_4MB=y
115# CONFIG_HUGETLB_PAGE_SIZE_512K is not set 115# CONFIG_HUGETLB_PAGE_SIZE_512K is not set
116# CONFIG_HUGETLB_PAGE_SIZE_64K is not set 116# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
117CONFIG_ARCH_SELECT_MEMORY_MODEL=y
117CONFIG_ARCH_SPARSEMEM_ENABLE=y 118CONFIG_ARCH_SPARSEMEM_ENABLE=y
118CONFIG_ARCH_SPARSEMEM_DEFAULT=y 119CONFIG_ARCH_SPARSEMEM_DEFAULT=y
119CONFIG_LARGE_ALLOCS=y 120CONFIG_LARGE_ALLOCS=y
@@ -430,7 +431,6 @@ CONFIG_ISCSI_TCP=m
430# CONFIG_SCSI_INIA100 is not set 431# CONFIG_SCSI_INIA100 is not set
431# CONFIG_SCSI_SYM53C8XX_2 is not set 432# CONFIG_SCSI_SYM53C8XX_2 is not set
432# CONFIG_SCSI_IPR is not set 433# CONFIG_SCSI_IPR is not set
433# CONFIG_SCSI_QLOGIC_FC is not set
434# CONFIG_SCSI_QLOGIC_1280 is not set 434# CONFIG_SCSI_QLOGIC_1280 is not set
435# CONFIG_SCSI_QLOGICPTI is not set 435# CONFIG_SCSI_QLOGICPTI is not set
436# CONFIG_SCSI_QLA_FC is not set 436# CONFIG_SCSI_QLA_FC is not set
@@ -1042,9 +1042,7 @@ CONFIG_USB_HIDDEV=y
1042# CONFIG_USB_ACECAD is not set 1042# CONFIG_USB_ACECAD is not set
1043# CONFIG_USB_KBTAB is not set 1043# CONFIG_USB_KBTAB is not set
1044# CONFIG_USB_POWERMATE is not set 1044# CONFIG_USB_POWERMATE is not set
1045# CONFIG_USB_MTOUCH is not set 1045# CONFIG_USB_TOUCHSCREEN is not set
1046# CONFIG_USB_ITMTOUCH is not set
1047# CONFIG_USB_EGALAX is not set
1048# CONFIG_USB_YEALINK is not set 1046# CONFIG_USB_YEALINK is not set
1049# CONFIG_USB_XPAD is not set 1047# CONFIG_USB_XPAD is not set
1050# CONFIG_USB_ATI_REMOTE is not set 1048# CONFIG_USB_ATI_REMOTE is not set
@@ -1115,6 +1113,14 @@ CONFIG_USB_HIDDEV=y
1115# CONFIG_NEW_LEDS is not set 1113# CONFIG_NEW_LEDS is not set
1116 1114
1117# 1115#
1116# LED drivers
1117#
1118
1119#
1120# LED Triggers
1121#
1122
1123#
1118# InfiniBand support 1124# InfiniBand support
1119# 1125#
1120# CONFIG_INFINIBAND is not set 1126# CONFIG_INFINIBAND is not set
@@ -1303,6 +1309,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1303# CONFIG_DEBUG_INFO is not set 1309# CONFIG_DEBUG_INFO is not set
1304CONFIG_DEBUG_FS=y 1310CONFIG_DEBUG_FS=y
1305# CONFIG_DEBUG_VM is not set 1311# CONFIG_DEBUG_VM is not set
1312# CONFIG_UNWIND_INFO is not set
1306CONFIG_FORCED_INLINING=y 1313CONFIG_FORCED_INLINING=y
1307# CONFIG_RCU_TORTURE_TEST is not set 1314# CONFIG_RCU_TORTURE_TEST is not set
1308# CONFIG_DEBUG_STACK_USAGE is not set 1315# CONFIG_DEBUG_STACK_USAGE is not set
diff --git a/arch/sparc64/kernel/module.c b/arch/sparc64/kernel/module.c
index 6c83e372f75d..579871527699 100644
--- a/arch/sparc64/kernel/module.c
+++ b/arch/sparc64/kernel/module.c
@@ -143,6 +143,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
143 location[3] = v >> 0; 143 location[3] = v >> 0;
144 break; 144 break;
145 145
146 case R_SPARC_DISP32:
147 v -= (Elf64_Addr) location;
148 *loc32 = v;
149 break;
150
146 case R_SPARC_WDISP30: 151 case R_SPARC_WDISP30:
147 v -= (Elf64_Addr) location; 152 v -= (Elf64_Addr) location;
148 *loc32 = (*loc32 & ~0x3fffffff) | 153 *loc32 = (*loc32 & ~0x3fffffff) |
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
index f9b75760163c..bdf1f4d02e3f 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc64/kernel/sys32.S
@@ -139,6 +139,7 @@ SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2)
139SIGN2(sys32_splice, sys_splice, %o0, %o1) 139SIGN2(sys32_splice, sys_splice, %o0, %o1)
140SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5) 140SIGN2(sys32_sync_file_range, compat_sync_file_range, %o0, %o5)
141SIGN2(sys32_tee, sys_tee, %o0, %o1) 141SIGN2(sys32_tee, sys_tee, %o0, %o1)
142SIGN1(sys32_vmsplice, compat_sys_vmsplice, %o0)
142 143
143 .globl sys32_mmap2 144 .globl sys32_mmap2
144sys32_mmap2: 145sys32_mmap2:
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 62672cd92eca..d4b39cd30310 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -25,7 +25,7 @@ sys_call_table32:
25/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod 25/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys32_chown16, sys32_mknod
26/*15*/ .word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek 26/*15*/ .word sys_chmod, sys32_lchown16, sparc_brk, sys32_perfctr, sys32_lseek
27/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16 27/*20*/ .word sys_getpid, sys_capget, sys_capset, sys32_setuid16, sys32_getuid16
28/*25*/ .word compat_sys_time, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause 28/*25*/ .word sys32_vmsplice, sys_ptrace, sys_alarm, sys32_sigaltstack, sys32_pause
29/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice 29/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
30 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile 30 .word sys_chown, sys_sync, sys32_kill, compat_sys_newstat, sys32_sendfile
31/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid 31/*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid
@@ -94,7 +94,7 @@ sys_call_table:
94/*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod 94/*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod
95/*15*/ .word sys_chmod, sys_lchown, sparc_brk, sys_perfctr, sys_lseek 95/*15*/ .word sys_chmod, sys_lchown, sparc_brk, sys_perfctr, sys_lseek
96/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid 96/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
97/*25*/ .word sys_nis_syscall, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall 97/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
98/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice 98/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
99 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64 99 .word sys_nis_syscall, sys_sync, sys_kill, sys_newstat, sys_sendfile64
100/*40*/ .word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall 100/*40*/ .word sys_newlstat, sys_dup, sys_pipe, sys_times, sys_nis_syscall
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index 3c7626cdba4b..528cf623f8b4 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -209,4 +209,4 @@ int __init timer_init(void)
209 return(0); 209 return(0);
210} 210}
211 211
212__initcall(timer_init); 212arch_initcall(timer_init);
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 62776c07cff1..222b5b46d2b2 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -76,6 +76,12 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
76 *addrp = __pa_symbol(&_end); 76 *addrp = __pa_symbol(&_end);
77 return 1; 77 return 1;
78 } 78 }
79
80 if (last >= ebda_addr && addr < ebda_addr + ebda_size) {
81 *addrp = ebda_addr + ebda_size;
82 return 1;
83 }
84
79 /* XXX ramdisk image here? */ 85 /* XXX ramdisk image here? */
80 return 0; 86 return 0;
81} 87}
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 77b4c608cca0..0de3ea938830 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -1777,6 +1777,8 @@ static inline void unlock_ExtINT_logic(void)
1777 spin_unlock_irqrestore(&ioapic_lock, flags); 1777 spin_unlock_irqrestore(&ioapic_lock, flags);
1778} 1778}
1779 1779
1780int timer_uses_ioapic_pin_0;
1781
1780/* 1782/*
1781 * This code may look a bit paranoid, but it's supposed to cooperate with 1783 * This code may look a bit paranoid, but it's supposed to cooperate with
1782 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ 1784 * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ
@@ -1814,6 +1816,9 @@ static inline void check_timer(void)
1814 pin2 = ioapic_i8259.pin; 1816 pin2 = ioapic_i8259.pin;
1815 apic2 = ioapic_i8259.apic; 1817 apic2 = ioapic_i8259.apic;
1816 1818
1819 if (pin1 == 0)
1820 timer_uses_ioapic_pin_0 = 1;
1821
1817 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", 1822 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
1818 vector, apic1, pin1, apic2, pin2); 1823 vector, apic1, pin1, apic2, pin2);
1819 1824
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index b17cf3eba359..083da7e606b1 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -968,7 +968,17 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
968 */ 968 */
969 int irq = gsi; 969 int irq = gsi;
970 if (gsi < MAX_GSI_NUM) { 970 if (gsi < MAX_GSI_NUM) {
971 if (gsi > 15) 971 /*
972 * Retain the VIA chipset work-around (gsi > 15), but
973 * avoid a problem where the 8254 timer (IRQ0) is setup
974 * via an override (so it's not on pin 0 of the ioapic),
975 * and at the same time, the pin 0 interrupt is a PCI
976 * type. The gsi > 15 test could cause these two pins
977 * to be shared as IRQ0, and they are not shareable.
978 * So test for this condition, and if necessary, avoid
979 * the pin collision.
980 */
981 if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
972 gsi = pci_irq++; 982 gsi = pci_irq++;
973 /* 983 /*
974 * Don't assign IRQ used by ACPI SCI 984 * Don't assign IRQ used by ACPI SCI
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 9d3d76c85ae7..2480d3f08a47 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -639,6 +639,14 @@ static int __init pci_iommu_init(void)
639 return -1; 639 return -1;
640 } 640 }
641 641
642 i = 0;
643 for_all_nb(dev)
644 i++;
645 if (i > MAX_NB) {
646 printk(KERN_ERR "PCI-GART: Too many northbridges (%ld). Disabled\n", i);
647 return -1;
648 }
649
642 printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n"); 650 printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
643 aper_size = info.aper_size * 1024 * 1024; 651 aper_size = info.aper_size * 1024 * 1024;
644 iommu_size = check_iommu_size(info.aper_base, aper_size); 652 iommu_size = check_iommu_size(info.aper_base, aper_size);
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index ebc3c33b1c6c..f0870bef24d1 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -571,17 +571,28 @@ static inline void copy_edd(void)
571#endif 571#endif
572 572
573#define EBDA_ADDR_POINTER 0x40E 573#define EBDA_ADDR_POINTER 0x40E
574static void __init reserve_ebda_region(void) 574
575unsigned __initdata ebda_addr;
576unsigned __initdata ebda_size;
577
578static void discover_ebda(void)
575{ 579{
576 unsigned int addr; 580 /*
577 /**
578 * there is a real-mode segmented pointer pointing to the 581 * there is a real-mode segmented pointer pointing to the
579 * 4K EBDA area at 0x40E 582 * 4K EBDA area at 0x40E
580 */ 583 */
581 addr = *(unsigned short *)phys_to_virt(EBDA_ADDR_POINTER); 584 ebda_addr = *(unsigned short *)EBDA_ADDR_POINTER;
582 addr <<= 4; 585 ebda_addr <<= 4;
583 if (addr) 586
584 reserve_bootmem_generic(addr, PAGE_SIZE); 587 ebda_size = *(unsigned short *)(unsigned long)ebda_addr;
588
589 /* Round EBDA up to pages */
590 if (ebda_size == 0)
591 ebda_size = 1;
592 ebda_size <<= 10;
593 ebda_size = round_up(ebda_size + (ebda_addr & ~PAGE_MASK), PAGE_SIZE);
594 if (ebda_size > 64*1024)
595 ebda_size = 64*1024;
585} 596}
586 597
587void __init setup_arch(char **cmdline_p) 598void __init setup_arch(char **cmdline_p)
@@ -627,6 +638,8 @@ void __init setup_arch(char **cmdline_p)
627 638
628 check_efer(); 639 check_efer();
629 640
641 discover_ebda();
642
630 init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT)); 643 init_memory_mapping(0, (end_pfn_map << PAGE_SHIFT));
631 644
632 dmi_scan_machine(); 645 dmi_scan_machine();
@@ -669,7 +682,8 @@ void __init setup_arch(char **cmdline_p)
669 reserve_bootmem_generic(0, PAGE_SIZE); 682 reserve_bootmem_generic(0, PAGE_SIZE);
670 683
671 /* reserve ebda region */ 684 /* reserve ebda region */
672 reserve_ebda_region(); 685 if (ebda_addr)
686 reserve_bootmem_generic(ebda_addr, ebda_size);
673 687
674#ifdef CONFIG_SMP 688#ifdef CONFIG_SMP
675 /* 689 /*
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 2700b1375c1f..6b87268c5c2e 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -385,6 +385,7 @@ void out_of_line_bug(void)
385 385
386static DEFINE_SPINLOCK(die_lock); 386static DEFINE_SPINLOCK(die_lock);
387static int die_owner = -1; 387static int die_owner = -1;
388static unsigned int die_nest_count;
388 389
389unsigned __kprobes long oops_begin(void) 390unsigned __kprobes long oops_begin(void)
390{ 391{
@@ -399,6 +400,7 @@ unsigned __kprobes long oops_begin(void)
399 else 400 else
400 spin_lock(&die_lock); 401 spin_lock(&die_lock);
401 } 402 }
403 die_nest_count++;
402 die_owner = cpu; 404 die_owner = cpu;
403 console_verbose(); 405 console_verbose();
404 bust_spinlocks(1); 406 bust_spinlocks(1);
@@ -409,7 +411,13 @@ void __kprobes oops_end(unsigned long flags)
409{ 411{
410 die_owner = -1; 412 die_owner = -1;
411 bust_spinlocks(0); 413 bust_spinlocks(0);
412 spin_unlock_irqrestore(&die_lock, flags); 414 die_nest_count--;
415 if (die_nest_count)
416 /* We still own the lock */
417 local_irq_restore(flags);
418 else
419 /* Nest count reaches zero, release the lock. */
420 spin_unlock_irqrestore(&die_lock, flags);
413 if (panic_on_oops) 421 if (panic_on_oops)
414 panic("Oops"); 422 panic("Oops");
415} 423}
@@ -464,6 +472,8 @@ void __kprobes die_nmi(char *str, struct pt_regs *regs)
464 panic("nmi watchdog"); 472 panic("nmi watchdog");
465 printk("console shuts up ...\n"); 473 printk("console shuts up ...\n");
466 oops_end(flags); 474 oops_end(flags);
475 nmi_exit();
476 local_irq_enable();
467 do_exit(SIGSEGV); 477 do_exit(SIGSEGV);
468} 478}
469 479
diff --git a/block/elevator.c b/block/elevator.c
index 29825792cbd5..8768a367fdde 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -333,6 +333,7 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)
333{ 333{
334 struct list_head *pos; 334 struct list_head *pos;
335 unsigned ordseq; 335 unsigned ordseq;
336 int unplug_it = 1;
336 337
337 blk_add_trace_rq(q, rq, BLK_TA_INSERT); 338 blk_add_trace_rq(q, rq, BLK_TA_INSERT);
338 339
@@ -399,6 +400,11 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)
399 } 400 }
400 401
401 list_add_tail(&rq->queuelist, pos); 402 list_add_tail(&rq->queuelist, pos);
403 /*
404 * most requeues happen because of a busy condition, don't
405 * force unplug of the queue for that case.
406 */
407 unplug_it = 0;
402 break; 408 break;
403 409
404 default: 410 default:
@@ -407,7 +413,7 @@ void elv_insert(request_queue_t *q, struct request *rq, int where)
407 BUG(); 413 BUG();
408 } 414 }
409 415
410 if (blk_queue_plugged(q)) { 416 if (unplug_it && blk_queue_plugged(q)) {
411 int nrq = q->rq.count[READ] + q->rq.count[WRITE] 417 int nrq = q->rq.count[READ] + q->rq.count[WRITE]
412 - q->in_flight; 418 - q->in_flight;
413 419
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index e5041a02e21f..eac48bec1479 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1732,8 +1732,21 @@ void blk_run_queue(struct request_queue *q)
1732 1732
1733 spin_lock_irqsave(q->queue_lock, flags); 1733 spin_lock_irqsave(q->queue_lock, flags);
1734 blk_remove_plug(q); 1734 blk_remove_plug(q);
1735 if (!elv_queue_empty(q)) 1735
1736 q->request_fn(q); 1736 /*
1737 * Only recurse once to avoid overrunning the stack, let the unplug
1738 * handling reinvoke the handler shortly if we already got there.
1739 */
1740 if (!elv_queue_empty(q)) {
1741 if (!test_and_set_bit(QUEUE_FLAG_REENTER, &q->queue_flags)) {
1742 q->request_fn(q);
1743 clear_bit(QUEUE_FLAG_REENTER, &q->queue_flags);
1744 } else {
1745 blk_plug_device(q);
1746 kblockd_schedule_work(&q->unplug_work);
1747 }
1748 }
1749
1737 spin_unlock_irqrestore(q->queue_lock, flags); 1750 spin_unlock_irqrestore(q->queue_lock, flags);
1738} 1751}
1739EXPORT_SYMBOL(blk_run_queue); 1752EXPORT_SYMBOL(blk_run_queue);
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 0e71dff327cd..b1ea4df85c7d 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -456,6 +456,35 @@ static void class_device_remove_attrs(struct class_device * cd)
456 } 456 }
457} 457}
458 458
459static int class_device_add_groups(struct class_device * cd)
460{
461 int i;
462 int error = 0;
463
464 if (cd->groups) {
465 for (i = 0; cd->groups[i]; i++) {
466 error = sysfs_create_group(&cd->kobj, cd->groups[i]);
467 if (error) {
468 while (--i >= 0)
469 sysfs_remove_group(&cd->kobj, cd->groups[i]);
470 goto out;
471 }
472 }
473 }
474out:
475 return error;
476}
477
478static void class_device_remove_groups(struct class_device * cd)
479{
480 int i;
481 if (cd->groups) {
482 for (i = 0; cd->groups[i]; i++) {
483 sysfs_remove_group(&cd->kobj, cd->groups[i]);
484 }
485 }
486}
487
459static ssize_t show_dev(struct class_device *class_dev, char *buf) 488static ssize_t show_dev(struct class_device *class_dev, char *buf)
460{ 489{
461 return print_dev_t(buf, class_dev->devt); 490 return print_dev_t(buf, class_dev->devt);
@@ -559,6 +588,8 @@ int class_device_add(struct class_device *class_dev)
559 class_name); 588 class_name);
560 } 589 }
561 590
591 class_device_add_groups(class_dev);
592
562 kobject_uevent(&class_dev->kobj, KOBJ_ADD); 593 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
563 594
564 /* notify any interfaces this device is now here */ 595 /* notify any interfaces this device is now here */
@@ -672,6 +703,7 @@ void class_device_del(struct class_device *class_dev)
672 if (class_dev->devt_attr) 703 if (class_dev->devt_attr)
673 class_device_remove_file(class_dev, class_dev->devt_attr); 704 class_device_remove_file(class_dev, class_dev->devt_attr);
674 class_device_remove_attrs(class_dev); 705 class_device_remove_attrs(class_dev);
706 class_device_remove_groups(class_dev);
675 707
676 kobject_uevent(&class_dev->kobj, KOBJ_REMOVE); 708 kobject_uevent(&class_dev->kobj, KOBJ_REMOVE);
677 kobject_del(&class_dev->kobj); 709 kobject_del(&class_dev->kobj);
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index f73446f580df..c688c25992e4 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -536,6 +536,9 @@ static void ub_cleanup(struct ub_dev *sc)
536 kfree(lun); 536 kfree(lun);
537 } 537 }
538 538
539 usb_set_intfdata(sc->intf, NULL);
540 usb_put_intf(sc->intf);
541 usb_put_dev(sc->dev);
539 kfree(sc); 542 kfree(sc);
540} 543}
541 544
@@ -2221,7 +2224,12 @@ static int ub_probe(struct usb_interface *intf,
2221 // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber; 2224 // sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
2222 usb_set_intfdata(intf, sc); 2225 usb_set_intfdata(intf, sc);
2223 usb_get_dev(sc->dev); 2226 usb_get_dev(sc->dev);
2224 // usb_get_intf(sc->intf); /* Do we need this? */ 2227 /*
2228 * Since we give the interface struct to the block level through
2229 * disk->driverfs_dev, we have to pin it. Otherwise, block_uevent
2230 * oopses on close after a disconnect (kernels 2.6.16 and up).
2231 */
2232 usb_get_intf(sc->intf);
2225 2233
2226 snprintf(sc->name, 12, DRV_NAME "(%d.%d)", 2234 snprintf(sc->name, 12, DRV_NAME "(%d.%d)",
2227 sc->dev->bus->busnum, sc->dev->devnum); 2235 sc->dev->bus->busnum, sc->dev->devnum);
@@ -2286,7 +2294,7 @@ static int ub_probe(struct usb_interface *intf,
2286 2294
2287err_dev_desc: 2295err_dev_desc:
2288 usb_set_intfdata(intf, NULL); 2296 usb_set_intfdata(intf, NULL);
2289 // usb_put_intf(sc->intf); 2297 usb_put_intf(sc->intf);
2290 usb_put_dev(sc->dev); 2298 usb_put_dev(sc->dev);
2291 kfree(sc); 2299 kfree(sc);
2292err_core: 2300err_core:
@@ -2461,12 +2469,6 @@ static void ub_disconnect(struct usb_interface *intf)
2461 * and no URBs left in transit. 2469 * and no URBs left in transit.
2462 */ 2470 */
2463 2471
2464 usb_set_intfdata(intf, NULL);
2465 // usb_put_intf(sc->intf);
2466 sc->intf = NULL;
2467 usb_put_dev(sc->dev);
2468 sc->dev = NULL;
2469
2470 ub_put(sc); 2472 ub_put(sc);
2471} 2473}
2472 2474
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 402296670d3a..78d928f9d9f1 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -291,7 +291,7 @@ config SX
291 291
292config RIO 292config RIO
293 tristate "Specialix RIO system support" 293 tristate "Specialix RIO system support"
294 depends on SERIAL_NONSTANDARD && !64BIT 294 depends on SERIAL_NONSTANDARD
295 help 295 help
296 This is a driver for the Specialix RIO, a smart serial card which 296 This is a driver for the Specialix RIO, a smart serial card which
297 drives an outboard box that can support up to 128 ports. Product 297 drives an outboard box that can support up to 128 ports. Product
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 02114a0bd0d9..128b2632512d 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1981,10 +1981,6 @@ static int __init cmm_init(void)
1981 if (!cmm_class) 1981 if (!cmm_class)
1982 return -1; 1982 return -1;
1983 1983
1984 rc = pcmcia_register_driver(&cm4000_driver);
1985 if (rc < 0)
1986 return rc;
1987
1988 major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); 1984 major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
1989 if (major < 0) { 1985 if (major < 0) {
1990 printk(KERN_WARNING MODULE_NAME 1986 printk(KERN_WARNING MODULE_NAME
@@ -1992,6 +1988,12 @@ static int __init cmm_init(void)
1992 return -1; 1988 return -1;
1993 } 1989 }
1994 1990
1991 rc = pcmcia_register_driver(&cm4000_driver);
1992 if (rc < 0) {
1993 unregister_chrdev(major, DEVICE_NAME);
1994 return rc;
1995 }
1996
1995 return 0; 1997 return 0;
1996} 1998}
1997 1999
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 29efa64580a8..47a8465bf95b 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -724,16 +724,19 @@ static int __init cm4040_init(void)
724 if (!cmx_class) 724 if (!cmx_class)
725 return -1; 725 return -1;
726 726
727 rc = pcmcia_register_driver(&reader_driver);
728 if (rc < 0)
729 return rc;
730
731 major = register_chrdev(0, DEVICE_NAME, &reader_fops); 727 major = register_chrdev(0, DEVICE_NAME, &reader_fops);
732 if (major < 0) { 728 if (major < 0) {
733 printk(KERN_WARNING MODULE_NAME 729 printk(KERN_WARNING MODULE_NAME
734 ": could not get major number\n"); 730 ": could not get major number\n");
735 return -1; 731 return -1;
736 } 732 }
733
734 rc = pcmcia_register_driver(&reader_driver);
735 if (rc < 0) {
736 unregister_chrdev(major, DEVICE_NAME);
737 return rc;
738 }
739
737 return 0; 740 return 0;
738} 741}
739 742
diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h
index 3ec73d1a279a..179cdbea712b 100644
--- a/drivers/char/rio/host.h
+++ b/drivers/char/rio/host.h
@@ -33,12 +33,6 @@
33#ifndef __rio_host_h__ 33#ifndef __rio_host_h__
34#define __rio_host_h__ 34#define __rio_host_h__
35 35
36#ifdef SCCS_LABELS
37#ifndef lint
38static char *_host_h_sccs_ = "@(#)host.h 1.2";
39#endif
40#endif
41
42/* 36/*
43** the host structure - one per host card in the system. 37** the host structure - one per host card in the system.
44*/ 38*/
@@ -77,9 +71,6 @@ struct Host {
77#define RC_STARTUP 1 71#define RC_STARTUP 1
78#define RC_RUNNING 2 72#define RC_RUNNING 2
79#define RC_STUFFED 3 73#define RC_STUFFED 3
80#define RC_SOMETHING 4
81#define RC_SOMETHING_NEW 5
82#define RC_SOMETHING_ELSE 6
83#define RC_READY 7 74#define RC_READY 7
84#define RUN_STATE 7 75#define RUN_STATE 7
85/* 76/*
diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c
index acda9326c2ef..290143addd34 100644
--- a/drivers/char/rio/rioboot.c
+++ b/drivers/char/rio/rioboot.c
@@ -34,6 +34,7 @@
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/termios.h> 35#include <linux/termios.h>
36#include <linux/serial.h> 36#include <linux/serial.h>
37#include <linux/vmalloc.h>
37#include <asm/semaphore.h> 38#include <asm/semaphore.h>
38#include <linux/generic_serial.h> 39#include <linux/generic_serial.h>
39#include <linux/errno.h> 40#include <linux/errno.h>
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c
index d31aba62bb7f..75b2557c37ec 100644
--- a/drivers/char/rio/rioctrl.c
+++ b/drivers/char/rio/rioctrl.c
@@ -1394,14 +1394,17 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
1394 return RIO_FAIL; 1394 return RIO_FAIL;
1395 } 1395 }
1396 1396
1397 if (((int) ((char) PortP->InUse) == -1) || !(CmdBlkP = RIOGetCmdBlk())) { 1397 if ((PortP->InUse == (typeof(PortP->InUse))-1) ||
1398 rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block for command %d on port %d\n", Cmd, PortP->PortNum); 1398 !(CmdBlkP = RIOGetCmdBlk())) {
1399 rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block "
1400 "for command %d on port %d\n", Cmd, PortP->PortNum);
1399 return RIO_FAIL; 1401 return RIO_FAIL;
1400 } 1402 }
1401 1403
1402 rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", CmdBlkP, PortP->InUse); 1404 rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n",
1405 CmdBlkP, PortP->InUse);
1403 1406
1404 PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; 1407 PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0];
1405 1408
1406 CmdBlkP->Packet.src_unit = 0; 1409 CmdBlkP->Packet.src_unit = 0;
1407 if (PortP->SecondBlock) 1410 if (PortP->SecondBlock)
@@ -1425,38 +1428,46 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
1425 1428
1426 switch (Cmd) { 1429 switch (Cmd) {
1427 case MEMDUMP: 1430 case MEMDUMP:
1428 rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); 1431 rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p "
1432 "(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
1429 PktCmdP->SubCommand = MEMDUMP; 1433 PktCmdP->SubCommand = MEMDUMP;
1430 PktCmdP->SubAddr = SubCmd.Addr; 1434 PktCmdP->SubAddr = SubCmd.Addr;
1431 break; 1435 break;
1432 case FCLOSE: 1436 case FCLOSE:
1433 rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", CmdBlkP); 1437 rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n",
1438 CmdBlkP);
1434 break; 1439 break;
1435 case READ_REGISTER: 1440 case READ_REGISTER:
1436 rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk %p\n", (int) SubCmd.Addr, CmdBlkP); 1441 rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) "
1442 "command blk %p\n", (int) SubCmd.Addr, CmdBlkP);
1437 PktCmdP->SubCommand = READ_REGISTER; 1443 PktCmdP->SubCommand = READ_REGISTER;
1438 PktCmdP->SubAddr = SubCmd.Addr; 1444 PktCmdP->SubAddr = SubCmd.Addr;
1439 break; 1445 break;
1440 case RESUME: 1446 case RESUME:
1441 rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", CmdBlkP); 1447 rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n",
1448 CmdBlkP);
1442 break; 1449 break;
1443 case RFLUSH: 1450 case RFLUSH:
1444 rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", CmdBlkP); 1451 rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n",
1452 CmdBlkP);
1445 CmdBlkP->PostFuncP = RIORFlushEnable; 1453 CmdBlkP->PostFuncP = RIORFlushEnable;
1446 break; 1454 break;
1447 case SUSPEND: 1455 case SUSPEND:
1448 rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", CmdBlkP); 1456 rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n",
1457 CmdBlkP);
1449 break; 1458 break;
1450 1459
1451 case MGET: 1460 case MGET:
1452 rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", CmdBlkP); 1461 rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n",
1462 CmdBlkP);
1453 break; 1463 break;
1454 1464
1455 case MSET: 1465 case MSET:
1456 case MBIC: 1466 case MBIC:
1457 case MBIS: 1467 case MBIS:
1458 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; 1468 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
1459 rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk %p\n", CmdBlkP); 1469 rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command "
1470 "blk %p\n", CmdBlkP);
1460 break; 1471 break;
1461 1472
1462 case WFLUSH: 1473 case WFLUSH:
@@ -1465,12 +1476,14 @@ int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
1465 ** allowed then we should not bother sending any more to the 1476 ** allowed then we should not bother sending any more to the
1466 ** RTA. 1477 ** RTA.
1467 */ 1478 */
1468 if ((int) ((char) PortP->WflushFlag) == (int) -1) { 1479 if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) {
1469 rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, WflushFlag about to wrap!"); 1480 rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, "
1481 "WflushFlag about to wrap!");
1470 RIOFreeCmdBlk(CmdBlkP); 1482 RIOFreeCmdBlk(CmdBlkP);
1471 return (RIO_FAIL); 1483 return (RIO_FAIL);
1472 } else { 1484 } else {
1473 rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk %p\n", CmdBlkP); 1485 rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command "
1486 "blk %p\n", CmdBlkP);
1474 CmdBlkP->PostFuncP = RIOWFlushMark; 1487 CmdBlkP->PostFuncP = RIOWFlushMark;
1475 } 1488 }
1476 break; 1489 break;
diff --git a/drivers/char/rio/rioioctl.h b/drivers/char/rio/rioioctl.h
index 14b83fae75c8..e8af5b30519e 100644
--- a/drivers/char/rio/rioioctl.h
+++ b/drivers/char/rio/rioioctl.h
@@ -33,10 +33,6 @@
33#ifndef __rioioctl_h__ 33#ifndef __rioioctl_h__
34#define __rioioctl_h__ 34#define __rioioctl_h__
35 35
36#ifdef SCCS_LABELS
37static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2";
38#endif
39
40/* 36/*
41** RIO device driver - user ioctls and associated structures. 37** RIO device driver - user ioctls and associated structures.
42*/ 38*/
@@ -44,55 +40,13 @@ static char *_rioioctl_h_sccs_ = "@(#)rioioctl.h 1.2";
44struct portStats { 40struct portStats {
45 int port; 41 int port;
46 int gather; 42 int gather;
47 ulong txchars; 43 unsigned long txchars;
48 ulong rxchars; 44 unsigned long rxchars;
49 ulong opens; 45 unsigned long opens;
50 ulong closes; 46 unsigned long closes;
51 ulong ioctls; 47 unsigned long ioctls;
52}; 48};
53 49
54
55#define rIOC ('r'<<8)
56#define TCRIOSTATE (rIOC | 1)
57#define TCRIOXPON (rIOC | 2)
58#define TCRIOXPOFF (rIOC | 3)
59#define TCRIOXPCPS (rIOC | 4)
60#define TCRIOXPRINT (rIOC | 5)
61#define TCRIOIXANYON (rIOC | 6)
62#define TCRIOIXANYOFF (rIOC | 7)
63#define TCRIOIXONON (rIOC | 8)
64#define TCRIOIXONOFF (rIOC | 9)
65#define TCRIOMBIS (rIOC | 10)
66#define TCRIOMBIC (rIOC | 11)
67#define TCRIOTRIAD (rIOC | 12)
68#define TCRIOTSTATE (rIOC | 13)
69
70/*
71** 15.10.1998 ARG - ESIL 0761 part fix
72** Add RIO ioctls for manipulating RTS and CTS flow control, (as LynxOS
73** appears to not support hardware flow control).
74*/
75#define TCRIOCTSFLOWEN (rIOC | 14) /* enable CTS flow control */
76#define TCRIOCTSFLOWDIS (rIOC | 15) /* disable CTS flow control */
77#define TCRIORTSFLOWEN (rIOC | 16) /* enable RTS flow control */
78#define TCRIORTSFLOWDIS (rIOC | 17) /* disable RTS flow control */
79
80/*
81** 09.12.1998 ARG - ESIL 0776 part fix
82** Definition for 'RIOC' also appears in daemon.h, so we'd better do a
83** #ifndef here first.
84** 'RIO_QUICK_CHECK' also #define'd here as this ioctl is now
85** allowed to be used by customers.
86**
87** 05.02.1999 ARG -
88** This is what I've decied to do with ioctls etc., which are intended to be
89** invoked from users applications :
90** Anything that needs to be defined here will be removed from daemon.h, that
91** way it won't end up having to be defined/maintained in two places. The only
92** consequence of this is that this file should now be #include'd by daemon.h
93**
94** 'stats' ioctls now #define'd here as they are to be used by customers.
95*/
96#define RIOC ('R'<<8)|('i'<<16)|('o'<<24) 50#define RIOC ('R'<<8)|('i'<<16)|('o'<<24)
97 51
98#define RIO_QUICK_CHECK (RIOC | 105) 52#define RIO_QUICK_CHECK (RIOC | 105)
diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index 1efde3b27619..fe00c7dfb649 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -22,7 +22,7 @@ config TCG_TPM
22 22
23config TCG_TIS 23config TCG_TIS
24 tristate "TPM Interface Specification 1.2 Interface" 24 tristate "TPM Interface Specification 1.2 Interface"
25 depends on TCG_TPM 25 depends on TCG_TPM && PNPACPI
26 ---help--- 26 ---help---
27 If you have a TPM security chip that is compliant with the 27 If you have a TPM security chip that is compliant with the
28 TCG TIS 1.2 TPM specification say Yes and it will be accessible 28 TCG TIS 1.2 TPM specification say Yes and it will be accessible
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 54a4c804e25f..050ced247f68 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -140,7 +140,7 @@ extern int tpm_pm_resume(struct device *);
140extern struct dentry ** tpm_bios_log_setup(char *); 140extern struct dentry ** tpm_bios_log_setup(char *);
141extern void tpm_bios_log_teardown(struct dentry **); 141extern void tpm_bios_log_teardown(struct dentry **);
142#else 142#else
143static inline struct dentry* tpm_bios_log_setup(char *name) 143static inline struct dentry ** tpm_bios_log_setup(char *name)
144{ 144{
145 return NULL; 145 return NULL;
146} 146}
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index b9cae9a238bb..f621168f38ae 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -55,7 +55,7 @@ enum tis_int_flags {
55}; 55};
56 56
57enum tis_defaults { 57enum tis_defaults {
58 TIS_MEM_BASE = 0xFED4000, 58 TIS_MEM_BASE = 0xFED40000,
59 TIS_MEM_LEN = 0x5000, 59 TIS_MEM_LEN = 0x5000,
60 TIS_SHORT_TIMEOUT = 750, /* ms */ 60 TIS_SHORT_TIMEOUT = 750, /* ms */
61 TIS_LONG_TIMEOUT = 2000, /* 2 sec */ 61 TIS_LONG_TIMEOUT = 2000, /* 2 sec */
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 956d121cb161..3e6ffcaa5af4 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -74,6 +74,8 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */
74static DEFINE_MUTEX (dbs_mutex); 74static DEFINE_MUTEX (dbs_mutex);
75static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); 75static DECLARE_WORK (dbs_work, do_dbs_timer, NULL);
76 76
77static struct workqueue_struct *dbs_workq;
78
77struct dbs_tuners { 79struct dbs_tuners {
78 unsigned int sampling_rate; 80 unsigned int sampling_rate;
79 unsigned int sampling_down_factor; 81 unsigned int sampling_down_factor;
@@ -364,23 +366,29 @@ static void do_dbs_timer(void *data)
364 mutex_lock(&dbs_mutex); 366 mutex_lock(&dbs_mutex);
365 for_each_online_cpu(i) 367 for_each_online_cpu(i)
366 dbs_check_cpu(i); 368 dbs_check_cpu(i);
367 schedule_delayed_work(&dbs_work, 369 queue_delayed_work(dbs_workq, &dbs_work,
368 usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); 370 usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
369 mutex_unlock(&dbs_mutex); 371 mutex_unlock(&dbs_mutex);
370} 372}
371 373
372static inline void dbs_timer_init(void) 374static inline void dbs_timer_init(void)
373{ 375{
374 INIT_WORK(&dbs_work, do_dbs_timer, NULL); 376 INIT_WORK(&dbs_work, do_dbs_timer, NULL);
375 schedule_delayed_work(&dbs_work, 377 if (!dbs_workq)
376 usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); 378 dbs_workq = create_singlethread_workqueue("ondemand");
379 if (!dbs_workq) {
380 printk(KERN_ERR "ondemand: Cannot initialize kernel thread\n");
381 return;
382 }
383 queue_delayed_work(dbs_workq, &dbs_work,
384 usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
377 return; 385 return;
378} 386}
379 387
380static inline void dbs_timer_exit(void) 388static inline void dbs_timer_exit(void)
381{ 389{
382 cancel_delayed_work(&dbs_work); 390 if (dbs_workq)
383 return; 391 cancel_rearming_delayed_workqueue(dbs_workq, &dbs_work);
384} 392}
385 393
386static int cpufreq_governor_dbs(struct cpufreq_policy *policy, 394static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
@@ -489,8 +497,12 @@ static int __init cpufreq_gov_dbs_init(void)
489 497
490static void __exit cpufreq_gov_dbs_exit(void) 498static void __exit cpufreq_gov_dbs_exit(void)
491{ 499{
492 /* Make sure that the scheduled work is indeed not running */ 500 /* Make sure that the scheduled work is indeed not running.
493 flush_scheduled_work(); 501 Assumes the timer has been cancelled first. */
502 if (dbs_workq) {
503 flush_workqueue(dbs_workq);
504 destroy_workqueue(dbs_workq);
505 }
494 506
495 cpufreq_unregister_governor(&cpufreq_gov_dbs); 507 cpufreq_unregister_governor(&cpufreq_gov_dbs);
496} 508}
diff --git a/drivers/edac/e752x_edac.c b/drivers/edac/e752x_edac.c
index 66572c5323ad..fce31936e6d7 100644
--- a/drivers/edac/e752x_edac.c
+++ b/drivers/edac/e752x_edac.c
@@ -25,6 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include "edac_mc.h" 26#include "edac_mc.h"
27 27
28static int force_function_unhide;
29
28#define e752x_printk(level, fmt, arg...) \ 30#define e752x_printk(level, fmt, arg...) \
29 edac_printk(level, "e752x", fmt, ##arg) 31 edac_printk(level, "e752x", fmt, ##arg)
30 32
@@ -782,8 +784,16 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
782 debugf0("%s(): mci\n", __func__); 784 debugf0("%s(): mci\n", __func__);
783 debugf0("Starting Probe1\n"); 785 debugf0("Starting Probe1\n");
784 786
785 /* enable device 0 function 1 */ 787 /* check to see if device 0 function 1 is enabled; if it isn't, we
788 * assume the BIOS has reserved it for a reason and is expecting
789 * exclusive access, we take care not to violate that assumption and
790 * fail the probe. */
786 pci_read_config_byte(pdev, E752X_DEVPRES1, &stat8); 791 pci_read_config_byte(pdev, E752X_DEVPRES1, &stat8);
792 if (!force_function_unhide && !(stat8 & (1 << 5))) {
793 printk(KERN_INFO "Contact your BIOS vendor to see if the "
794 "E752x error registers can be safely un-hidden\n");
795 goto fail;
796 }
787 stat8 |= (1 << 5); 797 stat8 |= (1 << 5);
788 pci_write_config_byte(pdev, E752X_DEVPRES1, stat8); 798 pci_write_config_byte(pdev, E752X_DEVPRES1, stat8);
789 799
@@ -1063,3 +1073,8 @@ module_exit(e752x_exit);
1063MODULE_LICENSE("GPL"); 1073MODULE_LICENSE("GPL");
1064MODULE_AUTHOR("Linux Networx (http://lnxi.com) Tom Zimmerman\n"); 1074MODULE_AUTHOR("Linux Networx (http://lnxi.com) Tom Zimmerman\n");
1065MODULE_DESCRIPTION("MC support for Intel e752x memory controllers"); 1075MODULE_DESCRIPTION("MC support for Intel e752x memory controllers");
1076
1077module_param(force_function_unhide, int, 0444);
1078MODULE_PARM_DESC(force_function_unhide, "if BIOS sets Dev0:Fun1 up as hidden:"
1079" 1=force unhide and hope BIOS doesn't fight driver for Dev0:Fun1 access");
1080
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 8bd305e47f0d..a140e4536a4e 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -133,6 +133,9 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
133 133
134 outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1); 134 outb(inb(ACBCTL1) | ACBCTL1_STOP, ACBCTL1);
135 outb(ACBST_STASTR | ACBST_NEGACK, ACBST); 135 outb(ACBST_STASTR | ACBST_NEGACK, ACBST);
136
137 /* Reset the status register */
138 outb(0, ACBST);
136 return; 139 return;
137 } 140 }
138 141
@@ -228,6 +231,10 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
228 timeout = jiffies + POLL_TIMEOUT; 231 timeout = jiffies + POLL_TIMEOUT;
229 while (time_before(jiffies, timeout)) { 232 while (time_before(jiffies, timeout)) {
230 status = inb(ACBST); 233 status = inb(ACBST);
234
235 /* Reset the status register to avoid the hang */
236 outb(0, ACBST);
237
231 if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) { 238 if ((status & (ACBST_SDAST|ACBST_BER|ACBST_NEGACK)) != 0) {
232 scx200_acb_machine(iface, status); 239 scx200_acb_machine(iface, status);
233 return; 240 return;
@@ -415,7 +422,6 @@ static int __init scx200_acb_create(const char *text, int base, int index)
415 struct scx200_acb_iface *iface; 422 struct scx200_acb_iface *iface;
416 struct i2c_adapter *adapter; 423 struct i2c_adapter *adapter;
417 int rc; 424 int rc;
418 char description[64];
419 425
420 iface = kzalloc(sizeof(*iface), GFP_KERNEL); 426 iface = kzalloc(sizeof(*iface), GFP_KERNEL);
421 if (!iface) { 427 if (!iface) {
@@ -434,10 +440,7 @@ static int __init scx200_acb_create(const char *text, int base, int index)
434 440
435 mutex_init(&iface->mutex); 441 mutex_init(&iface->mutex);
436 442
437 snprintf(description, sizeof(description), "%s ACCESS.bus [%s]", 443 if (!request_region(base, 8, adapter->name)) {
438 text, adapter->name);
439
440 if (request_region(base, 8, description) == 0) {
441 printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n", 444 printk(KERN_ERR NAME ": can't allocate io 0x%x-0x%x\n",
442 base, base + 8-1); 445 base, base + 8-1);
443 rc = -EBUSY; 446 rc = -EBUSY;
@@ -524,6 +527,9 @@ static int __init scx200_acb_init(void)
524 } else if (pci_dev_present(divil_pci)) 527 } else if (pci_dev_present(divil_pci))
525 rc = scx200_add_cs553x(); 528 rc = scx200_add_cs553x();
526 529
530 /* If at least one bus was created, init must succeed */
531 if (scx200_acb_list)
532 return 0;
527 return rc; 533 return rc;
528} 534}
529 535
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 4961f1e764a7..602797a44208 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -392,6 +392,7 @@ static struct pcmcia_device_id ide_ids[] = {
392 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), 392 PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e),
393 PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae), 393 PCMCIA_DEVICE_PROD_ID12("HITACHI", "FLASH", 0xf4f43949, 0x9eb86aae),
394 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 394 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178),
395 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178),
395 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 396 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753),
396 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 397 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b),
397 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 398 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149),
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 7cfedb8d9bcd..86fee43502cd 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -34,6 +34,8 @@
34 * 34 *
35 * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $ 35 * $Id: cm.c 2821 2005-07-08 17:07:28Z sean.hefty $
36 */ 36 */
37
38#include <linux/completion.h>
37#include <linux/dma-mapping.h> 39#include <linux/dma-mapping.h>
38#include <linux/err.h> 40#include <linux/err.h>
39#include <linux/idr.h> 41#include <linux/idr.h>
@@ -122,7 +124,7 @@ struct cm_id_private {
122 struct rb_node service_node; 124 struct rb_node service_node;
123 struct rb_node sidr_id_node; 125 struct rb_node sidr_id_node;
124 spinlock_t lock; /* Do not acquire inside cm.lock */ 126 spinlock_t lock; /* Do not acquire inside cm.lock */
125 wait_queue_head_t wait; 127 struct completion comp;
126 atomic_t refcount; 128 atomic_t refcount;
127 129
128 struct ib_mad_send_buf *msg; 130 struct ib_mad_send_buf *msg;
@@ -159,7 +161,7 @@ static void cm_work_handler(void *data);
159static inline void cm_deref_id(struct cm_id_private *cm_id_priv) 161static inline void cm_deref_id(struct cm_id_private *cm_id_priv)
160{ 162{
161 if (atomic_dec_and_test(&cm_id_priv->refcount)) 163 if (atomic_dec_and_test(&cm_id_priv->refcount))
162 wake_up(&cm_id_priv->wait); 164 complete(&cm_id_priv->comp);
163} 165}
164 166
165static int cm_alloc_msg(struct cm_id_private *cm_id_priv, 167static int cm_alloc_msg(struct cm_id_private *cm_id_priv,
@@ -559,7 +561,7 @@ struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
559 goto error; 561 goto error;
560 562
561 spin_lock_init(&cm_id_priv->lock); 563 spin_lock_init(&cm_id_priv->lock);
562 init_waitqueue_head(&cm_id_priv->wait); 564 init_completion(&cm_id_priv->comp);
563 INIT_LIST_HEAD(&cm_id_priv->work_list); 565 INIT_LIST_HEAD(&cm_id_priv->work_list);
564 atomic_set(&cm_id_priv->work_count, -1); 566 atomic_set(&cm_id_priv->work_count, -1);
565 atomic_set(&cm_id_priv->refcount, 1); 567 atomic_set(&cm_id_priv->refcount, 1);
@@ -724,8 +726,8 @@ retest:
724 } 726 }
725 727
726 cm_free_id(cm_id->local_id); 728 cm_free_id(cm_id->local_id);
727 atomic_dec(&cm_id_priv->refcount); 729 cm_deref_id(cm_id_priv);
728 wait_event(cm_id_priv->wait, !atomic_read(&cm_id_priv->refcount)); 730 wait_for_completion(&cm_id_priv->comp);
729 while ((work = cm_dequeue_work(cm_id_priv)) != NULL) 731 while ((work = cm_dequeue_work(cm_id_priv)) != NULL)
730 cm_free_work(work); 732 cm_free_work(work);
731 if (cm_id_priv->private_data && cm_id_priv->private_data_len) 733 if (cm_id_priv->private_data && cm_id_priv->private_data_len)
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 469b6923a2e2..5ad41a64314c 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -352,7 +352,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device,
352 INIT_WORK(&mad_agent_priv->local_work, local_completions, 352 INIT_WORK(&mad_agent_priv->local_work, local_completions,
353 mad_agent_priv); 353 mad_agent_priv);
354 atomic_set(&mad_agent_priv->refcount, 1); 354 atomic_set(&mad_agent_priv->refcount, 1);
355 init_waitqueue_head(&mad_agent_priv->wait); 355 init_completion(&mad_agent_priv->comp);
356 356
357 return &mad_agent_priv->agent; 357 return &mad_agent_priv->agent;
358 358
@@ -467,7 +467,7 @@ struct ib_mad_agent *ib_register_mad_snoop(struct ib_device *device,
467 mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp; 467 mad_snoop_priv->agent.qp = port_priv->qp_info[qpn].qp;
468 mad_snoop_priv->agent.port_num = port_num; 468 mad_snoop_priv->agent.port_num = port_num;
469 mad_snoop_priv->mad_snoop_flags = mad_snoop_flags; 469 mad_snoop_priv->mad_snoop_flags = mad_snoop_flags;
470 init_waitqueue_head(&mad_snoop_priv->wait); 470 init_completion(&mad_snoop_priv->comp);
471 mad_snoop_priv->snoop_index = register_snoop_agent( 471 mad_snoop_priv->snoop_index = register_snoop_agent(
472 &port_priv->qp_info[qpn], 472 &port_priv->qp_info[qpn],
473 mad_snoop_priv); 473 mad_snoop_priv);
@@ -486,6 +486,18 @@ error1:
486} 486}
487EXPORT_SYMBOL(ib_register_mad_snoop); 487EXPORT_SYMBOL(ib_register_mad_snoop);
488 488
489static inline void deref_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
490{
491 if (atomic_dec_and_test(&mad_agent_priv->refcount))
492 complete(&mad_agent_priv->comp);
493}
494
495static inline void deref_snoop_agent(struct ib_mad_snoop_private *mad_snoop_priv)
496{
497 if (atomic_dec_and_test(&mad_snoop_priv->refcount))
498 complete(&mad_snoop_priv->comp);
499}
500
489static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) 501static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
490{ 502{
491 struct ib_mad_port_private *port_priv; 503 struct ib_mad_port_private *port_priv;
@@ -509,9 +521,8 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv)
509 flush_workqueue(port_priv->wq); 521 flush_workqueue(port_priv->wq);
510 ib_cancel_rmpp_recvs(mad_agent_priv); 522 ib_cancel_rmpp_recvs(mad_agent_priv);
511 523
512 atomic_dec(&mad_agent_priv->refcount); 524 deref_mad_agent(mad_agent_priv);
513 wait_event(mad_agent_priv->wait, 525 wait_for_completion(&mad_agent_priv->comp);
514 !atomic_read(&mad_agent_priv->refcount));
515 526
516 kfree(mad_agent_priv->reg_req); 527 kfree(mad_agent_priv->reg_req);
517 ib_dereg_mr(mad_agent_priv->agent.mr); 528 ib_dereg_mr(mad_agent_priv->agent.mr);
@@ -529,9 +540,8 @@ static void unregister_mad_snoop(struct ib_mad_snoop_private *mad_snoop_priv)
529 atomic_dec(&qp_info->snoop_count); 540 atomic_dec(&qp_info->snoop_count);
530 spin_unlock_irqrestore(&qp_info->snoop_lock, flags); 541 spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
531 542
532 atomic_dec(&mad_snoop_priv->refcount); 543 deref_snoop_agent(mad_snoop_priv);
533 wait_event(mad_snoop_priv->wait, 544 wait_for_completion(&mad_snoop_priv->comp);
534 !atomic_read(&mad_snoop_priv->refcount));
535 545
536 kfree(mad_snoop_priv); 546 kfree(mad_snoop_priv);
537} 547}
@@ -600,8 +610,7 @@ static void snoop_send(struct ib_mad_qp_info *qp_info,
600 spin_unlock_irqrestore(&qp_info->snoop_lock, flags); 610 spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
601 mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent, 611 mad_snoop_priv->agent.snoop_handler(&mad_snoop_priv->agent,
602 send_buf, mad_send_wc); 612 send_buf, mad_send_wc);
603 if (atomic_dec_and_test(&mad_snoop_priv->refcount)) 613 deref_snoop_agent(mad_snoop_priv);
604 wake_up(&mad_snoop_priv->wait);
605 spin_lock_irqsave(&qp_info->snoop_lock, flags); 614 spin_lock_irqsave(&qp_info->snoop_lock, flags);
606 } 615 }
607 spin_unlock_irqrestore(&qp_info->snoop_lock, flags); 616 spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
@@ -626,8 +635,7 @@ static void snoop_recv(struct ib_mad_qp_info *qp_info,
626 spin_unlock_irqrestore(&qp_info->snoop_lock, flags); 635 spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
627 mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent, 636 mad_snoop_priv->agent.recv_handler(&mad_snoop_priv->agent,
628 mad_recv_wc); 637 mad_recv_wc);
629 if (atomic_dec_and_test(&mad_snoop_priv->refcount)) 638 deref_snoop_agent(mad_snoop_priv);
630 wake_up(&mad_snoop_priv->wait);
631 spin_lock_irqsave(&qp_info->snoop_lock, flags); 639 spin_lock_irqsave(&qp_info->snoop_lock, flags);
632 } 640 }
633 spin_unlock_irqrestore(&qp_info->snoop_lock, flags); 641 spin_unlock_irqrestore(&qp_info->snoop_lock, flags);
@@ -968,8 +976,7 @@ void ib_free_send_mad(struct ib_mad_send_buf *send_buf)
968 976
969 free_send_rmpp_list(mad_send_wr); 977 free_send_rmpp_list(mad_send_wr);
970 kfree(send_buf->mad); 978 kfree(send_buf->mad);
971 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 979 deref_mad_agent(mad_agent_priv);
972 wake_up(&mad_agent_priv->wait);
973} 980}
974EXPORT_SYMBOL(ib_free_send_mad); 981EXPORT_SYMBOL(ib_free_send_mad);
975 982
@@ -1757,8 +1764,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
1757 mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv, 1764 mad_recv_wc = ib_process_rmpp_recv_wc(mad_agent_priv,
1758 mad_recv_wc); 1765 mad_recv_wc);
1759 if (!mad_recv_wc) { 1766 if (!mad_recv_wc) {
1760 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1767 deref_mad_agent(mad_agent_priv);
1761 wake_up(&mad_agent_priv->wait);
1762 return; 1768 return;
1763 } 1769 }
1764 } 1770 }
@@ -1770,8 +1776,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
1770 if (!mad_send_wr) { 1776 if (!mad_send_wr) {
1771 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 1777 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
1772 ib_free_recv_mad(mad_recv_wc); 1778 ib_free_recv_mad(mad_recv_wc);
1773 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1779 deref_mad_agent(mad_agent_priv);
1774 wake_up(&mad_agent_priv->wait);
1775 return; 1780 return;
1776 } 1781 }
1777 ib_mark_mad_done(mad_send_wr); 1782 ib_mark_mad_done(mad_send_wr);
@@ -1790,8 +1795,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv,
1790 } else { 1795 } else {
1791 mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent, 1796 mad_agent_priv->agent.recv_handler(&mad_agent_priv->agent,
1792 mad_recv_wc); 1797 mad_recv_wc);
1793 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 1798 deref_mad_agent(mad_agent_priv);
1794 wake_up(&mad_agent_priv->wait);
1795 } 1799 }
1796} 1800}
1797 1801
@@ -2021,8 +2025,7 @@ void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
2021 mad_send_wc); 2025 mad_send_wc);
2022 2026
2023 /* Release reference on agent taken when sending */ 2027 /* Release reference on agent taken when sending */
2024 if (atomic_dec_and_test(&mad_agent_priv->refcount)) 2028 deref_mad_agent(mad_agent_priv);
2025 wake_up(&mad_agent_priv->wait);
2026 return; 2029 return;
2027done: 2030done:
2028 spin_unlock_irqrestore(&mad_agent_priv->lock, flags); 2031 spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
index 6c9c133d71ef..b4fa28d3160f 100644
--- a/drivers/infiniband/core/mad_priv.h
+++ b/drivers/infiniband/core/mad_priv.h
@@ -37,6 +37,7 @@
37#ifndef __IB_MAD_PRIV_H__ 37#ifndef __IB_MAD_PRIV_H__
38#define __IB_MAD_PRIV_H__ 38#define __IB_MAD_PRIV_H__
39 39
40#include <linux/completion.h>
40#include <linux/pci.h> 41#include <linux/pci.h>
41#include <linux/kthread.h> 42#include <linux/kthread.h>
42#include <linux/workqueue.h> 43#include <linux/workqueue.h>
@@ -108,7 +109,7 @@ struct ib_mad_agent_private {
108 struct list_head rmpp_list; 109 struct list_head rmpp_list;
109 110
110 atomic_t refcount; 111 atomic_t refcount;
111 wait_queue_head_t wait; 112 struct completion comp;
112}; 113};
113 114
114struct ib_mad_snoop_private { 115struct ib_mad_snoop_private {
@@ -117,7 +118,7 @@ struct ib_mad_snoop_private {
117 int snoop_index; 118 int snoop_index;
118 int mad_snoop_flags; 119 int mad_snoop_flags;
119 atomic_t refcount; 120 atomic_t refcount;
120 wait_queue_head_t wait; 121 struct completion comp;
121}; 122};
122 123
123struct ib_mad_send_wr_private { 124struct ib_mad_send_wr_private {
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c
index dfd4e588ce03..d4704e054e30 100644
--- a/drivers/infiniband/core/mad_rmpp.c
+++ b/drivers/infiniband/core/mad_rmpp.c
@@ -49,7 +49,7 @@ struct mad_rmpp_recv {
49 struct list_head list; 49 struct list_head list;
50 struct work_struct timeout_work; 50 struct work_struct timeout_work;
51 struct work_struct cleanup_work; 51 struct work_struct cleanup_work;
52 wait_queue_head_t wait; 52 struct completion comp;
53 enum rmpp_state state; 53 enum rmpp_state state;
54 spinlock_t lock; 54 spinlock_t lock;
55 atomic_t refcount; 55 atomic_t refcount;
@@ -69,10 +69,16 @@ struct mad_rmpp_recv {
69 u8 method; 69 u8 method;
70}; 70};
71 71
72static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
73{
74 if (atomic_dec_and_test(&rmpp_recv->refcount))
75 complete(&rmpp_recv->comp);
76}
77
72static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv) 78static void destroy_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
73{ 79{
74 atomic_dec(&rmpp_recv->refcount); 80 deref_rmpp_recv(rmpp_recv);
75 wait_event(rmpp_recv->wait, !atomic_read(&rmpp_recv->refcount)); 81 wait_for_completion(&rmpp_recv->comp);
76 ib_destroy_ah(rmpp_recv->ah); 82 ib_destroy_ah(rmpp_recv->ah);
77 kfree(rmpp_recv); 83 kfree(rmpp_recv);
78} 84}
@@ -253,7 +259,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent,
253 goto error; 259 goto error;
254 260
255 rmpp_recv->agent = agent; 261 rmpp_recv->agent = agent;
256 init_waitqueue_head(&rmpp_recv->wait); 262 init_completion(&rmpp_recv->comp);
257 INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv); 263 INIT_WORK(&rmpp_recv->timeout_work, recv_timeout_handler, rmpp_recv);
258 INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv); 264 INIT_WORK(&rmpp_recv->cleanup_work, recv_cleanup_handler, rmpp_recv);
259 spin_lock_init(&rmpp_recv->lock); 265 spin_lock_init(&rmpp_recv->lock);
@@ -279,12 +285,6 @@ error: kfree(rmpp_recv);
279 return NULL; 285 return NULL;
280} 286}
281 287
282static inline void deref_rmpp_recv(struct mad_rmpp_recv *rmpp_recv)
283{
284 if (atomic_dec_and_test(&rmpp_recv->refcount))
285 wake_up(&rmpp_recv->wait);
286}
287
288static struct mad_rmpp_recv * 288static struct mad_rmpp_recv *
289find_rmpp_recv(struct ib_mad_agent_private *agent, 289find_rmpp_recv(struct ib_mad_agent_private *agent,
290 struct ib_mad_recv_wc *mad_recv_wc) 290 struct ib_mad_recv_wc *mad_recv_wc)
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 15121cb5a1f6..21f9282c1b25 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -336,7 +336,7 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
336 switch (width) { 336 switch (width) {
337 case 4: 337 case 4:
338 ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >> 338 ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >>
339 (offset % 4)) & 0xf); 339 (4 - (offset % 8))) & 0xf);
340 break; 340 break;
341 case 8: 341 case 8:
342 ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]); 342 ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]);
diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index f6a05965a4e8..9164a09b6ccd 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -32,6 +32,8 @@
32 * 32 *
33 * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $ 33 * $Id: ucm.c 2594 2005-06-13 19:46:02Z libor $
34 */ 34 */
35
36#include <linux/completion.h>
35#include <linux/init.h> 37#include <linux/init.h>
36#include <linux/fs.h> 38#include <linux/fs.h>
37#include <linux/module.h> 39#include <linux/module.h>
@@ -72,7 +74,7 @@ struct ib_ucm_file {
72 74
73struct ib_ucm_context { 75struct ib_ucm_context {
74 int id; 76 int id;
75 wait_queue_head_t wait; 77 struct completion comp;
76 atomic_t ref; 78 atomic_t ref;
77 int events_reported; 79 int events_reported;
78 80
@@ -138,7 +140,7 @@ static struct ib_ucm_context *ib_ucm_ctx_get(struct ib_ucm_file *file, int id)
138static void ib_ucm_ctx_put(struct ib_ucm_context *ctx) 140static void ib_ucm_ctx_put(struct ib_ucm_context *ctx)
139{ 141{
140 if (atomic_dec_and_test(&ctx->ref)) 142 if (atomic_dec_and_test(&ctx->ref))
141 wake_up(&ctx->wait); 143 complete(&ctx->comp);
142} 144}
143 145
144static inline int ib_ucm_new_cm_id(int event) 146static inline int ib_ucm_new_cm_id(int event)
@@ -178,7 +180,7 @@ static struct ib_ucm_context *ib_ucm_ctx_alloc(struct ib_ucm_file *file)
178 return NULL; 180 return NULL;
179 181
180 atomic_set(&ctx->ref, 1); 182 atomic_set(&ctx->ref, 1);
181 init_waitqueue_head(&ctx->wait); 183 init_completion(&ctx->comp);
182 ctx->file = file; 184 ctx->file = file;
183 INIT_LIST_HEAD(&ctx->events); 185 INIT_LIST_HEAD(&ctx->events);
184 186
@@ -586,8 +588,8 @@ static ssize_t ib_ucm_destroy_id(struct ib_ucm_file *file,
586 if (IS_ERR(ctx)) 588 if (IS_ERR(ctx))
587 return PTR_ERR(ctx); 589 return PTR_ERR(ctx);
588 590
589 atomic_dec(&ctx->ref); 591 ib_ucm_ctx_put(ctx);
590 wait_event(ctx->wait, !atomic_read(&ctx->ref)); 592 wait_for_completion(&ctx->comp);
591 593
592 /* No new events will be generated after destroying the cm_id. */ 594 /* No new events will be generated after destroying the cm_id. */
593 ib_destroy_cm_id(ctx->cm_id); 595 ib_destroy_cm_id(ctx->cm_id);
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index 398add4d4cb1..3697edafd6d2 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -116,10 +116,9 @@ static int __devinit ipath_init_one(struct pci_dev *,
116#define PCI_DEVICE_ID_INFINIPATH_PE800 0x10 116#define PCI_DEVICE_ID_INFINIPATH_PE800 0x10
117 117
118static const struct pci_device_id ipath_pci_tbl[] = { 118static const struct pci_device_id ipath_pci_tbl[] = {
119 {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, 119 { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_HT) },
120 PCI_DEVICE_ID_INFINIPATH_HT)}, 120 { PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, PCI_DEVICE_ID_INFINIPATH_PE800) },
121 {PCI_DEVICE(PCI_VENDOR_ID_PATHSCALE, 121 { 0, }
122 PCI_DEVICE_ID_INFINIPATH_PE800)},
123}; 122};
124 123
125MODULE_DEVICE_TABLE(pci, ipath_pci_tbl); 124MODULE_DEVICE_TABLE(pci, ipath_pci_tbl);
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 312cf90731ea..205854e9c662 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -238,9 +238,9 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
238 spin_lock(&dev->cq_table.lock); 238 spin_lock(&dev->cq_table.lock);
239 239
240 cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1)); 240 cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
241
242 if (cq) 241 if (cq)
243 atomic_inc(&cq->refcount); 242 ++cq->refcount;
243
244 spin_unlock(&dev->cq_table.lock); 244 spin_unlock(&dev->cq_table.lock);
245 245
246 if (!cq) { 246 if (!cq) {
@@ -254,8 +254,10 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
254 if (cq->ibcq.event_handler) 254 if (cq->ibcq.event_handler)
255 cq->ibcq.event_handler(&event, cq->ibcq.cq_context); 255 cq->ibcq.event_handler(&event, cq->ibcq.cq_context);
256 256
257 if (atomic_dec_and_test(&cq->refcount)) 257 spin_lock(&dev->cq_table.lock);
258 if (!--cq->refcount)
258 wake_up(&cq->wait); 259 wake_up(&cq->wait);
260 spin_unlock(&dev->cq_table.lock);
259} 261}
260 262
261static inline int is_recv_cqe(struct mthca_cqe *cqe) 263static inline int is_recv_cqe(struct mthca_cqe *cqe)
@@ -267,23 +269,13 @@ static inline int is_recv_cqe(struct mthca_cqe *cqe)
267 return !(cqe->is_send & 0x80); 269 return !(cqe->is_send & 0x80);
268} 270}
269 271
270void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, 272void mthca_cq_clean(struct mthca_dev *dev, struct mthca_cq *cq, u32 qpn,
271 struct mthca_srq *srq) 273 struct mthca_srq *srq)
272{ 274{
273 struct mthca_cq *cq;
274 struct mthca_cqe *cqe; 275 struct mthca_cqe *cqe;
275 u32 prod_index; 276 u32 prod_index;
276 int nfreed = 0; 277 int nfreed = 0;
277 278
278 spin_lock_irq(&dev->cq_table.lock);
279 cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
280 if (cq)
281 atomic_inc(&cq->refcount);
282 spin_unlock_irq(&dev->cq_table.lock);
283
284 if (!cq)
285 return;
286
287 spin_lock_irq(&cq->lock); 279 spin_lock_irq(&cq->lock);
288 280
289 /* 281 /*
@@ -301,7 +293,7 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
301 293
302 if (0) 294 if (0)
303 mthca_dbg(dev, "Cleaning QPN %06x from CQN %06x; ci %d, pi %d\n", 295 mthca_dbg(dev, "Cleaning QPN %06x from CQN %06x; ci %d, pi %d\n",
304 qpn, cqn, cq->cons_index, prod_index); 296 qpn, cq->cqn, cq->cons_index, prod_index);
305 297
306 /* 298 /*
307 * Now sweep backwards through the CQ, removing CQ entries 299 * Now sweep backwards through the CQ, removing CQ entries
@@ -325,8 +317,6 @@ void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
325 } 317 }
326 318
327 spin_unlock_irq(&cq->lock); 319 spin_unlock_irq(&cq->lock);
328 if (atomic_dec_and_test(&cq->refcount))
329 wake_up(&cq->wait);
330} 320}
331 321
332void mthca_cq_resize_copy_cqes(struct mthca_cq *cq) 322void mthca_cq_resize_copy_cqes(struct mthca_cq *cq)
@@ -821,7 +811,7 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
821 } 811 }
822 812
823 spin_lock_init(&cq->lock); 813 spin_lock_init(&cq->lock);
824 atomic_set(&cq->refcount, 1); 814 cq->refcount = 1;
825 init_waitqueue_head(&cq->wait); 815 init_waitqueue_head(&cq->wait);
826 816
827 memset(cq_context, 0, sizeof *cq_context); 817 memset(cq_context, 0, sizeof *cq_context);
@@ -896,6 +886,17 @@ err_out:
896 return err; 886 return err;
897} 887}
898 888
889static inline int get_cq_refcount(struct mthca_dev *dev, struct mthca_cq *cq)
890{
891 int c;
892
893 spin_lock_irq(&dev->cq_table.lock);
894 c = cq->refcount;
895 spin_unlock_irq(&dev->cq_table.lock);
896
897 return c;
898}
899
899void mthca_free_cq(struct mthca_dev *dev, 900void mthca_free_cq(struct mthca_dev *dev,
900 struct mthca_cq *cq) 901 struct mthca_cq *cq)
901{ 902{
@@ -929,6 +930,7 @@ void mthca_free_cq(struct mthca_dev *dev,
929 spin_lock_irq(&dev->cq_table.lock); 930 spin_lock_irq(&dev->cq_table.lock);
930 mthca_array_clear(&dev->cq_table.cq, 931 mthca_array_clear(&dev->cq_table.cq,
931 cq->cqn & (dev->limits.num_cqs - 1)); 932 cq->cqn & (dev->limits.num_cqs - 1));
933 --cq->refcount;
932 spin_unlock_irq(&dev->cq_table.lock); 934 spin_unlock_irq(&dev->cq_table.lock);
933 935
934 if (dev->mthca_flags & MTHCA_FLAG_MSI_X) 936 if (dev->mthca_flags & MTHCA_FLAG_MSI_X)
@@ -936,8 +938,7 @@ void mthca_free_cq(struct mthca_dev *dev,
936 else 938 else
937 synchronize_irq(dev->pdev->irq); 939 synchronize_irq(dev->pdev->irq);
938 940
939 atomic_dec(&cq->refcount); 941 wait_event(cq->wait, !get_cq_refcount(dev, cq));
940 wait_event(cq->wait, !atomic_read(&cq->refcount));
941 942
942 if (cq->is_kernel) { 943 if (cq->is_kernel) {
943 mthca_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe); 944 mthca_free_cq_buf(dev, &cq->buf, cq->ibcq.cqe);
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index 4c1dcb4c1822..f8160b8de090 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -496,7 +496,7 @@ void mthca_free_cq(struct mthca_dev *dev,
496void mthca_cq_completion(struct mthca_dev *dev, u32 cqn); 496void mthca_cq_completion(struct mthca_dev *dev, u32 cqn);
497void mthca_cq_event(struct mthca_dev *dev, u32 cqn, 497void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
498 enum ib_event_type event_type); 498 enum ib_event_type event_type);
499void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, 499void mthca_cq_clean(struct mthca_dev *dev, struct mthca_cq *cq, u32 qpn,
500 struct mthca_srq *srq); 500 struct mthca_srq *srq);
501void mthca_cq_resize_copy_cqes(struct mthca_cq *cq); 501void mthca_cq_resize_copy_cqes(struct mthca_cq *cq);
502int mthca_alloc_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int nent); 502int mthca_alloc_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int nent);
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 25e1c1db9a40..a486dec1707e 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -761,6 +761,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr)
761 761
762int __devinit mthca_init_mr_table(struct mthca_dev *dev) 762int __devinit mthca_init_mr_table(struct mthca_dev *dev)
763{ 763{
764 unsigned long addr;
764 int err, i; 765 int err, i;
765 766
766 err = mthca_alloc_init(&dev->mr_table.mpt_alloc, 767 err = mthca_alloc_init(&dev->mr_table.mpt_alloc,
@@ -796,9 +797,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
796 goto err_fmr_mpt; 797 goto err_fmr_mpt;
797 } 798 }
798 799
800 addr = pci_resource_start(dev->pdev, 4) +
801 ((pci_resource_len(dev->pdev, 4) - 1) &
802 dev->mr_table.mpt_base);
803
799 dev->mr_table.tavor_fmr.mpt_base = 804 dev->mr_table.tavor_fmr.mpt_base =
800 ioremap(dev->mr_table.mpt_base, 805 ioremap(addr, (1 << i) * sizeof(struct mthca_mpt_entry));
801 (1 << i) * sizeof (struct mthca_mpt_entry));
802 806
803 if (!dev->mr_table.tavor_fmr.mpt_base) { 807 if (!dev->mr_table.tavor_fmr.mpt_base) {
804 mthca_warn(dev, "MPT ioremap for FMR failed.\n"); 808 mthca_warn(dev, "MPT ioremap for FMR failed.\n");
@@ -806,9 +810,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
806 goto err_fmr_mpt; 810 goto err_fmr_mpt;
807 } 811 }
808 812
813 addr = pci_resource_start(dev->pdev, 4) +
814 ((pci_resource_len(dev->pdev, 4) - 1) &
815 dev->mr_table.mtt_base);
816
809 dev->mr_table.tavor_fmr.mtt_base = 817 dev->mr_table.tavor_fmr.mtt_base =
810 ioremap(dev->mr_table.mtt_base, 818 ioremap(addr, (1 << i) * MTHCA_MTT_SEG_SIZE);
811 (1 << i) * MTHCA_MTT_SEG_SIZE);
812 if (!dev->mr_table.tavor_fmr.mtt_base) { 819 if (!dev->mr_table.tavor_fmr.mtt_base) {
813 mthca_warn(dev, "MTT ioremap for FMR failed.\n"); 820 mthca_warn(dev, "MTT ioremap for FMR failed.\n");
814 err = -ENOMEM; 821 err = -ENOMEM;
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.h b/drivers/infiniband/hw/mthca/mthca_provider.h
index 6676a786d690..179a8f610d0f 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.h
+++ b/drivers/infiniband/hw/mthca/mthca_provider.h
@@ -139,11 +139,12 @@ struct mthca_ah {
139 * a qp may be locked, with the send cq locked first. No other 139 * a qp may be locked, with the send cq locked first. No other
140 * nesting should be done. 140 * nesting should be done.
141 * 141 *
142 * Each struct mthca_cq/qp also has an atomic_t ref count. The 142 * Each struct mthca_cq/qp also has an ref count, protected by the
143 * pointer from the cq/qp_table to the struct counts as one reference. 143 * corresponding table lock. The pointer from the cq/qp_table to the
144 * This reference also is good for access through the consumer API, so 144 * struct counts as one reference. This reference also is good for
145 * modifying the CQ/QP etc doesn't need to take another reference. 145 * access through the consumer API, so modifying the CQ/QP etc doesn't
146 * Access because of a completion being polled does need a reference. 146 * need to take another reference. Access to a QP because of a
147 * completion being polled does not need a reference either.
147 * 148 *
148 * Finally, each struct mthca_cq/qp has a wait_queue_head_t for the 149 * Finally, each struct mthca_cq/qp has a wait_queue_head_t for the
149 * destroy function to sleep on. 150 * destroy function to sleep on.
@@ -159,8 +160,9 @@ struct mthca_ah {
159 * - decrement ref count; if zero, wake up waiters 160 * - decrement ref count; if zero, wake up waiters
160 * 161 *
161 * To destroy a CQ/QP, we can do the following: 162 * To destroy a CQ/QP, we can do the following:
162 * - lock cq/qp_table, remove pointer, unlock cq/qp_table lock 163 * - lock cq/qp_table
163 * - decrement ref count 164 * - remove pointer and decrement ref count
165 * - unlock cq/qp_table lock
164 * - wait_event until ref count is zero 166 * - wait_event until ref count is zero
165 * 167 *
166 * It is the consumer's responsibilty to make sure that no QP 168 * It is the consumer's responsibilty to make sure that no QP
@@ -197,7 +199,7 @@ struct mthca_cq_resize {
197struct mthca_cq { 199struct mthca_cq {
198 struct ib_cq ibcq; 200 struct ib_cq ibcq;
199 spinlock_t lock; 201 spinlock_t lock;
200 atomic_t refcount; 202 int refcount;
201 int cqn; 203 int cqn;
202 u32 cons_index; 204 u32 cons_index;
203 struct mthca_cq_buf buf; 205 struct mthca_cq_buf buf;
@@ -217,7 +219,7 @@ struct mthca_cq {
217struct mthca_srq { 219struct mthca_srq {
218 struct ib_srq ibsrq; 220 struct ib_srq ibsrq;
219 spinlock_t lock; 221 spinlock_t lock;
220 atomic_t refcount; 222 int refcount;
221 int srqn; 223 int srqn;
222 int max; 224 int max;
223 int max_gs; 225 int max_gs;
@@ -254,7 +256,7 @@ struct mthca_wq {
254 256
255struct mthca_qp { 257struct mthca_qp {
256 struct ib_qp ibqp; 258 struct ib_qp ibqp;
257 atomic_t refcount; 259 int refcount;
258 u32 qpn; 260 u32 qpn;
259 int is_direct; 261 int is_direct;
260 u8 port; /* for SQP and memfree use only */ 262 u8 port; /* for SQP and memfree use only */
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index f37b0e367323..19765f6f8d58 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -240,7 +240,7 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
240 spin_lock(&dev->qp_table.lock); 240 spin_lock(&dev->qp_table.lock);
241 qp = mthca_array_get(&dev->qp_table.qp, qpn & (dev->limits.num_qps - 1)); 241 qp = mthca_array_get(&dev->qp_table.qp, qpn & (dev->limits.num_qps - 1));
242 if (qp) 242 if (qp)
243 atomic_inc(&qp->refcount); 243 ++qp->refcount;
244 spin_unlock(&dev->qp_table.lock); 244 spin_unlock(&dev->qp_table.lock);
245 245
246 if (!qp) { 246 if (!qp) {
@@ -257,8 +257,10 @@ void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
257 if (qp->ibqp.event_handler) 257 if (qp->ibqp.event_handler)
258 qp->ibqp.event_handler(&event, qp->ibqp.qp_context); 258 qp->ibqp.event_handler(&event, qp->ibqp.qp_context);
259 259
260 if (atomic_dec_and_test(&qp->refcount)) 260 spin_lock(&dev->qp_table.lock);
261 if (!--qp->refcount)
261 wake_up(&qp->wait); 262 wake_up(&qp->wait);
263 spin_unlock(&dev->qp_table.lock);
262} 264}
263 265
264static int to_mthca_state(enum ib_qp_state ib_state) 266static int to_mthca_state(enum ib_qp_state ib_state)
@@ -833,10 +835,10 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
833 * entries and reinitialize the QP. 835 * entries and reinitialize the QP.
834 */ 836 */
835 if (new_state == IB_QPS_RESET && !qp->ibqp.uobject) { 837 if (new_state == IB_QPS_RESET && !qp->ibqp.uobject) {
836 mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn, 838 mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq), qp->qpn,
837 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); 839 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL);
838 if (qp->ibqp.send_cq != qp->ibqp.recv_cq) 840 if (qp->ibqp.send_cq != qp->ibqp.recv_cq)
839 mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq)->cqn, qp->qpn, 841 mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq), qp->qpn,
840 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); 842 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL);
841 843
842 mthca_wq_init(&qp->sq); 844 mthca_wq_init(&qp->sq);
@@ -1096,7 +1098,7 @@ static int mthca_alloc_qp_common(struct mthca_dev *dev,
1096 int ret; 1098 int ret;
1097 int i; 1099 int i;
1098 1100
1099 atomic_set(&qp->refcount, 1); 1101 qp->refcount = 1;
1100 init_waitqueue_head(&qp->wait); 1102 init_waitqueue_head(&qp->wait);
1101 qp->state = IB_QPS_RESET; 1103 qp->state = IB_QPS_RESET;
1102 qp->atomic_rd_en = 0; 1104 qp->atomic_rd_en = 0;
@@ -1318,6 +1320,17 @@ int mthca_alloc_sqp(struct mthca_dev *dev,
1318 return err; 1320 return err;
1319} 1321}
1320 1322
1323static inline int get_qp_refcount(struct mthca_dev *dev, struct mthca_qp *qp)
1324{
1325 int c;
1326
1327 spin_lock_irq(&dev->qp_table.lock);
1328 c = qp->refcount;
1329 spin_unlock_irq(&dev->qp_table.lock);
1330
1331 return c;
1332}
1333
1321void mthca_free_qp(struct mthca_dev *dev, 1334void mthca_free_qp(struct mthca_dev *dev,
1322 struct mthca_qp *qp) 1335 struct mthca_qp *qp)
1323{ 1336{
@@ -1339,14 +1352,14 @@ void mthca_free_qp(struct mthca_dev *dev,
1339 spin_lock(&dev->qp_table.lock); 1352 spin_lock(&dev->qp_table.lock);
1340 mthca_array_clear(&dev->qp_table.qp, 1353 mthca_array_clear(&dev->qp_table.qp,
1341 qp->qpn & (dev->limits.num_qps - 1)); 1354 qp->qpn & (dev->limits.num_qps - 1));
1355 --qp->refcount;
1342 spin_unlock(&dev->qp_table.lock); 1356 spin_unlock(&dev->qp_table.lock);
1343 1357
1344 if (send_cq != recv_cq) 1358 if (send_cq != recv_cq)
1345 spin_unlock(&recv_cq->lock); 1359 spin_unlock(&recv_cq->lock);
1346 spin_unlock_irq(&send_cq->lock); 1360 spin_unlock_irq(&send_cq->lock);
1347 1361
1348 atomic_dec(&qp->refcount); 1362 wait_event(qp->wait, !get_qp_refcount(dev, qp));
1349 wait_event(qp->wait, !atomic_read(&qp->refcount));
1350 1363
1351 if (qp->state != IB_QPS_RESET) 1364 if (qp->state != IB_QPS_RESET)
1352 mthca_MODIFY_QP(dev, qp->state, IB_QPS_RESET, qp->qpn, 0, 1365 mthca_MODIFY_QP(dev, qp->state, IB_QPS_RESET, qp->qpn, 0,
@@ -1358,10 +1371,10 @@ void mthca_free_qp(struct mthca_dev *dev,
1358 * unref the mem-free tables and free the QPN in our table. 1371 * unref the mem-free tables and free the QPN in our table.
1359 */ 1372 */
1360 if (!qp->ibqp.uobject) { 1373 if (!qp->ibqp.uobject) {
1361 mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq)->cqn, qp->qpn, 1374 mthca_cq_clean(dev, to_mcq(qp->ibqp.send_cq), qp->qpn,
1362 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); 1375 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL);
1363 if (qp->ibqp.send_cq != qp->ibqp.recv_cq) 1376 if (qp->ibqp.send_cq != qp->ibqp.recv_cq)
1364 mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq)->cqn, qp->qpn, 1377 mthca_cq_clean(dev, to_mcq(qp->ibqp.recv_cq), qp->qpn,
1365 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL); 1378 qp->ibqp.srq ? to_msrq(qp->ibqp.srq) : NULL);
1366 1379
1367 mthca_free_memfree(dev, qp); 1380 mthca_free_memfree(dev, qp);
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index adcaf85355ae..1ea433291fa7 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -241,7 +241,7 @@ int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
241 goto err_out_mailbox; 241 goto err_out_mailbox;
242 242
243 spin_lock_init(&srq->lock); 243 spin_lock_init(&srq->lock);
244 atomic_set(&srq->refcount, 1); 244 srq->refcount = 1;
245 init_waitqueue_head(&srq->wait); 245 init_waitqueue_head(&srq->wait);
246 246
247 if (mthca_is_memfree(dev)) 247 if (mthca_is_memfree(dev))
@@ -308,6 +308,17 @@ err_out:
308 return err; 308 return err;
309} 309}
310 310
311static inline int get_srq_refcount(struct mthca_dev *dev, struct mthca_srq *srq)
312{
313 int c;
314
315 spin_lock_irq(&dev->srq_table.lock);
316 c = srq->refcount;
317 spin_unlock_irq(&dev->srq_table.lock);
318
319 return c;
320}
321
311void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq) 322void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq)
312{ 323{
313 struct mthca_mailbox *mailbox; 324 struct mthca_mailbox *mailbox;
@@ -329,10 +340,10 @@ void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq)
329 spin_lock_irq(&dev->srq_table.lock); 340 spin_lock_irq(&dev->srq_table.lock);
330 mthca_array_clear(&dev->srq_table.srq, 341 mthca_array_clear(&dev->srq_table.srq,
331 srq->srqn & (dev->limits.num_srqs - 1)); 342 srq->srqn & (dev->limits.num_srqs - 1));
343 --srq->refcount;
332 spin_unlock_irq(&dev->srq_table.lock); 344 spin_unlock_irq(&dev->srq_table.lock);
333 345
334 atomic_dec(&srq->refcount); 346 wait_event(srq->wait, !get_srq_refcount(dev, srq));
335 wait_event(srq->wait, !atomic_read(&srq->refcount));
336 347
337 if (!srq->ibsrq.uobject) { 348 if (!srq->ibsrq.uobject) {
338 mthca_free_srq_buf(dev, srq); 349 mthca_free_srq_buf(dev, srq);
@@ -414,7 +425,7 @@ void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
414 spin_lock(&dev->srq_table.lock); 425 spin_lock(&dev->srq_table.lock);
415 srq = mthca_array_get(&dev->srq_table.srq, srqn & (dev->limits.num_srqs - 1)); 426 srq = mthca_array_get(&dev->srq_table.srq, srqn & (dev->limits.num_srqs - 1));
416 if (srq) 427 if (srq)
417 atomic_inc(&srq->refcount); 428 ++srq->refcount;
418 spin_unlock(&dev->srq_table.lock); 429 spin_unlock(&dev->srq_table.lock);
419 430
420 if (!srq) { 431 if (!srq) {
@@ -431,8 +442,10 @@ void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
431 srq->ibsrq.event_handler(&event, srq->ibsrq.srq_context); 442 srq->ibsrq.event_handler(&event, srq->ibsrq.srq_context);
432 443
433out: 444out:
434 if (atomic_dec_and_test(&srq->refcount)) 445 spin_lock(&dev->srq_table.lock);
446 if (!--srq->refcount)
435 wake_up(&srq->wait); 447 wake_up(&srq->wait);
448 spin_unlock(&dev->srq_table.lock);
436} 449}
437 450
438/* 451/*
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
index 4ca175553f9f..f887780e8093 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c
@@ -158,10 +158,8 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
158 if (priv->pkey == pkey) { 158 if (priv->pkey == pkey) {
159 unregister_netdev(priv->dev); 159 unregister_netdev(priv->dev);
160 ipoib_dev_cleanup(priv->dev); 160 ipoib_dev_cleanup(priv->dev);
161
162 list_del(&priv->list); 161 list_del(&priv->list);
163 162 free_netdev(priv->dev);
164 kfree(priv);
165 163
166 ret = 0; 164 ret = 0;
167 break; 165 break;
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 5bb55742ada6..c32ce4348e1b 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -409,6 +409,34 @@ static int srp_connect_target(struct srp_target_port *target)
409 } 409 }
410} 410}
411 411
412static void srp_unmap_data(struct scsi_cmnd *scmnd,
413 struct srp_target_port *target,
414 struct srp_request *req)
415{
416 struct scatterlist *scat;
417 int nents;
418
419 if (!scmnd->request_buffer ||
420 (scmnd->sc_data_direction != DMA_TO_DEVICE &&
421 scmnd->sc_data_direction != DMA_FROM_DEVICE))
422 return;
423
424 /*
425 * This handling of non-SG commands can be killed when the
426 * SCSI midlayer no longer generates non-SG commands.
427 */
428 if (likely(scmnd->use_sg)) {
429 nents = scmnd->use_sg;
430 scat = scmnd->request_buffer;
431 } else {
432 nents = 1;
433 scat = &req->fake_sg;
434 }
435
436 dma_unmap_sg(target->srp_host->dev->dma_device, scat, nents,
437 scmnd->sc_data_direction);
438}
439
412static int srp_reconnect_target(struct srp_target_port *target) 440static int srp_reconnect_target(struct srp_target_port *target)
413{ 441{
414 struct ib_cm_id *new_cm_id; 442 struct ib_cm_id *new_cm_id;
@@ -455,16 +483,16 @@ static int srp_reconnect_target(struct srp_target_port *target)
455 list_for_each_entry(req, &target->req_queue, list) { 483 list_for_each_entry(req, &target->req_queue, list) {
456 req->scmnd->result = DID_RESET << 16; 484 req->scmnd->result = DID_RESET << 16;
457 req->scmnd->scsi_done(req->scmnd); 485 req->scmnd->scsi_done(req->scmnd);
486 srp_unmap_data(req->scmnd, target, req);
458 } 487 }
459 488
460 target->rx_head = 0; 489 target->rx_head = 0;
461 target->tx_head = 0; 490 target->tx_head = 0;
462 target->tx_tail = 0; 491 target->tx_tail = 0;
463 target->req_head = 0; 492 INIT_LIST_HEAD(&target->free_reqs);
464 for (i = 0; i < SRP_SQ_SIZE - 1; ++i)
465 target->req_ring[i].next = i + 1;
466 target->req_ring[SRP_SQ_SIZE - 1].next = -1;
467 INIT_LIST_HEAD(&target->req_queue); 493 INIT_LIST_HEAD(&target->req_queue);
494 for (i = 0; i < SRP_SQ_SIZE; ++i)
495 list_add_tail(&target->req_ring[i].list, &target->free_reqs);
468 496
469 ret = srp_connect_target(target); 497 ret = srp_connect_target(target);
470 if (ret) 498 if (ret)
@@ -589,40 +617,10 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
589 return len; 617 return len;
590} 618}
591 619
592static void srp_unmap_data(struct scsi_cmnd *scmnd, 620static void srp_remove_req(struct srp_target_port *target, struct srp_request *req)
593 struct srp_target_port *target,
594 struct srp_request *req)
595{
596 struct scatterlist *scat;
597 int nents;
598
599 if (!scmnd->request_buffer ||
600 (scmnd->sc_data_direction != DMA_TO_DEVICE &&
601 scmnd->sc_data_direction != DMA_FROM_DEVICE))
602 return;
603
604 /*
605 * This handling of non-SG commands can be killed when the
606 * SCSI midlayer no longer generates non-SG commands.
607 */
608 if (likely(scmnd->use_sg)) {
609 nents = scmnd->use_sg;
610 scat = scmnd->request_buffer;
611 } else {
612 nents = 1;
613 scat = &req->fake_sg;
614 }
615
616 dma_unmap_sg(target->srp_host->dev->dma_device, scat, nents,
617 scmnd->sc_data_direction);
618}
619
620static void srp_remove_req(struct srp_target_port *target, struct srp_request *req,
621 int index)
622{ 621{
623 list_del(&req->list); 622 srp_unmap_data(req->scmnd, target, req);
624 req->next = target->req_head; 623 list_move_tail(&req->list, &target->free_reqs);
625 target->req_head = index;
626} 624}
627 625
628static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp) 626static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
@@ -647,7 +645,7 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
647 req->tsk_status = rsp->data[3]; 645 req->tsk_status = rsp->data[3];
648 complete(&req->done); 646 complete(&req->done);
649 } else { 647 } else {
650 scmnd = req->scmnd; 648 scmnd = req->scmnd;
651 if (!scmnd) 649 if (!scmnd)
652 printk(KERN_ERR "Null scmnd for RSP w/tag %016llx\n", 650 printk(KERN_ERR "Null scmnd for RSP w/tag %016llx\n",
653 (unsigned long long) rsp->tag); 651 (unsigned long long) rsp->tag);
@@ -665,14 +663,11 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
665 else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER)) 663 else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER))
666 scmnd->resid = be32_to_cpu(rsp->data_in_res_cnt); 664 scmnd->resid = be32_to_cpu(rsp->data_in_res_cnt);
667 665
668 srp_unmap_data(scmnd, target, req);
669
670 if (!req->tsk_mgmt) { 666 if (!req->tsk_mgmt) {
671 req->scmnd = NULL;
672 scmnd->host_scribble = (void *) -1L; 667 scmnd->host_scribble = (void *) -1L;
673 scmnd->scsi_done(scmnd); 668 scmnd->scsi_done(scmnd);
674 669
675 srp_remove_req(target, req, rsp->tag & ~SRP_TAG_TSK_MGMT); 670 srp_remove_req(target, req);
676 } else 671 } else
677 req->cmd_done = 1; 672 req->cmd_done = 1;
678 } 673 }
@@ -859,7 +854,6 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
859 struct srp_request *req; 854 struct srp_request *req;
860 struct srp_iu *iu; 855 struct srp_iu *iu;
861 struct srp_cmd *cmd; 856 struct srp_cmd *cmd;
862 long req_index;
863 int len; 857 int len;
864 858
865 if (target->state == SRP_TARGET_CONNECTING) 859 if (target->state == SRP_TARGET_CONNECTING)
@@ -879,22 +873,20 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
879 dma_sync_single_for_cpu(target->srp_host->dev->dma_device, iu->dma, 873 dma_sync_single_for_cpu(target->srp_host->dev->dma_device, iu->dma,
880 SRP_MAX_IU_LEN, DMA_TO_DEVICE); 874 SRP_MAX_IU_LEN, DMA_TO_DEVICE);
881 875
882 req_index = target->req_head; 876 req = list_entry(target->free_reqs.next, struct srp_request, list);
883 877
884 scmnd->scsi_done = done; 878 scmnd->scsi_done = done;
885 scmnd->result = 0; 879 scmnd->result = 0;
886 scmnd->host_scribble = (void *) req_index; 880 scmnd->host_scribble = (void *) (long) req->index;
887 881
888 cmd = iu->buf; 882 cmd = iu->buf;
889 memset(cmd, 0, sizeof *cmd); 883 memset(cmd, 0, sizeof *cmd);
890 884
891 cmd->opcode = SRP_CMD; 885 cmd->opcode = SRP_CMD;
892 cmd->lun = cpu_to_be64((u64) scmnd->device->lun << 48); 886 cmd->lun = cpu_to_be64((u64) scmnd->device->lun << 48);
893 cmd->tag = req_index; 887 cmd->tag = req->index;
894 memcpy(cmd->cdb, scmnd->cmnd, scmnd->cmd_len); 888 memcpy(cmd->cdb, scmnd->cmnd, scmnd->cmd_len);
895 889
896 req = &target->req_ring[req_index];
897
898 req->scmnd = scmnd; 890 req->scmnd = scmnd;
899 req->cmd = iu; 891 req->cmd = iu;
900 req->cmd_done = 0; 892 req->cmd_done = 0;
@@ -919,8 +911,7 @@ static int srp_queuecommand(struct scsi_cmnd *scmnd,
919 goto err_unmap; 911 goto err_unmap;
920 } 912 }
921 913
922 target->req_head = req->next; 914 list_move_tail(&req->list, &target->req_queue);
923 list_add_tail(&req->list, &target->req_queue);
924 915
925 return 0; 916 return 0;
926 917
@@ -1143,30 +1134,20 @@ static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event)
1143 return 0; 1134 return 0;
1144} 1135}
1145 1136
1146static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func) 1137static int srp_send_tsk_mgmt(struct srp_target_port *target,
1138 struct srp_request *req, u8 func)
1147{ 1139{
1148 struct srp_target_port *target = host_to_target(scmnd->device->host);
1149 struct srp_request *req;
1150 struct srp_iu *iu; 1140 struct srp_iu *iu;
1151 struct srp_tsk_mgmt *tsk_mgmt; 1141 struct srp_tsk_mgmt *tsk_mgmt;
1152 int req_index;
1153 int ret = FAILED;
1154 1142
1155 spin_lock_irq(target->scsi_host->host_lock); 1143 spin_lock_irq(target->scsi_host->host_lock);
1156 1144
1157 if (target->state == SRP_TARGET_DEAD || 1145 if (target->state == SRP_TARGET_DEAD ||
1158 target->state == SRP_TARGET_REMOVED) { 1146 target->state == SRP_TARGET_REMOVED) {
1159 scmnd->result = DID_BAD_TARGET << 16; 1147 req->scmnd->result = DID_BAD_TARGET << 16;
1160 goto out; 1148 goto out;
1161 } 1149 }
1162 1150
1163 if (scmnd->host_scribble == (void *) -1L)
1164 goto out;
1165
1166 req_index = (long) scmnd->host_scribble;
1167 printk(KERN_ERR "Abort for req_index %d\n", req_index);
1168
1169 req = &target->req_ring[req_index];
1170 init_completion(&req->done); 1151 init_completion(&req->done);
1171 1152
1172 iu = __srp_get_tx_iu(target); 1153 iu = __srp_get_tx_iu(target);
@@ -1177,10 +1158,10 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func)
1177 memset(tsk_mgmt, 0, sizeof *tsk_mgmt); 1158 memset(tsk_mgmt, 0, sizeof *tsk_mgmt);
1178 1159
1179 tsk_mgmt->opcode = SRP_TSK_MGMT; 1160 tsk_mgmt->opcode = SRP_TSK_MGMT;
1180 tsk_mgmt->lun = cpu_to_be64((u64) scmnd->device->lun << 48); 1161 tsk_mgmt->lun = cpu_to_be64((u64) req->scmnd->device->lun << 48);
1181 tsk_mgmt->tag = req_index | SRP_TAG_TSK_MGMT; 1162 tsk_mgmt->tag = req->index | SRP_TAG_TSK_MGMT;
1182 tsk_mgmt->tsk_mgmt_func = func; 1163 tsk_mgmt->tsk_mgmt_func = func;
1183 tsk_mgmt->task_tag = req_index; 1164 tsk_mgmt->task_tag = req->index;
1184 1165
1185 if (__srp_post_send(target, iu, sizeof *tsk_mgmt)) 1166 if (__srp_post_send(target, iu, sizeof *tsk_mgmt))
1186 goto out; 1167 goto out;
@@ -1188,37 +1169,85 @@ static int srp_send_tsk_mgmt(struct scsi_cmnd *scmnd, u8 func)
1188 req->tsk_mgmt = iu; 1169 req->tsk_mgmt = iu;
1189 1170
1190 spin_unlock_irq(target->scsi_host->host_lock); 1171 spin_unlock_irq(target->scsi_host->host_lock);
1172
1191 if (!wait_for_completion_timeout(&req->done, 1173 if (!wait_for_completion_timeout(&req->done,
1192 msecs_to_jiffies(SRP_ABORT_TIMEOUT_MS))) 1174 msecs_to_jiffies(SRP_ABORT_TIMEOUT_MS)))
1193 return FAILED; 1175 return -1;
1194 spin_lock_irq(target->scsi_host->host_lock);
1195 1176
1196 if (req->cmd_done) { 1177 return 0;
1197 srp_remove_req(target, req, req_index);
1198 scmnd->scsi_done(scmnd);
1199 } else if (!req->tsk_status) {
1200 srp_remove_req(target, req, req_index);
1201 scmnd->result = DID_ABORT << 16;
1202 ret = SUCCESS;
1203 }
1204 1178
1205out: 1179out:
1206 spin_unlock_irq(target->scsi_host->host_lock); 1180 spin_unlock_irq(target->scsi_host->host_lock);
1207 return ret; 1181 return -1;
1182}
1183
1184static int srp_find_req(struct srp_target_port *target,
1185 struct scsi_cmnd *scmnd,
1186 struct srp_request **req)
1187{
1188 if (scmnd->host_scribble == (void *) -1L)
1189 return -1;
1190
1191 *req = &target->req_ring[(long) scmnd->host_scribble];
1192
1193 return 0;
1208} 1194}
1209 1195
1210static int srp_abort(struct scsi_cmnd *scmnd) 1196static int srp_abort(struct scsi_cmnd *scmnd)
1211{ 1197{
1198 struct srp_target_port *target = host_to_target(scmnd->device->host);
1199 struct srp_request *req;
1200 int ret = SUCCESS;
1201
1212 printk(KERN_ERR "SRP abort called\n"); 1202 printk(KERN_ERR "SRP abort called\n");
1213 1203
1214 return srp_send_tsk_mgmt(scmnd, SRP_TSK_ABORT_TASK); 1204 if (srp_find_req(target, scmnd, &req))
1205 return FAILED;
1206 if (srp_send_tsk_mgmt(target, req, SRP_TSK_ABORT_TASK))
1207 return FAILED;
1208
1209 spin_lock_irq(target->scsi_host->host_lock);
1210
1211 if (req->cmd_done) {
1212 srp_remove_req(target, req);
1213 scmnd->scsi_done(scmnd);
1214 } else if (!req->tsk_status) {
1215 srp_remove_req(target, req);
1216 scmnd->result = DID_ABORT << 16;
1217 } else
1218 ret = FAILED;
1219
1220 spin_unlock_irq(target->scsi_host->host_lock);
1221
1222 return ret;
1215} 1223}
1216 1224
1217static int srp_reset_device(struct scsi_cmnd *scmnd) 1225static int srp_reset_device(struct scsi_cmnd *scmnd)
1218{ 1226{
1227 struct srp_target_port *target = host_to_target(scmnd->device->host);
1228 struct srp_request *req, *tmp;
1229
1219 printk(KERN_ERR "SRP reset_device called\n"); 1230 printk(KERN_ERR "SRP reset_device called\n");
1220 1231
1221 return srp_send_tsk_mgmt(scmnd, SRP_TSK_LUN_RESET); 1232 if (srp_find_req(target, scmnd, &req))
1233 return FAILED;
1234 if (srp_send_tsk_mgmt(target, req, SRP_TSK_LUN_RESET))
1235 return FAILED;
1236 if (req->tsk_status)
1237 return FAILED;
1238
1239 spin_lock_irq(target->scsi_host->host_lock);
1240
1241 list_for_each_entry_safe(req, tmp, &target->req_queue, list)
1242 if (req->scmnd->device == scmnd->device) {
1243 req->scmnd->result = DID_RESET << 16;
1244 scmnd->scsi_done(scmnd);
1245 srp_remove_req(target, req);
1246 }
1247
1248 spin_unlock_irq(target->scsi_host->host_lock);
1249
1250 return SUCCESS;
1222} 1251}
1223 1252
1224static int srp_reset_host(struct scsi_cmnd *scmnd) 1253static int srp_reset_host(struct scsi_cmnd *scmnd)
@@ -1518,10 +1547,12 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1518 1547
1519 INIT_WORK(&target->work, srp_reconnect_work, target); 1548 INIT_WORK(&target->work, srp_reconnect_work, target);
1520 1549
1521 for (i = 0; i < SRP_SQ_SIZE - 1; ++i) 1550 INIT_LIST_HEAD(&target->free_reqs);
1522 target->req_ring[i].next = i + 1;
1523 target->req_ring[SRP_SQ_SIZE - 1].next = -1;
1524 INIT_LIST_HEAD(&target->req_queue); 1551 INIT_LIST_HEAD(&target->req_queue);
1552 for (i = 0; i < SRP_SQ_SIZE; ++i) {
1553 target->req_ring[i].index = i;
1554 list_add_tail(&target->req_ring[i].list, &target->free_reqs);
1555 }
1525 1556
1526 ret = srp_parse_options(buf, target); 1557 ret = srp_parse_options(buf, target);
1527 if (ret) 1558 if (ret)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index bd7f7c3115de..c5cd43aae860 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -101,7 +101,7 @@ struct srp_request {
101 */ 101 */
102 struct scatterlist fake_sg; 102 struct scatterlist fake_sg;
103 struct completion done; 103 struct completion done;
104 short next; 104 short index;
105 u8 cmd_done; 105 u8 cmd_done;
106 u8 tsk_status; 106 u8 tsk_status;
107}; 107};
@@ -133,7 +133,7 @@ struct srp_target_port {
133 unsigned tx_tail; 133 unsigned tx_tail;
134 struct srp_iu *tx_ring[SRP_SQ_SIZE + 1]; 134 struct srp_iu *tx_ring[SRP_SQ_SIZE + 1];
135 135
136 int req_head; 136 struct list_head free_reqs;
137 struct list_head req_queue; 137 struct list_head req_queue;
138 struct srp_request req_ring[SRP_SQ_SIZE]; 138 struct srp_request req_ring[SRP_SQ_SIZE];
139 139
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index 1042987856f7..5013703db0e6 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -17,7 +17,7 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <asm/irq.h> 20//#include <asm/irq.h>
21 21
22#include <asm/arch/sharpsl.h> 22#include <asm/arch/sharpsl.h>
23#include <asm/arch/hardware.h> 23#include <asm/arch/hardware.h>
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 9b493f0becc4..173c899a1fb4 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1499,7 +1499,6 @@ static int __init capi_init(void)
1499 printk(KERN_ERR "capi20: unable to get major %d\n", capi_major); 1499 printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);
1500 return major_ret; 1500 return major_ret;
1501 } 1501 }
1502 capi_major = major_ret;
1503 capi_class = class_create(THIS_MODULE, "capi"); 1502 capi_class = class_create(THIS_MODULE, "capi");
1504 if (IS_ERR(capi_class)) { 1503 if (IS_ERR(capi_class)) {
1505 unregister_chrdev(capi_major, "capi20"); 1504 unregister_chrdev(capi_major, "capi20");
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index bfb73fd5077e..d86ab68114b0 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -710,8 +710,8 @@ static int gigaset_probe(struct usb_interface *interface,
710 retval = -ENODEV; //FIXME 710 retval = -ENODEV; //FIXME
711 711
712 /* See if the device offered us matches what we can accept */ 712 /* See if the device offered us matches what we can accept */
713 if ((le16_to_cpu(udev->descriptor.idVendor != USB_M105_VENDOR_ID)) || 713 if ((le16_to_cpu(udev->descriptor.idVendor) != USB_M105_VENDOR_ID) ||
714 (le16_to_cpu(udev->descriptor.idProduct != USB_M105_PRODUCT_ID))) 714 (le16_to_cpu(udev->descriptor.idProduct) != USB_M105_PRODUCT_ID))
715 return -ENODEV; 715 return -ENODEV;
716 716
717 /* this starts to become ascii art... */ 717 /* this starts to become ascii art... */
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 3f5b64794542..626506234b76 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -4,8 +4,11 @@ menu "LED devices"
4config NEW_LEDS 4config NEW_LEDS
5 bool "LED Support" 5 bool "LED Support"
6 help 6 help
7 Say Y to enable Linux LED support. This is not related to standard 7 Say Y to enable Linux LED support. This allows control of supported
8 keyboard LEDs which are controlled via the input system. 8 LEDs from both userspace and optionally, by kernel events (triggers).
9
10 This is not related to standard keyboard LEDs which are controlled
11 via the input system.
9 12
10config LEDS_CLASS 13config LEDS_CLASS
11 tristate "LED Class Support" 14 tristate "LED Class Support"
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index b0b5d05fadd6..c75d0ef1609c 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -19,6 +19,7 @@
19#include <linux/sysdev.h> 19#include <linux/sysdev.h>
20#include <linux/timer.h> 20#include <linux/timer.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/ctype.h>
22#include <linux/leds.h> 23#include <linux/leds.h>
23#include "leds.h" 24#include "leds.h"
24 25
@@ -43,9 +44,13 @@ static ssize_t led_brightness_store(struct class_device *dev,
43 ssize_t ret = -EINVAL; 44 ssize_t ret = -EINVAL;
44 char *after; 45 char *after;
45 unsigned long state = simple_strtoul(buf, &after, 10); 46 unsigned long state = simple_strtoul(buf, &after, 10);
47 size_t count = after - buf;
46 48
47 if (after - buf > 0) { 49 if (*after && isspace(*after))
48 ret = after - buf; 50 count++;
51
52 if (count == size) {
53 ret = count;
49 led_set_brightness(led_cdev, state); 54 led_set_brightness(led_cdev, state);
50 } 55 }
51 56
diff --git a/drivers/leds/ledtrig-timer.c b/drivers/leds/ledtrig-timer.c
index f484b5d6dbf8..fbf141ef46ec 100644
--- a/drivers/leds/ledtrig-timer.c
+++ b/drivers/leds/ledtrig-timer.c
@@ -20,6 +20,7 @@
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/sysdev.h> 21#include <linux/sysdev.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/ctype.h>
23#include <linux/leds.h> 24#include <linux/leds.h>
24#include "leds.h" 25#include "leds.h"
25 26
@@ -69,11 +70,15 @@ static ssize_t led_delay_on_store(struct class_device *dev, const char *buf,
69 int ret = -EINVAL; 70 int ret = -EINVAL;
70 char *after; 71 char *after;
71 unsigned long state = simple_strtoul(buf, &after, 10); 72 unsigned long state = simple_strtoul(buf, &after, 10);
73 size_t count = after - buf;
72 74
73 if (after - buf > 0) { 75 if (*after && isspace(*after))
76 count++;
77
78 if (count == size) {
74 timer_data->delay_on = state; 79 timer_data->delay_on = state;
75 mod_timer(&timer_data->timer, jiffies + 1); 80 mod_timer(&timer_data->timer, jiffies + 1);
76 ret = after - buf; 81 ret = count;
77 } 82 }
78 83
79 return ret; 84 return ret;
@@ -97,11 +102,15 @@ static ssize_t led_delay_off_store(struct class_device *dev, const char *buf,
97 int ret = -EINVAL; 102 int ret = -EINVAL;
98 char *after; 103 char *after;
99 unsigned long state = simple_strtoul(buf, &after, 10); 104 unsigned long state = simple_strtoul(buf, &after, 10);
105 size_t count = after - buf;
106
107 if (*after && isspace(*after))
108 count++;
100 109
101 if (after - buf > 0) { 110 if (count == size) {
102 timer_data->delay_off = state; 111 timer_data->delay_off = state;
103 mod_timer(&timer_data->timer, jiffies + 1); 112 mod_timer(&timer_data->timer, jiffies + 1);
104 ret = after - buf; 113 ret = count;
105 } 114 }
106 115
107 return ret; 116 return ret;
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 266414ca2814..9080853fe283 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1189,7 +1189,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1189 ioc->diagPending = 0; 1189 ioc->diagPending = 0;
1190 spin_lock_init(&ioc->diagLock); 1190 spin_lock_init(&ioc->diagLock);
1191 spin_lock_init(&ioc->fc_rescan_work_lock); 1191 spin_lock_init(&ioc->fc_rescan_work_lock);
1192 spin_lock_init(&ioc->fc_rport_lock);
1193 spin_lock_init(&ioc->initializing_hba_lock); 1192 spin_lock_init(&ioc->initializing_hba_lock);
1194 1193
1195 /* Initialize the event logging. 1194 /* Initialize the event logging.
@@ -5736,11 +5735,13 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
5736 return rc; 5735 return rc;
5737} 5736}
5738 5737
5738# define EVENT_DESCR_STR_SZ 100
5739
5739/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5740/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
5740static void 5741static void
5741EventDescriptionStr(u8 event, u32 evData0, char *evStr) 5742EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5742{ 5743{
5743 char *ds; 5744 char *ds = NULL;
5744 5745
5745 switch(event) { 5746 switch(event) {
5746 case MPI_EVENT_NONE: 5747 case MPI_EVENT_NONE:
@@ -5777,9 +5778,9 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5777 if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP) 5778 if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LIP)
5778 ds = "Loop State(LIP) Change"; 5779 ds = "Loop State(LIP) Change";
5779 else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE) 5780 else if (evData0 == MPI_EVENT_LOOP_STATE_CHANGE_LPE)
5780 ds = "Loop State(LPE) Change"; /* ??? */ 5781 ds = "Loop State(LPE) Change"; /* ??? */
5781 else 5782 else
5782 ds = "Loop State(LPB) Change"; /* ??? */ 5783 ds = "Loop State(LPB) Change"; /* ??? */
5783 break; 5784 break;
5784 case MPI_EVENT_LOGOUT: 5785 case MPI_EVENT_LOGOUT:
5785 ds = "Logout"; 5786 ds = "Logout";
@@ -5841,27 +5842,32 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5841 break; 5842 break;
5842 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: 5843 case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE:
5843 { 5844 {
5844 char buf[50];
5845 u8 id = (u8)(evData0); 5845 u8 id = (u8)(evData0);
5846 u8 ReasonCode = (u8)(evData0 >> 16); 5846 u8 ReasonCode = (u8)(evData0 >> 16);
5847 switch (ReasonCode) { 5847 switch (ReasonCode) {
5848 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED: 5848 case MPI_EVENT_SAS_DEV_STAT_RC_ADDED:
5849 sprintf(buf,"SAS Device Status Change: Added: id=%d", id); 5849 snprintf(evStr, EVENT_DESCR_STR_SZ,
5850 "SAS Device Status Change: Added: id=%d", id);
5850 break; 5851 break;
5851 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING: 5852 case MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING:
5852 sprintf(buf,"SAS Device Status Change: Deleted: id=%d", id); 5853 snprintf(evStr, EVENT_DESCR_STR_SZ,
5854 "SAS Device Status Change: Deleted: id=%d", id);
5853 break; 5855 break;
5854 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA: 5856 case MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA:
5855 sprintf(buf,"SAS Device Status Change: SMART Data: id=%d", id); 5857 snprintf(evStr, EVENT_DESCR_STR_SZ,
5858 "SAS Device Status Change: SMART Data: id=%d",
5859 id);
5856 break; 5860 break;
5857 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED: 5861 case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
5858 sprintf(buf,"SAS Device Status Change: No Persistancy Added: id=%d", id); 5862 snprintf(evStr, EVENT_DESCR_STR_SZ,
5863 "SAS Device Status Change: No Persistancy "
5864 "Added: id=%d", id);
5859 break; 5865 break;
5860 default: 5866 default:
5861 sprintf(buf,"SAS Device Status Change: Unknown: id=%d", id); 5867 snprintf(evStr, EVENT_DESCR_STR_SZ,
5862 break; 5868 "SAS Device Status Change: Unknown: id=%d", id);
5869 break;
5863 } 5870 }
5864 ds = buf;
5865 break; 5871 break;
5866 } 5872 }
5867 case MPI_EVENT_ON_BUS_TIMER_EXPIRED: 5873 case MPI_EVENT_ON_BUS_TIMER_EXPIRED:
@@ -5878,41 +5884,46 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5878 break; 5884 break;
5879 case MPI_EVENT_SAS_PHY_LINK_STATUS: 5885 case MPI_EVENT_SAS_PHY_LINK_STATUS:
5880 { 5886 {
5881 char buf[50];
5882 u8 LinkRates = (u8)(evData0 >> 8); 5887 u8 LinkRates = (u8)(evData0 >> 8);
5883 u8 PhyNumber = (u8)(evData0); 5888 u8 PhyNumber = (u8)(evData0);
5884 LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >> 5889 LinkRates = (LinkRates & MPI_EVENT_SAS_PLS_LR_CURRENT_MASK) >>
5885 MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT; 5890 MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT;
5886 switch (LinkRates) { 5891 switch (LinkRates) {
5887 case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN: 5892 case MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN:
5888 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5893 snprintf(evStr, EVENT_DESCR_STR_SZ,
5894 "SAS PHY Link Status: Phy=%d:"
5889 " Rate Unknown",PhyNumber); 5895 " Rate Unknown",PhyNumber);
5890 break; 5896 break;
5891 case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED: 5897 case MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED:
5892 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5898 snprintf(evStr, EVENT_DESCR_STR_SZ,
5899 "SAS PHY Link Status: Phy=%d:"
5893 " Phy Disabled",PhyNumber); 5900 " Phy Disabled",PhyNumber);
5894 break; 5901 break;
5895 case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION: 5902 case MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION:
5896 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5903 snprintf(evStr, EVENT_DESCR_STR_SZ,
5904 "SAS PHY Link Status: Phy=%d:"
5897 " Failed Speed Nego",PhyNumber); 5905 " Failed Speed Nego",PhyNumber);
5898 break; 5906 break;
5899 case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE: 5907 case MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE:
5900 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5908 snprintf(evStr, EVENT_DESCR_STR_SZ,
5909 "SAS PHY Link Status: Phy=%d:"
5901 " Sata OOB Completed",PhyNumber); 5910 " Sata OOB Completed",PhyNumber);
5902 break; 5911 break;
5903 case MPI_EVENT_SAS_PLS_LR_RATE_1_5: 5912 case MPI_EVENT_SAS_PLS_LR_RATE_1_5:
5904 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5913 snprintf(evStr, EVENT_DESCR_STR_SZ,
5914 "SAS PHY Link Status: Phy=%d:"
5905 " Rate 1.5 Gbps",PhyNumber); 5915 " Rate 1.5 Gbps",PhyNumber);
5906 break; 5916 break;
5907 case MPI_EVENT_SAS_PLS_LR_RATE_3_0: 5917 case MPI_EVENT_SAS_PLS_LR_RATE_3_0:
5908 sprintf(buf,"SAS PHY Link Status: Phy=%d:" 5918 snprintf(evStr, EVENT_DESCR_STR_SZ,
5919 "SAS PHY Link Status: Phy=%d:"
5909 " Rate 3.0 Gpbs",PhyNumber); 5920 " Rate 3.0 Gpbs",PhyNumber);
5910 break; 5921 break;
5911 default: 5922 default:
5912 sprintf(buf,"SAS PHY Link Status: Phy=%d", PhyNumber); 5923 snprintf(evStr, EVENT_DESCR_STR_SZ,
5924 "SAS PHY Link Status: Phy=%d", PhyNumber);
5913 break; 5925 break;
5914 } 5926 }
5915 ds = buf;
5916 break; 5927 break;
5917 } 5928 }
5918 case MPI_EVENT_SAS_DISCOVERY_ERROR: 5929 case MPI_EVENT_SAS_DISCOVERY_ERROR:
@@ -5921,9 +5932,8 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5921 case MPI_EVENT_IR_RESYNC_UPDATE: 5932 case MPI_EVENT_IR_RESYNC_UPDATE:
5922 { 5933 {
5923 u8 resync_complete = (u8)(evData0 >> 16); 5934 u8 resync_complete = (u8)(evData0 >> 16);
5924 char buf[40]; 5935 snprintf(evStr, EVENT_DESCR_STR_SZ,
5925 sprintf(buf,"IR Resync Update: Complete = %d:",resync_complete); 5936 "IR Resync Update: Complete = %d:",resync_complete);
5926 ds = buf;
5927 break; 5937 break;
5928 } 5938 }
5929 case MPI_EVENT_IR2: 5939 case MPI_EVENT_IR2:
@@ -5976,7 +5986,8 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
5976 ds = "Unknown"; 5986 ds = "Unknown";
5977 break; 5987 break;
5978 } 5988 }
5979 strcpy(evStr,ds); 5989 if (ds)
5990 strncpy(evStr, ds, EVENT_DESCR_STR_SZ);
5980} 5991}
5981 5992
5982/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 5993/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -5998,7 +6009,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
5998 int ii; 6009 int ii;
5999 int r = 0; 6010 int r = 0;
6000 int handlers = 0; 6011 int handlers = 0;
6001 char evStr[100]; 6012 char evStr[EVENT_DESCR_STR_SZ];
6002 u8 event; 6013 u8 event;
6003 6014
6004 /* 6015 /*
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index be7e8501b53c..f673cca507e1 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -76,8 +76,8 @@
76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR 76#define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR
77#endif 77#endif
78 78
79#define MPT_LINUX_VERSION_COMMON "3.03.08" 79#define MPT_LINUX_VERSION_COMMON "3.03.09"
80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.08" 80#define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.09"
81#define WHAT_MAGIC_STRING "@" "(" "#" ")" 81#define WHAT_MAGIC_STRING "@" "(" "#" ")"
82 82
83#define show_mptmod_ver(s,ver) \ 83#define show_mptmod_ver(s,ver) \
@@ -489,7 +489,6 @@ typedef struct _RaidCfgData {
489 489
490#define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */ 490#define MPT_RPORT_INFO_FLAGS_REGISTERED 0x01 /* rport registered */
491#define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */ 491#define MPT_RPORT_INFO_FLAGS_MISSING 0x02 /* missing from DevPage0 scan */
492#define MPT_RPORT_INFO_FLAGS_MAPPED_VDEV 0x04 /* target mapped in vdev */
493 492
494/* 493/*
495 * data allocated for each fc rport device 494 * data allocated for each fc rport device
@@ -501,7 +500,6 @@ struct mptfc_rport_info
501 struct scsi_target *starget; 500 struct scsi_target *starget;
502 FCDevicePage0_t pg0; 501 FCDevicePage0_t pg0;
503 u8 flags; 502 u8 flags;
504 u8 remap_needed;
505}; 503};
506 504
507/* 505/*
@@ -628,11 +626,11 @@ typedef struct _MPT_ADAPTER
628 struct work_struct mptscsih_persistTask; 626 struct work_struct mptscsih_persistTask;
629 627
630 struct list_head fc_rports; 628 struct list_head fc_rports;
631 spinlock_t fc_rport_lock; /* list and ri flags */
632 spinlock_t fc_rescan_work_lock; 629 spinlock_t fc_rescan_work_lock;
633 int fc_rescan_work_count; 630 int fc_rescan_work_count;
634 struct work_struct fc_rescan_work; 631 struct work_struct fc_rescan_work;
635 632 char fc_rescan_work_q_name[KOBJ_NAME_LEN];
633 struct workqueue_struct *fc_rescan_work_q;
636} MPT_ADAPTER; 634} MPT_ADAPTER;
637 635
638/* 636/*
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index b343f2a68b1c..856487741ef4 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -341,9 +341,6 @@ mptfc_generate_rport_ids(FCDevicePage0_t *pg0, struct fc_rport_identifiers *rid)
341 rid->port_name = ((u64)pg0->WWPN.High) << 32 | (u64)pg0->WWPN.Low; 341 rid->port_name = ((u64)pg0->WWPN.High) << 32 | (u64)pg0->WWPN.Low;
342 rid->port_id = pg0->PortIdentifier; 342 rid->port_id = pg0->PortIdentifier;
343 rid->roles = FC_RPORT_ROLE_UNKNOWN; 343 rid->roles = FC_RPORT_ROLE_UNKNOWN;
344 rid->roles |= FC_RPORT_ROLE_FCP_TARGET;
345 if (pg0->Protocol & MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR)
346 rid->roles |= FC_RPORT_ROLE_FCP_INITIATOR;
347 344
348 return 0; 345 return 0;
349} 346}
@@ -355,15 +352,18 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
355 struct fc_rport *rport; 352 struct fc_rport *rport;
356 struct mptfc_rport_info *ri; 353 struct mptfc_rport_info *ri;
357 int new_ri = 1; 354 int new_ri = 1;
358 u64 pn; 355 u64 pn, nn;
359 unsigned long flags;
360 VirtTarget *vtarget; 356 VirtTarget *vtarget;
357 u32 roles = FC_RPORT_ROLE_UNKNOWN;
361 358
362 if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) 359 if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0)
363 return; 360 return;
364 361
362 roles |= FC_RPORT_ROLE_FCP_TARGET;
363 if (pg0->Protocol & MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR)
364 roles |= FC_RPORT_ROLE_FCP_INITIATOR;
365
365 /* scan list looking for a match */ 366 /* scan list looking for a match */
366 spin_lock_irqsave(&ioc->fc_rport_lock, flags);
367 list_for_each_entry(ri, &ioc->fc_rports, list) { 367 list_for_each_entry(ri, &ioc->fc_rports, list) {
368 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; 368 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
369 if (pn == rport_ids.port_name) { /* match */ 369 if (pn == rport_ids.port_name) { /* match */
@@ -373,11 +373,9 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
373 } 373 }
374 } 374 }
375 if (new_ri) { /* allocate one */ 375 if (new_ri) { /* allocate one */
376 spin_unlock_irqrestore(&ioc->fc_rport_lock, flags);
377 ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); 376 ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL);
378 if (!ri) 377 if (!ri)
379 return; 378 return;
380 spin_lock_irqsave(&ioc->fc_rport_lock, flags);
381 list_add_tail(&ri->list, &ioc->fc_rports); 379 list_add_tail(&ri->list, &ioc->fc_rports);
382 } 380 }
383 381
@@ -387,14 +385,11 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
387 /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */ 385 /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */
388 if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { 386 if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) {
389 ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; 387 ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED;
390 spin_unlock_irqrestore(&ioc->fc_rport_lock, flags);
391 rport = fc_remote_port_add(ioc->sh, channel, &rport_ids); 388 rport = fc_remote_port_add(ioc->sh, channel, &rport_ids);
392 spin_lock_irqsave(&ioc->fc_rport_lock, flags);
393 if (rport) { 389 if (rport) {
394 ri->rport = rport; 390 ri->rport = rport;
395 if (new_ri) /* may have been reset by user */ 391 if (new_ri) /* may have been reset by user */
396 rport->dev_loss_tmo = mptfc_dev_loss_tmo; 392 rport->dev_loss_tmo = mptfc_dev_loss_tmo;
397 *((struct mptfc_rport_info **)rport->dd_data) = ri;
398 /* 393 /*
399 * if already mapped, remap here. If not mapped, 394 * if already mapped, remap here. If not mapped,
400 * target_alloc will allocate vtarget and map, 395 * target_alloc will allocate vtarget and map,
@@ -406,16 +401,21 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
406 vtarget->target_id = pg0->CurrentTargetID; 401 vtarget->target_id = pg0->CurrentTargetID;
407 vtarget->bus_id = pg0->CurrentBus; 402 vtarget->bus_id = pg0->CurrentBus;
408 } 403 }
409 ri->remap_needed = 0;
410 } 404 }
405 *((struct mptfc_rport_info **)rport->dd_data) = ri;
406 /* scan will be scheduled once rport becomes a target */
407 fc_remote_port_rolechg(rport,roles);
408
409 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
410 nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
411 dfcprintk ((MYIOC_s_INFO_FMT 411 dfcprintk ((MYIOC_s_INFO_FMT
412 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " 412 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, "
413 "rport tid %d, tmo %d\n", 413 "rport tid %d, tmo %d\n",
414 ioc->name, 414 ioc->name,
415 ioc->sh->host_no, 415 ioc->sh->host_no,
416 pg0->PortIdentifier, 416 pg0->PortIdentifier,
417 pg0->WWNN, 417 (unsigned long long)nn,
418 pg0->WWPN, 418 (unsigned long long)pn,
419 pg0->CurrentTargetID, 419 pg0->CurrentTargetID,
420 ri->rport->scsi_target_id, 420 ri->rport->scsi_target_id,
421 ri->rport->dev_loss_tmo)); 421 ri->rport->dev_loss_tmo));
@@ -425,8 +425,6 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
425 ri = NULL; 425 ri = NULL;
426 } 426 }
427 } 427 }
428 spin_unlock_irqrestore(&ioc->fc_rport_lock,flags);
429
430} 428}
431 429
432/* 430/*
@@ -476,7 +474,6 @@ mptfc_target_alloc(struct scsi_target *starget)
476 vtarget->target_id = ri->pg0.CurrentTargetID; 474 vtarget->target_id = ri->pg0.CurrentTargetID;
477 vtarget->bus_id = ri->pg0.CurrentBus; 475 vtarget->bus_id = ri->pg0.CurrentBus;
478 ri->starget = starget; 476 ri->starget = starget;
479 ri->remap_needed = 0;
480 rc = 0; 477 rc = 0;
481 } 478 }
482 } 479 }
@@ -502,10 +499,10 @@ mptfc_slave_alloc(struct scsi_device *sdev)
502 VirtDevice *vdev; 499 VirtDevice *vdev;
503 struct scsi_target *starget; 500 struct scsi_target *starget;
504 struct fc_rport *rport; 501 struct fc_rport *rport;
505 unsigned long flags;
506 502
507 503
508 rport = starget_to_rport(scsi_target(sdev)); 504 starget = scsi_target(sdev);
505 rport = starget_to_rport(starget);
509 506
510 if (!rport || fc_remote_port_chkready(rport)) 507 if (!rport || fc_remote_port_chkready(rport))
511 return -ENXIO; 508 return -ENXIO;
@@ -519,10 +516,8 @@ mptfc_slave_alloc(struct scsi_device *sdev)
519 return -ENOMEM; 516 return -ENOMEM;
520 } 517 }
521 518
522 spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags);
523 519
524 sdev->hostdata = vdev; 520 sdev->hostdata = vdev;
525 starget = scsi_target(sdev);
526 vtarget = starget->hostdata; 521 vtarget = starget->hostdata;
527 522
528 if (vtarget->num_luns == 0) { 523 if (vtarget->num_luns == 0) {
@@ -535,14 +530,16 @@ mptfc_slave_alloc(struct scsi_device *sdev)
535 vdev->vtarget = vtarget; 530 vdev->vtarget = vtarget;
536 vdev->lun = sdev->lun; 531 vdev->lun = sdev->lun;
537 532
538 spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags);
539
540 vtarget->num_luns++; 533 vtarget->num_luns++;
541 534
535
542#ifdef DMPT_DEBUG_FC 536#ifdef DMPT_DEBUG_FC
543 { 537 {
538 u64 nn, pn;
544 struct mptfc_rport_info *ri; 539 struct mptfc_rport_info *ri;
545 ri = *((struct mptfc_rport_info **)rport->dd_data); 540 ri = *((struct mptfc_rport_info **)rport->dd_data);
541 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
542 nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
546 dfcprintk ((MYIOC_s_INFO_FMT 543 dfcprintk ((MYIOC_s_INFO_FMT
547 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " 544 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
548 "CurrentTargetID %d, %x %llx %llx\n", 545 "CurrentTargetID %d, %x %llx %llx\n",
@@ -550,7 +547,9 @@ mptfc_slave_alloc(struct scsi_device *sdev)
550 sdev->host->host_no, 547 sdev->host->host_no,
551 vtarget->num_luns, 548 vtarget->num_luns,
552 sdev->id, ri->pg0.CurrentTargetID, 549 sdev->id, ri->pg0.CurrentTargetID,
553 ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN)); 550 ri->pg0.PortIdentifier,
551 (unsigned long long)pn,
552 (unsigned long long)nn));
554 } 553 }
555#endif 554#endif
556 555
@@ -570,11 +569,31 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
570 done(SCpnt); 569 done(SCpnt);
571 return 0; 570 return 0;
572 } 571 }
572
573 /* dd_data is null until finished adding target */
573 ri = *((struct mptfc_rport_info **)rport->dd_data); 574 ri = *((struct mptfc_rport_info **)rport->dd_data);
574 if (unlikely(ri->remap_needed)) 575 if (unlikely(!ri)) {
575 return SCSI_MLQUEUE_HOST_BUSY; 576 dfcprintk ((MYIOC_s_INFO_FMT
577 "mptfc_qcmd.%d: %d:%d, dd_data is null.\n",
578 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
579 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
580 SCpnt->device->id,SCpnt->device->lun));
581 SCpnt->result = DID_IMM_RETRY << 16;
582 done(SCpnt);
583 return 0;
584 }
576 585
577 return mptscsih_qcmd(SCpnt,done); 586 err = mptscsih_qcmd(SCpnt,done);
587#ifdef DMPT_DEBUG_FC
588 if (unlikely(err)) {
589 dfcprintk ((MYIOC_s_INFO_FMT
590 "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero.\n",
591 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
592 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
593 SCpnt->device->id,SCpnt->device->lun));
594 }
595#endif
596 return err;
578} 597}
579 598
580static void 599static void
@@ -615,18 +634,17 @@ mptfc_rescan_devices(void *arg)
615 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; 634 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
616 int ii; 635 int ii;
617 int work_to_do; 636 int work_to_do;
637 u64 pn;
618 unsigned long flags; 638 unsigned long flags;
619 struct mptfc_rport_info *ri; 639 struct mptfc_rport_info *ri;
620 640
621 do { 641 do {
622 /* start by tagging all ports as missing */ 642 /* start by tagging all ports as missing */
623 spin_lock_irqsave(&ioc->fc_rport_lock,flags);
624 list_for_each_entry(ri, &ioc->fc_rports, list) { 643 list_for_each_entry(ri, &ioc->fc_rports, list) {
625 if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) { 644 if (ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED) {
626 ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING; 645 ri->flags |= MPT_RPORT_INFO_FLAGS_MISSING;
627 } 646 }
628 } 647 }
629 spin_unlock_irqrestore(&ioc->fc_rport_lock,flags);
630 648
631 /* 649 /*
632 * now rescan devices known to adapter, 650 * now rescan devices known to adapter,
@@ -639,33 +657,24 @@ mptfc_rescan_devices(void *arg)
639 } 657 }
640 658
641 /* delete devices still missing */ 659 /* delete devices still missing */
642 spin_lock_irqsave(&ioc->fc_rport_lock, flags);
643 list_for_each_entry(ri, &ioc->fc_rports, list) { 660 list_for_each_entry(ri, &ioc->fc_rports, list) {
644 /* if newly missing, delete it */ 661 /* if newly missing, delete it */
645 if ((ri->flags & (MPT_RPORT_INFO_FLAGS_REGISTERED | 662 if (ri->flags & MPT_RPORT_INFO_FLAGS_MISSING) {
646 MPT_RPORT_INFO_FLAGS_MISSING))
647 == (MPT_RPORT_INFO_FLAGS_REGISTERED |
648 MPT_RPORT_INFO_FLAGS_MISSING)) {
649 663
650 ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| 664 ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED|
651 MPT_RPORT_INFO_FLAGS_MISSING); 665 MPT_RPORT_INFO_FLAGS_MISSING);
652 ri->remap_needed = 1; 666 fc_remote_port_delete(ri->rport); /* won't sleep */
653 fc_remote_port_delete(ri->rport);
654 /*
655 * remote port not really deleted 'cause
656 * binding is by WWPN and driver only
657 * registers FCP_TARGETs but cannot trust
658 * data structures.
659 */
660 ri->rport = NULL; 667 ri->rport = NULL;
668
669 pn = (u64)ri->pg0.WWPN.High << 32 |
670 (u64)ri->pg0.WWPN.Low;
661 dfcprintk ((MYIOC_s_INFO_FMT 671 dfcprintk ((MYIOC_s_INFO_FMT
662 "mptfc_rescan.%d: %llx deleted\n", 672 "mptfc_rescan.%d: %llx deleted\n",
663 ioc->name, 673 ioc->name,
664 ioc->sh->host_no, 674 ioc->sh->host_no,
665 ri->pg0.WWPN)); 675 (unsigned long long)pn));
666 } 676 }
667 } 677 }
668 spin_unlock_irqrestore(&ioc->fc_rport_lock,flags);
669 678
670 /* 679 /*
671 * allow multiple passes as target state 680 * allow multiple passes as target state
@@ -870,10 +879,23 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
870 goto out_mptfc_probe; 879 goto out_mptfc_probe;
871 } 880 }
872 881
873 for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { 882 /* initialize workqueue */
874 mptfc_init_host_attr(ioc,ii); 883
875 mptfc_GetFcDevPage0(ioc,ii,mptfc_register_dev); 884 snprintf(ioc->fc_rescan_work_q_name, KOBJ_NAME_LEN, "mptfc_wq_%d",
876 } 885 sh->host_no);
886 ioc->fc_rescan_work_q =
887 create_singlethread_workqueue(ioc->fc_rescan_work_q_name);
888 if (!ioc->fc_rescan_work_q)
889 goto out_mptfc_probe;
890
891 /*
892 * scan for rports -
893 * by doing it via the workqueue, some locking is eliminated
894 */
895
896 ioc->fc_rescan_work_count = 1;
897 queue_work(ioc->fc_rescan_work_q, &ioc->fc_rescan_work);
898 flush_workqueue(ioc->fc_rescan_work_q);
877 899
878 return 0; 900 return 0;
879 901
@@ -949,8 +971,18 @@ mptfc_init(void)
949static void __devexit 971static void __devexit
950mptfc_remove(struct pci_dev *pdev) 972mptfc_remove(struct pci_dev *pdev)
951{ 973{
952 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); 974 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
953 struct mptfc_rport_info *p, *n; 975 struct mptfc_rport_info *p, *n;
976 struct workqueue_struct *work_q;
977 unsigned long flags;
978
979 /* destroy workqueue */
980 if ((work_q=ioc->fc_rescan_work_q)) {
981 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
982 ioc->fc_rescan_work_q = NULL;
983 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
984 destroy_workqueue(work_q);
985 }
954 986
955 fc_remove_host(ioc->sh); 987 fc_remove_host(ioc->sh);
956 988
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index e9716b10acea..af6ec553ff7c 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -91,6 +91,7 @@ enum mptsas_hotplug_action {
91 MPTSAS_DEL_DEVICE, 91 MPTSAS_DEL_DEVICE,
92 MPTSAS_ADD_RAID, 92 MPTSAS_ADD_RAID,
93 MPTSAS_DEL_RAID, 93 MPTSAS_DEL_RAID,
94 MPTSAS_IGNORE_EVENT,
94}; 95};
95 96
96struct mptsas_hotplug_event { 97struct mptsas_hotplug_event {
@@ -298,6 +299,26 @@ mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle)
298 return rc; 299 return rc;
299} 300}
300 301
302/*
303 * Returns true if there is a scsi end device
304 */
305static inline int
306mptsas_is_end_device(struct mptsas_devinfo * attached)
307{
308 if ((attached->handle) &&
309 (attached->device_info &
310 MPI_SAS_DEVICE_INFO_END_DEVICE) &&
311 ((attached->device_info &
312 MPI_SAS_DEVICE_INFO_SSP_TARGET) |
313 (attached->device_info &
314 MPI_SAS_DEVICE_INFO_STP_TARGET) |
315 (attached->device_info &
316 MPI_SAS_DEVICE_INFO_SATA_DEVICE)))
317 return 1;
318 else
319 return 0;
320}
321
301static int 322static int
302mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, 323mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
303 u32 form, u32 form_specific) 324 u32 form, u32 form_specific)
@@ -872,7 +893,11 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
872 SasDevicePage0_t *buffer; 893 SasDevicePage0_t *buffer;
873 dma_addr_t dma_handle; 894 dma_addr_t dma_handle;
874 __le64 sas_address; 895 __le64 sas_address;
875 int error; 896 int error=0;
897
898 if (ioc->sas_discovery_runtime &&
899 mptsas_is_end_device(device_info))
900 goto out;
876 901
877 hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION; 902 hdr.PageVersion = MPI_SASDEVICE0_PAGEVERSION;
878 hdr.ExtPageLength = 0; 903 hdr.ExtPageLength = 0;
@@ -1009,7 +1034,11 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
1009 CONFIGPARMS cfg; 1034 CONFIGPARMS cfg;
1010 SasExpanderPage1_t *buffer; 1035 SasExpanderPage1_t *buffer;
1011 dma_addr_t dma_handle; 1036 dma_addr_t dma_handle;
1012 int error; 1037 int error=0;
1038
1039 if (ioc->sas_discovery_runtime &&
1040 mptsas_is_end_device(&phy_info->attached))
1041 goto out;
1013 1042
1014 hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION; 1043 hdr.PageVersion = MPI_SASEXPANDER0_PAGEVERSION;
1015 hdr.ExtPageLength = 0; 1044 hdr.ExtPageLength = 0;
@@ -1068,26 +1097,6 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
1068 return error; 1097 return error;
1069} 1098}
1070 1099
1071/*
1072 * Returns true if there is a scsi end device
1073 */
1074static inline int
1075mptsas_is_end_device(struct mptsas_devinfo * attached)
1076{
1077 if ((attached->handle) &&
1078 (attached->device_info &
1079 MPI_SAS_DEVICE_INFO_END_DEVICE) &&
1080 ((attached->device_info &
1081 MPI_SAS_DEVICE_INFO_SSP_TARGET) |
1082 (attached->device_info &
1083 MPI_SAS_DEVICE_INFO_STP_TARGET) |
1084 (attached->device_info &
1085 MPI_SAS_DEVICE_INFO_SATA_DEVICE)))
1086 return 1;
1087 else
1088 return 0;
1089}
1090
1091static void 1100static void
1092mptsas_parse_device_info(struct sas_identify *identify, 1101mptsas_parse_device_info(struct sas_identify *identify,
1093 struct mptsas_devinfo *device_info) 1102 struct mptsas_devinfo *device_info)
@@ -1737,6 +1746,9 @@ mptsas_hotplug_work(void *arg)
1737 break; 1746 break;
1738 case MPTSAS_ADD_DEVICE: 1747 case MPTSAS_ADD_DEVICE:
1739 1748
1749 if (ev->phys_disk_num_valid)
1750 mpt_findImVolumes(ioc);
1751
1740 /* 1752 /*
1741 * Refresh sas device pg0 data 1753 * Refresh sas device pg0 data
1742 */ 1754 */
@@ -1868,6 +1880,9 @@ mptsas_hotplug_work(void *arg)
1868 scsi_device_put(sdev); 1880 scsi_device_put(sdev);
1869 mpt_findImVolumes(ioc); 1881 mpt_findImVolumes(ioc);
1870 break; 1882 break;
1883 case MPTSAS_IGNORE_EVENT:
1884 default:
1885 break;
1871 } 1886 }
1872 1887
1873 kfree(ev); 1888 kfree(ev);
@@ -1940,7 +1955,8 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1940 EVENT_DATA_RAID *raid_event_data) 1955 EVENT_DATA_RAID *raid_event_data)
1941{ 1956{
1942 struct mptsas_hotplug_event *ev; 1957 struct mptsas_hotplug_event *ev;
1943 RAID_VOL0_STATUS * volumeStatus; 1958 int status = le32_to_cpu(raid_event_data->SettingsStatus);
1959 int state = (status >> 8) & 0xff;
1944 1960
1945 if (ioc->bus_type != SAS) 1961 if (ioc->bus_type != SAS)
1946 return; 1962 return;
@@ -1955,6 +1971,7 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1955 INIT_WORK(&ev->work, mptsas_hotplug_work, ev); 1971 INIT_WORK(&ev->work, mptsas_hotplug_work, ev);
1956 ev->ioc = ioc; 1972 ev->ioc = ioc;
1957 ev->id = raid_event_data->VolumeID; 1973 ev->id = raid_event_data->VolumeID;
1974 ev->event_type = MPTSAS_IGNORE_EVENT;
1958 1975
1959 switch (raid_event_data->ReasonCode) { 1976 switch (raid_event_data->ReasonCode) {
1960 case MPI_EVENT_RAID_RC_PHYSDISK_DELETED: 1977 case MPI_EVENT_RAID_RC_PHYSDISK_DELETED:
@@ -1966,6 +1983,25 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1966 ev->phys_disk_num = raid_event_data->PhysDiskNum; 1983 ev->phys_disk_num = raid_event_data->PhysDiskNum;
1967 ev->event_type = MPTSAS_DEL_DEVICE; 1984 ev->event_type = MPTSAS_DEL_DEVICE;
1968 break; 1985 break;
1986 case MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED:
1987 switch (state) {
1988 case MPI_PD_STATE_ONLINE:
1989 ioc->raid_data.isRaid = 1;
1990 ev->phys_disk_num_valid = 1;
1991 ev->phys_disk_num = raid_event_data->PhysDiskNum;
1992 ev->event_type = MPTSAS_ADD_DEVICE;
1993 break;
1994 case MPI_PD_STATE_MISSING:
1995 case MPI_PD_STATE_NOT_COMPATIBLE:
1996 case MPI_PD_STATE_OFFLINE_AT_HOST_REQUEST:
1997 case MPI_PD_STATE_FAILED_AT_HOST_REQUEST:
1998 case MPI_PD_STATE_OFFLINE_FOR_ANOTHER_REASON:
1999 ev->event_type = MPTSAS_DEL_DEVICE;
2000 break;
2001 default:
2002 break;
2003 }
2004 break;
1969 case MPI_EVENT_RAID_RC_VOLUME_DELETED: 2005 case MPI_EVENT_RAID_RC_VOLUME_DELETED:
1970 ev->event_type = MPTSAS_DEL_RAID; 2006 ev->event_type = MPTSAS_DEL_RAID;
1971 break; 2007 break;
@@ -1973,11 +2009,18 @@ mptscsih_send_raid_event(MPT_ADAPTER *ioc,
1973 ev->event_type = MPTSAS_ADD_RAID; 2009 ev->event_type = MPTSAS_ADD_RAID;
1974 break; 2010 break;
1975 case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED: 2011 case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED:
1976 volumeStatus = (RAID_VOL0_STATUS *) & 2012 switch (state) {
1977 raid_event_data->SettingsStatus; 2013 case MPI_RAIDVOL0_STATUS_STATE_FAILED:
1978 ev->event_type = (volumeStatus->State == 2014 case MPI_RAIDVOL0_STATUS_STATE_MISSING:
1979 MPI_RAIDVOL0_STATUS_STATE_FAILED) ? 2015 ev->event_type = MPTSAS_DEL_RAID;
1980 MPTSAS_DEL_RAID : MPTSAS_ADD_RAID; 2016 break;
2017 case MPI_RAIDVOL0_STATUS_STATE_OPTIMAL:
2018 case MPI_RAIDVOL0_STATUS_STATE_DEGRADED:
2019 ev->event_type = MPTSAS_ADD_RAID;
2020 break;
2021 default:
2022 break;
2023 }
1981 break; 2024 break;
1982 default: 2025 default:
1983 break; 2026 break;
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 3729062db317..84fa271eb8f4 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -632,7 +632,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
632 632
633 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */ 633 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
634 /* Spoof to SCSI Selection Timeout! */ 634 /* Spoof to SCSI Selection Timeout! */
635 sc->result = DID_NO_CONNECT << 16; 635 if (ioc->bus_type != FC)
636 sc->result = DID_NO_CONNECT << 16;
637 /* else fibre, just stall until rescan event */
638 else
639 sc->result = DID_REQUEUE << 16;
636 640
637 if (hd->sel_timeout[pScsiReq->TargetID] < 0xFFFF) 641 if (hd->sel_timeout[pScsiReq->TargetID] < 0xFFFF)
638 hd->sel_timeout[pScsiReq->TargetID]++; 642 hd->sel_timeout[pScsiReq->TargetID]++;
@@ -877,7 +881,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
877 struct scsi_cmnd *sc; 881 struct scsi_cmnd *sc;
878 882
879 dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n", 883 dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n",
880 vdevice->target_id, vdevice->lun, max)); 884 vdevice->vtarget->target_id, vdevice->lun, max));
881 885
882 for (ii=0; ii < max; ii++) { 886 for (ii=0; ii < max; ii++) {
883 if ((sc = hd->ScsiLookup[ii]) != NULL) { 887 if ((sc = hd->ScsiLookup[ii]) != NULL) {
@@ -1645,7 +1649,6 @@ int
1645mptscsih_abort(struct scsi_cmnd * SCpnt) 1649mptscsih_abort(struct scsi_cmnd * SCpnt)
1646{ 1650{
1647 MPT_SCSI_HOST *hd; 1651 MPT_SCSI_HOST *hd;
1648 MPT_ADAPTER *ioc;
1649 MPT_FRAME_HDR *mf; 1652 MPT_FRAME_HDR *mf;
1650 u32 ctx2abort; 1653 u32 ctx2abort;
1651 int scpnt_idx; 1654 int scpnt_idx;
@@ -1663,14 +1666,6 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1663 return FAILED; 1666 return FAILED;
1664 } 1667 }
1665 1668
1666 ioc = hd->ioc;
1667 if (hd->resetPending) {
1668 return FAILED;
1669 }
1670
1671 if (hd->timeouts < -1)
1672 hd->timeouts++;
1673
1674 /* Find this command 1669 /* Find this command
1675 */ 1670 */
1676 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) { 1671 if ((scpnt_idx = SCPNT_TO_LOOKUP_IDX(SCpnt)) < 0) {
@@ -1684,6 +1679,13 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1684 return SUCCESS; 1679 return SUCCESS;
1685 } 1680 }
1686 1681
1682 if (hd->resetPending) {
1683 return FAILED;
1684 }
1685
1686 if (hd->timeouts < -1)
1687 hd->timeouts++;
1688
1687 printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n", 1689 printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n",
1688 hd->ioc->name, SCpnt); 1690 hd->ioc->name, SCpnt);
1689 scsi_print_command(SCpnt); 1691 scsi_print_command(SCpnt);
@@ -1703,7 +1705,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1703 vdev = SCpnt->device->hostdata; 1705 vdev = SCpnt->device->hostdata;
1704 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1706 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
1705 vdev->vtarget->bus_id, vdev->vtarget->target_id, vdev->lun, 1707 vdev->vtarget->bus_id, vdev->vtarget->target_id, vdev->lun,
1706 ctx2abort, mptscsih_get_tm_timeout(ioc)); 1708 ctx2abort, mptscsih_get_tm_timeout(hd->ioc));
1707 1709
1708 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1710 printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n",
1709 hd->ioc->name, 1711 hd->ioc->name,
@@ -2521,15 +2523,15 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2521 2523
2522 /* 7. FC: Rescan for blocked rports which might have returned. 2524 /* 7. FC: Rescan for blocked rports which might have returned.
2523 */ 2525 */
2524 else if (ioc->bus_type == FC) { 2526 if (ioc->bus_type == FC) {
2525 int work_count;
2526 unsigned long flags;
2527
2528 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); 2527 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
2529 work_count = ++ioc->fc_rescan_work_count; 2528 if (ioc->fc_rescan_work_q) {
2529 if (ioc->fc_rescan_work_count++ == 0) {
2530 queue_work(ioc->fc_rescan_work_q,
2531 &ioc->fc_rescan_work);
2532 }
2533 }
2530 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); 2534 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
2531 if (work_count == 1)
2532 schedule_work(&ioc->fc_rescan_work);
2533 } 2535 }
2534 dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); 2536 dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name));
2535 2537
@@ -2544,7 +2546,6 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2544{ 2546{
2545 MPT_SCSI_HOST *hd; 2547 MPT_SCSI_HOST *hd;
2546 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; 2548 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
2547 int work_count;
2548 unsigned long flags; 2549 unsigned long flags;
2549 2550
2550 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", 2551 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
@@ -2569,10 +2570,13 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2569 2570
2570 case MPI_EVENT_RESCAN: /* 06 */ 2571 case MPI_EVENT_RESCAN: /* 06 */
2571 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags); 2572 spin_lock_irqsave(&ioc->fc_rescan_work_lock, flags);
2572 work_count = ++ioc->fc_rescan_work_count; 2573 if (ioc->fc_rescan_work_q) {
2574 if (ioc->fc_rescan_work_count++ == 0) {
2575 queue_work(ioc->fc_rescan_work_q,
2576 &ioc->fc_rescan_work);
2577 }
2578 }
2573 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags); 2579 spin_unlock_irqrestore(&ioc->fc_rescan_work_lock, flags);
2574 if (work_count == 1)
2575 schedule_work(&ioc->fc_rescan_work);
2576 break; 2580 break;
2577 2581
2578 /* 2582 /*
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 09c745b19cc8..f2a4d382ea19 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -783,6 +783,70 @@ static struct pci_device_id mptspi_pci_table[] = {
783}; 783};
784MODULE_DEVICE_TABLE(pci, mptspi_pci_table); 784MODULE_DEVICE_TABLE(pci, mptspi_pci_table);
785 785
786
787/*
788 * renegotiate for a given target
789 */
790static void
791mptspi_dv_renegotiate_work(void *data)
792{
793 struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
794 struct _MPT_SCSI_HOST *hd = wqw->hd;
795 struct scsi_device *sdev;
796
797 kfree(wqw);
798
799 shost_for_each_device(sdev, hd->ioc->sh)
800 mptspi_dv_device(hd, sdev);
801}
802
803static void
804mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd)
805{
806 struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC);
807
808 if (!wqw)
809 return;
810
811 INIT_WORK(&wqw->work, mptspi_dv_renegotiate_work, wqw);
812 wqw->hd = hd;
813
814 schedule_work(&wqw->work);
815}
816
817/*
818 * spi module reset handler
819 */
820static int
821mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
822{
823 struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata;
824 int rc;
825
826 rc = mptscsih_ioc_reset(ioc, reset_phase);
827
828 if (reset_phase == MPT_IOC_POST_RESET)
829 mptspi_dv_renegotiate(hd);
830
831 return rc;
832}
833
834/*
835 * spi module resume handler
836 */
837static int
838mptspi_resume(struct pci_dev *pdev)
839{
840 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
841 struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata;
842 int rc;
843
844 rc = mptscsih_resume(pdev);
845 mptspi_dv_renegotiate(hd);
846
847 return rc;
848}
849
786/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 850/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
787/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 851/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
788/* 852/*
@@ -1032,7 +1096,7 @@ static struct pci_driver mptspi_driver = {
1032 .shutdown = mptscsih_shutdown, 1096 .shutdown = mptscsih_shutdown,
1033#ifdef CONFIG_PM 1097#ifdef CONFIG_PM
1034 .suspend = mptscsih_suspend, 1098 .suspend = mptscsih_suspend,
1035 .resume = mptscsih_resume, 1099 .resume = mptspi_resume,
1036#endif 1100#endif
1037}; 1101};
1038 1102
@@ -1061,7 +1125,7 @@ mptspi_init(void)
1061 ": Registered for IOC event notifications\n")); 1125 ": Registered for IOC event notifications\n"));
1062 } 1126 }
1063 1127
1064 if (mpt_reset_register(mptspiDoneCtx, mptscsih_ioc_reset) == 0) { 1128 if (mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset) == 0) {
1065 dprintk((KERN_INFO MYNAM 1129 dprintk((KERN_INFO MYNAM
1066 ": Registered for IOC reset notifications\n")); 1130 ": Registered for IOC reset notifications\n"));
1067 } 1131 }
diff --git a/drivers/mmc/at91_mci.c b/drivers/mmc/at91_mci.c
index 6061c2d101a0..88f0eef9cf33 100644
--- a/drivers/mmc/at91_mci.c
+++ b/drivers/mmc/at91_mci.c
@@ -621,9 +621,6 @@ static void at91_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
621 struct at91mci_host *host = mmc_priv(mmc); 621 struct at91mci_host *host = mmc_priv(mmc);
622 unsigned long at91_master_clock = clk_get_rate(mci_clk); 622 unsigned long at91_master_clock = clk_get_rate(mci_clk);
623 623
624 DBG("Clock %uHz, busmode %u, powermode %u, Vdd %u\n",
625 ios->clock, ios->bus_mode, ios->power_mode, ios->vdd);
626
627 if (host) 624 if (host)
628 host->bus_mode = ios->bus_mode; 625 host->bus_mode = ios->bus_mode;
629 else 626 else
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index c0326bbc5f28..914d62b24064 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -720,10 +720,6 @@ static void au1xmmc_set_ios(struct mmc_host* mmc, struct mmc_ios* ios)
720{ 720{
721 struct au1xmmc_host *host = mmc_priv(mmc); 721 struct au1xmmc_host *host = mmc_priv(mmc);
722 722
723 DBG("set_ios (power=%u, clock=%uHz, vdd=%u, mode=%u)\n",
724 host->id, ios->power_mode, ios->clock, ios->vdd,
725 ios->bus_mode);
726
727 if (ios->power_mode == MMC_POWER_OFF) 723 if (ios->power_mode == MMC_POWER_OFF)
728 au1xmmc_set_power(host, 0); 724 au1xmmc_set_power(host, 0);
729 else if (ios->power_mode == MMC_POWER_ON) { 725 else if (ios->power_mode == MMC_POWER_ON) {
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c
index ffb7f55d3467..79358e223f57 100644
--- a/drivers/mmc/imxmmc.c
+++ b/drivers/mmc/imxmmc.c
@@ -102,6 +102,7 @@ struct imxmci_host {
102#define IMXMCI_PEND_CPU_DATA_b 5 102#define IMXMCI_PEND_CPU_DATA_b 5
103#define IMXMCI_PEND_CARD_XCHG_b 6 103#define IMXMCI_PEND_CARD_XCHG_b 6
104#define IMXMCI_PEND_SET_INIT_b 7 104#define IMXMCI_PEND_SET_INIT_b 7
105#define IMXMCI_PEND_STARTED_b 8
105 106
106#define IMXMCI_PEND_IRQ_m (1 << IMXMCI_PEND_IRQ_b) 107#define IMXMCI_PEND_IRQ_m (1 << IMXMCI_PEND_IRQ_b)
107#define IMXMCI_PEND_DMA_END_m (1 << IMXMCI_PEND_DMA_END_b) 108#define IMXMCI_PEND_DMA_END_m (1 << IMXMCI_PEND_DMA_END_b)
@@ -111,6 +112,7 @@ struct imxmci_host {
111#define IMXMCI_PEND_CPU_DATA_m (1 << IMXMCI_PEND_CPU_DATA_b) 112#define IMXMCI_PEND_CPU_DATA_m (1 << IMXMCI_PEND_CPU_DATA_b)
112#define IMXMCI_PEND_CARD_XCHG_m (1 << IMXMCI_PEND_CARD_XCHG_b) 113#define IMXMCI_PEND_CARD_XCHG_m (1 << IMXMCI_PEND_CARD_XCHG_b)
113#define IMXMCI_PEND_SET_INIT_m (1 << IMXMCI_PEND_SET_INIT_b) 114#define IMXMCI_PEND_SET_INIT_m (1 << IMXMCI_PEND_SET_INIT_b)
115#define IMXMCI_PEND_STARTED_m (1 << IMXMCI_PEND_STARTED_b)
114 116
115static void imxmci_stop_clock(struct imxmci_host *host) 117static void imxmci_stop_clock(struct imxmci_host *host)
116{ 118{
@@ -131,23 +133,52 @@ static void imxmci_stop_clock(struct imxmci_host *host)
131 dev_dbg(mmc_dev(host->mmc), "imxmci_stop_clock blocked, no luck\n"); 133 dev_dbg(mmc_dev(host->mmc), "imxmci_stop_clock blocked, no luck\n");
132} 134}
133 135
134static void imxmci_start_clock(struct imxmci_host *host) 136static int imxmci_start_clock(struct imxmci_host *host)
135{ 137{
136 int i = 0; 138 unsigned int trials = 0;
139 unsigned int delay_limit = 128;
140 unsigned long flags;
141
137 MMC_STR_STP_CLK &= ~STR_STP_CLK_STOP_CLK; 142 MMC_STR_STP_CLK &= ~STR_STP_CLK_STOP_CLK;
138 while(i < 0x1000) {
139 if(!(i & 0x7f))
140 MMC_STR_STP_CLK |= STR_STP_CLK_START_CLK;
141 143
142 if(MMC_STATUS & STATUS_CARD_BUS_CLK_RUN) { 144 clear_bit(IMXMCI_PEND_STARTED_b, &host->pending_events);
143 /* Check twice before cut */ 145
146 /*
147 * Command start of the clock, this usually succeeds in less
148 * then 6 delay loops, but during card detection (low clockrate)
149 * it takes up to 5000 delay loops and sometimes fails for the first time
150 */
151 MMC_STR_STP_CLK |= STR_STP_CLK_START_CLK;
152
153 do {
154 unsigned int delay = delay_limit;
155
156 while(delay--){
144 if(MMC_STATUS & STATUS_CARD_BUS_CLK_RUN) 157 if(MMC_STATUS & STATUS_CARD_BUS_CLK_RUN)
145 return; 158 /* Check twice before cut */
159 if(MMC_STATUS & STATUS_CARD_BUS_CLK_RUN)
160 return 0;
161
162 if(test_bit(IMXMCI_PEND_STARTED_b, &host->pending_events))
163 return 0;
146 } 164 }
147 165
148 i++; 166 local_irq_save(flags);
149 } 167 /*
150 dev_dbg(mmc_dev(host->mmc), "imxmci_start_clock blocked, no luck\n"); 168 * Ensure, that request is not doubled under all possible circumstances.
169 * It is possible, that cock running state is missed, because some other
170 * IRQ or schedule delays this function execution and the clocks has
171 * been already stopped by other means (response processing, SDHC HW)
172 */
173 if(!test_bit(IMXMCI_PEND_STARTED_b, &host->pending_events))
174 MMC_STR_STP_CLK |= STR_STP_CLK_START_CLK;
175 local_irq_restore(flags);
176
177 } while(++trials<256);
178
179 dev_err(mmc_dev(host->mmc), "imxmci_start_clock blocked, no luck\n");
180
181 return -1;
151} 182}
152 183
153static void imxmci_softreset(void) 184static void imxmci_softreset(void)
@@ -498,7 +529,7 @@ static int imxmci_data_done(struct imxmci_host *host, unsigned int stat)
498 529
499 data_error = imxmci_finish_data(host, stat); 530 data_error = imxmci_finish_data(host, stat);
500 531
501 if (host->req->stop && (data_error == MMC_ERR_NONE)) { 532 if (host->req->stop) {
502 imxmci_stop_clock(host); 533 imxmci_stop_clock(host);
503 imxmci_start_cmd(host, host->req->stop, 0); 534 imxmci_start_cmd(host, host->req->stop, 0);
504 } else { 535 } else {
@@ -622,6 +653,7 @@ static irqreturn_t imxmci_irq(int irq, void *devid, struct pt_regs *regs)
622 atomic_set(&host->stuck_timeout, 0); 653 atomic_set(&host->stuck_timeout, 0);
623 host->status_reg = stat; 654 host->status_reg = stat;
624 set_bit(IMXMCI_PEND_IRQ_b, &host->pending_events); 655 set_bit(IMXMCI_PEND_IRQ_b, &host->pending_events);
656 set_bit(IMXMCI_PEND_STARTED_b, &host->pending_events);
625 tasklet_schedule(&host->tasklet); 657 tasklet_schedule(&host->tasklet);
626 658
627 return IRQ_RETVAL(handled);; 659 return IRQ_RETVAL(handled);;
@@ -775,10 +807,6 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
775 struct imxmci_host *host = mmc_priv(mmc); 807 struct imxmci_host *host = mmc_priv(mmc);
776 int prescaler; 808 int prescaler;
777 809
778 dev_dbg(mmc_dev(host->mmc), "clock %u power %u vdd %u width %u\n",
779 ios->clock, ios->power_mode, ios->vdd,
780 (ios->bus_width==MMC_BUS_WIDTH_4)?4:1);
781
782 if( ios->bus_width==MMC_BUS_WIDTH_4 ) { 810 if( ios->bus_width==MMC_BUS_WIDTH_4 ) {
783 host->actual_bus_width = MMC_BUS_WIDTH_4; 811 host->actual_bus_width = MMC_BUS_WIDTH_4;
784 imx_gpio_mode(PB11_PF_SD_DAT3); 812 imx_gpio_mode(PB11_PF_SD_DAT3);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index da6ddd910fc5..1ca2c8b9c9b5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -59,21 +59,23 @@ static const unsigned int tacc_mant[] = {
59 59
60 60
61/** 61/**
62 * mmc_request_done - finish processing an MMC command 62 * mmc_request_done - finish processing an MMC request
63 * @host: MMC host which completed command 63 * @host: MMC host which completed request
64 * @mrq: MMC request which completed 64 * @mrq: MMC request which request
65 * 65 *
66 * MMC drivers should call this function when they have completed 66 * MMC drivers should call this function when they have completed
67 * their processing of a command. This should be called before the 67 * their processing of a request.
68 * data part of the command has completed.
69 */ 68 */
70void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq) 69void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
71{ 70{
72 struct mmc_command *cmd = mrq->cmd; 71 struct mmc_command *cmd = mrq->cmd;
73 int err = mrq->cmd->error; 72 int err = cmd->error;
74 pr_debug("MMC: req done (%02x): %d: %08x %08x %08x %08x\n", 73
75 cmd->opcode, err, cmd->resp[0], cmd->resp[1], 74 pr_debug("%s: req done (CMD%u): %d/%d/%d: %08x %08x %08x %08x\n",
76 cmd->resp[2], cmd->resp[3]); 75 mmc_hostname(host), cmd->opcode, err,
76 mrq->data ? mrq->data->error : 0,
77 mrq->stop ? mrq->stop->error : 0,
78 cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
77 79
78 if (err && cmd->retries) { 80 if (err && cmd->retries) {
79 cmd->retries--; 81 cmd->retries--;
@@ -97,8 +99,9 @@ EXPORT_SYMBOL(mmc_request_done);
97void 99void
98mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) 100mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
99{ 101{
100 pr_debug("MMC: starting cmd %02x arg %08x flags %08x\n", 102 pr_debug("%s: starting CMD%u arg %08x flags %08x\n",
101 mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags); 103 mmc_hostname(host), mrq->cmd->opcode,
104 mrq->cmd->arg, mrq->cmd->flags);
102 105
103 WARN_ON(host->card_busy == NULL); 106 WARN_ON(host->card_busy == NULL);
104 107
@@ -312,6 +315,18 @@ void mmc_release_host(struct mmc_host *host)
312 315
313EXPORT_SYMBOL(mmc_release_host); 316EXPORT_SYMBOL(mmc_release_host);
314 317
318static inline void mmc_set_ios(struct mmc_host *host)
319{
320 struct mmc_ios *ios = &host->ios;
321
322 pr_debug("%s: clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n",
323 mmc_hostname(host), ios->clock, ios->bus_mode,
324 ios->power_mode, ios->chip_select, ios->vdd,
325 ios->bus_width);
326
327 host->ops->set_ios(host, ios);
328}
329
315static int mmc_select_card(struct mmc_host *host, struct mmc_card *card) 330static int mmc_select_card(struct mmc_host *host, struct mmc_card *card)
316{ 331{
317 int err; 332 int err;
@@ -364,7 +379,7 @@ static int mmc_select_card(struct mmc_host *host, struct mmc_card *card)
364 } 379 }
365 } 380 }
366 381
367 host->ops->set_ios(host, &host->ios); 382 mmc_set_ios(host);
368 383
369 return MMC_ERR_NONE; 384 return MMC_ERR_NONE;
370} 385}
@@ -415,7 +430,7 @@ static u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
415 ocr = 3 << bit; 430 ocr = 3 << bit;
416 431
417 host->ios.vdd = bit; 432 host->ios.vdd = bit;
418 host->ops->set_ios(host, &host->ios); 433 mmc_set_ios(host);
419 } else { 434 } else {
420 ocr = 0; 435 ocr = 0;
421 } 436 }
@@ -549,6 +564,7 @@ static void mmc_decode_csd(struct mmc_card *card)
549 csd->read_partial = UNSTUFF_BITS(resp, 79, 1); 564 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
550 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1); 565 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
551 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1); 566 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
567 csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
552 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4); 568 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
553 csd->write_partial = UNSTUFF_BITS(resp, 21, 1); 569 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
554 } else { 570 } else {
@@ -583,6 +599,7 @@ static void mmc_decode_csd(struct mmc_card *card)
583 csd->read_partial = UNSTUFF_BITS(resp, 79, 1); 599 csd->read_partial = UNSTUFF_BITS(resp, 79, 1);
584 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1); 600 csd->write_misalign = UNSTUFF_BITS(resp, 78, 1);
585 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1); 601 csd->read_misalign = UNSTUFF_BITS(resp, 77, 1);
602 csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
586 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4); 603 csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
587 csd->write_partial = UNSTUFF_BITS(resp, 21, 1); 604 csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
588 } 605 }
@@ -666,7 +683,7 @@ static void mmc_idle_cards(struct mmc_host *host)
666 struct mmc_command cmd; 683 struct mmc_command cmd;
667 684
668 host->ios.chip_select = MMC_CS_HIGH; 685 host->ios.chip_select = MMC_CS_HIGH;
669 host->ops->set_ios(host, &host->ios); 686 mmc_set_ios(host);
670 687
671 mmc_delay(1); 688 mmc_delay(1);
672 689
@@ -679,7 +696,7 @@ static void mmc_idle_cards(struct mmc_host *host)
679 mmc_delay(1); 696 mmc_delay(1);
680 697
681 host->ios.chip_select = MMC_CS_DONTCARE; 698 host->ios.chip_select = MMC_CS_DONTCARE;
682 host->ops->set_ios(host, &host->ios); 699 mmc_set_ios(host);
683 700
684 mmc_delay(1); 701 mmc_delay(1);
685} 702}
@@ -704,13 +721,13 @@ static void mmc_power_up(struct mmc_host *host)
704 host->ios.chip_select = MMC_CS_DONTCARE; 721 host->ios.chip_select = MMC_CS_DONTCARE;
705 host->ios.power_mode = MMC_POWER_UP; 722 host->ios.power_mode = MMC_POWER_UP;
706 host->ios.bus_width = MMC_BUS_WIDTH_1; 723 host->ios.bus_width = MMC_BUS_WIDTH_1;
707 host->ops->set_ios(host, &host->ios); 724 mmc_set_ios(host);
708 725
709 mmc_delay(1); 726 mmc_delay(1);
710 727
711 host->ios.clock = host->f_min; 728 host->ios.clock = host->f_min;
712 host->ios.power_mode = MMC_POWER_ON; 729 host->ios.power_mode = MMC_POWER_ON;
713 host->ops->set_ios(host, &host->ios); 730 mmc_set_ios(host);
714 731
715 mmc_delay(2); 732 mmc_delay(2);
716} 733}
@@ -723,7 +740,7 @@ static void mmc_power_off(struct mmc_host *host)
723 host->ios.chip_select = MMC_CS_DONTCARE; 740 host->ios.chip_select = MMC_CS_DONTCARE;
724 host->ios.power_mode = MMC_POWER_OFF; 741 host->ios.power_mode = MMC_POWER_OFF;
725 host->ios.bus_width = MMC_BUS_WIDTH_1; 742 host->ios.bus_width = MMC_BUS_WIDTH_1;
726 host->ops->set_ios(host, &host->ios); 743 mmc_set_ios(host);
727} 744}
728 745
729static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) 746static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
@@ -971,7 +988,8 @@ static unsigned int mmc_calculate_clock(struct mmc_host *host)
971 if (!mmc_card_dead(card) && max_dtr > card->csd.max_dtr) 988 if (!mmc_card_dead(card) && max_dtr > card->csd.max_dtr)
972 max_dtr = card->csd.max_dtr; 989 max_dtr = card->csd.max_dtr;
973 990
974 pr_debug("MMC: selected %d.%03dMHz transfer rate\n", 991 pr_debug("%s: selected %d.%03dMHz transfer rate\n",
992 mmc_hostname(host),
975 max_dtr / 1000000, (max_dtr / 1000) % 1000); 993 max_dtr / 1000000, (max_dtr / 1000) % 1000);
976 994
977 return max_dtr; 995 return max_dtr;
@@ -1046,7 +1064,7 @@ static void mmc_setup(struct mmc_host *host)
1046 } else { 1064 } else {
1047 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; 1065 host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
1048 host->ios.clock = host->f_min; 1066 host->ios.clock = host->f_min;
1049 host->ops->set_ios(host, &host->ios); 1067 mmc_set_ios(host);
1050 1068
1051 /* 1069 /*
1052 * We should remember the OCR mask from the existing 1070 * We should remember the OCR mask from the existing
@@ -1082,7 +1100,7 @@ static void mmc_setup(struct mmc_host *host)
1082 * Ok, now switch to push-pull mode. 1100 * Ok, now switch to push-pull mode.
1083 */ 1101 */
1084 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL; 1102 host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
1085 host->ops->set_ios(host, &host->ios); 1103 mmc_set_ios(host);
1086 1104
1087 mmc_read_csds(host); 1105 mmc_read_csds(host);
1088 1106
@@ -1128,7 +1146,7 @@ static void mmc_rescan(void *data)
1128 * attached cards and the host support. 1146 * attached cards and the host support.
1129 */ 1147 */
1130 host->ios.clock = mmc_calculate_clock(host); 1148 host->ios.clock = mmc_calculate_clock(host);
1131 host->ops->set_ios(host, &host->ios); 1149 mmc_set_ios(host);
1132 } 1150 }
1133 1151
1134 mmc_release_host(host); 1152 mmc_release_host(host);
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 8eb2a2ede64b..06bd1f4cb9b1 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -187,6 +187,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
187 brq.cmd.opcode = MMC_WRITE_BLOCK; 187 brq.cmd.opcode = MMC_WRITE_BLOCK;
188 brq.data.flags |= MMC_DATA_WRITE; 188 brq.data.flags |= MMC_DATA_WRITE;
189 brq.data.blocks = 1; 189 brq.data.blocks = 1;
190
191 /*
192 * Scale up the timeout by the r2w factor
193 */
194 brq.data.timeout_ns <<= card->csd.r2w_factor;
195 brq.data.timeout_clks <<= card->csd.r2w_factor;
190 } 196 }
191 197
192 if (brq.data.blocks > 1) { 198 if (brq.data.blocks > 1) {
diff --git a/drivers/mmc/mmci.c b/drivers/mmc/mmci.c
index df7e861e2fc7..da8e4d7339cc 100644
--- a/drivers/mmc/mmci.c
+++ b/drivers/mmc/mmci.c
@@ -402,9 +402,6 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
402 struct mmci_host *host = mmc_priv(mmc); 402 struct mmci_host *host = mmc_priv(mmc);
403 u32 clk = 0, pwr = 0; 403 u32 clk = 0, pwr = 0;
404 404
405 DBG(host, "clock %uHz busmode %u powermode %u Vdd %u\n",
406 ios->clock, ios->bus_mode, ios->power_mode, ios->vdd);
407
408 if (ios->clock) { 405 if (ios->clock) {
409 if (ios->clock >= host->mclk) { 406 if (ios->clock >= host->mclk) {
410 clk = MCI_CLK_BYPASS; 407 clk = MCI_CLK_BYPASS;
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index eb42cb349420..f97b472085cb 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -198,7 +198,6 @@ static void pxamci_start_cmd(struct pxamci_host *host, struct mmc_command *cmd,
198 198
199static void pxamci_finish_request(struct pxamci_host *host, struct mmc_request *mrq) 199static void pxamci_finish_request(struct pxamci_host *host, struct mmc_request *mrq)
200{ 200{
201 pr_debug("PXAMCI: request done\n");
202 host->mrq = NULL; 201 host->mrq = NULL;
203 host->cmd = NULL; 202 host->cmd = NULL;
204 host->data = NULL; 203 host->data = NULL;
@@ -291,7 +290,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
291 pxamci_disable_irq(host, DATA_TRAN_DONE); 290 pxamci_disable_irq(host, DATA_TRAN_DONE);
292 291
293 host->data = NULL; 292 host->data = NULL;
294 if (host->mrq->stop && data->error == MMC_ERR_NONE) { 293 if (host->mrq->stop) {
295 pxamci_stop_clock(host); 294 pxamci_stop_clock(host);
296 pxamci_start_cmd(host, host->mrq->stop, 0); 295 pxamci_start_cmd(host, host->mrq->stop, 0);
297 } else { 296 } else {
@@ -309,12 +308,10 @@ static irqreturn_t pxamci_irq(int irq, void *devid, struct pt_regs *regs)
309 308
310 ireg = readl(host->base + MMC_I_REG); 309 ireg = readl(host->base + MMC_I_REG);
311 310
312 pr_debug("PXAMCI: irq %08x\n", ireg);
313
314 if (ireg) { 311 if (ireg) {
315 unsigned stat = readl(host->base + MMC_STAT); 312 unsigned stat = readl(host->base + MMC_STAT);
316 313
317 pr_debug("PXAMCI: stat %08x\n", stat); 314 pr_debug("PXAMCI: irq %08x stat %08x\n", ireg, stat);
318 315
319 if (ireg & END_CMD_RES) 316 if (ireg & END_CMD_RES)
320 handled |= pxamci_cmd_done(host, stat); 317 handled |= pxamci_cmd_done(host, stat);
@@ -368,10 +365,6 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
368{ 365{
369 struct pxamci_host *host = mmc_priv(mmc); 366 struct pxamci_host *host = mmc_priv(mmc);
370 367
371 pr_debug("pxamci_set_ios: clock %u power %u vdd %u.%02u\n",
372 ios->clock, ios->power_mode, ios->vdd / 100,
373 ios->vdd % 100);
374
375 if (ios->clock) { 368 if (ios->clock) {
376 unsigned int clk = CLOCKRATE / ios->clock; 369 unsigned int clk = CLOCKRATE / ios->clock;
377 if (CLOCKRATE / clk > ios->clock) 370 if (CLOCKRATE / clk > ios->clock)
@@ -397,7 +390,7 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
397 host->cmdat |= CMDAT_INIT; 390 host->cmdat |= CMDAT_INIT;
398 } 391 }
399 392
400 pr_debug("pxamci_set_ios: clkrt = %x cmdat = %x\n", 393 pr_debug("PXAMCI: clkrt = %x cmdat = %x\n",
401 host->clkrt, host->cmdat); 394 host->clkrt, host->cmdat);
402} 395}
403 396
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index bdbfca050029..b0053280ff2d 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -570,10 +570,6 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
570 570
571 spin_lock_irqsave(&host->lock, flags); 571 spin_lock_irqsave(&host->lock, flags);
572 572
573 DBG("clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n",
574 ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select,
575 ios->vdd, ios->bus_width);
576
577 /* 573 /*
578 * Reset the chip on each power off. 574 * Reset the chip on each power off.
579 * Should clear out any weird states. 575 * Should clear out any weird states.
diff --git a/drivers/mmc/wbsd.c b/drivers/mmc/wbsd.c
index 511f7b0b31d2..39b3d97f891e 100644
--- a/drivers/mmc/wbsd.c
+++ b/drivers/mmc/wbsd.c
@@ -931,10 +931,6 @@ static void wbsd_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
931 struct wbsd_host *host = mmc_priv(mmc); 931 struct wbsd_host *host = mmc_priv(mmc);
932 u8 clk, setup, pwr; 932 u8 clk, setup, pwr;
933 933
934 DBGF("clock %uHz busmode %u powermode %u cs %u Vdd %u width %u\n",
935 ios->clock, ios->bus_mode, ios->power_mode, ios->chip_select,
936 ios->vdd, ios->bus_width);
937
938 spin_lock_bh(&host->lock); 934 spin_lock_bh(&host->lock);
939 935
940 /* 936 /*
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 1363083b4d83..14dbad14afb6 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -52,6 +52,7 @@
52#include <linux/mii.h> 52#include <linux/mii.h>
53#include <linux/skbuff.h> 53#include <linux/skbuff.h>
54#include <linux/delay.h> 54#include <linux/delay.h>
55#include <linux/crc32.h>
55#include <asm/mipsregs.h> 56#include <asm/mipsregs.h>
56#include <asm/irq.h> 57#include <asm/irq.h>
57#include <asm/io.h> 58#include <asm/io.h>
@@ -2070,23 +2071,6 @@ static void au1000_tx_timeout(struct net_device *dev)
2070 netif_wake_queue(dev); 2071 netif_wake_queue(dev);
2071} 2072}
2072 2073
2073
2074static unsigned const ethernet_polynomial = 0x04c11db7U;
2075static inline u32 ether_crc(int length, unsigned char *data)
2076{
2077 int crc = -1;
2078
2079 while(--length >= 0) {
2080 unsigned char current_octet = *data++;
2081 int bit;
2082 for (bit = 0; bit < 8; bit++, current_octet >>= 1)
2083 crc = (crc << 1) ^
2084 ((crc < 0) ^ (current_octet & 1) ?
2085 ethernet_polynomial : 0);
2086 }
2087 return crc;
2088}
2089
2090static void set_rx_mode(struct net_device *dev) 2074static void set_rx_mode(struct net_device *dev)
2091{ 2075{
2092 struct au1000_private *aup = (struct au1000_private *) dev->priv; 2076 struct au1000_private *aup = (struct au1000_private *) dev->priv;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 1f3627470c95..038447fb5c5e 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -53,6 +53,7 @@
53#define DRV_VERSION "v1.17b" 53#define DRV_VERSION "v1.17b"
54#define DRV_RELDATE "2006/03/10" 54#define DRV_RELDATE "2006/03/10"
55#include "dl2k.h" 55#include "dl2k.h"
56#include <linux/dma-mapping.h>
56 57
57static char version[] __devinitdata = 58static char version[] __devinitdata =
58 KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n"; 59 KERN_INFO DRV_NAME " " DRV_VERSION " " DRV_RELDATE "\n";
@@ -765,7 +766,7 @@ rio_free_tx (struct net_device *dev, int irq)
765 break; 766 break;
766 skb = np->tx_skbuff[entry]; 767 skb = np->tx_skbuff[entry];
767 pci_unmap_single (np->pdev, 768 pci_unmap_single (np->pdev,
768 np->tx_ring[entry].fraginfo & 0xffffffffffff, 769 np->tx_ring[entry].fraginfo & DMA_48BIT_MASK,
769 skb->len, PCI_DMA_TODEVICE); 770 skb->len, PCI_DMA_TODEVICE);
770 if (irq) 771 if (irq)
771 dev_kfree_skb_irq (skb); 772 dev_kfree_skb_irq (skb);
@@ -893,7 +894,7 @@ receive_packet (struct net_device *dev)
893 /* Small skbuffs for short packets */ 894 /* Small skbuffs for short packets */
894 if (pkt_len > copy_thresh) { 895 if (pkt_len > copy_thresh) {
895 pci_unmap_single (np->pdev, 896 pci_unmap_single (np->pdev,
896 desc->fraginfo & 0xffffffffffff, 897 desc->fraginfo & DMA_48BIT_MASK,
897 np->rx_buf_sz, 898 np->rx_buf_sz,
898 PCI_DMA_FROMDEVICE); 899 PCI_DMA_FROMDEVICE);
899 skb_put (skb = np->rx_skbuff[entry], pkt_len); 900 skb_put (skb = np->rx_skbuff[entry], pkt_len);
@@ -901,7 +902,7 @@ receive_packet (struct net_device *dev)
901 } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { 902 } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
902 pci_dma_sync_single_for_cpu(np->pdev, 903 pci_dma_sync_single_for_cpu(np->pdev,
903 desc->fraginfo & 904 desc->fraginfo &
904 0xffffffffffff, 905 DMA_48BIT_MASK,
905 np->rx_buf_sz, 906 np->rx_buf_sz,
906 PCI_DMA_FROMDEVICE); 907 PCI_DMA_FROMDEVICE);
907 skb->dev = dev; 908 skb->dev = dev;
@@ -913,7 +914,7 @@ receive_packet (struct net_device *dev)
913 skb_put (skb, pkt_len); 914 skb_put (skb, pkt_len);
914 pci_dma_sync_single_for_device(np->pdev, 915 pci_dma_sync_single_for_device(np->pdev,
915 desc->fraginfo & 916 desc->fraginfo &
916 0xffffffffffff, 917 DMA_48BIT_MASK,
917 np->rx_buf_sz, 918 np->rx_buf_sz,
918 PCI_DMA_FROMDEVICE); 919 PCI_DMA_FROMDEVICE);
919 } 920 }
@@ -1800,7 +1801,7 @@ rio_close (struct net_device *dev)
1800 skb = np->rx_skbuff[i]; 1801 skb = np->rx_skbuff[i];
1801 if (skb) { 1802 if (skb) {
1802 pci_unmap_single(np->pdev, 1803 pci_unmap_single(np->pdev,
1803 np->rx_ring[i].fraginfo & 0xffffffffffff, 1804 np->rx_ring[i].fraginfo & DMA_48BIT_MASK,
1804 skb->len, PCI_DMA_FROMDEVICE); 1805 skb->len, PCI_DMA_FROMDEVICE);
1805 dev_kfree_skb (skb); 1806 dev_kfree_skb (skb);
1806 np->rx_skbuff[i] = NULL; 1807 np->rx_skbuff[i] = NULL;
@@ -1810,7 +1811,7 @@ rio_close (struct net_device *dev)
1810 skb = np->tx_skbuff[i]; 1811 skb = np->tx_skbuff[i];
1811 if (skb) { 1812 if (skb) {
1812 pci_unmap_single(np->pdev, 1813 pci_unmap_single(np->pdev,
1813 np->tx_ring[i].fraginfo & 0xffffffffffff, 1814 np->tx_ring[i].fraginfo & DMA_48BIT_MASK,
1814 skb->len, PCI_DMA_TODEVICE); 1815 skb->len, PCI_DMA_TODEVICE);
1815 dev_kfree_skb (skb); 1816 dev_kfree_skb (skb);
1816 np->tx_skbuff[i] = NULL; 1817 np->tx_skbuff[i] = NULL;
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 79a8fbcf5f93..0d5fccc984bb 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -582,7 +582,6 @@ static int __init setup_adapter(int card_base, int type, int n)
582 INIT_WORK(&priv->rx_work, rx_bh, priv); 582 INIT_WORK(&priv->rx_work, rx_bh, priv);
583 dev->priv = priv; 583 dev->priv = priv;
584 sprintf(dev->name, "dmascc%i", 2 * n + i); 584 sprintf(dev->name, "dmascc%i", 2 * n + i);
585 SET_MODULE_OWNER(dev);
586 dev->base_addr = card_base; 585 dev->base_addr = card_base;
587 dev->irq = irq; 586 dev->irq = irq;
588 dev->open = scc_open; 587 dev->open = scc_open;
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index 6ace0e914fd1..5927784df3f9 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -1550,7 +1550,6 @@ static unsigned char ax25_nocall[AX25_ADDR_LEN] =
1550 1550
1551static void scc_net_setup(struct net_device *dev) 1551static void scc_net_setup(struct net_device *dev)
1552{ 1552{
1553 SET_MODULE_OWNER(dev);
1554 dev->tx_queue_len = 16; /* should be enough... */ 1553 dev->tx_queue_len = 16; /* should be enough... */
1555 1554
1556 dev->open = scc_net_open; 1555 dev->open = scc_net_open;
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index fe22479eb202..b49884048caa 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1098,7 +1098,6 @@ static void yam_setup(struct net_device *dev)
1098 1098
1099 dev->base_addr = yp->iobase; 1099 dev->base_addr = yp->iobase;
1100 dev->irq = yp->irq; 1100 dev->irq = yp->irq;
1101 SET_MODULE_OWNER(dev);
1102 1101
1103 dev->open = yam_open; 1102 dev->open = yam_open;
1104 dev->stop = yam_close; 1103 dev->stop = yam_close;
diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile
index 27ab75f20799..c1ce2398efea 100644
--- a/drivers/net/irda/Makefile
+++ b/drivers/net/irda/Makefile
@@ -46,4 +46,4 @@ obj-$(CONFIG_MA600_DONGLE) += ma600-sir.o
46obj-$(CONFIG_TOIM3232_DONGLE) += toim3232-sir.o 46obj-$(CONFIG_TOIM3232_DONGLE) += toim3232-sir.o
47 47
48# The SIR helper module 48# The SIR helper module
49sir-dev-objs := sir_dev.o sir_dongle.o sir_kthread.o 49sir-dev-objs := sir_dev.o sir_dongle.o
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 96bdb73c2283..cd87593e4e8a 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -1778,7 +1778,7 @@ static int irda_usb_probe(struct usb_interface *intf,
1778 1778
1779 if (self->needspatch) { 1779 if (self->needspatch) {
1780 ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0), 1780 ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0),
1781 0x02, 0x40, 0, 0, 0, 0, msecs_to_jiffies(500)); 1781 0x02, 0x40, 0, 0, NULL, 0, 500);
1782 if (ret < 0) { 1782 if (ret < 0) {
1783 IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret); 1783 IRDA_DEBUG (0, "usb_control_msg failed %d\n", ret);
1784 goto err_out_3; 1784 goto err_out_3;
diff --git a/drivers/net/irda/sir-dev.h b/drivers/net/irda/sir-dev.h
index f69fb4cec76f..9fa294a546d6 100644
--- a/drivers/net/irda/sir-dev.h
+++ b/drivers/net/irda/sir-dev.h
@@ -15,23 +15,14 @@
15#define IRDA_SIR_H 15#define IRDA_SIR_H
16 16
17#include <linux/netdevice.h> 17#include <linux/netdevice.h>
18#include <linux/workqueue.h>
18 19
19#include <net/irda/irda.h> 20#include <net/irda/irda.h>
20#include <net/irda/irda_device.h> // iobuff_t 21#include <net/irda/irda_device.h> // iobuff_t
21 22
22/* FIXME: unify irda_request with sir_fsm! */
23
24struct irda_request {
25 struct list_head lh_request;
26 unsigned long pending;
27 void (*func)(void *);
28 void *data;
29 struct timer_list timer;
30};
31
32struct sir_fsm { 23struct sir_fsm {
33 struct semaphore sem; 24 struct semaphore sem;
34 struct irda_request rq; 25 struct work_struct work;
35 unsigned state, substate; 26 unsigned state, substate;
36 int param; 27 int param;
37 int result; 28 int result;
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index ea7c9464d46a..3b5854d10c17 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -23,6 +23,298 @@
23 23
24#include "sir-dev.h" 24#include "sir-dev.h"
25 25
26
27static struct workqueue_struct *irda_sir_wq;
28
29/* STATE MACHINE */
30
31/* substate handler of the config-fsm to handle the cases where we want
32 * to wait for transmit completion before changing the port configuration
33 */
34
35static int sirdev_tx_complete_fsm(struct sir_dev *dev)
36{
37 struct sir_fsm *fsm = &dev->fsm;
38 unsigned next_state, delay;
39 unsigned bytes_left;
40
41 do {
42 next_state = fsm->substate; /* default: stay in current substate */
43 delay = 0;
44
45 switch(fsm->substate) {
46
47 case SIRDEV_STATE_WAIT_XMIT:
48 if (dev->drv->chars_in_buffer)
49 bytes_left = dev->drv->chars_in_buffer(dev);
50 else
51 bytes_left = 0;
52 if (!bytes_left) {
53 next_state = SIRDEV_STATE_WAIT_UNTIL_SENT;
54 break;
55 }
56
57 if (dev->speed > 115200)
58 delay = (bytes_left*8*10000) / (dev->speed/100);
59 else if (dev->speed > 0)
60 delay = (bytes_left*10*10000) / (dev->speed/100);
61 else
62 delay = 0;
63 /* expected delay (usec) until remaining bytes are sent */
64 if (delay < 100) {
65 udelay(delay);
66 delay = 0;
67 break;
68 }
69 /* sleep some longer delay (msec) */
70 delay = (delay+999) / 1000;
71 break;
72
73 case SIRDEV_STATE_WAIT_UNTIL_SENT:
74 /* block until underlaying hardware buffer are empty */
75 if (dev->drv->wait_until_sent)
76 dev->drv->wait_until_sent(dev);
77 next_state = SIRDEV_STATE_TX_DONE;
78 break;
79
80 case SIRDEV_STATE_TX_DONE:
81 return 0;
82
83 default:
84 IRDA_ERROR("%s - undefined state\n", __FUNCTION__);
85 return -EINVAL;
86 }
87 fsm->substate = next_state;
88 } while (delay == 0);
89 return delay;
90}
91
92/*
93 * Function sirdev_config_fsm
94 *
95 * State machine to handle the configuration of the device (and attached dongle, if any).
96 * This handler is scheduled for execution in kIrDAd context, so we can sleep.
97 * however, kIrDAd is shared by all sir_dev devices so we better don't sleep there too
98 * long. Instead, for longer delays we start a timer to reschedule us later.
99 * On entry, fsm->sem is always locked and the netdev xmit queue stopped.
100 * Both must be unlocked/restarted on completion - but only on final exit.
101 */
102
103static void sirdev_config_fsm(void *data)
104{
105 struct sir_dev *dev = data;
106 struct sir_fsm *fsm = &dev->fsm;
107 int next_state;
108 int ret = -1;
109 unsigned delay;
110
111 IRDA_DEBUG(2, "%s(), <%ld>\n", __FUNCTION__, jiffies);
112
113 do {
114 IRDA_DEBUG(3, "%s - state=0x%04x / substate=0x%04x\n",
115 __FUNCTION__, fsm->state, fsm->substate);
116
117 next_state = fsm->state;
118 delay = 0;
119
120 switch(fsm->state) {
121
122 case SIRDEV_STATE_DONGLE_OPEN:
123 if (dev->dongle_drv != NULL) {
124 ret = sirdev_put_dongle(dev);
125 if (ret) {
126 fsm->result = -EINVAL;
127 next_state = SIRDEV_STATE_ERROR;
128 break;
129 }
130 }
131
132 /* Initialize dongle */
133 ret = sirdev_get_dongle(dev, fsm->param);
134 if (ret) {
135 fsm->result = ret;
136 next_state = SIRDEV_STATE_ERROR;
137 break;
138 }
139
140 /* Dongles are powered through the modem control lines which
141 * were just set during open. Before resetting, let's wait for
142 * the power to stabilize. This is what some dongle drivers did
143 * in open before, while others didn't - should be safe anyway.
144 */
145
146 delay = 50;
147 fsm->substate = SIRDEV_STATE_DONGLE_RESET;
148 next_state = SIRDEV_STATE_DONGLE_RESET;
149
150 fsm->param = 9600;
151
152 break;
153
154 case SIRDEV_STATE_DONGLE_CLOSE:
155 /* shouldn't we just treat this as success=? */
156 if (dev->dongle_drv == NULL) {
157 fsm->result = -EINVAL;
158 next_state = SIRDEV_STATE_ERROR;
159 break;
160 }
161
162 ret = sirdev_put_dongle(dev);
163 if (ret) {
164 fsm->result = ret;
165 next_state = SIRDEV_STATE_ERROR;
166 break;
167 }
168 next_state = SIRDEV_STATE_DONE;
169 break;
170
171 case SIRDEV_STATE_SET_DTR_RTS:
172 ret = sirdev_set_dtr_rts(dev,
173 (fsm->param&0x02) ? TRUE : FALSE,
174 (fsm->param&0x01) ? TRUE : FALSE);
175 next_state = SIRDEV_STATE_DONE;
176 break;
177
178 case SIRDEV_STATE_SET_SPEED:
179 fsm->substate = SIRDEV_STATE_WAIT_XMIT;
180 next_state = SIRDEV_STATE_DONGLE_CHECK;
181 break;
182
183 case SIRDEV_STATE_DONGLE_CHECK:
184 ret = sirdev_tx_complete_fsm(dev);
185 if (ret < 0) {
186 fsm->result = ret;
187 next_state = SIRDEV_STATE_ERROR;
188 break;
189 }
190 if ((delay=ret) != 0)
191 break;
192
193 if (dev->dongle_drv) {
194 fsm->substate = SIRDEV_STATE_DONGLE_RESET;
195 next_state = SIRDEV_STATE_DONGLE_RESET;
196 }
197 else {
198 dev->speed = fsm->param;
199 next_state = SIRDEV_STATE_PORT_SPEED;
200 }
201 break;
202
203 case SIRDEV_STATE_DONGLE_RESET:
204 if (dev->dongle_drv->reset) {
205 ret = dev->dongle_drv->reset(dev);
206 if (ret < 0) {
207 fsm->result = ret;
208 next_state = SIRDEV_STATE_ERROR;
209 break;
210 }
211 }
212 else
213 ret = 0;
214 if ((delay=ret) == 0) {
215 /* set serial port according to dongle default speed */
216 if (dev->drv->set_speed)
217 dev->drv->set_speed(dev, dev->speed);
218 fsm->substate = SIRDEV_STATE_DONGLE_SPEED;
219 next_state = SIRDEV_STATE_DONGLE_SPEED;
220 }
221 break;
222
223 case SIRDEV_STATE_DONGLE_SPEED:
224 if (dev->dongle_drv->reset) {
225 ret = dev->dongle_drv->set_speed(dev, fsm->param);
226 if (ret < 0) {
227 fsm->result = ret;
228 next_state = SIRDEV_STATE_ERROR;
229 break;
230 }
231 }
232 else
233 ret = 0;
234 if ((delay=ret) == 0)
235 next_state = SIRDEV_STATE_PORT_SPEED;
236 break;
237
238 case SIRDEV_STATE_PORT_SPEED:
239 /* Finally we are ready to change the serial port speed */
240 if (dev->drv->set_speed)
241 dev->drv->set_speed(dev, dev->speed);
242 dev->new_speed = 0;
243 next_state = SIRDEV_STATE_DONE;
244 break;
245
246 case SIRDEV_STATE_DONE:
247 /* Signal network layer so it can send more frames */
248 netif_wake_queue(dev->netdev);
249 next_state = SIRDEV_STATE_COMPLETE;
250 break;
251
252 default:
253 IRDA_ERROR("%s - undefined state\n", __FUNCTION__);
254 fsm->result = -EINVAL;
255 /* fall thru */
256
257 case SIRDEV_STATE_ERROR:
258 IRDA_ERROR("%s - error: %d\n", __FUNCTION__, fsm->result);
259
260#if 0 /* don't enable this before we have netdev->tx_timeout to recover */
261 netif_stop_queue(dev->netdev);
262#else
263 netif_wake_queue(dev->netdev);
264#endif
265 /* fall thru */
266
267 case SIRDEV_STATE_COMPLETE:
268 /* config change finished, so we are not busy any longer */
269 sirdev_enable_rx(dev);
270 up(&fsm->sem);
271 return;
272 }
273 fsm->state = next_state;
274 } while(!delay);
275
276 queue_delayed_work(irda_sir_wq, &fsm->work, msecs_to_jiffies(delay));
277}
278
279/* schedule some device configuration task for execution by kIrDAd
280 * on behalf of the above state machine.
281 * can be called from process or interrupt/tasklet context.
282 */
283
284int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned param)
285{
286 struct sir_fsm *fsm = &dev->fsm;
287
288 IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param);
289
290 if (down_trylock(&fsm->sem)) {
291 if (in_interrupt() || in_atomic() || irqs_disabled()) {
292 IRDA_DEBUG(1, "%s(), state machine busy!\n", __FUNCTION__);
293 return -EWOULDBLOCK;
294 } else
295 down(&fsm->sem);
296 }
297
298 if (fsm->state == SIRDEV_STATE_DEAD) {
299 /* race with sirdev_close should never happen */
300 IRDA_ERROR("%s(), instance staled!\n", __FUNCTION__);
301 up(&fsm->sem);
302 return -ESTALE; /* or better EPIPE? */
303 }
304
305 netif_stop_queue(dev->netdev);
306 atomic_set(&dev->enable_rx, 0);
307
308 fsm->state = initial_state;
309 fsm->param = param;
310 fsm->result = 0;
311
312 INIT_WORK(&fsm->work, sirdev_config_fsm, dev);
313 queue_work(irda_sir_wq, &fsm->work);
314 return 0;
315}
316
317
26/***************************************************************************/ 318/***************************************************************************/
27 319
28void sirdev_enable_rx(struct sir_dev *dev) 320void sirdev_enable_rx(struct sir_dev *dev)
@@ -619,10 +911,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
619 spin_lock_init(&dev->tx_lock); 911 spin_lock_init(&dev->tx_lock);
620 init_MUTEX(&dev->fsm.sem); 912 init_MUTEX(&dev->fsm.sem);
621 913
622 INIT_LIST_HEAD(&dev->fsm.rq.lh_request);
623 dev->fsm.rq.pending = 0;
624 init_timer(&dev->fsm.rq.timer);
625
626 dev->drv = drv; 914 dev->drv = drv;
627 dev->netdev = ndev; 915 dev->netdev = ndev;
628 916
@@ -682,3 +970,22 @@ int sirdev_put_instance(struct sir_dev *dev)
682} 970}
683EXPORT_SYMBOL(sirdev_put_instance); 971EXPORT_SYMBOL(sirdev_put_instance);
684 972
973static int __init sir_wq_init(void)
974{
975 irda_sir_wq = create_singlethread_workqueue("irda_sir_wq");
976 if (!irda_sir_wq)
977 return -ENOMEM;
978 return 0;
979}
980
981static void __exit sir_wq_exit(void)
982{
983 destroy_workqueue(irda_sir_wq);
984}
985
986module_init(sir_wq_init);
987module_exit(sir_wq_exit);
988
989MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");
990MODULE_DESCRIPTION("IrDA SIR core");
991MODULE_LICENSE("GPL");
diff --git a/drivers/net/irda/sir_kthread.c b/drivers/net/irda/sir_kthread.c
deleted file mode 100644
index e3904d6bfecd..000000000000
--- a/drivers/net/irda/sir_kthread.c
+++ /dev/null
@@ -1,508 +0,0 @@
1/*********************************************************************
2 *
3 * sir_kthread.c: dedicated thread to process scheduled
4 * sir device setup requests
5 *
6 * Copyright (c) 2002 Martin Diehl
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 ********************************************************************/
14
15#include <linux/module.h>
16#include <linux/kernel.h>
17#include <linux/version.h>
18#include <linux/init.h>
19#include <linux/smp_lock.h>
20#include <linux/completion.h>
21#include <linux/delay.h>
22
23#include <net/irda/irda.h>
24
25#include "sir-dev.h"
26
27/**************************************************************************
28 *
29 * kIrDAd kernel thread and config state machine
30 *
31 */
32
33struct irda_request_queue {
34 struct list_head request_list;
35 spinlock_t lock;
36 task_t *thread;
37 struct completion exit;
38 wait_queue_head_t kick, done;
39 atomic_t num_pending;
40};
41
42static struct irda_request_queue irda_rq_queue;
43
44static int irda_queue_request(struct irda_request *rq)
45{
46 int ret = 0;
47 unsigned long flags;
48
49 if (!test_and_set_bit(0, &rq->pending)) {
50 spin_lock_irqsave(&irda_rq_queue.lock, flags);
51 list_add_tail(&rq->lh_request, &irda_rq_queue.request_list);
52 wake_up(&irda_rq_queue.kick);
53 atomic_inc(&irda_rq_queue.num_pending);
54 spin_unlock_irqrestore(&irda_rq_queue.lock, flags);
55 ret = 1;
56 }
57 return ret;
58}
59
60static void irda_request_timer(unsigned long data)
61{
62 struct irda_request *rq = (struct irda_request *)data;
63 unsigned long flags;
64
65 spin_lock_irqsave(&irda_rq_queue.lock, flags);
66 list_add_tail(&rq->lh_request, &irda_rq_queue.request_list);
67 wake_up(&irda_rq_queue.kick);
68 spin_unlock_irqrestore(&irda_rq_queue.lock, flags);
69}
70
71static int irda_queue_delayed_request(struct irda_request *rq, unsigned long delay)
72{
73 int ret = 0;
74 struct timer_list *timer = &rq->timer;
75
76 if (!test_and_set_bit(0, &rq->pending)) {
77 timer->expires = jiffies + delay;
78 timer->function = irda_request_timer;
79 timer->data = (unsigned long)rq;
80 atomic_inc(&irda_rq_queue.num_pending);
81 add_timer(timer);
82 ret = 1;
83 }
84 return ret;
85}
86
87static void run_irda_queue(void)
88{
89 unsigned long flags;
90 struct list_head *entry, *tmp;
91 struct irda_request *rq;
92
93 spin_lock_irqsave(&irda_rq_queue.lock, flags);
94 list_for_each_safe(entry, tmp, &irda_rq_queue.request_list) {
95 rq = list_entry(entry, struct irda_request, lh_request);
96 list_del_init(entry);
97 spin_unlock_irqrestore(&irda_rq_queue.lock, flags);
98
99 clear_bit(0, &rq->pending);
100 rq->func(rq->data);
101
102 if (atomic_dec_and_test(&irda_rq_queue.num_pending))
103 wake_up(&irda_rq_queue.done);
104
105 spin_lock_irqsave(&irda_rq_queue.lock, flags);
106 }
107 spin_unlock_irqrestore(&irda_rq_queue.lock, flags);
108}
109
110static int irda_thread(void *startup)
111{
112 DECLARE_WAITQUEUE(wait, current);
113
114 daemonize("kIrDAd");
115
116 irda_rq_queue.thread = current;
117
118 complete((struct completion *)startup);
119
120 while (irda_rq_queue.thread != NULL) {
121
122 /* We use TASK_INTERRUPTIBLE, rather than
123 * TASK_UNINTERRUPTIBLE. Andrew Morton made this
124 * change ; he told me that it is safe, because "signal
125 * blocking is now handled in daemonize()", he added
126 * that the problem is that "uninterruptible sleep
127 * contributes to load average", making user worry.
128 * Jean II */
129 set_task_state(current, TASK_INTERRUPTIBLE);
130 add_wait_queue(&irda_rq_queue.kick, &wait);
131 if (list_empty(&irda_rq_queue.request_list))
132 schedule();
133 else
134 __set_task_state(current, TASK_RUNNING);
135 remove_wait_queue(&irda_rq_queue.kick, &wait);
136
137 /* make swsusp happy with our thread */
138 try_to_freeze();
139
140 run_irda_queue();
141 }
142
143#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,35)
144 reparent_to_init();
145#endif
146 complete_and_exit(&irda_rq_queue.exit, 0);
147 /* never reached */
148 return 0;
149}
150
151
152static void flush_irda_queue(void)
153{
154 if (atomic_read(&irda_rq_queue.num_pending)) {
155
156 DECLARE_WAITQUEUE(wait, current);
157
158 if (!list_empty(&irda_rq_queue.request_list))
159 run_irda_queue();
160
161 set_task_state(current, TASK_UNINTERRUPTIBLE);
162 add_wait_queue(&irda_rq_queue.done, &wait);
163 if (atomic_read(&irda_rq_queue.num_pending))
164 schedule();
165 else
166 __set_task_state(current, TASK_RUNNING);
167 remove_wait_queue(&irda_rq_queue.done, &wait);
168 }
169}
170
171/* substate handler of the config-fsm to handle the cases where we want
172 * to wait for transmit completion before changing the port configuration
173 */
174
175static int irda_tx_complete_fsm(struct sir_dev *dev)
176{
177 struct sir_fsm *fsm = &dev->fsm;
178 unsigned next_state, delay;
179 unsigned bytes_left;
180
181 do {
182 next_state = fsm->substate; /* default: stay in current substate */
183 delay = 0;
184
185 switch(fsm->substate) {
186
187 case SIRDEV_STATE_WAIT_XMIT:
188 if (dev->drv->chars_in_buffer)
189 bytes_left = dev->drv->chars_in_buffer(dev);
190 else
191 bytes_left = 0;
192 if (!bytes_left) {
193 next_state = SIRDEV_STATE_WAIT_UNTIL_SENT;
194 break;
195 }
196
197 if (dev->speed > 115200)
198 delay = (bytes_left*8*10000) / (dev->speed/100);
199 else if (dev->speed > 0)
200 delay = (bytes_left*10*10000) / (dev->speed/100);
201 else
202 delay = 0;
203 /* expected delay (usec) until remaining bytes are sent */
204 if (delay < 100) {
205 udelay(delay);
206 delay = 0;
207 break;
208 }
209 /* sleep some longer delay (msec) */
210 delay = (delay+999) / 1000;
211 break;
212
213 case SIRDEV_STATE_WAIT_UNTIL_SENT:
214 /* block until underlaying hardware buffer are empty */
215 if (dev->drv->wait_until_sent)
216 dev->drv->wait_until_sent(dev);
217 next_state = SIRDEV_STATE_TX_DONE;
218 break;
219
220 case SIRDEV_STATE_TX_DONE:
221 return 0;
222
223 default:
224 IRDA_ERROR("%s - undefined state\n", __FUNCTION__);
225 return -EINVAL;
226 }
227 fsm->substate = next_state;
228 } while (delay == 0);
229 return delay;
230}
231
232/*
233 * Function irda_config_fsm
234 *
235 * State machine to handle the configuration of the device (and attached dongle, if any).
236 * This handler is scheduled for execution in kIrDAd context, so we can sleep.
237 * however, kIrDAd is shared by all sir_dev devices so we better don't sleep there too
238 * long. Instead, for longer delays we start a timer to reschedule us later.
239 * On entry, fsm->sem is always locked and the netdev xmit queue stopped.
240 * Both must be unlocked/restarted on completion - but only on final exit.
241 */
242
243static void irda_config_fsm(void *data)
244{
245 struct sir_dev *dev = data;
246 struct sir_fsm *fsm = &dev->fsm;
247 int next_state;
248 int ret = -1;
249 unsigned delay;
250
251 IRDA_DEBUG(2, "%s(), <%ld>\n", __FUNCTION__, jiffies);
252
253 do {
254 IRDA_DEBUG(3, "%s - state=0x%04x / substate=0x%04x\n",
255 __FUNCTION__, fsm->state, fsm->substate);
256
257 next_state = fsm->state;
258 delay = 0;
259
260 switch(fsm->state) {
261
262 case SIRDEV_STATE_DONGLE_OPEN:
263 if (dev->dongle_drv != NULL) {
264 ret = sirdev_put_dongle(dev);
265 if (ret) {
266 fsm->result = -EINVAL;
267 next_state = SIRDEV_STATE_ERROR;
268 break;
269 }
270 }
271
272 /* Initialize dongle */
273 ret = sirdev_get_dongle(dev, fsm->param);
274 if (ret) {
275 fsm->result = ret;
276 next_state = SIRDEV_STATE_ERROR;
277 break;
278 }
279
280 /* Dongles are powered through the modem control lines which
281 * were just set during open. Before resetting, let's wait for
282 * the power to stabilize. This is what some dongle drivers did
283 * in open before, while others didn't - should be safe anyway.
284 */
285
286 delay = 50;
287 fsm->substate = SIRDEV_STATE_DONGLE_RESET;
288 next_state = SIRDEV_STATE_DONGLE_RESET;
289
290 fsm->param = 9600;
291
292 break;
293
294 case SIRDEV_STATE_DONGLE_CLOSE:
295 /* shouldn't we just treat this as success=? */
296 if (dev->dongle_drv == NULL) {
297 fsm->result = -EINVAL;
298 next_state = SIRDEV_STATE_ERROR;
299 break;
300 }
301
302 ret = sirdev_put_dongle(dev);
303 if (ret) {
304 fsm->result = ret;
305 next_state = SIRDEV_STATE_ERROR;
306 break;
307 }
308 next_state = SIRDEV_STATE_DONE;
309 break;
310
311 case SIRDEV_STATE_SET_DTR_RTS:
312 ret = sirdev_set_dtr_rts(dev,
313 (fsm->param&0x02) ? TRUE : FALSE,
314 (fsm->param&0x01) ? TRUE : FALSE);
315 next_state = SIRDEV_STATE_DONE;
316 break;
317
318 case SIRDEV_STATE_SET_SPEED:
319 fsm->substate = SIRDEV_STATE_WAIT_XMIT;
320 next_state = SIRDEV_STATE_DONGLE_CHECK;
321 break;
322
323 case SIRDEV_STATE_DONGLE_CHECK:
324 ret = irda_tx_complete_fsm(dev);
325 if (ret < 0) {
326 fsm->result = ret;
327 next_state = SIRDEV_STATE_ERROR;
328 break;
329 }
330 if ((delay=ret) != 0)
331 break;
332
333 if (dev->dongle_drv) {
334 fsm->substate = SIRDEV_STATE_DONGLE_RESET;
335 next_state = SIRDEV_STATE_DONGLE_RESET;
336 }
337 else {
338 dev->speed = fsm->param;
339 next_state = SIRDEV_STATE_PORT_SPEED;
340 }
341 break;
342
343 case SIRDEV_STATE_DONGLE_RESET:
344 if (dev->dongle_drv->reset) {
345 ret = dev->dongle_drv->reset(dev);
346 if (ret < 0) {
347 fsm->result = ret;
348 next_state = SIRDEV_STATE_ERROR;
349 break;
350 }
351 }
352 else
353 ret = 0;
354 if ((delay=ret) == 0) {
355 /* set serial port according to dongle default speed */
356 if (dev->drv->set_speed)
357 dev->drv->set_speed(dev, dev->speed);
358 fsm->substate = SIRDEV_STATE_DONGLE_SPEED;
359 next_state = SIRDEV_STATE_DONGLE_SPEED;
360 }
361 break;
362
363 case SIRDEV_STATE_DONGLE_SPEED:
364 if (dev->dongle_drv->reset) {
365 ret = dev->dongle_drv->set_speed(dev, fsm->param);
366 if (ret < 0) {
367 fsm->result = ret;
368 next_state = SIRDEV_STATE_ERROR;
369 break;
370 }
371 }
372 else
373 ret = 0;
374 if ((delay=ret) == 0)
375 next_state = SIRDEV_STATE_PORT_SPEED;
376 break;
377
378 case SIRDEV_STATE_PORT_SPEED:
379 /* Finally we are ready to change the serial port speed */
380 if (dev->drv->set_speed)
381 dev->drv->set_speed(dev, dev->speed);
382 dev->new_speed = 0;
383 next_state = SIRDEV_STATE_DONE;
384 break;
385
386 case SIRDEV_STATE_DONE:
387 /* Signal network layer so it can send more frames */
388 netif_wake_queue(dev->netdev);
389 next_state = SIRDEV_STATE_COMPLETE;
390 break;
391
392 default:
393 IRDA_ERROR("%s - undefined state\n", __FUNCTION__);
394 fsm->result = -EINVAL;
395 /* fall thru */
396
397 case SIRDEV_STATE_ERROR:
398 IRDA_ERROR("%s - error: %d\n", __FUNCTION__, fsm->result);
399
400#if 0 /* don't enable this before we have netdev->tx_timeout to recover */
401 netif_stop_queue(dev->netdev);
402#else
403 netif_wake_queue(dev->netdev);
404#endif
405 /* fall thru */
406
407 case SIRDEV_STATE_COMPLETE:
408 /* config change finished, so we are not busy any longer */
409 sirdev_enable_rx(dev);
410 up(&fsm->sem);
411 return;
412 }
413 fsm->state = next_state;
414 } while(!delay);
415
416 irda_queue_delayed_request(&fsm->rq, msecs_to_jiffies(delay));
417}
418
419/* schedule some device configuration task for execution by kIrDAd
420 * on behalf of the above state machine.
421 * can be called from process or interrupt/tasklet context.
422 */
423
424int sirdev_schedule_request(struct sir_dev *dev, int initial_state, unsigned param)
425{
426 struct sir_fsm *fsm = &dev->fsm;
427 int xmit_was_down;
428
429 IRDA_DEBUG(2, "%s - state=0x%04x / param=%u\n", __FUNCTION__, initial_state, param);
430
431 if (down_trylock(&fsm->sem)) {
432 if (in_interrupt() || in_atomic() || irqs_disabled()) {
433 IRDA_DEBUG(1, "%s(), state machine busy!\n", __FUNCTION__);
434 return -EWOULDBLOCK;
435 } else
436 down(&fsm->sem);
437 }
438
439 if (fsm->state == SIRDEV_STATE_DEAD) {
440 /* race with sirdev_close should never happen */
441 IRDA_ERROR("%s(), instance staled!\n", __FUNCTION__);
442 up(&fsm->sem);
443 return -ESTALE; /* or better EPIPE? */
444 }
445
446 xmit_was_down = netif_queue_stopped(dev->netdev);
447 netif_stop_queue(dev->netdev);
448 atomic_set(&dev->enable_rx, 0);
449
450 fsm->state = initial_state;
451 fsm->param = param;
452 fsm->result = 0;
453
454 INIT_LIST_HEAD(&fsm->rq.lh_request);
455 fsm->rq.pending = 0;
456 fsm->rq.func = irda_config_fsm;
457 fsm->rq.data = dev;
458
459 if (!irda_queue_request(&fsm->rq)) { /* returns 0 on error! */
460 atomic_set(&dev->enable_rx, 1);
461 if (!xmit_was_down)
462 netif_wake_queue(dev->netdev);
463 up(&fsm->sem);
464 return -EAGAIN;
465 }
466 return 0;
467}
468
469static int __init irda_thread_create(void)
470{
471 struct completion startup;
472 int pid;
473
474 spin_lock_init(&irda_rq_queue.lock);
475 irda_rq_queue.thread = NULL;
476 INIT_LIST_HEAD(&irda_rq_queue.request_list);
477 init_waitqueue_head(&irda_rq_queue.kick);
478 init_waitqueue_head(&irda_rq_queue.done);
479 atomic_set(&irda_rq_queue.num_pending, 0);
480
481 init_completion(&startup);
482 pid = kernel_thread(irda_thread, &startup, CLONE_FS|CLONE_FILES);
483 if (pid <= 0)
484 return -EAGAIN;
485 else
486 wait_for_completion(&startup);
487
488 return 0;
489}
490
491static void __exit irda_thread_join(void)
492{
493 if (irda_rq_queue.thread) {
494 flush_irda_queue();
495 init_completion(&irda_rq_queue.exit);
496 irda_rq_queue.thread = NULL;
497 wake_up(&irda_rq_queue.kick);
498 wait_for_completion(&irda_rq_queue.exit);
499 }
500}
501
502module_init(irda_thread_create);
503module_exit(irda_thread_join);
504
505MODULE_AUTHOR("Martin Diehl <info@mdiehl.de>");
506MODULE_DESCRIPTION("IrDA SIR core");
507MODULE_LICENSE("GPL");
508
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c
index 58f76cefbc83..a4674044bd6f 100644
--- a/drivers/net/irda/smsc-ircc2.c
+++ b/drivers/net/irda/smsc-ircc2.c
@@ -54,6 +54,7 @@
54#include <linux/rtnetlink.h> 54#include <linux/rtnetlink.h>
55#include <linux/serial_reg.h> 55#include <linux/serial_reg.h>
56#include <linux/dma-mapping.h> 56#include <linux/dma-mapping.h>
57#include <linux/pnp.h>
57#include <linux/platform_device.h> 58#include <linux/platform_device.h>
58 59
59#include <asm/io.h> 60#include <asm/io.h>
@@ -358,6 +359,16 @@ static inline void register_bank(int iobase, int bank)
358 iobase + IRCC_MASTER); 359 iobase + IRCC_MASTER);
359} 360}
360 361
362#ifdef CONFIG_PNP
363/* PNP hotplug support */
364static const struct pnp_device_id smsc_ircc_pnp_table[] = {
365 { .id = "SMCf010", .driver_data = 0 },
366 /* and presumably others */
367 { }
368};
369MODULE_DEVICE_TABLE(pnp, smsc_ircc_pnp_table);
370#endif
371
361 372
362/******************************************************************************* 373/*******************************************************************************
363 * 374 *
@@ -2072,7 +2083,8 @@ static void smsc_ircc_sir_wait_hw_transmitter_finish(struct smsc_ircc_cb *self)
2072 2083
2073/* PROBING 2084/* PROBING
2074 * 2085 *
2075 * 2086 * REVISIT we can be told about the device by PNP, and should use that info
2087 * instead of probing hardware and creating a platform_device ...
2076 */ 2088 */
2077 2089
2078static int __init smsc_ircc_look_for_chips(void) 2090static int __init smsc_ircc_look_for_chips(void)
diff --git a/drivers/net/ne.c b/drivers/net/ne.c
index 93c494bcd18d..b32765215f75 100644
--- a/drivers/net/ne.c
+++ b/drivers/net/ne.c
@@ -139,8 +139,9 @@ bad_clone_list[] __initdata = {
139 139
140#if defined(CONFIG_PLAT_MAPPI) 140#if defined(CONFIG_PLAT_MAPPI)
141# define DCR_VAL 0x4b 141# define DCR_VAL 0x4b
142#elif defined(CONFIG_PLAT_OAKS32R) 142#elif defined(CONFIG_PLAT_OAKS32R) || \
143# define DCR_VAL 0x48 143 defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
144# define DCR_VAL 0x48 /* 8-bit mode */
144#else 145#else
145# define DCR_VAL 0x49 146# define DCR_VAL 0x49
146#endif 147#endif
@@ -396,10 +397,22 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
396 /* We must set the 8390 for word mode. */ 397 /* We must set the 8390 for word mode. */
397 outb_p(DCR_VAL, ioaddr + EN0_DCFG); 398 outb_p(DCR_VAL, ioaddr + EN0_DCFG);
398 start_page = NESM_START_PG; 399 start_page = NESM_START_PG;
399 stop_page = NESM_STOP_PG; 400
401 /*
402 * Realtek RTL8019AS datasheet says that the PSTOP register
403 * shouldn't exceed 0x60 in 8-bit mode.
404 * This chip can be identified by reading the signature from
405 * the remote byte count registers (otherwise write-only)...
406 */
407 if ((DCR_VAL & 0x01) == 0 && /* 8-bit mode */
408 inb(ioaddr + EN0_RCNTLO) == 0x50 &&
409 inb(ioaddr + EN0_RCNTHI) == 0x70)
410 stop_page = 0x60;
411 else
412 stop_page = NESM_STOP_PG;
400 } else { 413 } else {
401 start_page = NE1SM_START_PG; 414 start_page = NE1SM_START_PG;
402 stop_page = NE1SM_STOP_PG; 415 stop_page = NE1SM_STOP_PG;
403 } 416 }
404 417
405#if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R) 418#if defined(CONFIG_PLAT_MAPPI) || defined(CONFIG_PLAT_OAKS32R)
@@ -509,15 +522,9 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
509 ei_status.name = name; 522 ei_status.name = name;
510 ei_status.tx_start_page = start_page; 523 ei_status.tx_start_page = start_page;
511 ei_status.stop_page = stop_page; 524 ei_status.stop_page = stop_page;
512#if defined(CONFIG_TOSHIBA_RBTX4927) || defined(CONFIG_TOSHIBA_RBTX4938)
513 wordlength = 1;
514#endif
515 525
516#ifdef CONFIG_PLAT_OAKS32R 526 /* Use 16-bit mode only if this wasn't overridden by DCR_VAL */
517 ei_status.word16 = 0; 527 ei_status.word16 = (wordlength == 2 && (DCR_VAL & 0x01));
518#else
519 ei_status.word16 = (wordlength == 2);
520#endif
521 528
522 ei_status.rx_start_page = start_page + TX_PAGES; 529 ei_status.rx_start_page = start_page + TX_PAGES;
523#ifdef PACKETBUF_MEMSIZE 530#ifdef PACKETBUF_MEMSIZE
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 459443b572ce..1b236bdf6b92 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -60,8 +60,10 @@ int mdiobus_register(struct mii_bus *bus)
60 for (i = 0; i < PHY_MAX_ADDR; i++) { 60 for (i = 0; i < PHY_MAX_ADDR; i++) {
61 struct phy_device *phydev; 61 struct phy_device *phydev;
62 62
63 if (bus->phy_mask & (1 << i)) 63 if (bus->phy_mask & (1 << i)) {
64 bus->phy_map[i] = NULL;
64 continue; 65 continue;
66 }
65 67
66 phydev = get_phy_device(bus, i); 68 phydev = get_phy_device(bus, i);
67 69
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index b82191d2bee1..f5a3bf4d959a 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -127,6 +127,7 @@ static const struct mii_chip_info {
127} mii_chip_table[] = { 127} mii_chip_table[] = {
128 { "SiS 900 Internal MII PHY", 0x001d, 0x8000, LAN }, 128 { "SiS 900 Internal MII PHY", 0x001d, 0x8000, LAN },
129 { "SiS 7014 Physical Layer Solution", 0x0016, 0xf830, LAN }, 129 { "SiS 7014 Physical Layer Solution", 0x0016, 0xf830, LAN },
130 { "SiS 900 on Foxconn 661 7MI", 0x0143, 0xBC70, LAN },
130 { "Altimata AC101LF PHY", 0x0022, 0x5520, LAN }, 131 { "Altimata AC101LF PHY", 0x0022, 0x5520, LAN },
131 { "ADM 7001 LAN PHY", 0x002e, 0xcc60, LAN }, 132 { "ADM 7001 LAN PHY", 0x002e, 0xcc60, LAN },
132 { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN }, 133 { "AMD 79C901 10BASE-T PHY", 0x0000, 0x6B70, LAN },
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 227df9876a2c..ffd267fab21d 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -51,7 +51,7 @@
51#include "sky2.h" 51#include "sky2.h"
52 52
53#define DRV_NAME "sky2" 53#define DRV_NAME "sky2"
54#define DRV_VERSION "1.2" 54#define DRV_VERSION "1.3"
55#define PFX DRV_NAME " " 55#define PFX DRV_NAME " "
56 56
57/* 57/*
@@ -79,6 +79,8 @@
79#define NAPI_WEIGHT 64 79#define NAPI_WEIGHT 64
80#define PHY_RETRIES 1000 80#define PHY_RETRIES 1000
81 81
82#define RING_NEXT(x,s) (((x)+1) & ((s)-1))
83
82static const u32 default_msg = 84static const u32 default_msg =
83 NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK 85 NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK
84 | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR 86 | NETIF_MSG_TIMER | NETIF_MSG_TX_ERR | NETIF_MSG_RX_ERR
@@ -96,6 +98,10 @@ static int disable_msi = 0;
96module_param(disable_msi, int, 0); 98module_param(disable_msi, int, 0);
97MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); 99MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
98 100
101static int idle_timeout = 100;
102module_param(idle_timeout, int, 0);
103MODULE_PARM_DESC(idle_timeout, "Idle timeout workaround for lost interrupts (ms)");
104
99static const struct pci_device_id sky2_id_table[] = { 105static const struct pci_device_id sky2_id_table[] = {
100 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, 106 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) },
101 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, 107 { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) },
@@ -122,6 +128,7 @@ MODULE_DEVICE_TABLE(pci, sky2_id_table);
122/* Avoid conditionals by using array */ 128/* Avoid conditionals by using array */
123static const unsigned txqaddr[] = { Q_XA1, Q_XA2 }; 129static const unsigned txqaddr[] = { Q_XA1, Q_XA2 };
124static const unsigned rxqaddr[] = { Q_R1, Q_R2 }; 130static const unsigned rxqaddr[] = { Q_R1, Q_R2 };
131static const u32 portirq_msk[] = { Y2_IS_PORT_1, Y2_IS_PORT_2 };
125 132
126/* This driver supports yukon2 chipset only */ 133/* This driver supports yukon2 chipset only */
127static const char *yukon2_name[] = { 134static const char *yukon2_name[] = {
@@ -298,7 +305,8 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
298 struct sky2_port *sky2 = netdev_priv(hw->dev[port]); 305 struct sky2_port *sky2 = netdev_priv(hw->dev[port]);
299 u16 ctrl, ct1000, adv, pg, ledctrl, ledover; 306 u16 ctrl, ct1000, adv, pg, ledctrl, ledover;
300 307
301 if (sky2->autoneg == AUTONEG_ENABLE && hw->chip_id != CHIP_ID_YUKON_XL) { 308 if (sky2->autoneg == AUTONEG_ENABLE &&
309 (hw->chip_id != CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) {
302 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL); 310 u16 ectrl = gm_phy_read(hw, port, PHY_MARV_EXT_CTRL);
303 311
304 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK | 312 ectrl &= ~(PHY_M_EC_M_DSC_MSK | PHY_M_EC_S_DSC_MSK |
@@ -326,7 +334,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
326 ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO); 334 ctrl |= PHY_M_PC_MDI_XMODE(PHY_M_PC_ENA_AUTO);
327 335
328 if (sky2->autoneg == AUTONEG_ENABLE && 336 if (sky2->autoneg == AUTONEG_ENABLE &&
329 hw->chip_id == CHIP_ID_YUKON_XL) { 337 (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)) {
330 ctrl &= ~PHY_M_PC_DSC_MSK; 338 ctrl &= ~PHY_M_PC_DSC_MSK;
331 ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA; 339 ctrl |= PHY_M_PC_DSC(2) | PHY_M_PC_DOWN_S_ENA;
332 } 340 }
@@ -442,10 +450,11 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
442 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 450 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
443 451
444 /* set LED Function Control register */ 452 /* set LED Function Control register */
445 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */ 453 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL,
446 PHY_M_LEDC_INIT_CTRL(7) | /* 10 Mbps */ 454 (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
447 PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */ 455 PHY_M_LEDC_INIT_CTRL(7) | /* 10 Mbps */
448 PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */ 456 PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */
457 PHY_M_LEDC_STA0_CTRL(7))); /* 1000 Mbps */
449 458
450 /* set Polarity Control register */ 459 /* set Polarity Control register */
451 gm_phy_write(hw, port, PHY_MARV_PHY_STAT, 460 gm_phy_write(hw, port, PHY_MARV_PHY_STAT,
@@ -459,6 +468,25 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
459 /* restore page register */ 468 /* restore page register */
460 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 469 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
461 break; 470 break;
471 case CHIP_ID_YUKON_EC_U:
472 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
473
474 /* select page 3 to access LED control register */
475 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
476
477 /* set LED Function Control register */
478 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL,
479 (PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */
480 PHY_M_LEDC_INIT_CTRL(8) | /* 10 Mbps */
481 PHY_M_LEDC_STA1_CTRL(7) | /* 100 Mbps */
482 PHY_M_LEDC_STA0_CTRL(7)));/* 1000 Mbps */
483
484 /* set Blink Rate in LED Timer Control Register */
485 gm_phy_write(hw, port, PHY_MARV_INT_MASK,
486 ledctrl | PHY_M_LED_BLINK_RT(BLINK_84MS));
487 /* restore page register */
488 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
489 break;
462 490
463 default: 491 default:
464 /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */ 492 /* set Tx LED (LED_TX) to blink mode on Rx OR Tx activity */
@@ -467,19 +495,21 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port)
467 ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); 495 ledover |= PHY_M_LED_MO_RX(MO_LED_OFF);
468 } 496 }
469 497
470 if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) { 498 if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) {
471 /* apply fixes in PHY AFE */ 499 /* apply fixes in PHY AFE */
472 gm_phy_write(hw, port, 22, 255); 500 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
501 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255);
502
473 /* increase differential signal amplitude in 10BASE-T */ 503 /* increase differential signal amplitude in 10BASE-T */
474 gm_phy_write(hw, port, 24, 0xaa99); 504 gm_phy_write(hw, port, 0x18, 0xaa99);
475 gm_phy_write(hw, port, 23, 0x2011); 505 gm_phy_write(hw, port, 0x17, 0x2011);
476 506
477 /* fix for IEEE A/B Symmetry failure in 1000BASE-T */ 507 /* fix for IEEE A/B Symmetry failure in 1000BASE-T */
478 gm_phy_write(hw, port, 24, 0xa204); 508 gm_phy_write(hw, port, 0x18, 0xa204);
479 gm_phy_write(hw, port, 23, 0x2002); 509 gm_phy_write(hw, port, 0x17, 0x2002);
480 510
481 /* set page register to 0 */ 511 /* set page register to 0 */
482 gm_phy_write(hw, port, 22, 0); 512 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
483 } else { 513 } else {
484 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); 514 gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl);
485 515
@@ -553,6 +583,11 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
553 583
554 if (sky2->duplex == DUPLEX_FULL) 584 if (sky2->duplex == DUPLEX_FULL)
555 reg |= GM_GPCR_DUP_FULL; 585 reg |= GM_GPCR_DUP_FULL;
586
587 /* turn off pause in 10/100mbps half duplex */
588 else if (sky2->speed != SPEED_1000 &&
589 hw->chip_id != CHIP_ID_YUKON_EC_U)
590 sky2->tx_pause = sky2->rx_pause = 0;
556 } else 591 } else
557 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL; 592 reg = GM_GPCR_SPEED_1000 | GM_GPCR_SPEED_100 | GM_GPCR_DUP_FULL;
558 593
@@ -719,7 +754,7 @@ static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2)
719{ 754{
720 struct sky2_tx_le *le = sky2->tx_le + sky2->tx_prod; 755 struct sky2_tx_le *le = sky2->tx_le + sky2->tx_prod;
721 756
722 sky2->tx_prod = (sky2->tx_prod + 1) % TX_RING_SIZE; 757 sky2->tx_prod = RING_NEXT(sky2->tx_prod, TX_RING_SIZE);
723 return le; 758 return le;
724} 759}
725 760
@@ -735,7 +770,7 @@ static inline void sky2_put_idx(struct sky2_hw *hw, unsigned q, u16 idx)
735static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2) 770static inline struct sky2_rx_le *sky2_next_rx(struct sky2_port *sky2)
736{ 771{
737 struct sky2_rx_le *le = sky2->rx_le + sky2->rx_put; 772 struct sky2_rx_le *le = sky2->rx_le + sky2->rx_put;
738 sky2->rx_put = (sky2->rx_put + 1) % RX_LE_SIZE; 773 sky2->rx_put = RING_NEXT(sky2->rx_put, RX_LE_SIZE);
739 return le; 774 return le;
740} 775}
741 776
@@ -1050,7 +1085,7 @@ static int sky2_up(struct net_device *dev)
1050 1085
1051 /* Enable interrupts from phy/mac for port */ 1086 /* Enable interrupts from phy/mac for port */
1052 imask = sky2_read32(hw, B0_IMSK); 1087 imask = sky2_read32(hw, B0_IMSK);
1053 imask |= (port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2; 1088 imask |= portirq_msk[port];
1054 sky2_write32(hw, B0_IMSK, imask); 1089 sky2_write32(hw, B0_IMSK, imask);
1055 1090
1056 return 0; 1091 return 0;
@@ -1078,7 +1113,7 @@ err_out:
1078/* Modular subtraction in ring */ 1113/* Modular subtraction in ring */
1079static inline int tx_dist(unsigned tail, unsigned head) 1114static inline int tx_dist(unsigned tail, unsigned head)
1080{ 1115{
1081 return (head - tail) % TX_RING_SIZE; 1116 return (head - tail) & (TX_RING_SIZE - 1);
1082} 1117}
1083 1118
1084/* Number of list elements available for next tx */ 1119/* Number of list elements available for next tx */
@@ -1255,7 +1290,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1255 le->opcode = OP_BUFFER | HW_OWNER; 1290 le->opcode = OP_BUFFER | HW_OWNER;
1256 1291
1257 fre = sky2->tx_ring 1292 fre = sky2->tx_ring
1258 + ((re - sky2->tx_ring) + i + 1) % TX_RING_SIZE; 1293 + RING_NEXT((re - sky2->tx_ring) + i, TX_RING_SIZE);
1259 pci_unmap_addr_set(fre, mapaddr, mapping); 1294 pci_unmap_addr_set(fre, mapaddr, mapping);
1260 } 1295 }
1261 1296
@@ -1315,7 +1350,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
1315 1350
1316 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1351 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1317 struct tx_ring_info *fre; 1352 struct tx_ring_info *fre;
1318 fre = sky2->tx_ring + (put + i + 1) % TX_RING_SIZE; 1353 fre = sky2->tx_ring + RING_NEXT(put + i, TX_RING_SIZE);
1319 pci_unmap_page(pdev, pci_unmap_addr(fre, mapaddr), 1354 pci_unmap_page(pdev, pci_unmap_addr(fre, mapaddr),
1320 skb_shinfo(skb)->frags[i].size, 1355 skb_shinfo(skb)->frags[i].size,
1321 PCI_DMA_TODEVICE); 1356 PCI_DMA_TODEVICE);
@@ -1401,7 +1436,7 @@ static int sky2_down(struct net_device *dev)
1401 1436
1402 /* Disable port IRQ */ 1437 /* Disable port IRQ */
1403 imask = sky2_read32(hw, B0_IMSK); 1438 imask = sky2_read32(hw, B0_IMSK);
1404 imask &= ~(sky2->port == 0) ? Y2_IS_PORT_1 : Y2_IS_PORT_2; 1439 imask &= ~portirq_msk[port];
1405 sky2_write32(hw, B0_IMSK, imask); 1440 sky2_write32(hw, B0_IMSK, imask);
1406 1441
1407 /* turn off LED's */ 1442 /* turn off LED's */
@@ -1498,17 +1533,26 @@ static void sky2_link_up(struct sky2_port *sky2)
1498 sky2_write8(hw, SK_REG(port, LNK_LED_REG), 1533 sky2_write8(hw, SK_REG(port, LNK_LED_REG),
1499 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF); 1534 LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
1500 1535
1501 if (hw->chip_id == CHIP_ID_YUKON_XL) { 1536 if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U) {
1502 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); 1537 u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
1538 u16 led = PHY_M_LEDC_LOS_CTRL(1); /* link active */
1539
1540 switch(sky2->speed) {
1541 case SPEED_10:
1542 led |= PHY_M_LEDC_INIT_CTRL(7);
1543 break;
1544
1545 case SPEED_100:
1546 led |= PHY_M_LEDC_STA1_CTRL(7);
1547 break;
1548
1549 case SPEED_1000:
1550 led |= PHY_M_LEDC_STA0_CTRL(7);
1551 break;
1552 }
1503 1553
1504 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3); 1554 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
1505 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, PHY_M_LEDC_LOS_CTRL(1) | /* LINK/ACT */ 1555 gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, led);
1506 PHY_M_LEDC_INIT_CTRL(sky2->speed ==
1507 SPEED_10 ? 7 : 0) |
1508 PHY_M_LEDC_STA1_CTRL(sky2->speed ==
1509 SPEED_100 ? 7 : 0) |
1510 PHY_M_LEDC_STA0_CTRL(sky2->speed ==
1511 SPEED_1000 ? 7 : 0));
1512 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); 1556 gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
1513 } 1557 }
1514 1558
@@ -1583,7 +1627,7 @@ static int sky2_autoneg_done(struct sky2_port *sky2, u16 aux)
1583 sky2->speed = sky2_phy_speed(hw, aux); 1627 sky2->speed = sky2_phy_speed(hw, aux);
1584 1628
1585 /* Pause bits are offset (9..8) */ 1629 /* Pause bits are offset (9..8) */
1586 if (hw->chip_id == CHIP_ID_YUKON_XL) 1630 if (hw->chip_id == CHIP_ID_YUKON_XL || hw->chip_id == CHIP_ID_YUKON_EC_U)
1587 aux >>= 6; 1631 aux >>= 6;
1588 1632
1589 sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0; 1633 sky2->rx_pause = (aux & PHY_M_PS_RX_P_EN) != 0;
@@ -1859,35 +1903,28 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
1859static int sky2_status_intr(struct sky2_hw *hw, int to_do) 1903static int sky2_status_intr(struct sky2_hw *hw, int to_do)
1860{ 1904{
1861 int work_done = 0; 1905 int work_done = 0;
1906 u16 hwidx = sky2_read16(hw, STAT_PUT_IDX);
1862 1907
1863 rmb(); 1908 rmb();
1864 1909
1865 for(;;) { 1910 while (hw->st_idx != hwidx) {
1866 struct sky2_status_le *le = hw->st_le + hw->st_idx; 1911 struct sky2_status_le *le = hw->st_le + hw->st_idx;
1867 struct net_device *dev; 1912 struct net_device *dev;
1868 struct sky2_port *sky2; 1913 struct sky2_port *sky2;
1869 struct sk_buff *skb; 1914 struct sk_buff *skb;
1870 u32 status; 1915 u32 status;
1871 u16 length; 1916 u16 length;
1872 u8 link, opcode;
1873 1917
1874 opcode = le->opcode; 1918 hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
1875 if (!opcode)
1876 break;
1877 opcode &= ~HW_OWNER;
1878
1879 hw->st_idx = (hw->st_idx + 1) % STATUS_RING_SIZE;
1880 le->opcode = 0;
1881 1919
1882 link = le->link; 1920 BUG_ON(le->link >= 2);
1883 BUG_ON(link >= 2); 1921 dev = hw->dev[le->link];
1884 dev = hw->dev[link];
1885 1922
1886 sky2 = netdev_priv(dev); 1923 sky2 = netdev_priv(dev);
1887 length = le->length; 1924 length = le->length;
1888 status = le->status; 1925 status = le->status;
1889 1926
1890 switch (opcode) { 1927 switch (le->opcode & ~HW_OWNER) {
1891 case OP_RXSTAT: 1928 case OP_RXSTAT:
1892 skb = sky2_receive(sky2, length, status); 1929 skb = sky2_receive(sky2, length, status);
1893 if (!skb) 1930 if (!skb)
@@ -1927,7 +1964,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
1927 1964
1928 case OP_TXINDEXLE: 1965 case OP_TXINDEXLE:
1929 /* TX index reports status for both ports */ 1966 /* TX index reports status for both ports */
1930 sky2_tx_done(hw->dev[0], status & 0xffff); 1967 BUILD_BUG_ON(TX_RING_SIZE > 0x1000);
1968 sky2_tx_done(hw->dev[0], status & 0xfff);
1931 if (hw->dev[1]) 1969 if (hw->dev[1])
1932 sky2_tx_done(hw->dev[1], 1970 sky2_tx_done(hw->dev[1],
1933 ((status >> 24) & 0xff) 1971 ((status >> 24) & 0xff)
@@ -1937,8 +1975,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do)
1937 default: 1975 default:
1938 if (net_ratelimit()) 1976 if (net_ratelimit())
1939 printk(KERN_WARNING PFX 1977 printk(KERN_WARNING PFX
1940 "unknown status opcode 0x%x\n", opcode); 1978 "unknown status opcode 0x%x\n", le->opcode);
1941 break; 1979 goto exit_loop;
1942 } 1980 }
1943 } 1981 }
1944 1982
@@ -2089,12 +2127,13 @@ static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port,
2089 */ 2127 */
2090static void sky2_idle(unsigned long arg) 2128static void sky2_idle(unsigned long arg)
2091{ 2129{
2092 struct net_device *dev = (struct net_device *) arg; 2130 struct sky2_hw *hw = (struct sky2_hw *) arg;
2131 struct net_device *dev = hw->dev[0];
2093 2132
2094 local_irq_disable();
2095 if (__netif_rx_schedule_prep(dev)) 2133 if (__netif_rx_schedule_prep(dev))
2096 __netif_rx_schedule(dev); 2134 __netif_rx_schedule(dev);
2097 local_irq_enable(); 2135
2136 mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout));
2098} 2137}
2099 2138
2100 2139
@@ -2105,65 +2144,46 @@ static int sky2_poll(struct net_device *dev0, int *budget)
2105 int work_done = 0; 2144 int work_done = 0;
2106 u32 status = sky2_read32(hw, B0_Y2_SP_EISR); 2145 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2107 2146
2108 restart_poll: 2147 if (status & Y2_IS_HW_ERR)
2109 if (unlikely(status & ~Y2_IS_STAT_BMU)) { 2148 sky2_hw_intr(hw);
2110 if (status & Y2_IS_HW_ERR)
2111 sky2_hw_intr(hw);
2112
2113 if (status & Y2_IS_IRQ_PHY1)
2114 sky2_phy_intr(hw, 0);
2115
2116 if (status & Y2_IS_IRQ_PHY2)
2117 sky2_phy_intr(hw, 1);
2118 2149
2119 if (status & Y2_IS_IRQ_MAC1) 2150 if (status & Y2_IS_IRQ_PHY1)
2120 sky2_mac_intr(hw, 0); 2151 sky2_phy_intr(hw, 0);
2121 2152
2122 if (status & Y2_IS_IRQ_MAC2) 2153 if (status & Y2_IS_IRQ_PHY2)
2123 sky2_mac_intr(hw, 1); 2154 sky2_phy_intr(hw, 1);
2124 2155
2125 if (status & Y2_IS_CHK_RX1) 2156 if (status & Y2_IS_IRQ_MAC1)
2126 sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); 2157 sky2_mac_intr(hw, 0);
2127 2158
2128 if (status & Y2_IS_CHK_RX2) 2159 if (status & Y2_IS_IRQ_MAC2)
2129 sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); 2160 sky2_mac_intr(hw, 1);
2130 2161
2131 if (status & Y2_IS_CHK_TXA1) 2162 if (status & Y2_IS_CHK_RX1)
2132 sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); 2163 sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1);
2133 2164
2134 if (status & Y2_IS_CHK_TXA2) 2165 if (status & Y2_IS_CHK_RX2)
2135 sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); 2166 sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2);
2136 }
2137 2167
2138 if (status & Y2_IS_STAT_BMU) { 2168 if (status & Y2_IS_CHK_TXA1)
2139 work_done += sky2_status_intr(hw, work_limit - work_done); 2169 sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1);
2140 *budget -= work_done;
2141 dev0->quota -= work_done;
2142 2170
2143 if (work_done >= work_limit) 2171 if (status & Y2_IS_CHK_TXA2)
2144 return 1; 2172 sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2);
2145 2173
2174 if (status & Y2_IS_STAT_BMU)
2146 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); 2175 sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
2147 }
2148
2149 mod_timer(&hw->idle_timer, jiffies + HZ);
2150 2176
2151 local_irq_disable(); 2177 work_done = sky2_status_intr(hw, work_limit);
2152 __netif_rx_complete(dev0); 2178 *budget -= work_done;
2179 dev0->quota -= work_done;
2153 2180
2154 status = sky2_read32(hw, B0_Y2_SP_LISR); 2181 if (work_done >= work_limit)
2182 return 1;
2155 2183
2156 if (unlikely(status)) { 2184 netif_rx_complete(dev0);
2157 /* More work pending, try and keep going */
2158 if (__netif_rx_schedule_prep(dev0)) {
2159 __netif_rx_reschedule(dev0, work_done);
2160 status = sky2_read32(hw, B0_Y2_SP_EISR);
2161 local_irq_enable();
2162 goto restart_poll;
2163 }
2164 }
2165 2185
2166 local_irq_enable(); 2186 status = sky2_read32(hw, B0_Y2_SP_LISR);
2167 return 0; 2187 return 0;
2168} 2188}
2169 2189
@@ -2244,13 +2264,6 @@ static int __devinit sky2_reset(struct sky2_hw *hw)
2244 return -EOPNOTSUPP; 2264 return -EOPNOTSUPP;
2245 } 2265 }
2246 2266
2247 /* This chip is new and not tested yet */
2248 if (hw->chip_id == CHIP_ID_YUKON_EC_U) {
2249 pr_info(PFX "%s: is a version of Yukon 2 chipset that has not been tested yet.\n",
2250 pci_name(hw->pdev));
2251 pr_info("Please report success/failure to maintainer <shemminger@osdl.org>\n");
2252 }
2253
2254 /* disable ASF */ 2267 /* disable ASF */
2255 if (hw->chip_id <= CHIP_ID_YUKON_EC) { 2268 if (hw->chip_id <= CHIP_ID_YUKON_EC) {
2256 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); 2269 sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
@@ -3302,7 +3315,10 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
3302 3315
3303 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 3316 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
3304 3317
3305 setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) dev); 3318 setup_timer(&hw->idle_timer, sky2_idle, (unsigned long) hw);
3319 if (idle_timeout > 0)
3320 mod_timer(&hw->idle_timer,
3321 jiffies + msecs_to_jiffies(idle_timeout));
3306 3322
3307 pci_set_drvdata(pdev, hw); 3323 pci_set_drvdata(pdev, hw);
3308 3324
@@ -3342,6 +3358,8 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
3342 del_timer_sync(&hw->idle_timer); 3358 del_timer_sync(&hw->idle_timer);
3343 3359
3344 sky2_write32(hw, B0_IMSK, 0); 3360 sky2_write32(hw, B0_IMSK, 0);
3361 synchronize_irq(hw->pdev->irq);
3362
3345 dev0 = hw->dev[0]; 3363 dev0 = hw->dev[0];
3346 dev1 = hw->dev[1]; 3364 dev1 = hw->dev[1];
3347 if (dev1) 3365 if (dev1)
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index b026f5653f04..8012994c9b93 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -378,6 +378,9 @@ enum {
378 CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */ 378 CHIP_REV_YU_EC_A1 = 0, /* Chip Rev. for Yukon-EC A1/A0 */
379 CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */ 379 CHIP_REV_YU_EC_A2 = 1, /* Chip Rev. for Yukon-EC A2 */
380 CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */ 380 CHIP_REV_YU_EC_A3 = 2, /* Chip Rev. for Yukon-EC A3 */
381
382 CHIP_REV_YU_EC_U_A0 = 0,
383 CHIP_REV_YU_EC_U_A1 = 1,
381}; 384};
382 385
383/* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */ 386/* B2_Y2_CLK_GATE 8 bit Clock Gating (Yukon-2 only) */
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 43f5e86fc559..394339d5e87c 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -1652,6 +1652,8 @@ spider_net_enable_card(struct spider_net_card *card)
1652 { SPIDER_NET_GFTRESTRT, SPIDER_NET_RESTART_VALUE }, 1652 { SPIDER_NET_GFTRESTRT, SPIDER_NET_RESTART_VALUE },
1653 1653
1654 { SPIDER_NET_GMRWOLCTRL, 0 }, 1654 { SPIDER_NET_GMRWOLCTRL, 0 },
1655 { SPIDER_NET_GTESTMD, 0x10000000 },
1656 { SPIDER_NET_GTTQMSK, 0x00400040 },
1655 { SPIDER_NET_GTESTMD, 0 }, 1657 { SPIDER_NET_GTESTMD, 0 },
1656 1658
1657 { SPIDER_NET_GMACINTEN, 0 }, 1659 { SPIDER_NET_GMACINTEN, 0 },
@@ -1792,15 +1794,7 @@ spider_net_setup_phy(struct spider_net_card *card)
1792 if (phy->def->ops->setup_forced) 1794 if (phy->def->ops->setup_forced)
1793 phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL); 1795 phy->def->ops->setup_forced(phy, SPEED_1000, DUPLEX_FULL);
1794 1796
1795 /* the following two writes could be moved to sungem_phy.c */ 1797 phy->def->ops->enable_fiber(phy);
1796 /* enable fiber mode */
1797 spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x9020);
1798 /* LEDs active in both modes, autosense prio = fiber */
1799 spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0x945f);
1800
1801 /* switch off fibre autoneg */
1802 spider_net_write_phy(card->netdev, 1, MII_NCONFIG, 0xfc01);
1803 spider_net_write_phy(card->netdev, 1, 0x0b, 0x0004);
1804 1798
1805 phy->def->ops->read_link(phy); 1799 phy->def->ops->read_link(phy);
1806 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name, 1800 pr_info("Found %s with %i Mbps, %s-duplex.\n", phy->def->name,
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h
index 5922b529a048..3b8d951cf73c 100644
--- a/drivers/net/spider_net.h
+++ b/drivers/net/spider_net.h
@@ -120,6 +120,8 @@ extern char spider_net_driver_name[];
120#define SPIDER_NET_GMRUAFILnR 0x00000500 120#define SPIDER_NET_GMRUAFILnR 0x00000500
121#define SPIDER_NET_GMRUA0FIL15R 0x00000578 121#define SPIDER_NET_GMRUA0FIL15R 0x00000578
122 122
123#define SPIDER_NET_GTTQMSK 0x00000934
124
123/* RX DMA controller registers, all 0x00000a.. are for DMA controller A, 125/* RX DMA controller registers, all 0x00000a.. are for DMA controller A,
124 * 0x00000b.. for DMA controller B, etc. */ 126 * 0x00000b.. for DMA controller B, etc. */
125#define SPIDER_NET_GDADCHA 0x00000a00 127#define SPIDER_NET_GDADCHA 0x00000a00
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index 046371ee5bbe..b2ddd5e79303 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -329,6 +329,30 @@ static int bcm5421_init(struct mii_phy* phy)
329 return 0; 329 return 0;
330} 330}
331 331
332static int bcm5421_enable_fiber(struct mii_phy* phy)
333{
334 /* enable fiber mode */
335 phy_write(phy, MII_NCONFIG, 0x9020);
336 /* LEDs active in both modes, autosense prio = fiber */
337 phy_write(phy, MII_NCONFIG, 0x945f);
338
339 /* switch off fibre autoneg */
340 phy_write(phy, MII_NCONFIG, 0xfc01);
341 phy_write(phy, 0x0b, 0x0004);
342
343 return 0;
344}
345
346static int bcm5461_enable_fiber(struct mii_phy* phy)
347{
348 phy_write(phy, MII_NCONFIG, 0xfc0c);
349 phy_write(phy, MII_BMCR, 0x4140);
350 phy_write(phy, MII_NCONFIG, 0xfc0b);
351 phy_write(phy, MII_BMCR, 0x0140);
352
353 return 0;
354}
355
332static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise) 356static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise)
333{ 357{
334 u16 ctl, adv; 358 u16 ctl, adv;
@@ -762,6 +786,7 @@ static struct mii_phy_ops bcm5421_phy_ops = {
762 .setup_forced = bcm54xx_setup_forced, 786 .setup_forced = bcm54xx_setup_forced,
763 .poll_link = genmii_poll_link, 787 .poll_link = genmii_poll_link,
764 .read_link = bcm54xx_read_link, 788 .read_link = bcm54xx_read_link,
789 .enable_fiber = bcm5421_enable_fiber,
765}; 790};
766 791
767static struct mii_phy_def bcm5421_phy_def = { 792static struct mii_phy_def bcm5421_phy_def = {
@@ -792,6 +817,25 @@ static struct mii_phy_def bcm5421k2_phy_def = {
792 .ops = &bcm5421k2_phy_ops 817 .ops = &bcm5421k2_phy_ops
793}; 818};
794 819
820static struct mii_phy_ops bcm5461_phy_ops = {
821 .init = bcm5421_init,
822 .suspend = generic_suspend,
823 .setup_aneg = bcm54xx_setup_aneg,
824 .setup_forced = bcm54xx_setup_forced,
825 .poll_link = genmii_poll_link,
826 .read_link = bcm54xx_read_link,
827 .enable_fiber = bcm5461_enable_fiber,
828};
829
830static struct mii_phy_def bcm5461_phy_def = {
831 .phy_id = 0x002060c0,
832 .phy_id_mask = 0xfffffff0,
833 .name = "BCM5461",
834 .features = MII_GBIT_FEATURES,
835 .magic_aneg = 1,
836 .ops = &bcm5461_phy_ops
837};
838
795/* Broadcom BCM 5462 built-in Vesta */ 839/* Broadcom BCM 5462 built-in Vesta */
796static struct mii_phy_ops bcm5462V_phy_ops = { 840static struct mii_phy_ops bcm5462V_phy_ops = {
797 .init = bcm5421_init, 841 .init = bcm5421_init,
@@ -857,6 +901,7 @@ static struct mii_phy_def* mii_phy_table[] = {
857 &bcm5411_phy_def, 901 &bcm5411_phy_def,
858 &bcm5421_phy_def, 902 &bcm5421_phy_def,
859 &bcm5421k2_phy_def, 903 &bcm5421k2_phy_def,
904 &bcm5461_phy_def,
860 &bcm5462V_phy_def, 905 &bcm5462V_phy_def,
861 &marvell_phy_def, 906 &marvell_phy_def,
862 &genmii_phy_def, 907 &genmii_phy_def,
diff --git a/drivers/net/sungem_phy.h b/drivers/net/sungem_phy.h
index 430544496c52..69e125197fcf 100644
--- a/drivers/net/sungem_phy.h
+++ b/drivers/net/sungem_phy.h
@@ -12,6 +12,7 @@ struct mii_phy_ops
12 int (*setup_forced)(struct mii_phy *phy, int speed, int fd); 12 int (*setup_forced)(struct mii_phy *phy, int speed, int fd);
13 int (*poll_link)(struct mii_phy *phy); 13 int (*poll_link)(struct mii_phy *phy);
14 int (*read_link)(struct mii_phy *phy); 14 int (*read_link)(struct mii_phy *phy);
15 int (*enable_fiber)(struct mii_phy *phy);
15}; 16};
16 17
17/* Structure used to statically define an mii/gii based PHY */ 18/* Structure used to statically define an mii/gii based PHY */
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index beeb612be98f..e1b33a25a25f 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7653,21 +7653,23 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
7653 cmd->supported |= (SUPPORTED_1000baseT_Half | 7653 cmd->supported |= (SUPPORTED_1000baseT_Half |
7654 SUPPORTED_1000baseT_Full); 7654 SUPPORTED_1000baseT_Full);
7655 7655
7656 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) 7656 if (!(tp->tg3_flags2 & TG3_FLG2_ANY_SERDES)) {
7657 cmd->supported |= (SUPPORTED_100baseT_Half | 7657 cmd->supported |= (SUPPORTED_100baseT_Half |
7658 SUPPORTED_100baseT_Full | 7658 SUPPORTED_100baseT_Full |
7659 SUPPORTED_10baseT_Half | 7659 SUPPORTED_10baseT_Half |
7660 SUPPORTED_10baseT_Full | 7660 SUPPORTED_10baseT_Full |
7661 SUPPORTED_MII); 7661 SUPPORTED_MII);
7662 else 7662 cmd->port = PORT_TP;
7663 } else {
7663 cmd->supported |= SUPPORTED_FIBRE; 7664 cmd->supported |= SUPPORTED_FIBRE;
7665 cmd->port = PORT_FIBRE;
7666 }
7664 7667
7665 cmd->advertising = tp->link_config.advertising; 7668 cmd->advertising = tp->link_config.advertising;
7666 if (netif_running(dev)) { 7669 if (netif_running(dev)) {
7667 cmd->speed = tp->link_config.active_speed; 7670 cmd->speed = tp->link_config.active_speed;
7668 cmd->duplex = tp->link_config.active_duplex; 7671 cmd->duplex = tp->link_config.active_duplex;
7669 } 7672 }
7670 cmd->port = 0;
7671 cmd->phy_address = PHY_ADDR; 7673 cmd->phy_address = PHY_ADDR;
7672 cmd->transceiver = 0; 7674 cmd->transceiver = 0;
7673 cmd->autoneg = tp->link_config.autoneg; 7675 cmd->autoneg = tp->link_config.autoneg;
@@ -8454,6 +8456,9 @@ static int tg3_run_loopback(struct tg3 *tp, int loopback_mode)
8454 8456
8455 tx_len = 1514; 8457 tx_len = 1514;
8456 skb = dev_alloc_skb(tx_len); 8458 skb = dev_alloc_skb(tx_len);
8459 if (!skb)
8460 return -ENOMEM;
8461
8457 tx_data = skb_put(skb, tx_len); 8462 tx_data = skb_put(skb, tx_len);
8458 memcpy(tx_data, tp->dev->dev_addr, 6); 8463 memcpy(tx_data, tp->dev->dev_addr, 6);
8459 memset(tx_data + 6, 0x0, 8); 8464 memset(tx_data + 6, 0x0, 8);
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index 9a06e61df0a2..e2982a83ae42 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -939,9 +939,9 @@ static int bcm43xx_sprom_extract(struct bcm43xx_private *bcm)
939 return 0; 939 return 0;
940} 940}
941 941
942static void bcm43xx_geo_init(struct bcm43xx_private *bcm) 942static int bcm43xx_geo_init(struct bcm43xx_private *bcm)
943{ 943{
944 struct ieee80211_geo geo; 944 struct ieee80211_geo *geo;
945 struct ieee80211_channel *chan; 945 struct ieee80211_channel *chan;
946 int have_a = 0, have_bg = 0; 946 int have_a = 0, have_bg = 0;
947 int i; 947 int i;
@@ -949,7 +949,10 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm)
949 struct bcm43xx_phyinfo *phy; 949 struct bcm43xx_phyinfo *phy;
950 const char *iso_country; 950 const char *iso_country;
951 951
952 memset(&geo, 0, sizeof(geo)); 952 geo = kzalloc(sizeof(*geo), GFP_KERNEL);
953 if (!geo)
954 return -ENOMEM;
955
953 for (i = 0; i < bcm->nr_80211_available; i++) { 956 for (i = 0; i < bcm->nr_80211_available; i++) {
954 phy = &(bcm->core_80211_ext[i].phy); 957 phy = &(bcm->core_80211_ext[i].phy);
955 switch (phy->type) { 958 switch (phy->type) {
@@ -967,31 +970,36 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm)
967 iso_country = bcm43xx_locale_iso(bcm->sprom.locale); 970 iso_country = bcm43xx_locale_iso(bcm->sprom.locale);
968 971
969 if (have_a) { 972 if (have_a) {
970 for (i = 0, channel = 0; channel < 201; channel++) { 973 for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL;
971 chan = &geo.a[i++]; 974 channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) {
975 chan = &geo->a[i++];
972 chan->freq = bcm43xx_channel_to_freq_a(channel); 976 chan->freq = bcm43xx_channel_to_freq_a(channel);
973 chan->channel = channel; 977 chan->channel = channel;
974 } 978 }
975 geo.a_channels = i; 979 geo->a_channels = i;
976 } 980 }
977 if (have_bg) { 981 if (have_bg) {
978 for (i = 0, channel = 1; channel < 15; channel++) { 982 for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL;
979 chan = &geo.bg[i++]; 983 channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) {
984 chan = &geo->bg[i++];
980 chan->freq = bcm43xx_channel_to_freq_bg(channel); 985 chan->freq = bcm43xx_channel_to_freq_bg(channel);
981 chan->channel = channel; 986 chan->channel = channel;
982 } 987 }
983 geo.bg_channels = i; 988 geo->bg_channels = i;
984 } 989 }
985 memcpy(geo.name, iso_country, 2); 990 memcpy(geo->name, iso_country, 2);
986 if (0 /*TODO: Outdoor use only */) 991 if (0 /*TODO: Outdoor use only */)
987 geo.name[2] = 'O'; 992 geo->name[2] = 'O';
988 else if (0 /*TODO: Indoor use only */) 993 else if (0 /*TODO: Indoor use only */)
989 geo.name[2] = 'I'; 994 geo->name[2] = 'I';
990 else 995 else
991 geo.name[2] = ' '; 996 geo->name[2] = ' ';
992 geo.name[3] = '\0'; 997 geo->name[3] = '\0';
998
999 ieee80211_set_geo(bcm->ieee, geo);
1000 kfree(geo);
993 1001
994 ieee80211_set_geo(bcm->ieee, &geo); 1002 return 0;
995} 1003}
996 1004
997/* DummyTransmission function, as documented on 1005/* DummyTransmission function, as documented on
@@ -3479,16 +3487,17 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm)
3479 goto err_80211_unwind; 3487 goto err_80211_unwind;
3480 bcm43xx_wireless_core_disable(bcm); 3488 bcm43xx_wireless_core_disable(bcm);
3481 } 3489 }
3490 err = bcm43xx_geo_init(bcm);
3491 if (err)
3492 goto err_80211_unwind;
3482 bcm43xx_pctl_set_crystal(bcm, 0); 3493 bcm43xx_pctl_set_crystal(bcm, 0);
3483 3494
3484 /* Set the MAC address in the networking subsystem */ 3495 /* Set the MAC address in the networking subsystem */
3485 if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) 3496 if (is_valid_ether_addr(bcm->sprom.et1macaddr))
3486 memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); 3497 memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6);
3487 else 3498 else
3488 memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); 3499 memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6);
3489 3500
3490 bcm43xx_geo_init(bcm);
3491
3492 snprintf(bcm->nick, IW_ESSID_MAX_SIZE, 3501 snprintf(bcm->nick, IW_ESSID_MAX_SIZE,
3493 "Broadcom %04X", bcm->chip_id); 3502 "Broadcom %04X", bcm->chip_id);
3494 3503
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.h b/drivers/net/wireless/bcm43xx/bcm43xx_main.h
index eca79a38594a..30a202b258b5 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.h
@@ -118,12 +118,14 @@ int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm,
118static inline 118static inline
119int bcm43xx_is_valid_channel_a(u8 channel) 119int bcm43xx_is_valid_channel_a(u8 channel)
120{ 120{
121 return (channel <= 200); 121 return (channel >= IEEE80211_52GHZ_MIN_CHANNEL
122 && channel <= IEEE80211_52GHZ_MAX_CHANNEL);
122} 123}
123static inline 124static inline
124int bcm43xx_is_valid_channel_bg(u8 channel) 125int bcm43xx_is_valid_channel_bg(u8 channel)
125{ 126{
126 return (channel >= 1 && channel <= 14); 127 return (channel >= IEEE80211_24GHZ_MIN_CHANNEL
128 && channel <= IEEE80211_24GHZ_MAX_CHANNEL);
127} 129}
128static inline 130static inline
129int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, 131int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index 33137165727f..b0abac515530 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -1287,7 +1287,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1287 if (radio->revision == 8) 1287 if (radio->revision == 8)
1288 bcm43xx_phy_write(bcm, 0x0805, 0x3230); 1288 bcm43xx_phy_write(bcm, 0x0805, 0x3230);
1289 bcm43xx_phy_init_pctl(bcm); 1289 bcm43xx_phy_init_pctl(bcm);
1290 if (bcm->chip_id == 0x4306 && bcm->chip_package != 2) { 1290 if (bcm->chip_id == 0x4306 && bcm->chip_package == 2) {
1291 bcm43xx_phy_write(bcm, 0x0429, 1291 bcm43xx_phy_write(bcm, 0x0429,
1292 bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF); 1292 bcm43xx_phy_read(bcm, 0x0429) & 0xBFFF);
1293 bcm43xx_phy_write(bcm, 0x04C3, 1293 bcm43xx_phy_write(bcm, 0x04C3,
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index 3edbb481a0a0..b45063974ae9 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -182,8 +182,11 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev,
182 mode = BCM43xx_INITIAL_IWMODE; 182 mode = BCM43xx_INITIAL_IWMODE;
183 183
184 bcm43xx_lock_mmio(bcm, flags); 184 bcm43xx_lock_mmio(bcm, flags);
185 if (bcm->ieee->iw_mode != mode) 185 if (bcm->initialized) {
186 bcm43xx_set_iwmode(bcm, mode); 186 if (bcm->ieee->iw_mode != mode)
187 bcm43xx_set_iwmode(bcm, mode);
188 } else
189 bcm->ieee->iw_mode = mode;
187 bcm43xx_unlock_mmio(bcm, flags); 190 bcm43xx_unlock_mmio(bcm, flags);
188 191
189 return 0; 192 return 0;
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 19e2b174d33c..d378478612fb 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -634,6 +634,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vi
634 * non-x86 architectures (yes Via exists on PPC among other places), 634 * non-x86 architectures (yes Via exists on PPC among other places),
635 * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get 635 * we must mask the PCI_INTERRUPT_LINE value versus 0xf to get
636 * interrupts delivered properly. 636 * interrupts delivered properly.
637 *
638 * Some of the on-chip devices are actually '586 devices' so they are
639 * listed here.
637 */ 640 */
638static void quirk_via_irq(struct pci_dev *dev) 641static void quirk_via_irq(struct pci_dev *dev)
639{ 642{
@@ -648,6 +651,10 @@ static void quirk_via_irq(struct pci_dev *dev)
648 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq); 651 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
649 } 652 }
650} 653}
654DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq);
655DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);
656DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);
657DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);
651DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq); 658DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);
652DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq); 659DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);
653DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq); 660DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);
@@ -895,6 +902,7 @@ static void __init k8t_sound_hostbridge(struct pci_dev *dev)
895} 902}
896DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge); 903DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_hostbridge);
897 904
905#ifndef CONFIG_ACPI_SLEEP
898/* 906/*
899 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge 907 * On ASUS P4B boards, the SMBus PCI Device within the ICH2/4 southbridge
900 * is not activated. The myth is that Asus said that they do not want the 908 * is not activated. The myth is that Asus said that they do not want the
@@ -906,8 +914,12 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho
906 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it 914 * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it
907 * becomes necessary to do this tweak in two steps -- I've chosen the Host 915 * becomes necessary to do this tweak in two steps -- I've chosen the Host
908 * bridge as trigger. 916 * bridge as trigger.
917 *
918 * Actually, leaving it unhidden and not redoing the quirk over suspend2ram
919 * will cause thermal management to break down, and causing machine to
920 * overheat.
909 */ 921 */
910static int __initdata asus_hides_smbus = 0; 922static int __initdata asus_hides_smbus;
911 923
912static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) 924static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
913{ 925{
@@ -1050,6 +1062,8 @@ static void __init asus_hides_smbus_lpc_ich6(struct pci_dev *dev)
1050} 1062}
1051DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 ); 1063DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, asus_hides_smbus_lpc_ich6 );
1052 1064
1065#endif
1066
1053/* 1067/*
1054 * SiS 96x south bridge: BIOS typically hides SMBus device... 1068 * SiS 96x south bridge: BIOS typically hides SMBus device...
1055 */ 1069 */
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index c53db7ceda5e..738b1ef595a3 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -426,7 +426,7 @@ static int ds_open(struct inode *inode, struct file *file)
426 426
427 if (!warning_printed) { 427 if (!warning_printed) {
428 printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl " 428 printk(KERN_INFO "pcmcia: Detected deprecated PCMCIA ioctl "
429 "usage.\n"); 429 "usage from process: %s.\n", current->comm);
430 printk(KERN_INFO "pcmcia: This interface will soon be removed from " 430 printk(KERN_INFO "pcmcia: This interface will soon be removed from "
431 "the kernel; please expect breakage unless you upgrade " 431 "the kernel; please expect breakage unless you upgrade "
432 "to new tools.\n"); 432 "to new tools.\n");
@@ -601,8 +601,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
601 ret = CS_BAD_ARGS; 601 ret = CS_BAD_ARGS;
602 else { 602 else {
603 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); 603 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function);
604 ret = pccard_get_configuration_info(s, p_dev, &buf->config); 604 if (p_dev == NULL)
605 pcmcia_put_dev(p_dev); 605 ret = CS_BAD_ARGS;
606 else {
607 ret = pccard_get_configuration_info(s, p_dev, &buf->config);
608 pcmcia_put_dev(p_dev);
609 }
606 } 610 }
607 break; 611 break;
608 case DS_GET_FIRST_TUPLE: 612 case DS_GET_FIRST_TUPLE:
@@ -632,8 +636,12 @@ static int ds_ioctl(struct inode * inode, struct file * file,
632 ret = CS_BAD_ARGS; 636 ret = CS_BAD_ARGS;
633 else { 637 else {
634 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); 638 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function);
635 ret = pccard_get_status(s, p_dev, &buf->status); 639 if (p_dev == NULL)
636 pcmcia_put_dev(p_dev); 640 ret = CS_BAD_ARGS;
641 else {
642 ret = pccard_get_status(s, p_dev, &buf->status);
643 pcmcia_put_dev(p_dev);
644 }
637 } 645 }
638 break; 646 break;
639 case DS_VALIDATE_CIS: 647 case DS_VALIDATE_CIS:
@@ -665,9 +673,10 @@ static int ds_ioctl(struct inode * inode, struct file * file,
665 if (!(buf->conf_reg.Function && 673 if (!(buf->conf_reg.Function &&
666 (buf->conf_reg.Function >= s->functions))) { 674 (buf->conf_reg.Function >= s->functions))) {
667 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function); 675 struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->conf_reg.Function);
668 if (p_dev) 676 if (p_dev) {
669 ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg); 677 ret = pcmcia_access_configuration_register(p_dev, &buf->conf_reg);
670 pcmcia_put_dev(p_dev); 678 pcmcia_put_dev(p_dev);
679 }
671 } 680 }
672 break; 681 break;
673 case DS_GET_FIRST_REGION: 682 case DS_GET_FIRST_REGION:
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index a23ec54989f6..2bc8aad47219 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -178,9 +178,9 @@ static int sa1100_rtc_open(struct device *dev)
178 return 0; 178 return 0;
179 179
180 fail_pi: 180 fail_pi:
181 free_irq(IRQ_RTCAlrm, NULL); 181 free_irq(IRQ_RTCAlrm, dev);
182 fail_ai: 182 fail_ai:
183 free_irq(IRQ_RTC1Hz, NULL); 183 free_irq(IRQ_RTC1Hz, dev);
184 fail_ui: 184 fail_ui:
185 return ret; 185 return ret;
186} 186}
@@ -295,7 +295,7 @@ static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
295 295
296static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq) 296static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)
297{ 297{
298 seq_printf(seq, "trim/divider\t: 0x%08x\n", RTTR); 298 seq_printf(seq, "trim/divider\t: 0x%08lx\n", RTTR);
299 seq_printf(seq, "alarm_IRQ\t: %s\n", 299 seq_printf(seq, "alarm_IRQ\t: %s\n",
300 (RTSR & RTSR_ALE) ? "yes" : "no" ); 300 (RTSR & RTSR_ALE) ? "yes" : "no" );
301 seq_printf(seq, "update_IRQ\t: %s\n", 301 seq_printf(seq, "update_IRQ\t: %s\n",
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index 5d6b7a57b02f..e65da921a827 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -1348,7 +1348,7 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1348 index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) 1348 index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa)
1349 - channel->ccws; 1349 - channel->ccws;
1350 if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) || 1350 if ((irb->scsw.actl & SCSW_ACTL_SUSPENDED) ||
1351 (irb->scsw.cstat | SCHN_STAT_PCI)) 1351 (irb->scsw.cstat & SCHN_STAT_PCI))
1352 /* Bloody io subsystem tells us lies about cpa... */ 1352 /* Bloody io subsystem tells us lies about cpa... */
1353 index = (index - 1) & (LCS_NUM_BUFFS - 1); 1353 index = (index - 1) & (LCS_NUM_BUFFS - 1);
1354 while (channel->io_idx != index) { 1354 while (channel->io_idx != index) {
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 383a95f34a0d..239e108b8ed1 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -392,13 +392,16 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
392 return -ENOMEM; 392 return -ENOMEM;
393 } 393 }
394 394
395 prom_getproperty(op.op_nodeid, str, tmp, len); 395 cnt = prom_getproperty(op.op_nodeid, str, tmp, len);
396 396 if (cnt <= 0) {
397 tmp[len] = '\0'; 397 error = -EINVAL;
398 } else {
399 tmp[len] = '\0';
398 400
399 if (__copy_to_user(argp, &op, sizeof(op)) != 0 401 if (__copy_to_user(argp, &op, sizeof(op)) != 0 ||
400 || copy_to_user(op.op_buf, tmp, len) != 0) 402 copy_to_user(op.op_buf, tmp, len) != 0)
401 error = -EFAULT; 403 error = -EFAULT;
404 }
402 405
403 kfree(tmp); 406 kfree(tmp);
404 kfree(str); 407 kfree(str);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index cb30d9c1153d..0c9c2f400bf6 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -219,6 +219,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
219 ahc->flags |= AHC_39BIT_ADDRESSING; 219 ahc->flags |= AHC_39BIT_ADDRESSING;
220 } else { 220 } else {
221 if (dma_set_mask(dev, DMA_32BIT_MASK)) { 221 if (dma_set_mask(dev, DMA_32BIT_MASK)) {
222 ahc_free(ahc);
222 printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n"); 223 printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
223 return (-ENODEV); 224 return (-ENODEV);
224 } 225 }
diff --git a/drivers/scsi/aic7xxx/aic7xxx_pci.c b/drivers/scsi/aic7xxx/aic7xxx_pci.c
index 5f586140e057..3adecef21783 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_pci.c
@@ -2036,12 +2036,12 @@ ahc_pci_resume(struct ahc_softc *ahc)
2036 * that the OS doesn't know about and rely on our chip 2036 * that the OS doesn't know about and rely on our chip
2037 * reset handler to handle the rest. 2037 * reset handler to handle the rest.
2038 */ 2038 */
2039 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4, 2039 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG,
2040 ahc->bus_softc.pci_softc.devconfig); 2040 ahc->bus_softc.pci_softc.devconfig, /*bytes*/4);
2041 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1, 2041 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
2042 ahc->bus_softc.pci_softc.command); 2042 ahc->bus_softc.pci_softc.command, /*bytes*/1);
2043 ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1, 2043 ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME,
2044 ahc->bus_softc.pci_softc.csize_lattime); 2044 ahc->bus_softc.pci_softc.csize_lattime, /*bytes*/1);
2045 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) { 2045 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) {
2046 struct seeprom_descriptor sd; 2046 struct seeprom_descriptor sd;
2047 u_int sxfrctl1; 2047 u_int sxfrctl1;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 0a8ad37ae899..2e9be83a697f 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -739,7 +739,8 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
739{ 739{
740 struct viosrp_adapter_info *req; 740 struct viosrp_adapter_info *req;
741 struct srp_event_struct *evt_struct; 741 struct srp_event_struct *evt_struct;
742 742 dma_addr_t addr;
743
743 evt_struct = get_event_struct(&hostdata->pool); 744 evt_struct = get_event_struct(&hostdata->pool);
744 if (!evt_struct) { 745 if (!evt_struct) {
745 printk(KERN_ERR "ibmvscsi: couldn't allocate an event " 746 printk(KERN_ERR "ibmvscsi: couldn't allocate an event "
@@ -757,10 +758,10 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
757 758
758 req->common.type = VIOSRP_ADAPTER_INFO_TYPE; 759 req->common.type = VIOSRP_ADAPTER_INFO_TYPE;
759 req->common.length = sizeof(hostdata->madapter_info); 760 req->common.length = sizeof(hostdata->madapter_info);
760 req->buffer = dma_map_single(hostdata->dev, 761 req->buffer = addr = dma_map_single(hostdata->dev,
761 &hostdata->madapter_info, 762 &hostdata->madapter_info,
762 sizeof(hostdata->madapter_info), 763 sizeof(hostdata->madapter_info),
763 DMA_BIDIRECTIONAL); 764 DMA_BIDIRECTIONAL);
764 765
765 if (dma_mapping_error(req->buffer)) { 766 if (dma_mapping_error(req->buffer)) {
766 printk(KERN_ERR 767 printk(KERN_ERR
@@ -770,8 +771,13 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
770 return; 771 return;
771 } 772 }
772 773
773 if (ibmvscsi_send_srp_event(evt_struct, hostdata)) 774 if (ibmvscsi_send_srp_event(evt_struct, hostdata)) {
774 printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n"); 775 printk(KERN_ERR "ibmvscsi: couldn't send ADAPTER_INFO_REQ!\n");
776 dma_unmap_single(hostdata->dev,
777 addr,
778 sizeof(hostdata->madapter_info),
779 DMA_BIDIRECTIONAL);
780 }
775}; 781};
776 782
777/** 783/**
@@ -1259,6 +1265,7 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1259{ 1265{
1260 struct viosrp_host_config *host_config; 1266 struct viosrp_host_config *host_config;
1261 struct srp_event_struct *evt_struct; 1267 struct srp_event_struct *evt_struct;
1268 dma_addr_t addr;
1262 int rc; 1269 int rc;
1263 1270
1264 evt_struct = get_event_struct(&hostdata->pool); 1271 evt_struct = get_event_struct(&hostdata->pool);
@@ -1279,8 +1286,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1279 memset(host_config, 0x00, sizeof(*host_config)); 1286 memset(host_config, 0x00, sizeof(*host_config));
1280 host_config->common.type = VIOSRP_HOST_CONFIG_TYPE; 1287 host_config->common.type = VIOSRP_HOST_CONFIG_TYPE;
1281 host_config->common.length = length; 1288 host_config->common.length = length;
1282 host_config->buffer = dma_map_single(hostdata->dev, buffer, length, 1289 host_config->buffer = addr = dma_map_single(hostdata->dev, buffer,
1283 DMA_BIDIRECTIONAL); 1290 length,
1291 DMA_BIDIRECTIONAL);
1284 1292
1285 if (dma_mapping_error(host_config->buffer)) { 1293 if (dma_mapping_error(host_config->buffer)) {
1286 printk(KERN_ERR 1294 printk(KERN_ERR
@@ -1291,11 +1299,9 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1291 1299
1292 init_completion(&evt_struct->comp); 1300 init_completion(&evt_struct->comp);
1293 rc = ibmvscsi_send_srp_event(evt_struct, hostdata); 1301 rc = ibmvscsi_send_srp_event(evt_struct, hostdata);
1294 if (rc == 0) { 1302 if (rc == 0)
1295 wait_for_completion(&evt_struct->comp); 1303 wait_for_completion(&evt_struct->comp);
1296 dma_unmap_single(hostdata->dev, host_config->buffer, 1304 dma_unmap_single(hostdata->dev, addr, length, DMA_BIDIRECTIONAL);
1297 length, DMA_BIDIRECTIONAL);
1298 }
1299 1305
1300 return rc; 1306 return rc;
1301} 1307}
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index fad607b2e6f4..ee22173fce43 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -27,7 +27,6 @@ void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
27int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *); 27int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
28void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *); 28void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *);
29void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *); 29void lpfc_read_lnk_stat(struct lpfc_hba *, LPFC_MBOXQ_t *);
30void lpfc_set_slim(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
31int lpfc_reg_login(struct lpfc_hba *, uint32_t, uint8_t *, LPFC_MBOXQ_t *, 30int lpfc_reg_login(struct lpfc_hba *, uint32_t, uint8_t *, LPFC_MBOXQ_t *,
32 uint32_t); 31 uint32_t);
33void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *); 32void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
index 8932b1be2b60..41cf5d3ea6ce 100644
--- a/drivers/scsi/lpfc/lpfc_disc.h
+++ b/drivers/scsi/lpfc/lpfc_disc.h
@@ -113,6 +113,7 @@ struct lpfc_nodelist {
113#define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from 113#define NLP_NPR_ADISC 0x2000000 /* Issue ADISC when dq'ed from
114 NPR list */ 114 NPR list */
115#define NLP_DELAY_REMOVE 0x4000000 /* Defer removal till end of DSM */ 115#define NLP_DELAY_REMOVE 0x4000000 /* Defer removal till end of DSM */
116#define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */
116 117
117/* Defines for list searchs */ 118/* Defines for list searchs */
118#define NLP_SEARCH_MAPPED 0x1 /* search mapped */ 119#define NLP_SEARCH_MAPPED 0x1 /* search mapped */
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 4813beaaca8f..283b7d824c34 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -302,10 +302,6 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
302 if (lpfc_reg_login(phba, Fabric_DID, (uint8_t *) sp, mbox, 0)) 302 if (lpfc_reg_login(phba, Fabric_DID, (uint8_t *) sp, mbox, 0))
303 goto fail_free_mbox; 303 goto fail_free_mbox;
304 304
305 /*
306 * set_slim mailbox command needs to execute first,
307 * queue this command to be processed later.
308 */
309 mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; 305 mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login;
310 mbox->context2 = ndlp; 306 mbox->context2 = ndlp;
311 307
@@ -781,25 +777,26 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
781 if (disc && phba->num_disc_nodes) { 777 if (disc && phba->num_disc_nodes) {
782 /* Check to see if there are more PLOGIs to be sent */ 778 /* Check to see if there are more PLOGIs to be sent */
783 lpfc_more_plogi(phba); 779 lpfc_more_plogi(phba);
784 }
785 780
786 if (phba->num_disc_nodes == 0) { 781 if (phba->num_disc_nodes == 0) {
787 spin_lock_irq(phba->host->host_lock); 782 spin_lock_irq(phba->host->host_lock);
788 phba->fc_flag &= ~FC_NDISC_ACTIVE; 783 phba->fc_flag &= ~FC_NDISC_ACTIVE;
789 spin_unlock_irq(phba->host->host_lock); 784 spin_unlock_irq(phba->host->host_lock);
790 785
791 lpfc_can_disctmo(phba); 786 lpfc_can_disctmo(phba);
792 if (phba->fc_flag & FC_RSCN_MODE) { 787 if (phba->fc_flag & FC_RSCN_MODE) {
793 /* Check to see if more RSCNs came in while we were 788 /*
794 * processing this one. 789 * Check to see if more RSCNs came in while
795 */ 790 * we were processing this one.
796 if ((phba->fc_rscn_id_cnt == 0) && 791 */
797 (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { 792 if ((phba->fc_rscn_id_cnt == 0) &&
798 spin_lock_irq(phba->host->host_lock); 793 (!(phba->fc_flag & FC_RSCN_DISCOVERY))) {
799 phba->fc_flag &= ~FC_RSCN_MODE; 794 spin_lock_irq(phba->host->host_lock);
800 spin_unlock_irq(phba->host->host_lock); 795 phba->fc_flag &= ~FC_RSCN_MODE;
801 } else { 796 spin_unlock_irq(phba->host->host_lock);
802 lpfc_els_handle_rscn(phba); 797 } else {
798 lpfc_els_handle_rscn(phba);
799 }
803 } 800 }
804 } 801 }
805 } 802 }
@@ -1263,7 +1260,7 @@ lpfc_issue_els_logo(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
1263 psli = &phba->sli; 1260 psli = &phba->sli;
1264 pring = &psli->ring[LPFC_ELS_RING]; 1261 pring = &psli->ring[LPFC_ELS_RING];
1265 1262
1266 cmdsize = 2 * (sizeof (uint32_t) + sizeof (struct lpfc_name)); 1263 cmdsize = (2 * sizeof (uint32_t)) + sizeof (struct lpfc_name);
1267 elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, 1264 elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp,
1268 ndlp->nlp_DID, ELS_CMD_LOGO); 1265 ndlp->nlp_DID, ELS_CMD_LOGO);
1269 if (!elsiocb) 1266 if (!elsiocb)
@@ -1451,22 +1448,23 @@ lpfc_cancel_retry_delay_tmo(struct lpfc_hba *phba, struct lpfc_nodelist * nlp)
1451 * PLOGIs to be sent 1448 * PLOGIs to be sent
1452 */ 1449 */
1453 lpfc_more_plogi(phba); 1450 lpfc_more_plogi(phba);
1454 }
1455 1451
1456 if (phba->num_disc_nodes == 0) { 1452 if (phba->num_disc_nodes == 0) {
1457 phba->fc_flag &= ~FC_NDISC_ACTIVE; 1453 phba->fc_flag &= ~FC_NDISC_ACTIVE;
1458 lpfc_can_disctmo(phba); 1454 lpfc_can_disctmo(phba);
1459 if (phba->fc_flag & FC_RSCN_MODE) { 1455 if (phba->fc_flag & FC_RSCN_MODE) {
1460 /* Check to see if more RSCNs 1456 /*
1461 * came in while we were 1457 * Check to see if more RSCNs
1462 * processing this one. 1458 * came in while we were
1463 */ 1459 * processing this one.
1464 if((phba->fc_rscn_id_cnt==0) && 1460 */
1465 (!(phba->fc_flag & FC_RSCN_DISCOVERY))) { 1461 if((phba->fc_rscn_id_cnt==0) &&
1466 phba->fc_flag &= ~FC_RSCN_MODE; 1462 !(phba->fc_flag & FC_RSCN_DISCOVERY)) {
1467 } 1463 phba->fc_flag &= ~FC_RSCN_MODE;
1468 else { 1464 }
1469 lpfc_els_handle_rscn(phba); 1465 else {
1466 lpfc_els_handle_rscn(phba);
1467 }
1470 } 1468 }
1471 } 1469 }
1472 } 1470 }
@@ -1872,9 +1870,6 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1872 if (mbox) { 1870 if (mbox) {
1873 if ((rspiocb->iocb.ulpStatus == 0) 1871 if ((rspiocb->iocb.ulpStatus == 0)
1874 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { 1872 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) {
1875 /* set_slim mailbox command needs to execute first,
1876 * queue this command to be processed later.
1877 */
1878 lpfc_unreg_rpi(phba, ndlp); 1873 lpfc_unreg_rpi(phba, ndlp);
1879 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 1874 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
1880 mbox->context2 = ndlp; 1875 mbox->context2 = ndlp;
@@ -1920,6 +1915,7 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
1920 uint8_t *pcmd; 1915 uint8_t *pcmd;
1921 uint16_t cmdsize; 1916 uint16_t cmdsize;
1922 int rc; 1917 int rc;
1918 ELS_PKT *els_pkt_ptr;
1923 1919
1924 psli = &phba->sli; 1920 psli = &phba->sli;
1925 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */ 1921 pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
@@ -1958,6 +1954,23 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
1958 pcmd += sizeof (uint32_t); 1954 pcmd += sizeof (uint32_t);
1959 memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm)); 1955 memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm));
1960 break; 1956 break;
1957 case ELS_CMD_PRLO:
1958 cmdsize = sizeof (uint32_t) + sizeof (PRLO);
1959 elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
1960 ndlp, ndlp->nlp_DID, ELS_CMD_PRLO);
1961 if (!elsiocb)
1962 return 1;
1963
1964 icmd = &elsiocb->iocb;
1965 icmd->ulpContext = oldcmd->ulpContext; /* Xri */
1966 pcmd = (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
1967
1968 memcpy(pcmd, ((struct lpfc_dmabuf *) oldiocb->context2)->virt,
1969 sizeof (uint32_t) + sizeof (PRLO));
1970 *((uint32_t *) (pcmd)) = ELS_CMD_PRLO_ACC;
1971 els_pkt_ptr = (ELS_PKT *) pcmd;
1972 els_pkt_ptr->un.prlo.acceptRspCode = PRLO_REQ_EXECUTED;
1973 break;
1961 default: 1974 default:
1962 return 1; 1975 return 1;
1963 } 1976 }
@@ -2498,7 +2511,7 @@ lpfc_els_rcv_rscn(struct lpfc_hba * phba,
2498 /* If we are about to begin discovery, just ACC the RSCN. 2511 /* If we are about to begin discovery, just ACC the RSCN.
2499 * Discovery processing will satisfy it. 2512 * Discovery processing will satisfy it.
2500 */ 2513 */
2501 if (phba->hba_state < LPFC_NS_QRY) { 2514 if (phba->hba_state <= LPFC_NS_QRY) {
2502 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 2515 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL,
2503 newnode); 2516 newnode);
2504 return 0; 2517 return 0;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 6721e679df62..adb086009ae0 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -311,8 +311,8 @@ lpfc_workq_post_event(struct lpfc_hba * phba, void *arg1, void *arg2,
311 evtp->evt_arg2 = arg2; 311 evtp->evt_arg2 = arg2;
312 evtp->evt = evt; 312 evtp->evt = evt;
313 313
314 list_add_tail(&evtp->evt_listp, &phba->work_list);
315 spin_lock_irq(phba->host->host_lock); 314 spin_lock_irq(phba->host->host_lock);
315 list_add_tail(&evtp->evt_listp, &phba->work_list);
316 if (phba->work_wait) 316 if (phba->work_wait)
317 wake_up(phba->work_wait); 317 wake_up(phba->work_wait);
318 spin_unlock_irq(phba->host->host_lock); 318 spin_unlock_irq(phba->host->host_lock);
@@ -1071,10 +1071,6 @@ lpfc_register_remote_port(struct lpfc_hba * phba,
1071 /* initialize static port data */ 1071 /* initialize static port data */
1072 rport->maxframe_size = ndlp->nlp_maxframe; 1072 rport->maxframe_size = ndlp->nlp_maxframe;
1073 rport->supported_classes = ndlp->nlp_class_sup; 1073 rport->supported_classes = ndlp->nlp_class_sup;
1074 if ((rport->scsi_target_id != -1) &&
1075 (rport->scsi_target_id < MAX_FCP_TARGET)) {
1076 ndlp->nlp_sid = rport->scsi_target_id;
1077 }
1078 rdata = rport->dd_data; 1074 rdata = rport->dd_data;
1079 rdata->pnode = ndlp; 1075 rdata->pnode = ndlp;
1080 1076
@@ -1087,6 +1083,10 @@ lpfc_register_remote_port(struct lpfc_hba * phba,
1087 if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN) 1083 if (rport_ids.roles != FC_RPORT_ROLE_UNKNOWN)
1088 fc_remote_port_rolechg(rport, rport_ids.roles); 1084 fc_remote_port_rolechg(rport, rport_ids.roles);
1089 1085
1086 if ((rport->scsi_target_id != -1) &&
1087 (rport->scsi_target_id < MAX_FCP_TARGET)) {
1088 ndlp->nlp_sid = rport->scsi_target_id;
1089 }
1090 1090
1091 return; 1091 return;
1092} 1092}
@@ -1238,6 +1238,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
1238 evt_listp); 1238 evt_listp);
1239 1239
1240 } 1240 }
1241 nlp->nlp_flag &= ~NLP_NODEV_REMOVE;
1241 nlp->nlp_type |= NLP_FC_NODE; 1242 nlp->nlp_type |= NLP_FC_NODE;
1242 break; 1243 break;
1243 case NLP_MAPPED_LIST: 1244 case NLP_MAPPED_LIST:
@@ -1258,6 +1259,7 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list)
1258 evt_listp); 1259 evt_listp);
1259 1260
1260 } 1261 }
1262 nlp->nlp_flag &= ~NLP_NODEV_REMOVE;
1261 break; 1263 break;
1262 case NLP_NPR_LIST: 1264 case NLP_NPR_LIST:
1263 nlp->nlp_flag |= list; 1265 nlp->nlp_flag |= list;
@@ -1402,6 +1404,8 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba,
1402 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi) 1404 if (icmd->ulpContext == (volatile ushort)ndlp->nlp_rpi)
1403 return 1; 1405 return 1;
1404 case CMD_ELS_REQUEST64_CR: 1406 case CMD_ELS_REQUEST64_CR:
1407 if (icmd->un.elsreq64.remoteID == ndlp->nlp_DID)
1408 return 1;
1405 case CMD_XMIT_ELS_RSP64_CX: 1409 case CMD_XMIT_ELS_RSP64_CX:
1406 if (iocb->context1 == (uint8_t *) ndlp) 1410 if (iocb->context1 == (uint8_t *) ndlp)
1407 return 1; 1411 return 1;
@@ -1901,10 +1905,8 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did)
1901 */ 1905 */
1902 if (ndlp->nlp_flag & NLP_DELAY_TMO) 1906 if (ndlp->nlp_flag & NLP_DELAY_TMO)
1903 lpfc_cancel_retry_delay_tmo(phba, ndlp); 1907 lpfc_cancel_retry_delay_tmo(phba, ndlp);
1904 } else { 1908 } else
1905 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1906 ndlp = NULL; 1909 ndlp = NULL;
1907 }
1908 } else { 1910 } else {
1909 flg = ndlp->nlp_flag & NLP_LIST_MASK; 1911 flg = ndlp->nlp_flag & NLP_LIST_MASK;
1910 if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) 1912 if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST))
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index 54d04188f7cc..eedf98801366 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -449,6 +449,7 @@ struct serv_parm { /* Structure is in Big Endian format */
449#define ELS_CMD_RRQ 0x12000000 449#define ELS_CMD_RRQ 0x12000000
450#define ELS_CMD_PRLI 0x20100014 450#define ELS_CMD_PRLI 0x20100014
451#define ELS_CMD_PRLO 0x21100014 451#define ELS_CMD_PRLO 0x21100014
452#define ELS_CMD_PRLO_ACC 0x02100014
452#define ELS_CMD_PDISC 0x50000000 453#define ELS_CMD_PDISC 0x50000000
453#define ELS_CMD_FDISC 0x51000000 454#define ELS_CMD_FDISC 0x51000000
454#define ELS_CMD_ADISC 0x52000000 455#define ELS_CMD_ADISC 0x52000000
@@ -484,6 +485,7 @@ struct serv_parm { /* Structure is in Big Endian format */
484#define ELS_CMD_RRQ 0x12 485#define ELS_CMD_RRQ 0x12
485#define ELS_CMD_PRLI 0x14001020 486#define ELS_CMD_PRLI 0x14001020
486#define ELS_CMD_PRLO 0x14001021 487#define ELS_CMD_PRLO 0x14001021
488#define ELS_CMD_PRLO_ACC 0x14001002
487#define ELS_CMD_PDISC 0x50 489#define ELS_CMD_PDISC 0x50
488#define ELS_CMD_FDISC 0x51 490#define ELS_CMD_FDISC 0x51
489#define ELS_CMD_ADISC 0x52 491#define ELS_CMD_ADISC 0x52
@@ -1539,6 +1541,7 @@ typedef struct {
1539 1541
1540#define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */ 1542#define FLAGS_TOPOLOGY_FAILOVER 0x0400 /* Bit 10 */
1541#define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */ 1543#define FLAGS_LINK_SPEED 0x0800 /* Bit 11 */
1544#define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */
1542 1545
1543 uint32_t link_speed; 1546 uint32_t link_speed;
1544#define LINK_SPEED_AUTO 0 /* Auto selection */ 1547#define LINK_SPEED_AUTO 0 /* Auto selection */
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 66d5d003555d..908d0f27706f 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -294,15 +294,6 @@ lpfc_config_port_post(struct lpfc_hba * phba)
294 } 294 }
295 } 295 }
296 296
297 /* This should turn on DELAYED ABTS for ELS timeouts */
298 lpfc_set_slim(phba, pmb, 0x052198, 0x1);
299 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
300 phba->hba_state = LPFC_HBA_ERROR;
301 mempool_free( pmb, phba->mbox_mem_pool);
302 return -EIO;
303 }
304
305
306 lpfc_read_config(phba, pmb); 297 lpfc_read_config(phba, pmb);
307 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) { 298 if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
308 lpfc_printf_log(phba, 299 lpfc_printf_log(phba,
@@ -804,7 +795,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
804 int max_speed; 795 int max_speed;
805 char * ports; 796 char * ports;
806 char * bus; 797 char * bus;
807 } m; 798 } m = {"<Unknown>", 0, "", ""};
808 799
809 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); 800 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype);
810 ports = (hdrtype == 0x80) ? "2-port " : ""; 801 ports = (hdrtype == 0x80) ? "2-port " : "";
@@ -1627,7 +1618,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1627 1618
1628 error = lpfc_alloc_sysfs_attr(phba); 1619 error = lpfc_alloc_sysfs_attr(phba);
1629 if (error) 1620 if (error)
1630 goto out_kthread_stop; 1621 goto out_remove_host;
1631 1622
1632 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, 1623 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ,
1633 LPFC_DRIVER_NAME, phba); 1624 LPFC_DRIVER_NAME, phba);
@@ -1644,8 +1635,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1644 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; 1635 phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET;
1645 1636
1646 error = lpfc_sli_hba_setup(phba); 1637 error = lpfc_sli_hba_setup(phba);
1647 if (error) 1638 if (error) {
1639 error = -ENODEV;
1648 goto out_free_irq; 1640 goto out_free_irq;
1641 }
1649 1642
1650 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { 1643 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
1651 spin_lock_irq(phba->host->host_lock); 1644 spin_lock_irq(phba->host->host_lock);
@@ -1700,6 +1693,9 @@ out_free_irq:
1700 free_irq(phba->pcidev->irq, phba); 1693 free_irq(phba->pcidev->irq, phba);
1701out_free_sysfs_attr: 1694out_free_sysfs_attr:
1702 lpfc_free_sysfs_attr(phba); 1695 lpfc_free_sysfs_attr(phba);
1696out_remove_host:
1697 fc_remove_host(phba->host);
1698 scsi_remove_host(phba->host);
1703out_kthread_stop: 1699out_kthread_stop:
1704 kthread_stop(phba->worker_thread); 1700 kthread_stop(phba->worker_thread);
1705out_free_iocbq: 1701out_free_iocbq:
@@ -1721,12 +1717,14 @@ out_iounmap_slim:
1721out_idr_remove: 1717out_idr_remove:
1722 idr_remove(&lpfc_hba_index, phba->brd_no); 1718 idr_remove(&lpfc_hba_index, phba->brd_no);
1723out_put_host: 1719out_put_host:
1720 phba->host = NULL;
1724 scsi_host_put(host); 1721 scsi_host_put(host);
1725out_release_regions: 1722out_release_regions:
1726 pci_release_regions(pdev); 1723 pci_release_regions(pdev);
1727out_disable_device: 1724out_disable_device:
1728 pci_disable_device(pdev); 1725 pci_disable_device(pdev);
1729out: 1726out:
1727 pci_set_drvdata(pdev, NULL);
1730 return error; 1728 return error;
1731} 1729}
1732 1730
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index c585e2b2e589..e42f22aaf71b 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -200,6 +200,9 @@ lpfc_init_link(struct lpfc_hba * phba,
200 break; 200 break;
201 } 201 }
202 202
203 /* Enable asynchronous ABTS responses from firmware */
204 mb->un.varInitLnk.link_flags |= FLAGS_IMED_ABORT;
205
203 /* NEW_FEATURE 206 /* NEW_FEATURE
204 * Setting up the link speed 207 * Setting up the link speed
205 */ 208 */
@@ -292,36 +295,6 @@ lpfc_unreg_did(struct lpfc_hba * phba, uint32_t did, LPFC_MBOXQ_t * pmb)
292 return; 295 return;
293} 296}
294 297
295/***********************************************/
296
297/* command to write slim */
298/***********************************************/
299void
300lpfc_set_slim(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, uint32_t addr,
301 uint32_t value)
302{
303 MAILBOX_t *mb;
304
305 mb = &pmb->mb;
306 memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
307
308 /* addr = 0x090597 is AUTO ABTS disable for ELS commands */
309 /* addr = 0x052198 is DELAYED ABTS enable for ELS commands */
310
311 /*
312 * Always turn on DELAYED ABTS for ELS timeouts
313 */
314 if ((addr == 0x052198) && (value == 0))
315 value = 1;
316
317 mb->un.varWords[0] = addr;
318 mb->un.varWords[1] = value;
319
320 mb->mbxCommand = MBX_SET_SLIM;
321 mb->mbxOwner = OWN_HOST;
322 return;
323}
324
325/**********************************************/ 298/**********************************************/
326/* lpfc_read_nv Issue a READ CONFIG */ 299/* lpfc_read_nv Issue a READ CONFIG */
327/* mailbox command */ 300/* mailbox command */
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 3d77bd999b70..27d60ad897cd 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -465,14 +465,18 @@ lpfc_rcv_padisc(struct lpfc_hba * phba,
465static int 465static int
466lpfc_rcv_logo(struct lpfc_hba * phba, 466lpfc_rcv_logo(struct lpfc_hba * phba,
467 struct lpfc_nodelist * ndlp, 467 struct lpfc_nodelist * ndlp,
468 struct lpfc_iocbq *cmdiocb) 468 struct lpfc_iocbq *cmdiocb,
469 uint32_t els_cmd)
469{ 470{
470 /* Put ndlp on NPR list with 1 sec timeout for plogi, ACC logo */ 471 /* Put ndlp on NPR list with 1 sec timeout for plogi, ACC logo */
471 /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary 472 /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary
472 * PLOGIs during LOGO storms from a device. 473 * PLOGIs during LOGO storms from a device.
473 */ 474 */
474 ndlp->nlp_flag |= NLP_LOGO_ACC; 475 ndlp->nlp_flag |= NLP_LOGO_ACC;
475 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 476 if (els_cmd == ELS_CMD_PRLO)
477 lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
478 else
479 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
476 480
477 if (!(ndlp->nlp_type & NLP_FABRIC) || 481 if (!(ndlp->nlp_type & NLP_FABRIC) ||
478 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { 482 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) {
@@ -681,7 +685,7 @@ lpfc_rcv_logo_plogi_issue(struct lpfc_hba * phba,
681 /* software abort outstanding PLOGI */ 685 /* software abort outstanding PLOGI */
682 lpfc_els_abort(phba, ndlp, 1); 686 lpfc_els_abort(phba, ndlp, 1);
683 687
684 lpfc_rcv_logo(phba, ndlp, cmdiocb); 688 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
685 return ndlp->nlp_state; 689 return ndlp->nlp_state;
686} 690}
687 691
@@ -788,10 +792,6 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
788 if (lpfc_reg_login 792 if (lpfc_reg_login
789 (phba, irsp->un.elsreq64.remoteID, 793 (phba, irsp->un.elsreq64.remoteID,
790 (uint8_t *) sp, mbox, 0) == 0) { 794 (uint8_t *) sp, mbox, 0) == 0) {
791 /* set_slim mailbox command needs to
792 * execute first, queue this command to
793 * be processed later.
794 */
795 switch (ndlp->nlp_DID) { 795 switch (ndlp->nlp_DID) {
796 case NameServer_DID: 796 case NameServer_DID:
797 mbox->mbox_cmpl = 797 mbox->mbox_cmpl =
@@ -832,11 +832,17 @@ static uint32_t
832lpfc_device_rm_plogi_issue(struct lpfc_hba * phba, 832lpfc_device_rm_plogi_issue(struct lpfc_hba * phba,
833 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 833 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
834{ 834{
835 /* software abort outstanding PLOGI */ 835 if(ndlp->nlp_flag & NLP_NPR_2B_DISC) {
836 lpfc_els_abort(phba, ndlp, 1); 836 ndlp->nlp_flag |= NLP_NODEV_REMOVE;
837 return ndlp->nlp_state;
838 }
839 else {
840 /* software abort outstanding PLOGI */
841 lpfc_els_abort(phba, ndlp, 1);
837 842
838 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 843 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
839 return NLP_STE_FREED_NODE; 844 return NLP_STE_FREED_NODE;
845 }
840} 846}
841 847
842static uint32_t 848static uint32_t
@@ -851,7 +857,7 @@ lpfc_device_recov_plogi_issue(struct lpfc_hba * phba,
851 ndlp->nlp_state = NLP_STE_NPR_NODE; 857 ndlp->nlp_state = NLP_STE_NPR_NODE;
852 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 858 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
853 spin_lock_irq(phba->host->host_lock); 859 spin_lock_irq(phba->host->host_lock);
854 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 860 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
855 spin_unlock_irq(phba->host->host_lock); 861 spin_unlock_irq(phba->host->host_lock);
856 862
857 return ndlp->nlp_state; 863 return ndlp->nlp_state;
@@ -905,7 +911,7 @@ lpfc_rcv_logo_adisc_issue(struct lpfc_hba * phba,
905 /* software abort outstanding ADISC */ 911 /* software abort outstanding ADISC */
906 lpfc_els_abort(phba, ndlp, 0); 912 lpfc_els_abort(phba, ndlp, 0);
907 913
908 lpfc_rcv_logo(phba, ndlp, cmdiocb); 914 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
909 return ndlp->nlp_state; 915 return ndlp->nlp_state;
910} 916}
911 917
@@ -932,7 +938,7 @@ lpfc_rcv_prlo_adisc_issue(struct lpfc_hba * phba,
932 cmdiocb = (struct lpfc_iocbq *) arg; 938 cmdiocb = (struct lpfc_iocbq *) arg;
933 939
934 /* Treat like rcv logo */ 940 /* Treat like rcv logo */
935 lpfc_rcv_logo(phba, ndlp, cmdiocb); 941 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_PRLO);
936 return ndlp->nlp_state; 942 return ndlp->nlp_state;
937} 943}
938 944
@@ -987,11 +993,17 @@ lpfc_device_rm_adisc_issue(struct lpfc_hba * phba,
987 struct lpfc_nodelist * ndlp, void *arg, 993 struct lpfc_nodelist * ndlp, void *arg,
988 uint32_t evt) 994 uint32_t evt)
989{ 995{
990 /* software abort outstanding ADISC */ 996 if(ndlp->nlp_flag & NLP_NPR_2B_DISC) {
991 lpfc_els_abort(phba, ndlp, 1); 997 ndlp->nlp_flag |= NLP_NODEV_REMOVE;
998 return ndlp->nlp_state;
999 }
1000 else {
1001 /* software abort outstanding ADISC */
1002 lpfc_els_abort(phba, ndlp, 1);
992 1003
993 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1004 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
994 return NLP_STE_FREED_NODE; 1005 return NLP_STE_FREED_NODE;
1006 }
995} 1007}
996 1008
997static uint32_t 1009static uint32_t
@@ -1006,7 +1018,7 @@ lpfc_device_recov_adisc_issue(struct lpfc_hba * phba,
1006 ndlp->nlp_state = NLP_STE_NPR_NODE; 1018 ndlp->nlp_state = NLP_STE_NPR_NODE;
1007 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1019 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1008 spin_lock_irq(phba->host->host_lock); 1020 spin_lock_irq(phba->host->host_lock);
1009 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1021 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1010 ndlp->nlp_flag |= NLP_NPR_ADISC; 1022 ndlp->nlp_flag |= NLP_NPR_ADISC;
1011 spin_unlock_irq(phba->host->host_lock); 1023 spin_unlock_irq(phba->host->host_lock);
1012 1024
@@ -1048,7 +1060,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_hba * phba,
1048 1060
1049 cmdiocb = (struct lpfc_iocbq *) arg; 1061 cmdiocb = (struct lpfc_iocbq *) arg;
1050 1062
1051 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1063 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
1052 return ndlp->nlp_state; 1064 return ndlp->nlp_state;
1053} 1065}
1054 1066
@@ -1073,7 +1085,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_hba * phba,
1073 struct lpfc_iocbq *cmdiocb; 1085 struct lpfc_iocbq *cmdiocb;
1074 1086
1075 cmdiocb = (struct lpfc_iocbq *) arg; 1087 cmdiocb = (struct lpfc_iocbq *) arg;
1076 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1088 lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
1077 return ndlp->nlp_state; 1089 return ndlp->nlp_state;
1078} 1090}
1079 1091
@@ -1133,8 +1145,14 @@ lpfc_device_rm_reglogin_issue(struct lpfc_hba * phba,
1133 struct lpfc_nodelist * ndlp, void *arg, 1145 struct lpfc_nodelist * ndlp, void *arg,
1134 uint32_t evt) 1146 uint32_t evt)
1135{ 1147{
1136 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1148 if(ndlp->nlp_flag & NLP_NPR_2B_DISC) {
1137 return NLP_STE_FREED_NODE; 1149 ndlp->nlp_flag |= NLP_NODEV_REMOVE;
1150 return ndlp->nlp_state;
1151 }
1152 else {
1153 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1154 return NLP_STE_FREED_NODE;
1155 }
1138} 1156}
1139 1157
1140static uint32_t 1158static uint32_t
@@ -1146,7 +1164,7 @@ lpfc_device_recov_reglogin_issue(struct lpfc_hba * phba,
1146 ndlp->nlp_state = NLP_STE_NPR_NODE; 1164 ndlp->nlp_state = NLP_STE_NPR_NODE;
1147 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1165 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1148 spin_lock_irq(phba->host->host_lock); 1166 spin_lock_irq(phba->host->host_lock);
1149 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1167 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1150 spin_unlock_irq(phba->host->host_lock); 1168 spin_unlock_irq(phba->host->host_lock);
1151 return ndlp->nlp_state; 1169 return ndlp->nlp_state;
1152} 1170}
@@ -1186,7 +1204,7 @@ lpfc_rcv_logo_prli_issue(struct lpfc_hba * phba,
1186 /* Software abort outstanding PRLI before sending acc */ 1204 /* Software abort outstanding PRLI before sending acc */
1187 lpfc_els_abort(phba, ndlp, 1); 1205 lpfc_els_abort(phba, ndlp, 1);
1188 1206
1189 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1207 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
1190 return ndlp->nlp_state; 1208 return ndlp->nlp_state;
1191} 1209}
1192 1210
@@ -1214,7 +1232,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_hba * phba,
1214 struct lpfc_iocbq *cmdiocb; 1232 struct lpfc_iocbq *cmdiocb;
1215 1233
1216 cmdiocb = (struct lpfc_iocbq *) arg; 1234 cmdiocb = (struct lpfc_iocbq *) arg;
1217 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1235 lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
1218 return ndlp->nlp_state; 1236 return ndlp->nlp_state;
1219} 1237}
1220 1238
@@ -1278,11 +1296,17 @@ static uint32_t
1278lpfc_device_rm_prli_issue(struct lpfc_hba * phba, 1296lpfc_device_rm_prli_issue(struct lpfc_hba * phba,
1279 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1297 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1280{ 1298{
1281 /* software abort outstanding PRLI */ 1299 if(ndlp->nlp_flag & NLP_NPR_2B_DISC) {
1282 lpfc_els_abort(phba, ndlp, 1); 1300 ndlp->nlp_flag |= NLP_NODEV_REMOVE;
1301 return ndlp->nlp_state;
1302 }
1303 else {
1304 /* software abort outstanding PLOGI */
1305 lpfc_els_abort(phba, ndlp, 1);
1283 1306
1284 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1307 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1285 return NLP_STE_FREED_NODE; 1308 return NLP_STE_FREED_NODE;
1309 }
1286} 1310}
1287 1311
1288 1312
@@ -1313,7 +1337,7 @@ lpfc_device_recov_prli_issue(struct lpfc_hba * phba,
1313 ndlp->nlp_state = NLP_STE_NPR_NODE; 1337 ndlp->nlp_state = NLP_STE_NPR_NODE;
1314 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1338 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1315 spin_lock_irq(phba->host->host_lock); 1339 spin_lock_irq(phba->host->host_lock);
1316 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1340 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1317 spin_unlock_irq(phba->host->host_lock); 1341 spin_unlock_irq(phba->host->host_lock);
1318 return ndlp->nlp_state; 1342 return ndlp->nlp_state;
1319} 1343}
@@ -1351,7 +1375,7 @@ lpfc_rcv_logo_unmap_node(struct lpfc_hba * phba,
1351 1375
1352 cmdiocb = (struct lpfc_iocbq *) arg; 1376 cmdiocb = (struct lpfc_iocbq *) arg;
1353 1377
1354 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1378 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
1355 return ndlp->nlp_state; 1379 return ndlp->nlp_state;
1356} 1380}
1357 1381
@@ -1375,7 +1399,7 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_hba * phba,
1375 1399
1376 cmdiocb = (struct lpfc_iocbq *) arg; 1400 cmdiocb = (struct lpfc_iocbq *) arg;
1377 1401
1378 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1402 lpfc_els_rsp_acc(phba, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
1379 return ndlp->nlp_state; 1403 return ndlp->nlp_state;
1380} 1404}
1381 1405
@@ -1386,7 +1410,7 @@ lpfc_device_recov_unmap_node(struct lpfc_hba * phba,
1386 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; 1410 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE;
1387 ndlp->nlp_state = NLP_STE_NPR_NODE; 1411 ndlp->nlp_state = NLP_STE_NPR_NODE;
1388 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1412 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1389 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1413 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1390 lpfc_disc_set_adisc(phba, ndlp); 1414 lpfc_disc_set_adisc(phba, ndlp);
1391 1415
1392 return ndlp->nlp_state; 1416 return ndlp->nlp_state;
@@ -1424,7 +1448,7 @@ lpfc_rcv_logo_mapped_node(struct lpfc_hba * phba,
1424 1448
1425 cmdiocb = (struct lpfc_iocbq *) arg; 1449 cmdiocb = (struct lpfc_iocbq *) arg;
1426 1450
1427 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1451 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
1428 return ndlp->nlp_state; 1452 return ndlp->nlp_state;
1429} 1453}
1430 1454
@@ -1456,7 +1480,7 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_hba * phba,
1456 spin_unlock_irq(phba->host->host_lock); 1480 spin_unlock_irq(phba->host->host_lock);
1457 1481
1458 /* Treat like rcv logo */ 1482 /* Treat like rcv logo */
1459 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1483 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_PRLO);
1460 return ndlp->nlp_state; 1484 return ndlp->nlp_state;
1461} 1485}
1462 1486
@@ -1469,7 +1493,7 @@ lpfc_device_recov_mapped_node(struct lpfc_hba * phba,
1469 ndlp->nlp_state = NLP_STE_NPR_NODE; 1493 ndlp->nlp_state = NLP_STE_NPR_NODE;
1470 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1494 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1471 spin_lock_irq(phba->host->host_lock); 1495 spin_lock_irq(phba->host->host_lock);
1472 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1496 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1473 spin_unlock_irq(phba->host->host_lock); 1497 spin_unlock_irq(phba->host->host_lock);
1474 lpfc_disc_set_adisc(phba, ndlp); 1498 lpfc_disc_set_adisc(phba, ndlp);
1475 return ndlp->nlp_state; 1499 return ndlp->nlp_state;
@@ -1551,7 +1575,7 @@ lpfc_rcv_logo_npr_node(struct lpfc_hba * phba,
1551 1575
1552 cmdiocb = (struct lpfc_iocbq *) arg; 1576 cmdiocb = (struct lpfc_iocbq *) arg;
1553 1577
1554 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1578 lpfc_rcv_logo(phba, ndlp, cmdiocb, ELS_CMD_LOGO);
1555 return ndlp->nlp_state; 1579 return ndlp->nlp_state;
1556} 1580}
1557 1581
@@ -1617,9 +1641,16 @@ lpfc_cmpl_plogi_npr_node(struct lpfc_hba * phba,
1617 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1641 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1618{ 1642{
1619 struct lpfc_iocbq *cmdiocb, *rspiocb; 1643 struct lpfc_iocbq *cmdiocb, *rspiocb;
1644 IOCB_t *irsp;
1620 1645
1621 cmdiocb = (struct lpfc_iocbq *) arg; 1646 cmdiocb = (struct lpfc_iocbq *) arg;
1622 rspiocb = cmdiocb->context_un.rsp_iocb; 1647 rspiocb = cmdiocb->context_un.rsp_iocb;
1648
1649 irsp = &rspiocb->iocb;
1650 if (irsp->ulpStatus) {
1651 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1652 return NLP_STE_FREED_NODE;
1653 }
1623 return ndlp->nlp_state; 1654 return ndlp->nlp_state;
1624} 1655}
1625 1656
@@ -1628,9 +1659,16 @@ lpfc_cmpl_prli_npr_node(struct lpfc_hba * phba,
1628 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1659 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1629{ 1660{
1630 struct lpfc_iocbq *cmdiocb, *rspiocb; 1661 struct lpfc_iocbq *cmdiocb, *rspiocb;
1662 IOCB_t *irsp;
1631 1663
1632 cmdiocb = (struct lpfc_iocbq *) arg; 1664 cmdiocb = (struct lpfc_iocbq *) arg;
1633 rspiocb = cmdiocb->context_un.rsp_iocb; 1665 rspiocb = cmdiocb->context_un.rsp_iocb;
1666
1667 irsp = &rspiocb->iocb;
1668 if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) {
1669 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1670 return NLP_STE_FREED_NODE;
1671 }
1634 return ndlp->nlp_state; 1672 return ndlp->nlp_state;
1635} 1673}
1636 1674
@@ -1649,9 +1687,16 @@ lpfc_cmpl_adisc_npr_node(struct lpfc_hba * phba,
1649 uint32_t evt) 1687 uint32_t evt)
1650{ 1688{
1651 struct lpfc_iocbq *cmdiocb, *rspiocb; 1689 struct lpfc_iocbq *cmdiocb, *rspiocb;
1690 IOCB_t *irsp;
1652 1691
1653 cmdiocb = (struct lpfc_iocbq *) arg; 1692 cmdiocb = (struct lpfc_iocbq *) arg;
1654 rspiocb = cmdiocb->context_un.rsp_iocb; 1693 rspiocb = cmdiocb->context_un.rsp_iocb;
1694
1695 irsp = &rspiocb->iocb;
1696 if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) {
1697 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1698 return NLP_STE_FREED_NODE;
1699 }
1655 return ndlp->nlp_state; 1700 return ndlp->nlp_state;
1656} 1701}
1657 1702
@@ -1668,7 +1713,12 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba,
1668 1713
1669 if (!mb->mbxStatus) 1714 if (!mb->mbxStatus)
1670 ndlp->nlp_rpi = mb->un.varWords[0]; 1715 ndlp->nlp_rpi = mb->un.varWords[0];
1671 1716 else {
1717 if (ndlp->nlp_flag & NLP_NODEV_REMOVE) {
1718 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1719 return NLP_STE_FREED_NODE;
1720 }
1721 }
1672 return ndlp->nlp_state; 1722 return ndlp->nlp_state;
1673} 1723}
1674 1724
@@ -1677,6 +1727,10 @@ lpfc_device_rm_npr_node(struct lpfc_hba * phba,
1677 struct lpfc_nodelist * ndlp, void *arg, 1727 struct lpfc_nodelist * ndlp, void *arg,
1678 uint32_t evt) 1728 uint32_t evt)
1679{ 1729{
1730 if (ndlp->nlp_flag & NLP_NPR_2B_DISC) {
1731 ndlp->nlp_flag |= NLP_NODEV_REMOVE;
1732 return ndlp->nlp_state;
1733 }
1680 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1734 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1681 return NLP_STE_FREED_NODE; 1735 return NLP_STE_FREED_NODE;
1682} 1736}
@@ -1687,7 +1741,7 @@ lpfc_device_recov_npr_node(struct lpfc_hba * phba,
1687 uint32_t evt) 1741 uint32_t evt)
1688{ 1742{
1689 spin_lock_irq(phba->host->host_lock); 1743 spin_lock_irq(phba->host->host_lock);
1690 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1744 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1691 spin_unlock_irq(phba->host->host_lock); 1745 spin_unlock_irq(phba->host->host_lock);
1692 if (ndlp->nlp_flag & NLP_DELAY_TMO) { 1746 if (ndlp->nlp_flag & NLP_DELAY_TMO) {
1693 lpfc_cancel_retry_delay_tmo(phba, ndlp); 1747 lpfc_cancel_retry_delay_tmo(phba, ndlp);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index f93799873721..7dc4c2e6bed2 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -629,8 +629,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba,
629 struct lpfc_iocbq *piocbq; 629 struct lpfc_iocbq *piocbq;
630 IOCB_t *piocb; 630 IOCB_t *piocb;
631 struct fcp_cmnd *fcp_cmnd; 631 struct fcp_cmnd *fcp_cmnd;
632 struct scsi_device *scsi_dev = lpfc_cmd->pCmd->device; 632 struct lpfc_rport_data *rdata = lpfc_cmd->rdata;
633 struct lpfc_rport_data *rdata = scsi_dev->hostdata;
634 struct lpfc_nodelist *ndlp = rdata->pnode; 633 struct lpfc_nodelist *ndlp = rdata->pnode;
635 634
636 if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) { 635 if ((ndlp == NULL) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
@@ -665,56 +664,18 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_hba *phba,
665 piocb->ulpTimeout = lpfc_cmd->timeout; 664 piocb->ulpTimeout = lpfc_cmd->timeout;
666 } 665 }
667 666
668 lpfc_cmd->rdata = rdata;
669
670 switch (task_mgmt_cmd) {
671 case FCP_LUN_RESET:
672 /* Issue LUN Reset to TGT <num> LUN <num> */
673 lpfc_printf_log(phba,
674 KERN_INFO,
675 LOG_FCP,
676 "%d:0703 Issue LUN Reset to TGT %d LUN %d "
677 "Data: x%x x%x\n",
678 phba->brd_no,
679 scsi_dev->id, scsi_dev->lun,
680 ndlp->nlp_rpi, ndlp->nlp_flag);
681
682 break;
683 case FCP_ABORT_TASK_SET:
684 /* Issue Abort Task Set to TGT <num> LUN <num> */
685 lpfc_printf_log(phba,
686 KERN_INFO,
687 LOG_FCP,
688 "%d:0701 Issue Abort Task Set to TGT %d LUN %d "
689 "Data: x%x x%x\n",
690 phba->brd_no,
691 scsi_dev->id, scsi_dev->lun,
692 ndlp->nlp_rpi, ndlp->nlp_flag);
693
694 break;
695 case FCP_TARGET_RESET:
696 /* Issue Target Reset to TGT <num> */
697 lpfc_printf_log(phba,
698 KERN_INFO,
699 LOG_FCP,
700 "%d:0702 Issue Target Reset to TGT %d "
701 "Data: x%x x%x\n",
702 phba->brd_no,
703 scsi_dev->id, ndlp->nlp_rpi,
704 ndlp->nlp_flag);
705 break;
706 }
707
708 return (1); 667 return (1);
709} 668}
710 669
711static int 670static int
712lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba) 671lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba,
672 unsigned tgt_id, struct lpfc_rport_data *rdata)
713{ 673{
714 struct lpfc_iocbq *iocbq; 674 struct lpfc_iocbq *iocbq;
715 struct lpfc_iocbq *iocbqrsp; 675 struct lpfc_iocbq *iocbqrsp;
716 int ret; 676 int ret;
717 677
678 lpfc_cmd->rdata = rdata;
718 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET); 679 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_TARGET_RESET);
719 if (!ret) 680 if (!ret)
720 return FAILED; 681 return FAILED;
@@ -726,6 +687,13 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
726 if (!iocbqrsp) 687 if (!iocbqrsp)
727 return FAILED; 688 return FAILED;
728 689
690 /* Issue Target Reset to TGT <num> */
691 lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
692 "%d:0702 Issue Target Reset to TGT %d "
693 "Data: x%x x%x\n",
694 phba->brd_no, tgt_id, rdata->pnode->nlp_rpi,
695 rdata->pnode->nlp_flag);
696
729 ret = lpfc_sli_issue_iocb_wait(phba, 697 ret = lpfc_sli_issue_iocb_wait(phba,
730 &phba->sli.ring[phba->sli.fcp_ring], 698 &phba->sli.ring[phba->sli.fcp_ring],
731 iocbq, iocbqrsp, lpfc_cmd->timeout); 699 iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -1021,6 +989,7 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
1021 lpfc_cmd->pCmd = cmnd; 989 lpfc_cmd->pCmd = cmnd;
1022 lpfc_cmd->timeout = 60; 990 lpfc_cmd->timeout = 60;
1023 lpfc_cmd->scsi_hba = phba; 991 lpfc_cmd->scsi_hba = phba;
992 lpfc_cmd->rdata = rdata;
1024 993
1025 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET); 994 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, FCP_LUN_RESET);
1026 if (!ret) 995 if (!ret)
@@ -1033,6 +1002,11 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
1033 if (iocbqrsp == NULL) 1002 if (iocbqrsp == NULL)
1034 goto out_free_scsi_buf; 1003 goto out_free_scsi_buf;
1035 1004
1005 lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
1006 "%d:0703 Issue LUN Reset to TGT %d LUN %d "
1007 "Data: x%x x%x\n", phba->brd_no, cmnd->device->id,
1008 cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);
1009
1036 ret = lpfc_sli_issue_iocb_wait(phba, 1010 ret = lpfc_sli_issue_iocb_wait(phba,
1037 &phba->sli.ring[phba->sli.fcp_ring], 1011 &phba->sli.ring[phba->sli.fcp_ring],
1038 iocbq, iocbqrsp, lpfc_cmd->timeout); 1012 iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -1104,7 +1078,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1104 int match; 1078 int match;
1105 int ret = FAILED, i, err_count = 0; 1079 int ret = FAILED, i, err_count = 0;
1106 int cnt, loopcnt; 1080 int cnt, loopcnt;
1107 unsigned int midlayer_id = 0;
1108 struct lpfc_scsi_buf * lpfc_cmd; 1081 struct lpfc_scsi_buf * lpfc_cmd;
1109 1082
1110 lpfc_block_requests(phba); 1083 lpfc_block_requests(phba);
@@ -1124,7 +1097,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1124 * targets known to the driver. Should any target reset 1097 * targets known to the driver. Should any target reset
1125 * fail, this routine returns failure to the midlayer. 1098 * fail, this routine returns failure to the midlayer.
1126 */ 1099 */
1127 midlayer_id = cmnd->device->id;
1128 for (i = 0; i < MAX_FCP_TARGET; i++) { 1100 for (i = 0; i < MAX_FCP_TARGET; i++) {
1129 /* Search the mapped list for this target ID */ 1101 /* Search the mapped list for this target ID */
1130 match = 0; 1102 match = 0;
@@ -1137,9 +1109,8 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1137 if (!match) 1109 if (!match)
1138 continue; 1110 continue;
1139 1111
1140 lpfc_cmd->pCmd->device->id = i; 1112 ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba,
1141 lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data; 1113 i, ndlp->rport->dd_data);
1142 ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba);
1143 if (ret != SUCCESS) { 1114 if (ret != SUCCESS) {
1144 lpfc_printf_log(phba, KERN_ERR, LOG_FCP, 1115 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
1145 "%d:0713 Bus Reset on target %d failed\n", 1116 "%d:0713 Bus Reset on target %d failed\n",
@@ -1158,7 +1129,6 @@ lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
1158 * the targets. Unfortunately, some targets do not abide by 1129 * the targets. Unfortunately, some targets do not abide by
1159 * this forcing the driver to double check. 1130 * this forcing the driver to double check.
1160 */ 1131 */
1161 cmnd->device->id = midlayer_id;
1162 cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring], 1132 cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
1163 0, 0, LPFC_CTX_HOST); 1133 0, 0, LPFC_CTX_HOST);
1164 if (cnt) 1134 if (cnt)
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index 4cf1366108b7..6b737568b831 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.1.4" 21#define LPFC_DRIVER_VERSION "8.1.6"
22 22
23#define LPFC_DRIVER_NAME "lpfc" 23#define LPFC_DRIVER_NAME "lpfc"
24 24
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 80b68a2481b3..de35ffe2f79d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4471,7 +4471,6 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
4471{ 4471{
4472 Scsi_Cmnd *scmd; 4472 Scsi_Cmnd *scmd;
4473 struct scsi_device *sdev; 4473 struct scsi_device *sdev;
4474 unsigned long flags = 0;
4475 scb_t *scb; 4474 scb_t *scb;
4476 int rval; 4475 int rval;
4477 4476
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index c11e5ce6865e..bec1424eda85 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -10,7 +10,7 @@
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 * 11 *
12 * FILE : megaraid_mbox.c 12 * FILE : megaraid_mbox.c
13 * Version : v2.20.4.7 (Nov 14 2005) 13 * Version : v2.20.4.8 (Apr 11 2006)
14 * 14 *
15 * Authors: 15 * Authors:
16 * Atul Mukker <Atul.Mukker@lsil.com> 16 * Atul Mukker <Atul.Mukker@lsil.com>
@@ -2278,6 +2278,7 @@ megaraid_mbox_dpc(unsigned long devp)
2278 unsigned long flags; 2278 unsigned long flags;
2279 uint8_t c; 2279 uint8_t c;
2280 int status; 2280 int status;
2281 uioc_t *kioc;
2281 2282
2282 2283
2283 if (!adapter) return; 2284 if (!adapter) return;
@@ -2320,6 +2321,9 @@ megaraid_mbox_dpc(unsigned long devp)
2320 // remove from local clist 2321 // remove from local clist
2321 list_del_init(&scb->list); 2322 list_del_init(&scb->list);
2322 2323
2324 kioc = (uioc_t *)scb->gp;
2325 kioc->status = 0;
2326
2323 megaraid_mbox_mm_done(adapter, scb); 2327 megaraid_mbox_mm_done(adapter, scb);
2324 2328
2325 continue; 2329 continue;
@@ -2636,6 +2640,7 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
2636 int recovery_window; 2640 int recovery_window;
2637 int recovering; 2641 int recovering;
2638 int i; 2642 int i;
2643 uioc_t *kioc;
2639 2644
2640 adapter = SCP2ADAPTER(scp); 2645 adapter = SCP2ADAPTER(scp);
2641 raid_dev = ADAP2RAIDDEV(adapter); 2646 raid_dev = ADAP2RAIDDEV(adapter);
@@ -2655,32 +2660,51 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
2655 // Also, reset all the commands currently owned by the driver 2660 // Also, reset all the commands currently owned by the driver
2656 spin_lock_irqsave(PENDING_LIST_LOCK(adapter), flags); 2661 spin_lock_irqsave(PENDING_LIST_LOCK(adapter), flags);
2657 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { 2662 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) {
2658
2659 list_del_init(&scb->list); // from pending list 2663 list_del_init(&scb->list); // from pending list
2660 2664
2661 con_log(CL_ANN, (KERN_WARNING 2665 if (scb->sno >= MBOX_MAX_SCSI_CMDS) {
2662 "megaraid: %ld:%d[%d:%d], reset from pending list\n", 2666 con_log(CL_ANN, (KERN_WARNING
2663 scp->serial_number, scb->sno, 2667 "megaraid: IOCTL packet with %d[%d:%d] being reset\n",
2664 scb->dev_channel, scb->dev_target)); 2668 scb->sno, scb->dev_channel, scb->dev_target));
2665 2669
2666 scp->result = (DID_RESET << 16); 2670 scb->status = -1;
2667 scp->scsi_done(scp);
2668 2671
2669 megaraid_dealloc_scb(adapter, scb); 2672 kioc = (uioc_t *)scb->gp;
2673 kioc->status = -EFAULT;
2674
2675 megaraid_mbox_mm_done(adapter, scb);
2676 } else {
2677 if (scb->scp == scp) { // Found command
2678 con_log(CL_ANN, (KERN_WARNING
2679 "megaraid: %ld:%d[%d:%d], reset from pending list\n",
2680 scp->serial_number, scb->sno,
2681 scb->dev_channel, scb->dev_target));
2682 } else {
2683 con_log(CL_ANN, (KERN_WARNING
2684 "megaraid: IO packet with %d[%d:%d] being reset\n",
2685 scb->sno, scb->dev_channel, scb->dev_target));
2686 }
2687
2688 scb->scp->result = (DID_RESET << 16);
2689 scb->scp->scsi_done(scb->scp);
2690
2691 megaraid_dealloc_scb(adapter, scb);
2692 }
2670 } 2693 }
2671 spin_unlock_irqrestore(PENDING_LIST_LOCK(adapter), flags); 2694 spin_unlock_irqrestore(PENDING_LIST_LOCK(adapter), flags);
2672 2695
2673 if (adapter->outstanding_cmds) { 2696 if (adapter->outstanding_cmds) {
2674 con_log(CL_ANN, (KERN_NOTICE 2697 con_log(CL_ANN, (KERN_NOTICE
2675 "megaraid: %d outstanding commands. Max wait %d sec\n", 2698 "megaraid: %d outstanding commands. Max wait %d sec\n",
2676 adapter->outstanding_cmds, MBOX_RESET_WAIT)); 2699 adapter->outstanding_cmds,
2700 (MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT)));
2677 } 2701 }
2678 2702
2679 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; 2703 recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
2680 2704
2681 recovering = adapter->outstanding_cmds; 2705 recovering = adapter->outstanding_cmds;
2682 2706
2683 for (i = 0; i < recovery_window && adapter->outstanding_cmds; i++) { 2707 for (i = 0; i < recovery_window; i++) {
2684 2708
2685 megaraid_ack_sequence(adapter); 2709 megaraid_ack_sequence(adapter);
2686 2710
@@ -2689,12 +2713,11 @@ megaraid_reset_handler(struct scsi_cmnd *scp)
2689 con_log(CL_ANN, ( 2713 con_log(CL_ANN, (
2690 "megaraid mbox: Wait for %d commands to complete:%d\n", 2714 "megaraid mbox: Wait for %d commands to complete:%d\n",
2691 adapter->outstanding_cmds, 2715 adapter->outstanding_cmds,
2692 MBOX_RESET_WAIT - i)); 2716 (MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT) - i));
2693 } 2717 }
2694 2718
2695 // bailout if no recovery happended in reset time 2719 // bailout if no recovery happended in reset time
2696 if ((i == MBOX_RESET_WAIT) && 2720 if (adapter->outstanding_cmds == 0) {
2697 (recovering == adapter->outstanding_cmds)) {
2698 break; 2721 break;
2699 } 2722 }
2700 2723
@@ -2918,12 +2941,13 @@ mbox_post_sync_cmd_fast(adapter_t *adapter, uint8_t raw_mbox[])
2918 wmb(); 2941 wmb();
2919 WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1); 2942 WRINDOOR(raid_dev, raid_dev->mbox_dma | 0x1);
2920 2943
2921 for (i = 0; i < 0xFFFFF; i++) { 2944 for (i = 0; i < MBOX_SYNC_WAIT_CNT; i++) {
2922 if (mbox->numstatus != 0xFF) break; 2945 if (mbox->numstatus != 0xFF) break;
2923 rmb(); 2946 rmb();
2947 udelay(MBOX_SYNC_DELAY_200);
2924 } 2948 }
2925 2949
2926 if (i == 0xFFFFF) { 2950 if (i == MBOX_SYNC_WAIT_CNT) {
2927 // We may need to re-calibrate the counter 2951 // We may need to re-calibrate the counter
2928 con_log(CL_ANN, (KERN_CRIT 2952 con_log(CL_ANN, (KERN_CRIT
2929 "megaraid: fast sync command timed out\n")); 2953 "megaraid: fast sync command timed out\n"));
@@ -3475,7 +3499,7 @@ megaraid_cmm_register(adapter_t *adapter)
3475 adp.drvr_data = (unsigned long)adapter; 3499 adp.drvr_data = (unsigned long)adapter;
3476 adp.pdev = adapter->pdev; 3500 adp.pdev = adapter->pdev;
3477 adp.issue_uioc = megaraid_mbox_mm_handler; 3501 adp.issue_uioc = megaraid_mbox_mm_handler;
3478 adp.timeout = 300; 3502 adp.timeout = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
3479 adp.max_kioc = MBOX_MAX_USER_CMDS; 3503 adp.max_kioc = MBOX_MAX_USER_CMDS;
3480 3504
3481 if ((rval = mraid_mm_register_adp(&adp)) != 0) { 3505 if ((rval = mraid_mm_register_adp(&adp)) != 0) {
@@ -3702,7 +3726,6 @@ megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb)
3702 unsigned long flags; 3726 unsigned long flags;
3703 3727
3704 kioc = (uioc_t *)scb->gp; 3728 kioc = (uioc_t *)scb->gp;
3705 kioc->status = 0;
3706 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf; 3729 mbox64 = (mbox64_t *)(unsigned long)kioc->cmdbuf;
3707 mbox64->mbox32.status = scb->status; 3730 mbox64->mbox32.status = scb->status;
3708 raw_mbox = (uint8_t *)&mbox64->mbox32; 3731 raw_mbox = (uint8_t *)&mbox64->mbox32;
diff --git a/drivers/scsi/megaraid/megaraid_mbox.h b/drivers/scsi/megaraid/megaraid_mbox.h
index 882fb1a0b575..868fb0ec93e7 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.h
+++ b/drivers/scsi/megaraid/megaraid_mbox.h
@@ -21,8 +21,8 @@
21#include "megaraid_ioctl.h" 21#include "megaraid_ioctl.h"
22 22
23 23
24#define MEGARAID_VERSION "2.20.4.7" 24#define MEGARAID_VERSION "2.20.4.8"
25#define MEGARAID_EXT_VERSION "(Release Date: Mon Nov 14 12:27:22 EST 2005)" 25#define MEGARAID_EXT_VERSION "(Release Date: Mon Apr 11 12:27:22 EST 2006)"
26 26
27 27
28/* 28/*
@@ -100,6 +100,9 @@
100#define MBOX_BUSY_WAIT 10 // max usec to wait for busy mailbox 100#define MBOX_BUSY_WAIT 10 // max usec to wait for busy mailbox
101#define MBOX_RESET_WAIT 180 // wait these many seconds in reset 101#define MBOX_RESET_WAIT 180 // wait these many seconds in reset
102#define MBOX_RESET_EXT_WAIT 120 // extended wait reset 102#define MBOX_RESET_EXT_WAIT 120 // extended wait reset
103#define MBOX_SYNC_WAIT_CNT 0xFFFF // wait loop index for synchronous mode
104
105#define MBOX_SYNC_DELAY_200 200 // 200 micro-seconds
103 106
104/* 107/*
105 * maximum transfer that can happen through the firmware commands issued 108 * maximum transfer that can happen through the firmware commands issued
diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index 8f3ce0432295..e8f534fb336b 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -898,10 +898,8 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp)
898 898
899 adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL); 899 adapter = kmalloc(sizeof(mraid_mmadp_t), GFP_KERNEL);
900 900
901 if (!adapter) { 901 if (!adapter)
902 rval = -ENOMEM; 902 return -ENOMEM;
903 goto memalloc_error;
904 }
905 903
906 memset(adapter, 0, sizeof(mraid_mmadp_t)); 904 memset(adapter, 0, sizeof(mraid_mmadp_t));
907 905
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 017729c59a49..584fe5d8e507 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -599,6 +599,7 @@ qla2x00_wait_for_loop_ready(scsi_qla_host_t *ha)
599* Either SUCCESS or FAILED. 599* Either SUCCESS or FAILED.
600* 600*
601* Note: 601* Note:
602* Only return FAILED if command not returned by firmware.
602**************************************************************************/ 603**************************************************************************/
603int 604int
604qla2xxx_eh_abort(struct scsi_cmnd *cmd) 605qla2xxx_eh_abort(struct scsi_cmnd *cmd)
@@ -609,11 +610,12 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
609 unsigned int id, lun; 610 unsigned int id, lun;
610 unsigned long serial; 611 unsigned long serial;
611 unsigned long flags; 612 unsigned long flags;
613 int wait = 0;
612 614
613 if (!CMD_SP(cmd)) 615 if (!CMD_SP(cmd))
614 return FAILED; 616 return SUCCESS;
615 617
616 ret = FAILED; 618 ret = SUCCESS;
617 619
618 id = cmd->device->id; 620 id = cmd->device->id;
619 lun = cmd->device->lun; 621 lun = cmd->device->lun;
@@ -642,7 +644,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
642 } else { 644 } else {
643 DEBUG3(printk("%s(%ld): abort_command " 645 DEBUG3(printk("%s(%ld): abort_command "
644 "mbx success.\n", __func__, ha->host_no)); 646 "mbx success.\n", __func__, ha->host_no));
645 ret = SUCCESS; 647 wait = 1;
646 } 648 }
647 spin_lock_irqsave(&ha->hardware_lock, flags); 649 spin_lock_irqsave(&ha->hardware_lock, flags);
648 650
@@ -651,17 +653,18 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
651 spin_unlock_irqrestore(&ha->hardware_lock, flags); 653 spin_unlock_irqrestore(&ha->hardware_lock, flags);
652 654
653 /* Wait for the command to be returned. */ 655 /* Wait for the command to be returned. */
654 if (ret == SUCCESS) { 656 if (wait) {
655 if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) { 657 if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) {
656 qla_printk(KERN_ERR, ha, 658 qla_printk(KERN_ERR, ha,
657 "scsi(%ld:%d:%d): Abort handler timed out -- %lx " 659 "scsi(%ld:%d:%d): Abort handler timed out -- %lx "
658 "%x.\n", ha->host_no, id, lun, serial, ret); 660 "%x.\n", ha->host_no, id, lun, serial, ret);
661 ret = FAILED;
659 } 662 }
660 } 663 }
661 664
662 qla_printk(KERN_INFO, ha, 665 qla_printk(KERN_INFO, ha,
663 "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no, 666 "scsi(%ld:%d:%d): Abort command issued -- %d %lx %x.\n",
664 id, lun, serial, ret); 667 ha->host_no, id, lun, wait, serial, ret);
665 668
666 return ret; 669 return ret;
667} 670}
@@ -1700,8 +1703,8 @@ qla2x00_free_device(scsi_qla_host_t *ha)
1700 ha->flags.online = 0; 1703 ha->flags.online = 0;
1701 1704
1702 /* Detach interrupts */ 1705 /* Detach interrupts */
1703 if (ha->pdev->irq) 1706 if (ha->host->irq)
1704 free_irq(ha->pdev->irq, ha); 1707 free_irq(ha->host->irq, ha);
1705 1708
1706 /* release io space registers */ 1709 /* release io space registers */
1707 if (ha->iobase) 1710 if (ha->iobase)
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index c750d3399a97..941c1e15c899 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -56,6 +56,8 @@ static struct {
56 {"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* locks up */ 56 {"DENON", "DRD-25X", "V", BLIST_NOLUN}, /* locks up */
57 {"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* responds to all lun */ 57 {"HITACHI", "DK312C", "CM81", BLIST_NOLUN}, /* responds to all lun */
58 {"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */ 58 {"HITACHI", "DK314C", "CR21", BLIST_NOLUN}, /* responds to all lun */
59 {"IBM", "2104-DU3", NULL, BLIST_NOLUN}, /* locks up */
60 {"IBM", "2104-TU3", NULL, BLIST_NOLUN}, /* locks up */
59 {"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* locks up */ 61 {"IMS", "CDD521/10", "2.06", BLIST_NOLUN}, /* locks up */
60 {"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* locks up */ 62 {"MAXTOR", "XT-3280", "PR02", BLIST_NOLUN}, /* locks up */
61 {"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* locks up */ 63 {"MAXTOR", "XT-4380S", "B3C", BLIST_NOLUN}, /* locks up */
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 7b0f9a3810d2..764a8b375ead 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1067,16 +1067,29 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes,
1067 break; 1067 break;
1068 case NOT_READY: 1068 case NOT_READY:
1069 /* 1069 /*
1070 * If the device is in the process of becoming ready, 1070 * If the device is in the process of becoming
1071 * retry. 1071 * ready, or has a temporary blockage, retry.
1072 */ 1072 */
1073 if (sshdr.asc == 0x04 && sshdr.ascq == 0x01) { 1073 if (sshdr.asc == 0x04) {
1074 scsi_requeue_command(q, cmd); 1074 switch (sshdr.ascq) {
1075 return; 1075 case 0x01: /* becoming ready */
1076 case 0x04: /* format in progress */
1077 case 0x05: /* rebuild in progress */
1078 case 0x06: /* recalculation in progress */
1079 case 0x07: /* operation in progress */
1080 case 0x08: /* Long write in progress */
1081 case 0x09: /* self test in progress */
1082 scsi_requeue_command(q, cmd);
1083 return;
1084 default:
1085 break;
1086 }
1076 } 1087 }
1077 if (!(req->flags & REQ_QUIET)) 1088 if (!(req->flags & REQ_QUIET)) {
1078 scmd_printk(KERN_INFO, cmd, 1089 scmd_printk(KERN_INFO, cmd,
1079 "Device not ready.\n"); 1090 "Device not ready: ");
1091 scsi_print_sense_hdr("", &sshdr);
1092 }
1080 scsi_end_request(cmd, 0, this_count, 1); 1093 scsi_end_request(cmd, 0, this_count, 1);
1081 return; 1094 return;
1082 case VOLUME_OVERFLOW: 1095 case VOLUME_OVERFLOW:
diff --git a/drivers/scsi/sim710.c b/drivers/scsi/sim710.c
index 3274ab76c8d3..255886a9ac55 100644
--- a/drivers/scsi/sim710.c
+++ b/drivers/scsi/sim710.c
@@ -75,7 +75,7 @@ param_setup(char *str)
75 else if(!strncmp(pos, "id:", 3)) { 75 else if(!strncmp(pos, "id:", 3)) {
76 if(slot == -1) { 76 if(slot == -1) {
77 printk(KERN_WARNING "sim710: Must specify slot for id parameter\n"); 77 printk(KERN_WARNING "sim710: Must specify slot for id parameter\n");
78 } else if(slot > MAX_SLOTS) { 78 } else if(slot >= MAX_SLOTS) {
79 printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val); 79 printk(KERN_WARNING "sim710: Illegal slot %d for id %d\n", slot, val);
80 } else { 80 } else {
81 id_array[slot] = val; 81 id_array[slot] = val;
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 674b15c78f68..bbf78aaf9e01 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -362,6 +362,40 @@ serial_out(struct uart_8250_port *up, int offset, int value)
362#define serial_inp(up, offset) serial_in(up, offset) 362#define serial_inp(up, offset) serial_in(up, offset)
363#define serial_outp(up, offset, value) serial_out(up, offset, value) 363#define serial_outp(up, offset, value) serial_out(up, offset, value)
364 364
365/* Uart divisor latch read */
366static inline int _serial_dl_read(struct uart_8250_port *up)
367{
368 return serial_inp(up, UART_DLL) | serial_inp(up, UART_DLM) << 8;
369}
370
371/* Uart divisor latch write */
372static inline void _serial_dl_write(struct uart_8250_port *up, int value)
373{
374 serial_outp(up, UART_DLL, value & 0xff);
375 serial_outp(up, UART_DLM, value >> 8 & 0xff);
376}
377
378#ifdef CONFIG_SERIAL_8250_AU1X00
379/* Au1x00 haven't got a standard divisor latch */
380static int serial_dl_read(struct uart_8250_port *up)
381{
382 if (up->port.iotype == UPIO_AU)
383 return __raw_readl(up->port.membase + 0x28);
384 else
385 return _serial_dl_read(up);
386}
387
388static void serial_dl_write(struct uart_8250_port *up, int value)
389{
390 if (up->port.iotype == UPIO_AU)
391 __raw_writel(value, up->port.membase + 0x28);
392 else
393 _serial_dl_write(up, value);
394}
395#else
396#define serial_dl_read(up) _serial_dl_read(up)
397#define serial_dl_write(up, value) _serial_dl_write(up, value)
398#endif
365 399
366/* 400/*
367 * For the 16C950 401 * For the 16C950
@@ -494,7 +528,8 @@ static void disable_rsa(struct uart_8250_port *up)
494 */ 528 */
495static int size_fifo(struct uart_8250_port *up) 529static int size_fifo(struct uart_8250_port *up)
496{ 530{
497 unsigned char old_fcr, old_mcr, old_dll, old_dlm, old_lcr; 531 unsigned char old_fcr, old_mcr, old_lcr;
532 unsigned short old_dl;
498 int count; 533 int count;
499 534
500 old_lcr = serial_inp(up, UART_LCR); 535 old_lcr = serial_inp(up, UART_LCR);
@@ -505,10 +540,8 @@ static int size_fifo(struct uart_8250_port *up)
505 UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); 540 UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
506 serial_outp(up, UART_MCR, UART_MCR_LOOP); 541 serial_outp(up, UART_MCR, UART_MCR_LOOP);
507 serial_outp(up, UART_LCR, UART_LCR_DLAB); 542 serial_outp(up, UART_LCR, UART_LCR_DLAB);
508 old_dll = serial_inp(up, UART_DLL); 543 old_dl = serial_dl_read(up);
509 old_dlm = serial_inp(up, UART_DLM); 544 serial_dl_write(up, 0x0001);
510 serial_outp(up, UART_DLL, 0x01);
511 serial_outp(up, UART_DLM, 0x00);
512 serial_outp(up, UART_LCR, 0x03); 545 serial_outp(up, UART_LCR, 0x03);
513 for (count = 0; count < 256; count++) 546 for (count = 0; count < 256; count++)
514 serial_outp(up, UART_TX, count); 547 serial_outp(up, UART_TX, count);
@@ -519,8 +552,7 @@ static int size_fifo(struct uart_8250_port *up)
519 serial_outp(up, UART_FCR, old_fcr); 552 serial_outp(up, UART_FCR, old_fcr);
520 serial_outp(up, UART_MCR, old_mcr); 553 serial_outp(up, UART_MCR, old_mcr);
521 serial_outp(up, UART_LCR, UART_LCR_DLAB); 554 serial_outp(up, UART_LCR, UART_LCR_DLAB);
522 serial_outp(up, UART_DLL, old_dll); 555 serial_dl_write(up, old_dl);
523 serial_outp(up, UART_DLM, old_dlm);
524 serial_outp(up, UART_LCR, old_lcr); 556 serial_outp(up, UART_LCR, old_lcr);
525 557
526 return count; 558 return count;
@@ -750,8 +782,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
750 782
751 serial_outp(up, UART_LCR, 0xE0); 783 serial_outp(up, UART_LCR, 0xE0);
752 784
753 quot = serial_inp(up, UART_DLM) << 8; 785 quot = serial_dl_read(up);
754 quot += serial_inp(up, UART_DLL);
755 quot <<= 3; 786 quot <<= 3;
756 787
757 status1 = serial_in(up, 0x04); /* EXCR1 */ 788 status1 = serial_in(up, 0x04); /* EXCR1 */
@@ -759,8 +790,7 @@ static void autoconfig_16550a(struct uart_8250_port *up)
759 status1 |= 0x10; /* 1.625 divisor for baud_base --> 921600 */ 790 status1 |= 0x10; /* 1.625 divisor for baud_base --> 921600 */
760 serial_outp(up, 0x04, status1); 791 serial_outp(up, 0x04, status1);
761 792
762 serial_outp(up, UART_DLL, quot & 0xff); 793 serial_dl_write(up, quot);
763 serial_outp(up, UART_DLM, quot >> 8);
764 794
765 serial_outp(up, UART_LCR, 0); 795 serial_outp(up, UART_LCR, 0);
766 796
@@ -1862,8 +1892,7 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
1862 serial_outp(up, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */ 1892 serial_outp(up, UART_LCR, cval | UART_LCR_DLAB);/* set DLAB */
1863 } 1893 }
1864 1894
1865 serial_outp(up, UART_DLL, quot & 0xff); /* LS of divisor */ 1895 serial_dl_write(up, quot);
1866 serial_outp(up, UART_DLM, quot >> 8); /* MS of divisor */
1867 1896
1868 /* 1897 /*
1869 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR 1898 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
@@ -1906,6 +1935,9 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
1906 int ret = 0; 1935 int ret = 0;
1907 1936
1908 switch (up->port.iotype) { 1937 switch (up->port.iotype) {
1938 case UPIO_AU:
1939 size = 0x100000;
1940 /* fall thru */
1909 case UPIO_MEM: 1941 case UPIO_MEM:
1910 if (!up->port.mapbase) 1942 if (!up->port.mapbase)
1911 break; 1943 break;
@@ -1938,6 +1970,9 @@ static void serial8250_release_std_resource(struct uart_8250_port *up)
1938 unsigned int size = 8 << up->port.regshift; 1970 unsigned int size = 8 << up->port.regshift;
1939 1971
1940 switch (up->port.iotype) { 1972 switch (up->port.iotype) {
1973 case UPIO_AU:
1974 size = 0x100000;
1975 /* fall thru */
1941 case UPIO_MEM: 1976 case UPIO_MEM:
1942 if (!up->port.mapbase) 1977 if (!up->port.mapbase)
1943 break; 1978 break;
@@ -2200,10 +2235,17 @@ static void
2200serial8250_console_write(struct console *co, const char *s, unsigned int count) 2235serial8250_console_write(struct console *co, const char *s, unsigned int count)
2201{ 2236{
2202 struct uart_8250_port *up = &serial8250_ports[co->index]; 2237 struct uart_8250_port *up = &serial8250_ports[co->index];
2238 unsigned long flags;
2203 unsigned int ier; 2239 unsigned int ier;
2240 int locked = 1;
2204 2241
2205 touch_nmi_watchdog(); 2242 touch_nmi_watchdog();
2206 2243
2244 if (oops_in_progress) {
2245 locked = spin_trylock_irqsave(&up->port.lock, flags);
2246 } else
2247 spin_lock_irqsave(&up->port.lock, flags);
2248
2207 /* 2249 /*
2208 * First save the IER then disable the interrupts 2250 * First save the IER then disable the interrupts
2209 */ 2251 */
@@ -2221,8 +2263,10 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
2221 * and restore the IER 2263 * and restore the IER
2222 */ 2264 */
2223 wait_for_xmitr(up, BOTH_EMPTY); 2265 wait_for_xmitr(up, BOTH_EMPTY);
2224 up->ier |= UART_IER_THRI; 2266 serial_out(up, UART_IER, ier);
2225 serial_out(up, UART_IER, ier | UART_IER_THRI); 2267
2268 if (locked)
2269 spin_unlock_irqrestore(&up->port.lock, flags);
2226} 2270}
2227 2271
2228static int serial8250_console_setup(struct console *co, char *options) 2272static int serial8250_console_setup(struct console *co, char *options)
diff --git a/drivers/serial/8250_au1x00.c b/drivers/serial/8250_au1x00.c
index 3d1bfd07208d..58015fd14be9 100644
--- a/drivers/serial/8250_au1x00.c
+++ b/drivers/serial/8250_au1x00.c
@@ -30,13 +30,12 @@
30 { \ 30 { \
31 .iobase = _base, \ 31 .iobase = _base, \
32 .membase = (void __iomem *)_base,\ 32 .membase = (void __iomem *)_base,\
33 .mapbase = _base, \ 33 .mapbase = CPHYSADDR(_base), \
34 .irq = _irq, \ 34 .irq = _irq, \
35 .uartclk = 0, /* filled */ \ 35 .uartclk = 0, /* filled */ \
36 .regshift = 2, \ 36 .regshift = 2, \
37 .iotype = UPIO_AU, \ 37 .iotype = UPIO_AU, \
38 .flags = UPF_SKIP_TEST | \ 38 .flags = UPF_SKIP_TEST \
39 UPF_IOREMAP, \
40 } 39 }
41 40
42static struct plat_serial8250_port au1x00_data[] = { 41static struct plat_serial8250_port au1x00_data[] = {
diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index aa5eb7ddeda9..3b35cb779539 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -5,6 +5,13 @@
5 * 5 *
6 * Copyright (C) 2004 Freescale Semiconductor, Inc. 6 * Copyright (C) 2004 Freescale Semiconductor, Inc.
7 * 7 *
8 * 2006 (c) MontaVista Software, Inc.
9 * Vitaly Bordug <vbordug@ru.mvista.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 *
8 */ 15 */
9#ifndef CPM_UART_H 16#ifndef CPM_UART_H
10#define CPM_UART_H 17#define CPM_UART_H
@@ -101,12 +108,13 @@ static inline unsigned long cpu2cpm_addr(void* addr, struct uart_cpm_port *pinfo
101 int offset; 108 int offset;
102 u32 val = (u32)addr; 109 u32 val = (u32)addr;
103 /* sane check */ 110 /* sane check */
104 if ((val >= (u32)pinfo->mem_addr) && 111 if (likely((val >= (u32)pinfo->mem_addr)) &&
105 (val<((u32)pinfo->mem_addr + pinfo->mem_size))) { 112 (val<((u32)pinfo->mem_addr + pinfo->mem_size))) {
106 offset = val - (u32)pinfo->mem_addr; 113 offset = val - (u32)pinfo->mem_addr;
107 return pinfo->dma_addr+offset; 114 return pinfo->dma_addr+offset;
108 } 115 }
109 printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); 116 /* something nasty happened */
117 BUG();
110 return 0; 118 return 0;
111} 119}
112 120
@@ -115,12 +123,13 @@ static inline void *cpm2cpu_addr(unsigned long addr, struct uart_cpm_port *pinfo
115 int offset; 123 int offset;
116 u32 val = addr; 124 u32 val = addr;
117 /* sane check */ 125 /* sane check */
118 if ((val >= pinfo->dma_addr) && 126 if (likely((val >= pinfo->dma_addr) &&
119 (val<(pinfo->dma_addr + pinfo->mem_size))) { 127 (val<(pinfo->dma_addr + pinfo->mem_size)))) {
120 offset = val - (u32)pinfo->dma_addr; 128 offset = val - (u32)pinfo->dma_addr;
121 return (void*)(pinfo->mem_addr+offset); 129 return (void*)(pinfo->mem_addr+offset);
122 } 130 }
123 printk("%s(): address %x to translate out of range!\n", __FUNCTION__, val); 131 /* something nasty happened */
132 BUG();
124 return 0; 133 return 0;
125} 134}
126 135
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index ced193bf9e1e..969f94900431 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -12,7 +12,8 @@
12 * 12 *
13 * Copyright (C) 2004 Freescale Semiconductor, Inc. 13 * Copyright (C) 2004 Freescale Semiconductor, Inc.
14 * (C) 2004 Intracom, S.A. 14 * (C) 2004 Intracom, S.A.
15 * (C) 2005 MontaVista Software, Inc. by Vitaly Bordug <vbordug@ru.mvista.com> 15 * (C) 2005-2006 MontaVista Software, Inc.
16 * Vitaly Bordug <vbordug@ru.mvista.com>
16 * 17 *
17 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by 19 * it under the terms of the GNU General Public License as published by
@@ -81,7 +82,7 @@ early_uart_get_pdev(int index)
81} 82}
82 83
83 84
84void cpm_uart_count(void) 85static void cpm_uart_count(void)
85{ 86{
86 cpm_uart_nr = 0; 87 cpm_uart_nr = 0;
87#ifdef CONFIG_SERIAL_CPM_SMC1 88#ifdef CONFIG_SERIAL_CPM_SMC1
@@ -104,6 +105,21 @@ void cpm_uart_count(void)
104#endif 105#endif
105} 106}
106 107
108/* Get UART number by its id */
109static int cpm_uart_id2nr(int id)
110{
111 int i;
112 if (id < UART_NR) {
113 for (i=0; i<UART_NR; i++) {
114 if (cpm_uart_port_map[i] == id)
115 return i;
116 }
117 }
118
119 /* not found or invalid argument */
120 return -1;
121}
122
107/* 123/*
108 * Check, if transmit buffers are processed 124 * Check, if transmit buffers are processed
109*/ 125*/
@@ -457,7 +473,11 @@ static void cpm_uart_shutdown(struct uart_port *port)
457 } 473 }
458 474
459 /* Shut them really down and reinit buffer descriptors */ 475 /* Shut them really down and reinit buffer descriptors */
460 cpm_line_cr_cmd(line, CPM_CR_STOP_TX); 476 if (IS_SMC(pinfo))
477 cpm_line_cr_cmd(line, CPM_CR_STOP_TX);
478 else
479 cpm_line_cr_cmd(line, CPM_CR_GRA_STOP_TX);
480
461 cpm_uart_initbd(pinfo); 481 cpm_uart_initbd(pinfo);
462 } 482 }
463} 483}
@@ -1008,7 +1028,11 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
1008 int line; 1028 int line;
1009 u32 mem, pram; 1029 u32 mem, pram;
1010 1030
1011 for (line=0; line<UART_NR && cpm_uart_port_map[line]!=pdata->fs_no; line++); 1031 line = cpm_uart_id2nr(idx);
1032 if(line < 0) {
1033 printk(KERN_ERR"%s(): port %d is not registered", __FUNCTION__, idx);
1034 return -1;
1035 }
1012 1036
1013 pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx]; 1037 pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx];
1014 1038
@@ -1241,8 +1265,7 @@ static int cpm_uart_drv_probe(struct device *dev)
1241 } 1265 }
1242 1266
1243 pdata = pdev->dev.platform_data; 1267 pdata = pdev->dev.platform_data;
1244 pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", 1268 pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", cpm_uart_id2nr(pdata->fs_no));
1245 cpm_uart_port_map[pdata->fs_no]);
1246 1269
1247 if ((ret = cpm_uart_drv_get_platform_data(pdev, 0))) 1270 if ((ret = cpm_uart_drv_get_platform_data(pdev, 0)))
1248 return ret; 1271 return ret;
@@ -1261,7 +1284,7 @@ static int cpm_uart_drv_remove(struct device *dev)
1261 struct fs_uart_platform_info *pdata = pdev->dev.platform_data; 1284 struct fs_uart_platform_info *pdata = pdev->dev.platform_data;
1262 1285
1263 pr_debug("cpm_uart_drv_remove: Removing CPM UART %d\n", 1286 pr_debug("cpm_uart_drv_remove: Removing CPM UART %d\n",
1264 cpm_uart_port_map[pdata->fs_no]); 1287 cpm_uart_id2nr(pdata->fs_no));
1265 1288
1266 uart_remove_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port); 1289 uart_remove_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port);
1267 return 0; 1290 return 0;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index a5a30622637a..17406a05ce1f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -8,6 +8,8 @@
8 * 8 *
9 * Copyright (C) 2004 Freescale Semiconductor, Inc. 9 * Copyright (C) 2004 Freescale Semiconductor, Inc.
10 * (C) 2004 Intracom, S.A. 10 * (C) 2004 Intracom, S.A.
11 * (C) 2006 MontaVista Software, Inc.
12 * Vitaly Bordug <vbordug@ru.mvista.com>
11 * 13 *
12 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index 7c6b07aeea92..4b2de08f46d0 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -8,6 +8,8 @@
8 * 8 *
9 * Copyright (C) 2004 Freescale Semiconductor, Inc. 9 * Copyright (C) 2004 Freescale Semiconductor, Inc.
10 * (C) 2004 Intracom, S.A. 10 * (C) 2004 Intracom, S.A.
11 * (C) 2006 MontaVista Software, Inc.
12 * Vitaly Bordug <vbordug@ru.mvista.com>
11 * 13 *
12 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by 15 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index c3b7a6673e9c..d202eb4f3848 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -45,6 +45,7 @@
45#include <asm/io.h> 45#include <asm/io.h>
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/hardware.h> 47#include <asm/hardware.h>
48#include <asm/arch/imx-uart.h>
48 49
49/* We've been assigned a range on the "Low-density serial ports" major */ 50/* We've been assigned a range on the "Low-density serial ports" major */
50#define SERIAL_IMX_MAJOR 204 51#define SERIAL_IMX_MAJOR 204
@@ -73,7 +74,8 @@ struct imx_port {
73 struct uart_port port; 74 struct uart_port port;
74 struct timer_list timer; 75 struct timer_list timer;
75 unsigned int old_status; 76 unsigned int old_status;
76 int txirq,rxirq,rtsirq; 77 int txirq,rxirq,rtsirq;
78 int have_rtscts:1;
77}; 79};
78 80
79/* 81/*
@@ -491,8 +493,12 @@ imx_set_termios(struct uart_port *port, struct termios *termios,
491 ucr2 = UCR2_SRST | UCR2_IRTS; 493 ucr2 = UCR2_SRST | UCR2_IRTS;
492 494
493 if (termios->c_cflag & CRTSCTS) { 495 if (termios->c_cflag & CRTSCTS) {
494 ucr2 &= ~UCR2_IRTS; 496 if( sport->have_rtscts ) {
495 ucr2 |= UCR2_CTSC; 497 ucr2 &= ~UCR2_IRTS;
498 ucr2 |= UCR2_CTSC;
499 } else {
500 termios->c_cflag &= ~CRTSCTS;
501 }
496 } 502 }
497 503
498 if (termios->c_cflag & CSTOPB) 504 if (termios->c_cflag & CSTOPB)
@@ -719,27 +725,6 @@ static void __init imx_init_ports(void)
719 imx_ports[i].timer.function = imx_timeout; 725 imx_ports[i].timer.function = imx_timeout;
720 imx_ports[i].timer.data = (unsigned long)&imx_ports[i]; 726 imx_ports[i].timer.data = (unsigned long)&imx_ports[i];
721 } 727 }
722
723 imx_gpio_mode(PC9_PF_UART1_CTS);
724 imx_gpio_mode(PC10_PF_UART1_RTS);
725 imx_gpio_mode(PC11_PF_UART1_TXD);
726 imx_gpio_mode(PC12_PF_UART1_RXD);
727 imx_gpio_mode(PB28_PF_UART2_CTS);
728 imx_gpio_mode(PB29_PF_UART2_RTS);
729
730 imx_gpio_mode(PB30_PF_UART2_TXD);
731 imx_gpio_mode(PB31_PF_UART2_RXD);
732
733#if 0 /* We don't need these, on the mx1 the _modem_ side of the uart
734 * is implemented.
735 */
736 imx_gpio_mode(PD7_AF_UART2_DTR);
737 imx_gpio_mode(PD8_AF_UART2_DCD);
738 imx_gpio_mode(PD9_AF_UART2_RI);
739 imx_gpio_mode(PD10_AF_UART2_DSR);
740#endif
741
742
743} 728}
744 729
745#ifdef CONFIG_SERIAL_IMX_CONSOLE 730#ifdef CONFIG_SERIAL_IMX_CONSOLE
@@ -932,7 +917,14 @@ static int serial_imx_resume(struct platform_device *dev)
932 917
933static int serial_imx_probe(struct platform_device *dev) 918static int serial_imx_probe(struct platform_device *dev)
934{ 919{
920 struct imxuart_platform_data *pdata;
921
935 imx_ports[dev->id].port.dev = &dev->dev; 922 imx_ports[dev->id].port.dev = &dev->dev;
923
924 pdata = (struct imxuart_platform_data *)dev->dev.platform_data;
925 if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS))
926 imx_ports[dev->id].have_rtscts = 1;
927
936 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port); 928 uart_add_one_port(&imx_reg, &imx_ports[dev->id].port);
937 platform_set_drvdata(dev, &imx_ports[dev->id]); 929 platform_set_drvdata(dev, &imx_ports[dev->id]);
938 return 0; 930 return 0;
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index fcd7744c4253..aeb8153ccf24 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1500,20 +1500,18 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
1500static struct uart_state *uart_get(struct uart_driver *drv, int line) 1500static struct uart_state *uart_get(struct uart_driver *drv, int line)
1501{ 1501{
1502 struct uart_state *state; 1502 struct uart_state *state;
1503 int ret = 0;
1503 1504
1504 mutex_lock(&port_mutex);
1505 state = drv->state + line; 1505 state = drv->state + line;
1506 if (mutex_lock_interruptible(&state->mutex)) { 1506 if (mutex_lock_interruptible(&state->mutex)) {
1507 state = ERR_PTR(-ERESTARTSYS); 1507 ret = -ERESTARTSYS;
1508 goto out; 1508 goto err;
1509 } 1509 }
1510 1510
1511 state->count++; 1511 state->count++;
1512 if (!state->port) { 1512 if (!state->port || state->port->flags & UPF_DEAD) {
1513 state->count--; 1513 ret = -ENXIO;
1514 mutex_unlock(&state->mutex); 1514 goto err_unlock;
1515 state = ERR_PTR(-ENXIO);
1516 goto out;
1517 } 1515 }
1518 1516
1519 if (!state->info) { 1517 if (!state->info) {
@@ -1531,15 +1529,17 @@ static struct uart_state *uart_get(struct uart_driver *drv, int line)
1531 tasklet_init(&state->info->tlet, uart_tasklet_action, 1529 tasklet_init(&state->info->tlet, uart_tasklet_action,
1532 (unsigned long)state); 1530 (unsigned long)state);
1533 } else { 1531 } else {
1534 state->count--; 1532 ret = -ENOMEM;
1535 mutex_unlock(&state->mutex); 1533 goto err_unlock;
1536 state = ERR_PTR(-ENOMEM);
1537 } 1534 }
1538 } 1535 }
1539
1540 out:
1541 mutex_unlock(&port_mutex);
1542 return state; 1536 return state;
1537
1538 err_unlock:
1539 state->count--;
1540 mutex_unlock(&state->mutex);
1541 err:
1542 return ERR_PTR(ret);
1543} 1543}
1544 1544
1545/* 1545/*
@@ -2085,45 +2085,6 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
2085 } 2085 }
2086} 2086}
2087 2087
2088/*
2089 * This reverses the effects of uart_configure_port, hanging up the
2090 * port before removal.
2091 */
2092static void
2093uart_unconfigure_port(struct uart_driver *drv, struct uart_state *state)
2094{
2095 struct uart_port *port = state->port;
2096 struct uart_info *info = state->info;
2097
2098 if (info && info->tty)
2099 tty_vhangup(info->tty);
2100
2101 mutex_lock(&state->mutex);
2102
2103 state->info = NULL;
2104
2105 /*
2106 * Free the port IO and memory resources, if any.
2107 */
2108 if (port->type != PORT_UNKNOWN)
2109 port->ops->release_port(port);
2110
2111 /*
2112 * Indicate that there isn't a port here anymore.
2113 */
2114 port->type = PORT_UNKNOWN;
2115
2116 /*
2117 * Kill the tasklet, and free resources.
2118 */
2119 if (info) {
2120 tasklet_kill(&info->tlet);
2121 kfree(info);
2122 }
2123
2124 mutex_unlock(&state->mutex);
2125}
2126
2127static struct tty_operations uart_ops = { 2088static struct tty_operations uart_ops = {
2128 .open = uart_open, 2089 .open = uart_open,
2129 .close = uart_close, 2090 .close = uart_close,
@@ -2270,6 +2231,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
2270 state = drv->state + port->line; 2231 state = drv->state + port->line;
2271 2232
2272 mutex_lock(&port_mutex); 2233 mutex_lock(&port_mutex);
2234 mutex_lock(&state->mutex);
2273 if (state->port) { 2235 if (state->port) {
2274 ret = -EINVAL; 2236 ret = -EINVAL;
2275 goto out; 2237 goto out;
@@ -2304,7 +2266,13 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
2304 port->cons && !(port->cons->flags & CON_ENABLED)) 2266 port->cons && !(port->cons->flags & CON_ENABLED))
2305 register_console(port->cons); 2267 register_console(port->cons);
2306 2268
2269 /*
2270 * Ensure UPF_DEAD is not set.
2271 */
2272 port->flags &= ~UPF_DEAD;
2273
2307 out: 2274 out:
2275 mutex_unlock(&state->mutex);
2308 mutex_unlock(&port_mutex); 2276 mutex_unlock(&port_mutex);
2309 2277
2310 return ret; 2278 return ret;
@@ -2322,6 +2290,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
2322int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port) 2290int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2323{ 2291{
2324 struct uart_state *state = drv->state + port->line; 2292 struct uart_state *state = drv->state + port->line;
2293 struct uart_info *info;
2325 2294
2326 BUG_ON(in_interrupt()); 2295 BUG_ON(in_interrupt());
2327 2296
@@ -2332,11 +2301,48 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2332 mutex_lock(&port_mutex); 2301 mutex_lock(&port_mutex);
2333 2302
2334 /* 2303 /*
2304 * Mark the port "dead" - this prevents any opens from
2305 * succeeding while we shut down the port.
2306 */
2307 mutex_lock(&state->mutex);
2308 port->flags |= UPF_DEAD;
2309 mutex_unlock(&state->mutex);
2310
2311 /*
2335 * Remove the devices from devfs 2312 * Remove the devices from devfs
2336 */ 2313 */
2337 tty_unregister_device(drv->tty_driver, port->line); 2314 tty_unregister_device(drv->tty_driver, port->line);
2338 2315
2339 uart_unconfigure_port(drv, state); 2316 info = state->info;
2317 if (info && info->tty)
2318 tty_vhangup(info->tty);
2319
2320 /*
2321 * All users of this port should now be disconnected from
2322 * this driver, and the port shut down. We should be the
2323 * only thread fiddling with this port from now on.
2324 */
2325 state->info = NULL;
2326
2327 /*
2328 * Free the port IO and memory resources, if any.
2329 */
2330 if (port->type != PORT_UNKNOWN)
2331 port->ops->release_port(port);
2332
2333 /*
2334 * Indicate that there isn't a port here anymore.
2335 */
2336 port->type = PORT_UNKNOWN;
2337
2338 /*
2339 * Kill the tasklet, and free resources.
2340 */
2341 if (info) {
2342 tasklet_kill(&info->tlet);
2343 kfree(info);
2344 }
2345
2340 state->port = NULL; 2346 state->port = NULL;
2341 mutex_unlock(&port_mutex); 2347 mutex_unlock(&port_mutex);
2342 2348
diff --git a/drivers/sn/ioc4.c b/drivers/sn/ioc4.c
index 67140a5804f5..cdeff909403e 100644
--- a/drivers/sn/ioc4.c
+++ b/drivers/sn/ioc4.c
@@ -310,7 +310,7 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
310 pci_set_drvdata(idd->idd_pdev, idd); 310 pci_set_drvdata(idd->idd_pdev, idd);
311 311
312 mutex_lock(&ioc4_mutex); 312 mutex_lock(&ioc4_mutex);
313 list_add(&idd->idd_list, &ioc4_devices); 313 list_add_tail(&idd->idd_list, &ioc4_devices);
314 314
315 /* Add this IOC4 to all submodules */ 315 /* Add this IOC4 to all submodules */
316 list_for_each_entry(is, &ioc4_submodules, is_list) { 316 list_for_each_entry(is, &ioc4_submodules, is_list) {
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 7860c8a5800d..956b7a1e8af9 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -69,7 +69,7 @@ static const char speedtch_driver_name[] = "speedtch";
69#define RESUBMIT_DELAY 1000 /* milliseconds */ 69#define RESUBMIT_DELAY 1000 /* milliseconds */
70 70
71#define DEFAULT_BULK_ALTSETTING 1 71#define DEFAULT_BULK_ALTSETTING 1
72#define DEFAULT_ISOC_ALTSETTING 2 72#define DEFAULT_ISOC_ALTSETTING 3
73#define DEFAULT_DL_512_FIRST 0 73#define DEFAULT_DL_512_FIRST 0
74#define DEFAULT_ENABLE_ISOC 0 74#define DEFAULT_ENABLE_ISOC 0
75#define DEFAULT_SW_BUFFERING 0 75#define DEFAULT_SW_BUFFERING 0
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index c1211fc037d9..546249843b8e 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -99,11 +99,11 @@ static const char usbatm_driver_name[] = "usbatm";
99 99
100#define UDSL_MAX_RCV_URBS 16 100#define UDSL_MAX_RCV_URBS 16
101#define UDSL_MAX_SND_URBS 16 101#define UDSL_MAX_SND_URBS 16
102#define UDSL_MAX_BUF_SIZE 64 * 1024 /* bytes */ 102#define UDSL_MAX_BUF_SIZE 65536
103#define UDSL_DEFAULT_RCV_URBS 4 103#define UDSL_DEFAULT_RCV_URBS 4
104#define UDSL_DEFAULT_SND_URBS 4 104#define UDSL_DEFAULT_SND_URBS 4
105#define UDSL_DEFAULT_RCV_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ 105#define UDSL_DEFAULT_RCV_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */
106#define UDSL_DEFAULT_SND_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ 106#define UDSL_DEFAULT_SND_BUF_SIZE 3392 /* 64 * ATM_CELL_SIZE */
107 107
108#define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) 108#define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD)
109 109
@@ -135,7 +135,7 @@ MODULE_PARM_DESC(rcv_buf_bytes,
135module_param(snd_buf_bytes, uint, S_IRUGO); 135module_param(snd_buf_bytes, uint, S_IRUGO);
136MODULE_PARM_DESC(snd_buf_bytes, 136MODULE_PARM_DESC(snd_buf_bytes,
137 "Size of the buffers used for transmission, in bytes (range: 1-" 137 "Size of the buffers used for transmission, in bytes (range: 1-"
138 __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " 138 __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: "
139 __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); 139 __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")");
140 140
141 141
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fbd938d4ea58..e2e00ba4e1e6 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1805,6 +1805,12 @@ int usb_add_hcd(struct usb_hcd *hcd,
1805 USB_SPEED_FULL; 1805 USB_SPEED_FULL;
1806 hcd->self.root_hub = rhdev; 1806 hcd->self.root_hub = rhdev;
1807 1807
1808 /* wakeup flag init defaults to "everything works" for root hubs,
1809 * but drivers can override it in reset() if needed, along with
1810 * recording the overall controller's system wakeup capability.
1811 */
1812 device_init_wakeup(&rhdev->dev, 1);
1813
1808 /* "reset" is misnamed; its role is now one-time init. the controller 1814 /* "reset" is misnamed; its role is now one-time init. the controller
1809 * should already have been reset (and boot firmware kicked off etc). 1815 * should already have been reset (and boot firmware kicked off etc).
1810 */ 1816 */
@@ -1813,13 +1819,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
1813 goto err_hcd_driver_setup; 1819 goto err_hcd_driver_setup;
1814 } 1820 }
1815 1821
1816 /* wakeup flag init is in transition; for now we can't rely on PCI to
1817 * initialize these bits properly, so we let reset() override it.
1818 * This init should _precede_ the reset() once PCI behaves.
1819 */
1820 device_init_wakeup(&rhdev->dev,
1821 device_can_wakeup(hcd->self.controller));
1822
1823 /* NOTE: root hub and controller capabilities may not be the same */ 1822 /* NOTE: root hub and controller capabilities may not be the same */
1824 if (device_can_wakeup(hcd->self.controller) 1823 if (device_can_wakeup(hcd->self.controller)
1825 && device_can_wakeup(&hcd->self.root_hub->dev)) 1824 && device_can_wakeup(&hcd->self.root_hub->dev))
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 0c87f73f2933..90b8d43c6b33 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1168,19 +1168,9 @@ static inline const char *plural(int n)
1168static int choose_configuration(struct usb_device *udev) 1168static int choose_configuration(struct usb_device *udev)
1169{ 1169{
1170 int i; 1170 int i;
1171 u16 devstatus;
1172 int bus_powered;
1173 int num_configs; 1171 int num_configs;
1174 struct usb_host_config *c, *best; 1172 struct usb_host_config *c, *best;
1175 1173
1176 /* If this fails, assume the device is bus-powered */
1177 devstatus = 0;
1178 usb_get_status(udev, USB_RECIP_DEVICE, 0, &devstatus);
1179 le16_to_cpus(&devstatus);
1180 bus_powered = ((devstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0);
1181 dev_dbg(&udev->dev, "device is %s-powered\n",
1182 bus_powered ? "bus" : "self");
1183
1184 best = NULL; 1174 best = NULL;
1185 c = udev->config; 1175 c = udev->config;
1186 num_configs = udev->descriptor.bNumConfigurations; 1176 num_configs = udev->descriptor.bNumConfigurations;
@@ -1197,6 +1187,19 @@ static int choose_configuration(struct usb_device *udev)
1197 * similar errors in their descriptors. If the next test 1187 * similar errors in their descriptors. If the next test
1198 * were allowed to execute, such configurations would always 1188 * were allowed to execute, such configurations would always
1199 * be rejected and the devices would not work as expected. 1189 * be rejected and the devices would not work as expected.
1190 * In the meantime, we run the risk of selecting a config
1191 * that requires external power at a time when that power
1192 * isn't available. It seems to be the lesser of two evils.
1193 *
1194 * Bugzilla #6448 reports a device that appears to crash
1195 * when it receives a GET_DEVICE_STATUS request! We don't
1196 * have any other way to tell whether a device is self-powered,
1197 * but since we don't use that information anywhere but here,
1198 * the call has been removed.
1199 *
1200 * Maybe the GET_DEVICE_STATUS call and the test below can
1201 * be reinstated when device firmwares become more reliable.
1202 * Don't hold your breath.
1200 */ 1203 */
1201#if 0 1204#if 0
1202 /* Rule out self-powered configs for a bus-powered device */ 1205 /* Rule out self-powered configs for a bus-powered device */
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 544f7589912f..73f5a379d9b3 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -863,7 +863,7 @@ static int ohci_restart (struct ohci_hcd *ohci)
863 i = ohci->num_ports; 863 i = ohci->num_ports;
864 while (i--) 864 while (i--)
865 ohci_writel (ohci, RH_PS_PSS, 865 ohci_writel (ohci, RH_PS_PSS,
866 &ohci->regs->roothub.portstatus [temp]); 866 &ohci->regs->roothub.portstatus [i]);
867 ohci_dbg (ohci, "restart complete\n"); 867 ohci_dbg (ohci, "restart complete\n");
868 } 868 }
869 return 0; 869 return 0;
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
index f419bd82ab7f..435273e7c85c 100644
--- a/drivers/usb/input/hid-core.c
+++ b/drivers/usb/input/hid-core.c
@@ -1557,6 +1557,9 @@ void hid_init_reports(struct hid_device *hid)
1557#define USB_VENDOR_ID_HP 0x03f0 1557#define USB_VENDOR_ID_HP 0x03f0
1558#define USB_DEVICE_ID_HP_USBHUB_KB 0x020c 1558#define USB_DEVICE_ID_HP_USBHUB_KB 0x020c
1559 1559
1560#define USB_VENDOR_ID_IBM 0x04b3
1561#define USB_DEVICE_ID_IBM_USBHUB_KB 0x3005
1562
1560#define USB_VENDOR_ID_CREATIVELABS 0x062a 1563#define USB_VENDOR_ID_CREATIVELABS 0x062a
1561#define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201 1564#define USB_DEVICE_ID_CREATIVELABS_SILVERCREST 0x0201
1562 1565
@@ -1681,6 +1684,7 @@ static const struct hid_blacklist {
1681 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, 1684 { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET},
1682 { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET }, 1685 { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVELABS_SILVERCREST, HID_QUIRK_NOGET },
1683 { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, 1686 { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET },
1687 { USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_USBHUB_KB, HID_QUIRK_NOGET },
1684 { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, 1688 { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET },
1685 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 1689 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
1686 { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET }, 1690 { USB_VENDOR_ID_SILVERCREST, USB_DEVICE_ID_SILVERCREST_KB, HID_QUIRK_NOGET },
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index 3824df33094e..1fd9cb85f4ca 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/usb.h> 17#include <linux/usb.h>
18#include <linux/delay.h>
18 19
19#define MAX_INTEL_HEX_RECORD_LENGTH 16 20#define MAX_INTEL_HEX_RECORD_LENGTH 16
20typedef struct _INTEL_HEX_RECORD 21typedef struct _INTEL_HEX_RECORD
@@ -114,6 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev)
114 115
115 /* De-assert reset (let the CPU run) */ 116 /* De-assert reset (let the CPU run) */
116 err = emi26_set_reset(dev,0); 117 err = emi26_set_reset(dev,0);
118 msleep(250); /* let device settle */
117 119
118 /* 2. We upload the FPGA firmware into the EMI 120 /* 2. We upload the FPGA firmware into the EMI
119 * Note: collect up to 1023 (yes!) bytes and send them with 121 * Note: collect up to 1023 (yes!) bytes and send them with
@@ -150,6 +152,7 @@ static int emi26_load_firmware (struct usb_device *dev)
150 goto wraperr; 152 goto wraperr;
151 } 153 }
152 } 154 }
155 msleep(250); /* let device settle */
153 156
154 /* De-assert reset (let the CPU run) */ 157 /* De-assert reset (let the CPU run) */
155 err = emi26_set_reset(dev,0); 158 err = emi26_set_reset(dev,0);
@@ -192,6 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev)
192 err("%s - error loading firmware: error = %d", __FUNCTION__, err); 195 err("%s - error loading firmware: error = %d", __FUNCTION__, err);
193 goto wraperr; 196 goto wraperr;
194 } 197 }
198 msleep(250); /* let device settle */
195 199
196 /* return 1 to fail the driver inialization 200 /* return 1 to fail the driver inialization
197 * and give real driver change to load */ 201 * and give real driver change to load */
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index 52fea2e08db8..fe351371f274 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/usb.h> 17#include <linux/usb.h>
18#include <linux/delay.h>
18 19
19#define MAX_INTEL_HEX_RECORD_LENGTH 16 20#define MAX_INTEL_HEX_RECORD_LENGTH 16
20typedef struct _INTEL_HEX_RECORD 21typedef struct _INTEL_HEX_RECORD
@@ -123,6 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev)
123 124
124 /* De-assert reset (let the CPU run) */ 125 /* De-assert reset (let the CPU run) */
125 err = emi62_set_reset(dev,0); 126 err = emi62_set_reset(dev,0);
127 msleep(250); /* let device settle */
126 128
127 /* 2. We upload the FPGA firmware into the EMI 129 /* 2. We upload the FPGA firmware into the EMI
128 * Note: collect up to 1023 (yes!) bytes and send them with 130 * Note: collect up to 1023 (yes!) bytes and send them with
@@ -166,6 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev)
166 err("%s - error loading firmware: error = %d", __FUNCTION__, err); 168 err("%s - error loading firmware: error = %d", __FUNCTION__, err);
167 goto wraperr; 169 goto wraperr;
168 } 170 }
171 msleep(250); /* let device settle */
169 172
170 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */ 173 /* 4. We put the part of the firmware that lies in the external RAM into the EZ-USB */
171 174
@@ -228,6 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev)
228 err("%s - error loading firmware: error = %d", __FUNCTION__, err); 231 err("%s - error loading firmware: error = %d", __FUNCTION__, err);
229 goto wraperr; 232 goto wraperr;
230 } 233 }
234 msleep(250); /* let device settle */
231 235
232 kfree(buf); 236 kfree(buf);
233 237
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index 2deb4c01539e..7683926a1b6f 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
318 set_register(pegasus, PhyCtrl, (indx | PHY_READ)); 318 set_register(pegasus, PhyCtrl, (indx | PHY_READ));
319 for (i = 0; i < REG_TIMEOUT; i++) { 319 for (i = 0; i < REG_TIMEOUT; i++) {
320 ret = get_registers(pegasus, PhyCtrl, 1, data); 320 ret = get_registers(pegasus, PhyCtrl, 1, data);
321 if (ret == -ESHUTDOWN)
322 goto fail;
321 if (data[0] & PHY_DONE) 323 if (data[0] & PHY_DONE)
322 break; 324 break;
323 } 325 }
@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
326 *regd = le16_to_cpu(regdi); 328 *regd = le16_to_cpu(regdi);
327 return ret; 329 return ret;
328 } 330 }
331fail:
329 if (netif_msg_drv(pegasus)) 332 if (netif_msg_drv(pegasus))
330 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 333 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
331 334
@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
354 set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); 357 set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));
355 for (i = 0; i < REG_TIMEOUT; i++) { 358 for (i = 0; i < REG_TIMEOUT; i++) {
356 ret = get_registers(pegasus, PhyCtrl, 1, data); 359 ret = get_registers(pegasus, PhyCtrl, 1, data);
360 if (ret == -ESHUTDOWN)
361 goto fail;
357 if (data[0] & PHY_DONE) 362 if (data[0] & PHY_DONE)
358 break; 363 break;
359 } 364 }
360 if (i < REG_TIMEOUT) 365 if (i < REG_TIMEOUT)
361 return ret; 366 return ret;
362 367
368fail:
363 if (netif_msg_drv(pegasus)) 369 if (netif_msg_drv(pegasus))
364 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 370 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
365 return -ETIMEDOUT; 371 return -ETIMEDOUT;
@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
387 ret = get_registers(pegasus, EpromCtrl, 1, &tmp); 393 ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
388 if (tmp & EPROM_DONE) 394 if (tmp & EPROM_DONE)
389 break; 395 break;
396 if (ret == -ESHUTDOWN)
397 goto fail;
390 } 398 }
391 if (i < REG_TIMEOUT) { 399 if (i < REG_TIMEOUT) {
392 ret = get_registers(pegasus, EpromData, 2, &retdatai); 400 ret = get_registers(pegasus, EpromData, 2, &retdatai);
@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
394 return ret; 402 return ret;
395 } 403 }
396 404
405fail:
397 if (netif_msg_drv(pegasus)) 406 if (netif_msg_drv(pegasus))
398 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 407 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
399 return -ETIMEDOUT; 408 return -ETIMEDOUT;
@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
433 442
434 for (i = 0; i < REG_TIMEOUT; i++) { 443 for (i = 0; i < REG_TIMEOUT; i++) {
435 ret = get_registers(pegasus, EpromCtrl, 1, &tmp); 444 ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
445 if (ret == -ESHUTDOWN)
446 goto fail;
436 if (tmp & EPROM_DONE) 447 if (tmp & EPROM_DONE)
437 break; 448 break;
438 } 449 }
439 disable_eprom_write(pegasus); 450 disable_eprom_write(pegasus);
440 if (i < REG_TIMEOUT) 451 if (i < REG_TIMEOUT)
441 return ret; 452 return ret;
453fail:
442 if (netif_msg_drv(pegasus)) 454 if (netif_msg_drv(pegasus))
443 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 455 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
444 return -ETIMEDOUT; 456 return -ETIMEDOUT;
@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
1378 struct pegasus *pegasus = usb_get_intfdata(intf); 1390 struct pegasus *pegasus = usb_get_intfdata(intf);
1379 1391
1380 netif_device_detach (pegasus->net); 1392 netif_device_detach (pegasus->net);
1393 cancel_delayed_work(&pegasus->carrier_check);
1381 if (netif_running(pegasus->net)) { 1394 if (netif_running(pegasus->net)) {
1382 cancel_delayed_work(&pegasus->carrier_check);
1383
1384 usb_kill_urb(pegasus->rx_urb); 1395 usb_kill_urb(pegasus->rx_urb);
1385 usb_kill_urb(pegasus->intr_urb); 1396 usb_kill_urb(pegasus->intr_urb);
1386 } 1397 }
@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf)
1400 pegasus->intr_urb->status = 0; 1411 pegasus->intr_urb->status = 0;
1401 pegasus->intr_urb->actual_length = 0; 1412 pegasus->intr_urb->actual_length = 0;
1402 intr_callback(pegasus->intr_urb, NULL); 1413 intr_callback(pegasus->intr_urb, NULL);
1403
1404 queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
1405 CARRIER_CHECK_DELAY);
1406 } 1414 }
1415 queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
1416 CARRIER_CHECK_DELAY);
1407 return 0; 1417 return 0;
1408} 1418}
1409 1419
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index f96b73f54bf1..5c60be521561 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -71,6 +71,16 @@ config USB_SERIAL_ANYDATA
71 To compile this driver as a module, choose M here: the 71 To compile this driver as a module, choose M here: the
72 module will be called anydata. 72 module will be called anydata.
73 73
74config USB_SERIAL_ARK3116
75 tristate "USB ARK Micro 3116 USB Serial Driver (EXPERIMENTAL)"
76 depends on USB_SERIAL && EXPERIMENTAL
77 help
78 Say Y here if you want to use a ARK Micro 3116 USB to Serial
79 device.
80
81 To compile this driver as a module, choose M here: the
82 module will be called ark3116
83
74config USB_SERIAL_BELKIN 84config USB_SERIAL_BELKIN
75 tristate "USB Belkin and Peracom Single Port Serial Driver" 85 tristate "USB Belkin and Peracom Single Port Serial Driver"
76 depends on USB_SERIAL 86 depends on USB_SERIAL
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile
index 93c21245b1af..5a0960fc9d3e 100644
--- a/drivers/usb/serial/Makefile
+++ b/drivers/usb/serial/Makefile
@@ -13,6 +13,7 @@ usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y)
13 13
14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o 14obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o
15obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o 15obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o
16obj-$(CONFIG_USB_SERIAL_ARK3116) += ark3116.o
16obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o 17obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o
17obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o 18obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o
18obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o 19obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c
index dbf1f063098c..694b205f9b73 100644
--- a/drivers/usb/serial/airprime.c
+++ b/drivers/usb/serial/airprime.c
@@ -18,6 +18,7 @@
18static struct usb_device_id id_table [] = { 18static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */ 19 { USB_DEVICE(0xf3d, 0x0112) }, /* AirPrime CDMA Wireless PC Card */
20 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ 20 { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */
21 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless Aircard 580 */
21 { }, 22 { },
22}; 23};
23MODULE_DEVICE_TABLE(usb, id_table); 24MODULE_DEVICE_TABLE(usb, id_table);
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
new file mode 100644
index 000000000000..8dec796222a0
--- /dev/null
+++ b/drivers/usb/serial/ark3116.c
@@ -0,0 +1,465 @@
1/*
2 * ark3116
3 * - implements a driver for the arkmicro ark3116 chipset (vendor=0x6547,
4 * productid=0x0232) (used in a datacable called KQ-U8A)
5 *
6 * - based on code by krisfx -> thanks !!
7 * (see http://www.linuxquestions.org/questions/showthread.php?p=2184457#post2184457)
8 *
9 * - based on logs created by usbsnoopy
10 *
11 * Author : Simon Schulz [ark3116_driver<AT>auctionant.de]
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/tty.h>
22#include <linux/module.h>
23#include <linux/usb.h>
24#include "usb-serial.h"
25
26
27static int debug;
28
29static struct usb_device_id id_table [] = {
30 { USB_DEVICE(0x6547, 0x0232) },
31 { },
32};
33MODULE_DEVICE_TABLE(usb, id_table);
34
35struct ark3116_private {
36 spinlock_t lock;
37 u8 termios_initialized;
38};
39
40static inline void ARK3116_SND(struct usb_serial *serial, int seq,
41 __u8 request, __u8 requesttype,
42 __u16 value, __u16 index)
43{
44 int result;
45 result = usb_control_msg(serial->dev,
46 usb_sndctrlpipe(serial->dev,0),
47 request, requesttype, value, index,
48 NULL,0x00, 1000);
49 dbg("%03d > ok",seq);
50}
51
52static inline void ARK3116_RCV(struct usb_serial *serial, int seq,
53 __u8 request, __u8 requesttype,
54 __u16 value, __u16 index, __u8 expected,
55 char *buf)
56{
57 int result;
58 result = usb_control_msg(serial->dev,
59 usb_rcvctrlpipe(serial->dev,0),
60 request, requesttype, value, index,
61 buf, 0x0000001, 1000);
62 if (result)
63 dbg("%03d < %d bytes [0x%02X]",seq, result, buf[0]);
64 else
65 dbg("%03d < 0 bytes", seq);
66}
67
68
69static inline void ARK3116_RCV_QUIET(struct usb_serial *serial,
70 __u8 request, __u8 requesttype,
71 __u16 value, __u16 index, char *buf)
72{
73 usb_control_msg(serial->dev,
74 usb_rcvctrlpipe(serial->dev,0),
75 request, requesttype, value, index,
76 buf, 0x0000001, 1000);
77}
78
79
80static int ark3116_attach(struct usb_serial *serial)
81{
82 char *buf;
83 struct ark3116_private *priv;
84 int i;
85
86 for (i = 0; i < serial->num_ports; ++i) {
87 priv = kmalloc (sizeof (struct ark3116_private), GFP_KERNEL);
88 if (!priv)
89 goto cleanup;
90 memset (priv, 0x00, sizeof (struct ark3116_private));
91 spin_lock_init(&priv->lock);
92
93 usb_set_serial_port_data(serial->port[i], priv);
94 }
95
96 buf = kmalloc(1, GFP_KERNEL);
97 if (!buf) {
98 dbg("error kmalloc -> out of mem ?");
99 goto cleanup;
100 }
101
102 /* 3 */
103 ARK3116_SND(serial, 3,0xFE,0x40,0x0008,0x0002);
104 ARK3116_SND(serial, 4,0xFE,0x40,0x0008,0x0001);
105 ARK3116_SND(serial, 5,0xFE,0x40,0x0000,0x0008);
106 ARK3116_SND(serial, 6,0xFE,0x40,0x0000,0x000B);
107
108 /* <-- seq7 */
109 ARK3116_RCV(serial, 7,0xFE,0xC0,0x0000,0x0003, 0x00, buf);
110 ARK3116_SND(serial, 8,0xFE,0x40,0x0080,0x0003);
111 ARK3116_SND(serial, 9,0xFE,0x40,0x001A,0x0000);
112 ARK3116_SND(serial,10,0xFE,0x40,0x0000,0x0001);
113 ARK3116_SND(serial,11,0xFE,0x40,0x0000,0x0003);
114
115 /* <-- seq12 */
116 ARK3116_RCV(serial,12,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
117 ARK3116_SND(serial,13,0xFE,0x40,0x0000,0x0004);
118
119 /* 14 */
120 ARK3116_RCV(serial,14,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
121 ARK3116_SND(serial,15,0xFE,0x40,0x0000,0x0004);
122
123 /* 16 */
124 ARK3116_RCV(serial,16,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
125 /* --> seq17 */
126 ARK3116_SND(serial,17,0xFE,0x40,0x0001,0x0004);
127
128 /* <-- seq18 */
129 ARK3116_RCV(serial,18,0xFE,0xC0,0x0000,0x0004, 0x01, buf);
130
131 /* --> seq19 */
132 ARK3116_SND(serial,19,0xFE,0x40,0x0003,0x0004);
133
134
135 /* <-- seq20 */
136 /* seems like serial port status info (RTS, CTS,...) */
137 /* returns modem control line status ?! */
138 ARK3116_RCV(serial,20,0xFE,0xC0,0x0000,0x0006, 0xFF, buf);
139
140 /* set 9600 baud & do some init ?! */
141 ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003);
142 ARK3116_SND(serial,148,0xFE,0x40,0x0038,0x0000);
143 ARK3116_SND(serial,149,0xFE,0x40,0x0001,0x0001);
144 ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003);
145 ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf);
146 ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003);
147 ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf);
148 ARK3116_SND(serial,154,0xFE,0x40,0x0003,0x0003);
149
150 kfree(buf);
151 return(0);
152
153cleanup:
154 for (--i; i>=0; --i)
155 usb_set_serial_port_data(serial->port[i], NULL);
156 return -ENOMEM;
157}
158
159static void ark3116_set_termios(struct usb_serial_port *port,
160 struct termios *old_termios)
161{
162 struct usb_serial *serial = port->serial;
163 struct ark3116_private *priv = usb_get_serial_port_data(port);
164 unsigned int cflag = port->tty->termios->c_cflag;
165 unsigned long flags;
166 int baud;
167 int ark3116_baud;
168 char *buf;
169 char config;
170
171 config = 0;
172
173 dbg("%s - port %d", __FUNCTION__, port->number);
174
175 if ((!port->tty) || (!port->tty->termios)) {
176 dbg("%s - no tty structures", __FUNCTION__);
177 return;
178 }
179
180 spin_lock_irqsave(&priv->lock, flags);
181 if (!priv->termios_initialized) {
182 *(port->tty->termios) = tty_std_termios;
183 port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
184 priv->termios_initialized = 1;
185 }
186 spin_unlock_irqrestore(&priv->lock, flags);
187
188 cflag = port->tty->termios->c_cflag;
189
190 /* check that they really want us to change something: */
191 if (old_termios) {
192 if ((cflag == old_termios->c_cflag) &&
193 (RELEVANT_IFLAG(port->tty->termios->c_iflag) ==
194 RELEVANT_IFLAG(old_termios->c_iflag))) {
195 dbg("%s - nothing to change...", __FUNCTION__);
196 return;
197 }
198 }
199
200 buf = kmalloc(1, GFP_KERNEL);
201 if (!buf) {
202 dbg("error kmalloc");
203 return;
204 }
205
206 /* set data bit count (8/7/6/5) */
207 if (cflag & CSIZE){
208 switch (cflag & CSIZE){
209 case CS5:
210 config |= 0x00;
211 dbg("setting CS5");
212 break;
213 case CS6:
214 config |= 0x01;
215 dbg("setting CS6");
216 break;
217 case CS7:
218 config |= 0x02;
219 dbg("setting CS7");
220 break;
221 default:
222 err ("CSIZE was set but not CS5-CS8, using CS8!");
223 case CS8:
224 config |= 0x03;
225 dbg("setting CS8");
226 break;
227 }
228 }
229
230 /* set parity (NONE,EVEN,ODD) */
231 if (cflag & PARENB){
232 if (cflag & PARODD) {
233 config |= 0x08;
234 dbg("setting parity to ODD");
235 } else {
236 config |= 0x18;
237 dbg("setting parity to EVEN");
238 }
239 } else {
240 dbg("setting parity to NONE");
241 }
242
243 /* SET STOPBIT (1/2) */
244 if (cflag & CSTOPB) {
245 config |= 0x04;
246 dbg ("setting 2 stop bits");
247 } else {
248 dbg ("setting 1 stop bit");
249 }
250
251
252 /* set baudrate: */
253 baud = 0;
254 switch (cflag & CBAUD){
255 case B0:
256 err("can't set 0baud, using 9600 instead");
257 break;
258 case B75: baud = 75; break;
259 case B150: baud = 150; break;
260 case B300: baud = 300; break;
261 case B600: baud = 600; break;
262 case B1200: baud = 1200; break;
263 case B1800: baud = 1800; break;
264 case B2400: baud = 2400; break;
265 case B4800: baud = 4800; break;
266 case B9600: baud = 9600; break;
267 case B19200: baud = 19200; break;
268 case B38400: baud = 38400; break;
269 case B57600: baud = 57600; break;
270 case B115200: baud = 115200; break;
271 case B230400: baud = 230400; break;
272 case B460800: baud = 460800; break;
273 default:
274 dbg("does not support the baudrate requested (fix it)");
275 break;
276 }
277
278 /* set 9600 as default (if given baudrate is invalid for example) */
279 if (baud == 0)
280 baud = 9600;
281
282 /*
283 * found by try'n'error, be careful, maybe there are other options
284 * for multiplicator etc!
285 */
286 if (baud == 460800)
287 /* strange, for 460800 the formula is wrong
288 * (dont use round(), then 9600baud is wrong) */
289 ark3116_baud = 7;
290 else
291 ark3116_baud = 3000000 / baud;
292
293 /* ? */
294 ARK3116_RCV(serial,0,0xFE,0xC0,0x0000,0x0003, 0x03, buf);
295 /* offset = buf[0]; */
296 /* offset = 0x03; */
297 /* dbg("using 0x%04X as target for 0x0003:",0x0080+offset); */
298
299
300 /* set baudrate */
301 dbg("setting baudrate to %d (->reg=%d)",baud,ark3116_baud);
302 ARK3116_SND(serial,147,0xFE,0x40,0x0083,0x0003);
303 ARK3116_SND(serial,148,0xFE,0x40,(ark3116_baud & 0x00FF) ,0x0000);
304 ARK3116_SND(serial,149,0xFE,0x40,(ark3116_baud & 0xFF00)>>8,0x0001);
305 ARK3116_SND(serial,150,0xFE,0x40,0x0003,0x0003);
306
307 /* ? */
308 ARK3116_RCV(serial,151,0xFE,0xC0,0x0000,0x0004,0x03, buf);
309 ARK3116_SND(serial,152,0xFE,0x40,0x0000,0x0003);
310
311 /* set data bit count, stop bit count & parity: */
312 dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config);
313 ARK3116_RCV(serial,153,0xFE,0xC0,0x0000,0x0003,0x00, buf);
314 ARK3116_SND(serial,154,0xFE,0x40,config,0x0003);
315
316 if (cflag & CRTSCTS)
317 dbg("CRTSCTS not supported by chipset ?!");
318
319 /* TEST ARK3116_SND(154,0xFE,0x40,0xFFFF, 0x0006); */
320
321 kfree(buf);
322 return;
323}
324
325static int ark3116_open(struct usb_serial_port *port, struct file *filp)
326{
327 struct termios tmp_termios;
328 struct usb_serial *serial = port->serial;
329 char *buf;
330 int result = 0;
331
332 dbg("%s - port %d", __FUNCTION__, port->number);
333
334 buf = kmalloc(1, GFP_KERNEL);
335 if (!buf) {
336 dbg("error kmalloc -> out of mem ?");
337 return -ENOMEM;
338 }
339
340 result = usb_serial_generic_open(port, filp);
341 if (result)
342 return result;
343
344 /* open */
345 ARK3116_RCV(serial,111,0xFE,0xC0,0x0000,0x0003, 0x02, buf);
346
347 ARK3116_SND(serial,112,0xFE,0x40,0x0082,0x0003);
348 ARK3116_SND(serial,113,0xFE,0x40,0x001A,0x0000);
349 ARK3116_SND(serial,114,0xFE,0x40,0x0000,0x0001);
350 ARK3116_SND(serial,115,0xFE,0x40,0x0002,0x0003);
351
352 ARK3116_RCV(serial,116,0xFE,0xC0,0x0000,0x0004, 0x03, buf);
353 ARK3116_SND(serial,117,0xFE,0x40,0x0002,0x0004);
354
355 ARK3116_RCV(serial,118,0xFE,0xC0,0x0000,0x0004, 0x02, buf);
356 ARK3116_SND(serial,119,0xFE,0x40,0x0000,0x0004);
357
358 ARK3116_RCV(serial,120,0xFE,0xC0,0x0000,0x0004, 0x00, buf);
359
360 ARK3116_SND(serial,121,0xFE,0x40,0x0001,0x0004);
361
362 ARK3116_RCV(serial,122,0xFE,0xC0,0x0000,0x0004, 0x01, buf);
363
364 ARK3116_SND(serial,123,0xFE,0x40,0x0003,0x0004);
365
366 /* returns different values (control lines ?!) */
367 ARK3116_RCV(serial,124,0xFE,0xC0,0x0000,0x0006, 0xFF, buf);
368
369 /* initialise termios: */
370 if (port->tty)
371 ark3116_set_termios(port, &tmp_termios);
372
373 kfree(buf);
374
375 return result;
376
377}
378
379static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
380 unsigned int cmd, unsigned long arg)
381{
382 dbg("ioctl not supported yet...");
383 return -ENOIOCTLCMD;
384}
385
386static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file)
387{
388 struct usb_serial *serial = port->serial;
389 char *buf;
390 char temp;
391
392 /* seems like serial port status info (RTS, CTS,...) is stored
393 * in reg(?) 0x0006
394 * pcb connection point 11 = GND -> sets bit4 of response
395 * pcb connection point 7 = GND -> sets bit6 of response
396 */
397
398 buf = kmalloc(1, GFP_KERNEL);
399 if (!buf) {
400 dbg("error kmalloc");
401 return -ENOMEM;
402 }
403
404 /* read register: */
405 ARK3116_RCV_QUIET(serial,0xFE,0xC0,0x0000,0x0006,buf);
406 temp = buf[0];
407 kfree(buf);
408
409 /* i do not really know if bit4=CTS and bit6=DSR... was just a
410 * quick guess !!
411 */
412 return (temp & (1<<4) ? TIOCM_CTS : 0) |
413 (temp & (1<<6) ? TIOCM_DSR : 0);
414}
415
416static struct usb_driver ark3116_driver = {
417 .name = "ark3116",
418 .probe = usb_serial_probe,
419 .disconnect = usb_serial_disconnect,
420 .id_table = id_table,
421};
422
423static struct usb_serial_driver ark3116_device = {
424 .driver = {
425 .owner = THIS_MODULE,
426 .name = "ark3116",
427 },
428 .id_table = id_table,
429 .num_interrupt_in = 1,
430 .num_bulk_in = 1,
431 .num_bulk_out = 1,
432 .num_ports = 1,
433 .attach = ark3116_attach,
434 .set_termios = ark3116_set_termios,
435 .ioctl = ark3116_ioctl,
436 .tiocmget = ark3116_tiocmget,
437 .open = ark3116_open,
438};
439
440static int __init ark3116_init(void)
441{
442 int retval;
443
444 retval = usb_serial_register(&ark3116_device);
445 if (retval)
446 return retval;
447 retval = usb_register(&ark3116_driver);
448 if (retval)
449 usb_serial_deregister(&ark3116_device);
450 return retval;
451}
452
453static void __exit ark3116_exit(void)
454{
455 usb_deregister(&ark3116_driver);
456 usb_serial_deregister(&ark3116_device);
457}
458
459module_init(ark3116_init);
460module_exit(ark3116_exit);
461MODULE_LICENSE("GPL");
462
463module_param(debug, bool, S_IRUGO | S_IWUSR);
464MODULE_PARM_DESC(debug, "Debug enabled or not");
465
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 82151207d814..986d7622273d 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -307,6 +307,7 @@ static struct ftdi_sio_quirk ftdi_HE_TIRA1_quirk = {
307 307
308 308
309static struct usb_device_id id_table_combined [] = { 309static struct usb_device_id id_table_combined [] = {
310 { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) },
310 { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) }, 311 { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) },
311 { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) }, 312 { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) },
312 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) }, 313 { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
@@ -498,6 +499,7 @@ static struct usb_device_id id_table_combined [] = {
498 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, 499 { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) },
499 { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) }, 500 { USB_DEVICE(ICOM_ID1_VID, ICOM_ID1_PID) },
500 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) }, 501 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_TMU_PID) },
502 { USB_DEVICE(FTDI_VID, FTDI_ACG_HFDUAL_PID) },
501 { }, /* Optional parameter entry */ 503 { }, /* Optional parameter entry */
502 { } /* Terminating entry */ 504 { } /* Terminating entry */
503}; 505};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 2c55a5ea9c99..d69a917e768f 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -32,6 +32,10 @@
32#define FTDI_NF_RIC_PID 0x0001 /* Product Id */ 32#define FTDI_NF_RIC_PID 0x0001 /* Product Id */
33 33
34 34
35/* ACT Solutions HomePro ZWave interface (http://www.act-solutions.com/HomePro.htm) */
36#define FTDI_ACTZWAVE_PID 0xF2D0
37
38
35/* www.irtrans.de device */ 39/* www.irtrans.de device */
36#define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ 40#define FTDI_IRTRANS_PID 0xFC60 /* Product Id */
37 41
@@ -426,6 +430,11 @@
426#define PAPOUCH_VID 0x5050 /* Vendor ID */ 430#define PAPOUCH_VID 0x5050 /* Vendor ID */
427#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ 431#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
428 432
433/*
434 * ACG Identification Technologies GmbH products (http://www.acg.de/).
435 * Submitted by anton -at- goto10 -dot- org.
436 */
437#define FTDI_ACG_HFDUAL_PID 0xDD20 /* HF Dual ISO Reader (RFID) */
429 438
430/* Commands */ 439/* Commands */
431#define FTDI_SIO_RESET 0 /* Reset the port */ 440#define FTDI_SIO_RESET 0 /* Reset the port */
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 476cda107f4f..c62cc2876519 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -138,6 +138,7 @@ int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp)
138 138
139 return result; 139 return result;
140} 140}
141EXPORT_SYMBOL_GPL(usb_serial_generic_open);
141 142
142static void generic_cleanup (struct usb_serial_port *port) 143static void generic_cleanup (struct usb_serial_port *port)
143{ 144{
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index 4d40704dea2c..238033a87092 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -257,14 +257,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
257 return (0); 257 return (0);
258 } 258 }
259 259
260 spin_lock(&port->lock); 260 spin_lock(&wport->lock);
261 if (port->write_urb_busy) { 261 if (wport->write_urb_busy) {
262 spin_unlock(&port->lock); 262 spin_unlock(&wport->lock);
263 dbg("%s - already writing", __FUNCTION__); 263 dbg("%s - already writing", __FUNCTION__);
264 return 0; 264 return 0;
265 } 265 }
266 port->write_urb_busy = 1; 266 wport->write_urb_busy = 1;
267 spin_unlock(&port->lock); 267 spin_unlock(&wport->lock);
268 268
269 count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; 269 count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
270 270
@@ -283,7 +283,7 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
283 wport->write_urb->dev = serial->dev; 283 wport->write_urb->dev = serial->dev;
284 result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); 284 result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
285 if (result) { 285 if (result) {
286 port->write_urb_busy = 0; 286 wport->write_urb_busy = 0;
287 err("%s - failed submitting write urb, error %d", __FUNCTION__, result); 287 err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
288 } else 288 } else
289 result = count; 289 result = count;
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 071f86a59c08..9c36f0ece20f 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -189,11 +189,15 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
189 189
190 portNumber = tty->index - serial->minor; 190 portNumber = tty->index - serial->minor;
191 port = serial->port[portNumber]; 191 port = serial->port[portNumber];
192 if (!port) 192 if (!port) {
193 return -ENODEV; 193 retval = -ENODEV;
194 goto bailout_kref_put;
195 }
194 196
195 if (mutex_lock_interruptible(&port->mutex)) 197 if (mutex_lock_interruptible(&port->mutex)) {
196 return -ERESTARTSYS; 198 retval = -ERESTARTSYS;
199 goto bailout_kref_put;
200 }
197 201
198 ++port->open_count; 202 ++port->open_count;
199 203
@@ -209,7 +213,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
209 * safe because we are called with BKL held */ 213 * safe because we are called with BKL held */
210 if (!try_module_get(serial->type->driver.owner)) { 214 if (!try_module_get(serial->type->driver.owner)) {
211 retval = -ENODEV; 215 retval = -ENODEV;
212 goto bailout_kref_put; 216 goto bailout_mutex_unlock;
213 } 217 }
214 218
215 /* only call the device specific open if this 219 /* only call the device specific open if this
@@ -224,10 +228,11 @@ static int serial_open (struct tty_struct *tty, struct file * filp)
224 228
225bailout_module_put: 229bailout_module_put:
226 module_put(serial->type->driver.owner); 230 module_put(serial->type->driver.owner);
227bailout_kref_put: 231bailout_mutex_unlock:
228 kref_put(&serial->kref, destroy_serial);
229 port->open_count = 0; 232 port->open_count = 0;
230 mutex_unlock(&port->mutex); 233 mutex_unlock(&port->mutex);
234bailout_kref_put:
235 kref_put(&serial->kref, destroy_serial);
231 return retval; 236 return retval;
232} 237}
233 238
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 334b1db1bd7c..27597c576eff 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -29,12 +29,15 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
29 29
30static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count) 30static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count)
31{ 31{
32 int rc = -ENXIO, power; 32 int rc = -ENXIO;
33 char *endp; 33 char *endp;
34 struct backlight_device *bd = to_backlight_device(cdev); 34 struct backlight_device *bd = to_backlight_device(cdev);
35 int power = simple_strtoul(buf, &endp, 0);
36 size_t size = endp - buf;
35 37
36 power = simple_strtoul(buf, &endp, 0); 38 if (*endp && isspace(*endp))
37 if (*endp && !isspace(*endp)) 39 size++;
40 if (size != count)
38 return -EINVAL; 41 return -EINVAL;
39 42
40 down(&bd->sem); 43 down(&bd->sem);
@@ -65,12 +68,15 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)
65 68
66static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count) 69static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count)
67{ 70{
68 int rc = -ENXIO, brightness; 71 int rc = -ENXIO;
69 char *endp; 72 char *endp;
70 struct backlight_device *bd = to_backlight_device(cdev); 73 struct backlight_device *bd = to_backlight_device(cdev);
74 int brightness = simple_strtoul(buf, &endp, 0);
75 size_t size = endp - buf;
71 76
72 brightness = simple_strtoul(buf, &endp, 0); 77 if (*endp && isspace(*endp))
73 if (*endp && !isspace(*endp)) 78 size++;
79 if (size != count)
74 return -EINVAL; 80 return -EINVAL;
75 81
76 down(&bd->sem); 82 down(&bd->sem);
diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
index 86908a60c630..bc8ab005a3fb 100644
--- a/drivers/video/backlight/lcd.c
+++ b/drivers/video/backlight/lcd.c
@@ -31,12 +31,15 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
31 31
32static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count) 32static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count)
33{ 33{
34 int rc, power; 34 int rc = -ENXIO;
35 char *endp; 35 char *endp;
36 struct lcd_device *ld = to_lcd_device(cdev); 36 struct lcd_device *ld = to_lcd_device(cdev);
37 int power = simple_strtoul(buf, &endp, 0);
38 size_t size = endp - buf;
37 39
38 power = simple_strtoul(buf, &endp, 0); 40 if (*endp && isspace(*endp))
39 if (*endp && !isspace(*endp)) 41 size++;
42 if (size != count)
40 return -EINVAL; 43 return -EINVAL;
41 44
42 down(&ld->sem); 45 down(&ld->sem);
@@ -44,8 +47,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
44 pr_debug("lcd: set power to %d\n", power); 47 pr_debug("lcd: set power to %d\n", power);
45 ld->props->set_power(ld, power); 48 ld->props->set_power(ld, power);
46 rc = count; 49 rc = count;
47 } else 50 }
48 rc = -ENXIO;
49 up(&ld->sem); 51 up(&ld->sem);
50 52
51 return rc; 53 return rc;
@@ -53,14 +55,12 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
53 55
54static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf) 56static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
55{ 57{
56 int rc; 58 int rc = -ENXIO;
57 struct lcd_device *ld = to_lcd_device(cdev); 59 struct lcd_device *ld = to_lcd_device(cdev);
58 60
59 down(&ld->sem); 61 down(&ld->sem);
60 if (likely(ld->props && ld->props->get_contrast)) 62 if (likely(ld->props && ld->props->get_contrast))
61 rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld)); 63 rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));
62 else
63 rc = -ENXIO;
64 up(&ld->sem); 64 up(&ld->sem);
65 65
66 return rc; 66 return rc;
@@ -68,12 +68,15 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
68 68
69static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count) 69static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count)
70{ 70{
71 int rc, contrast; 71 int rc = -ENXIO;
72 char *endp; 72 char *endp;
73 struct lcd_device *ld = to_lcd_device(cdev); 73 struct lcd_device *ld = to_lcd_device(cdev);
74 int contrast = simple_strtoul(buf, &endp, 0);
75 size_t size = endp - buf;
74 76
75 contrast = simple_strtoul(buf, &endp, 0); 77 if (*endp && isspace(*endp))
76 if (*endp && !isspace(*endp)) 78 size++;
79 if (size != count)
77 return -EINVAL; 80 return -EINVAL;
78 81
79 down(&ld->sem); 82 down(&ld->sem);
@@ -81,8 +84,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
81 pr_debug("lcd: set contrast to %d\n", contrast); 84 pr_debug("lcd: set contrast to %d\n", contrast);
82 ld->props->set_contrast(ld, contrast); 85 ld->props->set_contrast(ld, contrast);
83 rc = count; 86 rc = count;
84 } else 87 }
85 rc = -ENXIO;
86 up(&ld->sem); 88 up(&ld->sem);
87 89
88 return rc; 90 return rc;
@@ -90,14 +92,12 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
90 92
91static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf) 93static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf)
92{ 94{
93 int rc; 95 int rc = -ENXIO;
94 struct lcd_device *ld = to_lcd_device(cdev); 96 struct lcd_device *ld = to_lcd_device(cdev);
95 97
96 down(&ld->sem); 98 down(&ld->sem);
97 if (likely(ld->props)) 99 if (likely(ld->props))
98 rc = sprintf(buf, "%d\n", ld->props->max_contrast); 100 rc = sprintf(buf, "%d\n", ld->props->max_contrast);
99 else
100 rc = -ENXIO;
101 up(&ld->sem); 101 up(&ld->sem);
102 102
103 return rc; 103 return rc;
diff --git a/drivers/video/logo/Makefile b/drivers/video/logo/Makefile
index 4ef5cd19609d..b985dfad6c63 100644
--- a/drivers/video/logo/Makefile
+++ b/drivers/video/logo/Makefile
@@ -34,7 +34,7 @@ extra-y += $(call logo-cfiles,_clut224,ppm)
34extra-y += $(call logo-cfiles,_gray256,pgm) 34extra-y += $(call logo-cfiles,_gray256,pgm)
35 35
36# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..." 36# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
37quiet_cmd_logo = LOGO $@ 37quiet_cmd_logo = LOGO $@
38 cmd_logo = scripts/pnmtologo \ 38 cmd_logo = scripts/pnmtologo \
39 -t $(patsubst $*_%,%,$(notdir $(basename $<))) \ 39 -t $(patsubst $*_%,%,$(notdir $(basename $<))) \
40 -n $(notdir $(basename $<)) -o $@ $< 40 -n $(notdir $(basename $<)) -o $@ $<
diff --git a/fs/9p/fcall.c b/fs/9p/fcall.c
index 71742ba150c4..6f2617820a4e 100644
--- a/fs/9p/fcall.c
+++ b/fs/9p/fcall.c
@@ -98,23 +98,20 @@ v9fs_t_attach(struct v9fs_session_info *v9ses, char *uname, char *aname,
98static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc, 98static void v9fs_t_clunk_cb(void *a, struct v9fs_fcall *tc,
99 struct v9fs_fcall *rc, int err) 99 struct v9fs_fcall *rc, int err)
100{ 100{
101 int fid; 101 int fid, id;
102 struct v9fs_session_info *v9ses; 102 struct v9fs_session_info *v9ses;
103 103
104 if (err) 104 id = 0;
105 return;
106
107 fid = tc->params.tclunk.fid; 105 fid = tc->params.tclunk.fid;
108 kfree(tc); 106 if (rc)
109 107 id = rc->id;
110 if (!rc)
111 return;
112
113 v9ses = a;
114 if (rc->id == RCLUNK)
115 v9fs_put_idpool(fid, &v9ses->fidpool);
116 108
109 kfree(tc);
117 kfree(rc); 110 kfree(rc);
111 if (id == RCLUNK) {
112 v9ses = a;
113 v9fs_put_idpool(fid, &v9ses->fidpool);
114 }
118} 115}
119 116
120/** 117/**
diff --git a/fs/9p/mux.c b/fs/9p/mux.c
index 3e5b124a7212..f4407eb276c7 100644
--- a/fs/9p/mux.c
+++ b/fs/9p/mux.c
@@ -50,15 +50,23 @@ enum {
50 Wpending = 8, /* can write */ 50 Wpending = 8, /* can write */
51}; 51};
52 52
53enum {
54 None,
55 Flushing,
56 Flushed,
57};
58
53struct v9fs_mux_poll_task; 59struct v9fs_mux_poll_task;
54 60
55struct v9fs_req { 61struct v9fs_req {
62 spinlock_t lock;
56 int tag; 63 int tag;
57 struct v9fs_fcall *tcall; 64 struct v9fs_fcall *tcall;
58 struct v9fs_fcall *rcall; 65 struct v9fs_fcall *rcall;
59 int err; 66 int err;
60 v9fs_mux_req_callback cb; 67 v9fs_mux_req_callback cb;
61 void *cba; 68 void *cba;
69 int flush;
62 struct list_head req_list; 70 struct list_head req_list;
63}; 71};
64 72
@@ -96,8 +104,8 @@ struct v9fs_mux_poll_task {
96 104
97struct v9fs_mux_rpc { 105struct v9fs_mux_rpc {
98 struct v9fs_mux_data *m; 106 struct v9fs_mux_data *m;
99 struct v9fs_req *req;
100 int err; 107 int err;
108 struct v9fs_fcall *tcall;
101 struct v9fs_fcall *rcall; 109 struct v9fs_fcall *rcall;
102 wait_queue_head_t wqueue; 110 wait_queue_head_t wqueue;
103}; 111};
@@ -524,10 +532,9 @@ again:
524 532
525static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req) 533static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req)
526{ 534{
527 int ecode, tag; 535 int ecode;
528 struct v9fs_str *ename; 536 struct v9fs_str *ename;
529 537
530 tag = req->tag;
531 if (!req->err && req->rcall->id == RERROR) { 538 if (!req->err && req->rcall->id == RERROR) {
532 ecode = req->rcall->params.rerror.errno; 539 ecode = req->rcall->params.rerror.errno;
533 ename = &req->rcall->params.rerror.error; 540 ename = &req->rcall->params.rerror.error;
@@ -553,23 +560,6 @@ static void process_request(struct v9fs_mux_data *m, struct v9fs_req *req)
553 if (!req->err) 560 if (!req->err)
554 req->err = -EIO; 561 req->err = -EIO;
555 } 562 }
556
557 if (req->err == ERREQFLUSH)
558 return;
559
560 if (req->cb) {
561 dprintk(DEBUG_MUX, "calling callback tcall %p rcall %p\n",
562 req->tcall, req->rcall);
563
564 (*req->cb) (req->cba, req->tcall, req->rcall, req->err);
565 req->cb = NULL;
566 } else
567 kfree(req->rcall);
568
569 v9fs_mux_put_tag(m, tag);
570
571 wake_up(&m->equeue);
572 kfree(req);
573} 563}
574 564
575/** 565/**
@@ -669,17 +659,26 @@ static void v9fs_read_work(void *a)
669 list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) { 659 list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) {
670 if (rreq->tag == rcall->tag) { 660 if (rreq->tag == rcall->tag) {
671 req = rreq; 661 req = rreq;
672 req->rcall = rcall; 662 if (req->flush != Flushing)
673 list_del(&req->req_list); 663 list_del(&req->req_list);
674 spin_unlock(&m->lock);
675 process_request(m, req);
676 break; 664 break;
677 } 665 }
678
679 } 666 }
667 spin_unlock(&m->lock);
680 668
681 if (!req) { 669 if (req) {
682 spin_unlock(&m->lock); 670 req->rcall = rcall;
671 process_request(m, req);
672
673 if (req->flush != Flushing) {
674 if (req->cb)
675 (*req->cb) (req, req->cba);
676 else
677 kfree(req->rcall);
678
679 wake_up(&m->equeue);
680 }
681 } else {
683 if (err >= 0 && rcall->id != RFLUSH) 682 if (err >= 0 && rcall->id != RFLUSH)
684 dprintk(DEBUG_ERROR, 683 dprintk(DEBUG_ERROR,
685 "unexpected response mux %p id %d tag %d\n", 684 "unexpected response mux %p id %d tag %d\n",
@@ -746,7 +745,6 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
746 return ERR_PTR(-ENOMEM); 745 return ERR_PTR(-ENOMEM);
747 746
748 v9fs_set_tag(tc, n); 747 v9fs_set_tag(tc, n);
749
750 if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { 748 if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) {
751 char buf[150]; 749 char buf[150];
752 750
@@ -754,12 +752,14 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
754 printk(KERN_NOTICE "<<< %p %s\n", m, buf); 752 printk(KERN_NOTICE "<<< %p %s\n", m, buf);
755 } 753 }
756 754
755 spin_lock_init(&req->lock);
757 req->tag = n; 756 req->tag = n;
758 req->tcall = tc; 757 req->tcall = tc;
759 req->rcall = NULL; 758 req->rcall = NULL;
760 req->err = 0; 759 req->err = 0;
761 req->cb = cb; 760 req->cb = cb;
762 req->cba = cba; 761 req->cba = cba;
762 req->flush = None;
763 763
764 spin_lock(&m->lock); 764 spin_lock(&m->lock);
765 list_add_tail(&req->req_list, &m->unsent_req_list); 765 list_add_tail(&req->req_list, &m->unsent_req_list);
@@ -776,72 +776,108 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m,
776 return req; 776 return req;
777} 777}
778 778
779static void v9fs_mux_flush_cb(void *a, struct v9fs_fcall *tc, 779static void v9fs_mux_free_request(struct v9fs_mux_data *m, struct v9fs_req *req)
780 struct v9fs_fcall *rc, int err) 780{
781 v9fs_mux_put_tag(m, req->tag);
782 kfree(req);
783}
784
785static void v9fs_mux_flush_cb(struct v9fs_req *freq, void *a)
781{ 786{
782 v9fs_mux_req_callback cb; 787 v9fs_mux_req_callback cb;
783 int tag; 788 int tag;
784 struct v9fs_mux_data *m; 789 struct v9fs_mux_data *m;
785 struct v9fs_req *req, *rptr; 790 struct v9fs_req *req, *rreq, *rptr;
786 791
787 m = a; 792 m = a;
788 dprintk(DEBUG_MUX, "mux %p tc %p rc %p err %d oldtag %d\n", m, tc, 793 dprintk(DEBUG_MUX, "mux %p tc %p rc %p err %d oldtag %d\n", m,
789 rc, err, tc->params.tflush.oldtag); 794 freq->tcall, freq->rcall, freq->err,
795 freq->tcall->params.tflush.oldtag);
790 796
791 spin_lock(&m->lock); 797 spin_lock(&m->lock);
792 cb = NULL; 798 cb = NULL;
793 tag = tc->params.tflush.oldtag; 799 tag = freq->tcall->params.tflush.oldtag;
794 list_for_each_entry_safe(req, rptr, &m->req_list, req_list) { 800 req = NULL;
795 if (req->tag == tag) { 801 list_for_each_entry_safe(rreq, rptr, &m->req_list, req_list) {
802 if (rreq->tag == tag) {
803 req = rreq;
796 list_del(&req->req_list); 804 list_del(&req->req_list);
797 if (req->cb) {
798 cb = req->cb;
799 req->cb = NULL;
800 spin_unlock(&m->lock);
801 (*cb) (req->cba, req->tcall, req->rcall,
802 req->err);
803 }
804 kfree(req);
805 wake_up(&m->equeue);
806 break; 805 break;
807 } 806 }
808 } 807 }
808 spin_unlock(&m->lock);
809 809
810 if (!cb) 810 if (req) {
811 spin_unlock(&m->lock); 811 spin_lock(&req->lock);
812 req->flush = Flushed;
813 spin_unlock(&req->lock);
814
815 if (req->cb)
816 (*req->cb) (req, req->cba);
817 else
818 kfree(req->rcall);
819
820 wake_up(&m->equeue);
821 }
812 822
813 v9fs_mux_put_tag(m, tag); 823 kfree(freq->tcall);
814 kfree(tc); 824 kfree(freq->rcall);
815 kfree(rc); 825 v9fs_mux_free_request(m, freq);
816} 826}
817 827
818static void 828static int
819v9fs_mux_flush_request(struct v9fs_mux_data *m, struct v9fs_req *req) 829v9fs_mux_flush_request(struct v9fs_mux_data *m, struct v9fs_req *req)
820{ 830{
821 struct v9fs_fcall *fc; 831 struct v9fs_fcall *fc;
832 struct v9fs_req *rreq, *rptr;
822 833
823 dprintk(DEBUG_MUX, "mux %p req %p tag %d\n", m, req, req->tag); 834 dprintk(DEBUG_MUX, "mux %p req %p tag %d\n", m, req, req->tag);
824 835
836 /* if a response was received for a request, do nothing */
837 spin_lock(&req->lock);
838 if (req->rcall || req->err) {
839 spin_unlock(&req->lock);
840 dprintk(DEBUG_MUX, "mux %p req %p response already received\n", m, req);
841 return 0;
842 }
843
844 req->flush = Flushing;
845 spin_unlock(&req->lock);
846
847 spin_lock(&m->lock);
848 /* if the request is not sent yet, just remove it from the list */
849 list_for_each_entry_safe(rreq, rptr, &m->unsent_req_list, req_list) {
850 if (rreq->tag == req->tag) {
851 dprintk(DEBUG_MUX, "mux %p req %p request is not sent yet\n", m, req);
852 list_del(&rreq->req_list);
853 req->flush = Flushed;
854 spin_unlock(&m->lock);
855 if (req->cb)
856 (*req->cb) (req, req->cba);
857 return 0;
858 }
859 }
860 spin_unlock(&m->lock);
861
862 clear_thread_flag(TIF_SIGPENDING);
825 fc = v9fs_create_tflush(req->tag); 863 fc = v9fs_create_tflush(req->tag);
826 v9fs_send_request(m, fc, v9fs_mux_flush_cb, m); 864 v9fs_send_request(m, fc, v9fs_mux_flush_cb, m);
865 return 1;
827} 866}
828 867
829static void 868static void
830v9fs_mux_rpc_cb(void *a, struct v9fs_fcall *tc, struct v9fs_fcall *rc, int err) 869v9fs_mux_rpc_cb(struct v9fs_req *req, void *a)
831{ 870{
832 struct v9fs_mux_rpc *r; 871 struct v9fs_mux_rpc *r;
833 872
834 if (err == ERREQFLUSH) { 873 dprintk(DEBUG_MUX, "req %p r %p\n", req, a);
835 kfree(rc);
836 dprintk(DEBUG_MUX, "err req flush\n");
837 return;
838 }
839
840 r = a; 874 r = a;
841 dprintk(DEBUG_MUX, "mux %p req %p tc %p rc %p err %d\n", r->m, r->req, 875 r->rcall = req->rcall;
842 tc, rc, err); 876 r->err = req->err;
843 r->rcall = rc; 877
844 r->err = err; 878 if (req->flush!=None && !req->err)
879 r->err = -ERESTARTSYS;
880
845 wake_up(&r->wqueue); 881 wake_up(&r->wqueue);
846} 882}
847 883
@@ -856,12 +892,13 @@ int
856v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc, 892v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc,
857 struct v9fs_fcall **rc) 893 struct v9fs_fcall **rc)
858{ 894{
859 int err; 895 int err, sigpending;
860 unsigned long flags; 896 unsigned long flags;
861 struct v9fs_req *req; 897 struct v9fs_req *req;
862 struct v9fs_mux_rpc r; 898 struct v9fs_mux_rpc r;
863 899
864 r.err = 0; 900 r.err = 0;
901 r.tcall = tc;
865 r.rcall = NULL; 902 r.rcall = NULL;
866 r.m = m; 903 r.m = m;
867 init_waitqueue_head(&r.wqueue); 904 init_waitqueue_head(&r.wqueue);
@@ -869,48 +906,50 @@ v9fs_mux_rpc(struct v9fs_mux_data *m, struct v9fs_fcall *tc,
869 if (rc) 906 if (rc)
870 *rc = NULL; 907 *rc = NULL;
871 908
909 sigpending = 0;
910 if (signal_pending(current)) {
911 sigpending = 1;
912 clear_thread_flag(TIF_SIGPENDING);
913 }
914
872 req = v9fs_send_request(m, tc, v9fs_mux_rpc_cb, &r); 915 req = v9fs_send_request(m, tc, v9fs_mux_rpc_cb, &r);
873 if (IS_ERR(req)) { 916 if (IS_ERR(req)) {
874 err = PTR_ERR(req); 917 err = PTR_ERR(req);
875 dprintk(DEBUG_MUX, "error %d\n", err); 918 dprintk(DEBUG_MUX, "error %d\n", err);
876 return PTR_ERR(req); 919 return err;
877 } 920 }
878 921
879 r.req = req;
880 dprintk(DEBUG_MUX, "mux %p tc %p tag %d rpc %p req %p\n", m, tc,
881 req->tag, &r, req);
882 err = wait_event_interruptible(r.wqueue, r.rcall != NULL || r.err < 0); 922 err = wait_event_interruptible(r.wqueue, r.rcall != NULL || r.err < 0);
883 if (r.err < 0) 923 if (r.err < 0)
884 err = r.err; 924 err = r.err;
885 925
886 if (err == -ERESTARTSYS && m->trans->status == Connected && m->err == 0) { 926 if (err == -ERESTARTSYS && m->trans->status == Connected && m->err == 0) {
887 spin_lock(&m->lock); 927 if (v9fs_mux_flush_request(m, req)) {
888 req->tcall = NULL; 928 /* wait until we get response of the flush message */
889 req->err = ERREQFLUSH; 929 do {
890 spin_unlock(&m->lock); 930 clear_thread_flag(TIF_SIGPENDING);
931 err = wait_event_interruptible(r.wqueue,
932 r.rcall || r.err);
933 } while (!r.rcall && !r.err && err==-ERESTARTSYS &&
934 m->trans->status==Connected && !m->err);
935 }
936 sigpending = 1;
937 }
891 938
892 clear_thread_flag(TIF_SIGPENDING); 939 if (sigpending) {
893 v9fs_mux_flush_request(m, req);
894 spin_lock_irqsave(&current->sighand->siglock, flags); 940 spin_lock_irqsave(&current->sighand->siglock, flags);
895 recalc_sigpending(); 941 recalc_sigpending();
896 spin_unlock_irqrestore(&current->sighand->siglock, flags); 942 spin_unlock_irqrestore(&current->sighand->siglock, flags);
897 } 943 }
898 944
899 if (!err) { 945 if (rc)
900 if (r.rcall) 946 *rc = r.rcall;
901 dprintk(DEBUG_MUX, "got response id %d tag %d\n", 947 else
902 r.rcall->id, r.rcall->tag);
903
904 if (rc)
905 *rc = r.rcall;
906 else
907 kfree(r.rcall);
908 } else {
909 kfree(r.rcall); 948 kfree(r.rcall);
910 dprintk(DEBUG_MUX, "got error %d\n", err); 949
911 if (err > 0) 950 v9fs_mux_free_request(m, req);
912 err = -EIO; 951 if (err > 0)
913 } 952 err = -EIO;
914 953
915 return err; 954 return err;
916} 955}
@@ -951,12 +990,15 @@ void v9fs_mux_cancel(struct v9fs_mux_data *m, int err)
951 struct v9fs_req *req, *rtmp; 990 struct v9fs_req *req, *rtmp;
952 LIST_HEAD(cancel_list); 991 LIST_HEAD(cancel_list);
953 992
954 dprintk(DEBUG_MUX, "mux %p err %d\n", m, err); 993 dprintk(DEBUG_ERROR, "mux %p err %d\n", m, err);
955 m->err = err; 994 m->err = err;
956 spin_lock(&m->lock); 995 spin_lock(&m->lock);
957 list_for_each_entry_safe(req, rtmp, &m->req_list, req_list) { 996 list_for_each_entry_safe(req, rtmp, &m->req_list, req_list) {
958 list_move(&req->req_list, &cancel_list); 997 list_move(&req->req_list, &cancel_list);
959 } 998 }
999 list_for_each_entry_safe(req, rtmp, &m->unsent_req_list, req_list) {
1000 list_move(&req->req_list, &cancel_list);
1001 }
960 spin_unlock(&m->lock); 1002 spin_unlock(&m->lock);
961 1003
962 list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) { 1004 list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) {
@@ -965,11 +1007,9 @@ void v9fs_mux_cancel(struct v9fs_mux_data *m, int err)
965 req->err = err; 1007 req->err = err;
966 1008
967 if (req->cb) 1009 if (req->cb)
968 (*req->cb) (req->cba, req->tcall, req->rcall, req->err); 1010 (*req->cb) (req, req->cba);
969 else 1011 else
970 kfree(req->rcall); 1012 kfree(req->rcall);
971
972 kfree(req);
973 } 1013 }
974 1014
975 wake_up(&m->equeue); 1015 wake_up(&m->equeue);
diff --git a/fs/9p/mux.h b/fs/9p/mux.h
index e90bfd32ea42..fb10c50186a1 100644
--- a/fs/9p/mux.h
+++ b/fs/9p/mux.h
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26struct v9fs_mux_data; 26struct v9fs_mux_data;
27struct v9fs_req;
27 28
28/** 29/**
29 * v9fs_mux_req_callback - callback function that is called when the 30 * v9fs_mux_req_callback - callback function that is called when the
@@ -36,8 +37,7 @@ struct v9fs_mux_data;
36 * @rc - response call 37 * @rc - response call
37 * @err - error code (non-zero if error occured) 38 * @err - error code (non-zero if error occured)
38 */ 39 */
39typedef void (*v9fs_mux_req_callback)(void *a, struct v9fs_fcall *tc, 40typedef void (*v9fs_mux_req_callback)(struct v9fs_req *req, void *a);
40 struct v9fs_fcall *rc, int err);
41 41
42int v9fs_mux_global_init(void); 42int v9fs_mux_global_init(void);
43void v9fs_mux_global_exit(void); 43void v9fs_mux_global_exit(void);
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 083dcfcd158e..1a8e46084f0e 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -72,11 +72,17 @@ int v9fs_file_open(struct inode *inode, struct file *file)
72 return -ENOSPC; 72 return -ENOSPC;
73 } 73 }
74 74
75 err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); 75 err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, &fcall);
76 if (err < 0) { 76 if (err < 0) {
77 dprintk(DEBUG_ERROR, "rewalk didn't work\n"); 77 dprintk(DEBUG_ERROR, "rewalk didn't work\n");
78 goto put_fid; 78 if (fcall && fcall->id == RWALK)
79 goto clunk_fid;
80 else {
81 v9fs_put_idpool(fid, &v9ses->fidpool);
82 goto free_fcall;
83 }
79 } 84 }
85 kfree(fcall);
80 86
81 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ 87 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
82 /* translate open mode appropriately */ 88 /* translate open mode appropriately */
@@ -109,8 +115,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
109clunk_fid: 115clunk_fid:
110 v9fs_t_clunk(v9ses, fid); 116 v9fs_t_clunk(v9ses, fid);
111 117
112put_fid: 118free_fcall:
113 v9fs_put_idpool(fid, &v9ses->fidpool);
114 kfree(fcall); 119 kfree(fcall);
115 120
116 return err; 121 return err;
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 133db366d306..2cb87ba4b1c1 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -270,7 +270,10 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm,
270 err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); 270 err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall);
271 if (err < 0) { 271 if (err < 0) {
272 PRINT_FCALL_ERROR("clone error", fcall); 272 PRINT_FCALL_ERROR("clone error", fcall);
273 goto put_fid; 273 if (fcall && fcall->id == RWALK)
274 goto clunk_fid;
275 else
276 goto put_fid;
274 } 277 }
275 kfree(fcall); 278 kfree(fcall);
276 279
@@ -322,6 +325,9 @@ v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
322 &fcall); 325 &fcall);
323 326
324 if (err < 0) { 327 if (err < 0) {
328 if (fcall && fcall->id == RWALK)
329 goto clunk_fid;
330
325 PRINT_FCALL_ERROR("walk error", fcall); 331 PRINT_FCALL_ERROR("walk error", fcall);
326 v9fs_put_idpool(nfid, &v9ses->fidpool); 332 v9fs_put_idpool(nfid, &v9ses->fidpool);
327 goto error; 333 goto error;
@@ -640,19 +646,26 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
640 } 646 }
641 647
642 result = v9fs_t_walk(v9ses, dirfidnum, newfid, 648 result = v9fs_t_walk(v9ses, dirfidnum, newfid,
643 (char *)dentry->d_name.name, NULL); 649 (char *)dentry->d_name.name, &fcall);
650
644 if (result < 0) { 651 if (result < 0) {
645 v9fs_put_idpool(newfid, &v9ses->fidpool); 652 if (fcall && fcall->id == RWALK)
653 v9fs_t_clunk(v9ses, newfid);
654 else
655 v9fs_put_idpool(newfid, &v9ses->fidpool);
656
646 if (result == -ENOENT) { 657 if (result == -ENOENT) {
647 d_add(dentry, NULL); 658 d_add(dentry, NULL);
648 dprintk(DEBUG_VFS, 659 dprintk(DEBUG_VFS,
649 "Return negative dentry %p count %d\n", 660 "Return negative dentry %p count %d\n",
650 dentry, atomic_read(&dentry->d_count)); 661 dentry, atomic_read(&dentry->d_count));
662 kfree(fcall);
651 return NULL; 663 return NULL;
652 } 664 }
653 dprintk(DEBUG_ERROR, "walk error:%d\n", result); 665 dprintk(DEBUG_ERROR, "walk error:%d\n", result);
654 goto FreeFcall; 666 goto FreeFcall;
655 } 667 }
668 kfree(fcall);
656 669
657 result = v9fs_t_stat(v9ses, newfid, &fcall); 670 result = v9fs_t_stat(v9ses, newfid, &fcall);
658 if (result < 0) { 671 if (result < 0) {
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 57c4903614e5..d6603d02304c 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -74,8 +74,8 @@ struct autofs_wait_queue {
74 struct autofs_wait_queue *next; 74 struct autofs_wait_queue *next;
75 autofs_wqt_t wait_queue_token; 75 autofs_wqt_t wait_queue_token;
76 /* We use the following to see what we are waiting for */ 76 /* We use the following to see what we are waiting for */
77 int hash; 77 unsigned int hash;
78 int len; 78 unsigned int len;
79 char *name; 79 char *name;
80 u32 dev; 80 u32 dev;
81 u64 ino; 81 u64 ino;
@@ -85,7 +85,6 @@ struct autofs_wait_queue {
85 pid_t tgid; 85 pid_t tgid;
86 /* This is for status reporting upon return */ 86 /* This is for status reporting upon return */
87 int status; 87 int status;
88 atomic_t notify;
89 atomic_t wait_ctr; 88 atomic_t wait_ctr;
90}; 89};
91 90
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 84e030c8ddd0..5100f984783f 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -327,6 +327,7 @@ static int try_to_fill_dentry(struct dentry *dentry, int flags)
327static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd) 327static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
328{ 328{
329 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb); 329 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
330 struct autofs_info *ino = autofs4_dentry_ino(dentry);
330 int oz_mode = autofs4_oz_mode(sbi); 331 int oz_mode = autofs4_oz_mode(sbi);
331 unsigned int lookup_type; 332 unsigned int lookup_type;
332 int status; 333 int status;
@@ -340,13 +341,8 @@ static void *autofs4_follow_link(struct dentry *dentry, struct nameidata *nd)
340 if (oz_mode || !lookup_type) 341 if (oz_mode || !lookup_type)
341 goto done; 342 goto done;
342 343
343 /* 344 /* If an expire request is pending wait for it. */
344 * If a request is pending wait for it. 345 if (ino && (ino->flags & AUTOFS_INF_EXPIRING)) {
345 * If it's a mount then it won't be expired till at least
346 * a liitle later and if it's an expire then we might need
347 * to mount it again.
348 */
349 if (autofs4_ispending(dentry)) {
350 DPRINTK("waiting for active request %p name=%.*s", 346 DPRINTK("waiting for active request %p name=%.*s",
351 dentry, dentry->d_name.len, dentry->d_name.name); 347 dentry, dentry->d_name.len, dentry->d_name.name);
352 348
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 142ab6aa2aa1..ce103e7b0bc3 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -189,14 +189,30 @@ static int autofs4_getpath(struct autofs_sb_info *sbi,
189 return len; 189 return len;
190} 190}
191 191
192static struct autofs_wait_queue *
193autofs4_find_wait(struct autofs_sb_info *sbi,
194 char *name, unsigned int hash, unsigned int len)
195{
196 struct autofs_wait_queue *wq;
197
198 for (wq = sbi->queues; wq; wq = wq->next) {
199 if (wq->hash == hash &&
200 wq->len == len &&
201 wq->name && !memcmp(wq->name, name, len))
202 break;
203 }
204 return wq;
205}
206
192int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, 207int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
193 enum autofs_notify notify) 208 enum autofs_notify notify)
194{ 209{
210 struct autofs_info *ino;
195 struct autofs_wait_queue *wq; 211 struct autofs_wait_queue *wq;
196 char *name; 212 char *name;
197 unsigned int len = 0; 213 unsigned int len = 0;
198 unsigned int hash = 0; 214 unsigned int hash = 0;
199 int status; 215 int status, type;
200 216
201 /* In catatonic mode, we don't wait for nobody */ 217 /* In catatonic mode, we don't wait for nobody */
202 if (sbi->catatonic) 218 if (sbi->catatonic)
@@ -223,21 +239,41 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
223 return -EINTR; 239 return -EINTR;
224 } 240 }
225 241
226 for (wq = sbi->queues ; wq ; wq = wq->next) { 242 wq = autofs4_find_wait(sbi, name, hash, len);
227 if (wq->hash == dentry->d_name.hash && 243 ino = autofs4_dentry_ino(dentry);
228 wq->len == len && 244 if (!wq && ino && notify == NFY_NONE) {
229 wq->name && !memcmp(wq->name, name, len)) 245 /*
230 break; 246 * Either we've betean the pending expire to post it's
231 } 247 * wait or it finished while we waited on the mutex.
248 * So we need to wait till either, the wait appears
249 * or the expire finishes.
250 */
251
252 while (ino->flags & AUTOFS_INF_EXPIRING) {
253 mutex_unlock(&sbi->wq_mutex);
254 schedule_timeout_interruptible(HZ/10);
255 if (mutex_lock_interruptible(&sbi->wq_mutex)) {
256 kfree(name);
257 return -EINTR;
258 }
259 wq = autofs4_find_wait(sbi, name, hash, len);
260 if (wq)
261 break;
262 }
232 263
233 if (!wq) { 264 /*
234 /* Can't wait for an expire if there's no mount */ 265 * Not ideal but the status has already gone. Of the two
235 if (notify == NFY_NONE && !d_mountpoint(dentry)) { 266 * cases where we wait on NFY_NONE neither depend on the
267 * return status of the wait.
268 */
269 if (!wq) {
236 kfree(name); 270 kfree(name);
237 mutex_unlock(&sbi->wq_mutex); 271 mutex_unlock(&sbi->wq_mutex);
238 return -ENOENT; 272 return 0;
239 } 273 }
274 }
240 275
276 if (!wq) {
241 /* Create a new wait queue */ 277 /* Create a new wait queue */
242 wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL); 278 wq = kmalloc(sizeof(struct autofs_wait_queue),GFP_KERNEL);
243 if (!wq) { 279 if (!wq) {
@@ -263,20 +299,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
263 wq->tgid = current->tgid; 299 wq->tgid = current->tgid;
264 wq->status = -EINTR; /* Status return if interrupted */ 300 wq->status = -EINTR; /* Status return if interrupted */
265 atomic_set(&wq->wait_ctr, 2); 301 atomic_set(&wq->wait_ctr, 2);
266 atomic_set(&wq->notify, 1);
267 mutex_unlock(&sbi->wq_mutex);
268 } else {
269 atomic_inc(&wq->wait_ctr);
270 mutex_unlock(&sbi->wq_mutex); 302 mutex_unlock(&sbi->wq_mutex);
271 kfree(name);
272 DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
273 (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
274 }
275
276 if (notify != NFY_NONE && atomic_read(&wq->notify)) {
277 int type;
278
279 atomic_dec(&wq->notify);
280 303
281 if (sbi->version < 5) { 304 if (sbi->version < 5) {
282 if (notify == NFY_MOUNT) 305 if (notify == NFY_MOUNT)
@@ -299,6 +322,12 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
299 322
300 /* autofs4_notify_daemon() may block */ 323 /* autofs4_notify_daemon() may block */
301 autofs4_notify_daemon(sbi, wq, type); 324 autofs4_notify_daemon(sbi, wq, type);
325 } else {
326 atomic_inc(&wq->wait_ctr);
327 mutex_unlock(&sbi->wq_mutex);
328 kfree(name);
329 DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
330 (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
302 } 331 }
303 332
304 /* wq->name is NULL if and only if the lock is already released */ 333 /* wq->name is NULL if and only if the lock is already released */
diff --git a/fs/compat.c b/fs/compat.c
index 3f3e8f4d43d6..01f39f87f372 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1323,7 +1323,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
1323{ 1323{
1324 unsigned i; 1324 unsigned i;
1325 struct iovec *iov; 1325 struct iovec *iov;
1326 if (nr_segs >= UIO_MAXIOV) 1326 if (nr_segs > UIO_MAXIOV)
1327 return -EINVAL; 1327 return -EINVAL;
1328 iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec)); 1328 iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
1329 for (i = 0; i < nr_segs; i++) { 1329 for (i = 0; i < nr_segs; i++) {
@@ -1913,7 +1913,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
1913 } 1913 }
1914 1914
1915 if (sigmask) { 1915 if (sigmask) {
1916 if (sigsetsize |= sizeof(compat_sigset_t)) 1916 if (sigsetsize != sizeof(compat_sigset_t))
1917 return -EINVAL; 1917 return -EINVAL;
1918 if (copy_from_user(&ss32, sigmask, sizeof(ss32))) 1918 if (copy_from_user(&ss32, sigmask, sizeof(ss32)))
1919 return -EFAULT; 1919 return -EFAULT;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 48ae0339af17..2edd7eec88fd 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -711,7 +711,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
711 * direct blocks blocks 711 * direct blocks blocks
712 */ 712 */
713 if (num == 0 && blks > 1) { 713 if (num == 0 && blks > 1) {
714 current_block = le32_to_cpu(where->key + 1); 714 current_block = le32_to_cpu(where->key) + 1;
715 for (i = 1; i < blks; i++) 715 for (i = 1; i < blks; i++)
716 *(where->p + i ) = cpu_to_le32(current_block++); 716 *(where->p + i ) = cpu_to_le32(current_block++);
717 } 717 }
@@ -724,7 +724,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode,
724 if (block_i) { 724 if (block_i) {
725 block_i->last_alloc_logical_block = block + blks - 1; 725 block_i->last_alloc_logical_block = block + blks - 1;
726 block_i->last_alloc_physical_block = 726 block_i->last_alloc_physical_block =
727 le32_to_cpu(where[num].key + blks - 1); 727 le32_to_cpu(where[num].key) + blks - 1;
728 } 728 }
729 729
730 /* We are done with atomic stuff, now do the rest of housekeeping */ 730 /* We are done with atomic stuff, now do the rest of housekeeping */
@@ -814,11 +814,13 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
814 814
815 /* Simplest case - block found, no allocation needed */ 815 /* Simplest case - block found, no allocation needed */
816 if (!partial) { 816 if (!partial) {
817 first_block = chain[depth - 1].key; 817 first_block = le32_to_cpu(chain[depth - 1].key);
818 clear_buffer_new(bh_result); 818 clear_buffer_new(bh_result);
819 count++; 819 count++;
820 /*map more blocks*/ 820 /*map more blocks*/
821 while (count < maxblocks && count <= blocks_to_boundary) { 821 while (count < maxblocks && count <= blocks_to_boundary) {
822 unsigned long blk;
823
822 if (!verify_chain(chain, partial)) { 824 if (!verify_chain(chain, partial)) {
823 /* 825 /*
824 * Indirect block might be removed by 826 * Indirect block might be removed by
@@ -831,8 +833,9 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
831 count = 0; 833 count = 0;
832 break; 834 break;
833 } 835 }
834 if (le32_to_cpu(*(chain[depth-1].p+count) == 836 blk = le32_to_cpu(*(chain[depth-1].p + count));
835 (first_block + count))) 837
838 if (blk == first_block + count)
836 count++; 839 count++;
837 else 840 else
838 break; 841 break;
diff --git a/fs/locks.c b/fs/locks.c
index efad798824dc..6f99c0a6f836 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -446,15 +446,14 @@ static struct lock_manager_operations lease_manager_ops = {
446 */ 446 */
447static int lease_init(struct file *filp, int type, struct file_lock *fl) 447static int lease_init(struct file *filp, int type, struct file_lock *fl)
448 { 448 {
449 if (assign_type(fl, type) != 0)
450 return -EINVAL;
451
449 fl->fl_owner = current->files; 452 fl->fl_owner = current->files;
450 fl->fl_pid = current->tgid; 453 fl->fl_pid = current->tgid;
451 454
452 fl->fl_file = filp; 455 fl->fl_file = filp;
453 fl->fl_flags = FL_LEASE; 456 fl->fl_flags = FL_LEASE;
454 if (assign_type(fl, type) != 0) {
455 locks_free_lock(fl);
456 return -EINVAL;
457 }
458 fl->fl_start = 0; 457 fl->fl_start = 0;
459 fl->fl_end = OFFSET_MAX; 458 fl->fl_end = OFFSET_MAX;
460 fl->fl_ops = NULL; 459 fl->fl_ops = NULL;
@@ -466,16 +465,19 @@ static int lease_init(struct file *filp, int type, struct file_lock *fl)
466static int lease_alloc(struct file *filp, int type, struct file_lock **flp) 465static int lease_alloc(struct file *filp, int type, struct file_lock **flp)
467{ 466{
468 struct file_lock *fl = locks_alloc_lock(); 467 struct file_lock *fl = locks_alloc_lock();
469 int error; 468 int error = -ENOMEM;
470 469
471 if (fl == NULL) 470 if (fl == NULL)
472 return -ENOMEM; 471 goto out;
473 472
474 error = lease_init(filp, type, fl); 473 error = lease_init(filp, type, fl);
475 if (error) 474 if (error) {
476 return error; 475 locks_free_lock(fl);
476 fl = NULL;
477 }
478out:
477 *flp = fl; 479 *flp = fl;
478 return 0; 480 return error;
479} 481}
480 482
481/* Check if two locks overlap each other. 483/* Check if two locks overlap each other.
@@ -1372,6 +1374,7 @@ static int __setlease(struct file *filp, long arg, struct file_lock **flp)
1372 goto out; 1374 goto out;
1373 1375
1374 if (my_before != NULL) { 1376 if (my_before != NULL) {
1377 *flp = *my_before;
1375 error = lease->fl_lmops->fl_change(my_before, arg); 1378 error = lease->fl_lmops->fl_change(my_before, arg);
1376 goto out; 1379 goto out;
1377 } 1380 }
diff --git a/fs/namespace.c b/fs/namespace.c
index 2c5f1f80bdc2..bf478addb852 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -899,13 +899,11 @@ static int do_change_type(struct nameidata *nd, int flag)
899/* 899/*
900 * do loopback mount. 900 * do loopback mount.
901 */ 901 */
902static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags, int mnt_flags) 902static int do_loopback(struct nameidata *nd, char *old_name, int recurse)
903{ 903{
904 struct nameidata old_nd; 904 struct nameidata old_nd;
905 struct vfsmount *mnt = NULL; 905 struct vfsmount *mnt = NULL;
906 int recurse = flags & MS_REC;
907 int err = mount_is_safe(nd); 906 int err = mount_is_safe(nd);
908
909 if (err) 907 if (err)
910 return err; 908 return err;
911 if (!old_name || !*old_name) 909 if (!old_name || !*old_name)
@@ -939,7 +937,6 @@ static int do_loopback(struct nameidata *nd, char *old_name, unsigned long flags
939 spin_unlock(&vfsmount_lock); 937 spin_unlock(&vfsmount_lock);
940 release_mounts(&umount_list); 938 release_mounts(&umount_list);
941 } 939 }
942 mnt->mnt_flags = mnt_flags;
943 940
944out: 941out:
945 up_write(&namespace_sem); 942 up_write(&namespace_sem);
@@ -1353,7 +1350,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1353 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags, 1350 retval = do_remount(&nd, flags & ~MS_REMOUNT, mnt_flags,
1354 data_page); 1351 data_page);
1355 else if (flags & MS_BIND) 1352 else if (flags & MS_BIND)
1356 retval = do_loopback(&nd, dev_name, flags, mnt_flags); 1353 retval = do_loopback(&nd, dev_name, flags & MS_REC);
1357 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) 1354 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
1358 retval = do_change_type(&nd, flags); 1355 retval = do_change_type(&nd, flags);
1359 else if (flags & MS_MOVE) 1356 else if (flags & MS_MOVE)
diff --git a/fs/open.c b/fs/open.c
index 53ec28c36777..317b7c7f38a7 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1124,7 +1124,6 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1124 prevent_tail_call(ret); 1124 prevent_tail_call(ret);
1125 return ret; 1125 return ret;
1126} 1126}
1127EXPORT_SYMBOL_GPL(sys_openat);
1128 1127
1129#ifndef __alpha__ 1128#ifndef __alpha__
1130 1129
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 45ae7dd3c650..7ef1f094de91 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -533,6 +533,7 @@ void del_gendisk(struct gendisk *disk)
533 533
534 devfs_remove_disk(disk); 534 devfs_remove_disk(disk);
535 535
536 kobject_uevent(&disk->kobj, KOBJ_REMOVE);
536 if (disk->holder_dir) 537 if (disk->holder_dir)
537 kobject_unregister(disk->holder_dir); 538 kobject_unregister(disk->holder_dir);
538 if (disk->slave_dir) 539 if (disk->slave_dir)
@@ -545,7 +546,7 @@ void del_gendisk(struct gendisk *disk)
545 kfree(disk_name); 546 kfree(disk_name);
546 } 547 }
547 put_device(disk->driverfs_dev); 548 put_device(disk->driverfs_dev);
549 disk->driverfs_dev = NULL;
548 } 550 }
549 kobject_uevent(&disk->kobj, KOBJ_REMOVE);
550 kobject_del(&disk->kobj); 551 kobject_del(&disk->kobj);
551} 552}
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 34c7a11d91f0..70d9c5a37f5a 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -434,6 +434,11 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
434 if (dentry->d_name.len > SMB_MAXNAMELEN) 434 if (dentry->d_name.len > SMB_MAXNAMELEN)
435 goto out; 435 goto out;
436 436
437 /* Do not allow lookup of names with backslashes in */
438 error = -EINVAL;
439 if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
440 goto out;
441
437 lock_kernel(); 442 lock_kernel();
438 error = smb_proc_getattr(dentry, &finfo); 443 error = smb_proc_getattr(dentry, &finfo);
439#ifdef SMBFS_PARANOIA 444#ifdef SMBFS_PARANOIA
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index c71c375863cc..c71dd2760d32 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -339,9 +339,11 @@ int smb_add_request(struct smb_request *req)
339 /* 339 /*
340 * On timeout or on interrupt we want to try and remove the 340 * On timeout or on interrupt we want to try and remove the
341 * request from the recvq/xmitq. 341 * request from the recvq/xmitq.
342 * First check if the request is still part of a queue. (May
343 * have been removed by some error condition)
342 */ 344 */
343 smb_lock_server(server); 345 smb_lock_server(server);
344 if (!(req->rq_flags & SMB_REQ_RECEIVED)) { 346 if (!list_empty(&req->rq_queue)) {
345 list_del_init(&req->rq_queue); 347 list_del_init(&req->rq_queue);
346 smb_rput(req); 348 smb_rput(req);
347 } 349 }
diff --git a/fs/splice.c b/fs/splice.c
index 7fb04970c72d..a285fd746dc0 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -51,7 +51,7 @@ struct splice_pipe_desc {
51 * addition of remove_mapping(). If success is returned, the caller may 51 * addition of remove_mapping(). If success is returned, the caller may
52 * attempt to reuse this page for another destination. 52 * attempt to reuse this page for another destination.
53 */ 53 */
54static int page_cache_pipe_buf_steal(struct pipe_inode_info *info, 54static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe,
55 struct pipe_buffer *buf) 55 struct pipe_buffer *buf)
56{ 56{
57 struct page *page = buf->page; 57 struct page *page = buf->page;
@@ -78,16 +78,18 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *info,
78 return 1; 78 return 1;
79 } 79 }
80 80
81 buf->flags |= PIPE_BUF_FLAG_LRU;
81 return 0; 82 return 0;
82} 83}
83 84
84static void page_cache_pipe_buf_release(struct pipe_inode_info *info, 85static void page_cache_pipe_buf_release(struct pipe_inode_info *pipe,
85 struct pipe_buffer *buf) 86 struct pipe_buffer *buf)
86{ 87{
87 page_cache_release(buf->page); 88 page_cache_release(buf->page);
89 buf->flags &= ~PIPE_BUF_FLAG_LRU;
88} 90}
89 91
90static int page_cache_pipe_buf_pin(struct pipe_inode_info *info, 92static int page_cache_pipe_buf_pin(struct pipe_inode_info *pipe,
91 struct pipe_buffer *buf) 93 struct pipe_buffer *buf)
92{ 94{
93 struct page *page = buf->page; 95 struct page *page = buf->page;
@@ -141,6 +143,7 @@ static int user_page_pipe_buf_steal(struct pipe_inode_info *pipe,
141 if (!(buf->flags & PIPE_BUF_FLAG_GIFT)) 143 if (!(buf->flags & PIPE_BUF_FLAG_GIFT))
142 return 1; 144 return 1;
143 145
146 buf->flags |= PIPE_BUF_FLAG_LRU;
144 return generic_pipe_buf_steal(pipe, buf); 147 return generic_pipe_buf_steal(pipe, buf);
145} 148}
146 149
@@ -321,6 +324,8 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
321 mapping_gfp_mask(mapping)); 324 mapping_gfp_mask(mapping));
322 if (unlikely(error)) { 325 if (unlikely(error)) {
323 page_cache_release(page); 326 page_cache_release(page);
327 if (error == -EEXIST)
328 continue;
324 break; 329 break;
325 } 330 }
326 /* 331 /*
@@ -497,14 +502,14 @@ EXPORT_SYMBOL(generic_file_splice_read);
497 * Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos' 502 * Send 'sd->len' bytes to socket from 'sd->file' at position 'sd->pos'
498 * using sendpage(). Return the number of bytes sent. 503 * using sendpage(). Return the number of bytes sent.
499 */ 504 */
500static int pipe_to_sendpage(struct pipe_inode_info *info, 505static int pipe_to_sendpage(struct pipe_inode_info *pipe,
501 struct pipe_buffer *buf, struct splice_desc *sd) 506 struct pipe_buffer *buf, struct splice_desc *sd)
502{ 507{
503 struct file *file = sd->file; 508 struct file *file = sd->file;
504 loff_t pos = sd->pos; 509 loff_t pos = sd->pos;
505 int ret, more; 510 int ret, more;
506 511
507 ret = buf->ops->pin(info, buf); 512 ret = buf->ops->pin(pipe, buf);
508 if (!ret) { 513 if (!ret) {
509 more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len; 514 more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
510 515
@@ -535,7 +540,7 @@ static int pipe_to_sendpage(struct pipe_inode_info *info,
535 * SPLICE_F_MOVE isn't set, or we cannot move the page, we simply create 540 * SPLICE_F_MOVE isn't set, or we cannot move the page, we simply create
536 * a new page in the output file page cache and fill/dirty that. 541 * a new page in the output file page cache and fill/dirty that.
537 */ 542 */
538static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, 543static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
539 struct splice_desc *sd) 544 struct splice_desc *sd)
540{ 545{
541 struct file *file = sd->file; 546 struct file *file = sd->file;
@@ -549,7 +554,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
549 /* 554 /*
550 * make sure the data in this buffer is uptodate 555 * make sure the data in this buffer is uptodate
551 */ 556 */
552 ret = buf->ops->pin(info, buf); 557 ret = buf->ops->pin(pipe, buf);
553 if (unlikely(ret)) 558 if (unlikely(ret))
554 return ret; 559 return ret;
555 560
@@ -566,37 +571,23 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
566 */ 571 */
567 if ((sd->flags & SPLICE_F_MOVE) && this_len == PAGE_CACHE_SIZE) { 572 if ((sd->flags & SPLICE_F_MOVE) && this_len == PAGE_CACHE_SIZE) {
568 /* 573 /*
569 * If steal succeeds, buf->page is now pruned from the vm 574 * If steal succeeds, buf->page is now pruned from the
570 * side (page cache) and we can reuse it. The page will also 575 * pagecache and we can reuse it. The page will also be
571 * be locked on successful return. 576 * locked on successful return.
572 */ 577 */
573 if (buf->ops->steal(info, buf)) 578 if (buf->ops->steal(pipe, buf))
574 goto find_page; 579 goto find_page;
575 580
576 page = buf->page; 581 page = buf->page;
577 page_cache_get(page);
578
579 /*
580 * page must be on the LRU for adding to the pagecache.
581 * Check this without grabbing the zone lock, if it isn't
582 * the do grab the zone lock, recheck, and add if necessary.
583 */
584 if (!PageLRU(page)) {
585 struct zone *zone = page_zone(page);
586
587 spin_lock_irq(&zone->lru_lock);
588 if (!PageLRU(page)) {
589 SetPageLRU(page);
590 add_page_to_inactive_list(zone, page);
591 }
592 spin_unlock_irq(&zone->lru_lock);
593 }
594
595 if (add_to_page_cache(page, mapping, index, gfp_mask)) { 582 if (add_to_page_cache(page, mapping, index, gfp_mask)) {
596 page_cache_release(page);
597 unlock_page(page); 583 unlock_page(page);
598 goto find_page; 584 goto find_page;
599 } 585 }
586
587 page_cache_get(page);
588
589 if (!(buf->flags & PIPE_BUF_FLAG_LRU))
590 lru_cache_add(page);
600 } else { 591 } else {
601find_page: 592find_page:
602 page = find_lock_page(mapping, index); 593 page = find_lock_page(mapping, index);
@@ -647,23 +638,36 @@ find_page:
647 } 638 }
648 639
649 ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len); 640 ret = mapping->a_ops->prepare_write(file, page, offset, offset+this_len);
650 if (ret == AOP_TRUNCATED_PAGE) { 641 if (unlikely(ret)) {
642 loff_t isize = i_size_read(mapping->host);
643
644 if (ret != AOP_TRUNCATED_PAGE)
645 unlock_page(page);
651 page_cache_release(page); 646 page_cache_release(page);
652 goto find_page; 647 if (ret == AOP_TRUNCATED_PAGE)
653 } else if (ret) 648 goto find_page;
649
650 /*
651 * prepare_write() may have instantiated a few blocks
652 * outside i_size. Trim these off again.
653 */
654 if (sd->pos + this_len > isize)
655 vmtruncate(mapping->host, isize);
656
654 goto out; 657 goto out;
658 }
655 659
656 if (buf->page != page) { 660 if (buf->page != page) {
657 /* 661 /*
658 * Careful, ->map() uses KM_USER0! 662 * Careful, ->map() uses KM_USER0!
659 */ 663 */
660 char *src = buf->ops->map(info, buf, 1); 664 char *src = buf->ops->map(pipe, buf, 1);
661 char *dst = kmap_atomic(page, KM_USER1); 665 char *dst = kmap_atomic(page, KM_USER1);
662 666
663 memcpy(dst + offset, src + buf->offset, this_len); 667 memcpy(dst + offset, src + buf->offset, this_len);
664 flush_dcache_page(page); 668 flush_dcache_page(page);
665 kunmap_atomic(dst, KM_USER1); 669 kunmap_atomic(dst, KM_USER1);
666 buf->ops->unmap(info, buf, src); 670 buf->ops->unmap(pipe, buf, src);
667 } 671 }
668 672
669 ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); 673 ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len);
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c
index 64ee07db0d5e..8558226281c4 100644
--- a/fs/xfs/xfs_alloc.c
+++ b/fs/xfs/xfs_alloc.c
@@ -1942,8 +1942,10 @@ xfs_alloc_fix_freelist(
1942 /* 1942 /*
1943 * Allocate as many blocks as possible at once. 1943 * Allocate as many blocks as possible at once.
1944 */ 1944 */
1945 if ((error = xfs_alloc_ag_vextent(&targs))) 1945 if ((error = xfs_alloc_ag_vextent(&targs))) {
1946 xfs_trans_brelse(tp, agflbp);
1946 return error; 1947 return error;
1948 }
1947 /* 1949 /*
1948 * Stop if we run out. Won't happen if callers are obeying 1950 * Stop if we run out. Won't happen if callers are obeying
1949 * the restrictions correctly. Can happen for free calls 1951 * the restrictions correctly. Can happen for free calls
@@ -1960,6 +1962,7 @@ xfs_alloc_fix_freelist(
1960 return error; 1962 return error;
1961 } 1963 }
1962 } 1964 }
1965 xfs_trans_brelse(tp, agflbp);
1963 args->agbp = agbp; 1966 args->agbp = agbp;
1964 return 0; 1967 return 0;
1965} 1968}
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 81a05cfd77d2..1f148762eb28 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -316,6 +316,18 @@ xfs_rename(
316 } 316 }
317 } 317 }
318 318
319 /*
320 * If we are using project inheritance, we only allow renames
321 * into our tree when the project IDs are the same; else the
322 * tree quota mechanism would be circumvented.
323 */
324 if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
325 (target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
326 error = XFS_ERROR(EXDEV);
327 xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
328 goto rele_return;
329 }
330
319 new_parent = (src_dp != target_dp); 331 new_parent = (src_dp != target_dp);
320 src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR); 332 src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR);
321 333
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index f0e09ca14139..36ea1b2094f2 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -669,31 +669,22 @@ xfs_mntupdate(
669 xfs_mount_t *mp = XFS_BHVTOM(bdp); 669 xfs_mount_t *mp = XFS_BHVTOM(bdp);
670 int error; 670 int error;
671 671
672 if (args->flags & XFSMNT_BARRIER) 672 if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */
673 mp->m_flags |= XFS_MOUNT_BARRIER; 673 if (vfsp->vfs_flag & VFS_RDONLY)
674 else 674 vfsp->vfs_flag &= ~VFS_RDONLY;
675 mp->m_flags &= ~XFS_MOUNT_BARRIER; 675 if (args->flags & XFSMNT_BARRIER) {
676 676 mp->m_flags |= XFS_MOUNT_BARRIER;
677 if ((vfsp->vfs_flag & VFS_RDONLY) &&
678 !(*flags & MS_RDONLY)) {
679 vfsp->vfs_flag &= ~VFS_RDONLY;
680
681 if (args->flags & XFSMNT_BARRIER)
682 xfs_mountfs_check_barriers(mp); 677 xfs_mountfs_check_barriers(mp);
683 } 678 } else {
684 679 mp->m_flags &= ~XFS_MOUNT_BARRIER;
685 if (!(vfsp->vfs_flag & VFS_RDONLY) && 680 }
686 (*flags & MS_RDONLY)) { 681 } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */
687 VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error); 682 VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);
688
689 xfs_quiesce_fs(mp); 683 xfs_quiesce_fs(mp);
690
691 /* Ok now write out an unmount record */
692 xfs_log_unmount_write(mp); 684 xfs_log_unmount_write(mp);
693 xfs_unmountfs_writesb(mp); 685 xfs_unmountfs_writesb(mp);
694 vfsp->vfs_flag |= VFS_RDONLY; 686 vfsp->vfs_flag |= VFS_RDONLY;
695 } 687 }
696
697 return 0; 688 return 0;
698} 689}
699 690
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index fa71b305ba5c..7027ae68ee38 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -2663,7 +2663,7 @@ xfs_link(
2663 */ 2663 */
2664 if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && 2664 if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
2665 (tdp->i_d.di_projid != sip->i_d.di_projid))) { 2665 (tdp->i_d.di_projid != sip->i_d.di_projid))) {
2666 error = XFS_ERROR(EPERM); 2666 error = XFS_ERROR(EXDEV);
2667 goto error_return; 2667 goto error_return;
2668 } 2668 }
2669 2669
diff --git a/include/asm-arm/arch-aaec2000/debug-macro.S b/include/asm-arm/arch-aaec2000/debug-macro.S
index e4f1fa539a74..7b1fce021d8a 100644
--- a/include/asm-arm/arch-aaec2000/debug-macro.S
+++ b/include/asm-arm/arch-aaec2000/debug-macro.S
@@ -9,6 +9,7 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include "hardware.h"
12 .macro addruart,rx 13 .macro addruart,rx
13 mrc p15, 0, \rx, c1, c0 14 mrc p15, 0, \rx, c1, c0
14 tst \rx, #1 @ MMU enabled? 15 tst \rx, #1 @ MMU enabled?
diff --git a/include/asm-arm/arch-aaec2000/entry-macro.S b/include/asm-arm/arch-aaec2000/entry-macro.S
index df31313ab07e..1eb3503bd16e 100644
--- a/include/asm-arm/arch-aaec2000/entry-macro.S
+++ b/include/asm-arm/arch-aaec2000/entry-macro.S
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 *
12 */ 12 */
13#include <asm/arch/irqs.h>
13 14
14 .macro disable_fiq 15 .macro disable_fiq
15 .endm 16 .endm
diff --git a/include/asm-arm/arch-imx/debug-macro.S b/include/asm-arm/arch-imx/debug-macro.S
index 83f552f7bcc1..c611871643a2 100644
--- a/include/asm-arm/arch-imx/debug-macro.S
+++ b/include/asm-arm/arch-imx/debug-macro.S
@@ -16,7 +16,7 @@
16 tst \rx, #1 @ MMU enabled? 16 tst \rx, #1 @ MMU enabled?
17 moveq \rx, #0x00000000 @ physical 17 moveq \rx, #0x00000000 @ physical
18 movne \rx, #0xe0000000 @ virtual 18 movne \rx, #0xe0000000 @ virtual
19 orr \rx, \rx, #0x00200000 19 orreq \rx, \rx, #0x00200000 @ physical
20 orr \rx, \rx, #0x00006000 @ UART1 offset 20 orr \rx, \rx, #0x00006000 @ UART1 offset
21 .endm 21 .endm
22 22
diff --git a/include/asm-arm/arch-imx/imx-uart.h b/include/asm-arm/arch-imx/imx-uart.h
new file mode 100644
index 000000000000..3a685e1780ea
--- /dev/null
+++ b/include/asm-arm/arch-imx/imx-uart.h
@@ -0,0 +1,10 @@
1#ifndef ASMARM_ARCH_UART_H
2#define ASMARM_ARCH_UART_H
3
4#define IMXUART_HAVE_RTSCTS (1<<0)
5
6struct imxuart_platform_data {
7 unsigned int flags;
8};
9
10#endif
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index 942b622455bc..b59520e56fc7 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -260,6 +260,12 @@ out:
260 260
261#endif 261#endif
262 262
263#ifndef CONFIG_PCI
264
265#define __io(v) v
266
267#else
268
263/* 269/*
264 * IXP4xx does not have a transparent cpu -> PCI I/O translation 270 * IXP4xx does not have a transparent cpu -> PCI I/O translation
265 * window. Instead, it has a set of registers that must be tweaked 271 * window. Instead, it has a set of registers that must be tweaked
@@ -578,6 +584,7 @@ __ixp4xx_iowrite32_rep(void __iomem *addr, const void *vaddr, u32 count)
578 584
579#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET)) 585#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET))
580#define ioport_unmap(addr) 586#define ioport_unmap(addr)
587#endif // !CONFIG_PCI
581 588
582#endif // __ASM_ARM_ARCH_IO_H 589#endif // __ASM_ARM_ARCH_IO_H
583 590
diff --git a/include/asm-arm/arch-ixp4xx/memory.h b/include/asm-arm/arch-ixp4xx/memory.h
index ee211d28a3ef..af9667b57ab3 100644
--- a/include/asm-arm/arch-ixp4xx/memory.h
+++ b/include/asm-arm/arch-ixp4xx/memory.h
@@ -14,7 +14,7 @@
14 */ 14 */
15#define PHYS_OFFSET UL(0x00000000) 15#define PHYS_OFFSET UL(0x00000000)
16 16
17#ifndef __ASSEMBLY__ 17#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI)
18 18
19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes); 19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
20 20
diff --git a/include/asm-arm/arch-pxa/dma.h b/include/asm-arm/arch-pxa/dma.h
index 3e88a2a02a0f..a008150abc59 100644
--- a/include/asm-arm/arch-pxa/dma.h
+++ b/include/asm-arm/arch-pxa/dma.h
@@ -24,27 +24,29 @@ typedef struct pxa_dma_desc {
24 volatile u32 dcmd; /* DCMD value for the current transfer */ 24 volatile u32 dcmd; /* DCMD value for the current transfer */
25} pxa_dma_desc; 25} pxa_dma_desc;
26 26
27typedef enum {
28 DMA_PRIO_HIGH = 0,
29 DMA_PRIO_MEDIUM = 1,
30 DMA_PRIO_LOW = 2
31} pxa_dma_prio;
32
27#if defined(CONFIG_PXA27x) 33#if defined(CONFIG_PXA27x)
28 34
29#define PXA_DMA_CHANNELS 32 35#define PXA_DMA_CHANNELS 32
30#define PXA_DMA_NBCH(prio) ((prio == DMA_PRIO_LOW) ? 16 : 8)
31 36
32typedef enum { 37#define pxa_for_each_dma_prio(ch, prio) \
33 DMA_PRIO_HIGH = 0, 38for ( \
34 DMA_PRIO_MEDIUM = 8, 39 ch = prio * 4; \
35 DMA_PRIO_LOW = 16 40 ch != (4 << prio) + 16; \
36} pxa_dma_prio; 41 ch = (ch + 1 == (4 << prio)) ? (prio * 4 + 16) : (ch + 1) \
42)
37 43
38#elif defined(CONFIG_PXA25x) 44#elif defined(CONFIG_PXA25x)
39 45
40#define PXA_DMA_CHANNELS 16 46#define PXA_DMA_CHANNELS 16
41#define PXA_DMA_NBCH(prio) ((prio == DMA_PRIO_LOW) ? 8 : 4)
42 47
43typedef enum { 48#define pxa_for_each_dma_prio(ch, prio) \
44 DMA_PRIO_HIGH = 0, 49 for (ch = prio * 4; ch != (4 << prio); ch++)
45 DMA_PRIO_MEDIUM = 4,
46 DMA_PRIO_LOW = 8
47} pxa_dma_prio;
48 50
49#endif 51#endif
50 52
diff --git a/include/asm-arm/bug.h b/include/asm-arm/bug.h
index 7fb02138f585..5ab8216f5204 100644
--- a/include/asm-arm/bug.h
+++ b/include/asm-arm/bug.h
@@ -2,6 +2,7 @@
2#define _ASMARM_BUG_H 2#define _ASMARM_BUG_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/stddef.h>
5 6
6#ifdef CONFIG_BUG 7#ifdef CONFIG_BUG
7#ifdef CONFIG_DEBUG_BUGVERBOSE 8#ifdef CONFIG_DEBUG_BUGVERBOSE
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index ee8dfea549bc..cbf39a56dbe7 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -363,7 +363,7 @@
363/* 363/*
364 * The following syscalls are obsolete and no longer available for EABI. 364 * The following syscalls are obsolete and no longer available for EABI.
365 */ 365 */
366#if defined(__ARM_EABI__) 366#if defined(__ARM_EABI__) && !defined(__KERNEL__)
367#undef __NR_time 367#undef __NR_time
368#undef __NR_umount 368#undef __NR_umount
369#undef __NR_stime 369#undef __NR_stime
@@ -410,7 +410,8 @@ type name(void) { \
410 __asm__ __volatile__ ( \ 410 __asm__ __volatile__ ( \
411 __syscall(name) \ 411 __syscall(name) \
412 : "=r" (__res_r0) \ 412 : "=r" (__res_r0) \
413 : __SYS_REG_LIST() ); \ 413 : __SYS_REG_LIST() \
414 : "memory" ); \
414 __res = __res_r0; \ 415 __res = __res_r0; \
415 __syscall_return(type,__res); \ 416 __syscall_return(type,__res); \
416} 417}
@@ -424,7 +425,8 @@ type name(type1 arg1) { \
424 __asm__ __volatile__ ( \ 425 __asm__ __volatile__ ( \
425 __syscall(name) \ 426 __syscall(name) \
426 : "=r" (__res_r0) \ 427 : "=r" (__res_r0) \
427 : __SYS_REG_LIST( "0" (__r0) ) ); \ 428 : __SYS_REG_LIST( "0" (__r0) ) \
429 : "memory" ); \
428 __res = __res_r0; \ 430 __res = __res_r0; \
429 __syscall_return(type,__res); \ 431 __syscall_return(type,__res); \
430} 432}
@@ -439,7 +441,8 @@ type name(type1 arg1,type2 arg2) { \
439 __asm__ __volatile__ ( \ 441 __asm__ __volatile__ ( \
440 __syscall(name) \ 442 __syscall(name) \
441 : "=r" (__res_r0) \ 443 : "=r" (__res_r0) \
442 : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) ); \ 444 : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) \
445 : "memory" ); \
443 __res = __res_r0; \ 446 __res = __res_r0; \
444 __syscall_return(type,__res); \ 447 __syscall_return(type,__res); \
445} 448}
@@ -456,7 +459,8 @@ type name(type1 arg1,type2 arg2,type3 arg3) { \
456 __asm__ __volatile__ ( \ 459 __asm__ __volatile__ ( \
457 __syscall(name) \ 460 __syscall(name) \
458 : "=r" (__res_r0) \ 461 : "=r" (__res_r0) \
459 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) ); \ 462 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) \
463 : "memory" ); \
460 __res = __res_r0; \ 464 __res = __res_r0; \
461 __syscall_return(type,__res); \ 465 __syscall_return(type,__res); \
462} 466}
@@ -474,7 +478,8 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
474 __asm__ __volatile__ ( \ 478 __asm__ __volatile__ ( \
475 __syscall(name) \ 479 __syscall(name) \
476 : "=r" (__res_r0) \ 480 : "=r" (__res_r0) \
477 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) ); \ 481 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) \
482 : "memory" ); \
478 __res = __res_r0; \ 483 __res = __res_r0; \
479 __syscall_return(type,__res); \ 484 __syscall_return(type,__res); \
480} 485}
@@ -494,7 +499,8 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
494 __syscall(name) \ 499 __syscall(name) \
495 : "=r" (__res_r0) \ 500 : "=r" (__res_r0) \
496 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ 501 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \
497 "r" (__r3), "r" (__r4) ) ); \ 502 "r" (__r3), "r" (__r4) ) \
503 : "memory" ); \
498 __res = __res_r0; \ 504 __res = __res_r0; \
499 __syscall_return(type,__res); \ 505 __syscall_return(type,__res); \
500} 506}
@@ -514,7 +520,8 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6
514 __syscall(name) \ 520 __syscall(name) \
515 : "=r" (__res_r0) \ 521 : "=r" (__res_r0) \
516 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ 522 : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \
517 "r" (__r3), "r" (__r4), "r" (__r5) ) ); \ 523 "r" (__r3), "r" (__r4), "r" (__r5) ) \
524 : "memory" ); \
518 __res = __res_r0; \ 525 __res = __res_r0; \
519 __syscall_return(type,__res); \ 526 __syscall_return(type,__res); \
520} 527}
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 51c4e5fe6062..d92e253f7f6f 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -200,6 +200,7 @@ extern int io_apic_get_unique_id (int ioapic, int apic_id);
200extern int io_apic_get_version (int ioapic); 200extern int io_apic_get_version (int ioapic);
201extern int io_apic_get_redir_entries (int ioapic); 201extern int io_apic_get_redir_entries (int ioapic);
202extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); 202extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
203extern int timer_uses_ioapic_pin_0;
203#endif /* CONFIG_ACPI */ 204#endif /* CONFIG_ACPI */
204 205
205extern int (*ioapic_renumber_irq)(int ioapic, int irq); 206extern int (*ioapic_renumber_irq)(int ioapic, int irq);
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 90921e162793..6cc517e212a9 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -11,7 +11,6 @@
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <asm/bitops.h>
15#include <asm/intrinsics.h> 14#include <asm/intrinsics.h>
16 15
17/** 16/**
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
index 3872e924cdd6..d83fc29c2bbf 100644
--- a/include/asm-powerpc/uaccess.h
+++ b/include/asm-powerpc/uaccess.h
@@ -7,6 +7,7 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <asm/processor.h> 9#include <asm/processor.h>
10#include <asm/page.h>
10 11
11#define VERIFY_READ 0 12#define VERIFY_READ 0
12#define VERIFY_WRITE 1 13#define VERIFY_WRITE 1
@@ -179,9 +180,11 @@ do { \
179#define __put_user_nocheck(x, ptr, size) \ 180#define __put_user_nocheck(x, ptr, size) \
180({ \ 181({ \
181 long __pu_err; \ 182 long __pu_err; \
182 might_sleep(); \ 183 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
184 if (!is_kernel_addr((unsigned long)__pu_addr)) \
185 might_sleep(); \
183 __chk_user_ptr(ptr); \ 186 __chk_user_ptr(ptr); \
184 __put_user_size((x), (ptr), (size), __pu_err); \ 187 __put_user_size((x), __pu_addr, (size), __pu_err); \
185 __pu_err; \ 188 __pu_err; \
186}) 189})
187 190
@@ -258,9 +261,11 @@ do { \
258({ \ 261({ \
259 long __gu_err; \ 262 long __gu_err; \
260 unsigned long __gu_val; \ 263 unsigned long __gu_val; \
264 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
261 __chk_user_ptr(ptr); \ 265 __chk_user_ptr(ptr); \
262 might_sleep(); \ 266 if (!is_kernel_addr((unsigned long)__gu_addr)) \
263 __get_user_size(__gu_val, (ptr), (size), __gu_err); \ 267 might_sleep(); \
268 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
264 (x) = (__typeof__(*(ptr)))__gu_val; \ 269 (x) = (__typeof__(*(ptr)))__gu_val; \
265 __gu_err; \ 270 __gu_err; \
266}) 271})
@@ -270,9 +275,11 @@ do { \
270({ \ 275({ \
271 long __gu_err; \ 276 long __gu_err; \
272 long long __gu_val; \ 277 long long __gu_val; \
278 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
273 __chk_user_ptr(ptr); \ 279 __chk_user_ptr(ptr); \
274 might_sleep(); \ 280 if (!is_kernel_addr((unsigned long)__gu_addr)) \
275 __get_user_size(__gu_val, (ptr), (size), __gu_err); \ 281 might_sleep(); \
282 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
276 (x) = (__typeof__(*(ptr)))__gu_val; \ 283 (x) = (__typeof__(*(ptr)))__gu_val; \
277 __gu_err; \ 284 __gu_err; \
278}) 285})
diff --git a/include/asm-ppc/commproc.h b/include/asm-ppc/commproc.h
index 973e60908234..31f362966a58 100644
--- a/include/asm-ppc/commproc.h
+++ b/include/asm-ppc/commproc.h
@@ -35,6 +35,7 @@
35#define CPM_CR_INIT_TX ((ushort)0x0002) 35#define CPM_CR_INIT_TX ((ushort)0x0002)
36#define CPM_CR_HUNT_MODE ((ushort)0x0003) 36#define CPM_CR_HUNT_MODE ((ushort)0x0003)
37#define CPM_CR_STOP_TX ((ushort)0x0004) 37#define CPM_CR_STOP_TX ((ushort)0x0004)
38#define CPM_CR_GRA_STOP_TX ((ushort)0x0005)
38#define CPM_CR_RESTART_TX ((ushort)0x0006) 39#define CPM_CR_RESTART_TX ((ushort)0x0006)
39#define CPM_CR_CLOSE_RX_BD ((ushort)0x0007) 40#define CPM_CR_CLOSE_RX_BD ((ushort)0x0007)
40#define CPM_CR_SET_GADDR ((ushort)0x0008) 41#define CPM_CR_SET_GADDR ((ushort)0x0008)
diff --git a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
index b638b87cebe3..c70344b91049 100644
--- a/include/asm-ppc/cpm2.h
+++ b/include/asm-ppc/cpm2.h
@@ -69,7 +69,7 @@
69#define CPM_CR_INIT_TX ((ushort)0x0002) 69#define CPM_CR_INIT_TX ((ushort)0x0002)
70#define CPM_CR_HUNT_MODE ((ushort)0x0003) 70#define CPM_CR_HUNT_MODE ((ushort)0x0003)
71#define CPM_CR_STOP_TX ((ushort)0x0004) 71#define CPM_CR_STOP_TX ((ushort)0x0004)
72#define CPM_CR_GRA_STOP_TX ((ushort)0x0005) 72#define CPM_CR_GRA_STOP_TX ((ushort)0x0005)
73#define CPM_CR_RESTART_TX ((ushort)0x0006) 73#define CPM_CR_RESTART_TX ((ushort)0x0006)
74#define CPM_CR_SET_GADDR ((ushort)0x0008) 74#define CPM_CR_SET_GADDR ((ushort)0x0008)
75#define CPM_CR_START_IDMA ((ushort)0x0009) 75#define CPM_CR_START_IDMA ((ushort)0x0009)
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index a70ba2ee552d..0fb68a0b0181 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -20,6 +20,7 @@
20/* This must match what is in arch/ppc/Makefile */ 20/* This must match what is in arch/ppc/Makefile */
21#define PAGE_OFFSET CONFIG_KERNEL_START 21#define PAGE_OFFSET CONFIG_KERNEL_START
22#define KERNELBASE PAGE_OFFSET 22#define KERNELBASE PAGE_OFFSET
23#define is_kernel_addr(x) ((x) >= PAGE_OFFSET)
23 24
24#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
25 26
diff --git a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
index 657d582e8149..41c2792ff6b0 100644
--- a/include/asm-s390/unistd.h
+++ b/include/asm-s390/unistd.h
@@ -296,8 +296,14 @@
296#define __NR_pselect6 301 296#define __NR_pselect6 301
297#define __NR_ppoll 302 297#define __NR_ppoll 302
298#define __NR_unshare 303 298#define __NR_unshare 303
299#define __NR_set_robust_list 304
300#define __NR_get_robust_list 305
301#define __NR_splice 306
302#define __NR_sync_file_range 307
303#define __NR_tee 308
304#define __NR_vmsplice 309
299 305
300#define NR_syscalls 304 306#define NR_syscalls 310
301 307
302/* 308/*
303 * There are some system calls that are not present on 64 bit, some 309 * There are some system calls that are not present on 64 bit, some
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index 32a48f623e2b..f5611a721fbd 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -41,7 +41,7 @@
41#define __NR_capset 22 /* Linux Specific */ 41#define __NR_capset 22 /* Linux Specific */
42#define __NR_setuid 23 /* Implemented via setreuid in SunOS */ 42#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
43#define __NR_getuid 24 /* Common */ 43#define __NR_getuid 24 /* Common */
44/* #define __NR_time alias 25 ENOSYS under SunOS */ 44#define __NR_vmsplice 25 /* ENOSYS under SunOS */
45#define __NR_ptrace 26 /* Common */ 45#define __NR_ptrace 26 /* Common */
46#define __NR_alarm 27 /* Implemented via setitimer in SunOS */ 46#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
47#define __NR_sigaltstack 28 /* Common */ 47#define __NR_sigaltstack 28 /* Common */
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index ca80e8aca128..68705748bec0 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -41,7 +41,7 @@
41#define __NR_capset 22 /* Linux Specific */ 41#define __NR_capset 22 /* Linux Specific */
42#define __NR_setuid 23 /* Implemented via setreuid in SunOS */ 42#define __NR_setuid 23 /* Implemented via setreuid in SunOS */
43#define __NR_getuid 24 /* Common */ 43#define __NR_getuid 24 /* Common */
44/* #define __NR_time alias 25 ENOSYS under SunOS */ 44#define __NR_vmsplice 25 /* ENOSYS under SunOS */
45#define __NR_ptrace 26 /* Common */ 45#define __NR_ptrace 26 /* Common */
46#define __NR_alarm 27 /* Implemented via setitimer in SunOS */ 46#define __NR_alarm 27 /* Implemented via setitimer in SunOS */
47#define __NR_sigaltstack 28 /* Common */ 47#define __NR_sigaltstack 28 /* Common */
diff --git a/include/asm-x86_64/e820.h b/include/asm-x86_64/e820.h
index 93b51df51687..670a3388e70a 100644
--- a/include/asm-x86_64/e820.h
+++ b/include/asm-x86_64/e820.h
@@ -59,6 +59,8 @@ extern void __init parse_memopt(char *p, char **end);
59extern void __init parse_memmapopt(char *p, char **end); 59extern void __init parse_memmapopt(char *p, char **end);
60 60
61extern struct e820map e820; 61extern struct e820map e820;
62
63extern unsigned ebda_addr, ebda_size;
62#endif/*!__ASSEMBLY__*/ 64#endif/*!__ASSEMBLY__*/
63 65
64#endif/*__E820_HEADER*/ 66#endif/*__E820_HEADER*/
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index ee1bc69aec9c..52484e82c641 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -205,6 +205,7 @@ extern int skip_ioapic_setup;
205extern int io_apic_get_version (int ioapic); 205extern int io_apic_get_version (int ioapic);
206extern int io_apic_get_redir_entries (int ioapic); 206extern int io_apic_get_redir_entries (int ioapic);
207extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int); 207extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
208extern int timer_uses_ioapic_pin_0;
208#endif 209#endif
209 210
210extern int sis_apic_bug; /* dummy */ 211extern int sis_apic_bug; /* dummy */
diff --git a/include/linux/device.h b/include/linux/device.h
index f6e72a65a3f2..e8e53b9accc6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -200,6 +200,7 @@ extern int class_device_create_file(struct class_device *,
200 * @node: for internal use by the driver core only. 200 * @node: for internal use by the driver core only.
201 * @kobj: for internal use by the driver core only. 201 * @kobj: for internal use by the driver core only.
202 * @devt_attr: for internal use by the driver core only. 202 * @devt_attr: for internal use by the driver core only.
203 * @groups: optional additional groups to be created
203 * @dev: if set, a symlink to the struct device is created in the sysfs 204 * @dev: if set, a symlink to the struct device is created in the sysfs
204 * directory for this struct class device. 205 * directory for this struct class device.
205 * @class_data: pointer to whatever you want to store here for this struct 206 * @class_data: pointer to whatever you want to store here for this struct
@@ -228,6 +229,7 @@ struct class_device {
228 struct device * dev; /* not necessary, but nice to have */ 229 struct device * dev; /* not necessary, but nice to have */
229 void * class_data; /* class-specific data */ 230 void * class_data; /* class-specific data */
230 struct class_device *parent; /* parent of this child device, if there is one */ 231 struct class_device *parent; /* parent of this child device, if there is one */
232 struct attribute_group ** groups; /* optional groups */
231 233
232 void (*release)(struct class_device *dev); 234 void (*release)(struct class_device *dev);
233 int (*uevent)(struct class_device *dev, char **envp, 235 int (*uevent)(struct class_device *dev, char **envp,
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ff61817082fa..635690cf3e3d 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -14,6 +14,7 @@ enum dma_data_direction {
14}; 14};
15 15
16#define DMA_64BIT_MASK 0xffffffffffffffffULL 16#define DMA_64BIT_MASK 0xffffffffffffffffULL
17#define DMA_48BIT_MASK 0x0000ffffffffffffULL
17#define DMA_40BIT_MASK 0x000000ffffffffffULL 18#define DMA_40BIT_MASK 0x000000ffffffffffULL
18#define DMA_39BIT_MASK 0x0000007fffffffffULL 19#define DMA_39BIT_MASK 0x0000007fffffffffULL
19#define DMA_32BIT_MASK 0x00000000ffffffffULL 20#define DMA_32BIT_MASK 0x00000000ffffffffULL
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h
new file mode 100644
index 000000000000..f5975126b712
--- /dev/null
+++ b/include/linux/fs_uart_pd.h
@@ -0,0 +1,60 @@
1/*
2 * Platform information definitions for the CPM Uart driver.
3 *
4 * 2006 (c) MontaVista Software, Inc.
5 * Vitaly Bordug <vbordug@ru.mvista.com>
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#ifndef FS_UART_PD_H
13#define FS_UART_PD_H
14
15#include <linux/version.h>
16#include <asm/types.h>
17
18enum fs_uart_id {
19 fsid_smc1_uart,
20 fsid_smc2_uart,
21 fsid_scc1_uart,
22 fsid_scc2_uart,
23 fsid_scc3_uart,
24 fsid_scc4_uart,
25 fs_uart_nr,
26};
27
28static inline int fs_uart_id_scc2fsid(int id)
29{
30 return fsid_scc1_uart + id - 1;
31}
32
33static inline int fs_uart_id_fsid2scc(int id)
34{
35 return id - fsid_scc1_uart + 1;
36}
37
38static inline int fs_uart_id_smc2fsid(int id)
39{
40 return fsid_smc1_uart + id - 1;
41}
42
43static inline int fs_uart_id_fsid2smc(int id)
44{
45 return id - fsid_smc1_uart + 1;
46}
47
48struct fs_uart_platform_info {
49 void(*init_ioports)(void);
50 /* device specific information */
51 int fs_no; /* controller index */
52 u32 uart_clk;
53 u8 tx_num_fifo;
54 u8 tx_buf_size;
55 u8 rx_num_fifo;
56 u8 rx_buf_size;
57 u8 brg;
58};
59
60#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index e1bd0842f6a1..f4fc576ed4c4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -124,6 +124,7 @@ extern int get_option(char **str, int *pint);
124extern char *get_options(const char *str, int nints, int *ints); 124extern char *get_options(const char *str, int nints, int *ints);
125extern unsigned long long memparse(char *ptr, char **retptr); 125extern unsigned long long memparse(char *ptr, char **retptr);
126 126
127extern int core_kernel_text(unsigned long addr);
127extern int __kernel_text_address(unsigned long addr); 128extern int __kernel_text_address(unsigned long addr);
128extern int kernel_text_address(unsigned long addr); 129extern int kernel_text_address(unsigned long addr);
129extern int session_of_pgrp(int pgrp); 130extern int session_of_pgrp(int pgrp);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 30dd978c1ec8..991a37382a22 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -28,6 +28,7 @@ struct mmc_csd {
28 unsigned short cmdclass; 28 unsigned short cmdclass;
29 unsigned short tacc_clks; 29 unsigned short tacc_clks;
30 unsigned int tacc_ns; 30 unsigned int tacc_ns;
31 unsigned int r2w_factor;
31 unsigned int max_dtr; 32 unsigned int max_dtr;
32 unsigned int read_blkbits; 33 unsigned int read_blkbits;
33 unsigned int write_blkbits; 34 unsigned int write_blkbits;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 01db7b88a2b1..f4169bbb60eb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -433,8 +433,7 @@ struct net_device
433 433
434 /* register/unregister state machine */ 434 /* register/unregister state machine */
435 enum { NETREG_UNINITIALIZED=0, 435 enum { NETREG_UNINITIALIZED=0,
436 NETREG_REGISTERING, /* called register_netdevice */ 436 NETREG_REGISTERED, /* completed register_netdevice */
437 NETREG_REGISTERED, /* completed register todo */
438 NETREG_UNREGISTERING, /* called unregister_netdevice */ 437 NETREG_UNREGISTERING, /* called unregister_netdevice */
439 NETREG_UNREGISTERED, /* completed unregister todo */ 438 NETREG_UNREGISTERED, /* completed unregister todo */
440 NETREG_RELEASED, /* called free_netdev */ 439 NETREG_RELEASED, /* called free_netdev */
@@ -506,6 +505,8 @@ struct net_device
506 505
507 /* class/net/name entry */ 506 /* class/net/name entry */
508 struct class_device class_dev; 507 struct class_device class_dev;
508 /* space for optional statistics and wireless sysfs groups */
509 struct attribute_group *sysfs_groups[3];
509}; 510};
510 511
511#define NETDEV_ALIGN 32 512#define NETDEV_ALIGN 32
@@ -829,21 +830,19 @@ static inline void netif_rx_schedule(struct net_device *dev)
829 __netif_rx_schedule(dev); 830 __netif_rx_schedule(dev);
830} 831}
831 832
832 833/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().
833static inline void __netif_rx_reschedule(struct net_device *dev, int undo) 834 * Do not inline this?
834{ 835 */
835 dev->quota += undo;
836 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
837 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
838}
839
840/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
841static inline int netif_rx_reschedule(struct net_device *dev, int undo) 836static inline int netif_rx_reschedule(struct net_device *dev, int undo)
842{ 837{
843 if (netif_rx_schedule_prep(dev)) { 838 if (netif_rx_schedule_prep(dev)) {
844 unsigned long flags; 839 unsigned long flags;
840
841 dev->quota += undo;
842
845 local_irq_save(flags); 843 local_irq_save(flags);
846 __netif_rx_reschedule(dev, undo); 844 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
845 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
847 local_irq_restore(flags); 846 local_irq_restore(flags);
848 return 1; 847 return 1;
849 } 848 }
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
index 0bd828081c0c..c6e9a0b6d30b 100644
--- a/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
+++ b/include/linux/netfilter_ipv4/ip_conntrack_helper_h323_asn1.h
@@ -2,7 +2,7 @@
2 * ip_conntrack_helper_h323_asn1.h - BER and PER decoding library for H.323 2 * ip_conntrack_helper_h323_asn1.h - BER and PER decoding library for H.323
3 * conntrack/NAT module. 3 * conntrack/NAT module.
4 * 4 *
5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@hotmail.com> 5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
6 * 6 *
7 * This source code is licensed under General Public License version 2. 7 * This source code is licensed under General Public License version 2.
8 * 8 *
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ba73108cbf8b..ea4f7cd7bfd8 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -5,8 +5,9 @@
5 5
6#define PIPE_BUFFERS (16) 6#define PIPE_BUFFERS (16)
7 7
8#define PIPE_BUF_FLAG_ATOMIC 0x01 /* was atomically mapped */ 8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
9#define PIPE_BUF_FLAG_GIFT 0x02 /* page is a gift */ 9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
10#define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
10 11
11struct pipe_buffer { 12struct pipe_buffer {
12 struct page *page; 13 struct page *page;
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 5673008b61e1..970284f571a6 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -132,6 +132,7 @@ static inline void rcu_bh_qsctr_inc(int cpu)
132} 132}
133 133
134extern int rcu_pending(int cpu); 134extern int rcu_pending(int cpu);
135extern int rcu_needs_cpu(int cpu);
135 136
136/** 137/**
137 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 138 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index c32e60e79dea..bd14858121ea 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -254,6 +254,7 @@ struct uart_port {
254#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 254#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
255#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 255#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
256#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) 256#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
257#define UPF_DEAD ((__force upf_t) (1 << 30))
257#define UPF_IOREMAP ((__force upf_t) (1 << 31)) 258#define UPF_IOREMAP ((__force upf_t) (1 << 31))
258 259
259#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff)) 260#define UPF_CHANGE_MASK ((__force upf_t) (0x17fff))
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 3af03b19c983..2d985d59c7b8 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -150,6 +150,7 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
150 150
151extern void kfree(const void *); 151extern void kfree(const void *);
152extern unsigned int ksize(const void *); 152extern unsigned int ksize(const void *);
153extern int slab_is_available(void);
153 154
154#ifdef CONFIG_NUMA 155#ifdef CONFIG_NUMA
155extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node); 156extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 5b1fdf1cff4f..f03c24719302 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -296,7 +296,7 @@ static inline void disable_swap_token(void)
296#define read_swap_cache_async(swp,vma,addr) NULL 296#define read_swap_cache_async(swp,vma,addr) NULL
297#define lookup_swap_cache(swp) NULL 297#define lookup_swap_cache(swp) NULL
298#define valid_swaphandles(swp, off) 0 298#define valid_swaphandles(swp, off) 0
299#define can_share_swap_page(p) 0 299#define can_share_swap_page(p) (page_mapcount(p) == 1)
300#define move_to_swap_cache(p, swp) 1 300#define move_to_swap_cache(p, swp) 1
301#define move_from_swap_cache(p, i, m) 1 301#define move_from_swap_cache(p, i, m) 1
302#define __delete_from_swap_cache(p) /*NOTHING*/ 302#define __delete_from_swap_cache(p) /*NOTHING*/
diff --git a/include/net/ax25.h b/include/net/ax25.h
index d052b221dbcd..5bd997487054 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -145,14 +145,14 @@ enum {
145#define AX25_DEF_CONMODE 2 /* Connected mode allowed */ 145#define AX25_DEF_CONMODE 2 /* Connected mode allowed */
146#define AX25_DEF_WINDOW 2 /* Window=2 */ 146#define AX25_DEF_WINDOW 2 /* Window=2 */
147#define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */ 147#define AX25_DEF_EWINDOW 32 /* Module-128 Window=32 */
148#define AX25_DEF_T1 (10 * HZ) /* T1=10s */ 148#define AX25_DEF_T1 10000 /* T1=10s */
149#define AX25_DEF_T2 (3 * HZ) /* T2=3s */ 149#define AX25_DEF_T2 3000 /* T2=3s */
150#define AX25_DEF_T3 (300 * HZ) /* T3=300s */ 150#define AX25_DEF_T3 300000 /* T3=300s */
151#define AX25_DEF_N2 10 /* N2=10 */ 151#define AX25_DEF_N2 10 /* N2=10 */
152#define AX25_DEF_IDLE (0 * 60 * HZ) /* Idle=None */ 152#define AX25_DEF_IDLE 0 /* Idle=None */
153#define AX25_DEF_PACLEN 256 /* Paclen=256 */ 153#define AX25_DEF_PACLEN 256 /* Paclen=256 */
154#define AX25_DEF_PROTOCOL AX25_PROTO_STD_SIMPLEX /* Standard AX.25 */ 154#define AX25_DEF_PROTOCOL AX25_PROTO_STD_SIMPLEX /* Standard AX.25 */
155#define AX25_DEF_DS_TIMEOUT (3 * 60 * HZ) /* DAMA timeout 3 minutes */ 155#define AX25_DEF_DS_TIMEOUT 180000 /* DAMA timeout 3 minutes */
156 156
157typedef struct ax25_uid_assoc { 157typedef struct ax25_uid_assoc {
158 struct hlist_node uid_node; 158 struct hlist_node uid_node;
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 4725ff861c57..d5926bfb1fc9 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -955,11 +955,13 @@ enum ieee80211_state {
955 955
956#define IEEE80211_24GHZ_MIN_CHANNEL 1 956#define IEEE80211_24GHZ_MIN_CHANNEL 1
957#define IEEE80211_24GHZ_MAX_CHANNEL 14 957#define IEEE80211_24GHZ_MAX_CHANNEL 14
958#define IEEE80211_24GHZ_CHANNELS 14 958#define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
959 IEEE80211_24GHZ_MIN_CHANNEL + 1)
959 960
960#define IEEE80211_52GHZ_MIN_CHANNEL 34 961#define IEEE80211_52GHZ_MIN_CHANNEL 34
961#define IEEE80211_52GHZ_MAX_CHANNEL 165 962#define IEEE80211_52GHZ_MAX_CHANNEL 165
962#define IEEE80211_52GHZ_CHANNELS 131 963#define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
964 IEEE80211_52GHZ_MIN_CHANNEL + 1)
963 965
964enum { 966enum {
965 IEEE80211_CH_PASSIVE_ONLY = (1 << 0), 967 IEEE80211_CH_PASSIVE_ONLY = (1 << 0),
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
index b1ebfbae397f..052ed596a4e4 100644
--- a/include/net/ieee80211softmac.h
+++ b/include/net/ieee80211softmac.h
@@ -204,7 +204,8 @@ struct ieee80211softmac_device {
204 204
205 /* couple of flags */ 205 /* couple of flags */
206 u8 scanning:1, /* protects scanning from being done multiple times at once */ 206 u8 scanning:1, /* protects scanning from being done multiple times at once */
207 associated:1; 207 associated:1,
208 running:1;
208 209
209 struct ieee80211softmac_scaninfo *scaninfo; 210 struct ieee80211softmac_scaninfo *scaninfo;
210 struct ieee80211softmac_assoc_info associnfo; 211 struct ieee80211softmac_assoc_info associnfo;
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index b0666d66293f..4901ee446879 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -211,6 +211,7 @@ struct neigh_table
211#define NEIGH_UPDATE_F_ADMIN 0x80000000 211#define NEIGH_UPDATE_F_ADMIN 0x80000000
212 212
213extern void neigh_table_init(struct neigh_table *tbl); 213extern void neigh_table_init(struct neigh_table *tbl);
214extern void neigh_table_init_no_netlink(struct neigh_table *tbl);
214extern int neigh_table_clear(struct neigh_table *tbl); 215extern int neigh_table_clear(struct neigh_table *tbl);
215extern struct neighbour * neigh_lookup(struct neigh_table *tbl, 216extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
216 const void *pkey, 217 const void *pkey,
diff --git a/include/net/netrom.h b/include/net/netrom.h
index a5ee53bce62f..e0ca112024a3 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -42,11 +42,11 @@ enum {
42#define NR_COND_PEER_RX_BUSY 0x04 42#define NR_COND_PEER_RX_BUSY 0x04
43#define NR_COND_OWN_RX_BUSY 0x08 43#define NR_COND_OWN_RX_BUSY 0x08
44 44
45#define NR_DEFAULT_T1 (120 * HZ) /* Outstanding frames - 120 seconds */ 45#define NR_DEFAULT_T1 120000 /* Outstanding frames - 120 seconds */
46#define NR_DEFAULT_T2 (5 * HZ) /* Response delay - 5 seconds */ 46#define NR_DEFAULT_T2 5000 /* Response delay - 5 seconds */
47#define NR_DEFAULT_N2 3 /* Number of Retries - 3 */ 47#define NR_DEFAULT_N2 3 /* Number of Retries - 3 */
48#define NR_DEFAULT_T4 (180 * HZ) /* Busy Delay - 180 seconds */ 48#define NR_DEFAULT_T4 180000 /* Busy Delay - 180 seconds */
49#define NR_DEFAULT_IDLE (0 * 60 * HZ) /* No Activity Timeout - none */ 49#define NR_DEFAULT_IDLE 0 /* No Activity Timeout - none */
50#define NR_DEFAULT_WINDOW 4 /* Default Window Size - 4 */ 50#define NR_DEFAULT_WINDOW 4 /* Default Window Size - 4 */
51#define NR_DEFAULT_OBS 6 /* Default Obsolescence Count - 6 */ 51#define NR_DEFAULT_OBS 6 /* Default Obsolescence Count - 6 */
52#define NR_DEFAULT_QUAL 10 /* Default Neighbour Quality - 10 */ 52#define NR_DEFAULT_QUAL 10 /* Default Neighbour Quality - 10 */
diff --git a/include/net/rose.h b/include/net/rose.h
index 3249b979605a..012b09ed2401 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -49,14 +49,14 @@ enum {
49 ROSE_STATE_5 /* Deferred Call Acceptance */ 49 ROSE_STATE_5 /* Deferred Call Acceptance */
50}; 50};
51 51
52#define ROSE_DEFAULT_T0 (180 * HZ) /* Default T10 T20 value */ 52#define ROSE_DEFAULT_T0 180000 /* Default T10 T20 value */
53#define ROSE_DEFAULT_T1 (200 * HZ) /* Default T11 T21 value */ 53#define ROSE_DEFAULT_T1 200000 /* Default T11 T21 value */
54#define ROSE_DEFAULT_T2 (180 * HZ) /* Default T12 T22 value */ 54#define ROSE_DEFAULT_T2 180000 /* Default T12 T22 value */
55#define ROSE_DEFAULT_T3 (180 * HZ) /* Default T13 T23 value */ 55#define ROSE_DEFAULT_T3 180000 /* Default T13 T23 value */
56#define ROSE_DEFAULT_HB (5 * HZ) /* Default Holdback value */ 56#define ROSE_DEFAULT_HB 5000 /* Default Holdback value */
57#define ROSE_DEFAULT_IDLE (0 * 60 * HZ) /* No Activity Timeout - none */ 57#define ROSE_DEFAULT_IDLE 0 /* No Activity Timeout - none */
58#define ROSE_DEFAULT_ROUTING 1 /* Default routing flag */ 58#define ROSE_DEFAULT_ROUTING 1 /* Default routing flag */
59#define ROSE_DEFAULT_FAIL_TIMEOUT (120 * HZ) /* Time until link considered usable */ 59#define ROSE_DEFAULT_FAIL_TIMEOUT 120000 /* Time until link considered usable */
60#define ROSE_DEFAULT_MAXVC 50 /* Maximum number of VCs per neighbour */ 60#define ROSE_DEFAULT_MAXVC 50 /* Maximum number of VCs per neighbour */
61#define ROSE_DEFAULT_WINDOW_SIZE 7 /* Default window size */ 61#define ROSE_DEFAULT_WINDOW_SIZE 7 /* Default window size */
62 62
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index eba99f375517..7f4fea173fb1 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -712,6 +712,7 @@ struct sctp_chunk {
712 __u8 tsn_gap_acked; /* Is this chunk acked by a GAP ACK? */ 712 __u8 tsn_gap_acked; /* Is this chunk acked by a GAP ACK? */
713 __s8 fast_retransmit; /* Is this chunk fast retransmitted? */ 713 __s8 fast_retransmit; /* Is this chunk fast retransmitted? */
714 __u8 tsn_missing_report; /* Data chunk missing counter. */ 714 __u8 tsn_missing_report; /* Data chunk missing counter. */
715 __u8 data_accepted; /* At least 1 chunk in this packet accepted */
715}; 716};
716 717
717void sctp_chunk_hold(struct sctp_chunk *); 718void sctp_chunk_hold(struct sctp_chunk *);
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
index 6c2681dc5b46..637f77eccf0c 100644
--- a/include/scsi/srp.h
+++ b/include/scsi/srp.h
@@ -95,14 +95,15 @@ struct srp_direct_buf {
95 95
96/* 96/*
97 * We need the packed attribute because the SRP spec puts the list of 97 * We need the packed attribute because the SRP spec puts the list of
98 * descriptors at an offset of 20, which is not aligned to the size 98 * descriptors at an offset of 20, which is not aligned to the size of
99 * of struct srp_direct_buf. 99 * struct srp_direct_buf. The whole structure must be packed to avoid
100 * having the 20-byte structure padded to 24 bytes on 64-bit architectures.
100 */ 101 */
101struct srp_indirect_buf { 102struct srp_indirect_buf {
102 struct srp_direct_buf table_desc; 103 struct srp_direct_buf table_desc;
103 __be32 len; 104 __be32 len;
104 struct srp_direct_buf desc_list[0] __attribute__((packed)); 105 struct srp_direct_buf desc_list[0];
105}; 106} __attribute__((packed));
106 107
107enum { 108enum {
108 SRP_MULTICHAN_SINGLE = 0, 109 SRP_MULTICHAN_SINGLE = 0,
@@ -122,6 +123,11 @@ struct srp_login_req {
122 u8 target_port_id[16]; 123 u8 target_port_id[16];
123}; 124};
124 125
126/*
127 * The SRP spec defines the size of the LOGIN_RSP structure to be 52
128 * bytes, so it needs to be packed to avoid having it padded to 56
129 * bytes on 64-bit architectures.
130 */
125struct srp_login_rsp { 131struct srp_login_rsp {
126 u8 opcode; 132 u8 opcode;
127 u8 reserved1[3]; 133 u8 reserved1[3];
@@ -132,7 +138,7 @@ struct srp_login_rsp {
132 __be16 buf_fmt; 138 __be16 buf_fmt;
133 u8 rsp_flags; 139 u8 rsp_flags;
134 u8 reserved2[25]; 140 u8 reserved2[25];
135}; 141} __attribute__((packed));
136 142
137struct srp_login_rej { 143struct srp_login_rej {
138 u8 opcode; 144 u8 opcode;
@@ -207,6 +213,11 @@ enum {
207 SRP_RSP_FLAG_DIUNDER = 1 << 5 213 SRP_RSP_FLAG_DIUNDER = 1 << 5
208}; 214};
209 215
216/*
217 * The SRP spec defines the size of the RSP structure to be 36 bytes,
218 * so it needs to be packed to avoid having it padded to 40 bytes on
219 * 64-bit architectures.
220 */
210struct srp_rsp { 221struct srp_rsp {
211 u8 opcode; 222 u8 opcode;
212 u8 sol_not; 223 u8 sol_not;
@@ -221,6 +232,6 @@ struct srp_rsp {
221 __be32 sense_data_len; 232 __be32 sense_data_len;
222 __be32 resp_data_len; 233 __be32 resp_data_len;
223 u8 data[0]; 234 u8 data[0];
224}; 235} __attribute__((packed));
225 236
226#endif /* SCSI_SRP_H */ 237#endif /* SCSI_SRP_H */
diff --git a/init/do_mounts.c b/init/do_mounts.c
index adb7cad3e6ee..f4b7b9d278cd 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -310,6 +310,11 @@ retry:
310 310
311 panic("VFS: Unable to mount root fs on %s", b); 311 panic("VFS: Unable to mount root fs on %s", b);
312 } 312 }
313
314 printk("No filesystem could mount root, tried: ");
315 for (p = fs_names; *p; p += strlen(p)+1)
316 printk(" %s", p);
317 printk("\n");
313 panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b)); 318 panic("VFS: Unable to mount root fs on %s", __bdevname(ROOT_DEV, b));
314out: 319out:
315 putname(fs_names); 320 putname(fs_names);
diff --git a/init/initramfs.c b/init/initramfs.c
index 679d870d991b..f81cfa40a719 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -26,10 +26,12 @@ static void __init free(void *where)
26 26
27/* link hash */ 27/* link hash */
28 28
29#define N_ALIGN(len) ((((len) + 1) & ~3) + 2)
30
29static __initdata struct hash { 31static __initdata struct hash {
30 int ino, minor, major; 32 int ino, minor, major;
31 struct hash *next; 33 struct hash *next;
32 char *name; 34 char name[N_ALIGN(PATH_MAX)];
33} *head[32]; 35} *head[32];
34 36
35static inline int hash(int major, int minor, int ino) 37static inline int hash(int major, int minor, int ino)
@@ -57,7 +59,7 @@ static char __init *find_link(int major, int minor, int ino, char *name)
57 q->ino = ino; 59 q->ino = ino;
58 q->minor = minor; 60 q->minor = minor;
59 q->major = major; 61 q->major = major;
60 q->name = name; 62 strcpy(q->name, name);
61 q->next = NULL; 63 q->next = NULL;
62 *p = q; 64 *p = q;
63 return NULL; 65 return NULL;
@@ -133,8 +135,6 @@ static inline void eat(unsigned n)
133 count -= n; 135 count -= n;
134} 136}
135 137
136#define N_ALIGN(len) ((((len) + 1) & ~3) + 2)
137
138static __initdata char *collected; 138static __initdata char *collected;
139static __initdata int remains; 139static __initdata int remains;
140static __initdata char *collect; 140static __initdata char *collect;
diff --git a/kernel/extable.c b/kernel/extable.c
index 7501b531ceed..7fe262855317 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -40,7 +40,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
40 return e; 40 return e;
41} 41}
42 42
43static int core_kernel_text(unsigned long addr) 43int core_kernel_text(unsigned long addr)
44{ 44{
45 if (addr >= (unsigned long)_stext && 45 if (addr >= (unsigned long)_stext &&
46 addr <= (unsigned long)_etext) 46 addr <= (unsigned long)_etext)
diff --git a/kernel/module.c b/kernel/module.c
index d24deb0dbbc9..bbe04862e1b0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -705,14 +705,14 @@ EXPORT_SYMBOL(__symbol_put);
705 705
706void symbol_put_addr(void *addr) 706void symbol_put_addr(void *addr)
707{ 707{
708 unsigned long flags; 708 struct module *modaddr;
709 709
710 spin_lock_irqsave(&modlist_lock, flags); 710 if (core_kernel_text((unsigned long)addr))
711 if (!kernel_text_address((unsigned long)addr)) 711 return;
712 BUG();
713 712
714 module_put(module_text_address((unsigned long)addr)); 713 if (!(modaddr = module_text_address((unsigned long)addr)))
715 spin_unlock_irqrestore(&modlist_lock, flags); 714 BUG();
715 module_put(modaddr);
716} 716}
717EXPORT_SYMBOL_GPL(symbol_put_addr); 717EXPORT_SYMBOL_GPL(symbol_put_addr);
718 718
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 4e0f0ec003f7..921c22ad16e4 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -148,12 +148,34 @@ int ptrace_may_attach(struct task_struct *task)
148int ptrace_attach(struct task_struct *task) 148int ptrace_attach(struct task_struct *task)
149{ 149{
150 int retval; 150 int retval;
151 task_lock(task); 151
152 retval = -EPERM; 152 retval = -EPERM;
153 if (task->pid <= 1) 153 if (task->pid <= 1)
154 goto bad; 154 goto out;
155 if (task->tgid == current->tgid) 155 if (task->tgid == current->tgid)
156 goto bad; 156 goto out;
157
158repeat:
159 /*
160 * Nasty, nasty.
161 *
162 * We want to hold both the task-lock and the
163 * tasklist_lock for writing at the same time.
164 * But that's against the rules (tasklist_lock
165 * is taken for reading by interrupts on other
166 * cpu's that may have task_lock).
167 */
168 task_lock(task);
169 local_irq_disable();
170 if (!write_trylock(&tasklist_lock)) {
171 local_irq_enable();
172 task_unlock(task);
173 do {
174 cpu_relax();
175 } while (!write_can_lock(&tasklist_lock));
176 goto repeat;
177 }
178
157 /* the same process cannot be attached many times */ 179 /* the same process cannot be attached many times */
158 if (task->ptrace & PT_PTRACED) 180 if (task->ptrace & PT_PTRACED)
159 goto bad; 181 goto bad;
@@ -166,17 +188,15 @@ int ptrace_attach(struct task_struct *task)
166 ? PT_ATTACHED : 0); 188 ? PT_ATTACHED : 0);
167 if (capable(CAP_SYS_PTRACE)) 189 if (capable(CAP_SYS_PTRACE))
168 task->ptrace |= PT_PTRACE_CAP; 190 task->ptrace |= PT_PTRACE_CAP;
169 task_unlock(task);
170 191
171 write_lock_irq(&tasklist_lock);
172 __ptrace_link(task, current); 192 __ptrace_link(task, current);
173 write_unlock_irq(&tasklist_lock);
174 193
175 force_sig_specific(SIGSTOP, task); 194 force_sig_specific(SIGSTOP, task);
176 return 0;
177 195
178bad: 196bad:
197 write_unlock_irq(&tasklist_lock);
179 task_unlock(task); 198 task_unlock(task);
199out:
180 return retval; 200 return retval;
181} 201}
182 202
@@ -417,21 +437,22 @@ int ptrace_request(struct task_struct *child, long request,
417 */ 437 */
418int ptrace_traceme(void) 438int ptrace_traceme(void)
419{ 439{
420 int ret; 440 int ret = -EPERM;
421 441
422 /* 442 /*
423 * Are we already being traced? 443 * Are we already being traced?
424 */ 444 */
425 if (current->ptrace & PT_PTRACED) 445 task_lock(current);
426 return -EPERM; 446 if (!(current->ptrace & PT_PTRACED)) {
427 ret = security_ptrace(current->parent, current); 447 ret = security_ptrace(current->parent, current);
428 if (ret) 448 /*
429 return -EPERM; 449 * Set the ptrace bit in the process ptrace flags.
430 /* 450 */
431 * Set the ptrace bit in the process ptrace flags. 451 if (!ret)
432 */ 452 current->ptrace |= PT_PTRACED;
433 current->ptrace |= PT_PTRACED; 453 }
434 return 0; 454 task_unlock(current);
455 return ret;
435} 456}
436 457
437/** 458/**
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 6d32ff26f948..2058f88c7bbb 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -479,12 +479,31 @@ static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp)
479 return 0; 479 return 0;
480} 480}
481 481
482/*
483 * Check to see if there is any immediate RCU-related work to be done
484 * by the current CPU, returning 1 if so. This function is part of the
485 * RCU implementation; it is -not- an exported member of the RCU API.
486 */
482int rcu_pending(int cpu) 487int rcu_pending(int cpu)
483{ 488{
484 return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || 489 return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) ||
485 __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); 490 __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu));
486} 491}
487 492
493/*
494 * Check to see if any future RCU-related work will need to be done
495 * by the current CPU, even if none need be done immediately, returning
496 * 1 if so. This function is part of the RCU implementation; it is -not-
497 * an exported member of the RCU API.
498 */
499int rcu_needs_cpu(int cpu)
500{
501 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
502 struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu);
503
504 return (!!rdp->curlist || !!rdp_bh->curlist || rcu_pending(cpu));
505}
506
488void rcu_check_callbacks(int cpu, int user) 507void rcu_check_callbacks(int cpu, int user)
489{ 508{
490 if (user || 509 if (user ||
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6ecc180beb71..ccb0c1fdf1b5 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -189,7 +189,7 @@ config FRAME_POINTER
189config UNWIND_INFO 189config UNWIND_INFO
190 bool "Compile the kernel with frame unwind information" 190 bool "Compile the kernel with frame unwind information"
191 depends on !IA64 191 depends on !IA64
192 depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || SPARC64 || V850) 192 depends on !MODULES || !(MIPS || PARISC || PPC || SUPERH || V850)
193 help 193 help
194 If you say Y here the resulting kernel image will be slightly larger 194 If you say Y here the resulting kernel image will be slightly larger
195 but not slower, and it will give very useful debugging information. 195 but not slower, and it will give very useful debugging information.
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ea77c999047e..813b4ec1298a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -39,6 +39,7 @@
39#include <linux/mempolicy.h> 39#include <linux/mempolicy.h>
40 40
41#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
42#include <asm/div64.h>
42#include "internal.h" 43#include "internal.h"
43 44
44/* 45/*
@@ -2566,9 +2567,11 @@ void setup_per_zone_pages_min(void)
2566 } 2567 }
2567 2568
2568 for_each_zone(zone) { 2569 for_each_zone(zone) {
2569 unsigned long tmp; 2570 u64 tmp;
2571
2570 spin_lock_irqsave(&zone->lru_lock, flags); 2572 spin_lock_irqsave(&zone->lru_lock, flags);
2571 tmp = (pages_min * zone->present_pages) / lowmem_pages; 2573 tmp = (u64)pages_min * zone->present_pages;
2574 do_div(tmp, lowmem_pages);
2572 if (is_highmem(zone)) { 2575 if (is_highmem(zone)) {
2573 /* 2576 /*
2574 * __GFP_HIGH and PF_MEMALLOC allocations usually don't 2577 * __GFP_HIGH and PF_MEMALLOC allocations usually don't
@@ -2595,8 +2598,8 @@ void setup_per_zone_pages_min(void)
2595 zone->pages_min = tmp; 2598 zone->pages_min = tmp;
2596 } 2599 }
2597 2600
2598 zone->pages_low = zone->pages_min + tmp / 4; 2601 zone->pages_low = zone->pages_min + (tmp >> 2);
2599 zone->pages_high = zone->pages_min + tmp / 2; 2602 zone->pages_high = zone->pages_min + (tmp >> 1);
2600 spin_unlock_irqrestore(&zone->lru_lock, flags); 2603 spin_unlock_irqrestore(&zone->lru_lock, flags);
2601 } 2604 }
2602 2605
diff --git a/mm/slab.c b/mm/slab.c
index c32af7e7581e..b1d643b5238d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -700,6 +700,14 @@ static enum {
700 FULL 700 FULL
701} g_cpucache_up; 701} g_cpucache_up;
702 702
703/*
704 * used by boot code to determine if it can use slab based allocator
705 */
706int slab_is_available(void)
707{
708 return g_cpucache_up == FULL;
709}
710
703static DEFINE_PER_CPU(struct work_struct, reap_work); 711static DEFINE_PER_CPU(struct work_struct, reap_work);
704 712
705static void free_block(struct kmem_cache *cachep, void **objpp, int len, 713static void free_block(struct kmem_cache *cachep, void **objpp, int len,
diff --git a/mm/sparse.c b/mm/sparse.c
index d7c32de99ee8..c5e89eb9ac8f 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -32,7 +32,7 @@ static struct mem_section *sparse_index_alloc(int nid)
32 unsigned long array_size = SECTIONS_PER_ROOT * 32 unsigned long array_size = SECTIONS_PER_ROOT *
33 sizeof(struct mem_section); 33 sizeof(struct mem_section);
34 34
35 if (system_state == SYSTEM_RUNNING) 35 if (slab_is_available())
36 section = kmalloc_node(array_size, GFP_KERNEL, nid); 36 section = kmalloc_node(array_size, GFP_KERNEL, nid);
37 else 37 else
38 section = alloc_bootmem_node(NODE_DATA(nid), array_size); 38 section = alloc_bootmem_node(NODE_DATA(nid), array_size);
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 1a786bfaa416..72d852982664 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -963,7 +963,7 @@ static struct file_operations arp_seq_fops = {
963static int __init atm_clip_init(void) 963static int __init atm_clip_init(void)
964{ 964{
965 struct proc_dir_entry *p; 965 struct proc_dir_entry *p;
966 neigh_table_init(&clip_tbl); 966 neigh_table_init_no_netlink(&clip_tbl);
967 967
968 clip_tbl_hook = &clip_tbl; 968 clip_tbl_hook = &clip_tbl;
969 register_atm_ioctl(&clip_ioctl_ops); 969 register_atm_ioctl(&clip_ioctl_ops);
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index dbf9b47681f7..a2e0dd047e9f 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -228,6 +228,8 @@ ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr,
228 return NULL; 228 return NULL;
229} 229}
230 230
231EXPORT_SYMBOL(ax25_find_cb);
232
231void ax25_send_to_raw(ax25_address *addr, struct sk_buff *skb, int proto) 233void ax25_send_to_raw(ax25_address *addr, struct sk_buff *skb, int proto)
232{ 234{
233 ax25_cb *s; 235 ax25_cb *s;
@@ -424,6 +426,26 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg)
424 return 0; 426 return 0;
425} 427}
426 428
429static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev)
430{
431 ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2;
432 ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]);
433 ax25->t2 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T2]);
434 ax25->t3 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T3]);
435 ax25->n2 = ax25_dev->values[AX25_VALUES_N2];
436 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN];
437 ax25->idle = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_IDLE]);
438 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF];
439
440 if (ax25_dev->values[AX25_VALUES_AXDEFMODE]) {
441 ax25->modulus = AX25_EMODULUS;
442 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW];
443 } else {
444 ax25->modulus = AX25_MODULUS;
445 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW];
446 }
447}
448
427/* 449/*
428 * Fill in a created AX.25 created control block with the default 450 * Fill in a created AX.25 created control block with the default
429 * values for a particular device. 451 * values for a particular device.
@@ -433,39 +455,28 @@ void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev)
433 ax25->ax25_dev = ax25_dev; 455 ax25->ax25_dev = ax25_dev;
434 456
435 if (ax25->ax25_dev != NULL) { 457 if (ax25->ax25_dev != NULL) {
436 ax25->rtt = ax25_dev->values[AX25_VALUES_T1] / 2; 458 ax25_fillin_cb_from_dev(ax25, ax25_dev);
437 ax25->t1 = ax25_dev->values[AX25_VALUES_T1]; 459 return;
438 ax25->t2 = ax25_dev->values[AX25_VALUES_T2]; 460 }
439 ax25->t3 = ax25_dev->values[AX25_VALUES_T3]; 461
440 ax25->n2 = ax25_dev->values[AX25_VALUES_N2]; 462 /*
441 ax25->paclen = ax25_dev->values[AX25_VALUES_PACLEN]; 463 * No device, use kernel / AX.25 spec default values
442 ax25->idle = ax25_dev->values[AX25_VALUES_IDLE]; 464 */
443 ax25->backoff = ax25_dev->values[AX25_VALUES_BACKOFF]; 465 ax25->rtt = msecs_to_jiffies(AX25_DEF_T1) / 2;
444 466 ax25->t1 = msecs_to_jiffies(AX25_DEF_T1);
445 if (ax25_dev->values[AX25_VALUES_AXDEFMODE]) { 467 ax25->t2 = msecs_to_jiffies(AX25_DEF_T2);
446 ax25->modulus = AX25_EMODULUS; 468 ax25->t3 = msecs_to_jiffies(AX25_DEF_T3);
447 ax25->window = ax25_dev->values[AX25_VALUES_EWINDOW]; 469 ax25->n2 = AX25_DEF_N2;
448 } else { 470 ax25->paclen = AX25_DEF_PACLEN;
449 ax25->modulus = AX25_MODULUS; 471 ax25->idle = msecs_to_jiffies(AX25_DEF_IDLE);
450 ax25->window = ax25_dev->values[AX25_VALUES_WINDOW]; 472 ax25->backoff = AX25_DEF_BACKOFF;
451 } 473
474 if (AX25_DEF_AXDEFMODE) {
475 ax25->modulus = AX25_EMODULUS;
476 ax25->window = AX25_DEF_EWINDOW;
452 } else { 477 } else {
453 ax25->rtt = AX25_DEF_T1 / 2; 478 ax25->modulus = AX25_MODULUS;
454 ax25->t1 = AX25_DEF_T1; 479 ax25->window = AX25_DEF_WINDOW;
455 ax25->t2 = AX25_DEF_T2;
456 ax25->t3 = AX25_DEF_T3;
457 ax25->n2 = AX25_DEF_N2;
458 ax25->paclen = AX25_DEF_PACLEN;
459 ax25->idle = AX25_DEF_IDLE;
460 ax25->backoff = AX25_DEF_BACKOFF;
461
462 if (AX25_DEF_AXDEFMODE) {
463 ax25->modulus = AX25_EMODULUS;
464 ax25->window = AX25_DEF_EWINDOW;
465 } else {
466 ax25->modulus = AX25_MODULUS;
467 ax25->window = AX25_DEF_WINDOW;
468 }
469 } 480 }
470} 481}
471 482
@@ -1979,24 +1990,6 @@ static struct notifier_block ax25_dev_notifier = {
1979 .notifier_call =ax25_device_event, 1990 .notifier_call =ax25_device_event,
1980}; 1991};
1981 1992
1982EXPORT_SYMBOL(ax25_hard_header);
1983EXPORT_SYMBOL(ax25_rebuild_header);
1984EXPORT_SYMBOL(ax25_findbyuid);
1985EXPORT_SYMBOL(ax25_find_cb);
1986EXPORT_SYMBOL(ax25_linkfail_register);
1987EXPORT_SYMBOL(ax25_linkfail_release);
1988EXPORT_SYMBOL(ax25_listen_register);
1989EXPORT_SYMBOL(ax25_listen_release);
1990EXPORT_SYMBOL(ax25_protocol_register);
1991EXPORT_SYMBOL(ax25_protocol_release);
1992EXPORT_SYMBOL(ax25_send_frame);
1993EXPORT_SYMBOL(ax25_uid_policy);
1994EXPORT_SYMBOL(ax25cmp);
1995EXPORT_SYMBOL(ax2asc);
1996EXPORT_SYMBOL(asc2ax);
1997EXPORT_SYMBOL(null_ax25_address);
1998EXPORT_SYMBOL(ax25_display_timer);
1999
2000static int __init ax25_init(void) 1993static int __init ax25_init(void)
2001{ 1994{
2002 int rc = proto_register(&ax25_proto, 0); 1995 int rc = proto_register(&ax25_proto, 0);
diff --git a/net/ax25/ax25_addr.c b/net/ax25/ax25_addr.c
index 0164a155b8c4..5f0896ad0042 100644
--- a/net/ax25/ax25_addr.c
+++ b/net/ax25/ax25_addr.c
@@ -11,6 +11,7 @@
11#include <linux/socket.h> 11#include <linux/socket.h>
12#include <linux/in.h> 12#include <linux/in.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/timer.h> 16#include <linux/timer.h>
16#include <linux/string.h> 17#include <linux/string.h>
@@ -33,6 +34,8 @@
33 */ 34 */
34ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}}; 35ax25_address null_ax25_address = {{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}};
35 36
37EXPORT_SYMBOL(null_ax25_address);
38
36/* 39/*
37 * ax25 -> ascii conversion 40 * ax25 -> ascii conversion
38 */ 41 */
@@ -64,6 +67,8 @@ char *ax2asc(char *buf, ax25_address *a)
64 67
65} 68}
66 69
70EXPORT_SYMBOL(ax2asc);
71
67/* 72/*
68 * ascii -> ax25 conversion 73 * ascii -> ax25 conversion
69 */ 74 */
@@ -97,6 +102,8 @@ void asc2ax(ax25_address *addr, char *callsign)
97 addr->ax25_call[6] &= 0x1E; 102 addr->ax25_call[6] &= 0x1E;
98} 103}
99 104
105EXPORT_SYMBOL(asc2ax);
106
100/* 107/*
101 * Compare two ax.25 addresses 108 * Compare two ax.25 addresses
102 */ 109 */
@@ -116,6 +123,8 @@ int ax25cmp(ax25_address *a, ax25_address *b)
116 return 2; /* Partial match */ 123 return 2; /* Partial match */
117} 124}
118 125
126EXPORT_SYMBOL(ax25cmp);
127
119/* 128/*
120 * Compare two AX.25 digipeater paths. 129 * Compare two AX.25 digipeater paths.
121 */ 130 */
diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
index 061083efc1dc..5961459935eb 100644
--- a/net/ax25/ax25_ds_timer.c
+++ b/net/ax25/ax25_ds_timer.c
@@ -61,7 +61,8 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
61 return; 61 return;
62 62
63 del_timer(&ax25_dev->dama.slave_timer); 63 del_timer(&ax25_dev->dama.slave_timer);
64 ax25_dev->dama.slave_timeout = ax25_dev->values[AX25_VALUES_DS_TIMEOUT] / 10; 64 ax25_dev->dama.slave_timeout =
65 msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10;
65 ax25_ds_add_timer(ax25_dev); 66 ax25_ds_add_timer(ax25_dev);
66} 67}
67 68
diff --git a/net/ax25/ax25_iface.c b/net/ax25/ax25_iface.c
index d68aff100729..3bb152710b77 100644
--- a/net/ax25/ax25_iface.c
+++ b/net/ax25/ax25_iface.c
@@ -12,6 +12,7 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/spinlock.h> 17#include <linux/spinlock.h>
17#include <linux/timer.h> 18#include <linux/timer.h>
@@ -74,6 +75,8 @@ int ax25_protocol_register(unsigned int pid,
74 return 1; 75 return 1;
75} 76}
76 77
78EXPORT_SYMBOL(ax25_protocol_register);
79
77void ax25_protocol_release(unsigned int pid) 80void ax25_protocol_release(unsigned int pid)
78{ 81{
79 struct protocol_struct *s, *protocol; 82 struct protocol_struct *s, *protocol;
@@ -106,6 +109,8 @@ void ax25_protocol_release(unsigned int pid)
106 write_unlock(&protocol_list_lock); 109 write_unlock(&protocol_list_lock);
107} 110}
108 111
112EXPORT_SYMBOL(ax25_protocol_release);
113
109int ax25_linkfail_register(void (*func)(ax25_cb *, int)) 114int ax25_linkfail_register(void (*func)(ax25_cb *, int))
110{ 115{
111 struct linkfail_struct *linkfail; 116 struct linkfail_struct *linkfail;
@@ -123,6 +128,8 @@ int ax25_linkfail_register(void (*func)(ax25_cb *, int))
123 return 1; 128 return 1;
124} 129}
125 130
131EXPORT_SYMBOL(ax25_linkfail_register);
132
126void ax25_linkfail_release(void (*func)(ax25_cb *, int)) 133void ax25_linkfail_release(void (*func)(ax25_cb *, int))
127{ 134{
128 struct linkfail_struct *s, *linkfail; 135 struct linkfail_struct *s, *linkfail;
@@ -155,6 +162,8 @@ void ax25_linkfail_release(void (*func)(ax25_cb *, int))
155 spin_unlock_bh(&linkfail_lock); 162 spin_unlock_bh(&linkfail_lock);
156} 163}
157 164
165EXPORT_SYMBOL(ax25_linkfail_release);
166
158int ax25_listen_register(ax25_address *callsign, struct net_device *dev) 167int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
159{ 168{
160 struct listen_struct *listen; 169 struct listen_struct *listen;
@@ -176,6 +185,8 @@ int ax25_listen_register(ax25_address *callsign, struct net_device *dev)
176 return 1; 185 return 1;
177} 186}
178 187
188EXPORT_SYMBOL(ax25_listen_register);
189
179void ax25_listen_release(ax25_address *callsign, struct net_device *dev) 190void ax25_listen_release(ax25_address *callsign, struct net_device *dev)
180{ 191{
181 struct listen_struct *s, *listen; 192 struct listen_struct *s, *listen;
@@ -208,6 +219,8 @@ void ax25_listen_release(ax25_address *callsign, struct net_device *dev)
208 spin_unlock_bh(&listen_lock); 219 spin_unlock_bh(&listen_lock);
209} 220}
210 221
222EXPORT_SYMBOL(ax25_listen_release);
223
211int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *) 224int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *)
212{ 225{
213 int (*res)(struct sk_buff *, ax25_cb *) = NULL; 226 int (*res)(struct sk_buff *, ax25_cb *) = NULL;
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index d643dac3eccc..a0b534f80f17 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -12,6 +12,7 @@
12#include <linux/socket.h> 12#include <linux/socket.h>
13#include <linux/in.h> 13#include <linux/in.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h>
15#include <linux/sched.h> 16#include <linux/sched.h>
16#include <linux/timer.h> 17#include <linux/timer.h>
17#include <linux/string.h> 18#include <linux/string.h>
@@ -221,3 +222,5 @@ int ax25_rebuild_header(struct sk_buff *skb)
221 222
222#endif 223#endif
223 224
225EXPORT_SYMBOL(ax25_hard_header);
226EXPORT_SYMBOL(ax25_rebuild_header);
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 5fc048dcd39a..5d99852b239c 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -14,6 +14,7 @@
14#include <linux/socket.h> 14#include <linux/socket.h>
15#include <linux/in.h> 15#include <linux/in.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/module.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
19#include <linux/string.h> 20#include <linux/string.h>
@@ -104,6 +105,8 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, ax25_address *src, ax2
104 return ax25; /* We had to create it */ 105 return ax25; /* We had to create it */
105} 106}
106 107
108EXPORT_SYMBOL(ax25_send_frame);
109
107/* 110/*
108 * All outgoing AX.25 I frames pass via this routine. Therefore this is 111 * All outgoing AX.25 I frames pass via this routine. Therefore this is
109 * where the fragmentation of frames takes place. If fragment is set to 112 * where the fragmentation of frames takes place. If fragment is set to
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index f04f8630fd28..5ac98250797b 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -360,7 +360,7 @@ struct file_operations ax25_route_fops = {
360/* 360/*
361 * Find AX.25 route 361 * Find AX.25 route
362 * 362 *
363 * Only routes with a refernce rout of zero can be destroyed. 363 * Only routes with a reference count of zero can be destroyed.
364 */ 364 */
365static ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev) 365static ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
366{ 366{
diff --git a/net/ax25/ax25_timer.c b/net/ax25/ax25_timer.c
index 7a6b50a14554..ec254057f212 100644
--- a/net/ax25/ax25_timer.c
+++ b/net/ax25/ax25_timer.c
@@ -18,6 +18,7 @@
18#include <linux/socket.h> 18#include <linux/socket.h>
19#include <linux/in.h> 19#include <linux/in.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h>
21#include <linux/jiffies.h> 22#include <linux/jiffies.h>
22#include <linux/timer.h> 23#include <linux/timer.h>
23#include <linux/string.h> 24#include <linux/string.h>
@@ -137,6 +138,8 @@ unsigned long ax25_display_timer(struct timer_list *timer)
137 return timer->expires - jiffies; 138 return timer->expires - jiffies;
138} 139}
139 140
141EXPORT_SYMBOL(ax25_display_timer);
142
140static void ax25_heartbeat_expiry(unsigned long param) 143static void ax25_heartbeat_expiry(unsigned long param)
141{ 144{
142 int proto = AX25_PROTO_STD_SIMPLEX; 145 int proto = AX25_PROTO_STD_SIMPLEX;
diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index b8b5854bce9a..5e9a81e8b214 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -49,6 +49,8 @@ static DEFINE_RWLOCK(ax25_uid_lock);
49 49
50int ax25_uid_policy = 0; 50int ax25_uid_policy = 0;
51 51
52EXPORT_SYMBOL(ax25_uid_policy);
53
52ax25_uid_assoc *ax25_findbyuid(uid_t uid) 54ax25_uid_assoc *ax25_findbyuid(uid_t uid)
53{ 55{
54 ax25_uid_assoc *ax25_uid, *res = NULL; 56 ax25_uid_assoc *ax25_uid, *res = NULL;
@@ -67,6 +69,8 @@ ax25_uid_assoc *ax25_findbyuid(uid_t uid)
67 return res; 69 return res;
68} 70}
69 71
72EXPORT_SYMBOL(ax25_findbyuid);
73
70int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax) 74int ax25_uid_ioctl(int cmd, struct sockaddr_ax25 *sax)
71{ 75{
72 ax25_uid_assoc *ax25_uid; 76 ax25_uid_assoc *ax25_uid;
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index 894a22558d9d..bdb64c36df12 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -18,14 +18,14 @@ static int min_backoff[1], max_backoff[] = {2};
18static int min_conmode[1], max_conmode[] = {2}; 18static int min_conmode[1], max_conmode[] = {2};
19static int min_window[] = {1}, max_window[] = {7}; 19static int min_window[] = {1}, max_window[] = {7};
20static int min_ewindow[] = {1}, max_ewindow[] = {63}; 20static int min_ewindow[] = {1}, max_ewindow[] = {63};
21static int min_t1[] = {1}, max_t1[] = {30 * HZ}; 21static int min_t1[] = {1}, max_t1[] = {30000};
22static int min_t2[] = {1}, max_t2[] = {20 * HZ}; 22static int min_t2[] = {1}, max_t2[] = {20000};
23static int min_t3[1], max_t3[] = {3600 * HZ}; 23static int min_t3[1], max_t3[] = {3600000};
24static int min_idle[1], max_idle[] = {65535 * HZ}; 24static int min_idle[1], max_idle[] = {65535000};
25static int min_n2[] = {1}, max_n2[] = {31}; 25static int min_n2[] = {1}, max_n2[] = {31};
26static int min_paclen[] = {1}, max_paclen[] = {512}; 26static int min_paclen[] = {1}, max_paclen[] = {512};
27static int min_proto[1], max_proto[] = { AX25_PROTO_MAX }; 27static int min_proto[1], max_proto[] = { AX25_PROTO_MAX };
28static int min_ds_timeout[1], max_ds_timeout[] = {65535 * HZ}; 28static int min_ds_timeout[1], max_ds_timeout[] = {65535000};
29 29
30static struct ctl_table_header *ax25_table_header; 30static struct ctl_table_header *ax25_table_header;
31 31
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 59eef42d4a42..ad1c7af65ec8 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -308,26 +308,19 @@ int br_add_bridge(const char *name)
308 if (ret) 308 if (ret)
309 goto err2; 309 goto err2;
310 310
311 /* network device kobject is not setup until
312 * after rtnl_unlock does it's hotplug magic.
313 * so hold reference to avoid race.
314 */
315 dev_hold(dev);
316 rtnl_unlock();
317
318 ret = br_sysfs_addbr(dev); 311 ret = br_sysfs_addbr(dev);
319 dev_put(dev); 312 if (ret)
320 313 goto err3;
321 if (ret) 314 rtnl_unlock();
322 unregister_netdev(dev); 315 return 0;
323 out:
324 return ret;
325 316
317 err3:
318 unregister_netdev(dev);
326 err2: 319 err2:
327 free_netdev(dev); 320 free_netdev(dev);
328 err1: 321 err1:
329 rtnl_unlock(); 322 rtnl_unlock();
330 goto out; 323 return ret;
331} 324}
332 325
333int br_del_bridge(const char *name) 326int br_del_bridge(const char *name)
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index b0b7f55c1edd..bfa4d8c333f7 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -66,6 +66,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
66 } 66 }
67 67
68 if (is_multicast_ether_addr(dest)) { 68 if (is_multicast_ether_addr(dest)) {
69 br->statistics.multicast++;
69 br_flood_forward(br, skb, !passedup); 70 br_flood_forward(br, skb, !passedup);
70 if (!passedup) 71 if (!passedup)
71 br_pass_frame_up(br, skb); 72 br_pass_frame_up(br, skb);
diff --git a/net/core/dev.c b/net/core/dev.c
index 3bad1afc89fa..2dce673a039b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -193,7 +193,7 @@ static inline struct hlist_head *dev_index_hash(int ifindex)
193 * Our notifier list 193 * Our notifier list
194 */ 194 */
195 195
196static BLOCKING_NOTIFIER_HEAD(netdev_chain); 196static RAW_NOTIFIER_HEAD(netdev_chain);
197 197
198/* 198/*
199 * Device drivers call our routines to queue packets here. We empty the 199 * Device drivers call our routines to queue packets here. We empty the
@@ -736,7 +736,7 @@ int dev_change_name(struct net_device *dev, char *newname)
736 if (!err) { 736 if (!err) {
737 hlist_del(&dev->name_hlist); 737 hlist_del(&dev->name_hlist);
738 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name)); 738 hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
739 blocking_notifier_call_chain(&netdev_chain, 739 raw_notifier_call_chain(&netdev_chain,
740 NETDEV_CHANGENAME, dev); 740 NETDEV_CHANGENAME, dev);
741 } 741 }
742 742
@@ -751,7 +751,7 @@ int dev_change_name(struct net_device *dev, char *newname)
751 */ 751 */
752void netdev_features_change(struct net_device *dev) 752void netdev_features_change(struct net_device *dev)
753{ 753{
754 blocking_notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); 754 raw_notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev);
755} 755}
756EXPORT_SYMBOL(netdev_features_change); 756EXPORT_SYMBOL(netdev_features_change);
757 757
@@ -766,7 +766,7 @@ EXPORT_SYMBOL(netdev_features_change);
766void netdev_state_change(struct net_device *dev) 766void netdev_state_change(struct net_device *dev)
767{ 767{
768 if (dev->flags & IFF_UP) { 768 if (dev->flags & IFF_UP) {
769 blocking_notifier_call_chain(&netdev_chain, 769 raw_notifier_call_chain(&netdev_chain,
770 NETDEV_CHANGE, dev); 770 NETDEV_CHANGE, dev);
771 rtmsg_ifinfo(RTM_NEWLINK, dev, 0); 771 rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
772 } 772 }
@@ -864,7 +864,7 @@ int dev_open(struct net_device *dev)
864 /* 864 /*
865 * ... and announce new interface. 865 * ... and announce new interface.
866 */ 866 */
867 blocking_notifier_call_chain(&netdev_chain, NETDEV_UP, dev); 867 raw_notifier_call_chain(&netdev_chain, NETDEV_UP, dev);
868 } 868 }
869 return ret; 869 return ret;
870} 870}
@@ -887,7 +887,7 @@ int dev_close(struct net_device *dev)
887 * Tell people we are going down, so that they can 887 * Tell people we are going down, so that they can
888 * prepare to death, when device is still operating. 888 * prepare to death, when device is still operating.
889 */ 889 */
890 blocking_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev); 890 raw_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev);
891 891
892 dev_deactivate(dev); 892 dev_deactivate(dev);
893 893
@@ -924,7 +924,7 @@ int dev_close(struct net_device *dev)
924 /* 924 /*
925 * Tell people we are down 925 * Tell people we are down
926 */ 926 */
927 blocking_notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); 927 raw_notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev);
928 928
929 return 0; 929 return 0;
930} 930}
@@ -955,7 +955,7 @@ int register_netdevice_notifier(struct notifier_block *nb)
955 int err; 955 int err;
956 956
957 rtnl_lock(); 957 rtnl_lock();
958 err = blocking_notifier_chain_register(&netdev_chain, nb); 958 err = raw_notifier_chain_register(&netdev_chain, nb);
959 if (!err) { 959 if (!err) {
960 for (dev = dev_base; dev; dev = dev->next) { 960 for (dev = dev_base; dev; dev = dev->next) {
961 nb->notifier_call(nb, NETDEV_REGISTER, dev); 961 nb->notifier_call(nb, NETDEV_REGISTER, dev);
@@ -983,7 +983,7 @@ int unregister_netdevice_notifier(struct notifier_block *nb)
983 int err; 983 int err;
984 984
985 rtnl_lock(); 985 rtnl_lock();
986 err = blocking_notifier_chain_unregister(&netdev_chain, nb); 986 err = raw_notifier_chain_unregister(&netdev_chain, nb);
987 rtnl_unlock(); 987 rtnl_unlock();
988 return err; 988 return err;
989} 989}
@@ -994,12 +994,12 @@ int unregister_netdevice_notifier(struct notifier_block *nb)
994 * @v: pointer passed unmodified to notifier function 994 * @v: pointer passed unmodified to notifier function
995 * 995 *
996 * Call all network notifier blocks. Parameters and return value 996 * Call all network notifier blocks. Parameters and return value
997 * are as for blocking_notifier_call_chain(). 997 * are as for raw_notifier_call_chain().
998 */ 998 */
999 999
1000int call_netdevice_notifiers(unsigned long val, void *v) 1000int call_netdevice_notifiers(unsigned long val, void *v)
1001{ 1001{
1002 return blocking_notifier_call_chain(&netdev_chain, val, v); 1002 return raw_notifier_call_chain(&netdev_chain, val, v);
1003} 1003}
1004 1004
1005/* When > 0 there are consumers of rx skb time stamps */ 1005/* When > 0 there are consumers of rx skb time stamps */
@@ -2308,7 +2308,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
2308 if (dev->flags & IFF_UP && 2308 if (dev->flags & IFF_UP &&
2309 ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI | 2309 ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
2310 IFF_VOLATILE))) 2310 IFF_VOLATILE)))
2311 blocking_notifier_call_chain(&netdev_chain, 2311 raw_notifier_call_chain(&netdev_chain,
2312 NETDEV_CHANGE, dev); 2312 NETDEV_CHANGE, dev);
2313 2313
2314 if ((flags ^ dev->gflags) & IFF_PROMISC) { 2314 if ((flags ^ dev->gflags) & IFF_PROMISC) {
@@ -2353,7 +2353,7 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
2353 else 2353 else
2354 dev->mtu = new_mtu; 2354 dev->mtu = new_mtu;
2355 if (!err && dev->flags & IFF_UP) 2355 if (!err && dev->flags & IFF_UP)
2356 blocking_notifier_call_chain(&netdev_chain, 2356 raw_notifier_call_chain(&netdev_chain,
2357 NETDEV_CHANGEMTU, dev); 2357 NETDEV_CHANGEMTU, dev);
2358 return err; 2358 return err;
2359} 2359}
@@ -2370,7 +2370,7 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
2370 return -ENODEV; 2370 return -ENODEV;
2371 err = dev->set_mac_address(dev, sa); 2371 err = dev->set_mac_address(dev, sa);
2372 if (!err) 2372 if (!err)
2373 blocking_notifier_call_chain(&netdev_chain, 2373 raw_notifier_call_chain(&netdev_chain,
2374 NETDEV_CHANGEADDR, dev); 2374 NETDEV_CHANGEADDR, dev);
2375 return err; 2375 return err;
2376} 2376}
@@ -2427,7 +2427,7 @@ static int dev_ifsioc(struct ifreq *ifr, unsigned int cmd)
2427 return -EINVAL; 2427 return -EINVAL;
2428 memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, 2428 memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data,
2429 min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); 2429 min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
2430 blocking_notifier_call_chain(&netdev_chain, 2430 raw_notifier_call_chain(&netdev_chain,
2431 NETDEV_CHANGEADDR, dev); 2431 NETDEV_CHANGEADDR, dev);
2432 return 0; 2432 return 0;
2433 2433
@@ -2777,6 +2777,8 @@ int register_netdevice(struct net_device *dev)
2777 BUG_ON(dev_boot_phase); 2777 BUG_ON(dev_boot_phase);
2778 ASSERT_RTNL(); 2778 ASSERT_RTNL();
2779 2779
2780 might_sleep();
2781
2780 /* When net_device's are persistent, this will be fatal. */ 2782 /* When net_device's are persistent, this will be fatal. */
2781 BUG_ON(dev->reg_state != NETREG_UNINITIALIZED); 2783 BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
2782 2784
@@ -2863,6 +2865,11 @@ int register_netdevice(struct net_device *dev)
2863 if (!dev->rebuild_header) 2865 if (!dev->rebuild_header)
2864 dev->rebuild_header = default_rebuild_header; 2866 dev->rebuild_header = default_rebuild_header;
2865 2867
2868 ret = netdev_register_sysfs(dev);
2869 if (ret)
2870 goto out_err;
2871 dev->reg_state = NETREG_REGISTERED;
2872
2866 /* 2873 /*
2867 * Default initial state at registry is that the 2874 * Default initial state at registry is that the
2868 * device is present. 2875 * device is present.
@@ -2878,14 +2885,11 @@ int register_netdevice(struct net_device *dev)
2878 hlist_add_head(&dev->name_hlist, head); 2885 hlist_add_head(&dev->name_hlist, head);
2879 hlist_add_head(&dev->index_hlist, dev_index_hash(dev->ifindex)); 2886 hlist_add_head(&dev->index_hlist, dev_index_hash(dev->ifindex));
2880 dev_hold(dev); 2887 dev_hold(dev);
2881 dev->reg_state = NETREG_REGISTERING;
2882 write_unlock_bh(&dev_base_lock); 2888 write_unlock_bh(&dev_base_lock);
2883 2889
2884 /* Notify protocols, that a new device appeared. */ 2890 /* Notify protocols, that a new device appeared. */
2885 blocking_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); 2891 raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
2886 2892
2887 /* Finish registration after unlock */
2888 net_set_todo(dev);
2889 ret = 0; 2893 ret = 0;
2890 2894
2891out: 2895out:
@@ -2961,7 +2965,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
2961 rtnl_lock(); 2965 rtnl_lock();
2962 2966
2963 /* Rebroadcast unregister notification */ 2967 /* Rebroadcast unregister notification */
2964 blocking_notifier_call_chain(&netdev_chain, 2968 raw_notifier_call_chain(&netdev_chain,
2965 NETDEV_UNREGISTER, dev); 2969 NETDEV_UNREGISTER, dev);
2966 2970
2967 if (test_bit(__LINK_STATE_LINKWATCH_PENDING, 2971 if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
@@ -3008,7 +3012,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
3008 * 3012 *
3009 * We are invoked by rtnl_unlock() after it drops the semaphore. 3013 * We are invoked by rtnl_unlock() after it drops the semaphore.
3010 * This allows us to deal with problems: 3014 * This allows us to deal with problems:
3011 * 1) We can create/delete sysfs objects which invoke hotplug 3015 * 1) We can delete sysfs objects which invoke hotplug
3012 * without deadlocking with linkwatch via keventd. 3016 * without deadlocking with linkwatch via keventd.
3013 * 2) Since we run with the RTNL semaphore not held, we can sleep 3017 * 2) Since we run with the RTNL semaphore not held, we can sleep
3014 * safely in order to wait for the netdev refcnt to drop to zero. 3018 * safely in order to wait for the netdev refcnt to drop to zero.
@@ -3017,8 +3021,6 @@ static DEFINE_MUTEX(net_todo_run_mutex);
3017void netdev_run_todo(void) 3021void netdev_run_todo(void)
3018{ 3022{
3019 struct list_head list = LIST_HEAD_INIT(list); 3023 struct list_head list = LIST_HEAD_INIT(list);
3020 int err;
3021
3022 3024
3023 /* Need to guard against multiple cpu's getting out of order. */ 3025 /* Need to guard against multiple cpu's getting out of order. */
3024 mutex_lock(&net_todo_run_mutex); 3026 mutex_lock(&net_todo_run_mutex);
@@ -3041,40 +3043,29 @@ void netdev_run_todo(void)
3041 = list_entry(list.next, struct net_device, todo_list); 3043 = list_entry(list.next, struct net_device, todo_list);
3042 list_del(&dev->todo_list); 3044 list_del(&dev->todo_list);
3043 3045
3044 switch(dev->reg_state) { 3046 if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
3045 case NETREG_REGISTERING: 3047 printk(KERN_ERR "network todo '%s' but state %d\n",
3046 dev->reg_state = NETREG_REGISTERED; 3048 dev->name, dev->reg_state);
3047 err = netdev_register_sysfs(dev); 3049 dump_stack();
3048 if (err) 3050 continue;
3049 printk(KERN_ERR "%s: failed sysfs registration (%d)\n", 3051 }
3050 dev->name, err);
3051 break;
3052
3053 case NETREG_UNREGISTERING:
3054 netdev_unregister_sysfs(dev);
3055 dev->reg_state = NETREG_UNREGISTERED;
3056
3057 netdev_wait_allrefs(dev);
3058 3052
3059 /* paranoia */ 3053 netdev_unregister_sysfs(dev);
3060 BUG_ON(atomic_read(&dev->refcnt)); 3054 dev->reg_state = NETREG_UNREGISTERED;
3061 BUG_TRAP(!dev->ip_ptr);
3062 BUG_TRAP(!dev->ip6_ptr);
3063 BUG_TRAP(!dev->dn_ptr);
3064 3055
3056 netdev_wait_allrefs(dev);
3065 3057
3066 /* It must be the very last action, 3058 /* paranoia */
3067 * after this 'dev' may point to freed up memory. 3059 BUG_ON(atomic_read(&dev->refcnt));
3068 */ 3060 BUG_TRAP(!dev->ip_ptr);
3069 if (dev->destructor) 3061 BUG_TRAP(!dev->ip6_ptr);
3070 dev->destructor(dev); 3062 BUG_TRAP(!dev->dn_ptr);
3071 break;
3072 3063
3073 default: 3064 /* It must be the very last action,
3074 printk(KERN_ERR "network todo '%s' but state %d\n", 3065 * after this 'dev' may point to freed up memory.
3075 dev->name, dev->reg_state); 3066 */
3076 break; 3067 if (dev->destructor)
3077 } 3068 dev->destructor(dev);
3078 } 3069 }
3079 3070
3080out: 3071out:
@@ -3216,7 +3207,7 @@ int unregister_netdevice(struct net_device *dev)
3216 /* Notify protocols, that we are about to destroy 3207 /* Notify protocols, that we are about to destroy
3217 this device. They should clean all the things. 3208 this device. They should clean all the things.
3218 */ 3209 */
3219 blocking_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); 3210 raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
3220 3211
3221 /* 3212 /*
3222 * Flush the multicast chain 3213 * Flush the multicast chain
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 341de44c7ed1..646937cc2d84 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -170,13 +170,13 @@ void linkwatch_fire_event(struct net_device *dev)
170 spin_unlock_irqrestore(&lweventlist_lock, flags); 170 spin_unlock_irqrestore(&lweventlist_lock, flags);
171 171
172 if (!test_and_set_bit(LW_RUNNING, &linkwatch_flags)) { 172 if (!test_and_set_bit(LW_RUNNING, &linkwatch_flags)) {
173 unsigned long thisevent = jiffies; 173 unsigned long delay = linkwatch_nextevent - jiffies;
174 174
175 if (thisevent >= linkwatch_nextevent) { 175 /* If we wrap around we'll delay it by at most HZ. */
176 if (!delay || delay > HZ)
176 schedule_work(&linkwatch_work); 177 schedule_work(&linkwatch_work);
177 } else { 178 else
178 schedule_delayed_work(&linkwatch_work, linkwatch_nextevent - thisevent); 179 schedule_delayed_work(&linkwatch_work, delay);
179 }
180 } 180 }
181 } 181 }
182} 182}
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 4cf878efdb49..50a8c73caf97 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1326,8 +1326,7 @@ void neigh_parms_destroy(struct neigh_parms *parms)
1326 kfree(parms); 1326 kfree(parms);
1327} 1327}
1328 1328
1329 1329void neigh_table_init_no_netlink(struct neigh_table *tbl)
1330void neigh_table_init(struct neigh_table *tbl)
1331{ 1330{
1332 unsigned long now = jiffies; 1331 unsigned long now = jiffies;
1333 unsigned long phsize; 1332 unsigned long phsize;
@@ -1383,10 +1382,27 @@ void neigh_table_init(struct neigh_table *tbl)
1383 1382
1384 tbl->last_flush = now; 1383 tbl->last_flush = now;
1385 tbl->last_rand = now + tbl->parms.reachable_time * 20; 1384 tbl->last_rand = now + tbl->parms.reachable_time * 20;
1385}
1386
1387void neigh_table_init(struct neigh_table *tbl)
1388{
1389 struct neigh_table *tmp;
1390
1391 neigh_table_init_no_netlink(tbl);
1386 write_lock(&neigh_tbl_lock); 1392 write_lock(&neigh_tbl_lock);
1393 for (tmp = neigh_tables; tmp; tmp = tmp->next) {
1394 if (tmp->family == tbl->family)
1395 break;
1396 }
1387 tbl->next = neigh_tables; 1397 tbl->next = neigh_tables;
1388 neigh_tables = tbl; 1398 neigh_tables = tbl;
1389 write_unlock(&neigh_tbl_lock); 1399 write_unlock(&neigh_tbl_lock);
1400
1401 if (unlikely(tmp)) {
1402 printk(KERN_ERR "NEIGH: Registering multiple tables for "
1403 "family %d\n", tbl->family);
1404 dump_stack();
1405 }
1390} 1406}
1391 1407
1392int neigh_table_clear(struct neigh_table *tbl) 1408int neigh_table_clear(struct neigh_table *tbl)
@@ -2657,6 +2673,7 @@ EXPORT_SYMBOL(neigh_rand_reach_time);
2657EXPORT_SYMBOL(neigh_resolve_output); 2673EXPORT_SYMBOL(neigh_resolve_output);
2658EXPORT_SYMBOL(neigh_table_clear); 2674EXPORT_SYMBOL(neigh_table_clear);
2659EXPORT_SYMBOL(neigh_table_init); 2675EXPORT_SYMBOL(neigh_table_init);
2676EXPORT_SYMBOL(neigh_table_init_no_netlink);
2660EXPORT_SYMBOL(neigh_update); 2677EXPORT_SYMBOL(neigh_update);
2661EXPORT_SYMBOL(neigh_update_hhs); 2678EXPORT_SYMBOL(neigh_update_hhs);
2662EXPORT_SYMBOL(pneigh_enqueue); 2679EXPORT_SYMBOL(pneigh_enqueue);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index c12990c9c603..47a6fceb6771 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -29,7 +29,7 @@ static const char fmt_ulong[] = "%lu\n";
29 29
30static inline int dev_isalive(const struct net_device *dev) 30static inline int dev_isalive(const struct net_device *dev)
31{ 31{
32 return dev->reg_state == NETREG_REGISTERED; 32 return dev->reg_state <= NETREG_REGISTERED;
33} 33}
34 34
35/* use same locking rules as GIF* ioctl's */ 35/* use same locking rules as GIF* ioctl's */
@@ -445,58 +445,33 @@ static struct class net_class = {
445 445
446void netdev_unregister_sysfs(struct net_device * net) 446void netdev_unregister_sysfs(struct net_device * net)
447{ 447{
448 struct class_device * class_dev = &(net->class_dev); 448 class_device_del(&(net->class_dev));
449
450 if (net->get_stats)
451 sysfs_remove_group(&class_dev->kobj, &netstat_group);
452
453#ifdef WIRELESS_EXT
454 if (net->get_wireless_stats || (net->wireless_handlers &&
455 net->wireless_handlers->get_wireless_stats))
456 sysfs_remove_group(&class_dev->kobj, &wireless_group);
457#endif
458 class_device_del(class_dev);
459
460} 449}
461 450
462/* Create sysfs entries for network device. */ 451/* Create sysfs entries for network device. */
463int netdev_register_sysfs(struct net_device *net) 452int netdev_register_sysfs(struct net_device *net)
464{ 453{
465 struct class_device *class_dev = &(net->class_dev); 454 struct class_device *class_dev = &(net->class_dev);
466 int ret; 455 struct attribute_group **groups = net->sysfs_groups;
467 456
457 class_device_initialize(class_dev);
468 class_dev->class = &net_class; 458 class_dev->class = &net_class;
469 class_dev->class_data = net; 459 class_dev->class_data = net;
460 class_dev->groups = groups;
470 461
462 BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ);
471 strlcpy(class_dev->class_id, net->name, BUS_ID_SIZE); 463 strlcpy(class_dev->class_id, net->name, BUS_ID_SIZE);
472 if ((ret = class_device_register(class_dev)))
473 goto out;
474 464
475 if (net->get_stats && 465 if (net->get_stats)
476 (ret = sysfs_create_group(&class_dev->kobj, &netstat_group))) 466 *groups++ = &netstat_group;
477 goto out_unreg;
478 467
479#ifdef WIRELESS_EXT 468#ifdef WIRELESS_EXT
480 if (net->get_wireless_stats || (net->wireless_handlers && 469 if (net->get_wireless_stats
481 net->wireless_handlers->get_wireless_stats)) { 470 || (net->wireless_handlers && net->wireless_handlers->get_wireless_stats))
482 ret = sysfs_create_group(&class_dev->kobj, &wireless_group); 471 *groups++ = &wireless_group;
483 if (ret)
484 goto out_cleanup;
485 }
486 return 0;
487out_cleanup:
488 if (net->get_stats)
489 sysfs_remove_group(&class_dev->kobj, &netstat_group);
490#else
491 return 0;
492#endif 472#endif
493 473
494out_unreg: 474 return class_device_add(class_dev);
495 printk(KERN_WARNING "%s: sysfs attribute registration failed %d\n",
496 net->name, ret);
497 class_device_unregister(class_dev);
498out:
499 return ret;
500} 475}
501 476
502int netdev_sysfs_init(void) 477int netdev_sysfs_init(void)
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 1ff7328b0e17..2e0ee8355c41 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -848,6 +848,7 @@ static int dccp_close_state(struct sock *sk)
848void dccp_close(struct sock *sk, long timeout) 848void dccp_close(struct sock *sk, long timeout)
849{ 849{
850 struct sk_buff *skb; 850 struct sk_buff *skb;
851 int state;
851 852
852 lock_sock(sk); 853 lock_sock(sk);
853 854
@@ -882,6 +883,11 @@ void dccp_close(struct sock *sk, long timeout)
882 sk_stream_wait_close(sk, timeout); 883 sk_stream_wait_close(sk, timeout);
883 884
884adjudge_to_death: 885adjudge_to_death:
886 state = sk->sk_state;
887 sock_hold(sk);
888 sock_orphan(sk);
889 atomic_inc(sk->sk_prot->orphan_count);
890
885 /* 891 /*
886 * It is the last release_sock in its life. It will remove backlog. 892 * It is the last release_sock in its life. It will remove backlog.
887 */ 893 */
@@ -894,8 +900,9 @@ adjudge_to_death:
894 bh_lock_sock(sk); 900 bh_lock_sock(sk);
895 BUG_TRAP(!sock_owned_by_user(sk)); 901 BUG_TRAP(!sock_owned_by_user(sk));
896 902
897 sock_hold(sk); 903 /* Have we already been destroyed by a softirq or backlog? */
898 sock_orphan(sk); 904 if (state != DCCP_CLOSED && sk->sk_state == DCCP_CLOSED)
905 goto out;
899 906
900 /* 907 /*
901 * The last release_sock may have processed the CLOSE or RESET 908 * The last release_sock may have processed the CLOSE or RESET
@@ -915,12 +922,12 @@ adjudge_to_death:
915#endif 922#endif
916 } 923 }
917 924
918 atomic_inc(sk->sk_prot->orphan_count);
919 if (sk->sk_state == DCCP_CLOSED) 925 if (sk->sk_state == DCCP_CLOSED)
920 inet_csk_destroy_sock(sk); 926 inet_csk_destroy_sock(sk);
921 927
922 /* Otherwise, socket is reprieved until protocol close. */ 928 /* Otherwise, socket is reprieved until protocol close. */
923 929
930out:
924 bh_unlock_sock(sk); 931 bh_unlock_sock(sk);
925 local_bh_enable(); 932 local_bh_enable();
926 sock_put(sk); 933 sock_put(sk);
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index 7c8692c26bfe..66e230c3b328 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -493,7 +493,6 @@ struct elist_cb_state {
493static void neigh_elist_cb(struct neighbour *neigh, void *_info) 493static void neigh_elist_cb(struct neighbour *neigh, void *_info)
494{ 494{
495 struct elist_cb_state *s = _info; 495 struct elist_cb_state *s = _info;
496 struct dn_dev *dn_db;
497 struct dn_neigh *dn; 496 struct dn_neigh *dn;
498 497
499 if (neigh->dev != s->dev) 498 if (neigh->dev != s->dev)
@@ -503,10 +502,6 @@ static void neigh_elist_cb(struct neighbour *neigh, void *_info)
503 if (!(dn->flags & (DN_NDFLAG_R1|DN_NDFLAG_R2))) 502 if (!(dn->flags & (DN_NDFLAG_R1|DN_NDFLAG_R2)))
504 return; 503 return;
505 504
506 dn_db = (struct dn_dev *) s->dev->dn_ptr;
507 if (dn_db->parms.forwarding == 1 && (dn->flags & DN_NDFLAG_R2))
508 return;
509
510 if (s->t == s->n) 505 if (s->t == s->n)
511 s->rs = dn_find_slot(s->ptr, s->n, dn->priority); 506 s->rs = dn_find_slot(s->ptr, s->n, dn->priority);
512 else 507 else
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c
index fb79ce7d6439..57ea9f6f465c 100644
--- a/net/ieee80211/softmac/ieee80211softmac_assoc.c
+++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c
@@ -51,11 +51,12 @@ ieee80211softmac_assoc(struct ieee80211softmac_device *mac, struct ieee80211soft
51 spin_lock_irqsave(&mac->lock, flags); 51 spin_lock_irqsave(&mac->lock, flags);
52 mac->associnfo.associating = 1; 52 mac->associnfo.associating = 1;
53 mac->associated = 0; /* just to make sure */ 53 mac->associated = 0; /* just to make sure */
54 spin_unlock_irqrestore(&mac->lock, flags);
55 54
56 /* Set a timer for timeout */ 55 /* Set a timer for timeout */
57 /* FIXME: make timeout configurable */ 56 /* FIXME: make timeout configurable */
58 schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ); 57 if (likely(mac->running))
58 schedule_delayed_work(&mac->associnfo.timeout, 5 * HZ);
59 spin_unlock_irqrestore(&mac->lock, flags);
59} 60}
60 61
61void 62void
@@ -319,6 +320,9 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev,
319 u16 status = le16_to_cpup(&resp->status); 320 u16 status = le16_to_cpup(&resp->status);
320 struct ieee80211softmac_network *network = NULL; 321 struct ieee80211softmac_network *network = NULL;
321 unsigned long flags; 322 unsigned long flags;
323
324 if (unlikely(!mac->running))
325 return -ENODEV;
322 326
323 spin_lock_irqsave(&mac->lock, flags); 327 spin_lock_irqsave(&mac->lock, flags);
324 328
@@ -377,10 +381,16 @@ ieee80211softmac_handle_disassoc(struct net_device * dev,
377{ 381{
378 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 382 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
379 unsigned long flags; 383 unsigned long flags;
384
385 if (unlikely(!mac->running))
386 return -ENODEV;
387
380 if (memcmp(disassoc->header.addr2, mac->associnfo.bssid, ETH_ALEN)) 388 if (memcmp(disassoc->header.addr2, mac->associnfo.bssid, ETH_ALEN))
381 return 0; 389 return 0;
390
382 if (memcmp(disassoc->header.addr1, mac->dev->dev_addr, ETH_ALEN)) 391 if (memcmp(disassoc->header.addr1, mac->dev->dev_addr, ETH_ALEN))
383 return 0; 392 return 0;
393
384 dprintk(KERN_INFO PFX "got disassoc frame\n"); 394 dprintk(KERN_INFO PFX "got disassoc frame\n");
385 netif_carrier_off(dev); 395 netif_carrier_off(dev);
386 spin_lock_irqsave(&mac->lock, flags); 396 spin_lock_irqsave(&mac->lock, flags);
@@ -400,6 +410,9 @@ ieee80211softmac_handle_reassoc_req(struct net_device * dev,
400 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 410 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
401 struct ieee80211softmac_network *network; 411 struct ieee80211softmac_network *network;
402 412
413 if (unlikely(!mac->running))
414 return -ENODEV;
415
403 network = ieee80211softmac_get_network_by_bssid(mac, resp->header.addr3); 416 network = ieee80211softmac_get_network_by_bssid(mac, resp->header.addr3);
404 if (!network) { 417 if (!network) {
405 dprintkl(KERN_INFO PFX "reassoc request from unknown network\n"); 418 dprintkl(KERN_INFO PFX "reassoc request from unknown network\n");
diff --git a/net/ieee80211/softmac/ieee80211softmac_auth.c b/net/ieee80211/softmac/ieee80211softmac_auth.c
index 9a0eac6c61eb..06e332624665 100644
--- a/net/ieee80211/softmac/ieee80211softmac_auth.c
+++ b/net/ieee80211/softmac/ieee80211softmac_auth.c
@@ -86,6 +86,11 @@ ieee80211softmac_auth_queue(void *data)
86 86
87 /* Lock and set flags */ 87 /* Lock and set flags */
88 spin_lock_irqsave(&mac->lock, flags); 88 spin_lock_irqsave(&mac->lock, flags);
89 if (unlikely(!mac->running)) {
90 /* Prevent reschedule on workqueue flush */
91 spin_unlock_irqrestore(&mac->lock, flags);
92 return;
93 }
89 net->authenticated = 0; 94 net->authenticated = 0;
90 net->authenticating = 1; 95 net->authenticating = 1;
91 /* add a timeout call so we eventually give up waiting for an auth reply */ 96 /* add a timeout call so we eventually give up waiting for an auth reply */
@@ -124,6 +129,9 @@ ieee80211softmac_auth_resp(struct net_device *dev, struct ieee80211_auth *auth)
124 unsigned long flags; 129 unsigned long flags;
125 u8 * data; 130 u8 * data;
126 131
132 if (unlikely(!mac->running))
133 return -ENODEV;
134
127 /* Find correct auth queue item */ 135 /* Find correct auth queue item */
128 spin_lock_irqsave(&mac->lock, flags); 136 spin_lock_irqsave(&mac->lock, flags);
129 list_for_each(list_ptr, &mac->auth_queue) { 137 list_for_each(list_ptr, &mac->auth_queue) {
@@ -298,8 +306,6 @@ ieee80211softmac_deauth_from_net(struct ieee80211softmac_device *mac,
298 306
299 /* can't transmit data right now... */ 307 /* can't transmit data right now... */
300 netif_carrier_off(mac->dev); 308 netif_carrier_off(mac->dev);
301 /* let's try to re-associate */
302 schedule_work(&mac->associnfo.work);
303 spin_unlock_irqrestore(&mac->lock, flags); 309 spin_unlock_irqrestore(&mac->lock, flags);
304} 310}
305 311
@@ -338,6 +344,9 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
338 struct ieee80211softmac_network *net = NULL; 344 struct ieee80211softmac_network *net = NULL;
339 struct ieee80211softmac_device *mac = ieee80211_priv(dev); 345 struct ieee80211softmac_device *mac = ieee80211_priv(dev);
340 346
347 if (unlikely(!mac->running))
348 return -ENODEV;
349
341 if (!deauth) { 350 if (!deauth) {
342 dprintk("deauth without deauth packet. eek!\n"); 351 dprintk("deauth without deauth packet. eek!\n");
343 return 0; 352 return 0;
@@ -360,5 +369,8 @@ ieee80211softmac_deauth_resp(struct net_device *dev, struct ieee80211_deauth *de
360 } 369 }
361 370
362 ieee80211softmac_deauth_from_net(mac, net); 371 ieee80211softmac_deauth_from_net(mac, net);
372
373 /* let's try to re-associate */
374 schedule_work(&mac->associnfo.work);
363 return 0; 375 return 0;
364} 376}
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c
index be83bdc1644a..6252be2c0db9 100644
--- a/net/ieee80211/softmac/ieee80211softmac_module.c
+++ b/net/ieee80211/softmac/ieee80211softmac_module.c
@@ -89,6 +89,8 @@ ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm)
89 ieee80211softmac_wait_for_scan(sm); 89 ieee80211softmac_wait_for_scan(sm);
90 90
91 spin_lock_irqsave(&sm->lock, flags); 91 spin_lock_irqsave(&sm->lock, flags);
92 sm->running = 0;
93
92 /* Free all pending assoc work items */ 94 /* Free all pending assoc work items */
93 cancel_delayed_work(&sm->associnfo.work); 95 cancel_delayed_work(&sm->associnfo.work);
94 96
@@ -204,6 +206,8 @@ void ieee80211softmac_start(struct net_device *dev)
204 assert(0); 206 assert(0);
205 if (mac->txrates_change) 207 if (mac->txrates_change)
206 mac->txrates_change(dev, change, &oldrates); 208 mac->txrates_change(dev, change, &oldrates);
209
210 mac->running = 1;
207} 211}
208EXPORT_SYMBOL_GPL(ieee80211softmac_start); 212EXPORT_SYMBOL_GPL(ieee80211softmac_start);
209 213
diff --git a/net/ieee80211/softmac/ieee80211softmac_scan.c b/net/ieee80211/softmac/ieee80211softmac_scan.c
index 2b9e7edfa3ce..d31cf77498c4 100644
--- a/net/ieee80211/softmac/ieee80211softmac_scan.c
+++ b/net/ieee80211/softmac/ieee80211softmac_scan.c
@@ -115,7 +115,15 @@ void ieee80211softmac_scan(void *d)
115 // TODO: is this if correct, or should we do this only if scanning from assoc request? 115 // TODO: is this if correct, or should we do this only if scanning from assoc request?
116 if (sm->associnfo.req_essid.len) 116 if (sm->associnfo.req_essid.len)
117 ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0); 117 ieee80211softmac_send_mgt_frame(sm, &sm->associnfo.req_essid, IEEE80211_STYPE_PROBE_REQ, 0);
118
119 spin_lock_irqsave(&sm->lock, flags);
120 if (unlikely(!sm->running)) {
121 /* Prevent reschedule on workqueue flush */
122 spin_unlock_irqrestore(&sm->lock, flags);
123 break;
124 }
118 schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY); 125 schedule_delayed_work(&si->softmac_scan, IEEE80211SOFTMAC_PROBE_DELAY);
126 spin_unlock_irqrestore(&sm->lock, flags);
119 return; 127 return;
120 } else { 128 } else {
121 dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel); 129 dprintk(PFX "Not probing Channel %d (not allowed here)\n", si->channels[current_channel_idx].channel);
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 18d7fad474d7..c9026dbf4c93 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -337,7 +337,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
337 * Initialise the virtual path cache for the packet. It describes 337 * Initialise the virtual path cache for the packet. It describes
338 * how the packet travels inside Linux networking. 338 * how the packet travels inside Linux networking.
339 */ 339 */
340 if (likely(skb->dst == NULL)) { 340 if (skb->dst == NULL) {
341 int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, 341 int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
342 skb->dev); 342 skb->dev);
343 if (unlikely(err)) { 343 if (unlikely(err)) {
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 9bebad07bf2e..cbcae6544622 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -209,7 +209,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
209 209
210void ip_options_fragment(struct sk_buff * skb) 210void ip_options_fragment(struct sk_buff * skb)
211{ 211{
212 unsigned char * optptr = skb->nh.raw; 212 unsigned char * optptr = skb->nh.raw + sizeof(struct iphdr);
213 struct ip_options * opt = &(IPCB(skb)->opt); 213 struct ip_options * opt = &(IPCB(skb)->opt);
214 int l = opt->optlen; 214 int l = opt->optlen;
215 int optlen; 215 int optlen;
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c
index 2c2fb700d835..518f581d39ec 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c
@@ -162,6 +162,8 @@ static int get_tpkt_data(struct sk_buff **pskb, struct ip_conntrack *ct,
162 162
163 /* Validate TPKT length */ 163 /* Validate TPKT length */
164 tpktlen = tpkt[2] * 256 + tpkt[3]; 164 tpktlen = tpkt[2] * 256 + tpkt[3];
165 if (tpktlen < 4)
166 goto clear_out;
165 if (tpktlen > tcpdatalen) { 167 if (tpktlen > tcpdatalen) {
166 if (tcpdatalen == 4) { /* Separate TPKT header */ 168 if (tcpdatalen == 4) { /* Separate TPKT header */
167 /* Netmeeting sends TPKT header and data separately */ 169 /* Netmeeting sends TPKT header and data separately */
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c b/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
index 48078002e450..355a53a5b6cd 100644
--- a/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
+++ b/net/ipv4/netfilter/ip_conntrack_helper_h323_asn1.c
@@ -2,7 +2,7 @@
2 * ip_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323 2 * ip_conntrack_helper_h323_asn1.c - BER and PER decoding library for H.323
3 * conntrack/NAT module. 3 * conntrack/NAT module.
4 * 4 *
5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@hotmail.com> 5 * Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
6 * 6 *
7 * This source code is licensed under General Public License version 2. 7 * This source code is licensed under General Public License version 2.
8 * 8 *
@@ -703,6 +703,10 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level)
703 type = get_bits(bs, f->sz); 703 type = get_bits(bs, f->sz);
704 } 704 }
705 705
706 /* Write Type */
707 if (base)
708 *(unsigned *) base = type;
709
706 /* Check Range */ 710 /* Check Range */
707 if (type >= f->ub) { /* Newer version? */ 711 if (type >= f->ub) { /* Newer version? */
708 BYTE_ALIGN(bs); 712 BYTE_ALIGN(bs);
@@ -712,10 +716,6 @@ int decode_choice(bitstr_t * bs, field_t * f, char *base, int level)
712 return H323_ERROR_NONE; 716 return H323_ERROR_NONE;
713 } 717 }
714 718
715 /* Write Type */
716 if (base)
717 *(unsigned *) base = type;
718
719 /* Transfer to son level */ 719 /* Transfer to son level */
720 son = &f->fields[type]; 720 son = &f->fields[type];
721 if (son->attr & STOP) { 721 if (son->attr & STOP) {
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index 8f760b28617e..67e676783da9 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -219,8 +219,10 @@ ip_nat_out(unsigned int hooknum,
219 const struct net_device *out, 219 const struct net_device *out,
220 int (*okfn)(struct sk_buff *)) 220 int (*okfn)(struct sk_buff *))
221{ 221{
222#ifdef CONFIG_XFRM
222 struct ip_conntrack *ct; 223 struct ip_conntrack *ct;
223 enum ip_conntrack_info ctinfo; 224 enum ip_conntrack_info ctinfo;
225#endif
224 unsigned int ret; 226 unsigned int ret;
225 227
226 /* root is playing with raw sockets. */ 228 /* root is playing with raw sockets. */
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index 6d1c11563943..cee3397ec277 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1441,7 +1441,7 @@ static int compat_copy_entry_to_user(struct ipt_entry *e,
1441 ret = -EFAULT; 1441 ret = -EFAULT;
1442 origsize = *size; 1442 origsize = *size;
1443 ce = (struct compat_ipt_entry __user *)*dstptr; 1443 ce = (struct compat_ipt_entry __user *)*dstptr;
1444 if (__copy_to_user(ce, e, sizeof(struct ipt_entry))) 1444 if (copy_to_user(ce, e, sizeof(struct ipt_entry)))
1445 goto out; 1445 goto out;
1446 1446
1447 *dstptr += sizeof(struct compat_ipt_entry); 1447 *dstptr += sizeof(struct compat_ipt_entry);
@@ -1459,9 +1459,9 @@ static int compat_copy_entry_to_user(struct ipt_entry *e,
1459 goto out; 1459 goto out;
1460 ret = -EFAULT; 1460 ret = -EFAULT;
1461 next_offset = e->next_offset - (origsize - *size); 1461 next_offset = e->next_offset - (origsize - *size);
1462 if (__put_user(target_offset, &ce->target_offset)) 1462 if (put_user(target_offset, &ce->target_offset))
1463 goto out; 1463 goto out;
1464 if (__put_user(next_offset, &ce->next_offset)) 1464 if (put_user(next_offset, &ce->next_offset))
1465 goto out; 1465 goto out;
1466 return 0; 1466 return 0;
1467out: 1467out:
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 87f68e787d0c..e2b7b8055037 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1468,6 +1468,7 @@ void tcp_close(struct sock *sk, long timeout)
1468{ 1468{
1469 struct sk_buff *skb; 1469 struct sk_buff *skb;
1470 int data_was_unread = 0; 1470 int data_was_unread = 0;
1471 int state;
1471 1472
1472 lock_sock(sk); 1473 lock_sock(sk);
1473 sk->sk_shutdown = SHUTDOWN_MASK; 1474 sk->sk_shutdown = SHUTDOWN_MASK;
@@ -1544,6 +1545,11 @@ void tcp_close(struct sock *sk, long timeout)
1544 sk_stream_wait_close(sk, timeout); 1545 sk_stream_wait_close(sk, timeout);
1545 1546
1546adjudge_to_death: 1547adjudge_to_death:
1548 state = sk->sk_state;
1549 sock_hold(sk);
1550 sock_orphan(sk);
1551 atomic_inc(sk->sk_prot->orphan_count);
1552
1547 /* It is the last release_sock in its life. It will remove backlog. */ 1553 /* It is the last release_sock in its life. It will remove backlog. */
1548 release_sock(sk); 1554 release_sock(sk);
1549 1555
@@ -1555,8 +1561,9 @@ adjudge_to_death:
1555 bh_lock_sock(sk); 1561 bh_lock_sock(sk);
1556 BUG_TRAP(!sock_owned_by_user(sk)); 1562 BUG_TRAP(!sock_owned_by_user(sk));
1557 1563
1558 sock_hold(sk); 1564 /* Have we already been destroyed by a softirq or backlog? */
1559 sock_orphan(sk); 1565 if (state != TCP_CLOSE && sk->sk_state == TCP_CLOSE)
1566 goto out;
1560 1567
1561 /* This is a (useful) BSD violating of the RFC. There is a 1568 /* This is a (useful) BSD violating of the RFC. There is a
1562 * problem with TCP as specified in that the other end could 1569 * problem with TCP as specified in that the other end could
@@ -1584,7 +1591,6 @@ adjudge_to_death:
1584 if (tmo > TCP_TIMEWAIT_LEN) { 1591 if (tmo > TCP_TIMEWAIT_LEN) {
1585 inet_csk_reset_keepalive_timer(sk, tcp_fin_time(sk)); 1592 inet_csk_reset_keepalive_timer(sk, tcp_fin_time(sk));
1586 } else { 1593 } else {
1587 atomic_inc(sk->sk_prot->orphan_count);
1588 tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); 1594 tcp_time_wait(sk, TCP_FIN_WAIT2, tmo);
1589 goto out; 1595 goto out;
1590 } 1596 }
@@ -1603,7 +1609,6 @@ adjudge_to_death:
1603 NET_INC_STATS_BH(LINUX_MIB_TCPABORTONMEMORY); 1609 NET_INC_STATS_BH(LINUX_MIB_TCPABORTONMEMORY);
1604 } 1610 }
1605 } 1611 }
1606 atomic_inc(sk->sk_prot->orphan_count);
1607 1612
1608 if (sk->sk_state == TCP_CLOSE) 1613 if (sk->sk_state == TCP_CLOSE)
1609 inet_csk_destroy_sock(sk); 1614 inet_csk_destroy_sock(sk);
diff --git a/net/ipv4/tcp_highspeed.c b/net/ipv4/tcp_highspeed.c
index e0e9d1383c7c..b72fa55dfb84 100644
--- a/net/ipv4/tcp_highspeed.c
+++ b/net/ipv4/tcp_highspeed.c
@@ -137,8 +137,8 @@ static void hstcp_cong_avoid(struct sock *sk, u32 adk, u32 rtt,
137 if (tp->snd_cwnd < tp->snd_cwnd_clamp) { 137 if (tp->snd_cwnd < tp->snd_cwnd_clamp) {
138 tp->snd_cwnd_cnt += ca->ai; 138 tp->snd_cwnd_cnt += ca->ai;
139 if (tp->snd_cwnd_cnt >= tp->snd_cwnd) { 139 if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
140 tp->snd_cwnd++;
141 tp->snd_cwnd_cnt -= tp->snd_cwnd; 140 tp->snd_cwnd_cnt -= tp->snd_cwnd;
141 tp->snd_cwnd++;
142 } 142 }
143 } 143 }
144 } 144 }
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
index f8f3a37a1494..eb2865d5ae28 100644
--- a/net/ipv6/inet6_connection_sock.c
+++ b/net/ipv6/inet6_connection_sock.c
@@ -173,6 +173,7 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
173 173
174 if (err) { 174 if (err) {
175 sk->sk_err_soft = -err; 175 sk->sk_err_soft = -err;
176 kfree_skb(skb);
176 return err; 177 return err;
177 } 178 }
178 179
@@ -181,6 +182,7 @@ int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
181 182
182 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) { 183 if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) {
183 sk->sk_route_caps = 0; 184 sk->sk_route_caps = 0;
185 kfree_skb(skb);
184 return err; 186 return err;
185 } 187 }
186 188
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c
index c6d169fbdceb..82e665c79991 100644
--- a/net/irda/irias_object.c
+++ b/net/irda/irias_object.c
@@ -257,7 +257,6 @@ struct ias_attrib *irias_find_attrib(struct ias_object *obj, char *name)
257 /* Unsafe (locking), attrib might change */ 257 /* Unsafe (locking), attrib might change */
258 return attrib; 258 return attrib;
259} 259}
260EXPORT_SYMBOL(irias_find_attrib);
261 260
262/* 261/*
263 * Function irias_add_attribute (obj, attrib) 262 * Function irias_add_attribute (obj, attrib)
@@ -484,7 +483,6 @@ struct ias_value *irias_new_string_value(char *string)
484 483
485 return value; 484 return value;
486} 485}
487EXPORT_SYMBOL(irias_new_string_value);
488 486
489/* 487/*
490 * Function irias_new_octseq_value (octets, len) 488 * Function irias_new_octseq_value (octets, len)
@@ -519,7 +517,6 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
519 memcpy(value->t.oct_seq, octseq , len); 517 memcpy(value->t.oct_seq, octseq , len);
520 return value; 518 return value;
521} 519}
522EXPORT_SYMBOL(irias_new_octseq_value);
523 520
524struct ias_value *irias_new_missing_value(void) 521struct ias_value *irias_new_missing_value(void)
525{ 522{
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 17abf60f9570..99293c63ff73 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -289,7 +289,7 @@ int xt_compat_match(void *match, void **dstptr, int *size, int convert)
289 case COMPAT_TO_USER: 289 case COMPAT_TO_USER:
290 pm = (struct xt_entry_match *)match; 290 pm = (struct xt_entry_match *)match;
291 msize = pm->u.user.match_size; 291 msize = pm->u.user.match_size;
292 if (__copy_to_user(*dstptr, pm, msize)) { 292 if (copy_to_user(*dstptr, pm, msize)) {
293 ret = -EFAULT; 293 ret = -EFAULT;
294 break; 294 break;
295 } 295 }
@@ -366,7 +366,7 @@ int xt_compat_target(void *target, void **dstptr, int *size, int convert)
366 case COMPAT_TO_USER: 366 case COMPAT_TO_USER:
367 pt = (struct xt_entry_target *)target; 367 pt = (struct xt_entry_target *)target;
368 tsize = pt->u.user.target_size; 368 tsize = pt->u.user.target_size;
369 if (__copy_to_user(*dstptr, pt, tsize)) { 369 if (copy_to_user(*dstptr, pt, tsize)) {
370 ret = -EFAULT; 370 ret = -EFAULT;
371 break; 371 break;
372 } 372 }
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index d44981f5a619..3669cb953e6e 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -425,11 +425,16 @@ static int nr_create(struct socket *sock, int protocol)
425 425
426 nr_init_timers(sk); 426 nr_init_timers(sk);
427 427
428 nr->t1 = sysctl_netrom_transport_timeout; 428 nr->t1 =
429 nr->t2 = sysctl_netrom_transport_acknowledge_delay; 429 msecs_to_jiffies(sysctl_netrom_transport_timeout);
430 nr->n2 = sysctl_netrom_transport_maximum_tries; 430 nr->t2 =
431 nr->t4 = sysctl_netrom_transport_busy_delay; 431 msecs_to_jiffies(sysctl_netrom_transport_acknowledge_delay);
432 nr->idle = sysctl_netrom_transport_no_activity_timeout; 432 nr->n2 =
433 msecs_to_jiffies(sysctl_netrom_transport_maximum_tries);
434 nr->t4 =
435 msecs_to_jiffies(sysctl_netrom_transport_busy_delay);
436 nr->idle =
437 msecs_to_jiffies(sysctl_netrom_transport_no_activity_timeout);
433 nr->window = sysctl_netrom_transport_requested_window_size; 438 nr->window = sysctl_netrom_transport_requested_window_size;
434 439
435 nr->bpqext = 1; 440 nr->bpqext = 1;
@@ -1365,8 +1370,6 @@ static struct notifier_block nr_dev_notifier = {
1365 1370
1366static struct net_device **dev_nr; 1371static struct net_device **dev_nr;
1367 1372
1368static char banner[] __initdata = KERN_INFO "G4KLX NET/ROM for Linux. Version 0.7 for AX25.037 Linux 2.4\n";
1369
1370static int __init nr_proto_init(void) 1373static int __init nr_proto_init(void)
1371{ 1374{
1372 int i; 1375 int i;
@@ -1414,7 +1417,6 @@ static int __init nr_proto_init(void)
1414 } 1417 }
1415 1418
1416 register_netdevice_notifier(&nr_dev_notifier); 1419 register_netdevice_notifier(&nr_dev_notifier);
1417 printk(banner);
1418 1420
1419 ax25_protocol_register(AX25_P_NETROM, nr_route_frame); 1421 ax25_protocol_register(AX25_P_NETROM, nr_route_frame);
1420 ax25_linkfail_register(nr_link_failed); 1422 ax25_linkfail_register(nr_link_failed);
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 509afddae569..621e5586ab03 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -185,7 +185,6 @@ static struct net_device_stats *nr_get_stats(struct net_device *dev)
185 185
186void nr_setup(struct net_device *dev) 186void nr_setup(struct net_device *dev)
187{ 187{
188 SET_MODULE_OWNER(dev);
189 dev->mtu = NR_MAX_PACKET_SIZE; 188 dev->mtu = NR_MAX_PACKET_SIZE;
190 dev->hard_start_xmit = nr_xmit; 189 dev->hard_start_xmit = nr_xmit;
191 dev->open = nr_open; 190 dev->open = nr_open;
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index ea65396d1619..55564efccf11 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -518,11 +518,11 @@ static int rose_create(struct socket *sock, int protocol)
518 init_timer(&rose->timer); 518 init_timer(&rose->timer);
519 init_timer(&rose->idletimer); 519 init_timer(&rose->idletimer);
520 520
521 rose->t1 = sysctl_rose_call_request_timeout; 521 rose->t1 = msecs_to_jiffies(sysctl_rose_call_request_timeout);
522 rose->t2 = sysctl_rose_reset_request_timeout; 522 rose->t2 = msecs_to_jiffies(sysctl_rose_reset_request_timeout);
523 rose->t3 = sysctl_rose_clear_request_timeout; 523 rose->t3 = msecs_to_jiffies(sysctl_rose_clear_request_timeout);
524 rose->hb = sysctl_rose_ack_hold_back_timeout; 524 rose->hb = msecs_to_jiffies(sysctl_rose_ack_hold_back_timeout);
525 rose->idle = sysctl_rose_no_activity_timeout; 525 rose->idle = msecs_to_jiffies(sysctl_rose_no_activity_timeout);
526 526
527 rose->state = ROSE_STATE_0; 527 rose->state = ROSE_STATE_0;
528 528
@@ -1469,8 +1469,6 @@ static struct notifier_block rose_dev_notifier = {
1469 1469
1470static struct net_device **dev_rose; 1470static struct net_device **dev_rose;
1471 1471
1472static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n";
1473
1474static int __init rose_proto_init(void) 1472static int __init rose_proto_init(void)
1475{ 1473{
1476 int i; 1474 int i;
@@ -1519,7 +1517,6 @@ static int __init rose_proto_init(void)
1519 1517
1520 sock_register(&rose_family_ops); 1518 sock_register(&rose_family_ops);
1521 register_netdevice_notifier(&rose_dev_notifier); 1519 register_netdevice_notifier(&rose_dev_notifier);
1522 printk(banner);
1523 1520
1524 ax25_protocol_register(AX25_P_ROSE, rose_route_frame); 1521 ax25_protocol_register(AX25_P_ROSE, rose_route_frame);
1525 ax25_linkfail_register(rose_link_failed); 1522 ax25_linkfail_register(rose_link_failed);
diff --git a/net/rose/rose_dev.c b/net/rose/rose_dev.c
index d297af737d10..2a1bf8e119e5 100644
--- a/net/rose/rose_dev.c
+++ b/net/rose/rose_dev.c
@@ -135,7 +135,6 @@ static struct net_device_stats *rose_get_stats(struct net_device *dev)
135 135
136void rose_setup(struct net_device *dev) 136void rose_setup(struct net_device *dev)
137{ 137{
138 SET_MODULE_OWNER(dev);
139 dev->mtu = ROSE_MAX_PACKET_SIZE - 2; 138 dev->mtu = ROSE_MAX_PACKET_SIZE - 2;
140 dev->hard_start_xmit = rose_xmit; 139 dev->hard_start_xmit = rose_xmit;
141 dev->open = rose_open; 140 dev->open = rose_open;
diff --git a/net/rose/rose_link.c b/net/rose/rose_link.c
index 09e9e9d04d92..bd86a63960ce 100644
--- a/net/rose/rose_link.c
+++ b/net/rose/rose_link.c
@@ -40,7 +40,8 @@ void rose_start_ftimer(struct rose_neigh *neigh)
40 40
41 neigh->ftimer.data = (unsigned long)neigh; 41 neigh->ftimer.data = (unsigned long)neigh;
42 neigh->ftimer.function = &rose_ftimer_expiry; 42 neigh->ftimer.function = &rose_ftimer_expiry;
43 neigh->ftimer.expires = jiffies + sysctl_rose_link_fail_timeout; 43 neigh->ftimer.expires =
44 jiffies + msecs_to_jiffies(sysctl_rose_link_fail_timeout);
44 45
45 add_timer(&neigh->ftimer); 46 add_timer(&neigh->ftimer);
46} 47}
@@ -51,7 +52,8 @@ static void rose_start_t0timer(struct rose_neigh *neigh)
51 52
52 neigh->t0timer.data = (unsigned long)neigh; 53 neigh->t0timer.data = (unsigned long)neigh;
53 neigh->t0timer.function = &rose_t0timer_expiry; 54 neigh->t0timer.function = &rose_t0timer_expiry;
54 neigh->t0timer.expires = jiffies + sysctl_rose_restart_request_timeout; 55 neigh->t0timer.expires =
56 jiffies + msecs_to_jiffies(sysctl_rose_restart_request_timeout);
55 57
56 add_timer(&neigh->t0timer); 58 add_timer(&neigh->t0timer);
57} 59}
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index 8631b65a7312..a22542fa1bc8 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -48,8 +48,6 @@ static DEFINE_SPINLOCK(rose_route_list_lock);
48 48
49struct rose_neigh *rose_loopback_neigh; 49struct rose_neigh *rose_loopback_neigh;
50 50
51static void rose_remove_neigh(struct rose_neigh *);
52
53/* 51/*
54 * Add a new route to a node, and in the process add the node and the 52 * Add a new route to a node, and in the process add the node and the
55 * neighbour if it is new. 53 * neighbour if it is new.
@@ -235,11 +233,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
235 233
236 skb_queue_purge(&rose_neigh->queue); 234 skb_queue_purge(&rose_neigh->queue);
237 235
238 spin_lock_bh(&rose_neigh_list_lock);
239
240 if ((s = rose_neigh_list) == rose_neigh) { 236 if ((s = rose_neigh_list) == rose_neigh) {
241 rose_neigh_list = rose_neigh->next; 237 rose_neigh_list = rose_neigh->next;
242 spin_unlock_bh(&rose_neigh_list_lock);
243 kfree(rose_neigh->digipeat); 238 kfree(rose_neigh->digipeat);
244 kfree(rose_neigh); 239 kfree(rose_neigh);
245 return; 240 return;
@@ -248,7 +243,6 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
248 while (s != NULL && s->next != NULL) { 243 while (s != NULL && s->next != NULL) {
249 if (s->next == rose_neigh) { 244 if (s->next == rose_neigh) {
250 s->next = rose_neigh->next; 245 s->next = rose_neigh->next;
251 spin_unlock_bh(&rose_neigh_list_lock);
252 kfree(rose_neigh->digipeat); 246 kfree(rose_neigh->digipeat);
253 kfree(rose_neigh); 247 kfree(rose_neigh);
254 return; 248 return;
@@ -256,7 +250,6 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
256 250
257 s = s->next; 251 s = s->next;
258 } 252 }
259 spin_unlock_bh(&rose_neigh_list_lock);
260} 253}
261 254
262/* 255/*
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 91132f6871d7..f1c7bd29f2cd 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -974,10 +974,10 @@ hfsc_adjust_levels(struct hfsc_class *cl)
974 do { 974 do {
975 level = 0; 975 level = 0;
976 list_for_each_entry(p, &cl->children, siblings) { 976 list_for_each_entry(p, &cl->children, siblings) {
977 if (p->level > level) 977 if (p->level >= level)
978 level = p->level; 978 level = p->level + 1;
979 } 979 }
980 cl->level = level + 1; 980 cl->level = level;
981 } while ((cl = cl->cl_parent) != NULL); 981 } while ((cl = cl->cl_parent) != NULL);
982} 982}
983 983
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index 297b8951463e..cf0c767d43ae 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -149,6 +149,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue)
149 /* This is the first chunk in the packet. */ 149 /* This is the first chunk in the packet. */
150 chunk->singleton = 1; 150 chunk->singleton = 1;
151 ch = (sctp_chunkhdr_t *) chunk->skb->data; 151 ch = (sctp_chunkhdr_t *) chunk->skb->data;
152 chunk->data_accepted = 0;
152 } 153 }
153 154
154 chunk->chunk_hdr = ch; 155 chunk->chunk_hdr = ch;
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 2b9a832b29a7..8cdba51ec076 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -636,8 +636,9 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep,
636 */ 636 */
637 chunk->subh.cookie_hdr = 637 chunk->subh.cookie_hdr =
638 (struct sctp_signed_cookie *)chunk->skb->data; 638 (struct sctp_signed_cookie *)chunk->skb->data;
639 skb_pull(chunk->skb, 639 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
640 ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t)); 640 sizeof(sctp_chunkhdr_t)))
641 goto nomem;
641 642
642 /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint 643 /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint
643 * "Z" will reply with a COOKIE ACK chunk after building a TCB 644 * "Z" will reply with a COOKIE ACK chunk after building a TCB
@@ -965,7 +966,8 @@ sctp_disposition_t sctp_sf_beat_8_3(const struct sctp_endpoint *ep,
965 */ 966 */
966 chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data; 967 chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
967 paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); 968 paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
968 skb_pull(chunk->skb, paylen); 969 if (!pskb_pull(chunk->skb, paylen))
970 goto nomem;
969 971
970 reply = sctp_make_heartbeat_ack(asoc, chunk, 972 reply = sctp_make_heartbeat_ack(asoc, chunk,
971 chunk->subh.hb_hdr, paylen); 973 chunk->subh.hb_hdr, paylen);
@@ -1860,8 +1862,9 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep,
1860 * are in good shape. 1862 * are in good shape.
1861 */ 1863 */
1862 chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; 1864 chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data;
1863 skb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - 1865 if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
1864 sizeof(sctp_chunkhdr_t)); 1866 sizeof(sctp_chunkhdr_t)))
1867 goto nomem;
1865 1868
1866 /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie 1869 /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie
1867 * of a duplicate COOKIE ECHO match the Verification Tags of the 1870 * of a duplicate COOKIE ECHO match the Verification Tags of the
@@ -5151,7 +5154,9 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5151 int tmp; 5154 int tmp;
5152 __u32 tsn; 5155 __u32 tsn;
5153 int account_value; 5156 int account_value;
5157 struct sctp_tsnmap *map = (struct sctp_tsnmap *)&asoc->peer.tsn_map;
5154 struct sock *sk = asoc->base.sk; 5158 struct sock *sk = asoc->base.sk;
5159 int rcvbuf_over = 0;
5155 5160
5156 data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data; 5161 data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data;
5157 skb_pull(chunk->skb, sizeof(sctp_datahdr_t)); 5162 skb_pull(chunk->skb, sizeof(sctp_datahdr_t));
@@ -5162,10 +5167,16 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5162 /* ASSERT: Now skb->data is really the user data. */ 5167 /* ASSERT: Now skb->data is really the user data. */
5163 5168
5164 /* 5169 /*
5165 * if we are established, and we have used up our receive 5170 * If we are established, and we have used up our receive buffer
5166 * buffer memory, drop the frame 5171 * memory, think about droping the frame.
5167 */ 5172 * Note that we have an opportunity to improve performance here.
5168 if (asoc->state == SCTP_STATE_ESTABLISHED) { 5173 * If we accept one chunk from an skbuff, we have to keep all the
5174 * memory of that skbuff around until the chunk is read into user
5175 * space. Therefore, once we accept 1 chunk we may as well accept all
5176 * remaining chunks in the skbuff. The data_accepted flag helps us do
5177 * that.
5178 */
5179 if ((asoc->state == SCTP_STATE_ESTABLISHED) && (!chunk->data_accepted)) {
5169 /* 5180 /*
5170 * If the receive buffer policy is 1, then each 5181 * If the receive buffer policy is 1, then each
5171 * association can allocate up to sk_rcvbuf bytes 5182 * association can allocate up to sk_rcvbuf bytes
@@ -5176,9 +5187,25 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5176 account_value = atomic_read(&asoc->rmem_alloc); 5187 account_value = atomic_read(&asoc->rmem_alloc);
5177 else 5188 else
5178 account_value = atomic_read(&sk->sk_rmem_alloc); 5189 account_value = atomic_read(&sk->sk_rmem_alloc);
5179 5190 if (account_value > sk->sk_rcvbuf) {
5180 if (account_value > sk->sk_rcvbuf) 5191 /*
5181 return SCTP_IERROR_IGNORE_TSN; 5192 * We need to make forward progress, even when we are
5193 * under memory pressure, so we always allow the
5194 * next tsn after the ctsn ack point to be accepted.
5195 * This lets us avoid deadlocks in which we have to
5196 * drop frames that would otherwise let us drain the
5197 * receive queue.
5198 */
5199 if ((sctp_tsnmap_get_ctsn(map) + 1) != tsn)
5200 return SCTP_IERROR_IGNORE_TSN;
5201
5202 /*
5203 * We're going to accept the frame but we should renege
5204 * to make space for it. This will send us down that
5205 * path later in this function.
5206 */
5207 rcvbuf_over = 1;
5208 }
5182 } 5209 }
5183 5210
5184 /* Process ECN based congestion. 5211 /* Process ECN based congestion.
@@ -5226,6 +5253,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5226 datalen -= sizeof(sctp_data_chunk_t); 5253 datalen -= sizeof(sctp_data_chunk_t);
5227 5254
5228 deliver = SCTP_CMD_CHUNK_ULP; 5255 deliver = SCTP_CMD_CHUNK_ULP;
5256 chunk->data_accepted = 1;
5229 5257
5230 /* Think about partial delivery. */ 5258 /* Think about partial delivery. */
5231 if ((datalen >= asoc->rwnd) && (!asoc->ulpq.pd_mode)) { 5259 if ((datalen >= asoc->rwnd) && (!asoc->ulpq.pd_mode)) {
@@ -5242,7 +5270,8 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5242 * large spill over. 5270 * large spill over.
5243 */ 5271 */
5244 if (!asoc->rwnd || asoc->rwnd_over || 5272 if (!asoc->rwnd || asoc->rwnd_over ||
5245 (datalen > asoc->rwnd + asoc->frag_point)) { 5273 (datalen > asoc->rwnd + asoc->frag_point) ||
5274 rcvbuf_over) {
5246 5275
5247 /* If this is the next TSN, consider reneging to make 5276 /* If this is the next TSN, consider reneging to make
5248 * room. Note: Playing nice with a confused sender. A 5277 * room. Note: Playing nice with a confused sender. A
@@ -5250,8 +5279,8 @@ static int sctp_eat_data(const struct sctp_association *asoc,
5250 * space and in the future we may want to detect and 5279 * space and in the future we may want to detect and
5251 * do more drastic reneging. 5280 * do more drastic reneging.
5252 */ 5281 */
5253 if (sctp_tsnmap_has_gap(&asoc->peer.tsn_map) && 5282 if (sctp_tsnmap_has_gap(map) &&
5254 (sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map) + 1) == tsn) { 5283 (sctp_tsnmap_get_ctsn(map) + 1) == tsn) {
5255 SCTP_DEBUG_PRINTK("Reneging for tsn:%u\n", tsn); 5284 SCTP_DEBUG_PRINTK("Reneging for tsn:%u\n", tsn);
5256 deliver = SCTP_CMD_RENEGE; 5285 deliver = SCTP_CMD_RENEGE;
5257 } else { 5286 } else {
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c
index 75ef10408764..8bcca5676151 100644
--- a/net/sctp/sm_statetable.c
+++ b/net/sctp/sm_statetable.c
@@ -366,9 +366,9 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
366 /* SCTP_STATE_EMPTY */ \ 366 /* SCTP_STATE_EMPTY */ \
367 {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \ 367 {.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
368 /* SCTP_STATE_CLOSED */ \ 368 /* SCTP_STATE_CLOSED */ \
369 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \ 369 {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
370 /* SCTP_STATE_COOKIE_WAIT */ \ 370 /* SCTP_STATE_COOKIE_WAIT */ \
371 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \ 371 {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
372 /* SCTP_STATE_COOKIE_ECHOED */ \ 372 /* SCTP_STATE_COOKIE_ECHOED */ \
373 {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \ 373 {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
374 /* SCTP_STATE_ESTABLISHED */ \ 374 /* SCTP_STATE_ESTABLISHED */ \
@@ -380,7 +380,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
380 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \ 380 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
381 {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \ 381 {.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
382 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \ 382 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
383 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \ 383 {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
384} /* TYPE_SCTP_ECN_ECNE */ 384} /* TYPE_SCTP_ECN_ECNE */
385 385
386#define TYPE_SCTP_ECN_CWR { \ 386#define TYPE_SCTP_ECN_CWR { \
@@ -401,7 +401,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
401 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \ 401 /* SCTP_STATE_SHUTDOWN_RECEIVED */ \
402 {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \ 402 {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
403 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \ 403 /* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
404 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \ 404 {.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
405} /* TYPE_SCTP_ECN_CWR */ 405} /* TYPE_SCTP_ECN_CWR */
406 406
407#define TYPE_SCTP_SHUTDOWN_COMPLETE { \ 407#define TYPE_SCTP_SHUTDOWN_COMPLETE { \
@@ -647,7 +647,7 @@ chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
647 /* SCTP_STATE_EMPTY */ \ 647 /* SCTP_STATE_EMPTY */ \
648 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \ 648 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
649 /* SCTP_STATE_CLOSED */ \ 649 /* SCTP_STATE_CLOSED */ \
650 {.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \ 650 {.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
651 /* SCTP_STATE_COOKIE_WAIT */ \ 651 /* SCTP_STATE_COOKIE_WAIT */ \
652 {.fn = sctp_sf_do_prm_requestheartbeat, \ 652 {.fn = sctp_sf_do_prm_requestheartbeat, \
653 .name = "sctp_sf_do_prm_requestheartbeat"}, \ 653 .name = "sctp_sf_do_prm_requestheartbeat"}, \
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 2080b2d28c98..575e556aeb3e 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -279,6 +279,7 @@ static inline void sctp_ulpq_store_reasm(struct sctp_ulpq *ulpq,
279static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *queue, struct sk_buff *f_frag, struct sk_buff *l_frag) 279static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *queue, struct sk_buff *f_frag, struct sk_buff *l_frag)
280{ 280{
281 struct sk_buff *pos; 281 struct sk_buff *pos;
282 struct sk_buff *new = NULL;
282 struct sctp_ulpevent *event; 283 struct sctp_ulpevent *event;
283 struct sk_buff *pnext, *last; 284 struct sk_buff *pnext, *last;
284 struct sk_buff *list = skb_shinfo(f_frag)->frag_list; 285 struct sk_buff *list = skb_shinfo(f_frag)->frag_list;
@@ -297,11 +298,33 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff_head *qu
297 */ 298 */
298 if (last) 299 if (last)
299 last->next = pos; 300 last->next = pos;
300 else 301 else {
301 skb_shinfo(f_frag)->frag_list = pos; 302 if (skb_cloned(f_frag)) {
303 /* This is a cloned skb, we can't just modify
304 * the frag_list. We need a new skb to do that.
305 * Instead of calling skb_unshare(), we'll do it
306 * ourselves since we need to delay the free.
307 */
308 new = skb_copy(f_frag, GFP_ATOMIC);
309 if (!new)
310 return NULL; /* try again later */
311
312 new->sk = f_frag->sk;
313
314 skb_shinfo(new)->frag_list = pos;
315 } else
316 skb_shinfo(f_frag)->frag_list = pos;
317 }
302 318
303 /* Remove the first fragment from the reassembly queue. */ 319 /* Remove the first fragment from the reassembly queue. */
304 __skb_unlink(f_frag, queue); 320 __skb_unlink(f_frag, queue);
321
322 /* if we did unshare, then free the old skb and re-assign */
323 if (new) {
324 kfree_skb(f_frag);
325 f_frag = new;
326 }
327
305 while (pos) { 328 while (pos) {
306 329
307 pnext = pos->next; 330 pnext = pos->next;
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 56b3bed1108f..331c079f029b 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -200,7 +200,11 @@ input_file() {
200 print_mtime "$1" >> ${output} 200 print_mtime "$1" >> ${output}
201 cat "$1" >> ${output} 201 cat "$1" >> ${output}
202 else 202 else
203 grep ^file "$1" | cut -d ' ' -f 3 203 cat "$1" | while read type dir file perm ; do
204 if [ "$type" == "file" ]; then
205 echo "$file \\";
206 fi
207 done
204 fi 208 fi
205 elif [ -d "$1" ]; then 209 elif [ -d "$1" ]; then
206 dir_filelist "$1" 210 dir_filelist "$1"
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index a22cbedd3b3e..7f9d544f9b6c 100644
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -10,7 +10,10 @@
10# $4 - patchlevel 10# $4 - patchlevel
11 11
12 12
13cat << EOF 13test ! -r $2/Makefile -o -O $2/Makefile || exit 0
14echo " GEN $2/Makefile"
15
16cat << EOF > $2/Makefile
14# Automatically generated by $0: don't edit 17# Automatically generated by $0: don't edit
15 18
16VERSION = $3 19VERSION = $3
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index cd00e9f07589..6d04504b2fc1 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -487,14 +487,14 @@ static int strrcmp(const char *s, const char *sub)
487 * atsym =__param* 487 * atsym =__param*
488 * 488 *
489 * Pattern 2: 489 * Pattern 2:
490 * Many drivers utilise a *_driver container with references to 490 * Many drivers utilise a *driver container with references to
491 * add, remove, probe functions etc. 491 * add, remove, probe functions etc.
492 * These functions may often be marked __init and we do not want to 492 * These functions may often be marked __init and we do not want to
493 * warn here. 493 * warn here.
494 * the pattern is identified by: 494 * the pattern is identified by:
495 * tosec = .init.text | .exit.text | .init.data 495 * tosec = .init.text | .exit.text | .init.data
496 * fromsec = .data 496 * fromsec = .data
497 * atsym = *_driver, *_template, *_sht, *_ops, *_probe, *probe_one 497 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one
498 **/ 498 **/
499static int secref_whitelist(const char *tosec, const char *fromsec, 499static int secref_whitelist(const char *tosec, const char *fromsec,
500 const char *atsym) 500 const char *atsym)
@@ -502,7 +502,7 @@ static int secref_whitelist(const char *tosec, const char *fromsec,
502 int f1 = 1, f2 = 1; 502 int f1 = 1, f2 = 1;
503 const char **s; 503 const char **s;
504 const char *pat2sym[] = { 504 const char *pat2sym[] = {
505 "_driver", 505 "driver",
506 "_template", /* scsi uses *_template a lot */ 506 "_template", /* scsi uses *_template a lot */
507 "_sht", /* scsi also used *_sht to some extent */ 507 "_sht", /* scsi also used *_sht to some extent */
508 "_ops", 508 "_ops",
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 3cf368a16448..d987048d3f33 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -101,6 +101,8 @@ static int __init selinux_enabled_setup(char *str)
101 return 1; 101 return 1;
102} 102}
103__setup("selinux=", selinux_enabled_setup); 103__setup("selinux=", selinux_enabled_setup);
104#else
105int selinux_enabled = 1;
104#endif 106#endif
105 107
106/* Original (dummy) security module. */ 108/* Original (dummy) security module. */
@@ -4535,6 +4537,7 @@ int selinux_disable(void)
4535 printk(KERN_INFO "SELinux: Disabled at runtime.\n"); 4537 printk(KERN_INFO "SELinux: Disabled at runtime.\n");
4536 4538
4537 selinux_disabled = 1; 4539 selinux_disabled = 1;
4540 selinux_enabled = 0;
4538 4541
4539 /* Reset security_ops to the secondary module, dummy or capability. */ 4542 /* Reset security_ops to the secondary module, dummy or capability. */
4540 security_ops = secondary_ops; 4543 security_ops = secondary_ops;
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index 5f016c98056f..063af47bb231 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -29,12 +29,7 @@
29#define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE 29#define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE
30#define POLICYDB_VERSION_MAX POLICYDB_VERSION_AVTAB 30#define POLICYDB_VERSION_MAX POLICYDB_VERSION_AVTAB
31 31
32#ifdef CONFIG_SECURITY_SELINUX_BOOTPARAM
33extern int selinux_enabled; 32extern int selinux_enabled;
34#else
35#define selinux_enabled 1
36#endif
37
38extern int selinux_mls_enabled; 33extern int selinux_mls_enabled;
39 34
40int security_load_policy(void * data, size_t len); 35int security_load_policy(void * data, size_t len);
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 7177e98df7f3..c284dbb8b8c0 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -594,6 +594,10 @@ int security_sid_to_context(u32 sid, char **scontext, u32 *scontext_len)
594 594
595 *scontext_len = strlen(initial_sid_to_string[sid]) + 1; 595 *scontext_len = strlen(initial_sid_to_string[sid]) + 1;
596 scontextp = kmalloc(*scontext_len,GFP_ATOMIC); 596 scontextp = kmalloc(*scontext_len,GFP_ATOMIC);
597 if (!scontextp) {
598 rc = -ENOMEM;
599 goto out;
600 }
597 strcpy(scontextp, initial_sid_to_string[sid]); 601 strcpy(scontextp, initial_sid_to_string[sid]);
598 *scontext = scontextp; 602 *scontext = scontextp;
599 goto out; 603 goto out;